libxalan2-java-2.7.1/0000755000175000017500000000000010737235566013316 5ustar mkochmkochlibxalan2-java-2.7.1/build.sh0000644000175000017500000000424610721374040014737 0ustar mkochmkoch#!/bin/sh # #========================================================================= # Copyright 2004 The Apache Software Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #========================================================================= # # Name: build.sh Build Xalan-J 2.x using Ant # Author: Shane Curcuru # Alternatively, you can just call "ant" echo "Xalan-J 2.x Build" echo "-------------" _JAVACMD=$JAVA_HOME/bin/java if [ "$JAVA_HOME" = "" ] ; then echo "Warning: JAVA_HOME environment variable is not set." _JAVACMD=java fi # Default locations of jars we depend on to run Ant on our build.xml file if [ "$ANT_HOME" = "" ] ; then ANT_HOME=. fi if [ "$ANT_JAR" = "" ] ; then ANT_JAR=./tools/ant.jar fi if [ "$PARSER_JAR" = "" ] ; then PARSER_JAR=./lib/xercesImpl.jar fi if [ "$XML_APIS_JAR" = "" ] ; then XML_APIS_JAR=./lib/xml-apis.jar fi # Use _underscore prefix to not conflict with user's settings # Default to UNIX-style pathing CLPATHSEP=: # if we're on a Windows box make it ; uname | grep WIN && CLPATHSEP=\; _CLASSPATH="$ANT_JAR${CLPATHSEP}$XML_APIS_JAR${CLPATHSEP}$PARSER_JAR${CLPATHSEP}$CLASSPATH" # Attempt to automatically add system classes to _CLASSPATH if [ -f $JAVA_HOME/lib/tools.jar ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/tools.jar fi if [ -f $JAVA_HOME/lib/classes.zip ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/classes.zip fi echo "Starting Ant with targets: $@" echo " ...with classpath: $_CLASSPATH" "$_JAVACMD" $JAVA_OPTS -Dant.home=$ANT_HOME -classpath "$_CLASSPATH" org.apache.tools.ant.Main $@ libxalan2-java-2.7.1/lib/0000755000175000017500000000000010736401476014056 5ustar mkochmkochlibxalan2-java-2.7.1/lib/runtime.jar0000644000175000017500000001721410736401476016244 0ustar mkochmkochPK-^. META-INF/PKPK-^.META-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu )hx:*8%jrrPK=>PKV. java_cup/runtime/lr_parser.class: xTw'LYB2I"HJa K0&I20A *VT JڪսZjkޛLs==sOrV*ŸT * >T]SSN _ _ ?7*|w*|DVKG8LU'"*Tq*fMQ*x*Tl3g:3V֌͸̌+̸Ҍk̸ڌx~L` 7T ps-7= p'( v3ʍý 0Ý<}[ 6nH x8xx/2M7rs{/~= =OJb9? s˺<Ȋ?У p6FiF9ЯyI淬oz=\9ͳܼ `6UbM~ u`LP7&nZpcqjg3PX -nXCbB4[gL[E b~31ق\1[p.ڙv`0^X"[ʴ`b(-XgYqYd gcױpytxYV6 yϊ a70 jg10Ղxnk10ςVn-8^^kK٘KvDB-Csm3|mW]m`+LU5K٦T[-Ce6km B58ƠOI&t\[e0jm 6Fz!BX0Q:M~7tx>EE9iht:[4Bv*Fؒ ζʼ:ѹYnP8>/2rmK\PyȋA_[dbt;6y^Qqw9نX.wS0/(uw{ڠ$LEܘ3 8S|ka3uSiBkB^me⤥3F^rBA7>ސǃc`Az,%/%\R;#њfMP.qXZ9c^[ӌ-lXj Np(ҲP[? []ŵ'A5Ѫ)/ժZ4S^uu~1ꓽ|nIGXܼ꓅zzO9nOݩէq|z,v\ U p N>:7f/qz }d7DIaZhX4"o m;u(0QH1PKVV`r~3L>Wp6 FKm~z/OA^ 3|NrFgsxB4yH7S'cR滽Pk˿᛬j#59d>t}+^D> g]֩|NԤƐ׮J막z'%z#]IY\ऋ&F[/D[74ݟ:>߻ f+G:hKm7بI&^ۼy!BіRDgYptdz/ ?$:] z#Q+p4xùmt{|uFLx(IN-=DW83Y]W+b0WTh(7ugD돔BU0Kk>]O'M]ڰ y1$gka Q>j au {KkjؓBe 9<==+u#Biqf :; D!o_piw"t KX$LrqG_Л͔_eP\AicI}GÓ~V܄:҃,1-AQ7ά69M$ѓ4_@_J>τz Ӛ›sCѧ¾rH\ю9O i]k3$m#AjQ kDk>or(@s @ =9S 1F0K~h==HZODb~>x#14 HL Ga^ WqZAR?B<f6;*O 6=Mh/!mWS u2+@\ v=|J'Ha" A`2F+sP&W?шXCyA'Ճc%/f*H`  ۆnXnXnn54pӿ_ݰ[jE#1=p1wGrBBul_۲KۛNRH: SWXG':񅿆#읖y+Ld7WjAAjjzv9=3(vî8yrRR*#YRX:amI0a)`DZh+2ZW$H2Fqfa&[J$ #~QN83s/i' {j$TuBrT>[;OhdOPP< 0R<6"/Cx &7`x ?K k{f\&N~ .>_q%<'] |Eߊ#&S(X\/RЩ$WJ&F%oQAŊ(C񈒎ϊed[JƏ_(Ŏ9l=ssqZ8SãV3Eeֳdto+."'_J":ͱ3HD~jĮ@!Vr>7ʌH;l(ޮ1#Nphk VD ¶,[fYzp8%]%`FUG)]1"~n)^X#(B:aLL&;1+bP8)_1e43'Vtu<;nH2uO2]x:bf{Ё1Z/zFH,6C b;LN>)>0TU+wQSxI\qeg"j# i9?n"ԅciD4Fe:Ⱔ";k?TIM;aR* NG:yt4.M-% I䚒`IkJe'@LwGSf]Iuf*>xC0 @>B1hx PO2 4oO|P e~57+%ao@3q.|-f?tq<+cXgR,B,Q5b։ո"r'_֌`ZNd&vc Ak[s#O{) I[~L݉']\ %\%K>[䍸Mb|wG*ʘjk/WS ,ǡʞi=\ w -DnU^D HUބ[TEʻ0Iy)F6M䟃~ ;T$TBa<-he2<˃`' #k&&7A2^n-02PEksp+, D=4c8! (m9 笰¼'bm`# s7DΨ]Jrqb:MSsZt`R~H")(MP|sko-(36<πRQNp!('IjE0rgRNΠྒྷ_ivPl6>m b j[ұ2ՃWѶ_IRK(`EzaAɞA9r/2ey)vyz*tUZ;$;"oZ]_ELӒ]"kor.69¯84#3 ShISo|4ŢvY"j HH6\+Ȧ*d!QBC,Vy6l@;d9\+MQ)gr&%*x7PV'r.E.*ݬ]|Io{$~^kg*R* Ȳ )ӡt4 l<8$3dȡkR2x8)]-PpL:TLW͔"8= B,`+_"LY%X%_|W);i:qAq+| =7ĜD pq+!Dt PK[R)d&PKV.java_cup/runtime/Scanner.classeK @ -7Ѕ.EWEu_cvԩԫJLta $$mX]<k0 E*<8JT\%&"U)i4Ley4"Y~Y)䇷< a)I0?:E>?@h ->V{oPKPKV.java_cup/runtime/Symbol.classuSkoQ=w7[@ ںت4D]Xp^Yv4hGgR$;{Ι;~=TB8A@B2R iі2dy!G9 + bxʰˠ*x )xPW1#'TPƞئgY-\ ŕ~:z]9kjZZ'iͯNYLC`\ G?>Փ*VrN@Z/I gwiԍ)70YD=4CGwxWu~gD-J\ܟ d=ꚥפ򐇣@OCY7Fu$_MVQ$x~?4ʙ^av`'e B4F!1|tE>'S陀_̫BN2)m&ײc,i1"ΨK12q|l./&GrvY{ۈS#9gBskn&ti='wT\@o2I ?%K7PnzxpV PK(CPKV.*java_cup/runtime/virtual_parse_stack.classuT]oT=7w]hڄP7鮷BGIJlYJDgsٺxm㽎>$$xByKf# ďBqIk>qo᪍O9Vǻ6>g]\ȕ5RkeS X7}TIrG-{^RtܸKk~Zdz{IG&L(uĘ4dr[ KȨ(.r݉BmrhI: PKQ4ϕ@Q-CuC P-{AJ!Q&֒Pos/Be D8hq5ICe5#52c`K8SDш$b+/KpBEG˥$eGм$P 9&1]Az}B#P Xۭla݁[ps[w|BxȺtpju`ɏ` c8ILʨmAƗ, SLt1xvOsC1B3+xlksn uw6W[=j)NlX'W8E%2<)[wjR̨1=ӪOkcVrA&I{G O$$/$f-d-h!FE*vxqn3~ܣDD5c"-ՌhksPKJePK-^. META-INF/PK-^.=>=META-INF/MANIFEST.MFPKV.[R)d& java_cup/runtime/lr_parser.classPKV.njava_cup/runtime/Scanner.classPKV.(Cqjava_cup/runtime/Symbol.classPKV.Je*java_cup/runtime/virtual_parse_stack.classPKlibxalan2-java-2.7.1/tools/0000755000175000017500000000000010736163463014451 5ustar mkochmkochlibxalan2-java-2.7.1/tools/JLex.jar0000644000175000017500000015251310736163463016020 0ustar mkochmkochPK~ ) META-INF/PKPK~ )META-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMu *h)f&W+x%irrPKDDPK~ )JLex/CAccept.classJQƿdfM?1 MEBH)"L&NHf$VZ FR `gh{T[7|̏_=1 4#F'L><`嫣s;?00{P% ;Ί.MDPK[b9PK~ )JLex/CAcceptAnchor.classMOMK@}cnӤox@"*Tf]5MJhſ_C̛>?`]@(*\Lex(*h;Ť챩c /F^9a f5C\g as v '9azzPK4ǰ ^PK~ )JLex/CAlloc.classuSOSa P@qåbW,.@KDԔW$xbA6m=/&3} M:o7_svcDF22d쓱_eP(i'VF.XǦE]F62jc§@fmW [lSqQT1^!QqM*9$pHEخbgE/ӁvB9fXB&G.`>w\ .Ņs\Rդ:Mif ;G3A~ߓ$,N$Q f\U>,F8[8 jUvG5USCX50't$J[>d*9ۮb"{8OPub463ZFOKfR5zup0bOlQAiLP_4CVZZ yᐉ+K:t? %7:%!nCAq0+^Φ,l#ΡeV?BTT,ГdHeGzYԕԢT~` a)m$]AJ꠯Xh{T{j`Y#EK|_ʐ߷f Mp 6ȄY8I, 4rGFz EFB\Qo51yL*4M)2嵹>RT0#rXNy x:3s 0.^cJe+-w.#'|ITm8PK4&f)PK~ )JLex/CBunch.class=PN04mh @HP k\J8TH> <󖱟=_({&L̛X0hbq&TL*QǴM,¬m;XUA8LOqW0+ʵ'^y <eJ?=o <; 1Hyd(e Uy2,w4tgf-qB2H5hgI .ROjqGmGrRz(=/l˨+^}$NʰvG7d87Y'df2OfF%906BEAYG7}nE`F1cHQ52ԍg,/X:: XPK@scPK~ )JLex/CDTrans.classEPN@=KRET _| KYl oHL(uH9{fvf3_аCcQǒe+:6a@I,RVlDi[X5lU,,/2jM<pJJ e%ʾ\НUOѻ}z-lj3J߰cݠ`\)G UyOOQqU"rGCS*Q|(^4 ۍt^H[g1mHH; 7-*`eig!C\<!#`pX4p~nb#1DfCmm^| 5jUEԺDҺBںƂU i /PK{lPK~ )JLex/CDfa.classMPN@=Cd(4i* $PEnܱ;~ib#~~D[sιyz|Łe +V-Yةb5Ja#,CaaAbA K\}l; o TZ{73ɣ0 o8p;}=t'F%{@Uw3:ꯉn@섉,b_kGsW]aԾAj/Tpt4nS`Tr۾4"0{j,Ojػ5i*Rc/VV^Sozsl,:d"! K&{KndhnntX ^$ cҌI2CXXM38տ w`q–jҠ.hM] lQ6_PK|FPK~ )JLex/CEmit.class{ |TEwuL'+!@p$@p"b!L@2']uk]/ oPxz끷}^~&3߮duOadU>,#􀤏JKOJOKYIyI_EI_eI_UI_.)[mIߑ]Iߓ}I?CI?_~,'~*g~.~)W~-7~+%N%AH?IH$ TH`!#+AJH*4 %tUB7 %KȐCBzI-!KB }%-#$$ 0P % 0TB\ y%H(0LBFH)X( GJ-a$-a I(0^ %L0YB)*$TJ*a* H.afI-X I#ay0_ P %,P#j%(/a: K$$KX*ABP2 %4Jh,$  -Z%R* %,aI8E©$4 K8Cz gJ8KΑg J$lp $\(" KK$M¥6JL& KB•pEµp$(a$, JMp$<*1 KxB“HD§>/$|)~&H6 z5/ { /酷2I/KT/ei^˺xYW/JTaRi:(ҒBSh4Jڪ U]*EV+rjFSTJOMRQ4ENW E+r"g)r"(Tړۉfҿ(tj*\)r"UEȥlT꥛\+RZ͊\EU:EWEnTd"7)r-jѷmܮw(t"w)M]jE;Sh+vSi7zB(Uݫ^e{Oٯ-vx@F=Kg`"=4x^I4xQP_ }٫ȃ<i#ܓ?~Q=!$(BE"11JcaGKmi,Oc=4MHoRU~8+HU=B |JoRhBCPB)x *4LWpU鈴Zؑ (%=ZE lOcNw+r"x MThj媃)GX=U D(˔իkH8pamEmլysfMQXol R2QkDkuuhmK |{8M@hIn^<;";kn%6.V=CGaIE! (Κ5#yy58z1kISmP3lנhH:XSW85 TΤ0^̖5#-J-we8|n4 -U+M73цaJX-Ѣ-Z=wD. - RMiY5r]ODE"ᕾP`BoU:U-jcG%Pskh`#W7M5pc8'S0R7{gYp]s:jQԨsXId )eP0Ŕ}$D۵sMWQjNmF3EHT~(NjD#PMI:vTհG3Q"UYP,u2KW7CjyƑ\!XssJr5hLP* u6+S+ӪO~_=2!ZHO >B+hYgZc@wK% ~W̮4;j-f73؈x`wy A )N'v^TZֹla]*ee_=jY`20Gy'wp@Uz8=kGb`n^k5PR[)#Jv\9-퀪E+iO :ػ}FM-^ogd܀^۵!0 E}LZ'3,tr9B99V o%ǥ66Z!V6RtW11F0,Ta 5CGlc0[ǻh>qSqV]QmM뾰UdKIY7!Wex'5#>;>XWu]3S΍";*0O}Kw#vXˁ(茡(lk4amxYOvҙFןu2{u/ gekh&GXyۗ;VͪW5I}j(=9iZL ,nv5Wm[K;J?1}nŋێu7sҼi4R"HTis2;гoQT;7oc֨j3g=do]ta`{^9BB l VvR|u 3)\Դ[C啑p}>ܑTpNAj:.aoݣDsocf%8 ,./+M?y}8eWkgfobg/2f+zmdĻX?y#+XdnG}ؿ\ x[>|q`i0d;K4ct tt;ʹij̸&WVSCt4o9$m1+C Q\9ӧ_n!wL>vb@ Ǟ7Nut_!ฅ>}SW ~ /h *?>sUG8Mo~6W47 =;7opsg/^S, 5l^jm D*.Ĺ-V߆PUInwJu3*y3X5|ns^O "(vMRYNw):S; d9NPȭֶbY ɭT)G ?Эf{jmZ˥ |09|*- QՍz4rD=f͞U1YmiΥp1sí@eP37je+z$wN N~gZSt\.W Ϊws37 "hSTu٫${*0w֩֩Ԍ%zSZ@cs bR{kQkz*ڰ\ص23 Tؑfd$\k)޳Xs{&x]AMjƏ?KIB/Ƶy d5d-x` RUARj[0hƍ:N5orWRnvV5f=# g`6of8'&aW1YǖDZVe,-6M{uj߾nL꡻]sO'=heLX7 TmH#=N5bMi~=M-:awwn`{RCث6ծ^>J&ߎi;Dj &e@T{ƐB&@rO)WU6}R_qѰ*ޭ8Y !^O?wLWG(bN$'B22# !2ߐJT~}քz.PIL:Ƴd]﷋=@Euj{i‚ix7A.*CҿGvv:H,I,蒤gvGZ_C1'xIgeg 9z&#=%dTzHgc5}{ ߀ x hs }ڧle~K@q.א4=?g0۷=b~w:I5ɰ6w SUxxgˠu,anC f<6|ߊ3j 3 Xen3F_oR;E"1M\ml6vSyŨ_f'iOp \pb,tSH8z gp6 g2%5 -p!\J^  WQ WTL3Сp7бNt΃;i5.4 ;jMχFC&n6 Oix7Q6X>`ob}o·,c aGV?)X?(n-cqvdag0/;Iv)KeYuaY7ugiևg߲#O".;o:m>0}(^O8}ZK0Ǵywk '4;l?qEc;"hxgpgs].\o[ Pc i@h1W1.v7b0y#"XdPylcǘcot&PfD 6:b@= m@W:0؀Ad*MuK5`>8~ f@ ='.nwcw;iDKyX@PTb9y.ZrXLNul+rmb/gD";"B>-' ZXA{fWLut8q:q&Τlj lZ'ΡĹEG׊ Lq>=_\@7 5b#Ylt>,6G5q,wg=y,_{Aq/hߊ/ xRG<zx F'`x *0K< ijpxy`x֋W`x .f$>mK#}^ÛP_;+PAr<eF{RxO'6ӅzŞl'E==:O&;ӓ].3!tLws%>$#IW|߳zfQ_0{_Nn8 vPZ emNڌW%+"nϼtM?o&CIGQLd:_AJRe"Q' | Wuz3 5FI))?Qҷ&zYfzSN;\qN eb /& O$>YyXƧ^!Jq&*F^%Ljt{L0%KX?N|爯\#?O_'xjO_kb?GRrDT:yo2mkxwvZϨ'FNlFl,ơ'l>7_&IjPүr0ExgzD-Ư14ƿ>_ڒ4%[FéݛZ"ٸok&آEEShn9z{5j~M[ȲݴXs[v]히%"ڙ9f[;-AA'YrQY)hm]y5dRM vf$pKci#ᗑb KW*|$]Mp#-b~@nfo&o%ɣX>|9!KF>h0",~ZX?'i?ECiʟkst=gez-_>}A Co d` 0+A8˯虬o^A.;HM-`m)%W>f6Ƴcc[]Lo)3њ7=zY"S-Gc:D?[򭒨l%}2yO7 lL9g]tLד2B%)O>ºMEUʉJKz/wXDp>l%b؀M_:'vP"ܭ _ ~%RP]#)%QsUOѿ"{̯91f ؑQ}숃G֫~vlMVT4L1^38!l9ưgkH Ż[ɤl׋1 Y(+jRMTܳCҜb}~ۖ_o1VaН,%dΐIA/2 ze9'|d 0,$DVl- !@&#w@Y("/$v ɏJ (]`<i/L@9-"ZS, LYt9!x&:Q`Ow̋- $)Jņn8]! \A\U:,'FCB_'i қ$m2ҏ_PK:"OPK~ )JLex/CError.class}Vs>±uwN,qBA vp 4aaڬ!ڻRI6%-O"6 }vI0 A$d$d% JI[ 4  =ɨ)F-F>6ˌFu}ѳn060zF/2zˌ~RRRGTz]SP,YBJ`^Bdz =!9贄J9z~jޑ)F'J>rom֊[{Tɩ3 O=i6EbQZlNp3w8aqhuh_5gk@{Rv꽉1u<':'yM 7)]!*^q/:ݎ"- e̋'j56.W3/ HKP|L 1:mVBiyq>o=/VB5^k.-ĺbTJ9_ Kfjͅ$.y*Oe3U^rbUW؃U+Wgh*l5y CHb@6ή]Wq80F]flaL)ý%uT/vϷv F߁l".\P'^cjBgr?9)~x#N])~!R\? |=3ςS|xS|7.R|)Oqb)> ~6]/?wp fBEp{~xGZKתڀ~USY16<T~0~'pP? 釀C4p8O5OG>nG!? pkTWiݐ>4ih!~G hat'z r^3-@B%eTS@щk*>VqGŨ*UŲxom?p^\`.300fpl?b{>u 75L SPC k'0{0!)"fא{X[Ɛ #/j|αMk5!#spd)"VOoV㳆^4{_˒^ylıukJY8 7cmZ3BvZ4N$V-'d+ F9&Г]S)c#j tIMm/8ftL˘nTV {^_)S`fFEnZx[@NUv09Z̨W JnԊj8\4^E'q1n( YjRx4|%oTKy kVf&o%_v[Ӛ  75-!"eS TF}mE/| ]N5ۣϝN=u/]yz>zr>tȷݕ-Iwޕt]ВWqw7l: HEڗTW=hP-xN)?toWۛ¡=x3z@괏R>GW6Nv+.dOF 5Op+xO-(mlT9 %8#aPN!JLcX>Ę]Â\BN.cY~u|'^\Ŧ4_e*uKTC;7PKWGWPK~ )JLex/CLexGen.class||eTd>\#d-2ϓdOtϒlRϑ 2]w.-2OeAe~2Q?&e̟S2Z/e-od,1Pdv^iyWy\;g|/Ev~/C;vj!;veGhK9rMy_{$Bܫ仇׉A&'&"rķ{wG}}@܇}D ӄƧ4>q(4rh/ #4D(_F1}K;[,;N 'h8 4NcߒwJra?Aovĝ8iJOD~& _FvD$rE Qĝ</q MND " QD;HK Ҍt͉K$$҂$"QIq!%#NQ$&iIRU-!#]{2@yĥIG>!.H:L !ϯv]RЍ_. ҝ/s=!LrorR^$&!9~zП.F.[< JL$JdA"DFRrxC#Qa,!!Lia{$a*Owp8"Aq:IA0hCcR=—ݥD)1>xRTRUԖהNIKcS!Rj ʫKjJ*Sj fdJQ0 eXVYPS2fPzvIy :h3R,(6$ T& ke)’Y%`WnMAMjSRP]]QXVVC|;FWJŬb*JUmil>SRs ;.鸬 SR"c`jfWTby!% җ +z&YsgI) R*%2RJ()a4(,aA6))EY%f0ʒv`f¥vd Gdw4ȡ5ʭ, , ^A]J gw5@acunMjoH][SR%>F :+q A-`6*BS9YMΚc`f!7V3 (C%H5!⇗WƭB9 4Y! jnrILͱ] RRe4FXU0s k#lMKCSzք&TF\؄XƹxP2hcNfuN-,(/ǥ4P:, k+;WWltu#>u\ؑsdwz+.N) ”RS\PfjyT c2Uho\*NR 2f3s ?Jd;ubХSTytmR.#vԟ]\ԘXXQѽKZnN!lKcq9~M& ;|rSC 3n mPAY QYƏ K!wƏE+_Î[Kh5Mb9*(fBAi--Uڅ h T*8d; {?jH㱂rf;nQ#dϲB֨\춬cG56ƹwƊ@9nB*) M65F_Fg!6 .t.)%2b|IFȀ؏3|UD#r QcyL1,J} gة8`NwlZKZV{9.e6fӊa߰SC3yaP7EkRQU@3;FVQ6H1Õݨ206Q E5XOc?9e3Uh R-w@AYFzkaScVP]lG'5MVƱ8,@:ndAIX S<.g.\洋f28u*`wñf{RPm[>N&2E#wfnlfE)9߶@bk+O sDTBl>'N( QEik47f|)E%@R~qsF)aB0aqMȷ:B1[mZ[߰6UFD⫪pT̡ V<44ÊPE&cLql@,3EL%VpNS)gEUbUfO#u8 Qq A7BL2bgk7'N+Y2W‚js4LE WR_XXjj+hL ƪcbdrEj"ǠUZ0A2’"Dm3xyD1cIg׹;~t։I!O#w6#X}knc̫*40dRZ03Pj-e@+$m(ˍ~ьB1BW X`6x1 AL7öEd0ΎWԖެB-U\Rhlx8VV,(cJ*˯#VG^-<ƵC̒5YHaCDXcR k0Xd3Ffl p^^,Zcik"!<8cBz;+;%PXgIԎ!TИ#ÜЍR&'y+qaWTV !ˍ =&1[JS)`n:U:1 g1jsU1wjj*0䚊Y)jtZjE`4NIcQa7VQ *j?o20_e@~fW؝/3+_j`_~ChT>~G,IA6}lD$ۈIOcAtK>c/ea,lga [eaz,ZlaK /0Bn`a VygK?^/7c\^3Q#L7 u6M iRܗfi:ؔ&4'Ӝg<~|'9kٜ:EB*[UQdPBd@49&@-WQE0Jhv`UBVef*5 紑i7xrwQ-FSi¥0JYH1j%F +F] -Mk挋)\9Ԙx8`;Oȣ(0<DfQ!k!Kµ0BY-TRp{T4,vFVm1dT"\ZQѦ1Q]]Nc-¸[hkX=Zl5<ՠ¨<ӟ1gҜb,oĨ1b1F @a+L켨,D V6`.(KQ yAy|L[ 99Ϩ/wMyM?{+RAFaCo3dt4gV3kSQBUXO+kD~Kҷ]up6m+ bv!aM6&F 2D+v|.#l%1mpgKJʒ" <_(^nc蜼 9mU'pyATDS$hR!Y6J<*K "vGDr \81 qe9WVDɈS 0 qbr3Un#.Ae\[;NNĵ7">AG{)^؊q'Ⳉ_Tˈ{_C܇&;8lO!F (1O DgDO#nC܁ 9#5(M"53DYm+>BC܎ Ⳉϫ_A܃:>j?BycjxRO#+gϪz5]j'ID#!6S;K.Dы#RH۫Hjw3 j/?AC~R_8qdiER>L"و%e F,E\ %K,W ވx3mAO+mrHJ[]]^y{R\AW' Wg錫n6j\lmۻ.upp]csUnt]^t]l5kk=5>ebq fu}+k h1/\ .//T a1x#$njL@>bÚLOi?D;X^0J6/mAG 08.,s#xMNw 1fAu](V-0,&szg:T~S mpJR/ U:£ 4ᴸp?Et٧YJMGdoA뫡)T]B U(01XQ4 ?.t7~ 8Ѡc Y pp>&ꅐA> s`^ +2M{0>6sA}<>>/pR_r`Xg}H og;Dn6G_lm׳0{I}oagGKo3ҟ5LƧc绨\h9.F1r-TlP_yӝdzp6B}ѭ}-bt#}Ahg}n5o7Jڱ$&(w ,ٿviCzd B6UʺRf7ICo_8(dZ иtt7*:p7.N$u?mb'Z7=nzB[d"ņݱyDeo6;xnj YFߟ%i21rlLMpC[ -y\O)OOiOqޔ<`5Lٞ 6y7uǽR?ܗzQ8xyFfRw!,= ygb幂,=42^乖Wx/3./Ӟ)e2MNj[ ոՀGɸ \Vƚ8l&M*} Y&^M3Cȶ 6 zU%TjƯn ƣQwelb:S]FS )%!7dk eݨ_rDn)Ceb* 1ãx3=2&rT-덾^/wy!o{#yÁ x6ߣ = |[aFvBoL=%0}/=U{V7!L{|~} }O}ߗ+w }F ? ;*}߲/}Ǯ}g}?${wA|#;co_kS|gyw/Ё_xmm]q=?;z߮+Y_׽|wu?LO-I=D`ӽSt=C\k1)~ q"tUZ TIZ)䴭*!u}4S%y].v#84i/8E/WUDr!cc, ۀ6C0î{Ia?gj*Mww01KBA(ĭ,//w7O\]puRFGj1zŶIw o JKh-Ni]0z)rQR.F%0Z9&(]!O3L(R JX\ ˕Ap2V)Yp2nS][ K}%) e,| eL?Ɍ)SLg͔|Tf2R,^RKYwe*}PPj4P2e>Q_yu,ue=glÜ~0 ;uvuxsy ;Ó.dqduE~5q)AoK㵑hO7z3~c}W&o/J[:E;LJ[MhFe'׭NrL,f/z(L<: 'AJbV%CWYYK{^Tnk rlerS%y5dE>AXd-x^E=`s?ZIv[?nC{-?ؓ3l?9v_ώ&;؏ɜ+Y̹-Yxd''ydL8N>3U*"͗%{d/߈@?Onɷ'[גSW:9H'w; 2arcj7\RsC. /JNB fɺ1'F(M8[Y *pd4Ml>56S|{񑹶uBg-ȭm(`>A1]}6㿲\2VxÜnit5ɜfy|12'ch} vF&~33q_^K|f+ceą?ffnص"o^Gv`p쪌](Ϟi]Fxxqo#0(G~jO{;p]]Y~_oܯ=uӽI~%bY;l s&`3rAv)}=>v[ȿ}}rgOw=?><+g:/,}_Bo $2)=lޢծ^q+[>m݌n0d^h_kHo~goTncunIw|LT+1_as6ֵ! wv(h;Ri~xXqx^3IQ'C̗_X(DgbnkE@FnM zGcꙢ@d5 YY>v\7^MX)"{v] Ы u67jq=yQhp]e9h>ڐFUψk{y+HՏ{{h8$`Ҽ}/ , `7<;ʼc; o@y7N-|x;΂Ro V3;9˻i+XkUx.Zzeyc׳,r6̻]⽙{Wv{'Jv^vw-轏=]vz׳g {}yW#w)W nn.vʻwü{dގ8!g&$)kzBwg7ro&q4 _K0?*Щɯ^eڲc?}}h4pEoٰBmq|NqIN0 zO@{q7x'§> Nd5c欙XOeQKd|6מ-u`+oud}q_{ׅ}`Ip-'7߅L}4^D`1`ׇ߲DeOu"zq\_n Wܮ@1pk+꠷k wmIg`Y(vUW`k/,u\:~x&̳՛&+lg͠tCT=$g 0 Jo$l9rH !χ|@T]T O|x*(UqkDQ|a=d4ˡX~ !!c|k}cwNMP ?Q+ oQED;nF>'>$|`P%ѹFs ">(\ XPH4j_lM]4Z ;O4r3&?|U)ĶV="|N$'# ψjSDAbQ~g"[$ֿEA%mbX%\AVQ5H_v+Ώm 1퍊Y ?D0l(DAB!t+DJ(DJcog F8t0HcGg&ixξehm8^'aݟg*)P'h"$HS:`:Ʃ0qZl(UaZ׫pZkr؂Z *xQj-|·"J]ե/8^כk]ū+2FRݠnQoaUnݧƂz'۩ŞA e^Gx8wOp7էxGi]{xu;H;`~ ƨinP_%ꋼ2%^".V_Wk{ &unu?G=7oM;<R㏣NV?/Ճmc>R?៨/C+szS'Q?zTկDV >;F=.tPO?Q]=%SO aO(ga4&yOa&b@=#g P 5.G՚(ܤIj&ܫ&-N_͚Cxu۴KZ_s 4ExGSj|7.|ZRDQk-:6bNԴ[ y_Kۢ.2~Z'b8T;_unHq&k=B-S˵ Z8uk+Z?:RHAX uFm6X|TjC:҆qv-F6J<Oicğ\OmxF/&DɦJmѦH)T6CjH]R7- fIRXH+.[+&ie \*ԪV-"Vh5R6OZ͗j +ҕ"Zݠ]!ݭ])זHe5ǵkNmRڭ =(A~頶JBU:)}%@<-#+Jzmͦcshmmͯok=dkm"k:kzh2m'l}'mQ7Ljm3"mmb2y|Eb%˶kPR{vǶ^kۤ=mA|\{m]n==ۯ}h;}dB;h;}l^v\vJvZ;dugv=^BюؽkѾӾ#v֎ۻjhi?/~gEȨʜoc?E47Pa6x`Ӭ? tFf^º5،fztN1SfbZ-n4w{BG.t0 0S&wg [Vwxpw!w|D2nPKj9pPK~ )JLex/CMakeNfa.classW x\UOvdtۦmJi6i1@;i2Iv{n "XP)oR< `MXEQ" *>PP̽w_m3ߗ93sfyO~a8P/f(|QyoJxL[G%w$$xJoKQOxG/:`") |Clv[X.Ȼ];n7]ļO2v1.qCSR]L~.ge\J=$rN\׺1 @<( ,|#pc73o+cy0Ls ] F:xKܭeܡ|Wk 8uܫ 7q3u{t?.dc :y.Gt!E$" \xNօOt/t(&SBǗtQB.0 / .q.*p.&R bdrKLaJ t1b [ Tu2LY+5V, <,;H|`$A<_L$H`݉mәJDb[gpִdlbeFML+[6 >I묅ljVdm}Cˍ<5B|e/5KkcFy1Hc̨ɷZgp\ss/_|F]H܌F^dͦ+H,ZHil^& ZH%6ѺzuN$K._Q6eXh[jM$,e*k)եEw!w6Z=;= *կG=ݦ'T'ڝQ qrv/RWMY~9PyEbFG_H vP`}Vj"9P^R#U&XyuTqN= cْP<ڛ$puKe>QPUl:G0&a=FԈQ4P0Iz29]T&2`o 3L $rd,#P0ҩa\0,%$Դ _I$SH,@6[9Onf"6#2H"ΕŚ rkm>9I'~Z)#k0opӥnGܲh ԗHP$~ @8ƒX(CjрJF]ph 5Ova=.<~]J& 23+Ҵ3vY4PcIճw@sAzI󁑞-Y3EѬ;i$]mtFDU6f?t:,g<Ўl1qڋ

Qol1=fҝ:A _z z.׏5ɵB:{͹xm_PW>|S䋨/T2p| ha ΕF:$C-wh}٘{^O@Y/rO.g\gg#_OmN: eb)3X EuPWéç6d|* @Ъ]ua Pmة"ځkU 78nSP+ bC?w75j=]l$ttƻlb^G;+i pcO|¹?iM>5T T#bl&|R%j Zd'ѪѺU݊G:YǼ:oQ]˙^4se?6O#g9QLmr:]C(t\i%|.Klyy ͏fQ浐{:A ShLDQecQs(fJ}yl)ȏ\TŘ-(b\Np=vz, ""&a\=<7 Wn>Z[pTCمd0ޑpn1Qn61e?{LwڐBGsU~3ө[;|Ά4N)|Ϊ}=\3r*4LUI!#Ϛ^Ig֊41`_ٽpi_GeڭdaJ>UܻCAM.mM>FWCgY*DVXE9;&ҙJ'eRDMr8 Xt;W:@"sT[\#8>WXI=(%/U,Au7AH}&ʛ1ScKv'.p w&ybX~!<%r?*m &-(J<`'8lάz.?A]Akk0E*>=YC=3i/RQ:Qܞh<.AHifcHlzs2([9x['14C9Xẖ24ȪAT&(WHY)UXE$49rxZTF ZYakIc.87 a2@γbc[F?KͮPz&Qn& ߀mO{XD<PwaԽKأ~ܪ~aLa|W:^QGZQouDh1Q*ouX'' }qج~,z"Wgeq$!S[h:OGq^6GzO`R'g;!L$O4O7o#XbilhL6rx\.}e_$VcC8߆QT,9qjH46_K攤=O?n~bK^FKױZ{#6v]\{O{ XSy1gPKt V PK~ )JLex/CMinimize.classW xTյ3 ȉh<0jx@RPj$30̄I_Zkz"jE҇A,עXE}Tݶޯu#^k^}^Í>l>|^/!/>/^ X*QC1 5,a7Ph2UVkL]j+Zy !d6ڙ0/# a=6J.bjlb(C+P/S7󰅇|p)ĽmQ|M4bA5nkαtxh9Cً :}SYBֻ!T$ܧ K/y/'gs2^2x09!I]ԑM ʬ<̠#nףof%/ P҇B)1Y*̦u,$CC ?ܼx>>:/쒠֏I3&JHw5V^΋[zݯ2W" b}üOs`fAgQ$)80#hR FWAMMRq(V0EFUթhV~QNХJTg`:=H'4 +f̤!'*;JKFL׼A1Ug8sqO¬~x]aaUc<q8ߎG^`:ceM3-3)R.C(hx$O KYQZF?fΰS0OA(KKHٝޛk3Ϭj%Xi}͵S8(ssMI<j~g8[ CJ=0/p:+ء^n+<}<~Շ/'R} C}!PaQ"fs_obXѦ)615"zML!'/')4*a+o])#a<ѹ#pt5RGay:Xcy:8dyGTàgBi:U9a} S!mUuQFjK ׁeX_e\*,IDv%d7͋7u~>gL*) (YNذYεf4Eϻ 0$fJ~*MxǞbkcRv&[bTd̪<:?cv|; %A8ܖg(`j0.އIET=yqN -)Q+@W+qZHq1&&ԪKpZK*XZu%6جpj n}jR! /MxE%J]ՃT/>R;P N4WĩzQFuP7Y4V7O,yʯ)nb=mMq]PSDjo}uOsW jVOf R>4' q@ S/)d_ύqF ˧*sUI\+3\ W;AZ}JB#}< >s* i(7盕XHf5Z 4knDҜ-f-}ĭ,GsK*ӲJ$:Ew՝昗YYiNDL>FFj)0Jͩ޼j7LZ`ViQ@˪+>z!;p~:3FLhͼ/Ufz Cj;#t|fiOqzY|[^Rl2i r7rSrN d}'eдPry.;Ӳ#Hņ˲+ I/ {$glϸ HEeI> ُ< :>'zq=9fkfƇ^,䭢W&6yM%r 1,ȇŋrx[O4|\S> 9|֦ʧYm6 Ym&cBQ3S4 K"YMZ>D8ђy Tu뤟0]}nწ=PJO"c:nqIJ-g R)M>U\4SE3WI7LN-'g3SLZ@L (խ.@pvL]B^b-Ȭ襲wA4n oqWeV(,LrfiNrpZ>@z&''Cj0/YmBVwTC۸^,iU ټ3n67 m[Ȗj!c9e,4 ^-yLvyc.xF= i8u8C:j q9FѲ[ hR[DTQA+C dhV}պ ,cOB o^AHEDCLG|!#cнnzNJjSD+Q&U6b'u9-XEfvI&DMX֡A<{5ޓ-;t#1$?cD~ M~Ü,t=PK&.PK~ )JLex/CNfa2Dfa.classX |n潏X0B45) B́`%l/f߿_4o4bƣ2,pMW~RwXImFv;ZvN􄗵Fc%8 8Y$"p.;J^QNT(:8CD؏C)!hP\tp!\n%t$jK[ɪmGcƤ@֠(*h/|} jqp ~*IM4Ԍ#ap|?FJF5. Hc2KNcYb&.-.2,nbp%)x6$P`A */K1 I1T&K8vzw 'Jm#:hVT8ʒ|q'~ťANW̬^]?vę嵔H[јE-Apء jsX$Jݔ~<2B5tqs P@RCؑeG҇ O2Nj5aNHR1vԲ&m&zmmL4PHeVne_v+.eodF տrH5 30ZUb$5LPRs'zejPa\"]]*T 2UZJ|L2|O*RE^V7 FQng5A!vqZ/nQz5Wܣ[Խau?u+9ʼ@nwjIuWS:9*~HO%Jg&Y)346J dfSEL^}˭7y\ :U] 4k:ۭ ~Kmuf:qr\ E]8 s3gt0xg6IuŇ\/6']D?Sl}4tOK>)QG}* tt٫t3(ğl"Qb~bXCd3=p&㾾oD~3c~'m ΄剌(xLl;)-7Һ -\{o^qbP y1KBK+'UOyώSb?Ct@6 #=6+tGK]];]8V!%Y'Ϻap#;Qf\i9 |C[촮0L}C>>>s\z|8?g,,t/I1lYQlac8fNDN57}b 9gmua1NU8=p[;&6u-RG)#c\fLJߞ6춻5STlܐkt9z^ 눪T${lQaĈ1:`x(C4<B',zC4e ŇpYKBY`wkO#N@7*.JZ}_BۑItGQ3Kp{516*bbe1g*gћRV"S_ u;5BɺF}ZDߖѠrZIB,PKp4` PK~ )JLex/CNfaPair.class=J@iפiZ=zԂQJAPbenJA>A@Mgg5`G- :[]+M=t}lK'IS3&\D9D/I\s( Bkݫkn 2JX*{Rs8UOde6:3e«xLb>^*/˻;8xm׫2qI[\%z^!4^56 +暰YYoPKeBPK~ )JLex/CSet.classmTkSg~&a r/&%ZEmgtlZJ_g*h;??y7Ksyeslc(o5\pUwnkXpG T@BtbD.0A'Ӕ;/2LX@IZDQ2 eXPQMkLy +bFGU 0(*C_Xٷ~Jm ;g8w 7"-'B+r>.܊ j,M%ꩢXPS%*y| vp|'Z3 ]̈́r!C?Z62vfuD1$ o[ֶKOHY?+gcTFhGQVI߶lWX2tn O~D d&H+uY rhr%^g ؕX篇!A~L{ZDϪIV싃|]QP ~Mކmj>5_Џ+HK ɺFyt8B#!g(R:ING>lNLo "./w IJR2jP~1HY>a// 72Ԛf:i: ME$\HBz$} +Khk7mҼ!u|;fD!!Xe_1WԼ:} Y6Wgioax_m/i1]q|Q=|,vŢ3'ڍrvnS'ވd_PK"P.1PK~ )JLex/CSimplifyNfa.classVwe}Mҙ/J) Rڦ`RZB[B d$L\("*,.sh9|=_|/Qޙtz<>~~L~~=x7*TUU9 ^PpR))x_ .)|DTYTŏ*fֲX'G+gG\`61ر[*P.UXtJb휻]HLn?`(\oWc9!EEJ08779Яm㘆wpT^]j>Op5)Nk }sp8~ϸ8KF5+ &PS0si㶑'\5 xw̨[yL?{̈-{i98jf2ʧniũuu,Ezui vA3u̔1-lYdlh3mfºOzdtIdcǵ5CDWi%b lԞ).]qO,)2e Q`ZI7SwI ȧ@ńNP:MΧzn7I Bo =E"JܤK7&vݛZѓg& ٛ'j֤3Zv8V3o< ICRig]L9t*v7}i&VیS0FʰlrxS \W:kltܚofeztJhr' Llp[܀vQ҉Tى ё%nbV<͔bF2Tc9[&_*cI0O& =)j4J7K.5@2~Vo*drzTDu6 %aCXkxtE6'J., r9rVfʕgY NqI(k*8KPK PK~ )JLex/CSpec.classuYte-)e() T( (v)8Md&L&dqAYTEQDQB_|_||)jw'ߧRH.=g}G}G{|uG,@##ʁC@P TBa P,Bb` xXh"@#`M@3r1l  @hWUj`FhFiFަAzYC{xp^{h!1D!qD)D'A'>Nv43gUiF_`/9h<5 ѷ(^.%2p;z\暑)pLzrHAał T0ϰRX\oӋ\Tݰ܈ΌwiHfZ1f˾Mtg%L\*( pu˭ףIYeUsR&KO,fLZ\=(m5]Ylk㺓0JL֐_%tq+L˨J NolNiێ$U5duUUe2ê`examYpN5SNm:II'b51BP|6e1S%%5HA[l8LOW*} ,0c نXXDnS|X 뎣‘H4q91Q=Gf-=iCo'-7iSQ9~ɸbq5Dq )rVC 76&<.:y7n\dЄ\%& IM]Li8JWWU>ҩt۔"i[=b6[cDxԈʺw.Wrٛ++0Fv ˜u\.9v;FwbUBFY:4ԜbzıVz[RO6D͈w;qūPy:$]w?f6o,v6ikXCZd~]2xR0W4JnrNyKSyz*^Ou멼{==U>G*h䙞eUJT)/7rxzR%g~҃J)}WE甞P*]jʟQo+*Ǖ?G_Qo)ߩ4}pzR~z'5OHOʑ,@' eCP#G~#ۃ)1u:'EU?e~\(h rQ뷤vF`l&S42I=@ u?EiziAٝtC児8As:i *]Sy?ZNF77c1=M򥇂=-=>En*0 ơ݋h6DC Ct;;݅nD݉hP|LNyA )RO#Mth`ѡùF":Jt4Ϡ<&4Qtbx}KKNthHt2QPDIEU4&(!^F8L1:mF:ǭttc#[3^ACq~6/`AGZ.u\yo$GFp%őx+/Xq+qIɫx-{y+Oegwz߈PK7TJ PK~ )JLex/CUtility.classUmlSU~.]m6FalM[Aa_`z]v11?1h}ν(l9syy{_.]H9?1Hb.4tq=N%AaGd&㸌^#28B .pхK.D]v!l <(b!|uc#<(EvzqMb#1.7qʋhD+~@'$]Zl?0b%8jj$k*8=}vbBO E,Y|,/]i9 mX-b*iig k& l0̏Ŷ1#uXҖLꉔ:5#G$TMk~ňƴ DI#킏2 O X2RCZtj0qh(c 2[3b BqoWGb3^Vtgz!Hl)<hlĽ*7v5ƧgOi +D,߸&.@53bdxˌ$9FF2xLh׭pV<\wޱ8EVng_Mt :0sуeir*n |^:0 A5/Ǚ<|,ax(<ܙOD/חe؉b|igTY{ CEBA*oC(^R\,-;n6܋eg}Ǩ:ǴPTA-6(_PJy!㎽{h(u^h;X8 g3]8,pJ҂wlp, k(W߁_Z=ԫ7p@|֩~H7YMKMKMEܤ9;t)ܣtsn>1݄FU9떦[_YW>>>>c&>'ّi}1SzWk 됫YHl6u+5_PK  PK~ )JLex/Main.classmTkSa~՗+YYf 2D@Q9}X ׁ][>5f`S3A:/ussn9.81zQj!F*z'Cj\֛_Ro(˜hK oaKgR۪^"n25msQTB1ɸg3i]fl۲%.sPcԡ-zX\mU#z5h*uDN1\I/b. 'i21'kx@R$xh; BCRE$|N# NK5\UN~GGI F!};zܔ$!X~}-}EWzg>um#>X?:I`CdHFacȒcq86$ۡMRŅcbRv5t6@c$.PKRVPK~ )JLex/SparseBitSet$1.classeNNP =n!BZ$C+!:߄+UۊN| p"&d>;8BŦ En0 G!9UZ35n%ZT, p&(E)'D ;ىО)-,E`R(}+AlY$\Սhͽ4*!t~ }L 8j[ %F '-NE>Ae]2S-‚h?=bv}b+~PK=LPK~ )JLex/SparseBitSet$2.classeNNP =n!BZ$Z !&\MVt~DL`>}w4qMǵc9aBs2gkJ,(KYL>Q.RN9v9=SZ^-bY\8e֥Px!VEٲH乪Z{iTBT . B#q~380K+N[|ʺeZ؅z3Ţ6.6].׶ 8ptCa8 Ωʜiv+ ֲ,eI3D(J9Q&`LNLiy|eq-[BX e"nDkmQ ST`/db, ]P;l,1ڇ^8!lqt*r*jalFko_qPKnLPK~ )JLex/SparseBitSet$4.classmRMOQ=o:vv"B;|ݔ"dJhm0-xL̔7&7.Yq! & xߔ=?~P- #f4܍AE"Fd zuJKOBt`PKZa`9ҺYi=mt6Wvv|q7Okۼ"jU5kK?[*x;_~x>,2 2QBs30]{ {%0$J+^8 їNK r&{nQgP uGj+M/6we$"ۤ|%M1$]= /9h qӞ4AU_`K3ctKtה~P!O7a7Z$VcDz,@CJ2^G0%$2K%N% P;J?F\<@:BbDD}CBVY_ҏkR"}{e繒1dCf+YErHuW$z79~>5 = ,JFKC6NFksrG Cr֧~=gHfl4g,$Qn.PK҈vPK~ )JLex/SparseBitSet$BinOp.classeO P4,kZԢBX.O=?Zt=]3?f&F&,cP/d\1Ay&g/%AyK*^76aǖ? IR}itց 3ID+xqSZY M};0UPPK?`&PK~ )JLex/SparseBitSet.classX xT̛ypp3` zpTW4tii𠆇4<i /hxQK~e ?kxUO|c:Q g0AA> k|/xIl-K\Y,Ea">Pzfn` 6M% deGb< |/LhbRُlla^Xҭ`;/3r u?̟1` 2xqq 1SCG/qx=:NFOӬi\m,nap&aK:t|pLq؃_[:~t6a.NaO`ZqӪ7KƒF}jptm*m$tݜDKƚd8fVRy#4o`$S-b2fjk U*s*XdKD8d,jlf.#QSDb5 ]2>| eWe@UNק݌<\~Ϝh$IU(pϱ'.&U+kh<[:fFCx)VʹV XHVFMMF-͈WXlem¨'qkj/jU0fDvd̈`*v[xEHXXg$W뢴Hd97EQ6]ĊFYA17'E6MM/0qY:pC¨h(pN$ xd>he$:IKO 1SH9[Bp"Ө 4NėAkz7MG1s ƒvZU'&B_{bZ/F쬣"fgEĢsUk'ބґV8t:sBI1̢w BcД z ~9bӚM#;"mr@Hq^n;i1X]'= & VuKePL;xqKM%|BjGѸ*Dv :%!(NTqWr^u_D.S .*sLi0f*xp2"'0Y(qVܥgvs^6~LFOq!C.\J6ҍMea]$ [ަ elr};ۑTEoy%zMSa}-:. U`Cw ΡJ=S> Si=M%C|F|Koq?E|vG<$# g!_>_?,Oe"D2EB IE9_:Jt)UҭHMY)ޢbnӮ6h土n]R5 JYT]Tu}y7p{9_솪; Mݷa؍퍸pb/QsOGe3"dy{ P "Tr%״Ê].Dps~qBމsKq:}LoCgHAPGnoo Ϟy1T x&?eJ$4e79Sdʹ8OuE1?dn&%jLٿM! ,wRZu^r|JX@~C)JvB." y8-&98PCRO`a,'!,}1:Qgea:~*UQ0μ:*X89?kY5%zRY&3̄̂*G+1s}&:7ɬ8ưv!zfkhp@ט塵W9f E+V*m+c؁55B>ݶ{(•ǢS6͜_#|7c:.k+ ToS<+|(8F %2Y e iB6Iy X^9W~D:(OU.+r")T|ĎA\x&'-S{!h2|%H| 9jBm)Պz6y=nHU&zS{Opz1( xzPv=OD. uVn Jgr":jeZQ, j+T( oD/|=(VV$McξӖ +Yoi ¤|ޢSht΃>V~Igɏ jA9Qdqt9&1 Ve%4쫯{kpo*KNKIJV8Qob.נF҉!!.t6MMy{܋˛ܫd6% [ 4ɛyاT[JMCN]n>y%UʳCy^ާ'|$w]p':dyȱZ~ő]e]z?n_P]W9)L=Dq7rָ7/'>a,rIjzYd6n1t2衘7Kh.b8] 0G$1_4ah+p "JoeCP,aId [GAcu=VwcuAw8M?XwmX5ݹ-׬t{ikj~M/tsM.փ5^ Q؃j|9pXoǒ54KG}of` \Ȱ+B@%o`@=F̠y`LgtaHH~fGOGpL <9q5PKL zPK~ ) META-INF/PK~ )DD=META-INF/MANIFEST.MFPK~ )[b9JLex/CAccept.classPK~ )4ǰ ^JLex/CAcceptAnchor.classPK~ )4&f)JLex/CAlloc.classPK~ )@scJLex/CBunch.classPK~ ){l$ JLex/CDTrans.classPK~ )|F JLex/CDfa.classPK~ ):"O JLex/CEmit.classPK~ )ʠlT /JLex/CError.classPK~ )WGWZ6JLex/CInput.classPK~ )j9p5:JLex/CLexGen.classPK~ )t V sJLex/CMakeNfa.classPK~ )ƀ vJLex/CMinimize.classPK~ )&.8JLex/CNfa.classPK~ )p4` JLex/CNfa2Dfa.classPK~ )eBJLex/CNfaPair.classPK~ )"P.1;JLex/CSet.classPK~ ) JLex/CSimplifyNfa.classPK~ )7TJ éJLex/CSpec.classPK~ )  JLex/CUtility.classPK~ )RV|JLex/Main.classPK~ )=LJLex/SparseBitSet$1.classPK~ )z!wLǺJLex/SparseBitSet$2.classPK~ )nLJLex/SparseBitSet$3.classPK~ )҈vWJLex/SparseBitSet$4.classPK~ )?`&JLex/SparseBitSet$BinOp.classPK~ )L zJLex/SparseBitSet.classPK&libxalan2-java-2.7.1/tools/antRun.bat0000644000175000017500000000215110721374040016374 0ustar mkochmkoch@echo off rem rem ========================================================================== rem = Copyright 2004 The Apache Software Foundation. rem = rem = Licensed under the Apache License, Version 2.0 (the "License"); rem = you may not use this file except in compliance with the License. rem = You may obtain a copy of the License at rem = rem = http://www.apache.org/licenses/LICENSE-2.0 rem = rem = Unless required by applicable law or agreed to in writing, software rem = distributed under the License is distributed on an "AS IS" BASIS, rem = WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem = See the License for the specific language governing permissions and rem = limitations under the License. rem ========================================================================== rem rem Change drive and directory to %1 (Win9X only for NT/2K use "cd /d") cd %1 %1\ set ANT_RUN_CMD=%2 shift shift set PARAMS= :loop if ""%1 == "" goto runCommand set PARAMS=%PARAMS% %1 shift goto loop :runCommand rem echo %ANT_RUN_CMD% %PARAMS% %ANT_RUN_CMD% %PARAMS% libxalan2-java-2.7.1/KEYS0000644000175000017500000005046010721374041014002 0ustar mkochmkochThis file contains the PGP keys of xml-commons committers and are used for signing .zip/.tar.gz distributions. To verify the .sig on a distribution: Using PGP: pgp xalan-j_version.num.zip.sig Using gpg: gpg -verify xalan-j_version.num.zip.sig xalan-j_version.num.zip To import these public keys into your keyring: Using PGP: pgp < KEYS or pgp -ka KEYS Using gpg: gpg --import < KEYS Committers: to put your key in here: Using PGP: pgp -kxa and append it to this file. Using gpg: gpg --export -a >>KEYS should do the trick Shane Curcuru curcuru@apache.org -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP Personal Privacy 6.5.3 mQGiBDghjNIRBADXB4UY4YfZ2DmbSushlzPZCkY00iDPUB+GkW6FQhgnGCLZovgy FhCnCsKdN1xyHFq/Ns3PV3HPrMGxFKgVOfRuxREbF8CoXAa/u0qR1WoAm+rlyC9l OVsHdXxyOpZ8e4SPGne8LQYZwr2q+LsHiXOZktkaBo8ua8F4EJYkBMFhZQCg/4Iw jXmfpt661Essmf8d05cMdAcEAL0r+PrFxCmrU8Ok+r74+eqyclxVbiDbOf7Uef6N fEJmC5ihX7p8k8eEf2XepeAo6N0gdOxYVXVwcoRCmqPy7SSg1jnXqKOnA87ylv16 lOiJ5WUkiVX96WOWEsbbYKuggmWeDL+6iFc9hp6oEP2sf/geC8AEAEHTPfneJzpo 3z28A/9iX41r4K0iRx5eIJu2KUrjdpPxhn0JPe9dz2XzWZIciNeki+ThrcarEj9h lmfvcGLifXbQfXuFid3btMsBRI8dqAbbXmyfvCYYSHDOkXEmoMW66AWfeF4hgfHF SA5lmcpH4mtHU69uC0+cvYlRROP+HaeOepYbriA+9A9Qq4MAW7QiU2hhbmUgQ3Vy Y3VydSA8Y3VyY3VydUBhcGFjaGUub3JnPokATgQQEQIADgUCOy5rCAQLAwIBAhkB AAoJEDLsF1kwoh1V/nkAoMGf6NVxNmMxpMJ9mQW6pzwWDAF2AKCe05LW35bV/px3 c1a5mBZf0U8exokARgQQEQIABgUCOy5q+gAKCRAZucGLZELD3ErhAJ95upvPEsLB W+GF/Q27gKwJAJWh5ACg9vPu27CELQPkx5x6fhquWlPZWR6JAEYEEBECAAYFAjsu bP0ACgkQ1so098tadVyJkACbBhPpRY1usOMqaEoVi8iQvqJTaxMAoJDFZU6+RUTX dpyd/BhwgKB32d7TiQBGBBARAgAGBQI7LsU+AAoJEL66K4f1/EtCBKMAoMTRzp2x mzR4TjVuLDS1E4jkOAkWAKC4ONEEtQjIuTuDCVhZPQTtvk+0abQnU2hhbmUgQ3Vy Y3VydSA8c2hhbmVfY3VyY3VydUBsb3R1cy5jb20+iQBOBBARAgAOBQI7LmsIBAsD AgECGQAACgkQMuwXWTCiHVUPBACdHm9xrBcNMoEEgR0l+m/8zpgNqWEAn1CbpI+L 0JNmBIyppFM1pCcXp5K6iQBOBBARAgAOBQI4IYzSBAsDAgECGQEACgkQMuwXWTCi HVXQIQCg1Q1MKkWygIsDGAOhiPaM09pTdlUAniTeCkoOI0+2IgD/NtqnGDaSvNDn iQBGBBARAgAGBQI4qZk/AAoJEFHrPvFXdlryVbIAoO/egti1esgRI6GErIhICg3I octfAKDlpw6NWq/WTxk1Aa0pN/1b6fmD5IkARgQQEQIABgUCOxPAFAAKCRAZucGL ZELD3ElDAJ9dcJ0/3luizN4DiPKeIiMsN4PiAQCfdCDLUWcAs93yj0MfeACJ7F6+ UcqJAEYEEBECAAYFAjsubTcACgkQ1so098tadVzvZQCfRN3SVna4GEb5IwSm/zRn 0exFr6MAoLSGnZ1wKQT12W/tNR/y2BueOEY2iQBGBBARAgAGBQI6rusTAAoJEBm5 wYtkQsPcIsIAn0lLDcnoFp5jfpJqV5FnIgIjJ8HkAJ49bCzhw7U5n9G8XEYDQVE2 eLyMgIkARgQQEQIABgUCOy7FfwAKCRC+uiuH9fxLQhjTAKDDUMomB1wKbVEhcdoy zpjt13tTMgCgiser+HuJ5boYdvtoEfsn0bHQMFS0J1NoYW5lIEN1cmN1cnUgPHNo YW5lX2N1cmN1cnVAeWFob28uY29tPokASwQQEQIACwUCPD8X0QQLAwIBAAoJEDLs F1kwoh1VSusAnAuo93Gu3IphIzuBQSsFu9YRl5HLAKCH3V71nV+Td9udzwT6RIsn WWIPLIkARgQQEQIABgUCPD8Y0gAKCRAZucGLZELD3KwAAJ45UpvBFaNKOa64ujpg 2dKYVAGIZACg8fNYqXgVuqaB7Xrzyok45ciCfiC5Ag0EOCGM0hAIAPZCV7cIfwgX cqK61qlC8wXo+VMROU+28W65Szgg2gGnVqMU6Y9AVfPQB8bLQ6mUrfdMZIZJ+AyD vWXpF9Sh01D49Vlf3HZSTz09jdvOmeFXklnN/biudE/F/Ha8g8VHMGHOfMlm/xX5 u/2RXscBqtNbno2gpXI61Brwv0YAWCvl9Ij9WE5J280gtJ3kkQc2azNsOA1FHQ98 iLMcfFstjvbzySPAQ/ClWxiNjrtVjLhdONM0/XwXV0OjHRhs3jMhLLUq/zzhsSlA GBGNfISnCnLWhsQDGcgHKXrKlQzZlp+r0ApQmwJG0wg9ZqRdQZ+cfL2JSyIZJrqr ol7DVekyCzsAAgIIAM7v0Dm7spCxsDywqEkBCn3jUhjzq+8Ctl0qfHPA0tQdo61S +KB/j2G+sFYXDXd/l7ePj/wX5ZXpkVPNBg+rf0R6ExGYSIaf9/HqwSyXyz6hQ2HY yn99BDDIxViIXnIPUJ2Ul1Nn+xCduC/v756LYwM+oWXyb429W9bV9z0NVtnvpUxY Us9UWEiseJrBHHs92dMFWpTalpXrd7e/HAmUU+HzzpMjOAuxW7SunLLxVF5CH7t6 oMeGlZPB1CMF5B2Q9lu14hUj4TLYHD3lAG9wCHmCbP4qj+B+DeKCfAerV8ZqQ5tz /OT4QuICThVE4Z2ShpC7VsHVGoKPF0igeVVAP1CJAEYEGBECAAYFAjghjNIACgkQ MuwXWTCiHVV0vgCg4cicMdOPPnOwEyDUhn+iMYl0MmEAoOOqSf33NB1VlLx344qA 0Wi0FCL/ =QTmn -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP 6.5.8 mQGiBDnjTUMRBADGzi7y1XiTty/HZ1QhRQxMkyf7JD/E5dGXCVLRoSQV9/hdKPtF OGzjZQt6DssPnisgrW6hSLEs8GrZKHCZE6z8h5Yekg+WJTs3K0LNJ3X/tStVe/fU DarLM7u0qwtcsaISWFMRoy1xbrxBkpFBeNkD+FRUk8sXTVXoOGvm3Fw/8wCg/+pg Y7XD6ZIA0m/CxrxR+xTBri8D/Rk4/5rzsT42AImJwAweJidzlmmvWcDGjZolDxrH TlVpIXFjGFJBj9tg1Xz+3/w9zKyk900gcwlHU7uz28xPylishgd8DyAb/enSXsEy NC1EagypAbMpEhTAdBaUNPb6t8yOX3dHUki5yuZ+PryOyKWTaiHyhHLwJ5vZi9xm o+/ZBACqjUqAL27JOC1qw1zrWCQQzEJIeIIdGFEGoMBiFC425vh/1dJA1LUICHSZ bZvg7VlvAMErnZb/IcVx4LX4R8Uergh0E/4Xi6krTYZvDuI4RmP5Jn/7IaK2c27I lCx7I0hj4CQIWVIEVCDAGjJk9E38VahJYHySHzjMdhXSjTbqW7QnTG90dXN4c2wg VGVhbSA8TG90dXN4c2xfVGVhbUBsb3R1cy5jb20+iQBOBBARAgAOBQI5401DBAsD AgECGQEACgkQGbnBi2RCw9yVZwCgjxC/ie5/GhPLZyQhMSQvJuDJP8kAn17UNfN/ tRtFfcJDrNcC7P21ut+VuQINBDnjTUMQCAD2Qle3CH8IF3KiutapQvMF6PlTETlP tvFuuUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2 Uk89PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVy OtQa8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPw pVsYjY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnI Byl6ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICB/9g 5aR6mWbvaZAwN/IFwIC9cd54cDAW6pvowo6/gkgLfwULI7iGR8jrHHs9rSu968fV 3L7ys3pFLR93/22mJR1InTp+qQdUntcnh5fwbAd9Z8NoM2QEuY4c7cVjobazOgPf C6XZkS1C3tHcvUedzR8kmf1hiRtILWW2pF7A9JbJB3RHcuBut3cS3eME2+s+dCSl SugZKyVFuiDoKO59TD7OIn9dwipVhX7UgG0uLDlZzCd9dHLsrlr75LDxIZyiifDB 1oa+xM5smFYEqux+3lf/UNGhpxcaGDJM09UUpOVv8yVz+FZQilZ7Bu0XKvnj1p91 YFVAiQvQHijya+kMy6MCiQBGBBgRAgAGBQI5401DAAoJEBm5wYtkQsPcPlUAoNkm fMB0HL71h5QYfB/NRJupWsWUAKCi2UETq9cwA7QtuMyQ1cjvkA1mnQ== =lNZ2 -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGPfreeware 6.5.8 for non-commercial use mQGiBDtiOuERBADWqtYvR/wqP9H99bmQ1GNpS8NL7YXmOUEdH9X/7KT3nrFBjacO XTJ2/rjnY1ItW6EwnenuFf0okgnf3ZgUai6Ajr4buxCMhpAzm2htOAaSnc3l/FZF mcdvpvKkpc4bf2qYC0j4RjKPvXExPdK3DbQnl7Pi5q0qvdaS0JUkYR5X/QCg/7fI uJKHVBqIveeAmZKpU8xYd60D/RvTll3dwVCWhs21a/AFFYKpA86A5jyq/yXwIeVr IKtKfxnvcjpmZAYIMddsBtVFjW/CyRm6KQZXRdWpXuLymP7+ppT2VlRLM3TqUxum 4pASJdptk7fj3qzivyfaQ6/fAG3PyJcOe5hS7znLV2a0LX7PQBiPpUwqcjKQ2a2h LogQBACalpgAIdN1dfUbgOSm9gdsRb8wYIOKTFGpCWF17rMTMuSYTLAsm6mPdxrl FHn2wlROwiDFnzhEDFbPOHdC5XMD+tYdrWJaffJZKW7ZItOEz6OIh7gnmKpBcDsy WoJ9J7QRUiETHX3AbKOynSdk5kcgDWymCjSP6rE0M1PAiMVg1LQhU2NvdHQgQm9h ZyA8c2NvdHRfYm9hZ0Bsb3R1cy5jb20+iQBOBBARAgAOBQI7YjrhBAsDAgECGQEA CgkQQkPbOcGiXuYuqQCgxnuxkA2wfXf/qrhK9FDdhtG67MQAninm2rZVcTHqorBV KqUHMeC4VHaEuQINBDtiOuEQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4 INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3b zpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9G AFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67 VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM 2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCADj1YHJzpg7 J0z0zRmpzhmRfDZtzBZB+bjqXh1lkcJO9P6tqwEe9Jnhm+yMWKtfETeiNxyK7C5f qTATo9USqB2+VTfEr0Y+UivUcITB1UvChj02iPj7zhrW6A7ki5UHYzcK6y29Mw6K J39nKn7FPaxcqFEzksAGenT+yq0/sSCAydX0GyW6scEkkmdVsUskD5tb83KqNzKK wXm/iIkQHS5FyzQ7U/WGAKRMcQf14UkGrfPoeRbMfNmlp/B+Jwpfbn3bH47hgowA gdGcKQSAQhUgy6GDpsxWFTVyjiZNEBI2UxkoB7d8HzMRvme6tw51d59MSNK7X/Go GtA9P+IqA3UTiQBGBBgRAgAGBQI7YjrhAAoJEEJD2znBol7mw+MAn3pbgcaYV+KZ TLJszssOCpQLvJwpAKCOBhKSHNUJR8OXI4VhY2Arvmm33g== =genn -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGPfreeware 6.5.1 for non-commercial use mQGiBDuOlFsRBADT2HtC2QiEuPHzAk6Oa95nupm5zPFdtUasGWnbNhj37JNjhNFA /iCAvloRHMG8pR9ltlLZA4ae4X2BhPPqk+Us7zjYY/DkF/+G+cTMwPdoakc5JxL5 ZRoVntAYRH5bcmv9MdSbY4YDf2iqk8gCaFPjP9EQcw3l38kTbfVvGKIjNwCg/7fU aAHIiOYSH+eLMpF4LtuqQP0D/3DhtpvrALSpiF/rw3VnL1rnxcb2IZs9IL1U6bFK p0IbqQORSVO2+dYSWo4/Vt7aWBFVPf/yfn/elncVmo12wAzWy7sBnqv8QzfYAvyY UuOh2WUD4K1ALOy7VHNM1mMyvH4dDIAoOuqXMQBwJx0A+/zUUaUZZLojsWl366pF GHmlBACa5zXSZ0mUf5ScZqZyda7/kUsV+B5tKjEKuOY1d/hnI5e/9Z11EQIfqqxs UckzCii+mg8zSpSgWHtsSu5N90teLum98bEuhYNT1tB6Pc7yNWEfq3c3SPw8ZstX u1kTQrsQeTiPhmfTQ+RyFiv+ZjonEsETNQK8n7CU+N2diiX5d7QjTXlyaWFtIE1p ZHkgPG15cmlhbV9taWR5QGxvdHVzLmNvbT6JAE4EEBECAA4FAjuOlFsECwMCAQIZ AQAKCRDeziK2wcV9LzZ/AKCYT4SNAFyQB+tA93nYjRo+NMc12wCaAw6zfJ7j7pI4 e7L2OA0niSd8vHe5Ag0EO46UWxAIAPZCV7cIfwgXcqK61qlC8wXo+VMROU+28W65 Szgg2gGnVqMU6Y9AVfPQB8bLQ6mUrfdMZIZJ+AyDvWXpF9Sh01D49Vlf3HZSTz09 jdvOmeFXklnN/biudE/F/Ha8g8VHMGHOfMlm/xX5u/2RXscBqtNbno2gpXI61Brw v0YAWCvl9Ij9WE5J280gtJ3kkQc2azNsOA1FHQ98iLMcfFstjvbzySPAQ/ClWxiN jrtVjLhdONM0/XwXV0OjHRhs3jMhLLUq/zzhsSlAGBGNfISnCnLWhsQDGcgHKXrK lQzZlp+r0ApQmwJG0wg9ZqRdQZ+cfL2JSyIZJrqrol7DVekyCzsAAgIIANxxFjYo tUFTQpvEVHu1ZJhyZNySlR5EEDFemG/3AC67Mhv7ygHaeKP/oFzIixKmWllT7iKS SLjyS75rq7LpTzhasg2+suQPRnV8y2ATTLnlKWQVmZfVKY1RDiO4MWLik9laFTVY kEyFbKgF9w0LyeobsD7SU1J4D9IUOYmslq0m9rac0l+1ovNetdzIm3WSTB/gm/B2 Nrz1z8urh4mf+RJwuO0to9fkSjE1KUcrE7nTiSD6A3eUaQC6S+Q5wEeiB3QN5f18 giQuxna9Aet9J8tnMk+5iuh0QYKjNyXlyYD5B9ZF/4SXnQVDi6jAIC/Zzt/Yqzwo QX3NAtR8yY0WgASJAEYEGBECAAYFAjuOlFsACgkQ3s4itsHFfS+Q1QCg9ywbxv1n 32glMqfIb9X7icWxYIEAoOGctrkwfA71hEB0S6zhT4UU3zx7 =eDC+ -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP 6.5.8 mQGiBDu47OwRBADe/cmSMZz/V8OF9KlVIij1Y66HuKRf9u8ht0JrVZf40BiA6ZF0 IhXx44ELI1SWU2SqWQOrVR3RRVhHDbCiHGTGGLy8FgL5mhuC8vKRRkKNSzvgJKpD dCqRScL0UBWogvKj8plzuvz73rHDGJDdd4BYjOD02FW8wmBnWZO2FRQDhwCg/wwW HvcFM/O9dwoUPjdzc5AOteMEAN7vt3PzYpuhPEA21kGHd/wrn47BKGRiwYXv6b4S h6OCOWvj/JB9I/BnoeiDpt//1JRte/14JKf8IykuCQgzcZOvA2uuiMi0oWY7kBWe KDKzz63pFhlqncCzbxnOlIGUq82Y6ZGCrUvKErddOEdeHeCf2smgEvbxfED7lfKR noVTA/9mjXvtQf5tHlSA6/xErh5WVnvtK1voWQKK5CcRYccqoeD6hbYfwH2wHPte Rxvh+l8uyF+KTszM2cThA/BfVec01g3qeI1b4F1Izj9iLERxzvczB9QOQ11Ihhn1 aC6CGDRT8pbrQddWKZy1mGoSJzRDcAGmHleY24+AK371+rKzlrQtSm9zZXBoIEtl c3NlbG1hbiA8am9zZXBoX2tlc3NlbG1hbkBsb3R1cy5jb20+iQBOBBARAgAOBQI7 uOztBAsDAgECGQEACgkQss3trL7oYN6+QwCeNNwhvSTvw/OXKOAJ0wzpzUKc//AA oI+/TdbMVKrBDyEIR3fzS+PDYOq/uQINBDu47O0QCAD2Qle3CH8IF3KiutapQvMF 6PlTETlPtvFuuUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ +PVZX9x2Uk89PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarT W56NoKVyOtQa8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY72 88kjwEPwpVsYjY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy 1obEAxnIByl6ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7 AAICB/4usO5A+4Z5Zqdv3IE/Ffaw7XD2+94Jjr9VLWBvlNPb8hwYaCQ8Sn8c+Vwq lrePG3vHQvwsaTVpLWgk7G/tqasTdecCGrBEc9YlB/9jBqNaUuWdT1RlfxzS96Z1 ayhNSqHM5gF/6cTBedK95HF0++AdtG4Z+CxhX5COZliPcIeOH1mwYqP/OKcbfOmc NqsjEpKA81oMpu6RHlzdbvUEyr8JpwqlQnJBPZ6oRi7SUlsTidYvsTA2+ZXJWftr TXe/R4RdaoXnwhESiDAL1pJy1Hnw3N5RJGCA5RS3RLHa0wvF0YTCwdk7PJut7100 bdLw57nTr1edcFUKrPrXHQaAI4KiiQBGBBgRAgAGBQI7uOztAAoJELLN7ay+6GDe 6ioAn0mSgIVhoKS1/Umun8Let3+az+SMAJ0aDwtI+TswutMqImiCBg2XsQkOug== =FVde -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP 6.5.8 mQGiBDu46/8RBADy0Wm57RXcDu6sd+sza7pFOoYgWslo51LuSxoCVWZiBjgOhas0 JZeN9pOZlW89yFG4b4U+IfHJ6S0jrl9dcY4jZbwGZOBHF/03Z1viZajIZQ8X13HT xVASnVFspxj/bvnkpALBaaeI75De9XjDJzJmxWpIMnvXqD6r3jA78h5J2wCg/xbc xzkV5R1+g5f0YQ5f6LcLK0kD/RWVFuIvrlxzJXZQ+7jduyZmBJat9CQs0U3hHFXq DIxQPfFsEn9B/kc/qRTFITTeu1JVmq9SYXhJ/YRP+5yza/bJy3HBs4X4xUSeSGR9 lgMQ7CdI2RwCP2FiCt1yEZT0FG7V452P5u4GFsrUo0hzwPuF853OFbNMVA9lud7Q pKAdA/wN2J7vDQJzAI/Pnf1ilp3Etq5Mm0jm9F13qXY66a9GtqvcS/lZGwEwYb5J WHu2kUjDwRwc4rdVbmJS7r4OpuK4n4HSvkA+H7T2fGeAbSlmi2cf0Zj9PQc6nTTX xs9/mW+ducQoAWWqBsjYb9WTmETFI/v7XODgkFc8+4bGO79ysLQmSm9zZXBoIEtl c3NlbG1hbiA8amtlc3NlbG1AYXBhY2hlLm9yZz6JAE4EEBECAA4FAju46/8ECwMC AQIZAQAKCRBM03UrGv/D/h69AJkB04jEwgpZ3U/A3Vo1dfce8zM4/ACfRm4GEOJS 8R/nsuNzZ8YoRD52DpK5Ag0EO7jr/xAIAPZCV7cIfwgXcqK61qlC8wXo+VMROU+2 8W65Szgg2gGnVqMU6Y9AVfPQB8bLQ6mUrfdMZIZJ+AyDvWXpF9Sh01D49Vlf3HZS Tz09jdvOmeFXklnN/biudE/F/Ha8g8VHMGHOfMlm/xX5u/2RXscBqtNbno2gpXI6 1Brwv0YAWCvl9Ij9WE5J280gtJ3kkQc2azNsOA1FHQ98iLMcfFstjvbzySPAQ/Cl WxiNjrtVjLhdONM0/XwXV0OjHRhs3jMhLLUq/zzhsSlAGBGNfISnCnLWhsQDGcgH KXrKlQzZlp+r0ApQmwJG0wg9ZqRdQZ+cfL2JSyIZJrqrol7DVekyCzsAAgIIAMhL pfkBOHvfRhd/Dusekk1af4fMmH82fVhw82Q2+rY9CUNX1N/w0NLZ/AD1wKPugbDK QoVqgYaAP2rf0xETMFeZKlUhnPl0fXtfZSPWC8qIeiphac97g8Y4q/ZJL9jqZWiu lqQyArwniUUJ4L6obhZ0EjmSOy4etrWkIEv+1Z8Btw3+hn/XwdWRPzDkicMz7iL4 scAsSLphu53tUhBdlwBDFdjesaKCRqy8bdR3AQf77Z1czNMLfYA7RS6zuoiblkD6 GlABJDeQuxnBVJsuYpa+/zxlf4ol7P1rP5WohTN+hZWR9JI+MbqqG8EeyuYjI2Gj 2/jT1kKqjGgVnqjtcb2JAEYEGBECAAYFAju46/8ACgkQTNN1Kxr/w/4tsACgyWj3 /gI5CMj0KhDDxRXkxzCRP+AAnjY4cIvvgya56KB0IGmFgdgWZxUK =Ipr4 -----END PGP PUBLIC KEY BLOCK----- Type Bits/KeyID Date User ID pub 2048/1AAC221B 2001/11/09 Joseph Kesselman -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP 6.5.8 mQGhBDvsN+kRBADjapawUAJpEXOp7xNASa4FKdXFx9rLOx45+GP4bdTS9QN/p7Vo t4v+Xd8PUhJYHkxyfe39rtWfVTj+JPFotldMaPJUCKixnxnTjehbSoyi5sNraRqj WvZFYFDOOmOEy139eBBFXNTGSH+3D8A0PMg9IhUGHYgGZwqhEgd+2yaBlQCg/94k idl+3UadWoI4CTOxD+iU0rMD+JUCsUvmFTP1HfJQekMSNN16WSzJF29QOr0JUm9q ebnJHvtaQ/GaZrVyVv0bbgC1XAXf36pqWJPldkvOOzxCm0z0JkKdbQ6+r4P3hDMF Ppj1kUfz2XmdbkLTROu0PhUwgE4p7IKQspmxcdYGbT8rPtSSxXVF0yvF/NItXcCJ KfMEANYbpDzbuzWNtwVTQReFoj5xwYxH1H0CMeXmV+yq0i7DRNU+uAe2DmWOc6om bl9K5yk/cf8DP93/0yOaJqmZ1EjhHwKkknucHbjcNcMrG5qozU3bUr4in8IK5XO0 NDZEw6KZTLCyXWCl9kK/H7vr0ogtSeQo+rnMqM9Ggusl2yMCtC1Kb3NlcGggS2Vz c2VsbWFuIDxqb3NlcGhfa2Vzc2VsbWFuQGxvdHVzLmNvbT6JAE4EEBECAA4FAjvs N+kECwMCAQIZAQAKCRCVht3BGqwiGxyvAKCOQ+RkwNwxTbrfGj9y3Lm4mYjZ5wCg npZjPSr5wXU3YU+yi9TluXrMFWC5Ag0EO+w36RAIAPZCV7cIfwgXcqK61qlC8wXo +VMROU+28W65Szgg2gGnVqMU6Y9AVfPQB8bLQ6mUrfdMZIZJ+AyDvWXpF9Sh01D4 9Vlf3HZSTz09jdvOmeFXklnN/biudE/F/Ha8g8VHMGHOfMlm/xX5u/2RXscBqtNb no2gpXI61Brwv0YAWCvl9Ij9WE5J280gtJ3kkQc2azNsOA1FHQ98iLMcfFstjvbz ySPAQ/ClWxiNjrtVjLhdONM0/XwXV0OjHRhs3jMhLLUq/zzhsSlAGBGNfISnCnLW hsQDGcgHKXrKlQzZlp+r0ApQmwJG0wg9ZqRdQZ+cfL2JSyIZJrqrol7DVekyCzsA AgIIAJJnaUDpUG1btIJUVkHLHOeBkm8uIcixAY1BrsoAm+HKW0DfvGZ0OA9RZawL ZwE0sWCuOuzQjbMVFjt3B76kK7YRiha+hlsAvbm5Ojnz5cmn+4JhT6fvh7Eh4xBR zCyQTOedNtegy0zkV24ddRqjz/zRDa3KJLagZrQFKU4+LXF5DpaTUVDR5xHxDlWg Ht2RDbEWVSYALxRjyHobzVZYr9CuhRy6QKRd5pm/fD+qkDtwHbFkrouH8Txegr3y zVVc+vKC0GNr1xaX8f0lUGSz2KHPRgqyMfEKGRYM+IWfr/gHeZnP2SUzGHsfYzoi 6CJS6hPL/HyrPn+UbOmVo5uKNaqJAEYEGBECAAYFAjvsN+kACgkQlYbdwRqsIhuk fgCfco+vxnDUpU8cLscpZsPbk6J9p/MAn0VYo0g51AsO36+JJUak7IDWGFwb =pFGX -----END PGP PUBLIC KEY BLOCK----- Sarah McNamara -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP 6.5.8 mQGiBD0HV44RBADu4H3kzYmSoX2BZOkIio6h+LGD60EjDOGtGkFNh9pqd6aItRK9 qpFishIK/1/1z+/nLVBfQDc+PSXR8jhZUzj/AGAdjmOtYkBwAWGz1jY08/x98xiV MzMlVYYdm0dHZAfrNKV7nAfLuFQ4X1Og4Hbmgv5HlnVllXEBcHUYWG7AFwCg/5Wu q6weARMULjVCQb7B/myiQJMD/itxWrfL0KibEBHzKEmzM3V6pJR7CT18+GO7aLFD Y0OtTqfcKdBlbvK2Ngyn6MFO/fgctGYsNB20Yg0dJH2oLPrgGAnSVqkgMh2VhUFH oc/6cyjBkFJMOgHQQAPY5c2MdVlMhBTCJcIMArY5rPQVS7q6D+947hftyHyhDwss e9b9BACUls7qRcUum7a0eygN6ninot6UlSh9TLEt7OERdIUegu3mbXazdGi5jvCr lXb1BxZPBIYP2tMve88s1uuRdDP20Ht7k3uG/CzMDlcIUisFrlAqNI7XtzE51jsF FOTt8NZFFCfqCGaVT/k4FB3wMWniK8HeXEiUuOB7vqdec2e1W7QkU2FyYWggTWNO YW1hcmEgPG1jbmFtYXJhQGNhLmlibS5jb20+iQBOBBARAgAOBQI9B1eOBAsDAgEC GQEACgkQDL/HgFBA4ORinwCeM0LEu1iHaSfg3O8W8XUO3soVB/8AoJCsL4P3H2YW jzcc4jWc0MtufUNTuQINBD0HV44QCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFu uUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89 PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa 8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsY jY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6 ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCAC5df43 MJy9e/SkSdo/Vuu+3cUNcyTuOck0kFivwZKbYKbqJL1nfmT92Flgf4kzJUQTJ5QU 2//sG2dyRtSZwFmb2vhY+68G8d9m4bkbIq799si7sK1LtSdC+6jr5qEnO9w+KcM1 dxHhUXz5QSOLJgOL+FuF+NcvItUefl0tq5gwiGschyPljp4A2ulaEQn1s7ur6smZ 9QuEyr+95qTqo7I4yAA6NJy9kws2IkYTVXQGsuFlRuXsX30Q9jzlNGZGifLlo6gq im6cQJgP+WeNHMUb25hV3cVL+wONSklZXIshoDm+zwAcjrbeBVin7g9R38YfhA7p Gr5ZXzTdnd6GDVWAiQBGBBgRAgAGBQI9B1eOAAoJEAy/x4BQQODk1rYAn34/Xv82 CElwVpVsZeIkpD68gL1kAKCpGFmpS+W7aXKGVdlNubEulbVlHw== =+0VJ -----END PGP PUBLIC KEY BLOCK----- Ilene Seelemann (ilene@ca.ibm.com) -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGP 6.5.8 mQGiBD14yigRBAD4YG6RAKr364IFqsbD/3B02Nl28bkwVyWFxHA0y9Br5UvjyDGz sh6ZBQD7mPO2lpNGVj6ln0h5fxur+Nmi79j51LhdZamUGoJtx3GR8bMG3ps7OB+C FYobHFfBuaR+kvPioboPND0BKYqWktastyGi0Et5OSG2RbvMwBWwv7+ssQCg/y3A GTvsP70+0FPdsqYMIVbnvPcD/0I7huEjBXsF4/ZFple242zaDHiKcyJxaspiWYpk kHcHZB2fTUBroJtSvOE6in4LV9cBtr+qScyjYEKo7WXmTuvjPk9hGNg2/7IBhOAY pxEs/eMSRynPyX4dKsuQ/vbhRnJz5Uh2nG4l01oXIrIu3mLfbf0+njfAySbVZbUR Bm1fBADOLyw2OuOmVMu1DeFTZ2tyKyJQ+ALD3UtypphHDHcvejHC1Oq7heqxAk9p Ex/mYlIc3loddWiP6f4tQmdOqmvlhkZ1rGx1rNHMhRohRUPeY5WnRjg452hiaNtt ri3QnmX/w+3OQi9GcFzKr2GcSZzf429JArhAdMH4xoiK1lJTO7QiSWxlbmUgU2Vl bGVtYW5uIDxpbGVuZUBjYS5pYm0uY29tPokATgQQEQIADgUCPXjKKAQLAwIBAhkB AAoJEAaHFk5eFOHSfJsAnRLwJ3B/tgfUSAeXjgImzHITi93JAJ9kyIRfAu431G/0 chT0OWCp/IqAnIkATAQQEQIADAUCPXjPQgUDDy00gAAKCRAy7BdZMKIdVZ5wAKDf j9ZVL8158YK7kdwpPsVMqJRldACfcYLyjzQh1rZIuAW/E/ddhwQ+eniJAEYEEBEC AAYFAj18qXUACgkQDL/HgFBA4ORX1gCg3WrNmHJrAc46PL2MdI1pqqVM+MYAoKFq cnqo7mczQM80Fvw58092GlFCuQINBD14yigQCAD2Qle3CH8IF3KiutapQvMF6PlT ETlPtvFuuUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZ X9x2Uk89PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56N oKVyOtQa8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kj wEPwpVsYjY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obE AxnIByl6ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAIC CADSzWYVAO56F2n81OvuEKHEDsWHVTa5F+pB2rJQdSbYsvuB6VzOXO+gttdBgaPp Kox0wj/z1T3ycr3UyP21sbyP6C4IqUM1sxmDDvtPmi+GP9EnVVWsjt3kAX4NgpG+ /5RRjdmWvTXYwCyQsGUYmrxj38bTl3slaY2MXuzDrPN7jPLj0LQq2XsucxlBxne7 VcjMcwWdZy83yrcD4JBACjuzZDYv5rk8562v4i7yIL0OGG42ApLeHTszKgIOnvEz chBQRtAIbnTZyakWAQbx8yluBQREcWro65iVZngjEMFFBZogCOHRo/ZRea+6Chb0 GE4SHxWelDm1h29kRKFyNiSSiQBGBBgRAgAGBQI9eMooAAoJEAaHFk5eFOHSYScA ni92fvDPDNiD0HR5fYQkCcj9+AmCAJ9r2Ic4kOjE7g4LqGU0w/zr3IJ6wA== =g9hV -----END PGP PUBLIC KEY BLOCK----- Henry Zongaro (zongaro@ca.ibm.com) -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.2.2 (Cygwin) mQGiBD8cAJsRBADUrXrA/bCXXan4MTeyaYP/X7Jq2N4m0taDKcCWneTWVoXVISJD WRm5xI0qfiSMao4VCienFS6aEVDW/CtYy/oVN6faP4cDhfiauOSNVnkuprN5kNT5 45gXxjfkNZZqQEHzNXeQbd03b2eYVNRqEPIMmbe02VNmYU2ucNoS3tX+wwCg37o6 lECga3f3HAEbAoBGJWEQDz8D/1cYnr/3K08y5iRbx/fEImoSwDVmS2stl7YSHiFq y8OkkNv65ctxq1AQKWkd6l/TRLkaTxV6jRSNR9/UUSsKZ1WqYXdWIQlTHOyfyXA4 9F7BYWVCJ2AorGOCUV2RhL34JOtxD17eWFW7jte9d3yjzwrW6zEgRjL3gn8mF6pm N0vwA/9/Yhw4xs3kJrd93wpYC6tjwr9OpKX9btjCvmYRs0tIaiHgW+pz4yXcp0be 3JAKmOZLOpYgdXrzqoays2dIXHtPtnJ8xcusnuyafijXnpTugDLd2TTZwTE2PJqa T6wU6ucrxZoVye7tnCZC9WO4wwT1C34a2Bs8Kb9gdEztDDc64LQiSGVucnkgWm9u Z2FybyA8em9uZ2Fyb0BjYS5pYm0uY29tPohhBBMRAgAhBQI/HACbBQm6FuqABgsJ CAcDAgMVAgMDFgIBAh4BAheAAAoJEKtvTqlV3u1VQv0AnRtJiGiwnQ0xRr86VijM 3jpvtRhZAJ42nopVLUX7MLPQAmquJr7vbJ51erkBDQQ/HACeEAQAktEiSKwmijNK y3LRnBfDcmnsflwaR6vq/hzTU4OaHFlv7TsOF8IEYuVtY6k35r1EKRFDDj3O2yxc HZ2nJXsfwc2r4vXZ5maLJKrwm/oqdpCQxIhewKty0mNcBmRhYfzH8FwDbJfDj8GQ 3Mb+hoFng5IQz0TMn/+Xufi8hMPNubMAAwUD/1KqOj307Sw/I8xrukzKD28wephI BaHD0k/JrOE08hLy0AA2hJYtWON2ngFxsAMn+hyCaJ7jIf03lVzeWY/EFUsRiz6W SK2bgxCqztvFEfk6auQks9o8Qi7wSTdfGRvmgBEv1NIHricYGujpLMYL1/wcUmAb 0cuNiuD+f6I9//mOiEwEGBECAAwFAj8cAJ4FCboW6oAACgkQq29OqVXe7VV5NwCd GnR3HK9tl6lDNkgg4e/iwX1+TGAAoNAyeTCMkju29VQvP09DXyqF92KN =+iYb -----END PGP PUBLIC KEY BLOCK----- Brian James Minchau -----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGPfreeware 6.5.8 for non-commercial use mQGiBD90tykRBAD8mc8/pJcCYJt7EBGh4M0x6FinAlR0QQsxgpf6sKVUsW01vnce 1Sk2O5DfLCxTuTamstzMPGP9gqpIxL01qQO0ogarlQ8KLHtrb0x3ha2Ea32wnjux KsbWMYv88w3vyNmcPm4CwXePxWglBJxvuUtBl/8UfWX9tj51Gg1UIFkBMwCg/20T gSuvFLlcsBQIQ2z/lmyJsC8D/RP4QM4e36GyuMR+MVtamP2oq+kVsTgOWgMwbxBN pYVY9mtI43GIlQ3Nuj5MmgI2gh5w5KGkPxOUiBsbgGyKBpik2XET6uI+ESwxP/f3 q4P5SsBg9Cnkfw1PRFp9rPrtsH+qRL0sVbPES7m5wgHFMO+iNFRvlgCj+n+a5wP9 aZpVBADFiDoHukZKtwHkyeXf1ZAjDddYP0CMEU/+n6r2iQhGxsgB8YYxurCsNmWo ZHsEbFd9K0hiGW4wd8ehTnWhAOgF9haCg0ej+iXIsU26fSdup7XbhqWDwuBVG+oG fKrxWKn2M1Gq2/e7Y2uIQuUUZVLFWyfbz4srVKX4X+Usi2ZsWbQoQnJpYW4gSmFt ZXMgTWluY2hhdSA8bWluY2hhdUBjYS5pYm0uY29tPokATgQQEQIADgUCP3S3KQQL AwIBAhkBAAoJEEkBfzw7R979puQAoJz8iDTTk2RWVO7u3rTbiQLkKkDUAKDyteJj OIw78pLkcPnNBX5LsbtVzrkCDQQ/dLcqEAgA9kJXtwh/CBdyorrWqULzBej5UxE5 T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/c dlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaCl cjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD 8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZ yAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwACAggA 17tSplmHTmGaV5C5Up5Imu37MGELNYUmoDtg82Acn3gftwKAl81HSx7Lr5ekJTZ2 jdxX6k1TiJVvw0926Dm44xERqgbTnxJ0eSkvrzuM3WEdnSC4e34ostHcYSMjtXpI IwbhrAhCNJz8VHQsMPHbp5DCEESZracxHbOe1HGfV1qfomdM6X8k01fIa5Qmhi1B UUV8tdhr4yXL4fjzQYzI0PJQAVNxEKGrdPpnKedcEDKqdaGDD/SfFjo0Wp1Lg9wO pW6KnujtylZ/i2gj+oQtXgNXG1CDB2R4+573NyIWbTGCliDA0vr/MIOON3D0Ir1/ 4vtFBvRhTOefXJ2S7AQFl4kARgQYEQIABgUCP3S3KgAKCRBJAX88O0fe/XhoAKC6 AUWyj+MEm1Uf+mxMLDI2IXiDZQCdEMKlwjNalb4/NBV3HatUuhOuFho= =LaXh -----END PGP PUBLIC KEY BLOCK----- libxalan2-java-2.7.1/xdocs/0000755000175000017500000000000010736146354014431 5ustar mkochmkochlibxalan2-java-2.7.1/xdocs/xml-site-style.tar.gz0000644000175000017500000005553710721374034020467 0ustar mkochmkoch\@xml-site-style.tarYw6s8NLGq5i%6%:-%OEb.?X%nJL,?{`䅗x/>ݮ`8LFd<Ϯ-igKRqqDYFc?9W;|n`wwg_Ͽvvf,^^-6֯o.ogg?ٿ6d10!;?!%NY-=(1=1DŽD'MMXu޸~}~e<+A0HxϞf?<|6W)\\bG~܂SxS^s|z2BQAgC~p"<Ɉe@A?*4'_"v;xHW10ܼܼ֯7ЏN`|~EǻGy;)n4OϨk<?կf%rKԭsy|>~AoĹÇ~=7ayDzB7=GHu~ܽH"|щV͙/"e0&=˷xwvB`Jqn޼\ <Yi5J1犘'Rp=~U3+JT:̣;g7y%)YA>%]?盈o> '33΁27& .M9B| EؘV0 o# 2lQD"_u%I<@tLo+?F1o%?W-̍'&߯@~z?E){ԑ|a Yyo罾׍ϧa gS6}J ֿ9oɁ4 !]gx3w~KÜo>&gǐ2?|) HMEX#KIJ O-?XV,Op hFى4>ֿ5೰4f iw,|auFd-ܘy)yR Gu4V/~%?NV hYXu=!]+B:Q4>LAn*S1+O-ɰ+QteM8#[@/>g"[@>K]أ9%  >ҿ$vj`~iwGs{o;Zի;˟_(խogPApb7:4uT@6r\sX;fU#˚ 3 Xy6o)>ֿU-[ ?Va[?ʗJe5S~yOKI EWWexDG=8>tb? ߺS5G!PD|PHUf kBU潯ퟅo]eͭ_?ҿuy ߲b)LOg#[Wq Ω@߲c>o]e%m*_mU߽X{U}럂We럂We럂Wki'7 ] ?DwQkþ?EPoC?CPH.jػ7DwQkþϣhpƽ!ҿZVQb_槠!io}_ֿZGXjڷ߃Wk ?ֿZ?Bw,bX~l8g,^RD4sZp\i5 _oX'VFb>\’(v!ZQFoÕ2>IרWw:|Re5I(YLH o#^ȍ6Gʍi45`zY޴pBgoWp=l2Q䱰D2u`7Ľlk11[O ƒRgYvWf )9r>_)\WH?DߤR2(MUY,ڠ|{9m?<=),ַSwx`2O$ ϐ+8[%>_wd~tc_^grl} _\ < ?𲡗6>PvoA'qz.*,U-̏ ֿ m?7^Sd?;=t|\?[d*ʿ2vo 5(9r>k_+ȇo/3h{4Bܽ೰w~;ܰd;$(<~?˳rwG-_K$36i"qޓDㄍȣ|.=#TvsvCQi|=QT*iǰϗ2Slk,/ њcsfFr@ݝSs},i*xw*<{f1<k9*Vŕ$w*<{f7*nNG/ܤ]tkT+'z"_cqO?W'*n?Eq=S_oǫ ϞM?ٷLZjVٳY}iثu"*na9oQ_U|*HckEu>ֿu}jWbkyֿ*n7 H)L/oG7o`#A75 o"ƿq"h=?qZv [h-OAzҟy㿉u>ҟy{{dW? ǖ >\/MZcSXKVu±U4U85?h ^V؋*)VG_zM] ?zk/BmcU8<1~k4M#U?KIt{oYo^>ֿUuw?懺?w +4t _zMV{Yk[{T}*>ҿeߊØZ*y-kGI:^֣OuNauj/k滀oYk[>JV{Yk[>?)}T?A)ʬ_7߉Z0C@+|FmGګ$x&xll.a ?p;(o iʆ"-nFSxJW,Od„ǫ'nm*^7v2$M8fkN@ 6gU2bↁǓAwOӌAz#:Նh1VQSBS*p!|pI *[b\>WJ"<rE뒎?[dwUp -|(kU<]#\"O<}ϵG0+`#uj?|j}Sȇ{$ȇ/5_ӕ`N$Æ$5 WG"*%zF&N|k( k8~Wgr;/cGN- KY^<ݒBG*N>ȇN-+Έ'i8&#ȰE `HQ@ƫUѤՠ{:k_ec*?E}Rxԁu. aztN6)XX>Nm@)@_7US?zBƟBD?]ec:9YS?;|qwĿ`lRɗpvH :QϺJߦON"?C_E:MgHy^Chw*a #vIyi2B(4_92y[z98t*_ *"[? drex{>7oB"'ʿShl6#TmDQ#ȷ *> m.$ww'n<|$]`aIix*qW$v6l ;mbBKan)خ'$ػxIEӯ:3 !jB`:3.IdYB,YU"In{_u3C2cy}s}x+?~‰Agq_o}{ N` {|/1=; 1Tf6-xPTB,􇞞Ãx>^O 5~ޛ&7AecMt76A-hNcx=]$B4x6T/gA; @yTEx /`GPkpYbe }`D(%| ,Ȅt oQ . ື8}@ZMe r8j9;xEpM Ñ$Ы=M$po;ŋ́ @.Qj?* { 7wGh5(0167WZ<5&F˗/ˍWZA>R qrC>ؚ*В M ?mؚXء>XH{: L,M3`Ae6o@ea8j+j%J56|d 6 &+V[P S"%Q"8á?tO>,cL D"?ÿ  *CUԆkxlPS"}xos+@ϻCh|aPf2(\onc :8aI8C -͗-+ eɝtbݽX c+MCX!T &V45À9Fweˬl/5Y6*!#e@DI.1<|@0htnhnDi 6C5v'ި!˝͆/{^$pҤ//|GcG# ;8mSd_]0_@!A#FC2^6 eng~=>@8ۃt1HT 55l-Ła^ 2x|eq*"dFC&fS|5%~O=V> C!PNia: |߾Ё塚AF o D}Q3HĢ{81ZGhCH:D6$/PFHoḻi5717~3cdPG&hE?TW Yz*#!ݝnڵBJ Wu<E.%Lхv!ʗ9ryT^RGJSC)2"sq'T=ygmY}Tt͗+v5'_ _(x0wtt8p`ǎ۷owvvf2u{@bt Wa ܇Ƀprim ;MoէfĠ6)v<ԟ}q|a;>[zg GwqЄRac,C">PfkⰋ'>7-+j\\rRu@ _G"A9t!::  `pTC u*whlg(ׄj i}'Zf߾K\IBQ7"|ݡcn$E@2`07/{h`CT{gp68`!{' l=l^'`'$3H܏n`hNIǭoY&3ؑl? <8{7GIظgnSx7!7V<$soK8A- 薖?Ǥyx6Hiu䲺/>|I_6`O>r؝ s]@) [Ma-Dt'} ?|^g;[UvXs5*w&{OݵȆQM=1o?sbo\so܅ZoMdݬ"]_f3=o=-}t8;Og?ky㗗(lhiݾjjx߮=~ D_zƳ/_?z8\ĝby?|`:;㏫]]g~ŋPr喖ڒ\(LKK;qMLLd5QQQaaaLJb ~>c$Ia̲+wIMS][T"`q,'6|&ѹ>'nTe(<7aɵ ܦ8} GtNhNBYZ~u*3'Q'mmO9_hޑ$PNckikf7D.ݚoeZ7ƵUN[9YUQ~^K\FáٞEG }Zm{Pfݗw}8S8̒Oo^gUvTYǮ+ߵt߲uE#7؛{{ou̹s}y-}Csyٻn7%,?{Qb/ިFaX#:$Eo'vZa.u."VkQ Gsk+-KEr<גh` J~l>cI/;X_(WeMjgb %X5BLRzUHuVCM.D̴㳺oT**lV 7 ACXhK3L@:Ibtg|dy8~@tP9_ ͦjnɱ,7Qɷ̪43ޣ(m7/ /̐meG̦㺎)>Hޞ'QhY/7IׄgЍx6)ר+M YEɺG({,SP ZwkLDnDzuTV&$:,6Yd~9ʔ凘0^l|9mRrE0FoXsw("j1{p5!j;L3ݭ[gJ*-AM +.{~YDYyeQP}GftvkXmb[w؅htmjI#1($ZZXry| c*QBn6p[+Twɝ$W(V\ Rգ&3(6ͦQ±hy7Z<ĥd-1hڬS5[͑=26LvnF ӣb޷ˠp?,JUl3uj^*ST# NYl1U5=؇W>ភ35֔ؐcj˰hܗcQڹYi!j1s{5) JHeD[8}7):VFgP6nd~{2Qi<ǾV37wђ*G1f"H٬ r%ǂ|ΟA4%}w9HtsBuVe|緟wsD|DOz_K H{*aKeȑ˥H>1Ѯ#@2Ŭd3+2qK/Mڙj/|mi{'AS*GK#$rG㔈:71C|2oGk&q5}"psJu>YL+M.5δNhzP'K;`q҆ۧQzԣ}&{( b(yE;+Ŏ7^`bpO)kEYkY@j]/w 1u(0Lᚚ֬=eh6" cqk|A9@<=#XX5 l3',Pq|NM~~q G)BCQw 6, &*QᨅBxx24u8f5_JϮQ` u C.'|G=esSE` TuJs´\nx\l>GJPp{:! 9R^ ]sf+{A{WiO h/9z_=A_ /࿀kJ64c.'䮳C *14žBb򭩩 &)-f9IiDSᦜ43T8 ki2ݳR#B;uIb) sEWcT4K"vQ+$,Q){JCd%w}6mnT TIAeGQA[9tH{=J%%J]8ƀXUt~M@hA ~v $9NX3#X&)yHYEar f0"_JuO\N@6K '!LD`tk=4| BP1#mJIA|pc}Y4#rylB~,ɔj=&.p&F&C O$-7ZnkrMjBnzu/->$^4XH҉ 5(8}k!fU&vW"xFS]#U-kEQ??i/Y /࿀oKe%Wr! ~;뮓ih=Kl+{0+'Pʝ\Xވg֢?8,ƺص>Ox7v |,<.( ݥ;(YHC/Ep&]ո7IYJ&E{~{ 鋴( S'#air cEl4jxJ*QJMฌ =JZ '{ ilGlZ-P+T a\9tfR4(V:v&T/dE˝׾0&LhAsHME;%΄H|4k*F)kX(l_hz]"'!_.*p, _a6pMh܊v S+!P8d=Z:6@:]5[gdLEGS5 *t~|`1mq/Oϵ Jw[je%9}@fZLH"{SӏУk &/ynaB #-%BSvSJ!jRFEX-K"f!`"| Uǽ?ϰ3ZɵV9E$#hؒ|>~Gi>?@K+|~v> p76?? z~\H<9ťs4˯mg9,Fy\UVtgS-92;Q~ퟶ/Wer~Z 2'\|]66I6>{Ǿ)TXYaW*[6xn*ti΍YMw7^̴ZB:2=蠹v`$k8>pzln]:`fN83IMFcxÑZ&$VD( !B_/8UJ'Usek1# m'fwtfWN<1nw9ƛl B6D:l&ߟx`,Q$N<;vyd槵#76eδ dvH7G7?i3=rј1>]Z>sַLW[v'"=}Rf'ƍe*86[z w>vw__@*&࿀/ke@&Ot?ϪSx0#e"|릊;N &*ոv4W6xT 4_?w~r]}X/eJ@BNbj Rsi` N-CۙF/UT˸1_q챪 !h{-nu$f0lbLwچCٴ-ޭ<ٟ\S݃#q7[B[ Eެv`}|HՋ0vfUϷV>h}55˶_?oagc]&Km՞)OXU^yhi.]PDo`7Cn$ѱ(83^]5 h9N J6'zxJ^ӘDTk߿F:Oƅ)#\~90 rc9$PbT/o=ftw|JRwr)^Hض"(;*ӭ1ų?2vtVDk˼rfݺCXرQD*[ZZNݹ3c!J H(4KkhahfΙ׳7'8Zuv}@ԘͲko[sXps-"ai~Ȋ9<ܗxGC_Gl蠻ynwgn)[Xs\ 1bËWaZ+^wQ4n>mH5 +K?Kj'Z/\ڢ8kEL޿c*n8?ig[+C?Ǜ;R+'sUk| dYpL{nc 2_y6#-NF7aD]ʮǚW{aܥ2v3??zO}+}?j߬_lO,.V]zÉ#n]ݱOveoMlqov־A5Fæ5GSOmizƏ>_QSۣ]JCu3>%<2dn59>*/N5fئOZp״onñUq@6|l^7nKAҵ 챿q7y?םr{?MnDO _-]6zڼYXW4}ξ6隣;=swS?5-!W}36w=c|{L$zP_}7z$vf;Չ.BŒoũ`*j2+(̞q_/))Iܳ؉?nCdK_^:kɄ/H/2Cx}9LoR2ݎ $`ȁ;+o yޱ.k숹>^7yo숅w\XrכwϚ:,~Q?vV}~E][?pχ;W'ʳW׼?Gc^T]w/wU>?TP?T N_߮vdB={]?az_}߆03gjז_pNn?ۨS68ħמޙNǝ:R{U~9J|g V,x,{r݊iw5;"} ̿AGLEOY{{xfά v-8r{WjePa/?343i]!5Ůom?8?rw9bj]߼6<9N,שQm  @H EDffnzvg`"itB?kTHYUfޙ/UD^(\Lӄ⿠AUIyʔ ٠<ءf;Ŭd6x)ʖ-WVVVIʒ[$/%tV҈2g4HF9{ZEWZdra6,: EuެǰKwΑJ@t 1pJ+KK!e&=n LԔX:R&L9 ~ʕ 5ꦐz :բ:ӕYPD ,[3" :IՔbA&ʜON*p-h nDHԂ USuLa1/`ېΠ* 1VZdMͣʒ!UjRe, = }p YVd*dB֠h ^[SF:R@1j/mm> <@? 5IRaݴc&>W0~瓄N1, TkJ*+n@ӢfUp|Dt?C%c_p J6p@t*(4;3h1Ã|By&-J2q >A?!>J%n.+Q[:*1,-IIrِ7M'czOhv0Pt g}E9htcz*Brs:tCPR+)) 2Zm/pN PuTzVV wb/,ZA(Ɠ I;PMƪfd(fУj0B084XQ^L4[HbxG2)VX /-.dns2GsEuuB1"QB"n%#Wpbpe?M({fZTb9EgҹGfOO0%s|þӧe дH\wzE/ak~J$ʚ+EyUx^I궶!Z#6@ؼ:}:S)C?'^h_JgG'TY5{p_z 䳍R~BdyT~bdFҝ,YaqSdHV% LCpւx4,z@凞z4hВ}cq*0{RW!tGd$U18+034e8;o-ɧ~Eyed0n1p[Jz R0 -:*ڥnF75 eeInn Sjr7TbA,(aG _KSFSL @hZfx`T :'9]2C#JeK$31;>[.J5S;&㘘@)sv>F?xQ^w:i}~ͪ*B:!(??4xelPΔ럒lyk(M 7KCc&PpR,jv:Ct>_PR+9[/@PO"<4%m N謦 F캱K`m k} ofIlkYʑ@N {_"xtwH&, GHP>0&須{:NTM:2=!(B*cgz [._B ws9' K|P4CLՐJf7RjyN F2r,M!0 ]2pҩ:ݲ xCL74% I9 htVҵ~p"ōˬ_XZNܣ@n&MM4 1\]VrWubI`p$HgI + .(% V$ $@z%x r/ tۢ$a)L{@S/ 5$\%*c{ pd =ȞοQEHC a\0j(2dQ 9 t0T5U7=O9S"cVs>fNB=OAw&Iq*s鐲0XAae5AQ$2%z0K!Fܨ%W$6k툴` ěM@rdA:RfYGb.,d' S|/uYz"=/IZ"fhy+8+?0nZ\@`$} Ąk#u=1dϜH-l^*{{m:(ȅ4nC3)tIs9`& $'H6]& &R v0.0>sMۗ3Xt/(nkSI^D ')u Ob}$d6έ08K˃P.!Tt/,quNͲh8>GW0$oKY{$?`MʝS.udDaC BI8EZN6 IY)qP">yO5?ѷLIDMnVNw"m͒lF-vdRg.< I y:, %:^^Wƨո4mcU۞sϵ:&.ϝ""l9bER|]҆Wϋ ^#A tn}in̠7. d\6xk2a-2`-ڲq` 3^L~,&Kӂ{3n)%1ԦV U2$CDŽ -m)hi"2I} Z2a32BAK Z2-ۢP _1S _܈K -ZɤI+bE9^gm)T:R*DNZ#/h093KB1 rb v_]#iExVh]xc^],*;XwkΑr|KE1+`$Ef#& Nx1=7C%<ì$h5YДJ HyN dwm}݀+dvM<I H- ]1cÓ$CIzլ?$Dwu|6c,<6h{G9Bxh@A 9@iҶdIu4 K s(<l?C&#hk03y2%=+ew@v8u.uEXmLڝJV㤗``&2"|VDd qF &qe8-",Ǣl@ /9Y&<3E =*{Z q(V;JM[`g}8nnqLy,}LgTT|Mꁖ >Mb*A%+Jƾe/C% @J5SKL”Bh3|>L9|Y2Xw#eN4D=q;mf*S Jʢ1Hv [7'6$ @ n̑+^߶REjA{r]r ]Ѳ~'Mo%D0͗{m4[ Ƿ,\"밝X<]o&*6DʨbfEr7' dP+4Zm3iFb Q;_-3{>[z@~;IW2Ţ5Bv8H<(Ú+QĻiIyM]ën@( m װ_G2=xr`w`i&Ep0 8Cd6c* CMuw1ߖRGcr;mxgGj*H)`"D~~?~3h˳~N#}s}'DoΑa8R^ƢIY)J璊|r=(^ñ+!w=gt1^䊌V<8p< Ño1UMyJ)$ؙ&Noh;jYUl| P2oFyuncHo {d&3a4[T>ᡧNbz: _&Ⴢ6,:69 ӷ}63'Y:h5Pa/ nt:pR֘:ҬIWtoXe ؟^AԲv;k>p2,Ex 0g <9#MgjAKAibǽa.qfc8 , Ņl$mR!!SJeDz8YkoX702tآm݋Y)[ͱ5$K ) 9u5ɖԛWi 25e,BYyOwgRIӅDl!AKgCnco-V6tQ++IaD*8bzbBLPR)t*=c&g !HGH:ݣ<,~i:w`^b*VҗfɮO3 @-L8țbקaхfMTw'\Pb0c-8Qwa7}4"$7ꊓηM,Br{ad%@3lPbdU*UJURT*UJUR5Clibxalan2-java-2.7.1/xdocs/style/0000755000175000017500000000000010736146354015571 5ustar mkochmkochlibxalan2-java-2.7.1/xdocs/style/loader.xml0000644000175000017500000000035310721374034017552 0ustar mkochmkoch libxalan2-java-2.7.1/xdocs/style/graphics/0000755000175000017500000000000010736146354017371 5ustar mkochmkochlibxalan2-java-2.7.1/xdocs/style/graphics/button-b.gif0000644000175000017500000000023210721374034021577 0ustar mkochmkochGIF89ax ױ~~~}}}jjjiii,x OA8ͻ`WRhh䴾p,lFT`jgȤUʨR@0*Ot Zy0{sdyKj;libxalan2-java-2.7.1/xdocs/style/graphics/button-a.gif0000644000175000017500000000026310721374033021601 0ustar mkochmkochGIF89ax xx¬yppxooe]]d\\!,x @`@8ͻ`(`hlp,‘'|@H*Ȥd@@pJjuDxL.޴zv>븜FE|yX;libxalan2-java-2.7.1/xdocs/style/dtd/0000755000175000017500000000000010736146354016344 5ustar mkochmkochlibxalan2-java-2.7.1/xdocs/style/dtd/changes.dtd0000644000175000017500000000115110721374034020437 0ustar mkochmkoch %markupEntity; libxalan2-java-2.7.1/xdocs/style/dtd/faqs.dtd0000644000175000017500000000063110721374034017763 0ustar mkochmkoch %blocksEntity; libxalan2-java-2.7.1/xdocs/style/dtd/markup.ent0000644000175000017500000000117010721374033020341 0ustar mkochmkoch %externalEntity; %charEntity; %linksEntity; libxalan2-java-2.7.1/xdocs/style/dtd/book.dtd0000644000175000017500000000266210721374033017770 0ustar mkochmkoch %externalEntity; libxalan2-java-2.7.1/xdocs/style/dtd/document.dtd0000644000175000017500000000076610721374034020660 0ustar mkochmkoch %blocksEntity; libxalan2-java-2.7.1/xdocs/style/dtd/links.ent0000644000175000017500000000127010721374033020163 0ustar mkochmkoch libxalan2-java-2.7.1/xdocs/style/dtd/characters.ent0000644000175000017500000010076210721374034021171 0ustar mkochmkoch libxalan2-java-2.7.1/xdocs/style/dtd/blocks.ent0000644000175000017500000000155010721374034020322 0ustar mkochmkoch %markupEntity; libxalan2-java-2.7.1/xdocs/style/dtd/spec.dtd0000644000175000017500000006505410721374034017775 0ustar mkochmkoch libxalan2-java-2.7.1/xdocs/style/dtd/xsl-html40s.dtd0000644000175000017500000012435010721374034021135 0ustar mkochmkoch ]]> libxalan2-java-2.7.1/xdocs/style/stylesheets/0000755000175000017500000000000010736146354020145 5ustar mkochmkochlibxalan2-java-2.7.1/xdocs/style/stylesheets/book2group.xsl0000644000175000017500000000166510721374034022766 0ustar mkochmkoch libxalan2-java-2.7.1/xdocs/style/stylesheets/group2document.xsl0000644000175000017500000000137510721374033023647 0ustar mkochmkoch

Read the document or jump directly to:

  • libxalan2-java-2.7.1/xdocs/style/stylesheets/faqs2document.xsl0000644000175000017500000000310410721374034023436 0ustar mkochmkoch



  • libxalan2-java-2.7.1/xdocs/style/stylesheets/any2project.xsl0000644000175000017500000000070710721374034023131 0ustar mkochmkoch libxalan2-java-2.7.1/xdocs/style/stylesheets/document2html.xsl0000644000175000017500000004743110721374034023463 0ustar mkochmkoch

     Transform XML Document

    Document to transform Display output as
    HTML   HTML Source     
    libxalan2-java-2.7.1/samples/AppletXMLtoHTML/s1ToHTML.xsl0000644000175000017500000001046010721374040021644 0ustar mkochmkoch <xsl:value-of select="@title"/>

      NOTE:  

     
     
  •    
    libxalan2-java-2.7.1/samples/AppletXMLtoHTML/xalanApplets.xml0000644000175000017500000000147110721374036022766 0ustar mkochmkoch
    1. Include org.apache.xalan.xslt.client.XSLTProcessorApplet in an HTML client.

    2. Specify the XML source document and XSL stylesheet.

      You can use the DocumentURL and StyleURL PARAM tags or the setDocumentURL() and setStyleURL() methods. If the XML document contains a stylesheet Processing Instruction (PI), you do not need to specify an XSL stylesheet.

    3. Call the getHtmlText() method, which performs the transformation and returns the new document as a String.

    libxalan2-java-2.7.1/samples/AppletXMLtoHTML/rabbitwhorn.jpg0000644000175000017500000000627410721374035022640 0ustar mkochmkochJFIFHHC  !"$"$ChL"4!1"AQaq#2$BR ?4hѠ4hѠ56lGMG$}=L{ O`Nii[v^ʂ 2%<+펆8x 洭^zifDoř$Rs|O:ޖJWdN0 ' VsT^#FwyBFfgU398֫ ׶ѳI<2ޕ44h 8'^;?Bh?^$ ᖞ/6x2FC)W߶ߥ4;"E2+9?Vl8 sS;BSWv_Y3N$aqn}¾ٯ;,Jt櫖TYpвGӜp~uX`RyשKX+K +FeWu瓑_VڬEҥJ*v1!1(B 2`g̭w f+,zX,,?Sc\Qݶw)YCfht1_Tpqג< MQ*Ձ*ޚ/Tdģ$dh7N_oե7_noW\IĎ= ~9ΩI2Z6 #T85Q" Q1FWg9Y7Ϫ&r{thѠH8{k6Ե5=uuJTEN_, $\cmi#IPf@qgZfhfIBʭ㌃@O|FH϶ck%YS@D#ہηh}o~kcN%GR2z0=iWeYiJy3Vlˮ߲U sиF1 ۖo DR)WF1yYTkSdޔ7=칦[bxqʟg$F;![7*ihf S+=>Hƭv -.ѾJ %V\Xp,_w϶Pw--sJzIގa!zT1{cLj3c-%/D8ۤ|9Nﶶw)|7t2QPYjP# ry*6`-2+RecI,  w\uqqlIm^QK,}\V1%s,sBţtWSb3zm:hQҽQQm|*8z<9Wf[b0&H!`O<魵.XjYL4sEt{眝R^<<o륷\0](=aﭽ}m-=C-,Bf̭( ~:mpKndΒF%I'p"ezz@:缭[76櫅Z~B+0 9 KfmTMnI)bjf2 1{ˁnHLS],o=$CO>zݭx!I'Hz 3렣l%U}UۺHB0ppG5hϽe-KVTkH+(-1pGIbꐬh^k~[$&zA54;sZu[OL)` sӓ{i}ᗌbKiRMXSqP on˵*+=Z|u+Cg'TG`6zn-@ےGVt钭 `t)h320I䏘t6=&{Hb-CD;r~]4\]|ޱEf90ۜGqp2#}% `9<4PxwUKEy]@Q$c3:i:Qe,;+mfޫFƌK(f<MyUJ#̣'#AWvZ(աTK9 U@SO|QUQr a씮R (`3,X-ɸ%X,ΠcT`9.XIW+E _/$2iڅ}8]Ap{Pn7 M9D@Hnν cg!YEI.Fii#G?1vbٰw]uz%]#<(v_NZhjh(iz:cGVOH=>}NY+j6$fh/H9g>cAjõ)X0 $^_?XT[VlK`)~ƫԦT0[ Transformation API For XML (TrAX) November 12, 2000 Scott Boag IBM Research
    Scott_Boag@us.ibm.com
    Introduction This overview describes the set of APIs contained in javax.xml.transform, javax.xml.transform.stream, javax.xml.transform.dom, and javax.xml.transform.sax. For the sake of brevity, these interfaces are referred to as TrAX (Transformation API for XML). There is a broad need for Java applications to be able to transform XML and related tree-shaped data structures. In fact, XML is not normally very useful to an application without going through some sort of transformation, unless the semantic structure is used directly as data. Almost all XML-related applications need to perform transformations. Transformations may be described by Java code, Perl code, XSLT Stylesheets, other types of script, or by proprietary formats. The inputs, one or multiple, to a transformation, may be a URL, XML stream, a DOM tree, SAX Events, or a proprietary format or data structure. The output types are the pretty much the same types as the inputs, but different inputs may need to be combined with different outputs. The great challenge of a transformation API is how to deal with all the possible combinations of inputs and outputs, without becoming specialized for any of the given types. The Java community will greatly benefit from a common API that will allow them to understand and apply a single model, write to consistent interfaces, and apply the transformations polymorphically. TrAX attempts to define a model that is clean and generic, yet fills general application requirements across a wide variety of uses. General Terminology This section will explain some general terminology used in this document. Technical terminology will be explained in the Model section. In many cases, the general terminology overlaps with the technical terminology. Tree This term, as used within this document, describes an abstract structure that consists of nodes or events that may be produced by XML. A Tree physically may be a DOM tree, a series of well balanced parse events (such as those coming from a SAX2 ContentHander), a series of requests (the result of which can describe a tree), or a stream of marked-up characters. Source Tree(s) One or more trees that are the inputs to the transformation. Result Tree(s) One or more trees that are the output of the transformation. Transformation The process of consuming a stream or tree to produce another stream or tree. Identity (or Copy) Transformation The process of transformation from a source to a result, making as few structural changes as possible and no informational changes. The term is somewhat loosely used, as the process is really a copy. from one "format" (such as a DOM tree, stream, or set of SAX events) to another. Serialization The process of taking a tree and turning it into a stream. In some sense, a serialization is a specialized transformation. Parsing The process of taking a stream and turning it into a tree. In some sense, parsing is a specialized transformation. Transformer A Transformer is the object that executes the transformation. Transformation instructions Describes the transformation. A form of code, script, or simply a declaration or series of declarations. Stylesheet The same as "transformation instructions," except it is likely to be used in conjunction with XSLT. Templates Another form of "transformation instructions." In the TrAX interface, this term is used to describe processed or compiled transformation instructions. The Source flows through a Templates object to be formed into the Result. Processor A general term for the thing that may both process the transformation instructions, and perform the transformation. DOM Document Object Model, specifically referring to the Document Object Model (DOM) Level 2 Specification. SAX Simple API for XML, specifically referring to the SAX 2.0 release. Requirements The following requirements have been determined from broad experience with XML projects from the various members participating on the JCP. TrAX must provide a clean, simple interface for simple uses. TrAX must be powerful enough to be applied to a wide range of uses, such as, e-commerce, content management, server content delivery, and client applications. A processor that implements a TrAX interface must be optimizeable. Performance is a critical issue for most transformation use cases. As a specialization of the above requirement, a TrAX processor must be able to support a compiled model, so that a single set of transformation instructions can be compiled, optimized, and applied to a large set of input sources. TrAX must not be dependent an any given type of transformation instructions. For instance, it must remain independent of XSLT. TrAX must be able to allow processors to transform DOM trees. TrAX must be able to allow processors to produce DOM trees. TrAX must allow processors to transform SAX events. TrAX must allow processors to produce SAX events. TrAX must allow processors to transform streams of XML. TrAX must allow processors to produce XML, HTML, and other types of streams. TrAX must allow processors to implement the various combinations of inputs and outputs within a single processor. TrAX must allow processors to implement only a limited set of inputs. For instance, it should be possible to write a processor that implements the TrAX interfaces and that only processes DOM trees, not streams or SAX events. TrAX should allow a processor to implement transformations of proprietary data structures. For instance, it should be possible to implement a processor that provides TrAX interfaces that performs transformation of JDOM trees. TrAX must allow the setting of serialization properties, without constraint as to what the details of those properties are. TrAX must allow the setting of parameters to the transformation instructions. TrAX must support the setting of parameters and properties as XML Namespaced items (i.e., qualified names). TrAX must support URL resolution from within the transformation, and have it return the needed data structure. TrAX must have a mechanism for reporting errors and warnings to the calling application. Model The section defines the abstract model for TrAX, apart from the details of the interfaces. A TRaX TransformerFactory is an object that processes transformation instructions, and produces Templates (in the technical terminology). A Templates object provides a Transformer, which transforms one or more Sources into one or more Results. To use the TRaX interface, you create a TransformerFactory, which may directly provide a Transformers, or which can provide Templates from a variety of Sources. The Templates object is a processed or compiled representation of the transformation instructions, and provides a Transformer. The Transformer processes a Source according to the instructions found in the Templates, and produces a Result. The process of transformation from a tree, either in the form of an object model, or in the form of parse events, into a stream, is known as serialization. We believe this is the most suitable term for this process, despite the overlap with Java object serialization. ProcessorGeneric concept for the set of objects that implement the TrAX interfaces. Create compiled transformation instructions, transform sources, and manage transformation parameters and properties.Only the Templates object can be used concurrently in multiple threads. The rest of the processor does not do synchronized blocking, and so may not be used to perform multiple concurrent operations. TransformerFactory Serve as a vendor-neutral Processor interface for XSLT and similar processors. Serve as a factory for a concrete implementation of an TransformerFactory, serve as a direct factory for Transformer objects, serve as a factory for Templates objects, and manage processor specific features. A TransformerFactory may not perform mulitple concurrent operations. Templates The runtime representation of the transformation instructions. A data bag for transformation instructions; act as a factory for Transformers. Threadsafe for concurrent usage over multiple threads once construction is complete. Transformer Act as a per-thread execution context for transformations, act as an interface for performing the transformation.Perform the transformation. Only one instance per thread is safe. The Transformer is bound to the Templates object that created it. Source Serve as a single vendor-neutral object for multiple types of input. Act as simple data holder for System IDs, DOM nodes, streams, etc. Threadsafe concurrently over multiple threads for read-only operations; must be synchronized for edit operations. Result ResultTarget Serve as a single object for multiple types of output, so there can be simple process method signatures. Act as simple data holder for output stream, DOM node, ContentHandler, etc. Threadsafe concurrently over multiple threads for read-only, must be synchronized for edit.
    libxalan2-java-2.7.1/samples/AppletXMLtoHTML/appletXMLtoHTML.html0000644000175000017500000000245710721374036023401 0ustar mkochmkoch Using an applet to perform XSL transformations libxalan2-java-2.7.1/samples/AppletXMLtoHTML/lts3611beac.jpg0000644000175000017500000001627410721374036022251 0ustar mkochmkochOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOlibxalan2-java-2.7.1/samples/AppletXMLtoHTML/target.html0000644000175000017500000000172110721374035021761 0ustar mkochmkoch Untitled   libxalan2-java-2.7.1/samples/AppletXMLtoHTML/foo-s1.xml0000644000175000017500000000014010721374036021426 0ustar mkochmkoch

    Hello

    libxalan2-java-2.7.1/samples/AppletXMLtoHTML/README.html0000644000175000017500000000333410721374037021434 0ustar mkochmkoch Xalan Sample Applet

     Running the Xalan sample applet


    • appletXMLtoHTML.html transforms XML into HTML, and displays the XML document and XSL stylesheet as well as the HTML transformation result.

    • The applet looks for xalan.jar, xercesImpl.jar, xml-apis.jar and serializer.jar in the bin directory. If the JAR files are elsewhere, you must move them or adjust the applet archive setting in client.html.

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/trax/0000755000175000017500000000000010736146354015733 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/ExampleContentHandler.java0000644000175000017500000000616710721374037023027 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExampleContentHandler.java 470245 2006-11-02 06:34:33Z minchau $ */ import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; public class ExampleContentHandler implements ContentHandler { public void setDocumentLocator (Locator locator) { System.out.println("setDocumentLocator"); } public void startDocument () throws SAXException { System.out.println("startDocument"); } public void endDocument() throws SAXException { System.out.println("endDocument"); } public void startPrefixMapping (String prefix, String uri) throws SAXException { System.out.println("startPrefixMapping: "+prefix+", "+uri); } public void endPrefixMapping (String prefix) throws SAXException { System.out.println("endPrefixMapping: "+prefix); } public void startElement (String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { System.out.print("startElement: "+namespaceURI+", "+localName+ ", "+qName); int n = atts.getLength(); for(int i = 0; i < n; i++) { System.out.print(", "+atts.getQName(i)); } System.out.println(""); } public void endElement (String namespaceURI, String localName, String qName) throws SAXException { System.out.println("endElement: "+namespaceURI+", "+localName+ ", "+qName); } public void characters (char ch[], int start, int length) throws SAXException { String s = new String(ch, start, (length > 30) ? 30 : length); if(length > 30) System.out.println("characters: \""+s+"\"..."); else System.out.println("characters: \""+s+"\""); } public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { System.out.println("ignorableWhitespace"); } public void processingInstruction (String target, String data) throws SAXException { System.out.println("processingInstruction: "+target+", "+target); } public void skippedEntity (String name) throws SAXException { System.out.println("skippedEntity: "+name); } } libxalan2-java-2.7.1/samples/trax/xsl/0000755000175000017500000000000010736146354016541 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/xsl/baz.xsl0000644000175000017500000000253010721374037020040 0ustar mkochmkoch libxalan2-java-2.7.1/samples/trax/xsl/foo2.xsl0000644000175000017500000000226610721374037020137 0ustar mkochmkoch libxalan2-java-2.7.1/samples/trax/xsl/inc1/0000755000175000017500000000000010736146354017373 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/xsl/inc1/inc2/0000755000175000017500000000000010736146354020226 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/xsl/inc1/inc2/inc2.xsl0000644000175000017500000000202210721374037021600 0ustar mkochmkoch libxalan2-java-2.7.1/samples/trax/xsl/inc1/inc1.xsl0000644000175000017500000000177010721374037020755 0ustar mkochmkoch libxalan2-java-2.7.1/samples/trax/xsl/foo3.xsl0000644000175000017500000000227010721374037020133 0ustar mkochmkoch libxalan2-java-2.7.1/samples/trax/xsl/foo.xsl0000644000175000017500000000316310721374035020050 0ustar mkochmkoch default param value , libxalan2-java-2.7.1/samples/trax/Examples.java0000644000175000017500000007643710721374035020366 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Examples.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLFilter; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * Some examples to show how the Simple API for Transformations * could be used. * * Xalan Developers: please see * xml-xalan/test/java/src/org/apache/qetest/trax/ExamplesTest.java * when updating this file, and update that test file as well. * * @author Scott Boag */ public class Examples { /** * Method main */ public static void main(String argv[]) throws TransformerException, TransformerConfigurationException, IOException, SAXException, ParserConfigurationException, FileNotFoundException { System.out.println("\n\n==== exampleSimple ===="); try { exampleSimple1("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleSimple2 (see foo.out) ===="); try { exampleSimple2("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleFromStream ===="); try { exampleFromStream("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleFromReader ===="); try { exampleFromReader("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleUseTemplatesObj ===="); try { exampleUseTemplatesObj("xml/foo.xml", "xml/baz.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleContentHandlerToContentHandler ===="); try { exampleContentHandlerToContentHandler("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleXMLReader ===="); try { exampleXMLReader("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleXMLFilter ===="); try { exampleXMLFilter("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleXMLFilterChain ===="); try { exampleXMLFilterChain("xml/foo.xml", "xsl/foo.xsl", "xsl/foo2.xsl", "xsl/foo3.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleDOM2DOM ===="); try { exampleDOM2DOM("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleParam ===="); try { exampleParam("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleTransformerReuse ===="); try { exampleTransformerReuse("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleOutputProperties ===="); try { exampleOutputProperties("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleUseAssociated ===="); try { exampleUseAssociated("xml/foo.xml"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleContentHandler2DOM ===="); try { exampleContentHandler2DOM("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleAsSerializer ===="); try { exampleAsSerializer("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n\n==== exampleContentHandler2DOM ===="); try { exampleContentHandler2DOM("xml/foo.xml", "xsl/foo.xsl"); } catch( Exception ex ) { handleException(ex); } System.out.println("\n==== done! ===="); } /** * Show the simplest possible transformation from system id * to output stream. */ public static void exampleSimple1(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException { // Create a transform factory instance. TransformerFactory tfactory = TransformerFactory.newInstance(); // Create a transformer for the stylesheet. Transformer transformer = tfactory.newTransformer(new StreamSource(xslID)); // Transform the source XML to System.out. transformer.transform( new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); } /** * Show the simplest possible transformation from File * to a File. */ public static void exampleSimple2(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException { // Create a transform factory instance. TransformerFactory tfactory = TransformerFactory.newInstance(); // Create a transformer for the stylesheet. Transformer transformer = tfactory.newTransformer(new StreamSource(xslID)); // Transform the source XML to foo.out. transformer.transform( new StreamSource(new File(sourceID)), new StreamResult(new File("foo.out"))); } /** * Show simple transformation from input stream to output stream. */ public static void exampleFromStream(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, FileNotFoundException { // Create a transform factory instance. TransformerFactory tfactory = TransformerFactory.newInstance(); InputStream xslIS = new BufferedInputStream(new FileInputStream(xslID)); StreamSource xslSource = new StreamSource(xslIS); // Note that if we don't do this, relative URLs can not be resolved correctly! xslSource.setSystemId(xslID); // Create a transformer for the stylesheet. Transformer transformer = tfactory.newTransformer(xslSource); InputStream xmlIS = new BufferedInputStream(new FileInputStream(sourceID)); StreamSource xmlSource = new StreamSource(xmlIS); // Note that if we don't do this, relative URLs can not be resolved correctly! xmlSource.setSystemId(sourceID); // Transform the source XML to System.out. transformer.transform( xmlSource, new StreamResult(new OutputStreamWriter(System.out))); } /** * Show simple transformation from reader to output stream. In general * this use case is discouraged, since the XML encoding can not be * processed. */ public static void exampleFromReader(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, FileNotFoundException, UnsupportedEncodingException { // Create a transform factory instance. TransformerFactory tfactory = TransformerFactory.newInstance(); // Note that in this case the XML encoding can not be processed! Reader xslReader = new BufferedReader(new InputStreamReader(new FileInputStream(xslID), "UTF-8")); StreamSource xslSource = new StreamSource(xslReader); // Note that if we don't do this, relative URLs can not be resolved correctly! xslSource.setSystemId(xslID); // Create a transformer for the stylesheet. Transformer transformer = tfactory.newTransformer(xslSource); // Note that in this case the XML encoding can not be processed! Reader xmlReader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceID), "UTF-8")); StreamSource xmlSource = new StreamSource(xmlReader); // Note that if we don't do this, relative URLs can not be resolved correctly! xmlSource.setSystemId(sourceID); // Transform the source XML to System.out. transformer.transform( xmlSource, new StreamResult(new OutputStreamWriter(System.out))); } /** * Show the simplest possible transformation from system id to output stream. */ public static void exampleUseTemplatesObj(String sourceID1, String sourceID2, String xslID) throws TransformerException, TransformerConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); // Create a templates object, which is the processed, // thread-safe representation of the stylesheet. Templates templates = tfactory.newTemplates(new StreamSource(xslID)); // Illustrate the fact that you can make multiple transformers // from the same template. Transformer transformer1 = templates.newTransformer(); Transformer transformer2 = templates.newTransformer(); System.out.println("\n\n----- transform of "+sourceID1+" -----"); transformer1.transform(new StreamSource(sourceID1), new StreamResult(new OutputStreamWriter(System.out))); System.out.println("\n\n----- transform of "+sourceID2+" -----"); transformer2.transform(new StreamSource(sourceID2), new StreamResult(new OutputStreamWriter(System.out))); } /** * Show the Transformer using SAX events in and SAX events out. */ public static void exampleContentHandlerToContentHandler(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, SAXException, IOException { TransformerFactory tfactory = TransformerFactory.newInstance(); // Does this factory support SAX features? if (tfactory.getFeature(SAXSource.FEATURE)) { // If so, we can safely cast. SAXTransformerFactory stfactory = ((SAXTransformerFactory) tfactory); // A TransformerHandler is a ContentHandler that will listen for // SAX events, and transform them to the result. TransformerHandler handler = stfactory.newTransformerHandler(new StreamSource(xslID)); // Set the result handling to be a serialization to System.out. Result result = new SAXResult(new ExampleContentHandler()); handler.setResult(result); // Create a reader, and set it's content handler to be the TransformerHandler. XMLReader reader=null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } if( reader==null ) reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(handler); // It's a good idea for the parser to send lexical events. // The TransformerHandler is also a LexicalHandler. reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); // Parse the source XML, and send the parse events to the TransformerHandler. reader.parse(sourceID); } else { System.out.println( "Can't do exampleContentHandlerToContentHandler because tfactory is not a SAXTransformerFactory"); } } /** * Show the Transformer as a SAX2 XMLReader. An XMLFilter obtained * from newXMLFilter should act as a transforming XMLReader if setParent is not * called. Internally, an XMLReader is created as the parent for the XMLFilter. */ public static void exampleXMLReader(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, SAXException, IOException // , ParserConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); if(tfactory.getFeature(SAXSource.FEATURE)) { XMLReader reader = ((SAXTransformerFactory) tfactory).newXMLFilter(new StreamSource(xslID)); reader.setContentHandler(new ExampleContentHandler()); reader.parse(new InputSource(sourceID)); } else System.out.println("tfactory does not support SAX features!"); } /** * Show the Transformer as a simple XMLFilter. This is pretty similar * to exampleXMLReader, except that here the parent XMLReader is created * by the caller, instead of automatically within the XMLFilter. This * gives the caller more direct control over the parent reader. */ public static void exampleXMLFilter(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, SAXException, IOException // , ParserConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); XMLReader reader=null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } if( reader==null ) reader = XMLReaderFactory.createXMLReader(); // The transformer will use a SAX parser as it's reader. reader.setContentHandler(new ExampleContentHandler()); try { reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); reader.setFeature("http://apache.org/xml/features/validation/dynamic", true); } catch (SAXException se) { // What can we do? // TODO: User diagnostics. } XMLFilter filter = ((SAXTransformerFactory) tfactory).newXMLFilter(new StreamSource(xslID)); filter.setParent(reader); // Now, when you call transformer.parse, it will set itself as // the content handler for the parser object (it's "parent"), and // will then call the parse method on the parser. filter.parse(new InputSource(sourceID)); } /** * This example shows how to chain events from one Transformer * to another transformer, using the Transformer as a * SAX2 XMLFilter/XMLReader. */ public static void exampleXMLFilterChain( String sourceID, String xslID_1, String xslID_2, String xslID_3) throws TransformerException, TransformerConfigurationException, SAXException, IOException { TransformerFactory tfactory = TransformerFactory.newInstance(); Templates stylesheet1 = tfactory.newTemplates(new StreamSource(xslID_1)); Transformer transformer1 = stylesheet1.newTransformer(); // If one success, assume all will succeed. if (tfactory.getFeature(SAXSource.FEATURE)) { SAXTransformerFactory stf = (SAXTransformerFactory)tfactory; XMLReader reader=null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } if( reader==null ) reader = XMLReaderFactory.createXMLReader(); XMLFilter filter1 = stf.newXMLFilter(new StreamSource(xslID_1)); XMLFilter filter2 = stf.newXMLFilter(new StreamSource(xslID_2)); XMLFilter filter3 = stf.newXMLFilter(new StreamSource(xslID_3)); if (null != filter1) // If one success, assume all were success. { // transformer1 will use a SAX parser as it's reader. filter1.setParent(reader); // transformer2 will use transformer1 as it's reader. filter2.setParent(filter1); // transform3 will use transform2 as it's reader. filter3.setParent(filter2); filter3.setContentHandler(new ExampleContentHandler()); // filter3.setContentHandler(new org.xml.sax.helpers.DefaultHandler()); // Now, when you call transformer3 to parse, it will set // itself as the ContentHandler for transform2, and // call transform2.parse, which will set itself as the // content handler for transform1, and call transform1.parse, // which will set itself as the content listener for the // SAX parser, and call parser.parse(new InputSource("xml/foo.xml")). filter3.parse(new InputSource(sourceID)); } else { System.out.println( "Can't do exampleXMLFilter because "+ "tfactory doesn't support asXMLFilter()"); } } else { System.out.println( "Can't do exampleXMLFilter because "+ "tfactory is not a SAXTransformerFactory"); } } /** * Show how to transform a DOM tree into another DOM tree. * This uses the javax.xml.parsers to parse an XML file into a * DOM, and create an output DOM. */ public static Node exampleDOM2DOM(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, SAXException, IOException, ParserConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); if (tfactory.getFeature(DOMSource.FEATURE)) { Templates templates; { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setNamespaceAware(true); DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); org.w3c.dom.Document outNode = docBuilder.newDocument(); Node doc = docBuilder.parse(new InputSource(xslID)); DOMSource dsource = new DOMSource(doc); // If we don't do this, the transformer won't know how to // resolve relative URLs in the stylesheet. dsource.setSystemId(xslID); templates = tfactory.newTemplates(dsource); } Transformer transformer = templates.newTransformer(); DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); // Note you must always setNamespaceAware when building .xsl stylesheets dfactory.setNamespaceAware(true); DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); org.w3c.dom.Document outNode = docBuilder.newDocument(); Node doc = docBuilder.parse(new InputSource(sourceID)); transformer.transform(new DOMSource(doc), new DOMResult(outNode)); Transformer serializer = tfactory.newTransformer(); serializer.transform(new DOMSource(outNode), new StreamResult(new OutputStreamWriter(System.out))); return outNode; } else { throw new org.xml.sax .SAXNotSupportedException("DOM node processing not supported!"); } } /** * This shows how to set a parameter for use by the templates. Use * two transformers to show that different parameters may be set * on different transformers. */ public static void exampleParam(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); Templates templates = tfactory.newTemplates(new StreamSource(xslID)); Transformer transformer1 = templates.newTransformer(); Transformer transformer2 = templates.newTransformer(); transformer1.setParameter("a-param", "hello to you!"); transformer1.transform(new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); System.out.println("\n========="); transformer2.setOutputProperty(OutputKeys.INDENT, "yes"); transformer2.transform(new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); } /** * Show the that a transformer can be reused, and show resetting * a parameter on the transformer. */ public static void exampleTransformerReuse(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException { // Create a transform factory instance. TransformerFactory tfactory = TransformerFactory.newInstance(); // Create a transformer for the stylesheet. Transformer transformer = tfactory.newTransformer(new StreamSource(xslID)); transformer.setParameter("a-param", "hello to you!"); // Transform the source XML to System.out. transformer.transform( new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); System.out.println("\n=========\n"); transformer.setParameter("a-param", "hello to me!"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); // Transform the source XML to System.out. transformer.transform( new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); } /** * Show how to override output properties. */ public static void exampleOutputProperties(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); Templates templates = tfactory.newTemplates(new StreamSource(xslID)); Properties oprops = templates.getOutputProperties(); oprops.put(OutputKeys.INDENT, "yes"); Transformer transformer = templates.newTransformer(); transformer.setOutputProperties(oprops); transformer.transform(new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); } /** * Show how to get stylesheets that are associated with a given * xml document via the xml-stylesheet PI (see http://www.w3.org/TR/xml-stylesheet/). */ public static void exampleUseAssociated(String sourceID) throws TransformerException, TransformerConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); // The DOM tfactory will have it's own way, based on DOM2, // of getting associated stylesheets. if (tfactory instanceof SAXTransformerFactory) { SAXTransformerFactory stf = ((SAXTransformerFactory) tfactory); Source sources = stf.getAssociatedStylesheet(new StreamSource(sourceID), null, null, null); if(null != sources) { Transformer transformer = tfactory.newTransformer(sources); transformer.transform(new StreamSource(sourceID), new StreamResult(new OutputStreamWriter(System.out))); } else { System.out.println("Can't find the associated stylesheet!"); } } } /** * Show the Transformer using SAX events in and DOM nodes out. */ public static void exampleContentHandler2DOM(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, SAXException, IOException, ParserConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); // Make sure the transformer factory we obtained supports both // DOM and SAX. if (tfactory.getFeature(SAXSource.FEATURE) && tfactory.getFeature(DOMSource.FEATURE)) { // We can now safely cast to a SAXTransformerFactory. SAXTransformerFactory sfactory = (SAXTransformerFactory) tfactory; // Create an Document node as the root for the output. DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); org.w3c.dom.Document outNode = docBuilder.newDocument(); // Create a ContentHandler that can liston to SAX events // and transform the output to DOM nodes. TransformerHandler handler = sfactory.newTransformerHandler(new StreamSource(xslID)); handler.setResult(new DOMResult(outNode)); // Create a reader and set it's ContentHandler to be the // transformer. XMLReader reader=null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } if( reader==null ) reader= XMLReaderFactory.createXMLReader(); reader.setContentHandler(handler); reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); // Send the SAX events from the parser to the transformer, // and thus to the DOM tree. reader.parse(sourceID); // Serialize the node for diagnosis. exampleSerializeNode(outNode); } else { System.out.println( "Can't do exampleContentHandlerToContentHandler because tfactory is not a SAXTransformerFactory"); } } /** * Serialize a node to System.out. */ public static void exampleSerializeNode(Node node) throws TransformerException, TransformerConfigurationException, SAXException, IOException, ParserConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); // This creates a transformer that does a simple identity transform, // and thus can be used for all intents and purposes as a serializer. Transformer serializer = tfactory.newTransformer(); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); serializer.transform(new DOMSource(node), new StreamResult(new OutputStreamWriter(System.out))); } /** * A fuller example showing how the TrAX interface can be used * to serialize a DOM tree. */ public static void exampleAsSerializer(String sourceID, String xslID) throws TransformerException, TransformerConfigurationException, SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); org.w3c.dom.Document outNode = docBuilder.newDocument(); Node doc = docBuilder.parse(new InputSource(sourceID)); TransformerFactory tfactory = TransformerFactory.newInstance(); // This creates a transformer that does a simple identity transform, // and thus can be used for all intents and purposes as a serializer. Transformer serializer = tfactory.newTransformer(); Properties oprops = new Properties(); oprops.put("method", "html"); serializer.setOutputProperties(oprops); serializer.transform(new DOMSource(doc), new StreamResult(new OutputStreamWriter(System.out))); } private static void handleException( Exception ex ) { System.out.println("EXCEPTION: " ); ex.printStackTrace(); if( ex instanceof TransformerConfigurationException ) { System.out.println(); System.out.println("Internal exception: " ); Throwable ex1=((TransformerConfigurationException)ex).getException(); ex1.printStackTrace(); if( ex1 instanceof SAXException ) { Exception ex2=((SAXException)ex1).getException(); System.out.println("Internal sub-exception: " ); ex2.printStackTrace(); } } } } libxalan2-java-2.7.1/samples/trax/xml/0000755000175000017500000000000010736146354016533 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/xml/subdir1/0000755000175000017500000000000010736146354020104 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/xml/subdir1/foo2.xml0000644000175000017500000000006210721374036021463 0ustar mkochmkoch text in foo2.xmllibxalan2-java-2.7.1/samples/trax/xml/subdir1/subdir2/0000755000175000017500000000000010736146354021456 5ustar mkochmkochlibxalan2-java-2.7.1/samples/trax/xml/subdir1/subdir2/foo3.xml0000644000175000017500000000006210721374036023036 0ustar mkochmkoch text in foo3.xmllibxalan2-java-2.7.1/samples/trax/xml/baz.xml0000644000175000017500000000024710721374036020026 0ustar mkochmkoch MyBaz libxalan2-java-2.7.1/samples/trax/xml/foo.xml0000644000175000017500000000046410721374035020035 0ustar mkochmkoch MyBar libxalan2-java-2.7.1/samples/extensions/0000755000175000017500000000000010736146354017154 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/0000755000175000017500000000000010736146354017753 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/runDerby.bat0000644000175000017500000000506610721374035022235 0ustar mkochmkoch@echo off rem rem ========================================================================== rem = Copyright 2004 The Apache Software Foundation. rem = rem = Licensed under the Apache License, Version 2.0 (the "License"); rem = you may not use this file except in compliance with the License. rem = You may obtain a copy of the License at rem = rem = http://www.apache.org/licenses/LICENSE-2.0 rem = rem = Unless required by applicable law or agreed to in writing, software rem = distributed under the License is distributed on an "AS IS" BASIS, rem = WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem = See the License for the specific language governing permissions and rem = limitations under the License. rem ========================================================================== rem rem runDerby.bat: Script to execute the Derby tool IJ rem Usage: runDerby script file] rem Setup: rem - you should set JAVA_HOME rem - you can set DERBY_HOME to point to both derby.jar and derbytools.jar rem - JAVA_OPTS is added to the java command line rem - DERBY_JAR_DIR, default is the current directory echo. if not "%JAVA_HOME%" == "" goto setant :noJavaHome rem Default command used to call java.exe; hopefully it's on the path here if "%_JAVACMD%" == "" set _JAVACMD=java echo. echo Warning: JAVA_HOME environment variable is not set. echo If build fails because sun.* classes could not be found echo you will need to set the JAVA_HOME environment variable echo to the installation directory of java. echo. :setant rem Default command used to call java.exe or equivalent if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java if "%DERBY_JAR_DIR%" == "" set DERBY_JAR_DIR=. set _DERBY_JAR=%DERBY_JAR_DIR%\derby.jar;%DERBY_JAR_DIR%\derbytools.jar rem Attempt to automatically add system classes to _CLASSPATH rem Use _underscore prefix to not conflict with user's settings set _CLASSPATH=%CLASSPATH% if exist "%JAVA_HOME%\lib\tools.jar" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar if exist "%JAVA_HOME%\lib\classes.zip" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\classes.zip set _CLASSPATH=%_DERBY_JAR%;%_XML-APIS_JAR%;%_PARSER_JAR%;%_CLASSPATH% echo %_CLASSPATH% @echo on "%_JAVACMD%" -mx64m %JAVA_OPTS% -classpath "%_CLASSPATH%" -Dij.protocol=jdbc:derby: org.apache.derby.tools.ij %1 %2 @echo off goto end :end rem Cleanup environment variables set _JAVACMD= set _CLASSPATH= set _ANT_HOME= set _ANT_JAR= set _PARSER_JAR= set _XML-APIS_JAR= libxalan2-java-2.7.1/samples/extensions/sql/runExtConnection.bat0000644000175000017500000001112510721374037023743 0ustar mkochmkoch@echo off rem rem ========================================================================== rem = Copyright 2004 The Apache Software Foundation. rem = rem = Licensed under the Apache License, Version 2.0 (the "License"); rem = you may not use this file except in compliance with the License. rem = You may obtain a copy of the License at rem = rem = http://www.apache.org/licenses/LICENSE-2.0 rem = rem = Unless required by applicable law or agreed to in writing, software rem = distributed under the License is distributed on an "AS IS" BASIS, rem = WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem = See the License for the specific language governing permissions and rem = limitations under the License. rem ========================================================================== rem rem runDerby.bat: Script to execute the Derby tool IJ rem Usage: runDerby script file] rem Setup: rem - you should set JAVA_HOME rem - you can set DERBY_HOME to point to both derby.jar and derbytools.jar rem - JAVA_OPTS is added to the java command line rem - PARSER_JAR may be set to use alternate parser (default:..\..\..\bin\xercesImpl.jar) rem - DERBY_JAR_DIR, default is the current directory echo. if not "%JAVA_HOME%" == "" goto setant :noJavaHome rem Default command used to call java.exe; hopefully it's on the path here if "%_JAVACMD%" == "" set _JAVACMD=java echo. echo Warning: JAVA_HOME environment variable is not set. echo If build fails because sun.* classes could not be found echo you will need to set the JAVA_HOME environment variable echo to the installation directory of java. echo. :setant rem Default command used to call java.exe or equivalent if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java rem Default command used to call java.exe or equivalent if "%_JAVACCMD%" == "" set _JAVACCMD=%JAVA_HOME%\bin\javac if "%DERBY_JAR_DIR%" == "" set DERBY_JAR_DIR=. set _DERBY_JAR=%DERBY_JAR_DIR%\derby.jar;%DERBY_JAR_DIR%\derbytools.jar REM TO Work with JDK 1.3 and JDK 1.4, we will keep the directory REM component seperate from the JAR name. This way we can use the REM directory component as part of the Endorsed Dir command line REM argument when running under JDK 1.4 this should also work for JDK 1.5 REM The XML Apis are going to be either in the LIB dir for a source REM release or in the root direcctory for a binary release. IF EXIST "..\..\..\lib\xercesImpl.jar" goto BIN_DIR_BINRELEASE :BIN_DIR_SRCRELEASE Echo Setting bin JAR directory for a sOurce release set _BIN_JAR_DIR=..\..\..\ goto REPORT_BIN_DIR :BIN_DIR_BINRELEASE echo Setting bin JAR Directory for a binary release set _BIN_JAR_DIR=..\..\..\lib :REPORT_BIN_DIR Echo Binary JAR Directory: %_BIN_JAR_DIR% echo . REM The Parser JAR will be in the Lib Dir for the Source Release and for the REM Binary Release they are in the root directory. if exist "..\..\..\build\xalan.jar" goto XALAN_DIR_BINRELEASE :XALAN_DIR_SRCRELEASE Echo Configuring Xalan for a binary release set _XALAN_JAR_DIR=..\..\..\ goto XALAN_DIR_REPORT :XALAN_DIR_BINRELEASE Echo Configuring Xalan for source release set _XALAN_JAR_DIR=..\..\..\build :XALAN_DIR_REPORT Echo Xalan Directory is: %_XALAN_JAR_DIR% echo . rem Attempt to automatically add system classes to _CLASSPATH rem Use _underscore prefix to not conflict with user's settings set _CLASSPATH=%CLASSPATH% if exist "%JAVA_HOME%\lib\tools.jar" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar if exist "%JAVA_HOME%\lib\classes.zip" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\classes.zip set _CLASSPATH=%_XALAN_JAR_DIR%\xalan.jar;%_XALAN_JAR_DIR%\serializer.jar;%_BIN_JAR_DIR%\xml-apis.jar;%_BIN_JAR_DIR%\xercesImpl.jar;%_DERBY_JAR%;%_CLASSPATH% set _CLASSPATH=ext-connection;%_CLASSPATH% echo Using Classpath: %_CLASSPATH% echo . set _ENDORSED_DIR=%_XALAN_JAR_DIR%;%_BIN_JAR_DIR% echo Setting Endorsed Dir to: %_ENDORSED_DIR% : Note ONLY USed for JDK 1.4 echo . Echo Compiling the External connection Class echo %_JAVACCMD% -d ./ext-connection -classpath "%_CLASSPATH%" ./ext-connection/ExternalConnection.java %_JAVACCMD% -d ./ext-connection -classpath "%_CLASSPATH%" ./ext-connection/ExternalConnection.java @echo on "%_JAVACMD%" -mx64m %JAVA_OPTS% -Djava.endorsed.dirs=%_ENDORSED_DIR% -classpath "%_CLASSPATH%" ExternalConnection %1 %2 %3 %4 %5 %6 %7 %8 @echo off goto end :end rem Cleanup environment variables set _JAVACMD= set _CLASSPATH= set _ANT_HOME= set _ANT_JAR= set _PARSER_JAR= set _XML-APIS_JAR= libxalan2-java-2.7.1/samples/extensions/sql/pquery/0000755000175000017500000000000010736146354021300 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/pquery/dbinfo.xml0000644000175000017500000000035310721374037023257 0ustar mkochmkoch 1 org.apache.derby.jdbc.EmbeddedDriver jdbc:derby:sampleDB libxalan2-java-2.7.1/samples/extensions/sql/pquery/dbtest.xsl0000644000175000017500000000610710721374037023314 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/pquery/readme.html0000644000175000017500000000216610721374040023415 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/extensions/sql/runXalan.sh0000644000175000017500000000474510721374037022104 0ustar mkochmkoch#!/bin/sh # #========================================================================= # Copyright 2004 The Apache Software Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 if [ "$DERBY_JAR_DIR" = "" ] ; then DERBYJAR_DIR=. fi _JAVACMD=$JAVA_HOME/bin/java if [ "$JAVA_HOME" = "" ] ; then echo "Warning: JAVA_HOME environment variable is not set." _JAVACMD=java fi #TO Work with JDK 1.3 and JDK 1.4, we will keep the directory #component seperate from the JAR name. This way we can use the #directory component as part of the Endorsed Dir command line #argument when running under JDK 1.4 this should also work for JDK 1.5 #The XML Apis are going to be either in the LIB dir for a source #release or in the root direcctory for a binary release. if [ -f ../../../build/xalan.jar ] ; then echo "Configuring Xalan for a Source build" _XALAN_DIR=../../../build/ else echo "Configuring Xalan for a Release build" _XALAN_DIR=../../../ fi if [ -f ../../../lib/xercesImpl.jar ] ; then _JAR_DIR=../../../lib/ else _JAR_DIR=../../../ fi if [ "$PARSER_JAR" = "" ] ; then PARSER_JAR=$_JAR_DIR/xercesImpl.jar fi if [ "$XML_APIS_JAR" = "" ] ; then XML_APIS_JAR=$_JAR_DIR/xml-apis.jar fi if [ "$XALAN_JAR" = "" ] ; then XALAN_JAR=$_XALAN_DIR/xalan.jar SERIALIZER_JAR=$_XALAN_DIR/serializer.jar fi # Use _underscore prefix to not conflict with user's settings # Default to UNIX-style pathing CLPATHSEP=: # if we're on a Windows box make it ; uname | grep WIN && CLPATHSEP=\; _CLASSPATH="$XALAN_JAR${CLPATHSEP}$XML_APIS_JAR${CLPATHSEP}$PARSER_JAR${CLPATHSEP}$XALAN_JAR${CLPATHSEP}$DERBYJAR_DIR/derby.jar${CLPATHSEP}$DERBYJAR_DIR/derbytools.jar${CLPATHSEP}$CLASSPATH" # Attempt to automatically add system classes to _CLASSPATH if [ -f $JAVA_HOME/lib/tools.jar ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/tools.jar fi if [ -f $JAVA_HOME/lib/classes.zip ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/classes.zip fi _ENDORSED_DIR=${_XALAN_DIR}${CLPATHSEP}${_JAR_DIR} echo "Running Xalan: $@" echo "...with classpath: $_CLASSPATH" "$_JAVACMD" $JAVA_OPTS -Djava.endorsed.dirs=$_ENDORSED_DIR -classpath "$_CLASSPATH" -Dij.protocol=jdbc:derby: org.apache.xalan.xslt.Process $@ libxalan2-java-2.7.1/samples/extensions/sql/GETTING_STARTED.txt0000644000175000017500000000256510721374035023004 0ustar mkochmkochThe SQL Extension examples require the Apache Derby jars. The Derby jars are available from http://incubator.apache.org/derby/ The sample batch / script files are configured to look for the derby jars java/samples/extensions/sql directory by default. If you already have derby installed and want to use that implementation. You can do one of the following. 1) set the environment variable DERBY_JAR_DIR to point to the location of derby.jar and derbytools.jar 2) Have the derby.jar and derbytools.jar in your classpath. First create the sample database using Derby. To do this, On Windows execute the command runDerby.bat createdb.sql On Unix sh runDerby.sh createdb.sql You can use the Derby tools to examine the raw database To do this on windows execute the command runDerby.bat At the lj> prompt type the following commands lj> connect 'sampleDB'; lj> select * from import1; To quit the lj session type lj> quit; To Start lj on Unix type sh runDerby.sh Once the sample database has been created, you can run the sample stylesheets using the runXalan script. For some basic examples; runXalan.bat -XSL basic-connection/DumpSQL.xsl This example dumps the raw Document that was produced by the query. runXalan.bat -XSL basic-connection/dbtest.xsl Shows how to manipulate the raw document to produce HTML output libxalan2-java-2.7.1/samples/extensions/sql/ext-connection/0000755000175000017500000000000010736146354022710 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/ext-connection/ExternalConnection.java0000644000175000017500000000775110721374037027362 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExternalConnection.java 470245 2006-11-02 06:34:33Z minchau $ */ // Imported TraX classes import javax.xml.transform.TransformerFactory; import javax.xml.transform.Transformer; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerConfigurationException; import org.apache.xalan.lib.sql.DefaultConnectionPool; import org.apache.xalan.lib.sql.ConnectionPoolManager; // Imported java classes import java.io.StringReader; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; /** * Use the TraX interface to perform a transformation in the simplest manner possible * (3 statements). */ public class ExternalConnection { public static void main(String[] args) throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException { // Create a connection to the database server // Up the connection pool count for testing DefaultConnectionPool cp = new DefaultConnectionPool(); cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver"); cp.setURL("jdbc:derby:sampleDB"); //cp.setUser("sa"); //cp.setPassword(""); cp.setMinConnections(10); cp.setPoolEnabled(true); // Now let's register our connection pool so we can use // in a stylesheet ConnectionPoolManager pm = new ConnectionPoolManager(); pm.registerPool("extpool", cp); // Use the static TransformerFactory.newInstance() method to instantiate // a TransformerFactory. The javax.xml.transform.TransformerFactory // system property setting determines the actual class to instantiate -- // org.apache.xalan.transformer.TransformerImpl. TransformerFactory tFactory = TransformerFactory.newInstance(); // Grab the Name of the Stylesheet from the commad line if (args.length == 0) { System.out.println("You must provide the path and name to a stylesheet to process"); System.exit(0); } String stylesheet = args[0]; System.out.println("Transforming Stylesheet " + stylesheet); // Use the TransformerFactory to instantiate a Transformer that will work with // the stylesheet you specify. This method call also processes the stylesheet // into a compiled Templates object. Transformer transformer = tFactory.newTransformer( new StreamSource(stylesheet)); // For this transformation, all the required information is in the stylesheet, so generate // a minimal XML source document for the input. // Note: the command-line processor (org.apache.xalan.xslt.Process) uses this strategy when // the user does not provide an -IN parameter. StringReader reader = new StringReader(" "); // Use the Transformer to apply the associated Templates object to an XML document // and write the output to a file. transformer.transform( new StreamSource(reader), new StreamResult(new FileOutputStream("dbtest-out.html"))); System.out.println("************* The result is in dbtest-out.html *************"); cp.setPoolEnabled(false); } } libxalan2-java-2.7.1/samples/extensions/sql/ext-connection/dbtest.xsl0000644000175000017500000000523710721374036024726 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/ext-connection/readme.html0000644000175000017500000000216610721374036025032 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/extensions/sql/basic-connection/0000755000175000017500000000000010736146354023171 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/basic-connection/DumpSQL.xsl0000644000175000017500000000313110721374036025176 0ustar mkochmkoch libxalan2-java-2.7.1/samples/extensions/sql/basic-connection/dbtest-cinfo.xsl0000644000175000017500000000543410721374035026301 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/basic-connection/dbinfo.xml0000644000175000017500000000043010721374037025144 0ustar mkochmkoch This file contains information required to make a connection to the DBMS org.apache.derby.jdbc.EmbeddedDriver jdbc:derby:sampleDB libxalan2-java-2.7.1/samples/extensions/sql/basic-connection/dbtest.xsl0000644000175000017500000000611410721374037025203 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/basic-connection/readme.html0000644000175000017500000000216610721374040025306 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/extensions/sql/runExtConnection.sh0000644000175000017500000000562010721374036023611 0ustar mkochmkoch#!/bin/sh # #========================================================================= # Copyright 2004 The Apache Software Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 if [ "$DERBY_JAR_DIR" = "" ] ; then DERBYJAR_DIR=. fi _JAVACMD=$JAVA_HOME/bin/java _JAVACCMD=$JAVA_HOME/bin/javac if [ "$JAVA_HOME" = "" ] ; then echo "Warning: JAVA_HOME environment variable is not set." _JAVACMD=java fi #TO Work with JDK 1.3 and JDK 1.4, we will keep the directory #component seperate from the JAR name. This way we can use the #directory component as part of the Endorsed Dir command line #argument when running under JDK 1.4 this should also work for JDK 1.5 #The XML Apis are going to be either in the LIB dir for a source #release or in the root direcctory for a binary release. if [ -f ../../../build/xalan.jar ] ; then echo "Configuring Xalan for a Source build" echo . _XALAN_DIR=../../../build/ else echo "Configuring Xalan for a Release build" _XALAN_DIR=../../../ fi if [ -f ../../../lib/xercesImpl.jar ] ; then _JAR_DIR=../../../lib/ else _JAR_DIR=../../../ fi if [ "$PARSER_JAR" = "" ] ; then PARSER_JAR=$_JAR_DIR/xercesImpl.jar fi if [ "$XML_APIS_JAR" = "" ] ; then XML_APIS_JAR=$_JAR_DIR/xml-apis.jar fi if [ "$XALAN_JAR" = "" ] ; then XALAN_JAR=$_XALAN_DIR/xalan.jar SERIALIZER_JAR=$_XALAN_DIR/serializer.jar fi echo "Using Xalan JARS from: " $_XALAN_DIR echo . # Use _underscore prefix to not conflict with user's settings # Default to UNIX-style pathing CLPATHSEP=: # if we're on a Windows box make it ; uname | grep WIN && CLPATHSEP=\; _CLASSPATH="$XALAN_JAR${CLPATHSEP}$XML_APIS_JAR${CLPATHSEP}$PARSER_JAR${CLPATHSEP}$XALAN_JAR${CLPATHSEP}$DERBYJAR_DIR/derby.jar${CLPATHSEP}$DERBYJAR_DIR/derbytools.jar${CLPATHSEP}$CLASSPATH" # Attempt to automatically add system classes to _CLASSPATH if [ -f $JAVA_HOME/lib/tools.jar ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/tools.jar fi if [ -f $JAVA_HOME/lib/classes.zip ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/classes.zip fi _ENDORSED_DIR=${_XALAN_DIR}${CLPATHSEP}${_JAR_DIR} _CLASSPATH=${_CLASSPATH}${CLPATHSEP}./ext-connection echo Compiling the External connection Class echo $_JAVACCMD -d ./ext-connection -classpath "$_CLASSPATH" ./ext-connection/ExternalConnection.java $_JAVACCMD -d ./ext-connection -classpath "$_CLASSPATH" ./ext-connection/ExternalConnection.java echo . echo . echo "Running External Connection Example Code: $@" echo "...with classpath: $_CLASSPATH" "$_JAVACMD" $JAVA_OPTS -Djava.endorsed.dirs=$_ENDORSED_DIR -classpath "$_CLASSPATH" -Dij.protocol=jdbc:derby: ExternalConnection $@ libxalan2-java-2.7.1/samples/extensions/sql/show-error/0000755000175000017500000000000010736146354022062 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/show-error/dbinfo.xml0000644000175000017500000000037210721374037024042 0ustar mkochmkoch 1 com.lutris.instantdb.jdbc.idbDriver jdbc:idb:../../instantdb/sample.prp libxalan2-java-2.7.1/samples/extensions/sql/show-error/invalidConn.xsl0000644000175000017500000000604010721374037025051 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/show-error/invalidPQuery.xsl0000644000175000017500000000613710721374035025406 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/show-error/invalidQuery.xsl0000644000175000017500000000611510721374040025256 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/show-error/readme.html0000644000175000017500000000216610721374037024205 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/extensions/sql/streamable/0000755000175000017500000000000010736146354022072 5ustar mkochmkochlibxalan2-java-2.7.1/samples/extensions/sql/streamable/cachedNodes.xsl0000644000175000017500000000576610721374036025032 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/streamable/pivot.xsl0000644000175000017500000000703010721374040023750 0ustar mkochmkoch Error Connecting to the Database List of products Error in Query
    libxalan2-java-2.7.1/samples/extensions/sql/streamable/dbinfo.xml0000644000175000017500000000045210721374037024051 0ustar mkochmkoch This file contains information required to make a connection to the DBMS com.lutris.instantdb.jdbc.idbDriver jdbc:idb:../../instantdb/sample.prp libxalan2-java-2.7.1/samples/extensions/sql/streamable/streamNodes.xsl0000644000175000017500000000502110721374040025071 0ustar mkochmkoch Error Connecting to the Database List of products
    libxalan2-java-2.7.1/samples/extensions/sql/streamable/readme.html0000644000175000017500000000216610721374040024207 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/extensions/sql/runXalan.bat0000644000175000017500000001027610721374036022233 0ustar mkochmkoch@echo off rem rem ========================================================================== rem = Copyright 2004 The Apache Software Foundation. rem = rem = Licensed under the Apache License, Version 2.0 (the "License"); rem = you may not use this file except in compliance with the License. rem = You may obtain a copy of the License at rem = rem = http://www.apache.org/licenses/LICENSE-2.0 rem = rem = Unless required by applicable law or agreed to in writing, software rem = distributed under the License is distributed on an "AS IS" BASIS, rem = WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem = See the License for the specific language governing permissions and rem = limitations under the License. rem ========================================================================== rem rem runDerby.bat: Script to execute the Derby tool IJ rem Usage: runDerby script file] rem Setup: rem - you should set JAVA_HOME rem - you can set DERBY_HOME to point to both derby.jar and derbytools.jar rem - JAVA_OPTS is added to the java command line rem - PARSER_JAR may be set to use alternate parser (default:..\..\..\lib\xercesImpl.jar) rem - DERBY_JAR_DIR, default is the current directory echo. if not "%JAVA_HOME%" == "" goto setant :noJavaHome rem Default command used to call java.exe; hopefully it's on the path here if "%_JAVACMD%" == "" set _JAVACMD=java echo. echo Warning: JAVA_HOME environment variable is not set. echo If build fails because sun.* classes could not be found echo you will need to set the JAVA_HOME environment variable echo to the installation directory of java. echo. :setant rem Default command used to call java.exe or equivalent if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java if "%DERBY_JAR_DIR%" == "" set DERBY_JAR_DIR=. set _DERBY_JAR=%DERBY_JAR_DIR%\derby.jar;%DERBY_JAR_DIR%\derbytools.jar REM TO Work with JDK 1.3 and JDK 1.4, we will keep the directory REM component seperate from the JAR name. This way we can use the REM directory component as part of the Endorsed Dir command line REM argument when running under JDK 1.4 this should also work for JDK 1.5 REM The XML Apis are going to be either in the LIB dir for a source REM release or in the root direcctory for a binary release. IF EXIST "..\..\..\lib\xercesImpl.jar" goto BIN_DIR_BINRELEASE :BIN_DIR_SRCRELEASE Echo Setting bin JAR directory for a sOurce release set _BIN_JAR_DIR=..\..\..\ goto REPORT_BIN_DIR :BIN_DIR_BINRELEASE echo Setting bin JAR Directory for a binary release set _BIN_JAR_DIR=..\..\..\lib :REPORT_BIN_DIR Echo Binary JAR Directory: %_BIN_JAR_DIR% echo . REM The Parser JAR will be in the Lib Dir for the Source Release and for the REM Binary Release they are in the root directory. if exist "..\..\..\build\xalan.jar" goto XALAN_DIR_BINRELEASE :XALAN_DIR_SRCRELEASE Echo Configuring Xalan for a binary release set _XALAN_JAR_DIR=..\..\..\ goto XALAN_DIR_REPORT :XALAN_DIR_BINRELEASE Echo Configuring Xalan for source release set _XALAN_JAR_DIR=..\..\..\build :XALAN_DIR_REPORT Echo Xalan Directory is: %_XALAN_JAR_DIR% echo . rem Attempt to automatically add system classes to _CLASSPATH rem Use _underscore prefix to not conflict with user's settings set _CLASSPATH=%CLASSPATH% if exist "%JAVA_HOME%\lib\tools.jar" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar if exist "%JAVA_HOME%\lib\classes.zip" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\classes.zip set _CLASSPATH=%_XALAN_JAR_DIR%\xalan.jar;%_XALAN_JAR_DIR%\serializer.jar;%_BIN_JAR_DIR%\xml-apis.jar;%_BIN_JAR_DIR%\xercesImpl.jar;%_DERBY_JAR%;%_CLASSPATH% echo Using Classpath: %_CLASSPATH% echo . set _ENDORSED_DIR=%_XALAN_JAR_DIR%;%_BIN_JAR_DIR% echo Setting Endorsed Dir to: %_ENDORSED_DIR% : Note ONLY USed for JDK 1.4 echo . @echo on "%_JAVACMD%" -mx64m %JAVA_OPTS% -Djava.endorsed.dirs=%_ENDORSED_DIR% -classpath "%_CLASSPATH%" org.apache.xalan.xslt.Process %1 %2 %3 %4 %5 %6 %7 %8 @echo off goto end :end rem Cleanup environment variables set _JAVACMD= set _CLASSPATH= set _ANT_HOME= set _ANT_JAR= set _PARSER_JAR= set _XML-APIS_JAR= libxalan2-java-2.7.1/samples/extensions/sql/createdb.sql0000644000175000017500000000052510721374036022241 0ustar mkochmkochconnect 'sampleDB;create=true'; create table import1( ProductID int, Name varchar(40)); insert into import1 (ProductID, Name) values (1, 'toothpaste'); insert into import1 (ProductID, Name) values (2, 'milk'); insert into import1 (ProductID, Name) values (3, 'bread'); insert into import1 (ProductID, Name) values (4, 'cereal'); libxalan2-java-2.7.1/samples/extensions/sql/runDerby.sh0000644000175000017500000000272210721374035022075 0ustar mkochmkoch#!/bin/sh # #========================================================================= # Copyright 2004 The Apache Software Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 if [ "$DERBY_JAR_DIR" = "" ] ; then DERBYJAR_DIR=. fi _JAVACMD=$JAVA_HOME/bin/java _BUILD_DIR=../../../build _JAR_DIR=../../../lib _ENDORSED_DIR=$_BUILD_DIR if [ "$JAVA_HOME" = "" ] ; then echo "Warning: JAVA_HOME environment variable is not set." _JAVACMD=java fi # Use _underscore prefix to not conflict with user's settings # Default to UNIX-style pathing CLPATHSEP=: # if we're on a Windows box make it ; uname | grep WIN && CLPATHSEP=\; _CLASSPATH="$DERBYJAR_DIR/derby.jar${CLPATHSEP}$DERBYJAR_DIR/derbytools.jar${CLPATHSEP}$CLASSPATH" # Attempt to automatically add system classes to _CLASSPATH if [ -f $JAVA_HOME/lib/tools.jar ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/tools.jar fi if [ -f $JAVA_HOME/lib/classes.zip ] ; then _CLASSPATH=${_CLASSPATH}${CLPATHSEP}${JAVA_HOME}/lib/classes.zip fi echo "Running Derby: $@" echo " ...with classpath: $_CLASSPATH" "$_JAVACMD" $JAVA_OPTS -Djava.endorsed.dirs=$_ENDORSED_DIR -classpath "$_CLASSPATH" -Dij.protocol=jdbc:derby: org.apache.derby.tools.ij $@ libxalan2-java-2.7.1/samples/extensions/sql/readme.html0000644000175000017500000000216310721374035022071 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/extensions/5-numlistJscript.xsl0000644000175000017500000000464710721374040023100 0ustar mkochmkoch var counters = new Array(); function init (xslproc, elem) { name = elem.getAttribute ("name"); value = parseInt(elem.getAttribute ("value")); counters[name] = value; return null; } function read (name) { return "" + (counters[name]); } function incr (xslproc, elem) { name = elem.getAttribute ("name"); counters[name]++; return null; }

    JavaScript Example.

    Here are the names in alphabetical order by last name:

    [ ]. ,

    libxalan2-java-2.7.1/samples/extensions/2-basicJscript.xsl0000644000175000017500000000442310721374037022461 0ustar mkochmkoch var multiplier=1; // Extension element implementations always take two arguments. The first // argument is the XSL Processor context; the second argument is the element. function timelapse(xslProcessorContext, elem) { multiplier=parseInt(elem.getAttribute("multiplier")); // The element return value is placed in the result tree. // If you do not want a return value, return null. return null; } function getdate(numdays) { var d = new Date(); d.setDate(d.getDate() + parseInt(numdays*multiplier)); return d.toLocaleString(); }

    We have received your enquiry and will respond by

    libxalan2-java-2.7.1/samples/extensions/1-redir.xsl0000644000175000017500000000355510721374040021144 0ustar mkochmkoch Standard output:
    -- look in for the redirected output --
    libxalan2-java-2.7.1/samples/extensions/MyCounter.java0000644000175000017500000000362010721374040021732 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MyCounter.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.util.Hashtable; public class MyCounter { static Hashtable counters = new Hashtable (); public void init(org.apache.xalan.extensions.XSLProcessorContext context, org.w3c.dom.Element elem) { String name = elem.getAttribute("name"); String value = elem.getAttribute("value"); int val; try { val = Integer.parseInt (value); } catch (NumberFormatException e) { e.printStackTrace (); val = 0; } counters.put (name, new Integer (val)); } public int read(String name) { Integer cval = (Integer)counters.get(name); return (cval == null) ? 0 : cval.intValue(); } public void incr(org.apache.xalan.extensions.XSLProcessorContext context, org.w3c.dom.Element elem) { String name = elem.getAttribute("name"); Integer cval = (Integer) counters.get(name); int nval = (cval == null) ? 0 : (cval.intValue () + 1); counters.put (name, new Integer (nval)); } } libxalan2-java-2.7.1/samples/extensions/4-numlistJava.xsl0000644000175000017500000000370710721374036022343 0ustar mkochmkoch

    Java Example

    Here are the names in alphabetical order by last name:

    [ ]. ,

    libxalan2-java-2.7.1/samples/extensions/numlist.xml0000644000175000017500000000121210721374037021360 0ustar mkochmkoch libxalan2-java-2.7.1/samples/extensions/1-redir.xml0000644000175000017500000000030510721374036021131 0ustar mkochmkoch Testing Redirect extension: A foo subelement text node
    Everything else
    libxalan2-java-2.7.1/samples/extensions/3-java-namespace.xsl0000644000175000017500000000332510721374035022713 0ustar mkochmkoch

    Date:

    libxalan2-java-2.7.1/samples/extensions/3-java-namespace.xml0000644000175000017500000000016610721374037022707 0ustar mkochmkoch libxalan2-java-2.7.1/samples/extensions/2-basicJscript.xml0000644000175000017500000000010410721374035022441 0ustar mkochmkoch libxalan2-java-2.7.1/samples/extensions/IntDate.java0000644000175000017500000000252210721374034021340 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntDate.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.util.Calendar; import java.util.Date; public class IntDate { public static Date getDate(String year, String month, String day) { // Date(int, int, int) has been deprecated, so use Calendar to // set the year, month, and day. Calendar c = Calendar.getInstance(); // Convert each argument to int. c.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day)); return c.getTime(); } } libxalan2-java-2.7.1/samples/extensions/readme.html0000644000175000017500000000216010721374037021271 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/ApplyXPathDOM/0000755000175000017500000000000010736146354017347 5ustar mkochmkochlibxalan2-java-2.7.1/samples/ApplyXPathDOM/ApplyXPathDOM.java0000644000175000017500000001261210721374037022601 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ // This file uses 4 space indents, no tabs. import java.io.FileInputStream; import java.io.OutputStreamWriter; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.xpath.domapi.XPathEvaluatorImpl; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.xpath.XPathEvaluator; import org.w3c.dom.xpath.XPathNSResolver; import org.w3c.dom.xpath.XPathResult; import org.xml.sax.InputSource; /** * Very basic utility for applying the DOM L3 XPath API (currently in Last Call) * to an xml file and printing information about the execution of the XPath object * and the nodes it finds. * Takes 2 arguments: * (1) an xml filename * (2) an XPath expression to apply to the file * Examples: * java ApplyXPathDOM foo.xml / * java ApplyXPathDOM foo.xml /doc/name[1]/@last * *

    See also the Document Object Model (DOM) Level 3 XPath Specification.

    * @see XPathEvaluator * */ public class ApplyXPathDOM { protected String filename = null; protected String xpath = null; /** Process input args and execute the XPath. */ public void doMain(String[] args) throws Exception { filename = args[0]; xpath = args[1]; if ((filename != null) && (filename.length() > 0) && (xpath != null) && (xpath.length() > 0)) { // Tell that we're loading classes and parsing, so the time it // takes to do this doesn't get confused with the time to do // the actual query and serialization. System.out.println("Loading classes, parsing "+filename+", and setting up serializer"); // Set up a DOM tree to query. InputSource in = new InputSource(new FileInputStream(filename)); DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setNamespaceAware(true); Document doc = dfactory.newDocumentBuilder().parse(in); // Set up an identity transformer to use as serializer. Transformer serializer = TransformerFactory.newInstance().newTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); // Use the DOM L3 XPath API to apply the xpath expression to the doc. System.out.println("Querying DOM using "+xpath); // Create an XPath evaluator and pass in the document. XPathEvaluator evaluator = new XPathEvaluatorImpl(doc); XPathNSResolver resolver = evaluator.createNSResolver(doc); // Evaluate the xpath expression XPathResult result = (XPathResult)evaluator.evaluate(xpath, doc, resolver, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); // Serialize the found nodes to System.out. System.out.println(""); Node n; while ((n = result.iterateNext())!= null) { if (isTextNode(n)) { // DOM may have more than one node corresponding to a // single XPath text node. Coalesce all contiguous text nodes // at this level StringBuffer sb = new StringBuffer(n.getNodeValue()); for ( Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling() ) { sb.append(nn.getNodeValue()); } System.out.print(sb); } else { serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(System.out))); } System.out.println(); } System.out.println(""); } else { System.out.println("Bad input args: " + filename + ", " + xpath); } } /** Decide if the node is text, and so must be handled specially */ static boolean isTextNode(Node n) { if (n == null) return false; short nodeType = n.getNodeType(); return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.TEXT_NODE; } /** Main method to run from the command line. */ public static void main (String[] args) throws Exception { if (args.length != 2) { System.out.println("java ApplyXPathDOM filename.xml xpath\n" + "Reads filename.xml and applies the xpath; prints the nodelist found."); return; } ApplyXPathDOM app = new ApplyXPathDOM(); app.doMain(args); } } // end of class ApplyXPathDOM libxalan2-java-2.7.1/samples/ApplyXPathDOM/foo.xml0000644000175000017500000000066010721374037020651 0ustar mkochmkoch libxalan2-java-2.7.1/samples/ApplyXPathDOM/readme.html0000644000175000017500000000216010721374035021462 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/XPathAPI/0000755000175000017500000000000010736146354016333 5ustar mkochmkochlibxalan2-java-2.7.1/samples/XPathAPI/XPathResolver.java0000644000175000017500000001266710721374036021752 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import javax.xml.namespace.*; import javax.xml.xpath.*; import java.util.Iterator; /** * JAXP 1.3 XPath API sample. * * This sample demonstrates the use of NamespaceContext, XPathFunctionResolver * and XPathVariableResolver. The evaluated XPath expression ("ex:addFunc(2, 3) + $xyz") * contains an extension function and a variable reference. The extension function * and variable are evaluated using our customized XPathFunctionResolver and * XPathVariableResolver respectively. A NamespaceContext implementation is also * needed to map the prefix in the extension function to a valid namespace uri. */ public class XPathResolver { /** * The XPath expression to evaluate, which contains an extension * function and a variable reference. */ private static final String EXPR = "ex:addFunc(2, 3) + $xyz"; /** * The NamespaceContext implementation is used to map the prefix "ex" * to the namespace uri "http://ex.com". */ public static class MyNamespaceContext implements NamespaceContext { public String getNamespaceURI(String prefix) { if (prefix == null) throw new IllegalArgumentException("The prefix cannot be null."); if (prefix.equals("ex")) return "http://ex.com"; else return null; } public String getPrefix(String namespace) { if (namespace == null) throw new IllegalArgumentException("The namespace uri cannot be null."); if (namespace.equals("http://ex.com")) return "ex"; else return null; } public Iterator getPrefixes(String namespace) { return null; } } /** * The XPathFunctionResolver implementation is used to evaluate * the extension function "ex:addFunc(2, 3)". */ public static class MyFunctionResolver implements XPathFunctionResolver { /** * This method returns a customized XPathFunction implementation * for the extension function "ex:addFunc()". */ public XPathFunction resolveFunction(QName fname, int arity) { if (fname == null) throw new NullPointerException("The function name cannot be null."); // We only recognize one function, i.e. ex:addFunc(). if (fname.equals(new QName("http://ex.com", "addFunc", "ex"))) /** * Return a customized implementation of XPathFunction. We need * to implement the evaluate(List) method. */ return new XPathFunction() { /** * The actual implementation of the extension function. * Just cast two arguments to Double and add them together. */ public Object evaluate(java.util.List args) { if (args.size() == 2) { Double arg1 = (Double)args.get(0); Double arg2 = (Double)args.get(1); return new Double(arg1.doubleValue() + arg2.doubleValue()); } else return null; } }; else return null; } } /** * Our own implementation of XPathVariableResolver, which resolves the * variable "xyz" to a double value 4.0. */ public static class MyVariableResolver implements XPathVariableResolver { public Object resolveVariable(QName varName) { if (varName == null) throw new NullPointerException("The variable name cannot be null."); if (varName.equals(new QName("", "xyz"))) return new Double(4.0); else return null; } } public static void main(String[] args) { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); // Set the NamespaceContext xpath.setNamespaceContext(new MyNamespaceContext()); // Set the function resolver xpath.setXPathFunctionResolver(new MyFunctionResolver()); // Set the variable resolver xpath.setXPathVariableResolver(new MyVariableResolver()); Object result = null; try { result = xpath.evaluate(EXPR, (Object)null, XPathConstants.NUMBER); } catch (Exception e) { e.printStackTrace(); } // The evaluation result is 9.0. System.out.println("The evaluation result: " + result); } } libxalan2-java-2.7.1/samples/XPathAPI/ApplyXPathJAXP.java0000644000175000017500000001416310721374037021713 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.OutputStreamWriter; import javax.xml.namespace.*; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.*; import org.xml.sax.*; import org.w3c.dom.*; /** * JAXP 1.3 XPath API sample. * * Basic utility for applying an XPath expression to an input xml file and printing * the evaluation result, using JAXP 1.3 XPath API. * * Takes 3 arguments: * (1) an xml file name * (2) an XPath expression to apply to the input document * (3) the return type, which is one of the following Strings: * num, bool, str, node, nodeset * * Examples: * java ApplyXPathJAXP foo.xml /doc/name[1]/@last str * java ApplyXPathJAXP foo.xml /doc/name nodeset */ public class ApplyXPathJAXP { public static void main(String[] args) { QName returnType = null; if (args.length != 3) { System.err.println("Usage: java ApplyXPathAPI xml_file xpath_expression type"); } InputSource xml = new InputSource(args[0]); String expr = args[1]; // set the return type if (args[2].equals("num")) returnType = XPathConstants.NUMBER; else if (args[2].equals("bool")) returnType = XPathConstants.BOOLEAN; else if (args[2].equals("str")) returnType = XPathConstants.STRING; else if (args[2].equals("node")) returnType = XPathConstants.NODE; else if (args[2].equals("nodeset")) returnType = XPathConstants.NODESET; else System.err.println("Invalid return type: " + args[2]); // Create a new XPath XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); Object result = null; try { // compile the XPath expression XPathExpression xpathExpr = xpath.compile(expr); // Evaluate the XPath expression against the input document result = xpathExpr.evaluate(xml, returnType); // Print the result to System.out. printResult(result); } catch (Exception e) { e.printStackTrace(); } } /** * Print the type and value of the evaluation result. */ static void printResult(Object result) throws Exception { if (result instanceof Double) { System.out.println("Result type: double"); System.out.println("Value: " + result); } else if (result instanceof Boolean) { System.out.println("Result type: boolean"); System.out.println("Value: " + ((Boolean)result).booleanValue()); } else if (result instanceof String) { System.out.println("Result type: String"); System.out.println("Value: " + result); } else if (result instanceof Node) { Node node = (Node)result; System.out.println("Result type: Node"); System.out.println(""); printNode(node); System.out.println(""); } else if (result instanceof NodeList) { NodeList nodelist = (NodeList)result; System.out.println("Result type: NodeList"); System.out.println(""); printNodeList(nodelist); System.out.println(""); } } /** Decide if the node is text, and so must be handled specially */ static boolean isTextNode(Node n) { if (n == null) return false; short nodeType = n.getNodeType(); return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.TEXT_NODE; } static void printNode(Node node) throws Exception { if (isTextNode(node)) { System.out.println(node.getNodeValue()); } else { // Set up an identity transformer to use as serializer. Transformer serializer = TransformerFactory.newInstance().newTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); serializer.transform(new DOMSource(node), new StreamResult(new OutputStreamWriter(System.out))); } } static void printNodeList(NodeList nodelist) throws Exception { Node n; // Set up an identity transformer to use as serializer. Transformer serializer = TransformerFactory.newInstance().newTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); for (int i = 0; i < nodelist.getLength(); i++) { n = nodelist.item(i); if (isTextNode(n)) { // DOM may have more than one node corresponding to a // single XPath text node. Coalesce all contiguous text nodes // at this level StringBuffer sb = new StringBuffer(n.getNodeValue()); for ( Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling() ) { sb.append(nn.getNodeValue()); } System.out.print(sb); } else { serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(System.out))); } System.out.println(); } } } libxalan2-java-2.7.1/samples/XPathAPI/ExtensionFunctionResolver.java0000644000175000017500000000760710721374040024401 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import org.apache.xalan.extensions.XPathFunctionResolverImpl; import org.apache.xalan.extensions.ExtensionNamespaceContext; import org.xml.sax.InputSource; /** * JAXP 1.3 XPath API sample. * * This sample shows how to use the sample XPathFunctionResolver to evaluate * XPath expressions containing Java or EXSLT extension functions. * * To support extension functions in XPath expressions, you have to set an * XPathFunctionResolver on the XPath object. You can provide your implementation * of XPathFunctionResolver or use sample XPathFunctionResolver in * org.apache.xalan.extensions.XPathFunctionResolverImpl, which supports * the usage of Java and EXSLT extension functions. * * You also need to provide a NamespaceContext for the XPath evaluation. You * can provide your own implementation of NamespaceContext, or use the sample * implementation in org.apache.xalan.extensions.ExtensionNamespaceContext, * which supports the following namespace prefix to URI mappings: * * java --> http://xml.apache.org/xalan/java * exslt --> http://exslt.org/common * math --> http://exslt.org/math * set --> http://exslt.org/sets * str --> http://exslt.org/strings * dyn --> http://exslt.org/dynamic * datetime --> http://exslt.org/dates-and-times * * To run this sample, you have to put the directory containing ExtensionTest.class * on your classpath. */ public class ExtensionFunctionResolver { // An XPath expression containing an EXSLT extension function call. public static final String EXPR1 = "math:max(/doc/num)"; // An XPath expression containing a Java extension function call. // You have to compile the Java source file ExtensionTest.java and put // the directory containing ExtensionTest.class on your classpath. public static final String EXPR2 = "java:ExtensionTest.test('Bob')"; public static void main(String[] args) throws Exception { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); // set the NamespaceContext to // org.apache.xalan.extensions.ExtensionNamespaceContext xpath.setNamespaceContext(new ExtensionNamespaceContext()); // set the XPathFunctionResolver to // org.apache.xalan.extensions.XPathFunctionResolverImpl xpath.setXPathFunctionResolver(new XPathFunctionResolverImpl()); Object result = null; // Evaluate the XPath expression "math:max(/doc/num)" against // the input document numlist.xml InputSource context = new InputSource("numlist.xml"); result = xpath.evaluate(EXPR1, context, XPathConstants.NUMBER); System.out.println(EXPR1 + " = " + result); // Evaluate the XPath expression "java:ExtensionTest.test('Bob')" result = xpath.evaluate(EXPR2, context, XPathConstants.STRING); System.out.println(EXPR2 + " = " + result); } } libxalan2-java-2.7.1/samples/XPathAPI/numlist.xml0000644000175000017500000000012410721374035020536 0ustar mkochmkoch 2 4 6 libxalan2-java-2.7.1/samples/XPathAPI/ExtensionTest.java0000644000175000017500000000167210721374040022005 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class ExtensionTest { public static String test(String name) { return "Hello " + name + "!"; } } libxalan2-java-2.7.1/samples/XPathAPI/foo.xml0000644000175000017500000000066010721374037017635 0ustar mkochmkoch libxalan2-java-2.7.1/samples/SAX2SAX/0000755000175000017500000000000010736146354016046 5ustar mkochmkochlibxalan2-java-2.7.1/samples/SAX2SAX/birds.xml0000644000175000017500000002222310721374040017661 0ustar mkochmkoch Great Tinamou. Highland Tinamou. Little Tinamou. Thicket Tinamou. Slaty-breasted Tinamou. Choco Tinamou. Red-throated Loon. Arctic Loon. Pacific Loon. Common Loon. Yellow-billed Loon. Least Grebe. Pied-billed Grebe. Atitlan Grebe. Horned Grebe. Red-necked Grebe. Eared Grebe. Western Grebe. Clark's Grebe. Yellow-nosed Albatross. (A) Shy Albatross. (A) Black-browed Albatross. (A) Light-mantled Albatross. (A) Wandering Albatross. (A) Laysan Albatross. Black-footed Albatross. Short-tailed Albatross. (N) Northern Fulmar. Kermadec Petrel. (A) Herald Petrel. (A) Murphy's Petrel. (N) Mottled Petrel. (A) Bermuda Petrel. Black-capped Petrel. Juan Fernandez Petrel. (N) Dark-rumped Petrel. White-necked Petrel. (H) Bonin Petrel. (H) Black-winged Petrel. (H, A) Cook's Petrel. (N) Stejneger's Petrel. (A) Bulwer's Petrel. (H) Jouanin's Petrel. (H, A) Parkinson's Petrel. (N) Streaked Shearwater. (A) Cory's Shearwater. (N) Pink-footed Shearwater. (N) Flesh-footed Shearwater. (N) Greater Shearwater. (N) Wedge-tailed Shearwater. Buller's Shearwater. (N) Sooty Shearwater. (N) Short-tailed Shearwater. (N) Christmas Shearwater. (H) Manx Shearwater. Townsend's Shearwater. Black-vented Shearwater. Audubon's Shearwater. Little Shearwater. (A) Wilson's Storm-Petrel. (N) White-faced Storm-Petrel. (A) European Storm-Petrel. (A) Fork-tailed Storm-Petrel. Leach's Storm-Petrel. Ashy Storm-Petrel. Band-rumped Storm-Petrel. (N) Wedge-rumped Storm-Petrel. (N) Black Storm-Petrel. Guadalupe Storm-Petrel. Markham's Storm-Petrel. (A) Tristram's Storm-Petrel. (H) Least Storm-Petrel. White-tailed Tropicbird. Red-billed Tropicbird. Red-tailed Tropicbird. Masked Booby. Blue-footed Booby. Peruvian Booby. (A) Brown Booby. Red-footed Booby. Northern Gannet. American White Pelican. Brown Pelican. Brandt's Cormorant. Neotropic Cormorant. Double-crested Cormorant. Great Cormorant. Red-faced Cormorant. Pelagic Cormorant. Anhinga. Magnificent Frigatebird. Great Frigatebird. Lesser Frigatebird. (A) libxalan2-java-2.7.1/samples/SAX2SAX/SAX2SAX.java0000644000175000017500000001045110721374037017776 0ustar mkochmkoch /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAX2SAX.java 470245 2006-11-02 06:34:33Z minchau $ */ /** * Replicate the SimpleTransform sample, explicitly using the SAX model to handle the * stylesheet, the XML input, and the transformation. */ import java.io.FileOutputStream; import java.io.IOException; import javax.xml.transform.Result; import javax.xml.transform.Templates; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TemplatesHandler; import javax.xml.transform.sax.TransformerHandler; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xml.serializer.OutputPropertiesFactory; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; public class SAX2SAX { public static void main(String[] args) throws TransformerException, TransformerConfigurationException, SAXException, IOException { // Instantiate a TransformerFactory. TransformerFactory tFactory = TransformerFactory.newInstance(); // Determine whether the TransformerFactory supports The use of SAXSource // and SAXResult if (tFactory.getFeature(SAXSource.FEATURE) && tFactory.getFeature(SAXResult.FEATURE)) { // Cast the TransformerFactory. SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) tFactory); // Create a ContentHandler to handle parsing of the stylesheet. TemplatesHandler templatesHandler = saxTFactory.newTemplatesHandler(); // Create an XMLReader and set its ContentHandler. XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(templatesHandler); // Parse the stylesheet. reader.parse("birds.xsl"); //Get the Templates object from the ContentHandler. Templates templates = templatesHandler.getTemplates(); // Create a ContentHandler to handle parsing of the XML source. TransformerHandler handler = saxTFactory.newTransformerHandler(templates); // Reset the XMLReader's ContentHandler. reader.setContentHandler(handler); // Set the ContentHandler to also function as a LexicalHandler, which // includes "lexical" events (e.g., comments and CDATA). reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); FileOutputStream fos = new FileOutputStream("birds.out"); java.util.Properties xmlProps = OutputPropertiesFactory.getDefaultMethodProperties("xml"); xmlProps.setProperty("indent", "yes"); xmlProps.setProperty("standalone", "no"); Serializer serializer = SerializerFactory.getSerializer(xmlProps); serializer.setOutputStream(fos); // Set the result handling to be a serialization to the file output stream. Result result = new SAXResult(serializer.asContentHandler()); handler.setResult(result); // Parse the XML input document. reader.parse("birds.xml"); System.out.println("************* The result is in birds.out *************"); } else System.out.println("The TransformerFactory does not support SAX input and SAX output"); } } libxalan2-java-2.7.1/samples/SAX2SAX/foo.xsl0000644000175000017500000000206410721374037017356 0ustar mkochmkoch libxalan2-java-2.7.1/samples/SAX2SAX/birds.xsl0000644000175000017500000000372110721374036017676 0ustar mkochmkoch Order is: Family is: SubFamily is libxalan2-java-2.7.1/samples/SAX2SAX/foo.xml0000644000175000017500000000004710721374036017346 0ustar mkochmkoch Hellolibxalan2-java-2.7.1/samples/CompiledApplet/0000755000175000017500000000000010736146354017657 5ustar mkochmkochlibxalan2-java-2.7.1/samples/CompiledApplet/README.applet0000644000175000017500000001164210721374035022020 0ustar mkochmkoch====================================================================== The Apache XSLT Compiler (XSLTC) is a Java-based tool for compiling XSL stylesheets into extremely lightweight and portable Java byte code. The XSLTC Java Runtime environment can then process XML files against these compiled stylesheets (Translets) to generate any manner of output per the stylesheet instructions. This Applet Demo shows you how translets can be run in a client browser as Java applets to perform XSLT transformations on XML source documents residing on a Web server. Because of XSLTC's small footprint, it is possible to download the compiled stylesheets (translets) and the runtime classes in the applet. Whereas, this would not be easy with a fullsize Java-based XSLT processor. There are two important advantages of this approach: 1) It offloads XSLT processing from the server 2) It enables browsers, such as Netscape 4.x, that do not have native XSLT support to perform XSLT transformations today! ----------------------------------------------------------------------- DEMO CONTENTS ----------------------------------------------------------------------- The applet demo is very generic. It will let you run any pre-compiled translet through an applet, and it lets you use that on any XML file you can refer to using an URL. The contents of this demo are: TransformApplet.java - The applet that wraps the XSLTC runtime classes and your translet(s). index.html - Your main HTML document (displays two frames) menu.html - The HTML document for your dialog frame. This is the document that invokes the TransformApplet singleTransform.html - Another main HTML document that invokes the applet using two tags to specify the input document and stylesheet URI ----------------------------------------------------------------------- HOW TO SET UP THE DEMO ON YOUR SITE ----------------------------------------------------------------------- 1. Install and configure Xalan with XSLTC 2. Compile the stylesheets you want to export. This will result in one or more small Java classes (translets). 3. Create a JAR file containing your translet classes. Include a file named META-INF/services/javax.xml.transform.TransformerFactory in your JAR file that contains the following line: org.apache.xalan.xsltc.trax.TransformerFactoryImpl Be sure to make the JAR file world readable! 4. Copy the JAR file containing your translet classes and the following JAR files to the same directory containing index.html: xalan.jar, xml-apis.jar, xercesImpl.jar and xsltcapplet.jar. 5. Make your XML source documents readable through a URL (either place them behind a web server or make them readable for your browser as a file). 6. Open the supplied index.html and try out the demo! Alternatively, open the singleTransform.html, with the value attribute of the "input-document" tag set to the URI of your input document, and the value attribute of the "stylesheet-name" tag set to the URI of the stylesheet. 7. This sample has been tested successfully with JDK 1.4.0 using IE5.5 and NetScape7.0. With an earlier version of the JDK, you may have problems with the JavaScript code. ---------------------------------------------------------------------- KNOWN PROBLEMS ---------------------------------------------------------------------- . The following problems are specific to the Netscape 4.x browser. Class Already Loaded - If you start up the Netscape client browser on a Unix system where you have been running XSLTC, and consequently have a CLASSPATH that includes xml.jar, and xlstcrt.jar, the applet demo fails. You'll see a message saying a class has already been loaded in the Javascript console. To bring up the Javascript console, you type javascript: in the location/URL field of the browser. To work around this problem, unset your CLASSPATH before starting Netscape from a terminal window. This still may not resolve the problem if Netscape is started from a wrapper that sets your environment from your startup file (e.g., your .cshrc file for the C-shell). Parser Exception - This problem only applies to Netscape on the Windows platform with XML documents that have an external DTD. If you see the following message: org.xml.sax.SAXParseException: External parameter entity "%(DOCTYPE);" has characters after markup. try removing the reference to an external DTD in your XML source. . The following problems are specific to the Sun JRE 1.4.* plugin for browsers. java.lang.IllegalAccessError - Sun JRE 1.4.* has bundled with it an old version of Xalan-J Interpretive (2.2.D11). Copy a new verison of xalan.jar to the %Java_JRE%/lib/endorsed/ directory. ---------------------------------------------------------------------- END OF README libxalan2-java-2.7.1/samples/CompiledApplet/menu.html0000644000175000017500000000434710721374036021513 0ustar mkochmkoch

    Xalan/XSLTC Applet Demo

    Each of these examples illustrate the use of translets within a Java applet:

    Select translet:

    Select XML source document:

    libxalan2-java-2.7.1/samples/CompiledApplet/singleTransform.html0000644000175000017500000000216010721374037023714 0ustar mkochmkoch libxalan2-java-2.7.1/samples/CompiledApplet/index.html0000644000175000017500000000205110721374037021645 0ustar mkochmkoch XSLT Applet Demonstration libxalan2-java-2.7.1/samples/CompiledApplet/TransformApplet.java0000644000175000017500000002224610721374037023644 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformApplet.java 478660 2006-11-23 20:43:59Z minchau $ */ import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Frame; import java.awt.Label; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.PrintWriter; import java.io.StringWriter; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerException; import javax.xml.transform.ErrorListener; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; /** * This applet demonstrates how XSL transformations can be made to run in * browsers without native XSLT support. * * Note that the XSLTC transformation engine is invoked through the JAXP * interface, using the XSLTC "use-classpath" attribute. The * "use-classpath" attribute specifies to the XSLTC TransformerFactory * that a precompiled version of the stylesheet (translet) may be available, * and that that should be used in preference to recompiling the stylesheet. * @author Morten Jorgensen * @author Jacek Ambroziak */ public final class TransformApplet extends Applet { TransformerFactory tf; TransformDelegate transformThread; /** * This class implements a dialog box used for XSL messages/comments */ public class MessageFrame extends Frame { public Frame frame; public class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { frame.setVisible(false); } } /** * This method handles xml:message and xsl:comment by displaying * the message/comment in a dialog box. */ public MessageFrame(String title, String message) { super(title); frame = this; // Make visible to ButtonHandler setSize(320,200); // Create a panel for the message itself Panel center = new Panel(); center.add(new Label(message)); // Create a panel for the 'OK' button Panel bottom = new Panel(); Button okButton = new Button(" OK "); okButton.addActionListener(new ButtonHandler()); bottom.add(okButton); // Add the two panels to the window/frame add(center, BorderLayout.CENTER); add(bottom,BorderLayout.SOUTH); // Show the whole thing setVisible(true); } } /** * The applet uses this method to display messages and comments * generated by xsl:message and xsl:comment elements. */ public class AppletErrorListener implements ErrorListener { public void displayMessage(TransformerException e) { MessageFrame z = new MessageFrame("XSL transformation alert", e.getMessageAndLocation()); } public void error(TransformerException e) { displayMessage(e); } public void fatalError(TransformerException e) { displayMessage(e); } public void warning(TransformerException e) { displayMessage(e); } } /** * This method is the main body of the applet. The method is called * by some JavaScript code in an HTML document. */ public synchronized String transform(Object arg1, Object arg2) { final String stylesheetURL = (String)arg1; final String documentURL = (String)arg2; transformThread.setStylesheetURL(stylesheetURL); transformThread.setDocumentURL(documentURL); transformThread.setWaiting(false); transformThread.wakeUp(); try{ wait(); } catch (InterruptedException e){} return transformThread.getOutput(); } public void start() { transform(getParameter("stylesheet-name"), getParameter("input-document")); } public void destroy() { transformThread.destroy(); } public void init() { tf = TransformerFactory.newInstance(); try { tf.setAttribute("use-classpath", Boolean.TRUE); } catch (IllegalArgumentException iae) { System.err.println("Could not set XSLTC-specific TransformerFactory" + " attributes. Transformation failed."); } // Another thread is created to keep the context class loader // information. When use JDK 1.4 plugin for browser, to get around the // problem with the bundled old version of xalan and endorsed class // loading mechanism transformThread = new TransformDelegate(true); Thread t = new Thread(transformThread); t.setName("transformThread"); t.start(); } public String getOutput(){ return transformThread.getOutput(); } public synchronized void wakeUp() { notifyAll(); } class TransformDelegate implements Runnable { private boolean isRunning, isWaiting; private String stylesheetURL, documentURL; private String outPut; public TransformDelegate(boolean arg) { isRunning = arg; isWaiting = true; } public synchronized void run() { while(isRunning){ while(isWaiting){ try { wait(); } catch (InterruptedException e){} } transform(); isWaiting = true; TransformApplet.this.wakeUp(); } } public void setStylesheetURL(String arg){ stylesheetURL = arg; } public void setDocumentURL(String arg) { documentURL = arg; } public String getStylesheetURL(){ return stylesheetURL; } public String getDocumentURL() { return documentURL; } public void setWaiting(boolean arg) { isWaiting = arg; } public void destroy() { isRunning = false; } public synchronized void wakeUp() { notifyAll(); } public String getOutput(){ return outPut; } public void transform(){ String xslURL = getStylesheetURL(); String docURL = getDocumentURL(); // Initialise the output stream StringWriter sout = new StringWriter(); PrintWriter out = new PrintWriter(sout); // Check that the parameters are valid try { if (xslURL == null || docURL == null) { out.println("

    Transformation error

    "); out.println("The parameters stylesheetURL "+ "and source must be specified"); } else { Transformer t = tf.newTransformer(new StreamSource(xslURL)); t.setErrorListener(new AppletErrorListener()); final long start = System.currentTimeMillis(); t.transform(new StreamSource(docURL), new StreamResult(out)); final long done = System.currentTimeMillis() - start; out.println(""); } // Now close up the sink, and return the HTML output in the // StringWrite object as a string. out.close(); System.err.println("Transformation complete!"); System.err.println(sout.toString()); outPut = sout.toString(); sout.close(); } catch (RuntimeException e) { out.println("

    RTE

    "); out.close(); outPut = sout.toString(); } catch (Exception e) { out.println("

    exception

    "); out.println(e.toString()); out.close(); outPut = sout.toString(); } } } } libxalan2-java-2.7.1/samples/servlet/0000755000175000017500000000000010736146354016441 5ustar mkochmkochlibxalan2-java-2.7.1/samples/servlet/media.properties0000644000175000017500000000417610721374037021641 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: media.properties 470420 2006-11-02 17:14:05Z minchau $ # # This property file is used by com.lotus.xsl.server.DefaultApplyXSL. # # Each line below specifies a mapping rule between a value contained in the HTTP request's user-Agent # field and a value to be scanned for in XSL stylesheet(s) associated with the XML data. This mapping # enables relationships to be defined between client capabilities and stylesheets capable of acting # on these capabilities. # # The rules defined below are order-significant. In other words, if the first rule is unsuccessful, # the second rule will be tried, etc. The media value "unknown" will be used when no rules are # satisfied. # # Example: # # Mapping rules of... # # MSIE=explorer # MSPIE=pocketexplorer # # ...and XML data that contains XSL stylesheet associations of... # # # # # ...and an HTTP request that contains a user-Agent value of... # # foo MSPIE bar # # ...will apply the XSL stylesheet somedata.xsl. # MSIE=explorer MSPIE=pocketexplorer HandHTTP=handweb Mozilla=netscape Lynx=lynx Opera=opera Java=java AvantGo=avantgo Nokia=nokia UP.Browser=up DoCoMo=imode libxalan2-java-2.7.1/samples/servlet/ApplyXSLTProperties.java0000644000175000017500000001233210721374034023152 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ApplyXSLTProperties.java 470245 2006-11-02 06:34:33Z minchau $ */ package servlet; import java.net.MalformedURLException; import javax.servlet.*; import javax.servlet.http.*; /***************************************************************************************************** * * ApplyXSLTProperties contains operational parameters for ApplyXSLT based * on program defaults and configuration. *

    This class is also used to return values for request-time parameters.

    * * @author Spencer Shepard (sshepard@us.ibm.com) * @author R. Adam King (rak@us.ibm.com) * @author Tom Rowe (trowe@us.ibm.com) * *****************************************************************************************************/ public class ApplyXSLTProperties { /** * Program default for parameter "URL" */ private final String DEFAULT_URL; /** * Program default for parameter "xslURL" */ private final String DEFAULT_xslURL; /** * Program default for parameter "debug" */ private final boolean DEFAULT_debug; /** * Program default for parameter "noConflictWarnings" */ private final boolean DEFAULT_noCW; /** * Constructor to use program defaults. */ public ApplyXSLTProperties() { DEFAULT_URL = null; DEFAULT_xslURL = null; DEFAULT_debug = false; DEFAULT_noCW = false; } /** * Constructor to use to override program defaults. * @param config Servlet configuration */ public ApplyXSLTProperties(ServletConfig config) { String xm = config.getInitParameter("URL"), xu = config.getInitParameter("xslURL"), db = config.getInitParameter("debug"), cw = config.getInitParameter("noConflictWarnings"); if (xm != null) DEFAULT_URL = xm; else DEFAULT_URL = null; if (xu != null) DEFAULT_xslURL = xu; else DEFAULT_xslURL = null; if (db != null) DEFAULT_debug = new Boolean(db).booleanValue(); else DEFAULT_debug = false; if (cw != null) DEFAULT_noCW = new Boolean(cw).booleanValue(); else DEFAULT_noCW = false; } /** * Given a parameter name, returns the HTTP request's String value; * if not present in request, returns default String value. * @param request Request to check for default override * @param param Name of the parameter * @return String value of named parameter */ public String getRequestParmString(HttpServletRequest request, String param) { if (request != null) { String[] paramVals = request.getParameterValues(param); if (paramVals != null) return paramVals[0]; } return null; } /** * Returns the current setting for "URL". * @param request Request to check for parameter value * @return String value for "URL" * @exception MalformedURLException Will not be thrown */ public String getXMLurl(HttpServletRequest request) throws MalformedURLException { String temp = getRequestParmString(request, "URL"); if (temp != null) return temp; return DEFAULT_URL; } /** * Returns the current setting for "xslURL". * @param request Request to check for parameter value * @return String value for "xslURL" * @exception MalformedURLException Will not be thrown */ public String getXSLurl(HttpServletRequest request) throws MalformedURLException { String temp = getRequestParmString(request, "xslURL"); if (temp != null) return temp; return DEFAULT_xslURL; } /** * Returns the current setting for "debug". * @param request Request to check for parameter value * @return Boolean value for "debug" */ public boolean isDebug(HttpServletRequest request) { String temp = getRequestParmString(request, "debug"); if (temp != null) return new Boolean(temp).booleanValue(); return DEFAULT_debug; } /** * Returns the current setting for "noConflictWarnings". * @param request Request to check for parameter value * @return Boolean value for "noConflictWarnings" */ boolean isNoCW(HttpServletRequest request) { String temp = getRequestParmString(request, "noConflictWarnings"); if (temp != null) return new Boolean(temp).booleanValue(); return DEFAULT_noCW; } } libxalan2-java-2.7.1/samples/servlet/default.xsl0000644000175000017500000003077210721374036020620 0ustar mkochmkoch
      <? ?>
    =""
     
    <!--
      -->
    <![CDATA[
      ]]>
      < />
      < ></>
    - <>
     </>
    libxalan2-java-2.7.1/samples/servlet/ApplyXSLTListener.java0000644000175000017500000000614010721374037022606 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ApplyXSLTListener.java 470245 2006-11-02 06:34:33Z minchau $ */ package servlet; import java.io.*; import org.xml.sax.*; import org.apache.xml.utils.DefaultErrorHandler; /***************************************************************************************************** * ApplyXSLTListener provides a buffered listener essential for capturing, and then subsequently * reporting, XML and XSL processor messages which may be of use in debugging XML+XSL processed at * the server. * * @author Spencer Shepard (sshepard@us.ibm.com) * @author R. Adam King (rak@us.ibm.com) * @author Tom Rowe (trowe@us.ibm.com) * *****************************************************************************************************/ public class ApplyXSLTListener extends DefaultErrorHandler implements ErrorHandler { /** * Output stream */ private ByteArrayOutputStream outStream = new ByteArrayOutputStream(); /** * Buffered output stream */ public PrintWriter out = null; /** * Constructor. */ public ApplyXSLTListener() { out = new PrintWriter(new BufferedOutputStream(outStream), true); } /** * Receive notification of a warning. * * @param spe The warning information encapsulated in a SAX parse exception. */ public void warning(SAXParseException spe) { out.println("Parser Warning: " + spe.getMessage()); } /** * Receive notification of a recoverable error. * * @param spe The error information encapsulated in a SAX parse exception. */ public void error(SAXParseException spe) { out.println("Parser Error: " + spe.getMessage()); } /** * Receive notification of a non-recoverable error. * * @param spe The error information encapsulated in a SAX parse exception. * @exception SAXException Always thrown */ public void fatalError(SAXParseException spe) throws SAXException { out.println("Parser Fatal Error: " + spe.getMessage()); throw spe; } /** * Returns the buffered processing message(s). * @return Buffered processing message(s) */ public String getMessage() { return outStream.toString(); } } libxalan2-java-2.7.1/samples/servlet/UseStylesheetParamServlet.java0000644000175000017500000000623010721374037024434 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UseStylesheetParamServlet.java 470245 2006-11-02 06:34:33Z minchau $ */ /* Simple Servlet Example using a stylesheet parameter */ package servlet; // Imported TraX classes import javax.xml.transform.TransformerFactory; import javax.xml.transform.Transformer; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerConfigurationException; // Imported SAX classes import org.xml.sax.SAXException; // Imported java.io and javax.servlet classes import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class UseStylesheetParamServlet extends HttpServlet { /** * String representing the file separator characters for the System. */ public final static String FS = System.getProperty("file.separator"); PrintWriter out; String xslFile, xmlFile, paramValue; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { res.setContentType("text/html; charset=UTF-8"); out = res.getWriter(); paramValue = req.getParameter("PVAL"); xmlFile = req.getParameter("XML"); xslFile = req.getParameter("XSL"); if (paramValue == null) { out.println( "

    No input for paramValue

    "); return; } if ( xmlFile == null) { out.println( "

    No input for xmlFile

    "); return; } if ( xslFile == null) { out.println( "

    No input for xslFile

    "); return; } // get the real path for xml and xsl files; String ctx = getServletContext().getRealPath("") + FS; xslFile = ctx + xslFile; xmlFile = ctx + xmlFile; TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile)); // Set the stylesheet parameter (named param1). transformer.setParameter("param1", paramValue); // Perform the transformation. transformer.transform(new StreamSource(xmlFile), new StreamResult(out)); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } catch (TransformerException e) { e.printStackTrace(out); return; } } } libxalan2-java-2.7.1/samples/servlet/web.xml0000644000175000017500000000342010721374037017732 0ustar mkochmkoch xalanservlet SimpleXSLTServlet SimpleXSLTServlet servlet.SimpleXSLTServlet UseStylesheetParamServlet UseStylesheetParamServlet servlet.UseStylesheetParamServlet XSLTServletWithParams XSLTServletWithParams servlet.XSLTServletWithParams ApplyXSLT ApplyXSLT servlet.ApplyXSLT mediaURL media.properties xslURL /xalanservlet/booklist1.xsl SimpleXSLTServlet /SimpleXSLTServlet UseStylesheetParamServlet /UseStylesheetParamServlet XSLTServletWithParams /XSLTServletWithParams ApplyXSLT /ApplyXSLT/* libxalan2-java-2.7.1/samples/servlet/birds.xml0000644000175000017500000002231010721374037020257 0ustar mkochmkoch Great Tinamou. Highland Tinamou. Little Tinamou. Thicket Tinamou. Slaty-breasted Tinamou. Choco Tinamou. Red-throated Loon. Arctic Loon. Pacific Loon. Common Loon. Yellow-billed Loon. Least Grebe. Pied-billed Grebe. Atitlan Grebe. Horned Grebe. Red-necked Grebe. Eared Grebe. Western Grebe. Clark's Grebe. Yellow-nosed Albatross. (A) Shy Albatross. (A) Black-browed Albatross. (A) Light-mantled Albatross. (A) Wandering Albatross. (A) Laysan Albatross. Black-footed Albatross. Short-tailed Albatross. (N) Northern Fulmar. Kermadec Petrel. (A) Herald Petrel. (A) Murphy's Petrel. (N) Mottled Petrel. (A) Bermuda Petrel. Black-capped Petrel. Juan Fernandez Petrel. (N) Dark-rumped Petrel. White-necked Petrel. (H) Bonin Petrel. (H) Black-winged Petrel. (H, A) Cook's Petrel. (N) Stejneger's Petrel. (A) Bulwer's Petrel. (H) Jouanin's Petrel. (H, A) Parkinson's Petrel. (N) Streaked Shearwater. (A) Cory's Shearwater. (N) Pink-footed Shearwater. (N) Flesh-footed Shearwater. (N) Greater Shearwater. (N) Wedge-tailed Shearwater. Buller's Shearwater. (N) Sooty Shearwater. (N) Short-tailed Shearwater. (N) Christmas Shearwater. (H) Manx Shearwater. Townsend's Shearwater. Black-vented Shearwater. Audubon's Shearwater. Little Shearwater. (A) Wilson's Storm-Petrel. (N) White-faced Storm-Petrel. (A) European Storm-Petrel. (A) Fork-tailed Storm-Petrel. Leach's Storm-Petrel. Ashy Storm-Petrel. Band-rumped Storm-Petrel. (N) Wedge-rumped Storm-Petrel. (N) Black Storm-Petrel. Guadalupe Storm-Petrel. Markham's Storm-Petrel. (A) Tristram's Storm-Petrel. (H) Least Storm-Petrel. White-tailed Tropicbird. Red-billed Tropicbird. Red-tailed Tropicbird. Masked Booby. Blue-footed Booby. Peruvian Booby. (A) Brown Booby. Red-footed Booby. Northern Gannet. American White Pelican. Brown Pelican. Brandt's Cormorant. Neotropic Cormorant. Double-crested Cormorant. Great Cormorant. Red-faced Cormorant. Pelagic Cormorant. Anhinga. Magnificent Frigatebird. Great Frigatebird. Lesser Frigatebird. (A) libxalan2-java-2.7.1/samples/servlet/jspSample.jsp0000644000175000017500000000301110721374036021102 0ustar mkochmkoch<%@ page language="java" contentType="text/html" %> <%@ page import="javax.xml.transform.*"%> <%@ page import="javax.xml.transform.stream.*"%> JSP sample passing a parameter to XSL <%! String FS = System.getProperty("file.separator"); %> <% /** * This JSP uses PMA to set param1 in the * foo.xsl stylesheet before using the * stylesheet to transform foo.xml * and outputing the result. * * Invoke the jsp from the appropriate * context for your servlet/jsp server. * For example: http://localhost:8080/samples/jspSample.jsp?PMA=HellowWorld!&XML=foo.xml&XSL=foo.xsl * This example assumes that foo.xsl and foo.xml * are in the same directory. * Output should be Hello (from foo.xsml) and HelloWorld! * (value of param1 in foo.xsl). *@author Paul Campbell seapwc@halcyon.com *@version $Id: jspSample.jsp 337275 2003-02-20 18:43:14Z ilene $ */ String paramValue = request.getParameter("PMA"); String xmlFile = request.getParameter("XML"); String xslFile = request.getParameter("XSL"); // get the real path for xml and xsl files; String ctx = getServletContext().getRealPath("") + FS; xslFile = ctx + xslFile; xmlFile = ctx + xmlFile; TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile)); transformer.setParameter("param1", paramValue); transformer.transform( new StreamSource(xmlFile), new StreamResult(out)); %> libxalan2-java-2.7.1/samples/servlet/ApplyXSLTException.java0000644000175000017500000001120610721374036022755 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /***************************************************************************************************** * * Wrapper for exceptions occurring during apply XSL processing. * Allows for exceptions to be returned with an associated HTTP Status Code. * * @author Spencer Shepard (sshepard@us.ibm.com) * @author R. Adam King (rak@us.ibm.com) * @author Tom Rowe (trowe@us.ibm.com) * *****************************************************************************************************/ package servlet; public class ApplyXSLTException extends Exception { /** * Exception Message. * @serial */ private String myMessage = ""; /** * HTTP Status Code. Default= internal server error. * @serial */ private int myHttpStatusCode = javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; /** * Wrapped exception * @serial */ private Exception myException = null; /** * Constructor for exception with no additional detail. */ public ApplyXSLTException() { super(); } /** * Constructor for exception with message. * @param s Exception message */ public ApplyXSLTException(String s) { super(); myMessage = s; } /** * Constructor for exception with HTTP status code. * @param hsc Valid status code from javax.servlet.http.HttpServletResponse */ public ApplyXSLTException(int hsc) { super(); myHttpStatusCode = hsc; } /** * Constructor for exception with message and HTTP status code. * @param s Exception message * @param hsc Valid status code from javax.servlet.http.HttpServletResponse */ public ApplyXSLTException(String s, int hsc) { super(); myHttpStatusCode = hsc; } /** * Constructor for exception. * @param e Exception to be wrapped. */ public ApplyXSLTException(Exception e) { super(); myMessage = e.getMessage(); myException = e; } /** * Constructor for passed exception with message. * @param s Exception message * @param e Exception to be wrapped. */ public ApplyXSLTException (String s, Exception e) { super(); myMessage = s; myException = e; } /** * Constructor for passed exception with HTTP status code. * @param e Exception to be wrapped. * @param hsc Valid status code from javax.servlet.http.HttpServletResponse */ public ApplyXSLTException(Exception e, int hsc) { super(); myMessage = e.getMessage(); myException = e; myHttpStatusCode = hsc; } /** * Constructor for passed exception with HTTP status code and message. * @param s Exception message * @param e Exception to be wrapped. * @param hsc Valid status code from javax.servlet.http.HttpServletResponse */ public ApplyXSLTException(String s, Exception e, int hsc) { super(); myMessage = s; myException = e; myHttpStatusCode = hsc; } /** * Returns exception message. * @return exception message */ public String getMessage() { return myMessage; } /** * Appends string to exception message. * @param s String to be added to message */ public void appendMessage(String s) { myMessage += s; } /** * Returns the wrapped exception. * @return Wrapped exception */ public Exception getException() { return myException; } /** * Returns the HTTP status code associated with the exception. * @return Valid status code from javax.servlet.http.HttpServletResponse */ public int getStatusCode() { return myHttpStatusCode; } } libxalan2-java-2.7.1/samples/servlet/DefaultApplyXSLTProperties.java0000644000175000017500000002176410721374035024471 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DefaultApplyXSLTProperties.java 470245 2006-11-02 06:34:33Z minchau $ */ package servlet; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.Enumeration; import java.util.Properties; /***************************************************************************************************** * * DefaultApplyXSLTProperties contains operational parameters for DefaultApplyXSLT based * on program defaults and configuration. *

    This class is also used to return values for request-time parameters.

    * * @author Spencer Shepard (sshepard@us.ibm.com) * @author R. Adam King (rak@us.ibm.com) * @author Tom Rowe (trowe@us.ibm.com) * *****************************************************************************************************/ public class DefaultApplyXSLTProperties extends ApplyXSLTProperties { /** * Program default for parameter "catalog". * @see #getCatalog */ private final String DEFAULT_catalog; /** * Host used for local context comparisons. * @see #getLocalHost * @see #setLocalHost */ protected transient String localHost = null; /** * Server port. Used in toSafeURL() -- fix submitted by Ritesh Kumar. */ protected static int port =0; /** * Constructor to use program defaults. */ public DefaultApplyXSLTProperties() { super(); DEFAULT_catalog = null; setLocalHost(); // setSystemProperties(); } /** * Constructor to use to override program defaults. * @param config Servlet configuration * @see #setLocalHost */ public DefaultApplyXSLTProperties(ServletConfig config) { super(config); String cat = config.getInitParameter("catalog"); if (cat != null) DEFAULT_catalog = cat; else DEFAULT_catalog = null; setLocalHost(); setSystemProperties(); } /** * Sets the name of the local IP host name; this value will be used to constrain untrusted * XML document and XSL stylesheet URLs to this trusted host. * @see #getLocalHost */ protected void setLocalHost() { try { localHost = InetAddress.getLocalHost().getHostName(); } catch (Exception uhe) { localHost = null; } } /** * Returns the name of trusted IP host. * @return Name of trusted host * @see #setLocalHost */ public String getLocalHost() { return localHost; } /** * Returns a URL which is constrained to a trusted IP host. * @param xURL URL or file path to be made safe * @return Safe URL * @exception MalformedURLException Thrown when xURL is not a valid URL * @see #setLocalHost * @see #getLocalHost */ public URL toSafeURL(String xURL, HttpServletRequest request) throws MalformedURLException { // Fix submitted by Ritesh Kumar. Port is included in construction of URL that is returned. if (port == 0) port = request.getServerPort(); if (xURL == null) return null; if (xURL.startsWith("/")) { try { return new URL("http", localHost, port, xURL); } catch (MalformedURLException mue) { throw new MalformedURLException("toSafeURL(): " + xURL + " did not map to local"); } } URL tempURL = null; try { tempURL = new URL(xURL); } catch (MalformedURLException mue) { throw new MalformedURLException("toSafeURL(): " + xURL + " not a valid URL"); } try { return new URL(tempURL.getProtocol(), localHost, port, tempURL.getFile()); } catch (MalformedURLException mue) { throw new MalformedURLException("toSafeURL(): " + xURL + " could not be converted to local host"); } } /** * Returns a string representing the constrained URL for the XML document. * If there is no request parameter for the XML document, return the configured default. * @param request May contain an XML document URL parameter * @return String form of XML URL * @exception MalformedURLException Thrown when request URL is not a valid URL or path * @see #toSafeURL */ public String getXMLurl(HttpServletRequest request) throws MalformedURLException { URL url = toSafeURL(getRequestParmString(request, "URL"),request); if (url == null) return super.getXMLurl(null); return url.toExternalForm(); } /** * Returns a string representing the constrained URL for the XSL stylesheet * from the request. * @param request May contain an XSL stylesheet URL parameter * @return String form of request XSL URL, or null if request contains no xslURL parameter * @exception MalformedURLException Thrown when request URL is not a valid URL or path * @see #toSafeURL */ public String getXSLRequestURL(HttpServletRequest request) throws MalformedURLException { URL url = toSafeURL(getRequestParmString(request, "xslURL"),request); if (url == null) return null; return url.toExternalForm(); } /** * Returns a string representing the constrained request URL for the XSL stylesheet. * If there is no request parameter for the XSL stylesheet, return the configured default. * @param request May contain an XSL stylesheet URL parameter * @return String form of XSL URL * @exception MalformedURLException Thrown when request URL is not a valid URL or path * @see #toSafeURL */ public String getXSLurl(HttpServletRequest request) throws MalformedURLException { String reqURL = getXSLRequestURL(request); if (reqURL != null) return reqURL; URL url = toSafeURL(super.getXSLurl(null), request); return url.toExternalForm(); } /** * Returns URLs for all XCatalogs * that are to be used to process the request. Catalogs are used to resolve XML public identifiers * into system identifiers. *

    A single XCatalog can be configured as a default, * but multiple XCatalogs can be specified at request time to augment the configured default. * @param request May contain one or more XCatalog parameters * @return Array of strings for all catalog URLs */ public String[] getCatalog(HttpServletRequest request) { String temp[] = request.getParameterValues("catalog"); if (DEFAULT_catalog == null) return temp; if (temp == null) { String defaultArray[] = new String [1]; defaultArray[0] = DEFAULT_catalog; return defaultArray; } int i, len = temp.length + 1; String newCatalogs[] = new String[len]; newCatalogs[0] = DEFAULT_catalog; for (i=1; i < len; i++) { newCatalogs[i] = temp[i-1]; } return newCatalogs; } /** * I think we no longer need this. Sets the 3 jaxp core system properties. */ protected void setSystemProperties() { Properties props = new Properties(); props.put("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); props.put("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); props.put("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); Properties systemProps = System.getProperties(); Enumeration propEnum = props.propertyNames(); while(propEnum.hasMoreElements()) { String prop = (String)propEnum.nextElement(); if(!systemProps.containsKey(prop)) systemProps.put(prop, props.getProperty(prop)); } System.setProperties(systemProps); } } libxalan2-java-2.7.1/samples/servlet/booklist1.xsl0000644000175000017500000000305210721374037021073 0ustar mkochmkoch

    Books Checked Out

    libxalan2-java-2.7.1/samples/servlet/catalog.xml0000644000175000017500000000216410721374037020573 0ustar mkochmkoch A Certain Justice P.D. James 1998 0375401091 Ashworth Hall Anne Perry 1997 0449908445 L.A. Confidential James Ellroy 1997 0446674249 Shadow Woman Thomas Perry 1997 0679453024 libxalan2-java-2.7.1/samples/servlet/SimpleXSLTServlet.java0000644000175000017500000000576310721374037022623 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SimpleXSLTServlet.java 470245 2006-11-02 06:34:33Z minchau $ */ package servlet; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.net.URL; import javax.xml.transform.TransformerFactory; import javax.xml.transform.Transformer; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; /* * This sample applies the todo.xsl stylesheet to the * todo.xml XML document, and returns the transformation * output (HTML) to the client browser. * * IMPORTANT: For this to work, you must place todo.xsl and todo.xml * in the servlet root directory for documents. * */ public class SimpleXSLTServlet extends HttpServlet { /** * String representing the file separator characters for the System. */ public final static String FS = System.getProperty("file.separator"); public void init(ServletConfig config) throws ServletException { super.init(config); } public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, java.net.MalformedURLException { // The servlet returns HTML. response.setContentType("text/html; charset=UTF-8"); // Output goes in the response stream. PrintWriter out = response.getWriter(); try { TransformerFactory tFactory = TransformerFactory.newInstance(); //get the real path for xml and xsl files. String ctx = getServletContext().getRealPath("") + FS; // Get the XML input document and the stylesheet. Source xmlSource = new StreamSource(new URL("file", "", ctx+"birds.xml").openStream()); Source xslSource = new StreamSource(new URL("file", "", ctx+"birds.xsl").openStream()); // Generate the transformer. Transformer transformer = tFactory.newTransformer(xslSource); // Perform the transformation, sending the output to the response. transformer.transform(xmlSource, new StreamResult(out)); } catch (Exception e) { out.write(e.getMessage()); e.printStackTrace(out); } out.close(); } } libxalan2-java-2.7.1/samples/servlet/default2.xsl0000644000175000017500000002022210721374037020670 0ustar mkochmkoch
      <? ?>
    =""
     
    <!--
      -->
    <![CDATA[
      ]]>
      < />
      < ></>
    -< >
      </>
    libxalan2-java-2.7.1/samples/servlet/birds.xsl0000644000175000017500000000372110721374036020271 0ustar mkochmkoch Order is: Family is: SubFamily is libxalan2-java-2.7.1/samples/servlet/fooparam.xml0000644000175000017500000000005110721374035020754 0ustar mkochmkoch Hello libxalan2-java-2.7.1/samples/servlet/ApplyXSLT.java0000644000175000017500000007575710721374036021123 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ApplyXSLT.java 470245 2006-11-02 06:34:33Z minchau $ */ package servlet; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import java.net.URL; import java.net.MalformedURLException; import java.net.URLConnection; import javax.xml.transform.OutputKeys; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.StylesheetRoot; // SAX2 Imports import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.Locator; import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.w3c.dom.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; import org.apache.xalan.processor.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLFilterImpl; /***************************************************************************************************** * * ApplyXSLT supplies the basic * functions for transforming XML data using XSL stylesheets. * * @author Spencer Shepard (sshepard@us.ibm.com) * @author R. Adam King (rak@us.ibm.com) * @author Tom Rowe (trowe@us.ibm.com) * @author Don Leslie (donald_leslie@lotus.com) * *****************************************************************************************************/ public class ApplyXSLT extends HttpServlet { /** * Operational parameters for this class. *

    Request-time values override init-time values which override class defaults.

    * @see #init * @serial */ protected ApplyXSLTProperties ourDefaultParameters = null; /** * String representing the end of line characters for the System. */ public final static String EOL = System.getProperty("line.separator"); /** * String representing the file separator characters for the System. */ public final static String FS = System.getProperty("file.separator"); /** * String representing the current directory for properties files. See init(). */ public final static String ROOT = System.getProperty("server.root"); public static String CURRENTDIR; /** * Initialize operational parameters from the configuration. * @param config Configuration * @exception ServletException Never thrown */ public void init(ServletConfig config) throws ServletException { super.init(config); // If the server.root property --see above-- is null, use current working directory // as default location for media.properties. if (ROOT != null){ CURRENTDIR= getServletContext().getRealPath("/WEB-INF/classes/servlet/") + FS; System.out.println ( CURRENTDIR);} else CURRENTDIR = System.getProperty("user.dir")+ FS; setDefaultParameters(config); setMediaProps(config.getInitParameter("mediaURL")); } /** * Sets the default parameters for the servlet from the configuration. * Also sets required system properties until we figure out why servlet * sometimess fails to read properties from properties files. * @param config Configuration */ protected void setDefaultParameters(ServletConfig config) { ourDefaultParameters = new DefaultApplyXSLTProperties(config); } /** * Loads the media properties file specified by the given string. * @param mediaURLstring Location of the media properties file. Can be either a full URL or a path relative * to the System's server.root /servlets directory. If this parameter is null, * server.root/servlets/media.properties will be used. * @see ApplyXSL#CURRENTDIR */ protected void setMediaProps(String mediaURLstring) { if (mediaURLstring != null) { URL url = null; try { url = new URL(mediaURLstring); } catch (MalformedURLException mue1) { try { url = new URL("file", "", CURRENTDIR + mediaURLstring); } catch (MalformedURLException mue2) { writeLog("Unable to find the media properties file based on parameter 'mediaURL' = " + mediaURLstring, HttpServletResponse.SC_ACCEPTED, mue2); url = null; } } if (url != null) { try { ourMediaProps = new OrderedProps(url.openStream()); } catch (IOException ioe1) { writeLog("Exception occurred while opening media properties file: " + mediaURLstring + ". Media table may be invalid.", HttpServletResponse.SC_ACCEPTED, ioe1); } } } else { String defaultProp = CURRENTDIR + "media.properties"; try { ourMediaProps = new OrderedProps(new FileInputStream(defaultProp)); } catch (IOException ioe2) { writeLog("Default media properties file " + defaultProp + " not found.", HttpServletResponse.SC_ACCEPTED, ioe2); } } } public String getMedia(HttpServletRequest request) { return ourMediaProps.getValue(request.getHeader(HEADER_NAME)); } // doPost removed for security reasons due to the possibility of sending // unsecure XML and XSL XSLTInputSources through the request input stream /** * HTTP Get method passed on to process(). * @param request The request * @param response The response * @see #process * @exception ServletException Never thrown * @exception IOException Never thrown */ public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { TransformerFactory tFactory = TransformerFactory.newInstance(); process(tFactory, request, response); } catch (Exception e) { } } /** * Coordinates applying an XSL stylesheet to XML data using operational parameters. *

    If successfully applied, the result tree will be streamed to the response object * and the content type set according to the XSL stylesheet's <xsl:output> element(s).

    *

    If there is a problem in parsing the XML/XSL or if there is a problem in applying * the XSL to the XML, an exception will be streamed to the response object. The detail * of the information returned in the response object will depend on whether we're * running in debug mode or not.

    * @param processor implementation of TRaX processor * @param request May contain information relevant to creating XML and XSL XSLTInputSource's * @param response Where to write the transformation result * @see #getDocument * @see #getStylesheet * @see #getContentType * @see #displayException * @see #setStylesheetParams * @exception ServletException Never thrown * @exception IOException Never thrown */ public void process(TransformerFactory tFactory, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SAXException { boolean debug = ourDefaultParameters.isDebug(request); long time = 0; if (debug) time = System.currentTimeMillis(); // Listener to be used for all reporting ApplyXSLTListener listener = new ApplyXSLTListener(); listener.out.println("debug is " + debug); StreamSource xmlSource = null; StreamSource xslSource = null; try { if ((xmlSource = getDocument(request, listener)) == null) throw new ApplyXSLTException("getDocument() returned null", new NullPointerException(), response.SC_NOT_FOUND); } catch (ApplyXSLTException axe) { axe.appendMessage(EOL + "getDocument() resulted in ApplyXSLTException" + EOL + listener.getMessage()); if (debug) writeLog(axe); displayException(response, axe, debug); xmlSource = null; } // creating XSL Stylesheet if (xmlSource != null) { try { if ((xslSource = getStylesheet(tFactory, request, xmlSource, listener)) == null) { throw new ApplyXSLTException("getStylesheet() returned null", new NullPointerException(), response.SC_NOT_FOUND); } // For time being, must "reset" xmlSource after extracting stylesheet PI xmlSource = getDocument(request, listener); } catch (ApplyXSLTException axe) { axe.appendMessage(EOL + "getStylesheet() resulted in ApplyXSLTException" + EOL + listener.getMessage()); if (debug) writeLog(axe); displayException(response, axe, debug); xslSource = null; } // perform Transformation if ((xmlSource != null) && (xslSource != null)) { try { listener.out.println("Performing transformation..."); Templates templates = tFactory.newTemplates(xslSource); Transformer transformer = templates.newTransformer(); { try { String contentType = null; contentType = getContentType(templates); if (contentType != null); response.setContentType(contentType); if (transformer instanceof TransformerImpl) { TransformerImpl transformerImpl = (TransformerImpl)transformer; transformerImpl.setQuietConflictWarnings(ourDefaultParameters.isNoCW(request)); } setStylesheetParams(transformer, request); transformer.transform(xmlSource, new StreamResult(response.getOutputStream())); if (debug) writeLog(listener.getMessage(), response.SC_OK); } catch (Exception exc) { ApplyXSLTException axe = new ApplyXSLTException ("Exception occurred during Transformation:" + EOL + listener.getMessage() + EOL + exc.getMessage(), exc, response.SC_INTERNAL_SERVER_ERROR); if (debug) writeLog(axe); displayException(response, axe, debug); } finally { // transformer.reset(); } // end of try ... catch ... finally } } catch (/*org.xml.sax.SAX*/Exception saxExc) { ApplyXSLTException axe = new ApplyXSLTException ("Exception occurred during ctor/Transformation:" + EOL + listener.getMessage() + EOL + saxExc.getMessage(), saxExc, response.SC_INTERNAL_SERVER_ERROR); if (debug) writeLog(axe); displayException(response, axe, debug); } // end of new try ... catch } // end of if((stylesheetRoot != null) ... if (debug) { time = System.currentTimeMillis() - time; writeLog(" No Conflict Warnings = " + ourDefaultParameters.isNoCW(request) + " Transformation time: " + time + " ms", response.SC_OK); } } } /** * Returns an XML XSLTInputSource DOM. Attempts will be make to create the DOM from the following * sources: *
      *
    1. A relative URL specified in the HTTP request's path information. This capability is intended * for use by servlet engines that map some or all XML data to be processed at the server.
    2. *
    3. A URL specified in the HTTP request's URL= parameter. This capability * is intended for clients wishing to selectively process XML data at the server. For * security reasons, this URL will be forced to the local IP host.
    4. *
    5. The HTTP request's XML input stream. This capability is intended for use by chained servlets.
    6. *
    * @param request May contain or point to the XML XSLTInputSource * @param listener To record detailed parsing messages for possible return to requestor * @return XML XSLTInputSource DOM, or null if the XSLTInputSource could not be parsed * @exception ApplyXSLTException Thrown if exception occurs while handling request */ protected StreamSource getDocument(HttpServletRequest request, ApplyXSLTListener listener) throws ApplyXSLTException { try { String xmlURL = null; // document from PathInfo if ((xmlURL = request.getPathInfo()) != null) { listener.out.println("Parsing XML Document from PathInfo: " + xmlURL); return new StreamSource(new URL("http", ((DefaultApplyXSLTProperties) ourDefaultParameters).getLocalHost(), request.getServerPort(), xmlURL.replace('\\', '/')).openStream()); } // document from Request parameter if ((xmlURL = ourDefaultParameters.getXMLurl(request)) != null) { listener.out.println("Parsing XML Document from request parameter: " + xmlURL); return new StreamSource(new URL(xmlURL).openStream()); } // document from chain String contentType = request.getContentType(); if ((contentType != null) && contentType.startsWith("text/xml")) { listener.out.println("Parsing XML Document from request chain"); return new StreamSource(request.getInputStream()); } } catch (IOException ioe) { throw new ApplyXSLTException(ioe, HttpServletResponse.SC_NOT_FOUND); } catch (Exception e) { throw new ApplyXSLTException(e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } return null; } /** * Returns a Templates (StylesheetRoot) object. Attempts will be make to create the Stylesheet * from the followingsources: *
      *
    1. A URL specified in the HTTP request's xslURL= parameter. This capability * is intended for clients wishing to selectively override the server algorithm for applying XSL * stylesheets. For security reasons, this URL will be forced to the local IP host.
    2. *
    3. XML association. XML documents may contain references to one or more stylesheets using * this W3C proposed recommendation. * If the XML document does contain such references, a best match will be chosen based on the browser * type making the request and the default association. This capability enables relationships to be * defined between client capabilities and stylesheets capable of acting on these capabilities.
    4. *
    5. A configured default stylesheet URL
    6. *
    * @param request May contain or point to the XSL XSLTInputSource * @param xmlSource May point to the XSL XSLTInputSource * @param listener To record detailed parsing messages for possible return to requestor * @return XSL XSLTInputSource, or null if the request could not be parsed * @see #makeDocument * @see #getMedia * @see #STYLESHEET_ATTRIBUTE * @see #getXSLURLfromDoc * @see #toAcceptLanguageConnection * @exception ApplyXSLTException Thrown if exception occurs while handling request */ protected StreamSource getStylesheet(TransformerFactory tFactory, HttpServletRequest request, StreamSource xmlSource, ApplyXSLTListener listener) throws ApplyXSLTException { try { //stylesheet URL from request String xslURL = ((DefaultApplyXSLTProperties) ourDefaultParameters).getXSLRequestURL(request); if (xslURL != null) listener.out.println("Parsing XSL Stylesheet Document from request parameter: " + xslURL); else { // find stylesheet from XML Document, Media tag preference if (xmlSource != null){ listener.out.println("calling getXSLURLfromDoc and getMedia " + getMedia(request) ); xslURL = getXSLURLfromDoc(xmlSource, STYLESHEET_ATTRIBUTE, getMedia(request), tFactory); } if (xslURL != null) listener.out.println("Parsing XSL Stylesheet Document from XML Document tag: " + xslURL); else // Configuration Default if ((xslURL = ourDefaultParameters.getXSLurl(null)) != null) listener.out.println("Parsing XSL Stylesheet Document from configuration: " + xslURL); } return new StreamSource(xslURL); } catch (IOException ioe) { throw new ApplyXSLTException(ioe, HttpServletResponse.SC_NOT_FOUND); } catch (Exception e) { throw new ApplyXSLTException(e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } /** * Returns the response content type specified by the media-type and encoding attributes of * the <xsl:output> element(s) of the stylesheet. * @param xslSourceRoot XSL Stylesheet to be examined for <xsl:output> elements. * @return The response content type (MIME type and charset) of the stylesheet output * @see #process */ public String getContentType(Templates templates) { Properties oprops = templates.getOutputProperties(); String encoding = oprops.getProperty(OutputKeys.ENCODING); String media = oprops.getProperty(OutputKeys.MEDIA_TYPE); if (media != null) { if (encoding != null) return media + "; charset=" + encoding; return media; } else { String method = oprops.getProperty(OutputKeys.METHOD); if (method.equals("html")) return "text/html"; else if (method.equals("text")) return "text/plain"; else return "text/xml"; } } /** * Defines and sets select top-level XSL stylesheet variables from the HTTP request, which * can be evaluated using <xsl:param-variable>. The following variables will be * automatically set: *
    *
    ParameterName
    *
    Each non-reserved request parameter returned from request.getParameterNames(). If a * parameter contains more than a single value, only the first value is available.
    *
    servlet-RemoteAddr
    *
    Contains String output from request.getRemoteAddr(), which is the IP address * of the client machine.
    *
    servlet-RemoteHost
    *
    Contains String output from request.getRemoteHost(), which is the host name * of the client machine.
    *
    servlet-RemoteUser
    *
    Contains String output from request.getRemoteUser(), which was the user name * accepted by the server to grant access to this servlet.
    *
    servlet-Request
    *
    Contains the request object.
    *
    * @param xslprocessor Where to register parameters to be set * @param request Provides access to all meaningful parameters to set * @see #process */ public void setStylesheetParams(Transformer transformer, HttpServletRequest request) { Enumeration paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); try { String[] paramVals = request.getParameterValues(paramName); if (paramVals != null) transformer.setParameter(paramName, new XString(paramVals[0])); } catch (Exception e) { } } try { transformer.setParameter("servlet-RemoteAddr", new XString(request.getRemoteAddr())); } catch (Exception e) { } try { transformer.setParameter("servlet-RemoteHost", new XString(request.getRemoteHost())); } catch (Exception e) { } try { transformer.setParameter("servlet-RemoteUser", new XString(request.getRemoteUser())); } catch (Exception e) { } } /** * Writes the following information to the servlet log: *
      *
    1. HTTP status code
    2. *
    3. Message
    4. *
    5. Stack trace
    6. *
    * @param axe Contains valid HTTP status code, message, and stack trace (optional) */ protected void writeLog(ApplyXSLTException axe) { writeLog(axe.getMessage(), axe.getStatusCode(), axe.getException()); } /** * Writes the following information to the servlet log: *
      *
    1. HTTP status code
    2. *
    3. Message
    4. *
    5. Stack trace
    6. *
    * @param msg Message to be logged * @param statusCode Valid status code from javax.servlet.http.HttpServletResponse * @param t Used to generate stack trace (may be =null to suppress stack trace) */ protected void writeLog(String msg, int statusCode, Throwable t) { if (t == null) writeLog(msg, statusCode); else { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintWriter writer = new PrintWriter(bytes, true); System.out.println("Exception is " + t.getClass().getName()); t.printStackTrace(writer); log("HTTP Status Code: " + statusCode + " - " + msg + EOL + bytes.toString()); } } /** * Writes the following information to the servlet log: *
      *
    1. HTTP status code
    2. *
    3. Message
    4. *
    * @param msg Message to be logged * @param statusCode Valid status code from javax.servlet.http.HttpServletResponse */ protected void writeLog(String msg, int statusCode) { log("HTTP Status Code: " + statusCode + " - " + msg); } /** * Invokes response.sendError setting an HTTP status code and optionally an error message * as an HTML page. *

    If running in debug mode, also try to return a stack trace of the exception and * and xml/xsl processor messages.

    * @param response Where to stream the exception to * @param xse The wrapper which contains the exception and its HTTP status code * @param debug Indicates whether to include stack trace, etc. */ protected void displayException(HttpServletResponse response, ApplyXSLTException xse, boolean debug) { String mesg = xse.getMessage(); if (mesg == null) mesg = ""; else mesg = "" + mesg + ""; StringTokenizer tokens = new StringTokenizer(mesg, EOL); StringBuffer strBuf = new StringBuffer(); while (tokens.hasMoreTokens()) strBuf.append(tokens.nextToken() + EOL + "
    "); mesg = strBuf.toString(); if (debug) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintWriter writer = new PrintWriter(bytes, true); xse.getException().printStackTrace(writer); mesg += "
     " + bytes.toString() + " 
    "; } response.setContentType("text/html"); try { response.sendError(xse.getStatusCode(), mesg); } catch (IOException ioe) { System.err.println("IOException is occurring when sendError is called"); } } /** * Mapping of HTTP request's user-Agent values to stylesheet media= values. *

    This mapping is defined by a file pointed to by the operational parameter "mediaURL" which can * either contain a full URL or a path relative to the System's server.root /servlets directory.

    * @see #setMediaProps * @see #getMedia * @serial */ protected OrderedProps ourMediaProps = null; /** * Returns a connection which respects the Accept-Language header of the HTTP request. This * is useful when XSL files are internationalized for use with Web servers which respect this * header. *

    For example, Apache 1.3.6 may be configured for multiviews. Under this configuration, * requests for http://myhost/index.html would return http://myhost/index.html.fr to French browsers * and http://myhost/index.html.en to English browsers.

    * @param url Location to connect to * @param request Could contain an Accept-Language header * @return An Accept-Language-enabled URL connection * @see #getStylesheet */ protected URLConnection toAcceptLanguageConnection(URL url, HttpServletRequest request) throws Exception { URLConnection tempConnection = url.openConnection(); tempConnection.setRequestProperty("Accept-Language", request.getHeader("Accept-Language")); return tempConnection; } /** * Returns the XSL stylesheet URL associated with the specified XML document. If multiple XSL * stylesheets are associated with the XML document, preference will be given to the stylesheet * which contains an attribute name/value pair that corresponds to the specified attributeName * and attributeValue. * @param xmlSource XML XSLTInputSource to be searched for associated XSL stylesheets * @param attributeName Attribute name to provide preferential matching * @param attributeValue Attribute value to provide preferential matching * @return The preferred XSL stylesheet URL, or null if no XSL stylesheet association is found * @see #getStylesheet */ public static String getXSLURLfromDoc(StreamSource xmlSource, String attributeName, String attributeValue, TransformerFactory tFactory) { String tempURL = null, returnURL = null; try { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); Node sourceTree = docBuilder.parse(xmlSource.getInputStream()); for(Node child=sourceTree.getFirstChild(); null != child; child=child.getNextSibling()) { if(Node.PROCESSING_INSTRUCTION_NODE == child.getNodeType()) { ProcessingInstruction pi = (ProcessingInstruction)child; if(pi.getNodeName().equals("xml-stylesheet")) { PIA pia = new PIA(pi); if("text/xsl".equals(pia.getAttribute("type"))) { tempURL = pia.getAttribute("href"); String attribute = pia.getAttribute(attributeName); if ((attribute != null) && (attribute.indexOf(attributeValue) > -1)) return tempURL; if (!"yes".equals(pia.getAttribute("alternate"))) returnURL = tempURL; } } } } } catch(Exception saxExc) { } return returnURL; } /** * The attribute name in the tag used in stylesheet selection. */ protected static final String STYLESHEET_ATTRIBUTE = "media"; /** * The HTTP Header used for matching the Stylesheet attribute via the * media properties file selected. */ protected static final String HEADER_NAME = "user-Agent"; } /** * Stores the keys and values from a file (similar to a properties file) and * can return the first value which has a key contained in its string. * File can have comment lines starting with '#" and for each line the entries are * separated by tabs and '=' char. */ class OrderedProps { /** * Stores the Key and Values as an array of Strings */ private Vector attVec = new Vector(15); /** * Constructor. * @param inputStream Stream containing the properties file. * @exception IOException Thrown if unable to read from stream */ OrderedProps(InputStream inputStream) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(inputStream)); String currentLine, Key = null; StringTokenizer currentTokens; while ((currentLine = input.readLine()) != null) { currentTokens = new StringTokenizer(currentLine, "=\t\r\n"); if (currentTokens.hasMoreTokens()) Key = currentTokens.nextToken().trim(); if ((Key != null) && !Key.startsWith("#") && currentTokens.hasMoreTokens()) { String temp[] = new String[2]; temp[0] = Key; temp[1] = currentTokens.nextToken().trim(); attVec.addElement(temp); } } } /** * Iterates through the Key list and returns the first value for whose * key the given string contains. Returns "unknown" if no key is contained * in the string. * @param s String being searched for a key. * @return Value for key found in string, otherwise "unknown" */ String getValue(String s) { int i, j = attVec.size(); for (i = 0; i < j; i++) { String temp[] = (String[]) attVec.elementAt(i); if (s.indexOf(temp[0]) > -1) return temp[1]; } return "unknown"; } } /** * Parses a processing instruction's (PI) attributes for easy retrieval. */ class PIA { private Hashtable piAttributes = null; /** * Constructor. * @param pi The processing instruction whose attributes are to be parsed */ PIA(ProcessingInstruction pi) { piAttributes = new Hashtable(); StringTokenizer tokenizer = new StringTokenizer(pi.getNodeValue(), "=\""); while(tokenizer.hasMoreTokens()) { piAttributes.put(tokenizer.nextToken().trim(), tokenizer.nextToken().trim()); } } /** * Returns value of specified attribute. * @param name Attribute name * @return Attribute value, or null if the attribute name does not exist */ String getAttribute(String name) { return (String) piAttributes.get(name); } } libxalan2-java-2.7.1/samples/servlet/booklist2.xsl0000644000175000017500000000521610721374036021077 0ustar mkochmkoch
    My Books
    ISBN Title Author Published
    libxalan2-java-2.7.1/samples/servlet/fooparam.xsl0000644000175000017500000000261610721374037020775 0ustar mkochmkoch Stylesheet parameter

    XML source

    Stylesheet parameter

    The param1 stylesheet parameter has been set to .

    libxalan2-java-2.7.1/samples/servlet/readme.html0000644000175000017500000000216010721374035020554 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/servlet/XSLTServletWithParams.java0000644000175000017500000001223210721374035023434 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTServletWithParams.java 470245 2006-11-02 06:34:33Z minchau $ */ package servlet; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.Enumeration; import java.net.URL; import org.xml.sax.*; import javax.xml.transform.TransformerFactory; import javax.xml.transform.Transformer; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; /* * This sample takes input parameters in the request URL: a URL * parameter for the XML input, an xslURL parameter for the stylesheet, * and optional stylesheet parameters. * To run the equivalent of SimplestXSLServlet (with the documents in the * servlet document root directory), the request URL is * http://servlet.SimpleXSLServlet?URL=file:todo.xml&xslURL=file:todo.xsl * * Using a stylesheet Processing Instruction: * If the XML document includes a stylesheet PI that you want to use, * omit the xslURL parameter. * * Sending stylesheet parameters: * If, for example, a servlet takes a stylesheet parameter named param1 * param1 that you want to set to foo, include param1=foo in the URL. */ public class XSLTServletWithParams extends HttpServlet { /** * String representing the file separator characters for the System. */ public final static String FS = System.getProperty("file.separator"); public void init(ServletConfig config) throws ServletException { super.init(config); } public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // The servlet returns HTML; charset is UTF8. // See ApplyXSLT.getContentType() to get output properties from . response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { TransformerFactory tFactory = TransformerFactory.newInstance(); // Get params from URL. String xml = getRequestParam(request, "URL"); String xsl = getRequestParam(request, "xslURL"); Source xmlSource = null; Source xslSource = null; Transformer transformer = null; //get the real path for xml and xsl files. String ctx = getServletContext().getRealPath("") + FS; // Get the XML input document. if (xml != null && xml.length()> 0) xmlSource = new StreamSource(new URL("file", "", ctx + xml).openStream()); // Get the stylesheet. if (xsl != null && xsl.length()> 0) xslSource = new StreamSource(new URL("file", "", ctx + xsl).openStream()); if (xmlSource != null) // We have an XML input document. { if (xslSource == null) // If no stylesheet, look for PI in XML input document. { String media= null , title = null, charset = null; xslSource = tFactory.getAssociatedStylesheet(xmlSource,media, title, charset); } if (xslSource != null) // Now do we have a stylesheet? { transformer = tFactory.newTransformer(xslSource); setParameters(transformer, request); // Set stylesheet params. // Perform the transformation. transformer.transform(xmlSource, new StreamResult(out)); } else out.write("No Stylesheet!"); } else out.write("No XML Input Document!"); } catch (Exception e) { e.printStackTrace(out); } out.close(); } // Get parameters from the request URL. String getRequestParam(HttpServletRequest request, String param) { if (request != null) { String paramVal = request.getParameter(param); return paramVal; } return null; } // Set stylesheet parameters from the request URL. void setParameters(Transformer transformer, HttpServletRequest request) { Enumeration paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); try { String paramVal = request.getParameter(paramName); if (paramVal != null) transformer.setParameter(paramName, paramVal); } catch (Exception e) { } } } } libxalan2-java-2.7.1/samples/CompiledEJB/0000755000175000017500000000000010736146354017032 5ustar mkochmkochlibxalan2-java-2.7.1/samples/CompiledEJB/TransformRemote.java0000644000175000017500000000226210721374037023021 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformRemote.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.rmi.RemoteException; import javax.ejb.EJBObject; /** * XSL transformation bean remote interface * @author Morten Jorgensen */ public interface TransformRemote extends EJBObject { public String transform(String document, String transletName) throws RemoteException; } libxalan2-java-2.7.1/samples/CompiledEJB/bottom_frame.html0000644000175000017500000000161710721374035022374 0ustar mkochmkoch libxalan2-java-2.7.1/samples/CompiledEJB/README.ejb0000644000175000017500000000750210721374035020446 0ustar mkochmkoch============================================================ CONTENTS OF THIS DOCUMENT: o) HOW TO PROVIDE XSL TRANSFORMATIONS AS A WEB SERVICE o) HOW TO INVOKE TRANSLETS FROM AN ENTERPRISE JAVA BEAN o) TIPS FOR RUNNING THE SAMPLE ON JBOSS-3.0.4_TOMCAT-4.1.12 ------------------------------------------------------------ HOW TO PROVIDE XSL TRANSFORMATIONS AS A WEB SERVICE With XSLTC, XSL transformations can be run from within a an Enterprise Java Bean (EJB) and exported through a servlet. This sample code demonstrates how that can be implemented. The CompiledServlet and CompiledBrazil sample code demonstrate other approaches to providing XSL transformations as a web service. ------------------------------------------------------------ HOW TO INVOKE TRANSLETS FROM AN ENTERPRISE JAVA BEAN o) Create an EJB that implements SessionBean and has a single transform() entry point: public class TransformBean implements SessionBean { public String transform(String document, String transletName) { // instanciate translet // build internal DOM // run transformation : : } : : } o) Create this EJB's remote interface (this is the interface your servlet will use to call the bean's entry point): public interface TransformRemote extends EJBObject { public String transform(String document, String transletName) throws RemoteException; } o) Create the EJB's home interface, which your servlet will use to instantiate the remote interface: public interface TransformHome extends EJBHome { TransformRemote create() throws CreateException, RemoteException; } o) Create a servlet that uses the EJB's home interface to create a remote interface to the EJB, and then calls the EJB's transform() method through that remote interface: public class TransformServlet extends HttpServlet { public void init(ServletConfig config) { // look up the EJB's home interface using JNDI } public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // create the remote interface // pass the parameters from teh request to the EJB // display results passed back from EJB } } o) Set up your J2EE_CLASSPATH to include JAXP and the XSLTC runtime jars. o) Compile your XSL stylesheets and place them either in your J2EE_CLASSPATH or wrap them in your EJB jar. Make sure that the XSLTC TransformerFactory will be used by either setting the system property "javax.xml.transform.TransformerFactory" with the value "org.apache.xalan.xsltc.trax.TransformerFactoryImpl", or by making a file with the name "META-INF/services/javax.xml.transform.TransformerFactory" containing the single line org.apache.xalan.xsltc.trax.TransformerFactoryImpl available on your J2EE_CLASSPATH. o) Deploy your EJB o) Call the servlet with the necessary parameters (at least an URI to the source XML document and the name of the translet class). ------------------------------------------------------------ TIPS FOR RUNNING THE SAMPLE ON JBOSS-3.0.4_TOMCAT-4.1.12 o) Copy the bundled xalan.jar (a version containing XSLTC) to %Jboss_Home%/server/default/lib directory. o) Put the translet .class file in the same directory as the EJB classes. o) Set the value of the "translet" parameter to the name of the translet .class o) Set the value of the "document" parameter to a valid xml URI ------------------------------------------------------------ END OF README libxalan2-java-2.7.1/samples/CompiledEJB/TransformServlet.java0000644000175000017500000000556010721374037023216 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformServlet.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.io.IOException; import java.io.PrintWriter; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author Morten Jorgensen */ public class TransformServlet extends HttpServlet { // Error message used when the XSL transformation bean cannot be created private final static String createErrorMsg = "

    XSL transformation bean error

    "+ "

    An XSL transformation bean could not be created.

    "; // Transformer - "more than meets the eye". private TransformHome transformer; /** * Servlet initializer - look up the bean's home interface */ public void init(ServletConfig config) throws ServletException{ try{ InitialContext context = new InitialContext(); Object transformRef = context.lookup("transform"); transformer = (TransformHome)PortableRemoteObject.narrow(transformRef, TransformHome.class); } catch (Exception NamingException) { NamingException.printStackTrace(); } } /** * Handles "GET" HTTP requests - ie. runs the actual transformation */ public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String document = request.getParameter("document"); String translet = request.getParameter("translet"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); try{ // Get the insult from the bean TransformRemote xslt = transformer.create(); String result = xslt.transform(document, translet); out.println(result); } catch(Exception CreateException){ out.println(createErrorMsg); } out.close(); } public void destroy() { System.out.println("Destroy"); } } libxalan2-java-2.7.1/samples/CompiledEJB/TransformHome.java0000644000175000017500000000226410721374035022456 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformHome.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; /** * XSL transformation bean home interface * @author Morten Jorgensen */ public interface TransformHome extends EJBHome { TransformRemote create() throws CreateException, RemoteException; } libxalan2-java-2.7.1/samples/CompiledEJB/index.html0000644000175000017500000000220310721374037021017 0ustar mkochmkoch XML Technology Center libxalan2-java-2.7.1/samples/CompiledEJB/top_frame.html0000644000175000017500000001060010721374035021662 0ustar mkochmkoch

    Server-side XSL transformations

    Source document:
    Transformation:
    Method:
    libxalan2-java-2.7.1/samples/CompiledEJB/TransformBean.java0000644000175000017500000000743610721374040022435 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformBean.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.io.PrintWriter; import java.io.StringWriter; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.ErrorListener; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.ejb.SessionBean; import javax.ejb.SessionContext; /** * @author Morten Jorgensen */ public class TransformBean implements SessionBean { private SessionContext m_context = null; private final static String nullErrorMsg = "

    XSL transformation error

    "+ "

    'null' parameters sent to the XSL transformation bean's "+ "transform(String document, String translet) method.

    "; private static final String NAMESPACE_FEATURE = "http://xml.org/sax/features/namespaces"; /** * Generates HTML from a basic error message and an exception */ private void errorMsg(PrintWriter out, Exception e, String msg) { out.println("

    Error

    "); out.println("

    "+msg+"


    "); out.println(e.toString()); } /** * Main bean entry point */ public String transform(String document, String transletName) { // Initialise the output stream final StringWriter sout = new StringWriter(); final PrintWriter out = new PrintWriter(sout); try { if ((document == null) || (transletName == null)) { out.println(nullErrorMsg); } else { TransformerFactory tf = TransformerFactory.newInstance(); try { tf.setAttribute("use-classpath", Boolean.TRUE); } catch (IllegalArgumentException iae) { System.err.println( "Could not set XSLTC-specific TransformerFactory " + "attributes. Transformation failed."); } Transformer t = tf.newTransformer(new StreamSource(transletName)); // Do the actual transformation final long start = System.currentTimeMillis(); t.transform(new StreamSource(document), new StreamResult(out)); final long done = System.currentTimeMillis() - start; out.println(""); } } catch (Exception e) { errorMsg(out, e, "Impossible state reached."); } // Now close up the sink, and return the HTML output in the // StringWrite object as a string. out.close(); return sout.toString(); } /** * */ public void setSessionContext(SessionContext context) { m_context = context; } // General EJB entry points public void ejbCreate() { } public void ejbRemove() { } public void ejbActivate() { } public void ejbPassivate() { } public void ejbLoad() { } public void ejbStore() { } } libxalan2-java-2.7.1/samples/UseXMLFilters/0000755000175000017500000000000010736146354017423 5ustar mkochmkochlibxalan2-java-2.7.1/samples/UseXMLFilters/foo2.xsl0000644000175000017500000000211610721374036021012 0ustar mkochmkoch ...good to see you again! libxalan2-java-2.7.1/samples/UseXMLFilters/foo3.xsl0000644000175000017500000000210310721374035021006 0ustar mkochmkoch ...and goodby! libxalan2-java-2.7.1/samples/UseXMLFilters/UseXMLFilters.java0000644000175000017500000001111010721374035022717 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UseXMLFilters.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.io.IOException; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamSource; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xml.serializer.OutputPropertiesFactory; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLFilter; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * This example shows how to chain a series of transformations by * piping SAX events from one Transformer to another. Each Transformer * operates as a SAX2 XMLFilter/XMLReader. */ public class UseXMLFilters { public static void main(String[] args) throws TransformerException, TransformerConfigurationException, SAXException, IOException { // Instantiate a TransformerFactory. TransformerFactory tFactory = TransformerFactory.newInstance(); // Determine whether the TransformerFactory supports The use uf SAXSource // and SAXResult if (tFactory.getFeature(SAXSource.FEATURE) && tFactory.getFeature(SAXResult.FEATURE)) { // Cast the TransformerFactory to SAXTransformerFactory. SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) tFactory); // Create an XMLFilter for each stylesheet. XMLFilter xmlFilter1 = saxTFactory.newXMLFilter(new StreamSource("foo1.xsl")); XMLFilter xmlFilter2 = saxTFactory.newXMLFilter(new StreamSource("foo2.xsl")); XMLFilter xmlFilter3 = saxTFactory.newXMLFilter(new StreamSource("foo3.xsl")); // Create an XMLReader. XMLReader reader = XMLReaderFactory.createXMLReader(); // xmlFilter1 uses the XMLReader as its reader. xmlFilter1.setParent(reader); // xmlFilter2 uses xmlFilter1 as its reader. xmlFilter2.setParent(xmlFilter1); // xmlFilter3 uses xmlFilter2 as its reader. xmlFilter3.setParent(xmlFilter2); // xmlFilter3 outputs SAX events to the serializer. java.util.Properties xmlProps = OutputPropertiesFactory.getDefaultMethodProperties("xml"); xmlProps.setProperty("indent", "yes"); xmlProps.setProperty("standalone", "no"); Serializer serializer = SerializerFactory.getSerializer(xmlProps); serializer.setOutputStream(System.out); xmlFilter3.setContentHandler(serializer.asContentHandler()); // Perform the series of transformations as follows: // - transformer3 gets its parent (transformer2) as the XMLReader/XMLFilter // and calls transformer2.parse(new InputSource("foo.xml")). // - transformer2 gets its parent (transformer1) as the XMLReader/XMLFilter // and calls transformer1.parse(new InputSource("foo.xml")). // - transformer1 gets its parent (reader, a SAXParser) as the XMLReader // and calls reader.parse(new InputSource("foo.xml")). // - reader parses the XML document and sends the SAX parse events to transformer1, // which performs transformation 1 and sends the output to transformer2. // - transformer2 parses the transformation 1 output, performs transformation 2, and // sends the output to transformer3. // - transformer3 parses the transformation 2 output, performs transformation 3, // and sends the output to the serializer. xmlFilter3.parse(new InputSource("foo.xml")); } } } libxalan2-java-2.7.1/samples/UseXMLFilters/foo1.xsl0000644000175000017500000000206410721374037021014 0ustar mkochmkoch libxalan2-java-2.7.1/samples/UseXMLFilters/foo.xml0000644000175000017500000000004710721374035020722 0ustar mkochmkoch Hellolibxalan2-java-2.7.1/samples/UseXMLFilters/readme.html0000644000175000017500000000216010721374037021540 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/Validate/0000755000175000017500000000000010736146354016506 5ustar mkochmkochlibxalan2-java-2.7.1/samples/Validate/Validate.java0000644000175000017500000002231710721374036021101 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Validate.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.FilenameFilter; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.DefaultHandler; /* Use JAXP SAXParser to parse 1 .xml file or all the .xml files in a directory. * Takes 1 or 2 command-line arguments: * Argument 1 (required) is a file name or directory name. * Argument 2 (optional) is a log file name. If ommitted, messages are written to screen. */ public class Validate { static int numXMLFiles = 0; static int numValidFiles = 0; static int numInvalidFiles = 0; static int numFilesMissingDoctype = 0; static int numMalformedFiles = 0; static boolean useLogFile = false; static StringBuffer buff = new StringBuffer(); public static void main(String[] args) throws FileNotFoundException, IOException, ParserConfigurationException, SAXException { if (args.length == 0 || args.length > 2) { System.out.println("\nEnter 'java validate -help' for information about running Validate"); return; } if (args[0].toLowerCase().equals("-help")) { String sep = "\n====================================================\n"; String a = "Validate uses Xerces to parse the xml files in the directory you specify or the individual xml file you specify. The parser validates each document (checks that it conforms to its DOCTYPE).\n"; String b = "Each xml file should contain a DOCTYPE declaration.\n\n"; String c = "Validate takes 1 or 2 arguments:\n"; String d = " Argument 1 specifies a directory or an individual xml file.\n"; String e = " Argument 2 specifies a log file. If you include this argument, Validate appends messages to this file. If you do not, Validate writes messages to the screen.\n"; System.out.println(sep+a+b+c+d+e+sep); return; } try { Validate v = new Validate(); v.validate(args); } catch (Exception e) { e.printStackTrace(); } } void validate(String[] args) throws FileNotFoundException, IOException, ParserConfigurationException, SAXException { File dir = new File(args[0]); // User may include a 2nd argument for the log file. useLogFile = (args.length == 2); if (dir.isFile()) // Just checking one file. { parse(null,args[0]); } else if (dir.isDirectory()) // Checking the contents of a directory. { // Only interested in .xml files. XMLFileFilter filter = new XMLFileFilter(); String [] files = dir.list(filter); for (int i = 0; i 1) buff.append("Parsed " + numXMLFiles + " .xml files in " + args[0] + ".\n"); if (numValidFiles > 1) buff.append( numValidFiles + " files are valid.\n"); else if (numValidFiles == 1) buff.append( numValidFiles + " file is valid.\n"); if (numInvalidFiles > 1) buff.append(numInvalidFiles + " files are not valid.\n"); else if (numInvalidFiles == 1) buff.append( numInvalidFiles + " file is not valid.\n"); if (numMalformedFiles > 1) buff.append(numMalformedFiles + " files are not well-formed.\n"); else if (numMalformedFiles == 1) buff.append( numMalformedFiles + " file is not well-formed.\n"); if (numFilesMissingDoctype > 1) buff.append(numFilesMissingDoctype + " files do not contain a DOCTYPE declaration.\n"); else if (numFilesMissingDoctype == 1) buff.append(numFilesMissingDoctype + " file does not contain a DOCTYPE declaration.\n"); if (!useLogFile) System.out.print(buff.toString()); else { // If log file exists, append. FileWriter writer = new FileWriter(args[1], true); writer.write(new java.util.Date().toString()+ "\n"); writer.write(buff.toString()); writer.close(); System.out.println("Done with validation. See " + args[1] + "."); } } // Parse each XML file. void parse(String dir, String filename) throws FileNotFoundException, IOException, ParserConfigurationException, SAXException { try { File f = new File(dir, filename); StringBuffer errorBuff = new StringBuffer(); InputSource input = new InputSource(new FileInputStream(f)); // Set systemID so parser can find the dtd with a relative URL in the source document. input.setSystemId(f.toString()); SAXParserFactory spfact = SAXParserFactory.newInstance(); spfact.setValidating(true); spfact.setNamespaceAware(true); SAXParser parser = spfact.newSAXParser(); XMLReader reader = parser.getXMLReader(); //Instantiate inner-class error and lexical handler. Handler handler = new Handler(filename, errorBuff); reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); parser.parse(input, handler); if (handler.containsDTD && !handler.errorOrWarning) // valid { buff.append("VALID " + filename +"\n"); numValidFiles++; } else if (handler.containsDTD) // not valid { buff.append ("NOT VALID " + filename + "\n"); buff.append(errorBuff.toString()); numInvalidFiles++; } else // no DOCTYPE to use for validation { buff.append("NO DOCTYPE DECLARATION " + filename + "\n"); numFilesMissingDoctype++; } } catch (Exception e) // Serious problem! { buff.append("NOT WELL-FORMED " + filename + ". " + e.getMessage() + "\n"); numMalformedFiles++; } finally { numXMLFiles++; } } // Inner classes // Only interested in parsing .xml files. class XMLFileFilter implements FilenameFilter { public boolean accept(File dir, String fileName) { return fileName.toLowerCase().endsWith(".xml") && new File(dir.toString(),fileName).isFile(); } } // Catch any errors or warnings, and verify presence of doctype statement. class Handler extends DefaultHandler implements LexicalHandler { boolean errorOrWarning; boolean containsDTD; String sourceFile; StringBuffer errorBuff; Handler(String sourceFile, StringBuffer errorBuff) { super(); this.sourceFile = sourceFile; this.errorBuff = errorBuff; errorOrWarning = false; containsDTD = false; } public void error(SAXParseException exc) { errorBuff.append(sourceFile + " Error: " + exc.getMessage()+ "\n"); errorOrWarning = true; } public void warning(SAXParseException exc) { errorBuff.append(sourceFile + " Warning:" + exc.getMessage()+ "\n"); errorOrWarning = true; } // LexicalHandler methods; all no-op except startDTD(). // Set containsDTD to true when startDTD event occurs. public void startDTD (String name, String publicId, String systemId) throws SAXException { containsDTD = true; } public void endDTD () throws SAXException {} public void startEntity (String name) throws SAXException {} public void endEntity (String name) throws SAXException {} public void startCDATA () throws SAXException {} public void endCDATA () throws SAXException {} public void comment (char ch[], int start, int length) throws SAXException {} } } libxalan2-java-2.7.1/samples/Validate/birds.xml0000644000175000017500000002261310721374034020327 0ustar mkochmkoch ]> Great Tinamou. Highland Tinamou. Little Tinamou. Thicket Tinamou. Slaty-breasted Tinamou. Choco Tinamou. Red-throated Loon. Arctic Loon. Pacific Loon. Common Loon. Yellow-billed Loon. Least Grebe. Pied-billed Grebe. Atitlan Grebe. Horned Grebe. Red-necked Grebe. Eared Grebe. Western Grebe. Clark's Grebe. Yellow-nosed Albatross. (A) Shy Albatross. (A) Black-browed Albatross. (A) Light-mantled Albatross. (A) Wandering Albatross. (A) Laysan Albatross. Black-footed Albatross. Short-tailed Albatross. (N) Northern Fulmar. Kermadec Petrel. (A) Herald Petrel. (A) Murphy's Petrel. (N) Mottled Petrel. (A) Bermuda Petrel. Black-capped Petrel. Juan Fernandez Petrel. (N) Dark-rumped Petrel. White-necked Petrel. (H) Bonin Petrel. (H) Black-winged Petrel. (H, A) Cook's Petrel. (N) Stejneger's Petrel. (A) Bulwer's Petrel. (H) Jouanin's Petrel. (H, A) Parkinson's Petrel. (N) Streaked Shearwater. (A) Cory's Shearwater. (N) Pink-footed Shearwater. (N) Flesh-footed Shearwater. (N) Greater Shearwater. (N) Wedge-tailed Shearwater. Buller's Shearwater. (N) Sooty Shearwater. (N) Short-tailed Shearwater. (N) Christmas Shearwater. (H) Manx Shearwater. Townsend's Shearwater. Black-vented Shearwater. Audubon's Shearwater. Little Shearwater. (A) Wilson's Storm-Petrel. (N) White-faced Storm-Petrel. (A) European Storm-Petrel. (A) Fork-tailed Storm-Petrel. Leach's Storm-Petrel. Ashy Storm-Petrel. Band-rumped Storm-Petrel. (N) Wedge-rumped Storm-Petrel. (N) Black Storm-Petrel. Guadalupe Storm-Petrel. Markham's Storm-Petrel. (A) Tristram's Storm-Petrel. (H) Least Storm-Petrel. White-tailed Tropicbird. Red-billed Tropicbird. Red-tailed Tropicbird. Masked Booby. Blue-footed Booby. Peruvian Booby. (A) Brown Booby. Red-footed Booby. Northern Gannet. American White Pelican. Brown Pelican. Brandt's Cormorant. Neotropic Cormorant. Double-crested Cormorant. Great Cormorant. Red-faced Cormorant. Pelagic Cormorant. Anhinga. Magnificent Frigatebird. Great Frigatebird. Lesser Frigatebird. (A) libxalan2-java-2.7.1/samples/Validate/ValidateXMLInput.java0000644000175000017500000001022310721374037022474 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ValidateXMLInput.java 470245 2006-11-02 06:34:33Z minchau $ */ import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; /** * Validate the XML input by using SAXParserFactory to turn on namespace awareness and * validation, and a SAX XMLReader to parse the input and report problems to an error * handler. * * This sample uses birds.xml with an internal DOCTYPE declaration. As shipped, birds.xml * contains an element that violates the declared document type. */ public class ValidateXMLInput { public static void main(String[] args) throws Exception { ValidateXMLInput v = new ValidateXMLInput(); v.validate(); } void validate() throws Exception { // Since we're going to use a SAX feature, the transformer must support // input in the form of a SAXSource. TransformerFactory tfactory = TransformerFactory.newInstance(); if(tfactory.getFeature(SAXSource.FEATURE)) { // Standard way of creating an XMLReader in JAXP 1.1. SAXParserFactory pfactory= SAXParserFactory.newInstance(); pfactory.setNamespaceAware(true); // Very important! // Turn on validation. pfactory.setValidating(true); // Get an XMLReader. XMLReader reader = pfactory.newSAXParser().getXMLReader(); // Instantiate an error handler (see the Handler inner class below) that will report any // errors or warnings that occur as the XMLReader is parsing the XML input. Handler handler = new Handler(); reader.setErrorHandler(handler); // Standard way of creating a transformer from a URL. Transformer t = tfactory.newTransformer( new StreamSource("birds.xsl")); // Specify a SAXSource that takes both an XMLReader and a URL. SAXSource source = new SAXSource(reader, new InputSource("birds.xml")); // Transform to a file. try { t.transform(source, new StreamResult("birds.out")); } catch (TransformerException te) { // The TransformerException wraps someting other than a SAXParseException // warning or error, either of which should be "caught" by the Handler. System.out.println("Not a SAXParseException warning or error: " + te.getMessage()); } System.out.println("=====Done====="); } else System.out.println("tfactory does not support SAX features!"); } // Catch any errors or warnings from the XMLReader. class Handler extends DefaultHandler { public void warning (SAXParseException spe) throws SAXException { System.out.println("SAXParseException warning: " + spe.getMessage()); } public void error (SAXParseException spe) throws SAXException { System.out.println("SAXParseException error: " + spe.getMessage()); } } } libxalan2-java-2.7.1/samples/Validate/birds.xsl0000644000175000017500000000372110721374036020336 0ustar mkochmkoch Order is: Family is: SubFamily is libxalan2-java-2.7.1/samples/Validate/readme.html0000644000175000017500000000216010721374036020622 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/Pipe/0000755000175000017500000000000010736146354015652 5ustar mkochmkochlibxalan2-java-2.7.1/samples/Pipe/foo2.xsl0000644000175000017500000000211710721374037017243 0ustar mkochmkoch ...good to see you again! libxalan2-java-2.7.1/samples/Pipe/foo3.xsl0000644000175000017500000000210410721374035017236 0ustar mkochmkoch ...and goodby! libxalan2-java-2.7.1/samples/Pipe/Pipe.java0000644000175000017500000000731710721374035017413 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Pipe.java 470245 2006-11-02 06:34:33Z minchau $ */ import java.io.IOException; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamSource; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xml.serializer.OutputPropertiesFactory; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * This example shows how to chain a series of transformations by * piping SAX events from one Transformer to another. Each Transformer * operates as a SAX2 XMLFilter/XMLReader. */ public class Pipe { public static void main(String[] args) throws TransformerException, TransformerConfigurationException, SAXException, IOException { // Instantiate a TransformerFactory. TransformerFactory tFactory = TransformerFactory.newInstance(); // Determine whether the TransformerFactory supports The use uf SAXSource // and SAXResult if (tFactory.getFeature(SAXSource.FEATURE) && tFactory.getFeature(SAXResult.FEATURE)) { // Cast the TransformerFactory to SAXTransformerFactory. SAXTransformerFactory saxTFactory = ((SAXTransformerFactory) tFactory); // Create a TransformerHandler for each stylesheet. TransformerHandler tHandler1 = saxTFactory.newTransformerHandler(new StreamSource("foo1.xsl")); TransformerHandler tHandler2 = saxTFactory.newTransformerHandler(new StreamSource("foo2.xsl")); TransformerHandler tHandler3 = saxTFactory.newTransformerHandler(new StreamSource("foo3.xsl")); // Create an XMLReader. XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(tHandler1); reader.setProperty("http://xml.org/sax/properties/lexical-handler", tHandler1); tHandler1.setResult(new SAXResult(tHandler2)); tHandler2.setResult(new SAXResult(tHandler3)); // transformer3 outputs SAX events to the serializer. java.util.Properties xmlProps = OutputPropertiesFactory.getDefaultMethodProperties("xml"); xmlProps.setProperty("indent", "yes"); xmlProps.setProperty("standalone", "no"); Serializer serializer = SerializerFactory.getSerializer(xmlProps); serializer.setOutputStream(System.out); tHandler3.setResult(new SAXResult(serializer.asContentHandler())); // Parse the XML input document. The input ContentHandler and output ContentHandler // work in separate threads to optimize performance. reader.parse("foo.xml"); } } } libxalan2-java-2.7.1/samples/Pipe/foo1.xsl0000644000175000017500000000206510721374037017244 0ustar mkochmkoch libxalan2-java-2.7.1/samples/Pipe/foo.xml0000644000175000017500000000004710721374040017145 0ustar mkochmkoch Hellolibxalan2-java-2.7.1/samples/Pipe/readme.html0000644000175000017500000000216010721374035017765 0ustar mkochmkoch Xalan Samples

    Xalan Samples

    For information about the samples (what they illustrate and how to run them), see Samples.

    libxalan2-java-2.7.1/samples/UseStylesheetPI/0000755000175000017500000000000010736146354020014 5ustar mkochmkochlibxalan2-java-2.7.1/samples/UseStylesheetPI/UseStylesheetPI.java0000644000175000017500000000402110721374037023706 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UseStylesheetPI.java 470245 2006-11-02 06:34:33Z minchau $ */ import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; public class UseStylesheetPI { public static void main(String[] args) throws TransformerException, TransformerConfigurationException { String media= null , title = null, charset = null; try { TransformerFactory tFactory = TransformerFactory.newInstance(); Source stylesheet = tFactory.getAssociatedStylesheet (new StreamSource("fooX.xml"),media, title, charset); Transformer transformer = tFactory.newTransformer(stylesheet); transformer.transform(new StreamSource("fooX.xml"), new StreamResult(new java.io.FileOutputStream("foo.out"))); System.out.println("************* The result is in foo.out *************"); } catch (Exception e) { e.printStackTrace(); } } } libxalan2-java-2.7.1/samples/UseStylesheetPI/fooX.xml0000644000175000017500000000013210721374035021436 0ustar mkochmkoch Hellolibxalan2-java-2.7.1/samples/UseStylesheetPI/foo.xsl0000644000175000017500000000212210721374037021317 0ustar mkochmkoch libxalan2-java-2.7.1/commits.xml0000644000175000017500000035034410721374041015505 0ustar mkochmkoch zongaro@apache.org 2004/02/27 xml-xalan/java/src/org/apache/xalan/xsltc/dom NodeSortRecord.java NodeSortRecordFactory.java SortSettings.java Restored old constructor of NodeSortRecordFactory and _collator field of NodeSortRecord for binary compatibility. These changes allow translets compiled with an earlier version of XSLTC to continue to run with the new version. They should not be used in newly compiled translets or in new code in XSLTC itself.
    Also introduced a SortSettings class that is used to bundle sort settings from NodeSortRecordFactory into instances of NodeSortRecord. That reduces some of the space overhead in constructing a NodeSortRecord.
    Reviewed by Igor Hersht (igorh@ca.ibm.com)
    zongaro@apache.org 2004/02/27 xml-xalan/java/src/org/apache/xalan/xsltc/dom ForwardPositionIterator.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java Revived ForwardPositionIterator class and BasisLibrary.positionF purely to support backwards compatibility with translets compiled with earlier versions of XSLTC. New code should not reference either.
    Reviewed by Christine Li (jycli@ca.ibm.com).
    minchau@apache.org 2004/03/04 xml-xalan/java/src/org/apache/xalan/processor ProcessorImport.java ProcessorInclude.java ProcessorLRE.java ProcessorStylesheetElement.java StylesheetHandler.java XSLTElementDef.java xml-xalan/java/src/org/apache/xalan/templates ElemExsltFunction.java Submitted by: Brian Minchau
    Modified code for potential extension of classes with callbacks to the extensions.
    bhakti@apache.org 2004/03/08 xml-xalan/java/src/org/apache/xml/serializer Encodings.properties Added a newline at the end of Encodings.properties to fix bug 27516 igorh@apache.org 2004/03/09 xml-xalan/java/src/org/apache/xalan/xsltc/dom NodeCounter.java xsl:number, minor code cleaning and optimization bhakti@apache.org 2004/03/10 xml-xalan/java/src/org/apache/xalan/xsltc/dom LoadDocument.java Check if the systemId for the stylesheet is null to avoid getting an NPE. jycli@apache.org 2004/03/11 xml-xalan/java/src/org/apache/xalan/extensions ObjectFactory.java xml-xalan/java/src/org/apache/xalan/lib ObjectFactory.java xml-xalan/java/src/org/apache/xalan/lib/sql ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xslt ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/cmdline ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/dom ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/trax ObjectFactory.java xml-xalan/java/src/org/apache/xml/dtm ObjectFactory.java xml-xalan/java/src/org/apache/xml/dtm/ref ObjectFactory.java xml-xalan/java/src/org/apache/xml/serializer ObjectFactory.java xml-xalan/java/src/org/apache/xml/utils ObjectFactory.java xml-xalan/java/src/org/apache/xpath/compiler ObjectFactory.java xml-xalan/java/src/org/apache/xpath/functions ObjectFactory.java Fix a bug in the findProviderClass method of ObjectFactory classes. The argument of SecurityManager.checkPackageAccess should be a string value of a package name, instead of a class name santiagopg@apache.org 2004/03/16 xml-xalan/java/src/org/apache/xalan/xsltc/compiler FunctionCall.java Reverting latest patch by Arun. There are some problems with the new code to invoke functions dynamically (e.g. docbook reports a compile-time type check error). The approach taken to determine when to invoke methods dynamically needs to be revisted. santiagopg@apache.org 2004/03/23 xml-xalan/java/src/org/apache/xpath/compiler Compiler.java FunctionTable.java Patch to hide static function table in FunctionTable class. We do not want to expose this table to others. santiagopg@apache.org 2004/03/23 xml-xalan/java/src/org/apache/xml/utils DOMBuilder.java The xmlns URI should also be used to add NS decls as attributes to a DOM. However, this was only done for attributes that started with 'xmlns:' and not for 'xmlns' (i.e. not for decls of the default NS). mkwan@apache.org 2004/03/24 xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerImpl.java Patch for bug 27417.
    If an output stream is created by the XSLTC transformer, close it after the transformation.
    zongaro@apache.org 2004/04/10 xml-xalan/java/src/org/apache/xalan/xsltc/compiler ApplyImports.java Applying patch for bugs 27932 and 15333.
    Code was incorrectly calculating the set of templates to which an xsl:apply-imports instruction applies. It should consider all templates that the current template rule could override, which means that if the template appeared in a stylesheet that was included in another stylesheet, any templates imported into the including stylesheet have to be considered as well. The method Stylesheet.getMinimumDescendantPrecedence is responsible for this calculation.
    In addition, when code is generated for an xsl:apply-imports, if any template has local parameters, an empty stack frame has to be pushed before attempting to apply-imports. Otherwise, parameters from the template that contains the apply-imports instruction will be passed into the matching template.
    Reviewed by Joanne Tong (joannet@ca.ibm.com)
    zongaro@apache.org 2004/04/10 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Stylesheet.java Applying patch for bug 27932.
    Code was incorrectly calculating the set of templates to which an xsl:apply-imports instruction applies. It should consider all templates that the current template rule could override, which means that if the template appeared in a stylesheet that was included in another stylesheet, any templates imported into the including stylesheet have to be considered as well. The method Stylesheet.getMinimumDescendantPrecedence is responsible for this calculation.
    Reviewed by Joanne Tong (joannet@ca.ibm.com)
    igorh@apache.org 2004/04/26 xml-xalan/java/src/org/apache/xpath XPathContext.java xml-xalan/java/src/org/apache/xpath/objects DTMXRTreeFrag.java XRTreeFrag.java The problem is that about 1800 * Thread_num XRTreeFrag objects were created. It took too long for finalizer to be executed to release the references.
    A lot of the objects have the same DTMs (and one XPathContext per thread). In my fix I am suggesting a. to have new class DTMXRTreeFrag. The object of the class would be created only for different DTMs (just 5 objects). b. release the references to DTM and XPathContext from XPathContext.reset() (and remove finalize() ).
    minchau@apache.org 2004/04/27 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java xml-xalan/java/src/org/apache/xml/utils Trie.java PR: bugzilla 28435
    Submitted by: Brian Minchau
    Reviewed by: Henry Zongaro
    igorh@apache.org 2004/04/28 xml-xalan/java/src/org/apache/xalan/templates AVT.java Scaling Problem in org/apache/xalan/templates/AVT.evaluate The problem is that synchronized calls StringBufferPool.get() and StringBufferPool.free(buf) are redundant if (null != m_simpleString). The bug results in severe performance derogation in multi-thread test. The fix is simple just not to the calls when (null != m_simpleString). mcnamara@apache.org 2004/05/03 xml-xalan/java/xdocs/style/stylesheets designdoc2html.xsl Provide alternative text for images to address accessibility issues. All images should contain a short alternative text description that represents the function of the graphic. mcnamara@apache.org 2004/05/03 xml-xalan/java/xdocs xml-site-style.tar.gz Update document2html.xsl within this tarball to provide alternative text for images to address accessibility issues. All images should contain a short alternative text description that represents the function of the graphic. minchau@apache.org 2004/05/03 xml-xalan/java/samples/SAX2SAX SAX2SAX.java xml-xalan/java/samples/Pipe Pipe.java xml-xalan/java/samples/DOM2DOM DOM2DOM.java xml-xalan/java/samples/UseStylesheetPI foo.xsl xml-xalan/java/samples/UseStylesheetParam foo.xsl xml-xalan/java/samples/UseXMLFilters UseXMLFilters.java xml-xalan/java/samples/Trace foo.xsl Clean up related to bugzilla 24304. There is no longer a space after the XML header. To keep the output of this sample the same as before properties were set on the serializer (indent="yes" and standalone="no" ). Submitted by: Brian Minchau Reviewed by: Sarah McNamara igorh@apache.org 2004/05/06 xml-xalan/java/src/org/apache/xalan/templates AVT.java The problem is that we use an object pool (shared between different threads) to allocate FastStringBuffer objects. The problem results in a serious performance degradation on Z/OS and seems to be invisible on AIX.
    1 Differences in optimization of object pools for different JVMs and for different platforms are known(I know it now too). It is not surprising that Z/OS and AIX have different results.
    2. a. Object pools should be used only for very heavy object which live for a long time and could be reused in a lot of places. b. Small local objects which size cannot be changed could be allocated on the stack => creating them with new in the local scope could be a good idea. c. Caching middle size objects which can grow in size seems as a good idea, because such objects usually cannot be allocated on the stack.
    This is actually the case for FastStringBuffer objects.
    Solution
    I am creating FastStringBuffer objects in a local scope. I am going to use caching whenever possible.
    minchau@apache.org 2004/05/13 xml-xalan/java/src/org/apache/xalan/client XSLTProcessorApplet.java Submitted by: Brian Minchau
    Reviewed by: Christine Li
    Fixing binary compatibility (serialization/de-serialization) of XSLTProcessorApplet.
    bhakti@apache.org 2004/05/13 xml-xalan/java/src/org/apache/xalan/xsltc/runtime AbstractTranslet.java In xsltc currently with the extension redirect the output file is created only if the parent dir exists. Making the behaviour similar to that of xalan wherein the parent directory is also created. santiagopg@apache.org 2004/05/20 xml-xalan/java/src/org/apache/xalan/xsltc/runtime AbstractTranslet.java BasisLibrary.java Fix for Bugzilla 29120. The translet now stores a reference to the DocumentBuilderFactory which is used by nodeList2Iterator() in the basis library. Note that to reuse that reference you need to use the same transformer (not just the same template). santiagopg@apache.org 2004/05/21 xml-xalan/java/src/org/apache/xalan/xsltc/compiler AttributeValueTemplate.java Implemented a new parser for ATVs. The old was buggy: did not handle escaped curly braces in all cases and did not handled quotes at all. The old parser assumed that braces came in pairs, but it is possible to have an odd number as in "{{{$foo}}}". The new parser seems to handle all cases correctly. santiagopg@apache.org 2004/05/21 xml-xalan/java/src/org/apache/xalan/xsltc/compiler LiteralAttribute.java LiteralElement.java Parser.java SyntaxTreeNode.java Modified code to ensure line number information is propagated from parent to children to ensure we get informative error messages. This was particularly bad for errors in ATVs. santiagopg@apache.org 2004/05/25 xml-xalan/java/src/org/apache/xalan/xsltc/runtime AbstractTranslet.java BasisLibrary.java Improved patch for Bugzilla 29120 based on Matthias' suggestion. A DOMImplementation is now cached for even better performance. jycli@apache.org 2004/05/26 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Mode.java Stylesheet.java If the local is set to Turkish, but the codepage is MS-DOS (US) 437. The BCEL InstructionFinder.search(String) method can not find any instructions contain letter I. In Turkish, there are 2 lower case i. Since the search() method is case insensitive, change the pattern string to use lower case. minchau@apache.org 2004/06/01 xml-xalan/java/src/org/apache/xml/serializer ToStream.java PR: bugzilla 29234
    Submitted by: Brian Minchau
    Reviewed by: Morris Kwan
    This problem only showed up under XSLTC. When setting the encoding a related field was not set. Fixed this by over-riding the set method for the stream serializers.
    minchau@apache.org 2004/06/07 xml-xalan/java/src/org/apache/xml/serializer WriterToUTF8Buffered.java PR: bugzilla 29372
    Submitted by: J Desrochers (john@ASCnet.COM)
    Reviewed by: Brian Minchau
    A safe fix for chunking up an array for output. The length was multiplied by the chunk number (0,1,2... chunks) then divided by "chunks". John's fix uses a "long" to do the arithemetic because multiplying by the chunk number first could cause an overflow.
    santiagopg@apache.org 2004/06/10 xml-xalan/java/src/org/apache/xalan/xsltc/compiler LiteralElement.java Patch for Bugzilla 29411. New algorithm shoudl optimize the way NS decls are reported for nested literal elements. Note that the algorithm will not work accross non-literal elements. E.g., if there is an xsl:element between two literal elements, the inner literal element may report unnecessary NS delcs. This is just a simple way to ensure that any NS decls defined by the xsl:element instruction are re-defined in the inner literal (see namespace39 in the conf tests). santiagopg@apache.org 2004/06/11 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Mode.java Fixed a problem with peephole optimization patterns. I don't know if something changed in BCEL since the code was written, but the pattern syntax was not correct. I've also added a new common peephole pattern which should reduce then inner loop's length in some Translets. zongaro@apache.org 2004/06/17 xml-xalan/java/src/org/apache/xpath/axes ChildIterator.java Fix for Bugzilla bug 28879. Classes derived from NodeTest need to ensure that initNodeTest is called to set the filter for the kinds of nodes accepted. Without this change, ChildIterator will reject all nodes.
    Patch reviewed by Christine Li (jycli@ca.ibm.com).
    igorh@apache.org 2004/06/21 xml-xalan/java/src/org/apache/xalan/xsltc/dom KeyIndex.java xml-xalan/java/src/org/apache/xalan/xsltc/util IntegerArray.java Fix for Bugzilla Bugs 28622. santiagopg@apache.org 2004/06/24 xml-xalan/java/src/org/apache/xalan/xsltc/compiler CastExpr.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ObjectType.java StringType.java Type.java Patch for Bugzilla 27539 and related problems. The main problem was that hashCode() was not implemented correctly in ObjectType. To eleminate further problems I also removed Type.ObjectString as this type is the same as Type.String and the latter can be used in place of the former. aruny@apache.org 2004/07/15 xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerHandlerImpl.java TransformerImpl.java Description: getNode should return the result DOM tree once TransformerHandler completes the transformation. aruny@apache.org 2004/07/15 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Output.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime AbstractTranslet.java Description: Patch for the support of extension attribute "intent-amount" for xsl:output. Supports the old URI {http://xml.apache.org/xslt} and new URI{http://xml.apache.org/xalan}. aruny@apache.org 2004/07/15 xml-xalan/java/src/org/apache/xalan/xsltc/trax SAX2DOM.java Description: Patch for concatenating adjacent text nodes. aruny@apache.org 2004/07/15 xml-xalan/java/src/org/apache/xml/serializer ToStream.java Description: Improper Serialization of document type declaration in xml document. mkwan@apache.org 2004/07/21 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM2.java Patch for bug 30056. Recover the performance degradation for xsl:copy and xsl:copy-of.
    Reviewed by Henry Zongaro (zongaro@ca.ibm.com).
    minchau@apache.org 2004/07/21 xml-xalan/java/src/org/apache/xml/serializer SerializerBase.java ToTextStream.java PR: bugzilla 29706
    Submitted by: Brian Minchau
    Reviewed by: Christine Li
    A fix to add a temporary vs. permanent output state to the serializer (AKA result-tree-handler). In theory the XSLT processor should set the temporary or permanent output state, but we observer that when the encoding of a ToTextStream serializer is null, then such a serializer is in temporary output state.
    In temorary output state we don't do any escaping or encoding or other sorts of normalization on output. This will be done by another serializer later on, and that one will be in permanent output state.
    minchau@apache.org 2004/07/21 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java PR: bugzilla 30142
    Submitted by: Bruno Dumon (bruno@outerthought.org)
    Reviewed by: Brian Minchau
    Thanks to Bruno for this simple one-line, fix where we forgot to put a space between the PUBLIC and SYSTEM ID's in a DOCTYPE declaration in serialized HTML output.
    minchau@apache.org 2004/07/22 xml-xalan/java/src/org/apache/xml/serializer ToStream.java Submitted by: Brian Minchau
    Reviewed by: Henry Zongaro
    Backing out the last code change by Arun because it breaks the smoketest. The code I am backing out is definately wrong. The old code appears to be correct to both myself and Henry Zongaro.
    Waiting for a testcase to see what is wrong with the serialization code and DOCTYPE. Future changes may be made.
    minchau@apache.org 2004/07/22 xml-xalan/java/src/org/apache/xalan/xsltc/dom DOMAdapter.java Submitted by: Yash Talwar
    Reviewed by: Brian Minchau
    Fix for bugzilla 28796.
    minchau@apache.org 2004/07/22 xml-xalan/java/src/org/apache/xpath/objects XString.java Submitted by: Yash Talwar
    Reviewed by: Brian Minchau
    Fix for bugzilla 29655.
    minchau@apache.org 2004/08/13 xml-xalan/java/src/org/apache/xalan/lib Redirect.java PR: 30658
    Submitted by: Brian Minchau
    Reviewed by: Morris Kwan
    minchau@apache.org 2004/08/13 xml-xalan/java/src/org/apache/xalan/trace TraceManager.java PR: 30301
    Submitted by: Brian Minchau
    Reviewed by: Morris Kwan
    minchau@apache.org 2004/08/13 xml-xalan/java/src/org/apache/xpath/objects XRTreeFragSelectWrapper.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java PR: 30262
    Submitted by: Yash Talwar
    Reviewed by: Henry Zongaro
    mcnamara@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xml/dtm DTMException.java xml-xalan/java/src/org/apache/xpath XPathException.java Fix for printStackTrace when using JDK 1.4. mcnamara@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xalan/extensions ObjectFactory.java xml-xalan/java/src/org/apache/xalan/lib ObjectFactory.java xml-xalan/java/src/org/apache/xalan/lib/sql ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xslt ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/cmdline ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/dom ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/trax ObjectFactory.java xml-xalan/java/src/org/apache/xml/dtm ObjectFactory.java xml-xalan/java/src/org/apache/xml/dtm/ref ObjectFactory.java xml-xalan/java/src/org/apache/xml/serializer ObjectFactory.java xml-xalan/java/src/org/apache/xml/utils ObjectFactory.java xml-xalan/java/src/org/apache/xpath/compiler ObjectFactory.java xml-xalan/java/src/org/apache/xpath/functions ObjectFactory.java Fixing a potential memory leak. The reader used to read the service provider is never closed if an IOException is thrown while reading from it. Adding a finally block so that the reader will always be closed. Patch reviewed by Christine Li. jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xalan/extensions ObjectFactory.java Added serialVersionUID for classes which implement Serializable interface jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xalan/lib ObjectFactory.java xml-xalan/java/src/org/apache/xalan/lib/sql ObjectFactory.java Added serialVersionUID for classes which implement Serializable interface. Was reviewed by Henry Zongaro (zongaro@ca.ibm.com) jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xalan/processor ProcessorAttributeSet.java ProcessorCharacters.java ProcessorDecimalFormat.java ProcessorExsltFuncResult.java ProcessorExsltFunction.java ProcessorGlobalParamDecl.java ProcessorGlobalVariableDecl.java ProcessorImport.java ProcessorInclude.java ProcessorKey.java ProcessorLRE.java ProcessorNamespaceAlias.java ProcessorOutputElem.java ProcessorPreserveSpace.java ProcessorStripSpace.java ProcessorStylesheetDoc.java ProcessorStylesheetElement.java ProcessorTemplate.java ProcessorTemplateElem.java ProcessorText.java ProcessorUnknown.java WhitespaceInfoPaths.java XSLTElementProcessor.java Added serialVersionUID for classes which implement Serializable interface. Patch created by Christine Li (jycli@ca.ibm.com) and was reviewed by Henry Zongaro (zongaro@ca.ibm.com) jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xalan/templates AVT.java AVTPart.java AVTPartSimple.java AVTPartXPath.java DecimalFormatProperties.java ElemApplyImport.java ElemApplyTemplates.java ElemAttribute.java ElemAttributeSet.java ElemCallTemplate.java ElemChoose.java ElemComment.java ElemCopy.java ElemCopyOf.java ElemElement.java ElemEmpty.java ElemExsltFuncResult.java ElemExsltFunction.java ElemExtensionCall.java ElemExtensionDecl.java ElemExtensionScript.java ElemFallback.java ElemForEach.java ElemIf.java ElemLiteralResult.java ElemMessage.java ElemNumber.java ElemOtherwise.java ElemParam.java ElemPI.java ElemSort.java ElemTemplate.java ElemTemplateElement.java ElemText.java ElemTextLiteral.java ElemUnknown.java ElemUse.java ElemValueOf.java ElemVariable.java ElemVariablePsuedo.java ElemWhen.java ElemWithParam.java FuncDocument.java FuncFormatNumb.java FuncKey.java KeyDeclaration.java NamespaceAlias.java OutputProperties.java Stylesheet.java StylesheetComposed.java StylesheetRoot.java TemplateList.java TemplateSubPatternAssociation.java WhiteSpaceInfo.java XMLNSDecl.java XUnresolvedVariable.java XUnresolvedVariableSimple.java xml-xalan/java/src/org/apache/xalan/transformer CountersTable.java KeyIterator.java KeyRefIterator.java xml-xalan/java/src/org/apache/xalan/xslt ObjectFactory.java Added serialVersionUID for classes which implement Serializable interface. Patch created by Christine Li (jycli@ca.ibm.com) and was reviewed by Henry Zongaro (zongaro@ca.ibm.com) jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xalan/xsltc TransletException.java xml-xalan/java/src/org/apache/xalan/xsltc/cmdline ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/getopt GetOptsException.java IllegalArgumentException.java MissingOptArgException.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler CompilerException.java IllegalCharException.java ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util MultiHashtable.java ObjectFactory.java StringStack.java TypeCheckError.java xml-xalan/java/src/org/apache/xalan/xsltc/dom BitArray.java ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime ObjectFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/trax ObjectFactory.java TemplatesImpl.java Added serialVersionUID for classes which implement Serializable interface. Patch created by Christine Li (jycli@ca.ibm.com) and was reviewed by Henry Zongaro (zongaro@ca.ibm.com) jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xml/dtm DTMConfigurationException.java DTMDOMException.java ObjectFactory.java xml-xalan/java/src/org/apache/xml/dtm/ref DTMNamedNodeMap.java IncrementalSAXSource_Filter.java ObjectFactory.java xml-xalan/java/src/org/apache/xml/serializer ObjectFactory.java xml-xalan/java/src/org/apache/xml/utils MutableAttrListImpl.java NameSpace.java NodeVector.java ObjectFactory.java ObjectPool.java QName.java SAXSourceLocator.java SerializableLocatorImpl.java StopParseException.java StringVector.java URI.java WrappedRuntimeException.java WrongParserException.java Added serialVersionUID for classes which implement Serializable interface. Patch created by Christine Li (jycli@ca.ibm.com) and was reviewed by Henry Zongaro (zongaro@ca.ibm.com) jycli@apache.org 2004/08/17 xml-xalan/java/src/org/apache/xpath Expression.java FoundIndex.java NodeSetDTM.java XPath.java XPathProcessorException.java xml-xalan/java/src/org/apache/xpath/axes AttributeIterator.java AxesWalker.java BasicTestIterator.java ChildIterator.java ChildTestIterator.java DescendantIterator.java FilterExprIterator.java FilterExprIteratorSimple.java FilterExprWalker.java IteratorPool.java LocPathIterator.java MatchPatternIterator.java NodeSequence.java OneStepIterator.java OneStepIteratorForward.java PredicatedNodeTest.java ReverseAxesWalker.java RTFIterator.java SelfIteratorNoPredicate.java UnionChildIterator.java UnionPathIterator.java WalkingIterator.java WalkingIteratorSorted.java xml-xalan/java/src/org/apache/xpath/compiler ObjectFactory.java xml-xalan/java/src/org/apache/xpath/functions FuncBoolean.java FuncCeiling.java FuncConcat.java FuncContains.java FuncCount.java FuncCurrent.java FuncDoclocation.java FuncExtElementAvailable.java FuncExtFunction.java FuncExtFunctionAvailable.java FuncFalse.java FuncFloor.java FuncGenerateId.java FuncId.java FuncLang.java FuncLast.java FuncLocalPart.java FuncNamespace.java FuncNormalizeSpace.java FuncNot.java FuncNumber.java FuncPosition.java FuncQname.java FuncRound.java FuncStartsWith.java FuncString.java FuncStringLength.java FuncSubstring.java FuncSubstringAfter.java FuncSubstringBefore.java FuncSum.java FuncSystemProperty.java Function.java Function2Args.java Function3Args.java FunctionDef1Arg.java FunctionMultiArgs.java FunctionOneArg.java FuncTranslate.java FuncTrue.java FuncUnparsedEntityURI.java ObjectFactory.java WrongNumberArgsException.java xml-xalan/java/src/org/apache/xpath/objects XBoolean.java XBooleanStatic.java XNodeSet.java XNodeSetForDOM.java XNull.java XNumber.java XObject.java XRTreeFrag.java XRTreeFragSelectWrapper.java XString.java XStringForChars.java XStringForFSB.java xml-xalan/java/src/org/apache/xpath/operations And.java Bool.java Div.java Equals.java Gt.java Gte.java Lt.java Lte.java Minus.java Mod.java Mult.java Neg.java NotEquals.java Number.java Operation.java Or.java Plus.java Quo.java String.java UnaryOperation.java Variable.java VariableSafeAbsRef.java xml-xalan/java/src/org/apache/xpath/patterns ContextMatchStepPattern.java FunctionPattern.java NodeTest.java StepPattern.java UnionPattern.java Added serialVersionUID for classes which implement Serializable interface. Patch created by Christine Li (jycli@ca.ibm.com) and was reviewed by Henry Zongaro (zongaro@ca.ibm.com) minchau@apache.org 2004/08/26 xml-xalan/java/src/org/apache/xml/utils Trie.java Submitted by: Brian Minchau
    No external changes to Trie, but some additional APIs to make for a lower case only search in a Trie (possibly for future XHTML support where the element names are lower-case only).
    minchau@apache.org 2004/08/27 xml-xalan/java/src/org/apache/xml/serializer CharInfo.java ToHTMLStream.java ToStream.java Minor changes to CharInfo to map charaters to decorated entities (e.g. "&lt;" ) rather than just entity names (e.g. "lt"), which is a minor performance improvement. mkwan@apache.org 2004/08/30 xml-xalan/java/src/org/apache/xml/utils XMLReaderManager.java Fix a memory leak problem described in bugzilla 28082. minchau@apache.org 2004/09/01 xml-xalan/java/src/org/apache/xml/serializer SerializerTraceWriter.java ToStream.java WriterChain.java WriterToASCI.java WriterToUTF8Buffered.java Submitted by: Brian Minchau
    Code clean up, to have an explicit interface, WriterChain, for writers that wrap other Writers or OutputStreams, e.g. WriterToUTF8Buffered.
    minchau@apache.org 2004/09/01 xml-xalan/java/src/org/apache/xml/serializer ToXMLStream.java Submitted by: Brian Minchau
    Javadoc changes, and added a call in ToXMLStream.processingInstruction() method to effectively consider that a startDocument() call was made, if none was yet seen.
    minchau@apache.org 2004/09/07 xml-xalan/java/src/org/apache/xml/serializer ToSAXHandler.java PR: bugzilla 27522
    Submitted by: Brian Minchau
    committing patch from bugzilla 27522
    johng@apache.org 2004/09/16 xml-xalan/java/src/org/apache/xalan/lib/sql SQLDocument.java Fixed bug where JDBC execute was being called instead ofg executeQuery. executeQuery will always retrurn a result set even if the query does not return any rows where execute won't. This was causing a compatibility issue. Added in Record skip code to help with pagination. PR: http://nagoya.apache.org/jira/browse/XALANJ-1908 Submitted by: John Gentilin johng@apache.org 2004/09/16 xml-xalan/java/src/org/apache/xalan/lib/sql XConnection.java Fixed bug where the close document method could not locxate the SQL Document. see http://nagoya.apache.org/jira/browse/XALANJ-1925
    Obtained from: Moraine Didier mailto://didier.moraine@winterthur.be
    Submitted by: John Gentilin
    mcnamara@apache.org 2004/09/17 xml-xalan/java build.xml Added new targets to support building the distribution packages (*-bin.tar.gz/.zip and *-src.tar.gz/.zip) without building the user guide and api docs.
    Reorganized some sections to make the targets more readable.
    Renamed the "*-nojardepends" rules to either "*-compile" or "*-build" to make them more intuitive.
    Reviewed by Christine Li.
    zongaro@apache.org 2004/09/24 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Variable.java Skip translation for any unreferenced variables. Patch reviewed by Christine Li (jycli@ca.ibm.com). zongaro@apache.org 2004/10/01 xml-xalan/java/src/org/apache/xpath/compiler XPathParser.java xml-xalan/java/src/org/apache/xpath/patterns NodeTest.java Patch from Yash Talwar (ytalwar@ca.ibm.com) for XALANJ-1186.
    The existing code in the interpretive processor was handling namespace::pre by resolving the namespace prefix "pre" in the stylesheet, and then looking for namespace nodes with that same URI in the input document. In fact, it should look for namespaces nodes in the input document that declare the prefix "pre", without regard to the associated URI.
    The patch was reviewed by myself (zongaro@ca.ibm.com).
    minchau@apache.org 2004/10/06 xml-xalan/java/src/org/apache/xml/serializer ToHTMLSAXHandler.java XSL Transformation drops content inside xsl:comment tags.
    PR: XALANJ-1966
    Submitted by: Yash Talwar
    Reviewed by: Brian Minchau
    minchau@apache.org 2004/10/06 xml-xalan/java/src/org/apache/xpath/operations Variable.java Null Pointer Exception on sorting using a variable.
    PR: XALANJ-1942
    Submitted by: Yash Talwar
    Reviewed by: Brian Minchau
    minchau@apache.org 2004/10/06 xml-xalan/java/src/org/apache/xalan/processor ProcessorNamespaceAlias.java xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java Null Pointer Exception when namespace-alias element says to use "#default" namespace but there is no default namespace.
    PR: XALANJ-1967
    Submitted by: Yash Talwar
    Reviewed by: Brian Minchau
    zongaro@apache.org 2004/10/13 xml-xalan/java build.xml At the suggestion of Joseph Kesselman, dropped contents of the org.apache.xml.utils.synthetic package, as they have never been used. Patch reviewed by Christine Li (jycli@ca.ibm.com). jycli@apache.org 2004/10/13 xml-xalan/java build.xml xml-xalan/java/src/org/apache/xalan/extensions ExtensionHandlerGeneral.java xml-xalan/java/xdocs/sources/xalan extensions.xml resources.xml Fixed of Bug report XalanJ-1822. Added alternative BSF implementation support for extension functions in languages other than Java Patch reviewed by Henry Zongaro (zongaro@ca.ibm.com) minchau@apache.org 2004/10/14 xml-xalan/java/src/org/apache/xml/serializer/utils AttList.java BoolStack.java DOM2Helper.java Messages.java SerializerMessages_en.java SerializerMessages.java StringToIntTable.java SystemIDResolver.java URI.java Utils.java WrappedRuntimeException.java PR: XALANJ-1891
    Submitted by: Brian Minchau
    Reviewed by: Yash Talwar
    minchau@apache.org 2004/10/14 xml-xalan/java/src/org/apache/xml/serializer/utils Messages.java SerializerMessages.java Utils.java Submitted by: Brian Minchau
    Made some fields final or private to make the objects immutable, especially the messages.
    minchau@apache.org 2004/10/14 xml-xalan/java/src/org/apache/xml/serializer AttributesImplSerializer.java CharInfo.java DOMSerializer.java ElemDesc.java EmptySerializer.java EncodingInfo.java Encodings.java ExtendedContentHandler.java ExtendedLexicalHandler.java Method.java NamespaceMappings.java ObjectFactory.java OutputPropertiesFactory.java OutputPropertyUtils.java SerializationHandler.java Serializer.java SerializerBase.java SerializerConstants.java SerializerFactory.java SerializerTrace.java SerializerTraceWriter.java ToHTMLSAXHandler.java ToHTMLStream.java ToSAXHandler.java ToStream.java ToTextSAXHandler.java ToTextStream.java ToUnknownStream.java ToXMLSAXHandler.java ToXMLStream.java TreeWalker.java Utils.java Version.java WriterToASCI.java ElemContext.java TransformStateSetter.java Submitted by: Brian Minchau
    Reviewed by: Yash Talwar
    Source code changes to the serializer to make it independent of Xalan. Mostly message and utility usage changes. However multiple classes had their visibility reduced to less than "public".
    minchau@apache.org 2004/10/14 xml-xalan/java/src/org/apache/xml/utils CharKey.java Trie.java PR: XALANJ-1891
    Submitted by: Brian Minchau
    Reviewed by: Yash Talwar
    Deleting Charkey and Trie which were only used by the serializer. These classes are migrated to the serializer package, in the case of CharKey, it is now an inner private class.
    minchau@apache.org 2004/10/15 xml-xalan/java/src MANIFEST.SERIALIZER PR: XALANJ-1891
    Submitted by: Brian Minchau
    Reviewed by: Sarah McNamara
    Creating MANIFEST.SERIALIZER, a template like MANIFEST.MF but for an independent serializer.jar that is not part of xalan.jar
    minchau@apache.org 2004/10/15 xml-xalan/java build.xml PR: XALANJ-1891
    Submitted by: Brian Minchau
    Reviewed by: Sarah McNamara
    Changes to java/build.xml so that the serializer.jar is built and used by Xalan.
    The two new build targets are serializer.jar and serializer-dist
    minchau@apache.org 2004/10/15 xml-xalan/java/bin serializer.jar PR: XALANJ-1891
    Submitted by: Brian Minchau
    Reviewed by: Sarah McNamara, Yash Talwar
    Checking in an initial serializer.jar into java/bin, hopefully this won't change too often.
    johng@apache.org 2004/10/19 xml-xalan/java/src/org/apache/xalan/lib/sql DefaultConnectionPool.java XConnection.java SQLDocument.java This patch makes the close() function behave better but still has a problem when certain iterators are used. This code is at least safe in all instaces.
    It also fixes a minor bug in the default connection pool.
    Obtained from: John Gentilin
    Submitted by: John Gentilin
    jycli@apache.org 2004/10/21 xml-xalan/java/src/org/apache/xpath/objects XStringForFSB.java A patch to fix Bug XALANJ-1708.
    Reviewed by Morris Kwan (mkwan@ca.ibm.com)
    jycli@apache.org 2004/10/21 xml-xalan/java/src/org/apache/xpath/axes NodeSequence.java UnionPathIterator.java a fix for bug XALANJ-1810.
    Reviewed by Morris Kwan (mkwan@ca.ibm.com)
    mcnamara@apache.org 2004/10/21 xml-xalan/java build.xml Fix the samples build. The samples.class.path needs to include the serializer.jar. minchau@apache.org 2004/10/26 xml-xalan/java/src/org/apache/xml/serializer SerializerBase.java Submitted by: Brian Minchau
    Restoring the SerializerBase class "public" (what it used to be). There were strange build problems, I'll open a JIRA issue.
    mcnamara@apache.org 2004/10/28 xml-xalan/java build.xml One more fix to enable builds with JDK 1.4.x. Need to add the serializer classes to the xslt.boot.class.path. jycli@apache.org 2004/11/02 xml-xalan/java/src/org/apache/xpath/axes DescendantIterator.java String comparison should use String.equals(), instead of ==. Even == works fine for most of the cases, for a serializable object, two variable originally reference to the same string after deserialization, they no longer reference the same string, although the values are the same. Fix for bug XalanJ-1550 jycli@apache.org 2004/11/02 xml-xalan/java/src/org/apache/xalan/extensions ExtensionHandlerGeneral.java The latest Rhino1_5R5 checks for the script language line/column no.>=0 Fixed for bug XALANJ-1887. jycli@apache.org 2004/11/03 xml-xalan/java/src/META-INF/services org.apache.xalan.extensions.bsf.BSFManager Added a service provider configuration file to set the Apache BSF as the default implementation for scripting language support jycli@apache.org 2004/11/03 xml-xalan/java/bin bsf.jar bsf.LICENSE.txt bsf.README.txt remove IBM bsf implementation from the distribution. Xalan is not going to ship any bsf implementation. If users need IBM bsf, they can download it from Attic minchau@apache.org 2004/11/12 xml-xalan/java/src/org/apache/xpath/compiler Lexer.java XPathParser.java xml-xalan/java/src/org/apache/xpath/domapi XPathEvaluatorImpl.java XPathExpressionImpl.java XPathNamespaceImpl.java XPathNSResolverImpl.java XPathResultImpl.java XPathStylesheetDOM3Exception.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java PR: bug XALANJ-1985
    Submitted by: Yash Talwar
    Reviewed by: Brian Minchau
    Support for DOM 3 API, for use by an XML Parser.
    zongaro@apache.org 2004/11/16 xml-xalan/java/src/org/apache/xalan/xsltc/compiler CallTemplate.java Patch for bug report XALANJ-1994.
    The CallTemplate.getCalleeTemplate() method was searching through a Vector of all templates defined by the logical stylesheet, and picked out the first with the same name referenced by the current xsl:call-template instruction. However, that failed to account for import precedence. The SymbolTable.lookupTemplate method takes into account import precedence, and should be used instead.
    Patch was reviewed by Christine Li (jycli@ca.ibm.com)
    zongaro@apache.org 2004/11/19 xml-xalan/java/src/org/apache/xpath/objects XStringForFSB.java Patch for XALANJ-1955. The equals(Object) method contains a list of instanceof checks, and then casts the Object argument to the tested type in order to dispatch to a more specific equals method. In the case where the Object argument was an XMLString, the code was actually casting "this" to XMLString - thus testing this.equals(this), which will always be true.
    Reviewd by Joanne Tong (joannet () ca ! ibm ! com).
    zongaro@apache.org 2004/11/19 xml-xalan/java/src/org/apache/xalan/transformer KeyTable.java Patch for XALANJ-1368.
    The method getKeyDeclaration was looping through all the xsl:key elements defined, and returning the first with the required name. However, more than one xsl:key element can specify the same name, and should be treated cumulatively. Modified the method so that it returns all elements with the required name, and the caller so that it tries to match against the patterns associated with all such elements.
    Reviewed by Joanne Tong (joannet@ca.ibm.com).
    mkwan@apache.org 2004/11/22 xml-xalan/java/src/org/apache/xml/dtm/ref DTMManagerDefault.java Fix a memory leak problem in DTMManager (XALANJ-1999). santiagopg@apache.org 2004/12/06 xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java Operators.java Patch for XALANJ-2003. Problem was unrelated to recursion, but simply a bug in the basis library. Swapping operands requires swapping operators and the latter was not done. A workaround for this bug would be to swap the operands (and operator) in the stylesheet (as that would not cause any swapping in the basis library). santiagopg@apache.org 2004/12/10 xml-xalan/java/src/org/apache/xalan/xsltc/trax DOM2TO.java Patch for XALANJ-2015. Namespace declarations are now reported on a first pass to avoid the problem described in the bug report. santiagopg@apache.org 2004/12/10 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Output.java Parser.java SyntaxTreeNode.java Patch for XALANJ-1761. Output properties from multiple xsl:output instructions are now correctly merged (previously, only cdata-section-elements were handled correctly). santiagopg@apache.org 2004/12/10 xml-xalan/java/src/org/apache/xalan/xsltc/runtime Operators.java Replaced meaningless numbers by predefined constants in swapArray[] vector. joannet@apache.org 2004/12/13 xml-xalan/java/src/org/apache/xalan/templates ElemApplyImport.java xml-xalan/java/src/org/apache/xalan/transformer TransformerImpl.java Fixed XALANJ-1824. Changed current template rule when named template executes an xsl:apply-imports joannet@apache.org 2004/12/13 xml-xalan/java/src/org/apache/xalan/lib PipeDocument.java Fixed XALANJ-1662. Allow pipeDocument to throw exceptions joannet@apache.org 2004/12/13 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Import.java Fixed XALANJ-1812. Template inlining setting propagated to imported stylesheets jycli@apache.org 2004/12/15 xml-xalan/java/src/org/apache/xalan/client XSLTProcessorApplet.java xml-xalan/java/src/org/apache/xalan/extensions ExtensionHandlerJavaClass.java ExtensionHandlerJavaPackage.java MethodResolver.java xml-xalan/java/src/org/apache/xalan/lib/sql ConnectionPoolManager.java DTMDocument.java xml-xalan/java/src/org/apache/xalan/processor StylesheetHandler.java TransformerFactoryImpl.java XSLTAttributeDef.java xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources_ca.java XSLTErrorResources_cs.java XSLTErrorResources_de.java XSLTErrorResources_es.java XSLTErrorResources.java XSLTErrorResources_fr.java XSLTErrorResources_hu.java XSLTErrorResources_it.java XSLTErrorResources_ja.java XSLTErrorResources_ko.java XSLTErrorResources_pl.java XSLTErrorResources_pt_BR.java XSLTErrorResources_ru.java XSLTErrorResources_sk.java XSLTErrorResources_sv.java XSLTErrorResources_tr.java XSLTErrorResources_zh_CN.java XSLTErrorResources_zh_TW.java xml-xalan/java/src/org/apache/xalan/templates ElemApplyImport.java ElemApplyTemplates.java ElemAttributeSet.java ElemCallTemplate.java ElemChoose.java ElemComment.java ElemCopy.java ElemCopyOf.java ElemElement.java ElemExsltFuncResult.java ElemExsltFunction.java ElemExtensionCall.java ElemFallback.java ElemForEach.java ElemIf.java ElemLiteralResult.java ElemMessage.java ElemNumber.java ElemParam.java ElemPI.java ElemTemplate.java ElemTextLiteral.java ElemUnknown.java ElemValueOf.java ElemVariable.java ElemWithParam.java RedundentExprEliminator.java StylesheetRoot.java TemplateList.java xml-xalan/java/src/org/apache/xalan/trace TraceManager.java xml-xalan/java/src/org/apache/xalan/transformer StackGuard.java TransformerHandlerImpl.java TransformerImpl.java xml-xalan/java/src/org/apache/xalan/xslt EnvironmentCheck.java Process.java xml-xalan/java/src/org/apache/xalan/xsltc/cmdline Compile.java Transform.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler CastExpr.java EqualityExpr.java Key.java LocationPathPattern.java Mode.java ParentLocationPath.java Predicate.java ProcessingInstructionPattern.java RelationalExpr.java Sort.java Step.java StepPattern.java SyntaxTreeNode.java UnionPathExpr.java xpath.cup xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ClassGenerator.java ErrorMessages.java ErrorMessages_ca.java ErrorMessages_cs.java ErrorMessages_de.java ErrorMessages_es.java ErrorMessages_fr.java ErrorMessages_hu.java ErrorMessages_it.java ErrorMessages_ja.java ErrorMessages_ko.java ErrorMessages_no.java ErrorMessages_pl.java ErrorMessages_pt_BR.java ErrorMessages_ru.java ErrorMessages_sk.java ErrorMessages_tr.java ErrorMessages_zh_CN.java ErrorMessages_zh_TW.java NamedMethodGenerator.java xml-xalan/java/src/org/apache/xalan/xsltc/dom Axis.java DocumentCache.java MultiDOM.java MultipleNodeCounter.java NodeCounter.java SAXImpl.java SimpleResultTreeImpl.java SingleNodeCounter.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java ErrorMessages_ca.java ErrorMessages_cs.java ErrorMessages_de.java ErrorMessages_es.java ErrorMessages_fr.java ErrorMessages_hu.java ErrorMessages_it.java ErrorMessages_ja.java ErrorMessages_ko.java ErrorMessages_no.java ErrorMessages.java ErrorMessages_pl.java ErrorMessages_pt_BR.java ErrorMessages_ru.java ErrorMessages_sk.java ErrorMessages_tr.java ErrorMessages_zh_CN.java ErrorMessages_zh_TW.java Operators.java xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xalan/xsltc/util avaCupRedirect.java xml-xalan/java/src/org/apache/xml/dtm Axis.java DTMManager.java xml-xalan/java/src/org/apache/xml/dtm/ref DTMDefaultBase.java DTMDefaultBaseIterators.java DTMDefaultBaseTraversers.java DTMDocumentImpl.java IncrementalSAXSource_Xerces.java xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java SAX2DTM2.java xml-xalan/java/src/org/apache/xml/res XMLErrorResources_ca.java XMLErrorResources_cs.java XMLErrorResources_de.java XMLErrorResources_es.java XMLErrorResources_fr.java XMLErrorResources_hu.java XMLErrorResources_it.java XMLErrorResources_ja.java XMLErrorResources.java XMLErrorResources_ko.java XMLErrorResources_pl.java XMLErrorResources_pt_BR.java XMLErrorResources_ru.java XMLErrorResources_sk.java XMLErrorResources_sv.java XMLErrorResources_tr.java XMLErrorResources_zh_CN.java XMLErrorResources_zh_TW.java XMLMessages.java xml-xalan/java/src/org/apache/xml/serializer CharInfo.java SerializerConstants.java ToHTMLStream.java ToXMLStream.java xml-xalan/java/src/org/apache/xml/utils FastStringBuffer.java ThreadControllerWrapper.java XMLChar.java xml-xalan/java/src/org/apache/xml/utils/res CharArrayWrapper.java IntArrayWrapper.java LongArrayWrapper.java StringArrayWrapper.java XResourceBundle.java XResources_cy.java XResources_de.java XResources_el.java XResources_en.java XResources_es.java XResources_fr.java XResources_he.java XResources_hy.java XResources_it.java XResources_ja_JP_A.java XResources_ja_JP_HA.java XResources_ja_JP_HI.java XResources_ja_JP_I.java XResources_ka.java XResources_ko.java XResources_sv.java XResources_zh_CN.java XResources_zh_TW.java xml-xalan/java/src/org/apache/xpath XPath.java xml-xalan/java/src/org/apache/xpath/axes MatchPatternIterator.java WalkerFactory.java xml-xalan/java/src/org/apache/xpath/compiler Compiler.java FunctionTable.java Keywords.java Lexer.java XPathParser.java xml-xalan/java/src/org/apache/xpath/functions FuncSystemProperty.java xml-xalan/java/src/org/apache/xpath/objects XBoolean.java XBooleanStatic.java XNodeSet.java XString.java xml-xalan/java/src/org/apache/xpath/patterns StepPattern.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java XPATHErrorResources_ca.java XPATHErrorResources_cs.java XPATHErrorResources_de.java XPATHErrorResources_es.java XPATHErrorResources_fr.java XPATHErrorResources_hu.java XPATHErrorResources_it.java XPATHErrorResources_ja.java XPATHErrorResources_ko.java XPATHErrorResources_pl.java XPATHErrorResources_pt_BR.java XPATHErrorResources_ru.java XPATHErrorResources_sk.java XPATHErrorResources_sv.java XPATHErrorResources_tr.java XPATHErrorResources_zh_CN.java XPATHErrorResources_zh_TW.java Patch for bug report XALANJ-2008
    Based on Sun's Security Code Guidelines, modified the code to improve the security. Major changes includes:
    1. Added final modifier to static variables;
    2. Reduced scope and added public get methods whenever it is appropriate;
    3. Changed some static variable to instance variables;
    4. Changed some interfaces to final classes, if those interfaces are used only to define constants
    5. Removed the usage of System.exit;
    6. For various org.apache.xml.utils.res.XResourceBundle, the getObject() methods return immutable array wrappers instead of arrays
    7. Changed static methods of org.apache.xpath.compiler.FunctionTable to instance methods and the reference of a function table is passed around the processing to create an XPath object;
    8. Changed the flags of FEATURE_INCREMENTAL, FEATURE_OPTIMIZE and FEATURE_SOURCE_LOCATION to instance variables in TransformerFactorImpl. So they will not be changed during a processing once a new Templates is created;
    mkwan@apache.org 2004/12/15 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xpath/functions FuncExtFunction.java Patch for bug XALANJ-1592. Submitted by Catya Alone (catyaa@hotmail.com). Set the parent node for the arguments in extension functions. minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/serializer/utils Messages.java Partial fix for bug XALANJ-2021. minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/serializer/utils SerializerMessages.java Partial fix for bug XALANJ-2021. just to make key/keyvalue consistent minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/serializer/utils SerializerMessages_ca.java SerializerMessages_cs.java SerializerMessages_de.java SerializerMessages_es.java SerializerMessages_fr.java SerializerMessages_hu.java SerializerMessages_it.java SerializerMessages_ja.java SerializerMessages_ko.java SerializerMessages_pl.java SerializerMessages_pt_BR.java SerializerMessages_ru.java SerializerMessages_sv.java SerializerMessages_tr.java SerializerMessages_zh_CN.java SerializerMessages_zh_TW.java Other languages, for XALANJ-2021. minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/serializer/utils MsgKey.java A class containing only message keys, to be shared by all language translations (including English). This is to prevent replication of these keys during translation. Related to XALANJ-2021 minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/serializer/utils SerializerMessages_ca.java SerializerMessages_cs.java SerializerMessages_de.java SerializerMessages_es.java SerializerMessages_fr.java SerializerMessages_hu.java SerializerMessages_it.java SerializerMessages_ja.java SerializerMessages_ko.java SerializerMessages_pl.java SerializerMessages_pt_BR.java SerializerMessages_ru.java SerializerMessages_sv.java SerializerMessages_tr.java SerializerMessages_zh_CN.java SerializerMessages_zh_TW.java Changes for moving the message keys, to be shared by all language translations (including English). This is to prevent replication of these keys during translation. Related to XALANJ-2021 minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/serializer/utils Messages.java SerializerMessages.java URI.java xml-xalan/java/src/org/apache/xml/serializer CharInfo.java OutputPropertiesFactory.java SerializerBase.java SerializerFactory.java ToHTMLStream.java ToStream.java ToTextStream.java ToXMLStream.java Changes for moving the message keys, to be shared by all language translations (including English). This is to prevent replication of these keys during translation. Related to XALANJ-2021. minchau@apache.org 2004/12/16 xml-xalan/java/src/org/apache/xml/res XMLErrorResources.java Serializer messages were copied into a message file in the org.apache.xml.serializer.utils package. The serializer messages in this file are now "dead", so they are being deleted. This is part of the cleanup with XALANJ-2021. zongaro@apache.org 2004/12/22 xml-xalan/java/src/org/apache/xml/dtm/ref DTMNamedNodeMap.java DTMNodeProxy.java Applying patch for Jira bug report XALANJ-1427 on behalf of Yash Talwar (ytalwar@ca.ibm.com).
    Completing support for DOM Level 2 Core methods that were previously unimplemented, and fixed some bugs in the implementation. The implementation continues to be, of necessity, a read-only implementation.
    In particular, implemented the following:
    DTMNamedNodeMap.getNamedItem(String)
    DTMNodeProxy.getElementsByTagName(String)
    DTMNodeProxy.getElementsByTagNameNS(String,String)
    DTMNodeProxy.getElementById(String,String)
    DTMNodeProxy.getAttributeNodeNS(String,String)
    jycli@apache.org 2005/01/05 xml-xalan/java/xdocs/sources/xalan faq.xml Added a FAQ about how to use XSLTC in applet when using JRE1.4. It is a fix for bug report XALANJ-1705. Patch reviewed and modified by Sarah McNamara ilene@apache.org 2005/01/10 xml-xalan/java/src/org/apache/xalan/lib ExsltDatetime.java Fix for XALANJ-2013. Duplicate time zone string returned from EXSLT time() function. mcnamara@apache.org 2005/01/10 xml-xalan/java/src manifest.xalan-interpretive New manifest file to resolve Jira bug report XALANJ-1853. mcnamara@apache.org 2005/01/10 xml-xalan/java build.xml Fix for Jira bug report XALANJ-1853 . Use the new xalan interpretive manifest file when building the standalone xalan.jar that only contains the interpretive processor. mcnamara@apache.org 2005/01/10 xml-xalan/java/src MANIFEST.MF MANIFEST.SERIALIZER manifest.xsltc Fix for Jira bug report XALANJ-1852. zongaro@apache.org 2005/01/20 xml-xalan/java/src/org/apache/xalan/serialize SerializerUtils.java Applying patch for Jira bug report XALANJ-1640.
    As it's currently written, SerializerUtils.outputResultTreeFragment loops through the nodes in a result tree fragment, and for each one, it checks whether the node is in some namespace. If it is not, the code undeclares the default namespace by calling handler.startPrefixMapping("", ""). The problem is that if the RTF that's being copied just consists of a text node (or PIs or comments), that undeclaration of the default namespace hangs around until some subsequent child element picks it up as one of its attributes, even if that element is in some namespace - even what should be the default!
    The fix is to check whether the node that is being output is an element node prior to issuing the handler.startPrefixMapping call - that ensures the prefix mapping is not issued unless it's actually going to be used by the node that is about to be serialized.
    This patch was reviewed by Brian Minchau (minchau@ca.ibm.com).
    zongaro@apache.org 2005/01/24 xml-xalan/java/src/org/apache/xpath CachedXPathAPI.java Fix for Jira bug report XALANJ-1811.
    Updated Javadocs for constructors to make it clear that a single instance of CachecXPathAPI must not be used by multiple threads without synchronization.
    Reviewed by Christine Li (jycli@ca.ibm.com)
    zongaro@apache.org 2005/01/27 xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java Fix for Jira bug report XALANJ-1888.
    It is possible for the characters SAX event to specify a length of zero. Text nodes should not be created in such situations. Changed the charactersFlush method to guard against this case.
    Reviewed by Morris Kwan (mkwan@ca.ibm.com)
    zongaro@apache.org 2005/01/27 xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM2.java Two part fix for Jira bug report XALANJ-1888.
    1) It is possible for the characters SAX event to specify a length of zero. Text nodes should not be created in such situations. Changed the charactersFlush method to guard against this case.
    2) Made a defensive change to references to m_dataOrQName. If the value in this vector is to be interpreted as an index into m_data, it is stored as a negative value (via calls to addNode). However, most references to elements of m_dataOrQName were checking whether the value was non-positive, treating a value of zero as an index into m_data as well. The zeroth entry into m_data is an invalid entry. The fix to charactersFlush described above should ensure that zero is never stored in m_dataOrQName, but I thought it was just as well to duplicate the interpretation used in storing values in m_dataOrQName.
    Reviewed by Morris Kwan (mkwan@ca.ibm.com)
    jycli@apache.org 2005/02/04 xml-xalan/java/src/org/apache/xalan/templates ElemNumber.java Implement Errata E24, when the value attribute of xsl:number is NaN, infinite or less than 0.5. More details please refer to bug report XALANJ-1979. Patch is reviewed by Morris Kwan (mkwan@ca.ibm.com) jycli@apache.org 2005/02/04 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Number.java xml-xalan/java/src/org/apache/xalan/xsltc/dom AnyNodeCounter.java MultipleNodeCounter.java NodeCounter.java SingleNodeCounter.java Implement Errata E24 for XSLTC, when the value attribute of xsl:number is NaN, infinite or less than 0.5. More details please refer to bug report XALANJ-1979. Patch is reviewed by Morris Kwan (mkwan@ca.ibm.com) zongaro@apache.org 2005/02/09 xml-xalan/java/src/org/apache/xpath/compiler XPathParser.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java Fix for Jira bug report XALANJ-1478.
    In the recursive descent parsing of an ill-formed XPath expression like "2+", when the parser reaches the end of the expression while still looking for an operand it ultimately ends up trying to see whether what remains can be parsed as a location path. However, the LocationPath method was silently parsing the end of an expression as a location path! Added an error for that situation.
    Reviewed by Brian Minchau (minchau@ca.ibm.com)
    zongaro@apache.org 2005/02/09 xml-xalan/java/samples/trax ExampleContentHandler.java Fix for Jira bug report XALANJ-2054.
    The sample ContentHandler code was printing the namespaceURI argument of startElement and of endElement twice, but never printed the localName argument. Fixed that typo.
    Reviewed by Brian Minchau (minchau@ca.ibm.com)
    ytalwar@apache.org 2005/02/09 xml-xalan/java/src/org/apache/xalan/xsltc/compiler ApplyImports.java Mode.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ClassGenerator.java Fix for XALANJ-1417.
    minchau@apache.org 2005/02/11 xml-xalan/java/src/org/apache/xml/serializer AttributesImplSerializer.java EmptySerializer.java ExtendedContentHandler.java NamespaceMappings.java SerializerBase.java ToStream.java ToTextSAXHandler.java ToTextStream.java ToUnknownStream.java ToXMLSAXHandler.java ToXMLStream.java xml-xalan/java/src/org/apache/xalan/serialize SerializerUtils.java xml-xalan/java/src/org/apache/xalan/templates ElemAttribute.java ElemLiteralResult.java Fix for XALANJ-1886. Multiple problems fixed related to collecting xsl:attributes with over-ridden values and prefix/URI maps. With this fix, internally the serializer correctly identifies attributes by their expanded QName, which includes the URI rather than the prefix. minchau@apache.org 2005/02/11 xml-xalan/java/src/org/apache/xalan/transformer TransformerIdentityImpl.java xml-xalan/java/src/org/apache/xml/serializer TreeWalker.java Fix for XALANJ-1985, reviewed by Henry Zongaro. The problem was that a serialized DOM failed to declare a prefix/URI mapping. minchau@apache.org 2005/02/11 xml-xalan/java/src/org/apache/xalan/processor ProcessorLRE.java Fix for XALANJ-2037. The trace information doesn't have the right location information in this case. ytalwar@apache.org 2005/02/17 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Mode.java TestSeq.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util MethodGenerator.java Fix for XALANJ-2058. In the code, the problem is that a pattern gets compiled once, and then this compiled pattern gets re-used whenever the pattern is needed in any method.
    The fix is that pattern should get compiled once per method. So, pattern get reused only within a given method. for any new method, a pattern is recompiled.
    This fix has been reviewed by Henry Zongaro. Henry had also provided suggestions about the fix to resolve this issue. Thanks Henry for his valuable input.
    minchau@apache.org 2005/02/18 xml-xalan/java/src/org/apache/xml/serializer EmptySerializer.java ExtendedContentHandler.java SerializerBase.java Committing serializer.patch5.txt in JIRA issue XALANJ-1886, that puts back an old attAttribute() method that takes 5 String arguments. There is a new one that takes these 5 String arguments and a boolean to indicate if it is from an xsl:attribute or not. I'm just restoring the old method.
    Patch reviewed by Henry Zongaro.
    minchau@apache.org 2005/02/21 xml-xalan/java/src/org/apache/xml/serializer EmptySerializer.java SerializationHandler.java SerializerBase.java ToStream.java Fix for XALANJ-2033 and XALANJ-2051 so that the serializer will serialize DTD tags if desired. The patch was reviewed by Ilene Seeleman. ytalwar@apache.org 2005/02/22 xml-xalan/java/src/org/apache/xml/utils URI.java The fix is for XALANJ-2059.
    The problem is that when href attribute has aboslute uri with jar scheme and base uri is not null, then base uri is pre-appended to uri specified in href attribute. The newer patch is according to RFC 2396.
    The newer patch ignores base uri and directly make use of uri specifed href attribute, provided following conditions are met.
    a)If uri specified in href attribute starts with / after the scheme and : For example, href="file:/myDIR/myXSLFile.xsl.
    b)If scheme specified for uri href attribute is not same as scheme for base uri. c)If base uri is not hierarchical
    Henry Zongaro has helped creating this patch.
    ytalwar@apache.org 2005/03/02 xml-xalan/java/src/org/apache/xml/serializer SerializerConstants.java ToStream.java ToXMLStream.java xml-xalan/java/src/org/apache/xml/serializer/utils MsgKey.java SerializerMessages.java This patch fix XALANJ-2070.
    This patch add XML 1.1 support in term of following:
    - Output Document can be of Version XML 1.1
    - Control Characters in Range C0 and C1 are output as NCR.
    - Namespaces in XML 1.1 can be IRIs.
    - NCNames and QNames can conform to XML 1.1 specifications.
    - NEL and LSEP characters are treated as new end of line character as per XML 1.1 specifications.
    Thanks to Brian Minchau for reviewing the patch. Brian Minchau and Henry Zongaro has also helped how XML 1.1 support should be done.
    jycli@apache.org 2005/03/03 xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java xml-xalan/java/src/org/apache/xalan/templates ElemExtensionCall.java ElemLiteralResult.java Added implementation for getAttribute, getAttributeNS and getAttributes for LRE. A fix for bug report XALANJ-1526 mcnamara@apache.org 2005/03/03 xml-xalan/java/xdocs/sources/design design2_0_0.xml Patch for XALANJ-1990. Fixes broken link to apidocs for Serializer.html. mcnamara@apache.org 2005/03/03 xml-xalan/java/xdocs/sources/xalan usagepatterns.xml Patch for XALANJ-2026. Fixes typo in Debugger interface code example. mcnamara@apache.org 2005/03/03 xml-xalan/java/xdocs/sources/xalan readme.xml resources.xml xsltc_usage.xml xml-xalan/java/xdocs/sources/xsltc README.xslt README.xsltc Patch for XALANJ-1937. Change references in the docs from bugzilla to Apache Jira for reporting new issues and checking the status of existing issues. minchau@apache.org 2005/03/07 xml-xalan/java/src/org/apache/xml/serializer SerializerFactory.java xml-xalan/java/src/org/apache/xml/serializer/utils MsgKey.java SerializerMessages.java Fix for XALANJ-2074, committing patch2 in that issue, which removes two untranslated messages in SerializerFactory, and uses a new common message in SerializerMessages. jycli@apache.org 2005/03/10 xml-xalan/java/src/org/apache/xml/serializer CharInfo.java Marked the code to be privileged, which allows users to load customized entity files in sandbox. Fixed bug report XALANJ-2068. Patch was reviewed by Brian Minchau (minchau@ca.ibm.com) ytalwar@apache.org 2005/03/10 xml-xalan/java/src/org/apache/xml/serializer ToStream.java This patch fixes XALANJ-1431. The patch has been reviewed by Brian. The problem is that that when an empty attribute value is encountered, a text node is being created with empty string.
    Henry Zongaro has helped finding the XSLT 1.0 specs. that suggest a text node with empty string should not be created. URL http://www.w3.org/TR/xslt#value-of has the following information: "The xsl:value-of element is instantiated to create a text node in the result tree. The required select attribute is an expression; this expression is evaluated and the resulting object is converted to a string as if by a call to the string function. The string specifies the string-value of the created text node. If the string is empty, no text node will be created. The created text node will be merged with any adjacent text nodes."
    zongaro@apache.org 2005/03/14 xml-xalan/java/xdocs/sources/xalan builds.xml Patch for Jira bug report XALANJ-2079. Updated links to nightly Gump build. Reviewed by Brian Minchau. ytalwar@apache.org 2005/03/16 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Text.java This is a fix for XALANJ-2081. In class org.apache.xalan.xsltc.compiler.Text, a check was being done to find out if a given text string is all whitespaces. In case, a given text string is all whitespace, a call to serializer is not made. The code was using trim() method from java.lang.String. trim() method trimmed characters as whitespaces that are not considered as whitespace in XML. The code logic is changed to check if a given string is all whitespace accoding to XML specifications. I would like to thank Michael Glavassevich and Brian Minchau for their input to resolve this issue. ytalwar@apache.org 2005/03/23 xml-xalan/java/src/org/apache/xalan/processor XSLTAttributeDef.java xml-xalan/java/src/org/apache/xalan/templates ElemAttribute.java ElemElement.java ElemPI.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler ApplyTemplates.java AttributeSet.java CallTemplate.java DecimalFormatting.java Key.java Output.java ProcessingInstruction.java Template.java VariableBase.java WithParam.java xpath.lex XslAttribute.java XslElement.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util Util.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java xml-xalan/java/src/org/apache/xml/serializer WriterToUTF8Buffered.java xml-xalan/java/src/org/apache/xml/utils QName.java XML11Char.java This is resolve UTF-8 Charcater support and QName character support for XML 1.1 support in XALANJ-2070. Henry Zongaro and Brian Minchau helped in fixing this part of the JIRA issue. A new class org.apache.xml.utils.XML11Char has been included to support XML 1.1 characters. Also a reference to org.apache.xml.utils.XMLChar has been replaced with a reference to org.apache.xml.utils.XML11Char in almost all the places in Xalan. org.apache.xml.serializer.WriterToUTF8Buffered has been update to support UTF-8 characters that can be represented in four bytes. ytalwar@apache.org 2005/03/30 xml-xalan/java/src/org/apache/xpath/domapi package.html This resolves XALANJ-2085. Sarah McNamara has reviewed this change. ytalwar@apache.org 2005/04/01 xml-xalan/java/src/org/apache/xalan/templates ElemNumber.java This is a fix for XALANJ-2089. Christine Li has created this patch. Brian Minchau helped in creating this patch. Brian Minchau also reviewed this patch. org.apache.xalan.templates.ElemNumber.java has raised some performance issue as a static array to hold resources was removed earlier. However, the removal of static array is necessary to fix a potential bug multithread environment, where a given thread can request different locale than another thread. This patch resolves the performance glicth that was found in internal testing. minchau@apache.org 2005/04/07 xml-xalan/java/src/org/apache/xml/serializer CharInfo.java Commiting patch for XALANJ-2095, that tabs in text nodes in XML documents are serialized to &#9; but should stay as a tab character. minchau@apache.org 2005/04/07 xml-xalan/java/xdocs/sources/xalan usagepatterns.xml Patch from XALANJ-1924 applied. The one deprecated API used is replace by the current one, but multiple typos in other examples are corrected. minchau@apache.org 2005/04/07 xml-xalan/java/src/org/apache/xml/serializer Encodings.java Committing patch for XALANJ-2077. This performance modification is estimated to shave 3% of the serialization stage of small documents. Every little bit counts. minchau@apache.org 2005/04/07 xml-xalan/java/src/org/apache/xml/serializer Encodings.java Appling fix for XALANJ-2086, which pointed out that findCharToByteConverterMethod() always returned null. This bug was introduced some time ago during some security fixes. santiagopg@apache.org 2005/04/08 xml-xalan/java/src/org/apache/xalan/xsltc/trax Util.java Clear XML reader for the case in which them main stylesheet is passed using a DOMSource. This fixes the problem of trying to use a DOM2SAX reader for included/imported stylesheets that are resolved by user-defined URI resovers. minchau@apache.org 2005/04/25 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java Fix for XALANJ-2109 applied (we won't \n to \r\n in an HTML attribute value on Windows OS anymore, it will be left as is during serialization). minchau@apache.org 2005/04/26 xml-xalan/java/src/org/apache/xml/utils XMLReaderManager.java Applying patch in XALANJ-2105. mkwan@apache.org 2005/05/17 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xalan/processor TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xalan/templates ElemLiteralResult.java xml-xalan/java/src/org/apache/xalan/transformer TransformerImpl.java xml-xalan/java/src/org/apache/xalan/xsltc/trax SmartTransformerFactoryImpl.java TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xml/dtm/ref DTMNodeProxy.java xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm DOM2DTMdefaultNamespaceDeclarationNode.java xml-xalan/java/src/org/apache/xml/utils UnImplNode.java xml-xalan/java/src/org/apache/xpath/domapi XPathNamespaceImpl.java xml-xalan/java/src/org/apache/xpath/operations Variable.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java JAXP 1.3 integration. Integrate the Sun donated JAXP 1.3 implementation into the head branch. mkwan@apache.org 2005/05/17 xml-xalan/java/src/org/apache/xpath/jaxp JAXPExtensionsProvider.java JAXPPrefixResolver.java JAXPVariableStack.java XPathExpressionImpl.java XPathFactoryImpl.java XPathImpl.java JAXP 1.3 integration. Commit the XPath API implementation under org.apache.xpath.jaxp. mkwan@apache.org 2005/05/17 xml-xalan/java/bin xml-apis.jar New xml-apis.jar containing JAXP 1.3 APIs. jycli@apache.org 2005/05/17 xml-xalan/java/src/org/apache/xpath/compiler Compiler.java FuncLoader.java FunctionTable.java Keywords.java ObjectFactory.java SecuritySupport.java SecuritySupport12.java XPathParser.java xml-xalan/java/src/org/apache/xpath/functions FuncExtFunctionAvailable.java xml-xalan/java/src/org/apache/xalan/processor StylesheetHandler.java Modified FunctionTable. Although it is not recommanded, but it is doable for users to add a customized function or overwrite the default implementation of a build-in function. Fixed bug report XALANJ-2116. Patch is reviewed by Henry Zongaro mkwan@apache.org 2005/05/19 xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerImpl.java Put in the missing Transformer.reset() implementation when doing the JAXP 1.3 integration. mkwan@apache.org 2005/05/20 xml-xalan/java/src/org/apache/xalan/transformer TransformerIdentityImpl.java TransformerImpl.java xml-xalan/java/src/org/apache/xml/utils DOMBuilder.java Support DOMResult.nextSibling in XalanJ Interpretive. If nextSibling is not null, then result nodes are inserted before it. mkwan@apache.org 2005/05/20 xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output TransletOutputHandlerFactory.java xml-xalan/java/src/org/apache/xalan/xsltc/trax SAX2DOM.java TransformerImpl.java Support DOMResult.nextSibling in XSLTC. The nextSibling information is passed from TransformerImpl to TransletOutputHandlerFactory, then to SAX2DOM. If nextSibling is not null, SAX2DOM inserts the result nodes before it. Otherwise the result nodes are appended as the last children of the parent. mkwan@apache.org 2005/05/20 xml-xalan/java/samples/XPathAPI ApplyXPathJAXP.java foo.xml XPathResolver.java Add two samples to demonstrate how to use the XPath API in JAXP 1.3.
    1. ApplyXPathJAXP. Basic sample like ApplyXPath, but use JAXP 1.3 XPath API instead
    2. XPathResolver. Demonstrate how to use NamespaceContext, XPathFunctionResolver and XPathVariableResolver.
    mkwan@apache.org 2005/05/30 xml-xalan/java/src/org/apache/xalan/extensions ExtensionHandlerJavaClass.java ExtensionHandlerJavaPackage.java ExtensionNamespaceContext.java XPathFunctionImpl.java XPathFunctionResolverImpl.java Patch for XALANJ-2126. This is a sample implementation of XPathFunctionResolver, with support for Java and EXSLT extension functions. mkwan@apache.org 2005/05/30 xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java New messages for XALANJ-2126. Messages for the sample XPathFunctionResolver implementation. mkwan@apache.org 2005/05/30 xml-xalan/java/samples/XPathAPI ExtensionFunctionResolver.java For XALANJ-2126. New sample to demonstrate how to use the sample XPathFunctionResolver to evaluate XPath expression containing Java and EXSLT extension functions. minchau@apache.org 2005/05/31 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java Committing patch for issue XALANJ-2121, which is that some empty attributes of some HTML elements are note serialized as empty. minchau@apache.org 2005/05/31 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java Putting static iniitialization of HTML element/attribute information in a static method, which is invoked from a static { ...} block. No real difference, but slowly inching this code towards adding a ToXHTMLStream class that extends ToXMLStream, but uses methods in ToHTMLStream. mkwan@apache.org 2005/05/31 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xalan/processor TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ErrorMessages.java ErrorMsg.java xml-xalan/java/src/org/apache/xalan/xsltc/trax SmartTransformerFactoryImpl.java TransformerFactoryImpl.java Patch for XALANJ-2123. Move hard-coded messages for JAXP 1.3 into resource bundles. minchau@apache.org 2005/05/31 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java Added "nowrap" as an empty attribute for elements <div> <src> and <tr> as these are either Netscape or Internet-Explorer extensions. This is patch3 from XALANJ-2121. minchau@apache.org 2005/06/01 xml-xalan/java/src/org/apache/xml/serializer OutputPropertiesFactory.java ToStream.java Applying patcth for JIRA XALANJ-2093. Adding a xalan:line-separator extension output attribute. mkwan@apache.org 2005/06/03 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xalan/processor TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xalan/transformer TransformerIdentityImpl.java TransformerImpl.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler Parser.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ErrorMsg.java xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xml/utils DefaultErrorHandler.java Patch for XALANJ-2134. Change the error handling behavior to be conformant with the requirement from JAXP 1.3 that the default ErrorListener will report all warnings and errors to System.err and does not throw any Exceptions. mkwan@apache.org 2005/06/07 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xalan/processor ProcessorInclude.java ProcessorLRE.java ProcessorStylesheetElement.java TransformerFactoryImpl.java xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java xml-xalan/java/src/org/apache/xalan/templates ElemExtensionCall.java StylesheetRoot.java xml-xalan/java/src/org/apache/xalan/transformer TransformerIdentityImpl.java TransformerImpl.java TrAXFilter.java xml-xalan/java/src/org/apache/xalan/xslt Process.java xml-xalan/java/src/org/apache/xml/utils DOMHelper.java xml-xalan/java/src/org/apache/xpath XPathContext.java xml-xalan/java/src/org/apache/xpath/functions FuncExtFunction.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java Patch for XALANJ-2136.
    Support the secure processing feature in Xalan interpretive. When this feature is set to true, the following XML processing limits are applied:
    1. extension functions and extension elements are disabled.
    2. parsers created by the XSLT processor also have the secure processing feature set to true.
    A new option -secure is added to the Process command line to enable the secure processing feature.
    mkwan@apache.org 2005/06/08 xml-xalan/java/src/org/apache/xalan/xsltc/compiler FunctionCall.java Parser.java TransletOutput.java XSLTC.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java ErrorMessages.java xml-xalan/java/src/org/apache/xalan/xsltc/trax TemplatesHandlerImpl.java TemplatesImpl.java TransformerFactoryImpl.java TransformerImpl.java TrAXFilter.java Util.java Patch for XALANJ-2136. Implement the secure processing feature for XSLTC. Extension functions and extension elements are disabled when this feature is set to true. zongaro@apache.org 2005/06/08 xml-xalan/java/src/org/apache/xalan/xsltc/dom KeyIndex.java Fix for XALANJ-1938.
    A KeyIndex object contains a Hashtable mappings from key values to the IntegerArray objects that contain the set of nodes selected by those key values. For a reference to the key function, the lookupKey method finds the nodes selected by a particular key value, and the merge method merges all the nodes selected if more than one key value is specified for the one refernce to the key function.
    The problem was that the lookupKey and merge methods operated on the "live" versions of the IntegerArrays stored in the mapping Hashtable, so that one reference to the key function might affect the result of subsequent references to the key function. Changed those methods to make clones of the selected IntegerArray objects, which can be safely modified without affecting the original IntegerArrays.
    This patch was reviewed by Joanne Tong (joannet@ca.ibm.com).
    mkwan@apache.org 2005/06/10 xml-xalan/java/bin xercesImpl.jar The new xercesImpl.jar supports the secure processing feature. mkwan@apache.org 2005/06/14 xml-xalan/java/bin xml-apis.jar Update with the latest xml-apis.jar built from xml-commons. mkwan@apache.org 2005/06/15 xml-xalan/java/xdocs/sources entities.ent xalan-jlocal.xml xalan-jsite.xml xml-xalan/java/xdocs/sources/xalan features.xml samples.xml xpath_apis.xml Patch for XALANJ-2124. Update the online documentation to include descriptions on the new JAXP 1.3 features:
    1. Add a new "XPath API" page to provide a complete guide on how to use the XPath API in JAXP 1.3. Details on basic usage patterns, factory plugin mechanism, how to use NamespaceContext, XPathVariableResolver and XPathFunctionResolver.
    2. Document the secure processing feature in the features page.
    3. Describe three new XPath API related samples in the samples page.
    zongaro@apache.org 2005/06/15 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Step.java Patch for bug XALANJ-2097 from Nick Van den Bleeken. (Nick.VandenBleeken@pandora.be), reviewed by Henry Zongaro.
    The code generated for a path expression of the form $var/self::node() was incorrect. It looked like the following, where "i" refers to the context node.

    new StepIterator(dtmaxisiterator1.cloneIterator(), new SingletonIterator(i));

    That's incorrect, because the SingletonIterator will only return the node used upon its instantiation, rather than the node provided from the parent step expression by the StepIterator.
    The SingletonIterator should only be used if the self::node() is not a step in a path expression. In the case of a path expression, dom.getAxisIterator should be used to create the axis iterator instead.
    mkwan@apache.org 2005/06/21 xml-xalan/java/src/META-INF/services javax.xml.xpath.XPathFactory Service provider file for javax.xml.xpath.XPathFactory mkwan@apache.org 2005/06/21 xml-xalan/java/samples/XPathAPI ExtensionTest.java numlist.xml xml and extension java source for the ExtensionFunctionResolver sample. mkwan@apache.org 2005/06/21 xml-xalan/java/src MANIFEST.MF manifest.xalan-interpretive manifest.xsltc Update manifest files for jaxp version and remove entry for org.w3c.dom.xpath. mkwan@apache.org 2005/06/22 xml-xalan/java build.xml xml-xalan/java/bin xml-apis.jar xml-xalan/java/src xml-commons-external-1.2.01-src.tar.gz xml-commons-external-1.3.01-src.tar.gz Update the source and binary of xml-apis.jar. mkwan@apache.org 2005/06/22 xml-xalan/java/src/org/apache/xml/dtm/ref DTMNodeProxy.java Java docs cleanup. Remove the word "Experimental" for DOM Level 3 spec and update the URI link. Also remove the obsolete methods that are replaced by new ones. mkwan@apache.org 2005/06/22 xml-xalan/java/src/org/apache/xalan Version.java xml-xalan/java/src/org/apache/xalan/processor StylesheetHandler.java xml-xalan/java/src/org/apache/xml/utils UnImplNode.java Cleanup javadocs on DOM Level 3 spec. Update the uri and remove obsolete methods. The getVersion() method in org.w3c.dom.Node is replaced by getXmlVersion(). mkwan@apache.org 2005/06/23 xml-xalan/java/bin xercesImpl.jar The latest xercesImpl.jar from cvs. mkwan@apache.org 2005/06/24 xml-xalan/java build.xml Add xml-apis.jar to boot classpath to fix a build problem with JDK 1.4. mkwan@apache.org 2005/06/28 xml-xalan/java/src/org/apache/xalan/lib ExsltDatetime.java Patch for XALANJ-2076. Fix a bug in date:month-in-year. mkwan@apache.org 2005/06/29 xml-xalan/java/bin xercesImpl.jar New xercesImpl.jar from the official Xerces-J 2.7.0 release. jycli@apache.org 2005/06/29 xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java xml-xalan/java/src/org/apache/xml/res XMLErrorResources.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources.java Cleanup resource files. Remove unused constants and commented out message keys. Fix for bug XALANJ-2161 Patch is reviewed by Sarah McNamara (mcnamara@ca.ibm.com) zongaro@apache.org 2005/06/30 xml-xalan/java/src/org/apache/xalan/xsltc/compiler AbsoluteLocationPath.java FilteredAbsoluteLocationPath.java FilterExpr.java FilterParentPath.java FunctionCall.java KeyCall.java ParentLocationPath.java Sort.java Step.java StepPattern.java Patch for XALANJ-2146. Reviewed by Christine Li (jycli@ca.ibm.com).
    Section 4.3.4 of the JVM specification prohibits an uninitialized object from appearing on the stack or in a local variable when a backwards branch is executed. We need to guard against that in the generated code in XSLTC by storing arguments to constructors in temporary variables if there's any possibility that the code used to calculate such arguments might contain a backwards branch.
    zongaro@apache.org 2005/07/05 xml-xalan/java/src/org/apache/xalan/transformer TransformerIdentityImpl.java Patch for Jira issue XALANJ-1978. Reviewed by Christine Li (jycli@ca.ibm.com).
    Behaviour of StreamResult.getSystemId has changed if the Result object was created using a File. The URI returned begins with "file:/" where it used to begin with "file:///". TransformerIdentityImpl had a dependency on the old behaviour.
    jycli@apache.org 2005/07/08 xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ErrorMessages.java Added missing apostrophe for error messages. Fixed bug report XALANJ-2167. Patch is reviewed by Sarah McNamara (mcnamara@ca.ibm.com) zongaro@apache.org 2005/07/11 xml-xalan/java/src/org/apache/xalan/xsltc/runtime AbstractTranslet.java Fix for bug report XALANJ-2140.
    The AbstractTranslet._keyIndexes field is used to record the sets of keys for a particular transformation by name. This table was not cleared at the end of a transformation, so the keys from one transformation persisted to subsequent transformations. Fixed this by adding a try-finally block in the AbstractTranslet.transform method and setting _keyIndexes to null in the finally block.
    Reviewed by Brian Minchau (minchau@ca.ibm.com).
    minchau@apache.org 2005/07/13 xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java Minor change in the error message, fix was found by Brian Vargas, patch produced and reviewed by Brian Minchau. minchau@apache.org 2005/07/15 xml-xalan/java/src/org/apache/xml/serializer ToHTMLSAXHandler.java Applying patch2 from XALANJ-2023 Submitted by Ken Weiner, reviewed, approved, applied by Brian Minchau minchau@apache.org 2005/07/15 xml-xalan/java/src/org/apache/xml/serializer ToHTMLStream.java Changing "<!DOCTYPE HTML" to "<!DOCTYPE html" to be more xhtml friendly. Applying the patch in XALANJ-2103 that was created by Brian Minchau and reviewed/approved by Joanne Tong. minchau@apache.org 2005/07/15 xml-xalan/java/src/org/apache/xalan/xsltc/compiler Parser.java Fixing a NPE for when _locator is null in the XSLTC Parser. Applyin the patch in XALANJ-2154 from Brian Minchau, reiwed and approved by Santiago P.G. mcnamara@apache.org 2005/07/15 xml-xalan/java/src/org/apache/xalan/lib ExsltDatetime.java Patch for XALANJ-2099 provided by Morris Kwan and reviewed by me.
    According to the EXSLT doc the extension date:day-abbreviation() should output a three-letter English day abbreviation: one of 'Sun', 'Mon', 'Tue', 'Wed', 'Thu' or 'Fri'. (See http://exslt.org/date/functions/day-abbreviation/index.html)
    mcnamara@apache.org 2005/07/15 xml-xalan/java/src/org/apache/xalan/transformer TransformerImpl.java Patch for XALANJ-2143. Javadoc improvement for TransformerImpl.setOutputProperty(name,value). mcnamara@apache.org 2005/07/15 xml-xalan/java/xdocs/sources/xalan usagepatterns.xml Patch for XALANJ-2142 - correction for the xalan namespace URI. Patch provided by Brian Minchau and reviewed by Sarah McNamara. Patch for XALANJ-2144 - incorrect use of the word "concurrently" when referring to the XPath module. mcnamara@apache.org 2005/07/19 xml-xalan/java/licenses BCEL.LICENSE.txt LICENSE.DOM-documentation.html LICENSE.DOM-software.html LICENSE-SAX.html regexp.LICENSE.txt runtime.LICENSE.txt serializer.LICENSE.txt serializer.NOTICE.txt xalan.LICENSE.txt xalan.NOTICE.txt xercesImpl.LICENSE.txt xercesImpl.NOTICE.txt xml-apis.LICENSE.txt xml-apis.NOTICE.txt Creation of the xml-xalan/java/licenses directory which contains all licenses required for the Xalan Java (interpretive and compiled) runtime jars and its dependencies. Most of these files have been moved here from xml-xalan/java/bin. The serializer files are new for the Xalan Java 2.7 release (fixes XALANJ-1977). The xercesImpl.LICENSE.txt and xml-apis.LICENSE.txt now reflect ASL v2.0.
    This change was reviewed and approved in XALANJ-2170 by Christine Li.
    mcnamara@apache.org 2005/07/19 xml-xalan/java/lib xercesImpl.jar xercesImpl.README.txt xml-apis.jar xml-apis.README.txt BCEL.jar BCEL.README.txt regexp.jar regexp.README.txt runtime.jar runtime.README.txt Creation of the xml-xalan/java/lib directory which contains all runtime library dependencies (jars) required by Xalan Java (interpretive and compiled) runtime These files have been moved here from xml-xalan/java/bin.
    This change was reviewed and approved in XALANJ-2170 by Christine Li.
    mcnamara@apache.org 2005/07/19 xml-xalan/java/tools ant.jar ant.LICENSE.txt ant.README.txt antRun antRun.bat java_cup.jar java_cup.LICENSE.txt java_cup.README.txt JLex.jar JLex.LICENSE.txt JLex.README.txt stylebook-1.0-b3_xalan-2.jar stylebook-1.0-b3_xalan-2.LICENSE.txt stylebook-1.0-b3_xalan-2.README.txt xalan2jdoc.jar xalan2jtaglet.jar Creation of the xml-xalan/java/tools directory which contains all build time tools required by Xalan Java (interpretive and compiled) builds, including documentation builds. These tools are not required at runtime.
    These files have been moved here from xml-xalan/java/bin.
    This change was reviewed and approved in XALANJ-2170 by Christine Li.
    mcnamara@apache.org 2005/07/19 xml-xalan/java serializer.README.txt xalan.README.txt New readme files for the xalan.jar and serializer.jar. This change was reviewed and approved in XALANJ-2170 by Christine Li. mcnamara@apache.org 2005/07/19 xml-xalan/java build.bat build.sh build.xml Updates to the build scripts and Ant build.xml file to accomodate the restructuring of the tools and runtime libraries in xml-xalan/java/tools and xml-xalan/java/lib. Also changes to build.xml to reflect upcoming Xalan Java 2.7.0 (version number) changes.
    This change was reviewed and approved in XALANJ-2170 by Christine Li.
    mcnamara@apache.org 2005/07/19 xml-xalan/java/samples/AppletXMLtoHTML client.html README.html xml-xalan/java/samples/ApplyXPathDOM ApplyXPathDOM.java Doc changes for Xalan Java 2.7.0 release. This change was reviewed and approved in XALANJ-2170 by Christine Li. mcnamara@apache.org 2005/07/19 xml-xalan/java/src/org/apache/xalan/processor XSLProcessorVersion.java xml-xalan/java/src/org/apache/xalan/xslt EnvironmentCheck.java xml-xalan/java/src/org/apache/xpath/domapi XPathEvaluatorImpl.java XPathExpressionImpl.java XPathNSResolverImpl.java XPathResultImpl.java xml-xalan/java/src/org/apache/xml/serializer Version.src xml-xalan/java/xdocs/sources entities.src xalan-jlocal.xml xalan-jsite.xml xml-xalan/java/xdocs/sources/xalan commandline_xsltc.xml commandline.xml downloads.xml extensions.xml extensionslib.xml faq.xml features.xml getstarted.xml index.xml overview.xml public_apis.xml resources.xml samples.xml trax.xml usagepatterns.xml whatsnew.xml xpath_apis.xml xsltc_usage.xml xml-xalan/java/xdocs/sources/xsltc README.xslt README.xsltc Doc changes for Xalan Java 2.7.0 release. This change was reviewed and approved in XALANJ-2170 by Christine Li. mcnamara@apache.org 2005/07/19 xml-xalan/java/src/org/apache/xalan/processor XSLProcessorVersion.java xml-xalan/java/src/org/apache/xalan/xslt EnvironmentCheck.java xml-xalan/java/src/org/apache/xpath/domapi XPathEvaluatorImpl.java XPathExpressionImpl.java XPathNSResolverImpl.java XPathResultImpl.java xml-xalan/java/src/org/apache/xml/serializer Version.src xml-xalan/java/xdocs/sources entities.src xalan-jlocal.xml xalan-jsite.xml xml-xalan/java/xdocs/sources/xalan commandline_xsltc.xml commandline.xml downloads.xml extensions.xml extensionslib.xml faq.xml features.xml getstarted.xml index.xml overview.xml public_apis.xml resources.xml samples.xml trax.xml usagepatterns.xml whatsnew.xml xpath_apis.xml xsltc_usage.xml xml-xalan/java/xdocs/sources/xsltc README.xslt README.xsltc Doc changes for Xalan Java 2.7.0 release. This change was reviewed and approved in XALANJ-2170 by Christine Li. mcnamara@apache.org 2005/07/19 xml-xalan/java/src/org/apache/xalan/processor XSLProcessorVersion.src xml-xalan/java build.xml Doc changes for Xalan Java 2.7.0 release. This change was reviewed and approved in XALANJ-2170 by Christine Li. zongaro@apache.org 2005/07/21 xml-xalan/java/src/org/apache/xml/utils XMLString.java XMLStringDefault.java xml-xalan/java/src/org/apache/xpath/objects XString.java Patch for XALANJ-2176 reviewed by Christine Li (jycli@ca.ibm.com).
    Replaced characters in Javadoc comments that were encoded in ISO-8859-1 with HTML character entity references. This avoids any problems with editors, IDEs or versions of javac that make faulty assumptions about source encodings.
    johng@apache.org 2005/07/24 xml-xalan/java/src/org/apache/xalan/processor TransformerFactoryImpl.java PR: XALANJ-2113 Submitted by: John Gentilin Reviewed by: Henry Zongaro johng@apache.org 2005/07/25 xml-xalan/java/src/org/apache/xpath/objects XString.java xml-xalan/java/src/org/apache/xml/dtm/ref DTMDefaultBase.java PR: XALANJ-2114 Submitted by: John Gentilin Reviewed by: Henry Zongaro mcnamara@ca.ibm.com 2005/07/25 xml-xalan/java/src/org/apache/xpath/functions FuncSystemProperty.java Patch for XALANJ-936. Reviewed by Yash Talwar.
    libxalan2-java-2.7.1/NOTICE.txt0000644000175000017500000000722010721374040015021 0ustar mkochmkoch ========================================================================= == NOTICE file corresponding to section 4(d) of the Apache License, == == Version 2.0, in this case for the Apache Xalan Java distribution. == ========================================================================= Apache Xalan (Xalan XSLT processor) Copyright 1999-2006 The Apache Software Foundation Apache Xalan (Xalan serializer) Copyright 1999-2006 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). ========================================================================= Portions of this software was originally based on the following: - software copyright (c) 1999-2002, Lotus Development Corporation., http://www.lotus.com. - software copyright (c) 2001-2002, Sun Microsystems., http://www.sun.com. - software copyright (c) 2003, IBM Corporation., http://www.ibm.com. ========================================================================= The binary distribution package (ie. jars, samples and documentation) of this product includes software developed by the following: - The Apache Software Foundation - Xerces Java - see LICENSE.txt - JAXP 1.3 APIs - see LICENSE.txt - Bytecode Engineering Library - see LICENSE.txt - Regular Expression - see LICENSE.txt - Scott Hudson, Frank Flannery, C. Scott Ananian - CUP Parser Generator runtime (javacup\runtime) - see LICENSE.txt ========================================================================= The source distribution package (ie. all source and tools required to build Xalan Java) of this product includes software developed by the following: - The Apache Software Foundation - Xerces Java - see LICENSE.txt - JAXP 1.3 APIs - see LICENSE.txt - Bytecode Engineering Library - see LICENSE.txt - Regular Expression - see LICENSE.txt - Ant - see LICENSE.txt - Stylebook doc tool - see LICENSE.txt - Elliot Joel Berk and C. Scott Ananian - Lexical Analyzer Generator (JLex) - see LICENSE.txt ========================================================================= Apache Xerces Java Copyright 1999-2006 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Portions of Apache Xerces Java in xercesImpl.jar and xml-apis.jar were originally based on the following: - software copyright (c) 1999, IBM Corporation., http://www.ibm.com. - software copyright (c) 1999, Sun Microsystems., http://www.sun.com. - voluntary contributions made by Paul Eng on behalf of the Apache Software Foundation that were originally developed at iClick, Inc., software copyright (c) 1999. ========================================================================= Apache xml-commons xml-apis (redistribution of xml-apis.jar) Apache XML Commons Copyright 2001-2003,2006 The Apache Software Foundation. This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Portions of this software were originally based on the following: - software copyright (c) 1999, IBM Corporation., http://www.ibm.com. - software copyright (c) 1999, Sun Microsystems., http://www.sun.com. - software copyright (c) 2000 World Wide Web Consortium, http://www.w3.org libxalan2-java-2.7.1/build.xml0000644000175000017500000025740110737235566015150 0ustar mkochmkoch libxalan2-java-2.7.1/src/0000755000175000017500000000000010736146354014100 5ustar mkochmkochlibxalan2-java-2.7.1/src/MANIFEST.MF0000644000175000017500000000502010721374032015515 0ustar mkochmkochManifest-Version: 1.0 Created-By: @java.version@ (@java.vendor@) Main-Class: org.apache.xalan.xslt.Process Class-Path: xercesImpl.jar xml-apis.jar serializer.jar Name: org/apache/xalan/ Comment: Main Xalan engine implementing TrAX/JAXP Specification-Title: Java API for XML Processing Specification-Vendor: Sun Microsystems Inc. Specification-Version: 1.3 Implementation-Title: org.apache.xalan Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/ Name: org/apache/xpath/ Comment: XPath engine Implementation-Title: org.apache.xpath Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/ Name: org/apache/xml/ Comment: DTM implementation and utilities Implementation-Title: org.apache.xml Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/ Name: org/apache/xalan/xsltc/ Comment: Main XSLTC engine implementing TrAX/JAXP Specification-Title: Java API for XML Processing Specification-Vendor: Sun Microsystems Inc. Specification-Version: 1.3 Implementation-Title: org.apache.xalan.xsltc Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/ Name: java_cup/runtime/ Comment: Runtime component of JCup Specification-Title: Runtime component of JCup Specification-Vendor: Princeton University Specification-Version: 0.10k Implementation-Title: runtime Implementation-Version: @impl.version@ Implementation-Vendor: Princeton University Implementation-URL: http://www.cs.princeton.edu/~appel/modern/java/CUP/ Name: org/apache/bcel/ Comment: Byte Code Engineering Library Specification-Title: Byte Code Engineering Library Specification-Vendor: Markus Dahm Specification-Version: 5.0 rc1 Implementation-Title: org.apache.bcel Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://jakarta.apache.org/bcel Name: org/apache/regexp/ Comment: Java Regular Expression package Specification-Title: Java Regular Expression package Specification-Vendor: Apache Software Foundation Specification-Version: 1.2 Implementation-Title: org.apache.regexp Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://jakarta.apache.org/regexp libxalan2-java-2.7.1/src/trax/0000755000175000017500000000000010736146354015056 5ustar mkochmkochlibxalan2-java-2.7.1/src/trax/trax.properties0000644000175000017500000000241210721374031020136 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # $Revision$ $Date: 2006-11-02 11:56:13 -0500 (Thu, 02 Nov 2006) $ # # Note: This properties file is provided for illustrative purposes # only and is not part of the interface definition. # This properties file is located in the implementation JAR # and different implementations will specify different # implementation classes and output methods. # # The TRaX Stylesheet processor trax.processor.xslt=org.apache.xalan.processor.StylesheetProcessor libxalan2-java-2.7.1/src/META-INF/0000755000175000017500000000000010721374030015224 5ustar mkochmkochlibxalan2-java-2.7.1/src/META-INF/services/0000755000175000017500000000000010736146354017063 5ustar mkochmkochlibxalan2-java-2.7.1/src/META-INF/services/javax.xml.xpath.XPathFactory0000644000175000017500000000004610721374031024401 0ustar mkochmkochorg.apache.xpath.jaxp.XPathFactoryImpllibxalan2-java-2.7.1/src/META-INF/services/org.apache.xml.dtm.DTMManager0000644000175000017500000000005210721374033024301 0ustar mkochmkochorg.apache.xml.dtm.ref.DTMManagerDefault libxalan2-java-2.7.1/src/META-INF/services/org.apache.xalan.extensions.bsf.BSFManager0000644000175000017500000000003310721374030026752 0ustar mkochmkochorg.apache.bsf.BSFManager libxalan2-java-2.7.1/src/META-INF/services/javax.xml.transform.TransformerFactory0000644000175000017500000000006310721374033026547 0ustar mkochmkochorg.apache.xalan.processor.TransformerFactoryImpl libxalan2-java-2.7.1/src/manifest.xalan-interpretive0000644000175000017500000000203110721374030021431 0ustar mkochmkochManifest-Version: 1.0 Created-By: @java.version@ (@java.vendor@) Main-Class: org.apache.xalan.xslt.Process Class-Path: xercesImpl.jar xml-apis.jar serializer.jar Name: org/apache/xalan/ Comment: Main Xalan engine implementing TrAX/JAXP Specification-Title: Java API for XML Processing Specification-Vendor: Sun Microsystems Inc. Specification-Version: 1.3 Implementation-Title: org.apache.xalan Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/dist/ Name: org/apache/xml/ Comment: DTM implementation and utilities Implementation-Title: org.apache.xml Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/dist/ Name: org/apache/xpath/ Comment: XPath engine Implementation-Title: org.apache.xpath Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/dist/ libxalan2-java-2.7.1/src/xml-commons-external-1.3.02-src.tar.gz0000644000175000017500000114045710721374032022626 0ustar mkochmkoch}WGʞ#lD,a'fWp{3HFҰv.wcw!lN?btcCE+OͧO_ݢşqG[3rпCgV[4[k3(ahVVa[OV>>f Σ3ty4Qv9O3(f'h ꓇Oh{0 v'Ew?8E0tmmAQ?3`o[q6l뿵y݉h_ks/ttzEO<}Σgo506n:۶!7VOq_k>}|p/ֺw,[{Gm|ϬU86Ho<|?NǑs/{]x?]{ǞC<o<,0z{߿xp=hx"A=Y~Տ8e%`w?{!em+c$_k>c]yV ~>jo;,p[}`=e[͇=gq.n̺?i>iQ_O˛1̳:|k}濵Ѣto|_7b;=%gXm6V?,m $Fx$\vuҍY(4Oj'+F֛/T3q 4, I&N~,n|d(༟Dn,.:`^Iޏ9|;QYo6uDY~gw qQq2a_0Fǀo?HD)b~1JdxZ#%Y>JǹC:'~ E{xuj罣ۇݎ88;{G{hߩŗ# QS')#$膧4x4A 2Iӛ=OINlF]5m4W{MQ=Uo!/n4 6׾las€I "AVA s|]Jt&? F}Q>h`MPaԗ ^/oÇ"~h1%yaW(`Rc`` F.Aj .vWe &aO QbYG$rMm;1 ?5Gp&ts ;]% g^j<'ѸIEӎn%gT󘡬V ,b}׿w~EQ<+[?,!m,$įsS-@S}v\ÓV7%GםWwow_2'0 84+r [Tw^K 5"7xfn >%B"suNl3$'`0kIR3F#=)v%a5^ ;ՈҚdxývێNt]4&ìIο530QiLB~fg:{gAKi/G=9hOty5GWd=9h|ɾ$S}ï;qoѕ..-c7E E4:NQ#{\AMŘ$𘩶hx%$#/|؋F跧ͧ١ x6vhg"I-[Qw_ߌ=G\//Z ӆZZ T ynVf5iH%lwQ C7B<'oFޔ&v„fy[kKVU;!>i4Ab|*>M וp#= i֓wzVxxp︛ y_y [?#!VY]{itLjC#FH``6s cۖ}q>O۝-ӶO97=qFbM3 9ڋFuKwSVF`Hnov֓[{3լ?]]}azpj F(wICqO/h )`mZkoU.bZ$B1IX`f{J8M1$C FcX@&@~a|!ɓR0U CtDOl#YjrAVX6,{=x;3Bb^BR2'AXTU^GjօhKԇ㾲}W}pBWZ*@Ȃ!Y%pEۛ/0O~ao/y/B # fip/^D^ٔCSmi$4j-K#Hlp;)-OaR֥E"dj8Cm5V7-Ijx~(XptG؏+QۙЖ)d ;ͩ/~lm jPRZ6ưi!#>R1Y-tz9y O) (g-Zd>g93N綧~[UՠCmNn`\;qX8&|X h^P>gbo#wO|O5eV+JtzGqY>~d!-"png~lLB)٪{C?spIߓ>>?.:|g:ؿ/ J,`{]] /''!$,3\Wq4O9w|e g|pNЯv_b4ܐߴ@kO p5^/M=o/F9!nWB~2av;~4!wvy{+gEq}t[rz?I!*_E܇Ɯwv5l1Thd @a?nC0W||wR]#³  j.}ߦ$ɼgPhZ1qT8Ajo{<>Gu@ןگG-or#rO+Bn~V'87yy>$Z ^t5'; `g_͉(tOڂӑ o>?*닡JǜtvQP?*!T0(%N52a3c"ziJޞܑkn=y=se %N>ejXw&Qh YC#hq.yXسh]-'q{&a Ib/cX3K!J1=@;}NLGD|n6v>U|$fB'.$ |Cfk>kqDT = 􂉸Dg ~q>)VnTtNu~e ?[meo%b0{)`%0͒L6(y} h=ud?FF#V(R/{Jz(RkQa Pǹ^\!Q{*" 8Eq׫iͬyxcW|o|Ҽ |x+J%GEd2BLRtMhhͮcչX#Yno Xl#4Yd-#7;QG$m^o{8t'{44.fYYpBd.Egᶇ'-D7_&I]wm/ dsoA^ᦳsA 3æ4LNyMG:h.kh=Dw!e [O7ͺ/gP:t/^uv2HVQǷ~+҃LЃsu\5?t}Nɩ"< ?݁t'SDcj?6@ ]Yc8*?<4sڴA?E"齨dTʖJgX]F#;6_F8I4eKcswϢa kF;Φ󴿥V.P=^@*pe~e:a*mU{=fyx{x'rfP{CM/ZF+\O2qjҧ=R(P!Bep)!G `ȘUG['^RHLB?~l7.+b$8Ө.J̊z[]ڢaڄVN:?Gnnw:H=lv^O "J,>?J~?7-Y&쓊R'8;N?7ö>TfdBA VC@&mգ7ˢvMY}D/o1ZIN.J 97 Nd3ÄE{ ZN̈́w>Tx̰.&bH6 A@% (6&GJJ,!e r7Qsɥ.Թ 5E_'Q1)YEӣڮdZLmKVuYQ6ۼj%ʓ/IYwB‘d=GBf> ,Սx>}3$|ٰd.rV.U:LNJ dtt) ߼T*kaUMu ,Bbr;:^xW&\HKfJ:oQ2)qn2YH@]:7V{wL䗱@u<@z;|?|39tDq692T*'VHkW)!qC.5U. /u;6*2.2!rb7J\!BkNu7%&AOSX`(&BF,; ؕWo4[SC{o|0,apYlCCKu}J0tH!88JÁaR@}>x \S1)&BB2Dp {@G2d?7w:xIrng͒߭$4{t3. D .h!$OT/\uv~48 ) V?d ؼVXL~D0mV shl~mAr#4u|>E qwSтΖnXO }}Kz315lǞtESqLC}FgLG2>MMg ,nbYra}4xCseZ'o(RNO :kM`_;50E)0LFbNcʳqT ާkAPQ;q_EkD!ilV<$ #ƨ6L>v+NTXJ+j!]x)CzT;XvL~˫Jgr/99XH|nҠmkGo|!ѽ%t7 MG#v|,dx g'oPteShJf51d|wGt6A9b`_Hi1}&&&S[ R<5x &'tUѾxvH"r?MSqv]S0<|lc~GivrI&WwcѦLX*+__ks#o BɶZ,tuu<,6R+?٣M,Mk--C$%h𑔪g$iOXJ1|*J|BCd#ŀ,$J$F"'BD޾92 ˧@2ͱ!8Et>[E.-CrH"k11u T9|ZsB|1|S9#%Z-1t'Ve=w,so/ޡK->G%en :Վr\W%Q/_J3"7P6w&cz[}6{!Lio2Ċ3l[F&Xt?X2UBvdzLuH3,9߸dr{g4Tn2j|7R_Pq;gvOw2qu8rh,J_b$f6?&>~p?Ƿ>Ȥrv.tUXt-fI$Y7M<7 Y=qaJ퉟Ɩ<6]T8Pd_ħA!yPH>m!0a3nȓ@I0$vbo\( $<%Du[5EW^7 ;Ћ ^ߴk*˝m\# T9XoQi^뒽e V.wDt={Vn,nӖe^Q-C+i(> q1g_+~rɪm:K@!YrYi]1IcToI1gSznK8tj!Ɣ(L+R :gہ ry z^ @VaQ|bdv Z>ݗg{YAuׂ$mT^eS1890x(_$ⷔC!d!c?x3IN9Ew<3킧 M9oHtl&|ÃB'氀snN]^o̹I$c-wI%hy"A.iϓ虵hӓ\=GL==gtNVpdTN6c'g$i,sZxFC]VuRK޿F t}_|gin?Hovz~5kM~NQot'ƝJ2qI7b`>n ^fIM$`"*P*U:ַBz=>g%:'"S%BF@c&7.`T*|SEgF?֍߈[}~9kٻa?2JJXjԏ.PNG20%&2IGK8wH[ @<Г*TvgS#(?pH>if&>sB) )ntsrzAͦ,TxO~g-~/>ZZZ>I/{PvdC7i:d塑X[_3=hR)"̐gI{`_%*?>ĵWjgh*S0#[1eMNfNAypEgʩne2T RX#Ÿp\f)+{kg'kZM9Ć2ΐn?|>J?P2>s˴4A\Qv U ] ׸̃W39'lugLmB Sy::/]XJM-ƙ0 ֩y K/^M*QPlM5-{omؾQa^:TXzn!hD59!LT 1xB -8f8\#HVӡGp-ǤfhW&ET'Iy=`Q=NǹfC"`ΒDfJ!fTI`Œᅄ(({gA¶>%%srcK3#\?q7NZ_478Qw ;N{d# f,A< ɺp-P *s$h7^eǼR0&zcq4d2djqYyN?KaGH>Ѝ;7?)YJ g$\&(DcDCkpSZ'ؒ5Y:#1Sj-6P7Kݲ4(Nǧg$4[H||}|=@섩2B,iՆ 7!Ό%T`?''8ӑ? P:+7I5&Bw3W)1x|z!1vE+ G``Ϳ@kӇl&S2SH; shӺ8HhRnA|Z-z`2%oNWfXRO l/^U?'S?'С:nv)Ť R~$[UPS(F{<\-Jt &/$ٳϕ,%(EMY Z^T^8v wU=Am(0 QMX;RHMnE(kRrr̯Gt ~kurC%J 傕D%ɥ379DB^RNWXhXQ36v_zh~yx*իlF~"\g5,3*<[ܪF-M~,*тÆHW2Z Nyzof֌So3Ձ3g 0Y=OѶKtAώξ>+ZV(6VZMϴ&*ڦ݂Vs<1ct`$@\L.!LE_Y~NŇ,-ۖZg:W+)YFGnNKДFSLb{c]kg|uZqJ̯d>fi]'x*L.4UCLA0jҤãҮ5E[,D sWMP<'b}XV˖S[?!"U%pkL10ߓ-~Ұ Gmh$Ŀ1 ̭ݵts[cpJ.e6yQ[ARQm z Q[NgҒo@eҘ?a2[EP@hQBn0;q1gOaA"o@v b"h7 <}¤w0 ^3$ur[[Bk,4B{ h j}C+6#I.L2_cy8ɾ[⹜RҐjW$B*T_  Ryp NլU7CMe 0/p >aiFOS<)*ҞdoS@=j5f:e͘ db;`Dz!j%a0Գl68s^(*9'^H@jR h. l32L1]E` ގ|ݠS9k8Gڳn0, J l qƋEGW5{,8#k:pS3PS|qF+suYűc Ǣ LCNbHh" {$ռuTɔZؽHjgƬf>/'s:mKh2FcJKb%[ROߒtUr\GD9҃I IO ZXK|秲9``#_jk<ߑ.S;bKF])%e1+F"ǹwFsn\oR߰`ވ.n:*Qb=y[w-rikg3Y kҴV#Om /O5ːʸHxQV;.o SZnNbX bZU4l(Omj,:IԒ֩ ՕRpDKK]֦gD }pS&\̀.GIך ֠wQs.SO29*tsj~r[JudOЖJG:DZg˱82ϧ_+8]@Ae)+(RZn3}8D2N,T_,3YVO@e*4=e3 M*-RFQ+%- tj o4uA3`USM?+Vej $W4؃ |؃+Ĺb.*߾`2؝1,:sgKPH kOTV -T'2Rf) .>8sL&J)8c82j'>KqՄ! WAª+hL~/+gV3za$V[^!q#ӈ ؐR+s +7r6*Vb}!2} ]13 [^2RJxHyjNnOJpUC9d2i^~•jHY nef!{ΰ-*Au+-}131E.,INzޠd -o4Ee+ûAx .;M@{\%hђe56i)\bP_tEV҈B!}^TӾyQj" Ul3/2 pk&4W-ʶ\K#05JɕGu]Vu%K6K~hG]8fptE_f*ݞ<=nz7l)L0nF"#^`R_V.*r]&a{. R}fPƄNOH4a+c4QC_ "{hW<dc^Yyj_Ā˘)YnA~#mFhV}um}IB0`2bNno:Omn{#3m@T.#7wO@jPF w2;{hگ-1\)6M7fRˠJXov>=2tPނҲ8mQp(瀙7rpg% ]F.T*N.<$EZjI`Q r=<)96$c o4 U.@Znp? 9Ѽ2W?.30F ې8_1uua Cl)V34bs>-&864"`7ྐ'OH*UE@o[%_^.* ĵ38/ۂ}cЪleq6s[`VflNff2L8 `V66M2xlQ]j*T,0 _eFehR(ĴR%ƕDWVؾԾ++ƾbD9 9EN($Ȼ)?l 2 P?{%L{psw-(ao5< Z@:.XJ(˖xLGǗ&8&(xH(znn(>gx]&85\C 2(땸ŠaBɩUU?Ü\ƺlc-I%Py<􆊝,[* e-hf#h`hтB֔];@IʱufO㻱WjqWBy1SټF^Wa6!mZ ؊\iӚeVtY I2;mGJńTC*OuLRROCikP Aվ]+JT*xW| u._rن\DLE İtd)_\NlXQ#˔ipd. /WF lSQ}zSU],J*=YeHH~ Zvɷ:/cy9\:1Qy1x+m325reʓv2eJc3H&,ǠdV22]ى`(EE'2KQj G )^Jf, )ʹ޸kغP9Ѩg21X=Q_}v}`GX eMi~UUT<]W`ggpy-RAKeR$әcY&˙+Υ{ \SE`( Lrn;yJT.hH7/\R=eOqU`Tgfʅ!=z}+ M> [eАtW-sVC{.Ջl(}:sf,kfl)83 ؊6 `RS1KG*I>GZڶѤ^H9`N+?a־&ZO7כkD& 6d۔Yfs+qO&N.k Cr'λ6GRu 0jP{ Xrمz9q4=<',J.1f}*&Љ>P26 W]B$QVdUJnЊqNfF"qT`%2+Åƙi!g$( DH1sڲeq8bܠԆ V|QGqOF0sH`_ZV ƴ:Ҿf~$dbJ9^0PDMH'EiY+f jnU_ g|7X$|I.",I-J{c詋ur e/L.j%}5(ux-)u@M~DEytco]xփZ͞dLJJBvȠuE}Lb܈Ok( 5bPíy/u|/[eKލJ a +9aP CRI?Ͳ XL(x{x6-IWהŵ=%Ui MRN1/M8(aOKqu``ߐӨ*˪6TX-5ޔ_^d)R^ŗ$^%w$\Q}/BAUaYd+f7FwC]tpY޷>S@ك=n[l7X:5zg[~zBC^nZkt6z2e]YrUUD9b~|xYdK zL. Ey)VQ!$ݨ%s{pQ >$o'pnr~ts?O0hTQq)uޏd? <]v~?&EI 4֦Q'ְX!Z w#+&[xXVpVoWѽ,:GE,ZT4WHdP@j| yB~Eu|}'/DצX}*ZՍ'S!ZkOE4oeS>cǻ8>O*_nA+Xם1ϣ.IO *LJ+3B݋zl&Oj)BE>"ӧr~-J*$cL$BF@c -ί5N)0_D?V@cDHSPc_w;+5"b 7'  67V7ןodb\|``~CMI-$QF$z{Vx*!eu@ۭ1cL&> v9ޯo$I@XYOOUTMvTsY߰鍉]sy}?y1T?$0հ[zM61z~ XB AxAt茇uX-Q>HIaJn|U_a" |m98QJY֩5H~k"tEe:9` 'S!|ۯ۝ί7x6PAOI?bk49EzrT+eڵ2A ҅Uş4via84,3y(1ϪDJŠx&K0N8]݁K`M5fJ&ZtNײaC(?$pfdZtSbtd9E=?'zci< -h;^zo׻H|,41sNbt2%$\(X`6]5T4JpryV|Ghb& H 0 (& "vA_PLL:W?0<]ڞ/Ď<Fm t 'lNw̍OFٱ ,:RlÓT:vG#ÔvZhZ̮)ȌU61c*ybZ,vLyԎY(WD}UF FI.6@,,hB<,+2 *m ۘ% zSV+CE d/y&TbCMʢb 7_25QB+o;S=uET D ZDbyIS-:O 0¤%-K9.bXG$\Su@bY\v^/nBgr^ܡ_,č~rܠsh2l@/ĕA,f Zb  & xpi]DFhK[k ^B/,!%C %햖h *T8?o+@DMv/,,[=xZ#"@k[2# 5ӄX6yF7o|;} h:-Za_2 _ ZMa K,ոeLPK6trGh./g!z1}Hడ71F%.weBZƪmxp,iĕUES$}GnŠ>Reg͛d_nٔ]7v= qd+3|!ʏ}b섉NR[ x,._E}WEi =jj_3TXBFx78DÐHM6FD18KǣnΤkfr&CL$gB#j0lⱚUk A:4M0-6҅FYNtP,ޙr1 1/Hi֋qa6+RXؔe=ݘ1e@*嶣˪p SMTZ\ `]cnNf(OUb'Px_~;l>gL>O,(.eS@7F$WSdےrV0\K87o EsSxJUI=\HG7%uAU]Q ͅT:r!i J"q"5R9;QrVDi"N6:I l@134,i[L-e0윍e+])`k-,ڶ5F;u\ 8L9 s- ?rX(2sQhC.4٭,S_D l =:~6HK$?>S L0WW~e yk$z@!+nXSJW2 P!vlN9Pß}{+B/Bb`W4"Z b/کۙ_呂]]8~]&n|MX8MF_Yk5Ik.p㐠ˎ&K `lͶl~5h{?q>e#Q'<|꜇*ۋO!f_ՋXECx?R1|G.?^oL!476ӍՖ'V}|J?xqO?Bnd8z-͵6[kXq{*,M[~k81nxU &HcOv,PE^Nk i4e]x.}zd~OmML)eW'Tظ l{/#qʷvht]WX=[*X'TKԞz7_69JNEKdt 2>@"8Ԕw]iQ SB]5K!A޶oT0{ZEx[rg~|TBZBXI\桴{>i,ep('K~pR'0AyIӱr\wL66=< Fh>8#Y#,82UzңLi'SMazOy={[ْE^D 5z>UnC@ғhNjFMvu+j]Mz9؁ z[/_'x_1&wu`Mpf~X y3$%c:Cy?[i[Na q{T PQv~&~V?`r_ڕh^ V%@&#ϴiv%{0| 4D)]r)v$&[{f 0FIyUu旈N/*8 @Ґ-PV[܋ ȏy0|%9f|dcvr:|Qb^_kMA#jhTA m/l@DmƢY(6 y~&fBhFg{ȼ"Ā*KB;!=d:f!t^|̢V0t1a-.H z'^<QtVc]<^b{CThթbVcjVZ˨+L*joίwv_\gނJ-WtcAIf)w%AT*;\[BMgY su 9Se6)d.) Y'Ys<*,"^F@GJ燴cbJj7LWL#o\2Hf* [+ST1?g1TA@j9m%VVa1kF5.Cj L n+”*n7>8 giz7tK#"14;w&qDI#.D4M z1b GZk/2^t5m8X:=X3 Y5|]'xk[ui}<"(VpK:3 }iH"2qϟJS_?fŚ[UH&ɁE%J8> N+ױ*%#w.N@c*xSEVh"6s1eLTFס]J fȚCz`)J!Ib LU6 8VF'JGr%ԗ4Z@nQ' _*!_ CP8]47+KD8C$G҇s~@+,lPDh%D*U*h&fA0.rLGR?sJ*U}dqΧ;VZƥ ncOg#m.zd09#cCcVD*ls pqAĬlRWTdRMPkVAs lB^zbD{_ܿǧQ=:c`-! \ڈ.g+/8!K6+Dc#@|ЏhGm|!&d0W'vD 9/#P[$?ERUqMA7lEl5V(yiUccyހv#|@Sgz$3aϭbaj%[%lj*ŅȮҔBG!}Z,ېo-Q=$-ן?N GLl3@2R^ܺ,eP/ ?@|,Yq}Au_4rYB5h%^][^mGöU2[e-m3n 56e29˵mzsPDxP i,>?'VoY&w g":w,@ЏaV! cd/j<_/B#Ĺ_uIMvV?m2  oEˍ?Z=ySߑon[~6BpqtC8TM퍙wd}VaLv7S2hI7Yu1<;.rCYJ0@tMfGVJ"{s!q@;b0UbDfM46a+K/r6!= 5CUU;8w"F:x O,@,@d~G]īIYTtw8KN:9QappVfS%s&1w\ Q2gi7Ҙa(ch0Æ%~8Ho! ҘKgGq,Lyvze@>zggCdՑ/795vitԅ> x,7tupYH1R$Nx]kIf"QkD"1RRCܖI)\##b/edFd++@V:i5(Lܠ/gOJ,z}RPb[Nh+[).ȢBk].,UNI6 8(MlnPR&M@xʹL6~¡nnYnW&h4⫄]dҝs6vfdNg.2J/I2M8swB{ɣ5~2>{>&! ݩH*s_\dsC&2*[Իf!A8ߠSTJwc]XD5R|8YNť>o.B(Ld͡1Z"('}Dgecx{%N$u8R6l4a뙔/fw+zyYPi U&^< /w,qSh*b#>wI4͠~7jWD 0)RlbD8>) tŤBJ~CN N7< ‡ ~*aD] -ӥ ktslu3  <9rؑM6ޏ&|R Y)`0Μ4?pYYdQ@i.)[X@FUͅ='U o28 ?NU sí.~Ƨt{^nXR 8GW.!id(hjFFWh,7+v>9hlH Z&',18*hA *WyeT1HOJE̽/Bn_ *9wLcH8L)$7KnL'cbfK,::3K/[yM⦂ۙ1|cƜow1/Ts٦V#y$pj=gnpmis὘AD^&Dn},7<#^pxsW3|i)[xdB(#Ipbm0{Q% Jgq!wOvUeI*0Bcn:m C>*յ:m,[5'EEdf&k3l"͖X@oH dM3Wm#TآCyjZԟrM̋ k.X!$!2"HuL?5c#.qB*J급=W)k5]u"xnZr e4Mxy{K~RȤ^ ΥdJs _VEĞJ SҒȤD^bb)%:dPwhӥtj\*%^v:׵Y׻^p}p9@Jouyd>l0ţ@$jN9lD3*oqɥm.f\[im6E~ ֞I7ɏ!岵䘻cfyO~LTKi]R9%ɎmEEe]HeO%ܒfu4kI@rL!5'ْApHM]U.R]/F,6~8Ipس5Weq4/$k!! hZMιOTB~,+$^jbB.LB DCY`VIF€Se&Px9x\?0#.zKLٿ"X{&pHEDŽ ?u3 R*є&I(lC >ቦ!^xxaY>4bB BC?2`,E5܇Vyb `U5`2]x,t%45{uWdumc?N+iPjLO\N_j$36쭘Iz[DŽer txFQ.Maꙁ.>:ńIa!p3$'AY^]9X$D^p6&?V,͘|qy(2_q2ԝc@}Pfv:dM80XWnZ+S )T _1 ( 4UusJ&GN̔Y-mai4EV,YbR Sej 0! F>vJB֗Fpj2Rħơ9h&L& ?T#GvLy%4ԭPNᖪɪuY׿|bng1ܛ~NWSgS\]t<&x|" 0U* $`uGU05p090Mt+Eu@cs>V Ȋ(J)Q }qĺ8()t;rBG2<<[4̫Vez Z[%^lv*NȼHKDi-4SuB&1t}t2 nm>9WfKv WXRߦR?kMςQZFPm GSG5UFq?Ș۔*E_Ru`=՝py:Biartuip asgk:n"mGbmoeQF ,@j:+Juс]r>k˃Imd|=. c5F8JE|y` kWDn $T'=SjbRIR ǴlrlC t\*ݡUOm.psY]L}+9;=lKe'S˿d_u,l2\4ߋ·r[l~n;t1FUc{d!tE]}|c{]U@b΍~s\Ɲp{$f۫L;ڝcT>/_#u-뽙?u(@^/}%nlQȐi=6<;MǵtH}i{Yi wNӂDQye } "h*雥w&0P&KEa?ЛNԥF#00pSv,9ײJ A 0YGB.کOeVfzVJk!=a*5VEspܨ}q+zAB ZTJ~YRw;:8# j4OݏY( xV+$$i?_5T "hAA kw9 ft L(y̗=^ף\Ǡ*ȪoS4RX80^Pu$0x>J?$xP2[ZM8` Btލ! \0"9><^ o$ZOJ6[WlUg1  Mu`|`KUd %IT2!(p_] G| ._~ۖ' nta ",U1(]vQ[ Fa]Ѩ3H&4eHXPd+wCqYnrsXrIKs`mmdb oMca2I͒`BWOvn|l4Ћ_nT\bdJT\H51 M]-shv_C;eȨ~z-Xs^mcvoo@ĽW )lhB#Dpw_ Ņ,ߤz@|V xc 8a#1x[QRqҫn/ bk*<%݇n_ex6>JZXY^βo|\]zyu >Z_]>nǟg<+}$'Jt~s|_a?bi)rg{W06`y}-?Xnc;<-p}--=Agz;7O_lE絭^ z `{xY!l&.Ԧ?*GxzMw} ;4GrLˉ}4"^^x BLl;@Y)F(?6~L,g0;D'/wtA(}F_Ib޽Dg0K++v@=mlY_ u$*y?25^q,Nxz i=b`;+(|/p%)1;'Ӹa1.PK+nf3hmeQ0̇i ^ OSv,H$`Un=%E(bhC\8 P>]12|i1À%T??+F3y6$ʧɇR]9:PT>ʧ(jUyϦh毾 T}&rU+˸I i'X*ިl}|t>k+vo5V<3K,'7%NY6 l\9'zƫ n"&S<«'vZfM/Inqt|ʼn βgR4|wF'pt٫ Lw)sߌR4h~^fo(L84@ 7= g"N^T (CrUԩq} /Fhg=w~x ysoos`g{?zOΫ]yo;zQR$俇BJ5BI{ P 0C,>J]OQ9Š`TN(u4IORwS6)Nж wlGLҖD]wJBr/$+|1f4Dtν$>hLԀumN6P862M F3)ΆȂFid',Ɨc HHk_ꆿވ3M~߂4 PGHe3mjXd K5-JRPX-oh}d$;QG(md||uTp'ꐫ&[|{[KܙKczl 4%^^YY_Jr@Gm7|iƤyq8}th"Pu7P뙤6(VN_l"e8BR A C%CdLOWMyxQ](_z0.dҍBUDZ?Gw Voy]䦻T[f^!Fo?|W8^m?Ŝ`źA+?e/^^m3;o^1!\缵FUbu GD}gn5+13GY+GFbVDaTZZ$P Fp}kqn8F9bA͙phX`@a~,$f~4C Xgv)ӴŐǭW>`?Nm4;xݾ!@ S`cVtEac;p$ҤRKiP=2Z^ 855[/Otf{Rґ-<X ]&i+U5JF.9Rke#^ZFPʛt^mұDiZ vP7ôܨB1`8K9 ;Y\z Tp# 3$]LteQ B/gmllH i.Q{^nm|GrćEM6M 6Q)]jF:>͛=NFU_U;;jT.芕d#8qŰ3<]^%z^ؼL)^%W*O}=bYNPٟ-m_wӲ^GzUa?uzߧDjT]Tqߔga6L*s = j?u8.-CUd HO<П7P=IWuf+꽕(ZY{v&Z{7i9}gzqAtMrniOrJ_T_yO.)QzUt'fJNDV]9(6ڎ%*6G1|Ul^wע7x̅lyT|%U"]eyr ?rHD#?XP\n/p $%d_RyK0nyGbF_ C栲M ׈tz:+%y?rL}uuՍ\tRt9"]~5pvFVKoRvs! 2ڦ `b҉~I7U6DPY۝1Yڞ F]W¾̫]Bkg^n\:`"@tIr2#EF#*Αb9G^ch3\Pz>[k]AJ@u|3M8r]˳ʔЭ@1b VK4u%囝gh}}} Z{Vٻ{MtfSoӠx4ESAG4Xם0k!I`_vtJXn=:?LWþaA$ dW8=ZGq(kK;+:-P uź 02i piwIAq81vtbȼh"g,ROAp(7pչ ǹt<_ Y!z6 O^gmnF.t(0^l%ʩp[ףM%SN {T($^` Qz'eP94 iRiG!~i2B2z5.Mf*_!k3a{m%k mqiET9#^̨4U $eEb6_A'tV88n'rS}_ >BGQ  #)>]a9ǏGFԻoֲᇦyDŎZ#)5< C9Gjcc uOq&?;e9͇Y v?彫_}nj8%6?Ƒ!cQ~gnк-=1/Ԧ#-a$t eV_Z2Egech8D2r^QM"-TBM軮bAit.q]FVa (i/wvudVsx\LrTY]U)̘7b=q~K@z(aD;HryCw_tzz~`̛ 2?]vJw,8㬤20'g7s&2ɍN1)y lncJ{1p,`!_lF2QaJ5ʑG!1<$,DbIQM>y{Ⴖp'&&Pk|ht-a,H׉32& ZJN_rt qq *\`V;JP7" BbZf>C LgE+\-[\|.kF6ܰpP[4}7=m ͬG4a8 ? )ϴ}I=8I"uZDtb=1gz 6%G;]Z 2 SoV2T;@VGRG8|e0v _>~LM* #[݉ԍ* CVcE<;QW^a< PDߒھʑ0oj\d9@]D]繁@$'ل4VyBʀ荗1zhzޖx0js 8*fc6j~ Lw15˽Xe&.x%MpQ`3?‰uic:4tBu58 jou-:zRai!e%E?fDhhv$^I(ʍr­V.gA˘q>P%=fl=U,]w!̰^x@PƝwo-M9Om! ]`ں6"Vz+._4O`e+,#TWxvOIZm┌nI97ױTM $}rb`eƽf>9-t$XAŹ_L8}L[_0LsZHGpWF }]MGT恓j?: lap}MtԽ_cj@iDtJ[C6hZGAUA,E@/~D[89j@1xӄL0Knel/SP#+\96t}@jf7m/ L]8L6 %W(u %=:U )P4lqy!EXrJ0!eJQ3* D2ZF,@Bw( BWH/hN(rU%p,0u%}|~ Uߥ jsBnБ4=`f\PR03g"6^-!`l*jX3gyUDʨD6.3+C1  :?;/w8t<滍SHL$&WU9'>Nρ]dkӌqYva_ƏkzKrJK}8vnJ^U~[;\.U(UAgr9?E+WkknyWXH)<fTo;KKHj&eHųW[akoي:Kk[g/?|Aܸq`BMץZGÝ\,$cn^W>i9I2 =W̨VӾ%eZ>\.tW{^B4L ~\e%s`Eb((֙dTf#'PU![u\m_!݆t!%-R1y>xu}ysߖl|簮(sK r|vo3yɨc8oC*#[{$4J{,+{ Om#IDMHHT4Ƴ)E0Iv ahA|p~isv :O?$8;;^,b."-V [v F~EۣѰvieyi5'/j/8}ä ES..tPGMcyhL zweu={޽&!Cq-Zvc۶?O)+m |Q9}a8s4jذ?Nj߾z`ܞ@za dROR_ %DV"mה@vLA.X^p\&~b1d*4QQvFnUtdݜh8Nd؟\ygw{t[~j*yھom g.ӄG4ň ?` H7{/ã6p0&qi8O(Hޱ#~ !1prT ܡXۊ941 Q{-OMWodCToN '35"02uaNq')gGM*bO@EaNɏA(+Vnc}@T^Sյ\gO|=v"$3(hXR&TSRV.qVxPZѐ.=?o` 1$9]'B Lds{uXv 1C byEk 2h5:r-M{8gPUﭮ{(Zy|&Z[[f9N`[kmy.;JH`7wtNЅ\XxdE6W%q]houW0|.:/),dFC֡)<#,or;m 8H_spXnT{^o͗xaSY~xm8P(y6ezNS$n5 >5/{FhӺ3IN曎 gZxJu{!X U[t;lg(KO&u{6 Dđ,Ll9t, 찆 hb=$)J 7Y #S&I u<3C|<+jMVQkQnCѝL0Sr?G @ĢEeMhYNKT+# {ڹGrkOF3UJ1Kr hT,2 ϬLO Q~K0GyK܁&&돛{*سk znFbC?NW#Ґp"ieͥB .+@4煙:ٴ5*_O⒲C+Ϭn&I{ȋ'DrB̈́4)cqr})uSw*82!0WyYTgYIUK`g̙{.\lal t@||Ba^+'[ Ÿg%`ǜzQnL "OƈCz"'2l+SJ]Pn.Zɯr@z7k GpLh)^F34nrmGm7g7|W]%Gjށ m=Z7rX2RDhX.}=xbcJ؁iUh*|3#$Z * l^nJk'L~k1ofpR#"7?LEtE 10,OJ+Xq|j]i 3˒%#Z `X?P2nq)Å2̍$;L괼 ,B{&DdhʋnLӻ%ՏIj:w+ACldR蚬n2P i.щLQf%/v~ Xܠxk>d$ѭU ˩a6y. -4ѺKOfos/B )!)L^lXצks?ELKLU*#Zw; Z͓|!9iEm PFy՚>Zi.#ZKߵKq&)5yfo-ޫ=\==e:ia(\d9#+&ҍ;{-b4-:x ZfBQ>b|=95KhaZЖuq1t)q4sX$ m3Gj؛U ӥmޥ1:kL5GaLÝq\aKp>^ X㎟L_Nq$XUIZ sa1]qVlV#2$e]Zt.{ k6ԶZۻ͐`66iHf2\9Lnqu}o0gt%)Ltb7f$s, WC{al.Buq!bsbdd'jhS\2njXZIkbhѱh tS% ,9:Y쑓6I&n2egj~eL ΌGH?'<&)t_GYJB8ZT)4SQT=SHC!bg` M(Ha8F*&pZKP$Ίhj/%§b_dd#"GDIc *vإ$k(4\GYGqF4EoxJp+8$oΘh%N#QH(Ƕ ޵@I "=wxyYEPB"M@H,8lбq$6|*bVs*§L=ߤWXi|vV8 L5_ 0qS-Zh'e -|Oz,sGf 6)[G?u;{')M^>Hu2Myp 'ItZX30#rű,M\RQR ĵ8"aHeU=S @L>Nw&OϕoՀkL9Gz _f}TIcT H¶SSG0P4),@ik *"iXL]5Em_3 ] U1rﯭ6m=o3ˡkאX=`| Ę|۝dqk^XHR/R&)RchC燒T:Mxw6B-5rg@Pѫ&INl㊩.Jg],P+>,ƒdiuU[d 9dJu7E\&s`<ڰl\D R$+- VẝMZeHN*6ْ#6IqD9zfؓ!B'<A5I1iP6Vgw6еL7sd:Oل.$997繗CNe 愫 18b-f7nԌ+_nw$[cOTk oj?$xamY h]t 5usk-ɫ n4) . ȅvְth{"XgJĄSa, h-FyX|Kwާe4Mb~y`W֜ cCǶS@OFҡmko( Y<eH$+㴘U~`⍠vڼVf5[׹#[TjI-z?iזWVQ~u{[][o!e]wQ<ɏ&Jq?4?z{IWr lF{I ~Xtz2L^x&'& inXK١]EoO Fq6 5ѣ?IHB^RpV(k#<΅ϦH?>@8&ιя?6X* /k\!G2nHltg;Et̾6 L RS*{*n).xSɤ@'6E; Л aFz8q\6 GX֟Fijex)8%'Fl6;Hl&gOO~uRp ߭2$^1)+-`J} Wn x_6T I` črMf'D0 jzTPŬ^nb{oAj u*U:\A7 :JgNx I~6l*C,)daBaJ62|DJ>B\/Bkd53| Ua_E! +b0~uE5~Ez+5ܨ_F}Tz67Tc2vnDĭL-~)uf&YLLEy@yL+-^uBlkѮ(eef9([NQщ"GI_)xȑKw6>GsU^΋–8MCW ,Tg3^ɡ;ѥհ~y9NZtAoІW<D#ה@ywP `g%s.m` ~R NGPh"Z,°W:S8;(m]G  @]_I*]qw¥]HU5Cp!j5siz}cOաvGIcNj qׇNUMhI;-FPO^a5`~#QibIp@4 . #"$>KfNz I: \8Ty-S)F ϤN: 25P)!p}h{fxxq.ɇ@@E *'- 3 >".ĜBUOҒ-oh~W bD0F @ W'\G90J"Y\wtbmȆal(uCt6zzu:u=8^DzT92i'{J7CƒJmA^X`ŵeYJ'hS( IP**~-pFf4;Q8>א }ɜLI2hnC n#+f(B3;`XDgHcds@ҝbL 5ۣ Wm[ h  )G]c zT~Hjmog V 68tNjMGmCpf4:|%R9uw18uE5-YP_؛R F`֦v).ZKYkgч,`"|fd<6}ՏqdGZb"n)Iw Z  t z(HUѶNPJ#"Z:wz6D"6j!D\҉/Zd@W wEeIT]~l[CsXL^ FKi },]%1tNƻC֢Xv} zJ0$F("|[}%ƀ$+f!~8陹]f!yPf4W ,mW1]h~vCdžL`0ݠR'_iנ\nÆ,O] cEd*0kzU9f7gK,E wp9x _@*gXXpSFUUF4J dQoY*NrATN䌀hzfCf-0Ns^GRUXtbQ%4āS^ҜJi)W#e?yLSRO[F pw9N H@.kI\dHߙV0RXoo쨵%{L1;HiO9w^vWw;JL$Sr`唡9SqM$-u8 aqD"1#vGNK3] !NAV»G?$w{?:?wۺl⏧c <sB뒁*v-<>+ϒH ?+co*‹K+ iI&~`L=wL^}kռ~KVK-|<woq޸w/?z$Ї?coaB#25lX |[zhCFupnŃL6=$=KpW~=GC nO*uz_^?f5(T" _P|;=yY GU\؋`F8UooT]"w$cfR M/c'8lkRqGOp> n.`mp52&LŞK،6EĻYtkvǯ2zMtZ[ILD4]$8aV1F(,+ڻw{lKAHH6ccop0`0_< uv&NZ2ݕb16|ƞmylq@$~K%.Ԁ3# :V p^{m?*设mZ׈8V.*0F\~b tq=ʹ~uh o@c(dq1LS6j Y1 )=ON@"oۖ>,_Ei(ģY'}J)Sn2|d]B!F~L 0cN : &eČ 5oYh!tT_U)@&\| e;0WA!5pkC9FDֵ}!­X U?\e`auiy|o)}U]Z~i>?Xߕ{&~,:2(n~qIx̌ܝװ,1TRi\Xc_C/(00 ݬKűz}_[ ?7q22)2OPӇ+Sqf;l}ǧt [+S4Ueq,<&}vq:}$jrBRX! ֍S-$.xȧx;L4m ˧S*lѶDWɟ5C 'hn%.T\ƿ=s. f* Xev!?3^Ppޣ2$k\y]@KR$ b킙)2{!aؑ/>RT4>H*G-x>TF e'¤۸q5L{[h䍲cqlR#s5Xgtg;+#YV>Oi$)tzAUFbvK y^꨽Ɏt0"U>4L*,ʦ(TJJdkӱ69gjOm,8 48cCayN$qXz,9Y^xIra73i EǍ6&oRdYLL@VTZ\mUwLa~Yꏭ?h r\B4rr+>~@> :d1J`A{g*^)nsi jfF~/4ZUQUcwZxÌ i5pn\"G*WZRʿ&E@RgE{;5f[YC5GRp/1dUG.aG Ayǖm6"bJ) AjU f8.^@?꫷;#o[}!*pOiuHKGn^au$'%R(bԭ[';;"NBl<09}!Iأ=<a; œjj^N Oπu\lN#3h4#~HsarJp8EX SqZҬ?"Iy i8}V,|hZ]#=LJ!6rzt-kl qխZБN):z%j(Zc <A z8[3y5ѝL ]*%(LD +Ee#YWy-K9~R3 .:π"^7%$3-kfpYw2~)zYaRow-jO5#xM ) \A︻^_9:n7 [q}2yoh()yzh`o)Wy![ȣ.KZX̵Sw["2Ɇ4pP'@@Wh@|]`B/*\iC}DzSSvstFх4[rt|w|M;mGdy^ #ne+m#p|mJiާ׊0/1ИZ籛jdZ!f.z `PW4aZ%n#/ @b`n\d&Gh_|oz_J۳F` x}FZGS&ohtJãW >9 x"/#!X]i=J6Y罊 泃g,>.o K+>Q^v;`#Q$M䓻3A8' KbE zd8ʨʼqWmQ,"o({! d rX@RSc#9DOzXeWjh:B;a^Ɛ wM̶i"L5+&k)ID8 &9B840eblxȡ&QC~Oax5M i.IjȑZ6r̺n;2z~`IUEͣ'I)Q~q^CGƹ&@Njɬ@Sf4II4Nb@]BvW !wtDcW|y5ޓ4)- =mRGEaV*NC4*ӛ(GNEntؐk2ğTh]:i0pâA ' ݚugEpVV*o/Z."s$Muu%60DK3ЫEUvЎĔIQRe6$/Ow$'zLG[((LNH'.r@Գ)oLJOYhmUU^A.T/cJ5yКM in9[OV]a@O]^4* ^&Y ,c~5tN9T7tfTSc + a> ,DU?<S"I H@H|;5S @cD3SRJ](4iЎa6Cƿ$>.3auY!nW0:tb,ԅ tAkG[hg:FE'@BHc |2H[PbZ0PCmOvT;'H "{ky A^sQ,~17f--zy dpN+nߕ{זos6ߧf9k{}7T/t6d4V(zccv.e+)혾M_M&S)}2TJ*=ٿ Jyyj~<Ģ/t JHV@2&QU={^o͗4?kR9ceT:k0OMm/IT޴?rt[ ɐYư;vLCzvS{9r^#)=sс埥39-&Yvvjw0`kTHq0}1цYha&ߋ|Lo ^&? bP n}Ztw&i|QvOI#  U03L'׺k<3ЉKY&¼Skh,OI/o3$Pâ ٠$=eƙQ3 +)"HD%*C=9D_zԺ50+-OK)ģƢuelYNKT+-˂DN#9@6Aާrv3^|cVIHH<2--(~?ߥn\H2}vs^3o:A Cb#;;T]mYM?.mK;@f_ `Wu>Fk/<)bE$szVhJb !c؎P:u-s 9PTyt =5>38J*{_:$ pv2{_mݓ)1%VI2 r=*'G [Ÿf%pGQ#Dʇ)3}^XavȮP٤0~@IA#Dy=+zXn4(hTGs8VEhNZkh[*Rb˘%(Jk{%PI;zFm6GsLՂdQMyeɑggpE~ڈ2'h 4`;YCB1j)x A1RO7AUmUo!/tM[^A,fɜk?%H^ohkܕuS*.j)iJq*jw3`ڹ8p#M텽-DkpG;$Qdk!0A 򴋞iC x> HmͮhOf.23:ZSn7'+WLݦ'WZKmV0HGyitz ݰܠʄbKPfi⩥Czrhg~F6惽(wP_*NA}[Cǒ9~:ёtwL R}b JF[&6+:ov̚;^\MXr45 7IFX,}m?D^ BnNeoam9x!b?Rqc` b^r,MrA-lqJ008C".+mٝ%YvFmfB3׋AANKC{FR!vh}aVҽK{ȗhzg+XZ.9s&|}ՋsH'WD^#q쓙6~}ibN^@O|o,ɸoFXRcQ`J2gxQJRiFǕ)|e޵R{Lfyꍫ`ltUB A7odt8w,P. xDcT"Jt'hjmѠ`XXNx'v#<[E7P~,T|VPkvfL44xvlBvMy-d% 1{c3dlN I [pXy,9iٌa_i qμ r_X "IUv5k Jօ(^BnƉd`v%ձ4r4lxKTT}4/մkijG9rRnFRXm4@sɅۓׂgD哭ȃC0(8nNMcB95C?AW񯝜:5-܌̓А]IxP ȢIrJ Ml+So h  >D'B E|cvqylw"Nf W+H 싉K&99P+~ڔCi}ɂ ﳾyaasb_LQ(uQt1nu% I|[G5D!~# Ԟ:8rc;PXPSR"V,W$hq+8RŇuP'M Zе&I6Ei=5_G#vS=ՖGU`*4:c z:fWYI &"QuM(C{\XS &E ,^C>YlOV?Q/a[oUY|w_,G F+i8Vt# ca.Qz4HۘX*mOܗ~la˘>F)0Zt,us$'T=zG{[&G?|ۛϞ?}Ļ2H[kqi rGg^sIxKR뮺^j}Qx_<̎HŹO0@a ztnKi$`~}eU^s} Q%G Gfy<-j@E/(YVo乵~w_>mBv?e: {a܅3|L 6xI3񻱙Qv MZ;[)70JW@\T"l}݊)_!tjW̠&efR3W7T;G5.hmr& kU '3j? ;oM6S A%K>gaFMM&gd:u'8A6aC@4~~arK1 g;%`_1K?vi΍B|5ڐ}S$f[D+5UZz#+S ƒDSa1{jw潓7я1tfC.jyr0ď+Z+-b :}HO 0?D_y! ݆5nRv@J&RՃyd}VM'$OYGi)IVJx槚n9HB=͢xXL6ÔXeNgMwC[RxS$rE) tܺDr}4gWdZW֌ KVӎpâ@OiA/N70`Z_PqQZ -hҶcP"{B"#~Mm Iv ܐ6V*\,$_M{*_r#5H z1O̞R l#o7e6@<vwyÑþvMpX!?]J%$C&@N\uqehQ3ӃB D T;d~l."Z/oɓd4/6@[] ˭˲<%I vU_WwF4mY˔,Efԋ L_}b7s{f[za٩+Nb R񈦳3QL*sh@IqnLוrRH!rz|U\O偀h"UUT+[@f@|p| GbpUii7Wj4+& F @ W'\90J"Y\?WLH'֖|lHƆR2p שAbt_j⅃[,̝oMg00X"9Ƥڏbp4jZg8 ޤ 0jX 76lNwђ_\s>&QY1E͖%<y)K>;FcGbKl^qKI2kDX g(Xu PWUh['\ZA XdlcA+b#"ڞHĵ!R1HV tPZ>0zYT[Drkb.+Lh)/_ֿӼ3ay}| E3EP9=M%#@l+uZ s,Y40TI 1]㮌~\O͆q\)LJh]Šw 2wJMϟ|]Js^j z&dQ_u #w\%pաaAz6* )aiW:a\E=s<~80(UO 3Q"KPdNK"D-qdww$;E,`ש ӑ# @T5$.YnahhL+K(^Ǹu[;;jmSiO9ž^ ;DG%zw)ypyU}tT@xzD] XdmO&iq.J\!,&sWQ^'Y䒝$05y< xS`[pۣЦt䓓O](PFx()P `/вu;\Y~\WZ T` ~_RoLYKOTPdtU HbMXV \c\+<&s,&qسiqF7^ߒc^*f{?_6m1 YO:`"Ih)Qbk?|BD/\Z;4=+kaxVy@~(b <(KMCsJbÉ&A}Y~a*؅׶0) V_ 1a$Q5ٖRgH,*L &AuMN#w> SvMI; I4|b`,ZXYr`;8Z,:SiR;gֲYHG9A%4q</$?sšwo>^͈Ŷ!8Y K !TpĥQ2VgIA44P.Y4y6B8[I)]7@23l U嬳]Û]W/w~E[uZz6i$# A!::g ]>B,Y.HWе駬(|WCk"~9a(PƌBdV 3ىeg1Z9'D59-BUS/F{_P1u݃@0Q';l֊ZI[#F_ɐl¤dm_Ke3fjIEFeϑ>ťa%bOaN3yi)Ve6 9nr\Sے(f!$yJVU| XLCUD}9YٜSc7M5x8r+ٖX*9#T:!\rof毤7햢3$OΫ-Gdz=_̩yz&[[,Сj q._uRD^?LxQg)~^9fEb=3׏x k6uwX2dt5D*U!4(2E Y "YJ{kQ|N^~UlQXIi{s!PS6Vu^3,JJ#<֬Y(&YSۮE2MIt`&0Js.=H.#Ц4QBچ$Ngk$5Ϟ.҄s,P;-UƳQ+N'MNsn.)HӀTIu\C虖dtՒu&Tai`Y]%~. 7 !ȩTrvk!ZNsYQmF6#bqLٸ(Ow}g l+jǞ >iiFrrxkf _ @14g -zr(diA] 7Hics.ոZؓONR͇Ѕm;ZoOʰS$8Ma١{*bbePPSA<.e}WnmM鳕g0Тt(@rPZ u!E>y8:12ʢ6p Cޘ]a7$$8@Y}gWcAPB Z-昀M;3@ /=VXz+}>0Oo+e׵|R_!Cv֝hk{g{kgk+gAj@2NJտyO ld"X!Bc^L4H(@o]HUR+jik2Y=wp -v)U ++"]7]צ98pzp;ry+Jr:lәnVL HzMC)W[TM>Hي&P{\aI `)]">˂4|[} ?Jcu8R3 U% qqU^dUz=T ,i;wț޶G+Bk~ T-2bOX[j2G}%{ǻc`jС>ÅӐ6ӡej[vHsKj`Zxo3&BCҞ0ב+AueMa;(*5pcNxo]{޽ݥ?'p_?qUIU&? m*Vk^}Bث!#@ 9d{b18ف) l89J-7;-#ߏf7ىw%<(ǟf޼+F;yyw7뻩_n~fy>F;W ܹZs-n W*WfRp 6p淚D3`:s?AX|&,%jR.N'xU+U dy+:$_!ybłډt)g K?%Ư4IHJݸ64l>`Bs+6M ;b&W"qNYKy.jFz yBf)ʨ-exCzG)?FW } ԣ 4bF<(S#(e%dd٧GF ݷddu$:pw]7]p#^슾O4{mGaՅ!?6 4%" DqdTV 2;mEeCFHe47s߹g_g/Ϯ ]@MW}-(kmNzeX,}$ y[%Q"wUK/A 2=7pm(2"9aZ&?$7D{24EBj3YCf ˕G8A`!9.,K֓zmcH؜zodX䪒"#\|aW7wV6`<7#C11tR+s 3HGc?fقv\M\1+M4Ngek,OQG=pN #7ZM$- $ClV+ρ$IrdER-דzɸzd՞Эq*'&vP o }Q0TtBV­ʝ ߢ ;;+`6~:)mtV;c{ۘeɼMWX1#s e91Xw_k`4jHXZȺ"BbSx̮Q7\w3ƥ6kDNJCzwWv< Ct4ʇL3*wzr}q˅X:0x/vE2UZ|xiltxV9MKFo*$agV d胪\5{!sOmGj";&s+2հ`bg24ݽ7DK֥)Ms,tWUj,i]?Er}4+od$4g3_&+4Jd H%"7Rp6W2hH)0iB5}t$R=5D1&q`7$̜Si({jDFUJl$Mc3^6KVX^E>J-+`+?x 0<vNq ޼{Q)Heq?~[|+qYмNmeї?@@`Yqt4FԋF eV:n?pfzsx~{)FȜL78WV83OMVpedPBDޏH̸fj R j*1qq<^ ȋ ݤW3s<\1|*~H)l'&2P;~;*׶qr6ExuKs; x;Wk8^?RJxo\:w+Y.v{*c=865(njwF ChY#WSJ#0vl@>yu1.7~bi ٨أs ה?+bF!t-MĐ% VQZUNc0ڠÐ"L  4fsZT=W{TH;QJNLAY{ PУhPkUg y#['Ԛt\,c[ܦc9d'R] OSXF%{,)I6SVZLG5]aﮊbT?R1eDNg#h4ʏc?; nQə`nB2}PijeږEgG .Yu4sQY(hQPu0A^kÕ`%YtmiS1s# "zI*f+ ԛ\EM`+}㣻d%'Z!x)&_[ EP[Ts%YnT(g+T-ˤ|:f_jq$?+2B,iWc+rǏhkFMpQ웍}%ӃQ.is,]nK⳺D@ˤŢz3rQ}M..(szm{w:Қ\x{gRURH!fMTDÇ+rS%t[(Ҿ:s{pA Mo5pZt@y)5[*d!#m4>!d@˜ZʇS:9=L(΁p٥HrWx2TƧ<9eU~Ӯoݿw޽sg{>H{K:>K$?hcc&V9Or(!fM0*y<˥eL<e\Nf̭-FiRyHe7g!ꖇ!.M&c+7n*IψA^0HaU.93˨yX g8Bgzf\].K.pbQH~=I|g'Vu/O_1mz8yS^̚@957fB !U !0VS>1 Dbzɸ"OkS ᘳpi2B>؃:c֎3 ysڸ'u6F&/ @:Сg*`GXYstJ!Heb.Y3C=[p!+aYml8$.jTlXvýdjHRJ)a%6O̶̵BMn)<3ذ3C1>+A__>VUGzॐ4H < ̵'> G{GS *SE#"kGK{Ob/E  ߘ;c ;uO&Gk80KoHN5l^M46x r+՘Q$̐\ 1AA#BVX/% xU U%2gW/-`o9#H06`d؅4U- Ca9MTRu^K!c??'Iv\ n$?E˪D ޫAWwx ،"L=WCnQȫƁNy퓐⇠!ZBmc6{h-Mk kHZH}M}_лS5ΰ~T_+">̡( tU@+>6Y7I0Ƣߧ'ZœS|Az "ig|hA|Zjx&g)YqHlpO\Q*Jl$:NyR((͢R/o$n l4CV4%DrX[׊fmc `3r#'NM* Q8QCn4mZ9zmnF_}ގ J9[3^}nT G2a>n:?FJ[BVg.џW5*d>4J8a[aGa6gp-X$ahH/%1WU)jhbfItݥ u U Mbds3,ʝRۮ<>'5ٽl$^:GO0kZk6YOd %u7ji;4LrL L4  'DT4b^)źxN$q*S^ɹO1$qtb8*K`KK`EU/<MTI~y#1<_7Ji+ɶCՊ驂n (&?gCMg )L>ZF43œӱbcam3鴁&@S[Otak•R69L۱C==ĐaVdAl[ S?sMSʯ < v9hV"bHd8h[BR4q yI'j^'yF*u(AN<lFdթȈȎ;f#ݢ/͋gk{/[/d(i`2 # _U%mիY2yt oO%*1>.iy۠DU]%-;$ZV"x@jzynzglBqs$ǴJ0)Cr`W=Xw.PF!.Eo{\aYFNydL?D)o4^~X>]Ap# s'ZKm|zl bІ6y 0/>!]P $ %C߻0'^d[, ޯ Jj\Gm1P@Y-W/(۝Del_Gۄ`nkj2Si[`.2(g%=M6X:hո:܁;7+JZCEgq ;yU Vg/d'(nip33墙6c!5 -tj$?IB vx @'PcXb*@T(m"D7BH0lܦ"4=R[_V |@ۋiھufXtZ"WdCɱ12Ԭ浽ҠUjDKtEε=8( 8uUh%S*]tMN# i62H?dHuHQdh ൌZζ@@zs`8"­;U{qvScmU3t ȸ-IFNze׾+OɸVϱ"g q`F Ps$V _b+/VG 4WM&pYka55γ{x/^TVj*P>J]a !ˉs{a/<+#O4t+WdQljriNA>tT2pqOι[L]\~1W؎%b^'MNb!ׂ|=?ť8bbU,k-[E1SgHh} cEz;@񟽅*+ռaS>lU|yF$4 iM%ݦrji7`ab7qqIYGѮ!\>>ӕdoXPNzU(G&!ÍgAë"wb̦ąjmXYQ2$E>yG>eA*1J_YndiUx7`I@Û"L#ńx@:;KuCMAh0軽yQEыgt?os ;2FdFemA#&Y E= P"+Ddyw< d]@3̀%.P÷k bDHTC `ށk Cν>}>Ӛr%xc Atk_ =2}_~"Y6wp9(+`6 ,,Ѥx7pR9 Ц6hԞJXirol&>x®&NB$e8jDܩ@\XÏB XsJ™|(@sAT ]|ꞲK4CBaYpȐElS|q%pW9 >ִbBX,kB\~I"#'x3=ye$y63n:bq|X(-Ym#s˃k-Umo՗?iUj5]g%ƈ҇9 DPk+A G(::E*T1/@aد wk>ـ/Q%w >dkPή8`*"ܨSDw>&{Nr '>&NW[_Jԫ:7D!/E29#wvx j1ռw/*mBڛϲ9SzgD-_HFwug2:>e l 8pedp\>=cqNؠJ2/ 1a0}kBNRMhHY1*2 w]$!ϒIy6ȧ0bඣ OIqZ>lNdɀ.(#͛c7hKj 7D_N{ jz3@+֫7-{3P2%$Hʛ˽nע; zMWO1)wtT0NʾJ޾[%RťgPl5nW'qNap5j׻q`: j$w42y.T}Zx܀}x@kϽ֙Nmi1]SUTPSY)+1H7xHA$UI>s;[ywRR_]OcPK "UŐCzt?S ɾzL[0$Hp+:s"Խiͅ\Y؟ZOmn6Q^NX%{jn!l&# `H)cx8?00d㐩mTeޫ3Hw!}LV=nA /ŏ.İ4=x ;Le&9,juKo)}vBlſ;XāD@jx}X AI{yyɍ&ږ,izO974c(:!@GIB b[>EC{î/OĂ D :V?kB('4A;nuLQ&#h X4 m@k=[~ɠ W4JC'$J'z)mfmt/!62 DvK.p9ǩ;:>K7+bCuA;4a ~!2IJ@[=H:0M fF|5Lwu@UǹX,Ӧ?fnOo[<d9p,Xqnq3S˖3%%$3W ɠM.Y-YՕ<bb==L~K4|];zMGO2׬o\Py^dTsrjM [aHeWբ_ 8fBD$}^mkEVTQDTş0.BР^=t@Z)W̖ʺj.&\[n7K {g|o/tYxOQ "4uU,j]Գ'p(us\q[kb+J'ӹ2,{:|E0-P$x½i,ԗ&̔RѶ1^ͭ,ގ{(n*WM ʬQ8 GKIB p#qQUz#s2oBESk&rAUO1E˽ "g̦Px$wIBⅳņ( %,'YipySIQy["F 1UUQ:5A,)Ki] r:N:XoP4C> RK93ݼ7t?Qifr~#r(h'ɽMYS9&9BCUo:~ O"`q$>֕qnjzu=76ih0򕸚4WSɛ^}2䇗{/=Z}hGW8n^ֿ͒B HRwLTi1nFem{͢ieGS!L)_BY.BڮQD0zKE &"ѨFv mzԁW[Y;n\"2m gʦ?7rX_}>xzs%eQXҚ`5xՌ}1ejmƪӌːR9J zniTmک;vWЕĨ)Di=؍A&]EM_ ndC:˾< ڬWl#/hAFؓߞjwSU8߈MT69IkXqRn3հ$ΫW$~)Te:媕+])C6:#߬7n )R1Xe[H#]!;#PcOv.T-~3Z\kb4BS\qϭfƃ+˨=v9w9m.y!u`- _5h^|7g]0UVQeOK7'͍퍻k,7![I}Y8\ pzc]+q4au||໵?РeZN u[7s/*@p]H)¨s[3V^j]Ӡ.Dm[_@άZimL&=C >KY㑋mKkYKhۢu!ƚwD0@߃z(JC0,ڦ7Ye6vB*|bqAnId+{F>Zd ;NkOIZRjqu*7Dv.|v| M b$}E4Og@zVh mQ# "eR8K}fGH`uaͭ?$k]'mmݽQv来w,5 z~sn9#Ḳ㽬و()|| /KUk ls%H&h 4yćxAF) ]%75 ?D4`g|MwS(:+,xy SUya\;(p\ kI|?!Zr7@-JK6s lc-8)"?Ew̡Zc;)655C4N`G\6ӜW&jd?A+ipFG@U2ȏhQ`ƁsI c~pHNθ'̇="|m4pDN&e Lr@gR as>Yo|1wa@M9?ͧg.!29x$ڣ58? N :j})OpBP=x4Q4$p1)M"a0%'a&+Ų&&!gUl|'j0ΊӀI7YؼHLNH%0+@7ϔ l:#?IY@ ,9I@ _ |{ט6F.3PѕlXb E5'])֨;i"fψՓANF`tsTϑ R&t۴ꏎ2}C}E VcC Lv<&Mk3e*^xl bhZUR]sU$'$ڌ1SBLYy)Emc&z^JT'e!Hdd2LdL}17H֑T>2&m:@D7^1p/z#bCy3G`|NY} RYi"\s1+qZsfڏ B9%a b/i)ꅩaPm(. hN8[n<LL5sp(D3/5У p 8{A8g#{3'-fWB9n18 Ewv35lA>\Nj7 BH萇Ԉ \ݯoE ]g85^.F PX*og6x%ZUS{ﶗJ&B%wc`oaqjN;$QKYt7ygU"lX!\qZK{'YOwFeZ(p6؋ KQ׻,B(EOk9%E86 c>5Ǔq ݪJ *Hѣ9=%'Ze l>B\493c QWxRqVe8i{|ה;mLWs&j=gk2v!̻Y03~BWy[WY\#)w9 wkk\C#U >*sDkkB|9[¬6*)0jqM|M~\+PDLΊ?_%1$}x1D[w%I a*IRHŗh7ɺQy}K"$B%G h+#78(({)c6Jh@q\36xNCYR6j[QWa&$?n;9`KDʿ}xs&CY$ɤ*EFT>Pl-skʜ5Ӽ%O!'U4f~̠@ CBdEAcMA )8iEu Ԁ;RB -{"l7XK sx?p,gѲ}t cBSҎ +kS*IƳ+,ޠFzA3 I`}Wt!M 8pKn#wqc%?]$̻C h'su|3 80Nc p)ب^ Vj]('M!kDᴢ+QbK)Fr uHL\NgQP1&@]A" zÈKb1 0Gĕɰ]7+ƨ(`t*::Xۼ1t黪drTW' 7h_TpH. }NqBEЖfn(K`q+ՠ4j=ٓ5@5{lj< MAC@8" S$1?g).(>ro}AScL|gg$M*FߊH!'iH&(#-"J|Q-p sc6IL,H#Q K2p%Xev>s=ͧ9 u*&Y*RjAoHGTgU[8ABٕfl`wE+Wӈah \ѪHʒ&ޤsɡ0&uFRrG&h&L{ )T"q5 I3n}$7Qi)$u::8LoXu l-MY,pUԆ`d*hwN[dyffOQ:)JM v~/\i+cf &!9oCkx0WBg7)۽lUTtPDoUr0ʤjc)re8Ϧ۝Js, {AM>r EŌ"f+EN8z{rtԂw]4hp_!W.P9>=u6.D-d(/|  TO \O{0^sW^AxzKg|c4ت z4!ֵ65Gp*0k#mna & s_+햫v-I-l\RMEjA:zQNrJKԵyE|fcZ*D kI v9G|mM 1,D6/3cgV}Lj̤<ٝTD뚉?4H9ȳ<[_R$x,>3NljZlj(WEb{kMA:yѠ^yK@ig-F5115AR`U)jaݒVX;P+4,U)(R^XS|t,Z+^x2\d9tR:DL<֮aC#)5[#%5@68je|=,!-* ^c8<;?\_"P u L:DŽvgz['նDv`9ȶ+|1T?4+ QUOmA4QMpU{4Mi\s߅B*-EOø_cb.Æm٧Es3vGkۖGVz!Ѱ5u'em,QES[z;W%;P)d0B/KY+Na1NZr`!cVj8#Sk8&XuRc˥`jPgNpu6Jf: lsQ1ѐFiFXj1o ,wWV _Cj;w6Y[|bsE߀ƓV3,䇙?>|(ϓhtυ;e-X˔`k3tMMбY;f50û]~ܑ> SqLEc~ z!2rC85j*/;u|ݥ T5A7\̦:<2t2 iSYoC1elDecP6Gtu|aYevLrXܼraL) 04s=&O@2cRJc@|H`Y#Uç{*9͆.랦E۠`Fen#}qk-&!tL'X8IuAsQ[hxH l8\0Ϲ5nasq:)R>!u.şvD_>qCL*CWf5ȮN3i7Պ}j`ٿSr˖ >7+(CsBTU~f`π.bk۷S.YU@gW_mU9ĄUB3_x.uh}cU7fY{$i΀ 1x6?=TcB=ҲH&G9p_l86D }VTaטh70GO78fv ϲxQŀoLنG*ѦsЪL`K =t(%瑼#=\+j hc&lQU ۜ ajiO \Fg;(1#aN}7-|YqG<4> kvy/,JΣ1^ߥX8ξ^wr[˗ۨ7t<׃{Xo8d#3{ުv}r{mpTt t ^κ7ا]vJ "s9 rlŸd)+# S6ERp7!lK.)i_@RoY]}ä+:k5NCnjhNUJf Ѣ+. ݮlmll.?_g]o\/&xN |(l\(eFT1"m31Ԗ rVbW.N02nV[[ @u<߮MQt¢"HrT\ի(QmoMp8դE|/z\ow!IR741ij:>K?Abs\? `"9z_XOYmSeք [83iR*6T`R14Q:9Dҵr){<'c*5룞^^E Knذ;Ug0&5:{N5rm5] F͕\:;|*<5{.YM ԧa/ib_yQ _]īF/v \7(lgwG;DƲǵ|RؐpW4{T(p3jS3ӏ);pkQ=Ń2D0 'ti_`&>a`PQ2XYneRKxAԁ)wfʑ p/W $TUr#|55%Iڠ:Ž$lM(Qp@ӌ+F9bR swA،oolmoܺ6o-<׫gp՛oAzk?n?Y_^_ɝEy^4yxcg$U|QOāG=Grf_to~7??˿\Tny ^^~$EA]s#qA2 E,΅iꐭ+%gzq,ҨLL+{T"fNRЎ*9R"Jrj5@h0[A߮%> 8nk4 gXd"8ƒH\-@ ,pLWJ=H =k籲G٦wć&&]өf@݀p艴Pr78}B*0$*Y@2;ue~Lmѳ~ܭΰHs9OQ1ݗ87Z[Lb9_\%hMD,8ڊ~SMh znnn޹Gߍ[wlßgiO~boϖy1؜#9\ƼdoRnʗIp&!Ũۿmn*IA8LRx1 ش+/(nj?.<{}I덯כ?_y?Ogw__8\x"4Sme񹸊d"z(l<<~<Z3WR| (='[=~G+[W5w.܏6>? ,$HS[SrX#/??{$Lk/Ieσփ1 TŌ 'Q=*ޣH#A&DP]\.=bg1r͜ oq{.Lp;}ufp?߆Ch@|?ɁpǏ"8H_Dݸ#xUu0ԑ@^kUz3J),_^E,I0͇ȫ ,/' gj_+Ձ ogGGhR0ouEC~${Vz#4Fdgp>qpx[W_jDesA;f 0 d`^S.{bⴙd#'I1].tF6.Q_s&+ 䥷Fb4yTQ.ˠ?jx^pG rї^"J0ʧb>M*A5T>̏NJY9 d\ԝjqжǎ +OSP(iv5yڣjQDtXcjaaJ0 b֢c X(.3lr3AeWJ+0AxhN eE6~ӦQ%- .vh [*~cƻDH1ׇBl:lׁ"NkvBoz'['`a1۪бî{M;Omrad2g֓g/}BL9{wMM޿^g~̟.nswsg{kgEV=CGLA#_}3{t=K`)\7sb8-At6+r|(KQ|آѧxuNٙ p+0kZ[u:VWr(F^KtRov^u 4ag}Eu0ɹplZDf"Tu[l[lyS,]B9(!+szY9'44V ݷ4Aۺ[|ĩUx&.ߣaӄ:6tnCF.%ol7ylUL1FiEᡪ(_ˏA `PJeU7&r\4(T7+t?t_!n?}Fɔߴ#ޢ6/v`Ql"Q1LHG]b7qq?5F{ <n;@j&sA+j/:P[%;VLWQozWJT/b֗} 7^2D";F>hqBD=5{Q0+8dKԪ>ȼkx~K7r+=XC%Z0 a9X/R*m+D<BJ|jlav)=7^%umnmܥom,Y-7(Mv?ܽ5F=ipsJK:KDi> ?y1&Nf˕Y#c ?]ZH )(;AVc!XLa<C׃vPixdtxY.hʞ@φl* Amwq^Hе67VIJ&s#q^x*\4,0mU{mj97#xQ~uݮ^[Śx/n!-ӨƵl'@}0S-pIZ.n,[MYgkXW?]yUܬtfUUw:[uR>s^MD[,bVݝxMuP-U^Y]lM'ԳHԜ*YZ{0 GOҎgA18P׃ygXOPU1O*7R'rC(kJ?1JRi(sFϤ2k:: /nT0JDׅ'1,d1<a\DOBʮ?Q~8DЕ!z> W \_iMqyɟ8܄@hdNC~J%]GJ** $5}ІU狹o{%P\9ar 1j*jD/8J׶o> {z.dVŏ ȴFaʷ|Hn F {U ^,,Xg5Y^w!^Fa;o\^n99^U _׼{57pB3v ~C@V#r4FAͼxIѪ|*EK 0L!~y>x!xaWxIPxcEĻFc]yTG,(6ʜ##B$f9M`) FqZ*3H}VX ~!"’F{|Oh B6*ߧ( 4)M CTZ@bF®{ڴ98}c67+NLJ8%)VČe/3ki;zǰ@#h-E%'$&>հ&$)Ľ7Uܕ I?I4qdM&'opgS[`꤈ZjbfXbocyLQY(JF •|,d+4Ia0?m;m)R#FLLcxzTD@0˔O^TtLc=ޓ#$.yzo -fV ;xh—ft Q"y6\g|TSLG0Dh {%.tFKKGDT|*1KGh:JKǒP32#a;b. v|;%|x,ANnKಪQ{>TiasH zhL&gXx";~=a)a_"?,1,E'/&7;~XJ Ddǵx m [?~?E1#A\7<[u3w6ש'P K 7i..+ c^,K=X1m<DuM0/`K6-Vf>J0 LHa-]U˴g>X$SxaΤi /7 ki2V.b57~Vm]V؃p~{$ G5K۲pJWfN<-cm\_ .pFe:].5 bwb(%x.8B{Fwbc [bl >Pzx{}O/I~&M;=KåF =ho5Q%)Q(ѭC0^uii 03!;u(ݗ)aGԂysT'6HYTo>\v|H__xp񇳡iNIkMF)eȓq&f(x1?! @MDx E"%uh/XA),d; a x1dHrt3W6T4-y8Yn]VU 򯻯om~Y:OL)Ғg[N|bɻJR9LqҲJAh`!)ɲKVr+3xi4ݍ_S.ܞtГLakvR( I!)yXF8hk"]z[Z}4d^9[LBtNВKtH?7jEyoG k pþr :ޡhB)dA9: ip:듞<:䙩28(PIJTtPލ37 O~Y(-1[ DŌ{AM"7f:GݷFᣮJ-eє>*N~&[pʊ M"COG#.~t44 5'\mES%걥i ]%`jxIF\iVsl-}u6G9V:ஜ`aڼmHS$7i7zo;Eyn^HVEI1qJN #\!i? ; kOoh5;ڛ"aDxhk-_5xCVǹ 7;4]&` iXa%c}? 5-^iKx7u{T>6*Xv$*cWc؃{HSTeRue pj]6T΂yrܪ_2}\9æݪa'ۆ4/M0*]Ś!;g5yWUc[(À+(F8STII'2c( T*fK?4)c%Y]_ڌ=vnlIn.*_ : X .ɇctb@Q) KJūM#U'?V!#}#ppn>auH9kǾ8[NDm,F%lUт)8_܅a< u:C5$ͯ#9/\C_I%5z@ {ӊokӘK'qHCN:htY0kiqHѥ$Ep˅T8 J8nũm2:ЪNo&Nkј6oFD`oV:Q1=< FJȩce#K6>tM>(•"skDM~0RNS'%PϰSd.'Dj>fN3>$q{jXN3"5lw#]ya.ŅP ,aqP-zɌ\,Fy&D(?ǒL`n &D_Gwr)tu. /转D71Jf$Fi iIwnbRD&kLրǷD0mr'tJTJPOS"o6;WL~=kOf>d%5iOT$gw^޿{-]mKlAwz,؝;l+:'v:i۬k"& sFB)_0_i1X#y jasi$6r1Ø&U7=c{Ԛ^DDIE|h.!9¸iQ&[uXwge=Ԗ ]po4'<,d{T$an?ڱ !7r!;#:`j\՞sk/ݎL .zhJH'IȰ="hxPqPW4ؤޮ}`",@\MCi Xe&f"s`c3J Ĕ 袘@ bL-i+[A|?U1yq*i҅o,tPugF%Pin Y i0%3;"dsxK5ʒ4+YZueb܌{ 6DFCmw$p|4hEwbȵ4`$Z(]H4f r,v%}!lPȑhnjfdǴ:8ָ,#Pұ 1#k8Nq4b$I,sGwaGq휐}%کd%D6#*aI4GUl Y3ޔfTŸi:+yek kpM@IX5+RqOn[ jŴKrƢwE_?uzۢ]M/†3"opv*pm_6<{7IxveeT-XMH6&t#9.GU~kp@z(oU?%ɻ FK wJO) Xoih4ؼy>oZ%!aX(3܂'3&LL">0vMZn #ʠu^綽MP 15L04 OWT&01^=!mgx0~ : Y5r܈^ݬ,'F 1%p]o9WcV0:34ob9''P;cք_leu0석NZs4󚋀5oL`֖^-.t@v=8̹1KN: C VPu$y@ax?ϫQzfKC8/3&0h3< [wDwd$P|LrArmlC}OѦ/ըoIl{ pb4\⮇\&)l3<(^CkضH,lCGCE5ѠX{]]HL`ۃ2U:wQrceT';Qѭ2/`hݱoFA+DFR>H;sU!PŰr@Y ,ku6+9A?ے!.5{MhvҝզQc:2 ϫZOs?],F #Nfo ?>nO O⿹3>[Od{R[aNQH*U~K1 >!7Ǧdt3.s@ID:Z,rr)+XPg! ,_$^2 Ðp2f]-X̀t[eoS1C-)'x\*>iN!Ąe@nM5 V ]CmҖ-y%K|RGOp tuyҮs#r2V1>ΥurLـ_ 8g{3;ZZ{3˱?qăuy|g6D"s:dEf \[""X8Ug2w@'\C}"c1?i|?[X>>g[T6e[`ؿI>xx@Bn\3&jHt; 83Ab[w"}%#@&k_U-nX-C@bÁ$crWM+G`C t[:DQ/^ǫ2;.>“2h'I4b',\Mc~6n7qڪm&kV+D  f =Q( [ 6߼f}cFfrF_ =&,NzgL;&KVuHPci폊eaYqK#nSI߭+h>m9 cT5cϼc jS <'qg.^L4N, 6f=iuēuBǕ51)EC0v`OIH]])TR#ښǀףCH'[qVasZ-2O%7~'(3>oB\1jsoo &-9-Pu blM`fDH:JY̯8@M|0<]F(3<6Z*Iu#}>_`.%^χ ~LogjUqw ??UyT7 z .̥-f)rSV%c\m@d\ xit}'1֌' ReCNr玮e20(kej*[ n;0.Lm(g텩SxY˯@1**le13yO9 Ԗ]m@5?O'2sڀjypPsAO٨8*?g @;qQR#U/ މLAB'oWCi;-!5 SUHlwשVMHy׷mۺ37@OQT Cw w7U% Tx,sSaaU)iՀ֣b`%j݁E>n؁]D`*XRA6Q4qqP _AGH0a 'I+K:aЩeD dRطEU.JȮ)c:`R+zr˫=G4&{9 Q>naEwq"Curw0\,h$ Nz4gsY,d _NAM 0tGl]*zr E+!Cs%=gB`"*]?:7U|c^xV끛6r'Xa]#ʻSҌImc,''On͑8/`5X6O1ڬ{?ha-8ɖOwE&%BLVr WlRψeUTM:X&+;vd\fR2vv'ݻĽ2<#΂Dp+ vcajb)lƼA: 8 T1}>N k{ǬxBϷ ?h~O3Mڸ/Z?}mAu׻6h,ӿ_)` ;ߩA8 먐< 3 s}z'W1l+H觴.%lXhLf'1*&z_@O](.(b B򗍽X$`"ItRCFOSMkEOr^]Xgg8&[&r:EIxuDŽh;~X{ jr]PxC>(`z]bS黉17e`Pkra|DڨW3`7aGKlZcZԑ+tՆ3eg]ZMX8bU0Jf0K 8y?c=G6xH>,iNLڗ&R$bb`$|#NBzzvb=4i3UbT&YB%Q;勤B9,IƏү o%eʼMv1=j#kX2~Sg[=?;Q1t_[._6_ }e9M 5Q9U"Cy h؂bNUc"vCet:g#-5@iy[B]ȶlQeeS_90Giga.ŴlGfj"}j$##qvkڂ*&-}50$No䒪^k* {O[|D#-,^=BRq&ţ+,X^+X.XeAv A}- Fk^?領yv6t‘,nIt_}Q/t$=b.n˾{]7I;3DB'$%' jxb K`bBI-L{Qp5(c1I`ϔ3qdA!iXELÈdIѱUR'n6f߰ĝöP7n+!49&RRBhyUR8skr ךep NƩp7G=Kʹs x*aI;~ ?-RrVj hF恗F CՋ:9HclǑA!.' d1t/2жn2r6nw[*9N j&)@y=ZKd.RIJUQ 5FAL.S )ѵA;S1 Ax>!v>}%SN-۪i 3'(R k?#!S)|9>hZ)QkŊ*lǺe}cVai$ImQ)bk=XV^ګ!TQ}C࿣OT#㜕{ۿ'^wY8ĊKs=n"\p#okUBC?Ȥ}=jx򮽷]YP)ֵJ4.kjV69iiQfDUupgu/?GǤ6"xaմd#WFm9o ŏ1i^j4j)1'GQ`h~I^Z|%UqN@pΥ5.W;(-B;& -Fa[髵z ;OBs-qpq0?MaߝA/Hv~MWε}F{ݎh>llqz! 6[SYo~SJsǒ>^5KƄQ V+ G&j*YMQ |8X,WdDBmw Lpq@D:8;*` v^2"5Fɝ{/)1T+j|r4Ԉ?I  b9P=Y[vY, =8Ô*ϋK9:0 7xլ͙5d>s#)іX%`6҉9&IFeX?D<Hf,JAEa)9K;oF3,@~VJ':p'2AO=GOzYq9vĬZ?)MI2)e'Suz jNzְF\e0N⿬)͘<Cc{s}%l ? QrLa;_B/P`r{=Q>y1gK;\!"2&vғ7چ3%Y4Ƨ")i4lzOfGlwWvL|dZ`z*uVCIw4aVg(UR#5[a G:})i3*2XuuSH`j1Ls}3&#Ee pF5Uoʲ7& ݴShBF 9h4 'vy8ujm 5Ǧ頑Sl5(sƾ [DW@#Zc!C (Q| -_(]:zGgpY4n Zۯ|[kd84" ̩ڢa;Y4*h/ᓙ`*HNY2ȵwWY#>iW8QFyrT=Z*ԝnJQX֟tUa^C T)xQ{jtH*c8-Q:q6ȱ~՞Έ/rŌ.rrBi)`XT4b*`bg, Q-N]dt9a`U- 9mdiԇӊt˜=ĺ*7RM!6Z, MIX|"sU9HW ҇u4͘.+Yt,_5U-Ӵ"$1 `)mE6:uA{#(㓢v N6wd f=/e^wYhJ/1HI^3s#F҆w8<6 <ڋ7=|)JC%S |[T1@O!4EY>9,v HOA1 x1ѧΉ>e>vJhWlmw`"V+%8HISBVjqY%S MspThQn`UGuMl?Tm}uJNnEe(rmv! 8KoB+%?]J;'a.~ԇXsv0@x!/#_K !np8Jm܍Q Mrf(ѫ>|q5&&?v`?Sn ֓JyH%Z0Mʮ7<`Oi>0 9؞p.P(;î"dtA(h0~Cek5GUEns%wA㯬`@~9>_PP5kBkeU< )ŊahK0OGj/Wiڙ$<%ooSdq^HK%>sb…z!fN@մ18l*$<8A`1:(mD 5wt"TDp4CE;8$J{x]qx&nے薶`h^6YXƚl58bJQ R+s/Su1~j a#7'\DPX\éAU?mΙQGE =O|5בaDZ y[#Jȵpj(G7Ÿ%RK_\{"&DkMyWkI՚Q%f+(q8\)Ne͗;ldNQqمn5澁b6, ?l_ESz燛K,_/7EJ/\ct.WB{6#fN>K18Kk"wQ91 GIȲ`"jwIU 0CI 膾N-ƽ2S DA|NlzaX5EX-|O ۮ <%5tlltg6+:;8$g`! lB|8t#R2PͲFF8|gZt4?wGn2;Lkd\Q'S2(g5.䡩+͢|͛"sށ!5PVd;ޞdO_SMS1]8VvDoEke"vf!a88o9CZbMF&TfE؃v }Xw M:J~ZQ|Ak7`lʃ@*.aJq:AZd93VC70.Ǥ$xPԑuYV$'4Jǜ*qY R^IhmT*HƲ㩉D5muxD2~%bz}WyZf~9qz,_!PFPTђ(Z"+DV68ۤz#73$唵ODf{ŧL* porL9w^0ob{gzp >2D0J nH #\9%br8 FҔa0E3 XAg̪vڞ1G\'ss_{a$_:;,,Lk\Ybb~]8Aj2= (V`a jtO5+B{PJ/5X ٙ(Kp_ GviРEvMB%P]o0P ]Jk\ {t .Z }%p!c ]ù: @:$9g'xX `0éB֋]7MևwNҵex˺&ir"J %IAxl&OW#a$ԷY9VvX N@w dPo޽K~ڃ 1͹e f.u-m4o 98(W h^7s/἖p^0D{HxԽѼ(>ᷣjRç@pCIڊWd t5P@'=js_&\ʝn"pjGWpV!\&`k[0]Ҭ> &H-Z P7G)ܻT{#Env:tJ~E9$%ecEgH BT}c54mzp'p} [`=EF!ߓM^JTM q b<0sq;56QQA@FzǀDq#"i(/)%ilNѝ6N6N҄#AiYW&A|}o:MmY*pZURB1q1yu#L5В NIW/ fc9.` W@OΧ΄7gxvLI: N C!] Yݵkșֿ(Ȥ NLb+_ .UA*؆- y%i7Ȝf8umģ ]e2z'ֈs\hY}+ko㾓f1\1i@E)d.pCڣjlJí$XsjuTW}D%z\ur Q7IzCo?H;Nwګ/93'/ً|[FV+Z]Eb c8|$(CHXb`0*Km [ά*^im{ DpT?͖Q.PB!bүHgJs5 "m'ڶ0a{1S:$xQ-&Ŵ eOknZխA w^z<@`>Qi$[!rB܄^~0Z OЇ?#JBp UǑY#6j1zxhhlhȶ4`Xyr= D[) B98c-=[^; PڔWsF`<תΠB<'zSgo9~ >;r?/E^>LHێ[ <Dg:Z,NoLt ,`!ls(RG21J`)ʫx)z7*k|=v~m#>I:9e>d̸Yݫru|__rȹTd Io+wyQj:G-˂#JE8Zn=H>f VL'ٸUPϵ7'RV$G6B)tH%z¦@5)uLCJsP U1/{;j)6Wd^>x (2Y^I}yvb=4i3Ub@a(KY'Q勤B9,IƏү o%eʼ98+}l%*3I~ZŘ"X!3։o\uC`FZ .ɷZ뭤F'Tj,<5ɤI;BȫQ8Cz5Ed—~O9W8LՕ)}@14VaioT٘ϐ1wTj7I;)XM&jJ[AxQǺF)d$bE3EvH$H)-sʣOVδtY"D%dVS#P;+3E٪VA"i+!aM]`j5]\^9,AR4$ˆ9X`UIPAst(]@ӿeG$m!s3H=3W[raNǨZ_et#e/H?׼v+1l\bq񘛵bAk="rj'j"WH̘l͘1^ғh0`jj&\R@ hlXB^&8a8%wτ< CbB4ȁJ>:q dNcא5#[.M[[)/pݛN&Ei߅/fMIwdBH6tIjf{׎)R$ +('כtT9DR\Iܬ^1%&_g6nC;Nګ[#FeM;tXgAѴRDLu "+t)tS 8a)8T-9,`x>uf)=01˻sy,=w[TmdGS2$p?%~zӅ'ƏP{fEC1'smqWG:JcpoIVz+gff^T_\y9h(D$58'/ה/F3fk@zq)voykh!6^paZezDTaday=+OLٸCBbˀ%L%M.%Xv^uDcjΌ|ɶ8.b,+`:<i$UJd1L^/;=`}7_ƤffA콀@-QWfawaQ5}ϒÁh?z=26ʯj,piHi!;x>>~瞓_tuG dȞZ9أSS/mH9CpXgO(Z Y[;着&*y_hvb=3 P~&b.sE:U}Ũ%(MԿJÓZr'IGjN Vlk6x%U;yX,ќZKB^6Blo1uQ'vm/*ɺ ȿ*l{@34`¹  ڎGB6'j `ݜ廌)򋲮8]/æ.4oB3 )0[ VQoFǘxGfw7W؜ܿyS_-[݄?W\=[,3<'N 8GQ-ٛW3&xl['|8wqm}ЄywTf 1簃~"tl%jvfĵHVTeЭV9+e~Qܥ 煚{vQz'xqX/^t\qV4^ڝ\E'Gق Mޝwr~bcԇC.4?~y V4b!t]h:]TgzY^|{neϩR;"dRJR|ʹPk޹-:_vxFRMl^ӟ}-߃͇`ݿwos&Kk,w?W̃a֕%G㏧ EWYoj)5lPqimjEa6Jl BKG_Q3]jq!'q"s(Fz>hqg`FE *H +$8̽NstQRkX}46ƃ˘L^>q? WiLIO{vbbݫbbp B=~ ,[r>q~~諦J/M ˘8V1xNZ~:7$P+IUx~R'f3A_~ W\ S>c&Oy?x𓂸E}t^ 2Ên`Dj`&:L;eJ@ҀX|x'Dʬgmd\ˇm1g~7Yq~0IZ}|by(:΄AV5TԦ6FT<.=7Mŗq-ovݩDP^x%Dv]b1Xh_-u pj^X"0GWE;Ue3ĉ?gWOl~8TcQc -$c#ԵUo,IYaY\b)%YD`L*7z!SsZua\<ěQ;7B "/1ؔ'XW2l2s sE3qpi7#^mRiyԹp 9nਜ਼uW.Tm>g̸RϪ^L-"|Z̈L?6?>|2gs@ z e,Nڬܟop$F:BO9)?Iu䟋,ˬn9g2OF|?{nu|R 9Wfg6-^z h B>ޚEP)OwH LhlI{tCQ;2pt0kiXKV-$* פT:Xh$ K2DI&^}éhw ذ$hRĵnd*J(s99Q @2υ v>qd{B)4UgԛY[Z+oZ{~üT P.e?A.1+x_?H X3lE6Q:Aaq_5i|RV,xIn֝5'4A: _uRN{Y>z'8aה_=BCtFvVhk($ ,6߳jJh)m' 77MGiفd|n? (RƲE!)ᡄW5-i3Jz4oz>1=Mv4]pt;?M#վBqLX͔+MTfPm  {:(@]CVjXf'e1Q~9\J)iae!Lр 5jVwF_MƎ7R0+je0X`WY#eDlm%w_r0:FD`K0ts_&lE!&SJ [AֻD-f keGǼ"-*`+`F?%}VRU]K#B<֖ti,P">yzt{<-KPv6>O8(=]e%>6䬜jW=]R@Ǻ]ۜOggs^?L-\4i)[3WVc -:B9`.F +!ULUZ[ -07:AWPMZ(%D>vMtrj/ me6 !*tT1D|Xb^+(W],d~"CPˠ61W6a!˂;G$/Њi:".8tA+2TD% X4WXOQa4sB/4b u&Y i8hqRTU~@nqC.9x&)3t6!:vjk4Di9yn"f_n3woABF sJnI!D:id`46:hD&"B_ uBy4Paᨗ3 c.`7t{ g qKF:?K&mkWP^Yf2 ׼e58U6akI mvFگ¹?7Oq30gRRߠ]iBa]j/; M0g/I:N]ymYnNSc `ѾX,18tgzdqm{_6i<(Μ:\ _vׄ}?֌<7K 9PRL \cz#MXf޻{׍Xpce27/ K _ƺ %j<U]OkCP|[[`l|L^* 3gtB~ޝ؛vf26//F1kM؀@*~qLcGqTM?fHOC54Sb~@=t_n&|U\nԍY4^J0 Jshz6ZB([WCfL6;^T?uz䷄{Y2FE p1M*=G»̇g#-S5 \G~ QFO:#Oa6'Jt\cK Dws;06-fVF2NHm6°d{W',Y`}͕vqZ0./>_-}yTݺ#zJLQ-NW~8ġX_ÇPQ-o _8YkԷPnkKh .ċѬF/B|j8q-SLfEKX6Ͳ +,ɖ#uq:&&d%)r޷m!dFE"$FUC=AZ˛:66CZ^?^;I6`Lx# Rd\}M'spIQi5柲q "I2u물8"ʏf|5t:w>ޞ x)A2=m&ݺ#Gz֗<2f w.- n8%Y WRƲ/CVF08KjPN}[;'cA{ljx/Q7IoQ%Ap/ӵ6ClqKw'[e cjVX1Dü!Y<3,}c!m[+<<Rt ٖqH#FƢ|Pd49&jӨ3x  MK.){z~Uo ?>nO O +"BjH6'Rj`n$ersb[9 |cdg ɰ)%?5RC!'U>) eida~tx{V^Mg+i+c|qX}P,tCk9،/P٠5cZN{Q-jr/w-S, 3:Y'Rc"ҟl&;< rQfO:@TC5 Hp-}_M :\"NU@)jUr EJaC-;cuhlO'\&cu\2ZкƷ hQEʽnr[& 7ttH䰦"E9pիV0ohNY?w<&<nHdGem<ўön _]&c5H>BT@?4ąhc5A:puRu5=19BhhÙǝ>T_/Һ7br^l&+lս4 Ū x ,`XjKc DWĮ<=ma?*ۯ nKUY6r5~l Sޜd~@e#MH54wߪ%M8 -Djz8B[>5A 8f|sցRªk*ucטz/T=x@"Q N !9I9Orw{mDiX@B@$Oθ_E6Lj<=I̗N76RL!  \h/}A6޽߽w8UGJxt-76:1a+֨1g(]_ct`F(e.wЅo۷n m$vW`%jUS}c6&*X pƁb'u*3%@yFFz#Anޓ(N0ؒ N`?bU'9,4+IK>oj#qd‘]Sư` bGeR̀;l㝍w+\"0Ckp72~xl&3 M5ٌ f#1֛(4YIn|"lMd&O>15uY*WKK;T ;sR3ׂ2N͋0^<,+R78#0ePU¨4nl?ı9A3A0ޱֹ]Rλcn|wZ mESIo1#BsgIW9s W-B4etڐleUgXviѭqoU N\mŔSEp~3Ç-R0 -oHn:p%`&ygxmU $2ژÏ7n sj7GȮW; h:;umA m~&VҪ]=0#r c*ˏiɏ'ձ_x8 XE7 A)|_2SR!hâq;y" 'EwX~p2:>e"犠jʜ,픆.< gngLԿ  G&Ot/c:9AaP)q>qp7蘤6skCTV Cb{&351`j;ZSGLW[8ƔZwƦ@P`z̈́n$%!ނOd\(5]p0З7Cm{eCLJ?le(V8CN(C /y^[SYakieLɻَhi¬t'tѹQqhP Cju믬]7Y5wnwm~!O 즫OI؛Awj ;\"1XbXkDz= , D < gj!i8Z.!8Oe\K$9W`w';KW(F:eR\&)`=2WŮƎlȖʣ80aɃ#rBLu.KcPO({S> 8TDP@0g);Ȏ) CbUK/'0}Fq3+cQhy<嘎9 M [s,8ld5ہ89cf6!UN7Q쿃CvPkzzqXplc&_ZRע R˙YM,9f 7+=x^+>ڻi )r2iE1Zxqޠ(/>\4WXBJmTv0 {Z ~/kxP\[7 oúGj.W]]$֣68z"(؉xzt5ڰowI=RPzx %3b9fq>21 2ƒFH-S׃Ǣ7T]iYe^LI:>#ju0bڻ]14wuc7?LlZ `V+f@I h^5?E3Siv:Mڻ N &:zX|Vc]P8$}Z'%hވU?ŃX ǚlw_EYW"j??yo޺7o.㿮'|lֻw[J9 -F7%tFGA{SO6>Z#[hSвͳz?+ ;izm>?O~ƄȀyݲ'3ס5s¦ɠU^tQS0kq6IQzohoQY?g?LGe4 zk%y_R+o3+g(K*Dsq/gUPRJ]z,σbpF6[Z8N5<1UzU>wZPo_WoEgQq '.8rd G8ʟ' Je"}` mӛOқ*oȑ34V)"sWxD HyW0̐'kwL*R=Ro.eMxQ+[`wȢk u 5lh) HUnv>`J&ǶÄ m{mDt/X`"-3~Q7]I=I'|al4AHP@JjObAXB̈́I}iZh(UcCumn݆Go'1Eلʲ`*% ârDgY,/:Xo`2mVI+t(]ⱳkc2fZo@PMUJ8cmD.ڿ>_SM z0T_@"f!߄,~mep]k5LK_`&UX.O\LfI!;{;YI(?ᰓk$ue2i,$;vɾ {7;F/Ru.Q@tX￳B, ?dҎ k Jjd@#k,$QŨ;>4u^smuG)FKLܣ*]os ΅k Q \p xwjƩsJ%D7X}Qmnos[{v_u~~ wޝX7yn!@%SFY{#msmncǴOsq[}r/ls?aQ1't%baNZ$נ: -T&FE{k[L4KSm ԭqejyND pԷ; +X;8.NڇĉG݀sdu7ykq:̤bJ%==jEߥOsDj}QVwzS);Lˑ_9vK0ET,όrtogO"C^zo1`@Ѝh ŤwM=w,B+>~VJ[+oQa)~4ym+~7W[m>?ߞe;Xs??>㧪U=+ 2ו͚ͩ M B~=)FjR_y]]Aʣ۹Ѹine2Qe)xgl2Ɏ` Z0p0rB)"?=[7V+w~ 3aZ +ֿ~~ʩ9Ya,Vhby]hϠ80S+:j\8R~a$NnRkbgn 'f0@?jvCY͛܂6Y2h_I0쀲f,Bƭ)_W P!Hu9%^`gxan ̤C9i^Xn]y+OaFBRYh t͡3Z 1w>)& SiyM& le Tu~0hx^KK8&y^CׄpUeДmp"Jz6 !6k5ٍ̂8O4` h 3YaKЬp: TAKG.7:D2blLCQ Xn0F2}+` ;b ķ crq8~7`h#VmNSA ⽚35ʔ6qX+`|]$yD0_[xndx *jl3x0Aa`^A`Èl@z9og˞d# dZo6,/̋_ىFv}$rV}dnUr]IrRm[nsS#mbd3Wd(00/+?;p$.X1.! /) 7|V/l#6mclZc;6}0Q͡|o1 ݤi͐E3UlQĽ4ʧUܥy()0( m (C.X tՐǰpr '4e&UqpH^_IBA%YD$kcO՗4Ǣ6.>s2>w= *V7}=ڱh|顰aӿ =7GkOSͰ|{tN1[!L:~S̞<;r\]`rY`na܏̭&Z#f'!9]c k%OߎoAWyL|=?ÙO $UdáPx> Ρ=Rg )@V[zF |iL&Xh?恵q(U lc "w]uEֽX 6: #C.Lv@aLypp\BMԍԥ7~pZkv4hsӹ!-mَDа^pp+ s.k|m,8"H1`^M ~'caFvoJcItKfAEa#"4P)dϯ6g8Ns;LOv>[$ M) 81vQ6W@DaI&*!,N}vMPOLũ+~H=^YۈLOk,!=4+)31C(A`>2ߛCnfɉ3 D@w|d EQ˔>c0j^&$흝[3܁;u —W2*L!!JįD$dCA}V3HR*)::(f^ F@~7_>ۇ:__|_͎#$EFNo-?DO5yw$DJJ?͠h ďߛ#3IZRwӴ |H#MR}XvLMOdD1J\ ur'A^PZW`Ϩg.d.:HفqGI=KFom$6%l%"&`ؘ: `+LKr3:k7$l lϤe4z(kLrS #ғv x&.`14fdlsl8o$淊+F~O\ 7tAKۑǥ#8MZvmEDqEymG-Yajf<@vmh魿=نt&eWML9x *GΜ"g?]3|$svm ^ٌR(f9Wh{zYΡ!cbD78Mg%9F8ӧGqw[Oa.Xf':wco|1nyc-!q8Z̐rz /5{3 n8z &\FAT*K?PoR &+I^-S+=sp!q^%6f&!gIA*a^u!rmj\4%+["h,KZm9&cǣqGn ;Cw$gU~'=}D4\r$ãNzg}pp#OF_y6N5%[r 8Il?i.lKW]b[ytޗUuMO0D.F$o/Vrm /z#^F󉨵jCKU)y(c\,)hW-LU^ y9V)#Wf(TTdd X {f N~d.8۞#xe NbO+p_W~:(OFrmv{@[q)l'9P%u\6eWq'i%äJILLf`D<2-Hbܲy":˛0)M(9JHࡁ#WgFg3$ᲅ ?W=G;B ^~V_i⥕>,(vmܫH\P䦃Rm) Q4@9Ф2l,&ES .pA 4WQRm~C} ʑorFϙggf"{4X*~[%ͼOyvf~6iZW[[[aUﻓ;%[byyj<3ZB+Wm,+kffIJUa'.xeR3]oB#[Ϣ2^Z[尺\G\$$׆5l :jN?^Erdu!R-HU۬0%\LZ_gރfߵ'1Ŗx &mp$ $6kj)kS:Tze,]$ pj3A#s mLJ NׄwAMw9eL%i4`8&UTF2i*" 2BWgcu6~fdZZ6Ìf oߙrgPQTQQ}2ٜAbSƢĮ*T"I;jEKʊ~YLϹaLOBFK|YMږ5szFnhH=Rs-lIa3tK4GxXڱ].}1Z'H;7PW gN&NvtH-WeF <.h8JfPNcz")xdMd>vܷK,ލ@ mw˩0,:~۸ ~J+pZ<]i3` q6ALŃcC1s.F!ϕu=dJrgh&2{}85މq:̖mWC3' ;=e0\lCd[N5!g/|RO >qiBf]s# TmςY"~HZd+0~}ͯw *X RӔa3΂ !* E9>оNJ}x=OU,#2Oռ!YqjLgBvx<s1j+2N+a9a[yaԊAso/w"Ls&Yv/1@У|a!-t잝Ͱ:=4ְҜAcYk9zApj.~%p$ۦ*_]c^_cd_ Q*HO'9D7k!Q^DKFHRH3!Ij`I1>~FGm"Fy1"" e݋$azn(90yb,-jJSˏ,ZAq `-"j M=M8p,sO+"SN[!Anp :V) 6p 'i.?e?,k)?QI6 wW`Mlb qð"lZ5dL]Ӯ/ <#H5t6 ۞ %Xj5"o,hY>=7|g\somJq{bj7O:d!\%ޑz\6VzoUc-Rd5vpZ!Xa] 0Qy(y "D .=`ߘ~, ^l5 8J[H4hFđT\<9 5ojaPO Ģ(nySJ]jcJݐ0džʞ;[}Pޡrwwt H?fw"%իN_2-S fV) ڮo3|`^y9+7[nj`1_bٸ9AdyгCwX6 }ʲh{`mRK8@#Kpc O;'a=9I6 Q2`%tXtZ%Rk 7T֜ [-w:s1⒀vOjmU($[nƓ+.^=!uAߤ|uS\b8Ï4ekx&"U"L&GXk@]+ (b/@rw^p0]&X?Xأ81,ǓDz`D3br4&D԰m)y:h1^%8"g(wa;kzǶWd&,Qv &@?6z2f$H t! t"ʉ櫕Z wtϩvX KNwvi}5ޓW0p̋:abf=NRè4'51ro{I75k Ų={̾JevRݻe Ů b95_n: Xk{FZ˹J(W|7AynpEp*?#(H:Шyu" 1oui9X2C-s|kE \;E ؄$\nP<^e9v_'n;s\h_8ROfN늑.6ͤwv dT`^r(|һh ,|`TZpalޑ%#cq꣐|wG71giwҺ>!.z;z}y)03u͎?=v|p|,J>?UpT^${bA< T^01LF&K­($0{]"JcnQjϊyd#[m?&re(}\kiVRmdg)&grr<1 ^ߏ [ZQSo£J %DdRUvd>@[چa/EZkTWa ,>?k@U7GiNvM3C#B-$-P3G3HO0^inrkp妷Id|yC{oꄮ%c:i3ܞ^r+ȩ \xn=[zkl FB FU֦׶^&V]>B|ov\ ;2%Rf [B"N'!MiP: p03=bXC+Νߐd Nα=dFӼ! bJ&aYEϙe;<^ M㸒+OĔT88~;ڌOïuUITͫ-nzJ&X$c\KN[ZmJ.0G8@m|u=@lnV? Wl`4)ʂp?#*J)w}ea-ԻS%Н91Y^Eͽk$ u6E?VI/$?CqZ@2 6N9!x0ԆQV9պPFVbqkIhUs(x,c.4% UKX|QlN<0ԞC $i/M)eK$#ȏRBG(DZT̅~Ezu->>g,Y#po$E~_k?m۶8o t.9%$ukp[ݓPR ~c2 r% 3:Yui[!$"& &QQKof.-$;Y;@ўѣNUC~2tvn^[&QI -Ak1|J QcW0h9g`(&ic/yt9Yxz_,'u]VQghFp><9}9hpk!}(d¹9e!_>Yk;/ 6IIN#^x,z΀}_p,oY}Yۓ6un]s7kz|׃Ó͑rv}Y)=Yxtg=x0"lXSmz-X,0xurg"[+y'Ȣ)B1/Y@"gCD>cS3.Ir~ɪ@\cu33d0/F%W_Tt^S|gaAx1 /t~P]" h8G&@5 EQO9_:v`A@-Odԥ!tngߜͻ-͹|(97)x7G'mA|Q,Ƶd0s8ɳS84 Ҕl`OVdzLVW昁]m mAM&ݼ̦%KWx¦A,K5mQì6f'%(%~rQC^CGUnji%ڜ 5mWkg y ,՗ )6fr;,BPGlDU}/`3l_NRw_s-Пd#;ŷYu5l=$?r+;&"u(aHsa4 ᴪﳝwFTb͘Yz;zd=E)YQ t8N+:禶갑>"bcr&yNv4Qpb.fG /*t@;\vۇG54)dgTkAV~,QqQVbֶ-Wf,-(ks`fO Mi:Od zloÆR޲ Aflyp I;Ρ_O'~epon)fG4<kf3Ɏ-$3+?Xy`]GiƲ^sۑfB4붥oZ궬g1Ir5ޕ`po;nY+_, 1w)V Wy]/n")n{McRmT=qq)SJշ׋U8j7ZkN'LAܶ B^gsQ.+4ʧ'}o=Ԍ_Pt·Z%XrDҍwSц p8D s<K8 ( .Gs]*UiuP(âƩ”VNk(:ѾL:ImD<*lԌTLX)Y'I,GODא>Ʈ +W(52;N1VnAuq$ϓM^j?vP5{PJITP#z վ_'E e [}M=[{pY͑[ԐT_Z6*k8^S#݉1EHumuOCa(Ds1oKqNfAAݟSxE@ 3 kR|fLkL=y}(gD8׳İfuyh#Q+2=G7lI)Nb|޶ޮ#LM>7/ܘՈ]KIǜpd=9Ra2R)L=j 8 U1Yd?g#DuƬ 7OKT+4qa8x3uTGMjǍ5Pۨ2`sUVƊBhИF^mf4 1LQ% @\՗ِ\?<3q 'Wc+ΨPq T тȸt=@˖9 \~1v \gJ>۟wy"ꅖ<9:|h5JNrf4szf?_;9 f4͍vr@m3"ϛ >ق1*楈p+gCo{uħ6J*A-N&a(R{ K˰__>ըHGN'(׿c]Ilf-+ `0R~+D~OTbi0Wxbms.1t%a!c !xv8 K՛/yefl>n(8`Y\`_U'hffo-PgK]۰:rSʇԔ D'F>9|r2G'Fef;'uQ(o8j r ThqUM:Ow"''wZ.-]d?o# [?\r.L>LN5 5v8~A-JE$$_fjtGNw?t'Xg=yFWbA.91s۵ܦУ&wR~(xvQN,,G4&/s.NM6kط,Wή1Ǚ֩5w]r*^By=PWM3z7[~y_-ّ hP9h+6&$,{ܞdjR-쀪g+u䘣juFŴz߸Tl 1f̻蟪~$_LD)=IAQW}L]dpkZrE~Gs}.8\˗%xG6#$/#6]@nJ!dJvy E)ִ"Hkk=^n“ cw/):W pࡘ8?mGM^ꘛK_?“G4-oj+﹣!>;9/휪SD^cm:ԝ> u Sʽ:^h DߜƄC{7xTu͓bbbDk#]g"U$~ZM'R-2J"hpMFW5E(;5 \aӘui̾'疜2`KEk,<n~[ۖS>_-T$nm[&8IDH7&l]pqHyw1#^(WřA%2xK Hx= !/j+#qA nay%3\?7X"Sm& 8j{Ćvv0pXK< f:6MSfҀ&| ~9ut127zd`ZtiRb]k}cz|iL 7L\mikp]q_RcSJH jyf7vȐ,u̚2+g3zre &8? ac4MblUI'H,3X,kDˡXF jqif3ې./)^82;pC3#6C^\$U3J9/fwyaT基3 dޣU?V_:@Tqb* kNFT[26r3{3&nm[ gJ7kŝ/PM;@uՁe z}m+9cJ2:P9WTql `2D:)TD,Eϕ}nZ>z5qP6 U­j @rĞH:C/V T SӃ.-TqkiidK5EL8 u vyD<ׁmbWp1! \ڧmI1=]l8L D>|ӔS;Ʈd3WAe9D^QCОbfNG ,j /mfr5=iה, ҿOܧҺǦIfԯ̨R:.mI3/x "<"; KqEljșN#Jyߵi7fY@'yϋwXb@+!X "wc{DӧFJfs*}0r=#Wg}}ץOLwlo9ڨzmDq͊$x>7U`.#_r՘pƧ( :9Mv"_F/B~0':cT%QGiqp9z$l<3㇏iKRlB=a;ȧSIu_Sgu:JubCpQ7+>~VJAK}Pe$>Z=fīa>p?R懣&㡮Lϟskb њqg,%:XђѾ:yln?w#a'  A< ^[9eJoŵǩWA8a݂^Ӳ_5Fj64oi{7=1=geB|(BJA`dbYYp(@}"]E]`KHG%4П4q|=pځa=.Sտ0pvk2"{ylh%+ rWS*\然p~7⤨P˒$dσBŶ'x:VX3gJ]|SPܧ=-qeo~ Еac٨|Xє'pWCF!.4`xs~!Џ>'뀝 ń@b !O(j?1ܯީz9 7c+2B1aqBSx:q옗[ ⸹<` KNdQu07iM4M,lÂq=ȋ!(K$ڌ{C&}n 0?t8lEr.?.pd-OR̅gĒz\NE%εx꒠jTˊ۴?Me! b$Ea*P$6H64YOϳHTMDBd|tR.}a VZ \S艭ވW:Nh̉[*u0wNt1wB4u *j_|'B"4-y#^C,?@xâ1VU R騌t4w(BU{dqal^_94f<7Kh[`Xb;RSZqAW#vX=38]NxCHvݞx_ o`!.R/IV*w2ttO#ڂr;cz4@mRE,1x @MNjn~<`mƺ1&t )EafWP_,|[xi5>#/3xqJXk>UIh: 쬥HFEL=l4F'fTKiZNPSMQy;CB0Zoڡs-iʂ[Hc(Ktš7|&QToRU3"SPjb2$ɒ#BEwr1հyoYg 'ozώ}f&p,*>Zq?ci Frʑ+;yك RC.7)ީ'@ N @H갉91 &oɭ ݰ`ep6iixQ^pwU =OFnSj+m c yi4)9Uv9bzۮL++zՔKVaJ㽂Ij!{f1"PB45.S2'ot9o68R *ehUi_x/Jt̙tJO{9a'!:4/A)U}(鍤xT2{rrtû__y~ݖH}ԥ`zg=r-i Z+0 ʟ&wն*|ӢVYk{i4lN1g@bmlV\Nc?7)(#;hB㢸s A#tuxqJp c~ݠ[`ОK7Gʲ)>؞O/H39C uIo`@uFmҺv\Fz# %W 6 rm]Ek ;NFO^r6!Ӟx7CR(%S5H;.D&Jdu8% q z8}eySq_C@di[& HfF6S&28{:dhʧ儝|x̚b,h𥎁^ MIJ[qe+\FXmF4Ne%siP!k y 8Mg"T?|輪0W/̴G/^?ko1YSL.JlN2DHo#FKf,+ n'[㉲l'O. ?ٝf d|]dO9Ѓy16ćUrSs_W|P$?>\Q' L)IF-IQDW_jN p@6֭l\"ʸ 2Wx>:7kNL'Ѽn9/5WW9W wz/>n;;T-Xh /6Е싶U89i^ 5{g[I(,Ht !כMn]{ZtcC- i֤&ܷA0GZu*t8:\x9;}]HLqN8P@r3q]Yg0vAsk`/oݮϰi)ӿ =PWֿ\<2m߼?3xe@[̪U>TSU I;oc:]ew/zEH\ vN_MSWVML&iƍoHyGo,~ovP<\v]LH-[|k"F'_pcm F0M[ }?T =Bdl\XZdv4۲CyPB~\;2br( o|V{ _cVgR);I.J1[@i {$S\탩,Rw<6TM{TSJB+5xOA-oE% _|T٫VG~)7\li%.冻hnmyc*r]\j+wF[hcy̭6EskZŚܺ^0a9u7J˸te'Dm'-nc$&$_؇VgZʊ#Yqq7 d9]!@* >5q f kE4!BQKHO #ݠ=.mF"|KtMc(2,((L'C#D&5YԌc\R]Bg|r&d/4}%Q@& J-`GnHe0G}Vԗ |8=|gJ'K!|:pFRc&i1羴ˡ# U'N (/ñ$1׻ATS3EepΦ_@/Ur奟kj,Z }-(hPԹ98CW@NB58trl:Ο^lWR݃N5F 5̧1[۱zwo/y/ ]X %9"Wt`+Vۨ"I! #C/kR*W`OY&o|srxעtEN5h?x/rm0325l| IR64D# mt B2P֬׶ zop?T?r>?O 񎺎q'tO0˳="^6hDn _hx;P=\_)M왴Y1״e朒%|Kb)t$e!$FmfőF#sqarVNV"@ص@e4jil6`KT#\|rU"{ePi PMŴCK60-[߅I qyU1RI-7\/1O+`TEIlw3Q35~#me'Sd\^s5\mΓ}Hl}y5? (ukѳxrV[c{lu=vk#A,j%A 䵀9 B_رr]xl[lAFiG6f?y!`/j ru=+E{d^UMSB(O'\SE `%*N1E|Դ{C0Ɖ4@5$ \D Ou3#~"LYY 8$Bl6 MٕB¯S{Irx2..{Q"t, ׊| 9 $Ki U9кR3SN,|nF(rW?h+Q SѩAK᪝ec ޘf 'A:a!+N~tw~bJ~7f"}؊*S懨tg 1q psB{ajR4떗i /'e3Bja@Zu%{^_?q xMt_jR{w: gWӀKn+d .n(fed y48j<0sҵG>ڌS玑Jed} E蕬Pu$&RX`[g,"/-8+kD5Ƕc9fY@_nf1xuq5G+V', ^HedbCDy-k@D\bAOD>5|sp,b)4\SQ 0^B\tr0v3D'U]..}U Ro ?mGNQE8?H b6fE*;E֎47P VG1 ;USCco!7WtW-:A}vymy"8>z+y k0E "=C|' q- w^9-Z[jC-'ÁzϱD˧\3lAlȎY,GԨ#EꊴNYY|2̘O'?yw9ihOЩWblQߌ젉5ۘ_Ȩ\O8|yx3H'ow/޾9>Z\c8' iwF /wwvv`-OFA ?7 4rܸaOiY;>_B_4 iak}rSZ@)\З[P,b!4c] x2/s, ,|aR9|F5V5o0!`&\*BYhZ ^%@̂ ʐs6 $Ɓ1/!Q|"x9ݑ\ρy}UAOXFCZ)igaM89g%‚sπ-.5 ye(;:Ĭ:Ob)AZ^-CWO_ku}벚7ڣis?f-X3LJ ~C vwO ns# `j3!Q4Uρgu&GrhO;W\* bh4ۺ0mÇ!J^C&NG͢4`l)/p(:*qGlz> 4YĐ?ʐi6ʜpXR 䌔Qri6Bren OІKU)qG'FL&8u:K|Axh o5aKuH_ z2uxw]Yz2k;H8`pl7S-9T2M$ /-8jƶ{ (Nq$R&4*u0+IBI_a#^ulRlSDtsS(|bزxNgE}CHq*A0\X} ;~g*b <46U=4K ]P'6ĢXÁ>d]-l,о0 ڶ?)jU7{hwe_!ߌ5Snʺl*W(Tm'iAbYMշHsXlѱ"T%J'ũ'l6ᡊIQ. Um/#hpb\ZƤW:R9XQ)'* ѓ .94f 6 rw g4%{_\aP۠< 2 A4Q'_W2򃹃DB3q ]kB{Mc9ȭ+vmG;SLbwyqxW׻tO7{wG+}?+O/I[}3YTu$ wfqN:UuJi%|ku^(3pk.8Fs.-JUa-. .xj!@k4d+]UQKWp5{0j+9XDu Z xd viHG@}ȉ%3forNjΠmHS`[ \ VYQ- (䚜A&)j9 TéV=[ saPR||yw7brt<׶NGєSLN *jYȥD</qqέP\-Aszpk_?y=.?ke+% 7`ք7P: o~&| @h'B0?T7feLEa;ʼAGch [uZ@O20);D2;{E VWD~+srye$ ё2wѲsB_ { KXTY(" rzKi4rEkԮyTv46u#fw.e}˪XTMOgq܎P / w3=(!fZʄ6+BVgePV}؍SY8:-|8^Z 5[|mWp0!W.fC]ǩ MåXm6JQQӘ [3,l4jvKoȾ _& ~ux%}VΚuKB/ gO[M@ihq=WgS&lZxS^|6*@OV 1rOK%~JSzvmwkZz}i,ɸXfֺ(O鮁x޵P+N~}i7HǓT|=Tꌻk lvZSzF }4gHY.Vz{WU@?|ftAʂbd-4pCq~ļo.<('Dq1<ñ j;x.6@&C*PYKoxu ;KU"ʗX¨V!_r=:f2~!Q,C$jpE͒25 )W,,K;f enQt,F͒25#lZLוVpZi?B2cγ[O=`cUO{QO15g+ݤ$5:l9MtY\D_.3eaeB^sD8@Nh򴬌;4:)4J}EX |3#֮qARãߙ:w+Z~nJϲkk5BNDu+I@-FP| R34uf՝}M=WYe2u+ɄU5)qIDIw$ n('ZYIX8$7:QSojv*e&ɲ]'NRSu:9Ef~1MFNXYkOhT&^xKv4>d:kw*ZaXL3:Ek; :\LV_m:uZp{@n92dܵe$>Kg>)c+_ |T{t<%t4=w0 *7N׶*v88\p܎v0*OM&rN/r faݖDK "IQ;|If;riVn%_L龹^w-xCI[ɿ߁+]u}Ww-*'t%/+vϪE;oèUYX{z=dG)H.FS{Ax!@8v'U9}eWY.*ӊ WP_%ۣYY7ON ᢂPp- t3 }X;J##I`W6MpOl7!tUaiUa-xJ:%Pky 1頩yb۠t:kGcE%-5ܬ7WePq: Jl*yC}ס[#M#b܂L!Knѯs?QwMb: 7>g=iѬ{d|iZ*EO@nHߍCh8.ڰ6vm13 9V< Ĩu1`SFH(5+p]Ήt7dž4kJ`yY"O :oR:; e 9XzB^ ?er\_~DCغ{&+nͧPPXTǴ_W9IHu3^b;zmW.&<Ȯ_#%'uHz}"v`:ctwK >`>TV59suq'W!;m zl=h9zþ/,k]GurPǙ8.ձvpPΛ9XJDg6caV<R?b)lLgEzh[vr,Bd˕ J2;tѫ)BMJ)ؚ zIt[H]N>+=Źe痧aK c̬OJ9ǻ{7+}+_/_DT*P~\&4j@'ԯ[ӼCaC ûԞxiԑЊkd1&aJAVc^~'T<"9G OS@CcEeXeB v/IA0 ,XsՇ2rD3X%jжX7s+;>X2ׅu7 ](ɫ(])uőD^2~>vO'F+jC_ B@dOJrFgC(r`Ü M_Be?sȖfYgN" Z;WD릈agQFȎiE^7F<1OI |)&Hx5ko"NiCZ^/[()Ez` F'$ bCÜΫDh(fLbz>q|47m[,,%>VyR@\ Zh\w1wN.bJj("%|Yy,b/e;NoVJAe!8h-T'v,y'7P&"N7CU~u6`hg'Y+GFD#?Lˎ."KX+/_TdTDNĪ"?,i(RlF!wŕ1{6V-NJ2I~Q_kk#NJojDž~Oɇze)3Ys4b0^')1B@ Di!➄]0.KB%Q^;XhΏ3pZQ3ofU-W|:fQQCQf:#3PI4jKҞ# zs0.\ZZvEN@=ޖ{;Sw"H Cr~@}mKp\tJ9݇ S&f/7FN=sf> >s PfVHzQSIhhs|@<<87ϿwӲ -NDtz2}LܞOπ(0/2Z0h}הFgX51O@t-1 6Dv{ ,-PځQl|% O -*_WV"k|4IG%wga+Id/J(IuMdz)bO4v ̭%JSTkN!q+_ҦlCpvx/KZ_ɾ)V G&npH jg/zEx|$h (.zEʵ{12a\Ģ Nn[z6((rM ZѻD V 6.7tۏX] f$`bp3={ZuC"ZQOHX~g@‘㶍c^Uң(NԝYٰfon1RGuH,⤬ r*?{F_tEHi=3gE,Q<ڱ1d4 GUeUW?@<$;bUSeT 8U{<:K,m}RJ?0.}yK݆]Rq|Ub+R.BI\SbK}0{p.\[d!ޑv3㜠}Nlw,<{fEftr?3R5^lQq g<;DD8| xC FbF9xcpcOZ]$yS3rfpW ڳbskEgO:tJRnG2 ʷJʔAH_[jVU/Kֺ6!ѽ0o/W0W9QOБϸV0eT 7pxCN޾ˁ^t!c{`ୀw@B"IKIҨ-zc1&kx&V|#@TމNMeZ+ۻ[X,$. }ՎwtctGjCl$ >fN8:j utxBQ~ʨ9٩??J;D 6u7M t!/ty*F;^v6 cșb^i?U9wab霸S\ U>-\sWLPE:0RX `"B/#KDWSfRa UÑWi^9`@pԓs^?L{7OWp3Q_yq&e`p(S~fʹy"FG.+ӟ0axqnjdS:0!@Pv~ޫ$TQW"9$;HSq`E"H(`'X5j !< X $uZ|ז"a:|*@<nt#)*9x+ȓ+}1h G^)U3* A;/ȈlH0c_H3UDo+>u4[`˲yhWw'=6>qJ<d6MӢ҄!sUtOJ`XJ˧b!It3 xnN74)jy(h3Fˢ1ԑ/XW5oTBI*Tnի\m='"q 8k=@zf~+qBwׅ3 9]2L'b2ԁS `+ t+Ok1d̫`rYBFcuذrͥSn&e2ŀb-`d1–Sυ%neȶmQi56mqQl~^Z-֝{M(,Dcy~w_ ^9VyW?]%gR}(VZ?0jUJ]sNdlS&j6/gC=_©O)4zE{h6 OU6d>hEȬ:|WbK^~b?f3"=4MyW,e_`muRH9Cüotaqsab2SlpQ0%B4:O:7=ەgp-res$iAݙhH5ղN%/B'4W9xlvPcEhwYt)/栩9]Zq9h~T9,M2i $Z9לU7 E7Tp֛Ù˜T:&j{l} eN ڬw魴yF&v)GPKߌ\<|)pF7s| N7U( InM䉭c9KS<i 4_ЗgWg^L^/B]0'}׭w6;Am:QNNTj$tDu]Bі z(N9˩B,\]XPv(DW9^9q4.f3ՠF%ɈqQP:0O^[W$L>G7EwE~T,S:\wܿpF\e pQXD$/%c Xr)NWbz im|W T4ѠN(I0'w8[G(Ɓ /LR =x1埢Z~(:8ChhZp ?knYEY=-qeNYIBŔhZlBY ?KCgG-oB=-WpXHGׂhR0'C˾eã !ڋC6*O'DN7I+ ثzD0w5b~NrhajAc4yV;K%yoؿpȉ1w\82=j ;\5.T ZU4G? f j*"ØU_ ģ*clp=+\^*Fm 2Q WB́\IW2ёI+Eg_PRsSI7[*iV%Qku*l 2a~wWf\&ɰ䢤|ƬL_8[LncJKn3,]u y,eˉXJ"fjbleQL.=ZBw1^.m"U;ц賷8wv Ef;{%BZJ )esY7}0 0/sLq=:R5>0HN"?XNT:F&})tdcf|80 Vx΅ "mt[nǹAa R2 ~&Ia- r4Fe|+sm@ei# c2r,45o^[s5?𸕸k>~GsҔBm*|A%F.LsS2s%1Ws%1WqI_^烳Ë@'a63qmSv$Ʌ# V{e8@/Ƿ=F %)1p7GN.rQɶTɎ2>{L+JB'8sJU/)DV pzlVc U--3R~õN\˩ZXض[=c*Kk^Y ,.89_M6ıVG4gJFMt@Yq#`3hto*ǗkRv<5buݥ;W%;oOUGZrV,c1.a =vЎ}ZKًZ#0cVXw6 /gt*lLf݀7pgߟ W~WRՠ#xi Bv–7KpR+}<8?G#hneRC6#űlF[G"e*fEjL{Ƿ2饅R#-[8 h&rVQ1j/ߞ)Me}i#㾣2Ee&f̩裗'?LjKr[9[К j 0{m`~8fL'!l+:^ԛDά]if9ԼV +,}ڃyYfg5r6vSs:?=:C 翻<UR!=?c_phq WD': FqQv&_0re:&#ͣRDl_F`( `/D50$Ԙ"D5lq.87٭,sN hom+֯4fҬVJZiV+jYͭ= WaEHE8\eR )?h'WvgStE1z:f&\؜K{p:L3oJc FT&; ņ$Xlr fOwZ1@@1j ~#𚎢=>9r 'De'PX(ZD!O ɧ+X6{!9KOX= &R@-:>D,Tu[0({sJJ9iz؏gM"=^ m,W0 V԰| 䕩eCSMr**_+_ea00kg@E^!]0arVL'P^hU`:c2܀'P!r7ICQ cK2Z`ef^EiG4xIÚēE_Tќ(N x\8Ȕ"A  8`̺%EnA-\_H`TEJ62/do't&jkPJ:PT@B)kAOu` K0Q8luܡh:OqlK0]$!TH=*#K@Oj_1qZI_rܓ.炘ݖz̒eR v?T' ZN`{' [1ÿ /3ۮA{g5[DOPlv+JP5a[E̫#n?Z5B 8ܽ1w-ͱsHU/ȹfgDz:Zx}@a ĉ:H~ b,zhͨbS~μ}yCE"B'D R.Fc0 w8: Kˤ ]X8H[J.U9l(SWZJ"]Za+-c[˸ɹp=OwގE[y'ER]˕X)<{|!\lcPq1S~ 5两ߺrm2~޺KE+93ݏW4³'^=NЄgr_?F1P*t\ߌCm}*W/ dM@Xf6`ii㍲]42ŋF6ڍ5)- $F,0a<;6e7;*,em$ܣW <1>?qj)!ػ!so>X]Y;9s?>l<{d-B؏QZ\Igx\, c InɱM~(a[yG+F>R71"]^ %tE220Jk7ʊ4AktdܽoЊ} ӖkS @]p.V[,*Y) ~<|-24}8A_H՚txr5x44J.HL s5KkQ]ȟWU4A`U3}5H۸B8!;@Fqw︚=dE61a{ ׯ-дJF/$3;';5J*E5I f;vRi. Uua!i\t"?}iHh}e-)k1;!ڶFѳݽ(}lwPJ>[ n rtcohw{{/z^ɥŰP ~:t |kڂqfEt8Nߝ=?4kXnHP`wQNiw?p~u7@@Elï"R>CJE%<~beהFFbm=82M1ڼN jӕ}rhA%>8бUv?~LclȡFwM < ȹԚĞWpaFS荚g?ZWo$Ae  Pqr^&׺@97i8/Q@d R\"{;\uRimF` 0[iq.׿%W7CѮ@Uxʏ1|ξ_;^+R>+O˔C}Dɨ-ra?wc h]֡p n8?==A[O h qebjK"XK!(ܓ;ss)d ӧiw؆afZX Πnf?MŬ̄d)'UX<'A}B s*:9:vU*h^/2a"pb&yoM0>ATrҜ>=(*}cDAc;[@S؁FgHFnwCzt"0K^mt3 8׵WUc&h9oR ɯJHP|HTGL~C-K% jNT/XRtچl&')WJ3[(ټ޴V_tb/ci6͖YΉ"8=:U.'VGX PO\Х}M.%1pNȐG%~>"BĴܫ]]Le)5`%nN<kRߩ{pEȈJwTnqL<LHΤqWr \Eoak/W܉R[明5_ F1h 㵸ڮܕ470VVM(!q3-.3 zOz%MqԠL?:m21BLS-T>MїGkO*9`HR/^(b](0$ȲB:NHђj$3`DUm4j菛F[V 2܆b`[Dk}c4;ԩU {&M2K_d F5{},:Y19IO"H?v>b@CC|R*4݆GfNR /Y>U͉tCǤ]|.j<\G%l+T7ky{2L0uek&^ #+zVB̧E5[fxJA [=@m{&>TOKruQj8\@Y]LVadx qd^'P'֖)֩,N p6… hSý:u@n;PDMpHܓlVֺiHk+ 3oqG]yJVb/Ȃ5j|K,=sLM[[ ~+27,D.7繒gU LӾ.Ž0zBd=yi~˕جXrΆb7LZk8^ގApҍ'E̞DYS\vdWxeJVKWZ@Rac-Nn@/|TZ]UPK# Dӫeh oү>/6[ng۫e|VVtrk V|u`n*zwMܭhO;&cr))I^!JJ}Ӝnv:SIF9tcjkO Opxk{yrr?(8aW4h'GxrƌOx(IDk)4.յxi& kN*fL;% \n=98qJu/Y5h{Uc 61TeH[V_z6-Çv9=h厦%Zl+HdHpc)l=n\ %Gi PQx>=i%VQԩ19>8yYEt]T(Qᩲas1;)glQjG`u FrXrS޻SjܴD̢#QegR̐ș,%P,à u/i2=؆\#%H9#8R 'Lc]MaJCb |bFf24I/j)g˜0l%dzݲ\ b0a6d͒2$V>v|6m0X-bְ0_W5n .  BO-Tz_n+1ƂF$OWٜV1죔*oE̦l\ oؗ vCxE(+n 2?fP[{0lmS2KouO/`jxlݭC𗢛lTF5XX @+&>XҀ2ˮ@ɮ /L@M6XF !/tKtvt~qv]O $G>} Yv4W0}<&FG$q؆ BG^3K;L3\Nea{j? ka 0[}(.v.v)*SE3 )@t7տ7g"PAm+83OZs!r-TfL[mmf4X?vܸnv6nﳃ__ ,w۷ K ^h6QR,j8)<ꌚԠ(աStAca;|ɝ`za|\בij4jh)a<@d# wT5GS! XtPCj%xiCL1KB_xI6\^c>Ժx`OyܿtZ 9ʼnUn.U6l/ij49= ;#{i9i&E 7e _DB=ӎ?@{JL>C Zf8J@a2<ߩ8(}(?Q%mKW eSs34kp}%eלjna ?+ ԋy\glIXtA<|Bc/)lg hs]^ĦYLTn9TQ<駘{//uS4φ\J7?JLXNYNs yFEe:s]:oAmt/^8TH|րDogB>I9YeV/ߞ_Q ڭ#|"M'~ż| s [w\^ cD!-2Yq_y8իWW "L@s\TjQL 7$ӒOW.t^) Ƭ(CpGW]5Xwq <5^(!JRS1T`^gR4EU%D44l[+nרkX+4DqZ#,CіZǎ:CY'Po?{g#e|VG?4"E=Ȁ8oҹsmҿ%wΜL|#y6ɻICԖ?&fdă?N;K^iUWly ɔW4O?:tMy9pxGJjU8SZ`XdK %B FGT[zEOW{'\ g/*Xb;) z}~GoV5wKTLJ ;汩[VH i܇ ޤTL*RlO nB5ls{yP A2 M|ن0 \d掃H7Hs#BDrsMܣ+ظ /(̝_"]l9?a5_V'giVѵ;F, zO+ǣzӳGg@ުk-&52'}MO!_P?/XxuoO~{}tGn%zl <`s#A߾;;AkjEQsUZ;2LHe<)NpC8Mt ua=Ku_%c= #DpOgZ Oik)r28=m)]117ƺZBwgd^'_@ tʅ#j T"gP`.HaptoaZ VzQ5D \ Ͽv'3H>T?zoś,Ov@Jx{>xFh(|CwAaP{jSi= -z6GǂOM( P,x*܄uf%"iAL*ˏI N~+^{*'WhRlǥxd}>MiO5`&msY®X UCvc-I876ͤ0xt?5r \k%6-`-[5AK:d`1W4?gGJyD&HsË7@rox+g=U k?-׼-I ʽoBM"XF]4]^]ؓPl-;ǟJra0=n8]mӊ|j|/`v?ctźh3fmy7`*{SFG{U2AJAXjhū?=Tӟ@l?i-φ>(Jg9d>qlM+h]H3;iL'#tݱ–+(lH%:fBS x6jwM{\aG^jy8|x;;u49jHP=td m¼NЏPO@rGMkI($>YE>}u l3kֆ x}JZE<,6J^uW\]j3ZzK7Ln͂u4[SS),M0L Ch0[&qwhG;늊DH*Ӛ̠t דM}Jlܦ&%6HzJ\ R*Bv(֞AaC?$V9X#Z-E;֌` yg3c[ڡ2ח`Nm$ \ 4I ʙ)fN{ T\AHf3]mVjRP:i{ggYb,]FVTE|FO`\vfIKy@ ֟~7Qw4@?+ߎξΠRgOF) $ZLD'uLp&C%" lVjBeГy!~^ 8!r30 -,·=s yC<,t@#c=tj 1&-D e;s!׎ w'̇ETKh?a _'!v.p ZCa;J쀏J'2̅#NZKj%,;ds/VKΘbW@fbPKc9.f,i{4 %/J Z@2qfw å0ggӆZHȏxsAq6٨88sH,9318NxsAKFԂS 8ϘsOϖA~r5Qk-hzAyĚCwx~^:xӍ8x?fQ?9q[maڑGUqb :c?ƐH h Kc 8pe)}LaXR$p]F}`kKqwpymaڑGqsb :c?ƐH hKc <pe)}LaX&y@iEs&DQ7>]61'n#-?L;²64}NlA][zmbiNl1帏),KbNЖV,@ wͷ٫klCi{WP+0uzNp7f>Z,I<ӵ!v<UǂIvxޯ'lKȒ5]lACXy]Gy&t &lnZk␀kXt< Vp/'r,B7;?@V~G9b?ԛ[-?xOu5YU5I6ld= bG@a˜%3pZ_&WP{6b@=P܌3Koz`Ō&Bt1>YBKBHڢhг`r~|7D=ۏ M2d?J䤟|gGH顓ڢhгXrCn3ZO9؃Ś&yP_J+QGi7`5AvzPL=?;4Y<}goTnUҎ)+]Ʈ)T!(T}!>% 2A:L6f߯f>`kɂ^${4dSI^&Y_?Xgo]fع^>py-3iӶc?/|ąԒ%Zh<\(P{Y!ԑ}1:Y=B;kvC)z-J2>s~c{dwZ e~r..8Vxgˠ.\ZC#wWw`,|#1 zp(?倏s?S<̾6Ѕb#98ğS | jP)8Kk=as{< 4|͝7T=j^(|tgR:BO3C'F#QX"Op? D-ѥL.ȳ7p7g~GBu\c&-3*h߉ijf͍WѨM?#eb1ɯLgdfOq0Mm{Žތѧӌɬd,ȳD""[D̓P}^AcX>;#l)=4q! #p)L0k|/)@b e>Z0g˃8m~h 9l\y}7LGX^> O W6i}q ;Ge1D:Y1jSh3=^0CL@'}>Uœv:nGAkO@y N~R}<-4͓R}5)ڔX՟NQm&8)":*O1C1#GY(}{3L(|0h<8aCSz+ƻ՝%,~K>k>  LWٞXtkbf"+kGn?ƃ3!KZ(}ǰ~|Mf/kSGꩇ{xclŒ>4ވLr@j>Pg KY>N+xi 5~AاtKf8F(0`5Ayzx7j3J#է1P&NOOq,); p5~!-e2WLdz<^pdv^qY(Qx:%h&v/ ~ǐ\1N?ʇeH/~f< (ԟnOy4Mvd4nqlT8L-٧^MS>Z0L. zzSe -78v3=nvNm5FyX=,Gn?ƃ3!KZ4}gXqUQo]x,ͣ{E{xDJeƧY_TGiyfl1ͅO_o>nV(oD!x1vECm{(z({h{kLq䳥$7a6|hw{{;RrߋCɥŰq:t7qQݛbqq:(.0gwEtwq_xL&GP%GId &㌟tL,z7L?&yG(0B+cی.x_v}/-^T) ?;|RD6q:q'؏NxLaԃU2R 75xce)]MH8z|wɟgg'Nr|AJd```Op5<(9:;Yr?GJl:89:?^=Ӄw黳ӷGojzAx %`΢ OiPj ['$H|,q.ζ:;:P{i㵒 l_<{K=㷸٢7j~^y;nD磤^]\џPG](X]U{2{ITAD)\mza=F_3JcU. Ni@ ^i*_-17AQ/Y+>PIRݠVl3 8'u).Aؓ{+jQE7OQxAuxnn?~@-*'ҾKW ='p!??_lŶ?[0uuo^VRiRx$<{4zJM`2>*Q Ah -"T9 #Q9^Wi+SZͧkBڻGqM&ϊk8``h|7 +6I7E A KcGs#4+5$ω.=L $װ0T9`BpS&װ"w 2߭Qՠ; #b2"Ơ"JϮ! ^Nc6 1+ 7]>o ,X w x$Mi⿟V2>+eo-mzM.|jYW.|耾A @D8Ni2nJm/O#GC059Z^ 9-l7X[-1c6Q$KKYޢlpm7;Pd!eI7#+dP(sy$(@)17hY`pu+L.n8P}YG%sY{؂'*|q@DNwo~<:5ؽypԇ#=t.`i|U w Go}^§Ͼ_Kkѧϼ_ P+o3Mxۮ`Wb/ڮ ~s {4Pp̰ul5<)s٬AY y g/kh:?"~ B-pI}2u X@L Nx0_La.Zoy?W*g}\ZF M`O^Oƌ=~str~_W}~qv|BSD,6&}ֹYj!y /ZCm3ݮ qx#9a.K9(yp)t7<Ϣբ4>$PFoߝ\jUx޲hd3fVu054g?H.Yנ}p~)ZßT&]v3r"R!p.xnJpAVg_`WpT,N[zܽ@/g|^8CCܰ{^1ݕ&~3ǨRX%)AFG  x;$z53u'g~feCAá$oڎoԯJUWi;Oa4qƠPx`j@)&X% / _+vHɟ%67+k]>I~$g>hfMp6L8MeMB&T78nX82U| =8}18r8cENK,ݢmSޡ[MWVUێ Į:sF7%[K2] ̩͗ZmZ/[㴷e*]czbR;}mqc5$a:ߛҢ_{ jul9c u00)rw%L@";XfrUg ^Zg{PggoYYVԲq+t~L5#<+rE1~ipOɠ(5*j3nR)ȃ}94=в~({ȩg  K;\3&{kt*wo~O)+l{m L\ҡ7vV'EBSi J5ᮊ=tZ ^$7tOm >6fRUR LYp( Z$wXb86M?O//t+L.O (MQ2Cǜ*!XjXm9J{Xu*%Q|R_$lf=^y/cGߕJ[$aeH,- sqiA*?B8jڏNP #=rGWzgFs/h]QJKn.Qfbh5,CU+׎&9x:ޢSDA>jجK-QhRto *ﭠ#( _ф`w'EVE25QsgCA! 970XH#2.6J|}^Kܪ9Zm99T8s ^f4 L 8IRYiݸ nKg_کF]O>A/~ΞC,˜~~{e M =3<4J9JxMoapc}V,3\\{(uЗ:\V2N*aaURD>QĶ`mZ4i̛X5!_T}[zq% [W߿/]Psnrp=MXB'fz&p{vۭ.4)PAѕ1r#Wїu,}QO ZME@ړ|J aPD1Y-8,s/8@1 &IM{;^΋2>o/uoT\=Nх&,Z4"qh1&\qq -51_Z~ݶnj%^^?TXe{J[g%ކj[iN<J15TkG1&+(W$Z h kFݤteoGeS' K\uD]r"5(DB,&H+]f: Os廉x΅DI9ead<4p)ٙO05t TĸI ЛFW[=ʺdy'/©KqɶT3WLC{unSIhؖ\7]Dĝbb2n7!nPzX0"z 5+%C]q*14sç5 NN׶~aNHK*7V5FLck` S ˅}\6uԋkY^OmXo7w֝-ᔴh]g-$;ޔWI QpdUQ.{gJW0ʵ<:M'%)ٯO Qf0%tWnN@dT:^v!i(u<5wG(tk1AoS,%:Dz_BDdVu,Jq5v?϶{V|Vg_J:{CQ K-R|\{]j|:#YA>?M<9uϺz9ִ65~am'?٫ꨋ͚H*^i_^gݍ$uƁS `읞98_^;2  moK}U8Daªj])d?Qߝ_=[bgά~फ:Z^ô4p0k!/usd_)Sl\SM!n;[K㝬%wSeXF5N {,uŚFJv`] L`)nzS8 g/;WK쿕7W_ٸ[@g:U7u5l,-reC=Wg9~ps ,7l t u;'4{ k]B.lm!jJK]Rꮽ66P:l258RUkAe+(~- ]+_۟a(-A7ns%l#Mz!f1ߪvI'Y+oa$Ksb|'CoD\,ɐ"vIyufry`r7_a|B:3Rj y"vXB?HUppR4iGKfS;ijH?;JUhXKW+3}:tñ`Rm'm }I1NFK8 wX(n 9P )wCk7z#t>K˲br*8q΁{SŬw날SJf kj~9坕sf̂ٝpoJ{JVDmJ <ӷHysoQU~VJK9}Ӡ?l-V#RK?hGJ<2Fkt33(>^sz&P,"LPW 5T"`1hŸ.V\I7%TK(t϶`ST(G)%JWr禮k\bUSQ}頻nqUgEI(p7`bmrGe!g*5d D&zCXuhPs]7tu3/ܪ7,R%eeEg=j܍(ЕSZx!_" Ӓγl.#\|Y'- }eSCIEqGz4wVWTN7BʑuFWb9x<Lk&E^\ҾS:xgozϷwV_K?cpVK^RˬuRe7w}L/. ?>BXśv ~$f*Sb(xYE"Pr66ѢBLP˳icdG!' mnXGp+\a .GN|9gkXr_guEiY2Ezr9khR3A:lnvZcC2m=.xřu va\7ۧb@w}ǁЛGW=@`;chdPsFlVspߚ݅8Nrhm3/P s`Y_'H~iY2 ^@6/G|>.zu/*6'Dz!^ pB/yA$rlPńd?6-3ưL]v\mulLtAyST?݆I 3JX)<}Tpa-ɯcר/gU4g&/&j!Z80O@իkT&.HR}Xu2" u.%9;DIn_;OV36H Nv 6H {&=,>\f{EG~F?h cs6nY+V=K;ҦLP:2t> 4i<+MN^;ku")zj(zm 4{&ݵM%h&D úp="bJU^S3ɧܑ"r7\zRoPmCJ cg-&u5}d&egX7&2ig"?4$l^9qZev͖%f `0DE`pY)Kx0wE ЫD | S&aޟ8ݯ/1 A?/nDчZb?,&W ):M`N柁裘H( NJ~Fb6׸kCL$m]oNOߞ]g:"̼62/d]O v1PLfOϔY+on_xh> 06g@/=iUPL^_T:;c:u2Lr?)Tmo^LF7$4?ئ2r; mo2|H Ϧaqq2,jޞz%\q{)DD4WA㓱}5Y6;u  u雿l09Z  X(dknCHO.R[:8xwv|o?P6W'x2!MGHhծNI,/ ~o]MS=isX :'"'-gPz*++iNJY**2@@JVu{Kɋs/:?wR`ե,W,Zo>ys[,q&dyQ320P=-_ns;8rTUq: 1żGWPh+2Aafkog2H>Y:gT2Zq&|E i $̓GnS #Sk'4%fOOTT5 Eݹ%ptZj%BXt [Ä`QKQvĻ{%H ~%Q7Xk0>B=0D:Orlk삡&dɞFIr.Ŝ=%SA$t ^|W_i(OgMAįFx,$(Xkɡq"*(a|3 >0+c\!l2WXMZTxg5)#`Z]^xS@9 A/; k@3ׯ $}YbM@o-Gg0r< 7[cܦ qكjڃu <;҃(88c!Yhu.{ˠ|@Qߦ SꀽDSMBcG@g~ݰWc] HW!Q>@/EsX#t ;L8Yb$^f\TiL=Tu\r˴`-EKAHYJ  scRa-?xOhnjp$TPrhl6Yq~i`HsS0L@KOPN PuRg)'r%+L0] a)V_pIhQ:^q>$q r8d۳U/d"(f81]'1iS d\7:\j  J@}D(-1y 1MyQ"ARèkVdQu2u_mGЧ0.<8z4i'qQXF{D} Q1fm^D*zfZC:FaJfF/=3;?˯_më_es`3lXnU>g!dG-Jc63JeAݐ9(SiD0fȖ#e;75xT7[ ,+_-7x/ZDΚbp4EeF t#h n/y ݝP2JB{.gSEB–kS ٺdRq82Ag8N-FA Ư9'$fbX#Wׇٌwx?i?Q|6SPE벵{"\-5,Ka1Q8U+󘍪8E8 W`I?> mSþ%h ^(/ ľJU< 4O.)4ypecȈV#A[-oLp?j+/}c()[^"ڶbϷu?(ARҩdȐGzl`0 b8!nK2!!Y 3ʺ/sܖ l1}t'B* #sDZz4y4So8h] ::0}nȠ 珗2t="$ƙ,-֐tCq- GF^ESr@.͒5[TFoAZL$ )CIUΜorzN%+g{.VAB"#ɗzq-xfMCc{pyIE{֛T~ *׾R *^.ֺN,[F'Λ1B2#]ARKTvթsR\00F~lUr:<uIυ(8'6"Gj f\9 nΦ> ^f3Ac撹ƒ47QfE*u}lzY5aVS"g!EȀ~w o /gf.dǶnɼ!9K'f̑F`TRX( ~[ƥ[,: zHUDZI7x8-tgu@AOJdM/FrK޲9x3qɰ %Y?;479/Ϳ)4ʙMBvi'Tenij8TJ9wD. 4CB~л9R8 NP([!!EF`Dk),ѷ ziuaB-0+BGDDH#}/V9fQ`OѹrxCģo@lbp.`,x2[ x (G >XgLRL|ck*$: _f({6L43|$^볂 )&_L NY܋50b/qnx!RtJ) 0;Mh, 7ey/CyS5NKxDReU(J0g^O +z;BhB[@7ݶ\Ң/ycr0@F^=L~=.?.MKB-3dѰ-WpRz8'0Ͱ([DVYu6 ?b;qZT Js`hfuHIo)rIG M̟aⰔ61-8}Pumdb`&0swG@*_78w@jV\!+Ib a2vsD6 P赋I5*^ߴ;)/Lmp(upQh*N+ڙT2&%vgoN: #*7r<}.W=+1g[|Qt=|lr8GI0MEājбuIAƣR YRe^\:qcVr9煶w#[^Iģ@Y 1ƃ}#fqlj&^<6LgVpC7g1UxŅHۊiTb>tm@P;ITVK_wIJ[c6Wc-7 `Uy\<7{<;/qFy8Z^#fFU>/nGϯ[yo?B|=pPtˎz2&«ڝt$y<T)C aO %4ӱ*Eg)$´m2WUzK)vXK'qÀY$5ݳBa$-B 1]a 8n/0XPSPF؎Eނz@A ؔF2c i2&J6u- ܝ/2$>j ]]p'^U>X'{|;=[߯IRCn4 Uk9o#oiJ[!Y`0 Vy z2c\ǀ/AXw)G0.jA\ 2״ͭ nG햬(h2Q1?YPiO";]n)ӰWi=e /zBo=<8j< :6}A{>jdz`u'x:* hBH(2AUϩkoPoKǤ_amOwx_4OW*WD ߹E C@QVbWa29Qn/~O%+ рGGG ?\`Zao//~Ϲ.s qU h 䦾6ɪm(uR1=\˜h mM[?XqE/l§ 3rB;K?>nX#*AP\2mlԹ:kA"!~KF+0Q;/Cvh0>X^H4L70N8bxq:v({h&/t?2cCi.6,}qnI19 S󈞼Ѭn@5o ,њI bM<v[!5O0,l*'N|Y薠W^riN!K}\@YUA{̋xvO8N6ƖDDNu6.[xgeilF+p\Zۼ[/us%k8H{pU)wWfŝ,.Zï#Jfŷ勵 NW ?I" S) 1 /1>&1qoJ#=^N^Y*m(I}q 9=5Op)'(1EArw8DYtuY?Sfȫb'ˀ\YL,@ 3/o#TZ#cC#Ç/GBd E=>l4Z_ݲQk2TA8PDh+P>BS#@bHCŜ| ́ p RFI'3TR1l[HXtҠ;q 4mA %1Da VИ7&Ctൟ< $ 8UkҁVqz%Aè)>NO6,y$ W'MvEHqK&@Sda4\i©)zD>"#uDxFfo]]iRrRfToAfsHQ7ӫbӫ|VlafOcA.ޙNohKgW;VJv `DJJ'י}CMTyALQ*FBCNԾm |àP6Fb)^L Pgpcܣ;=ٜץ^74Z󛝞3o_=p60g XhdcѪ6eMNh\B8~?[< 9-G񫽦V5qύW! XL84u3=ĕdҾnt andn%o:`Zp{n?)?>.4< ߐOþl*/(#{eɰ^KG2a;xanI*}ZkS4laS((xC5+ns}ȶ8NX` @sPM ^<cޓ@lRÍhAлZ T{~?%U_x,D aa[w;P^jEPS9FS˩JuP \ qzDYi!+=dX4Lٞ"{{3 [qiCa`'ͦhAhjш>I"P$Ah8//u4ĩ+W2XXrZB2na&yR.^)Pd<,eIK~Ǩ hjmG<Ƹ%>R@ãK]bMQhCLF;D CfD"PU֢jY1eWMXUz<^/-L3Xh@68{܋^#{ d-ː/_5X(|̘I8ķjM G ^3k+ *EA 1{,% UoϺ7^vN~˩׿'zsY\ᨔ <%.Q )t, a@M DSy~*bĶQ蠔~C4BTX S0W"8PAH>IWˈaN+>A>! {-e(4r~}JC'+M?9mup$\С+-1 pq?msQ&pĵ=|ՍAq&]x KN'nR]XW}YҖv1WpĞ#W[ir WqT\UKz%i8ID/? t -wgyi +'m4][g5dS@x]IYAN`a+{[g>ܒpJ<<,{=Olԝ_u٬_պk&&:r|˽qFpY&i{^rSأ K94/76|kX8[vx8{'.`>*$~0_=Z,R>5LN5}q ]Ke4-t~4( / *y3b-L=kXcLBy3P-NE0nELMEHXL)>lʫ(UR&ff'n`D\j%\죦@b̈́}rk)h>)븒$wsK[fm|zj ~_5?[yFxyS 9]7P6i8 !bW_:XM6e@75ZE뎪ťr=jKdeh%0٠ +Zo:LR$] Kj6gr }R\ץk0lp.;'шR+VNcnNe+YAQkM\Tҿ2eJ"%85) q={4IP]{TWɧzJ ɧpI,{c[k@n`fɝ/ 0J }ȤANߞsguB~PȽ(j(/C>m{Ge+O#҅i4HM8/J_ QxVQ+ne|M$e~t|i*Ϯa=n]4>=k^e9WO ཨ^x?#S;!@K,|CZ_+5mKl<w*&כ^4dH,焹-C,A mb$N콛N[?O0ĬI?F| zda\GxFg\N/}bO,Mz>UP0@-'$F-h)ëA8je9.d:4Wh @B_ ZtCcD LV*y'IK" Gff:!80NZ&%`2bݿa\@׫m/?$rA<'<8Wa+'w:wqzE:kW5>%2 &~1!+rM~`FтK#ذ.ٔ0CJhdG<Ɂ-|IFQfcZ@kdm%(>A +Q . |lX 2GB*y*-YvC2([3.kl8\a)N2D iył# V6'wPU|'~biX&:!$+()hV0Q?n}f@M> 0;Шa`Pp]]۳* }aT ;(&:ƮMm-=qv&7XT~2Kg˂WKo;'*\kAj:´;sĥ|1r*{%IAbdZqjͶy+Ƅ3qwŽ|\8A[n<_ si:Y8}2.4D8vq)Gp5sd*Arg?6< _;Xidh1{WGޅܗ$(~'MmګYg||D]4  mEQ,5>rn]}\uږ%c':?GL(+5P$pcyMwO5p`#"X0Wyϥd "BwElc0n*P㷫XJ?nVヒQ#mi*@AHqf]%=랟t6fځf?w/NI`׆S9+wsG'N<jP&`=xߕŧoi:?I=.RO,9L:b  l]G#l̈́$ Q2t.wq(sd8l-B:E7%8rh8pI&T_]MJ>&]<R LOO[1Rq6THmDqbF)V.(j[7ʚ7QHH3 3hqwwh-;0"+\k*Ih%3G-3\wJ֘|?FB<g9B` ̇{Z#$١b0O6wc_yJFIي9~7{={Hf)X}'j ny!県-?},dtV"xd ?_ã&V_u8o} 0=dX(\ &2a9B$KجJ7$+8zoB_AW VۦYu}GlKQ&t ߽\Y_qM}3&doä!˟H?B#=&/9'4Zz nbs<n?kH+r &u6׵V1cfOz'ٜΙTc)swBTNngqrmU; 빽(e`hU'hgy̌ or7^l%(=~mԈ:*^4OCW4loC0gG2.n4jvσ*__$y U9Tc#SHxA$"b>sSŞc#3ŔfN^\`2?,~Z[WG %,\e^FUىE6$h8h/ cʢfz©T,:1?Ǽ[;8.vNfo$R>`Y , & I^IE=%KpaK s.T%4"GF! !t H"OQ`_ք4t^kR!2 q?(ѢmIEφI@$]DY ,nWyjzAQcƵ [k:TN>,g1V횦o‚F*)^fRi !O?.% >tzj4 ೻*'4 >f)ԟwrP*Cf}a6u֘yϓ}(N{Jbj6U#K$2}jxb^gJ՟WMTnQLdE/9(VFHM_gRFԉR>.a|}V:V֍+vLʵ}h( ٴ3֙5d 8-ө*/`[Jϭ< _w(b]Ib?X˂f?FWS}uo+Nz8"J?ޘ0\iUy+OH "Q^b-#{dsy׼uz>Kw1q"Q3|^i{F%]TW=m8: TpSS\|8?W~lPHr6R UŎɞq-51_ѕrl f;8 Mv)=n0u a6tJԶ:l>F яbZY^?ǞdLRGK!׍װ5ku1a$Xm`n1WPEb^!C6yiJ~;NbȌB7!qX%Ȭ\")XSԾiG$R]qE8ơoǍ[SZ 76d 8te#v`?S9%R^r{$T|5B'3x_oRn~ͺnp|2c%V?w^joiz_f rJjXzʞS;P0Nק5کHSgmnsm=n SI}L qwx,"m<4]BA;Isk-V~\je`x Q ʧ ȣsO>Y,ÆD5 h'g!.Œ! 4pK5nm[b+smnO` pSY>z;y[9b $R=9Ʃr\Mi)h`O/}6mN Pmo/ |ʶz-igɍ[x5EM:"XD<MVfAJPSU?zQȪdf &C2:*j~Yu A/_kƂR]aU؉шt!} <{y/ܚb PާӷYFK*oSmsoU9Sc;Og GӻLp^Y.(24gbT|6a >tHuD;x#6CEt'6˦[Z$WrJ& ^Ѐ`y{7=ckq+\y^T9R1fPkV|sŔq*h4/2Ҟ}|tk~Txn o(hĘ".ذ *qrrtkLVN~\tFW7$!IR!*6ܷN_rd[e;!N\sFKt{/V6sU%/կQ]d6x T Zr^iY3TAbRv~4}"2 A~fxԋԂ'ƒB Wwl.s`溔MX/ U<łT)$-&GthF]1b3'm^32ˢ!Wkj 6=kZ˾ g'提 u5&\1"cG@]jm6XKM%>οz-WRUkj, ilBPE!gQR )ss/<4~,9aW]ƂKҔ (Y_$~]]ni v޻4ۡZ}dT '/D>uNyآwu*U]Q1L2P" <Sӏ}HR\Gl,>_n&VО ht`lfEG@h`S6z(L0b~FF?S{G<uGRUAZZb2ĢIex3Ε+QkZhe‚w>Jk&_,]f+՛OEL}&HJj Z4bc/]o!CmJܠ>DW!;[-&{ &#5ǻ}=Y/"),92Tf7'LZ BѪctu1~K[Fm98s&V_\{ܨe(/8kxwRCÖ6w p8 ^Kw57|:x7^ik6w6Д7d#R6C]) t٤s<*ah:S4J'y./9:n?mi?iQ%CC {s obf]%؉Qe5p'~9Om꧰*T<՞A~[:;LT e+ֆzJf^ޜA-峣KV]~NWI)W{8B 2l<)ȡ'){wzoKϹw!_aPu-_ lijK H6%k&쀅VMOd{׽,n,20 Oʀ% ޘJPK'T\sR})1j8;*4QZdӮ[/*Rօi?Qn>f^z(&@S`֎i46#rhUmڋ_qB#9Kqh@ZemPz?)^^? O{j6/p79tYM7 )20([}(.2}?#[= f֍׃Epa J(?Ra` Tz͒V `]~߂_;םoF8]GQ4c)yGXwΛog{ֻo/Npչ|8\W.om0Nlˁ݂ {o.)L*B(D °K&&ʃG/YH+4U,t< xn{Yn'?QuO1g Ջ"O9}K(g(Ň]9E鿖DyY"T񝲼)"b6%7eg'Y=qoW,@Fwy4)]ù:|y==G==؅d~ ~|O짥U*mҤ`愐M(*੝ߨ@ nxLJYN#NB9`2¤ $Fa,T \=_Ń;TS ̄?UcN^~w氬rX.􁫭&L0 +1;@",<0 3>/g *=9b,6JԬ-hvJQrZTedK~sZq _-HI ݌2KhaLZdsml!qp; @t5*ȭʝQ.(P b/Z5s<HGh돓?O[1T !4NhT{@^ O$1i'ɹ=Y*Yy$8 uL&C8ML: _[X61l-|L^낂!D,an}Pҭ͚%54796N8MG\2RgoϷ 15'.&[T$BZ^[h>6y.Pg樲\YvhMAy>%UA$*P7`p5K1{G]?7Hw`b0HH\jy=AC>fgpvCu]K4#DUqQMfI pz|*5ۦR=/މ7*rq` ͇^ueQ/eh"94 ǒȸ6yq`Z%Y^ޡZIk̵rq*P UJ k +ws0۰[=`{pEۺU{1ݝg+4,:,* Q8vQe4(hnKr8 \7GgCQŸhev΀#[IJl}iQ K2 "VxN9~Zb#Pf־M*w}i[n ޢ*>wfDZ(~x-~y_c[dS="8UaD.tZ(\bP60SB=&mps0!s:f4-PƴҞ/k쿿: ]^}&aboįv^>^*SP:bf$+5|]dn mSUc)ۑ@^u 2H%.3bc2 r Ld"PĖ)ATARUq,H_~a|9 cq|!D!|mx9 _6aKs'^# QE`["K?cPp}2a}@~GB{trsXHIN). =df'x#O/ORLp\Ht|ox+k< ?4h#v fHOQz!⋆ m‰ȶgB2ApnohTAU^]"gҖsڡ-p D8ؙd[G^X'5"/Ű@#j^"3=ek֭ 9e8zGqN؅`C9a.{ױdtH-X@/(7N^;|:G!۹s=E`HnprCa_Ynp)֠s6?-=lc׾lWϗjA7I}Za;4_\<1b: \L2!GRFD |`]ٹK΋6ˢ3^3)i< 1\6jv W{VwsV0pǁ'W?I&1uKVGh}KH}-BTcc{W#G*EKŠPG 2vBzo*. =io(Azty]h:B: tܞ~>{\= +r{6PmH` g> gU<-.+Ϡ< ŔU YRR4jZlFSۋ,'h/.%Vė*H3 Q!!;="F0;i(d\D\55͂ uL7NbΈ֫N{b358z#2P3Tfsc_r; M޸S:˹SDGAܢ?X[䑬!& cĨV tDţ"T #8,ZIIl`[}^l-$şZRQB4.~+Lpq+#>?pc+"8i\Ŗ)4`G-CjR)mqyi3|aШuG'&~Q|wLZ %2ڈcL9PS+WSf`P;"/s.r= FPQ{}t[mP<@5kհ`瘙hhH138Z"JFniÝ`Fh1Pmy2”Wي ⍐%f;RAf6G^={"rG#_^4;3?lgJt }cWi^hh4Ļ1CliJn.V]|dj4VWyaԻLNƷ0bu YwU}W+Gw5jysοs.:|c ]39$j b6f#`!w ƴI~{2,qԡ~)Og *{FWLT s3ԏ/+ۧUSy_o ?%po&7? ?\&V_%+;+|ZԎ (2|UB1,4LX*ɩE_B*d>y)AEGP;qqY(᧲j PI/z+U Aꁴp,\D>4 R  \}k:n6734FOn, )͕[ti(4~_h~0o ~J9t֧wfpY8@H@F`Ks3 8/-_W"iWyF۔@Ź\ÈZl˽[3 WH68EG<|N :_1gفωK00szٽ*'O1ϗ/ק#kMzp91V (p}%n1,Z,AК/oyve/^h/3 id)o\(/]G8}o;.v4]}F8L×!j9/voq:]!_t{7N UDEqsT87jDIsC5qwh-^M׭ FYJ,ɮ*%+rq8>Z.֊s! 7*;¢:Pwyxu}4 rxf*)o.~IRH ?!J܈Qr{ݿZ_iUO%Uħj4 f64c/RD&#e#MY\'y$h\c ɰ/w^L0yVE!U}b#5DOPxKEjg̘p>v"qyPL^*U|ޝZ4Ǡ'5R8+^ 6lxV^D7LRӚ3@6og!߈dl0t,C}&@ 0,j8]B6t >? 5ᆃQ]}foFeRZ$2[c(6%۪eƏ/?C\/o#()94JSDX{`*Vf CVf;f<5bՀf^Ҫ\'s2_O @ȌeX肕 CHmr,0Lqo,졖 P |Y0R UQ{o;F=yrO `p:1 JP$0 2@"L3lJXw ;ݐ>r@EkϽ! /<8STmE{jIupx^0`GS#Dr P~6ss D18|c3q T(rb-0*8rXgcc!^]pj¶*YdfOA >/A2}楺-+_4ɼ@ot1b~ՑIޒfԼAn{ *c#H"< CQ.zEf)p*1N]$O+-Sb"2 WAyT l$8iV&< sy/T#yFbu+ͽGVW՚kڅ$Bn}{*i]V"v&Q٘e5Qgg<6(YJlceMz Jt XB,$r 3.wSf 1DSr YdؘjF і$eG~Vtg58{#->p 3H6 ivE C$) h!ŲW)7}^Zx-K"fțXpEpEf\V̳6~QGz<8'A8fhG5bZfVyR볣J7)Mݘ JpbI23F #b9Zn\NZkgV 9&EQ93SlhjW`j!J; R^m!-0g+=h QdڡJ4?~??wbkY2ů^`} 'HYyl(>Ґ"+R8k@yȮE.H7):D5Y͌hOcM\L5:%0WLYwL{$MθLr !ɞC[^`F,j45m#6+|:û.J#je WӹKU?j; c9 bX'#j@'a$ࠛ2IQV+b3Gv,`n6 x̛<4Dց^uP"t6╠dPpW^m7z#I֬cdZf ʌ!S5($*##O%zޤ@D+ʬxb  A#\!*3SY.sDj\s@*-.()706T1 î]imKxH‘T jv;e*6(;w YBXv'bGNs|Zh\S8m80Ÿ0V;3/'Y#UP84]TFM%M a`uC,O<$%P d0 L0 ,E^s DH XYM˃'CAO@D{ uTr 9!Tz=zTeT[& X$xE:WW݋;7;;?^ |kVI@SA+9n~ZR? 礫3+-٘ <2wH=i$B㇖$ks*׷?GE+\McSM.^MX^:y8׽ mn6B^-3}/Q CkS(> 4N~#+b3 9#oLmjbW q},RYPg>xF=E+ ?E>RTDb[ZjP%;=Q2jFEidi dJ8֝|x߽T9tԄwcG`FN)WQrj;cTVtfL!g$B. glP]F(^GYSb жB[:(+]D l y3q C CS#A-YciȠ="L/$r; +-}3k&bc5`ɢLv\LMb+0.K dGzeMgAS-MsjIͥ2O[-Ku iEg'\o,#`f ?8/  X8&_lN,2LR3NiYWh\*ݺqĹB :7Q^( ])\9.[uɶ]Sv}6Ue#M;D)+X11W̲ٹuvfM7| e/HN5'I;3 2F%κםw7=:^J|85M w":-0\C6A~` тt]h$E30Yo>\]]^0}>**$)Xh( &QȮKTg%Psj4 iaCfBI痿,Z#RRKU|B4Mp6)0e 2E=f0 3Q$o՘l)lur=GS!--E X՗X*]GK"hO*^_ \d [[ě̲w@t a;D2Ն@ͯwtx긩ZSu&Ms6*&ɨi NG8YQ#Uޥ[J]rT[@^4]4EAh+Mq.%1nTZ<"<XBzGU U}=K )uRP%SAN$z&cE궱Ntj~]9ʊ1]OR<}{T-%MM}u˄Y-%[* NYᗯ2fFKFS..a]Kmәx2Lei\mEHc-%|iXK[, ̇$[B.y)@-[1]AdM%,-38gYeMF0j3XFVϠuƱ SXC#~p%HjKȶ3; LPL;y7sp5"Y$@.tgde X)6\$~Q2'0r{WH/z^A>w vOVS6x }%H'%)^oWĎPH@YS3P(b~F05.ޮ *TYP@zڈ3KٙݨrQ;ЦFuk./G!g~BrlQ$5Ql;M;~!hGs|ҹ+]̰ )ePz~(HEʗCȏK ۜr5Rz9W#ʏ8F ꚝI֜pLN{<Ҵ= ,eȇ2@la cJnx\^)Bq)),\>Ň U|L?_%8.P X%ދ](X@YaJOP)cvp([ 3Z=Vgh)թ eiD詡]V \vsXV &~~MQ7UlD^ꑞYhEV)FݴU9q_嵭TH/>q,.cV 䨡y/= em*t AژłnkzUŷ'eg=4f7E?N衝kKp;wn$s=zafnW^0\(Iԋ'ƆpjF$@m]' hzDSwl:qx?XYY`Yj7=[ b:RHǫxӍ-ثp8z;˚YGo?/~> `_ֳ0ً,_¢z ElרIqYm2\tKގVŕ`kbaw]kĭuzr+=Go,(u|Di\[\6(LZн-`;|ZnY*Eσh^\xȬqQʷȽ|E/fX)yNe$ZѫEuScw䡋ԶĿ8N 3N10w'~} eWدm*2U _7]~4\ (oͥԧ/g34µYEܸ9rܮGJ#fm! 6P=Mb7(ǼUE|^^a#h0S=hmV譀 d^J/F_|@o%  f:;>!d\BqS\3.wIK^`O@lQƁ$B;\_vp)a|f€R?#N@>\^Z e'j{7.Y[Ca %F#x>n/=4j 2؏iOtr-G5anm2t)``"lea;9䒳U̍uu*aᠶV_bfaC7+R`xU\oDSsP&\xjWgt|QY?n@qkLHO仵[e)ʣ"\'Parͤ9'fj5PS,{)nީ cޏl@lZzހp]B74˰аDgIk$-xIS!nWU"8 RD@hY8euO@f mqGK̘ÙhuŽIa[C`=@nb4gԙ[4uNR񓸸s_ %*YK~"&$bŮ͑|>p%(511IXʼ7zzs݆qi pw5VQ=9񓸴K 9<_,LN=|h4-TpZʵKoW5zImҿ/j@|xXZ\`Ln-ޯbNngg Vl^㑀J^eBG V yI]Κ WO !]ѠfWw;ܾZnỳ&~n65Trsjy͸Δ0ԩ$JyLmfTUyAOAMɽgyښ"as]ˆ]qWRԐ?/ZvNC s\Mspb*-h =G—fzJJP˗NWyU-{]+9r 2ozîS1.Ъ:/2PJtqi_S̪uŴoy1AlB4ն-az:$GE㳪tOyv\ ,ZK=6qp$C䂕%@-|A (pVl%hC1cP=(ʳƣHG)Cr8NÊ1r_"("O.!L\\KhaLfTwS<82w۸ycT~iJhi$ #? 3„SHey9 }9p2)+G/q#'b- `0Jż2:Ƣu7rVf=uP47J@vuvV#s@} "Fb*P Kz{Á}'XTV4le?nEdHcH9mw:ǥ{\'r~Cu0i}M\X@q9@:/ ّ3Xf߯qdskJ}+Fov됏#Q5Ӯ`r@Pvۜas=<JReE+lFiĀWvE\.?[ڄfzMc(}1.$0$XL~o~o#`iAEY8#ځ'='yaI0"ڊk$FcXyΌMa;1@[ƭƭJ?%[{.QHy5|Y.\i b5udf,%$iTTUa},zk cAyg6Ђ>^ৼdIL-K-01#]\t "vJB&~zML4 5y!q{`Ĥ"+J@/Ի ).2\@c\C5(B՚e=eeq}V62S95Zc?!ʾbGp|\%an);zn.FJKtS90)ϋvRQ8YnųyOcse٪×Ios4Ntټ-+Ȳ_L3DMwE4\]Ҽ\@ʽR2z@9$XL6H R=n_vYzUlԆB?p'p9WHaQƙEY'k VEUGki_JaÔX]C޽i4K{1/&D䵵5ksKu'Z%r{IyDD{{3u? (j=$|CՎ魱B|*?{h=n37)`3J <ҨNA_3o Xu]|[^")Nr.VMY 0oPz]PƳ߾wn" Hj7'ꊆH*>:+Џ bj[5!-Q%F.ـê&`Ut:Ɔ9i 䭚\BVXFlF5;yZrתUBsg7Z -7dn(P(wuR/+=0 K?ȯ0aDSQ= Bz,I遗W[Ө9{ПS b%-䴵oS7(^΋ Z!|A%i2d|" Ƽ k2spCt:Cf-?Ȁf=Nwm1X@ 7Epp GbkF_dob>+{yK {:L 9:b@.v*ux8ACƚS/nez=Tؾne%BZA{s tr˨G0ȘV7t::kщRi}yRMHyIU +I S{=Q@^BꀼW3|ԤK+.1Y^WMFѬ16 $Jp)op;<ӽxp/vqm72)E2#B-RO̻=Ͳcr D7 j~δ݀sY6D4ebU%vH./ҚNxP+aHa,3 ;P Y5qbgc !|r^|e0h6xOF4`"E!|gUWeژMj!,̝Dg9SӁr-Ż nB"b&w9gy / %IY_]u9nCʈHƾ2q?clqLqL_)~(pacHmTg_Z)rg&=_},_ͪ xF+lݑFsOgjɨ8=ɽwlG cAI4t 'ch4lr'TR a|;2`ZMAQ+sZzyga;*(4 P.ÉBWPJ36D\ia|N;? oOۜJ ҟ7}P!7fCv3np𫷯AKł- j !u;!O JKA7]CF$ll/@} Ģ?ibT#tLJk'du)E2 -39=y{xUPѓƝB)8z{Һ[ݭظc>6_)SǜZuR2H͵99EgS5Rե1ص ^@za\8@NyiăyvǬ;VO5VT^v/ ~[+Et:֜AbމRJ\ǂi-ֿιN2s֍8o)z bm-RL Y\uf~@_FipyLh=jdCٯX+6[ h>sfl)s)jӜ_0Ϛ1aEXTdAM}~zk'/no>[yϢϢ-4U [qx%l'f>: 3pM-Anq)O|8NMw:' -Pn9|nQ=xP| :Zثp-Gvf1t(yggYF.' yρD:6t+YbY]W짞'c``羱{>';hfK\xW|NP"W RQa P| V<=L|_c (>FԸ i,e ©/dUi^3 `f=0w Y 7ҭQ"fֽ1K^/#C",u6rvAKtZO6'VC"\tv! f4^Yd֌MOI:vpMeG1AL/:wqo'qfIhrt@FQXKe7t)FuN%i# C 92F8E@)bꌬ2iJЧ %Y=ً9 QjqxG?W~5:E?v7gypÝ aZW6n7ʠ}i(9 Ա""hWhg8M'D+fKxbOQ]$sjD>K $Brٶ֘1 i]$ƒơ20 d25E$ 8|;% c iZ]^9iˁg^41s R ^[tع#0r Cpm)RbL9 tvڃuMNk=^FOsۛ/l!Ⳑ ?7 e(_ߴ~ѡW`/s(St1 P'n:2^4Λ? wM'6݅1]SM JϠ×8˚#hWf])L BLʵ>Zyb,;ep@}^Mpv Dcg.$3<|+aN"Zp%jLk)em$(=1EsU좵ؽᷝ <NpaNƵ vF57Y .έ(?~CFo (`-xpI =v;xvdezz.#fYrtÕ7@H(waHZ:C٢7 ׻Ӳ-D Э<[<%SnǤE-גW"78$6Y%3|%$H_r* J([ƥ`MpuBՄY JdKnPyn#?م +&yAnHF6P^E/®_:BIuqP3##914 =;- W;"B>sf3u8yx3y5;da_/sl~];otizi`N iW%;yAI(FDJJIUPH(^8 c:pojUہI'--=o5jduc` y֜s_/k AbHonJJՊXza ,~9;A?$`P}' !gK.o;$3Au=j_T"[~w*Ir''HJSښZ6j}f' vs|e<8W\Ϋ<1귳*cEj;NO`ܗSz>EV(6>)Kkm,idiU^z;99-6=En/zj#hhv }oȗ{l"s-tFQp""?GeNh&j+84Kҁ'?12Is~Sč՛K칞Z4Bn`bM[{p",dZ4cI HftVy˷8?6*> V܇~BazRnϗ:,XSk(`N{r j~\JJwI1(})*o3gww`ox#KfDF iE֨XmDx)7)ffڢЌ?)5 ;]foŨVhrRݐc:F̉a g$u-7[2ӵ0qneUцs]fz?GT@loOUF#]2nDC BL,x5u]sLafp 4-1!:#r49f 6AH\XB/m3~5تW]WY(Bǵ+XB͢F',h1>[rbO3 EJq23ֿ ˮ|lmx[[ ,_Lˬ51q+|c3/G^Xu vN@?3Bϖl[pŧK{cE cH5k}ck@`($W< .RW`jMH= g%dD\<` I_Am]̏ diDTj =mNoFkZYђa 'u+Z,5"6w` 1Ė&򑡆w{3)'it`a&r=/ҝJ@Mh920?nz~!<\2Gy[.%@$Lìc]O.QY =>9C>RvPwepQu;>v o>baySW{yEo~J뽬7Ylhhw%cDP_jț*f}fVVp"WY<+1чܘa8#'G~CxX_ ey0(N-'OZ9bRw-9SEɣ@+h؊늻#nh6lތfͣ'FCwu|#?#HspT׋jqpaa $m3{$i} Y/6!|E׃|߅^cN9gxisj*U||*J✪h>UPOrI"n_d0˪'Ǎ!Yf|ATn =ml%>3j:щBkʨSPrƌekFr;:~qj+C7輼ic8m|l?^J+j{rkʤd&@Zxn$`*uVח!4N@yFiAa;P#s+:=.]jv,YŬpөzI'űQഴ+YE#e fE~(Mv?^p~d ͬ0 (i0: 7 0nasMaD1xIQ}ծ];Nm%#x/Jԋd(C.%xv4D{C3INb9ì,kC:>oC&B1}yy&ne7b}24& Z=ئ pG1PwMSa4@FseskAf7{Z Kb@rlׅprx2'ܞ'C-ewDf.\%۷ws՟qA ?q[9Lno7^X..}a5c)%8̺,I=AKqU}Z6= Lʖ{Ɔk1 nXqTbN_t})` ?1yIW9-}mBzmjz"=Qw`3j <:aACϦ^ 4&tfyѷ'OR=KOht;IznPdd'iڱN|L%cUHzo^;| the0={Hihu5VL\Uy#Qr#&a=tnF ϓŌDxĔENOU6(?Eǜ z@I93zfߪ^_Gaפ`'$N2\:dv3f݇LɆƔ]TudI vigyjSmc=2s\R]hVx.<<hgyR{7 Krxk_"Ww;Gt| ?.w{a&qhl<# =a98cT8vM&SRS"CwQ(g[>xFa ,Mvy RɋbG #=)Sȃ-!#BF?&a3P$ U~2Zz2ֆkhԴ(͛(%T|:^E[ gDQĥٰRO4Ut 6KwK1CdL+_"+?lTV jecە *PN GSA;QCXAǃRTM 'Sj:aF؂ډuNA[Gw|WjCU} *kHu,DhA$Sd7lV&8"%**J5ځ,Lc~vjյFoFgc6 Lv7:Jy_D0ai5e跛t{ڠk( N/>^>XG*Ǧ(푤sN[Dcq+FNh!pgl $pŖ6Yx sF|COqN>3U~i*4"C^N(%Bے1ʧFv71PB򥑂4r$^T2]T +2NYSz5JI#T0t,~*x+0Z ؂jpj%,,ĥO c HnLw9=lnlloO.7b.(5NF4:/)6(UFmqP@7[(CR  52]fv-)80\WQSL9DnPAlrS!\Nct0p:eL . Xbz=ȩfs̾#t- Bh/4e ?İDd^' XS}_֘L㓪Gl(d͆.135ً;38042ɹ JYǬ Za@(Ô6@` ځY ɖ.~|vQG*m{$ [O;{?3{l\,,x^xznNŧ uM>^xo譎1vja ڷyg,,_Ϲ1deFVj3ǵ),"xK}f2jPhO-RXed KW`Fޘ9x;!9 v66;C5SL+,ͭ1uM]Y*3F:jG1(a0 tϒFmb:JDyn\Q-;;BHc]\_Du:S>xlՠwHG3OFIvb`)+ XR3a;aGXۄDqXO+%"=/j 9Xx*#l}Bm\P/\羆@f kW 炎DSbˤ뎯ZtPK`NpYb]P ZkQ2sՠ{CFikn_,Y՜%;~qP;[pο>!kjߍϟ&ɋϞH,_wBvB XHK 6Bc7{9f<RJU&Uf0Cztȿ;qonF _9tmkIoX>02vc Z ^cRIvBFz2O%<Q҆m`ʢEY$)/saNGis׷濻5?Oϟon$O7mnl A>OExt-`w"հ_xs[yD2Op*@\`WeWXV`7!~0+QO[ t-ibV۵ Vn̻Z+2mkZGQ %U؀9.\r*YNHl 9L.a*SZ8=rk|БX}.$l;vYS3EjZq=r~'o<˥ԠpQr։HƓƱZH9Ub2bxN2>4adbicvHPjWhCh25 |=Zl`5^ow=ԅ]e3d74k#}Htj yXW fJ( ~AGEUQX!ƥhuާ4ձ.%cDZ:޽j~mAfpW[Fnn>EWbhZz?jHYj[υH 0S dl#AЇP" XՑvq^C( 3Rv S:;Nvj*u#$75y94h˅`SF$Eohv{h[ctsRJN1R0zl# U8OFȉ֒ ` okbCieckS;һýz6.\۴#pxݚ5THo \A.#eR۝W ^28c$\1uv+Tݿ=HXOTZ;=IYzrRV#ccwp3 ֚ Nm4W^$9*T)(WY`,ޤWWb|Gn3T/>^5$7d"QiTDrʔ/yz_##7۫θqA![" h;D7pFaI)zq\*5J1}&'")./X)Cn߀nT\R(B=p}Yf5UMwNkzs)!I~9$CWGF!]8y'ۄ"QKf!!ih ]YQӗ7%ȶX7 6߱`8'6*n1 A(7#ƣzar_M?^a9: a-ȶ$Ghtxg ' DRMR/bɛ@s) .G 0)ڧSYp2\mׯs9~[Ѫo+ayO˓06j0B~:9Y>zLɖ9ol?[Ⳉ/3%Yz\;uԖ Z^'cC Ȑ19L"E AfWZ^A = ׃y2u{-->&YU!+@϶G!WK%־(yY90ɷtѝ|cC:"Ǖ|YVxݡkOmLn)g}wp|ŋPz߃_e2l*cayE^TvD l&n= юEl)HK9Ԁ,qH1kŁBH %ńט1(t ϿVf߅2Hsy_7|;W9WtGto-v2j9%a8F9,'JGL%vz0^<IV OOD`g6@U+T>E],'K2t"^ {ouU9%SdιAe5qHd=94QI22c`cN+ٔX쬭j%%P8 oC^ͨ0>]Z񟍍 !> o.ÎxC݊c`P)}}958h\NƢgC:a.rlܒp9GtD3D(qJE\hѭo=1ꪗ{:~=1wPwp\**Kdl3ɣi1pvߢ1!?h&m2׳S^l^}jg92;oD^+!BuxH"-a!Zj=Q/^)fm#wJǑG[Jb?xk"fyRR "sߨ!F[xE9TVsC֣`B [͠ V9ÝO=0eF牾̏~\h OKT34*q]"`9K`KY%Ӹ#o(\qi,`6Xi##9Q/c;qc8Vp H8N# _#S ]Wo}q/H`,cP9bn9I[Cl{d+&h@F$j%<$e&n,vva_&m4[g#+ge1r/ѭaT2z1!.Μv| UZm̞;d+}llEK~U fȰT܎fHXHNS (Nײ{BsEƭQBb9 2+=u<%!bI,^3:;Pi$I˞~⳰0ub g% 5Ԟo~2Rړ#ٯP/@.֎k4"(V!Γ>Hr֎ ,/Lɢ*K´QǣRd.E %]Vh>0Tp,I5 "\=Uqy53 } R(J?2H GXs<8>ljr3qK5ww=z{Ý7jl, ۖ*+FUʝ:,>$O#X*iCqHpW؂V?27I(GM&G%/ Y#y"KC%FZ4vc[b̙{Nx-ͫw?5E%Z0hxlؼ 4|wpfwg?)$[ǿ 7^583{Z>n`:=`11eT Jök{4L~fDN{j™}!쥂Dž+f'>l(d{ q<6&{qoSWw]K<*/K"M263jtV9-_õ٧{ =E0:X(n`fG'U~:\'hC èt0fB a!mP'Z;v|B:7p[S=MbJgvRUTgd:jy8L"Rέ)/.@rdѸycG @~ZrWP60+QREC譥S.Wr.?ͫ Ϭqql&/΍>7 -Uڡ<}-xr;<?Ko@^^%D4lz^6Ңf<z^!Ww/K|B3Q9A׾45^qO.wF97%&M5&/mw!q vx#l #$FK)t$+!C[2#*5xʖ )T\ b϶-2S4iE3R Z2׿2\bVa'[g_Y'-JSJn X@&^8? B9;<>)/2X QM2OYjJ;໦CP*ʪv4Ҿb)gz1JTߣ9Ěa/0$jk/6ST;!wɊ3P]xRwdձq9ey+13Cd jEJ8/3ŝvk{Tpv+RSi75zDnj쮛pgp@,8FʐQ|@ 8%mYiDunlz9e&oTԜo;)c*@= 7=TlGU.s0(njr9yW~lV(ן2Mgc>}qa pZ͸:Vum 4~]uߜmw3Y<D-$sg^|p!~u rpNߧl?}yzrn}{VY u6trY guY/AijB96.'gA諤Mr?[4zde”eC07/صǞ{XuIܩkbm{ϯ/7۲;4b&T yE+A`0W2qu*Rk$gѤb8Q.6?j _c<XhNdX&5͗PQ7Xeμ`Hךgcm{ @M9ZClu68OKj#>2ë7{D.0Qk:Ck6W+k WB~8&T:bI,3Ih ?(CnrFUO\`1 W1cCiHΣY|X2 E(ZX;ˬ|nI5K.c2 0x|: ԯdEd4Ԯ'DȗފGljY!UcJN9nJM=w/G@\T^GKv*=+kwۙiQd$ܱ~#|9۴;/Qb\򖿸BbA$MD8kOtҜ:`HҚ:\{,mV+Hma'\zJuX&$;U3K g;i3+} %c4[w"f B ו~;kˆ1u#)EM;E(v4"񐻱8*1^&yxdBhdLe8t"Pݘ;@é ԃeQrvt݀E: M+ZF/Kai,^!̿wGÃW׻ý_{GjKC|ZJdмYg+ӨOP##UcC@iz7# _e3Py;tyݰqEÆ%eːaove3k5aUdt1-u0~3ndlk#*8f?DU]yu?ާuNn9w8-Mbn7̘tِQ wG}J3pSm02Fj3RPn*}f҉dug,QT ΂3O5;pTKE:n>#. Yr3̝aѰKj\0R6C-g7eQ ?F-˶Kv9_wk"sZmOV F'["?U~-/']NudFM]>DLcqz^AΰգSN|^D{#v5,AA>"*X8嘗{{|iF^_G4/h\.Y&aV5u:ORn6o#kCDPR0[K=~q&\NrМ~6 %1])1"4ܩ^*/ORu;*V6`_A'~@suh;qxO A[gka2vᲑ3f$g V-Og^=iLjQ*pON=|M.ZȻ. #JL3s;g8M[T, t)Ġe7~,w끬'fyVz ymKʰf^/!32uPظxK^x]ﴄfByÂ"دvVΛ끤=ɀ4s,g'$7 ~ ŏL <ǐmόGaz3ja3do\ 9=.?d+ CZ'e V+#qj6%7>\#=u:]V3#Er&<\i|b{D\;Ȥ_Q\_i;w:咳ѺdpO2_ÜFf'm3#Wb#P8^>U=1 ppA PP#P*^9xu+\Kl}-l~mĶ _0ZLHsu: u`;!}5ax#R. OKQ\&eD夺!Z A -8z} } !huoQKHE.m| h sF<㭛gO-S/ws:nCky gQh~ꙗoXȝν4UB244XEZg0-+hgm0Fݿũ$=]Y I0Or(7$&@+d\V]߻8ۤ /M|rvgWKݳKb egE6N_X<g%MSXjDVZE (VKҬulaz7Wܧ_MsY_fYir_ H/}W6N` vMOrZ"n{Z4ԒKV"@P3;XO4-V簃nx? ߶>ŖXD(66Lêp7'd3^78n'[ r[d_*SL&ip~9`_[d ƭt, \ @aV3g9H<^cA)a3\́DmHidB@6ZnueBF2`sڬ56j 1aB~"E9BJC*(BRJ|+7r0KGP5>`׵62LAO#ةp =N, [d!p$D)8&OM֭LJNKh @'fl"HQRo6ƧkC;1 @f!Be=ʄ$2 YMӮɭCXkkUԹ 8k2.@:> er_ ":JJqBC"yhp]Ҝ{~!HF'*5n^]l=9n휍Uhh JĜƔ! I,/ фWE&4#b/@9<8EY6twg=y)Ii_H"{Eb%kmmLGWz\^^"T/^*$uB鸖{ScHƖi#}~nt$X*_. uE,ǧN M8zIm=(òqq+J'&kv3+N77rHA3.;5[) n hUV_iGj]$AXYPuǙYgk`M IpyrVx8W8Y8 Ʋ*\ʢ"ӿwzsg\p%Ӆ:biNl%rCIQnN8BdfPГxn?.+TOM6` ^vYrکys "jB4WClMKD~YAʯ4aqI~{Z$Pp0Ϯ,㎤%KO+_Z%[(YpxV ZKKk]SN+`]8+ĉi%">#-{DKXmk30)!cL7+P1xsRS$&H.wB)H+]t½]rؑ&?0v~Gzo#YM" , % i;eL(Wۧ}5~EOij˂y { -! HNY\8ň $:U .$IY&DkQ es?>J B)*PGIj* :9sW{I3ІFض bwgyژ2T)7k"*qi݆w$vZULH̴(+P!8N\Z Xi$`_)X$Ctj. mr6mNYi k>-#`)ɵzoP@Hh'"3%ډIUgmWX9yoW,׻"Ǣ K&x8H`\.;ꥁ$ሗ%Ԣ#2c߿7hd P*ѫ6`yFxG:e[=D…6YY']Դ6*$%(//|UV2#n /.r lCK"qȔ* 5VT]Π "0W4?!/ge%=l5 gYsPW38- r@X7ݽXE/?jZ,,i 5mw@|íj?gE 1?߹X/0Nv!eUZ >OAc_vۑC4Zm lel1ɋGZD܋m_Q7=ET2/"yjҟZѧIX/_ėMѷ?2žJ !H) Xl<]*:p% !ti?>fRl2 ÑuAC"鯇(N8٥O *NX+efNs􏘪^XkP9u8H|}[B# ءjϲX1]އ칋~Q 2)18BI+]!'E*+a‰(Z{jE3(Xyqbsa;Kʰ G_H+! }i34.%tFp1 C ,y $e))`d]k[Ύw^[%%tB|_ά~kRu0=!7;W{_؛3rz]e=| u@"d9*VV;h }Qq{UyF96C#Ӄ]{"32P|>cNi_ʑj8GK%vr*4[ÅO!m<}yoųC| A# fw/D 5%RO*?;oU02ډPMipap8 xM{1xL cT*ho$@1="dј#oc#:G{J(X7$r׾je3PoY><5%RaR.Y[|ӗEg&R }CVQ(mPzvqʸɴ~0B5XBUFS#GiTٷYq၏NjN4^; 2cG ՛#T; MUZAz_Q|lKAͮʣX=vQY72VoB*ځ/u<}}g,rEeqކ09nZwJHîUpEk/*c̀ODpǐe;yOB,Xrˈpc'Ƽ۪ys>R -I;+vYoS8X5N>3:l~9K{!H"dx)͙R^N7{i/w'6&Lk?`,|.=u,{~zdibןƙfz_cmn> [[ ߃|x9.u]8/tH/de Ks@֎!@ZD\#-`'A(WnZib4P6Xm C!?l^~'(7<Phd*G9wc Ҭu{-?d1{;,T sjFrmIU}>m{$˻%pז=2@Q7yB!MTeeeFDtĉ g6릤aR0",]/n*; "meoOLξtN.M0WRo֟!  7OꑼػqFFBg{ v:!>@H<͂\Fwțk;t4 JUnj2m;s*=[ iY@ fc$Fg+}!vK+}{` F>2 NtU1%eI huAQ%r;[2E%;@I2;ǃ|uy:4.5b'[0~M8@uso˯j׷8^# /Gqv`)sHQ(K E8Aǀ=(P(:$GBq'e`p[3*U:Lub>:"BͷnFb0%/cGɋ?Qk?qwM|8NKP(w*j$EƂ`?c^F.+^pYu蕒0h,6%5Nkǐ5\9<J4J>rms90.K e.I0Ձ$$(@--:wDF={{AmanںOT H 8~prB=FY1Ea7/ cMN>D6\\p矾KgsTh"/KT. \F(v~HՅѪ"KbKT C•m狳nT|4GG.;|eK~E-J;ը/}[#(‘d { G_:WigGm?+MMxedq.gZ.Po=;Օa1=1)l,WVYAFVY ]h3L}gW#=+%+%)y` BKRn䓊NVڣT\Su[- öC*aB+"E1TGu8sj݉1zui@X!=8-;'#tEi L3B@Ֆ0``ZٸdHW)b-Tuc5w.fwQ/8qՋeћA)-ыZK/jQq!no9v3O͚'S[{C.q-)r)`짓#\~֎І'n#~ t|Qg"&Qn-Q/栞J#hV˩*ajHi9Y=NT;vޣBc9:zb T$؀*@*"e2ZiQF%CUAe w\G "KG"q-ܒjqpL5i>Tn9Tw6s|Sq/ m ONcb|Z zB]wR8>"{7` yk@zզ68{b$?>1n[ĚMyZ#sd>4˛2}y$V+J2/(GԞ KqNnM˻H ;`nkV%C! oQɣya͠^>qQCqRO9ҭ_`͍㻙YL{UR#{chT<)jAq2@/9Uă#/eײ )xR1IVfn$%HQ!!ʩ7a%!n^*Sȼ^\n$<6\x{Y;Յo1 8\t(80$G$6Z(GtI|J{ t +D^F5םXJp]6)`K 61ވN_>BY>.I1jw${>7U ZU: 􉪄ψ@tA(7fHa>ZC{Iⅹ<mЉ5tj#!Fˀ088j@0@QCW`4piLY]: &<<AXW8z<)R1GR+➰x:s}Xl{WQpiG4; Dѱdr@eʨ&Xi<]k9Ӣ~ Tl̘fp2+ pۤf(͛_Cy|k%}A<בa'tN&<Qrkmy0.xfA!ѭXWe| K+JY@nyuX1TdðjԱ/3n?0. p" }cryմ7˽p6愭/ "2zRlWШUE+ڒ f B28_k]@, Han)A j ; A!DFeΞgA 5`Gj RՖ T ,60D׆]GuK:ͦ .@#>t  Rd4ߎ=/uͽeTLLq t\lUmp5JQcm@+{~%3TȨ{A]OF"@ AWW>GFR m'=e-JciFn|[Oq/`]~ͤCV`y$px"x/*;4;NB Wu/qe_Iok)W | t0Gv(>7$;P[3''1պ*]D^3A$2{{zC ͼ־ [5F(ۂExL. 8tmJRFG1.A N EcP$& /H^}Wz-9_ 8<3W3&)zjb~ȭVM_3~i4]cUCz+i'|GٷMeV˪T3CX n{ipm1H;8^f4۸R=` w;-nzTdT(!Q\Y9vC?qrB]UgÌhҵ)NOd:\:_x0 =4YrZ.ZʭSsAWX.4n=| zk#I7];ѳ#C2 1zwcN@c^U0q%.ej j 8t<%y _$4oׁ^< >h x8$o]Vծl"l06; ޟ}R4gSSam9TCC-H]ӕ({a{g$pv^N bp<M67bZ3I0]O6a> 4d{{WxԎƈj )R]\dmR6moU>ȥJ{="̥u7<;Y>o*kԽm.;2&uB'%@+ZM^m&B9~6ioTRFOG8F- m^yI\D*?.@ӷ2%2'ɂ"!^)6T_1SAvN-v4?o Akcp5?*+$њ 7 9<֏}x:%Ѥȧ *ͭdlDv EiQ?H *R/qP7݅[`{HFB|GBYl%5yYk|Ԥ| n.9<5ǿ|m,}#vK0iOe|Yyger)\:Q T;̘Cul`d/ZTe> w82ն[-VЁiG(lwiȡ~]W 2Rڛ]҈ 6Ӕ6ۤZSrG *rPv2* 5&e S*"k>ˣLKʞֽK)߽Xgqt_m]c,IM.irgQX>{4bpuhvN#eVfaVmou(MzR]~p"blp<`x*%1{Bz#90~Q[:W߰Nv&ѵZ2NwzۨWېWKJ4VO fimEi 鹻itx~1$;78| WehH\XzyTyy-H1T5)CBmM]w,\ϒ6CI~Ml[307{e'Zs᳤߃'ćohb?JpՀ%z/-ᠻّd5THM.sVC/䩔q-%Ov OcvNqزʋ٧u ?hD6,Q(  F]99Zhu;TۤKtC¬F]6$D&l\f<٘kL& 7&"gjGdtVZݢL2_vAP)P ]@:ZjaTX GyW1))̶C%5gڡ%w?y$d6e(q 1tO67 F8a(vp;k] 컱ϥZ~_ںFgVO_-hʗȕ6q\ ]v Vi0#t>;+HJC9lnstKva[˦ƃ߮M,V"$Fc'Ǹ+oW$ v ļF3d䨭-OHwI"Rf9u4m&ZRϴ+@{L2⃞,Н`aK? ;s+Pt^6pw']&MRd**_)՟ϊ; Xi$tUk=:.iU7~Fjس$z~b^s*߹ʌX!wʀ*ձcC٘XO_# kV}7@aӚN$_nQ'N5O9;䢚%paJh15(/ŃŲ"]6Eѩۊ'Om$E,=sxgXj} f;)gں&<\fYjQW %vEd]"BS]ce_×D5eykg ;17OR@UcA &حC2$٬:E^Xn^(mN܁ a2r ~{kk1 /D=$+:'I:- b{?Ρ\=n2#w|F/QW"M9\Ik",5;s8.0qEahp@8=w֕NL,mwf ɒuAz=4,n]]6%6jIy:D*ll76 IÌנ}R{>oK !5RP3hu:+5lgfUID̂KAzAk?sUq R:?U9UpTv{Y11lyr JG:f_T WRB:l0O˦A%Es~[~>ijA/Z۱е{QX(>on܋/~*-@bR! [R bXE-ΗehE]H45DaǡٍRzf؍aKHfjلHstp_udEaD՜PHK@V>),CVa|à 1 CZH-ljpzMRfyUFkH"ހo\i>2g:Kw&W = XCri$y+b%6/p ܰ;}GJ؉ZACCYCIЋÙFSRG΋1h1E'޸DR@4 Q2yeo2e6kӬ^q0f ߁RsbUx~lȼKUU$ޯ@Nj#^wX֎'@jkj>PǮ&ӎӎH4 M瓽\Ҍ $EH}=b D/F<.MT\kQIXl1v?zJT/EEiRAK|]Bx}:Dt+~DnjC21grAM\n{7;H)W>q2y {ԟÃCGXgȒE_lN MDI "/Uo<;- $t.o?0%ْRzAtX+l%C48;f<{LJ<||Ƀ/~w"o\d>O{U5?tZ><||ć۞f|>6XUY D})u4ߑ15x_wJ{hoqwNUDegԸm$ifg@;, P׶'*sfuy^Nr3|vQ!6܀k_tJ3@?S:̋e+CUF־|WL#S˼ qe5ښ^Tl_t*ڣG?x?~ô!-OŲ溱e'mcmGJe )~na@C jzڭkN͏0+ cFG%nLmv*SL3*=nZ-kW ?>zhIF" ??aMI'M|>X_րLij+:5' SRoM;HGPj&He#,s C pyLtRY":@=D~Wx!re_1G>j9I8хj,`m]Cq Mz%X2 9Q25wv]$Ҝd=_Cm.p9X'1oYq&3TʶCdb]J L@pxs@EqSd"nZfcP]:`$y n,ҮP_Pz'-8Dp[A4 L(2t$6j͌2ˤIO-rOM_`g|mnrX=TuJd|>LM%=@ -P=96i}ЎA1f72T!Gjdn{%cPW,ltJi^o&?F+iN$.xM J .!GvL9^Zx؁+Y =U 4m@b>1VԒܕnxWk%FCFug|?)v%;77ժ,&T\a Z4$u#{נ+S/%KLqU;/"r%Htԙv^UVlO9^lO0|umcX,i#B, kLyd6"=lrUFH !;d)~ >ۊ>oj߽xM&MTvh*Fj1aS/リ;vm&pjV[匴ʊ~r܄ ~B64lٵV]Scz+oz)FNK e~k\emR} Kp5$Ոl/cIYzc2&.:6҈h ϖϠ]t&f&+X#?yz<6wztn-u]1'/|>lIK,_oIK?I:'T{᤮$tgvϭxby NSXXJ\>oXb` q94[N7 ,݊_"̍t0*G1,tslN19DF)a2zJkdhoМd]Runt)`ZY)Tdo-F43n1 n5s?X=s}KoRÛ{oYmHllEҶtRU{F0aǾ-"sL>eX ?MEV,RNf(T?3ذl^@0K_ΰdQ 22Qʨ(XQ"؇\x*0OI+&#Q3l9N ͬ4 79h_̴{GIՄj sf1]cYސ)ôOhLjRg`ߕekC^a+QKB?Bc"5"_ǫ|nd)>{x!RԾU=h-/leajrpb(nTF(o4 ޝMuJ( /$IL*,Ya7aɥ@&72eWFsT}Tͨ@fODO#[ÿ*s݀ү,dDEf`9|!_Bl.n9w5E 2- [e/5~rO 6O(e}N )i(Όj:An*[Rp EOeKvaCG'UNtr_2$i˩#ĒEIl,i7Ԙ fQ 1q, q4y9O898c3U*$^nb jK744Z|gDY_ )mɞ#sK#T&>F&B>zbK>+q~3yVtms~ ^x!/ܩFٔ@i@F̧ia;zOԲ%%w3+Gj:mzbK<_0A<i+ӱ5#Xde X2'A {u~i^'D Gw2κXHKrzԵYvV]xO!tmlX9qI]= mƀ⓸_Mߠ=!:;i~roRJ_kuNO[WIvM^4\5~`^T 7`rMG2t>l)GkD%s2Yxƙ\oS-# /pqI]3#ㄇ)y!OHlFQ'bt̎2%^n:ٹԞ̶<+e<#@NZ;1; )bČ ŲӼvnج>^w`S򱺑,<++kIQ 7$l4B%w4GY&vn9Sqq+~6"7q` kߤeղ% 8nuäWjuM#jnMÕ6JVi+yJZh5ۚ.sPa ##mYl@t,\jM;Z7Xxzw+??Iu>W@:9B acWstS,(kE 7Px"! dR:T^#؍׸O#I5\E겦Y ieB"?PoCtjn6ЄV4<$[T6mVf8GRv1YʚVU%-Zzko0s_a%VvD~qQ\Ӆ3لk`,d]1vJrC΀ڗe%2%?Y 8zcmr02'N= 4-.K]Xh#nqapu57 /w͚66㍖\4)p bw*J3R0\3TErGIqOoEb|ȵۙbw"', h:Cyu(s3WyC< oQ-R}[j C9'Zv[.gBb:݋IªvI>J|+=?(BuWo oK5'Ɓ|leMl66+޸TI&eM휄<4HuۧPDNEn-J{k 7w#}s>lTskZՏy(CCZb'F>ny:@kاn(] wp1˜nϫJT=80C`L~ÁI/$Q[d|A6W6ƽ^CnT],t-Ri5wڃ}XXgLa5&plӵzȵ ]sP$92fboիQ"Zj.%)9!9oס E l/۸ppז;o_rq: v/钔&>gL)-Nx`'g[o0ImZaR-ٺJ~nxLi4g^{3L]C\@s<kFi8@Ze+Pg/P(ۅPw2NE6[Y10HXgtP‡sh:0 Ⲣ'ӼzCאV2g>uF1 PSHV"\u#mGZjhȏJiWh-4Ϲwh FP׍$iPɔ 70V_mW_=(J;()%8{U94>w-i} lmۣyz;?f-J`qޫRGȏ@Wvon%~N>MFʾϧ|@M+7;8+&+CF֙ǖ:Г-9o$ 6N:nD6R(&!AьνLu. ==}~ɣ )sQ ᶿӨ@z sZP }|qԗ3 xƗ;sكg?_9Yϰ {-]Z*%C {@v<~TWT5yj73p<3 O៓n]G ,\1aN'ħupFzh'ϩ3ݛU!WZYR0fgoI|Px*W[68vOo湟3{>SO𺾬[]y3G,Kh/G$Րqhfn-gb?=q;{Ge W [`d [? (Ϳ0D%Q*S$ پNGv4~:Ă1`gyPT40}y}k@10G}0%)k.9jllvQtcոᷝ/ e9[,m>,p6g. Sv-D81(tҗH::MTT,{6L'<.jhۖ긷 }xqo ajGoF{aypMm[C/%AIlΒ;jn۔c6ndǔΧ>aJ)PÃM|NnQ~l6X}Rz]RdQ[_׿Ize͊矶nԧ_ A0YE%7J\@s`UBW%7j@ǝW3iIN "l ._m^ݽGPqصXvk(Mk?,R?O 6e\tCuCW絴W:46gQ%j6pԺnI+4qVm3QOKi/bUok0&D$lϷc(!̓n Z-8S2JX*Ӈ~䤀F2boO%3gfVg 'T:csn0i+O7Gn%5y ŏb hR{;rfsY͜X~Û7G?ڶ"EEFyR`zw`E^rWʘ @3BÄ{.Аv֜3p'6yZaܙ$<}cJ#!7+aD*Y%)EzCБ6;zDO/G?@t|{7ǎB:ln6BU[sبDewy; D__%HܱFaU4A[ô&l?^- i1-f eQ[D~'B.ASUV&R]\?/?u 4O_Ȫbù`t .\x PWG{?K<`٬q9wO/ /` N?#R͜^Ϗq9 lcNG M3 {姘e-?];4bGO)[q4t^5٢\|2+-/"Ugdl Ko0#M(Ȳxgyh(L`@lJB ȡay ڡ;.,@8T]7up߆wӕ$?JpQB{3:?ߧn7kvm\[LhW&>窓dayYg jhd:f32`;"/nO (e&xzJׯ}#+*;3"o0/A u:G1D-䵺\@$-;.zAT~kznr]@ӂU+3|ϲV~92qC~3q1#MB:NH&H ]q1ʥOg5+Jq/Tgcl\`Gfovچu11N$1%@)QԄn+{8Ezԑ =mQjӜ4KZ?<`J`XVxـ?5z'؊<_PpS_{;!{y9Yە5 매u f]`bzpg)NYI崚@H{DY7^!,Ɯ|,&bMĮ첚~doK>-DtfZP7EOm憼͜~8bj6`˧ V=lQEjR`0SE5YW 4A,VWT/[jUqm}4(.cռ?lhT'LeC1%eD膕AFm{n<'ҋl8;9]EIh1j@_sJv7ɮA.@~c p+2DkNB{L5g S9r~+U$0rC"&|7KdNMjP5ݜklrxBz㣘'v㜞5Jm५UN"Z+L:wd Hٲr-8#ȱeJ.cc͸&H6%7 ʳ@z]Ⱦz\,O:" KD-(deʎ2[m*sK*?:OG毱!G kY b{J"Q$EkHz" O_!(PjӠ$ZR$햒ԵȞh^k% nYl`R1ҁϦ#t.^c8#6z'ea:k92L:AR熅zlooOB7XxT׾D,`all*"~d8;;ǵq3y[ s"khg<P# 芟`cqC^¡mU|`fzy fwNh~vtx`l@R)Uʦ~],+fG$npu&HFرS tHyZG20%|a@غ؍R 2`BN|t# n@ uvT\b%UHw,fo{™r4xx6H3 3UI`GI.]ޟH޽Romp 񴜛I/T٥#c )Z*oa/]Ĝ[ɀwЈ)cnFԌAD\*ݍُ8?F߂==We##.."ژa%~|*, a >TA/d{_8ci4o DCޜIm;$1Z YSyD~bnjUU ٢GKf*dx{*VAy)zA7.(dt݃wq|mGQTi먴1ޏ3{{RIJ6պgss|C<4/3<֚"M T$2)"hlCL}cti7 .u֠:] 8Լ品zְc&X셴#o~M2x*Υj6jMHtH +f/a4J5ttX(}RoK eh. 3:c^+kI! {/KMO}o@l[̅sNC 1U>r;{Eern/bN;#!F[%`ہ7){a't}ٶ%QvLwV*aM<ťiSyV`dJc:gi,a=gGLjp19yIƌBUeU>8T$zCnŷ65A04;z"QT55UYrފy H=q>P[a1zNb atI߃G_<,ٮj GgylM#1g9ِj:60ی>8$ɖ,  oŘT09YªMOA0 = -qFb.g}(L_fr]ș7̞!,Mc yV+bF,tD@噤yY.6k] )Vj ҕ-۫Ԃ\Eud!X"ꔰQC'tlB8nk"62o\I5=h}0Lpm4}TGKԳ=ݠ&tiq,ՔUY3uhfc2ӲJ'[Z>s.튙Bl7"05cY|V]}&}שּxzp4Sh@;W9fcb6zu2W*GW8~`[.iĬN狡8&}R$;ر g)E95&Ql; W8,`sDi'Zp@:aA k-9v׋&gSvSd>۝xvˁnL魓3Kmlj'}|Tb=5CլY؎Xx䋠l ):iTjDowWY 4je^ ؚU6:SM%TB)E`mG¨QM ˃4 ݍ{l uBkoY.}=&Qy.-aZԲ.FSGD)-X}Uh@֟:ÕnUE?ׯJ\@Jԙ(6:ly0%oKj OIN_RoAU(sut`oW@)7*gp^m _NʯHH_y\ݙ`TW}]; `B=&.&z|ox/͵݄UխVuEEf;8]\",S/ .;$e!=Ʈ}$\ 67[-؞u-}Vfal@&6 vm7fA]m.Zm'DZ~YRWyF2^h1Z[l’(|G6ȸzWjg9CꡏinڪD].[cLMMPINWqtr;;-{~Vy St<ظ˯eCA쬚ƯxPʯ;P9syRR+݊G7rwcJ^F!cc_Dc@\0ښKߟ<8x?=zţM| Go~֖ߣ=كO<}0;Ns{Aݭ}Bb`m[H}TE"D6ل>)kh2RԏTN8U"ow1O<(-48t4}nQ'&>hGA"U;<R Eқ]=膱Ultk#pylZ:[}s{){QpZJ>uOCx?28m 'Ad|Jk~3e%(5^ l5NCu瀒YL; 55WJ&[Ec&33tovd8H\|Z Dף4{²p Dϐ?wD{YJig䘎 L$vZoyv͵Mюi_/#NUŒ7QWPb4`GRIe:^&1k߯9T}^}a9|4+F8}_cm(%WQVϳW6fh;,!l2: z[{kD/~Ԯpm5z%C\H$݄JԄMXdªk_02/߫~tnU"`CrZIUP(S+[H [c!?ZPFHeMn OE,?qXF>[o; ٦^e@7LGJyyB# (j-7*T]DZbV"}:#,+O%Vd[{eX:̠bO8{k2̡.9gĕ -T40S#_͖aZoXԨXAlU4n[fzKļ%%uv'w̨(5RfS6u aWKvq.{@~0v<cdAȆG~ {nb.((^)<% }*r4l.Pɑu?۳!:Ņ~-)1K ˻Ef¥6`CZ7[NAP1OI$9†a!m/؅4Ci>H8v=t}Ҿ|݄'/Nz }ЅOhdz~w&>_Ǜxy(_~w4M=Q]>?@| Zj@dAu3|PCE| 瀴2uL r?sMj Qj#3ahzbbj` %鈌HL,~e~,_/fU~\#bs[>*I6*#K?NʯPQ!ұ ׿ʂ8F/k s]7('D\z:QN7;[yv-/9]ڃAWQ;4jApeSp&tA9 ]VA<a|[N Wm!K]ፀ?1f (¶q\QH!kt}i!# c|X"rzw'1Byp!dp@xb( p(_}3 42 z89;5 @A<خ< 8^oF[+$ ;\aAu`0,\k9z^ՍMnB@+b98q&bw1BaW9vz N ;DŽ93S6 R~5?yO>NćsA+ng t$7d/{?4P^)2QGakƜmw}(}O$9 7<+gkJGub/뛷9C퓔Z$q)9FAerV6B\U\iTTw~Dk/# ) =v'A"Q zO\4؈stE<_qgzP4A`n}z1\=*krXOxB67ɞ#eGvs|}oog{fYY&2XQSBjQSI"q6;䮘}l?`TWЂ@ןC qBmf 26!+G%ᾄF/RܭYŘFюϢ8MRum7%VzhxQ2p1iyU[{axA"zp./<}'R 5g[HS*ҢPҔa & o@MB0C(0b^cJ?Jp4LۥB0X@P ?B{o9$*}'lshmN42@yPT2J}JG͋ݝoH~ύE EH΄ TV B3+ޕռKrn[4M"9>Y@Fs('m(%B>etJ07Xr%ٗ4矻 -22$JH/6/ 5 ]|8FZT7_KXNIjhy .B1:"q殏 D)=1su`o~?/_m p15b5va(C 0՞7$0+P+ZΧIF$zMli@?xcN[1AI D_(KDelH?bZ5Ewm 1`$-U&S'@v Y>=$M6# A> WBD2' .WĨiժj%2 %FK`DGVf_q+]M`b-/B3 S^9g1h[X`2С Ђ.+8-" tj1)p snPڭ~"iI%L 9uU3f9ə$t?tA+'(YlM' >t&X'g %@ጅ K{-Ts92~(ls!?#Cŀ”L#)`eϹ%HGlZK 9n͌M߸4WO V;=94j!N8Y1p$ 0̩,`/exUu$aMixts?am[q`"=ͷjQv^%L"]3*0.tm3n^m3es ;ICQ|) Lp;o#4'e{~Xz3]]'WM[[nO72' vRj6iS[}mԽ?>>xAsRrr[/=TL#ejw.UBek̇79n~|vZѵ绪zf{56䴓Ll6x3] po lVcgOq.LNS'K4z)ږ%c׎]h`/QʈbLA)jN-ۮ7,'g\}9,A(4Tbi,Lo$iedb?;&v!ygFϐ~1>=ve:_Tʦrsl _6gXmٖ6!!8DR`G Etf-~h#JhZ"AHI'D ҔW sU( _HT>{P&E%ըÉaǭJ tbϧң#MʥL1+M+ҪZjzPa(?iͺI4V3vu2+Tw(T] KiLb)P%HPKEx{9ZHMF![L6"_( ) U.QUW*%wY(g^qU]+f"e$8fwIkN[97dKk)D_r= 2%8s'_V/PWa룜Ŵ {jUGƌg%iRquV`,~cdH JH_0F?{1A8S@}+\S}Ap\/쮔߲l.|X0 0(_…<:\S|D̏OBu>Ltbgf녺Q1'Vuʨ:ǩ$> zēʙ\7LT$ KW 097OL.B#~Xo NϠ>xZhA"lDdfٖAwy—S~6Z?B͞>l3:Wkr2)N =i}N|&Ont`=$w ~;NoĭO8σ'#w71NL]%~qxV*GӋyz%/u[11*OE]M-cxW#٬u^oz-WŰI`I#[";pI^;{%VЍlB E]J:ԒLA 8 l ( ~G#J"s\~-5#e}ttF1Jp3C}ҠBYg Lz%˼)T69><:cp=vDXl/^үտsϝ+QZ4_wZi+~;%CÀ(6Bo [LR/>4cD+$ ՅC5N8OuabvCLczHL:zJ'v`,rkik?, t^'] cdz‡f0POS_6ꬠRLjaU6+hO{V-=?XO񍌭_~ {t`̤9ڽvfGM"' >Rl46u0;.C@I̐"٘{_G/>?۴\iwM[j.s! ,R;[;?QHIM OܴLQQBۉ>Ka' !H4̲U#V7Fgo;2M7ͷ,jd_:ٯ̓vR_앑܋-ȧ̳Oc{G̟ȴ_Hs<~ei}>UV]$7+Lu1k%\O, y/qNtGdu5*jn5#i⋗0zfY]RckyNEX׌4GkT3dumDĉ w )4|ZaQ1nČ`l i$6*XⴜNF +Y|Fd1QlgLud,U//Vt`sQ3í`lI9)vZ(O|KPzk Pq-uRNIɰLIhRQ>>B2kЃUW!tH; Җ҂sz[GE2Y; 6;e|Pߛգ 1W +t__Ry&'PS}iJsF[&{ *6nY2~ MS '$8}-4 NN3Nx(,-n&0uF0I 2r .Z5h3ctfuԀrӥc&%I&J|6ȩS؞:( DO$,3*]eCd4NabogRG% QtE2^ה4&(3t1Z Hv⬸?P+LHqg|ϴ>E ]& QM ڰ#zꞗ V_n7yy$a}\߬QxWVBx)"$`1Zĕ>c ?~pB]|L }@>^UpixŬ<=k].t*:[Ts~U0!ѵbx<*GCR鉜l cnq)O4YP~: 1J#\z*A!ٺ+>8T rhiqLӛKmF'Jhy_ŦS 180;'&=zowoZv'KgCs]LI $o5fK iuZ 0x;s82E^ff+<=)T;N:(FA7߀=֩Ye֞v(YyP6D!$MVzT`rL&[IvpyLWC3Z>bT(^YX͠09'7vL@xmYI\%Pa6.ɥxLL038M|]d XJmQM!$9MJTuK:ӎ\odi]7)[y<{A;ɏ#N@F+i( X]^ltkL~ :=f+^fHi65h%';2 chno6O*mC\m[{6rS:镃o^0bPdC -֗*X6Hpasػ̙9/J"R؇ i<44i% A+|H.WlS}i XV/+A陾ے&EtEIX6oIQ>iɚ +dK_H(OMe{dyEJKdEweϞbh: i oF2{f՛wXu)h{V|W%Ϧ7 ZtnR,a9@dL 9 _>+!9 6$SfX,rSUAج߆~|ve,>ؾ\ndPq>03lh2>Ъn&ز$yuR"-f;])a֢B(pU&XyYm.j떐9X] y„. 7EcTS.rp2wzbš@i@0kgzFEvnI^ֶ;/P^[oq#9Xbg7%G&;W;[GqB\l izUx|v PԸTv dPy a˜q="ˌٿ:!"X!/(g'KrGb8.pр:뀄%e!:饧e k{HKx8ӨJD!N2fqKB?4Cdӽ_W/#WYw x捄F`Zt!īCt "ƿI7"*+SQ@6ö<F*ȥGPZO qn/TsRɌ\-zXɀUpC Z! #yR3 ndhZtN9aHe1tb}?q7Q1~l[j.m\njJ< C3[.u2)R1FqQ `h6fV |UǠN!;dC/< CAddG8 L(2D y=}A@S)'*Xnn O O lkqĔ*Uu 0n!c\r}\ |Gl)g )0(Dy Qb(V݁8Oi\ Ka X:9GZYZ:aߩl2Pg1gn[8 ]XS3U#X18ZnHʕ)3j~|# hx|CVyg4kTqRy]y[| +#e3~x4$i*g0Ǽ2s<_+[!ިԖJ}oLބ},Y}FH^(k>vQ0|Ѧ#h jLSi[*VZH8pG5ϕߌ)YJHq"vmN+'0kqqYZtQA`%9QCporKKU|qU#Vn3A7!Zd'> zmA &#VL}|z•p.O 1&ҢH{Ėh!ޫDCͭ@' O.r¬5쒖B>~.2%Q3~`@3R4Gf]\92N] Uᬎ`|S=-B.%.&Yr36y[Rd&9jOʳ[\؂hY%fk֑#P#Ax?-륎UYܪjBW4-/ TCso~.5g}t_Cz!$&(!"rieA]J%yötFV-3]|2F1p0ŧNW`ƌ!6GIm Voe_2E-Z)_UOaIea/u!Uf7c6P7ޘ, h ]Uq&g9Fei "wHU6_iGx*uGktXfn1I.kauΙpO&N9߈Н 2WSY0L~}F *059BWqἧf?mpW> IR;*jBdH#@1PJd԰9z|fHHC=~W9HZ0_^)ĝc!a`5M^ZM_Ϊ.7a i\ ZR-JpL&GEݣR#BxAT.b(2 7|p )'O #ԢnX2]NEM\(q$$/3u.A?rIj]ȅl?duf(*^ϊ&FGΠVy^yic$[=曘sGq٫M ${Qޚ&yU/Q&eҪe 4uy X67AQa7LǝtrsEpSG"C^[̖N1Hs`3:%5Mw*gS7Z#o.Vwґ9b7hsqo8Kȹ[*Nj6\uTγ(l=ć|T}D5Onh.zUT9Oɛ̣݄ɤ/n mxZ,U,-_zǺ_;IMw=_!9>V}?833/CgR* WhGF1vf^Fv"P*w4SDxfs÷|q^=ڟ L%_|0#Pox*`D);&zkY1Ci V6.3nmRq BָD69`n-)'T!(ճde_IӪH/ ʦpEOT{-`J&b6:zM@)⤴9N wWLb3V\7iF§,Ӫ7sy|x%a1H<* <,&  qaov!!ñ6fsNTG`irc*,y ]>o T7g` v5[?G4 N-xIGA4K)ۼՃH,:Hvcpkgkq7P  m12X2u bH2"t.YQLWcuߢ8qK FwÎDSL#m$_@f\rz5 j_kVFSk ZO {Fީ>s{ԥI/CE}QU.+ՅwCLvf Qh2g9%| -(nGJD̏Rk2݄.#NGnt^'jϑ-ӏ議ꡬwu=`zf[k):SA8'X;*zOpMpm^'kV#Z"07fvz VZ $J +BB%ԵQnA>5^ 9AȖXSҠQ 1S:M<|ROB ypIB'%,^"-[BIf'#3w:7Ź'u[6_G/lZtg}/@ :׀[`0b`=A$T2M'jy+޳WBⰉyu˺#NA5 *(pO e x~x*Eg5Y}]mVmDCk9PcYB.jD% `”]^/þeXHi5P|h %[Amw\""ޟRIXJ>aZQ;y6F\o*DMt Qֱ*9AN0mp4i\~LxXï Zr}FڱcZ'm50ʟhb/KgrGϣǫ>?V4jv'KIGg!+|)y*t/}}$P~ZAχE?ZI:Nv?᫺LP2Ke!UK(ze/%+k'ӞiQ^HHwyZH*-zF<ƨ cMq ?N$.Tp)ˤ*>[{E0:`G#╘ouP]+pĭ#zNYxaĪRQ;գIS7ڄHv_}",@( )]L\J' d.~H"VH!]yxu.W-:ثGCA>Qډf*1q_Jdb |&4+v򉷶 Gz+K\:i%]TKXo8`Ɨ|EEhIZ \zay Js:gv6*K5?\Z}:>kZ$H։E&T]wKr+n55)!|djZ&k0b` 'ʛP<@Esi`o =HJ# 4)`e\8) l5RcRnP#HEk=iAZ$[i3 i7xVF gU'M͎fLO2Lr=/r&&hWɽJpǽޛjD'qhcZNW^1GMWkVz)że(e˦Sp=\}lb\FctnSb!0L6b ;}&v4r؜c aku$OKL~&i?LZA-|UP{>6fCDIgg zq{{$gM0c'@/Eo/m?S+Ӊ`BH6 J M~Q^f8X1n[3/H 98lG+3{rgJJuXh(A;ɒQ֧j vmҰQ~\`/-,bʨ߱-yYWNJ"%RV' ~MXjq7M$} ruGaIz0"菱v|x\"a )q0:8~2W opi$$ywƍlQ `v>yG/)sgNsm0ATB@ /"HA&_ 20_:b=W:c3;ո\AqkQ`>>̷pQ*X(ֿ%QDPƒN#xt*%t4Nn2 + n'_Sֿ[;H*R眗RcLgfeqt9.%}њ8u0o\ vV.`&:;SQKĤA?NMFQ*gh hUHL݋So|I3[V o̶ WEppOK PŮ@,LX,t[i=s6޹qIS}ժ<|&ƊN|a26\#2(0"l F@ϩcU a!KG*V!)̀)<͌'Vuw27"~|uM_{D/4V&mSjѢD+n)Q{&0 x aYd̔:7`H.AnT ج\G:뵅"߰,lbk|[5^4*umھ0!M#@2^&VRۮUaZ=ƨִXY1,6TUS*lhwMISk6: hBWoH ՟3_%zbD |n٭G"M()UvxWp\ Ig^ZmU^p-I|7NGV$eϤ}U1^_.vu覌8];SbVb m!mnOi} m}MiʏQ[_zmQۿ2aT5 b簯*%.B$ Kds&7VEy:ƥ5aS8i=G&ZTԡf%SIz.I>,c,7Ko2/db˶Sfm84)K2(S3ۻcy #Hb9ضnn(& cw#3P)G2<7 pbdQ94'Tg I:?m1pӣPЫ{Y3B$p_E%d3AO?i{6߿R\լoݍ9{|%- JE|'jo:esUmZ>;[,=7pgGS"{p}0pb^+34J) pIFi 18X|N6o5ɢs ATu ! 4h!(մܒ7NvSNy\kmOC%?3j/(Is jsBK4_GD"l鴠^۟K1lDx*VZŸ4e<誌ٶӶ=r:2W[Mmwpvg"5Hh/uFNBFJǘߜ(Ӆ\[mIȀ{kVn$L@}UZ':):xXdwiPX/LET*RF߸d=,aM4=B7 ė77bǃ‚-;R3 *rt5ԙ/F,-UD c!j5Z\Ӕ*KkJ+loviqRPIsZ>s-[pOuڅ+fH?Lg'V.̨ii*_C$vYh6+t@|$oEWLAdJV2g`2Wޱ:G+< lT8[Zd+I_|<0 5oo 6]BX0|7 Vsh3XXvrKZ_2il1uW"I/΁Pg˷]Gǖhy"ʦ"M$Ht#A<ٮ6@\E/LS5 *{pY ܎\Ce_"畽9q%?#١fR`x{MNi+_$q6֭_&~`$C9Tiœ"@`VI;ѫ`GR룄14 ns!f k2])ĥl `Es*0o>Wg*k&{' c 7]M.BVoJ۟锄}6,S/;`Y T]Y`s+ډ5x'2Ec{My&ghvڌEzMCsj{U5G]0CAnyQIKtGn]C;iXd7!ջH/KF9q5̌BM#\'n-Ze->jn| juQwbemCOPEQ '$qRTz]6ΰj؅>*HDp׭lVofV,^46\9*Ӹr#Gq\4o(_tTDT'DZ `=M4sN+ڠQEB&_&,6rgƛ&%-{*6н,IY6]^F?` ۹ E,7]quCGO@G?gydIvfr5:pGP<BІFc1zYt5vj6jšOf嵵demcme|x3-ʹ6F+yPg|s. );v o|Oܕҫ)gil e=-|;O%]V4S%>[*a GSyob]U1z&R)i硵N?KG%xk.~Ʋo&[ŧTmCjj0  3.l8e&pH.9"<(a'r ٕ*VCH'{ч((7wq j,G*2p2-]e OEC92S^wʯSrcQOco`J tȫqtX`VrR4;~ZxQBAj_2sq~AzXyM5 V՘n2 PC}@+PH֟NM78ӑxT1@|UE|5eHAe|RT뮉.( {[o~LCd"9ր7+?K< X*2:jJ=5U,ڋM 6 Z1 Xz^8j=Νh/D4THۢ6qj1o.;Ua1"R<6J0?Q9Sd6 _WFyJ.*ڜqu:x}&>Hi"J!?d$vZ˟t+^]t*FH9|p|ݤGYb& w8vR!3tb\s1.|{|tSH5X-vT%' ON%?|BǫW֓d6>$ %!1)89=w B$dk̤ o:C(?<]x!(˖ѱ4wCIq W"rX)nohKqXoG;;Kk$Jko=b=A E`^zt+' ('KVk<6}G?il&a {yoD)s>H^=}ozluw%ڗ`k(MPOvU)\h{ _QߕuDtS6[^ D*Md zpz2E j$-7ɏe4.9W $`U/Pp8뤢x`e;It=9*\RA s46/M"hshɇ92928r@DP]dw0â8ǫ${PFZsӫyL ݑf2L),99FCP+̀.'ٌl` IT.ff5g~,>򥟾nH8T#Z:\Q @DGnB?xB,#\;ڽ )$e5e{Bxv=. Z.V z)xrAs(a9 .荶*״k IԄZt<DDofj [%aqhzxS'mQ8i*ڨ* {ڱT@͞<>nA[]D pd@[{v'N俪um=ͺ[`fy6#+I%TT1U@0dXWLFٜ ^\2!6,oS"lutmSGGgPëqWs]cY:AieODuYǾ2$wYDŽ{_\IrL]3B3+s55i R׏Z4b=rǠKfpʬR' @کJ㝸ES_?S8N]u%=뉔( jRbL՞AQ6|7㇫ =zxu4LV?^nCENY|OY1φ0GS("ٿJ92hH!cq ?x0uK|16X7سb"]eV&哉?Ԍ㗶Yj[jEEMj}u>&eDH 8\B^t @Gz9x8. u8{3G8%r;6<=-0ax8A,I0Sb!Y8"R 9s&Fc LiWmƁ0 P .mUX1HKWE$?SN6-".XYb>-eYc>9q('G5(rt? Bj[ V+Mez)n>?68r"/@SWUD@( _w6H;ƼZ@,;>p$hGuR.tHqYٷK#k[ &:A{h@@ݒČqF@}gJUoYqֲ9>`H=X  6;ÇisMGnU v&7z#&#,h|՜R,MՌ).ΙK6 <[dnU ~0 o4hO:r7]|KYKDDy*ErP}Jjsp1).|Ri4+ N&jIp}H 7j3,`6?| t z0 JRWcFJ:uUsy+,G@zt] A8Rn5@U7/[J[NBJnh}2ٜѾ 5 0,p݂U\L,gІ.um i o@fL*ȕ4;$<7|(;j}Se;伕;hoKɉhxtvݱHp9O_l8wlKo:d,bX1 Mq퉓AW;?moZM7;\MRYϷ'lC_h>T#7]eߍn=* M?.* $6 4W<J#-SԳ\6C LETK🷫C7zE: +r7uR| s5S˩n^!Eef:S07=Th/BhbI𫽆L7v 4e`qqEYۡO]Y'onmHj_u\WBl飶Pe5#@!`WAK>Ɖ/A itU=*7BUxMMƞapVR+` ʉH7tn:J \ PK3uw 6!F |C(%ǒxq즊Ter[E ea/_6ao}-ǛaR̔vquY"$Q8]qh,vO-*Ȁd ^ZIR`ծZ)4g{nbףh8<||0pY Jm.0UFԣ)Ϭ;H)sd"=;3bLYɡ̆OX6՜)k) _8inc.`'' ڹ5ᢰZgNsRɯY5\ϩ Af*q6?˾/Kdf4̖i^=нm_T^lXPCL9}xgNPː_$H8͆`V`N{o7}~[x%kB}avV ,FNN?W[cixWcҤ&\@tyn0?}j?Ҷlu$??\|zV>RŸpacHwV;>Op-dNIYmeǣ1G}4!ks]W7ԄLgdp;aDI[29#}sZY[N8SHnс :*pDrzIP(3&n&s.RI I>L \#&+@Lf!3ܮprr/ִ%^.D@66ov;f`h!XOcMRq0Kj`Q:Pbm1W}3 Ke''yHT)S왗2һStjH4x;o\J|\>Ы,5BcG B8A9 98y 6^][=9ktd j])`e[dnFWXŇAU!U 6#ro%8*2&]'11* )̳>f˥$}AtxJfֽt3\ =񷪺YNkv>0,WwV[2m;q̭>qpJUcy@?V:)unK8:cMaw֗,Y<: ,"uV&_Ui'HԌ󫻝!# Msj͜smwv$Aɼ*T)U9p{PoLZ&JRyc}Yo2 U!hGm9`2"JxQ`i9,Pt}bAU.\}NZ'?>D| NB~c L2A] ^+h:tJG17ZeJT6}r'jQ2dzf#! gFTkY@äћa#e8Mj> !1ujCSe;l !p$q)ΓNM6bM1?iǓ`~Hy^靛}18 P?NzNq Y^)Q8Q=[J2*k/Nur0+f@7f@9}ߺXkB 'D;8G2)3ӕ9uUh{@:d7I}zoPbyyf ܕC/_L(sb_~s/u4'εΉ(sgE/}"QwDwgŬ;K(3Dh($]Ή8Ί57;Mӱs(KUf€ %"H%7@4nUq "z@zM8rD L!䮓*Дo7HATdN{A,Y4ؐZ؂QG˦/W,ܣj[zyĠ Z0"^}3lsxʾ{ ť衃='gԂ˫pŪWf®խuƢl+&\/@~4aU 7]@xoe0AYFM]/7ڤl ZOYuyᕷnF2b~`zy㹁pM s V(e5xbtpkV!clGNJ ;<8q spzYcPXL^c/yO{E9kTp||r n:=f{V9pRJX}~CmUYIBY'r_`{ ԰GܛMkzB8eO>DL\v}B ƹ66I>M!NB^U*+Ks8>#P({Etqx ЁbgŸtDu"f[?KL;hֳNEcn7u?zD(zssL'I/Wwm{۽vw~3?Ԏht ҾAD.#T̩fw!WܜnH]'8AeԏlIo8D|j:5/Nγ_`pA?/ CG8mC6bA0̌N(&[Kp_;f%rPG0=m82댇`C&0{YYq.y!?7k`طv fQ̭C\61xXMtBXpWo4:ah~QGbg^Hu!(\y|o:f bAMDz/߽+X.1$rF! ?Zʹ w/\Օ$)),")bf/C e2M@Јou k{ O+Iz̲;q#hKAD Ȳ&HcN z8&'MB8=e  ]ha"t7|5t3 (r}'pQ(oէa$v#P4Ցϰ ~TJ ͈*zO%}gq1Y }_m!wPe~r_x.4duH1m8 g51 vKY9!]L]ǟaf`[ڄ 4EMTy] '84gD NXoXlWɼbG}b ֫7{;)pdHGfEԉǏ[?mW;f˽xxa݈w׽AAOi,k W2lKUoOKu ;c`2#e6K9wp=;vtp$AP+T?l'opfeԊ@ 4a&MOvĥD%l/klHcGES4ۤ`!$57]ِ߳c&Ybs5aZ+Ɇ:JuR4k8]: pfI cX lhldQ&@k;5HGo^PQM'TRIl~6my=HɮS:Fu~Wu~U1Q!#njݣPOXA=-riV=5c}B-M9EVgPz31! TOݮ9Wio M]jvk7?;R~G*3 Z|to~4`^Ffوb=ע C**#j{`[/wclt޻1&&ɣAkOG{ֶd~e8o8SXƾ>wk*USk}$o ᰀƔPT`:.!Ф%rT&^!¡=k 4I1U0e5>}3ɣ'dSy={)?صxumمC|F v*RX/D|Dܑ A`7&6":谏1C}Gl4J8e򲗞fnuzH˞˝ L(@$JH˙0D>;' !a1e qKG>]q?D[dW>,ǗISR1/Bjˢoc[7;`G;{qbwF6$M*^lRFfk6fM7{\љix:=kt2pj$ǧW 4]x::NPrw%P¾Oeg>h?i;_:5'}hirpWu/|D QydT,E:.̖ m %2M[i '>‚qJ1Z )]jrgN`-&%pŅ@h%^>Z17[+d%_PJ p@#t>β>XRAӘu7;6wcq3t6jesyָV>@ K=TCՠFS&M pr5 Yz7[.0u7RMIR؄eyOV] L0pyX+L)írBJS "Ѣ0#v<0n'/\%v)&1wmxX6Ψ9KL8@&rfk*eB((9 ^tk8i"ķ VMSs8aI^2lBG8+o 8~WRJiCW :C10'!mrmJ9swI* UN>䡵@Sx(THX!G )jٛt*h_,ѧ gň;*3!~R }Ԓ<IZ;1#QZe$=}܈ܐ%WG m l:X~W\Q@";`v<'췬`wӷٻD%f9:"Hz\-^>D7an&94ěXzNhrLT(Z{uak00=k9We0(N}{ }ZԷ1B&NZ$8Q`FnRꔊHdK3CL-%tN>Ŵ _x9uϙYTH sG,PWp[4VxwD=N qqw#\+d(@ eCZ$܁hjYq\E#N0AHә2iqӛό'|(Ǭg= OyN9aQK+ZCw}eu7i%չʮ(h>D;lk]lu"Q~G=(1e>Z b#"!H MAVП` s[6`͗F\Bg"s@@ۯ_%?wpeOnn '!fPבeӧ5-g-Ρ(|YȘcH"d:VY͋N۬kF/4֞| ./ͭ!q7,ei#P[[G[}(X ;D${7.b"9`ZDϼ#0Lbx!"-q tio]i">]>EMl;߀EaI2%Y,& y&uKy^[X^7,~e3<8U d g )ߏ瓕Gk+Odu;_ {A\Kar>(@߀ehfi;4}]H~9⦆;\!{J>=Q>6֎޶/eW"blaaq2gî`of Vo@dCt/ 9D"ؙ!aCYf%'w،IY8)⤭`^x Mv՟6sb|e f1ك$+:ڟa ?gǠ8,A9>܎xx%?.e+}]9EG+>Z5wn壎'ղS,O Fldmm7V#;G>[1{tHكa~z6(̰kk/dvd73u.cdJBF3lR#2UkN3LHn^͢ն@$m N#,C=!uxpVH߳ ]LD|3 .18xf2dE{-`idQQp!A%%PKBМ<ȸT9rTUQ'";|:$Y5CPSl0"qOBb2,.Y^n\qn0*\e¬tko[9U`F~3Hqr}qd Wo'ݢhճ%а_ P p+9m#ͳKa'Z˲l8@T!>yo-DnH/ @+nAx7N[V#N^~?%?98L^muǠ{;ov[0y} Uww[/}fowg{}+yWGfأ-~ejϭ{GGKVf۽ۃ7w އfXY ?=L~:21?2pۂa`'9|kF3 i{:E|\?+W( q-lrP6ߏw^mA u3ܷ@Y΋#|<[{k0a{klo~`6ym6, y{S΁־B>TfOLuhs,䤗ː],pdM#ueK~,Q2dEQ<È^>MKC0=?OP ;FF4XXYAyj솊fd\nN@ c_;& 3AJzCbd Z^` j_z]!fT2^:򲝼ƽ "?NBn5U/g1C."2<0?ɩV%l8amhDLv]??O?M1O?GƏ)}_<*TOt(*A5;M t׉1~lKv_(= "&&G=<*)iM#*5Apu͚v&҉E4B(sNZ㆓m,-BuO2QceuO2Yc=w=ē֜*h|GB ϳ JdVq,UXk'[|H4!10攫5d7#ʫPlϱa[ɖ)mҏi^ԈݰrwR'v'Fr9qY췟)CGxuNt1GbZ^Y];j}c?ADg<.t2ݔY,Cq1K5MNjͩ 9|%Qj! gsӥTj$Q%f!%پǃQD쾑a9֪U̖@l?VExX&+iV ~ZiJeC2CZ 3_k`٢ܺ4Ԇ79-\?-!ɢ@ [vXWgd51Hu:NQ4G$aw B>*1i4?{AfG}FoC:()??Yc㇏?||O=1ȿ[o<\QvN+/_.6iNd#!J Cimg-w{[ŦL=H{ӈ S"e=|/ 띴4\Q尳̡VAW] sH⯡թV \.w] g.1)E Q%=!~@U[e:yd_P%:~c&eHYbz`}o秝R<% Xů=2CQGm|}<( ^<ծ!Xׯ0H{K;^>72>LoR*;>^o3?A&?1BQRn&QD>YW8vWuf ;:zN!0펜媝E9lk5>~sBWkʏs=}HcLCW>Z_YypdmNw+x_éPHh#1:2|6r"u䡧QOUN;VLRf=25 oi=&O-! '阳'>Ntٗq r!=Xn¬3TШ/R: juJ9+>]қMHpEψc{_Ԗ|x$ dR.xr9;HtbVgLh`+90]7@u.emP@ZLKc!;U C֧F!a Z 5Ӡn-uB F {ِ<&CaO\( Ⰼm'^%r'8jz.BX8qIî!O`5Gي㴇%>B@ +6 9`q ~~V)G(7+`ݣ31qKy4XgK$6}-4)Ӑoi!9Z3. eg> bBAck(˛ao.k;Ѝ$&Zއj >F@]霑#`\ڰw3o=:%Ycuk(TA9:٣OE!Mk{qscƒ%czmR>tXc %/IrDp2bD_@@D,\컧 s?y1,ZTo{QC2,7?EI7CA/5Xo1Ӧ{_KBzʘӺڧ7)MjrBr8?. hjtKNSBY89Ɇk )2>"屋0VɸRPH#MġIz ԴAta=֫6M 440-:A> _kDEbXMA0hD(Iaf.Gc_u(%Z^co PI/q>SϊIDYKUGE2J19塤eDS#;o| EWC3KeBwu?NA_qN2Qiix* !@ȪGߝٵ*]?!YofphQlioěJT0%HNDݢ %r"IRm)鎿ASɶMsDKbA,@3.ԡnCO6Sz42E̶›#5>5]גTo @>a@؉9z FR%`h_myAWCRmԣtNcꥦg^ZGUXWÅ'hǴ0+0sO/^]%~sgHl)/=F3z~tb:ɴ(kj炵>Jd1ɸ\m*oe1-7))Fei: 2* 80t;p>j};`Q+"*J{yְp,,׶EqW3BRhQ~@fֽFbgP¹vͦk7h|VjнUx^'%:b}8Eþîh ^Ut5^O"M`ӓNL/ã07@>%^P5?_QM4sQ}l!0,:,\ucjQdB=28Z%ϑec0AII O.l  WR==,58cxoP y_|Z`IGRr"EϞbȀxJEePay8$27[ t&%q8|6N'5J`%ӅqB9v)Q\/ө-2w];?|On8hI ǓY“kHhm3AU_ O}!5&Ŗl`àe)4R8x`?"i(. Pix,uX|[Ij+2/2&Wd_!d_e_e_e_e_e_e_e_7χc+2U2libxalan2-java-2.7.1/src/manifest.xsltc0000644000175000017500000000360310721374033016756 0ustar mkochmkochManifest-Version: 1.0 Created-By: @java.version@ (@java.vendor@) Class-Path: xercesImpl.jar xml-apis.jar serializer.jar Name: org/apache/xalan/xsltc/ Comment: Main XSLTC engine implementing TrAX/JAXP Specification-Title: Java API for XML Processing Specification-Vendor: Sun Microsystems Inc. Specification-Version: 1.3 Implementation-Title: org.apache.xalan.xsltc Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/dist/ Name: org/apache/xml/ Comment: DTM implementation and utilities Implementation-Title: org.apache.xml Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/dist/ Name: java_cup/runtime/ Comment: Runtime component of JCup Specification-Title: Runtime component of JCup Specification-Vendor: Princeton University Specification-Version: 0.10k Implementation-Title: runtime Implementation-Version: @impl.version@ Implementation-Vendor: Princeton University Implementation-URL: http://www.cs.princeton.edu/~appel/modern/java/CUP/ Name: org/apache/bcel/ Comment: Byte Code Engineering Library Specification-Title: Byte Code Engineering Library Specification-Vendor: Markus Dahm Specification-Version: 5.0 rc1 Implementation-Title: org.apache.bcel Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://jakarta.apache.org/bcel Name: org/apache/regexp/ Comment: Java Regular Expression package Specification-Title: Java Regular Expression package Specification-Vendor: Apache Software Foundation Specification-Version: 1.2 Implementation-Title: org.apache.regexp Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://jakarta.apache.org/regexp libxalan2-java-2.7.1/src/MANIFEST.SERIALIZER0000644000175000017500000000165010721374032016671 0ustar mkochmkochManifest-Version: 1.0 Created-By: @java.version@ (@java.vendor@) Main-Class: org.apache.xml.serializer.Version Class-Path: xml-apis.jar Name: org/apache/xml/serializer/ Comment: Serializer to write out XML, HTML etc. as a stream of characters from an input DOM or from input SAX events. Specification-Title: XSL Transformations (XSLT), at http://www.w3.org/TR/xslt Specification-Vendor: W3C Recommendation 16 November 1999 Specification-Version: 1.0 Implementation-Title: org.apache.xml.serializer Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation Implementation-URL: http://xml.apache.org/xalan-j/usagepatterns.html Name: org/apache/xml/serializer/utils/ Comment: Utilities used internally by the Serializer. Not for external use. Implementation-Title: org.apache.xml.serializer.utils Implementation-Version: @impl.version@ Implementation-Vendor: Apache Software Foundation libxalan2-java-2.7.1/src/org/0000755000175000017500000000000010721374030014653 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/0000755000175000017500000000000010721374030016074 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/0000755000175000017500000000000010736146354017234 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/Expression.java0000644000175000017500000004424210721374032022232 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Expression.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.XMLString; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; import org.xml.sax.ContentHandler; /** * This abstract class serves as the base for all expression objects. An * Expression can be executed to return a {@link org.apache.xpath.objects.XObject}, * normally has a location within a document or DOM, can send error and warning * events, and normally do not hold state and are meant to be immutable once * construction has completed. An exception to the immutibility rule is iterators * and walkers, which must be cloned in order to be used -- the original must * still be immutable. */ public abstract class Expression implements java.io.Serializable, ExpressionNode, XPathVisitable { static final long serialVersionUID = 565665869777906902L; /** * The location where this expression was built from. Need for diagnostic * messages. May be null. * @serial */ private ExpressionNode m_parent; /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return false; } // /** // * Set the location where this expression was built from. // * // * // * @param locator the location where this expression was built from, may be // * null. // */ // public void setSourceLocator(SourceLocator locator) // { // m_slocator = locator; // } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * @param currentNode The currentNode. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public XObject execute(XPathContext xctxt, int currentNode) throws javax.xml.transform.TransformerException { // For now, the current node is already pushed. return execute(xctxt); } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * @param currentNode The currentNode. * @param dtm The DTM of the current node. * @param expType The expanded type ID of the current node. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public XObject execute( XPathContext xctxt, int currentNode, DTM dtm, int expType) throws javax.xml.transform.TransformerException { // For now, the current node is already pushed. return execute(xctxt); } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public abstract XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException; /** * Execute an expression in the XPath runtime context, and return the * result of the expression, but tell that a "safe" object doesn't have * to be returned. The default implementation just calls execute(xctxt). * * * @param xctxt The XPath runtime context. * @param destructiveOK true if a "safe" object doesn't need to be returned. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { return execute(xctxt); } /** * Evaluate expression to a number. * * * @param xctxt The XPath runtime context. * @return The expression evaluated as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return execute(xctxt).num(); } /** * Evaluate expression to a boolean. * * * @param xctxt The XPath runtime context. * @return false * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { return execute(xctxt).bool(); } /** * Cast result object to a string. * * * @param xctxt The XPath runtime context. * @return The string this wraps or the empty string if null * * @throws javax.xml.transform.TransformerException */ public XMLString xstr(XPathContext xctxt) throws javax.xml.transform.TransformerException { return execute(xctxt).xstr(); } /** * Tell if the expression is a nodeset expression. In other words, tell * if you can execute {@link #asNode(XPathContext) asNode} without an exception. * @return true if the expression can be represented as a nodeset. */ public boolean isNodesetExpr() { return false; } /** * Return the first node out of the nodeset, if this expression is * a nodeset expression. * @param xctxt The XPath runtime context. * @return the first node out of the nodeset, or DTM.NULL. * * @throws javax.xml.transform.TransformerException */ public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException { DTMIterator iter = execute(xctxt).iter(); return iter.nextNode(); } /** * Given an select expression and a context, evaluate the XPath * and return the resulting iterator. * * @param xctxt The execution context. * @param contextNode The node that "." expresses. * * * @return A valid DTMIterator. * @throws TransformerException thrown if the active ProblemListener decides * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException * @xsl.usage experimental */ public DTMIterator asIterator(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException { try { xctxt.pushCurrentNodeAndExpression(contextNode, contextNode); return execute(xctxt).iter(); } finally { xctxt.popCurrentNodeAndExpression(); } } /** * Given an select expression and a context, evaluate the XPath * and return the resulting iterator, but do not clone. * * @param xctxt The execution context. * @param contextNode The node that "." expresses. * * * @return A valid DTMIterator. * @throws TransformerException thrown if the active ProblemListener decides * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException * @xsl.usage experimental */ public DTMIterator asIteratorRaw(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException { try { xctxt.pushCurrentNodeAndExpression(contextNode, contextNode); XNodeSet nodeset = (XNodeSet)execute(xctxt); return nodeset.iterRaw(); } finally { xctxt.popCurrentNodeAndExpression(); } } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * NEEDSDOC @param handler * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. * @throws org.xml.sax.SAXException */ public void executeCharsToContentHandler( XPathContext xctxt, ContentHandler handler) throws javax.xml.transform.TransformerException, org.xml.sax.SAXException { XObject obj = execute(xctxt); obj.dispatchCharactersEvents(handler); obj.detach(); } /** * Tell if this expression returns a stable number that will not change during * iterations within the expression. This is used to determine if a proximity * position predicate can indicate that no more searching has to occur. * * * @return true if the expression represents a stable number. */ public boolean isStableNumber() { return false; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). * NEEDSDOC @param globalsSize */ public abstract void fixupVariables(java.util.Vector vars, int globalsSize); /** * Compare this object with another object and see * if they are equal, include the sub heararchy. * * @param expr Another expression object. * @return true if this objects class and the expr * object's class are the same, and the data contained * within both objects are considered equal. */ public abstract boolean deepEquals(Expression expr); /** * This is a utility method to tell if the passed in * class is the same class as this. It is to be used by * the deepEquals method. I'm bottlenecking it here * because I'm not totally confident that comparing the * class objects is the best way to do this. * @return true of the passed in class is the exact same * class as this class. */ protected final boolean isSameClass(Expression expr) { if(null == expr) return false; return (getClass() == expr.getClass()); } /** * Warn the user of an problem. * * @param xctxt The XPath runtime context. * @param msg An error msgkey that corresponds to one of the conststants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. * * @throws javax.xml.transform.TransformerException */ public void warn(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException { java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args); if (null != xctxt) { ErrorListener eh = xctxt.getErrorListener(); // TO DO: Need to get stylesheet Locator from here. eh.warning(new TransformerException(fmsg, xctxt.getSAXLocator())); } } /** * Tell the user of an assertion error, and probably throw an * exception. * * @param b If false, a runtime exception will be thrown. * @param msg The assertion message, which should be informative. * * @throws RuntimeException if the b argument is false. * * @throws javax.xml.transform.TransformerException */ public void assertion(boolean b, java.lang.String msg) { if (!b) { java.lang.String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ msg }); throw new RuntimeException(fMsg); } } /** * Tell the user of an error, and probably throw an * exception. * * @param xctxt The XPath runtime context. * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. * * @throws javax.xml.transform.TransformerException */ public void error(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException { java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); if (null != xctxt) { ErrorListener eh = xctxt.getErrorListener(); TransformerException te = new TransformerException(fmsg, this); eh.fatalError(te); } } /** * Get the first non-Expression parent of this node. * @return null or first ancestor that is not an Expression. */ public ExpressionNode getExpressionOwner() { ExpressionNode parent = exprGetParent(); while((null != parent) && (parent instanceof Expression)) parent = parent.exprGetParent(); return parent; } //=============== ExpressionNode methods ================ /** This pair of methods are used to inform the node of its parent. */ public void exprSetParent(ExpressionNode n) { assertion(n != this, "Can not parent an expression to itself!"); m_parent = n; } public ExpressionNode exprGetParent() { return m_parent; } /** This method tells the node to add its argument to the node's list of children. */ public void exprAddChild(ExpressionNode n, int i) { assertion(false, "exprAddChild method not implemented!"); } /** This method returns a child node. The children are numbered from zero, left to right. */ public ExpressionNode exprGetChild(int i) { return null; } /** Return the number of children the node has. */ public int exprGetNumChildren() { return 0; } //=============== SourceLocator methods ================ /** * Return the public identifier for the current document event. * *

    The return value is the public identifier of the document * entity or of the external parsed entity in which the markup that * triggered the event appears.

    * * @return A string containing the public identifier, or * null if none is available. * @see #getSystemId */ public String getPublicId() { if(null == m_parent) return null; return m_parent.getPublicId(); } /** * Return the system identifier for the current document event. * *

    The return value is the system identifier of the document * entity or of the external parsed entity in which the markup that * triggered the event appears.

    * *

    If the system identifier is a URL, the parser must resolve it * fully before passing it to the application.

    * * @return A string containing the system identifier, or null * if none is available. * @see #getPublicId */ public String getSystemId() { if(null == m_parent) return null; return m_parent.getSystemId(); } /** * Return the line number where the current document event ends. * *

    Warning: The return value from the method * is intended only as an approximation for the sake of error * reporting; it is not intended to provide sufficient information * to edit the character content of the original XML document.

    * *

    The return value is an approximation of the line number * in the document entity or external parsed entity where the * markup that triggered the event appears.

    * * @return The line number, or -1 if none is available. * @see #getColumnNumber */ public int getLineNumber() { if(null == m_parent) return 0; return m_parent.getLineNumber(); } /** * Return the character position where the current document event ends. * *

    Warning: The return value from the method * is intended only as an approximation for the sake of error * reporting; it is not intended to provide sufficient information * to edit the character content of the original XML document.

    * *

    The return value is an approximation of the column number * in the document entity or external parsed entity where the * markup that triggered the event appears.

    * * @return The column number, or -1 if none is available. * @see #getLineNumber */ public int getColumnNumber() { if(null == m_parent) return 0; return m_parent.getColumnNumber(); } } libxalan2-java-2.7.1/src/org/apache/xpath/jaxp/0000755000175000017500000000000010736146354020176 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/jaxp/XPathFactoryImpl.java0000644000175000017500000002273710721374032024240 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // $Id: XPathFactoryImpl.java 468655 2006-10-28 07:12:06Z minchau $ package org.apache.xpath.jaxp; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xalan.res.XSLMessages; import javax.xml.XMLConstants; import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactoryConfigurationException; import javax.xml.xpath.XPathFunctionResolver; import javax.xml.xpath.XPathVariableResolver; /** * The XPathFactory builds XPaths. * * @version $Revision$ * @author Ramesh Mandava */ public class XPathFactoryImpl extends XPathFactory { /** *

    Name of class as a constant to use for debugging.

    */ private static final String CLASS_NAME = "XPathFactoryImpl"; /** *

    XPathFunctionResolver for this XPathFactory and created XPaths.

    */ private XPathFunctionResolver xPathFunctionResolver = null; /** *

    XPathVariableResolver for this XPathFactory and created XPaths

    */ private XPathVariableResolver xPathVariableResolver = null; /** *

    State of secure processing feature.

    */ private boolean featureSecureProcessing = false; /** *

    Is specified object model supported by this * XPathFactory?

    * * @param objectModel Specifies the object model which the returned * XPathFactory will understand. * * @return true if XPathFactory supports * objectModel, else false. * * @throws NullPointerException If objectModel is null. * @throws IllegalArgumentException If objectModel.length() == 0. */ public boolean isObjectModelSupported(String objectModel) { if (objectModel == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_OBJECT_MODEL_NULL, new Object[] { this.getClass().getName() } ); throw new NullPointerException( fmsg ); } if (objectModel.length() == 0) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_OBJECT_MODEL_EMPTY, new Object[] { this.getClass().getName() } ); throw new IllegalArgumentException( fmsg ); } // know how to support default object model, W3C DOM if (objectModel.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) { return true; } // don't know how to support anything else return false; } /** *

    Returns a new XPath object using the underlying * object model determined when the factory was instantiated.

    * * @return New XPath */ public javax.xml.xpath.XPath newXPath() { return new org.apache.xpath.jaxp.XPathImpl( xPathVariableResolver, xPathFunctionResolver, featureSecureProcessing ); } /** *

    Set a feature for this XPathFactory and * XPaths created by this factory.

    * *

    * Feature names are fully qualified {@link java.net.URI}s. * Implementations may define their own features. * An {@link XPathFactoryConfigurationException} is thrown if this * XPathFactory or the XPaths * it creates cannot support the feature. * It is possible for an XPathFactory to expose a feature * value but be unable to change its state. *

    * *

    See {@link javax.xml.xpath.XPathFactory} for full documentation * of specific features.

    * * @param name Feature name. * @param value Is feature state true or false. * * @throws XPathFactoryConfigurationException if this * XPathFactory or the XPaths * it creates cannot support this feature. * @throws NullPointerException if name is * null. */ public void setFeature(String name, boolean value) throws XPathFactoryConfigurationException { // feature name cannot be null if (name == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_NAME_NULL, new Object[] { CLASS_NAME, new Boolean( value) } ); throw new NullPointerException( fmsg ); } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { featureSecureProcessing = value; // all done processing feature return; } // unknown feature String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_UNKNOWN, new Object[] { name, CLASS_NAME, new Boolean(value) } ); throw new XPathFactoryConfigurationException( fmsg ); } /** *

    Get the state of the named feature.

    * *

    * Feature names are fully qualified {@link java.net.URI}s. * Implementations may define their own features. * An {@link XPathFactoryConfigurationException} is thrown if this * XPathFactory or the XPaths * it creates cannot support the feature. * It is possible for an XPathFactory to expose a feature * value but be unable to change its state. *

    * * @param name Feature name. * * @return State of the named feature. * * @throws XPathFactoryConfigurationException if this * XPathFactory or the XPaths * it creates cannot support this feature. * @throws NullPointerException if name is * null. */ public boolean getFeature(String name) throws XPathFactoryConfigurationException { // feature name cannot be null if (name == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_GETTING_NULL_FEATURE, new Object[] { CLASS_NAME } ); throw new NullPointerException( fmsg ); } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return featureSecureProcessing; } // unknown feature String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE, new Object[] { name, CLASS_NAME } ); throw new XPathFactoryConfigurationException( fmsg ); } /** *

    Establish a default function resolver.

    * *

    Any XPath objects constructed from this factory will use * the specified resolver by default.

    * *

    A NullPointerException is thrown if * resolver is null.

    * * @param resolver XPath function resolver. * * @throws NullPointerException If resolver is * null. */ public void setXPathFunctionResolver(XPathFunctionResolver resolver) { // resolver cannot be null if (resolver == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_NULL_XPATH_FUNCTION_RESOLVER, new Object[] { CLASS_NAME } ); throw new NullPointerException( fmsg ); } xPathFunctionResolver = resolver; } /** *

    Establish a default variable resolver.

    * *

    Any XPath objects constructed from this factory will use * the specified resolver by default.

    * *

    A NullPointerException is thrown if resolver is null.

    * * @param resolver Variable resolver. * * @throws NullPointerException If resolver is * null. */ public void setXPathVariableResolver(XPathVariableResolver resolver) { // resolver cannot be null if (resolver == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_NULL_XPATH_VARIABLE_RESOLVER, new Object[] { CLASS_NAME } ); throw new NullPointerException( fmsg ); } xPathVariableResolver = resolver; } } libxalan2-java-2.7.1/src/org/apache/xpath/jaxp/JAXPVariableStack.java0000644000175000017500000000536610721374030024235 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // $Id: JAXPVariableStack.java 524815 2007-04-02 15:52:15Z zongaro $ package org.apache.xpath.jaxp; import javax.xml.transform.TransformerException; import javax.xml.xpath.XPathVariableResolver; import org.apache.xml.utils.QName; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xalan.res.XSLMessages; /** * Overrides {@link VariableStack} and delegates the call to * {@link javax.xml.xpath.XPathVariableResolver}. * * @author Ramesh Mandava ( ramesh.mandava@sun.com ) */ public class JAXPVariableStack extends VariableStack { private final XPathVariableResolver resolver; public JAXPVariableStack(XPathVariableResolver resolver) { super(2); this.resolver = resolver; } public XObject getVariableOrParam(XPathContext xctxt, QName qname) throws TransformerException,IllegalArgumentException { if ( qname == null ) { //JAXP 1.3 spec says that if variable name is null then // we need to through IllegalArgumentException String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Variable qname"} ); throw new IllegalArgumentException( fmsg ); } javax.xml.namespace.QName name = new javax.xml.namespace.QName( qname.getNamespace(), qname.getLocalPart()); Object varValue = resolver.resolveVariable( name ); if ( varValue == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL, new Object[] { name.toString()} ); throw new TransformerException( fmsg ); } return XObject.create( varValue, xctxt ); } } libxalan2-java-2.7.1/src/org/apache/xpath/jaxp/XPathImpl.java0000644000175000017500000005605310721374031022705 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // $Id: XPathImpl.java 524814 2007-04-02 15:52:11Z zongaro $ package org.apache.xpath.jaxp; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFunctionResolver; import javax.xml.xpath.XPathVariableResolver; import javax.xml.xpath.XPathExpression; import org.apache.xml.dtm.DTM; import org.apache.xpath.*; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xalan.res.XSLMessages; import org.w3c.dom.Node; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.traversal.NodeIterator; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.parsers.*; import java.io.IOException; /** * The XPathImpl class provides implementation for the methods defined in * javax.xml.xpath.XPath interface. This provide simple access to the results * of an XPath expression. * * * @version $Revision$ * @author Ramesh Mandava */ public class XPathImpl implements javax.xml.xpath.XPath { // Private variables private XPathVariableResolver variableResolver; private XPathFunctionResolver functionResolver; private XPathVariableResolver origVariableResolver; private XPathFunctionResolver origFunctionResolver; private NamespaceContext namespaceContext=null; private JAXPPrefixResolver prefixResolver; // By default Extension Functions are allowed in XPath Expressions. If // Secure Processing Feature is set on XPathFactory then the invocation of // extensions function need to throw XPathFunctionException private boolean featureSecureProcessing = false; XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) { this.origVariableResolver = this.variableResolver = vr; this.origFunctionResolver = this.functionResolver = fr; } XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr, boolean featureSecureProcessing ) { this.origVariableResolver = this.variableResolver = vr; this.origFunctionResolver = this.functionResolver = fr; this.featureSecureProcessing = featureSecureProcessing; } /** *

    Establishes a variable resolver.

    * * @param resolver Variable Resolver */ public void setXPathVariableResolver(XPathVariableResolver resolver) { if ( resolver == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"XPathVariableResolver"} ); throw new NullPointerException( fmsg ); } this.variableResolver = resolver; } /** *

    Returns the current variable resolver.

    * * @return Current variable resolver */ public XPathVariableResolver getXPathVariableResolver() { return variableResolver; } /** *

    Establishes a function resolver.

    * * @param resolver XPath function resolver */ public void setXPathFunctionResolver(XPathFunctionResolver resolver) { if ( resolver == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"XPathFunctionResolver"} ); throw new NullPointerException( fmsg ); } this.functionResolver = resolver; } /** *

    Returns the current function resolver.

    * * @return Current function resolver */ public XPathFunctionResolver getXPathFunctionResolver() { return functionResolver; } /** *

    Establishes a namespace context.

    * * @param nsContext Namespace context to use */ public void setNamespaceContext(NamespaceContext nsContext) { if ( nsContext == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"NamespaceContext"} ); throw new NullPointerException( fmsg ); } this.namespaceContext = nsContext; this.prefixResolver = new JAXPPrefixResolver ( nsContext ); } /** *

    Returns the current namespace context.

    * * @return Current Namespace context */ public NamespaceContext getNamespaceContext() { return namespaceContext; } private static Document d = null; private static DocumentBuilder getParser() { try { // we'd really like to cache those DocumentBuilders, but we can't because: // 1. thread safety. parsers are not thread-safe, so at least // we need one instance per a thread. // 2. parsers are non-reentrant, so now we are looking at having a // pool of parsers. // 3. then the class loading issue. The look-up procedure of // DocumentBuilderFactory.newInstance() depends on context class loader // and system properties, which may change during the execution of JVM. // // so we really have to create a fresh DocumentBuilder every time we need one // - KK DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware( true ); dbf.setValidating( false ); return dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { // this should never happen with a well-behaving JAXP implementation. throw new Error(e.toString()); } } private static Document getDummyDocument( ) { // we don't need synchronization here; even if two threads // enter this code at the same time, we just waste a little time if(d==null) { DOMImplementation dim = getParser().getDOMImplementation(); d = dim.createDocument("http://java.sun.com/jaxp/xpath", "dummyroot", null); } return d; } private XObject eval(String expression, Object contextItem) throws javax.xml.transform.TransformerException { org.apache.xpath.XPath xpath = new org.apache.xpath.XPath( expression, null, prefixResolver, org.apache.xpath.XPath.SELECT ); org.apache.xpath.XPathContext xpathSupport = null; // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 // expressions. if ( functionResolver != null ) { JAXPExtensionsProvider jep = new JAXPExtensionsProvider( functionResolver, featureSecureProcessing ); xpathSupport = new org.apache.xpath.XPathContext(jep, false); } else { xpathSupport = new org.apache.xpath.XPathContext(false); } XObject xobj = null; xpathSupport.setVarStack(new JAXPVariableStack(variableResolver)); // If item is null, then we will create a a Dummy contextNode if ( contextItem instanceof Node ) { xobj = xpath.execute (xpathSupport, (Node)contextItem, prefixResolver ); } else { xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver ); } return xobj; } /** *

    Evaluate an XPath expression in the specified context and return the result as the specified type.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If returnType is not one of the types defined in {@link XPathConstants} ( * {@link XPathConstants#NUMBER NUMBER}, * {@link XPathConstants#STRING STRING}, * {@link XPathConstants#BOOLEAN BOOLEAN}, * {@link XPathConstants#NODE NODE} or * {@link XPathConstants#NODESET NODESET}) * then an IllegalArgumentException is thrown.

    * *

    If a null value is provided for * item, an empty document will be used for the * context. * If expression or returnType is null, then a * NullPointerException is thrown.

    * * @param expression The XPath expression. * @param item The starting context (node or node list, for example). * @param returnType The desired return type. * * @return Result of evaluating an XPath expression as an Object of returnType. * * @throws XPathExpressionException If expression cannot be evaluated. * @throws IllegalArgumentException If returnType is not one of the types defined in {@link XPathConstants}. * @throws NullPointerException If expression or returnType is null. */ public Object evaluate(String expression, Object item, QName returnType) throws XPathExpressionException { if ( expression == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"XPath expression"} ); throw new NullPointerException ( fmsg ); } if ( returnType == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"returnType"} ); throw new NullPointerException ( fmsg ); } // Checking if requested returnType is supported. returnType need to // be defined in XPathConstants if ( !isSupported ( returnType ) ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString() } ); throw new IllegalArgumentException ( fmsg ); } try { XObject resultObject = eval( expression, item ); return getResultAsType( resultObject, returnType ); } catch ( java.lang.NullPointerException npe ) { // If VariableResolver returns null Or if we get // NullPointerException at this stage for some other reason // then we have to reurn XPathException throw new XPathExpressionException ( npe ); } catch ( javax.xml.transform.TransformerException te ) { Throwable nestedException = te.getException(); if ( nestedException instanceof javax.xml.xpath.XPathFunctionException ) { throw (javax.xml.xpath.XPathFunctionException)nestedException; } else { // For any other exceptions we need to throw // XPathExpressionException ( as per spec ) throw new XPathExpressionException ( te ); } } } private boolean isSupported( QName returnType ) { if ( ( returnType.equals( XPathConstants.STRING ) ) || ( returnType.equals( XPathConstants.NUMBER ) ) || ( returnType.equals( XPathConstants.BOOLEAN ) ) || ( returnType.equals( XPathConstants.NODE ) ) || ( returnType.equals( XPathConstants.NODESET ) ) ) { return true; } return false; } private Object getResultAsType( XObject resultObject, QName returnType ) throws javax.xml.transform.TransformerException { // XPathConstants.STRING if ( returnType.equals( XPathConstants.STRING ) ) { return resultObject.str(); } // XPathConstants.NUMBER if ( returnType.equals( XPathConstants.NUMBER ) ) { return new Double ( resultObject.num()); } // XPathConstants.BOOLEAN if ( returnType.equals( XPathConstants.BOOLEAN ) ) { return new Boolean( resultObject.bool()); } // XPathConstants.NODESET ---ORdered, UNOrdered??? if ( returnType.equals( XPathConstants.NODESET ) ) { return resultObject.nodelist(); } // XPathConstants.NODE if ( returnType.equals( XPathConstants.NODE ) ) { NodeIterator ni = resultObject.nodeset(); //Return the first node, or null return ni.nextNode(); } String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString()}); throw new IllegalArgumentException( fmsg ); } /** *

    Evaluate an XPath expression in the specified context and return the result as a String.

    * *

    This method calls {@link #evaluate(String expression, Object item, QName returnType)} with a returnType of * {@link XPathConstants#STRING}.

    * *

    See "Evaluation of XPath Expressions" of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If a null value is provided for * item, an empty document will be used for the * context. * If expression is null, then a NullPointerException is thrown.

    * * @param expression The XPath expression. * @param item The starting context (node or node list, for example). * * @return The String that is the result of evaluating the expression and * converting the result to a String. * * @throws XPathExpressionException If expression cannot be evaluated. * @throws NullPointerException If expression is null. */ public String evaluate(String expression, Object item) throws XPathExpressionException { return (String)this.evaluate( expression, item, XPathConstants.STRING ); } /** *

    Compile an XPath expression for later evaluation.

    * *

    If expression contains any {@link XPathFunction}s, * they must be available via the {@link XPathFunctionResolver}. * An {@link XPathExpressionException} will be thrown if the XPathFunction * cannot be resovled with the XPathFunctionResolver.

    * *

    If expression is null, a NullPointerException is thrown.

    * * @param expression The XPath expression. * * @return Compiled XPath expression. * @throws XPathExpressionException If expression cannot be compiled. * @throws NullPointerException If expression is null. */ public XPathExpression compile(String expression) throws XPathExpressionException { if ( expression == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"XPath expression"} ); throw new NullPointerException ( fmsg ); } try { org.apache.xpath.XPath xpath = new XPath (expression, null, prefixResolver, org.apache.xpath.XPath.SELECT ); // Can have errorListener XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath, prefixResolver, functionResolver, variableResolver, featureSecureProcessing ); return ximpl; } catch ( javax.xml.transform.TransformerException te ) { throw new XPathExpressionException ( te ) ; } } /** *

    Evaluate an XPath expression in the context of the specified InputSource * and return the result as the specified type.

    * *

    This method builds a data model for the {@link InputSource} and calls * {@link #evaluate(String expression, Object item, QName returnType)} on the resulting document object.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If returnType is not one of the types defined in {@link XPathConstants}, * then an IllegalArgumentException is thrown.

    * *

    If expression, source or returnType is null, * then a NullPointerException is thrown.

    * * @param expression The XPath expression. * @param source The input source of the document to evaluate over. * @param returnType The desired return type. * * @return The Object that encapsulates the result of evaluating the expression. * * @throws XPathExpressionException If expression cannot be evaluated. * @throws IllegalArgumentException If returnType is not one of the types defined in {@link XPathConstants}. * @throws NullPointerException If expression, source or returnType * is null. */ public Object evaluate(String expression, InputSource source, QName returnType) throws XPathExpressionException { // Checking validity of different parameters if( source== null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"source"} ); throw new NullPointerException ( fmsg ); } if ( expression == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"XPath expression"} ); throw new NullPointerException ( fmsg ); } if ( returnType == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"returnType"} ); throw new NullPointerException ( fmsg ); } //Checking if requested returnType is supported. //returnType need to be defined in XPathConstants if ( !isSupported ( returnType ) ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString() } ); throw new IllegalArgumentException ( fmsg ); } try { Document document = getParser().parse( source ); XObject resultObject = eval( expression, document ); return getResultAsType( resultObject, returnType ); } catch ( SAXException e ) { throw new XPathExpressionException ( e ); } catch( IOException e ) { throw new XPathExpressionException ( e ); } catch ( javax.xml.transform.TransformerException te ) { Throwable nestedException = te.getException(); if ( nestedException instanceof javax.xml.xpath.XPathFunctionException ) { throw (javax.xml.xpath.XPathFunctionException)nestedException; } else { throw new XPathExpressionException ( te ); } } } /** *

    Evaluate an XPath expression in the context of the specified InputSource * and return the result as a String.

    * *

    This method calls {@link #evaluate(String expression, InputSource source, QName returnType)} with a * returnType of {@link XPathConstants#STRING}.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If expression or source is null, * then a NullPointerException is thrown.

    * * @param expression The XPath expression. * @param source The InputSource of the document to evaluate over. * * @return The String that is the result of evaluating the expression and * converting the result to a String. * * @throws XPathExpressionException If expression cannot be evaluated. * @throws NullPointerException If expression or source is null. */ public String evaluate(String expression, InputSource source) throws XPathExpressionException { return (String)this.evaluate( expression, source, XPathConstants.STRING ); } /** *

    Reset this XPath to its original configuration.

    * *

    XPath is reset to the same state as when it was created with * {@link XPathFactory#newXPath()}. * reset() is designed to allow the reuse of existing XPaths * thus saving resources associated with the creation of new XPaths.

    * *

    The reset XPath is not guaranteed to have the same * {@link XPathFunctionResolver}, {@link XPathVariableResolver} * or {@link NamespaceContext} Objects, e.g. {@link Object#equals(Object obj)}. * It is guaranteed to have a functionally equal XPathFunctionResolver, * XPathVariableResolver * and NamespaceContext.

    */ public void reset() { this.variableResolver = this.origVariableResolver; this.functionResolver = this.origFunctionResolver; this.namespaceContext = null; } } libxalan2-java-2.7.1/src/org/apache/xpath/jaxp/JAXPExtensionsProvider.java0000644000175000017500000002036010721374033025366 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // $Id: JAXPExtensionsProvider.java 468655 2006-10-28 07:12:06Z minchau $ package org.apache.xpath.jaxp; import javax.xml.transform.TransformerException; import javax.xml.xpath.XPathFunctionResolver; import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionException; import org.apache.xpath.ExtensionsProvider; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.functions.FuncExtFunction; import java.util.Vector; import java.util.ArrayList; import javax.xml.namespace.QName; /** * * @author Ramesh Mandava ( ramesh.mandava@sun.com ) */ public class JAXPExtensionsProvider implements ExtensionsProvider { private final XPathFunctionResolver resolver; private boolean extensionInvocationDisabled = false; public JAXPExtensionsProvider(XPathFunctionResolver resolver) { this.resolver = resolver; this.extensionInvocationDisabled = false; } public JAXPExtensionsProvider(XPathFunctionResolver resolver, boolean featureSecureProcessing ) { this.resolver = resolver; this.extensionInvocationDisabled = featureSecureProcessing; } /** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } } /** * Is the extension element available? */ public boolean elementAvailable(String ns, String elemName) throws javax.xml.transform.TransformerException { return false; } /** * Execute the extension function. */ public Object extFunction(String ns, String funcName, Vector argVec, Object methodKey) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); // JAXP 1.3 spec says When XMLConstants.FEATURE_SECURE_PROCESSING // feature is set then invocation of extension functions need to // throw XPathFunctionException if ( extensionInvocationDisabled ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, new Object[] { myQName.toString() } ); throw new XPathFunctionException ( fmsg ); } // Assuming user is passing all the needed parameters ( including // default values ) int arity = argVec.size(); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, arity ); // not using methodKey ArrayList argList = new ArrayList( arity); for ( int i=0; i * This class implements a Default PrefixResolver which * can be used to perform prefix-to-namespace lookup * for the XPath object. * This class delegates the resolution to the passed NamespaceContext */ public class JAXPPrefixResolver implements PrefixResolver { private NamespaceContext namespaceContext; public JAXPPrefixResolver ( NamespaceContext nsContext ) { this.namespaceContext = nsContext; } public String getNamespaceForPrefix( String prefix ) { return namespaceContext.getNamespaceURI( prefix ); } /** * Return the base identifier. * * @return null */ public String getBaseIdentifier() { return null; } /** * @see PrefixResolver#handlesNullPrefixes() */ public boolean handlesNullPrefixes() { return false; } /** * The URI for the XML namespace. * (Duplicate of that found in org.apache.xpath.XPathContext). */ public static final String S_XMLNAMESPACEURI = "http://www.w3.org/XML/1998/namespace"; /** * Given a prefix and a Context Node, get the corresponding namespace. * Warning: This will not work correctly if namespaceContext * is an attribute node. * @param prefix Prefix to resolve. * @param namespaceContext Node from which to start searching for a * xmlns attribute that binds a prefix to a namespace. * @return Namespace that prefix resolves to, or null if prefix * is not bound. */ public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node namespaceContext) { Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = S_XMLNAMESPACEURI; } else { int type; while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { NamedNodeMap nnm = parent.getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { Node attr = nnm.item(i); String aname = attr.getNodeName(); boolean isPrefix = aname.startsWith("xmlns:"); if (isPrefix || aname.equals("xmlns")) { int index = aname.indexOf(':'); String p =isPrefix ?aname.substring(index + 1) :""; if (p.equals(prefix)) { namespace = attr.getNodeValue(); break; } } } } parent = parent.getParentNode(); } } return namespace; } } libxalan2-java-2.7.1/src/org/apache/xpath/jaxp/XPathExpressionImpl.java0000644000175000017500000004011010721374032024751 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // $Id: XPathExpressionImpl.java 524813 2007-04-02 15:52:07Z zongaro $ package org.apache.xpath.jaxp; import org.apache.xpath.*; import javax.xml.transform.TransformerException; import org.apache.xpath.objects.XObject; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xalan.res.XSLMessages; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFunctionResolver; import javax.xml.xpath.XPathVariableResolver; import javax.xml.xpath.XPathConstants; import org.w3c.dom.Node; import org.w3c.dom.Document; import org.w3c.dom.DOMImplementation; import org.w3c.dom.traversal.NodeIterator; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.xml.sax.InputSource; /** * The XPathExpression interface encapsulates a (compiled) XPath expression. * * @version $Revision$ * @author Ramesh Mandava */ public class XPathExpressionImpl implements javax.xml.xpath.XPathExpression{ private XPathFunctionResolver functionResolver; private XPathVariableResolver variableResolver; private JAXPPrefixResolver prefixResolver; private org.apache.xpath.XPath xpath; // By default Extension Functions are allowed in XPath Expressions. If // Secure Processing Feature is set on XPathFactory then the invocation of // extensions function need to throw XPathFunctionException private boolean featureSecureProcessing = false; /** Protected constructor to prevent direct instantiation; use compile() * from the context. */ protected XPathExpressionImpl() { }; protected XPathExpressionImpl(org.apache.xpath.XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver ) { this.xpath = xpath; this.prefixResolver = prefixResolver; this.functionResolver = functionResolver; this.variableResolver = variableResolver; this.featureSecureProcessing = false; }; protected XPathExpressionImpl(org.apache.xpath.XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver, boolean featureSecureProcessing ) { this.xpath = xpath; this.prefixResolver = prefixResolver; this.functionResolver = functionResolver; this.variableResolver = variableResolver; this.featureSecureProcessing = featureSecureProcessing; }; public void setXPath (org.apache.xpath.XPath xpath ) { this.xpath = xpath; } public Object eval(Object item, QName returnType) throws javax.xml.transform.TransformerException { XObject resultObject = eval ( item ); return getResultAsType( resultObject, returnType ); } private XObject eval ( Object contextItem ) throws javax.xml.transform.TransformerException { org.apache.xpath.XPathContext xpathSupport = null; // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 // expressions. if ( functionResolver != null ) { JAXPExtensionsProvider jep = new JAXPExtensionsProvider( functionResolver, featureSecureProcessing ); xpathSupport = new org.apache.xpath.XPathContext(jep, false); } else { xpathSupport = new org.apache.xpath.XPathContext(false); } xpathSupport.setVarStack(new JAXPVariableStack(variableResolver)); XObject xobj = null; Node contextNode = (Node)contextItem; // We always need to have a ContextNode with Xalan XPath implementation // To allow simple expression evaluation like 1+1 we are setting // dummy Document as Context Node if ( contextNode == null ) { contextNode = getDummyDocument(); } xobj = xpath.execute(xpathSupport, contextNode, prefixResolver ); return xobj; } /** *

    Evaluate the compiled XPath expression in the specified context and * return the result as the specified type.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If returnType is not one of the types defined * in {@link XPathConstants}, * then an IllegalArgumentException is thrown.

    * *

    If a null value is provided for * item, an empty document will be used for the * context. * If returnType is null, then a * NullPointerException is thrown.

    * * @param item The starting context (node or node list, for example). * @param returnType The desired return type. * * @return The Object that is the result of evaluating the * expression and converting the result to * returnType. * * @throws XPathExpressionException If the expression cannot be evaluated. * @throws IllegalArgumentException If returnType is not one * of the types defined in {@link XPathConstants}. * @throws NullPointerException If returnType is * null. */ public Object evaluate(Object item, QName returnType) throws XPathExpressionException { //Validating parameters to enforce constraints defined by JAXP spec if ( returnType == null ) { //Throwing NullPointerException as defined in spec String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"returnType"} ); throw new NullPointerException( fmsg ); } // Checking if requested returnType is supported. returnType need to be // defined in XPathConstants if ( !isSupported ( returnType ) ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString() } ); throw new IllegalArgumentException ( fmsg ); } try { return eval( item, returnType); } catch ( java.lang.NullPointerException npe ) { // If VariableResolver returns null Or if we get // NullPointerException at this stage for some other reason // then we have to reurn XPathException throw new XPathExpressionException ( npe ); } catch ( javax.xml.transform.TransformerException te ) { Throwable nestedException = te.getException(); if ( nestedException instanceof javax.xml.xpath.XPathFunctionException ) { throw (javax.xml.xpath.XPathFunctionException)nestedException; } else { // For any other exceptions we need to throw // XPathExpressionException ( as per spec ) throw new XPathExpressionException( te); } } } /** *

    Evaluate the compiled XPath expression in the specified context and * return the result as a String.

    * *

    This method calls {@link #evaluate(Object item, QName returnType)} * with a returnType of * {@link XPathConstants#STRING}.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If a null value is provided for * item, an empty document will be used for the * context. * * @param item The starting context (node or node list, for example). * * @return The String that is the result of evaluating the * expression and converting the result to a * String. * * @throws XPathExpressionException If the expression cannot be evaluated. */ public String evaluate(Object item) throws XPathExpressionException { return (String)this.evaluate( item, XPathConstants.STRING ); } static DocumentBuilderFactory dbf = null; static DocumentBuilder db = null; static Document d = null; /** *

    Evaluate the compiled XPath expression in the context of the * specified InputSource and return the result as the * specified type.

    * *

    This method builds a data model for the {@link InputSource} and calls * {@link #evaluate(Object item, QName returnType)} on the resulting * document object.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If returnType is not one of the types defined in * {@link XPathConstants}, * then an IllegalArgumentException is thrown.

    * *

    If source or returnType is null, * then a NullPointerException is thrown.

    * * @param source The InputSource of the document to evaluate * over. * @param returnType The desired return type. * * @return The Object that is the result of evaluating the * expression and converting the result to * returnType. * * @throws XPathExpressionException If the expression cannot be evaluated. * @throws IllegalArgumentException If returnType is not one * of the types defined in {@link XPathConstants}. * @throws NullPointerException If source or * returnType is null. */ public Object evaluate(InputSource source, QName returnType) throws XPathExpressionException { if ( ( source == null ) || ( returnType == null ) ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, null ); throw new NullPointerException ( fmsg ); } // Checking if requested returnType is supported. returnType need to be // defined in XPathConstants if ( !isSupported ( returnType ) ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString() } ); throw new IllegalArgumentException ( fmsg ); } try { if ( dbf == null ) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware( true ); dbf.setValidating( false ); } db = dbf.newDocumentBuilder(); Document document = db.parse( source ); return eval( document, returnType ); } catch ( Exception e ) { throw new XPathExpressionException ( e ); } } /** *

    Evaluate the compiled XPath expression in the context of the specified InputSource and return the result as a * String.

    * *

    This method calls {@link #evaluate(InputSource source, QName returnType)} with a returnType of * {@link XPathConstants#STRING}.

    * *

    See "Evaluation of XPath Expressions" section of JAXP 1.3 spec * for context item evaluation, * variable, function and QName resolution and return type conversion.

    * *

    If source is null, then a NullPointerException is thrown.

    * * @param source The InputSource of the document to evaluate over. * * @return The String that is the result of evaluating the expression and converting the result to a * String. * * @throws XPathExpressionException If the expression cannot be evaluated. * @throws NullPointerException If source is null. */ public String evaluate(InputSource source) throws XPathExpressionException { return (String)this.evaluate( source, XPathConstants.STRING ); } private boolean isSupported( QName returnType ) { // XPathConstants.STRING if ( ( returnType.equals( XPathConstants.STRING ) ) || ( returnType.equals( XPathConstants.NUMBER ) ) || ( returnType.equals( XPathConstants.BOOLEAN ) ) || ( returnType.equals( XPathConstants.NODE ) ) || ( returnType.equals( XPathConstants.NODESET ) ) ) { return true; } return false; } private Object getResultAsType( XObject resultObject, QName returnType ) throws javax.xml.transform.TransformerException { // XPathConstants.STRING if ( returnType.equals( XPathConstants.STRING ) ) { return resultObject.str(); } // XPathConstants.NUMBER if ( returnType.equals( XPathConstants.NUMBER ) ) { return new Double ( resultObject.num()); } // XPathConstants.BOOLEAN if ( returnType.equals( XPathConstants.BOOLEAN ) ) { return new Boolean( resultObject.bool()); } // XPathConstants.NODESET ---ORdered, UNOrdered??? if ( returnType.equals( XPathConstants.NODESET ) ) { return resultObject.nodelist(); } // XPathConstants.NODE if ( returnType.equals( XPathConstants.NODE ) ) { NodeIterator ni = resultObject.nodeset(); //Return the first node, or null return ni.nextNode(); } // If isSupported check is already done then the execution path // shouldn't come here. Being defensive String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString()}); throw new IllegalArgumentException ( fmsg ); } private static Document getDummyDocument( ) { try { if ( dbf == null ) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware( true ); dbf.setValidating( false ); } db = dbf.newDocumentBuilder(); DOMImplementation dim = db.getDOMImplementation(); d = dim.createDocument("http://java.sun.com/jaxp/xpath", "dummyroot", null); return d; } catch ( Exception e ) { e.printStackTrace(); } return null; } } libxalan2-java-2.7.1/src/org/apache/xpath/XPathProcessorException.java0000644000175000017500000000335710721374030024676 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathProcessorException.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; /** * Derived from XPathException in order that XPath processor * exceptions may be specifically caught. * @xsl.usage general */ public class XPathProcessorException extends XPathException { static final long serialVersionUID = 1215509418326642603L; /** * Create an XPathProcessorException object that holds * an error message. * @param message The error message. */ public XPathProcessorException(String message) { super(message); } /** * Create an XPathProcessorException object that holds * an error message, and another exception * that caused this exception. * @param message The error message. * @param e The exception that caused this exception. */ public XPathProcessorException(String message, Exception e) { super(message, e); } } libxalan2-java-2.7.1/src/org/apache/xpath/XPathVisitable.java0000644000175000017500000000314510721374030022755 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathVisitable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; /** * A class that implements this interface will call a XPathVisitor * for itself and members within it's heararchy. If the XPathVisitor's * method returns false, the sub-member heararchy will not be * traversed. */ public interface XPathVisitable { /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param owner The owner of the visitor, where that path may be * rewritten if needed. * @param visitor The visitor whose appropriate method will be called. */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor); } libxalan2-java-2.7.1/src/org/apache/xpath/operations/0000755000175000017500000000000010736146354021417 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/operations/Lte.java0000644000175000017500000000334710721374030023001 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Lte.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The '<=' operation expression executer. */ public class Lte extends Operation { static final long serialVersionUID = 6945650810527140228L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return left.lessThanOrEqual(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/NotEquals.java0000644000175000017500000000336010721374030024163 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NotEquals.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The '!=' operation expression executer. */ public class NotEquals extends Operation { static final long serialVersionUID = -7869072863070586900L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Operation.java0000644000175000017500000001343010721374031024210 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Operation.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XObject; /** * The baseclass for a binary operation. */ public class Operation extends Expression implements ExpressionOwner { static final long serialVersionUID = -3037139537171050430L; /** The left operand expression. * @serial */ protected Expression m_left; /** The right operand expression. * @serial */ protected Expression m_right; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_left.fixupVariables(vars, globalsSize); m_right.fixupVariables(vars, globalsSize); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { if (null != m_left && m_left.canTraverseOutsideSubtree()) return true; if (null != m_right && m_right.canTraverseOutsideSubtree()) return true; return false; } /** * Set the left and right operand expressions for this operation. * * * @param l The left expression operand. * @param r The right expression operand. */ public void setLeftRight(Expression l, Expression r) { m_left = l; m_right = r; l.exprSetParent(this); r.exprSetParent(this); } /** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; } /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return null; // no-op } /** @return the left operand of binary operation, as an Expression. */ public Expression getLeftOperand(){ return m_left; } /** @return the right operand of binary operation, as an Expression. */ public Expression getRightOperand(){ return m_right; } class LeftExprOwner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_left; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(Operation.this); m_left = exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitBinaryOperation(owner, this)) { m_left.callVisitors(new LeftExprOwner(), visitor); m_right.callVisitors(this, visitor); } } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_right; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_right = exp; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; if(!m_left.deepEquals(((Operation)expr).m_left)) return false; if(!m_right.deepEquals(((Operation)expr).m_right)) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/UnaryOperation.java0000644000175000017500000001110410721374030025222 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnaryOperation.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XObject; /** * The unary operation base class. */ public abstract class UnaryOperation extends Expression implements ExpressionOwner { static final long serialVersionUID = 6536083808424286166L; /** The operand for the operation. * @serial */ protected Expression m_right; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_right.fixupVariables(vars, globalsSize); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { if (null != m_right && m_right.canTraverseOutsideSubtree()) return true; return false; } /** * Set the expression operand for the operation. * * * @param r The expression operand to which the unary operation will be * applied. */ public void setRight(Expression r) { m_right = r; r.exprSetParent(this); } /** * Execute the operand and apply the unary operation to the result. * * * @param xctxt The runtime execution context. * * @return An XObject that represents the result of applying the unary * operation to the evaluated operand. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return operate(m_right.execute(xctxt)); } /** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public abstract XObject operate(XObject right) throws javax.xml.transform.TransformerException; /** @return the operand of unary operation, as an Expression. */ public Expression getOperand(){ return m_right; } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitUnaryOperation(owner, this)) { m_right.callVisitors(this, visitor); } } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_right; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_right = exp; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; if(!m_right.deepEquals(((UnaryOperation)expr).m_right)) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Bool.java0000644000175000017500000000422110721374032023142 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Bool.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The 'boolean()' operation expression executer. */ public class Bool extends UnaryOperation { static final long serialVersionUID = 44705375321914635L; /** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { if (XObject.CLASS_BOOLEAN == right.getType()) return right; else return right.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } /** * Evaluate this operation directly to a boolean. * * @param xctxt The runtime execution context. * * @return The result of the operation as a boolean. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_right.bool(xctxt); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Plus.java0000644000175000017500000000422410721374032023175 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Plus.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The '+' operation expression executer. */ public class Plus extends Operation { static final long serialVersionUID = -4492072861616504256L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return new XNumber(left.num() + right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_right.num(xctxt) + m_left.num(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Mod.java0000644000175000017500000000422310721374033022771 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Mod.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The 'mod' operation expression executer. */ public class Mod extends Operation { static final long serialVersionUID = 5009471154238918201L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return new XNumber(left.num() % right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_left.num(xctxt) % m_right.num(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/And.java0000644000175000017500000000446610721374032022764 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: And.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The 'and' operation expression executer. */ public class And extends Operation { static final long serialVersionUID = 392330077126534022L; /** * AND two expressions and return the boolean result. Override * superclass method for optimization purposes. * * @param xctxt The runtime execution context. * * @return {@link org.apache.xpath.objects.XBoolean#S_TRUE} or * {@link org.apache.xpath.objects.XBoolean#S_FALSE}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject expr1 = m_left.execute(xctxt); if (expr1.bool()) { XObject expr2 = m_right.execute(xctxt); return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } else return XBoolean.S_FALSE; } /** * Evaluate this operation directly to a boolean. * * @param xctxt The runtime execution context. * * @return The result of the operation as a boolean. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_left.bool(xctxt) && m_right.bool(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Mult.java0000644000175000017500000000422210721374030023167 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Mult.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The '*' operation expression executer. */ public class Mult extends Operation { static final long serialVersionUID = -4956770147013414675L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return new XNumber(left.num() * right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_left.num(xctxt) * m_right.num(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Or.java0000644000175000017500000000446310721374031022636 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Or.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The 'or' operation expression executer. */ public class Or extends Operation { static final long serialVersionUID = -644107191353853079L; /** * OR two expressions and return the boolean result. Override * superclass method for optimization purposes. * * @param xctxt The runtime execution context. * * @return {@link org.apache.xpath.objects.XBoolean#S_TRUE} or * {@link org.apache.xpath.objects.XBoolean#S_FALSE}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject expr1 = m_left.execute(xctxt); if (!expr1.bool()) { XObject expr2 = m_right.execute(xctxt); return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } else return XBoolean.S_TRUE; } /** * Evaluate this operation directly to a boolean. * * @param xctxt The runtime execution context. * * @return The result of the operation as a boolean. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_left.bool(xctxt) || m_right.bool(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Minus.java0000644000175000017500000000425410721374033023351 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Minus.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The binary '-' operation expression executer. */ public class Minus extends Operation { static final long serialVersionUID = -5297672838170871043L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the * result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return new XNumber(left.num() - right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_left.num(xctxt) - m_right.num(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Gte.java0000644000175000017500000000336610721374030022775 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Gte.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The '>=' operation expression executer. */ public class Gte extends Operation { static final long serialVersionUID = 9142945909906680220L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return left.greaterThanOrEqual(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Number.java0000644000175000017500000000417010721374030023500 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Number.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The 'number()' operation expression executer. */ public class Number extends UnaryOperation { static final long serialVersionUID = 7196954482871619765L; /** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { if (XObject.CLASS_NUMBER == right.getType()) return right; else return new XNumber(right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_right.num(xctxt); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Lt.java0000644000175000017500000000333510721374030022631 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Lt.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The '<' operation expression executer. */ public class Lt extends Operation { static final long serialVersionUID = 3388420509289359422L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return left.lessThan(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Gt.java0000644000175000017500000000334010721374031022621 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Gt.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The '>' operation expression executer. */ public class Gt extends Operation { static final long serialVersionUID = 8927078751014375950L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return left.greaterThan(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/VariableSafeAbsRef.java0000644000175000017500000000572510721374033025671 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VariableSafeAbsRef.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xml.dtm.DTMManager; import org.apache.xpath.Expression; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; /** * This is a "smart" variable reference that is used in situations where * an absolute path is optimized into a variable reference, but may * be used in some situations where the document context may have changed. * For instance, in select="document(doc/@href)//name[//salary > 7250]", the * root in the predicate will be different for each node in the set. While * this is easy to detect statically in this case, in other cases static * detection would be very hard or impossible. So, this class does a dynamic check * to make sure the document context of the referenced variable is the same as * the current document context, and, if it is not, execute the referenced variable's * expression with the current context instead. */ public class VariableSafeAbsRef extends Variable { static final long serialVersionUID = -9174661990819967452L; /** * Dereference the variable, and return the reference value. Note that lazy * evaluation will occur. If a variable within scope is not found, a warning * will be sent to the error listener, and an empty nodeset will be returned. * * * @param xctxt The runtime execution context. * * @return The evaluated variable, or an empty nodeset if not found. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { XNodeSet xns = (XNodeSet)super.execute(xctxt, destructiveOK); DTMManager dtmMgr = xctxt.getDTMManager(); int context = xctxt.getContextNode(); if(dtmMgr.getDTM(xns.getRoot()).getDocument() != dtmMgr.getDTM(context).getDocument()) { Expression expr = (Expression)xns.getContainedIter(); xns = (XNodeSet)expr.asIterator(xctxt, context); } return xns; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/package.html0000644000175000017500000000202210721374032023662 0ustar mkochmkoch Xalan XPath operations.

    Support for XPath operations, such as +, -, string(), etc.

    libxalan2-java-2.7.1/src/org/apache/xpath/operations/String.java0000644000175000017500000000320210721374030023511 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: String.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * The 'string()' operation expression executer. */ public class String extends UnaryOperation { static final long serialVersionUID = 2973374377453022888L; /** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { return (XString)right.xstr(); // semi-safe cast. } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Equals.java0000644000175000017500000000464610721374031023513 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Equals.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * The '=' operation expression executer. */ public class Equals extends Operation { static final long serialVersionUID = -2658315633903426134L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return left.equals(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } /** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); boolean result = left.equals(right) ? true : false; left.detach(); right.detach(); return result; } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Neg.java0000644000175000017500000000404110721374030022756 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Neg.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The unary '-' operation expression executer. */ public class Neg extends UnaryOperation { static final long serialVersionUID = -6280607702375702291L; /** * Apply the operation to two operands, and return the result. * * * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject right) throws javax.xml.transform.TransformerException { return new XNumber(-right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return -(m_right.num(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Div.java0000644000175000017500000000422310721374032022773 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Div.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The 'div' operation expression executer. */ public class Div extends Operation { static final long serialVersionUID = 6220756595959798135L; /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return new XNumber(left.num() / right.num()); } /** * Evaluate this operation directly to a double. * * @param xctxt The runtime execution context. * * @return The result of the operation as a double. * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (m_left.num(xctxt) / m_right.num(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Quo.java0000644000175000017500000000347510721374032023025 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Quo.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * The 'quo' operation expression executer. (no longer supported by XPath). * @deprecated */ public class Quo extends Operation { static final long serialVersionUID = 693765299196169905L; // Actually, this is no longer supported by xpath... /** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return new XNumber((int) (left.num() / right.num())); } } libxalan2-java-2.7.1/src/org/apache/xpath/operations/Variable.java0000644000175000017500000002752010721374032024003 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Variable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.operations; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.QName; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.axes.PathComponent; import org.apache.xpath.axes.WalkerFactory; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; /** * The variable reference expression executer. */ public class Variable extends Expression implements PathComponent { static final long serialVersionUID = -4334975375609297049L; /** Tell if fixupVariables was called. * @serial */ private boolean m_fixUpWasCalled = false; /** The qualified name of the variable. * @serial */ protected QName m_qname; /** * The index of the variable, which is either an absolute index to a * global, or, if higher than the globals area, must be adjusted by adding * the offset to the current stack frame. */ protected int m_index; /** * Set the index for the variable into the stack. For advanced use only. You * must know what you are doing to use this. * * @param index a global or local index. */ public void setIndex(int index) { m_index = index; } /** * Set the index for the variable into the stack. For advanced use only. * * @return index a global or local index. */ public int getIndex() { return m_index; } /** * Set whether or not this is a global reference. For advanced use only. * * @param isGlobal true if this should be a global variable reference. */ public void setIsGlobal(boolean isGlobal) { m_isGlobal = isGlobal; } /** * Set the index for the variable into the stack. For advanced use only. * * @return true if this should be a global variable reference. */ public boolean getGlobal() { return m_isGlobal; } protected boolean m_isGlobal = false; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_fixUpWasCalled = true; int sz = vars.size(); for (int i = vars.size()-1; i >= 0; i--) { QName qn = (QName)vars.elementAt(i); // System.out.println("qn: "+qn); if(qn.equals(m_qname)) { if(i < globalsSize) { m_isGlobal = true; m_index = i; } else { m_index = i-globalsSize; } return; } } java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, new Object[]{m_qname.toString()}); TransformerException te = new TransformerException(msg, this); throw new org.apache.xml.utils.WrappedRuntimeException(te); } /** * Set the qualified name of the variable. * * @param qname Must be a non-null reference to a qualified name. */ public void setQName(QName qname) { m_qname = qname; } /** * Get the qualified name of the variable. * * @return A non-null reference to a qualified name. */ public QName getQName() { return m_qname; } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return execute(xctxt, false); } /** * Dereference the variable, and return the reference value. Note that lazy * evaluation will occur. If a variable within scope is not found, a warning * will be sent to the error listener, and an empty nodeset will be returned. * * * @param xctxt The runtime execution context. * * @return The evaluated variable, or an empty nodeset if not found. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { org.apache.xml.utils.PrefixResolver xprefixResolver = xctxt.getNamespaceContext(); XObject result; // Is the variable fetched always the same? // XObject result = xctxt.getVariable(m_qname); if(m_fixUpWasCalled) { if(m_isGlobal) result = xctxt.getVarStack().getGlobalVariable(xctxt, m_index, destructiveOK); else result = xctxt.getVarStack().getLocalVariable(xctxt, m_index, destructiveOK); } else { result = xctxt.getVarStack().getVariableOrParam(xctxt,m_qname); } if (null == result) { // This should now never happen... warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new Object[]{ m_qname.getLocalPart() }); //"VariableReference given for variable out "+ // (new RuntimeException()).printStackTrace(); // error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, // new Object[]{ m_qname.getLocalPart() }); //"Could not get variable named "+varName); result = new XNodeSet(xctxt.getDTMManager()); } return result; // } // else // { // // Hack city... big time. This is needed to evaluate xpaths from extensions, // // pending some bright light going off in my head. Some sort of callback? // synchronized(this) // { // org.apache.xalan.templates.ElemVariable vvar= getElemVariable(); // if(null != vvar) // { // m_index = vvar.getIndex(); // m_isGlobal = vvar.getIsTopLevel(); // m_fixUpWasCalled = true; // return execute(xctxt); // } // } // throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{m_qname.toString()})); //"Variable not resolvable: "+m_qname); // } } /** * Get the XSLT ElemVariable that this sub-expression references. In order for * this to work, the SourceLocator must be the owning ElemTemplateElement. * @return The dereference to the ElemVariable, or null if not found. */ public org.apache.xalan.templates.ElemVariable getElemVariable() { // Get the current ElemTemplateElement, and then walk backwards in // document order, searching // for an xsl:param element or xsl:variable element that matches our // qname. If we reach the top level, use the StylesheetRoot's composed // list of top level variables and parameters. org.apache.xalan.templates.ElemVariable vvar = null; org.apache.xpath.ExpressionNode owner = getExpressionOwner(); if (null != owner && owner instanceof org.apache.xalan.templates.ElemTemplateElement) { org.apache.xalan.templates.ElemTemplateElement prev = (org.apache.xalan.templates.ElemTemplateElement) owner; if (!(prev instanceof org.apache.xalan.templates.Stylesheet)) { while ( prev != null && !(prev.getParentNode() instanceof org.apache.xalan.templates.Stylesheet) ) { org.apache.xalan.templates.ElemTemplateElement savedprev = prev; while (null != (prev = prev.getPreviousSiblingElem())) { if(prev instanceof org.apache.xalan.templates.ElemVariable) { vvar = (org.apache.xalan.templates.ElemVariable) prev; if (vvar.getName().equals(m_qname)) { return vvar; } vvar = null; } } prev = savedprev.getParentElem(); } } if (prev != null) vvar = prev.getStylesheetRoot().getVariableOrParamComposed(m_qname); } return vvar; } /** * Tell if this expression returns a stable number that will not change during * iterations within the expression. This is used to determine if a proximity * position predicate can indicate that no more searching has to occur. * * * @return true if the expression represents a stable number. */ public boolean isStableNumber() { return true; } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { org.apache.xalan.templates.ElemVariable vvar = getElemVariable(); if(null != vvar) { XPath xpath = vvar.getSelect(); if(null != xpath) { Expression expr = xpath.getExpression(); if(null != expr && expr instanceof PathComponent) { return ((PathComponent)expr).getAnalysisBits(); } } } return WalkerFactory.BIT_FILTER; } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { visitor.visitVariableRef(owner, this); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; if(!m_qname.equals(((Variable)expr).m_qname)) return false; // We have to make sure that the qname really references // the same variable element. if(getElemVariable() != ((Variable)expr).getElemVariable()) return false; return true; } static final java.lang.String PSUEDOVARNAMESPACE = "http://xml.apache.org/xalan/psuedovar"; /** * Tell if this is a psuedo variable reference, declared by Xalan instead * of by the user. */ public boolean isPsuedoVarRef() { java.lang.String ns = m_qname.getNamespaceURI(); if((null != ns) && ns.equals(PSUEDOVARNAMESPACE)) { if(m_qname.getLocalName().startsWith("#")) return true; } return false; } } libxalan2-java-2.7.1/src/org/apache/xpath/XPathVisitor.java0000644000175000017500000001546510721374030022502 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathVisitor.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import org.apache.xpath.axes.LocPathIterator; import org.apache.xpath.axes.UnionPathIterator; import org.apache.xpath.functions.Function; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XString; import org.apache.xpath.operations.Operation; import org.apache.xpath.operations.UnaryOperation; import org.apache.xpath.operations.Variable; import org.apache.xpath.patterns.NodeTest; import org.apache.xpath.patterns.StepPattern; import org.apache.xpath.patterns.UnionPattern; /** * A derivation from this class can be passed to a class that implements * the XPathVisitable interface, to have the appropriate method called * for each component of the XPath. Aside from possible other uses, the * main intention is to provide a reasonable means to perform expression * rewriting. * *

    Each method has the form * boolean visitComponentType(ExpressionOwner owner, ComponentType compType). * The ExpressionOwner argument is the owner of the component, and can * be used to reset the expression for rewriting. If a method returns * false, the sub hierarchy will not be traversed.

    * *

    This class is meant to be a base class that will be derived by concrete classes, * and doesn't much except return true for each method.

    */ public class XPathVisitor { /** * Visit a LocationPath. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param path The LocationPath object. * @return true if the sub expressions should be traversed. */ public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path) { return true; } /** * Visit a UnionPath. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param path The UnionPath object. * @return true if the sub expressions should be traversed. */ public boolean visitUnionPath(ExpressionOwner owner, UnionPathIterator path) { return true; } /** * Visit a step within a location path. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param step The Step object. * @return true if the sub expressions should be traversed. */ public boolean visitStep(ExpressionOwner owner, NodeTest step) { return true; } /** * Visit a predicate within a location path. Note that there isn't a * proper unique component for predicates, and that the expression will * be called also for whatever type Expression is. * * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param pred The predicate object. * @return true if the sub expressions should be traversed. */ public boolean visitPredicate(ExpressionOwner owner, Expression pred) { return true; } /** * Visit a binary operation. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param op The operation object. * @return true if the sub expressions should be traversed. */ public boolean visitBinaryOperation(ExpressionOwner owner, Operation op) { return true; } /** * Visit a unary operation. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param op The operation object. * @return true if the sub expressions should be traversed. */ public boolean visitUnaryOperation(ExpressionOwner owner, UnaryOperation op) { return true; } /** * Visit a variable reference. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param var The variable reference object. * @return true if the sub expressions should be traversed. */ public boolean visitVariableRef(ExpressionOwner owner, Variable var) { return true; } /** * Visit a function. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param func The function reference object. * @return true if the sub expressions should be traversed. */ public boolean visitFunction(ExpressionOwner owner, Function func) { return true; } /** * Visit a match pattern. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param pattern The match pattern object. * @return true if the sub expressions should be traversed. */ public boolean visitMatchPattern(ExpressionOwner owner, StepPattern pattern) { return true; } /** * Visit a union pattern. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param pattern The union pattern object. * @return true if the sub expressions should be traversed. */ public boolean visitUnionPattern(ExpressionOwner owner, UnionPattern pattern) { return true; } /** * Visit a string literal. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param str The string literal object. * @return true if the sub expressions should be traversed. */ public boolean visitStringLiteral(ExpressionOwner owner, XString str) { return true; } /** * Visit a number literal. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param num The number literal object. * @return true if the sub expressions should be traversed. */ public boolean visitNumberLiteral(ExpressionOwner owner, XNumber num) { return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/CachedXPathAPI.java0000644000175000017500000003254110721374032022540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CachedXPathAPI.java 524811 2007-04-02 15:51:59Z zongaro $ */ package org.apache.xpath; import javax.xml.transform.TransformerException; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.PrefixResolverDefault; import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** * The methods in this class are convenience methods into the * low-level XPath API. * * These functions tend to be a little slow, since a number of objects must be * created for each evaluation. A faster way is to precompile the * XPaths using the low-level API, and then just use the XPaths * over and over. * * This is an alternative for the old XPathAPI class, which provided * static methods for the purpose but had the drawback of * instantiating a new XPathContext (and thus building a new DTMManager, * and new DTMs) each time it was called. XPathAPIObject instead retains * its context as long as the object persists, reusing the DTMs. This * does have a downside: if you've changed your source document, you should * obtain a new XPathAPIObject to continue searching it, since trying to use * the old DTMs will probably yield bad results or malfunction outright... and * the cached DTMs may consume memory until this object and its context are * returned to the heap. Essentially, it's the caller's responsibility to * decide when to discard the cache. * * @see XPath Specification * */ public class CachedXPathAPI { /** XPathContext, and thus the document model system (DTMs), persists through multiple calls to this object. This is set in the constructor. */ protected XPathContext xpathSupport; /** *

    Default constructor. Establishes its own {@link XPathContext}, and hence * its own {@link org.apache.xml.dtm.DTMManager}. * Good choice for simple uses.

    *

    Note that any particular instance of {@link CachedXPathAPI} must not be * operated upon by multiple threads without synchronization; we do * not currently support multithreaded access to a single * {@link org.apache.xml.dtm.DTM}.

    */ public CachedXPathAPI() { // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 expressions. xpathSupport = new XPathContext(false); } /** *

    This constructor shares its {@link XPathContext} with a pre-existing * {@link CachedXPathAPI}. That allows sharing document models * ({@link org.apache.xml.dtm.DTM}) and previously established location * state.

    *

    Note that the original {@link CachedXPathAPI} and the new one should * not be operated upon concurrently; we do not support multithreaded access * to a single {@link org.apache.xml.dtm.DTM} at this time. Similarly, * any particular instance of {@link CachedXPathAPI} must not be operated * upon by multiple threads without synchronization.

    *

    %REVIEW% Should this instead do a clone-and-reset on the XPathSupport object?

    * */ public CachedXPathAPI(CachedXPathAPI priorXPathAPI) { xpathSupport = priorXPathAPI.xpathSupport; } /** Returns the XPathSupport object used in this CachedXPathAPI * * %REVIEW% I'm somewhat concerned about the loss of encapsulation * this causes, but the xml-security folks say they need it. * */ public XPathContext getXPathContext() { return this.xpathSupport; } /** * Use an XPath string to select a single node. XPath namespace * prefixes are resolved from the context node, which may not * be what you want (see the next method). * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return The first node found that matches the XPath, or null. * * @throws TransformerException */ public Node selectSingleNode(Node contextNode, String str) throws TransformerException { return selectSingleNode(contextNode, str, contextNode); } /** * Use an XPath string to select a single node. * XPath namespace prefixes are resolved from the namespaceNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return The first node found that matches the XPath, or null. * * @throws TransformerException */ public Node selectSingleNode( Node contextNode, String str, Node namespaceNode) throws TransformerException { // Have the XObject return its result as a NodeSetDTM. NodeIterator nl = selectNodeIterator(contextNode, str, namespaceNode); // Return the first node, or null return nl.nextNode(); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeIterator selectNodeIterator(Node contextNode, String str) throws TransformerException { return selectNodeIterator(contextNode, str, contextNode); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the namespaceNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeIterator selectNodeIterator( Node contextNode, String str, Node namespaceNode) throws TransformerException { // Execute the XPath, and have it return the result XObject list = eval(contextNode, str, namespaceNode); // Have the XObject return its result as a NodeSetDTM. return list.nodeset(); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the namespaceNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList( Node contextNode, String str, Node namespaceNode) throws TransformerException { // Execute the XPath, and have it return the result XObject list = eval(contextNode, str, namespaceNode); // Return a NodeList. return list.nodelist(); } /** * Evaluate XPath string to an XObject. Using this method, * XPath namespace prefixes will be resolved from the namespaceNode. * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null. * @see org.apache.xpath.objects.XObject * @see org.apache.xpath.objects.XNull * @see org.apache.xpath.objects.XBoolean * @see org.apache.xpath.objects.XNumber * @see org.apache.xpath.objects.XString * @see org.apache.xpath.objects.XRTreeFrag * * @throws TransformerException */ public XObject eval(Node contextNode, String str) throws TransformerException { return eval(contextNode, str, contextNode); } /** * Evaluate XPath string to an XObject. * XPath namespace prefixes are resolved from the namespaceNode. * The implementation of this is a little slow, since it creates * a number of objects each time it is called. This could be optimized * to keep the same objects around, but then thread-safety issues would arise. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null. * @see org.apache.xpath.objects.XObject * @see org.apache.xpath.objects.XNull * @see org.apache.xpath.objects.XBoolean * @see org.apache.xpath.objects.XNumber * @see org.apache.xpath.objects.XString * @see org.apache.xpath.objects.XRTreeFrag * * @throws TransformerException */ public XObject eval(Node contextNode, String str, Node namespaceNode) throws TransformerException { // Since we don't have a XML Parser involved here, install some default support // for things like namespaces, etc. // (Changed from: XPathContext xpathSupport = new XPathContext(); // because XPathContext is weak in a number of areas... perhaps // XPathContext should be done away with.) // Create an object to resolve namespace prefixes. // XPath namespaces are resolved from the input context node's document element // if it is a root node, or else the current context node (for lack of a better // resolution space, given the simplicity of this sample code). PrefixResolverDefault prefixResolver = new PrefixResolverDefault( (namespaceNode.getNodeType() == Node.DOCUMENT_NODE) ? ((Document) namespaceNode).getDocumentElement() : namespaceNode); // Create the XPath object. XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null); // Execute the XPath, and have it return the result // return xpath.execute(xpathSupport, contextNode, prefixResolver); int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode); return xpath.execute(xpathSupport, ctxtNode, prefixResolver); } /** * Evaluate XPath string to an XObject. * XPath namespace prefixes are resolved from the namespaceNode. * The implementation of this is a little slow, since it creates * a number of objects each time it is called. This could be optimized * to keep the same objects around, but then thread-safety issues would arise. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param prefixResolver Will be called if the parser encounters namespace * prefixes, to resolve the prefixes to URLs. * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null. * @see org.apache.xpath.objects.XObject * @see org.apache.xpath.objects.XNull * @see org.apache.xpath.objects.XBoolean * @see org.apache.xpath.objects.XNumber * @see org.apache.xpath.objects.XString * @see org.apache.xpath.objects.XRTreeFrag * * @throws TransformerException */ public XObject eval( Node contextNode, String str, PrefixResolver prefixResolver) throws TransformerException { // Since we don't have a XML Parser involved here, install some default support // for things like namespaces, etc. // (Changed from: XPathContext xpathSupport = new XPathContext(); // because XPathContext is weak in a number of areas... perhaps // XPathContext should be done away with.) // Create the XPath object. XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null); // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 expressions. XPathContext xpathSupport = new XPathContext(false); // Execute the XPath, and have it return the result int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode); return xpath.execute(xpathSupport, ctxtNode, prefixResolver); } } libxalan2-java-2.7.1/src/org/apache/xpath/XPathContext.java0000644000175000017500000012314710721374030022464 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathContext.java 524809 2007-04-02 15:51:51Z zongaro $ */ package org.apache.xpath; import java.lang.reflect.Method; import java.util.Stack; import java.util.Vector; import java.util.HashMap; import java.util.Iterator; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.dtm.ref.sax2dtm.SAX2RTFDTM; import org.apache.xml.utils.IntStack; import org.apache.xml.utils.NodeVector; import org.apache.xml.utils.ObjectStack; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xml.utils.XMLString; import org.apache.xpath.axes.SubContextList; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.DTMXRTreeFrag; import org.apache.xpath.objects.XString; import org.apache.xpath.res.XPATHErrorResources; import org.xml.sax.XMLReader; /** * Default class for the runtime execution context for XPath. * *

    This class extends DTMManager but does not directly implement it.

    * @xsl.usage advanced */ public class XPathContext extends DTMManager // implements ExpressionContext { IntStack m_last_pushed_rtfdtm=new IntStack(); /** * Stack of cached "reusable" DTMs for Result Tree Fragments. * This is a kluge to handle the problem of starting an RTF before * the old one is complete. * * %REVIEW% I'm using a Vector rather than Stack so we can reuse * the DTMs if the problem occurs multiple times. I'm not sure that's * really a net win versus discarding the DTM and starting a new one... * but the retained RTF DTM will have been tail-pruned so should be small. */ private Vector m_rtfdtm_stack=null; /** Index of currently active RTF DTM in m_rtfdtm_stack */ private int m_which_rtfdtm=-1; /** * Most recent "reusable" DTM for Global Result Tree Fragments. No stack is * required since we're never going to pop these. */ private SAX2RTFDTM m_global_rtfdtm=null; /** * HashMap of cached the DTMXRTreeFrag objects, which are identified by DTM IDs. * The object are just wrappers for DTMs which are used in XRTreeFrag. */ private HashMap m_DTMXRTreeFrags = null; /** * state of the secure processing feature. */ private boolean m_isSecureProcessing = false; /** * Though XPathContext context extends * the DTMManager, it really is a proxy for this object, which * is the real DTMManager. */ protected DTMManager m_dtmManager = DTMManager.newInstance( org.apache.xpath.objects.XMLStringFactoryImpl.getFactory()); /** * Return the DTMManager object. Though XPathContext context extends * the DTMManager, it really is a proxy for the real DTMManager. If a * caller needs to make a lot of calls to the DTMManager, it is faster * if it gets the real one from this function. */ public DTMManager getDTMManager() { return m_dtmManager; } /** * Set the state of the secure processing feature */ public void setSecureProcessing(boolean flag) { m_isSecureProcessing = flag; } /** * Return the state of the secure processing feature */ public boolean isSecureProcessing() { return m_isSecureProcessing; } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * (I think more parameters will need to be added for error handling, and entity * resolution). * * @param source the specification of the source object, which may be null, * in which case it is assumed that node construction will take * by some other means. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param wsfilter Enables filtering of whitespace nodes, and may be null. * @param incremental true if the construction should try and be incremental. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * * @return a non-null DTM reference. */ public DTM getDTM(javax.xml.transform.Source source, boolean unique, DTMWSFilter wsfilter, boolean incremental, boolean doIndexing) { return m_dtmManager.getDTM(source, unique, wsfilter, incremental, doIndexing); } /** * Get an instance of a DTM that "owns" a node handle. * * @param nodeHandle the nodeHandle. * * @return a non-null DTM reference. */ public DTM getDTM(int nodeHandle) { return m_dtmManager.getDTM(nodeHandle); } /** * Given a W3C DOM node, try and return a DTM handle. * Note: calling this may be non-optimal. * * @param node Non-null reference to a DOM node. * * @return a valid DTM handle. */ public int getDTMHandleFromNode(org.w3c.dom.Node node) { return m_dtmManager.getDTMHandleFromNode(node); } // // /** * %TBD% Doc */ public int getDTMIdentity(DTM dtm) { return m_dtmManager.getDTMIdentity(dtm); } // /** * Creates an empty DocumentFragment object. * @return A new DocumentFragment handle. */ public DTM createDocumentFragment() { return m_dtmManager.createDocumentFragment(); } // /** * Release a DTM either to a lru pool, or completely remove reference. * DTMs without system IDs are always hard deleted. * State: experimental. * * @param dtm The DTM to be released. * @param shouldHardDelete True if the DTM should be removed no matter what. * @return true if the DTM was removed, false if it was put back in a lru pool. */ public boolean release(DTM dtm, boolean shouldHardDelete) { // %REVIEW% If it's a DTM which may contain multiple Result Tree // Fragments, we can't discard it unless we know not only that it // is empty, but that the XPathContext itself is going away. So do // _not_ accept the request. (May want to do it as part of // reset(), though.) if(m_rtfdtm_stack!=null && m_rtfdtm_stack.contains(dtm)) { return false; } return m_dtmManager.release(dtm, shouldHardDelete); } /** * Create a new DTMIterator based on an XPath * UnionExpr. * * @param xpathCompiler ??? Somehow we need to pass in a subpart of the * expression. I hate to do this with strings, since the larger expression * has already been parsed. * * @param pos The position in the expression. * @return The newly created DTMIterator. */ public DTMIterator createDTMIterator(Object xpathCompiler, int pos) { return m_dtmManager.createDTMIterator(xpathCompiler, pos); } // /** * Create a new DTMIterator based on an XPath * UnionExpr. * * @param xpathString Must be a valid string expressing a * UnionExpr. * * @param presolver An object that can resolve prefixes to namespace URLs. * * @return The newly created DTMIterator. */ public DTMIterator createDTMIterator(String xpathString, PrefixResolver presolver) { return m_dtmManager.createDTMIterator(xpathString, presolver); } // /** * Create a new DTMIterator based only on a whatToShow and * a DTMFilter. The traversal semantics are defined as the descendant * access. * * @param whatToShow This flag specifies which node types may appear in * the logical view of the tree presented by the iterator. See the * description of NodeFilter for the set of possible * SHOW_ values.These flags can be combined using * OR. * @param filter The NodeFilter to be used with this * TreeWalker, or null to indicate no filter. * @param entityReferenceExpansion The value of this flag determines * whether entity reference nodes are expanded. * * @return The newly created NodeIterator. */ public DTMIterator createDTMIterator(int whatToShow, DTMFilter filter, boolean entityReferenceExpansion) { return m_dtmManager.createDTMIterator(whatToShow, filter, entityReferenceExpansion); } /** * Create a new DTMIterator that holds exactly one node. * * @param node The node handle that the DTMIterator will iterate to. * * @return The newly created DTMIterator. */ public DTMIterator createDTMIterator(int node) { // DescendantIterator iter = new DescendantIterator(); DTMIterator iter = new org.apache.xpath.axes.OneStepIteratorForward(Axis.SELF); iter.setRoot(node, this); return iter; // return m_dtmManager.createDTMIterator(node); } /** * Create an XPathContext instance. This is equivalent to calling * the {@link #XPathContext(boolean)} constructor with the value * true. */ public XPathContext() { this(true); } /** * Create an XPathContext instance. * @param recursiveVarContext A boolean value indicating whether * the XPath context needs to support pushing of scopes for * variable resolution */ public XPathContext(boolean recursiveVarContext) { m_prefixResolvers.push(null); m_currentNodes.push(DTM.NULL); m_currentExpressionNodes.push(DTM.NULL); m_saxLocations.push(null); m_variableStacks = recursiveVarContext ? new VariableStack() : new VariableStack(1); } /** * Create an XPathContext instance. This is equivalent to calling the * constructor {@link #XPathContext(java.lang.Object,boolean)} with the * value of the second parameter set to true. * @param owner Value that can be retrieved via the getOwnerObject() method. * @see #getOwnerObject */ public XPathContext(Object owner) { this(owner, true); } /** * Create an XPathContext instance. * @param owner Value that can be retrieved via the getOwnerObject() method. * @see #getOwnerObject * @param recursiveVarContext A boolean value indicating whether * the XPath context needs to support pushing of scopes for * variable resolution */ public XPathContext(Object owner, boolean recursiveVarContext) { this(recursiveVarContext); m_owner = owner; try { m_ownerGetErrorListener = m_owner.getClass().getMethod("getErrorListener", new Class[] {}); } catch (NoSuchMethodException nsme) {} } /** * Reset for new run. */ public void reset() { releaseDTMXRTreeFrags(); // These couldn't be disposed of earlier (see comments in release()); zap them now. if(m_rtfdtm_stack!=null) for (java.util.Enumeration e = m_rtfdtm_stack.elements() ; e.hasMoreElements() ;) m_dtmManager.release((DTM)e.nextElement(), true); m_rtfdtm_stack=null; // drop our references too m_which_rtfdtm=-1; if(m_global_rtfdtm!=null) m_dtmManager.release(m_global_rtfdtm,true); m_global_rtfdtm=null; m_dtmManager = DTMManager.newInstance( org.apache.xpath.objects.XMLStringFactoryImpl.getFactory()); m_saxLocations.removeAllElements(); m_axesIteratorStack.removeAllElements(); m_contextNodeLists.removeAllElements(); m_currentExpressionNodes.removeAllElements(); m_currentNodes.removeAllElements(); m_iteratorRoots.RemoveAllNoClear(); m_predicatePos.removeAllElements(); m_predicateRoots.RemoveAllNoClear(); m_prefixResolvers.removeAllElements(); m_prefixResolvers.push(null); m_currentNodes.push(DTM.NULL); m_currentExpressionNodes.push(DTM.NULL); m_saxLocations.push(null); } /** The current stylesheet locator. */ ObjectStack m_saxLocations = new ObjectStack(RECURSIONLIMIT); /** * Set the current locater in the stylesheet. * * @param location The location within the stylesheet. */ public void setSAXLocator(SourceLocator location) { m_saxLocations.setTop(location); } /** * Set the current locater in the stylesheet. * * @param location The location within the stylesheet. */ public void pushSAXLocator(SourceLocator location) { m_saxLocations.push(location); } /** * Push a slot on the locations stack so that setSAXLocator can be * repeatedly called. * */ public void pushSAXLocatorNull() { m_saxLocations.push(null); } /** * Pop the current locater. */ public void popSAXLocator() { m_saxLocations.pop(); } /** * Get the current locater in the stylesheet. * * @return The location within the stylesheet, or null if not known. */ public SourceLocator getSAXLocator() { return (SourceLocator) m_saxLocations.peek(); } /** The owner context of this XPathContext. In the case of XSLT, this will be a * Transformer object. */ private Object m_owner; /** The owner context of this XPathContext. In the case of XSLT, this will be a * Transformer object. */ private Method m_ownerGetErrorListener; /** * Get the "owner" context of this context, which should be, * in the case of XSLT, the Transformer object. This is needed * so that XSLT functions can get the Transformer. * @return The owner object passed into the constructor, or null. */ public Object getOwnerObject() { return m_owner; } // ================ VarStack =================== /** * The stack of Variable stacks. A VariableStack will be * pushed onto this stack for each template invocation. */ private VariableStack m_variableStacks; /** * Get the variable stack, which is in charge of variables and * parameters. * * @return the variable stack, which should not be null. */ public final VariableStack getVarStack() { return m_variableStacks; } /** * Get the variable stack, which is in charge of variables and * parameters. * * @param varStack non-null reference to the variable stack. */ public final void setVarStack(VariableStack varStack) { m_variableStacks = varStack; } // ================ SourceTreeManager =================== /** The source tree manager, which associates Source objects to source * tree nodes. */ private SourceTreeManager m_sourceTreeManager = new SourceTreeManager(); /** * Get the SourceTreeManager associated with this execution context. * * @return the SourceTreeManager associated with this execution context. */ public final SourceTreeManager getSourceTreeManager() { return m_sourceTreeManager; } /** * Set the SourceTreeManager associated with this execution context. * * @param mgr the SourceTreeManager to be associated with this * execution context. */ public void setSourceTreeManager(SourceTreeManager mgr) { m_sourceTreeManager = mgr; } // ================================================= /** The ErrorListener where errors and warnings are to be reported. */ private ErrorListener m_errorListener; /** A default ErrorListener in case our m_errorListener was not specified and our * owner either does not have an ErrorListener or has a null one. */ private ErrorListener m_defaultErrorListener; /** * Get the ErrorListener where errors and warnings are to be reported. * * @return A non-null ErrorListener reference. */ public final ErrorListener getErrorListener() { if (null != m_errorListener) return m_errorListener; ErrorListener retval = null; try { if (null != m_ownerGetErrorListener) retval = (ErrorListener) m_ownerGetErrorListener.invoke(m_owner, new Object[] {}); } catch (Exception e) {} if (null == retval) { if (null == m_defaultErrorListener) m_defaultErrorListener = new org.apache.xml.utils.DefaultErrorHandler(); retval = m_defaultErrorListener; } return retval; } /** * Set the ErrorListener where errors and warnings are to be reported. * * @param listener A non-null ErrorListener reference. */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { if (listener == null) throw new IllegalArgumentException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler"); m_errorListener = listener; } // ================================================= /** The TrAX URI Resolver for resolving URIs from the document(...) * function to source tree nodes. */ private URIResolver m_uriResolver; /** * Get the URIResolver associated with this execution context. * * @return a URI resolver, which may be null. */ public final URIResolver getURIResolver() { return m_uriResolver; } /** * Set the URIResolver associated with this execution context. * * @param resolver the URIResolver to be associated with this * execution context, may be null to clear an already set resolver. */ public void setURIResolver(URIResolver resolver) { m_uriResolver = resolver; } // ================================================= /** The reader of the primary source tree. */ public XMLReader m_primaryReader; /** * Get primary XMLReader associated with this execution context. * * @return The reader of the primary source tree. */ public final XMLReader getPrimaryReader() { return m_primaryReader; } /** * Set primary XMLReader associated with this execution context. * * @param reader The reader of the primary source tree. */ public void setPrimaryReader(XMLReader reader) { m_primaryReader = reader; } // ================================================= /** Misnamed string manager for XPath messages. */ // private static XSLMessages m_XSLMessages = new XSLMessages(); /** * Tell the user of an assertion error, and probably throw an * exception. * * @param b If false, a TransformerException will be thrown. * @param msg The assertion message, which should be informative. * * @throws javax.xml.transform.TransformerException if b is false. */ private void assertion(boolean b, String msg) throws javax.xml.transform.TransformerException { if (!b) { ErrorListener errorHandler = getErrorListener(); if (errorHandler != null) { errorHandler.fatalError( new TransformerException( XSLMessages.createMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ msg }), (SAXSourceLocator)this.getSAXLocator())); } } } //========================================================== // SECTION: Execution context state tracking //========================================================== /** * The current context node list. */ private Stack m_contextNodeLists = new Stack(); public Stack getContextNodeListsStack() { return m_contextNodeLists; } public void setContextNodeListsStack(Stack s) { m_contextNodeLists = s; } /** * Get the current context node list. * * @return the current node list, * also refered to here as a context node list. */ public final DTMIterator getContextNodeList() { if (m_contextNodeLists.size() > 0) return (DTMIterator) m_contextNodeLists.peek(); else return null; } /** * Set the current context node list. * * @param nl the current node list, * also refered to here as a context node list. * @xsl.usage internal */ public final void pushContextNodeList(DTMIterator nl) { m_contextNodeLists.push(nl); } /** * Pop the current context node list. * @xsl.usage internal */ public final void popContextNodeList() { if(m_contextNodeLists.isEmpty()) System.err.println("Warning: popContextNodeList when stack is empty!"); else m_contextNodeLists.pop(); } /** * The ammount to use for stacks that record information during the * recursive execution. */ public static final int RECURSIONLIMIT = (1024*4); /** The stack of current node objects. * Not to be confused with the current node list. %REVIEW% Note that there * are no bounds check and resize for this stack, so if it is blown, it's all * over. */ private IntStack m_currentNodes = new IntStack(RECURSIONLIMIT); // private NodeVector m_currentNodes = new NodeVector(); public IntStack getCurrentNodeStack() {return m_currentNodes; } public void setCurrentNodeStack(IntStack nv) { m_currentNodes = nv; } /** * Get the current context node. * * @return the current node. */ public final int getCurrentNode() { return m_currentNodes.peek(); } /** * Set the current context node and expression node. * * @param cn the current node. * @param en the sub-expression context node. */ public final void pushCurrentNodeAndExpression(int cn, int en) { m_currentNodes.push(cn); m_currentExpressionNodes.push(cn); } /** * Set the current context node. */ public final void popCurrentNodeAndExpression() { m_currentNodes.quickPop(1); m_currentExpressionNodes.quickPop(1); } /** * Push the current context node, expression node, and prefix resolver. * * @param cn the current node. * @param en the sub-expression context node. * @param nc the namespace context (prefix resolver. */ public final void pushExpressionState(int cn, int en, PrefixResolver nc) { m_currentNodes.push(cn); m_currentExpressionNodes.push(cn); m_prefixResolvers.push(nc); } /** * Pop the current context node, expression node, and prefix resolver. */ public final void popExpressionState() { m_currentNodes.quickPop(1); m_currentExpressionNodes.quickPop(1); m_prefixResolvers.pop(); } /** * Set the current context node. * * @param n the current node. */ public final void pushCurrentNode(int n) { m_currentNodes.push(n); } /** * Pop the current context node. */ public final void popCurrentNode() { m_currentNodes.quickPop(1); } /** * Set the current predicate root. */ public final void pushPredicateRoot(int n) { m_predicateRoots.push(n); } /** * Pop the current predicate root. */ public final void popPredicateRoot() { m_predicateRoots.popQuick(); } /** * Get the current predicate root. */ public final int getPredicateRoot() { return m_predicateRoots.peepOrNull(); } /** * Set the current location path iterator root. */ public final void pushIteratorRoot(int n) { m_iteratorRoots.push(n); } /** * Pop the current location path iterator root. */ public final void popIteratorRoot() { m_iteratorRoots.popQuick(); } /** * Get the current location path iterator root. */ public final int getIteratorRoot() { return m_iteratorRoots.peepOrNull(); } /** A stack of the current sub-expression nodes. */ private NodeVector m_iteratorRoots = new NodeVector(); /** A stack of the current sub-expression nodes. */ private NodeVector m_predicateRoots = new NodeVector(); /** A stack of the current sub-expression nodes. */ private IntStack m_currentExpressionNodes = new IntStack(RECURSIONLIMIT); public IntStack getCurrentExpressionNodeStack() { return m_currentExpressionNodes; } public void setCurrentExpressionNodeStack(IntStack nv) { m_currentExpressionNodes = nv; } private IntStack m_predicatePos = new IntStack(); public final int getPredicatePos() { return m_predicatePos.peek(); } public final void pushPredicatePos(int n) { m_predicatePos.push(n); } public final void popPredicatePos() { m_predicatePos.pop(); } /** * Get the current node that is the expression's context (i.e. for current() support). * * @return The current sub-expression node. */ public final int getCurrentExpressionNode() { return m_currentExpressionNodes.peek(); } /** * Set the current node that is the expression's context (i.e. for current() support). * * @param n The sub-expression node to be current. */ public final void pushCurrentExpressionNode(int n) { m_currentExpressionNodes.push(n); } /** * Pop the current node that is the expression's context * (i.e. for current() support). */ public final void popCurrentExpressionNode() { m_currentExpressionNodes.quickPop(1); } private ObjectStack m_prefixResolvers = new ObjectStack(RECURSIONLIMIT); /** * Get the current namespace context for the xpath. * * @return the current prefix resolver for resolving prefixes to * namespace URLs. */ public final PrefixResolver getNamespaceContext() { return (PrefixResolver) m_prefixResolvers.peek(); } /** * Get the current namespace context for the xpath. * * @param pr the prefix resolver to be used for resolving prefixes to * namespace URLs. */ public final void setNamespaceContext(PrefixResolver pr) { m_prefixResolvers.setTop(pr); } /** * Push a current namespace context for the xpath. * * @param pr the prefix resolver to be used for resolving prefixes to * namespace URLs. */ public final void pushNamespaceContext(PrefixResolver pr) { m_prefixResolvers.push(pr); } /** * Just increment the namespace contest stack, so that setNamespaceContext * can be used on the slot. */ public final void pushNamespaceContextNull() { m_prefixResolvers.push(null); } /** * Pop the current namespace context for the xpath. */ public final void popNamespaceContext() { m_prefixResolvers.pop(); } //========================================================== // SECTION: Current TreeWalker contexts (for internal use) //========================================================== /** * Stack of AxesIterators. */ private Stack m_axesIteratorStack = new Stack(); public Stack getAxesIteratorStackStacks() { return m_axesIteratorStack; } public void setAxesIteratorStackStacks(Stack s) { m_axesIteratorStack = s; } /** * Push a TreeWalker on the stack. * * @param iter A sub-context AxesWalker. * @xsl.usage internal */ public final void pushSubContextList(SubContextList iter) { m_axesIteratorStack.push(iter); } /** * Pop the last pushed axes iterator. * @xsl.usage internal */ public final void popSubContextList() { m_axesIteratorStack.pop(); } /** * Get the current axes iterator, or return null if none. * * @return the sub-context node list. * @xsl.usage internal */ public SubContextList getSubContextList() { return m_axesIteratorStack.isEmpty() ? null : (SubContextList) m_axesIteratorStack.peek(); } /** * Get the current node list * as defined by the XSLT spec. * * @return the current node list. * @xsl.usage internal */ public org.apache.xpath.axes.SubContextList getCurrentNodeList() { return m_axesIteratorStack.isEmpty() ? null : (SubContextList) m_axesIteratorStack.elementAt(0); } //========================================================== // SECTION: Implementation of ExpressionContext interface //========================================================== /** * Get the current context node. * @return The current context node. */ public final int getContextNode() { return this.getCurrentNode(); } /** * Get the current context node list. * @return An iterator for the current context list, as * defined in XSLT. */ public final DTMIterator getContextNodes() { try { DTMIterator cnl = getContextNodeList(); if (null != cnl) return cnl.cloneWithReset(); else return null; // for now... this might ought to be an empty iterator. } catch (CloneNotSupportedException cnse) { return null; // error reporting? } } XPathExpressionContext expressionContext = new XPathExpressionContext(); /** * The the expression context for extensions for this context. * * @return An object that implements the ExpressionContext. */ public ExpressionContext getExpressionContext() { return expressionContext; } public class XPathExpressionContext implements ExpressionContext { /** * Return the XPathContext associated with this XPathExpressionContext. * Extensions should use this judiciously and only when special processing * requirements cannot be met another way. Consider requesting an enhancement * to the ExpressionContext interface to avoid having to call this method. * @return the XPathContext associated with this XPathExpressionContext. */ public XPathContext getXPathContext() { return XPathContext.this; } /** * Return the DTMManager object. Though XPathContext context extends * the DTMManager, it really is a proxy for the real DTMManager. If a * caller needs to make a lot of calls to the DTMManager, it is faster * if it gets the real one from this function. */ public DTMManager getDTMManager() { return m_dtmManager; } /** * Get the current context node. * @return The current context node. */ public org.w3c.dom.Node getContextNode() { int context = getCurrentNode(); return getDTM(context).getNode(context); } /** * Get the current context node list. * @return An iterator for the current context list, as * defined in XSLT. */ public org.w3c.dom.traversal.NodeIterator getContextNodes() { return new org.apache.xml.dtm.ref.DTMNodeIterator(getContextNodeList()); } /** * Get the error listener. * @return The registered error listener. */ public ErrorListener getErrorListener() { return XPathContext.this.getErrorListener(); } /** * Get the value of a node as a number. * @param n Node to be converted to a number. May be null. * @return value of n as a number. */ public double toNumber(org.w3c.dom.Node n) { // %REVIEW% You can't get much uglier than this... int nodeHandle = getDTMHandleFromNode(n); DTM dtm = getDTM(nodeHandle); XString xobj = (XString)dtm.getStringValue(nodeHandle); return xobj.num(); } /** * Get the value of a node as a string. * @param n Node to be converted to a string. May be null. * @return value of n as a string, or an empty string if n is null. */ public String toString(org.w3c.dom.Node n) { // %REVIEW% You can't get much uglier than this... int nodeHandle = getDTMHandleFromNode(n); DTM dtm = getDTM(nodeHandle); XMLString strVal = dtm.getStringValue(nodeHandle); return strVal.toString(); } /** * Get a variable based on it's qualified name. * @param qname The qualified name of the variable. * @return The evaluated value of the variable. * @throws javax.xml.transform.TransformerException */ public final XObject getVariableOrParam(org.apache.xml.utils.QName qname) throws javax.xml.transform.TransformerException { return m_variableStacks.getVariableOrParam(XPathContext.this, qname); } } /** * Get a DTM to be used as a container for a global Result Tree * Fragment. This will always be an instance of (derived from? equivalent to?) * SAX2DTM, since each RTF is constructed by temporarily redirecting our SAX * output to it. It may be a single DTM containing for multiple fragments, * if the implementation supports that. * * Note: The distinction between this method and getRTFDTM() is that the latter * allocates space from the dynamic variable stack (m_rtfdtm_stack), which may * be pruned away again as the templates which defined those variables are exited. * Global variables may be bound late (see XUnresolvedVariable), and never want to * be discarded, hence we need to allocate them separately and don't actually need * a stack to track them. * * @return a non-null DTM reference. */ public DTM getGlobalRTFDTM() { // We probably should _NOT_ be applying whitespace filtering at this stage! // // Some magic has been applied in DTMManagerDefault to recognize this set of options // and generate an instance of DTM which can contain multiple documents // (SAX2RTFDTM). Perhaps not the optimal way of achieving that result, but // I didn't want to change the manager API at this time, or expose // too many dependencies on its internals. (Ideally, I'd like to move // isTreeIncomplete all the way up to DTM, so we wouldn't need to explicitly // specify the subclass here.) // If it doesn't exist, or if the one already existing is in the middle of // being constructed, we need to obtain a new DTM to write into. I'm not sure // the latter will ever arise, but I'd rather be just a bit paranoid.. if( m_global_rtfdtm==null || m_global_rtfdtm.isTreeIncomplete() ) { m_global_rtfdtm=(SAX2RTFDTM)m_dtmManager.getDTM(null,true,null,false,false); } return m_global_rtfdtm; } /** * Get a DTM to be used as a container for a dynamic Result Tree * Fragment. This will always be an instance of (derived from? equivalent to?) * SAX2DTM, since each RTF is constructed by temporarily redirecting our SAX * output to it. It may be a single DTM containing for multiple fragments, * if the implementation supports that. * * @return a non-null DTM reference. */ public DTM getRTFDTM() { SAX2RTFDTM rtfdtm; // We probably should _NOT_ be applying whitespace filtering at this stage! // // Some magic has been applied in DTMManagerDefault to recognize this set of options // and generate an instance of DTM which can contain multiple documents // (SAX2RTFDTM). Perhaps not the optimal way of achieving that result, but // I didn't want to change the manager API at this time, or expose // too many dependencies on its internals. (Ideally, I'd like to move // isTreeIncomplete all the way up to DTM, so we wouldn't need to explicitly // specify the subclass here.) if(m_rtfdtm_stack==null) { m_rtfdtm_stack=new Vector(); rtfdtm=(SAX2RTFDTM)m_dtmManager.getDTM(null,true,null,false,false); m_rtfdtm_stack.addElement(rtfdtm); ++m_which_rtfdtm; } else if(m_which_rtfdtm<0) { rtfdtm=(SAX2RTFDTM)m_rtfdtm_stack.elementAt(++m_which_rtfdtm); } else { rtfdtm=(SAX2RTFDTM)m_rtfdtm_stack.elementAt(m_which_rtfdtm); // It might already be under construction -- the classic example would be // an xsl:variable which uses xsl:call-template as part of its value. To // handle this recursion, we have to start a new RTF DTM, pushing the old // one onto a stack so we can return to it. This is not as uncommon a case // as we might wish, unfortunately, as some folks insist on coding XSLT // as if it were a procedural language... if(rtfdtm.isTreeIncomplete()) { if(++m_which_rtfdtm < m_rtfdtm_stack.size()) rtfdtm=(SAX2RTFDTM)m_rtfdtm_stack.elementAt(m_which_rtfdtm); else { rtfdtm=(SAX2RTFDTM)m_dtmManager.getDTM(null,true,null,false,false); m_rtfdtm_stack.addElement(rtfdtm); } } } return rtfdtm; } /** Push the RTFDTM's context mark, to allows discarding RTFs added after this * point. (If it doesn't exist we don't push, since we might still be able to * get away with not creating it. That requires that excessive pops be harmless.) * */ public void pushRTFContext() { m_last_pushed_rtfdtm.push(m_which_rtfdtm); if(null!=m_rtfdtm_stack) ((SAX2RTFDTM)(getRTFDTM())).pushRewindMark(); } /** Pop the RTFDTM's context mark. This discards any RTFs added after the last * mark was set. * * If there is no RTF DTM, there's nothing to pop so this * becomes a no-op. If pushes were issued before this was called, we count on * the fact that popRewindMark is defined such that overpopping just resets * to empty. * * Complicating factor: We need to handle the case of popping back to a previous * RTF DTM, if one of the weird produce-an-RTF-to-build-an-RTF cases arose. * Basically: If pop says this DTM is now empty, then return to the previous * if one exists, in whatever state we left it in. UGLY, but hopefully the * situation which forces us to consider this will arise exceedingly rarely. * */ public void popRTFContext() { int previous=m_last_pushed_rtfdtm.pop(); if(null==m_rtfdtm_stack) return; if(m_which_rtfdtm==previous) { if(previous>=0) // guard against none-active { boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(previous))).popRewindMark(); } } else while(m_which_rtfdtm!=previous) { // Empty each DTM before popping, so it's ready for reuse // _DON'T_ pop the previous, since it's still open (which is why we // stacked up more of these) and did not receive a mark. boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark(); --m_which_rtfdtm; } } /** * Gets DTMXRTreeFrag object if one has already been created. * Creates new DTMXRTreeFrag object and adds to m_DTMXRTreeFrags HashMap, * otherwise. * @param dtmIdentity * @return DTMXRTreeFrag */ public DTMXRTreeFrag getDTMXRTreeFrag(int dtmIdentity){ if(m_DTMXRTreeFrags == null){ m_DTMXRTreeFrags = new HashMap(); } if(m_DTMXRTreeFrags.containsKey(new Integer(dtmIdentity))){ return (DTMXRTreeFrag)m_DTMXRTreeFrags.get(new Integer(dtmIdentity)); }else{ final DTMXRTreeFrag frag = new DTMXRTreeFrag(dtmIdentity,this); m_DTMXRTreeFrags.put(new Integer(dtmIdentity),frag); return frag ; } } /** * Cleans DTMXRTreeFrag objects by removing references * to DTM and XPathContext objects. */ private final void releaseDTMXRTreeFrags(){ if(m_DTMXRTreeFrags == null){ return; } final Iterator iter = (m_DTMXRTreeFrags.values()).iterator(); while(iter.hasNext()){ DTMXRTreeFrag frag = (DTMXRTreeFrag)iter.next(); frag.destruct(); iter.remove(); } m_DTMXRTreeFrags = null; } } libxalan2-java-2.7.1/src/org/apache/xpath/domapi/0000755000175000017500000000000010736146354020505 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/domapi/XPathNSResolverImpl.java0000644000175000017500000000423710721374033025176 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xpath.domapi; import org.apache.xml.utils.PrefixResolverDefault; import org.w3c.dom.Node; import org.w3c.dom.xpath.XPathNSResolver; /** * * The class provides an implementation XPathNSResolver according * to the DOM L3 XPath Specification, Working Group Note 26 February 2004. * *

    See also the Document Object Model (DOM) Level 3 XPath Specification.

    * *

    The XPathNSResolver interface permit prefix * strings in the expression to be properly bound to * namespaceURI strings. XPathEvaluator can * construct an implementation of XPathNSResolver from a node, * or the interface may be implemented by any application.

    * * @see org.w3c.dom.xpath.XPathNSResolver * @xsl.usage internal */ class XPathNSResolverImpl extends PrefixResolverDefault implements XPathNSResolver { /** * Constructor for XPathNSResolverImpl. * @param xpathExpressionContext */ public XPathNSResolverImpl(Node xpathExpressionContext) { super(xpathExpressionContext); } /** * @see org.w3c.dom.xpath.XPathNSResolver#lookupNamespaceURI(String) */ public String lookupNamespaceURI(String prefix) { return super.getNamespaceForPrefix(prefix); } } libxalan2-java-2.7.1/src/org/apache/xpath/domapi/XPathResultImpl.java0000644000175000017500000004733710721374031024420 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xpath.domapi; import javax.xml.transform.TransformerException; import org.apache.xpath.XPath; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xpath.res.XPATHMessages; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener; import org.w3c.dom.events.EventTarget; import org.w3c.dom.traversal.NodeIterator; import org.w3c.dom.xpath.XPathException; import org.w3c.dom.xpath.XPathResult; /** * * The class provides an implementation XPathResult according * to the DOM L3 XPath Specification, Working Group Note 26 February 2004. * *

    See also the Document Object Model (DOM) Level 3 XPath Specification.

    * *

    The XPathResult interface represents the result of the * evaluation of an XPath expression within the context of a particular * node. Since evaluation of an XPath expression can result in various * result types, this object makes it possible to discover and manipulate * the type and value of the result.

    * *

    This implementation wraps an XObject. * * @see org.apache.xpath.objects.XObject * @see org.w3c.dom.xpath.XPathResult * * @xsl.usage internal */ class XPathResultImpl implements XPathResult, EventListener { /** * The wrapped XObject */ final private XObject m_resultObj; /** * The xpath object that wraps the expression used for this result. */ final private XPath m_xpath; /** * This the type specified by the user during construction. Typically * the constructor will be called by org.apache.xpath.XPath.evaluate(). */ final private short m_resultType; private boolean m_isInvalidIteratorState = false; /** * Only used to attach a mutation event handler when specified * type is an iterator type. */ final private Node m_contextNode; /** * The iterator, if this is an iterator type. */ private NodeIterator m_iterator = null;; /** * The list, if this is a snapshot type. */ private NodeList m_list = null; /** * Constructor for XPathResultImpl. * * For internal use only. */ XPathResultImpl(short type, XObject result, Node contextNode, XPath xpath) { // Check that the type is valid if (!isValidType(type)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INVALID_XPATH_TYPE, new Object[] {new Integer(type)}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // Invalid XPath type argument: {0} } // Result object should never be null! if (null == result) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_EMPTY_XPATH_RESULT, null); throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,fmsg); // Empty XPath result object } this.m_resultObj = result; this.m_contextNode = contextNode; this.m_xpath = xpath; // If specified result was ANY_TYPE, determine XObject type if (type == ANY_TYPE) { this.m_resultType = getTypeFromXObject(result); } else { this.m_resultType = type; } // If the context node supports DOM Events and the type is one of the iterator // types register this result as an event listener if (((m_resultType == XPathResult.ORDERED_NODE_ITERATOR_TYPE) || (m_resultType == XPathResult.UNORDERED_NODE_ITERATOR_TYPE))) { addEventListener(); }// else can we handle iterator types if contextNode doesn't support EventTarget?? // If this is an iterator type get the iterator if ((m_resultType == ORDERED_NODE_ITERATOR_TYPE) || (m_resultType == UNORDERED_NODE_ITERATOR_TYPE) || (m_resultType == ANY_UNORDERED_NODE_TYPE) || (m_resultType == FIRST_ORDERED_NODE_TYPE)) { try { m_iterator = m_resultObj.nodeset(); } catch (TransformerException te) { // probably not a node type String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INCOMPATIBLE_TYPES, new Object[] {m_xpath.getPatternString(), getTypeString(getTypeFromXObject(m_resultObj)),getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."}, } // If user requested ordered nodeset and result is unordered // need to sort...TODO // if ((m_resultType == ORDERED_NODE_ITERATOR_TYPE) && // (!(((DTMNodeIterator)m_iterator).getDTMIterator().isDocOrdered()))) { // // } // If it's a snapshot type, get the nodelist } else if ((m_resultType == UNORDERED_NODE_SNAPSHOT_TYPE) || (m_resultType == ORDERED_NODE_SNAPSHOT_TYPE)) { try { m_list = m_resultObj.nodelist(); } catch (TransformerException te) { // probably not a node type String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INCOMPATIBLE_TYPES, new Object[] {m_xpath.getPatternString(), getTypeString(getTypeFromXObject(m_resultObj)),getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."}, } } } /** * @see org.w3c.dom.xpath.XPathResult#getResultType() */ public short getResultType() { return m_resultType; } /** * The value of this number result. * @exception XPathException * TYPE_ERR: raised if resultType is not * NUMBER_TYPE. * @see org.w3c.dom.xpath.XPathResult#getNumberValue() */ public double getNumberValue() throws XPathException { if (getResultType() != NUMBER_TYPE) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a number" } else { try { return m_resultObj.num(); } catch (Exception e) { // Type check above should prevent this exception from occurring. throw new XPathException(XPathException.TYPE_ERR,e.getMessage()); } } } /** * The value of this string result. * @exception XPathException * TYPE_ERR: raised if resultType is not * STRING_TYPE. * * @see org.w3c.dom.xpath.XPathResult#getStringValue() */ public String getStringValue() throws XPathException { if (getResultType() != STRING_TYPE) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_STRING, new Object[] {m_xpath.getPatternString(), m_resultObj.getTypeString()}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a string." } else { try { return m_resultObj.str(); } catch (Exception e) { // Type check above should prevent this exception from occurring. throw new XPathException(XPathException.TYPE_ERR,e.getMessage()); } } } /** * @see org.w3c.dom.xpath.XPathResult#getBooleanValue() */ public boolean getBooleanValue() throws XPathException { if (getResultType() != BOOLEAN_TYPE) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_BOOLEAN, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a boolean." } else { try { return m_resultObj.bool(); } catch (TransformerException e) { // Type check above should prevent this exception from occurring. throw new XPathException(XPathException.TYPE_ERR,e.getMessage()); } } } /** * The value of this single node result, which may be null. * @exception XPathException * TYPE_ERR: raised if resultType is not * ANY_UNORDERED_NODE_TYPE or * FIRST_ORDERED_NODE_TYPE. * * @see org.w3c.dom.xpath.XPathResult#getSingleNodeValue() */ public Node getSingleNodeValue() throws XPathException { if ((m_resultType != ANY_UNORDERED_NODE_TYPE) && (m_resultType != FIRST_ORDERED_NODE_TYPE)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_SINGLENODE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a single node. // This method applies only to types ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE." } NodeIterator result = null; try { result = m_resultObj.nodeset(); } catch (TransformerException te) { throw new XPathException(XPathException.TYPE_ERR,te.getMessage()); } if (null == result) return null; Node node = result.nextNode(); // Wrap "namespace node" in an XPathNamespace if (isNamespaceNode(node)) { return new XPathNamespaceImpl(node); } else { return node; } } /** * @see org.w3c.dom.xpath.XPathResult#getInvalidIteratorState() */ public boolean getInvalidIteratorState() { return m_isInvalidIteratorState; } /** * The number of nodes in the result snapshot. Valid values for * snapshotItem indices are 0 to * snapshotLength-1 inclusive. * @exception XPathException * TYPE_ERR: raised if resultType is not * UNORDERED_NODE_SNAPSHOT_TYPE or * ORDERED_NODE_SNAPSHOT_TYPE. * * @see org.w3c.dom.xpath.XPathResult#getSnapshotLength() */ public int getSnapshotLength() throws XPathException { if ((m_resultType != UNORDERED_NODE_SNAPSHOT_TYPE) && (m_resultType != ORDERED_NODE_SNAPSHOT_TYPE)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_GET_SNAPSHOT_LENGTH, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // "The method getSnapshotLength cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}. } return m_list.getLength(); } /** * Iterates and returns the next node from the node set or * nullif there are no more nodes. * @return Returns the next node. * @exception XPathException * TYPE_ERR: raised if resultType is not * UNORDERED_NODE_ITERATOR_TYPE or * ORDERED_NODE_ITERATOR_TYPE. * @exception DOMException * INVALID_STATE_ERR: The document has been mutated since the result was * returned. * @see org.w3c.dom.xpath.XPathResult#iterateNext() */ public Node iterateNext() throws XPathException, DOMException { if ((m_resultType != UNORDERED_NODE_ITERATOR_TYPE) && (m_resultType != ORDERED_NODE_ITERATOR_TYPE)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NON_ITERATOR_TYPE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The method iterateNext cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}. // This method applies only to types UNORDERED_NODE_ITERATOR_TYPE and ORDERED_NODE_ITERATOR_TYPE."}, } if (getInvalidIteratorState()) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_DOC_MUTATED, null); throw new DOMException(DOMException.INVALID_STATE_ERR,fmsg); // Document mutated since result was returned. Iterator is invalid. } Node node = m_iterator.nextNode(); if(null == node) removeEventListener(); // JIRA 1673 // Wrap "namespace node" in an XPathNamespace if (isNamespaceNode(node)) { return new XPathNamespaceImpl(node); } else { return node; } } /** * Returns the indexth item in the snapshot collection. If * index is greater than or equal to the number of nodes in * the list, this method returns null. Unlike the iterator * result, the snapshot does not become invalid, but may not correspond * to the current document if it is mutated. * @param index Index into the snapshot collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. * @exception XPathException * TYPE_ERR: raised if resultType is not * UNORDERED_NODE_SNAPSHOT_TYPE or * ORDERED_NODE_SNAPSHOT_TYPE. * * @see org.w3c.dom.xpath.XPathResult#snapshotItem(int) */ public Node snapshotItem(int index) throws XPathException { if ((m_resultType != UNORDERED_NODE_SNAPSHOT_TYPE) && (m_resultType != ORDERED_NODE_SNAPSHOT_TYPE)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NON_SNAPSHOT_TYPE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)}); throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The method snapshotItem cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}. // This method applies only to types UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE."}, } Node node = m_list.item(index); // Wrap "namespace node" in an XPathNamespace if (isNamespaceNode(node)) { return new XPathNamespaceImpl(node); } else { return node; } } /** * Check if the specified type is one of the supported types. * @param type The specified type * * @return true If the specified type is supported; otherwise, returns false. */ static boolean isValidType( short type ) { switch (type) { case ANY_TYPE: case NUMBER_TYPE: case STRING_TYPE: case BOOLEAN_TYPE: case UNORDERED_NODE_ITERATOR_TYPE: case ORDERED_NODE_ITERATOR_TYPE: case UNORDERED_NODE_SNAPSHOT_TYPE: case ORDERED_NODE_SNAPSHOT_TYPE: case ANY_UNORDERED_NODE_TYPE: case FIRST_ORDERED_NODE_TYPE: return true; default: return false; } } /** * @see org.w3c.dom.events.EventListener#handleEvent(Event) */ public void handleEvent(Event event) { if (event.getType().equals("DOMSubtreeModified")) { // invalidate the iterator m_isInvalidIteratorState = true; // deregister as a listener to reduce computational load removeEventListener(); } } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string */ private String getTypeString(int type) { switch (type) { case ANY_TYPE: return "ANY_TYPE"; case ANY_UNORDERED_NODE_TYPE: return "ANY_UNORDERED_NODE_TYPE"; case BOOLEAN_TYPE: return "BOOLEAN"; case FIRST_ORDERED_NODE_TYPE: return "FIRST_ORDERED_NODE_TYPE"; case NUMBER_TYPE: return "NUMBER_TYPE"; case ORDERED_NODE_ITERATOR_TYPE: return "ORDERED_NODE_ITERATOR_TYPE"; case ORDERED_NODE_SNAPSHOT_TYPE: return "ORDERED_NODE_SNAPSHOT_TYPE"; case STRING_TYPE: return "STRING_TYPE"; case UNORDERED_NODE_ITERATOR_TYPE: return "UNORDERED_NODE_ITERATOR_TYPE"; case UNORDERED_NODE_SNAPSHOT_TYPE: return "UNORDERED_NODE_SNAPSHOT_TYPE"; default: return "#UNKNOWN"; } } /** * Given an XObject, determine the corresponding DOM XPath type * * @return type string */ private short getTypeFromXObject(XObject object) { switch (object.getType()) { case XObject.CLASS_BOOLEAN: return BOOLEAN_TYPE; case XObject.CLASS_NODESET: return UNORDERED_NODE_ITERATOR_TYPE; case XObject.CLASS_NUMBER: return NUMBER_TYPE; case XObject.CLASS_STRING: return STRING_TYPE; // XPath 2.0 types // case XObject.CLASS_DATE: // case XObject.CLASS_DATETIME: // case XObject.CLASS_DTDURATION: // case XObject.CLASS_GDAY: // case XObject.CLASS_GMONTH: // case XObject.CLASS_GMONTHDAY: // case XObject.CLASS_GYEAR: // case XObject.CLASS_GYEARMONTH: // case XObject.CLASS_TIME: // case XObject.CLASS_YMDURATION: return STRING_TYPE; // treat all date types as strings? case XObject.CLASS_RTREEFRAG: return UNORDERED_NODE_ITERATOR_TYPE; case XObject.CLASS_NULL: return ANY_TYPE; // throw exception ? default: return ANY_TYPE; // throw exception ? } } /** * Given a node, determine if it is a namespace node. * * @param node * * @return boolean Returns true if this is a namespace node; otherwise, returns false. */ private boolean isNamespaceNode(Node node) { if ((null != node) && (node.getNodeType() == Node.ATTRIBUTE_NODE) && (node.getNodeName().startsWith("xmlns:") || node.getNodeName().equals("xmlns"))) { return true; } else { return false; } } /** * Add m_contextNode to Event Listner to listen for Mutations Events * */ private void addEventListener(){ if(m_contextNode instanceof EventTarget) ((EventTarget)m_contextNode).addEventListener("DOMSubtreeModified",this,true); } /** * Remove m_contextNode to Event Listner to listen for Mutations Events * */ private void removeEventListener(){ if(m_contextNode instanceof EventTarget) ((EventTarget)m_contextNode).removeEventListener("DOMSubtreeModified",this,true); } } libxalan2-java-2.7.1/src/org/apache/xpath/domapi/XPathNamespaceImpl.java0000644000175000017500000002210410721374031025017 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xpath.domapi; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.xpath.XPathNamespace; import org.w3c.dom.UserDataHandler; /** * * * The XPathNamespace interface is returned by * XPathResult interfaces to represent the XPath namespace node * type that DOM lacks. There is no public constructor for this node type. * Attempts to place it into a hierarchy or a NamedNodeMap result in a * DOMException with the code HIERARCHY_REQUEST_ERR * . This node is read only, so methods or setting of attributes that would * mutate the node result in a DOMException with the code * NO_MODIFICATION_ALLOWED_ERR. *

    The core specification describes attributes of the Node * interface that are different for different node node types but does not * describe XPATH_NAMESPACE_NODE, so here is a description of * those attributes for this node type. All attributes of Node * not described in this section have a null or * false value. *

    ownerDocument matches the ownerDocument of the * ownerElement even if the element is later adopted. *

    prefix is the prefix of the namespace represented by the * node. *

    nodeName is the same as prefix. *

    nodeType is equal to XPATH_NAMESPACE_NODE. *

    namespaceURI is the namespace URI of the namespace * represented by the node. *

    adoptNode, cloneNode, and * importNode fail on this node type by raising a * DOMException with the code NOT_SUPPORTED_ERR.In * future versions of the XPath specification, the definition of a namespace * node may be changed incomatibly, in which case incompatible changes to * field values may be required to implement versions beyond XPath 1.0. *

    See also the Document Object Model (DOM) Level 3 XPath Specification. * * This implementation wraps the DOM attribute node that contained the * namespace declaration. * @xsl.usage internal */ class XPathNamespaceImpl implements XPathNamespace { // Node that XPathNamespaceImpl wraps final private Node m_attributeNode; /** * Constructor for XPathNamespaceImpl. */ XPathNamespaceImpl(Node node) { m_attributeNode = node; } /** * @see org.apache.xalan.dom3.xpath.XPathNamespace#getOwnerElement() */ public Element getOwnerElement() { return ((Attr)m_attributeNode).getOwnerElement(); } /** * @see org.w3c.dom.Node#getNodeName() */ public String getNodeName() { return "#namespace"; } /** * @see org.w3c.dom.Node#getNodeValue() */ public String getNodeValue() throws DOMException { return m_attributeNode.getNodeValue(); } /** * @see org.w3c.dom.Node#setNodeValue(String) */ public void setNodeValue(String arg0) throws DOMException { } /** * @see org.w3c.dom.Node#getNodeType() */ public short getNodeType() { return XPathNamespace.XPATH_NAMESPACE_NODE; } /** * @see org.w3c.dom.Node#getParentNode() */ public Node getParentNode() { return m_attributeNode.getParentNode(); } /** * @see org.w3c.dom.Node#getChildNodes() */ public NodeList getChildNodes() { return m_attributeNode.getChildNodes(); } /** * @see org.w3c.dom.Node#getFirstChild() */ public Node getFirstChild() { return m_attributeNode.getFirstChild(); } /** * @see org.w3c.dom.Node#getLastChild() */ public Node getLastChild() { return m_attributeNode.getLastChild(); } /** * @see org.w3c.dom.Node#getPreviousSibling() */ public Node getPreviousSibling() { return m_attributeNode.getPreviousSibling(); } /** * @see org.w3c.dom.Node#getNextSibling() */ public Node getNextSibling() { return m_attributeNode.getNextSibling(); } /** * @see org.w3c.dom.Node#getAttributes() */ public NamedNodeMap getAttributes() { return m_attributeNode.getAttributes(); } /** * @see org.w3c.dom.Node#getOwnerDocument() */ public Document getOwnerDocument() { return m_attributeNode.getOwnerDocument(); } /** * @see org.w3c.dom.Node#insertBefore(Node, Node) */ public Node insertBefore(Node arg0, Node arg1) throws DOMException { return null; } /** * @see org.w3c.dom.Node#replaceChild(Node, Node) */ public Node replaceChild(Node arg0, Node arg1) throws DOMException { return null; } /** * @see org.w3c.dom.Node#removeChild(Node) */ public Node removeChild(Node arg0) throws DOMException { return null; } /** * @see org.w3c.dom.Node#appendChild(Node) */ public Node appendChild(Node arg0) throws DOMException { return null; } /** * @see org.w3c.dom.Node#hasChildNodes() */ public boolean hasChildNodes() { return false; } /** * @see org.w3c.dom.Node#cloneNode(boolean) */ public Node cloneNode(boolean arg0) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR,null); } /** * @see org.w3c.dom.Node#normalize() */ public void normalize() { m_attributeNode.normalize(); } /** * @see org.w3c.dom.Node#isSupported(String, String) */ public boolean isSupported(String arg0, String arg1) { return m_attributeNode.isSupported(arg0, arg1); } /** * @see org.w3c.dom.Node#getNamespaceURI() */ public String getNamespaceURI() { // For namespace node, the namespaceURI is the namespace URI // of the namespace represented by the node. return m_attributeNode.getNodeValue(); } /** * @see org.w3c.dom.Node#getPrefix() */ public String getPrefix() { return m_attributeNode.getPrefix(); } /** * @see org.w3c.dom.Node#setPrefix(String) */ public void setPrefix(String arg0) throws DOMException { } /** * @see org.w3c.dom.Node#getLocalName() */ public String getLocalName() { // For namespace node, the local name is the same as the prefix return m_attributeNode.getPrefix(); } /** * @see org.w3c.dom.Node#hasAttributes() */ public boolean hasAttributes() { return m_attributeNode.hasAttributes(); } public String getBaseURI ( ) { return null; } public short compareDocumentPosition(Node other) throws DOMException { return 0; } private String textContent; public String getTextContent() throws DOMException { return textContent; } public void setTextContent(String textContent) throws DOMException { this.textContent = textContent; } public boolean isSameNode(Node other) { return false; } public String lookupPrefix(String namespaceURI) { return ""; //PENDING } public boolean isDefaultNamespace(String namespaceURI) { return false; } public String lookupNamespaceURI(String prefix) { return null; } public boolean isEqualNode(Node arg) { return false; } public Object getFeature(String feature, String version) { return null; //PENDING } public Object setUserData(String key, Object data, UserDataHandler handler) { return null; //PENDING } public Object getUserData(String key) { return null; } } libxalan2-java-2.7.1/src/org/apache/xpath/domapi/XPathEvaluatorImpl.java0000644000175000017500000002634210721374032025076 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xpath.domapi; import javax.xml.transform.TransformerException; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.XPath; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xpath.res.XPATHMessages; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.xpath.XPathEvaluator; import org.w3c.dom.xpath.XPathException; import org.w3c.dom.xpath.XPathExpression; import org.w3c.dom.xpath.XPathNSResolver; /** * * The class provides an implementation of XPathEvaluator according * to the DOM L3 XPath Specification, Working Group Note 26 February 2004. * *

    See also the Document Object Model (DOM) Level 3 XPath Specification.

    * *

    The evaluation of XPath expressions is provided by * XPathEvaluator, which will provide evaluation of XPath 1.0 * expressions with no specialized extension functions or variables. It is * expected that the XPathEvaluator interface will be * implemented on the same object which implements the Document * interface in an implementation which supports the XPath DOM module. * XPathEvaluator implementations may be available from other * sources that may provide support for special extension functions or * variables which are not defined in this specification.

    * * @see org.w3c.dom.xpath.XPathEvaluator * * @xsl.usage internal */ public final class XPathEvaluatorImpl implements XPathEvaluator { /** * This prefix resolver is created whenever null is passed to the * evaluate method. Its purpose is to satisfy the DOM L3 XPath API * requirement that if a null prefix resolver is used, an exception * should only be thrown when an attempt is made to resolve a prefix. */ private class DummyPrefixResolver implements PrefixResolver { /** * Constructor for DummyPrefixResolver. */ DummyPrefixResolver() {} /** * @exception DOMException * NAMESPACE_ERR: Always throws this exceptionn * * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String, Node) */ public String getNamespaceForPrefix(String prefix, Node context) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_RESOLVER, null); throw new DOMException(DOMException.NAMESPACE_ERR, fmsg); // Unable to resolve prefix with null prefix resolver. } /** * @exception DOMException * NAMESPACE_ERR: Always throws this exceptionn * * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String) */ public String getNamespaceForPrefix(String prefix) { return getNamespaceForPrefix(prefix,null); } /** * @see org.apache.xml.utils.PrefixResolver#handlesNullPrefixes() */ public boolean handlesNullPrefixes() { return false; } /** * @see org.apache.xml.utils.PrefixResolver#getBaseIdentifier() */ public String getBaseIdentifier() { return null; } } /** * The document to be searched to parallel the case where the XPathEvaluator * is obtained by casting a Document. */ private final Document m_doc; /** * Constructor for XPathEvaluatorImpl. * * @param doc The document to be searched, to parallel the case where'' * the XPathEvaluator is obtained by casting the document. */ public XPathEvaluatorImpl(Document doc) { m_doc = doc; } /** * Constructor in the case that the XPath expression can be evaluated * without needing an XML document at all. * */ public XPathEvaluatorImpl() { m_doc = null; } /** * Creates a parsed XPath expression with resolved namespaces. This is * useful when an expression will be reused in an application since it * makes it possible to compile the expression string into a more * efficient internal form and preresolve all namespace prefixes which * occur within the expression. * * @param expression The XPath expression string to be parsed. * @param resolver The resolver permits translation of * prefixes within the XPath expression into appropriate namespace URIs * . If this is specified as null, any namespace prefix * within the expression will result in DOMException * being thrown with the code NAMESPACE_ERR. * @return The compiled form of the XPath expression. * @exception XPathException * INVALID_EXPRESSION_ERR: Raised if the expression is not legal * according to the rules of the XPathEvaluatori * @exception DOMException * NAMESPACE_ERR: Raised if the expression contains namespace prefixes * which cannot be resolved by the specified * XPathNSResolver. * * @see org.w3c.dom.xpath.XPathEvaluator#createExpression(String, XPathNSResolver) */ public XPathExpression createExpression( String expression, XPathNSResolver resolver) throws XPathException, DOMException { try { // If the resolver is null, create a dummy prefix resolver XPath xpath = new XPath(expression,null, ((null == resolver) ? new DummyPrefixResolver() : ((PrefixResolver)resolver)), XPath.SELECT); return new XPathExpressionImpl(xpath, m_doc); } catch (TransformerException e) { // Need to pass back exception code DOMException.NAMESPACE_ERR also. // Error found in DOM Level 3 XPath Test Suite. if(e instanceof XPathStylesheetDOM3Exception) throw new DOMException(DOMException.NAMESPACE_ERR,e.getMessageAndLocation()); else throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,e.getMessageAndLocation()); } } /** * Adapts any DOM node to resolve namespaces so that an XPath expression * can be easily evaluated relative to the context of the node where it * appeared within the document. This adapter works like the DOM Level 3 * method lookupNamespaceURI on nodes in resolving the * namespaceURI from a given prefix using the current information available * in the node's hierarchy at the time lookupNamespaceURI is called, also * correctly resolving the implicit xml prefix. * * @param nodeResolver The node to be used as a context for namespace * resolution. * @return XPathNSResolver which resolves namespaces with * respect to the definitions in scope for a specified node. * * @see org.w3c.dom.xpath.XPathEvaluator#createNSResolver(Node) */ public XPathNSResolver createNSResolver(Node nodeResolver) { return new XPathNSResolverImpl((nodeResolver.getNodeType() == Node.DOCUMENT_NODE) ? ((Document) nodeResolver).getDocumentElement() : nodeResolver); } /** * Evaluates an XPath expression string and returns a result of the * specified type if possible. * * @param expression The XPath expression string to be parsed and * evaluated. * @param contextNode The context is context node for the * evaluation of this XPath expression. If the XPathEvaluator was * obtained by casting the Document then this must be * owned by the same document and must be a Document, * Element, Attribute, Text, * CDATASection, Comment, * ProcessingInstruction, or XPathNamespace * node. If the context node is a Text or a * CDATASection, then the context is interpreted as the * whole logical text node as seen by XPath, unless the node is empty * in which case it may not serve as the XPath context. * @param resolver The resolver permits translation of * prefixes within the XPath expression into appropriate namespace URIs * . If this is specified as null, any namespace prefix * within the expression will result in DOMException * being thrown with the code NAMESPACE_ERR. * @param type If a specific type is specified, then the * result will be coerced to return the specified type relying on * XPath type conversions and fail if the desired coercion is not * possible. This must be one of the type codes of * XPathResult. * @param result The result specifies a specific result * object which may be reused and returned by this method. If this is * specified as nullor the implementation does not reuse * the specified result, a new result object will be constructed and * returned.For XPath 1.0 results, this object will be of type * XPathResult. * @return The result of the evaluation of the XPath expression.For XPath * 1.0 results, this object will be of type XPathResult. * @exception XPathException * INVALID_EXPRESSION_ERR: Raised if the expression is not legal * according to the rules of the XPathEvaluatori *
    TYPE_ERR: Raised if the result cannot be converted to return the * specified type. * @exception DOMException * NAMESPACE_ERR: Raised if the expression contains namespace prefixes * which cannot be resolved by the specified * XPathNSResolver. *
    WRONG_DOCUMENT_ERR: The Node is from a document that is not * supported by this XPathEvaluator. *
    NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath * context node. * * @see org.w3c.dom.xpath.XPathEvaluator#evaluate(String, Node, XPathNSResolver, short, XPathResult) */ public Object evaluate( String expression, Node contextNode, XPathNSResolver resolver, short type, Object result) throws XPathException, DOMException { XPathExpression xpathExpression = createExpression(expression, resolver); return xpathExpression.evaluate(contextNode, type, result); } } libxalan2-java-2.7.1/src/org/apache/xpath/domapi/package.html0000644000175000017500000000176610721374031022765 0ustar mkochmkoch XPath domapi Package.

    Implements DOM Level 3 XPath API

    libxalan2-java-2.7.1/src/org/apache/xpath/domapi/XPathStylesheetDOM3Exception.java0000644000175000017500000000247510721374030026744 0ustar mkochmkoch/* * Copyright (c) 2002 World Wide Web Consortium, * (Massachusetts Institute of Technology, Institut National de * Recherche en Informatique et en Automatique, Keio University). All * Rights Reserved. This program is distributed under the W3C's Software * Intellectual Property License. This program is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ package org.apache.xpath.domapi; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; /** * * A new exception to add support for DOM Level 3 XPath API. * This class is needed to throw a org.w3c.dom.DOMException with proper error code in * createExpression method of XPathEvaluatorImpl (a DOM Level 3 class). * * This class extends TransformerException because the error message includes information * about where the XPath problem is in the stylesheet as well as the XPath expression itself. * * @xsl.usage internal */ final public class XPathStylesheetDOM3Exception extends TransformerException { public XPathStylesheetDOM3Exception(String msg, SourceLocator arg1) { super(msg, arg1); } } libxalan2-java-2.7.1/src/org/apache/xpath/domapi/XPathExpressionImpl.java0000644000175000017500000002020010721374032025256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xpath.domapi; import javax.xml.transform.TransformerException; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xpath.res.XPATHMessages; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.xpath.XPathException; import org.w3c.dom.xpath.XPathExpression; import org.w3c.dom.xpath.XPathNamespace; /** * * The class provides an implementation of XPathExpression according * to the DOM L3 XPath Specification, Working Group Note 26 February 2004. * *

    See also the Document Object Model (DOM) Level 3 XPath Specification.

    * *

    The XPathExpression interface represents a parsed and resolved * XPath expression.

    * * @see org.w3c.dom.xpath.XPathExpression * * @xsl.usage internal */ class XPathExpressionImpl implements XPathExpression { /** * The xpath object that this expression wraps */ final private XPath m_xpath; /** * The document to be searched to parallel the case where the XPathEvaluator * is obtained by casting a Document. */ final private Document m_doc; /** * Constructor for XPathExpressionImpl. * * @param xpath The wrapped XPath object. * @param doc The document to be searched, to parallel the case where'' * the XPathEvaluator is obtained by casting the document. */ XPathExpressionImpl(XPath xpath, Document doc) { m_xpath = xpath; m_doc = doc; } /** * * This method provides an implementation XPathResult.evaluate according * to the DOM L3 XPath Specification, Working Group Note 26 February 2004. * *

    See also the Document Object Model (DOM) Level 3 XPath Specification.

    * *

    Evaluates this XPath expression and returns a result.

    * @param contextNode The context is context node for the * evaluation of this XPath expression.If the XPathEvaluator was * obtained by casting the Document then this must be * owned by the same document and must be a Document, * Element, Attribute, Text, * CDATASection, Comment, * ProcessingInstruction, or XPathNamespace * node.If the context node is a Text or a * CDATASection, then the context is interpreted as the * whole logical text node as seen by XPath, unless the node is empty * in which case it may not serve as the XPath context. * @param type If a specific type is specified, then the * result will be coerced to return the specified type relying on * XPath conversions and fail if the desired coercion is not possible. * This must be one of the type codes of XPathResult. * @param result The result specifies a specific result * object which may be reused and returned by this method. If this is * specified as nullor the implementation does not reuse * the specified result, a new result object will be constructed and * returned.For XPath 1.0 results, this object will be of type * XPathResult. * @return The result of the evaluation of the XPath expression.For XPath * 1.0 results, this object will be of type XPathResult. * @exception XPathException * TYPE_ERR: Raised if the result cannot be converted to return the * specified type. * @exception DOMException * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported * by the XPathEvaluator that created this * XPathExpression. *
    NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath * context node. * * @see org.w3c.dom.xpath.XPathExpression#evaluate(Node, short, XPathResult) * @xsl.usage internal */ public Object evaluate( Node contextNode, short type, Object result) throws XPathException, DOMException { // If the XPathEvaluator was determined by "casting" the document if (m_doc != null) { // Check that the context node is owned by the same document if ((contextNode != m_doc) && (!contextNode.getOwnerDocument().equals(m_doc))) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_DOCUMENT, null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, fmsg); } // Check that the context node is an acceptable node type short nodeType = contextNode.getNodeType(); if ((nodeType != Document.DOCUMENT_NODE) && (nodeType != Document.ELEMENT_NODE) && (nodeType != Document.ATTRIBUTE_NODE) && (nodeType != Document.TEXT_NODE) && (nodeType != Document.CDATA_SECTION_NODE) && (nodeType != Document.COMMENT_NODE) && (nodeType != Document.PROCESSING_INSTRUCTION_NODE) && (nodeType != XPathNamespace.XPATH_NAMESPACE_NODE)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_NODETYPE, null); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, fmsg); } } // // If the type is not a supported type, throw an exception and be // done with it! if (!XPathResultImpl.isValidType(type)) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INVALID_XPATH_TYPE, new Object[] {new Integer(type)}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // Invalid XPath type argument: {0} } // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 // expressions. // Cache xpath context? XPathContext xpathSupport = new XPathContext(false); // if m_document is not null, build the DTM from the document if (null != m_doc) { xpathSupport.getDTMHandleFromNode(m_doc); } XObject xobj = null; try { xobj = m_xpath.execute(xpathSupport, contextNode, null); } catch (TransformerException te) { // What should we do here? throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,te.getMessageAndLocation()); } // Create a new XPathResult object // Reuse result object passed in? // The constructor will check the compatibility of type and xobj and // throw an exception if they are not compatible. return new XPathResultImpl(type,xobj,contextNode, m_xpath); } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/0000755000175000017500000000000010736146354020665 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/objects/XNodeSetForDOM.java0000644000175000017500000000767710721374030024235 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XNodeSetForDOM.java 469368 2006-10-31 04:41:36Z minchau $ */ package org.apache.xpath.objects; import org.apache.xml.dtm.DTMManager; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPathContext; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** * This class overrides the XNodeSet#object() method to provide the original * Node object, NodeList object, or NodeIterator. */ public class XNodeSetForDOM extends XNodeSet { static final long serialVersionUID = -8396190713754624640L; Object m_origObj; public XNodeSetForDOM(Node node, DTMManager dtmMgr) { m_dtmMgr = dtmMgr; m_origObj = node; int dtmHandle = dtmMgr.getDTMHandleFromNode(node); setObject(new NodeSetDTM(dtmMgr)); ((NodeSetDTM) m_obj).addNode(dtmHandle); } /** * Construct a XNodeSet object. * * @param val Value of the XNodeSet object */ public XNodeSetForDOM(XNodeSet val) { super(val); if(val instanceof XNodeSetForDOM) m_origObj = ((XNodeSetForDOM)val).m_origObj; } public XNodeSetForDOM(NodeList nodeList, XPathContext xctxt) { m_dtmMgr = xctxt.getDTMManager(); m_origObj = nodeList; // JKESS 20020514: Longer-term solution is to force // folks to request length through an accessor, so we can defer this // retrieval... but that requires an API change. // m_obj=new org.apache.xpath.NodeSetDTM(nodeList, xctxt); org.apache.xpath.NodeSetDTM nsdtm=new org.apache.xpath.NodeSetDTM(nodeList, xctxt); m_last=nsdtm.getLength(); setObject(nsdtm); } public XNodeSetForDOM(NodeIterator nodeIter, XPathContext xctxt) { m_dtmMgr = xctxt.getDTMManager(); m_origObj = nodeIter; // JKESS 20020514: Longer-term solution is to force // folks to request length through an accessor, so we can defer this // retrieval... but that requires an API change. // m_obj = new org.apache.xpath.NodeSetDTM(nodeIter, xctxt); org.apache.xpath.NodeSetDTM nsdtm=new org.apache.xpath.NodeSetDTM(nodeIter, xctxt); m_last=nsdtm.getLength(); setObject(nsdtm); } /** * Return the original DOM object that the user passed in. For use primarily * by the extension mechanism. * * @return The object that this class wraps */ public Object object() { return m_origObj; } /** * Cast result object to a nodelist. Always issues an error. * * @return null * * @throws javax.xml.transform.TransformerException */ public NodeIterator nodeset() throws javax.xml.transform.TransformerException { return (m_origObj instanceof NodeIterator) ? (NodeIterator)m_origObj : super.nodeset(); } /** * Cast result object to a nodelist. Always issues an error. * * @return null * * @throws javax.xml.transform.TransformerException */ public NodeList nodelist() throws javax.xml.transform.TransformerException { return (m_origObj instanceof NodeList) ? (NodeList)m_origObj : super.nodelist(); } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XString.java0000644000175000017500000011343110721374031023116 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XString.java 570108 2007-08-27 13:30:57Z zongaro $ */ package org.apache.xpath.objects; import java.util.Locale; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.XMLCharacterRecognizer; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; /** * This class represents an XPath string object, and is capable of * converting the string to other types, such as a number. * @xsl.usage general */ public class XString extends XObject implements XMLString { static final long serialVersionUID = 2020470518395094525L; /** Empty string XString object */ public static final XString EMPTYSTRING = new XString(""); /** * Construct a XString object. This constructor exists for derived classes. * * @param val String object this will wrap. */ protected XString(Object val) { super(val); } /** * Construct a XNodeSet object. * * @param val String object this will wrap. */ public XString(String val) { super(val); } /** * Tell that this is a CLASS_STRING. * * @return type CLASS_STRING */ public int getType() { return CLASS_STRING; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#STRING" */ public String getTypeString() { return "#STRING"; } /** * Tell if this object contains a java String object. * * @return true if this XMLString can return a string without creating one. */ public boolean hasString() { return true; } /** * Cast result object to a number. * * @return 0.0 if this string is null, numeric value of this string * or NaN */ public double num() { return toDouble(); } /** * Convert a string to a double -- Allowed input is in fixed * notation ddd.fff. * * @return A double value representation of the string, or return Double.NaN * if the string can not be converted. */ public double toDouble() { /* XMLCharacterRecognizer.isWhiteSpace(char c) methods treats the following * characters as white space characters. * ht - horizontal tab, nl - newline , cr - carriage return and sp - space * trim() methods by default also takes care of these white space characters * So trim() method is used to remove leading and trailing white spaces. */ XMLString s = trim(); double result = Double.NaN; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c != '-' && c != '.' && ( c < 0X30 || c > 0x39)) { // The character is not a '-' or a '.' or a digit // then return NaN because something is wrong. return result; } } try { result = Double.parseDouble(s.toString()); } catch (NumberFormatException e){} return result; } /** * Cast result object to a boolean. * * @return True if the length of this string object is greater * than 0. */ public boolean bool() { return str().length() > 0; } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public XMLString xstr() { return this; } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public String str() { return (null != m_obj) ? ((String) m_obj) : ""; } /** * Cast result object to a result tree fragment. * * @param support Xpath context to use for the conversion * * @return A document fragment with this string as a child node */ public int rtf(XPathContext support) { DTM frag = support.createDocumentFragment(); frag.appendTextChild(str()); return frag.getDocument(); } /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { String str = str(); ch.characters(str.toCharArray(), 0, str.length()); } /** * Directly call the * comment method on the passed LexicalHandler for the * string-value. * * @param lh A non-null reference to a LexicalHandler. * * @throws org.xml.sax.SAXException */ public void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh) throws org.xml.sax.SAXException { String str = str(); lh.comment(str.toCharArray(), 0, str.length()); } /** * Returns the length of this string. * * @return the length of the sequence of characters represented by this * object. */ public int length() { return str().length(); } /** * Returns the character at the specified index. An index ranges * from 0 to length() - 1. The first character * of the sequence is at index 0, the next at index * 1, and so on, as for array indexing. * * @param index the index of the character. * @return the character at the specified index of this string. * The first character is at index 0. * @exception IndexOutOfBoundsException if the index * argument is negative or not less than the length of this * string. */ public char charAt(int index) { return str().charAt(index); } /** * Copies characters from this string into the destination character * array. * * @param srcBegin index of the first character in the string * to copy. * @param srcEnd index after the last character in the string * to copy. * @param dst the destination array. * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: *
    • srcBegin is negative. *
    • srcBegin is greater than srcEnd *
    • srcEnd is greater than the length of this * string *
    • dstBegin is negative *
    • dstBegin+(srcEnd-srcBegin) is larger than * dst.length
    * @exception NullPointerException if dst is null */ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { str().getChars(srcBegin, srcEnd, dst, dstBegin); } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. int t = obj2.getType(); try { if (XObject.CLASS_NODESET == t) return obj2.equals(this); // If at least one object to be compared is a boolean, then each object // to be compared is converted to a boolean as if by applying the // boolean function. else if(XObject.CLASS_BOOLEAN == t) return obj2.bool() == bool(); // Otherwise, if at least one object to be compared is a number, then each object // to be compared is converted to a number as if by applying the number function. else if(XObject.CLASS_NUMBER == t) return obj2.num() == num(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } // Otherwise, both objects to be compared are converted to strings as // if by applying the string function. return xstr().equals(obj2.xstr()); } /** * Compares this string to the specified String. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this String against. * @return true if the Strings are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(String obj2) { return str().equals(obj2); } /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this String * against. * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(XMLString obj2) { if (obj2 != null) { if (!obj2.hasString()) { return obj2.equals(str()); } else { return str().equals(obj2.toString()); } } return false; } /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this String * against. * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(Object obj2) { if (null == obj2) return false; // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. else if (obj2 instanceof XNodeSet) return obj2.equals(this); else if(obj2 instanceof XNumber) return obj2.equals(this); else return str().equals(obj2.toString()); } /** * Compares this String to another String, * ignoring case considerations. Two strings are considered equal * ignoring case if they are of the same length, and corresponding * characters in the two strings are equal ignoring case. * * @param anotherString the String to compare this * String against. * @return true if the argument is not null * and the Strings are equal, * ignoring case; false otherwise. * @see #equals(Object) * @see java.lang.Character#toLowerCase(char) * @see java.lang.Character#toUpperCase(char) */ public boolean equalsIgnoreCase(String anotherString) { return str().equalsIgnoreCase(anotherString); } /** * Compares two strings lexicographically. * * @param xstr the String to be compared. * * @return the value 0 if the argument string is equal to * this string; a value less than 0 if this string * is lexicographically less than the string argument; and a * value greater than 0 if this string is * lexicographically greater than the string argument. * @exception java.lang.NullPointerException if anotherString * is null. */ public int compareTo(XMLString xstr) { int len1 = this.length(); int len2 = xstr.length(); int n = Math.min(len1, len2); int i = 0; int j = 0; while (n-- != 0) { char c1 = this.charAt(i); char c2 = xstr.charAt(j); if (c1 != c2) { return c1 - c2; } i++; j++; } return len1 - len2; } /** * Compares two strings lexicographically, ignoring case considerations. * This method returns an integer whose sign is that of * this.toUpperCase().toLowerCase().compareTo( * str.toUpperCase().toLowerCase()). *

    * Note that this method does not take locale into account, * and will result in an unsatisfactory ordering for certain locales. * The java.text package provides collators to allow * locale-sensitive ordering. * * @param str the String to be compared. * @return a negative integer, zero, or a positive integer as the * the specified String is greater than, equal to, or less * than this String, ignoring case considerations. * @see java.text.Collator#compare(String, String) * @since 1.2 */ public int compareToIgnoreCase(XMLString str) { // %REVIEW% Like it says, @since 1.2. Doesn't exist in earlier // versions of Java, hence we can't yet shell out to it. We can implement // it as character-by-character compare, but doing so efficiently // is likely to be (ahem) interesting. // // However, since nobody is actually _using_ this method yet: // return str().compareToIgnoreCase(str.toString()); throw new org.apache.xml.utils.WrappedRuntimeException( new java.lang.NoSuchMethodException( "Java 1.2 method, not yet implemented")); } /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *

       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(String prefix, int toffset) { return str().startsWith(prefix, toffset); } /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(String prefix) { return startsWith(prefix, 0); } /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *
       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(XMLString prefix, int toffset) { int to = toffset; int tlim = this.length(); int po = 0; int pc = prefix.length(); // Note: toffset might be near -1>>>1. if ((toffset < 0) || (toffset > tlim - pc)) { return false; } while (--pc >= 0) { if (this.charAt(to) != prefix.charAt(po)) { return false; } to++; po++; } return true; } /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(XMLString prefix) { return startsWith(prefix, 0); } /** * Tests if this string ends with the specified suffix. * * @param suffix the suffix. * @return true if the character sequence represented by the * argument is a suffix of the character sequence represented by * this object; false otherwise. Note that the * result will be true if the argument is the * empty string or is equal to this String object * as determined by the {@link #equals(Object)} method. * @exception java.lang.NullPointerException if suffix is * null. */ public boolean endsWith(String suffix) { return str().endsWith(suffix); } /** * Returns a hashcode for this string. The hashcode for a * String object is computed as *
       * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
       * 
    * using int arithmetic, where s[i] is the * ith character of the string, n is the length of * the string, and ^ indicates exponentiation. * (The hash value of the empty string is zero.) * * @return a hash code value for this object. */ public int hashCode() { return str().hashCode(); } /** * Returns the index within this string of the first occurrence of the * specified character. If a character with value ch occurs * in the character sequence represented by this String * object, then the index of the first such occurrence is returned -- * that is, the smallest value k such that: *
       * this.charAt(k) == ch
       * 
    * is true. If no such character occurs in this string, * then -1 is returned. * * @param ch a character. * @return the index of the first occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public int indexOf(int ch) { return str().indexOf(ch); } /** * Returns the index within this string of the first occurrence of the * specified character, starting the search at the specified index. *

    * If a character with value ch occurs in the character * sequence represented by this String object at an index * no smaller than fromIndex, then the index of the first * such occurrence is returned--that is, the smallest value k * such that: *

       * (this.charAt(k) == ch) && (k >= fromIndex)
       * 
    * is true. If no such character occurs in this string at or after * position fromIndex, then -1 is returned. *

    * There is no restriction on the value of fromIndex. If it * is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param ch a character. * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in the * character sequence represented by this object that is greater * than or equal to fromIndex, or -1 * if the character does not occur. */ public int indexOf(int ch, int fromIndex) { return str().indexOf(ch, fromIndex); } /** * Returns the index within this string of the last occurrence of the * specified character. That is, the index returned is the largest * value k such that: *

       * this.charAt(k) == ch
       * 
    * is true. * The String is searched backwards starting at the last character. * * @param ch a character. * @return the index of the last occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public int lastIndexOf(int ch) { return str().lastIndexOf(ch); } /** * Returns the index within this string of the last occurrence of the * specified character, searching backward starting at the specified * index. That is, the index returned is the largest value k * such that: *
       * this.charAt(k) == ch) && (k <= fromIndex)
       * 
    * is true. * * @param ch a character. * @param fromIndex the index to start the search from. There is no * restriction on the value of fromIndex. If it is * greater than or equal to the length of this string, it has * the same effect as if it were equal to one less than the * length of this string: this entire string may be searched. * If it is negative, it has the same effect as if it were -1: * -1 is returned. * @return the index of the last occurrence of the character in the * character sequence represented by this object that is less * than or equal to fromIndex, or -1 * if the character does not occur before that point. */ public int lastIndexOf(int ch, int fromIndex) { return str().lastIndexOf(ch, fromIndex); } /** * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: *
       * this.startsWith(str, k)
       * 
    * is true. * * @param str any string. * @return if the string argument occurs as a substring within this * object, then the index of the first character of the first * such substring is returned; if it does not occur as a * substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int indexOf(String str) { return str().indexOf(str); } /** * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: *
       * this.startsWith(str, k)
       * 
    * is true. * * @param str any string. * @return if the string argument occurs as a substring within this * object, then the index of the first character of the first * such substring is returned; if it does not occur as a * substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int indexOf(XMLString str) { return str().indexOf(str.toString()); } /** * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. The integer * returned is the smallest value k such that: *
       * this.startsWith(str, k) && (k >= fromIndex)
       * 
    * is true. *

    * There is no restriction on the value of fromIndex. If * it is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param str the substring to search for. * @param fromIndex the index to start the search from. * @return If the string argument occurs as a substring within this * object at a starting index no smaller than * fromIndex, then the index of the first character * of the first such substring is returned. If it does not occur * as a substring starting at fromIndex or beyond, * -1 is returned. * @exception java.lang.NullPointerException if str is * null */ public int indexOf(String str, int fromIndex) { return str().indexOf(str, fromIndex); } /** * Returns the index within this string of the rightmost occurrence * of the specified substring. The rightmost empty string "" is * considered to occur at the index value this.length(). * The returned index is the largest value k such that *

       * this.startsWith(str, k)
       * 
    * is true. * * @param str the substring to search for. * @return if the string argument occurs one or more times as a substring * within this object, then the index of the first character of * the last such substring is returned. If it does not occur as * a substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int lastIndexOf(String str) { return str().lastIndexOf(str); } /** * Returns the index within this string of the last occurrence of * the specified substring. * * @param str the substring to search for. * @param fromIndex the index to start the search from. There is no * restriction on the value of fromIndex. If it is greater than * the length of this string, it has the same effect as if it * were equal to the length of this string: this entire string * may be searched. If it is negative, it has the same effect * as if it were -1: -1 is returned. * @return If the string argument occurs one or more times as a substring * within this object at a starting index no greater than * fromIndex, then the index of the first character of * the last such substring is returned. If it does not occur as a * substring starting at fromIndex or earlier, * -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int lastIndexOf(String str, int fromIndex) { return str().lastIndexOf(str, fromIndex); } /** * Returns a new string that is a substring of this string. The * substring begins with the character at the specified index and * extends to the end of this string.

    * Examples: *

       * "unhappy".substring(2) returns "happy"
       * "Harbison".substring(3) returns "bison"
       * "emptiness".substring(9) returns "" (an empty string)
       * 
    * * @param beginIndex the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if * beginIndex is negative or larger than the * length of this String object. */ public XMLString substring(int beginIndex) { return new XString(str().substring(beginIndex)); } /** * Returns a new string that is a substring of this string. The * substring begins at the specified beginIndex and * extends to the character at index endIndex - 1. * Thus the length of the substring is endIndex-beginIndex. * * @param beginIndex the beginning index, inclusive. * @param endIndex the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if the * beginIndex is negative, or * endIndex is larger than the length of * this String object, or * beginIndex is larger than * endIndex. */ public XMLString substring(int beginIndex, int endIndex) { return new XString(str().substring(beginIndex, endIndex)); } /** * Concatenates the specified string to the end of this string. * * @param str the String that is concatenated to the end * of this String. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. * @exception java.lang.NullPointerException if str is * null. */ public XMLString concat(String str) { // %REVIEW% Make an FSB here? return new XString(str().concat(str)); } /** * Converts all of the characters in this String to lower * case using the rules of the given Locale. * * @param locale use the case transformation rules for this locale * @return the String, converted to lowercase. * @see java.lang.Character#toLowerCase(char) * @see java.lang.String#toUpperCase(Locale) */ public XMLString toLowerCase(Locale locale) { return new XString(str().toLowerCase(locale)); } /** * Converts all of the characters in this String to lower * case using the rules of the default locale, which is returned * by Locale.getDefault. *

    * * @return the string, converted to lowercase. * @see java.lang.Character#toLowerCase(char) * @see java.lang.String#toLowerCase(Locale) */ public XMLString toLowerCase() { return new XString(str().toLowerCase()); } /** * Converts all of the characters in this String to upper * case using the rules of the given locale. * @param locale use the case transformation rules for this locale * @return the String, converted to uppercase. * @see java.lang.Character#toUpperCase(char) * @see java.lang.String#toLowerCase(Locale) */ public XMLString toUpperCase(Locale locale) { return new XString(str().toUpperCase(locale)); } /** * Converts all of the characters in this String to upper * case using the rules of the default locale, which is returned * by Locale.getDefault. * *

    * If no character in this string has a different uppercase version, * based on calling the toUpperCase method defined by * Character, then the original string is returned. *

    * Otherwise, this method creates a new String object * representing a character sequence identical in length to the * character sequence represented by this String object and * with every character equal to the result of applying the method * Character.toUpperCase to the corresponding character of * this String object.

    * Examples: *

       * "Fahrvergnügen".toUpperCase() returns "FAHRVERGNÜGEN"
       * "Visit Ljubinje!".toUpperCase() returns "VISIT LJUBINJE!"
       * 
    * * @return the string, converted to uppercase. * @see java.lang.Character#toUpperCase(char) * @see java.lang.String#toUpperCase(Locale) */ public XMLString toUpperCase() { return new XString(str().toUpperCase()); } /** * Removes white space from both ends of this string. * * @return this string, with white space removed from the front and end. */ public XMLString trim() { return new XString(str().trim()); } /** * Returns whether the specified ch conforms to the XML 1.0 definition * of whitespace. Refer to * the definition of S for details. * @param ch Character to check as XML whitespace. * @return =true if ch is XML whitespace; otherwise =false. */ private static boolean isSpace(char ch) { return XMLCharacterRecognizer.isWhiteSpace(ch); // Take the easy way out for now. } /** * Conditionally trim all leading and trailing whitespace in the specified String. * All strings of white space are * replaced by a single space character (#x20), except spaces after punctuation which * receive double spaces if doublePunctuationSpaces is true. * This function may be useful to a formatter, but to get first class * results, the formatter should probably do it's own white space handling * based on the semantics of the formatting object. * * @param trimHead Trim leading whitespace? * @param trimTail Trim trailing whitespace? * @param doublePunctuationSpaces Use double spaces for punctuation? * @return The trimmed string. */ public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail, boolean doublePunctuationSpaces) { // %OPT% !!!!!!! int len = this.length(); char[] buf = new char[len]; this.getChars(0, len, buf, 0); boolean edit = false; int s; for (s = 0; s < len; s++) { if (isSpace(buf[s])) { break; } } /* replace S to ' '. and ' '+ -> single ' '. */ int d = s; boolean pres = false; for (; s < len; s++) { char c = buf[s]; if (isSpace(c)) { if (!pres) { if (' ' != c) { edit = true; } buf[d++] = ' '; if (doublePunctuationSpaces && (s != 0)) { char prevChar = buf[s - 1]; if (!((prevChar == '.') || (prevChar == '!') || (prevChar == '?'))) { pres = true; } } else { pres = true; } } else { edit = true; pres = true; } } else { buf[d++] = c; pres = false; } } if (trimTail && 1 <= d && ' ' == buf[d - 1]) { edit = true; d--; } int start = 0; if (trimHead && 0 < d && ' ' == buf[0]) { edit = true; start++; } XMLStringFactory xsf = XMLStringFactoryImpl.getFactory(); return edit ? xsf.newstr(new String(buf, start, d - start)) : this; } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { visitor.visitStringLiteral(owner, this); } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XObjectFactory.java0000644000175000017500000001124310721374031024404 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XObjectFactory.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.OneStepIterator; public class XObjectFactory { /** * Create the right XObject based on the type of the object passed. This * function can not make an XObject that exposes DOM Nodes, NodeLists, and * NodeIterators to the XSLT stylesheet as node-sets. * * @param val The java object which this object will wrap. * * @return the right XObject based on the type of the object passed. */ static public XObject create(Object val) { XObject result; if (val instanceof XObject) { result = (XObject) val; } else if (val instanceof String) { result = new XString((String) val); } else if (val instanceof Boolean) { result = new XBoolean((Boolean)val); } else if (val instanceof Double) { result = new XNumber(((Double) val)); } else { result = new XObject(val); } return result; } /** * Create the right XObject based on the type of the object passed. * This function can make an XObject that exposes DOM Nodes, NodeLists, and * NodeIterators to the XSLT stylesheet as node-sets. * * @param val The java object which this object will wrap. * @param xctxt The XPath context. * * @return the right XObject based on the type of the object passed. */ static public XObject create(Object val, XPathContext xctxt) { XObject result; if (val instanceof XObject) { result = (XObject) val; } else if (val instanceof String) { result = new XString((String) val); } else if (val instanceof Boolean) { result = new XBoolean((Boolean)val); } else if (val instanceof Number) { result = new XNumber(((Number) val)); } else if (val instanceof DTM) { DTM dtm = (DTM)val; try { int dtmRoot = dtm.getDocument(); DTMAxisIterator iter = dtm.getAxisIterator(Axis.SELF); iter.setStartNode(dtmRoot); DTMIterator iterator = new OneStepIterator(iter, Axis.SELF); iterator.setRoot(dtmRoot, xctxt); result = new XNodeSet(iterator); } catch(Exception ex) { throw new org.apache.xml.utils.WrappedRuntimeException(ex); } } else if (val instanceof DTMAxisIterator) { DTMAxisIterator iter = (DTMAxisIterator)val; try { DTMIterator iterator = new OneStepIterator(iter, Axis.SELF); iterator.setRoot(iter.getStartNode(), xctxt); result = new XNodeSet(iterator); } catch(Exception ex) { throw new org.apache.xml.utils.WrappedRuntimeException(ex); } } else if (val instanceof DTMIterator) { result = new XNodeSet((DTMIterator) val); } // This next three instanceofs are a little worrysome, since a NodeList // might also implement a Node! else if (val instanceof org.w3c.dom.Node) { result = new XNodeSetForDOM((org.w3c.dom.Node)val, xctxt); } // This must come after org.w3c.dom.Node, since many Node implementations // also implement NodeList. else if (val instanceof org.w3c.dom.NodeList) { result = new XNodeSetForDOM((org.w3c.dom.NodeList)val, xctxt); } else if (val instanceof org.w3c.dom.traversal.NodeIterator) { result = new XNodeSetForDOM((org.w3c.dom.traversal.NodeIterator)val, xctxt); } else { result = new XObject(val); } return result; } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XMLStringFactoryImpl.java0000644000175000017500000000607710721374030025527 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLStringFactoryImpl.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; /** * Class XMLStringFactoryImpl creates XString versions of XMLStrings. * @xsl.usage internal */ public class XMLStringFactoryImpl extends XMLStringFactory { /** The XMLStringFactory to pass to DTM construction. */ private static XMLStringFactory m_xstringfactory = new XMLStringFactoryImpl(); /** * Get the XMLStringFactory to pass to DTM construction. * * * @return A never-null static reference to a String factory. */ public static XMLStringFactory getFactory() { return m_xstringfactory; } /** * Create a new XMLString from a Java string. * * * @param string Java String reference, which must be non-null. * * @return An XMLString object that wraps the String reference. */ public XMLString newstr(String string) { return new XString(string); } /** * Create a XMLString from a FastStringBuffer. * * * @param fsb FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public XMLString newstr(FastStringBuffer fsb, int start, int length) { return new XStringForFSB(fsb, start, length); } /** * Create a XMLString from a FastStringBuffer. * * * @param string FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public XMLString newstr(char[] string, int start, int length) { return new XStringForChars(string, start, length); } /** * Get a cheap representation of an empty string. * * @return An non-null reference to an XMLString that represents "". */ public XMLString emptystr() { return XString.EMPTYSTRING; } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XObject.java0000644000175000017500000004716410721374031023067 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XObject.java 469368 2006-10-31 04:41:36Z minchau $ */ package org.apache.xpath.objects; import java.io.Serializable; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.XMLString; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathException; import org.apache.xpath.XPathVisitor; import org.apache.xpath.res.XPATHErrorResources; import org.w3c.dom.DocumentFragment; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** * This class represents an XPath object, and is capable of * converting the object to various types, such as a string. * This class acts as the base class to other XPath type objects, * such as XString, and provides polymorphic casting capabilities. * @xsl.usage general */ public class XObject extends Expression implements Serializable, Cloneable { static final long serialVersionUID = -821887098985662951L; /** * The java object which this object wraps. * @serial */ protected Object m_obj; // This may be NULL!!! /** * Create an XObject. */ public XObject(){} /** * Create an XObject. * * @param obj Can be any object, should be a specific type * for derived classes, or null. */ public XObject(Object obj) { setObject(obj); } protected void setObject(Object obj) { m_obj = obj; } /** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return This object. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return this; } /** * Specify if it's OK for detach to release the iterator for reuse. * This function should be called with a value of false for objects that are * stored in variables. * Calling this with a value of false on a XNodeSet will cause the nodeset * to be cached. * * @param allowRelease true if it is OK for detach to release this iterator * for pooling. */ public void allowDetachToRelease(boolean allowRelease){} /** * Detaches the DTMIterator from the set which it iterated * over, releasing any computational resources and placing the iterator * in the INVALID state. After detach has been invoked, * calls to nextNode or previousNode will * raise a runtime exception. */ public void detach(){} /** * Forces the object to release it's resources. This is more harsh than * detach(). */ public void destruct() { if (null != m_obj) { allowDetachToRelease(true); detach(); setObject(null); } } /** * Reset for fresh reuse. */ public void reset() { } /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { xstr().dispatchCharactersEvents(ch); } /** * Create the right XObject based on the type of the object passed. This * function can not make an XObject that exposes DOM Nodes, NodeLists, and * NodeIterators to the XSLT stylesheet as node-sets. * * @param val The java object which this object will wrap. * * @return the right XObject based on the type of the object passed. */ static public XObject create(Object val) { return XObjectFactory.create(val); } /** * Create the right XObject based on the type of the object passed. * This function can make an XObject that exposes DOM Nodes, NodeLists, and * NodeIterators to the XSLT stylesheet as node-sets. * * @param val The java object which this object will wrap. * @param xctxt The XPath context. * * @return the right XObject based on the type of the object passed. */ static public XObject create(Object val, XPathContext xctxt) { return XObjectFactory.create(val, xctxt); } /** Constant for NULL object type */ public static final int CLASS_NULL = -1; /** Constant for UNKNOWN object type */ public static final int CLASS_UNKNOWN = 0; /** Constant for BOOLEAN object type */ public static final int CLASS_BOOLEAN = 1; /** Constant for NUMBER object type */ public static final int CLASS_NUMBER = 2; /** Constant for STRING object type */ public static final int CLASS_STRING = 3; /** Constant for NODESET object type */ public static final int CLASS_NODESET = 4; /** Constant for RESULT TREE FRAGMENT object type */ public static final int CLASS_RTREEFRAG = 5; /** Represents an unresolved variable type as an integer. */ public static final int CLASS_UNRESOLVEDVARIABLE = 600; /** * Tell what kind of class this is. * * @return CLASS_UNKNOWN */ public int getType() { return CLASS_UNKNOWN; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#UNKNOWN" + object class name */ public String getTypeString() { return "#UNKNOWN (" + object().getClass().getName() + ")"; } /** * Cast result object to a number. Always issues an error. * * @return 0.0 * * @throws javax.xml.transform.TransformerException */ public double num() throws javax.xml.transform.TransformerException { error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER, new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number"); return 0.0; } /** * Cast result object to a number, but allow side effects, such as the * incrementing of an iterator. * * @return numeric value of the string conversion from the * next node in the NodeSetDTM, or NAN if no node was found */ public double numWithSideEffects() throws javax.xml.transform.TransformerException { return num(); } /** * Cast result object to a boolean. Always issues an error. * * @return false * * @throws javax.xml.transform.TransformerException */ public boolean bool() throws javax.xml.transform.TransformerException { error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER, new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number"); return false; } /** * Cast result object to a boolean, but allow side effects, such as the * incrementing of an iterator. * * @return True if there is a next node in the nodeset */ public boolean boolWithSideEffects() throws javax.xml.transform.TransformerException { return bool(); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public XMLString xstr() { return XMLStringFactoryImpl.getFactory().newstr(str()); } /** * Cast result object to a string. * * @return The object as a string */ public String str() { return (m_obj != null) ? m_obj.toString() : ""; } /** * Return the string representation of the object * * * @return the string representation of the object */ public String toString() { return str(); } /** * Cast result object to a result tree fragment. * * @param support XPath context to use for the conversion * * @return the objec as a result tree fragment. */ public int rtf(XPathContext support) { int result = rtf(); if (DTM.NULL == result) { DTM frag = support.createDocumentFragment(); // %OPT% frag.appendTextChild(str()); result = frag.getDocument(); } return result; } /** * Cast result object to a result tree fragment. * * @param support XPath context to use for the conversion * * @return the objec as a result tree fragment. */ public DocumentFragment rtree(XPathContext support) { DocumentFragment docFrag = null; int result = rtf(); if (DTM.NULL == result) { DTM frag = support.createDocumentFragment(); // %OPT% frag.appendTextChild(str()); docFrag = (DocumentFragment)frag.getNode(frag.getDocument()); } else { DTM frag = support.getDTM(result); docFrag = (DocumentFragment)frag.getNode(frag.getDocument()); } return docFrag; } /** * For functions to override. * * @return null */ public DocumentFragment rtree() { return null; } /** * For functions to override. * * @return null */ public int rtf() { return DTM.NULL; } /** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The object that this class wraps */ public Object object() { return m_obj; } /** * Cast result object to a nodelist. Always issues an error. * * @return null * * @throws javax.xml.transform.TransformerException */ public DTMIterator iter() throws javax.xml.transform.TransformerException { error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST, new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeList!"); return null; } /** * Get a fresh copy of the object. For use with variables. * * @return This object, unless overridden by subclass. */ public XObject getFresh() { return this; } /** * Cast result object to a nodelist. Always issues an error. * * @return null * * @throws javax.xml.transform.TransformerException */ public NodeIterator nodeset() throws javax.xml.transform.TransformerException { error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST, new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeList!"); return null; } /** * Cast result object to a nodelist. Always issues an error. * * @return null * * @throws javax.xml.transform.TransformerException */ public NodeList nodelist() throws javax.xml.transform.TransformerException { error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST, new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeList!"); return null; } /** * Cast result object to a nodelist. Always issues an error. * * @return The object as a NodeSetDTM. * * @throws javax.xml.transform.TransformerException */ public NodeSetDTM mutableNodeset() throws javax.xml.transform.TransformerException { error(XPATHErrorResources.ER_CANT_CONVERT_TO_MUTABLENODELIST, new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a NodeSetDTM!"); return (NodeSetDTM) m_obj; } /** * Cast object to type t. * * @param t Type of object to cast this to * @param support XPath context to use for the conversion * * @return This object as the given type t * * @throws javax.xml.transform.TransformerException */ public Object castToType(int t, XPathContext support) throws javax.xml.transform.TransformerException { Object result; switch (t) { case CLASS_STRING : result = str(); break; case CLASS_NUMBER : result = new Double(num()); break; case CLASS_NODESET : result = iter(); break; case CLASS_BOOLEAN : result = new Boolean(bool()); break; case CLASS_UNKNOWN : result = m_obj; break; // %TBD% What to do here? // case CLASS_RTREEFRAG : // result = rtree(support); // break; default : error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE, new Object[]{ getTypeString(), Integer.toString(t) }); //"Can not convert "+getTypeString()+" to a type#"+t); result = null; } return result; } /** * Tell if one object is less than the other. * * @param obj2 Object to compare this to * * @return True if this object is less than the given object * * @throws javax.xml.transform.TransformerException */ public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.greaterThan(this); return this.num() < obj2.num(); } /** * Tell if one object is less than or equal to the other. * * @param obj2 Object to compare this to * * @return True if this object is less than or equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.greaterThanOrEqual(this); return this.num() <= obj2.num(); } /** * Tell if one object is greater than the other. * * @param obj2 Object to compare this to * * @return True if this object is greater than the given object * * @throws javax.xml.transform.TransformerException */ public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThan(this); return this.num() > obj2.num(); } /** * Tell if one object is greater than or equal to the other. * * @param obj2 Object to compare this to * * @return True if this object is greater than or equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. Because the arguments // are backwards, we call the opposite comparison // function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThanOrEqual(this); return this.num() >= obj2.num(); } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return True if this object is equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.equals(this); if (null != m_obj) { return m_obj.equals(obj2.m_obj); } else { return obj2.m_obj == null; } } /** * Tell if two objects are functionally not equal. * * @param obj2 Object to compare this to * * @return True if this object is not equal to the given object * * @throws javax.xml.transform.TransformerException */ public boolean notEquals(XObject obj2) throws javax.xml.transform.TransformerException { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.notEquals(this); return !equals(obj2); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg Error message to issue * * @throws javax.xml.transform.TransformerException */ protected void error(String msg) throws javax.xml.transform.TransformerException { error(msg, null); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg Error message to issue * @param args Arguments to use in the message * * @throws javax.xml.transform.TransformerException */ protected void error(String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, // m_support.ERROR, // null, // null, fmsg, 0, 0); // if(shouldThrow) { throw new XPathException(fmsg, this); } } /** * XObjects should not normally need to fix up variables. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } /** * Cast result object to a string. * * * NEEDSDOC @param fsb * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { fsb.append(str()); } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { assertion(false, "callVisitors should not be called for this object!!!"); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; // If equals at the expression level calls deepEquals, I think we're // still safe from infinite recursion since this object overrides // equals. I hope. if(!this.equals((XObject)expr)) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XStringForFSB.java0000644000175000017500000007110710721374031024123 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XStringForFSB.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.XMLCharacterRecognizer; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; import org.apache.xpath.res.XPATHErrorResources; /** * This class will wrap a FastStringBuffer and allow for */ public class XStringForFSB extends XString { static final long serialVersionUID = -1533039186550674548L; /** The start position in the fsb. */ int m_start; /** The length of the string. */ int m_length; /** If the str() function is called, the string will be cached here. */ protected String m_strCache = null; /** cached hash code */ protected int m_hash = 0; /** * Construct a XNodeSet object. * * @param val FastStringBuffer object this will wrap, must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. */ public XStringForFSB(FastStringBuffer val, int start, int length) { super(val); m_start = start; m_length = length; if (null == val) throw new IllegalArgumentException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, null)); } /** * Construct a XNodeSet object. * * @param val String object this will wrap. */ private XStringForFSB(String val) { super(val); throw new IllegalArgumentException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_FSB_CANNOT_TAKE_STRING, null)); // "XStringForFSB can not take a string for an argument!"); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public FastStringBuffer fsb() { return ((FastStringBuffer) m_obj); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { // %OPT% !!! FSB has to be updated to take partial fsb's for append. fsb.append(str()); } /** * Tell if this object contains a java String object. * * @return true if this XMLString can return a string without creating one. */ public boolean hasString() { return (null != m_strCache); } // /** NEEDSDOC Field strCount */ // public static int strCount = 0; // // /** NEEDSDOC Field xtable */ // static java.util.Hashtable xtable = new java.util.Hashtable(); /** * Since this object is incomplete without the length and the offset, we * have to convert to a string when this function is called. * * @return The java String representation of this object. */ public Object object() { return str(); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public String str() { if (null == m_strCache) { m_strCache = fsb().getString(m_start, m_length); // strCount++; // // RuntimeException e = new RuntimeException("Bad! Bad!"); // java.io.CharArrayWriter writer = new java.io.CharArrayWriter(); // java.io.PrintWriter pw = new java.io.PrintWriter(writer); // // e.printStackTrace(pw); // // String str = writer.toString(); // // str = str.substring(0, 600); // // if (null == xtable.get(str)) // { // xtable.put(str, str); // System.out.println(str); // } // System.out.println("strCount: " + strCount); // throw e; // e.printStackTrace(); // System.exit(-1); } return m_strCache; } /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { fsb().sendSAXcharacters(ch, m_start, m_length); } /** * Directly call the * comment method on the passed LexicalHandler for the * string-value. * * @param lh A non-null reference to a LexicalHandler. * * @throws org.xml.sax.SAXException */ public void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh) throws org.xml.sax.SAXException { fsb().sendSAXComment(lh, m_start, m_length); } /** * Returns the length of this string. * * @return the length of the sequence of characters represented by this * object. */ public int length() { return m_length; } /** * Returns the character at the specified index. An index ranges * from 0 to length() - 1. The first character * of the sequence is at index 0, the next at index * 1, and so on, as for array indexing. * * @param index the index of the character. * @return the character at the specified index of this string. * The first character is at index 0. * @exception IndexOutOfBoundsException if the index * argument is negative or not less than the length of this * string. */ public char charAt(int index) { return fsb().charAt(m_start + index); } /** * Copies characters from this string into the destination character * array. * * @param srcBegin index of the first character in the string * to copy. * @param srcEnd index after the last character in the string * to copy. * @param dst the destination array. * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: *
    • srcBegin is negative. *
    • srcBegin is greater than srcEnd *
    • srcEnd is greater than the length of this * string *
    • dstBegin is negative *
    • dstBegin+(srcEnd-srcBegin) is larger than * dst.length
    * @exception NullPointerException if dst is null */ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { // %OPT% Need to call this on FSB when it is implemented. // %UNTESTED% (I don't think anyone calls this yet?) int n = srcEnd - srcBegin; if (n > m_length) n = m_length; if (n > (dst.length - dstBegin)) n = (dst.length - dstBegin); int end = srcBegin + m_start + n; int d = dstBegin; FastStringBuffer fsb = fsb(); for (int i = srcBegin + m_start; i < end; i++) { dst[d++] = fsb.charAt(i); } } /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this String * against. * * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(XMLString obj2) { if (this == obj2) { return true; } int n = m_length; if (n == obj2.length()) { FastStringBuffer fsb = fsb(); int i = m_start; int j = 0; while (n-- != 0) { if (fsb.charAt(i) != obj2.charAt(j)) { return false; } i++; j++; } return true; } return false; } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { if (this == obj2) { return true; } if(obj2.getType() == XObject.CLASS_NUMBER) return obj2.equals(this); String str = obj2.str(); int n = m_length; if (n == str.length()) { FastStringBuffer fsb = fsb(); int i = m_start; int j = 0; while (n-- != 0) { if (fsb.charAt(i) != str.charAt(j)) { return false; } i++; j++; } return true; } return false; } /** * Tell if two objects are functionally equal. * * @param anotherString Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(String anotherString) { int n = m_length; if (n == anotherString.length()) { FastStringBuffer fsb = fsb(); int i = m_start; int j = 0; while (n-- != 0) { if (fsb.charAt(i) != anotherString.charAt(j)) { return false; } i++; j++; } return true; } return false; } /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this String * against. * * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(Object obj2) { if (null == obj2) return false; if(obj2 instanceof XNumber) return obj2.equals(this); // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. else if (obj2 instanceof XNodeSet) return obj2.equals(this); else if (obj2 instanceof XStringForFSB) return equals((XMLString) obj2); else return equals(obj2.toString()); } /** * Compares this String to another String, * ignoring case considerations. Two strings are considered equal * ignoring case if they are of the same length, and corresponding * characters in the two strings are equal ignoring case. * * @param anotherString the String to compare this * String against. * @return true if the argument is not null * and the Strings are equal, * ignoring case; false otherwise. * @see #equals(Object) * @see java.lang.Character#toLowerCase(char) * @see java.lang.Character#toUpperCase(char) */ public boolean equalsIgnoreCase(String anotherString) { return (m_length == anotherString.length()) ? str().equalsIgnoreCase(anotherString) : false; } /** * Compares two strings lexicographically. * * @param xstr the String to be compared. * * @return the value 0 if the argument string is equal to * this string; a value less than 0 if this string * is lexicographically less than the string argument; and a * value greater than 0 if this string is * lexicographically greater than the string argument. * @exception java.lang.NullPointerException if anotherString * is null. */ public int compareTo(XMLString xstr) { int len1 = m_length; int len2 = xstr.length(); int n = Math.min(len1, len2); FastStringBuffer fsb = fsb(); int i = m_start; int j = 0; while (n-- != 0) { char c1 = fsb.charAt(i); char c2 = xstr.charAt(j); if (c1 != c2) { return c1 - c2; } i++; j++; } return len1 - len2; } /** * Compares two strings lexicographically, ignoring case considerations. * This method returns an integer whose sign is that of * this.toUpperCase().toLowerCase().compareTo( * str.toUpperCase().toLowerCase()). *

    * Note that this method does not take locale into account, * and will result in an unsatisfactory ordering for certain locales. * The java.text package provides collators to allow * locale-sensitive ordering. * * @param xstr the String to be compared. * * @return a negative integer, zero, or a positive integer as the * the specified String is greater than, equal to, or less * than this String, ignoring case considerations. * @see java.text.Collator#compare(String, String) * @since 1.2 */ public int compareToIgnoreCase(XMLString xstr) { int len1 = m_length; int len2 = xstr.length(); int n = Math.min(len1, len2); FastStringBuffer fsb = fsb(); int i = m_start; int j = 0; while (n-- != 0) { char c1 = Character.toLowerCase(fsb.charAt(i)); char c2 = Character.toLowerCase(xstr.charAt(j)); if (c1 != c2) { return c1 - c2; } i++; j++; } return len1 - len2; } /** * Returns a hashcode for this string. The hashcode for a * String object is computed as *

       * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
       * 
    * using int arithmetic, where s[i] is the * ith character of the string, n is the length of * the string, and ^ indicates exponentiation. * (The hash value of the empty string is zero.) * * @return a hash code value for this object. */ public int hashCode() { // Commenting this out because in JDK1.1.8 and VJ++ // we don't match XMLStrings. Defaulting to the super // causes us to create a string, but at this point // this only seems to get called in key processing. // Maybe we can live with it? /* int h = m_hash; if (h == 0) { int off = m_start; int len = m_length; FastStringBuffer fsb = fsb(); for (int i = 0; i < len; i++) { h = 31 * h + fsb.charAt(off); off++; } m_hash = h; } */ return super.hashCode(); // h; } /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *
       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(XMLString prefix, int toffset) { FastStringBuffer fsb = fsb(); int to = m_start + toffset; int tlim = m_start + m_length; int po = 0; int pc = prefix.length(); // Note: toffset might be near -1>>>1. if ((toffset < 0) || (toffset > m_length - pc)) { return false; } while (--pc >= 0) { if (fsb.charAt(to) != prefix.charAt(po)) { return false; } to++; po++; } return true; } /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. * @since JDK1. 0 */ public boolean startsWith(XMLString prefix) { return startsWith(prefix, 0); } /** * Returns the index within this string of the first occurrence of the * specified character. If a character with value ch occurs * in the character sequence represented by this String * object, then the index of the first such occurrence is returned -- * that is, the smallest value k such that: *
       * this.charAt(k) == ch
       * 
    * is true. If no such character occurs in this string, * then -1 is returned. * * @param ch a character. * @return the index of the first occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public int indexOf(int ch) { return indexOf(ch, 0); } /** * Returns the index within this string of the first occurrence of the * specified character, starting the search at the specified index. *

    * If a character with value ch occurs in the character * sequence represented by this String object at an index * no smaller than fromIndex, then the index of the first * such occurrence is returned--that is, the smallest value k * such that: *

       * (this.charAt(k) == ch) && (k >= fromIndex)
       * 
    * is true. If no such character occurs in this string at or after * position fromIndex, then -1 is returned. *

    * There is no restriction on the value of fromIndex. If it * is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param ch a character. * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in the * character sequence represented by this object that is greater * than or equal to fromIndex, or -1 * if the character does not occur. */ public int indexOf(int ch, int fromIndex) { int max = m_start + m_length; FastStringBuffer fsb = fsb(); if (fromIndex < 0) { fromIndex = 0; } else if (fromIndex >= m_length) { // Note: fromIndex might be near -1>>>1. return -1; } for (int i = m_start + fromIndex; i < max; i++) { if (fsb.charAt(i) == ch) { return i - m_start; } } return -1; } /** * Returns a new string that is a substring of this string. The * substring begins with the character at the specified index and * extends to the end of this string.

    * Examples: *

       * "unhappy".substring(2) returns "happy"
       * "Harbison".substring(3) returns "bison"
       * "emptiness".substring(9) returns "" (an empty string)
       * 
    * * @param beginIndex the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if * beginIndex is negative or larger than the * length of this String object. */ public XMLString substring(int beginIndex) { int len = m_length - beginIndex; if (len <= 0) return XString.EMPTYSTRING; else { int start = m_start + beginIndex; return new XStringForFSB(fsb(), start, len); } } /** * Returns a new string that is a substring of this string. The * substring begins at the specified beginIndex and * extends to the character at index endIndex - 1. * Thus the length of the substring is endIndex-beginIndex. * * @param beginIndex the beginning index, inclusive. * @param endIndex the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if the * beginIndex is negative, or * endIndex is larger than the length of * this String object, or * beginIndex is larger than * endIndex. */ public XMLString substring(int beginIndex, int endIndex) { int len = endIndex - beginIndex; if (len > m_length) len = m_length; if (len <= 0) return XString.EMPTYSTRING; else { int start = m_start + beginIndex; return new XStringForFSB(fsb(), start, len); } } /** * Concatenates the specified string to the end of this string. * * @param str the String that is concatenated to the end * of this String. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. * @exception java.lang.NullPointerException if str is * null. */ public XMLString concat(String str) { // %OPT% Make an FSB here? return new XString(str().concat(str)); } /** * Removes white space from both ends of this string. * * @return this string, with white space removed from the front and end. */ public XMLString trim() { return fixWhiteSpace(true, true, false); } /** * Returns whether the specified ch conforms to the XML 1.0 definition * of whitespace. Refer to * the definition of S for details. * @param ch Character to check as XML whitespace. * @return =true if ch is XML whitespace; otherwise =false. */ private static boolean isSpace(char ch) { return XMLCharacterRecognizer.isWhiteSpace(ch); // Take the easy way out for now. } /** * Conditionally trim all leading and trailing whitespace in the specified String. * All strings of white space are * replaced by a single space character (#x20), except spaces after punctuation which * receive double spaces if doublePunctuationSpaces is true. * This function may be useful to a formatter, but to get first class * results, the formatter should probably do it's own white space handling * based on the semantics of the formatting object. * * @param trimHead Trim leading whitespace? * @param trimTail Trim trailing whitespace? * @param doublePunctuationSpaces Use double spaces for punctuation? * @return The trimmed string. */ public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail, boolean doublePunctuationSpaces) { int end = m_length + m_start; char[] buf = new char[m_length]; FastStringBuffer fsb = fsb(); boolean edit = false; /* replace S to ' '. and ' '+ -> single ' '. */ int d = 0; boolean pres = false; for (int s = m_start; s < end; s++) { char c = fsb.charAt(s); if (isSpace(c)) { if (!pres) { if (' ' != c) { edit = true; } buf[d++] = ' '; if (doublePunctuationSpaces && (d != 0)) { char prevChar = buf[d - 1]; if (!((prevChar == '.') || (prevChar == '!') || (prevChar == '?'))) { pres = true; } } else { pres = true; } } else { edit = true; pres = true; } } else { buf[d++] = c; pres = false; } } if (trimTail && 1 <= d && ' ' == buf[d - 1]) { edit = true; d--; } int start = 0; if (trimHead && 0 < d && ' ' == buf[0]) { edit = true; start++; } XMLStringFactory xsf = XMLStringFactoryImpl.getFactory(); return edit ? xsf.newstr(buf, start, d - start) : this; } /** * Convert a string to a double -- Allowed input is in fixed * notation ddd.fff. * * %OPT% CHECK PERFORMANCE against generating a Java String and * converting it to double. The advantage of running in native * machine code -- perhaps even microcode, on some systems -- may * more than make up for the cost of allocating and discarding the * additional object. We need to benchmark this. * * %OPT% More importantly, we need to decide whether we _care_ about * the performance of this operation. Does XString.toDouble constitute * any measurable percentage of our typical runtime? I suspect not! * * @return A double value representation of the string, or return Double.NaN * if the string can not be converted. */ public double toDouble() { if(m_length == 0) return Double.NaN; int i; char c; String valueString = fsb().getString(m_start,m_length); // The following are permitted in the Double.valueOf, but not by the XPath spec: // - a plus sign // - The use of e or E to indicate exponents // - trailing f, F, d, or D // See function comments; not sure if this is slower than actually doing the // conversion ourselves (as was before). for (i=0;i '9')) break; } for (;iDTMIterator from the set which it iterated * over, releasing any computational resources and placing the iterator * in the INVALID state. After detach has been invoked, * calls to nextNode or previousNode will * raise a runtime exception. * * In general, detach should only be called once on the object. */ public void detach(){ if(m_allowRelease){ m_DTMXRTreeFrag.destruct(); setObject(null); } } /** * Tell what kind of class this is. * * @return type CLASS_RTREEFRAG */ public int getType() { return CLASS_RTREEFRAG; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#RTREEFRAG" */ public String getTypeString() { return "#RTREEFRAG"; } /** * Cast result object to a number. * * @return The result tree fragment as a number or NaN */ public double num() throws javax.xml.transform.TransformerException { XMLString s = xstr(); return s.toDouble(); } /** * Cast result object to a boolean. This always returns true for a RTreeFrag * because it is treated like a node-set with a single root node. * * @return true */ public boolean bool() { return true; } private XMLString m_xmlStr = null; /** * Cast result object to an XMLString. * * @return The document fragment node data or the empty string. */ public XMLString xstr() { if(null == m_xmlStr) m_xmlStr = m_DTMXRTreeFrag.getDTM().getStringValue(m_dtmRoot); return m_xmlStr; } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { XString xstring = (XString)xstr(); xstring.appendToFsb(fsb); } /** * Cast result object to a string. * * @return The document fragment node data or the empty string. */ public String str() { String str = m_DTMXRTreeFrag.getDTM().getStringValue(m_dtmRoot).toString(); return (null == str) ? "" : str; } /** * Cast result object to a result tree fragment. * * @return The document fragment this wraps */ public int rtf() { return m_dtmRoot; } /** * Cast result object to a DTMIterator. * dml - modified to return an RTFIterator for * benefit of EXSLT object-type function in * {@link org.apache.xalan.lib.ExsltCommon}. * @return The document fragment as a DTMIterator */ public DTMIterator asNodeIterator() { return new RTFIterator(m_dtmRoot, m_DTMXRTreeFrag.getXPathContext().getDTMManager()); } /** * Cast result object to a nodelist. (special function). * * @return The document fragment as a nodelist */ public NodeList convertToNodeset() { if (m_obj instanceof NodeList) return (NodeList) m_obj; else return new org.apache.xml.dtm.ref.DTMNodeList(asNodeIterator()); } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return True if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { try { if (XObject.CLASS_NODESET == obj2.getType()) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. return obj2.equals(this); } else if (XObject.CLASS_BOOLEAN == obj2.getType()) { return bool() == obj2.bool(); } else if (XObject.CLASS_NUMBER == obj2.getType()) { return num() == obj2.num(); } else if (XObject.CLASS_NODESET == obj2.getType()) { return xstr().equals(obj2.xstr()); } else if (XObject.CLASS_STRING == obj2.getType()) { return xstr().equals(obj2.xstr()); } else if (XObject.CLASS_RTREEFRAG == obj2.getType()) { // Probably not so good. Think about this. return xstr().equals(obj2.xstr()); } else { return super.equals(obj2); } } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XNumber.java0000644000175000017500000002434210721374031023102 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XNumber.java 469368 2006-10-31 04:41:36Z minchau $ */ package org.apache.xpath.objects; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; /** * This class represents an XPath number, and is capable of * converting the number to other types, such as a string. * @xsl.usage general */ public class XNumber extends XObject { static final long serialVersionUID = -2720400709619020193L; /** Value of the XNumber object. * @serial */ double m_val; /** * Construct a XNodeSet object. * * @param d Value of the object */ public XNumber(double d) { super(); m_val = d; } /** * Construct a XNodeSet object. * * @param num Value of the object */ public XNumber(Number num) { super(); m_val = num.doubleValue(); setObject(num); } /** * Tell that this is a CLASS_NUMBER. * * @return node type CLASS_NUMBER */ public int getType() { return CLASS_NUMBER; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#NUMBER" */ public String getTypeString() { return "#NUMBER"; } /** * Cast result object to a number. * * @return the value of the XNumber object */ public double num() { return m_val; } /** * Evaluate expression to a number. * * @return 0.0 * * @throws javax.xml.transform.TransformerException */ public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_val; } /** * Cast result object to a boolean. * * @return false if the value is NaN or equal to 0.0 */ public boolean bool() { return (Double.isNaN(m_val) || (m_val == 0.0)) ? false : true; } // /** // * Cast result object to a string. // * // * @return "NaN" if the number is NaN, Infinity or -Infinity if // * the number is infinite or the string value of the number. // */ // private static final int PRECISION = 16; // public String str() // { // // if (Double.isNaN(m_val)) // { // return "NaN"; // } // else if (Double.isInfinite(m_val)) // { // if (m_val > 0) // return "Infinity"; // else // return "-Infinity"; // } // // long longVal = (long)m_val; // if ((double)longVal == m_val) // return Long.toString(longVal); // // // String s = Double.toString(m_val); // int len = s.length(); // // if (s.charAt(len - 2) == '.' && s.charAt(len - 1) == '0') // { // return s.substring(0, len - 2); // } // // int exp = 0; // int e = s.indexOf('E'); // if (e != -1) // { // exp = Integer.parseInt(s.substring(e + 1)); // s = s.substring(0,e); // len = e; // } // // // Calculate Significant Digits: // // look from start of string for first digit // // look from end for last digit // // significant digits = end - start + (0 or 1 depending on decimal location) // // int decimalPos = -1; // int start = (s.charAt(0) == '-') ? 1 : 0; // findStart: for( ; start < len; start++ ) // { // switch (s.charAt(start)) // { // case '0': // break; // case '.': // decimalPos = start; // break; // default: // break findStart; // } // } // int end = s.length() - 1; // findEnd: for( ; end > start; end-- ) // { // switch (s.charAt(end)) // { // case '0': // break; // case '.': // decimalPos = end; // break; // default: // break findEnd; // } // } // // int sigDig = end - start; // // // clarify decimal location if it has not yet been found // if (decimalPos == -1) // decimalPos = s.indexOf('.'); // // // if decimal is not between start and end, add one to sigDig // if (decimalPos < start || decimalPos > end) // ++sigDig; // // // reduce significant digits to PRECISION if necessary // if (sigDig > PRECISION) // { // // re-scale BigDecimal in order to get significant digits = PRECISION // BigDecimal num = new BigDecimal(s); // int newScale = num.scale() - (sigDig - PRECISION); // if (newScale < 0) // newScale = 0; // s = num.setScale(newScale, BigDecimal.ROUND_HALF_UP).toString(); // // // remove trailing '0's; keep track of decimalPos // int truncatePoint = s.length(); // while (s.charAt(--truncatePoint) == '0') // ; // // if (s.charAt(truncatePoint) == '.') // { // decimalPos = truncatePoint; // } // else // { // decimalPos = s.indexOf('.'); // truncatePoint += 1; // } // // s = s.substring(0, truncatePoint); // len = s.length(); // } // // // Account for exponent by adding zeros as needed // // and moving the decimal place // // if (exp == 0) // return s; // // start = 0; // String sign; // if (s.charAt(0) == '-') // { // sign = "-"; // start++; // } // else // sign = ""; // // String wholePart = s.substring(start, decimalPos); // String decimalPart = s.substring(decimalPos + 1); // // // get the number of digits right of the decimal // int decimalLen = decimalPart.length(); // // if (exp >= decimalLen) // return sign + wholePart + decimalPart + zeros(exp - decimalLen); // // if (exp > 0) // return sign + wholePart + decimalPart.substring(0, exp) + "." // + decimalPart.substring(exp); // // return sign + "0." + zeros(-1 - exp) + wholePart + decimalPart; // } /** * Cast result object to a string. * * @return "NaN" if the number is NaN, Infinity or -Infinity if * the number is infinite or the string value of the number. */ public String str() { if (Double.isNaN(m_val)) { return "NaN"; } else if (Double.isInfinite(m_val)) { if (m_val > 0) return "Infinity"; else return "-Infinity"; } double num = m_val; String s = Double.toString(num); int len = s.length(); if (s.charAt(len - 2) == '.' && s.charAt(len - 1) == '0') { s = s.substring(0, len - 2); if (s.equals("-0")) return "0"; return s; } int e = s.indexOf('E'); if (e < 0) { if (s.charAt(len - 1) == '0') return s.substring(0, len - 1); else return s; } int exp = Integer.parseInt(s.substring(e + 1)); String sign; if (s.charAt(0) == '-') { sign = "-"; s = s.substring(1); --e; } else sign = ""; int nDigits = e - 2; if (exp >= nDigits) return sign + s.substring(0, 1) + s.substring(2, e) + zeros(exp - nDigits); // Eliminate trailing 0's - bugzilla 14241 while (s.charAt(e-1) == '0') e--; if (exp > 0) return sign + s.substring(0, 1) + s.substring(2, 2 + exp) + "." + s.substring(2 + exp, e); return sign + "0." + zeros(-1 - exp) + s.substring(0, 1) + s.substring(2, e); } /** * Return a string of '0' of the given length * * * @param n Length of the string to be returned * * @return a string of '0' with the given length */ static private String zeros(int n) { if (n < 1) return ""; char[] buf = new char[n]; for (int i = 0; i < n; i++) { buf[i] = '0'; } return new String(buf); } /** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The value of this XNumber as a Double object */ public Object object() { if(null == m_obj) setObject(new Double(m_val)); return m_obj; } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. int t = obj2.getType(); try { if (t == XObject.CLASS_NODESET) return obj2.equals(this); else if(t == XObject.CLASS_BOOLEAN) return obj2.bool() == bool(); else return m_val == obj2.num(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } } /** * Tell if this expression returns a stable number that will not change during * iterations within the expression. This is used to determine if a proximity * position predicate can indicate that no more searching has to occur. * * * @return true if the expression represents a stable number. */ public boolean isStableNumber() { return true; } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { visitor.visitNumberLiteral(owner, this); } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XStringForChars.java0000644000175000017500000001545010721374031024550 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XStringForChars.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.FastStringBuffer; import org.apache.xpath.res.XPATHErrorResources; /** * This class will wrap a FastStringBuffer and allow for */ public class XStringForChars extends XString { static final long serialVersionUID = -2235248887220850467L; /** The start position in the fsb. */ int m_start; /** The length of the string. */ int m_length; protected String m_strCache = null; /** * Construct a XNodeSet object. * * @param val FastStringBuffer object this will wrap, must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. */ public XStringForChars(char[] val, int start, int length) { super(val); m_start = start; m_length = length; if(null == val) throw new IllegalArgumentException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, null)); //"The FastStringBuffer argument can not be null!!"); } /** * Construct a XNodeSet object. * * @param val String object this will wrap. */ private XStringForChars(String val) { super(val); throw new IllegalArgumentException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, null)); //"XStringForChars can not take a string for an argument!"); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public FastStringBuffer fsb() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, null)); //"fsb() not supported for XStringForChars!"); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { fsb.append((char[])m_obj, m_start, m_length); } /** * Tell if this object contains a java String object. * * @return true if this XMLString can return a string without creating one. */ public boolean hasString() { return (null != m_strCache); } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public String str() { if(null == m_strCache) m_strCache = new String((char[])m_obj, m_start, m_length); return m_strCache; } /** * Since this object is incomplete without the length and the offset, we * have to convert to a string when this function is called. * * @return The java String representation of this object. */ public Object object() { return str(); } /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { ch.characters((char[])m_obj, m_start, m_length); } /** * Directly call the * comment method on the passed LexicalHandler for the * string-value. * * @param lh A non-null reference to a LexicalHandler. * * @throws org.xml.sax.SAXException */ public void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh) throws org.xml.sax.SAXException { lh.comment((char[])m_obj, m_start, m_length); } /** * Returns the length of this string. * * @return the length of the sequence of characters represented by this * object. */ public int length() { return m_length; } /** * Returns the character at the specified index. An index ranges * from 0 to length() - 1. The first character * of the sequence is at index 0, the next at index * 1, and so on, as for array indexing. * * @param index the index of the character. * @return the character at the specified index of this string. * The first character is at index 0. * @exception IndexOutOfBoundsException if the index * argument is negative or not less than the length of this * string. */ public char charAt(int index) { return ((char[])m_obj)[index+m_start]; } /** * Copies characters from this string into the destination character * array. * * @param srcBegin index of the first character in the string * to copy. * @param srcEnd index after the last character in the string * to copy. * @param dst the destination array. * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: *
    • srcBegin is negative. *
    • srcBegin is greater than srcEnd *
    • srcEnd is greater than the length of this * string *
    • dstBegin is negative *
    • dstBegin+(srcEnd-srcBegin) is larger than * dst.length
    * @exception NullPointerException if dst is null */ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { System.arraycopy((char[])m_obj, m_start+srcBegin, dst, dstBegin, srcEnd); } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XRTreeFragSelectWrapper.java0000644000175000017500000001251110721374031026167 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XRTreeFragSelectWrapper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.XMLString; import org.apache.xpath.Expression; import org.apache.xpath.XPathContext; import org.apache.xpath.res.XPATHErrorResources; /** * This class makes an select statement act like an result tree fragment. */ public class XRTreeFragSelectWrapper extends XRTreeFrag implements Cloneable { static final long serialVersionUID = -6526177905590461251L; public XRTreeFragSelectWrapper(Expression expr) { super(expr); } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { ((Expression)m_obj).fixupVariables(vars, globalsSize); } /** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return the result of executing the select expression * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject m_selected; m_selected = ((Expression)m_obj).execute(xctxt); m_selected.allowDetachToRelease(m_allowRelease); if (m_selected.getType() == CLASS_STRING) return m_selected; else return new XString(m_selected.str()); } /** * Detaches the DTMIterator from the set which it iterated * over, releasing any computational resources and placing the iterator * in the INVALID state. After detach has been invoked, * calls to nextNode or previousNode will * raise a runtime exception. * * In general, detach should only be called once on the object. */ public void detach() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"detach() not supported by XRTreeFragSelectWrapper!"); } /** * Cast result object to a number. * * @return The result tree fragment as a number or NaN */ public double num() throws javax.xml.transform.TransformerException { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"num() not supported by XRTreeFragSelectWrapper!"); } /** * Cast result object to an XMLString. * * @return The document fragment node data or the empty string. */ public XMLString xstr() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"xstr() not supported by XRTreeFragSelectWrapper!"); } /** * Cast result object to a string. * * @return The document fragment node data or the empty string. */ public String str() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"str() not supported by XRTreeFragSelectWrapper!"); } /** * Tell what kind of class this is. * * @return the string type */ public int getType() { return CLASS_STRING; } /** * Cast result object to a result tree fragment. * * @return The document fragment this wraps */ public int rtf() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"rtf() not supported by XRTreeFragSelectWrapper!"); } /** * Cast result object to a DTMIterator. * * @return The document fragment as a DTMIterator */ public DTMIterator asNodeIterator() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"asNodeIterator() not supported by XRTreeFragSelectWrapper!"); } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XBoolean.java0000644000175000017500000000750010721374032023227 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XBoolean.java 469368 2006-10-31 04:41:36Z minchau $ */ package org.apache.xpath.objects; /** * This class represents an XPath boolean object, and is capable of * converting the boolean to other types, such as a string. * @xsl.usage advanced */ public class XBoolean extends XObject { static final long serialVersionUID = -2964933058866100881L; /** * A true boolean object so we don't have to keep creating them. * @xsl.usage internal */ public static final XBoolean S_TRUE = new XBooleanStatic(true); /** * A true boolean object so we don't have to keep creating them. * @xsl.usage internal */ public static final XBoolean S_FALSE = new XBooleanStatic(false); /** Value of the object. * @serial */ private final boolean m_val; /** * Construct a XBoolean object. * * @param b Value of the boolean object */ public XBoolean(boolean b) { super(); m_val = b; } /** * Construct a XBoolean object. * * @param b Value of the boolean object */ public XBoolean(Boolean b) { super(); m_val = b.booleanValue(); setObject(b); } /** * Tell that this is a CLASS_BOOLEAN. * * @return type of CLASS_BOOLEAN */ public int getType() { return CLASS_BOOLEAN; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#BOOLEAN" */ public String getTypeString() { return "#BOOLEAN"; } /** * Cast result object to a number. * * @return numeric value of the object value */ public double num() { return m_val ? 1.0 : 0.0; } /** * Cast result object to a boolean. * * @return The object value as a boolean */ public boolean bool() { return m_val; } /** * Cast result object to a string. * * @return The object's value as a string */ public String str() { return m_val ? "true" : "false"; } /** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The object's value as a java object */ public Object object() { if(null == m_obj) setObject(new Boolean(m_val)); return m_obj; } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare to this * * @return True if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. if (obj2.getType() == XObject.CLASS_NODESET) return obj2.equals(this); try { return m_val == obj2.bool(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XNull.java0000644000175000017500000000550610721374033022567 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XNull.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; /** * This class represents an XPath null object, and is capable of * converting the null to other types, such as a string. * @xsl.usage general */ public class XNull extends XNodeSet { static final long serialVersionUID = -6841683711458983005L; /** * Create an XObject. */ public XNull() { super(); } /** * Tell what kind of class this is. * * @return type CLASS_NULL */ public int getType() { return CLASS_NULL; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#CLASS_NULL" */ public String getTypeString() { return "#CLASS_NULL"; } /** * Cast result object to a number. * * @return 0.0 */ public double num() { return 0.0; } /** * Cast result object to a boolean. * * @return false */ public boolean bool() { return false; } /** * Cast result object to a string. * * @return empty string "" */ public String str() { return ""; } /** * Cast result object to a result tree fragment. * * @param support XPath context to use for the conversion * * @return The object as a result tree fragment. */ public int rtf(XPathContext support) { // DTM frag = support.createDocumentFragment(); // %REVIEW% return DTM.NULL; } // /** // * Cast result object to a nodelist. // * // * @return null // */ // public DTMIterator iter() // { // return null; // } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return True if the given object is of type CLASS_NULL */ public boolean equals(XObject obj2) { return obj2.getType() == CLASS_NULL; } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/package.html0000644000175000017500000000214710721374030023136 0ustar mkochmkoch XPath objects Package.

    Implementation of XPath polymorphic type objects -- this package will grow as XPath objects are expanded to support XML Schema data types.

    libxalan2-java-2.7.1/src/org/apache/xpath/objects/XNodeSet.java0000644000175000017500000005715210721374033023222 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XNodeSet.java 469368 2006-10-31 04:41:36Z minchau $ */ package org.apache.xpath.objects; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.utils.XMLString; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.axes.NodeSequence; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** * This class represents an XPath nodeset object, and is capable of * converting the nodeset to other types, such as a string. * @xsl.usage general */ public class XNodeSet extends NodeSequence { static final long serialVersionUID = 1916026368035639667L; /** * Default constructor for derived objects. */ protected XNodeSet() { } /** * Construct a XNodeSet object. * * @param val Value of the XNodeSet object */ public XNodeSet(DTMIterator val) { super(); if(val instanceof XNodeSet) { final XNodeSet nodeSet = (XNodeSet) val; setIter(nodeSet.m_iter); m_dtmMgr = nodeSet.m_dtmMgr; m_last = nodeSet.m_last; // First make sure the DTMIterator val has a cache, // so if it doesn't have one, make one. if(!nodeSet.hasCache()) nodeSet.setShouldCacheNodes(true); // Get the cache from val and use it ourselves (we share it). setObject(nodeSet.getIteratorCache()); } else setIter(val); } /** * Construct a XNodeSet object. * * @param val Value of the XNodeSet object */ public XNodeSet(XNodeSet val) { super(); setIter(val.m_iter); m_dtmMgr = val.m_dtmMgr; m_last = val.m_last; if(!val.hasCache()) val.setShouldCacheNodes(true); setObject(val.m_obj); } /** * Construct an empty XNodeSet object. This is used to create a mutable * nodeset to which random nodes may be added. */ public XNodeSet(DTMManager dtmMgr) { this(DTM.NULL,dtmMgr); } /** * Construct a XNodeSet object for one node. * * @param n Node to add to the new XNodeSet object */ public XNodeSet(int n, DTMManager dtmMgr) { super(new NodeSetDTM(dtmMgr)); m_dtmMgr = dtmMgr; if (DTM.NULL != n) { ((NodeSetDTM) m_obj).addNode(n); m_last = 1; } else m_last = 0; } /** * Tell that this is a CLASS_NODESET. * * @return type CLASS_NODESET */ public int getType() { return CLASS_NODESET; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return type string "#NODESET" */ public String getTypeString() { return "#NODESET"; } /** * Get numeric value of the string conversion from a single node. * * @param n Node to convert * * @return numeric value of the string conversion from a single node. */ public double getNumberFromNode(int n) { XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n); return xstr.toDouble(); } /** * Cast result object to a number. * * @return numeric value of the string conversion from the * next node in the NodeSetDTM, or NAN if no node was found */ public double num() { int node = item(0); return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN; } /** * Cast result object to a number, but allow side effects, such as the * incrementing of an iterator. * * @return numeric value of the string conversion from the * next node in the NodeSetDTM, or NAN if no node was found */ public double numWithSideEffects() { int node = nextNode(); return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN; } /** * Cast result object to a boolean. * * @return True if there is a next node in the nodeset */ public boolean bool() { return (item(0) != DTM.NULL); } /** * Cast result object to a boolean, but allow side effects, such as the * incrementing of an iterator. * * @return True if there is a next node in the nodeset */ public boolean boolWithSideEffects() { return (nextNode() != DTM.NULL); } /** * Get the string conversion from a single node. * * @param n Node to convert * * @return the string conversion from a single node. */ public XMLString getStringFromNode(int n) { // %OPT% // I guess we'll have to get a static instance of the DTM manager... if(DTM.NULL != n) { return m_dtmMgr.getDTM(n).getStringValue(n); } else { return org.apache.xpath.objects.XString.EMPTYSTRING; } } /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { int node = item(0); if(node != DTM.NULL) { m_dtmMgr.getDTM(node).dispatchCharactersEvents(node, ch, false); } } /** * Cast result object to an XMLString. * * @return The document fragment node data or the empty string. */ public XMLString xstr() { int node = item(0); return (node != DTM.NULL) ? getStringFromNode(node) : XString.EMPTYSTRING; } /** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { XString xstring = (XString)xstr(); xstring.appendToFsb(fsb); } /** * Cast result object to a string. * * @return the string conversion from the next node in the nodeset * or "" if there is no next node */ public String str() { int node = item(0); return (node != DTM.NULL) ? getStringFromNode(node).toString() : ""; } /** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The object that this class wraps */ public Object object() { if(null == m_obj) return this; else return m_obj; } // %REVIEW% // hmmm... // /** // * Cast result object to a result tree fragment. // * // * @param support The XPath context to use for the conversion // * // * @return the nodeset as a result tree fragment. // */ // public DocumentFragment rtree(XPathContext support) // { // DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // DocumentBuilder db = dbf.newDocumentBuilder(); // Document myDoc = db.newDocument(); // // DocumentFragment docFrag = myDoc.createDocumentFragment(); // // DTMIterator nl = iter(); // int node; // // while (DTM.NULL != (node = nl.nextNode())) // { // frag.appendChild(node, true, true); // } // // return frag.getDocument(); // } /** * Cast result object to a nodelist. * * @return a NodeIterator. * * @throws javax.xml.transform.TransformerException */ public NodeIterator nodeset() throws javax.xml.transform.TransformerException { return new org.apache.xml.dtm.ref.DTMNodeIterator(iter()); } /** * Cast result object to a nodelist. * * @return a NodeList. * * @throws javax.xml.transform.TransformerException */ public NodeList nodelist() throws javax.xml.transform.TransformerException { org.apache.xml.dtm.ref.DTMNodeList nodelist = new org.apache.xml.dtm.ref.DTMNodeList(this); // Creating a DTMNodeList has the side-effect that it will create a clone // XNodeSet with cache and run m_iter to the end. You cannot get any node // from m_iter after this call. As a fix, we call SetVector() on the clone's // cache. See Bugzilla 14406. XNodeSet clone = (XNodeSet)nodelist.getDTMIterator(); SetVector(clone.getVector()); return nodelist; } // /** // * Return a java object that's closest to the representation // * that should be handed to an extension. // * // * @return The object that this class wraps // */ // public Object object() // { // return new org.apache.xml.dtm.ref.DTMNodeList(iter()); // } /** * Return the iterator without cloning, etc. */ public DTMIterator iterRaw() { return this; } public void release(DTMIterator iter) { } /** * Cast result object to a nodelist. * * @return The nodeset as a nodelist */ public DTMIterator iter() { try { if(hasCache()) return cloneWithReset(); else return this; // don't bother to clone... won't do any good! } catch (CloneNotSupportedException cnse) { throw new RuntimeException(cnse.getMessage()); } } /** * Get a fresh copy of the object. For use with variables. * * @return A fresh nodelist. */ public XObject getFresh() { try { if(hasCache()) return (XObject)cloneWithReset(); else return this; // don't bother to clone... won't do any good! } catch (CloneNotSupportedException cnse) { throw new RuntimeException(cnse.getMessage()); } } /** * Cast result object to a mutableNodeset. * * @return The nodeset as a mutableNodeset */ public NodeSetDTM mutableNodeset() { NodeSetDTM mnl; if(m_obj instanceof NodeSetDTM) { mnl = (NodeSetDTM) m_obj; } else { mnl = new NodeSetDTM(iter()); setObject(mnl); setCurrentPos(0); } return mnl; } /** Less than comparator */ static final LessThanComparator S_LT = new LessThanComparator(); /** Less than or equal comparator */ static final LessThanOrEqualComparator S_LTE = new LessThanOrEqualComparator(); /** Greater than comparator */ static final GreaterThanComparator S_GT = new GreaterThanComparator(); /** Greater than or equal comparator */ static final GreaterThanOrEqualComparator S_GTE = new GreaterThanOrEqualComparator(); /** Equal comparator */ static final EqualComparator S_EQ = new EqualComparator(); /** Not equal comparator */ static final NotEqualComparator S_NEQ = new NotEqualComparator(); /** * Tell if one object is less than the other. * * @param obj2 Object to compare this nodeset to * @param comparator Comparator to use * * @return See the comments below for each object type comparison * * @throws javax.xml.transform.TransformerException */ public boolean compare(XObject obj2, Comparator comparator) throws javax.xml.transform.TransformerException { boolean result = false; int type = obj2.getType(); if (XObject.CLASS_NODESET == type) { // %OPT% This should be XMLString based instead of string based... // From http://www.w3.org/TR/xpath: // If both objects to be compared are node-sets, then the comparison // will be true if and only if there is a node in the first node-set // and a node in the second node-set such that the result of performing // the comparison on the string-values of the two nodes is true. // Note this little gem from the draft: // NOTE: If $x is bound to a node-set, then $x="foo" // does not mean the same as not($x!="foo"): the former // is true if and only if some node in $x has the string-value // foo; the latter is true if and only if all nodes in $x have // the string-value foo. DTMIterator list1 = iterRaw(); DTMIterator list2 = ((XNodeSet) obj2).iterRaw(); int node1; java.util.Vector node2Strings = null; while (DTM.NULL != (node1 = list1.nextNode())) { XMLString s1 = getStringFromNode(node1); if (null == node2Strings) { int node2; while (DTM.NULL != (node2 = list2.nextNode())) { XMLString s2 = getStringFromNode(node2); if (comparator.compareStrings(s1, s2)) { result = true; break; } if (null == node2Strings) node2Strings = new java.util.Vector(); node2Strings.addElement(s2); } } else { int n = node2Strings.size(); for (int i = 0; i < n; i++) { if (comparator.compareStrings(s1, (XMLString)node2Strings.elementAt(i))) { result = true; break; } } } } list1.reset(); list2.reset(); } else if (XObject.CLASS_BOOLEAN == type) { // From http://www.w3.org/TR/xpath: // If one object to be compared is a node-set and the other is a boolean, // then the comparison will be true if and only if the result of // performing the comparison on the boolean and on the result of // converting the node-set to a boolean using the boolean function // is true. double num1 = bool() ? 1.0 : 0.0; double num2 = obj2.num(); result = comparator.compareNumbers(num1, num2); } else if (XObject.CLASS_NUMBER == type) { // From http://www.w3.org/TR/xpath: // If one object to be compared is a node-set and the other is a number, // then the comparison will be true if and only if there is a // node in the node-set such that the result of performing the // comparison on the number to be compared and on the result of // converting the string-value of that node to a number using // the number function is true. DTMIterator list1 = iterRaw(); double num2 = obj2.num(); int node; while (DTM.NULL != (node = list1.nextNode())) { double num1 = getNumberFromNode(node); if (comparator.compareNumbers(num1, num2)) { result = true; break; } } list1.reset(); } else if (XObject.CLASS_RTREEFRAG == type) { XMLString s2 = obj2.xstr(); DTMIterator list1 = iterRaw(); int node; while (DTM.NULL != (node = list1.nextNode())) { XMLString s1 = getStringFromNode(node); if (comparator.compareStrings(s1, s2)) { result = true; break; } } list1.reset(); } else if (XObject.CLASS_STRING == type) { // From http://www.w3.org/TR/xpath: // If one object to be compared is a node-set and the other is a // string, then the comparison will be true if and only if there // is a node in the node-set such that the result of performing // the comparison on the string-value of the node and the other // string is true. XMLString s2 = obj2.xstr(); DTMIterator list1 = iterRaw(); int node; while (DTM.NULL != (node = list1.nextNode())) { XMLString s1 = getStringFromNode(node); if (comparator.compareStrings(s1, s2)) { result = true; break; } } list1.reset(); } else { result = comparator.compareNumbers(this.num(), obj2.num()); } return result; } /** * Tell if one object is less than the other. * * @param obj2 object to compare this nodeset to * * @return see this.compare(...) * * @throws javax.xml.transform.TransformerException */ public boolean lessThan(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_LT); } /** * Tell if one object is less than or equal to the other. * * @param obj2 object to compare this nodeset to * * @return see this.compare(...) * * @throws javax.xml.transform.TransformerException */ public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_LTE); } /** * Tell if one object is less than the other. * * @param obj2 object to compare this nodeset to * * @return see this.compare(...) * * @throws javax.xml.transform.TransformerException */ public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_GT); } /** * Tell if one object is less than the other. * * @param obj2 object to compare this nodeset to * * @return see this.compare(...) * * @throws javax.xml.transform.TransformerException */ public boolean greaterThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_GTE); } /** * Tell if two objects are functionally equal. * * @param obj2 object to compare this nodeset to * * @return see this.compare(...) * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { try { return compare(obj2, S_EQ); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } } /** * Tell if two objects are functionally not equal. * * @param obj2 object to compare this nodeset to * * @return see this.compare(...) * * @throws javax.xml.transform.TransformerException */ public boolean notEquals(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_NEQ); } } /** * compares nodes for various boolean operations. */ abstract class Comparator { /** * Compare two strings * * * @param s1 First string to compare * @param s2 Second String to compare * * @return Whether the strings are equal or not */ abstract boolean compareStrings(XMLString s1, XMLString s2); /** * Compare two numbers * * * @param n1 First number to compare * @param n2 Second number to compare * * @return Whether the numbers are equal or not */ abstract boolean compareNumbers(double n1, double n2); } /** * Compare strings or numbers for less than. */ class LessThanComparator extends Comparator { /** * Compare two strings for less than. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return True if s1 is less than s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() < s2.toDouble()); // return s1.compareTo(s2) < 0; } /** * Compare two numbers for less than. * * * @param n1 First number to compare * @param n2 Second number to compare * * @return true if n1 is less than n2 */ boolean compareNumbers(double n1, double n2) { return n1 < n2; } } /** * Compare strings or numbers for less than or equal. */ class LessThanOrEqualComparator extends Comparator { /** * Compare two strings for less than or equal. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is less than or equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() <= s2.toDouble()); // return s1.compareTo(s2) <= 0; } /** * Compare two numbers for less than or equal. * * * @param n1 First number to compare * @param n2 Second number to compare * * @return true if n1 is less than or equal to n2 */ boolean compareNumbers(double n1, double n2) { return n1 <= n2; } } /** * Compare strings or numbers for greater than. */ class GreaterThanComparator extends Comparator { /** * Compare two strings for greater than. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is greater than s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() > s2.toDouble()); // return s1.compareTo(s2) > 0; } /** * Compare two numbers for greater than. * * * @param n1 First number to compare * @param n2 Second number to compare * * @return true if n1 is greater than n2 */ boolean compareNumbers(double n1, double n2) { return n1 > n2; } } /** * Compare strings or numbers for greater than or equal. */ class GreaterThanOrEqualComparator extends Comparator { /** * Compare two strings for greater than or equal. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is greater than or equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return (s1.toDouble() >= s2.toDouble()); // return s1.compareTo(s2) >= 0; } /** * Compare two numbers for greater than or equal. * * * @param n1 First number to compare * @param n2 Second number to compare * * @return true if n1 is greater than or equal to n2 */ boolean compareNumbers(double n1, double n2) { return n1 >= n2; } } /** * Compare strings or numbers for equality. */ class EqualComparator extends Comparator { /** * Compare two strings for equality. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return s1.equals(s2); } /** * Compare two numbers for equality. * * * @param n1 First number to compare * @param n2 Second number to compare * * @return true if n1 is equal to n2 */ boolean compareNumbers(double n1, double n2) { return n1 == n2; } } /** * Compare strings or numbers for non-equality. */ class NotEqualComparator extends Comparator { /** * Compare two strings for non-equality. * * * @param s1 First string to compare * @param s2 Second String to compare * * @return true if s1 is not equal to s2 */ boolean compareStrings(XMLString s1, XMLString s2) { return !s1.equals(s2); } /** * Compare two numbers for non-equality. * * * @param n1 First number to compare * @param n2 Second number to compare * * @return true if n1 is not equal to n2 */ boolean compareNumbers(double n1, double n2) { return n1 != n2; } } libxalan2-java-2.7.1/src/org/apache/xpath/objects/XBooleanStatic.java0000644000175000017500000000361410721374030024377 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XBooleanStatic.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.objects; /** * This class doesn't have any XPathContext, so override * whatever to ensure it works OK. * @xsl.usage internal */ public class XBooleanStatic extends XBoolean { static final long serialVersionUID = -8064147275772687409L; /** The value of the object. * @serial */ private final boolean m_val; /** * Construct a XBooleanStatic object. * * @param b The value of the object */ public XBooleanStatic(boolean b) { super(b); m_val = b; } /** * Tell if two objects are functionally equal. * * @param obj2 Object to compare to this * * @return True if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { try { return m_val == obj2.bool(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/0000755000175000017500000000000010736146354021046 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/compiler/Compiler.java0000644000175000017500000011433010721374031023452 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Compiler.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.QName; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xpath.Expression; import org.apache.xpath.axes.UnionPathIterator; import org.apache.xpath.axes.WalkerFactory; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.functions.FuncExtFunctionAvailable; import org.apache.xpath.functions.Function; import org.apache.xpath.functions.WrongNumberArgsException; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XString; import org.apache.xpath.operations.And; import org.apache.xpath.operations.Div; import org.apache.xpath.operations.Equals; import org.apache.xpath.operations.Gt; import org.apache.xpath.operations.Gte; import org.apache.xpath.operations.Lt; import org.apache.xpath.operations.Lte; import org.apache.xpath.operations.Minus; import org.apache.xpath.operations.Mod; import org.apache.xpath.operations.Mult; import org.apache.xpath.operations.Neg; import org.apache.xpath.operations.NotEquals; import org.apache.xpath.operations.Operation; import org.apache.xpath.operations.Or; import org.apache.xpath.operations.Plus; import org.apache.xpath.operations.UnaryOperation; import org.apache.xpath.operations.Variable; import org.apache.xpath.patterns.FunctionPattern; import org.apache.xpath.patterns.NodeTest; import org.apache.xpath.patterns.StepPattern; import org.apache.xpath.patterns.UnionPattern; import org.apache.xpath.res.XPATHErrorResources; /** * An instance of this class compiles an XPath string expression into * a Expression object. This class compiles the string into a sequence * of operation codes (op map) and then builds from that into an Expression * tree. * @xsl.usage advanced */ public class Compiler extends OpMap { /** * Construct a Compiler object with a specific ErrorListener and * SourceLocator where the expression is located. * * @param errorHandler Error listener where messages will be sent, or null * if messages should be sent to System err. * @param locator The location object where the expression lives, which * may be null, but which, if not null, must be valid over * the long haul, in other words, it will not be cloned. * @param fTable The FunctionTable object where the xpath build-in * functions are stored. */ public Compiler(ErrorListener errorHandler, SourceLocator locator, FunctionTable fTable) { m_errorHandler = errorHandler; m_locator = locator; m_functionTable = fTable; } /** * Construct a Compiler instance that has a null error listener and a * null source locator. */ public Compiler() { m_errorHandler = null; m_locator = null; } /** * Execute the XPath object from a given opcode position. * @param opPos The current position in the xpath.m_opMap array. * @return The result of the XPath. * * @throws TransformerException if there is a syntax or other error. * @xsl.usage advanced */ public Expression compile(int opPos) throws TransformerException { int op = getOp(opPos); Expression expr = null; // System.out.println(getPatternString()+"op: "+op); switch (op) { case OpCodes.OP_XPATH : expr = compile(opPos + 2); break; case OpCodes.OP_OR : expr = or(opPos); break; case OpCodes.OP_AND : expr = and(opPos); break; case OpCodes.OP_NOTEQUALS : expr = notequals(opPos); break; case OpCodes.OP_EQUALS : expr = equals(opPos); break; case OpCodes.OP_LTE : expr = lte(opPos); break; case OpCodes.OP_LT : expr = lt(opPos); break; case OpCodes.OP_GTE : expr = gte(opPos); break; case OpCodes.OP_GT : expr = gt(opPos); break; case OpCodes.OP_PLUS : expr = plus(opPos); break; case OpCodes.OP_MINUS : expr = minus(opPos); break; case OpCodes.OP_MULT : expr = mult(opPos); break; case OpCodes.OP_DIV : expr = div(opPos); break; case OpCodes.OP_MOD : expr = mod(opPos); break; // case OpCodes.OP_QUO : // expr = quo(opPos); break; case OpCodes.OP_NEG : expr = neg(opPos); break; case OpCodes.OP_STRING : expr = string(opPos); break; case OpCodes.OP_BOOL : expr = bool(opPos); break; case OpCodes.OP_NUMBER : expr = number(opPos); break; case OpCodes.OP_UNION : expr = union(opPos); break; case OpCodes.OP_LITERAL : expr = literal(opPos); break; case OpCodes.OP_VARIABLE : expr = variable(opPos); break; case OpCodes.OP_GROUP : expr = group(opPos); break; case OpCodes.OP_NUMBERLIT : expr = numberlit(opPos); break; case OpCodes.OP_ARGUMENT : expr = arg(opPos); break; case OpCodes.OP_EXTFUNCTION : expr = compileExtension(opPos); break; case OpCodes.OP_FUNCTION : expr = compileFunction(opPos); break; case OpCodes.OP_LOCATIONPATH : expr = locationPath(opPos); break; case OpCodes.OP_PREDICATE : expr = null; break; // should never hit this here. case OpCodes.OP_MATCHPATTERN : expr = matchPattern(opPos + 2); break; case OpCodes.OP_LOCATIONPATHPATTERN : expr = locationPathPattern(opPos); break; case OpCodes.OP_QUO: error(XPATHErrorResources.ER_UNKNOWN_OPCODE, new Object[]{ "quo" }); //"ERROR! Unknown op code: "+m_opMap[opPos]); break; default : error(XPATHErrorResources.ER_UNKNOWN_OPCODE, new Object[]{ Integer.toString(getOp(opPos)) }); //"ERROR! Unknown op code: "+m_opMap[opPos]); } // if(null != expr) // expr.setSourceLocator(m_locator); return expr; } /** * Bottle-neck compilation of an operation with left and right operands. * * @param operation non-null reference to parent operation. * @param opPos The op map position of the parent operation. * * @return reference to {@link org.apache.xpath.operations.Operation} instance. * * @throws TransformerException if there is a syntax or other error. */ private Expression compileOperation(Operation operation, int opPos) throws TransformerException { int leftPos = getFirstChildPos(opPos); int rightPos = getNextOpPos(leftPos); operation.setLeftRight(compile(leftPos), compile(rightPos)); return operation; } /** * Bottle-neck compilation of a unary operation. * * @param unary The parent unary operation. * @param opPos The position in the op map of the parent operation. * * @return The unary argument. * * @throws TransformerException if syntax or other error occurs. */ private Expression compileUnary(UnaryOperation unary, int opPos) throws TransformerException { int rightPos = getFirstChildPos(opPos); unary.setRight(compile(rightPos)); return unary; } /** * Compile an 'or' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Or} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression or(int opPos) throws TransformerException { return compileOperation(new Or(), opPos); } /** * Compile an 'and' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.And} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression and(int opPos) throws TransformerException { return compileOperation(new And(), opPos); } /** * Compile a '!=' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.NotEquals} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression notequals(int opPos) throws TransformerException { return compileOperation(new NotEquals(), opPos); } /** * Compile a '=' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Equals} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression equals(int opPos) throws TransformerException { return compileOperation(new Equals(), opPos); } /** * Compile a '<=' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Lte} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression lte(int opPos) throws TransformerException { return compileOperation(new Lte(), opPos); } /** * Compile a '<' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Lt} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression lt(int opPos) throws TransformerException { return compileOperation(new Lt(), opPos); } /** * Compile a '>=' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Gte} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression gte(int opPos) throws TransformerException { return compileOperation(new Gte(), opPos); } /** * Compile a '>' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Gt} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression gt(int opPos) throws TransformerException { return compileOperation(new Gt(), opPos); } /** * Compile a '+' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Plus} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression plus(int opPos) throws TransformerException { return compileOperation(new Plus(), opPos); } /** * Compile a '-' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Minus} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression minus(int opPos) throws TransformerException { return compileOperation(new Minus(), opPos); } /** * Compile a '*' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Mult} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression mult(int opPos) throws TransformerException { return compileOperation(new Mult(), opPos); } /** * Compile a 'div' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Div} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression div(int opPos) throws TransformerException { return compileOperation(new Div(), opPos); } /** * Compile a 'mod' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Mod} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression mod(int opPos) throws TransformerException { return compileOperation(new Mod(), opPos); } /* * Compile a 'quo' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Quo} instance. * * @throws TransformerException if a error occurs creating the Expression. */ // protected Expression quo(int opPos) throws TransformerException // { // return compileOperation(new Quo(), opPos); // } /** * Compile a unary '-' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Neg} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression neg(int opPos) throws TransformerException { return compileUnary(new Neg(), opPos); } /** * Compile a 'string(...)' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.String} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression string(int opPos) throws TransformerException { return compileUnary(new org.apache.xpath.operations.String(), opPos); } /** * Compile a 'boolean(...)' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Bool} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression bool(int opPos) throws TransformerException { return compileUnary(new org.apache.xpath.operations.Bool(), opPos); } /** * Compile a 'number(...)' operation. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Number} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression number(int opPos) throws TransformerException { return compileUnary(new org.apache.xpath.operations.Number(), opPos); } /** * Compile a literal string value. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.objects.XString} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression literal(int opPos) { opPos = getFirstChildPos(opPos); return (XString) getTokenQueue().elementAt(getOp(opPos)); } /** * Compile a literal number value. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.objects.XNumber} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression numberlit(int opPos) { opPos = getFirstChildPos(opPos); return (XNumber) getTokenQueue().elementAt(getOp(opPos)); } /** * Compile a variable reference. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Variable} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; } /** * Compile an expression group. * * @param opPos The current position in the m_opMap array. * * @return reference to the contained expression. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression group(int opPos) throws TransformerException { // no-op return compile(opPos + 2); } /** * Compile a function argument. * * @param opPos The current position in the m_opMap array. * * @return reference to the argument expression. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression arg(int opPos) throws TransformerException { // no-op return compile(opPos + 2); } /** * Compile a location path union. The UnionPathIterator itself may create * {@link org.apache.xpath.axes.LocPathIterator} children. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.axes.LocPathIterator} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression union(int opPos) throws TransformerException { locPathDepth++; try { return UnionPathIterator.createUnionIterator(this, opPos); } finally { locPathDepth--; } } private int locPathDepth = -1; /** * Get the level of the location path or union being constructed. * @return 0 if it is a top-level path. */ public int getLocationPathDepth() { return locPathDepth; } /** * Get the function table */ FunctionTable getFunctionTable() { return m_functionTable; } /** * Compile a location path. The LocPathIterator itself may create * {@link org.apache.xpath.axes.AxesWalker} children. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.axes.LocPathIterator} instance. * * @throws TransformerException if a error occurs creating the Expression. */ public Expression locationPath(int opPos) throws TransformerException { locPathDepth++; try { DTMIterator iter = WalkerFactory.newDTMIterator(this, opPos, (locPathDepth == 0)); return (Expression)iter; // cast OK, I guess. } finally { locPathDepth--; } } /** * Compile a location step predicate expression. * * @param opPos The current position in the m_opMap array. * * @return the contained predicate expression. * * @throws TransformerException if a error occurs creating the Expression. */ public Expression predicate(int opPos) throws TransformerException { return compile(opPos + 2); } /** * Compile an entire match pattern expression. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.patterns.UnionPattern} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression matchPattern(int opPos) throws TransformerException { locPathDepth++; try { // First, count... int nextOpPos = opPos; int i; for (i = 0; getOp(nextOpPos) == OpCodes.OP_LOCATIONPATHPATTERN; i++) { nextOpPos = getNextOpPos(nextOpPos); } if (i == 1) return compile(opPos); UnionPattern up = new UnionPattern(); StepPattern[] patterns = new StepPattern[i]; for (i = 0; getOp(opPos) == OpCodes.OP_LOCATIONPATHPATTERN; i++) { nextOpPos = getNextOpPos(opPos); patterns[i] = (StepPattern) compile(opPos); opPos = nextOpPos; } up.setPatterns(patterns); return up; } finally { locPathDepth--; } } /** * Compile a location match pattern unit expression. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.patterns.StepPattern} instance. * * @throws TransformerException if a error occurs creating the Expression. */ public Expression locationPathPattern(int opPos) throws TransformerException { opPos = getFirstChildPos(opPos); return stepPattern(opPos, 0, null); } /** * Get a {@link org.w3c.dom.traversal.NodeFilter} bit set that tells what * to show for a given node test. * * @param opPos the op map position for the location step. * * @return {@link org.w3c.dom.traversal.NodeFilter} bit set that tells what * to show for a given node test. */ public int getWhatToShow(int opPos) { int axesType = getOp(opPos); int testType = getOp(opPos + 3); // System.out.println("testType: "+testType); switch (testType) { case OpCodes.NODETYPE_COMMENT : return DTMFilter.SHOW_COMMENT; case OpCodes.NODETYPE_TEXT : // return DTMFilter.SHOW_TEXT | DTMFilter.SHOW_COMMENT; return DTMFilter.SHOW_TEXT | DTMFilter.SHOW_CDATA_SECTION ; case OpCodes.NODETYPE_PI : return DTMFilter.SHOW_PROCESSING_INSTRUCTION; case OpCodes.NODETYPE_NODE : // return DTMFilter.SHOW_ALL; switch (axesType) { case OpCodes.FROM_NAMESPACE: return DTMFilter.SHOW_NAMESPACE; case OpCodes.FROM_ATTRIBUTES : case OpCodes.MATCH_ATTRIBUTE : return DTMFilter.SHOW_ATTRIBUTE; case OpCodes.FROM_SELF: case OpCodes.FROM_ANCESTORS_OR_SELF: case OpCodes.FROM_DESCENDANTS_OR_SELF: return DTMFilter.SHOW_ALL; default: if (getOp(0) == OpCodes.OP_MATCHPATTERN) return ~DTMFilter.SHOW_ATTRIBUTE & ~DTMFilter.SHOW_DOCUMENT & ~DTMFilter.SHOW_DOCUMENT_FRAGMENT; else return ~DTMFilter.SHOW_ATTRIBUTE; } case OpCodes.NODETYPE_ROOT : return DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT; case OpCodes.NODETYPE_FUNCTEST : return NodeTest.SHOW_BYFUNCTION; case OpCodes.NODENAME : switch (axesType) { case OpCodes.FROM_NAMESPACE : return DTMFilter.SHOW_NAMESPACE; case OpCodes.FROM_ATTRIBUTES : case OpCodes.MATCH_ATTRIBUTE : return DTMFilter.SHOW_ATTRIBUTE; // break; case OpCodes.MATCH_ANY_ANCESTOR : case OpCodes.MATCH_IMMEDIATE_ANCESTOR : return DTMFilter.SHOW_ELEMENT; // break; default : return DTMFilter.SHOW_ELEMENT; } default : // System.err.println("We should never reach here."); return DTMFilter.SHOW_ALL; } } private static final boolean DEBUG = false; /** * Compile a step pattern unit expression, used for both location paths * and match patterns. * * @param opPos The current position in the m_opMap array. * @param stepCount The number of steps to expect. * @param ancestorPattern The owning StepPattern, which may be null. * * @return reference to {@link org.apache.xpath.patterns.StepPattern} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected StepPattern stepPattern( int opPos, int stepCount, StepPattern ancestorPattern) throws TransformerException { int startOpPos = opPos; int stepType = getOp(opPos); if (OpCodes.ENDOP == stepType) { return null; } boolean addMagicSelf = true; int endStep = getNextOpPos(opPos); // int nextStepType = getOpMap()[endStep]; StepPattern pattern; // boolean isSimple = ((OpCodes.ENDOP == nextStepType) && (stepCount == 0)); int argLen; switch (stepType) { case OpCodes.OP_FUNCTION : if(DEBUG) System.out.println("MATCH_FUNCTION: "+m_currentPattern); addMagicSelf = false; argLen = getOp(opPos + OpMap.MAPINDEX_LENGTH); pattern = new FunctionPattern(compileFunction(opPos), Axis.PARENT, Axis.CHILD); break; case OpCodes.FROM_ROOT : if(DEBUG) System.out.println("FROM_ROOT, "+m_currentPattern); addMagicSelf = false; argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT, Axis.PARENT, Axis.CHILD); break; case OpCodes.MATCH_ATTRIBUTE : if(DEBUG) System.out.println("MATCH_ATTRIBUTE: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(DTMFilter.SHOW_ATTRIBUTE, getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.PARENT, Axis.ATTRIBUTE); break; case OpCodes.MATCH_ANY_ANCESTOR : if(DEBUG) System.out.println("MATCH_ANY_ANCESTOR: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); int what = getWhatToShow(startOpPos); // bit-o-hackery, but this code is due for the morgue anyway... if(0x00000500 == what) addMagicSelf = false; pattern = new StepPattern(getWhatToShow(startOpPos), getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.ANCESTOR, Axis.CHILD); break; case OpCodes.MATCH_IMMEDIATE_ANCESTOR : if(DEBUG) System.out.println("MATCH_IMMEDIATE_ANCESTOR: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(getWhatToShow(startOpPos), getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.PARENT, Axis.CHILD); break; default : error(XPATHErrorResources.ER_UNKNOWN_MATCH_OPERATION, null); //"unknown match operation!"); return null; } pattern.setPredicates(getCompiledPredicates(opPos + argLen)); if(null == ancestorPattern) { // This is the magic and invisible "." at the head of every // match pattern, and corresponds to the current node in the context // list, from where predicates are counted. // So, in order to calculate "foo[3]", it has to count from the // current node in the context list, so, from that current node, // the full pattern is really "self::node()/child::foo[3]". If you // translate this to a select pattern from the node being tested, // which is really how we're treating match patterns, it works out to // self::foo/parent::node[child::foo[3]]", or close enough. /* if(addMagicSelf && pattern.getPredicateCount() > 0) { StepPattern selfPattern = new StepPattern(DTMFilter.SHOW_ALL, Axis.PARENT, Axis.CHILD); // We need to keep the new nodetest from affecting the score... XNumber score = pattern.getStaticScore(); pattern.setRelativePathPattern(selfPattern); pattern.setStaticScore(score); selfPattern.setStaticScore(score); }*/ } else { // System.out.println("Setting "+ancestorPattern+" as relative to "+pattern); pattern.setRelativePathPattern(ancestorPattern); } StepPattern relativePathPattern = stepPattern(endStep, stepCount + 1, pattern); return (null != relativePathPattern) ? relativePathPattern : pattern; } /** * Compile a zero or more predicates for a given match pattern. * * @param opPos The position of the first predicate the m_opMap array. * * @return reference to array of {@link org.apache.xpath.Expression} instances. * * @throws TransformerException if a error occurs creating the Expression. */ public Expression[] getCompiledPredicates(int opPos) throws TransformerException { int count = countPredicates(opPos); if (count > 0) { Expression[] predicates = new Expression[count]; compilePredicates(opPos, predicates); return predicates; } return null; } /** * Count the number of predicates in the step. * * @param opPos The position of the first predicate the m_opMap array. * * @return The number of predicates for this step. * * @throws TransformerException if a error occurs creating the Expression. */ public int countPredicates(int opPos) throws TransformerException { int count = 0; while (OpCodes.OP_PREDICATE == getOp(opPos)) { count++; opPos = getNextOpPos(opPos); } return count; } /** * Compiles predicates in the step. * * @param opPos The position of the first predicate the m_opMap array. * @param predicates An empty pre-determined array of * {@link org.apache.xpath.Expression}s, that will be filled in. * * @throws TransformerException */ private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } } /** * Compile a built-in XPath function. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.functions.Function} instance. * * @throws TransformerException if a error occurs creating the Expression. */ Expression compileFunction(int opPos) throws TransformerException { int endFunc = opPos + getOp(opPos + 1) - 1; opPos = getFirstChildPos(opPos); int funcID = getOp(opPos); opPos++; if (-1 != funcID) { Function func = m_functionTable.getFunction(funcID); /** * It is a trick for function-available. Since the function table is an * instance field, insert this table at compilation time for later usage */ if (func instanceof FuncExtFunctionAvailable) ((FuncExtFunctionAvailable) func).setFunctionTable(m_functionTable); func.postCompileStep(this); try { int i = 0; for (int p = opPos; p < endFunc; p = getNextOpPos(p), i++) { // System.out.println("argPos: "+ p); // System.out.println("argCode: "+ m_opMap[p]); func.setArg(compile(p), i); } func.checkNumberArgs(i); } catch (WrongNumberArgsException wnae) { java.lang.String name = m_functionTable.getFunctionName(funcID); m_errorHandler.fatalError( new TransformerException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_ONLY_ALLOWS, new Object[]{name, wnae.getMessage()}), m_locator)); //"name + " only allows " + wnae.getMessage() + " arguments", m_locator)); } return func; } else { error(XPATHErrorResources.ER_FUNCTION_TOKEN_NOT_FOUND, null); //"function token not found."); return null; } } // The current id for extension functions. private static long s_nextMethodId = 0; /** * Get the next available method id */ synchronized private long getNextMethodId() { if (s_nextMethodId == Long.MAX_VALUE) s_nextMethodId = 0; return s_nextMethodId++; } /** * Compile an extension function. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.functions.FuncExtFunction} instance. * * @throws TransformerException if a error occurs creating the Expression. */ private Expression compileExtension(int opPos) throws TransformerException { int endExtFunc = opPos + getOp(opPos + 1) - 1; opPos = getFirstChildPos(opPos); java.lang.String ns = (java.lang.String) getTokenQueue().elementAt(getOp(opPos)); opPos++; java.lang.String funcName = (java.lang.String) getTokenQueue().elementAt(getOp(opPos)); opPos++; // We create a method key to uniquely identify this function so that we // can cache the object needed to invoke it. This way, we only pay the // reflection overhead on the first call. Function extension = new FuncExtFunction(ns, funcName, String.valueOf(getNextMethodId())); try { int i = 0; while (opPos < endExtFunc) { int nextOpPos = getNextOpPos(opPos); extension.setArg(this.compile(opPos), i); opPos = nextOpPos; i++; } } catch (WrongNumberArgsException wnae) { ; // should never happen } return extension; } /** * Warn the user of an problem. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void warn(String msg, Object[] args) throws TransformerException { java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args); if (null != m_errorHandler) { m_errorHandler.warning(new TransformerException(fmsg, m_locator)); } else { System.out.println(fmsg +"; file "+m_locator.getSystemId() +"; line "+m_locator.getLineNumber() +"; column "+m_locator.getColumnNumber()); } } /** * Tell the user of an assertion error, and probably throw an * exception. * * @param b If false, a runtime exception will be thrown. * @param msg The assertion message, which should be informative. * * @throws RuntimeException if the b argument is false. */ public void assertion(boolean b, java.lang.String msg) { if (!b) { java.lang.String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ msg }); throw new RuntimeException(fMsg); } } /** * Tell the user of an error, and probably throw an * exception. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void error(String msg, Object[] args) throws TransformerException { java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); if (null != m_errorHandler) { m_errorHandler.fatalError(new TransformerException(fmsg, m_locator)); } else { // System.out.println(te.getMessage() // +"; file "+te.getSystemId() // +"; line "+te.getLineNumber() // +"; column "+te.getColumnNumber()); throw new TransformerException(fmsg, (SAXSourceLocator)m_locator); } } /** * The current prefixResolver for the execution context. */ private PrefixResolver m_currentPrefixResolver = null; /** * Get the current namespace context for the xpath. * * @return The current prefix resolver, *may* be null, though hopefully not. */ public PrefixResolver getNamespaceContext() { return m_currentPrefixResolver; } /** * Set the current namespace context for the xpath. * * @param pr The resolver for prefixes in the XPath expression. */ public void setNamespaceContext(PrefixResolver pr) { m_currentPrefixResolver = pr; } /** The error listener where errors will be sent. If this is null, errors * and warnings will be sent to System.err. May be null. */ ErrorListener m_errorHandler; /** The source locator for the expression being compiled. May be null. */ SourceLocator m_locator; /** * The FunctionTable for all xpath build-in functions */ private FunctionTable m_functionTable; } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/Keywords.java0000644000175000017500000002424210721374031023511 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Keywords.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; import java.util.Hashtable; /** * Table of strings to operation code lookups. * @xsl.usage internal */ public class Keywords { /** Table of keywords to opcode associations. */ private static Hashtable m_keywords = new Hashtable(); /** Table of axes names to opcode associations. */ private static Hashtable m_axisnames = new Hashtable(); /** Table of function name to function ID associations. */ private static Hashtable m_nodetests = new Hashtable(); /** Table of node type strings to opcode associations. */ private static Hashtable m_nodetypes = new Hashtable(); /** ancestor axes string. */ private static final String FROM_ANCESTORS_STRING = "ancestor"; /** ancestor-or-self axes string. */ private static final String FROM_ANCESTORS_OR_SELF_STRING = "ancestor-or-self"; /** attribute axes string. */ private static final String FROM_ATTRIBUTES_STRING = "attribute"; /** child axes string. */ private static final String FROM_CHILDREN_STRING = "child"; /** descendant-or-self axes string. */ private static final String FROM_DESCENDANTS_STRING = "descendant"; /** ancestor axes string. */ private static final String FROM_DESCENDANTS_OR_SELF_STRING = "descendant-or-self"; /** following axes string. */ private static final String FROM_FOLLOWING_STRING = "following"; /** following-sibling axes string. */ private static final String FROM_FOLLOWING_SIBLINGS_STRING = "following-sibling"; /** parent axes string. */ private static final String FROM_PARENT_STRING = "parent"; /** preceding axes string. */ private static final String FROM_PRECEDING_STRING = "preceding"; /** preceding-sibling axes string. */ private static final String FROM_PRECEDING_SIBLINGS_STRING = "preceding-sibling"; /** self axes string. */ private static final String FROM_SELF_STRING = "self"; /** namespace axes string. */ private static final String FROM_NAMESPACE_STRING = "namespace"; /** self axes abreviated string. */ private static final String FROM_SELF_ABBREVIATED_STRING = "."; /** comment node test string. */ private static final String NODETYPE_COMMENT_STRING = "comment"; /** text node test string. */ private static final String NODETYPE_TEXT_STRING = "text"; /** processing-instruction node test string. */ private static final String NODETYPE_PI_STRING = "processing-instruction"; /** Any node test string. */ private static final String NODETYPE_NODE_STRING = "node"; /** Wildcard element string. */ private static final String NODETYPE_ANYELEMENT_STRING = "*"; /** current function string. */ public static final String FUNC_CURRENT_STRING = "current"; /** last function string. */ public static final String FUNC_LAST_STRING = "last"; /** position function string. */ public static final String FUNC_POSITION_STRING = "position"; /** count function string. */ public static final String FUNC_COUNT_STRING = "count"; /** id function string. */ static final String FUNC_ID_STRING = "id"; /** key function string (XSLT). */ public static final String FUNC_KEY_STRING = "key"; /** local-name function string. */ public static final String FUNC_LOCAL_PART_STRING = "local-name"; /** namespace-uri function string. */ public static final String FUNC_NAMESPACE_STRING = "namespace-uri"; /** name function string. */ public static final String FUNC_NAME_STRING = "name"; /** generate-id function string (XSLT). */ public static final String FUNC_GENERATE_ID_STRING = "generate-id"; /** not function string. */ public static final String FUNC_NOT_STRING = "not"; /** true function string. */ public static final String FUNC_TRUE_STRING = "true"; /** false function string. */ public static final String FUNC_FALSE_STRING = "false"; /** boolean function string. */ public static final String FUNC_BOOLEAN_STRING = "boolean"; /** lang function string. */ public static final String FUNC_LANG_STRING = "lang"; /** number function string. */ public static final String FUNC_NUMBER_STRING = "number"; /** floor function string. */ public static final String FUNC_FLOOR_STRING = "floor"; /** ceiling function string. */ public static final String FUNC_CEILING_STRING = "ceiling"; /** round function string. */ public static final String FUNC_ROUND_STRING = "round"; /** sum function string. */ public static final String FUNC_SUM_STRING = "sum"; /** string function string. */ public static final String FUNC_STRING_STRING = "string"; /** starts-with function string. */ public static final String FUNC_STARTS_WITH_STRING = "starts-with"; /** contains function string. */ public static final String FUNC_CONTAINS_STRING = "contains"; /** substring-before function string. */ public static final String FUNC_SUBSTRING_BEFORE_STRING = "substring-before"; /** substring-after function string. */ public static final String FUNC_SUBSTRING_AFTER_STRING = "substring-after"; /** normalize-space function string. */ public static final String FUNC_NORMALIZE_SPACE_STRING = "normalize-space"; /** translate function string. */ public static final String FUNC_TRANSLATE_STRING = "translate"; /** concat function string. */ public static final String FUNC_CONCAT_STRING = "concat"; /** system-property function string. */ public static final String FUNC_SYSTEM_PROPERTY_STRING = "system-property"; /** function-available function string (XSLT). */ public static final String FUNC_EXT_FUNCTION_AVAILABLE_STRING = "function-available"; /** element-available function string (XSLT). */ public static final String FUNC_EXT_ELEM_AVAILABLE_STRING = "element-available"; /** substring function string. */ public static final String FUNC_SUBSTRING_STRING = "substring"; /** string-length function string. */ public static final String FUNC_STRING_LENGTH_STRING = "string-length"; /** unparsed-entity-uri function string (XSLT). */ public static final String FUNC_UNPARSED_ENTITY_URI_STRING = "unparsed-entity-uri"; // Proprietary, built in functions /** current function string (Proprietary). */ public static final String FUNC_DOCLOCATION_STRING = "document-location"; static { m_axisnames.put(FROM_ANCESTORS_STRING, new Integer(OpCodes.FROM_ANCESTORS)); m_axisnames.put(FROM_ANCESTORS_OR_SELF_STRING, new Integer(OpCodes.FROM_ANCESTORS_OR_SELF)); m_axisnames.put(FROM_ATTRIBUTES_STRING, new Integer(OpCodes.FROM_ATTRIBUTES)); m_axisnames.put(FROM_CHILDREN_STRING, new Integer(OpCodes.FROM_CHILDREN)); m_axisnames.put(FROM_DESCENDANTS_STRING, new Integer(OpCodes.FROM_DESCENDANTS)); m_axisnames.put(FROM_DESCENDANTS_OR_SELF_STRING, new Integer(OpCodes.FROM_DESCENDANTS_OR_SELF)); m_axisnames.put(FROM_FOLLOWING_STRING, new Integer(OpCodes.FROM_FOLLOWING)); m_axisnames.put(FROM_FOLLOWING_SIBLINGS_STRING, new Integer(OpCodes.FROM_FOLLOWING_SIBLINGS)); m_axisnames.put(FROM_PARENT_STRING, new Integer(OpCodes.FROM_PARENT)); m_axisnames.put(FROM_PRECEDING_STRING, new Integer(OpCodes.FROM_PRECEDING)); m_axisnames.put(FROM_PRECEDING_SIBLINGS_STRING, new Integer(OpCodes.FROM_PRECEDING_SIBLINGS)); m_axisnames.put(FROM_SELF_STRING, new Integer(OpCodes.FROM_SELF)); m_axisnames.put(FROM_NAMESPACE_STRING, new Integer(OpCodes.FROM_NAMESPACE)); m_nodetypes.put(NODETYPE_COMMENT_STRING, new Integer(OpCodes.NODETYPE_COMMENT)); m_nodetypes.put(NODETYPE_TEXT_STRING, new Integer(OpCodes.NODETYPE_TEXT)); m_nodetypes.put(NODETYPE_PI_STRING, new Integer(OpCodes.NODETYPE_PI)); m_nodetypes.put(NODETYPE_NODE_STRING, new Integer(OpCodes.NODETYPE_NODE)); m_nodetypes.put(NODETYPE_ANYELEMENT_STRING, new Integer(OpCodes.NODETYPE_ANYELEMENT)); m_keywords.put(FROM_SELF_ABBREVIATED_STRING, new Integer(OpCodes.FROM_SELF)); m_keywords.put(FUNC_ID_STRING, new Integer(FunctionTable.FUNC_ID)); m_keywords.put(FUNC_KEY_STRING, new Integer(FunctionTable.FUNC_KEY)); m_nodetests.put(NODETYPE_COMMENT_STRING, new Integer(OpCodes.NODETYPE_COMMENT)); m_nodetests.put(NODETYPE_TEXT_STRING, new Integer(OpCodes.NODETYPE_TEXT)); m_nodetests.put(NODETYPE_PI_STRING, new Integer(OpCodes.NODETYPE_PI)); m_nodetests.put(NODETYPE_NODE_STRING, new Integer(OpCodes.NODETYPE_NODE)); } static Object getAxisName(String key){ return m_axisnames.get(key); } static Object lookupNodeTest(String key){ return m_nodetests.get(key); } static Object getKeyWord(String key){ return m_keywords.get(key); } static Object getNodeType(String key){ return m_nodetypes.get(key); } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/XPathParser.java0000644000175000017500000020051010721374030024074 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathParser.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.XPathProcessorException; import org.apache.xpath.domapi.XPathStylesheetDOM3Exception; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XString; import org.apache.xpath.res.XPATHErrorResources; /** * Tokenizes and parses XPath expressions. This should really be named * XPathParserImpl, and may be renamed in the future. * @xsl.usage general */ public class XPathParser { // %REVIEW% Is there a better way of doing this? // Upside is minimum object churn. Downside is that we don't have a useful // backtrace in the exception itself -- but we don't expect to need one. static public final String CONTINUE_AFTER_FATAL_ERROR="CONTINUE_AFTER_FATAL_ERROR"; /** * The XPath to be processed. */ private OpMap m_ops; /** * The next token in the pattern. */ transient String m_token; /** * The first char in m_token, the theory being that this * is an optimization because we won't have to do charAt(0) as * often. */ transient char m_tokenChar = 0; /** * The position in the token queue is tracked by m_queueMark. */ int m_queueMark = 0; /** * Results from checking FilterExpr syntax */ protected final static int FILTER_MATCH_FAILED = 0; protected final static int FILTER_MATCH_PRIMARY = 1; protected final static int FILTER_MATCH_PREDICATES = 2; /** * The parser constructor. */ public XPathParser(ErrorListener errorListener, javax.xml.transform.SourceLocator sourceLocator) { m_errorListener = errorListener; m_sourceLocator = sourceLocator; } /** * The prefix resolver to map prefixes to namespaces in the OpMap. */ PrefixResolver m_namespaceContext; /** * Given an string, init an XPath object for selections, * in order that a parse doesn't * have to be done each time the expression is evaluated. * * @param compiler The compiler object. * @param expression A string conforming to the XPath grammar. * @param namespaceContext An object that is able to resolve prefixes in * the XPath to namespaces. * * @throws javax.xml.transform.TransformerException */ public void initXPath( Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { m_ops = compiler; m_namespaceContext = namespaceContext; m_functionTable = compiler.getFunctionTable(); Lexer lexer = new Lexer(compiler, namespaceContext, this); lexer.tokenize(expression); m_ops.setOp(0,OpCodes.OP_XPATH); m_ops.setOp(OpMap.MAPINDEX_LENGTH,2); // Patch for Christine's gripe. She wants her errorHandler to return from // a fatal error and continue trying to parse, rather than throwing an exception. // Without the patch, that put us into an endless loop. // // %REVIEW% Is there a better way of doing this? // %REVIEW% Are there any other cases which need the safety net? // (and if so do we care right now, or should we rewrite the XPath // grammar engine and can fix it at that time?) try { nextToken(); Expr(); if (null != m_token) { String extraTokens = ""; while (null != m_token) { extraTokens += "'" + m_token + "'"; nextToken(); if (null != m_token) extraTokens += ", "; } error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens); } } catch (org.apache.xpath.XPathProcessorException e) { if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage())) { // What I _want_ to do is null out this XPath. // I doubt this has the desired effect, but I'm not sure what else to do. // %REVIEW%!!! initXPath(compiler, "/..", namespaceContext); } else throw e; } compiler.shrink(); } /** * Given an string, init an XPath object for pattern matches, * in order that a parse doesn't * have to be done each time the expression is evaluated. * @param compiler The XPath object to be initialized. * @param expression A String representing the XPath. * @param namespaceContext An object that is able to resolve prefixes in * the XPath to namespaces. * * @throws javax.xml.transform.TransformerException */ public void initMatchPattern( Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { m_ops = compiler; m_namespaceContext = namespaceContext; m_functionTable = compiler.getFunctionTable(); Lexer lexer = new Lexer(compiler, namespaceContext, this); lexer.tokenize(expression); m_ops.setOp(0, OpCodes.OP_MATCHPATTERN); m_ops.setOp(OpMap.MAPINDEX_LENGTH, 2); nextToken(); Pattern(); if (null != m_token) { String extraTokens = ""; while (null != m_token) { extraTokens += "'" + m_token + "'"; nextToken(); if (null != m_token) extraTokens += ", "; } error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens); } // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH)+1); m_ops.shrink(); } /** The error listener where syntax errors are to be sent. */ private ErrorListener m_errorListener; /** The source location of the XPath. */ javax.xml.transform.SourceLocator m_sourceLocator; /** The table contains build-in functions and customized functions */ private FunctionTable m_functionTable; /** * Allow an application to register an error event handler, where syntax * errors will be sent. If the error listener is not set, syntax errors * will be sent to System.err. * * @param handler Reference to error listener where syntax errors will be * sent. */ public void setErrorHandler(ErrorListener handler) { m_errorListener = handler; } /** * Return the current error listener. * * @return The error listener, which should not normally be null, but may be. */ public ErrorListener getErrorListener() { return m_errorListener; } /** * Check whether m_token matches the target string. * * @param s A string reference or null. * * @return If m_token is null, returns false (or true if s is also null), or * return true if the current token matches the string, else false. */ final boolean tokenIs(String s) { return (m_token != null) ? (m_token.equals(s)) : (s == null); } /** * Check whether m_tokenChar==c. * * @param c A character to be tested. * * @return If m_token is null, returns false, or return true if c matches * the current token. */ final boolean tokenIs(char c) { return (m_token != null) ? (m_tokenChar == c) : false; } /** * Look ahead of the current token in order to * make a branching decision. * * @param c the character to be tested for. * @param n number of tokens to look ahead. Must be * greater than 1. * * @return true if the next token matches the character argument. */ final boolean lookahead(char c, int n) { int pos = (m_queueMark + n); boolean b; if ((pos <= m_ops.getTokenQueueSize()) && (pos > 0) && (m_ops.getTokenQueueSize() != 0)) { String tok = ((String) m_ops.m_tokenQueue.elementAt(pos - 1)); b = (tok.length() == 1) ? (tok.charAt(0) == c) : false; } else { b = false; } return b; } /** * Look behind the first character of the current token in order to * make a branching decision. * * @param c the character to compare it to. * @param n number of tokens to look behind. Must be * greater than 1. Note that the look behind terminates * at either the beginning of the string or on a '|' * character. Because of this, this method should only * be used for pattern matching. * * @return true if the token behind the current token matches the character * argument. */ private final boolean lookbehind(char c, int n) { boolean isToken; int lookBehindPos = m_queueMark - (n + 1); if (lookBehindPos >= 0) { String lookbehind = (String) m_ops.m_tokenQueue.elementAt(lookBehindPos); if (lookbehind.length() == 1) { char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0); isToken = (c0 == '|') ? false : (c0 == c); } else { isToken = false; } } else { isToken = false; } return isToken; } /** * look behind the current token in order to * see if there is a useable token. * * @param n number of tokens to look behind. Must be * greater than 1. Note that the look behind terminates * at either the beginning of the string or on a '|' * character. Because of this, this method should only * be used for pattern matching. * * @return true if look behind has a token, false otherwise. */ private final boolean lookbehindHasToken(int n) { boolean hasToken; if ((m_queueMark - n) > 0) { String lookbehind = (String) m_ops.m_tokenQueue.elementAt(m_queueMark - (n - 1)); char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0); hasToken = (c0 == '|') ? false : true; } else { hasToken = false; } return hasToken; } /** * Look ahead of the current token in order to * make a branching decision. * * @param s the string to compare it to. * @param n number of tokens to lookahead. Must be * greater than 1. * * @return true if the token behind the current token matches the string * argument. */ private final boolean lookahead(String s, int n) { boolean isToken; if ((m_queueMark + n) <= m_ops.getTokenQueueSize()) { String lookahead = (String) m_ops.m_tokenQueue.elementAt(m_queueMark + (n - 1)); isToken = (lookahead != null) ? lookahead.equals(s) : (s == null); } else { isToken = (null == s); } return isToken; } /** * Retrieve the next token from the command and * store it in m_token string. */ private final void nextToken() { if (m_queueMark < m_ops.getTokenQueueSize()) { m_token = (String) m_ops.m_tokenQueue.elementAt(m_queueMark++); m_tokenChar = m_token.charAt(0); } else { m_token = null; m_tokenChar = 0; } } /** * Retrieve a token relative to the current token. * * @param i Position relative to current token. * * @return The string at the given index, or null if the index is out * of range. */ private final String getTokenRelative(int i) { String tok; int relative = m_queueMark + i; if ((relative > 0) && (relative < m_ops.getTokenQueueSize())) { tok = (String) m_ops.m_tokenQueue.elementAt(relative); } else { tok = null; } return tok; } /** * Retrieve the previous token from the command and * store it in m_token string. */ private final void prevToken() { if (m_queueMark > 0) { m_queueMark--; m_token = (String) m_ops.m_tokenQueue.elementAt(m_queueMark); m_tokenChar = m_token.charAt(0); } else { m_token = null; m_tokenChar = 0; } } /** * Consume an expected token, throwing an exception if it * isn't there. * * @param expected The string to be expected. * * @throws javax.xml.transform.TransformerException */ private final void consumeExpected(String expected) throws javax.xml.transform.TransformerException { if (tokenIs(expected)) { nextToken(); } else { error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected, m_token }); //"Expected "+expected+", but found: "+m_token); // Patch for Christina's gripe. She wants her errorHandler to return from // this error and continue trying to parse, rather than throwing an exception. // Without the patch, that put us into an endless loop. throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR); } } /** * Consume an expected token, throwing an exception if it * isn't there. * * @param expected the character to be expected. * * @throws javax.xml.transform.TransformerException */ private final void consumeExpected(char expected) throws javax.xml.transform.TransformerException { if (tokenIs(expected)) { nextToken(); } else { error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ String.valueOf(expected), m_token }); //"Expected "+expected+", but found: "+m_token); // Patch for Christina's gripe. She wants her errorHandler to return from // this error and continue trying to parse, rather than throwing an exception. // Without the patch, that put us into an endless loop. throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR); } } /** * Warn the user of a problem. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ void warn(String msg, Object[] args) throws TransformerException { String fmsg = XSLMessages.createXPATHWarning(msg, args); ErrorListener ehandler = this.getErrorListener(); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.warning(new TransformerException(fmsg, m_sourceLocator)); } else { // Should never happen. System.err.println(fmsg); } } /** * Notify the user of an assertion error, and probably throw an * exception. * * @param b If false, a runtime exception will be thrown. * @param msg The assertion message, which should be informative. * * @throws RuntimeException if the b argument is false. */ private void assertion(boolean b, String msg) { if (!b) { String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ msg }); throw new RuntimeException(fMsg); } } /** * Notify the user of an error, and probably throw an * exception. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ void error(String msg, Object[] args) throws TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); ErrorListener ehandler = this.getErrorListener(); TransformerException te = new TransformerException(fmsg, m_sourceLocator); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.fatalError(te); } else { // System.err.println(fmsg); throw te; } } /** * This method is added to support DOM 3 XPath API. *

    * This method is exactly like error(String, Object[]); except that * the underlying TransformerException is * XpathStylesheetDOM3Exception (which extends TransformerException). *

    * So older XPath code in Xalan is not affected by this. To older XPath code * the behavior of whether error() or errorForDOM3() is called because it is * always catching TransformerException objects and is oblivious to * the new subclass of XPathStylesheetDOM3Exception. Older XPath code * runs as before. *

    * However, newer DOM3 XPath code upon catching a TransformerException can * can check if the exception is an instance of XPathStylesheetDOM3Exception * and take appropriate action. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ void errorForDOM3(String msg, Object[] args) throws TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); ErrorListener ehandler = this.getErrorListener(); TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.fatalError(te); } else { // System.err.println(fmsg); throw te; } } /** * Dump the remaining token queue. * Thanks to Craig for this. * * @return A dump of the remaining token queue, which may be appended to * an error message. */ protected String dumpRemainingTokenQueue() { int q = m_queueMark; String returnMsg; if (q < m_ops.getTokenQueueSize()) { String msg = "\n Remaining tokens: ("; while (q < m_ops.getTokenQueueSize()) { String t = (String) m_ops.m_tokenQueue.elementAt(q++); msg += (" '" + t + "'"); } returnMsg = msg + ")"; } else { returnMsg = ""; } return returnMsg; } /** * Given a string, return the corresponding function token. * * @param key A local name of a function. * * @return The function ID, which may correspond to one of the FUNC_XXX * values found in {@link org.apache.xpath.compiler.FunctionTable}, but may * be a value installed by an external module. */ final int getFunctionToken(String key) { int tok; Object id; try { // These are nodetests, xpathparser treats them as functions when parsing // a FilterExpr. id = Keywords.lookupNodeTest(key); if (null == id) id = m_functionTable.getFunctionID(key); tok = ((Integer) id).intValue(); } catch (NullPointerException npe) { tok = -1; } catch (ClassCastException cce) { tok = -1; } return tok; } /** * Insert room for operation. This will NOT set * the length value of the operation, but will update * the length value for the total expression. * * @param pos The position where the op is to be inserted. * @param length The length of the operation space in the op map. * @param op The op code to the inserted. */ void insertOp(int pos, int length, int op) { int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH); for (int i = totalLen - 1; i >= pos; i--) { m_ops.setOp(i + length, m_ops.getOp(i)); } m_ops.setOp(pos,op); m_ops.setOp(OpMap.MAPINDEX_LENGTH,totalLen + length); } /** * Insert room for operation. This WILL set * the length value of the operation, and will update * the length value for the total expression. * * @param length The length of the operation. * @param op The op code to the inserted. */ void appendOp(int length, int op) { int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH); m_ops.setOp(totalLen, op); m_ops.setOp(totalLen + OpMap.MAPINDEX_LENGTH, length); m_ops.setOp(OpMap.MAPINDEX_LENGTH, totalLen + length); } // ============= EXPRESSIONS FUNCTIONS ================= /** * * * Expr ::= OrExpr * * * @throws javax.xml.transform.TransformerException */ protected void Expr() throws javax.xml.transform.TransformerException { OrExpr(); } /** * * * OrExpr ::= AndExpr * | OrExpr 'or' AndExpr * * * @throws javax.xml.transform.TransformerException */ protected void OrExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); AndExpr(); if ((null != m_token) && tokenIs("or")) { nextToken(); insertOp(opPos, 2, OpCodes.OP_OR); OrExpr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } } /** * * * AndExpr ::= EqualityExpr * | AndExpr 'and' EqualityExpr * * * @throws javax.xml.transform.TransformerException */ protected void AndExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); EqualityExpr(-1); if ((null != m_token) && tokenIs("and")) { nextToken(); insertOp(opPos, 2, OpCodes.OP_AND); AndExpr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } } /** * * @returns an Object which is either a String, a Number, a Boolean, or a vector * of nodes. * * EqualityExpr ::= RelationalExpr * | EqualityExpr '=' RelationalExpr * * * @param addPos Position where expression is to be added, or -1 for append. * * @return the position at the end of the equality expression. * * @throws javax.xml.transform.TransformerException */ protected int EqualityExpr(int addPos) throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); if (-1 == addPos) addPos = opPos; RelationalExpr(-1); if (null != m_token) { if (tokenIs('!') && lookahead('=', 1)) { nextToken(); nextToken(); insertOp(addPos, 2, OpCodes.OP_NOTEQUALS); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = EqualityExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } else if (tokenIs('=')) { nextToken(); insertOp(addPos, 2, OpCodes.OP_EQUALS); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = EqualityExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } } return addPos; } /** * . * @returns an Object which is either a String, a Number, a Boolean, or a vector * of nodes. * * RelationalExpr ::= AdditiveExpr * | RelationalExpr '<' AdditiveExpr * | RelationalExpr '>' AdditiveExpr * | RelationalExpr '<=' AdditiveExpr * | RelationalExpr '>=' AdditiveExpr * * * @param addPos Position where expression is to be added, or -1 for append. * * @return the position at the end of the relational expression. * * @throws javax.xml.transform.TransformerException */ protected int RelationalExpr(int addPos) throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); if (-1 == addPos) addPos = opPos; AdditiveExpr(-1); if (null != m_token) { if (tokenIs('<')) { nextToken(); if (tokenIs('=')) { nextToken(); insertOp(addPos, 2, OpCodes.OP_LTE); } else { insertOp(addPos, 2, OpCodes.OP_LT); } int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = RelationalExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } else if (tokenIs('>')) { nextToken(); if (tokenIs('=')) { nextToken(); insertOp(addPos, 2, OpCodes.OP_GTE); } else { insertOp(addPos, 2, OpCodes.OP_GT); } int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = RelationalExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } } return addPos; } /** * This has to handle construction of the operations so that they are evaluated * in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be * evaluated as |-|+|9|7|6|. * * AdditiveExpr ::= MultiplicativeExpr * | AdditiveExpr '+' MultiplicativeExpr * | AdditiveExpr '-' MultiplicativeExpr * * * @param addPos Position where expression is to be added, or -1 for append. * * @return the position at the end of the equality expression. * * @throws javax.xml.transform.TransformerException */ protected int AdditiveExpr(int addPos) throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); if (-1 == addPos) addPos = opPos; MultiplicativeExpr(-1); if (null != m_token) { if (tokenIs('+')) { nextToken(); insertOp(addPos, 2, OpCodes.OP_PLUS); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = AdditiveExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } else if (tokenIs('-')) { nextToken(); insertOp(addPos, 2, OpCodes.OP_MINUS); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = AdditiveExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } } return addPos; } /** * This has to handle construction of the operations so that they are evaluated * in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be * evaluated as |-|+|9|7|6|. * * MultiplicativeExpr ::= UnaryExpr * | MultiplicativeExpr MultiplyOperator UnaryExpr * | MultiplicativeExpr 'div' UnaryExpr * | MultiplicativeExpr 'mod' UnaryExpr * | MultiplicativeExpr 'quo' UnaryExpr * * @param addPos Position where expression is to be added, or -1 for append. * * @return the position at the end of the equality expression. * * @throws javax.xml.transform.TransformerException */ protected int MultiplicativeExpr(int addPos) throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); if (-1 == addPos) addPos = opPos; UnaryExpr(); if (null != m_token) { if (tokenIs('*')) { nextToken(); insertOp(addPos, 2, OpCodes.OP_MULT); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = MultiplicativeExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } else if (tokenIs("div")) { nextToken(); insertOp(addPos, 2, OpCodes.OP_DIV); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = MultiplicativeExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } else if (tokenIs("mod")) { nextToken(); insertOp(addPos, 2, OpCodes.OP_MOD); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = MultiplicativeExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } else if (tokenIs("quo")) { nextToken(); insertOp(addPos, 2, OpCodes.OP_QUO); int opPlusLeftHandLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos; addPos = MultiplicativeExpr(addPos); m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen); addPos += 2; } } return addPos; } /** * * UnaryExpr ::= UnionExpr * | '-' UnaryExpr * * * @throws javax.xml.transform.TransformerException */ protected void UnaryExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); boolean isNeg = false; if (m_tokenChar == '-') { nextToken(); appendOp(2, OpCodes.OP_NEG); isNeg = true; } UnionExpr(); if (isNeg) m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * * StringExpr ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void StringExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_STRING); Expr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * * * StringExpr ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void BooleanExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_BOOL); Expr(); int opLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos; if (opLen == 2) { error(XPATHErrorResources.ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, null); //"boolean(...) argument is no longer optional with 19990709 XPath draft."); } m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, opLen); } /** * * * NumberExpr ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void NumberExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_NUMBER); Expr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * The context of the right hand side expressions is the context of the * left hand side expression. The results of the right hand side expressions * are node sets. The result of the left hand side UnionExpr is the union * of the results of the right hand side expressions. * * * UnionExpr ::= PathExpr * | UnionExpr '|' PathExpr * * * @throws javax.xml.transform.TransformerException */ protected void UnionExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); boolean continueOrLoop = true; boolean foundUnion = false; do { PathExpr(); if (tokenIs('|')) { if (false == foundUnion) { foundUnion = true; insertOp(opPos, 2, OpCodes.OP_UNION); } nextToken(); } else { break; } // this.m_testForDocOrder = true; } while (continueOrLoop); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * PathExpr ::= LocationPath * | FilterExpr * | FilterExpr '/' RelativeLocationPath * | FilterExpr '//' RelativeLocationPath * * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException */ protected void PathExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); int filterExprMatch = FilterExpr(); if (filterExprMatch != FILTER_MATCH_FAILED) { // If FilterExpr had Predicates, a OP_LOCATIONPATH opcode would already // have been inserted. boolean locationPathStarted = (filterExprMatch==FILTER_MATCH_PREDICATES); if (tokenIs('/')) { nextToken(); if (!locationPathStarted) { // int locationPathOpPos = opPos; insertOp(opPos, 2, OpCodes.OP_LOCATIONPATH); locationPathStarted = true; } if (!RelativeLocationPath()) { // "Relative location path expected following '/' or '//'" error(XPATHErrorResources.ER_EXPECTED_REL_LOC_PATH, null); } } // Terminate for safety. if (locationPathStarted) { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } } else { LocationPath(); } } /** * * * FilterExpr ::= PrimaryExpr * | FilterExpr Predicate * * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @return FILTER_MATCH_PREDICATES, if this method successfully matched a * FilterExpr with one or more Predicates; * FILTER_MATCH_PRIMARY, if this method successfully matched a * FilterExpr that was just a PrimaryExpr; or * FILTER_MATCH_FAILED, if this method did not match a FilterExpr * * @throws javax.xml.transform.TransformerException */ protected int FilterExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); int filterMatch; if (PrimaryExpr()) { if (tokenIs('[')) { // int locationPathOpPos = opPos; insertOp(opPos, 2, OpCodes.OP_LOCATIONPATH); while (tokenIs('[')) { Predicate(); } filterMatch = FILTER_MATCH_PREDICATES; } else { filterMatch = FILTER_MATCH_PRIMARY; } } else { filterMatch = FILTER_MATCH_FAILED; } return filterMatch; /* * if(tokenIs('[')) * { * Predicate(); * m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos; * } */ } /** * * PrimaryExpr ::= VariableReference * | '(' Expr ')' * | Literal * | Number * | FunctionCall * * @return true if this method successfully matched a PrimaryExpr * * @throws javax.xml.transform.TransformerException * */ protected boolean PrimaryExpr() throws javax.xml.transform.TransformerException { boolean matchFound; int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); if ((m_tokenChar == '\'') || (m_tokenChar == '"')) { appendOp(2, OpCodes.OP_LITERAL); Literal(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); matchFound = true; } else if (m_tokenChar == '$') { nextToken(); // consume '$' appendOp(2, OpCodes.OP_VARIABLE); QName(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); matchFound = true; } else if (m_tokenChar == '(') { nextToken(); appendOp(2, OpCodes.OP_GROUP); Expr(); consumeExpected(')'); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); matchFound = true; } else if ((null != m_token) && ((('.' == m_tokenChar) && (m_token.length() > 1) && Character.isDigit( m_token.charAt(1))) || Character.isDigit(m_tokenChar))) { appendOp(2, OpCodes.OP_NUMBERLIT); Number(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); matchFound = true; } else if (lookahead('(', 1) || (lookahead(':', 1) && lookahead('(', 3))) { matchFound = FunctionCall(); } else { matchFound = false; } return matchFound; } /** * * Argument ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void Argument() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_ARGUMENT); Expr(); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * * FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' * * @return true if, and only if, a FunctionCall was matched * * @throws javax.xml.transform.TransformerException */ protected boolean FunctionCall() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); if (lookahead(':', 1)) { appendOp(4, OpCodes.OP_EXTFUNCTION); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH + 1, m_queueMark - 1); nextToken(); consumeExpected(':'); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH + 2, m_queueMark - 1); nextToken(); } else { int funcTok = getFunctionToken(m_token); if (-1 == funcTok) { error(XPATHErrorResources.ER_COULDNOT_FIND_FUNCTION, new Object[]{ m_token }); //"Could not find function: "+m_token+"()"); } switch (funcTok) { case OpCodes.NODETYPE_PI : case OpCodes.NODETYPE_COMMENT : case OpCodes.NODETYPE_TEXT : case OpCodes.NODETYPE_NODE : // Node type tests look like function calls, but they're not return false; default : appendOp(3, OpCodes.OP_FUNCTION); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH + 1, funcTok); } nextToken(); } consumeExpected('('); while (!tokenIs(')') && m_token != null) { if (tokenIs(',')) { error(XPATHErrorResources.ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, null); //"Found ',' but no preceding argument!"); } Argument(); if (!tokenIs(')')) { consumeExpected(','); if (tokenIs(')')) { error(XPATHErrorResources.ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, null); //"Found ',' but no following argument!"); } } } consumeExpected(')'); // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH,m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); return true; } // ============= GRAMMAR FUNCTIONS ================= /** * * LocationPath ::= RelativeLocationPath * | AbsoluteLocationPath * * * @throws javax.xml.transform.TransformerException */ protected void LocationPath() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); // int locationPathOpPos = opPos; appendOp(2, OpCodes.OP_LOCATIONPATH); boolean seenSlash = tokenIs('/'); if (seenSlash) { appendOp(4, OpCodes.FROM_ROOT); // Tell how long the step is without the predicate m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 2, 4); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 1, OpCodes.NODETYPE_ROOT); nextToken(); } else if (m_token == null) { error(XPATHErrorResources.ER_EXPECTED_LOC_PATH_AT_END_EXPR, null); } if (m_token != null) { if (!RelativeLocationPath() && !seenSlash) { // Neither a '/' nor a RelativeLocationPath - i.e., matched nothing // "Location path expected, but found "+m_token+" was encountered." error(XPATHErrorResources.ER_EXPECTED_LOC_PATH, new Object [] {m_token}); } } // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH,m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * * RelativeLocationPath ::= Step * | RelativeLocationPath '/' Step * | AbbreviatedRelativeLocationPath * * @returns true if, and only if, a RelativeLocationPath was matched * * @throws javax.xml.transform.TransformerException */ protected boolean RelativeLocationPath() throws javax.xml.transform.TransformerException { if (!Step()) { return false; } while (tokenIs('/')) { nextToken(); if (!Step()) { // RelativeLocationPath can't end with a trailing '/' // "Location step expected following '/' or '//'" error(XPATHErrorResources.ER_EXPECTED_LOC_STEP, null); } } return true; } /** * * Step ::= Basis Predicate * | AbbreviatedStep * * @returns false if step was empty (or only a '/'); true, otherwise * * @throws javax.xml.transform.TransformerException */ protected boolean Step() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); boolean doubleSlash = tokenIs('/'); // At most a single '/' before each Step is consumed by caller; if the // first thing is a '/', that means we had '//' and the Step must not // be empty. if (doubleSlash) { nextToken(); appendOp(2, OpCodes.FROM_DESCENDANTS_OR_SELF); // Have to fix up for patterns such as '//@foo' or '//attribute::foo', // which translate to 'descendant-or-self::node()/attribute::foo'. // notice I leave the '/' on the queue, so the next will be processed // by a regular step pattern. // Make room for telling how long the step is without the predicate m_ops.setOp(OpMap.MAPINDEX_LENGTH,m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.NODETYPE_NODE); m_ops.setOp(OpMap.MAPINDEX_LENGTH,m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); // Tell how long the step is without the predicate m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH + 1, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); // Tell how long the step is with the predicate m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); } if (tokenIs(".")) { nextToken(); if (tokenIs('[')) { error(XPATHErrorResources.ER_PREDICATE_ILLEGAL_SYNTAX, null); //"'..[predicate]' or '.[predicate]' is illegal syntax. Use 'self::node()[predicate]' instead."); } appendOp(4, OpCodes.FROM_SELF); // Tell how long the step is without the predicate m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 2,4); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 1, OpCodes.NODETYPE_NODE); } else if (tokenIs("..")) { nextToken(); appendOp(4, OpCodes.FROM_PARENT); // Tell how long the step is without the predicate m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 2,4); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 1, OpCodes.NODETYPE_NODE); } // There is probably a better way to test for this // transition... but it gets real hairy if you try // to do it in basis(). else if (tokenIs('*') || tokenIs('@') || tokenIs('_') || (m_token!= null && Character.isLetter(m_token.charAt(0)))) { Basis(); while (tokenIs('[')) { Predicate(); } // Tell how long the entire step is. m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } else { // No Step matched - that's an error if previous thing was a '//' if (doubleSlash) { // "Location step expected following '/' or '//'" error(XPATHErrorResources.ER_EXPECTED_LOC_STEP, null); } return false; } return true; } /** * * Basis ::= AxisName '::' NodeTest * | AbbreviatedBasis * * @throws javax.xml.transform.TransformerException */ protected void Basis() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); int axesType; // The next blocks guarantee that a FROM_XXX will be added. if (lookahead("::", 1)) { axesType = AxisName(); nextToken(); nextToken(); } else if (tokenIs('@')) { axesType = OpCodes.FROM_ATTRIBUTES; appendOp(2, axesType); nextToken(); } else { axesType = OpCodes.FROM_CHILDREN; appendOp(2, axesType); } // Make room for telling how long the step is without the predicate m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); NodeTest(axesType); // Tell how long the step is without the predicate m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH + 1, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * * Basis ::= AxisName '::' NodeTest * | AbbreviatedBasis * * @return FROM_XXX axes type, found in {@link org.apache.xpath.compiler.Keywords}. * * @throws javax.xml.transform.TransformerException */ protected int AxisName() throws javax.xml.transform.TransformerException { Object val = Keywords.getAxisName(m_token); if (null == val) { error(XPATHErrorResources.ER_ILLEGAL_AXIS_NAME, new Object[]{ m_token }); //"illegal axis name: "+m_token); } int axesType = ((Integer) val).intValue(); appendOp(2, axesType); return axesType; } /** * * NodeTest ::= WildcardName * | NodeType '(' ')' * | 'processing-instruction' '(' Literal ')' * * @param axesType FROM_XXX axes type, found in {@link org.apache.xpath.compiler.Keywords}. * * @throws javax.xml.transform.TransformerException */ protected void NodeTest(int axesType) throws javax.xml.transform.TransformerException { if (lookahead('(', 1)) { Object nodeTestOp = Keywords.getNodeType(m_token); if (null == nodeTestOp) { error(XPATHErrorResources.ER_UNKNOWN_NODETYPE, new Object[]{ m_token }); //"Unknown nodetype: "+m_token); } else { nextToken(); int nt = ((Integer) nodeTestOp).intValue(); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), nt); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); consumeExpected('('); if (OpCodes.NODETYPE_PI == nt) { if (!tokenIs(')')) { Literal(); } } consumeExpected(')'); } } else { // Assume name of attribute or element. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.NODENAME); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); if (lookahead(':', 1)) { if (tokenIs('*')) { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ELEMWILDCARD); } else { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); // Minimalist check for an NCName - just check first character // to distinguish from other possible tokens if (!Character.isLetter(m_tokenChar) && !tokenIs('_')) { // "Node test that matches either NCName:* or QName was expected." error(XPATHErrorResources.ER_EXPECTED_NODE_TEST, null); } } nextToken(); consumeExpected(':'); } else { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.EMPTY); } m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); if (tokenIs('*')) { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ELEMWILDCARD); } else { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); // Minimalist check for an NCName - just check first character // to distinguish from other possible tokens if (!Character.isLetter(m_tokenChar) && !tokenIs('_')) { // "Node test that matches either NCName:* or QName was expected." error(XPATHErrorResources.ER_EXPECTED_NODE_TEST, null); } } m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } } /** * * Predicate ::= '[' PredicateExpr ']' * * * @throws javax.xml.transform.TransformerException */ protected void Predicate() throws javax.xml.transform.TransformerException { if (tokenIs('[')) { nextToken(); PredicateExpr(); consumeExpected(']'); } } /** * * PredicateExpr ::= Expr * * * @throws javax.xml.transform.TransformerException */ protected void PredicateExpr() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); appendOp(2, OpCodes.OP_PREDICATE); Expr(); // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * QName ::= (Prefix ':')? LocalPart * Prefix ::= NCName * LocalPart ::= NCName * * @throws javax.xml.transform.TransformerException */ protected void QName() throws javax.xml.transform.TransformerException { // Namespace if(lookahead(':', 1)) { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); consumeExpected(':'); } else { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.EMPTY); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); } // Local name m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } /** * NCName ::= (Letter | '_') (NCNameChar) * NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender */ protected void NCName() { m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } /** * The value of the Literal is the sequence of characters inside * the " or ' characters>. * * Literal ::= '"' [^"]* '"' * | "'" [^']* "'" * * * @throws javax.xml.transform.TransformerException */ protected void Literal() throws javax.xml.transform.TransformerException { int last = m_token.length() - 1; char c0 = m_tokenChar; char cX = m_token.charAt(last); if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\''))) { // Mutate the token to remove the quotes and have the XString object // already made. int tokenQueuePos = m_queueMark - 1; m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos); Object obj = new XString(m_token.substring(1, last)); m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos); // lit = m_token.substring(1, last); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } else { error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!"); } } /** * * Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+ * * * @throws javax.xml.transform.TransformerException */ protected void Number() throws javax.xml.transform.TransformerException { if (null != m_token) { // Mutate the token to remove the quotes and have the XNumber object // already made. double num; try { // XPath 1.0 does not support number in exp notation if ((m_token.indexOf('e') > -1)||(m_token.indexOf('E') > -1)) throw new NumberFormatException(); num = Double.valueOf(m_token).doubleValue(); } catch (NumberFormatException nfe) { num = 0.0; // to shut up compiler. error(XPATHErrorResources.ER_COULDNOT_BE_FORMATTED_TO_NUMBER, new Object[]{ m_token }); //m_token+" could not be formatted to a number!"); } m_ops.m_tokenQueue.setElementAt(new XNumber(num),m_queueMark - 1); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); nextToken(); } } // ============= PATTERN FUNCTIONS ================= /** * * Pattern ::= LocationPathPattern * | Pattern '|' LocationPathPattern * * * @throws javax.xml.transform.TransformerException */ protected void Pattern() throws javax.xml.transform.TransformerException { while (true) { LocationPathPattern(); if (tokenIs('|')) { nextToken(); } else { break; } } } /** * * * LocationPathPattern ::= '/' RelativePathPattern? * | IdKeyPattern (('/' | '//') RelativePathPattern)? * | '//'? RelativePathPattern * * * @throws javax.xml.transform.TransformerException */ protected void LocationPathPattern() throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); final int RELATIVE_PATH_NOT_PERMITTED = 0; final int RELATIVE_PATH_PERMITTED = 1; final int RELATIVE_PATH_REQUIRED = 2; int relativePathStatus = RELATIVE_PATH_NOT_PERMITTED; appendOp(2, OpCodes.OP_LOCATIONPATHPATTERN); if (lookahead('(', 1) && (tokenIs(Keywords.FUNC_ID_STRING) || tokenIs(Keywords.FUNC_KEY_STRING))) { IdKeyPattern(); if (tokenIs('/')) { nextToken(); if (tokenIs('/')) { appendOp(4, OpCodes.MATCH_ANY_ANCESTOR); nextToken(); } else { appendOp(4, OpCodes.MATCH_IMMEDIATE_ANCESTOR); } // Tell how long the step is without the predicate m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 2, 4); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 1, OpCodes.NODETYPE_FUNCTEST); relativePathStatus = RELATIVE_PATH_REQUIRED; } } else if (tokenIs('/')) { if (lookahead('/', 1)) { appendOp(4, OpCodes.MATCH_ANY_ANCESTOR); // Added this to fix bug reported by Myriam for match="//x/a" // patterns. If you don't do this, the 'x' step will think it's part // of a '//' pattern, and so will cause 'a' to be matched when it has // any ancestor that is 'x'. nextToken(); relativePathStatus = RELATIVE_PATH_REQUIRED; } else { appendOp(4, OpCodes.FROM_ROOT); relativePathStatus = RELATIVE_PATH_PERMITTED; } // Tell how long the step is without the predicate m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 2, 4); m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH) - 1, OpCodes.NODETYPE_ROOT); nextToken(); } else { relativePathStatus = RELATIVE_PATH_REQUIRED; } if (relativePathStatus != RELATIVE_PATH_NOT_PERMITTED) { if (!tokenIs('|') && (null != m_token)) { RelativePathPattern(); } else if (relativePathStatus == RELATIVE_PATH_REQUIRED) { // "A relative path pattern was expected." error(XPATHErrorResources.ER_EXPECTED_REL_PATH_PATTERN, null); } } // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); } /** * * IdKeyPattern ::= 'id' '(' Literal ')' * | 'key' '(' Literal ',' Literal ')' * (Also handle doc()) * * * @throws javax.xml.transform.TransformerException */ protected void IdKeyPattern() throws javax.xml.transform.TransformerException { FunctionCall(); } /** * * RelativePathPattern ::= StepPattern * | RelativePathPattern '/' StepPattern * | RelativePathPattern '//' StepPattern * * @throws javax.xml.transform.TransformerException */ protected void RelativePathPattern() throws javax.xml.transform.TransformerException { // Caller will have consumed any '/' or '//' preceding the // RelativePathPattern, so let StepPattern know it can't begin with a '/' boolean trailingSlashConsumed = StepPattern(false); while (tokenIs('/')) { nextToken(); // StepPattern() may consume first slash of pair in "a//b" while // processing StepPattern "a". On next iteration, let StepPattern know // that happened, so it doesn't match ill-formed patterns like "a///b". trailingSlashConsumed = StepPattern(!trailingSlashConsumed); } } /** * * StepPattern ::= AbbreviatedNodeTestStep * * @param isLeadingSlashPermitted a boolean indicating whether a slash can * appear at the start of this step * * @return boolean indicating whether a slash following the step was consumed * * @throws javax.xml.transform.TransformerException */ protected boolean StepPattern(boolean isLeadingSlashPermitted) throws javax.xml.transform.TransformerException { return AbbreviatedNodeTestStep(isLeadingSlashPermitted); } /** * * AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate * * @param isLeadingSlashPermitted a boolean indicating whether a slash can * appear at the start of this step * * @return boolean indicating whether a slash following the step was consumed * * @throws javax.xml.transform.TransformerException */ protected boolean AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted) throws javax.xml.transform.TransformerException { int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); int axesType; // The next blocks guarantee that a MATCH_XXX will be added. int matchTypePos = -1; if (tokenIs('@')) { axesType = OpCodes.MATCH_ATTRIBUTE; appendOp(2, axesType); nextToken(); } else if (this.lookahead("::", 1)) { if (tokenIs("attribute")) { axesType = OpCodes.MATCH_ATTRIBUTE; appendOp(2, axesType); } else if (tokenIs("child")) { matchTypePos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); axesType = OpCodes.MATCH_IMMEDIATE_ANCESTOR; appendOp(2, axesType); } else { axesType = -1; this.error(XPATHErrorResources.ER_AXES_NOT_ALLOWED, new Object[]{ this.m_token }); } nextToken(); nextToken(); } else if (tokenIs('/')) { if (!isLeadingSlashPermitted) { // "A step was expected in the pattern, but '/' was encountered." error(XPATHErrorResources.ER_EXPECTED_STEP_PATTERN, null); } axesType = OpCodes.MATCH_ANY_ANCESTOR; appendOp(2, axesType); nextToken(); } else { matchTypePos = m_ops.getOp(OpMap.MAPINDEX_LENGTH); axesType = OpCodes.MATCH_IMMEDIATE_ANCESTOR; appendOp(2, axesType); } // Make room for telling how long the step is without the predicate m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1); NodeTest(axesType); // Tell how long the step is without the predicate m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH + 1, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); while (tokenIs('[')) { Predicate(); } boolean trailingSlashConsumed; // For "a//b", where "a" is current step, we need to mark operation of // current step as "MATCH_ANY_ANCESTOR". Then we'll consume the first // slash and subsequent step will be treated as a MATCH_IMMEDIATE_ANCESTOR // (unless it too is followed by '//'.) // // %REVIEW% Following is what happens today, but I'm not sure that's // %REVIEW% correct behaviour. Perhaps no valid case could be constructed // %REVIEW% where it would matter? // // If current step is on the attribute axis (e.g., "@x//b"), we won't // change the current step, and let following step be marked as // MATCH_ANY_ANCESTOR on next call instead. if ((matchTypePos > -1) && tokenIs('/') && lookahead('/', 1)) { m_ops.setOp(matchTypePos, OpCodes.MATCH_ANY_ANCESTOR); nextToken(); trailingSlashConsumed = true; } else { trailingSlashConsumed = false; } // Tell how long the entire step is. m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos); return trailingSlashConsumed; } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/PsuedoNames.java0000644000175000017500000000333110721374031024121 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PsuedoNames.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; /** * This is used to represent names of nodes that may not be named, like a * comment node. */ public class PsuedoNames { /** * Psuedo name for a wild card pattern ('*'). */ public static final String PSEUDONAME_ANY = "*"; /** * Psuedo name for the root node. */ public static final String PSEUDONAME_ROOT = "/"; /** * Psuedo name for a text node. */ public static final String PSEUDONAME_TEXT = "#text"; /** * Psuedo name for a comment node. */ public static final String PSEUDONAME_COMMENT = "#comment"; /** * Psuedo name for a processing instruction node. */ public static final String PSEUDONAME_PI = "#pi"; /** * Psuedo name for an unknown type value. */ public static final String PSEUDONAME_OTHER = "*"; } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/FunctionTable.java0000644000175000017500000003761610721374030024447 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionTable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; import org.apache.xpath.Expression; import org.apache.xpath.functions.Function; import java.util.HashMap; import javax.xml.transform.TransformerException; /** * The function table for XPath. */ public class FunctionTable { /** The 'current()' id. */ public static final int FUNC_CURRENT = 0; /** The 'last()' id. */ public static final int FUNC_LAST = 1; /** The 'position()' id. */ public static final int FUNC_POSITION = 2; /** The 'count()' id. */ public static final int FUNC_COUNT = 3; /** The 'id()' id. */ public static final int FUNC_ID = 4; /** The 'key()' id (XSLT). */ public static final int FUNC_KEY = 5; /** The 'local-name()' id. */ public static final int FUNC_LOCAL_PART = 7; /** The 'namespace-uri()' id. */ public static final int FUNC_NAMESPACE = 8; /** The 'name()' id. */ public static final int FUNC_QNAME = 9; /** The 'generate-id()' id. */ public static final int FUNC_GENERATE_ID = 10; /** The 'not()' id. */ public static final int FUNC_NOT = 11; /** The 'true()' id. */ public static final int FUNC_TRUE = 12; /** The 'false()' id. */ public static final int FUNC_FALSE = 13; /** The 'boolean()' id. */ public static final int FUNC_BOOLEAN = 14; /** The 'number()' id. */ public static final int FUNC_NUMBER = 15; /** The 'floor()' id. */ public static final int FUNC_FLOOR = 16; /** The 'ceiling()' id. */ public static final int FUNC_CEILING = 17; /** The 'round()' id. */ public static final int FUNC_ROUND = 18; /** The 'sum()' id. */ public static final int FUNC_SUM = 19; /** The 'string()' id. */ public static final int FUNC_STRING = 20; /** The 'starts-with()' id. */ public static final int FUNC_STARTS_WITH = 21; /** The 'contains()' id. */ public static final int FUNC_CONTAINS = 22; /** The 'substring-before()' id. */ public static final int FUNC_SUBSTRING_BEFORE = 23; /** The 'substring-after()' id. */ public static final int FUNC_SUBSTRING_AFTER = 24; /** The 'normalize-space()' id. */ public static final int FUNC_NORMALIZE_SPACE = 25; /** The 'translate()' id. */ public static final int FUNC_TRANSLATE = 26; /** The 'concat()' id. */ public static final int FUNC_CONCAT = 27; /** The 'substring()' id. */ public static final int FUNC_SUBSTRING = 29; /** The 'string-length()' id. */ public static final int FUNC_STRING_LENGTH = 30; /** The 'system-property()' id. */ public static final int FUNC_SYSTEM_PROPERTY = 31; /** The 'lang()' id. */ public static final int FUNC_LANG = 32; /** The 'function-available()' id (XSLT). */ public static final int FUNC_EXT_FUNCTION_AVAILABLE = 33; /** The 'element-available()' id (XSLT). */ public static final int FUNC_EXT_ELEM_AVAILABLE = 34; /** The 'unparsed-entity-uri()' id (XSLT). */ public static final int FUNC_UNPARSED_ENTITY_URI = 36; // Proprietary /** The 'document-location()' id (Proprietary). */ public static final int FUNC_DOCLOCATION = 35; /** * The function table. */ private static Class m_functions[]; /** Table of function name to function ID associations. */ private static HashMap m_functionID = new HashMap(); /** * The function table contains customized functions */ private Class m_functions_customer[] = new Class[NUM_ALLOWABLE_ADDINS]; /** * Table of function name to function ID associations for customized functions */ private HashMap m_functionID_customer = new HashMap(); /** * Number of built in functions. Be sure to update this as * built-in functions are added. */ private static final int NUM_BUILT_IN_FUNCS = 37; /** * Number of built-in functions that may be added. */ private static final int NUM_ALLOWABLE_ADDINS = 30; /** * The index to the next free function index. */ private int m_funcNextFreeIndex = NUM_BUILT_IN_FUNCS; static { m_functions = new Class[NUM_BUILT_IN_FUNCS]; m_functions[FUNC_CURRENT] = org.apache.xpath.functions.FuncCurrent.class; m_functions[FUNC_LAST] = org.apache.xpath.functions.FuncLast.class; m_functions[FUNC_POSITION] = org.apache.xpath.functions.FuncPosition.class; m_functions[FUNC_COUNT] = org.apache.xpath.functions.FuncCount.class; m_functions[FUNC_ID] = org.apache.xpath.functions.FuncId.class; m_functions[FUNC_KEY] = org.apache.xalan.templates.FuncKey.class; m_functions[FUNC_LOCAL_PART] = org.apache.xpath.functions.FuncLocalPart.class; m_functions[FUNC_NAMESPACE] = org.apache.xpath.functions.FuncNamespace.class; m_functions[FUNC_QNAME] = org.apache.xpath.functions.FuncQname.class; m_functions[FUNC_GENERATE_ID] = org.apache.xpath.functions.FuncGenerateId.class; m_functions[FUNC_NOT] = org.apache.xpath.functions.FuncNot.class; m_functions[FUNC_TRUE] = org.apache.xpath.functions.FuncTrue.class; m_functions[FUNC_FALSE] = org.apache.xpath.functions.FuncFalse.class; m_functions[FUNC_BOOLEAN] = org.apache.xpath.functions.FuncBoolean.class; m_functions[FUNC_LANG] = org.apache.xpath.functions.FuncLang.class; m_functions[FUNC_NUMBER] = org.apache.xpath.functions.FuncNumber.class; m_functions[FUNC_FLOOR] = org.apache.xpath.functions.FuncFloor.class; m_functions[FUNC_CEILING] = org.apache.xpath.functions.FuncCeiling.class; m_functions[FUNC_ROUND] = org.apache.xpath.functions.FuncRound.class; m_functions[FUNC_SUM] = org.apache.xpath.functions.FuncSum.class; m_functions[FUNC_STRING] = org.apache.xpath.functions.FuncString.class; m_functions[FUNC_STARTS_WITH] = org.apache.xpath.functions.FuncStartsWith.class; m_functions[FUNC_CONTAINS] = org.apache.xpath.functions.FuncContains.class; m_functions[FUNC_SUBSTRING_BEFORE] = org.apache.xpath.functions.FuncSubstringBefore.class; m_functions[FUNC_SUBSTRING_AFTER] = org.apache.xpath.functions.FuncSubstringAfter.class; m_functions[FUNC_NORMALIZE_SPACE] = org.apache.xpath.functions.FuncNormalizeSpace.class; m_functions[FUNC_TRANSLATE] = org.apache.xpath.functions.FuncTranslate.class; m_functions[FUNC_CONCAT] = org.apache.xpath.functions.FuncConcat.class; m_functions[FUNC_SYSTEM_PROPERTY] = org.apache.xpath.functions.FuncSystemProperty.class; m_functions[FUNC_EXT_FUNCTION_AVAILABLE] = org.apache.xpath.functions.FuncExtFunctionAvailable.class; m_functions[FUNC_EXT_ELEM_AVAILABLE] = org.apache.xpath.functions.FuncExtElementAvailable.class; m_functions[FUNC_SUBSTRING] = org.apache.xpath.functions.FuncSubstring.class; m_functions[FUNC_STRING_LENGTH] = org.apache.xpath.functions.FuncStringLength.class; m_functions[FUNC_DOCLOCATION] = org.apache.xpath.functions.FuncDoclocation.class; m_functions[FUNC_UNPARSED_ENTITY_URI] = org.apache.xpath.functions.FuncUnparsedEntityURI.class; } static{ m_functionID.put(Keywords.FUNC_CURRENT_STRING, new Integer(FunctionTable.FUNC_CURRENT)); m_functionID.put(Keywords.FUNC_LAST_STRING, new Integer(FunctionTable.FUNC_LAST)); m_functionID.put(Keywords.FUNC_POSITION_STRING, new Integer(FunctionTable.FUNC_POSITION)); m_functionID.put(Keywords.FUNC_COUNT_STRING, new Integer(FunctionTable.FUNC_COUNT)); m_functionID.put(Keywords.FUNC_ID_STRING, new Integer(FunctionTable.FUNC_ID)); m_functionID.put(Keywords.FUNC_KEY_STRING, new Integer(FunctionTable.FUNC_KEY)); m_functionID.put(Keywords.FUNC_LOCAL_PART_STRING, new Integer(FunctionTable.FUNC_LOCAL_PART)); m_functionID.put(Keywords.FUNC_NAMESPACE_STRING, new Integer(FunctionTable.FUNC_NAMESPACE)); m_functionID.put(Keywords.FUNC_NAME_STRING, new Integer(FunctionTable.FUNC_QNAME)); m_functionID.put(Keywords.FUNC_GENERATE_ID_STRING, new Integer(FunctionTable.FUNC_GENERATE_ID)); m_functionID.put(Keywords.FUNC_NOT_STRING, new Integer(FunctionTable.FUNC_NOT)); m_functionID.put(Keywords.FUNC_TRUE_STRING, new Integer(FunctionTable.FUNC_TRUE)); m_functionID.put(Keywords.FUNC_FALSE_STRING, new Integer(FunctionTable.FUNC_FALSE)); m_functionID.put(Keywords.FUNC_BOOLEAN_STRING, new Integer(FunctionTable.FUNC_BOOLEAN)); m_functionID.put(Keywords.FUNC_LANG_STRING, new Integer(FunctionTable.FUNC_LANG)); m_functionID.put(Keywords.FUNC_NUMBER_STRING, new Integer(FunctionTable.FUNC_NUMBER)); m_functionID.put(Keywords.FUNC_FLOOR_STRING, new Integer(FunctionTable.FUNC_FLOOR)); m_functionID.put(Keywords.FUNC_CEILING_STRING, new Integer(FunctionTable.FUNC_CEILING)); m_functionID.put(Keywords.FUNC_ROUND_STRING, new Integer(FunctionTable.FUNC_ROUND)); m_functionID.put(Keywords.FUNC_SUM_STRING, new Integer(FunctionTable.FUNC_SUM)); m_functionID.put(Keywords.FUNC_STRING_STRING, new Integer(FunctionTable.FUNC_STRING)); m_functionID.put(Keywords.FUNC_STARTS_WITH_STRING, new Integer(FunctionTable.FUNC_STARTS_WITH)); m_functionID.put(Keywords.FUNC_CONTAINS_STRING, new Integer(FunctionTable.FUNC_CONTAINS)); m_functionID.put(Keywords.FUNC_SUBSTRING_BEFORE_STRING, new Integer(FunctionTable.FUNC_SUBSTRING_BEFORE)); m_functionID.put(Keywords.FUNC_SUBSTRING_AFTER_STRING, new Integer(FunctionTable.FUNC_SUBSTRING_AFTER)); m_functionID.put(Keywords.FUNC_NORMALIZE_SPACE_STRING, new Integer(FunctionTable.FUNC_NORMALIZE_SPACE)); m_functionID.put(Keywords.FUNC_TRANSLATE_STRING, new Integer(FunctionTable.FUNC_TRANSLATE)); m_functionID.put(Keywords.FUNC_CONCAT_STRING, new Integer(FunctionTable.FUNC_CONCAT)); m_functionID.put(Keywords.FUNC_SYSTEM_PROPERTY_STRING, new Integer(FunctionTable.FUNC_SYSTEM_PROPERTY)); m_functionID.put(Keywords.FUNC_EXT_FUNCTION_AVAILABLE_STRING, new Integer(FunctionTable.FUNC_EXT_FUNCTION_AVAILABLE)); m_functionID.put(Keywords.FUNC_EXT_ELEM_AVAILABLE_STRING, new Integer(FunctionTable.FUNC_EXT_ELEM_AVAILABLE)); m_functionID.put(Keywords.FUNC_SUBSTRING_STRING, new Integer(FunctionTable.FUNC_SUBSTRING)); m_functionID.put(Keywords.FUNC_STRING_LENGTH_STRING, new Integer(FunctionTable.FUNC_STRING_LENGTH)); m_functionID.put(Keywords.FUNC_UNPARSED_ENTITY_URI_STRING, new Integer(FunctionTable.FUNC_UNPARSED_ENTITY_URI)); m_functionID.put(Keywords.FUNC_DOCLOCATION_STRING, new Integer(FunctionTable.FUNC_DOCLOCATION)); } public FunctionTable(){ } /** * Return the name of the a function in the static table. Needed to avoid * making the table publicly available. */ String getFunctionName(int funcID) { if (funcID < NUM_BUILT_IN_FUNCS) return m_functions[funcID].getName(); else return m_functions_customer[funcID - NUM_BUILT_IN_FUNCS].getName(); } /** * Obtain a new Function object from a function ID. * * @param which The function ID, which may correspond to one of the FUNC_XXX * values found in {@link org.apache.xpath.compiler.FunctionTable}, but may * be a value installed by an external module. * * @return a a new Function instance. * * @throws javax.xml.transform.TransformerException if ClassNotFoundException, * IllegalAccessException, or InstantiationException is thrown. */ Function getFunction(int which) throws javax.xml.transform.TransformerException { try{ if (which < NUM_BUILT_IN_FUNCS) return (Function) m_functions[which].newInstance(); else return (Function) m_functions_customer[ which-NUM_BUILT_IN_FUNCS].newInstance(); }catch (IllegalAccessException ex){ throw new TransformerException(ex.getMessage()); }catch (InstantiationException ex){ throw new TransformerException(ex.getMessage()); } } /** * Obtain a function ID from a given function name * @param key the function name in a java.lang.String format. * @return a function ID, which may correspond to one of the FUNC_XXX values * found in {@link org.apache.xpath.compiler.FunctionTable}, but may be a * value installed by an external module. */ Object getFunctionID(String key){ Object id = m_functionID_customer.get(key); if (null == id) id = m_functionID.get(key); return id; } /** * Install a built-in function. * @param name The unqualified name of the function, must not be null * @param func A Implementation of an XPath Function object. * @return the position of the function in the internal index. */ public int installFunction(String name, Class func) { int funcIndex; Object funcIndexObj = getFunctionID(name); if (null != funcIndexObj) { funcIndex = ((Integer) funcIndexObj).intValue(); if (funcIndex < NUM_BUILT_IN_FUNCS){ funcIndex = m_funcNextFreeIndex++; m_functionID_customer.put(name, new Integer(funcIndex)); } m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func; } else { funcIndex = m_funcNextFreeIndex++; m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func; m_functionID_customer.put(name, new Integer(funcIndex)); } return funcIndex; } /** * Tell if a built-in, non-namespaced function is available. * * @param methName The local name of the function. * * @return True if the function can be executed. */ public boolean functionAvailable(String methName) { Object tblEntry = m_functionID.get(methName); if (null != tblEntry) return true; else{ tblEntry = m_functionID_customer.get(methName); return (null != tblEntry)? true : false; } } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/package.html0000644000175000017500000000206510721374033023321 0ustar mkochmkoch XPath parsing and compilation support Package.

    Implements an XPath parser which produces an OpMap, and a so-called Compiler which produces an expression tree for fast evaluation.

    libxalan2-java-2.7.1/src/org/apache/xpath/compiler/OpMap.java0000644000175000017500000003004410721374032022714 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OpMap.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.ObjectVector; import org.apache.xpath.patterns.NodeTest; import org.apache.xpath.res.XPATHErrorResources; /** * This class represents the data structure basics of the XPath * object. */ public class OpMap { /** * The current pattern string, for diagnostics purposes */ protected String m_currentPattern; /** * Return the expression as a string for diagnostics. * * @return The expression string. */ public String toString() { return m_currentPattern; } /** * Return the expression as a string for diagnostics. * * @return The expression string. */ public String getPatternString() { return m_currentPattern; } /** * The starting size of the token queue. */ static final int MAXTOKENQUEUESIZE = 500; /* * Amount to grow token queue when it becomes full */ static final int BLOCKTOKENQUEUESIZE = 500; /** * TokenStack is the queue of used tokens. The current token is the token at the * end of the m_tokenQueue. The idea is that the queue can be marked and a sequence * of tokens can be reused. */ ObjectVector m_tokenQueue = new ObjectVector(MAXTOKENQUEUESIZE, BLOCKTOKENQUEUESIZE); /** * Get the XPath as a list of tokens. * * @return ObjectVector of tokens. */ public ObjectVector getTokenQueue() { return m_tokenQueue; } /** * Get the XPath as a list of tokens. * * @param pos index into token queue. * * @return The token, normally a string. */ public Object getToken(int pos) { return m_tokenQueue.elementAt(pos); } /** * The current size of the token queue. */ // public int m_tokenQueueSize = 0; /** * Get size of the token queue. * * @return The size of the token queue. */ public int getTokenQueueSize() { return m_tokenQueue.size(); } /** * An operations map is used instead of a proper parse tree. It contains * operations codes and indexes into the m_tokenQueue. * I use an array instead of a full parse tree in order to cut down * on the number of objects created. */ OpMapVector m_opMap = null; /** * Get the opcode list that describes the XPath operations. It contains * operations codes and indexes into the m_tokenQueue. * I use an array instead of a full parse tree in order to cut down * on the number of objects created. * * @return An IntVector that is the opcode list that describes the XPath operations. */ public OpMapVector getOpMap() { return m_opMap; } // Position indexes /** * The length is always the opcode position + 1. * Length is always expressed as the opcode+length bytes, * so it is always 2 or greater. */ public static final int MAPINDEX_LENGTH = 1; /** * Replace the large arrays * with a small array. */ void shrink() { int n = m_opMap.elementAt(MAPINDEX_LENGTH); m_opMap.setToSize(n + 4); m_opMap.setElementAt(0,n); m_opMap.setElementAt(0,n+1); m_opMap.setElementAt(0,n+2); n = m_tokenQueue.size(); m_tokenQueue.setToSize(n + 4); m_tokenQueue.setElementAt(null,n); m_tokenQueue.setElementAt(null,n + 1); m_tokenQueue.setElementAt(null,n + 2); } /** * Given an operation position, return the current op. * * @param opPos index into op map. * @return the op that corresponds to the opPos argument. */ public int getOp(int opPos) { return m_opMap.elementAt(opPos); } /** * Set the op at index to the given int. * * @param opPos index into op map. * @param value Value to set */ public void setOp(int opPos, int value) { m_opMap.setElementAt(value,opPos); } /** * Given an operation position, return the end position, i.e. the * beginning of the next operation. * * @param opPos An op position of an operation for which there is a size * entry following. * @return position of next operation in m_opMap. */ public int getNextOpPos(int opPos) { return opPos + m_opMap.elementAt(opPos + 1); } /** * Given a location step position, return the end position, i.e. the * beginning of the next step. * * @param opPos the position of a location step. * @return the position of the next location step. */ public int getNextStepPos(int opPos) { int stepType = getOp(opPos); if ((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES)) { return getNextOpPos(opPos); } else if ((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP)) { int newOpPos = getNextOpPos(opPos); while (OpCodes.OP_PREDICATE == getOp(newOpPos)) { newOpPos = getNextOpPos(newOpPos); } stepType = getOp(newOpPos); if (!((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES))) { return OpCodes.ENDOP; } return newOpPos; } else { throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_UNKNOWN_STEP, new Object[]{String.valueOf(stepType)})); //"Programmer's assertion in getNextStepPos: unknown stepType: " + stepType); } } /** * Given an operation position, return the end position, i.e. the * beginning of the next operation. * * @param opMap The operations map. * @param opPos index to operation, for which there is a size entry following. * @return position of next operation in m_opMap. */ public static int getNextOpPos(int[] opMap, int opPos) { return opPos + opMap[opPos + 1]; } /** * Given an FROM_stepType position, return the position of the * first predicate, if there is one, or else this will point * to the end of the FROM_stepType. * Example: * int posOfPredicate = xpath.getNextOpPos(stepPos); * boolean hasPredicates = * OpCodes.OP_PREDICATE == xpath.getOp(posOfPredicate); * * @param opPos position of FROM_stepType op. * @return position of predicate in FROM_stepType structure. */ public int getFirstPredicateOpPos(int opPos) throws javax.xml.transform.TransformerException { int stepType = m_opMap.elementAt(opPos); if ((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES)) { return opPos + m_opMap.elementAt(opPos + 2); } else if ((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP)) { return opPos + m_opMap.elementAt(opPos + 1); } else if(-2 == stepType) { return -2; } else { error(org.apache.xpath.res.XPATHErrorResources.ER_UNKNOWN_OPCODE, new Object[]{ String.valueOf(stepType) }); //"ERROR! Unknown op code: "+m_opMap[opPos]); return -1; } } /** * Tell the user of an error, and probably throw an * exception. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void error(String msg, Object[] args) throws javax.xml.transform.TransformerException { java.lang.String fmsg = org.apache.xalan.res.XSLMessages.createXPATHMessage(msg, args); throw new javax.xml.transform.TransformerException(fmsg); } /** * Go to the first child of a given operation. * * @param opPos position of operation. * * @return The position of the first child of the operation. */ public static int getFirstChildPos(int opPos) { return opPos + 2; } /** * Get the length of an operation. * * @param opPos The position of the operation in the op map. * * @return The size of the operation. */ public int getArgLength(int opPos) { return m_opMap.elementAt(opPos + MAPINDEX_LENGTH); } /** * Given a location step, get the length of that step. * * @param opPos Position of location step in op map. * * @return The length of the step. */ public int getArgLengthOfStep(int opPos) { return m_opMap.elementAt(opPos + MAPINDEX_LENGTH + 1) - 3; } /** * Get the first child position of a given location step. * * @param opPos Position of location step in the location map. * * @return The first child position of the step. */ public static int getFirstChildPosOfStep(int opPos) { return opPos + 3; } /** * Get the test type of the step, i.e. NODETYPE_XXX value. * * @param opPosOfStep The position of the FROM_XXX step. * * @return NODETYPE_XXX value. */ public int getStepTestType(int opPosOfStep) { return m_opMap.elementAt(opPosOfStep + 3); // skip past op, len, len without predicates } /** * Get the namespace of the step. * * @param opPosOfStep The position of the FROM_XXX step. * * @return The step's namespace, NodeTest.WILD, or null for null namespace. */ public String getStepNS(int opPosOfStep) { int argLenOfStep = getArgLengthOfStep(opPosOfStep); // System.out.println("getStepNS.argLenOfStep: "+argLenOfStep); if (argLenOfStep == 3) { int index = m_opMap.elementAt(opPosOfStep + 4); if (index >= 0) return (String) m_tokenQueue.elementAt(index); else if (OpCodes.ELEMWILDCARD == index) return NodeTest.WILD; else return null; } else return null; } /** * Get the local name of the step. * @param opPosOfStep The position of the FROM_XXX step. * * @return OpCodes.EMPTY, OpCodes.ELEMWILDCARD, or the local name. */ public String getStepLocalName(int opPosOfStep) { int argLenOfStep = getArgLengthOfStep(opPosOfStep); // System.out.println("getStepLocalName.argLenOfStep: "+argLenOfStep); int index; switch (argLenOfStep) { case 0 : index = OpCodes.EMPTY; break; case 1 : index = OpCodes.ELEMWILDCARD; break; case 2 : index = m_opMap.elementAt(opPosOfStep + 4); break; case 3 : index = m_opMap.elementAt(opPosOfStep + 5); break; default : index = OpCodes.EMPTY; break; // Should assert error } // int index = (argLenOfStep == 3) ? m_opMap[opPosOfStep+5] // : ((argLenOfStep == 1) ? -3 : -2); if (index >= 0) return (String) m_tokenQueue.elementAt(index).toString(); else if (OpCodes.ELEMWILDCARD == index) return NodeTest.WILD; else return null; } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/XPathDumper.java0000644000175000017500000000203610721374030024077 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathDumper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; /** * Class for XPath diagnostic functions. */ public class XPathDumper { // deleted for the time being. } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/Lexer.java0000644000175000017500000004300110721374032022754 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Lexer.java 524810 2007-04-02 15:51:55Z zongaro $ */ package org.apache.xpath.compiler; import java.util.Vector; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.res.XPATHErrorResources; /** * This class is in charge of lexical processing of the XPath * expression into tokens. */ class Lexer { /** * The target XPath. */ private Compiler m_compiler; /** * The prefix resolver to map prefixes to namespaces in the XPath. */ PrefixResolver m_namespaceContext; /** * The XPath processor object. */ XPathParser m_processor; /** * This value is added to each element name in the TARGETEXTRA * that is a 'target' (right-most top-level element name). */ static final int TARGETEXTRA = 10000; /** * Ignore this, it is going away. * This holds a map to the m_tokenQueue that tells where the top-level elements are. * It is used for pattern matching so the m_tokenQueue can be walked backwards. * Each element that is a 'target', (right-most top level element name) has * TARGETEXTRA added to it. * */ private int m_patternMap[] = new int[100]; /** * Ignore this, it is going away. * The number of elements that m_patternMap maps; */ private int m_patternMapSize; /** * Create a Lexer object. * * @param compiler The owning compiler for this lexer. * @param resolver The prefix resolver for mapping qualified name prefixes * to namespace URIs. * @param xpathProcessor The parser that is processing strings to opcodes. */ Lexer(Compiler compiler, PrefixResolver resolver, XPathParser xpathProcessor) { m_compiler = compiler; m_namespaceContext = resolver; m_processor = xpathProcessor; } /** * Walk through the expression and build a token queue, and a map of the top-level * elements. * @param pat XSLT Expression. * * @throws javax.xml.transform.TransformerException */ void tokenize(String pat) throws javax.xml.transform.TransformerException { tokenize(pat, null); } /** * Walk through the expression and build a token queue, and a map of the top-level * elements. * @param pat XSLT Expression. * @param targetStrings Vector to hold Strings, may be null. * * @throws javax.xml.transform.TransformerException */ void tokenize(String pat, Vector targetStrings) throws javax.xml.transform.TransformerException { m_compiler.m_currentPattern = pat; m_patternMapSize = 0; // This needs to grow too. Use a conservative estimate that the OpMapVector // needs about five time the length of the input path expression - to a // maximum of MAXTOKENQUEUESIZE*5. If the OpMapVector needs to grow, grow // it freely (second argument to constructor). int initTokQueueSize = ((pat.length() < OpMap.MAXTOKENQUEUESIZE) ? pat.length() : OpMap.MAXTOKENQUEUESIZE) * 5; m_compiler.m_opMap = new OpMapVector(initTokQueueSize, OpMap.BLOCKTOKENQUEUESIZE * 5, OpMap.MAPINDEX_LENGTH); int nChars = pat.length(); int startSubstring = -1; int posOfNSSep = -1; boolean isStartOfPat = true; boolean isAttrName = false; boolean isNum = false; // Nesting of '[' so we can know if the given element should be // counted inside the m_patternMap. int nesting = 0; // char[] chars = pat.toCharArray(); for (int i = 0; i < nChars; i++) { char c = pat.charAt(i); switch (c) { case '\"' : { if (startSubstring != -1) { isNum = false; isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); isAttrName = false; if (-1 != posOfNSSep) { posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i); } else { addToTokenQueue(pat.substring(startSubstring, i)); } } startSubstring = i; for (i++; (i < nChars) && ((c = pat.charAt(i)) != '\"'); i++); if (c == '\"' && i < nChars) { addToTokenQueue(pat.substring(startSubstring, i + 1)); startSubstring = -1; } else { m_processor.error(XPATHErrorResources.ER_EXPECTED_DOUBLE_QUOTE, null); //"misquoted literal... expected double quote!"); } } break; case '\'' : if (startSubstring != -1) { isNum = false; isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); isAttrName = false; if (-1 != posOfNSSep) { posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i); } else { addToTokenQueue(pat.substring(startSubstring, i)); } } startSubstring = i; for (i++; (i < nChars) && ((c = pat.charAt(i)) != '\''); i++); if (c == '\'' && i < nChars) { addToTokenQueue(pat.substring(startSubstring, i + 1)); startSubstring = -1; } else { m_processor.error(XPATHErrorResources.ER_EXPECTED_SINGLE_QUOTE, null); //"misquoted literal... expected single quote!"); } break; case 0x0A : case 0x0D : case ' ' : case '\t' : if (startSubstring != -1) { isNum = false; isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); isAttrName = false; if (-1 != posOfNSSep) { posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i); } else { addToTokenQueue(pat.substring(startSubstring, i)); } startSubstring = -1; } break; case '@' : isAttrName = true; // fall-through on purpose case '-' : if ('-' == c) { if (!(isNum || (startSubstring == -1))) { break; } isNum = false; } // fall-through on purpose case '(' : case '[' : case ')' : case ']' : case '|' : case '/' : case '*' : case '+' : case '=' : case ',' : case '\\' : // Unused at the moment case '^' : // Unused at the moment case '!' : // Unused at the moment case '$' : case '<' : case '>' : if (startSubstring != -1) { isNum = false; isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); isAttrName = false; if (-1 != posOfNSSep) { posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i); } else { addToTokenQueue(pat.substring(startSubstring, i)); } startSubstring = -1; } else if (('/' == c) && isStartOfPat) { isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); } else if ('*' == c) { isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); isAttrName = false; } if (0 == nesting) { if ('|' == c) { if (null != targetStrings) { recordTokenString(targetStrings); } isStartOfPat = true; } } if ((')' == c) || (']' == c)) { nesting--; } else if (('(' == c) || ('[' == c)) { nesting++; } addToTokenQueue(pat.substring(i, i + 1)); break; case ':' : if (i>0) { if (posOfNSSep == (i - 1)) { if (startSubstring != -1) { if (startSubstring < (i - 1)) addToTokenQueue(pat.substring(startSubstring, i - 1)); } isNum = false; isAttrName = false; startSubstring = -1; posOfNSSep = -1; addToTokenQueue(pat.substring(i - 1, i + 1)); break; } else { posOfNSSep = i; } } // fall through on purpose default : if (-1 == startSubstring) { startSubstring = i; isNum = Character.isDigit(c); } else if (isNum) { isNum = Character.isDigit(c); } } } if (startSubstring != -1) { isNum = false; isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName); if ((-1 != posOfNSSep) || ((m_namespaceContext != null) && (m_namespaceContext.handlesNullPrefixes()))) { posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, nChars); } else { addToTokenQueue(pat.substring(startSubstring, nChars)); } } if (0 == m_compiler.getTokenQueueSize()) { m_processor.error(XPATHErrorResources.ER_EMPTY_EXPRESSION, null); //"Empty expression!"); } else if (null != targetStrings) { recordTokenString(targetStrings); } m_processor.m_queueMark = 0; } /** * Record the current position on the token queue as long as * this is a top-level element. Must be called before the * next token is added to the m_tokenQueue. * * @param nesting The nesting count for the pattern element. * @param isStart true if this is the start of a pattern. * @param isAttrName true if we have determined that this is an attribute name. * * @return true if this is the start of a pattern. */ private boolean mapPatternElemPos(int nesting, boolean isStart, boolean isAttrName) { if (0 == nesting) { if(m_patternMapSize >= m_patternMap.length) { int patternMap[] = m_patternMap; int len = m_patternMap.length; m_patternMap = new int[m_patternMapSize + 100]; System.arraycopy(patternMap, 0, m_patternMap, 0, len); } if (!isStart) { m_patternMap[m_patternMapSize - 1] -= TARGETEXTRA; } m_patternMap[m_patternMapSize] = (m_compiler.getTokenQueueSize() - (isAttrName ? 1 : 0)) + TARGETEXTRA; m_patternMapSize++; isStart = false; } return isStart; } /** * Given a map pos, return the corresponding token queue pos. * * @param i The index in the m_patternMap. * * @return the token queue position. */ private int getTokenQueuePosFromMap(int i) { int pos = m_patternMap[i]; return (pos >= TARGETEXTRA) ? (pos - TARGETEXTRA) : pos; } /** * Reset token queue mark and m_token to a * given position. * @param mark The new position. */ private final void resetTokenMark(int mark) { int qsz = m_compiler.getTokenQueueSize(); m_processor.m_queueMark = (mark > 0) ? ((mark <= qsz) ? mark - 1 : mark) : 0; if (m_processor.m_queueMark < qsz) { m_processor.m_token = (String) m_compiler.getTokenQueue().elementAt(m_processor.m_queueMark++); m_processor.m_tokenChar = m_processor.m_token.charAt(0); } else { m_processor.m_token = null; m_processor.m_tokenChar = 0; } } /** * Given a string, return the corresponding keyword token. * * @param key The keyword. * * @return An opcode value. */ final int getKeywordToken(String key) { int tok; try { Integer itok = (Integer) Keywords.getKeyWord(key); tok = (null != itok) ? itok.intValue() : 0; } catch (NullPointerException npe) { tok = 0; } catch (ClassCastException cce) { tok = 0; } return tok; } /** * Record the current token in the passed vector. * * @param targetStrings Vector of string. */ private void recordTokenString(Vector targetStrings) { int tokPos = getTokenQueuePosFromMap(m_patternMapSize - 1); resetTokenMark(tokPos + 1); if (m_processor.lookahead('(', 1)) { int tok = getKeywordToken(m_processor.m_token); switch (tok) { case OpCodes.NODETYPE_COMMENT : targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT); break; case OpCodes.NODETYPE_TEXT : targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT); break; case OpCodes.NODETYPE_NODE : targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY); break; case OpCodes.NODETYPE_ROOT : targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT); break; case OpCodes.NODETYPE_ANYELEMENT : targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY); break; case OpCodes.NODETYPE_PI : targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY); break; default : targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY); } } else { if (m_processor.tokenIs('@')) { tokPos++; resetTokenMark(tokPos + 1); } if (m_processor.lookahead(':', 1)) { tokPos += 2; } targetStrings.addElement(m_compiler.getTokenQueue().elementAt(tokPos)); } } /** * Add a token to the token queue. * * * @param s The token. */ private final void addToTokenQueue(String s) { m_compiler.getTokenQueue().addElement(s); } /** * When a seperator token is found, see if there's a element name or * the like to map. * * @param pat The XPath name string. * @param startSubstring The start of the name string. * @param posOfNSSep The position of the namespace seperator (':'). * @param posOfScan The end of the name index. * * @throws javax.xml.transform.TransformerException * * @return -1 always. */ private int mapNSTokens(String pat, int startSubstring, int posOfNSSep, int posOfScan) throws javax.xml.transform.TransformerException { String prefix = ""; if ((startSubstring >= 0) && (posOfNSSep >= 0)) { prefix = pat.substring(startSubstring, posOfNSSep); } String uName; if ((null != m_namespaceContext) &&!prefix.equals("*") &&!prefix.equals("xmlns")) { try { if (prefix.length() > 0) uName = ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix( prefix); else { // Assume last was wildcard. This is not legal according // to the draft. Set the below to true to make namespace // wildcards work. if (false) { addToTokenQueue(":"); String s = pat.substring(posOfNSSep + 1, posOfScan); if (s.length() > 0) addToTokenQueue(s); return -1; } else { uName = ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix( prefix); } } } catch (ClassCastException cce) { uName = m_namespaceContext.getNamespaceForPrefix(prefix); } } else { uName = prefix; } if ((null != uName) && (uName.length() > 0)) { addToTokenQueue(uName); addToTokenQueue(":"); String s = pat.substring(posOfNSSep + 1, posOfScan); if (s.length() > 0) addToTokenQueue(s); } else { // To older XPath code it doesn't matter if // error() is called or errorForDOM3(). m_processor.errorForDOM3(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE, new String[] {prefix}); //"Prefix must resolve to a namespace: {0}"; /** old code commented out 17-Sep-2004 // error("Could not locate namespace for prefix: "+prefix); // m_processor.error(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE, // new String[] {prefix}); //"Prefix must resolve to a namespace: {0}"; */ /*** Old code commented out 10-Jan-2001 addToTokenQueue(prefix); addToTokenQueue(":"); String s = pat.substring(posOfNSSep + 1, posOfScan); if (s.length() > 0) addToTokenQueue(s); ***/ } return -1; } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/OpMapVector.java0000644000175000017500000000600010721374033024073 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xpath.compiler; /** * * Like IntVector, but used only for the OpMap array. Length of array * is kept in the m_lengthPos position of the array. Only the required methods * are in included here. * @xsl.usage internal */ public class OpMapVector { /** Size of blocks to allocate */ protected int m_blocksize; /** Array of ints */ protected int m_map[]; // IntStack is trying to see this directly /** Position where size of array is kept */ protected int m_lengthPos = 0; /** Size of array */ protected int m_mapSize; /** * Construct a OpMapVector, using the given block size. * * @param blocksize Size of block to allocate */ public OpMapVector(int blocksize, int increaseSize, int lengthPos) { m_blocksize = increaseSize; m_mapSize = blocksize; m_lengthPos = lengthPos; m_map = new int[blocksize]; } /** * Get the nth element. * * @param i index of object to get * * @return object at given index */ public final int elementAt(int i) { return m_map[i]; } /** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param value object to set * @param index Index of where to set the object */ public final void setElementAt(int value, int index) { if (index >= m_mapSize) { int oldSize = m_mapSize; m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, oldSize); m_map = newMap; } m_map[index] = value; } /* * Reset the array to the supplied size. No checking is done. * * @param size The size to trim to. */ public final void setToSize(int size) { int newMap[] = new int[size]; System.arraycopy(m_map, 0, newMap, 0, m_map[m_lengthPos]); m_mapSize = size; m_map = newMap; } } libxalan2-java-2.7.1/src/org/apache/xpath/compiler/OpCodes.java0000644000175000017500000003165010721374032023240 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OpCodes.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.compiler; /** * Operations codes for XPath. * * Code for the descriptions of the operations codes: * [UPPER CASE] indicates a literal value, * [lower case] is a description of a value, * ([length] always indicates the length of the operation, * including the operations code and the length integer.) * {UPPER CASE} indicates the given production, * {description} is the description of a new production, * (For instance, {boolean expression} means some expression * that should be resolved to a boolean.) * * means that it occurs zero or more times, * + means that it occurs one or more times, * ? means that it is optional. * * returns: indicates what the production should return. */ public class OpCodes { /** * [ENDOP] * Some operators may like to have a terminator. * @xsl.usage advanced */ public static final int ENDOP = -1; /** * [EMPTY] * Empty slot to indicate NULL. */ public static final int EMPTY = -2; /** * [ELEMWILDCARD] * Means ELEMWILDCARD ("*"), used instead * of string index in some places. * @xsl.usage advanced */ public static final int ELEMWILDCARD = -3; /** * [OP_XPATH] * [length] * {expression} * * returns: * XNodeSet * XNumber * XString * XBoolean * XRTree * XObject * @xsl.usage advanced */ public static final int OP_XPATH = 1; /** * [OP_OR] * [length] * {boolean expression} * {boolean expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_OR = 2; /** * [OP_AND] * [length] * {boolean expression} * {boolean expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_AND = 3; /** * [OP_NOTEQUALS] * [length] * {expression} * {expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_NOTEQUALS = 4; /** * [OP_EQUALS] * [length] * {expression} * {expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_EQUALS = 5; /** * [OP_LTE] (less-than-or-equals) * [length] * {number expression} * {number expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_LTE = 6; /** * [OP_LT] (less-than) * [length] * {number expression} * {number expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_LT = 7; /** * [OP_GTE] (greater-than-or-equals) * [length] * {number expression} * {number expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_GTE = 8; /** * [OP_GT] (greater-than) * [length] * {number expression} * {number expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_GT = 9; /** * [OP_PLUS] * [length] * {number expression} * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_PLUS = 10; /** * [OP_MINUS] * [length] * {number expression} * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_MINUS = 11; /** * [OP_MULT] * [length] * {number expression} * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_MULT = 12; /** * [OP_DIV] * [length] * {number expression} * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_DIV = 13; /** * [OP_MOD] * [length] * {number expression} * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_MOD = 14; /** * [OP_QUO] * [length] * {number expression} * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_QUO = 15; /** * [OP_NEG] * [length] * {number expression} * * returns: * XNumber * @xsl.usage advanced */ public static final int OP_NEG = 16; /** * [OP_STRING] (cast operation) * [length] * {expression} * * returns: * XString * @xsl.usage advanced */ public static final int OP_STRING = 17; /** * [OP_BOOL] (cast operation) * [length] * {expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_BOOL = 18; /** * [OP_NUMBER] (cast operation) * [length] * {expression} * * returns: * XBoolean * @xsl.usage advanced */ public static final int OP_NUMBER = 19; /** * [OP_UNION] * [length] * {PathExpr}+ * * returns: * XNodeSet * @xsl.usage advanced */ public static final int OP_UNION = 20; /** * [OP_LITERAL] * [3] * [index to token] * * returns: * XString * @xsl.usage advanced */ public static final int OP_LITERAL = 21; /** The low opcode for nodesets, needed by getFirstPredicateOpPos and * getNextStepPos. */ static final int FIRST_NODESET_OP = 22; /** * [OP_VARIABLE] * [4] * [index to namespace token, or EMPTY] * [index to function name token] * * returns: * XString * @xsl.usage advanced */ public static final int OP_VARIABLE = 22; /** * [OP_GROUP] * [length] * {expression} * * returns: * XNodeSet * XNumber * XString * XBoolean * XRTree * XObject * @xsl.usage advanced */ public static final int OP_GROUP = 23; /** * [OP_EXTFUNCTION] (Extension function.) * [length] * [index to namespace token] * [index to function name token] * {OP_ARGUMENT} * * returns: * XNodeSet * XNumber * XString * XBoolean * XRTree * XObject * @xsl.usage advanced */ public static final int OP_EXTFUNCTION = 24; /** * [OP_FUNCTION] * [length] * [FUNC_name] * {OP_ARGUMENT} * [ENDOP] * * returns: * XNodeSet * XNumber * XString * XBoolean * XRTree * XObject * @xsl.usage advanced */ public static final int OP_FUNCTION = 25; /** The last opcode for stuff that can be a nodeset. */ static final int LAST_NODESET_OP = 25; /** * [OP_ARGUMENT] (Function argument.) * [length] * {expression} * * returns: * XNodeSet * XNumber * XString * XBoolean * XRTree * XObject * @xsl.usage advanced */ public static final int OP_ARGUMENT = 26; /** * [OP_NUMBERLIT] (Number literal.) * [3] * [index to token] * * returns: * XString * @xsl.usage advanced */ public static final int OP_NUMBERLIT = 27; /** * [OP_LOCATIONPATH] * [length] * {FROM_stepType} * | {function} * {predicate} * [ENDOP] * * (Note that element and attribute namespaces and * names can be wildcarded '*'.) * * returns: * XNodeSet * @xsl.usage advanced */ public static final int OP_LOCATIONPATH = 28; // public static final int LOCATIONPATHEX_MASK = 0x0000FFFF; // public static final int LOCATIONPATHEX_ISSIMPLE = 0x00010000; // public static final int OP_LOCATIONPATH_EX = (28 | 0x00010000); /** * [OP_PREDICATE] * [length] * {expression} * [ENDOP] (For safety) * * returns: * XBoolean or XNumber * @xsl.usage advanced */ public static final int OP_PREDICATE = 29; /** * [OP_MATCHPATTERN] * [length] * {PathExpr}+ * * returns: * XNodeSet * @xsl.usage advanced */ public static final int OP_MATCHPATTERN = 30; /** * [OP_LOCATIONPATHPATTERN] * [length] * {FROM_stepType} * | {function}{predicate} * [ENDOP] * returns: * XNodeSet * @xsl.usage advanced */ public static final int OP_LOCATIONPATHPATTERN = 31; /** * [NODETYPE_COMMENT] * No size or arguments. * Note: must not overlap function OP number! * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_COMMENT = 1030; /** * [NODETYPE_TEXT] * No size or arguments. * Note: must not overlap function OP number! * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_TEXT = 1031; /** * [NODETYPE_PI] * [index to token] * Note: must not overlap function OP number! * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_PI = 1032; /** * [NODETYPE_NODE] * No size or arguments. * Note: must not overlap function OP number! * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_NODE = 1033; /** * [NODENAME] * [index to ns token or EMPTY] * [index to name token] * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODENAME = 34; /** * [NODETYPE_ROOT] * No size or arguments. * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_ROOT = 35; /** * [NODETYPE_ANY] * No size or arguments. * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_ANYELEMENT = 36; /** * [NODETYPE_ANY] * No size or arguments. * * returns: * XBoolean * @xsl.usage advanced */ public static final int NODETYPE_FUNCTEST = 1034; /** * [FROM_stepType] * [length, including predicates] * [length of just the step, without the predicates] * {node test} * {predicates}? * * returns: * XBoolean * @xsl.usage advanced */ public static final int AXES_START_TYPES = 37; /** ancestor axes opcode. */ public static final int FROM_ANCESTORS = 37; /** ancestor-or-self axes opcode. */ public static final int FROM_ANCESTORS_OR_SELF = 38; /** attribute axes opcode. */ public static final int FROM_ATTRIBUTES = 39; /** children axes opcode. */ public static final int FROM_CHILDREN = 40; /** descendants axes opcode. */ public static final int FROM_DESCENDANTS = 41; /** descendants-of-self axes opcode. */ public static final int FROM_DESCENDANTS_OR_SELF = 42; /** following axes opcode. */ public static final int FROM_FOLLOWING = 43; /** following-siblings axes opcode. */ public static final int FROM_FOLLOWING_SIBLINGS = 44; /** parent axes opcode. */ public static final int FROM_PARENT = 45; /** preceding axes opcode. */ public static final int FROM_PRECEDING = 46; /** preceding-sibling axes opcode. */ public static final int FROM_PRECEDING_SIBLINGS = 47; /** self axes opcode. */ public static final int FROM_SELF = 48; /** namespace axes opcode. */ public static final int FROM_NAMESPACE = 49; /** '/' axes opcode. */ public static final int FROM_ROOT = 50; /** * For match patterns. * @xsl.usage advanced */ public static final int MATCH_ATTRIBUTE = 51; /** * For match patterns. * @xsl.usage advanced */ public static final int MATCH_ANY_ANCESTOR = 52; /** * For match patterns. * @xsl.usage advanced */ public static final int MATCH_IMMEDIATE_ANCESTOR = 53; /** The end of the axes types. */ public static final int AXES_END_TYPES = 53; /** The next free ID. Please keep this up to date. */ private static final int NEXT_FREE_ID = 99; } libxalan2-java-2.7.1/src/org/apache/xpath/ExpressionOwner.java0000644000175000017500000000267210721374033023247 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExpressionOwner.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; /** * Classes that implement this interface own an expression, which * can be rewritten. */ public interface ExpressionOwner { /** * Get the raw Expression object that this class wraps. * * @return the raw Expression object, which should not normally be null. */ public Expression getExpression(); /** * Set the raw expression object for this object. * * @param exp the raw Expression object, which should not normally be null. */ public void setExpression(Expression exp); } libxalan2-java-2.7.1/src/org/apache/xpath/NodeSet.java0000644000175000017500000011037610721374032021436 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSet.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.DOM2Helper; import org.apache.xpath.axes.ContextNodeList; import org.apache.xpath.res.XPATHErrorResources; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeFilter; import org.w3c.dom.traversal.NodeIterator; /** *

    The NodeSet class can act as either a NodeVector, * NodeList, or NodeIterator. However, in order for it to * act as a NodeVector or NodeList, it's required that * setShouldCacheNodes(true) be called before the first * nextNode() is called, in order that nodes can be added * as they are fetched. Derived classes that implement iterators * must override runTo(int index), in order that they may * run the iteration to the given index.

    * *

    Note that we directly implement the DOM's NodeIterator * interface. We do not emulate all the behavior of the * standard NodeIterator. In particular, we do not guarantee * to present a "live view" of the document ... but in XSLT, * the source document should never be mutated, so this should * never be an issue.

    * *

    Thought: Should NodeSet really implement NodeList and NodeIterator, * or should there be specific subclasses of it which do so? The * advantage of doing it all here is that all NodeSets will respond * to the same calls; the disadvantage is that some of them may return * less-than-enlightening results when you do so.

    * @xsl.usage advanced */ public class NodeSet implements NodeList, NodeIterator, Cloneable, ContextNodeList { /** * Create an empty nodelist. */ public NodeSet() { m_blocksize = 32; m_mapSize = 0; } /** * Create an empty, using the given block size. * * @param blocksize Size of blocks to allocate */ public NodeSet(int blocksize) { m_blocksize = blocksize; m_mapSize = 0; } /** * Create a NodeSet, and copy the members of the * given nodelist into it. * * @param nodelist List of Nodes to be made members of the new set. */ public NodeSet(NodeList nodelist) { this(32); addNodes(nodelist); } /** * Create a NodeSet, and copy the members of the * given NodeSet into it. * * @param nodelist Set of Nodes to be made members of the new set. */ public NodeSet(NodeSet nodelist) { this(32); addNodes((NodeIterator) nodelist); } /** * Create a NodeSet, and copy the members of the * given NodeIterator into it. * * @param ni Iterator which yields Nodes to be made members of the new set. */ public NodeSet(NodeIterator ni) { this(32); addNodes(ni); } /** * Create a NodeSet which contains the given Node. * * @param node Single node to be added to the new set. */ public NodeSet(Node node) { this(32); addNode(node); } /** * @return The root node of the Iterator, as specified when it was created. * For non-Iterator NodeSets, this will be null. */ public Node getRoot() { return null; } /** * Get a cloned Iterator, and reset its state to the beginning of the * iteration. * * @return a new NodeSet of the same type, having the same state... * except that the reset() operation has been called. * * @throws CloneNotSupportedException if this subclass of NodeSet * does not support the clone() operation. */ public NodeIterator cloneWithReset() throws CloneNotSupportedException { NodeSet clone = (NodeSet) clone(); clone.reset(); return clone; } /** * Reset the iterator. May have no effect on non-iterator Nodesets. */ public void reset() { m_next = 0; } /** * This attribute determines which node types are presented via the * iterator. The available set of constants is defined in the * NodeFilter interface. For NodeSets, the mask has been * hardcoded to show all nodes except EntityReference nodes, which have * no equivalent in the XPath data model. * * @return integer used as a bit-array, containing flags defined in * the DOM's NodeFilter class. The value will be * SHOW_ALL & ~SHOW_ENTITY_REFERENCE, meaning that * only entity references are suppressed. */ public int getWhatToShow() { return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE; } /** * The filter object used to screen nodes. Filters are applied to * further reduce (and restructure) the NodeIterator's view of the * document. In our case, we will be using hardcoded filters built * into our iterators... but getFilter() is part of the DOM's * NodeIterator interface, so we have to support it. * * @return null, which is slightly misleading. True, there is no * user-written filter object, but in fact we are doing some very * sophisticated custom filtering. A DOM purist might suggest * returning a placeholder object just to indicate that this is * not going to return all nodes selected by whatToShow. */ public NodeFilter getFilter() { return null; } /** * The value of this flag determines whether the children of entity * reference nodes are visible to the iterator. If false, they will be * skipped over. *
    To produce a view of the document that has entity references * expanded and does not expose the entity reference node itself, use the * whatToShow flags to hide the entity reference node and set * expandEntityReferences to true when creating the iterator. To produce * a view of the document that has entity reference nodes but no entity * expansion, use the whatToShow flags to show the entity reference node * and set expandEntityReferences to false. * * @return true for all iterators based on NodeSet, meaning that the * contents of EntityRefrence nodes may be returned (though whatToShow * says that the EntityReferences themselves are not shown.) */ public boolean getExpandEntityReferences() { return true; } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * @return The next Node in the set being iterated over, or * null if there are no more members in that set. * @throws DOMException * INVALID_STATE_ERR: Raised if this method is called after the * detach method was invoked. */ public Node nextNode() throws DOMException { if ((m_next) < this.size()) { Node next = this.elementAt(m_next); m_next++; return next; } else return null; } /** * Returns the previous node in the set and moves the position of the * iterator backwards in the set. * @return The previous Node in the set being iterated over, * ornull if there are no more members in that set. * @throws DOMException * INVALID_STATE_ERR: Raised if this method is called after the * detach method was invoked. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and hence doesn't know what the previous node was. */ public Node previousNode() throws DOMException { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_ITERATE, null)); //"This NodeSet can not iterate to a previous node!"); if ((m_next - 1) > 0) { m_next--; return this.elementAt(m_next); } else return null; } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. *

    * This operation is a no-op in NodeSet, and will not cause * INVALID_STATE_ERR to be raised by later operations. *

    */ public void detach(){} /** * Tells if this NodeSet is "fresh", in other words, if * the first nextNode() that is called will return the * first node in the set. * * @return true if nextNode() would return the first node in the set, * false if it would return a later one. */ public boolean isFresh() { return (m_next == 0); } /** * If an index is requested, NodeSet will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end. * * @param index Position to advance (or retreat) to, with * 0 requesting the reset ("fresh") position and -1 (or indeed * any out-of-bounds value) requesting the final position. * @throws RuntimeException thrown if this NodeSet is not * one of the types which supports indexing/counting. */ public void runTo(int index) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!"); if ((index >= 0) && (m_next < m_firstFree)) m_next = index; else m_next = m_firstFree - 1; } /** * Returns the indexth item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * * TODO: What happens if index is out of range? * * @param index Index into the collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. */ public Node item(int index) { runTo(index); return (Node) this.elementAt(index); } /** * The number of nodes in the list. The range of valid child node indices is * 0 to length-1 inclusive. Note that this operation requires * finding all the matching nodes, which may defeat attempts to defer * that work. * * @return integer indicating how many nodes are represented by this list. */ public int getLength() { runTo(-1); return this.size(); } /** * Add a node to the NodeSet. Not all types of NodeSets support this * operation * * @param n Node to be added * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNode(Node n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.addElement(n); } /** * Insert a node at a given position. * * @param n Node to be added * @param pos Offset at which the node is to be inserted, * with 0 being the first position. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void insertNode(Node n, int pos) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); insertElementAt(n, pos); } /** * Remove a node. * * @param n Node to be added * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void removeNode(Node n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.removeElement(n); } /** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param nodelist List of nodes which should now be referenced by * this NodeSet. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodes(NodeList nodelist) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null != nodelist) // defensive to fix a bug that Sanjiva reported. { int nChildren = nodelist.getLength(); for (int i = 0; i < nChildren; i++) { Node obj = nodelist.item(i); if (null != obj) { addElement(obj); } } } // checkDups(); } /** *

    Copy NodeList members into this nodelist, adding in * document order. Only genuine node references will be copied; * nulls appearing in the source NodeSet will * not be added to this one.

    * *

    In case you're wondering why this function is needed: NodeSet * implements both NodeIterator and NodeList. If this method isn't * provided, Java can't decide which of those to use when addNodes() * is invoked. Providing the more-explicit match avoids that * ambiguity.)

    * * @param ns NodeSet whose members should be merged into this NodeSet. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodes(NodeSet ns) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); addNodes((NodeIterator) ns); } /** * Copy NodeList members into this nodelist, adding in * document order. Null references are not added. * * @param iterator NodeIterator which yields the nodes to be added. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodes(NodeIterator iterator) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null != iterator) // defensive to fix a bug that Sanjiva reported. { Node obj; while (null != (obj = iterator.nextNode())) { addElement(obj); } } // checkDups(); } /** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param nodelist List of nodes to be added * @param support The XPath runtime context. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodesInDocOrder(NodeList nodelist, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); int nChildren = nodelist.getLength(); for (int i = 0; i < nChildren; i++) { Node node = nodelist.item(i); if (null != node) { addNodeInDocOrder(node, support); } } } /** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param iterator NodeIterator which yields the nodes to be added. * @param support The XPath runtime context. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodesInDocOrder(NodeIterator iterator, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); Node node; while (null != (node = iterator.nextNode())) { addNodeInDocOrder(node, support); } } /** * Add the node list to this node set in document order. * * @param start index. * @param end index. * @param testIndex index. * @param nodelist The nodelist to add. * @param support The XPath runtime context. * * @return false always. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ private boolean addNodesInDocOrder(int start, int end, int testIndex, NodeList nodelist, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); boolean foundit = false; int i; Node node = nodelist.item(testIndex); for (i = end; i >= start; i--) { Node child = (Node) elementAt(i); if (child == node) { i = -2; // Duplicate, suppress insert break; } if (!DOM2Helper.isNodeAfter(node, child)) { insertElementAt(node, i + 1); testIndex--; if (testIndex > 0) { boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist, support); if (!foundPrev) { addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support); } } break; } } if (i == -1) { insertElementAt(node, 0); } return foundit; } /** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @param test true if we should test for doc order * @param support The XPath runtime context. * @return insertIndex. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public int addNodeInDocOrder(Node node, boolean test, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); int insertIndex = -1; if (test) { // This needs to do a binary search, but a binary search // is somewhat tough because the sequence test involves // two nodes. int size = size(), i; for (i = size - 1; i >= 0; i--) { Node child = (Node) elementAt(i); if (child == node) { i = -2; // Duplicate, suppress insert break; } if (!DOM2Helper.isNodeAfter(node, child)) { break; } } if (i != -2) { insertIndex = i + 1; insertElementAt(node, insertIndex); } } else { insertIndex = this.size(); boolean foundit = false; for (int i = 0; i < insertIndex; i++) { if (this.item(i).equals(node)) { foundit = true; break; } } if (!foundit) addElement(node); } // checkDups(); return insertIndex; } // end addNodeInDocOrder(Vector v, Object obj) /** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @param support The XPath runtime context. * * @return The index where it was inserted. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public int addNodeInDocOrder(Node node, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); return addNodeInDocOrder(node, true, support); } // end addNodeInDocOrder(Vector v, Object obj) /** If this node is being used as an iterator, the next index that nextNode() * will return. */ transient protected int m_next = 0; /** * Get the current position, which is one less than * the next nextNode() call will retrieve. i.e. if * you call getCurrentPos() and the return is 0, the next * fetch will take place at index 1. * * @return The the current position index. */ public int getCurrentPos() { return m_next; } /** * Set the current position in the node set. * @param i Must be a valid index. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and thus doesn't permit indexed access. */ public void setCurrentPos(int i) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!"); m_next = i; } /** * Return the last fetched node. Needed to support the UnionPathIterator. * * @return the last fetched node. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and thus doesn't permit indexed access. */ public Node getCurrentNode() { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!"); int saved = m_next; Node n = (m_next < m_firstFree) ? elementAt(m_next) : null; m_next = saved; // HACK: I think this is a bit of a hack. -sb return n; } /** True if this list can be mutated. */ transient protected boolean m_mutable = true; /** True if this list is cached. * @serial */ transient protected boolean m_cacheNodes = true; /** * Get whether or not this is a cached node set. * * * @return True if this list is cached. */ public boolean getShouldCacheNodes() { return m_cacheNodes; } /** * If setShouldCacheNodes(true) is called, then nodes will * be cached. They are not cached by default. This switch must * be set before the first call to nextNode is made, to ensure * that all nodes are cached. * * @param b true if this node set should be cached. * @throws RuntimeException thrown if an attempt is made to * request caching after we've already begun stepping through the * nodes in this set. */ public void setShouldCacheNodes(boolean b) { if (!isFresh()) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_CALL_SETSHOULDCACHENODE, null)); //"Can not call setShouldCacheNodes after nextNode has been called!"); m_cacheNodes = b; m_mutable = true; } transient private int m_last = 0; public int getLast() { return m_last; } public void setLast(int last) { m_last = last; } /** Size of blocks to allocate. * @serial */ private int m_blocksize; /** Array of nodes this points to. * @serial */ Node m_map[]; /** Number of nodes in this NodeVector. * @serial */ protected int m_firstFree = 0; /** Size of the array this points to. * @serial */ private int m_mapSize; // lazy initialization /** * Get a cloned LocPathIterator. * * @return A clone of this * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { NodeSet clone = (NodeSet) super.clone(); if ((null != this.m_map) && (this.m_map == clone.m_map)) { clone.m_map = new Node[this.m_map.length]; System.arraycopy(this.m_map, 0, clone.m_map, 0, this.m_map.length); } return clone; } /** * Get the length of the list. * * @return Number of nodes in this NodeVector */ public int size() { return m_firstFree; } /** * Append a Node onto the vector. * * @param value Node to add to the vector */ public void addElement(Node value) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if ((m_firstFree + 1) >= m_mapSize) { if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } else { m_mapSize += m_blocksize; Node newMap[] = new Node[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } } m_map[m_firstFree] = value; m_firstFree++; } /** * Append a Node onto the vector. * * @param value Node to add to the vector */ public final void push(Node value) { int ff = m_firstFree; if ((ff + 1) >= m_mapSize) { if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } else { m_mapSize += m_blocksize; Node newMap[] = new Node[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, ff + 1); m_map = newMap; } } m_map[ff] = value; ff++; m_firstFree = ff; } /** * Pop a node from the tail of the vector and return the result. * * @return the node at the tail of the vector */ public final Node pop() { m_firstFree--; Node n = m_map[m_firstFree]; m_map[m_firstFree] = null; return n; } /** * Pop a node from the tail of the vector and return the * top of the stack after the pop. * * @return The top of the stack after it's been popped */ public final Node popAndTop() { m_firstFree--; m_map[m_firstFree] = null; return (m_firstFree == 0) ? null : m_map[m_firstFree - 1]; } /** * Pop a node from the tail of the vector. */ public final void popQuick() { m_firstFree--; m_map[m_firstFree] = null; } /** * Return the node at the top of the stack without popping the stack. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @return Node at the top of the stack or null if stack is empty. */ public final Node peepOrNull() { return ((null != m_map) && (m_firstFree > 0)) ? m_map[m_firstFree - 1] : null; } /** * Push a pair of nodes into the stack. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @param v1 First node to add to vector * @param v2 Second node to add to vector */ public final void pushPair(Node v1, Node v2) { if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } else { if ((m_firstFree + 2) >= m_mapSize) { m_mapSize += m_blocksize; Node newMap[] = new Node[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree); m_map = newMap; } } m_map[m_firstFree] = v1; m_map[m_firstFree + 1] = v2; m_firstFree += 2; } /** * Pop a pair of nodes from the tail of the stack. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. */ public final void popPair() { m_firstFree -= 2; m_map[m_firstFree] = null; m_map[m_firstFree + 1] = null; } /** * Set the tail of the stack to the given node. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @param n Node to set at the tail of vector */ public final void setTail(Node n) { m_map[m_firstFree - 1] = n; } /** * Set the given node one position from the tail. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @param n Node to set */ public final void setTailSub1(Node n) { m_map[m_firstFree - 2] = n; } /** * Return the node at the tail of the vector without popping * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @return Node at the tail of the vector */ public final Node peepTail() { return m_map[m_firstFree - 1]; } /** * Return the node one position from the tail without popping. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @return Node one away from the tail */ public final Node peepTailSub1() { return m_map[m_firstFree - 2]; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * @param value Node to insert * @param at Position where to insert */ public void insertElementAt(Node value, int at) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } else if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; Node newMap[] = new Node[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } if (at <= (m_firstFree - 1)) { System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at); } m_map[at] = value; m_firstFree++; } /** * Append the nodes to the list. * * @param nodes NodeVector to append to this list */ public void appendNodes(NodeSet nodes) { int nNodes = nodes.size(); if (null == m_map) { m_mapSize = nNodes + m_blocksize; m_map = new Node[m_mapSize]; } else if ((m_firstFree + nNodes) >= m_mapSize) { m_mapSize += (nNodes + m_blocksize); Node newMap[] = new Node[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes); m_map = newMap; } System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes); m_firstFree += nNodes; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. */ public void removeAllElements() { if (null == m_map) return; for (int i = 0; i < m_firstFree; i++) { m_map[i] = null; } m_firstFree = 0; } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s Node to remove from the list * * @return True if the node was successfully removed */ public boolean removeElement(Node s) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) return false; for (int i = 0; i < m_firstFree; i++) { Node node = m_map[i]; if ((null != node) && node.equals(s)) { if (i < m_firstFree - 1) System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i - 1); m_firstFree--; m_map[m_firstFree] = null; return true; } } return false; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param i Index of node to remove */ public void removeElementAt(int i) { if (null == m_map) return; if (i >= m_firstFree) throw new ArrayIndexOutOfBoundsException(i + " >= " + m_firstFree); else if (i < 0) throw new ArrayIndexOutOfBoundsException(i); if (i < m_firstFree - 1) System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i - 1); m_firstFree--; m_map[m_firstFree] = null; } /** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param node Node to set * @param index Index of where to set the node */ public void setElementAt(Node node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; } /** * Get the nth element. * * @param i Index of node to get * * @return Node at specified index */ public Node elementAt(int i) { if (null == m_map) return null; return m_map[i]; } /** * Tell if the table contains the given node. * * @param s Node to look for * * @return True if the given node was found. */ public boolean contains(Node s) { runTo(-1); if (null == m_map) return false; for (int i = 0; i < m_firstFree; i++) { Node node = m_map[i]; if ((null != node) && node.equals(s)) return true; } return false; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @param index Index of where to start the search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(Node elem, int index) { runTo(-1); if (null == m_map) return -1; for (int i = index; i < m_firstFree; i++) { Node node = m_map[i]; if ((null != node) && node.equals(elem)) return i; } return -1; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(Node elem) { runTo(-1); if (null == m_map) return -1; for (int i = 0; i < m_firstFree; i++) { Node node = m_map[i]; if ((null != node) && node.equals(elem)) return i; } return -1; } } libxalan2-java-2.7.1/src/org/apache/xpath/Arg.java0000644000175000017500000001474410721374032020610 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Arg.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import org.apache.xml.utils.QName; import org.apache.xpath.objects.XObject; /** * This class holds an instance of an argument on * the stack. The value of the argument can be either an * XObject or a String containing an expression. * @xsl.usage internal */ public class Arg { /** Field m_qname: The name of this argument, expressed as a QName * (Qualified Name) object. * @see getQName * @see setQName * */ private QName m_qname; /** * Get the qualified name for this argument. * * @return QName object containing the qualified name */ public final QName getQName() { return m_qname; } /** * Set the qualified name for this argument. * * @param name QName object representing the new Qualified Name. */ public final void setQName(QName name) { m_qname = name; } /** Field m_val: Stored XObject value of this argument * @see #getVal() * @see #setVal() */ private XObject m_val; /** * Get the value for this argument. * * @return the argument's stored XObject value. * @see #setVal(XObject) */ public final XObject getVal() { return m_val; } /** * Set the value of this argument. * * @param val an XObject representing the arguments's value. * @see #getVal() */ public final void setVal(XObject val) { m_val = val; } /** * Have the object release it's resources. * Call only when the variable or argument is going out of scope. */ public void detach() { if(null != m_val) { m_val.allowDetachToRelease(true); m_val.detach(); } } /** Field m_expression: Stored expression value of this argument. * @see #setExpression * @see #getExpression * */ private String m_expression; /** * Get the value expression for this argument. * * @return String containing the expression previously stored into this * argument * @see #setExpression */ public String getExpression() { return m_expression; } /** * Set the value expression for this argument. * * @param expr String containing the expression to be stored as this * argument's value. * @see #getExpression */ public void setExpression(String expr) { m_expression = expr; } /** * True if this variable was added with an xsl:with-param or * is added via setParameter. */ private boolean m_isFromWithParam; /** * Tell if this variable is a parameter passed with a with-param or as * a top-level parameter. */ public boolean isFromWithParam() { return m_isFromWithParam; } /** * True if this variable is currently visible. To be visible, * a variable needs to come either from xsl:variable or be * a "received" parameter, ie one for which an xsl:param has * been encountered. * Set at the time the object is constructed and updated as needed. */ private boolean m_isVisible; /** * Tell if this variable is currently visible. */ public boolean isVisible() { return m_isVisible; } /** * Update visibility status of this variable. */ public void setIsVisible(boolean b) { m_isVisible = b; } /** * Construct a dummy parameter argument, with no QName and no * value (either expression string or value XObject). isVisible * defaults to true. */ public Arg() { m_qname = new QName(""); ; // so that string compares can be done. m_val = null; m_expression = null; m_isVisible = true; m_isFromWithParam = false; } /** * Construct a parameter argument that contains an expression. * * @param qname Name of the argument, expressed as a QName object. * @param expression String to be stored as this argument's value expression. * @param isFromWithParam True if this is a parameter variable. */ public Arg(QName qname, String expression, boolean isFromWithParam) { m_qname = qname; m_val = null; m_expression = expression; m_isFromWithParam = isFromWithParam; m_isVisible = !isFromWithParam; } /** * Construct a parameter argument which has an XObject value. * isVisible defaults to true. * * @param qname Name of the argument, expressed as a QName object. * @param val Value of the argument, expressed as an XObject */ public Arg(QName qname, XObject val) { m_qname = qname; m_val = val; m_isVisible = true; m_isFromWithParam = false; m_expression = null; } /** * Equality function specialized for the variable name. If the argument * is not a qname, it will deligate to the super class. * * @param obj the reference object with which to compare. * @return true if this object is the same as the obj * argument; false otherwise. */ public boolean equals(Object obj) { if(obj instanceof QName) { return m_qname.equals(obj); } else return super.equals(obj); } /** * Construct a parameter argument. * * @param qname Name of the argument, expressed as a QName object. * @param val Value of the argument, expressed as an XObject * @param isFromWithParam True if this is a parameter variable. */ public Arg(QName qname, XObject val, boolean isFromWithParam) { m_qname = qname; m_val = val; m_isFromWithParam = isFromWithParam; m_isVisible = !isFromWithParam; m_expression = null; } } libxalan2-java-2.7.1/src/org/apache/xpath/ExpressionNode.java0000644000175000017500000000400210721374032023026 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExpressionNode.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import javax.xml.transform.SourceLocator; /** * A class that implements this interface can construct expressions, * give information about child and parent expressions, * and give the originating source information. A class that implements * this interface does not lay any claim to being directly executable. * *

    Note: This interface should not be considered stable. Only exprSetParent * and exprGetParent can be counted on to work reliably. Work in progress.

    */ public interface ExpressionNode extends SourceLocator { /** This pair of methods are used to inform the node of its parent. */ public void exprSetParent(ExpressionNode n); public ExpressionNode exprGetParent(); /** This method tells the node to add its argument to the node's list of children. */ public void exprAddChild(ExpressionNode n, int i); /** This method returns a child node. The children are numbered from zero, left to right. */ public ExpressionNode exprGetChild(int i); /** Return the number of children the node has. */ public int exprGetNumChildren(); } libxalan2-java-2.7.1/src/org/apache/xpath/SourceTreeManager.java0000644000175000017500000002635710721374033023456 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SourceTreeManager.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import java.io.IOException; import java.util.Vector; import javax.xml.transform.Source; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.SystemIDResolver; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * This class bottlenecks all management of source trees. The methods * in this class should allow easy garbage collection of source * trees (not yet!), and should centralize parsing for those source trees. */ public class SourceTreeManager { /** Vector of SourceTree objects that this manager manages. */ private Vector m_sourceTree = new Vector(); /** * Reset the list of SourceTree objects that this manager manages. * */ public void reset() { m_sourceTree = new Vector(); } /** The TrAX URI resolver used to obtain source trees. */ URIResolver m_uriResolver; /** * Set an object that will be used to resolve URIs used in * document(), etc. * @param resolver An object that implements the URIResolver interface, * or null. */ public void setURIResolver(URIResolver resolver) { m_uriResolver = resolver; } /** * Get the object that will be used to resolve URIs used in * document(), etc. * @return An object that implements the URIResolver interface, * or null. */ public URIResolver getURIResolver() { return m_uriResolver; } /** * Given a document, find the URL associated with that document. * @param owner Document that was previously processed by this liaison. * * @return The base URI of the owner argument. */ public String findURIFromDoc(int owner) { int n = m_sourceTree.size(); for (int i = 0; i < n; i++) { SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i); if (owner == sTree.m_root) return sTree.m_url; } return null; } /** * This will be called by the processor when it encounters * an xsl:include, xsl:import, or document() function. * * @param base The base URI that should be used. * @param urlString Value from an xsl:import or xsl:include's href attribute, * or a URI specified in the document() function. * * @return a Source that can be used to process the resource. * * @throws IOException * @throws TransformerException */ public Source resolveURI( String base, String urlString, SourceLocator locator) throws TransformerException, IOException { Source source = null; if (null != m_uriResolver) { source = m_uriResolver.resolve(urlString, base); } if (null == source) { String uri = SystemIDResolver.getAbsoluteURI(urlString, base); source = new StreamSource(uri); } return source; } /** JJK: Support kluge in ElemForEach. * TODO: This function is highly dangerous. Cache management must be improved. * * @param n The node to remove. */ public void removeDocumentFromCache(int n) { if(DTM.NULL ==n) return; for(int i=m_sourceTree.size()-1;i>=0;--i) { SourceTree st=(SourceTree)m_sourceTree.elementAt(i); if(st!=null && st.m_root==n) { m_sourceTree.removeElementAt(i); return; } } } /** * Put the source tree root node in the document cache. * TODO: This function needs to be a LOT more sophisticated. * * @param n The node to cache. * @param source The Source object to cache. */ public void putDocumentInCache(int n, Source source) { int cachedNode = getNode(source); if (DTM.NULL != cachedNode) { if (!(cachedNode == n)) throw new RuntimeException( "Programmer's Error! " + "putDocumentInCache found reparse of doc: " + source.getSystemId()); return; } if (null != source.getSystemId()) { m_sourceTree.addElement(new SourceTree(n, source.getSystemId())); } } /** * Given a Source object, find the node associated with it. * * @param source The Source object to act as the key. * * @return The node that is associated with the Source, or null if not found. */ public int getNode(Source source) { // if (source instanceof DOMSource) // return ((DOMSource) source).getNode(); // TODO: Not sure if the BaseID is really the same thing as the ID. String url = source.getSystemId(); if (null == url) return DTM.NULL; int n = m_sourceTree.size(); // System.out.println("getNode: "+n); for (int i = 0; i < n; i++) { SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i); // System.out.println("getNode - url: "+url); // System.out.println("getNode - sTree.m_url: "+sTree.m_url); if (url.equals(sTree.m_url)) return sTree.m_root; } // System.out.println("getNode - returning: "+node); return DTM.NULL; } /** * Get the source tree from the a base URL and a URL string. * * @param base The base URI to use if the urlString is relative. * @param urlString An absolute or relative URL string. * @param locator The location of the caller, for diagnostic purposes. * * @return should be a non-null reference to the node identified by the * base and urlString. * * @throws TransformerException If the URL can not resolve to a node. */ public int getSourceTree( String base, String urlString, SourceLocator locator, XPathContext xctxt) throws TransformerException { // System.out.println("getSourceTree"); try { Source source = this.resolveURI(base, urlString, locator); // System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId()); return getSourceTree(source, locator, xctxt); } catch (IOException ioe) { throw new TransformerException(ioe.getMessage(), locator, ioe); } /* catch (TransformerException te) { throw new TransformerException(te.getMessage(), locator, te); }*/ } /** * Get the source tree from the input source. * * @param source The Source object that should identify the desired node. * @param locator The location of the caller, for diagnostic purposes. * * @return non-null reference to a node. * * @throws TransformerException if the Source argument can't be resolved to * a node. */ public int getSourceTree(Source source, SourceLocator locator, XPathContext xctxt) throws TransformerException { int n = getNode(source); if (DTM.NULL != n) return n; n = parseToNode(source, locator, xctxt); if (DTM.NULL != n) putDocumentInCache(n, source); return n; } /** * Try to create a DOM source tree from the input source. * * @param source The Source object that identifies the source node. * @param locator The location of the caller, for diagnostic purposes. * * @return non-null reference to node identified by the source argument. * * @throws TransformerException if the source argument can not be resolved * to a source node. */ public int parseToNode(Source source, SourceLocator locator, XPathContext xctxt) throws TransformerException { try { Object xowner = xctxt.getOwnerObject(); DTM dtm; if(null != xowner && xowner instanceof org.apache.xml.dtm.DTMWSFilter) { dtm = xctxt.getDTM(source, false, (org.apache.xml.dtm.DTMWSFilter)xowner, false, true); } else { dtm = xctxt.getDTM(source, false, null, false, true); } return dtm.getDocument(); } catch (Exception e) { //e.printStackTrace(); throw new TransformerException(e.getMessage(), locator, e); } } /** * This method returns the SAX2 parser to use with the InputSource * obtained from this URI. * It may return null if any SAX2-conformant XML parser can be used, * or if getInputSource() will also return null. The parser must * be free for use (i.e. * not currently in use for another parse(). * * @param inputSource The value returned from the URIResolver. * @return a SAX2 XMLReader to use to resolve the inputSource argument. * @param locator The location of the original caller, for diagnostic purposes. * * @throws TransformerException if the reader can not be created. */ public static XMLReader getXMLReader(Source inputSource, SourceLocator locator) throws TransformerException { try { XMLReader reader = (inputSource instanceof SAXSource) ? ((SAXSource) inputSource).getXMLReader() : null; if (null == reader) { try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } catch (AbstractMethodError ame){} if(null == reader) reader = XMLReaderFactory.createXMLReader(); } try { reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); } catch (org.xml.sax.SAXException se) { // What can we do? // TODO: User diagnostics. } return reader; } catch (org.xml.sax.SAXException se) { throw new TransformerException(se.getMessage(), locator, se); } } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/0000755000175000017500000000000010736146354021244 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/functions/SecuritySupport.java0000644000175000017500000000745410721374033025314 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/Function2Args.java0000644000175000017500000001227610721374030024567 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Function2Args.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; /** * Base class for functions that accept two arguments. * @xsl.usage advanced */ public class Function2Args extends FunctionOneArg { static final long serialVersionUID = 5574294996842710641L; /** The second argument passed to the function (at index 1). * @serial */ Expression m_arg1; /** * Return the second argument passed to the function (at index 1). * * @return An expression that represents the second argument passed to the * function. */ public Expression getArg1() { return m_arg1; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if(null != m_arg1) m_arg1.fixupVariables(vars, globalsSize); } /** * Set an argument expression for a function. This method is called by the * XPath compiler. * * @param arg non-null expression that represents the argument. * @param argNum The argument number index. * * @throws WrongNumberArgsException If the argNum parameter is greater than 1. */ public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { // System.out.println("argNum: "+argNum); if (argNum == 0) super.setArg(arg, argNum); else if (1 == argNum) { m_arg1 = arg; arg.exprSetParent(this); } else reportWrongNumberArgs(); } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum != 2) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("two", null)); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return super.canTraverseOutsideSubtree() ? true : m_arg1.canTraverseOutsideSubtree(); } class Arg1Owner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_arg1; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(Function2Args.this); m_arg1 = exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callArgVisitors(XPathVisitor visitor) { super.callArgVisitors(visitor); if(null != m_arg1) m_arg1.callVisitors(new Arg1Owner(), visitor); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; if(null != m_arg1) { if(null == ((Function2Args)expr).m_arg1) return false; if(!m_arg1.deepEquals(((Function2Args)expr).m_arg1)) return false; } else if(null != ((Function2Args)expr).m_arg1) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/WrongNumberArgsException.java0000644000175000017500000000272010721374032027037 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WrongNumberArgsException.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; /** * An exception that is thrown if the wrong number of arguments to an exception * are specified by the stylesheet. * @xsl.usage advanced */ public class WrongNumberArgsException extends Exception { static final long serialVersionUID = -4551577097576242432L; /** * Constructor WrongNumberArgsException * * @param argsExpected Error message that tells the number of arguments that * were expected. */ public WrongNumberArgsException(String argsExpected) { super(argsExpected); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncExtFunctionAvailable.java0000644000175000017500000000660410721374030026764 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncExtFunctionAvailable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.templates.Constants; import org.apache.xpath.ExtensionsProvider; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.FunctionTable; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the ExtFunctionAvailable() function. * @xsl.usage advanced */ public class FuncExtFunctionAvailable extends FunctionOneArg { static final long serialVersionUID = 5118814314918592241L; transient private FunctionTable m_functionTable = null; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String prefix; String namespace; String methName; String fullName = m_arg0.execute(xctxt).str(); int indexOfNSSep = fullName.indexOf(':'); if (indexOfNSSep < 0) { prefix = ""; namespace = Constants.S_XSLNAMESPACEURL; methName = fullName; } else { prefix = fullName.substring(0, indexOfNSSep); namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix); if (null == namespace) return XBoolean.S_FALSE; methName = fullName.substring(indexOfNSSep + 1); } if (namespace.equals(Constants.S_XSLNAMESPACEURL)) { try { if (null == m_functionTable) m_functionTable = new FunctionTable(); return m_functionTable.functionAvailable(methName) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } catch (Exception e) { return XBoolean.S_FALSE; } } else { //dml ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject(); return extProvider.functionAvailable(namespace, methName) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } /** * The function table is an instance field. In order to access this instance * field during evaluation, this method is called at compilation time to * insert function table information for later usage. It should only be used * during compiling of XPath expressions. * @param aTable an instance of the function table */ public void setFunctionTable(FunctionTable aTable){ m_functionTable = aTable; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncLang.java0000644000175000017500000000476410721374031023604 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncLang.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the Lang() function. * @xsl.usage advanced */ public class FuncLang extends FunctionOneArg { static final long serialVersionUID = -7868705139354872185L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String lang = m_arg0.execute(xctxt).str(); int parent = xctxt.getCurrentNode(); boolean isLang = false; DTM dtm = xctxt.getDTM(parent); while (DTM.NULL != parent) { if (DTM.ELEMENT_NODE == dtm.getNodeType(parent)) { int langAttr = dtm.getAttributeNode(parent, "http://www.w3.org/XML/1998/namespace", "lang"); if (DTM.NULL != langAttr) { String langVal = dtm.getNodeValue(langAttr); // %OPT% if (langVal.toLowerCase().startsWith(lang.toLowerCase())) { int valLen = lang.length(); if ((langVal.length() == valLen) || (langVal.charAt(valLen) == '-')) { isLang = true; } } break; } } parent = dtm.getParent(parent); } return isLang ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncLocalPart.java0000644000175000017500000000364210721374033024600 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncLocalPart.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the LocalPart() function. * @xsl.usage advanced */ public class FuncLocalPart extends FunctionDef1Arg { static final long serialVersionUID = 7591798770325814746L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int context = getArg0AsNode(xctxt); if(DTM.NULL == context) return XString.EMPTYSTRING; DTM dtm = xctxt.getDTM(context); String s = (context != DTM.NULL) ? dtm.getLocalName(context) : ""; if(s.startsWith("#") || s.equals("xmlns")) return XString.EMPTYSTRING; return new XString(s); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncSubstringAfter.java0000644000175000017500000000355510721374032025663 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncSubstringAfter.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the SubstringAfter() function. * @xsl.usage advanced */ public class FuncSubstringAfter extends Function2Args { static final long serialVersionUID = -8119731889862512194L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XMLString s1 = m_arg0.execute(xctxt).xstr(); XMLString s2 = m_arg1.execute(xctxt).xstr(); int index = s1.indexOf(s2); return (-1 == index) ? XString.EMPTYSTRING : (XString)s1.substring(index + s2.length()); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FunctionDef1Arg.java0000644000175000017500000001276110721374031025022 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionDef1Arg.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XString; import org.apache.xpath.res.XPATHErrorResources; /** * Base class for functions that accept one argument that can be defaulted if * not specified. * @xsl.usage advanced */ public class FunctionDef1Arg extends FunctionOneArg { static final long serialVersionUID = 2325189412814149264L; /** * Execute the first argument expression that is expected to return a * nodeset. If the argument is null, then return the current context node. * * @param xctxt Runtime XPath context. * * @return The first node of the executed nodeset, or the current context * node if the first argument is null. * * @throws javax.xml.transform.TransformerException if an error occurs while * executing the argument expression. */ protected int getArg0AsNode(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (null == m_arg0) ? xctxt.getCurrentNode() : m_arg0.asNode(xctxt); } /** * Tell if the expression is a nodeset expression. * @return true if the expression can be represented as a nodeset. */ public boolean Arg0IsNodesetExpr() { return (null == m_arg0) ? true : m_arg0.isNodesetExpr(); } /** * Execute the first argument expression that is expected to return a * string. If the argument is null, then get the string value from the * current context node. * * @param xctxt Runtime XPath context. * * @return The string value of the first argument, or the string value of the * current context node if the first argument is null. * * @throws javax.xml.transform.TransformerException if an error occurs while * executing the argument expression. */ protected XMLString getArg0AsString(XPathContext xctxt) throws javax.xml.transform.TransformerException { if(null == m_arg0) { int currentNode = xctxt.getCurrentNode(); if(DTM.NULL == currentNode) return XString.EMPTYSTRING; else { DTM dtm = xctxt.getDTM(currentNode); return dtm.getStringValue(currentNode); } } else return m_arg0.execute(xctxt).xstr(); } /** * Execute the first argument expression that is expected to return a * number. If the argument is null, then get the number value from the * current context node. * * @param xctxt Runtime XPath context. * * @return The number value of the first argument, or the number value of the * current context node if the first argument is null. * * @throws javax.xml.transform.TransformerException if an error occurs while * executing the argument expression. */ protected double getArg0AsNumber(XPathContext xctxt) throws javax.xml.transform.TransformerException { if(null == m_arg0) { int currentNode = xctxt.getCurrentNode(); if(DTM.NULL == currentNode) return 0; else { DTM dtm = xctxt.getDTM(currentNode); XMLString str = dtm.getStringValue(currentNode); return str.toDouble(); } } else return m_arg0.execute(xctxt).num(); } /** * Check that the number of arguments passed to this function is correct. * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException if the number of arguments is not 0 or 1. */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum > 1) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_ZERO_OR_ONE, null)); //"0 or 1"); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return (null == m_arg0) ? false : super.canTraverseOutsideSubtree(); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncConcat.java0000644000175000017500000000537610721374032024133 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncConcat.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the Concat() function. * @xsl.usage advanced */ public class FuncConcat extends FunctionMultiArgs { static final long serialVersionUID = 1737228885202314413L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { StringBuffer sb = new StringBuffer(); // Compiler says we must have at least two arguments. sb.append(m_arg0.execute(xctxt).str()); sb.append(m_arg1.execute(xctxt).str()); if (null != m_arg2) sb.append(m_arg2.execute(xctxt).str()); if (null != m_args) { for (int i = 0; i < m_args.length; i++) { sb.append(m_args[i].execute(xctxt).str()); } } return new XString(sb.toString()); } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum < 2) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("gtone", null)); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncNumber.java0000644000175000017500000000314010721374031024136 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncNumber.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Number() function. * @xsl.usage advanced */ public class FuncNumber extends FunctionDef1Arg { static final long serialVersionUID = 7266745342264153076L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return new XNumber(getArg0AsNumber(xctxt)); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/SecuritySupport12.java0000644000175000017500000001176110721374032025452 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncFalse.java0000644000175000017500000000335310721374032023747 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncFalse.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the False() function. * @xsl.usage advanced */ public class FuncFalse extends Function { static final long serialVersionUID = 6150918062759769887L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return XBoolean.S_FALSE; } /** * No arguments to process, so this does nothing. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncSystemProperty.java0000644000175000017500000001342710721374031025750 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncSystemProperty.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import java.io.BufferedInputStream; import java.io.InputStream; import java.util.Properties; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; import org.apache.xpath.res.XPATHErrorResources; /** * Execute the SystemProperty() function. * @xsl.usage advanced */ public class FuncSystemProperty extends FunctionOneArg { static final long serialVersionUID = 3694874980992204867L; /** * The path/filename of the property file: XSLTInfo.properties * Maintenance note: see also * org.apache.xalan.processor.TransformerFactoryImpl.XSLT_PROPERTIES */ static final String XSLT_PROPERTIES = "org/apache/xalan/res/XSLTInfo.properties"; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String fullName = m_arg0.execute(xctxt).str(); int indexOfNSSep = fullName.indexOf(':'); String result; String propName = ""; // List of properties where the name of the // property argument is to be looked for. Properties xsltInfo = new Properties(); loadPropertyFile(XSLT_PROPERTIES, xsltInfo); if (indexOfNSSep > 0) { String prefix = (indexOfNSSep >= 0) ? fullName.substring(0, indexOfNSSep) : ""; String namespace; namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix); propName = (indexOfNSSep < 0) ? fullName : fullName.substring(indexOfNSSep + 1); if (namespace.startsWith("http://www.w3.org/XSL/Transform") || namespace.equals("http://www.w3.org/1999/XSL/Transform")) { result = xsltInfo.getProperty(propName); if (null == result) { warn(xctxt, XPATHErrorResources.WG_PROPERTY_NOT_SUPPORTED, new Object[]{ fullName }); //"XSL Property not supported: "+fullName); return XString.EMPTYSTRING; } } else { warn(xctxt, XPATHErrorResources.WG_DONT_DO_ANYTHING_WITH_NS, new Object[]{ namespace, fullName }); //"Don't currently do anything with namespace "+namespace+" in property: "+fullName); try { result = System.getProperty(propName); if (null == result) { // result = System.getenv(propName); return XString.EMPTYSTRING; } } catch (SecurityException se) { warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION, new Object[]{ fullName }); //"SecurityException when trying to access XSL system property: "+fullName); return XString.EMPTYSTRING; } } } else { try { result = System.getProperty(fullName); if (null == result) { // result = System.getenv(fullName); return XString.EMPTYSTRING; } } catch (SecurityException se) { warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION, new Object[]{ fullName }); //"SecurityException when trying to access XSL system property: "+fullName); return XString.EMPTYSTRING; } } if (propName.equals("version") && result.length() > 0) { try { // Needs to return the version number of the spec we conform to. return new XString("1.0"); } catch (Exception ex) { return new XString(result); } } else return new XString(result); } /** * Retrieve a propery bundle from a specified file * * @param file The string name of the property file. The name * should already be fully qualified as path/filename * @param target The target property bag the file will be placed into. */ public void loadPropertyFile(String file, Properties target) { try { // Use SecuritySupport class to provide priveleged access to property file SecuritySupport ss = SecuritySupport.getInstance(); InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), file); // get a buffered version BufferedInputStream bis = new BufferedInputStream(is); target.load(bis); // and load up the property bag from this bis.close(); // close out after reading } catch (Exception ex) { // ex.printStackTrace(); throw new org.apache.xml.utils.WrappedRuntimeException(ex); } } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncString.java0000644000175000017500000000313510721374031024160 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncString.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the String() function. * @xsl.usage advanced */ public class FuncString extends FunctionDef1Arg { static final long serialVersionUID = -2206677149497712883L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (XString)getArg0AsString(xctxt); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncBoolean.java0000644000175000017500000000320510721374031024267 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncBoolean.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the Boolean() function. * @xsl.usage advanced */ public class FuncBoolean extends FunctionOneArg { static final long serialVersionUID = 4328660760070034592L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncId.java0000644000175000017500000001101510721374031023242 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncId.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import java.util.StringTokenizer; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.StringVector; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; /** * Execute the Id() function. * @xsl.usage advanced */ public class FuncId extends FunctionOneArg { static final long serialVersionUID = 8930573966143567310L; /** * Fill in a list with nodes that match a space delimited list if ID * ID references. * * @param xctxt The runtime XPath context. * @param docContext The document where the nodes are being looked for. * @param refval A space delimited list of ID references. * @param usedrefs List of references for which nodes were found. * @param nodeSet Node set where the nodes will be added to. * @param mayBeMore true if there is another set of nodes to be looked for. * * @return The usedrefs value. */ private StringVector getNodesByID(XPathContext xctxt, int docContext, String refval, StringVector usedrefs, NodeSetDTM nodeSet, boolean mayBeMore) { if (null != refval) { String ref = null; // DOMHelper dh = xctxt.getDOMHelper(); StringTokenizer tokenizer = new StringTokenizer(refval); boolean hasMore = tokenizer.hasMoreTokens(); DTM dtm = xctxt.getDTM(docContext); while (hasMore) { ref = tokenizer.nextToken(); hasMore = tokenizer.hasMoreTokens(); if ((null != usedrefs) && usedrefs.contains(ref)) { ref = null; continue; } int node = dtm.getElementById(ref); if (DTM.NULL != node) nodeSet.addNodeInDocOrder(node, xctxt); if ((null != ref) && (hasMore || mayBeMore)) { if (null == usedrefs) usedrefs = new StringVector(); usedrefs.addElement(ref); } } } return usedrefs; } /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int docContext = dtm.getDocument(); if (DTM.NULL == docContext) error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null); XObject arg = m_arg0.execute(xctxt); int argType = arg.getType(); XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); if (XObject.CLASS_NODESET == argType) { DTMIterator ni = arg.iter(); StringVector usedrefs = null; int pos = ni.nextNode(); while (DTM.NULL != pos) { DTM ndtm = ni.getDTM(pos); String refval = ndtm.getStringValue(pos).toString(); pos = ni.nextNode(); usedrefs = getNodesByID(xctxt, docContext, refval, usedrefs, nodeSet, DTM.NULL != pos); } // ni.detach(); } else if (XObject.CLASS_NULL == argType) { return nodes; } else { String refval = arg.str(); getNodesByID(xctxt, docContext, refval, null, nodeSet, false); } return nodes; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncQname.java0000644000175000017500000000364710721374032023764 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncQname.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the Qname() function. * @xsl.usage advanced */ public class FuncQname extends FunctionDef1Arg { static final long serialVersionUID = -1532307875532617380L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int context = getArg0AsNode(xctxt); XObject val; if (DTM.NULL != context) { DTM dtm = xctxt.getDTM(context); String qname = dtm.getNodeNameX(context); val = (null == qname) ? XString.EMPTYSTRING : new XString(qname); } else { val = XString.EMPTYSTRING; } return val; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/Function3Args.java0000644000175000017500000001221210721374033024561 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Function3Args.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; /** * Base class for functions that accept three arguments. * @xsl.usage advanced */ public class Function3Args extends Function2Args { static final long serialVersionUID = 7915240747161506646L; /** The third argument passed to the function (at index 2). * @serial */ Expression m_arg2; /** * Return the third argument passed to the function (at index 2). * * @return An expression that represents the third argument passed to the * function. */ public Expression getArg2() { return m_arg2; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if(null != m_arg2) m_arg2.fixupVariables(vars, globalsSize); } /** * Set an argument expression for a function. This method is called by the * XPath compiler. * * @param arg non-null expression that represents the argument. * @param argNum The argument number index. * * @throws WrongNumberArgsException If the argNum parameter is greater than 2. */ public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (argNum < 2) super.setArg(arg, argNum); else if (2 == argNum) { m_arg2 = arg; arg.exprSetParent(this); } else reportWrongNumberArgs(); } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum != 3) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("three", null)); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return super.canTraverseOutsideSubtree() ? true : m_arg2.canTraverseOutsideSubtree(); } class Arg2Owner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_arg2; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(Function3Args.this); m_arg2 = exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callArgVisitors(XPathVisitor visitor) { super.callArgVisitors(visitor); if(null != m_arg2) m_arg2.callVisitors(new Arg2Owner(), visitor); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; if(null != m_arg2) { if(null == ((Function3Args)expr).m_arg2) return false; if(!m_arg2.deepEquals(((Function3Args)expr).m_arg2)) return false; } else if (null != ((Function3Args)expr).m_arg2) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncContains.java0000644000175000017500000000360410721374033024473 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncContains.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the Contains() function. * @xsl.usage advanced */ public class FuncContains extends Function2Args { static final long serialVersionUID = 5084753781887919723L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String s1 = m_arg0.execute(xctxt).str(); String s2 = m_arg1.execute(xctxt).str(); // Add this check for JDK consistency for empty strings. if (s1.length() == 0 && s2.length() == 0) return XBoolean.S_TRUE; int index = s1.indexOf(s2); return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncCount.java0000644000175000017500000000404710721374032024006 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncCount.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Count() function. * @xsl.usage advanced */ public class FuncCount extends FunctionOneArg { static final long serialVersionUID = -7116225100474153751L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { // DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); // // We should probably make a function on the iterator for this, // // as a given implementation could optimize. // int i = 0; // // while (DTM.NULL != nl.nextNode()) // { // i++; // } // nl.detach(); DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); int i = nl.getLength(); nl.detach(); return new XNumber((double) i); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncExtElementAvailable.java0000644000175000017500000000614310721374033026571 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncExtElementAvailable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.templates.Constants; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.apache.xpath.ExtensionsProvider; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the ExtElementAvailable() function. * @xsl.usage advanced */ public class FuncExtElementAvailable extends FunctionOneArg { static final long serialVersionUID = -472533699257968546L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String prefix; String namespace; String methName; String fullName = m_arg0.execute(xctxt).str(); int indexOfNSSep = fullName.indexOf(':'); if (indexOfNSSep < 0) { prefix = ""; namespace = Constants.S_XSLNAMESPACEURL; methName = fullName; } else { prefix = fullName.substring(0, indexOfNSSep); namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix); if (null == namespace) return XBoolean.S_FALSE; methName= fullName.substring(indexOfNSSep + 1); } if (namespace.equals(Constants.S_XSLNAMESPACEURL) || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)) { try { TransformerImpl transformer = (TransformerImpl) xctxt.getOwnerObject(); return transformer.getStylesheet().getAvailableElements().containsKey( new QName(namespace, methName)) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } catch (Exception e) { return XBoolean.S_FALSE; } } else { //dml ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject(); return extProvider.elementAvailable(namespace, methName) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncNormalizeSpace.java0000644000175000017500000000532410721374033025632 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncNormalizeSpace.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; import org.xml.sax.ContentHandler; /** * Execute the normalize-space() function. * @xsl.usage advanced */ public class FuncNormalizeSpace extends FunctionDef1Arg { static final long serialVersionUID = -3377956872032190880L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XMLString s1 = getArg0AsString(xctxt); return (XString)s1.fixWhiteSpace(true, true, false); } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public void executeCharsToContentHandler(XPathContext xctxt, ContentHandler handler) throws javax.xml.transform.TransformerException, org.xml.sax.SAXException { if(Arg0IsNodesetExpr()) { int node = getArg0AsNode(xctxt); if(DTM.NULL != node) { DTM dtm = xctxt.getDTM(node); dtm.dispatchCharactersEvents(node, handler, true); } } else { XObject obj = execute(xctxt); obj.dispatchCharactersEvents(handler); } } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncGenerateId.java0000644000175000017500000000424110721374030024717 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncGenerateId.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the GenerateId() function. * @xsl.usage advanced */ public class FuncGenerateId extends FunctionDef1Arg { static final long serialVersionUID = 973544842091724273L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int which = getArg0AsNode(xctxt); if (DTM.NULL != which) { // Note that this is a different value than in previous releases // of Xalan. It's sensitive to the exact encoding of the node // handle anyway, so fighting to maintain backward compatability // really didn't make sense; it may change again as we continue // to experiment with balancing document and node numbers within // that value. return new XString("N" + Integer.toHexString(which).toUpperCase()); } else return XString.EMPTYSTRING; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncStartsWith.java0000644000175000017500000000327610721374030025033 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncStartsWith.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the StartsWith() function. * @xsl.usage advanced */ public class FuncStartsWith extends Function2Args { static final long serialVersionUID = 2194585774699567928L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_arg0.execute(xctxt).xstr().startsWith(m_arg1.execute(xctxt).xstr()) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncRound.java0000644000175000017500000000355410721374031024006 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncRound.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the round() function. * @xsl.usage advanced */ public class FuncRound extends FunctionOneArg { static final long serialVersionUID = -7970583902573826611L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { final XObject obj = m_arg0.execute(xctxt); final double val= obj.num(); if (val >= -0.5 && val < 0) return new XNumber(-0.0); if (val == 0.0) return new XNumber(val); return new XNumber(java.lang.Math.floor(val + 0.5)); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncTranslate.java0000644000175000017500000000562410721374031024654 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncTranslate.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the Translate() function. * @xsl.usage advanced */ public class FuncTranslate extends Function3Args { static final long serialVersionUID = -1672834340026116482L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String theFirstString = m_arg0.execute(xctxt).str(); String theSecondString = m_arg1.execute(xctxt).str(); String theThirdString = m_arg2.execute(xctxt).str(); int theFirstStringLength = theFirstString.length(); int theThirdStringLength = theThirdString.length(); // A vector to contain the new characters. We'll use it to construct // the result string. StringBuffer sbuffer = new StringBuffer(); for (int i = 0; i < theFirstStringLength; i++) { char theCurrentChar = theFirstString.charAt(i); int theIndex = theSecondString.indexOf(theCurrentChar); if (theIndex < 0) { // Didn't find the character in the second string, so it // is not translated. sbuffer.append(theCurrentChar); } else if (theIndex < theThirdStringLength) { // OK, there's a corresponding character in the // third string, so do the translation... sbuffer.append(theThirdString.charAt(theIndex)); } else { // There's no corresponding character in the // third string, since it's shorter than the // second string. In this case, the character // is removed from the output string, so don't // do anything. } } return new XString(sbuffer.toString()); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/Function.java0000644000175000017500000001124010721374032023660 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Function.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.objects.XObject; /** * This is a superclass of all XPath functions. This allows two * ways for the class to be called. One method is that the * super class processes the arguments and hands the results to * the derived class, the other method is that the derived * class may process it's own arguments, which is faster since * the arguments don't have to be added to an array, but causes * a larger code footprint. * @xsl.usage advanced */ public abstract class Function extends Expression { static final long serialVersionUID = 6927661240854599768L; /** * Set an argument expression for a function. This method is called by the * XPath compiler. * * @param arg non-null expression that represents the argument. * @param argNum The argument number index. * * @throws WrongNumberArgsException If the argNum parameter is beyond what * is specified for this function. */ public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { // throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("zero", null)); reportWrongNumberArgs(); } /** * Check that the number of arguments passed to this function is correct. * This method is meant to be overloaded by derived classes, to check for * the number of arguments for a specific function type. This method is * called by the compiler for static number of arguments checking. * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum != 0) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. This method is meant to be overloaded * by derived classes so that the message will be as specific as possible. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("zero", null)); } /** * Execute an XPath function object. The function must return * a valid object. * @param xctxt The execution current context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { // Programmer's assert. (And, no, I don't want the method to be abstract). System.out.println("Error! Function.execute should not be called!"); return null; } /** * Call the visitors for the function arguments. */ public void callArgVisitors(XPathVisitor visitor) { } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitFunction(owner, this)) { callArgVisitors(visitor); } } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; return true; } /** * This function is currently only being used by Position() * and Last(). See respective functions for more detail. */ public void postCompileStep(Compiler compiler) { // no default action } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncCurrent.java0000644000175000017500000000552510721374032024342 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncCurrent.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.LocPathIterator; import org.apache.xpath.axes.PredicatedNodeTest; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; import org.apache.xpath.axes.SubContextList; import org.apache.xpath.patterns.StepPattern; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; /** * Execute the current() function. * @xsl.usage advanced */ public class FuncCurrent extends Function { static final long serialVersionUID = 5715316804877715008L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { SubContextList subContextList = xctxt.getCurrentNodeList(); int currentNode = DTM.NULL; if (null != subContextList) { if (subContextList instanceof PredicatedNodeTest) { LocPathIterator iter = ((PredicatedNodeTest)subContextList) .getLocPathIterator(); currentNode = iter.getCurrentContextNode(); } else if(subContextList instanceof StepPattern) { throw new RuntimeException(XSLMessages.createMessage( XSLTErrorResources.ER_PROCESSOR_ERROR,null)); } } else { // not predicate => ContextNode == CurrentNode currentNode = xctxt.getContextNode(); } return new XNodeSet(currentNode, xctxt.getDTMManager()); } /** * No arguments to process, so this does nothing. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncLast.java0000644000175000017500000000625410721374031023622 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncLast.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.SubContextList; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Last() function. * @xsl.usage advanced */ public class FuncLast extends Function { static final long serialVersionUID = 9205812403085432943L; private boolean m_isTopLevel; /** * Figure out if we're executing a toplevel expression. * If so, we can't be inside of a predicate. */ public void postCompileStep(Compiler compiler) { m_isTopLevel = compiler.getLocationPathDepth() == -1; } /** * Get the position in the current context node list. * * @param xctxt non-null reference to XPath runtime context. * * @return The number of nodes in the list. * * @throws javax.xml.transform.TransformerException */ public int getCountOfContextNodeList(XPathContext xctxt) throws javax.xml.transform.TransformerException { // assert(null != m_contextNodeList, "m_contextNodeList must be non-null"); // If we're in a predicate, then this will return non-null. SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList(); // System.out.println("iter: "+iter); if (null != iter) return iter.getLastPos(xctxt); DTMIterator cnl = xctxt.getContextNodeList(); int count; if(null != cnl) { count = cnl.getLength(); // System.out.println("count: "+count); } else count = 0; return count; } /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XNumber xnum = new XNumber((double) getCountOfContextNodeList(xctxt)); // System.out.println("last: "+xnum.num()); return xnum; } /** * No arguments to process, so this does nothing. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncCeiling.java0000644000175000017500000000316310721374033024267 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncCeiling.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Ceiling() function. * @xsl.usage advanced */ public class FuncCeiling extends FunctionOneArg { static final long serialVersionUID = -1275988936390464739L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return new XNumber(Math.ceil(m_arg0.execute(xctxt).num())); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncFloor.java0000644000175000017500000000316710721374030023777 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncFloor.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Floor() function. * @xsl.usage advanced */ public class FuncFloor extends FunctionOneArg { static final long serialVersionUID = 2326752233236309265L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return new XNumber(java.lang.Math.floor(m_arg0.execute(xctxt).num())); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncTrue.java0000644000175000017500000000334710721374030023635 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncTrue.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the True() function. * @xsl.usage advanced */ public class FuncTrue extends Function { static final long serialVersionUID = 5663314547346339447L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return XBoolean.S_TRUE; } /** * No arguments to process, so this does nothing. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/package.html0000644000175000017500000000240110721374030023506 0ustar mkochmkoch XPath functions Package.

    Implements XPath functions -- each function is derived from Function, FunctionOneArg, Function2Args, etc, with number-of-arguments checking being applied mainly at compile time -- this package only implements XPath functions, XSLT functions are found in the "templates" package.

    libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncSum.java0000644000175000017500000000400710721374031023455 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncSum.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Sum() function. * @xsl.usage advanced */ public class FuncSum extends FunctionOneArg { static final long serialVersionUID = -2719049259574677519L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { DTMIterator nodes = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); double sum = 0.0; int pos; while (DTM.NULL != (pos = nodes.nextNode())) { DTM dtm = nodes.getDTM(pos); XMLString s = dtm.getStringValue(pos); if (null != s) sum += s.toDouble(); } nodes.detach(); return new XNumber(sum); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncSubstringBefore.java0000644000175000017500000000345410721374031026021 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncSubstringBefore.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the SubstringBefore() function. * @xsl.usage advanced */ public class FuncSubstringBefore extends Function2Args { static final long serialVersionUID = 4110547161672431775L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String s1 = m_arg0.execute(xctxt).str(); String s2 = m_arg1.execute(xctxt).str(); int index = s1.indexOf(s2); return (-1 == index) ? XString.EMPTYSTRING : new XString(s1.substring(0, index)); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncNot.java0000644000175000017500000000316510721374031023455 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncNot.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XObject; /** * Execute the Not() function. * @xsl.usage advanced */ public class FuncNot extends FunctionOneArg { static final long serialVersionUID = 7299699961076329790L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_arg0.execute(xctxt).bool() ? XBoolean.S_FALSE : XBoolean.S_TRUE; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncDoclocation.java0000644000175000017500000000443010721374032025150 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncDoclocation.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the proprietary document-location() function, which returns * a node set of documents. * @xsl.usage advanced */ public class FuncDoclocation extends FunctionDef1Arg { static final long serialVersionUID = 7469213946343568769L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int whereNode = getArg0AsNode(xctxt); String fileLocation = null; if (DTM.NULL != whereNode) { DTM dtm = xctxt.getDTM(whereNode); // %REVIEW% if (DTM.DOCUMENT_FRAGMENT_NODE == dtm.getNodeType(whereNode)) { whereNode = dtm.getFirstChild(whereNode); } if (DTM.NULL != whereNode) { fileLocation = dtm.getDocumentBaseURI(); // int owner = dtm.getDocument(); // fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner); } } return new XString((null != fileLocation) ? fileLocation : ""); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncNamespace.java0000644000175000017500000000464210721374032024613 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncNamespace.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the Namespace() function. * @xsl.usage advanced */ public class FuncNamespace extends FunctionDef1Arg { static final long serialVersionUID = -4695674566722321237L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int context = getArg0AsNode(xctxt); String s; if(context != DTM.NULL) { DTM dtm = xctxt.getDTM(context); int t = dtm.getNodeType(context); if(t == DTM.ELEMENT_NODE) { s = dtm.getNamespaceURI(context); } else if(t == DTM.ATTRIBUTE_NODE) { // This function always returns an empty string for namespace nodes. // We check for those here. Fix inspired by Davanum Srinivas. s = dtm.getNodeName(context); if(s.startsWith("xmlns:") || s.equals("xmlns")) return XString.EMPTYSTRING; s = dtm.getNamespaceURI(context); } else return XString.EMPTYSTRING; } else return XString.EMPTYSTRING; return ((null == s) ? XString.EMPTYSTRING : new XString(s)); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FunctionOneArg.java0000644000175000017500000001156410721374032024765 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionOneArg.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; /** * Base class for functions that accept one argument. * @xsl.usage advanced */ public class FunctionOneArg extends Function implements ExpressionOwner { static final long serialVersionUID = -5180174180765609758L; /** The first argument passed to the function (at index 0). * @serial */ Expression m_arg0; /** * Return the first argument passed to the function (at index 0). * * @return An expression that represents the first argument passed to the * function. */ public Expression getArg0() { return m_arg0; } /** * Set an argument expression for a function. This method is called by the * XPath compiler. * * @param arg non-null expression that represents the argument. * @param argNum The argument number index. * * @throws WrongNumberArgsException If the argNum parameter is greater than 0. */ public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (0 == argNum) { m_arg0 = arg; arg.exprSetParent(this); } else reportWrongNumberArgs(); } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum != 1) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("one", null)); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return m_arg0.canTraverseOutsideSubtree(); } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { if(null != m_arg0) m_arg0.fixupVariables(vars, globalsSize); } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callArgVisitors(XPathVisitor visitor) { if(null != m_arg0) m_arg0.callVisitors(this, visitor); } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_arg0; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_arg0 = exp; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; if(null != m_arg0) { if(null == ((FunctionOneArg)expr).m_arg0) return false; if(!m_arg0.deepEquals(((FunctionOneArg)expr).m_arg0)) return false; } else if(null != ((FunctionOneArg)expr).m_arg0) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncStringLength.java0000644000175000017500000000317310721374033025326 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncStringLength.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the StringLength() function. * @xsl.usage advanced */ public class FuncStringLength extends FunctionDef1Arg { static final long serialVersionUID = -159616417996519839L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return new XNumber(getArg0AsString(xctxt).length()); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncExtFunction.java0000644000175000017500000002273210721374031025164 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncExtFunction.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import java.util.Vector; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionNode; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.ExtensionsProvider; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XNull; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; import org.apache.xpath.res.XPATHMessages; /** * An object of this class represents an extension call expression. When * the expression executes, it calls ExtensionsTable#extFunction, and then * converts the result to the appropriate XObject. * @xsl.usage advanced */ public class FuncExtFunction extends Function { static final long serialVersionUID = 5196115554693708718L; /** * The namespace for the extension function, which should not normally * be null or empty. * @serial */ String m_namespace; /** * The local name of the extension. * @serial */ String m_extensionName; /** * Unique method key, which is passed to ExtensionsTable#extFunction in * order to allow caching of the method. * @serial */ Object m_methodKey; /** * Array of static expressions which represent the parameters to the * function. * @serial */ Vector m_argVec = new Vector(); /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). * NEEDSDOC @param globalsSize */ public void fixupVariables(java.util.Vector vars, int globalsSize) { if (null != m_argVec) { int nArgs = m_argVec.size(); for (int i = 0; i < nArgs; i++) { Expression arg = (Expression) m_argVec.elementAt(i); arg.fixupVariables(vars, globalsSize); } } } /** * Return the namespace of the extension function. * * @return The namespace of the extension function. */ public String getNamespace() { return m_namespace; } /** * Return the name of the extension function. * * @return The name of the extension function. */ public String getFunctionName() { return m_extensionName; } /** * Return the method key of the extension function. * * @return The method key of the extension function. */ public Object getMethodKey() { return m_methodKey; } /** * Return the nth argument passed to the extension function. * * @param n The argument number index. * @return The Expression object at the given index. */ public Expression getArg(int n) { if (n >= 0 && n < m_argVec.size()) return (Expression) m_argVec.elementAt(n); else return null; } /** * Return the number of arguments that were passed * into this extension function. * * @return The number of arguments. */ public int getArgCount() { return m_argVec.size(); } /** * Create a new FuncExtFunction based on the qualified name of the extension, * and a unique method key. * * @param namespace The namespace for the extension function, which should * not normally be null or empty. * @param extensionName The local name of the extension. * @param methodKey Unique method key, which is passed to * ExtensionsTable#extFunction in order to allow caching * of the method. */ public FuncExtFunction(java.lang.String namespace, java.lang.String extensionName, Object methodKey) { //try{throw new Exception("FuncExtFunction() " + namespace + " " + extensionName);} catch (Exception e){e.printStackTrace();} m_namespace = namespace; m_extensionName = extensionName; m_methodKey = methodKey; } /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { if (xctxt.isSecureProcessing()) throw new javax.xml.transform.TransformerException( XPATHMessages.createXPATHMessage( XPATHErrorResources.ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, new Object[] {toString()})); XObject result; Vector argVec = new Vector(); int nArgs = m_argVec.size(); for (int i = 0; i < nArgs; i++) { Expression arg = (Expression) m_argVec.elementAt(i); XObject xobj = arg.execute(xctxt); /* * Should cache the arguments for func:function */ xobj.allowDetachToRelease(false); argVec.addElement(xobj); } //dml ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject(); Object val = extProvider.extFunction(this, argVec); if (null != val) { result = XObject.create(val, xctxt); } else { result = new XNull(); } return result; } /** * Set an argument expression for a function. This method is called by the * XPath compiler. * * @param arg non-null expression that represents the argument. * @param argNum The argument number index. * * @throws WrongNumberArgsException If the argNum parameter is beyond what * is specified for this function. */ public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { m_argVec.addElement(arg); arg.exprSetParent(this); } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException{} class ArgExtOwner implements ExpressionOwner { Expression m_exp; ArgExtOwner(Expression exp) { m_exp = exp; } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_exp; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(FuncExtFunction.this); m_exp = exp; } } /** * Call the visitors for the function arguments. */ public void callArgVisitors(XPathVisitor visitor) { for (int i = 0; i < m_argVec.size(); i++) { Expression exp = (Expression)m_argVec.elementAt(i); exp.callVisitors(new ArgExtOwner(exp), visitor); } } /** * Set the parent node. * For an extension function, we also need to set the parent * node for all argument expressions. * * @param n The parent node */ public void exprSetParent(ExpressionNode n) { super.exprSetParent(n); int nArgs = m_argVec.size(); for (int i = 0; i < nArgs; i++) { Expression arg = (Expression) m_argVec.elementAt(i); arg.exprSetParent(n); } } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. This class supports an arbitrary * number of arguments, so this method must never be called. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ "Programmer's assertion: the method FunctionMultiArgs.reportWrongNumberArgs() should never be called." }); throw new RuntimeException(fMsg); } /** * Return the name of the extesion function in string format */ public String toString() { if (m_namespace != null && m_namespace.length() > 0) return "{" + m_namespace + "}" + m_extensionName; else return m_extensionName; } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncUnparsedEntityURI.java0000644000175000017500000000347510721374032026260 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncUnparsedEntityURI.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * @xsl.usage advanced */ public class FuncUnparsedEntityURI extends FunctionOneArg { static final long serialVersionUID = 845309759097448178L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String name = m_arg0.execute(xctxt).str(); int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int doc = dtm.getDocument(); String uri = dtm.getUnparsedEntityURI(name); return new XString(uri); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/ObjectFactory.java0000644000175000017500000006376510721374030024652 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

    * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

    * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468655 2006-10-28 07:12:06Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

      *
    1. query the system property using System.getProperty *
    2. read META-INF/services/factoryId file *
    3. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -5782303800588797207L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncSubstring.java0000644000175000017500000000715310721374030024675 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncSubstring.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; import org.apache.xpath.res.XPATHErrorResources; /** * Execute the Substring() function. * @xsl.usage advanced */ public class FuncSubstring extends Function3Args { static final long serialVersionUID = -5996676095024715502L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XMLString s1 = m_arg0.execute(xctxt).xstr(); double start = m_arg1.execute(xctxt).num(); int lenOfS1 = s1.length(); XMLString substr; if (lenOfS1 <= 0) return XString.EMPTYSTRING; else { int startIndex; if (Double.isNaN(start)) { // Double.MIN_VALUE doesn't work with math below // so just use a big number and hope I never get caught. start = -1000000; startIndex = 0; } else { start = Math.round(start); startIndex = (start > 0) ? (int) start - 1 : 0; } if (null != m_arg2) { double len = m_arg2.num(xctxt); int end = (int) (Math.round(len) + start) - 1; // Normalize end index. if (end < 0) end = 0; else if (end > lenOfS1) end = lenOfS1; if (startIndex > lenOfS1) startIndex = lenOfS1; substr = s1.substring(startIndex, end); } else { if (startIndex > lenOfS1) startIndex = lenOfS1; substr = s1.substring(startIndex); } } return (XString)substr; // cast semi-safe } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if (argNum < 2) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_TWO_OR_THREE, null)); //"2 or 3"); } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FuncPosition.java0000644000175000017500000001030110721374032024510 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncPosition.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.SubContextList; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Execute the Position() function. * @xsl.usage advanced */ public class FuncPosition extends Function { static final long serialVersionUID = -9092846348197271582L; private boolean m_isTopLevel; /** * Figure out if we're executing a toplevel expression. * If so, we can't be inside of a predicate. */ public void postCompileStep(Compiler compiler) { m_isTopLevel = compiler.getLocationPathDepth() == -1; } /** * Get the position in the current context node list. * * @param xctxt Runtime XPath context. * * @return The current position of the itteration in the context node list, * or -1 if there is no active context node list. */ public int getPositionInContextNodeList(XPathContext xctxt) { // System.out.println("FuncPosition- entry"); // If we're in a predicate, then this will return non-null. SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList(); if (null != iter) { int prox = iter.getProximityPosition(xctxt); // System.out.println("FuncPosition- prox: "+prox); return prox; } DTMIterator cnl = xctxt.getContextNodeList(); if (null != cnl) { int n = cnl.getCurrentNode(); if(n == DTM.NULL) { if(cnl.getCurrentPos() == 0) return 0; // Then I think we're in a sort. See sort21.xsl. So the iterator has // already been spent, and is not on the node we're processing. // It's highly possible that this is an issue for other context-list // functions. Shouldn't be a problem for last(), and it shouldn't be // a problem for current(). try { cnl = cnl.cloneWithReset(); } catch(CloneNotSupportedException cnse) { throw new org.apache.xml.utils.WrappedRuntimeException(cnse); } int currentNode = xctxt.getContextNode(); // System.out.println("currentNode: "+currentNode); while(DTM.NULL != (n = cnl.nextNode())) { if(n == currentNode) break; } } // System.out.println("n: "+n); // System.out.println("FuncPosition- cnl.getCurrentPos(): "+cnl.getCurrentPos()); return cnl.getCurrentPos(); } // System.out.println("FuncPosition - out of guesses: -1"); return -1; } /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { double pos = (double) getPositionInContextNodeList(xctxt); return new XNumber(pos); } /** * No arguments to process, so this does nothing. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } } libxalan2-java-2.7.1/src/org/apache/xpath/functions/FunctionMultiArgs.java0000644000175000017500000001474410721374031025523 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionMultiArgs.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.functions; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.res.XPATHErrorResources; /** * Base class for functions that accept an undetermined number of multiple * arguments. * @xsl.usage advanced */ public class FunctionMultiArgs extends Function3Args { static final long serialVersionUID = 7117257746138417181L; /** Argument expressions that are at index 3 or greater. * @serial */ Expression[] m_args; /** * Return an expression array containing arguments at index 3 or greater. * * @return An array that contains the arguments at index 3 or greater. */ public Expression[] getArgs() { return m_args; } /** * Set an argument expression for a function. This method is called by the * XPath compiler. * * @param arg non-null expression that represents the argument. * @param argNum The argument number index. * * @throws WrongNumberArgsException If a derived class determines that the * number of arguments is incorrect. */ public void setArg(Expression arg, int argNum) throws WrongNumberArgsException { if (argNum < 3) super.setArg(arg, argNum); else { if (null == m_args) { m_args = new Expression[1]; m_args[0] = arg; } else { // Slow but space conservative. Expression[] args = new Expression[m_args.length + 1]; System.arraycopy(m_args, 0, args, 0, m_args.length); args[m_args.length] = arg; m_args = args; } arg.exprSetParent(this); } } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if(null != m_args) { for (int i = 0; i < m_args.length; i++) { m_args[i].fixupVariables(vars, globalsSize); } } } /** * Check that the number of arguments passed to this function is correct. * * * @param argNum The number of arguments that is being passed to the function. * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException{} /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. This class supports an arbitrary * number of arguments, so this method must never be called. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ "Programmer's assertion: the method FunctionMultiArgs.reportWrongNumberArgs() should never be called." }); throw new RuntimeException(fMsg); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { if (super.canTraverseOutsideSubtree()) return true; else { int n = m_args.length; for (int i = 0; i < n; i++) { if (m_args[i].canTraverseOutsideSubtree()) return true; } return false; } } class ArgMultiOwner implements ExpressionOwner { int m_argIndex; ArgMultiOwner(int index) { m_argIndex = index; } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_args[m_argIndex]; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(FunctionMultiArgs.this); m_args[m_argIndex] = exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callArgVisitors(XPathVisitor visitor) { super.callArgVisitors(visitor); if (null != m_args) { int n = m_args.length; for (int i = 0; i < n; i++) { m_args[i].callVisitors(new ArgMultiOwner(i), visitor); } } } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; FunctionMultiArgs fma = (FunctionMultiArgs) expr; if (null != m_args) { int n = m_args.length; if ((null == fma) || (fma.m_args.length != n)) return false; for (int i = 0; i < n; i++) { if (!m_args[i].deepEquals(fma.m_args[i])) return false; } } else if (null != fma.m_args) { return false; } return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/XPath.java0000644000175000017500000004757510721374030021131 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPath.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import java.io.Serializable; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.FunctionTable; import org.apache.xpath.compiler.XPathParser; import org.apache.xpath.functions.Function; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; /** * The XPath class wraps an expression object and provides general services * for execution of that expression. * @xsl.usage advanced */ public class XPath implements Serializable, ExpressionOwner { static final long serialVersionUID = 3976493477939110553L; /** The top of the expression tree. * @serial */ private Expression m_mainExp; /** * The function table for xpath build-in functions */ private transient FunctionTable m_funcTable = null; /** * initial the function table */ private void initFunctionTable(){ m_funcTable = new FunctionTable(); } /** * Get the raw Expression object that this class wraps. * * * @return the raw Expression object, which should not normally be null. */ public Expression getExpression() { return m_mainExp; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_mainExp.fixupVariables(vars, globalsSize); } /** * Set the raw expression object for this object. * * * @param exp the raw Expression object, which should not normally be null. */ public void setExpression(Expression exp) { if(null != m_mainExp) exp.exprSetParent(m_mainExp.exprGetParent()); // a bit bogus m_mainExp = exp; } /** * Get the SourceLocator on the expression object. * * * @return the SourceLocator on the expression object, which may be null. */ public SourceLocator getLocator() { return m_mainExp; } // /** // * Set the SourceLocator on the expression object. // * // * // * @param l the SourceLocator on the expression object, which may be null. // */ // public void setLocator(SourceLocator l) // { // // Note potential hazards -- l may not be serializable, or may be changed // // after being assigned here. // m_mainExp.setSourceLocator(l); // } /** The pattern string, mainly kept around for diagnostic purposes. * @serial */ String m_patternString; /** * Return the XPath string associated with this object. * * * @return the XPath string associated with this object. */ public String getPatternString() { return m_patternString; } /** Represents a select type expression. */ public static final int SELECT = 0; /** Represents a match type expression. */ public static final int MATCH = 1; /** * Construct an XPath object. * * (Needs review -sc) This method initializes an XPathParser/ * Compiler and compiles the expression. * @param exprString The XPath expression. * @param locator The location of the expression, may be null. * @param prefixResolver A prefix resolver to use to resolve prefixes to * namespace URIs. * @param type one of {@link #SELECT} or {@link #MATCH}. * @param errorListener The error listener, or null if default should be used. * * @throws javax.xml.transform.TransformerException if syntax or other error. */ public XPath( String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type, ErrorListener errorListener) throws javax.xml.transform.TransformerException { initFunctionTable(); if(null == errorListener) errorListener = new org.apache.xml.utils.DefaultErrorHandler(); m_patternString = exprString; XPathParser parser = new XPathParser(errorListener, locator); Compiler compiler = new Compiler(errorListener, locator, m_funcTable); if (SELECT == type) parser.initXPath(compiler, exprString, prefixResolver); else if (MATCH == type) parser.initMatchPattern(compiler, exprString, prefixResolver); else throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); //"Can not deal with XPath type: " + type); // System.out.println("----------------"); Expression expr = compiler.compile(0); // System.out.println("expr: "+expr); this.setExpression(expr); if((null != locator) && locator instanceof ExpressionNode) { expr.exprSetParent((ExpressionNode)locator); } } /** * Construct an XPath object. * * (Needs review -sc) This method initializes an XPathParser/ * Compiler and compiles the expression. * @param exprString The XPath expression. * @param locator The location of the expression, may be null. * @param prefixResolver A prefix resolver to use to resolve prefixes to * namespace URIs. * @param type one of {@link #SELECT} or {@link #MATCH}. * @param errorListener The error listener, or null if default should be used. * * @throws javax.xml.transform.TransformerException if syntax or other error. */ public XPath( String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type, ErrorListener errorListener, FunctionTable aTable) throws javax.xml.transform.TransformerException { m_funcTable = aTable; if(null == errorListener) errorListener = new org.apache.xml.utils.DefaultErrorHandler(); m_patternString = exprString; XPathParser parser = new XPathParser(errorListener, locator); Compiler compiler = new Compiler(errorListener, locator, m_funcTable); if (SELECT == type) parser.initXPath(compiler, exprString, prefixResolver); else if (MATCH == type) parser.initMatchPattern(compiler, exprString, prefixResolver); else throw new RuntimeException(XSLMessages.createXPATHMessage( XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); //"Can not deal with XPath type: " + type); // System.out.println("----------------"); Expression expr = compiler.compile(0); // System.out.println("expr: "+expr); this.setExpression(expr); if((null != locator) && locator instanceof ExpressionNode) { expr.exprSetParent((ExpressionNode)locator); } } /** * Construct an XPath object. * * (Needs review -sc) This method initializes an XPathParser/ * Compiler and compiles the expression. * @param exprString The XPath expression. * @param locator The location of the expression, may be null. * @param prefixResolver A prefix resolver to use to resolve prefixes to * namespace URIs. * @param type one of {@link #SELECT} or {@link #MATCH}. * * @throws javax.xml.transform.TransformerException if syntax or other error. */ public XPath( String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type) throws javax.xml.transform.TransformerException { this(exprString, locator, prefixResolver, type, null); } /** * Construct an XPath object. * * @param expr The Expression object. * * @throws javax.xml.transform.TransformerException if syntax or other error. */ public XPath(Expression expr) { this.setExpression(expr); initFunctionTable(); } /** * Given an expression and a context, evaluate the XPath * and return the result. * * @param xctxt The execution context. * @param contextNode The node that "." expresses. * @param namespaceContext The context in which namespaces in the * XPath are supposed to be expanded. * * @return The result of the XPath or null if callbacks are used. * @throws TransformerException thrown if * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException * @xsl.usage experimental */ public XObject execute( XPathContext xctxt, org.w3c.dom.Node contextNode, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { return execute( xctxt, xctxt.getDTMHandleFromNode(contextNode), namespaceContext); } /** * Given an expression and a context, evaluate the XPath * and return the result. * * @param xctxt The execution context. * @param contextNode The node that "." expresses. * @param namespaceContext The context in which namespaces in the * XPath are supposed to be expanded. * * @throws TransformerException thrown if the active ProblemListener decides * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException * @xsl.usage experimental */ public XObject execute( XPathContext xctxt, int contextNode, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { xctxt.pushNamespaceContext(namespaceContext); xctxt.pushCurrentNodeAndExpression(contextNode, contextNode); XObject xobj = null; try { xobj = m_mainExp.execute(xctxt); } catch (TransformerException te) { te.setLocator(this.getLocator()); ErrorListener el = xctxt.getErrorListener(); if(null != el) // defensive, should never happen. { el.error(te); } else throw te; } catch (Exception e) { while (e instanceof org.apache.xml.utils.WrappedRuntimeException) { e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException(); } // e.printStackTrace(); String msg = e.getMessage(); if (msg == null || msg.length() == 0) { msg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_XPATH_ERROR, null); } TransformerException te = new TransformerException(msg, getLocator(), e); ErrorListener el = xctxt.getErrorListener(); // te.printStackTrace(); if(null != el) // defensive, should never happen. { el.fatalError(te); } else throw te; } finally { xctxt.popNamespaceContext(); xctxt.popCurrentNodeAndExpression(); } return xobj; } /** * Given an expression and a context, evaluate the XPath * and return the result. * * @param xctxt The execution context. * @param contextNode The node that "." expresses. * @param namespaceContext The context in which namespaces in the * XPath are supposed to be expanded. * * @throws TransformerException thrown if the active ProblemListener decides * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException * @xsl.usage experimental */ public boolean bool( XPathContext xctxt, int contextNode, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { xctxt.pushNamespaceContext(namespaceContext); xctxt.pushCurrentNodeAndExpression(contextNode, contextNode); try { return m_mainExp.bool(xctxt); } catch (TransformerException te) { te.setLocator(this.getLocator()); ErrorListener el = xctxt.getErrorListener(); if(null != el) // defensive, should never happen. { el.error(te); } else throw te; } catch (Exception e) { while (e instanceof org.apache.xml.utils.WrappedRuntimeException) { e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException(); } // e.printStackTrace(); String msg = e.getMessage(); if (msg == null || msg.length() == 0) { msg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_XPATH_ERROR, null); } TransformerException te = new TransformerException(msg, getLocator(), e); ErrorListener el = xctxt.getErrorListener(); // te.printStackTrace(); if(null != el) // defensive, should never happen. { el.fatalError(te); } else throw te; } finally { xctxt.popNamespaceContext(); xctxt.popCurrentNodeAndExpression(); } return false; } /** Set to true to get diagnostic messages about the result of * match pattern testing. */ private static final boolean DEBUG_MATCHES = false; /** * Get the match score of the given node. * * @param xctxt XPath runtime context. * @param context The current source tree context node. * * @return score, one of {@link #MATCH_SCORE_NODETEST}, * {@link #MATCH_SCORE_NONE}, {@link #MATCH_SCORE_OTHER}, * or {@link #MATCH_SCORE_QNAME}. * * @throws javax.xml.transform.TransformerException */ public double getMatchScore(XPathContext xctxt, int context) throws javax.xml.transform.TransformerException { xctxt.pushCurrentNode(context); xctxt.pushCurrentExpressionNode(context); try { XObject score = m_mainExp.execute(xctxt); if (DEBUG_MATCHES) { DTM dtm = xctxt.getDTM(context); System.out.println("score: " + score.num() + " for " + dtm.getNodeName(context) + " for xpath " + this.getPatternString()); } return score.num(); } finally { xctxt.popCurrentNode(); xctxt.popCurrentExpressionNode(); } // return XPath.MATCH_SCORE_NONE; } /** * Warn the user of an problem. * * @param xctxt The XPath runtime context. * @param sourceNode Not used. * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void warn( XPathContext xctxt, int sourceNode, String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHWarning(msg, args); ErrorListener ehandler = xctxt.getErrorListener(); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.warning(new TransformerException(fmsg, (SAXSourceLocator)xctxt.getSAXLocator())); } } /** * Tell the user of an assertion error, and probably throw an * exception. * * @param b If false, a runtime exception will be thrown. * @param msg The assertion message, which should be informative. * * @throws RuntimeException if the b argument is false. */ public void assertion(boolean b, String msg) { if (!b) { String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ msg }); throw new RuntimeException(fMsg); } } /** * Tell the user of an error, and probably throw an * exception. * * @param xctxt The XPath runtime context. * @param sourceNode Not used. * @param msg An error msgkey that corresponds to one of the constants found * in {@link org.apache.xpath.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void error( XPathContext xctxt, int sourceNode, String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); ErrorListener ehandler = xctxt.getErrorListener(); if (null != ehandler) { ehandler.fatalError(new TransformerException(fmsg, (SAXSourceLocator)xctxt.getSAXLocator())); } else { SourceLocator slocator = xctxt.getSAXLocator(); System.out.println(fmsg + "; file " + slocator.getSystemId() + "; line " + slocator.getLineNumber() + "; column " + slocator.getColumnNumber()); } } /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param owner The owner of the visitor, where that path may be * rewritten if needed. * @param visitor The visitor whose appropriate method will be called. */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { m_mainExp.callVisitors(this, visitor); } /** * The match score if no match is made. * @xsl.usage advanced */ public static final double MATCH_SCORE_NONE = Double.NEGATIVE_INFINITY; /** * The match score if the pattern has the form * of a QName optionally preceded by an @ character. * @xsl.usage advanced */ public static final double MATCH_SCORE_QNAME = 0.0; /** * The match score if the pattern pattern has the form NCName:*. * @xsl.usage advanced */ public static final double MATCH_SCORE_NSWILD = -0.25; /** * The match score if the pattern consists of just a NodeTest. * @xsl.usage advanced */ public static final double MATCH_SCORE_NODETEST = -0.5; /** * The match score if the pattern consists of something * other than just a NodeTest or just a qname. * @xsl.usage advanced */ public static final double MATCH_SCORE_OTHER = 0.5; } libxalan2-java-2.7.1/src/org/apache/xpath/XPathAPI.java0000644000175000017500000002645410721374032021456 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathAPI.java 524807 2007-04-02 15:51:43Z zongaro $ */ package org.apache.xpath; import javax.xml.transform.TransformerException; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.PrefixResolverDefault; import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** * The methods in this class are convenience methods into the * low-level XPath API. * These functions tend to be a little slow, since a number of objects must be * created for each evaluation. A faster way is to precompile the * XPaths using the low-level API, and then just use the XPaths * over and over. * * NOTE: In particular, each call to this method will create a new * XPathContext, a new DTMManager... and thus a new DTM. That's very * safe, since it guarantees that you're always processing against a * fully up-to-date view of your document. But it's also portentially * very expensive, since you're rebuilding the DTM every time. You should * consider using an instance of CachedXPathAPI rather than these static * methods. * * @see XPath Specification * */ public class XPathAPI { /** * Use an XPath string to select a single node. XPath namespace * prefixes are resolved from the context node, which may not * be what you want (see the next method). * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return The first node found that matches the XPath, or null. * * @throws TransformerException */ public static Node selectSingleNode(Node contextNode, String str) throws TransformerException { return selectSingleNode(contextNode, str, contextNode); } /** * Use an XPath string to select a single node. * XPath namespace prefixes are resolved from the namespaceNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return The first node found that matches the XPath, or null. * * @throws TransformerException */ public static Node selectSingleNode( Node contextNode, String str, Node namespaceNode) throws TransformerException { // Have the XObject return its result as a NodeSetDTM. NodeIterator nl = selectNodeIterator(contextNode, str, namespaceNode); // Return the first node, or null return nl.nextNode(); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeIterator selectNodeIterator(Node contextNode, String str) throws TransformerException { return selectNodeIterator(contextNode, str, contextNode); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the namespaceNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeIterator selectNodeIterator( Node contextNode, String str, Node namespaceNode) throws TransformerException { // Execute the XPath, and have it return the result XObject list = eval(contextNode, str, namespaceNode); // Have the XObject return its result as a NodeSetDTM. return list.nodeset(); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); } /** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the namespaceNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList( Node contextNode, String str, Node namespaceNode) throws TransformerException { // Execute the XPath, and have it return the result XObject list = eval(contextNode, str, namespaceNode); // Return a NodeList. return list.nodelist(); } /** * Evaluate XPath string to an XObject. Using this method, * XPath namespace prefixes will be resolved from the namespaceNode. * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null. * @see org.apache.xpath.objects.XObject * @see org.apache.xpath.objects.XNull * @see org.apache.xpath.objects.XBoolean * @see org.apache.xpath.objects.XNumber * @see org.apache.xpath.objects.XString * @see org.apache.xpath.objects.XRTreeFrag * * @throws TransformerException */ public static XObject eval(Node contextNode, String str) throws TransformerException { return eval(contextNode, str, contextNode); } /** * Evaluate XPath string to an XObject. * XPath namespace prefixes are resolved from the namespaceNode. * The implementation of this is a little slow, since it creates * a number of objects each time it is called. This could be optimized * to keep the same objects around, but then thread-safety issues would arise. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null. * @see org.apache.xpath.objects.XObject * @see org.apache.xpath.objects.XNull * @see org.apache.xpath.objects.XBoolean * @see org.apache.xpath.objects.XNumber * @see org.apache.xpath.objects.XString * @see org.apache.xpath.objects.XRTreeFrag * * @throws TransformerException */ public static XObject eval(Node contextNode, String str, Node namespaceNode) throws TransformerException { // Since we don't have a XML Parser involved here, install some default support // for things like namespaces, etc. // (Changed from: XPathContext xpathSupport = new XPathContext(); // because XPathContext is weak in a number of areas... perhaps // XPathContext should be done away with.) // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 expressions. XPathContext xpathSupport = new XPathContext(false); // Create an object to resolve namespace prefixes. // XPath namespaces are resolved from the input context node's document element // if it is a root node, or else the current context node (for lack of a better // resolution space, given the simplicity of this sample code). PrefixResolverDefault prefixResolver = new PrefixResolverDefault( (namespaceNode.getNodeType() == Node.DOCUMENT_NODE) ? ((Document) namespaceNode).getDocumentElement() : namespaceNode); // Create the XPath object. XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null); // Execute the XPath, and have it return the result // return xpath.execute(xpathSupport, contextNode, prefixResolver); int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode); return xpath.execute(xpathSupport, ctxtNode, prefixResolver); } /** * Evaluate XPath string to an XObject. * XPath namespace prefixes are resolved from the namespaceNode. * The implementation of this is a little slow, since it creates * a number of objects each time it is called. This could be optimized * to keep the same objects around, but then thread-safety issues would arise. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @param prefixResolver Will be called if the parser encounters namespace * prefixes, to resolve the prefixes to URLs. * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null. * @see org.apache.xpath.objects.XObject * @see org.apache.xpath.objects.XNull * @see org.apache.xpath.objects.XBoolean * @see org.apache.xpath.objects.XNumber * @see org.apache.xpath.objects.XString * @see org.apache.xpath.objects.XRTreeFrag * * @throws TransformerException */ public static XObject eval( Node contextNode, String str, PrefixResolver prefixResolver) throws TransformerException { // Since we don't have a XML Parser involved here, install some default support // for things like namespaces, etc. // (Changed from: XPathContext xpathSupport = new XPathContext(); // because XPathContext is weak in a number of areas... perhaps // XPathContext should be done away with.) // Create the XPath object. XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null); // Create an XPathContext that doesn't support pushing and popping of // variable resolution scopes. Sufficient for simple XPath 1.0 expressions. XPathContext xpathSupport = new XPathContext(false); // Execute the XPath, and have it return the result int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode); return xpath.execute(xpathSupport, ctxtNode, prefixResolver); } } libxalan2-java-2.7.1/src/org/apache/xpath/patterns/0000755000175000017500000000000010736146354021074 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/patterns/StepPattern.java0000644000175000017500000006621010721374031024202 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StepPattern.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.patterns; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMFilter; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.axes.SubContextList; import org.apache.xpath.compiler.PsuedoNames; import org.apache.xpath.objects.XObject; /** * This class represents a single pattern match step. * @xsl.usage advanced */ public class StepPattern extends NodeTest implements SubContextList, ExpressionOwner { static final long serialVersionUID = 9071668960168152644L; /** The axis for this test. */ protected int m_axis; /** * Construct a StepPattern that tests for namespaces and node names. * * * @param whatToShow Bit set defined mainly by {@link org.w3c.dom.traversal.NodeFilter}. * @param namespace The namespace to be tested. * @param name The local name to be tested. * @param axis The Axis for this test, one of of Axes.ANCESTORORSELF, etc. * @param axisForPredicate No longer used. */ public StepPattern(int whatToShow, String namespace, String name, int axis, int axisForPredicate) { super(whatToShow, namespace, name); m_axis = axis; } /** * Construct a StepPattern that doesn't test for node names. * * * @param whatToShow Bit set defined mainly by {@link org.w3c.dom.traversal.NodeFilter}. * @param axis The Axis for this test, one of of Axes.ANCESTORORSELF, etc. * @param axisForPredicate No longer used. */ public StepPattern(int whatToShow, int axis, int axisForPredicate) { super(whatToShow); m_axis = axis; } /** * The target local name or psuedo name, for hash table lookup optimization. * @serial */ String m_targetString; // only calculate on head /** * Calculate the local name or psuedo name of the node that this pattern will test, * for hash table lookup optimization. * * @see org.apache.xpath.compiler.PsuedoNames */ public void calcTargetString() { int whatToShow = getWhatToShow(); switch (whatToShow) { case DTMFilter.SHOW_COMMENT : m_targetString = PsuedoNames.PSEUDONAME_COMMENT; break; case DTMFilter.SHOW_TEXT : case DTMFilter.SHOW_CDATA_SECTION : case (DTMFilter.SHOW_TEXT | DTMFilter.SHOW_CDATA_SECTION) : m_targetString = PsuedoNames.PSEUDONAME_TEXT; break; case DTMFilter.SHOW_ALL : m_targetString = PsuedoNames.PSEUDONAME_ANY; break; case DTMFilter.SHOW_DOCUMENT : case DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT : m_targetString = PsuedoNames.PSEUDONAME_ROOT; break; case DTMFilter.SHOW_ELEMENT : if (this.WILD == m_name) m_targetString = PsuedoNames.PSEUDONAME_ANY; else m_targetString = m_name; break; default : m_targetString = PsuedoNames.PSEUDONAME_ANY; break; } } /** * Get the local name or psuedo name of the node that this pattern will test, * for hash table lookup optimization. * * * @return local name or psuedo name of the node. * @see org.apache.xpath.compiler.PsuedoNames */ public String getTargetString() { return m_targetString; } /** * Reference to nodetest and predicate for * parent or ancestor. * @serial */ StepPattern m_relativePathPattern; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). * @param globalsSize The number of variables in the global variable area. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if (null != m_predicates) { for (int i = 0; i < m_predicates.length; i++) { m_predicates[i].fixupVariables(vars, globalsSize); } } if (null != m_relativePathPattern) { m_relativePathPattern.fixupVariables(vars, globalsSize); } } /** * Set the reference to nodetest and predicate for * parent or ancestor. * * * @param expr The relative pattern expression. */ public void setRelativePathPattern(StepPattern expr) { m_relativePathPattern = expr; expr.exprSetParent(this); calcScore(); } /** * Get the reference to nodetest and predicate for * parent or ancestor. * * * @return The relative pattern expression. */ public StepPattern getRelativePathPattern() { return m_relativePathPattern; } // /** // * Set the list of predicate expressions for this pattern step. // * @param predicates List of expression objects. // */ // public void setPredicates(Expression[] predicates) // { // m_predicates = predicates; // } /** * Set the list of predicate expressions for this pattern step. * @return List of expression objects. */ public Expression[] getPredicates() { return m_predicates; } /** * The list of predicate expressions for this pattern step. * @serial */ Expression[] m_predicates; /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * NOTE: Ancestors tests with predicates are problematic, and will require * special treatment. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { int n = getPredicateCount(); for (int i = 0; i < n; i++) { if (getPredicate(i).canTraverseOutsideSubtree()) return true; } return false; } /** * Get a predicate expression. * * * @param i The index of the predicate. * * @return A predicate expression. */ public Expression getPredicate(int i) { return m_predicates[i]; } /** * Get the number of predicates for this match pattern step. * * * @return the number of predicates for this match pattern step. */ public final int getPredicateCount() { return (null == m_predicates) ? 0 : m_predicates.length; } /** * Set the predicates for this match pattern step. * * * @param predicates An array of expressions that define predicates * for this step. */ public void setPredicates(Expression[] predicates) { m_predicates = predicates; if(null != predicates) { for(int i = 0; i < predicates.length; i++) { predicates[i].exprSetParent(this); } } calcScore(); } /** * Static calc of match score. */ public void calcScore() { if ((getPredicateCount() > 0) || (null != m_relativePathPattern)) { m_score = SCORE_OTHER; } else super.calcScore(); if (null == m_targetString) calcTargetString(); } /** * Execute this pattern step, including predicates. * * * @param xctxt XPath runtime context. * @param currentNode The current node context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, int currentNode) throws javax.xml.transform.TransformerException { DTM dtm = xctxt.getDTM(currentNode); if (dtm != null) { int expType = dtm.getExpandedTypeID(currentNode); return execute(xctxt, currentNode, dtm, expType); } return NodeTest.SCORE_NONE; } /** * Execute this pattern step, including predicates. * * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return execute(xctxt, xctxt.getCurrentNode()); } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * @param currentNode The currentNode. * @param dtm The DTM of the current node. * @param expType The expanded type ID of the current node. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. */ public XObject execute( XPathContext xctxt, int currentNode, DTM dtm, int expType) throws javax.xml.transform.TransformerException { if (m_whatToShow == NodeTest.SHOW_BYFUNCTION) { if (null != m_relativePathPattern) { return m_relativePathPattern.execute(xctxt); } else return NodeTest.SCORE_NONE; } XObject score; score = super.execute(xctxt, currentNode, dtm, expType); if (score == NodeTest.SCORE_NONE) return NodeTest.SCORE_NONE; if (getPredicateCount() != 0) { if (!executePredicates(xctxt, dtm, currentNode)) return NodeTest.SCORE_NONE; } if (null != m_relativePathPattern) return m_relativePathPattern.executeRelativePathPattern(xctxt, dtm, currentNode); return score; } /** * New Method to check whether the current node satisfies a position predicate * * @param xctxt The XPath runtime context. * @param predPos Which predicate we're evaluating of foo[1][2][3]. * @param dtm The DTM of the current node. * @param context The currentNode. * @param pos The position being requested, i.e. the value returned by * m_predicates[predPos].execute(xctxt). * * @return true of the position of the context matches pos, false otherwise. */ private final boolean checkProximityPosition(XPathContext xctxt, int predPos, DTM dtm, int context, int pos) { try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.PRECEDINGSIBLING); for (int child = traverser.first(context); DTM.NULL != child; child = traverser.next(context, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { throw new Error("Why: Should never have been called"); } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos--; if (pos < 1) return false; } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return (pos == 1); } /** * Get the proximity position index of the current node based on this * node test. * * * @param xctxt XPath runtime context. * @param predPos Which predicate we're evaluating of foo[1][2][3]. * @param findLast If true, don't terminate when the context node is found. * * @return the proximity position index of the current node based on the * node test. */ private final int getProximityPosition(XPathContext xctxt, int predPos, boolean findLast) { int pos = 0; int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int parent = dtm.getParent(context); try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.CHILD); for (int child = traverser.first(parent); DTM.NULL != child; child = traverser.next(parent, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { if ((pos + 1) != (int) pred.numWithSideEffects()) { pass = false; break; } } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos++; if (!findLast && child == context) { return pos; } } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return pos; } /** * Get the proximity position index of the current node based on this * node test. * * * @param xctxt XPath runtime context. * * @return the proximity position index of the current node based on the * node test. */ public int getProximityPosition(XPathContext xctxt) { return getProximityPosition(xctxt, xctxt.getPredicatePos(), false); } /** * Get the count of the nodes that match the test, which is the proximity * position of the last node that can pass this test in the sub context * selection. In XSLT 1-based indexing, this count is the index of the last * node. * * * @param xctxt XPath runtime context. * * @return the count of the nodes that match the test. */ public int getLastPos(XPathContext xctxt) { return getProximityPosition(xctxt, xctxt.getPredicatePos(), true); } /** * Execute the match pattern step relative to another step. * * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ protected final XObject executeRelativePathPattern( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { XObject score = NodeTest.SCORE_NONE; int context = currentNode; DTMAxisTraverser traverser; traverser = dtm.getAxisTraverser(m_axis); for (int relative = traverser.first(context); DTM.NULL != relative; relative = traverser.next(context, relative)) { try { xctxt.pushCurrentNode(relative); score = execute(xctxt); if (score != NodeTest.SCORE_NONE) break; } finally { xctxt.popCurrentNode(); } } return score; } /** * Execute the predicates on this step to determine if the current node * should be filtered or accepted. * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return true if the node should be accepted, false otherwise. * * @throws javax.xml.transform.TransformerException */ protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; } /** * Get the string represenentation of this step for diagnostic purposes. * * * @return A string representation of this step, built by reverse-engineering * the contained info. */ public String toString() { StringBuffer buf = new StringBuffer(); for (StepPattern pat = this; pat != null; pat = pat.m_relativePathPattern) { if (pat != this) buf.append("/"); buf.append(Axis.getNames(pat.m_axis)); buf.append("::"); if (0x000005000 == pat.m_whatToShow) { buf.append("doc()"); } else if (DTMFilter.SHOW_BYFUNCTION == pat.m_whatToShow) { buf.append("function()"); } else if (DTMFilter.SHOW_ALL == pat.m_whatToShow) { buf.append("node()"); } else if (DTMFilter.SHOW_TEXT == pat.m_whatToShow) { buf.append("text()"); } else if (DTMFilter.SHOW_PROCESSING_INSTRUCTION == pat.m_whatToShow) { buf.append("processing-instruction("); if (null != pat.m_name) { buf.append(pat.m_name); } buf.append(")"); } else if (DTMFilter.SHOW_COMMENT == pat.m_whatToShow) { buf.append("comment()"); } else if (null != pat.m_name) { if (DTMFilter.SHOW_ATTRIBUTE == pat.m_whatToShow) { buf.append("@"); } if (null != pat.m_namespace) { buf.append("{"); buf.append(pat.m_namespace); buf.append("}"); } buf.append(pat.m_name); } else if (DTMFilter.SHOW_ATTRIBUTE == pat.m_whatToShow) { buf.append("@"); } else if ((DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT) == pat.m_whatToShow) { buf.append("doc-root()"); } else { buf.append("?" + Integer.toHexString(pat.m_whatToShow)); } if (null != pat.m_predicates) { for (int i = 0; i < pat.m_predicates.length; i++) { buf.append("["); buf.append(pat.m_predicates[i]); buf.append("]"); } } } return buf.toString(); } /** Set to true to send diagnostics about pattern matches to the consol. */ private static final boolean DEBUG_MATCHES = false; /** * Get the match score of the given node. * * @param xctxt The XPath runtime context. * @param context The node to be tested. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public double getMatchScore(XPathContext xctxt, int context) throws javax.xml.transform.TransformerException { xctxt.pushCurrentNode(context); xctxt.pushCurrentExpressionNode(context); try { XObject score = execute(xctxt); return score.num(); } finally { xctxt.popCurrentNode(); xctxt.popCurrentExpressionNode(); } // return XPath.MATCH_SCORE_NONE; } /** * Set the axis that this step should follow. * * * @param axis The Axis for this test, one of of Axes.ANCESTORORSELF, etc. */ public void setAxis(int axis) { m_axis = axis; } /** * Get the axis that this step follows. * * * @return The Axis for this test, one of of Axes.ANCESTORORSELF, etc. */ public int getAxis() { return m_axis; } class PredOwner implements ExpressionOwner { int m_index; PredOwner(int index) { m_index = index; } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_predicates[m_index]; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(StepPattern.this); m_predicates[m_index] = exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitMatchPattern(owner, this)) { callSubtreeVisitors(visitor); } } /** * Call the visitors on the subtree. Factored out from callVisitors * so it may be called by derived classes. */ protected void callSubtreeVisitors(XPathVisitor visitor) { if (null != m_predicates) { int n = m_predicates.length; for (int i = 0; i < n; i++) { ExpressionOwner predOwner = new PredOwner(i); if (visitor.visitPredicate(predOwner, m_predicates[i])) { m_predicates[i].callVisitors(predOwner, visitor); } } } if (null != m_relativePathPattern) { m_relativePathPattern.callVisitors(this, visitor); } } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_relativePathPattern; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_relativePathPattern = (StepPattern)exp; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; StepPattern sp = (StepPattern)expr; if (null != m_predicates) { int n = m_predicates.length; if ((null == sp.m_predicates) || (sp.m_predicates.length != n)) return false; for (int i = 0; i < n; i++) { if (!m_predicates[i].deepEquals(sp.m_predicates[i])) return false; } } else if (null != sp.m_predicates) return false; if(null != m_relativePathPattern) { if(!m_relativePathPattern.deepEquals(sp.m_relativePathPattern)) return false; } else if(sp.m_relativePathPattern != null) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/patterns/NodeTestFilter.java0000644000175000017500000000253410721374033024625 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeTestFilter.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.patterns; /** * This interface should be implemented by Nodes and/or iterators, * when they need to know what the node test is before they do * getNextChild, etc. */ public interface NodeTestFilter { /** * Set the node test for this filter. * * * @param nodeTest Reference to a NodeTest that may be used to predetermine * what nodes to return. */ void setNodeTest(NodeTest nodeTest); } libxalan2-java-2.7.1/src/org/apache/xpath/patterns/ContextMatchStepPattern.java0000644000175000017500000001307410721374030026523 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ContextMatchStepPattern.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.patterns; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMFilter; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.WalkerFactory; import org.apache.xpath.objects.XObject; /** * Special context node pattern matcher. */ public class ContextMatchStepPattern extends StepPattern { static final long serialVersionUID = -1888092779313211942L; /** * Construct a ContextMatchStepPattern. * */ public ContextMatchStepPattern(int axis, int paxis) { super(DTMFilter.SHOW_ALL, axis, paxis); } /** * Execute this pattern step, including predicates. * * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { if (xctxt.getIteratorRoot() == xctxt.getCurrentNode()) return getStaticScore(); else return this.SCORE_NONE; } /** * Execute the match pattern step relative to another step. * * * @param xctxt The XPath runtime context. * NEEDSDOC @param prevStep * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject executeRelativePathPattern( XPathContext xctxt, StepPattern prevStep) throws javax.xml.transform.TransformerException { XObject score = NodeTest.SCORE_NONE; int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); if (null != dtm) { int predContext = xctxt.getCurrentNode(); DTMAxisTraverser traverser; int axis = m_axis; boolean needToTraverseAttrs = WalkerFactory.isDownwardAxisOfMany(axis); boolean iterRootIsAttr = (dtm.getNodeType(xctxt.getIteratorRoot()) == DTM.ATTRIBUTE_NODE); if((Axis.PRECEDING == axis) && iterRootIsAttr) { axis = Axis.PRECEDINGANDANCESTOR; } traverser = dtm.getAxisTraverser(axis); for (int relative = traverser.first(context); DTM.NULL != relative; relative = traverser.next(context, relative)) { try { xctxt.pushCurrentNode(relative); score = execute(xctxt); if (score != NodeTest.SCORE_NONE) { //score = executePredicates( xctxt, prevStep, SCORE_OTHER, // predContext, relative); if (executePredicates(xctxt, dtm, context)) return score; score = NodeTest.SCORE_NONE; } if(needToTraverseAttrs && iterRootIsAttr && (DTM.ELEMENT_NODE == dtm.getNodeType(relative))) { int xaxis = Axis.ATTRIBUTE; for (int i = 0; i < 2; i++) { DTMAxisTraverser atraverser = dtm.getAxisTraverser(xaxis); for (int arelative = atraverser.first(relative); DTM.NULL != arelative; arelative = atraverser.next(relative, arelative)) { try { xctxt.pushCurrentNode(arelative); score = execute(xctxt); if (score != NodeTest.SCORE_NONE) { //score = executePredicates( xctxt, prevStep, SCORE_OTHER, // predContext, arelative); if (score != NodeTest.SCORE_NONE) return score; } } finally { xctxt.popCurrentNode(); } } xaxis = Axis.NAMESPACE; } } } finally { xctxt.popCurrentNode(); } } } return score; } } libxalan2-java-2.7.1/src/org/apache/xpath/patterns/UnionPattern.java0000644000175000017500000001270510721374030024356 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnionPattern.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.patterns; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XObject; /** * This class represents a union pattern, which can have multiple individual * StepPattern patterns. * @xsl.usage advanced */ public class UnionPattern extends Expression { static final long serialVersionUID = -6670449967116905820L; /** Array of the contained step patterns to be tested. * @serial */ private StepPattern[] m_patterns; /** * No arguments to process, so this does nothing. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { for (int i = 0; i < m_patterns.length; i++) { m_patterns[i].fixupVariables(vars, globalsSize); } } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { if(null != m_patterns) { int n = m_patterns.length; for (int i = 0; i < n; i++) { if(m_patterns[i].canTraverseOutsideSubtree()) return true; } } return false; } /** * Set the contained step patterns to be tested. * * * @param patterns the contained step patterns to be tested. */ public void setPatterns(StepPattern[] patterns) { m_patterns = patterns; if(null != patterns) { for(int i = 0; i < patterns.length; i++) { patterns[i].exprSetParent(this); } } } /** * Get the contained step patterns to be tested. * * * @return an array of the contained step patterns to be tested. */ public StepPattern[] getPatterns() { return m_patterns; } /** * Test a node to see if it matches any of the patterns in the union. * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject bestScore = null; int n = m_patterns.length; for (int i = 0; i < n; i++) { XObject score = m_patterns[i].execute(xctxt); if (score != NodeTest.SCORE_NONE) { if (null == bestScore) bestScore = score; else if (score.num() > bestScore.num()) bestScore = score; } } if (null == bestScore) { bestScore = NodeTest.SCORE_NONE; } return bestScore; } class UnionPathPartOwner implements ExpressionOwner { int m_index; UnionPathPartOwner(int index) { m_index = index; } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_patterns[m_index]; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(UnionPattern.this); m_patterns[m_index] = (StepPattern)exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { visitor.visitUnionPattern(owner, this); if(null != m_patterns) { int n = m_patterns.length; for(int i = 0; i < n; i++) { m_patterns[i].callVisitors(new UnionPathPartOwner(i), visitor); } } } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; UnionPattern up = (UnionPattern)expr; if(null != m_patterns) { int n = m_patterns.length; if((null == up.m_patterns) || (up.m_patterns.length != n)) return false; for(int i = 0; i < n; i++) { if(!m_patterns[i].deepEquals(up.m_patterns[i])) return false; } } else if(up.m_patterns != null) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/patterns/package.html0000644000175000017500000000207610721374032023350 0ustar mkochmkoch XPath nodetest and XSLT pattern matching support.

    Implementation of XPath nodeTest support, and XSLT pattern matching support.

    libxalan2-java-2.7.1/src/org/apache/xpath/patterns/NodeTest.java0000644000175000017500000005174610721374030023465 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeTest.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.patterns; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * This is the basic node test class for both match patterns and location path * steps. * @xsl.usage advanced */ public class NodeTest extends Expression { static final long serialVersionUID = -5736721866747906182L; /** * The namespace or local name for node tests with a wildcard. * @see the XPath NameTest production. */ public static final String WILD = "*"; /** * The URL to pass to the Node#supports method, to see if the * DOM has already been stripped of whitespace nodes. */ public static final String SUPPORTS_PRE_STRIPPING = "http://xml.apache.org/xpath/features/whitespace-pre-stripping"; /** * This attribute determines which node types are accepted. * @serial */ protected int m_whatToShow; /** * Special bitmap for match patterns starting with a function. * Make sure this does not conflict with {@link org.w3c.dom.traversal.NodeFilter}. */ public static final int SHOW_BYFUNCTION = 0x00010000; /** * This attribute determines which node types are accepted. * These constants are defined in the {@link org.w3c.dom.traversal.NodeFilter} * interface. * * @return bitset mainly defined in {@link org.w3c.dom.traversal.NodeFilter}. */ public int getWhatToShow() { return m_whatToShow; } /** * This attribute determines which node types are accepted. * These constants are defined in the {@link org.w3c.dom.traversal.NodeFilter} * interface. * * @param what bitset mainly defined in {@link org.w3c.dom.traversal.NodeFilter}. */ public void setWhatToShow(int what) { m_whatToShow = what; } /** * The namespace to be tested for, which may be null. * @serial */ String m_namespace; /** * Return the namespace to be tested. * * @return The namespace to be tested for, or {@link #WILD}, or null. */ public String getNamespace() { return m_namespace; } /** * Set the namespace to be tested. * * @param ns The namespace to be tested for, or {@link #WILD}, or null. */ public void setNamespace(String ns) { m_namespace = ns; } /** * The local name to be tested for. * @serial */ protected String m_name; /** * Return the local name to be tested. * * @return the local name to be tested, or {@link #WILD}, or an empty string. */ public String getLocalName() { return (null == m_name) ? "" : m_name; } /** * Set the local name to be tested. * * @param name the local name to be tested, or {@link #WILD}, or an empty string. */ public void setLocalName(String name) { m_name = name; } /** * Statically calculated score for this test. One of * {@link #SCORE_NODETEST}, * {@link #SCORE_NONE}, * {@link #SCORE_NSWILD}, * {@link #SCORE_QNAME}, or * {@link #SCORE_OTHER}. * @serial */ XNumber m_score; /** * The match score if the pattern consists of just a NodeTest. * @see XSLT Specification - 5.5 Conflict Resolution for Template Rules */ public static final XNumber SCORE_NODETEST = new XNumber(XPath.MATCH_SCORE_NODETEST); /** * The match score if the pattern pattern has the form NCName:*. * @see XSLT Specification - 5.5 Conflict Resolution for Template Rules */ public static final XNumber SCORE_NSWILD = new XNumber(XPath.MATCH_SCORE_NSWILD); /** * The match score if the pattern has the form * of a QName optionally preceded by an @ character. * @see XSLT Specification - 5.5 Conflict Resolution for Template Rules */ public static final XNumber SCORE_QNAME = new XNumber(XPath.MATCH_SCORE_QNAME); /** * The match score if the pattern consists of something * other than just a NodeTest or just a qname. * @see XSLT Specification - 5.5 Conflict Resolution for Template Rules */ public static final XNumber SCORE_OTHER = new XNumber(XPath.MATCH_SCORE_OTHER); /** * The match score if no match is made. * @see XSLT Specification - 5.5 Conflict Resolution for Template Rules */ public static final XNumber SCORE_NONE = new XNumber(XPath.MATCH_SCORE_NONE); /** * Construct an NodeTest that tests for namespaces and node names. * * * @param whatToShow Bit set defined mainly by {@link org.w3c.dom.traversal.NodeFilter}. * @param namespace The namespace to be tested. * @param name The local name to be tested. */ public NodeTest(int whatToShow, String namespace, String name) { initNodeTest(whatToShow, namespace, name); } /** * Construct an NodeTest that doesn't test for node names. * * * @param whatToShow Bit set defined mainly by {@link org.w3c.dom.traversal.NodeFilter}. */ public NodeTest(int whatToShow) { initNodeTest(whatToShow); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; NodeTest nt = (NodeTest)expr; if(null != nt.m_name) { if(null == m_name) return false; else if(!nt.m_name.equals(m_name)) return false; } else if(null != m_name) return false; if(null != nt.m_namespace) { if(null == m_namespace) return false; else if(!nt.m_namespace.equals(m_namespace)) return false; } else if(null != m_namespace) return false; if(m_whatToShow != nt.m_whatToShow) return false; if(m_isTotallyWild != nt.m_isTotallyWild) return false; return true; } /** * Null argument constructor. */ public NodeTest(){} /** * Initialize this node test by setting the whatToShow property, and * calculating the score that this test will return if a test succeeds. * * * @param whatToShow Bit set defined mainly by {@link org.w3c.dom.traversal.NodeFilter}. */ public void initNodeTest(int whatToShow) { m_whatToShow = whatToShow; calcScore(); } /** * Initialize this node test by setting the whatToShow property and the * namespace and local name, and * calculating the score that this test will return if a test succeeds. * * * @param whatToShow Bit set defined mainly by {@link org.w3c.dom.traversal.NodeFilter}. * @param namespace The namespace to be tested. * @param name The local name to be tested. */ public void initNodeTest(int whatToShow, String namespace, String name) { m_whatToShow = whatToShow; m_namespace = namespace; m_name = name; calcScore(); } /** * True if this test has a null namespace and a local name of {@link #WILD}. * @serial */ private boolean m_isTotallyWild; /** * Get the static score for this node test. * @return Should be one of the SCORE_XXX constants. */ public XNumber getStaticScore() { return m_score; } /** * Set the static score for this node test. * @param score Should be one of the SCORE_XXX constants. */ public void setStaticScore(XNumber score) { m_score = score; } /** * Static calc of match score. */ protected void calcScore() { if ((m_namespace == null) && (m_name == null)) m_score = SCORE_NODETEST; else if (((m_namespace == WILD) || (m_namespace == null)) && (m_name == WILD)) m_score = SCORE_NODETEST; else if ((m_namespace != WILD) && (m_name == WILD)) m_score = SCORE_NSWILD; else m_score = SCORE_QNAME; m_isTotallyWild = (m_namespace == null && m_name == WILD); } /** * Get the score that this test will return if a test succeeds. * * * @return the score that this test will return if a test succeeds. */ public double getDefaultScore() { return m_score.num(); } /** * Tell what node type to test, if not DTMFilter.SHOW_ALL. * * @param whatToShow Bit set defined mainly by * {@link org.apache.xml.dtm.DTMFilter}. * @return the node type for the whatToShow. Since whatToShow can specify * multiple types, it will return the first bit tested that is on, * so the caller of this function should take care that this is * the function they really want to call. If none of the known bits * are set, this function will return zero. */ public static int getNodeTypeTest(int whatToShow) { // %REVIEW% Is there a better way? if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT)) return DTM.ELEMENT_NODE; if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE)) return DTM.ATTRIBUTE_NODE; if (0 != (whatToShow & DTMFilter.SHOW_TEXT)) return DTM.TEXT_NODE; if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT)) return DTM.DOCUMENT_NODE; if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT)) return DTM.DOCUMENT_FRAGMENT_NODE; if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE)) return DTM.NAMESPACE_NODE; if (0 != (whatToShow & DTMFilter.SHOW_COMMENT)) return DTM.COMMENT_NODE; if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION)) return DTM.PROCESSING_INSTRUCTION_NODE; if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE)) return DTM.DOCUMENT_TYPE_NODE; if (0 != (whatToShow & DTMFilter.SHOW_ENTITY)) return DTM.ENTITY_NODE; if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE)) return DTM.ENTITY_REFERENCE_NODE; if (0 != (whatToShow & DTMFilter.SHOW_NOTATION)) return DTM.NOTATION_NODE; if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION)) return DTM.CDATA_SECTION_NODE; return 0; } /** * Do a diagnostics dump of a whatToShow bit set. * * * @param whatToShow Bit set defined mainly by * {@link org.apache.xml.dtm.DTMFilter}. */ public static void debugWhatToShow(int whatToShow) { java.util.Vector v = new java.util.Vector(); if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE)) v.addElement("SHOW_ATTRIBUTE"); if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE)) v.addElement("SHOW_NAMESPACE"); if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION)) v.addElement("SHOW_CDATA_SECTION"); if (0 != (whatToShow & DTMFilter.SHOW_COMMENT)) v.addElement("SHOW_COMMENT"); if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT)) v.addElement("SHOW_DOCUMENT"); if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT)) v.addElement("SHOW_DOCUMENT_FRAGMENT"); if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE)) v.addElement("SHOW_DOCUMENT_TYPE"); if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT)) v.addElement("SHOW_ELEMENT"); if (0 != (whatToShow & DTMFilter.SHOW_ENTITY)) v.addElement("SHOW_ENTITY"); if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE)) v.addElement("SHOW_ENTITY_REFERENCE"); if (0 != (whatToShow & DTMFilter.SHOW_NOTATION)) v.addElement("SHOW_NOTATION"); if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION)) v.addElement("SHOW_PROCESSING_INSTRUCTION"); if (0 != (whatToShow & DTMFilter.SHOW_TEXT)) v.addElement("SHOW_TEXT"); int n = v.size(); for (int i = 0; i < n; i++) { if (i > 0) System.out.print(" | "); System.out.print(v.elementAt(i)); } if (0 == n) System.out.print("empty whatToShow: " + whatToShow); System.out.println(); } /** * Two names are equal if they and either both are null or * the name t is wild and the name p is non-null, or the two * strings are equal. * * @param p part string from the node. * @param t target string, which may be {@link #WILD}. * * @return true if the strings match according to the rules of this method. */ private static final boolean subPartMatch(String p, String t) { // boolean b = (p == t) || ((null != p) && ((t == WILD) || p.equals(t))); // System.out.println("subPartMatch - p: "+p+", t: "+t+", result: "+b); return (p == t) || ((null != p) && ((t == WILD) || p.equals(t))); } /** * This is temporary to patch over Xerces issue with representing DOM * namespaces as "". * * @param p part string from the node, which may represent the null namespace * as null or as "". * @param t target string, which may be {@link #WILD}. * * @return true if the strings match according to the rules of this method. */ private static final boolean subPartMatchNS(String p, String t) { return (p == t) || ((null != p) && ((p.length() > 0) ? ((t == WILD) || p.equals(t)) : null == t)); } /** * Tell what the test score is for the given node. * * * @param xctxt XPath runtime context. * @param context The node being tested. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, int context) throws javax.xml.transform.TransformerException { DTM dtm = xctxt.getDTM(context); short nodeType = dtm.getNodeType(context); if (m_whatToShow == DTMFilter.SHOW_ALL) return m_score; int nodeBit = (m_whatToShow & (0x00000001 << (nodeType - 1))); switch (nodeBit) { case DTMFilter.SHOW_DOCUMENT_FRAGMENT : case DTMFilter.SHOW_DOCUMENT : return SCORE_OTHER; case DTMFilter.SHOW_COMMENT : return m_score; case DTMFilter.SHOW_CDATA_SECTION : case DTMFilter.SHOW_TEXT : // was: // return (!xctxt.getDOMHelper().shouldStripSourceNode(context)) // ? m_score : SCORE_NONE; return m_score; case DTMFilter.SHOW_PROCESSING_INSTRUCTION : return subPartMatch(dtm.getNodeName(context), m_name) ? m_score : SCORE_NONE; // From the draft: "Two expanded names are equal if they // have the same local part, and either both have no URI or // both have the same URI." // "A node test * is true for any node of the principal node type. // For example, child::* will select all element children of the // context node, and attribute::* will select all attributes of // the context node." // "A node test can have the form NCName:*. In this case, the prefix // is expanded in the same way as with a QName using the context // namespace declarations. The node test will be true for any node // of the principal type whose expanded name has the URI to which // the prefix expands, regardless of the local part of the name." case DTMFilter.SHOW_NAMESPACE : { String ns = dtm.getLocalName(context); return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE; } case DTMFilter.SHOW_ATTRIBUTE : case DTMFilter.SHOW_ELEMENT : { return (m_isTotallyWild || (subPartMatchNS(dtm.getNamespaceURI(context), m_namespace) && subPartMatch(dtm.getLocalName(context), m_name))) ? m_score : SCORE_NONE; } default : return SCORE_NONE; } // end switch(testType) } /** * Tell what the test score is for the given node. * * * @param xctxt XPath runtime context. * @param context The node being tested. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, int context, DTM dtm, int expType) throws javax.xml.transform.TransformerException { if (m_whatToShow == DTMFilter.SHOW_ALL) return m_score; int nodeBit = (m_whatToShow & (0x00000001 << ((dtm.getNodeType(context)) - 1))); switch (nodeBit) { case DTMFilter.SHOW_DOCUMENT_FRAGMENT : case DTMFilter.SHOW_DOCUMENT : return SCORE_OTHER; case DTMFilter.SHOW_COMMENT : return m_score; case DTMFilter.SHOW_CDATA_SECTION : case DTMFilter.SHOW_TEXT : // was: // return (!xctxt.getDOMHelper().shouldStripSourceNode(context)) // ? m_score : SCORE_NONE; return m_score; case DTMFilter.SHOW_PROCESSING_INSTRUCTION : return subPartMatch(dtm.getNodeName(context), m_name) ? m_score : SCORE_NONE; // From the draft: "Two expanded names are equal if they // have the same local part, and either both have no URI or // both have the same URI." // "A node test * is true for any node of the principal node type. // For example, child::* will select all element children of the // context node, and attribute::* will select all attributes of // the context node." // "A node test can have the form NCName:*. In this case, the prefix // is expanded in the same way as with a QName using the context // namespace declarations. The node test will be true for any node // of the principal type whose expanded name has the URI to which // the prefix expands, regardless of the local part of the name." case DTMFilter.SHOW_NAMESPACE : { String ns = dtm.getLocalName(context); return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE; } case DTMFilter.SHOW_ATTRIBUTE : case DTMFilter.SHOW_ELEMENT : { return (m_isTotallyWild || (subPartMatchNS(dtm.getNamespaceURI(context), m_namespace) && subPartMatch(dtm.getLocalName(context), m_name))) ? m_score : SCORE_NONE; } default : return SCORE_NONE; } // end switch(testType) } /** * Test the current node to see if it matches the given node test. * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return execute(xctxt, xctxt.getCurrentNode()); } /** * Node tests by themselves do not need to fix up variables. */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { assertion(false, "callVisitors should not be called for this object!!!"); } } libxalan2-java-2.7.1/src/org/apache/xpath/patterns/FunctionPattern.java0000644000175000017500000001534110721374031025053 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionPattern.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.patterns; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * Match pattern step that contains a function. * @xsl.usage advanced */ public class FunctionPattern extends StepPattern { static final long serialVersionUID = -5426793413091209944L; /** * Construct a FunctionPattern from a * {@link org.apache.xpath.functions.Function expression}. * * NEEDSDOC @param expr */ public FunctionPattern(Expression expr, int axis, int predaxis) { super(0, null, null, axis, predaxis); m_functionExpr = expr; } /** * Static calc of match score. */ public final void calcScore() { m_score = SCORE_OTHER; if (null == m_targetString) calcTargetString(); } /** * Should be a {@link org.apache.xpath.functions.Function expression}. * @serial */ Expression m_functionExpr; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); m_functionExpr.fixupVariables(vars, globalsSize); } /** * Test a node to see if it matches the given node test. * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, int context) throws javax.xml.transform.TransformerException { DTMIterator nl = m_functionExpr.asIterator(xctxt, context); XNumber score = SCORE_NONE; if (null != nl) { int n; while (DTM.NULL != (n = nl.nextNode())) { score = (n == context) ? SCORE_OTHER : SCORE_NONE; if (score == SCORE_OTHER) { context = n; break; } } // nl.detach(); } nl.detach(); return score; } /** * Test a node to see if it matches the given node test. * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, int context, DTM dtm, int expType) throws javax.xml.transform.TransformerException { DTMIterator nl = m_functionExpr.asIterator(xctxt, context); XNumber score = SCORE_NONE; if (null != nl) { int n; while (DTM.NULL != (n = nl.nextNode())) { score = (n == context) ? SCORE_OTHER : SCORE_NONE; if (score == SCORE_OTHER) { context = n; break; } } nl.detach(); } return score; } /** * Test a node to see if it matches the given node test. * * @param xctxt XPath runtime context. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int context = xctxt.getCurrentNode(); DTMIterator nl = m_functionExpr.asIterator(xctxt, context); XNumber score = SCORE_NONE; if (null != nl) { int n; while (DTM.NULL != (n = nl.nextNode())) { score = (n == context) ? SCORE_OTHER : SCORE_NONE; if (score == SCORE_OTHER) { context = n; break; } } nl.detach(); } return score; } class FunctionOwner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_functionExpr; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(FunctionPattern.this); m_functionExpr = exp; } } /** * Call the visitor for the function. */ protected void callSubtreeVisitors(XPathVisitor visitor) { m_functionExpr.callVisitors(new FunctionOwner(), visitor); super.callSubtreeVisitors(visitor); } } libxalan2-java-2.7.1/src/org/apache/xpath/SourceTree.java0000644000175000017500000000304510721374033022150 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SourceTree.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; /** * This object represents a Source Tree, and any associated * information. * @xsl.usage internal */ public class SourceTree { /** * Constructor SourceTree * * * @param root The root of the source tree, which may or may not be a * {@link org.w3c.dom.Document} node. * @param url The URI of the source tree. */ public SourceTree(int root, String url) { m_root = root; m_url = url; } /** The URI of the source tree. */ public String m_url; /** The root of the source tree, which may or may not be a * {@link org.w3c.dom.Document} node. */ public int m_root; } libxalan2-java-2.7.1/src/org/apache/xpath/package.html0000644000175000017500000000213510721374030021502 0ustar mkochmkoch XPath support Package.

    Implementation of XPath; for the most part, only classes meant for public use are found at this root level of the XPath packages.

    libxalan2-java-2.7.1/src/org/apache/xpath/res/0000755000175000017500000000000010736146354020025 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_zh_CN.java0000644000175000017500000000177210721374033025540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_zh_CN.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; public class XPATHErrorResources_zh_CN extends XPATHErrorResources_zh { } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_tr.java0000644000175000017500000013121410721374030025154 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_tr.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_tr extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "E\u015fle\u015fme \u00f6r\u00fcnt\u00fcs\u00fcnde current() i\u015flevine izin verilmez!" }, { ER_CURRENT_TAKES_NO_ARGS, "current() i\u015flevi ba\u011f\u0131ms\u0131z de\u011fi\u015fken kabul etmez!" }, { ER_DOCUMENT_REPLACED, "document() i\u015flevi uygulamas\u0131 org.apache.xalan.xslt.FuncDocument ile de\u011fi\u015ftirildi!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "Ba\u011flam\u0131n iye belgesi yok!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() i\u015flevinde \u00e7ok fazla ba\u011f\u0131ms\u0131z de\u011fi\u015fken var."}, { ER_TRANSLATE_TAKES_3_ARGS, "translate() i\u015flevi \u00fc\u00e7 ba\u011f\u0131ms\u0131z de\u011fi\u015fken al\u0131r!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "unparsed-entity-uri i\u015flevi bir ba\u011f\u0131ms\u0131z de\u011fi\u015fken almal\u0131d\u0131r!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "namespace ekseni hen\u00fcz ger\u00e7ekle\u015ftirilmedi!"}, { ER_UNKNOWN_AXIS, "Bilinmeyen eksen: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "Bilinmeyen e\u015fle\u015fme i\u015flemi!"}, { ER_INCORRECT_ARG_LENGTH, "processing-instruction() d\u00fc\u011f\u00fcm s\u0131namas\u0131n\u0131n ba\u011f\u0131ms\u0131z de\u011fi\u015fken uzunlu\u011fu yanl\u0131\u015f!"}, { ER_CANT_CONVERT_TO_NUMBER, "{0} bir say\u0131ya d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez"}, { ER_CANT_CONVERT_TO_NODELIST, "{0} NodeList''e d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0} NodeSetDTM''ye d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez!"}, { ER_CANT_CONVERT_TO_TYPE, "{0} - type#{1} d\u00f6n\u00fc\u015f\u00fcm\u00fc yap\u0131lamaz"}, { ER_EXPECTED_MATCH_PATTERN, "getMatchScore i\u00e7inde e\u015fle\u015fme \u00f6r\u00fcnt\u00fcs\u00fc bekleniyor!"}, { ER_COULDNOT_GET_VAR_NAMED, "{0} adl\u0131 de\u011fi\u015fken al\u0131namad\u0131"}, { ER_UNKNOWN_OPCODE, "HATA! Bilinmeyen i\u015flem kodu: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Fazladan ge\u00e7ersiz simgeler: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Haz\u0131r bilginin t\u0131rnak imi yanl\u0131\u015f... \u00e7ift t\u0131rnak bekleniyor!"}, { ER_EXPECTED_SINGLE_QUOTE, "Haz\u0131r bilginin t\u0131rnak imi yanl\u0131\u015f... tek t\u0131rnak bekleniyor!"}, { ER_EMPTY_EXPRESSION, "\u0130fade bo\u015f!"}, { ER_EXPECTED_BUT_FOUND, "{0} bekleniyordu, {1} bulundu"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Programc\u0131 de\u011ferlendirmesi yanl\u0131\u015f! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "boolean(...) ba\u011f\u0131ms\u0131z de\u011fi\u015fkeni 19990709 XPath tasla\u011f\u0131yla art\u0131k iste\u011fe ba\u011fl\u0131 de\u011fil."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "',' bulundu, ancak \u00f6ncesinde ba\u011f\u0131ms\u0131z de\u011fi\u015fken yok!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "',' bulundu, ancak sonras\u0131nda ba\u011f\u0131ms\u0131z de\u011fi\u015fken yok!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[kar\u015f\u0131la\u015ft\u0131rma belirtimi]' ya da '.[kar\u015f\u0131la\u015ft\u0131rma belirtimi]' ge\u00e7ersiz bir s\u00f6zdizimi. Yerine \u015funu kullan\u0131n: 'self::node()[kar\u015f\u0131la\u015ft\u0131rma belirtimi]'."}, { ER_ILLEGAL_AXIS_NAME, "Eksen ad\u0131 ge\u00e7ersiz: {0}"}, { ER_UNKNOWN_NODETYPE, "D\u00fc\u011f\u00fcm tipi ge\u00e7ersiz: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "\u00d6r\u00fcnt\u00fc haz\u0131r bilgisinin ({0}) t\u0131rnak i\u00e7ine al\u0131nmas\u0131 gerekiyor!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} bir say\u0131 olarak bi\u00e7imlenemedi!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "XML TransformerFactory ili\u015fkisi {0} yarat\u0131lamad\u0131"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Hata! xpath select ifadesi (-select) bulunamad\u0131."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "HATA! OP_LOCATIONPATH sonras\u0131nda ENDOP bulunamad\u0131."}, { ER_ERROR_OCCURED, "Hata olu\u015ftu!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "De\u011fi\u015fken i\u00e7in belirtilen VariableReference ba\u011flam d\u0131\u015f\u0131 ya da tan\u0131ms\u0131z! Ad = {0}"}, { ER_AXES_NOT_ALLOWED, "E\u015fle\u015fme \u00f6r\u00fcnt\u00fclerinde yaln\u0131zca child:: ve attribute:: eksenlerine izin verilir! Ge\u00e7ersiz eksenler = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() yanl\u0131\u015f say\u0131da ba\u011f\u0131ms\u0131z de\u011fi\u015fken i\u00e7eriyor."}, { ER_COUNT_TAKES_1_ARG, "Say\u0131m i\u015flevi tek bir ba\u011f\u0131ms\u0131z de\u011fi\u015fken almal\u0131d\u0131r!"}, { ER_COULDNOT_FIND_FUNCTION, "\u0130\u015flev bulunamad\u0131: {0}"}, { ER_UNSUPPORTED_ENCODING, "Desteklenmeyen kodlama: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "getNextSibling s\u0131ras\u0131nda DTM i\u00e7inde sorun olu\u015ftu... kurtarma giri\u015fiminde bulunuluyor"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Programc\u0131 hatas\u0131: EmptyNodeList i\u00e7ine yaz\u0131lamaz."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory, XPathContext taraf\u0131ndan desteklenmiyor!"}, { ER_PREFIX_MUST_RESOLVE, "\u00d6nek bir ad alan\u0131na \u00e7\u00f6z\u00fclmelidir: {0}"}, { ER_PARSE_NOT_SUPPORTED, "XPathContext i\u00e7inde parse (InputSource kayna\u011f\u0131) desteklenmiyor! {0} a\u00e7\u0131lam\u0131yor"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... DTM taraf\u0131ndan i\u015flenmedi!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... DTM taraf\u0131ndan i\u015flenmedi!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison {0} tipi d\u00fc\u011f\u00fcmleri i\u015fleyemez"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper {0} tipi d\u00fc\u011f\u00fcmleri i\u015fleyemez"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse hatas\u0131: Sistem tnt - {0} sat\u0131r - {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse hatas\u0131"}, { ER_INVALID_UTF16_SURROGATE, "UTF-16 yerine kullan\u0131lan de\u011fer ge\u00e7ersiz: {0} ?"}, { ER_OIERROR, "G\u00c7 hatas\u0131"}, { ER_CANNOT_CREATE_URL, "\u0130lgili url yarat\u0131lam\u0131yor: {0}"}, { ER_XPATH_READOBJECT, "XPath.readObject i\u00e7inde: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "\u0130\u015flev simgesi bulunamad\u0131."}, { ER_CANNOT_DEAL_XPATH_TYPE, "XPath tipi i\u015flenemiyor: {0}"}, { ER_NODESET_NOT_MUTABLE, "Bu NodeSet de\u011fi\u015febilir t\u00fcrde de\u011fil"}, { ER_NODESETDTM_NOT_MUTABLE, "Bu NodeSetDTM de\u011fi\u015febilir t\u00fcrde de\u011fil"}, { ER_VAR_NOT_RESOLVABLE, "De\u011fi\u015fken \u00e7\u00f6z\u00fclebilir bir de\u011fi\u015fken de\u011fil: {0}"}, { ER_NULL_ERROR_HANDLER, "Bo\u015f de\u011ferli hata i\u015fleyici"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Programc\u0131 do\u011frulamas\u0131: bilinmeyen opcode:{0}"}, { ER_ZERO_OR_ONE, "0 ya da 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() XRTreeFragSelectWrapper taraf\u0131ndan desteklenmiyor"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() XRTreeFragSelectWrapper taraf\u0131ndan desteklenmiyor"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() XRTreeFragSelectWrapper taraf\u0131ndan desteklenmiyor"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() XRTreeFragSelectWrapper taraf\u0131ndan desteklenmiyor"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() XRTreeFragSelectWrapper taraf\u0131ndan desteklenmiyor"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() XRTreeFragSelectWrapper taraf\u0131ndan desteklenmiyor"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() XStringForChars i\u00e7in desteklenmiyor"}, { ER_COULD_NOT_FIND_VAR, "{0} ad\u0131nda de\u011fi\u015fken bulunamad\u0131"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars ba\u011f\u0131ms\u0131z de\u011fi\u015fken olarak dizgi alamaz"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "FastStringBuffer ba\u011f\u0131ms\u0131z de\u011fi\u015fkeni bo\u015f de\u011ferli olamaz"}, { ER_TWO_OR_THREE, "2 ya da 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "De\u011fi\u015fkene ba\u011f tan\u0131mlamadan \u00f6nce eri\u015fildi!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB ba\u011f\u0131ms\u0131z de\u011fi\u015fken olarak dizgi alamaz!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Hata! Walker k\u00f6k\u00fc bo\u015f de\u011fere ayarlan\u0131yor!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Bu NodeSetDTM \u00f6nceki bir d\u00fc\u011f\u00fcme yineleme yapamaz!"}, { ER_NODESET_CANNOT_ITERATE, "Bu NodeSet \u00f6nceki bir d\u00fc\u011f\u00fcme yineleme yapamaz!"}, { ER_NODESETDTM_CANNOT_INDEX, "Bu NodeSetDTM dizinleme ya da sayma i\u015flevleri yapamaz!"}, { ER_NODESET_CANNOT_INDEX, "Bu NodeSet dizinleme ya da sayma i\u015flevleri yapamaz!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "nextNode \u00e7a\u011fr\u0131ld\u0131ktan sonra setShouldCacheNodes \u00e7a\u011fr\u0131lamaz!"}, { ER_ONLY_ALLOWS, "{0} yaln\u0131zca {1} ba\u011f\u0131ms\u0131z de\u011fi\u015fkene izin verir"}, { ER_UNKNOWN_STEP, "getNextStepPos i\u00e7inde programc\u0131 do\u011frulamas\u0131: bilinmeyen stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "'/' ya da '//' simgesinden sonra g\u00f6reli yer yolu bekleniyordu."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Yer yolu bekleniyordu, ancak \u015fu simge saptand\u0131\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Yer yolu bekleniyordu, ancak XPath ifadesinin sonu saptand\u0131."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "'/' ya da '//' simgesinden sonra yer ad\u0131m\u0131 bekleniyordu."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "NCName:* ya da QName ile e\u015fle\u015fen bir d\u00fc\u011f\u00fcm s\u0131namas\u0131 bekleniyordu."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Ad\u0131m \u00f6r\u00fcnt\u00fcs\u00fc bekleniyordu, ancak '/' saptand\u0131."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "G\u00f6reli yol \u00f6r\u00fcnt\u00fcs\u00fc bekleniyordu."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "''{0}'' XPath ifadesine ili\u015fkin XPathResult''\u0131n XPathResultType de\u011feri ({1}) bir boole de\u011fere d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "''{0}'' XPath ifadesine ili\u015fkin XPathResult''\u0131n XPathResultType de\u011feri ({1}) tek bir d\u00fc\u011f\u00fcme d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez. getSingleNodeValue y\u00f6ntemi yaln\u0131zca ANY_UNORDERED_NODE_TYPE ve FIRST_ORDERED_NODE_TYPE tipleri i\u00e7in ge\u00e7erlidir."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "getSnapshotLength y\u00f6ntemi, ''{0}'' XPath ifadesinin XPathResult''\u0131nda \u00e7a\u011fr\u0131lamaz; y\u00f6nteme ili\u015fkin XPathResultType {1}. Bu y\u00f6ntem yaln\u0131zca UNORDERED_NODE_SNAPSHOT_TYPE ve ORDERED_NODE_SNAPSHOT_TYPE tipleri i\u00e7in ge\u00e7erlidir."}, { ER_NON_ITERATOR_TYPE, "iterateNext y\u00f6ntemi, ''{0}'' XPath ifadesinin XPathResult''\u0131nda \u00e7a\u011fr\u0131lamaz; y\u00f6nteme ili\u015fkin XPathResultType {1}. Bu y\u00f6ntem yaln\u0131zca UNORDERED_NODE_ITERATOR_TYPE ve ORDERED_NODE_ITERATOR_TYPE tipleri i\u00e7in ge\u00e7erlidir."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Sonu\u00e7 d\u00f6nd\u00fcr\u00fcld\u00fckten sonra belge de\u011fi\u015ftirildi. Yineleyici ge\u00e7ersiz."}, { ER_INVALID_XPATH_TYPE, "Ge\u00e7ersiz XPath tipi ba\u011f\u0131ms\u0131z de\u011fi\u015fkeni: {0}"}, { ER_EMPTY_XPATH_RESULT, "Bo\u015f XPath sonu\u00e7 nesnesi"}, { ER_INCOMPATIBLE_TYPES, "''{0}'' XPath ifadesine ili\u015fkin XPathResult''\u0131n XPathResultType de\u011feri ({1}), belirtilen XPathResultType {2} tipine zorlanamaz."}, { ER_NULL_RESOLVER, "Bo\u015f de\u011ferli \u00f6nek \u00e7\u00f6z\u00fcc\u00fcyle \u00f6nek \u00e7\u00f6z\u00fclemez."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "''{0}'' XPath ifadesine ili\u015fkin XPathResult''\u0131n XPathResultType de\u011feri ({1}) bir dizgiye d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "snapshotItem y\u00f6ntemi, ''{0}'' XPath ifadesinin XPathResult''\u0131nda \u00e7a\u011fr\u0131lamaz; y\u00f6nteme ili\u015fkin XPathResultType {1}. Bu y\u00f6ntem yaln\u0131zca UNORDERED_NODE_SNAPSHOT_TYPE ve ORDERED_NODE_SNAPSHOT_TYPE tipleri i\u00e7in ge\u00e7erlidir."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Ba\u011flam d\u00fc\u011f\u00fcm\u00fc, bu XPathEvaluator arabirimine ba\u011flanan belgeye ait de\u011fil."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Ba\u011flam d\u00fc\u011f\u00fcm\u00fc tipi desteklenmiyor."}, { ER_XPATH_ERROR, "XPath i\u00e7inde bilinmeyen hata."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "''{0}'' XPath ifadesine ili\u015fkin XPathResult''\u0131n XPathResultType de\u011feri ({1}) bir say\u0131ya d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "XMLConstants.FEATURE_SECURE_PROCESSING \u00f6zelli\u011fi true de\u011ferine ayarland\u0131\u011f\u0131nda ''{0}'' eklenti i\u015flevi \u00e7a\u011fr\u0131lamaz."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "{0} de\u011fi\u015fkenine ili\u015fkin resolveVariable bo\u015f de\u011fer d\u00f6nd\u00fcr\u00fcyor"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Desteklenmeyen d\u00f6n\u00fc\u015f tipi: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Kaynak ve/ya da d\u00f6n\u00fc\u015f tipi bo\u015f de\u011ferli olamaz"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "{0} ba\u011f\u0131ms\u0131z de\u011fi\u015fkeni bo\u015f de\u011ferli olamaz"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel ) objectModel == null ile \u00e7a\u011fr\u0131lamaz"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) objectModel == \"\" ile \u00e7a\u011fr\u0131lamaz"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Ad\u0131 bo\u015f de\u011ferli bir \u00f6zellik belirleme giri\u015fimi: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Bilinmeyen \"{0}\" \u00f6zelli\u011fini belirleme giri\u015fimi: {1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Bo\u015f de\u011ferli bir adla \u00f6zellik alma giri\u015fimi: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Bilinmeyen \"{0}\" \u00f6zelli\u011fini alma giri\u015fimi: {1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Bo\u015f de\u011ferli XPathFunctionResolver belirleme giri\u015fimi: {0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Bo\u015f de\u011ferli bir XPathVariableResolver belirleme giri\u015fimi: {0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "format-number i\u015flevinde \u00fclke de\u011feri ad\u0131 hen\u00fcz i\u015flenmedi!"}, { WG_PROPERTY_NOT_SUPPORTED, "XSL \u00f6zelli\u011fi desteklenmiyor: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "{1} \u00f6zelli\u011findeki {0} ad alan\u0131yla \u015fu an hi\u00e7bir \u015fey yapmay\u0131n"}, { WG_SECURITY_EXCEPTION, "{0} XSL sistem \u00f6zelli\u011fine eri\u015fme giri\u015fimi s\u0131ras\u0131nda SecurityException"}, { WG_QUO_NO_LONGER_DEFINED, "Eski s\u00f6zdizimi: quo(...) art\u0131k XPath i\u00e7inde tan\u0131mlanmaz."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "nodeTest uygulanmas\u0131 i\u00e7in XPath t\u00fcretilmi\u015f bir nesne gerektirir!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "\u0130\u015flev simgesi bulunamad\u0131."}, { WG_COULDNOT_FIND_FUNCTION, "\u0130\u015flev bulunamad\u0131: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Dizgiden URL olu\u015fturulamad\u0131: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "DTM ayr\u0131\u015ft\u0131r\u0131c\u0131s\u0131 i\u00e7in -E se\u00e7ene\u011fi desteklenmiyor"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "De\u011fi\u015fken i\u00e7in belirtilen VariableReference ba\u011flam d\u0131\u015f\u0131 ya da tan\u0131ms\u0131z! Ad = {0}"}, { WG_UNSUPPORTED_ENCODING, "Desteklenmeyen kodlama: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "tr"}, { "help_language", "tr"}, { "language", "tr"}, { "BAD_CODE", "createMessage i\u00e7in kullan\u0131lan de\u011fi\u015ftirge s\u0131n\u0131rlar\u0131n d\u0131\u015f\u0131nda"}, { "FORMAT_FAILED", "messageFormat \u00e7a\u011fr\u0131s\u0131 s\u0131ras\u0131nda kural d\u0131\u015f\u0131 durum yay\u0131nland\u0131"}, { "version", ">>>>>>> Xalan S\u00fcr\u00fcm "}, { "version2", "<<<<<<<"}, { "yes", "yes"}, { "line", "Sat\u0131r #"}, { "column", "Kolon #"}, { "xsldone", "XSLProcessor: bitti"}, { "xpath_option", "xpath se\u00e7enekleri: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select xpath ifadesi]"}, { "optionMatch", " [-match e\u015fle\u015fme \u00f6r\u00fcnt\u00fcs\u00fc (e\u015fle\u015fme tan\u0131lamas\u0131 i\u00e7in)]"}, { "optionAnyExpr", "Ya da yaln\u0131zca xpath ifadesi de tan\u0131lama d\u00f6k\u00fcm\u00fc sa\u011flar"}, { "noParsermsg1", "XSL i\u015flemi ba\u015far\u0131s\u0131z oldu."}, { "noParsermsg2", "** Ayr\u0131\u015ft\u0131r\u0131c\u0131 bulunamad\u0131 **"}, { "noParsermsg3", "L\u00fctfen classpath de\u011fi\u015fkeninizi inceleyin."}, { "noParsermsg4", "Sisteminizde IBM XML Parser for Java arac\u0131 yoksa, \u015fu adresten y\u00fckleyebilirsiniz:"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "HATALI_KOD"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "B\u0130\u00c7\u0130MLEME_BA\u015eARISIZ"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#hata"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Hata: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Uyar\u0131: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "\u00d6R\u00dcNT\u00dc "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("tr", "TR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_fr.java0000644000175000017500000012606010721374031025142 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_fr.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_fr extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "La fonction current() n'est pas admise dans un motif de correspondance !" }, { ER_CURRENT_TAKES_NO_ARGS, "La fonction current() n'accepte pas d'arguments !" }, { ER_DOCUMENT_REPLACED, "L'impl\u00e9mentation de la fonction document() a \u00e9t\u00e9 remplac\u00e9e par org.apache.xalan.xslt.FuncDocument !"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "Le contexte ne poss\u00e8de pas de document propri\u00e9taire !"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() poss\u00e8de trop d'arguments."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() poss\u00e8de trop d'arguments."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() poss\u00e8de trop d'arguments."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() poss\u00e8de trop d'arguments."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() poss\u00e8de trop d'arguments."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() poss\u00e8de trop d'arguments."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() poss\u00e8de trop d'arguments."}, { ER_TRANSLATE_TAKES_3_ARGS, "La fonction translate() accepte trois arguments !"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Un argument doit \u00eatre fournie \u00e0 la fonction unparsed-entity-uri !"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "L'axe de l'espace de noms n'est pas impl\u00e9ment\u00e9 !"}, { ER_UNKNOWN_AXIS, "axe inconnu : {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "op\u00e9ration de correspondance inconnue !"}, { ER_INCORRECT_ARG_LENGTH, "La longueur d'argument du test du noeud processing-instruction() n'est pas correcte !"}, { ER_CANT_CONVERT_TO_NUMBER, "Impossible de convertir {0} en un nombre"}, { ER_CANT_CONVERT_TO_NODELIST, "Impossible de convertir {0} en un NodeList !"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Impossible de convertir {0} en un NodeSetDTM !"}, { ER_CANT_CONVERT_TO_TYPE, "Impossible de convertir {0} en un type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "Motif de correspondance obligatoire dans getMatchScore !"}, { ER_COULDNOT_GET_VAR_NAMED, "Impossible d''extraire la variable {0}"}, { ER_UNKNOWN_OPCODE, "ERREUR ! Code op\u00e9ration inconnu : {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Jetons incorrects suppl\u00e9mentaires : {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Erreur de guillemets dans un litt\u00e9ral... Guillemet double obligatoire !"}, { ER_EXPECTED_SINGLE_QUOTE, "Erreur de guillemets dans un litt\u00e9ral... Guillemet simple obligatoire !"}, { ER_EMPTY_EXPRESSION, "Expression vide !"}, { ER_EXPECTED_BUT_FOUND, "{1} a \u00e9t\u00e9 trouv\u00e9 alors que {0} \u00e9tait attendu :"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Assertion de programme incorrecte ! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "L'argument bool\u00e9en(...) n'est plus optionnel avec le document de normalisation XPath 19990709."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Virgule trouv\u00e9e sans argument qui la pr\u00e9c\u00e8de !"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Virgule trouv\u00e9e sans argument qui la suit !"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "La syntaxe '[pr\u00e9dicat]' ou '.[pr\u00e9dicat]' est incorrecte. Pr\u00e9f\u00e9rez 'self::node()[pr\u00e9dicat]'."}, { ER_ILLEGAL_AXIS_NAME, "nom d''axe incorrect : {0}"}, { ER_UNKNOWN_NODETYPE, "Type de noeud inconnu : {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Le litt\u00e9ral de motif ({0}) doit figurer entre guillemets !"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} ne peut \u00eatre format\u00e9e sous forme num\u00e9rique !"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Impossible de cr\u00e9er XML TransformerFactory Liaison : {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Erreur ! Impossible de trouver l'expression de s\u00e9lection xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "ERREUR ! Impossible de trouver ENDOP apr\u00e8s OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Une erreur s'est produite !"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "R\u00e9f\u00e9rence de la variable hors contexte ou sans d\u00e9finition ! Nom = {0}"}, { ER_AXES_NOT_ALLOWED, "Seuls les axes child:: et attribute:: sont autoris\u00e9s dans des motifs de correspondance ! Axes incorrects= {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() poss\u00e8de un nombre non valide d'arguments."}, { ER_COUNT_TAKES_1_ARG, "Un seul argument doit \u00eatre fourni \u00e0 la fonction count !"}, { ER_COULDNOT_FIND_FUNCTION, "Impossible de trouver la fonction : {0}"}, { ER_UNSUPPORTED_ENCODING, "Codage non pris en charge : {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Une erreur s'est produite dans la DTM de getNextSibling... Tentative de reprise en cours"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Erreur de programme : Ecriture impossible dans EmptyNodeList."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "SetDOMFactory n'est pas pris en charge par XPathContext !"}, { ER_PREFIX_MUST_RESOLVE, "Le pr\u00e9fixe doit se convertir en espace de noms : {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource source) non pris en charge dans XPathContext ! Ouverture de {0} impossible"}, { ER_SAX_API_NOT_HANDLED, "Caract\u00e8res (char ch[]...) de l'API SAX non pris en charge par le DTM !"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... non pris en charge par le DTM !"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison ne prend pas en charge des noeuds de type {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper ne prend pas en charge des noeuds de type {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Erreur de DOM2Helper.parse : ID syst\u00e8me - {0} ligne - {1}"}, { ER_XERCES_PARSE_ERROR, "Erreur de DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Substitut UTF-16 non valide d\u00e9tect\u00e9 : {0} ?"}, { ER_OIERROR, "Erreur d'E-S"}, { ER_CANNOT_CREATE_URL, "Impossible de cr\u00e9er une URL pour : {0}"}, { ER_XPATH_READOBJECT, "Dans XPath.readObject : {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "jeton de fonction introuvable."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Impossible de traiter le type XPath : {0}"}, { ER_NODESET_NOT_MUTABLE, "NodeSet indivisible"}, { ER_NODESETDTM_NOT_MUTABLE, "NodeSetDTM indivisible"}, { ER_VAR_NOT_RESOLVABLE, "Impossible de r\u00e9soudre la variable : {0}"}, { ER_NULL_ERROR_HANDLER, "Gestionnaire d'erreurs vide"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Assertion de programme : code op\u00e9ration inconnu : {0}"}, { ER_ZERO_OR_ONE, "0 ou 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() non pris en charge par XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() non pris en charge par XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() non pris en charge par XRTreeFragSelectWrapper"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() non pris en charge par XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() non pris en charge par XRTreeFragSelectWrapper"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() non pris en charge par XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() non pris en charge par XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "Impossible de trouver la variable portant le nom {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars n'accepte pas de cha\u00eene comme argument"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "L'argument FastStringBuffer ne doit pas \u00eatre vide"}, { ER_TWO_OR_THREE, "2 ou 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "L'acc\u00e8s \u00e0 la variable a pr\u00e9c\u00e9d\u00e9 la liaison de celle-ci !"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB n'accepte pas de cha\u00eene comme argument !"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Erreur ! D\u00e9finition d'une valeur nulle pour la racine d'un \u00e9l\u00e9ment walker !!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Ce NodeSetDTM ne permet pas d'it\u00e9ration vers un noeud pr\u00e9c\u00e9dent !"}, { ER_NODESET_CANNOT_ITERATE, "Ce NodeSet ne permet pas d'it\u00e9ration vers un noeud pr\u00e9c\u00e9dent !"}, { ER_NODESETDTM_CANNOT_INDEX, "Ce NodeSetDTM ne peut pas effectuer de fonctions d'indexage ou de d\u00e9nombrement !"}, { ER_NODESET_CANNOT_INDEX, "Ce NodeSet ne peut pas effectuer de fonctions d'indexage ou de d\u00e9nombrement !"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Impossible d'appeler setShouldCacheNodes apr\u00e8s nextNode !"}, { ER_ONLY_ALLOWS, "{0} accepte uniquement {1} arguments"}, { ER_UNKNOWN_STEP, "Assertion du programmeur dans getNextStepPos : stepType inconnu : {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Un chemin d'emplacement relatif \u00e9tait attendu apr\u00e8s le jeton '/' ou '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Un chemin d''emplacement \u00e9tait attendu, mais le jeton suivant a \u00e9t\u00e9 d\u00e9tect\u00e9 : {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Un chemin d'emplacement \u00e9tait attendu mais la fin de l'expression XPath a \u00e9t\u00e9 d\u00e9tect\u00e9e."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Une \u00e9tape d'emplacement \u00e9tait attendue apr\u00e8s le jeton '/' ou '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Un test de noeud correspondant \u00e0 NCName:* ou QName \u00e9tait attendu."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Un mod\u00e8le d'\u00e9tape \u00e9tait attendu, mais '/' a \u00e9t\u00e9 d\u00e9tect\u00e9."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Un mod\u00e8le de chemin relatif \u00e9tait attendu."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "Le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' a un type XPathResultType de {1} qui ne peut pas \u00eatre converti en valeur bool\u00e9enne."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "Le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' a un type XPathResultType de {1} qui ne peut pas \u00eatre converti en noeud unique. La m\u00e9thode getSingleNodeValue s''applique uniquement aux types ANY_UNORDERED_NODE_TYPE et FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "La m\u00e9thode getSnapshotLength ne peut pas \u00eatre appel\u00e9e sur le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' car son type XPathResultType est {1}. Cette m\u00e9thode s''applique uniquement aux types UNORDERED_NODE_SNAPSHOT_TYPE et ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "La m\u00e9thode iterateNext ne peut pas \u00eatre appel\u00e9e sur le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' car son type XPathResultType est {1}. Cette m\u00e9thode s''applique uniquement aux types UNORDERED_NODE_ITERATOR_TYPE et ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Mutation du document depuis le renvoi du r\u00e9sultat. L'it\u00e9rateur est incorrect."}, { ER_INVALID_XPATH_TYPE, "Argument de type XPath incorrect : {0}"}, { ER_EMPTY_XPATH_RESULT, "Objet r\u00e9sultat XPath vide"}, { ER_INCOMPATIBLE_TYPES, "Le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' a un type XPathResultType de {1} qui ne peut pas \u00eatre forc\u00e9 dans le type XPathResultType indiqu\u00e9 de {2}."}, { ER_NULL_RESOLVER, "Conversion impossible du pr\u00e9fixe avec un programme de r\u00e9solution de pr\u00e9fixe de valeur nulle."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "Le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' a un type XPathResultType de {1} qui ne peut pas \u00eatre converti en cha\u00eene."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "La m\u00e9thode snapshotItem ne peut pas \u00eatre appel\u00e9e sur le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' car son type XPathResultType est {1}. Cette m\u00e9thode s''applique uniquement aux types UNORDERED_NODE_SNAPSHOT_TYPE et ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Le noeud de contexte n'appartient pas au document li\u00e9 \u00e0 ce XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Le type de noeud contextuel n'est pas pris en charge."}, { ER_XPATH_ERROR, "Erreur inconnue d\u00e9tect\u00e9e dans XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "Le r\u00e9sultat XPathResult de l''expression XPath ''{0}'' a un type XPathResultType de {1} qui ne peut pas \u00eatre converti en un nombre."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "La fonction d''extension : ''{0}'' ne peut pas \u00eatre appel\u00e9e lorsque la fonction XMLConstants.FEATURE_SECURE_PROCESSING a la valeur true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable pour la variable {0} renvoyant la valeur null"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Type de retour non pris en charge : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Le type de retour et/ou source ne peut pas avoir une valeur null"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "L''argument {0} ne peut pas avoir une valeur null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( Cha\u00eene objectModel ) ne peut pas \u00eatre appel\u00e9 avec objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( Cha\u00eene objectModel ) ne peut pas \u00eatre appel\u00e9 avec objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Tentative de d\u00e9finition d''une fonction ayant un nom null : {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Tentative de d\u00e9finition d''une fonction inconnue \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Tentative de d\u00e9finition d''une fonction ayant un nom null : {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Tentative d''extraction d''une fonction inconnue \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Tentative de d\u00e9finition d''un \u00e9l\u00e9ment XPathFunctionResolver null : {0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Tentative de d\u00e9finition d''un \u00e9l\u00e9ment XPathVariableResolver null : {0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "Le nom d'environnement local de la fonction format-number n'est pas encore pris en charge."}, { WG_PROPERTY_NOT_SUPPORTED, "Propri\u00e9t\u00e9 XSL non prise en charge : {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Espace de noms {0} inexploitable dans la propri\u00e9t\u00e9 : {1}"}, { WG_SECURITY_EXCEPTION, "Une exception de s\u00e9curit\u00e9 s''est produite lors de l''acc\u00e8s \u00e0 la propri\u00e9t\u00e9 : {0}"}, { WG_QUO_NO_LONGER_DEFINED, "L'ancienne syntaxe : quo(...) n'est plus d\u00e9finie dans XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath requiert un objet d\u00e9riv\u00e9 pour impl\u00e9menter nodeTest !"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "jeton de fonction introuvable."}, { WG_COULDNOT_FIND_FUNCTION, "Impossible de trouver la fonction : {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Impossible de cr\u00e9er l''URL \u00e0 partir de : {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "L'option -E n'est pas prise en charge pour l'analyseur DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "R\u00e9f\u00e9rence de la variable hors contexte ou sans d\u00e9finition ! Nom = {0}"}, { WG_UNSUPPORTED_ENCODING, "Codage non pris en charge : {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "en"}, { "help_language", "en"}, { "language", "en"}, { "BAD_CODE", "Le param\u00e8tre de createMessage se trouve hors limites"}, { "FORMAT_FAILED", "Exception soulev\u00e9e lors de l'appel de messageFormat"}, { "version", ">>>>>>> Version de Xalan "}, { "version2", "<<<<<<<"}, { "yes", "oui"}, { "line", "Ligne #"}, { "column", "Colonne #"}, { "xsldone", "XSLProcessor : termin\u00e9"}, { "xpath_option", "options xpath : "}, { "optionIN", " [-in URLXMLentr\u00e9e]"}, { "optionSelect", " [-select expression xpath]"}, { "optionMatch", " [-match motif de correspondance (diagnostics)]"}, { "optionAnyExpr", "Une expression xpath effectuera un vidage de diagnostics"}, { "noParsermsg1", "Echec du processus XSL."}, { "noParsermsg2", "** Analyseur introuvable **"}, { "noParsermsg3", "V\u00e9rifiez le chemin d'acc\u00e8s des classes."}, { "noParsermsg4", "XML Parser for Java disponible en t\u00e9l\u00e9chargement sur le site"}, { "noParsermsg5", "AlphaWorks de IBM : http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Erreur : "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Avertissement : "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources.java0000644000175000017500000012113110721374032024446 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "The current() function is not allowed in a match pattern!" }, { ER_CURRENT_TAKES_NO_ARGS, "The current() function does not accept arguments!" }, { ER_DOCUMENT_REPLACED, "document() function implementation has been replaced by org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "context does not have an owner document!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() has too many arguments."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() has too many arguments."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() has too many arguments."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() has too many arguments."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() has too many arguments."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() has too many arguments."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() has too many arguments."}, { ER_TRANSLATE_TAKES_3_ARGS, "The translate() function takes three arguments!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "The unparsed-entity-uri function should take one argument!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "namespace axis not implemented yet!"}, { ER_UNKNOWN_AXIS, "unknown axis: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "unknown match operation!"}, { ER_INCORRECT_ARG_LENGTH, "Arg length of processing-instruction() node test is incorrect!"}, { ER_CANT_CONVERT_TO_NUMBER, "Can not convert {0} to a number"}, { ER_CANT_CONVERT_TO_NODELIST, "Can not convert {0} to a NodeList!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Can not convert {0} to a NodeSetDTM!"}, { ER_CANT_CONVERT_TO_TYPE, "Can not convert {0} to a type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "Expected match pattern in getMatchScore!"}, { ER_COULDNOT_GET_VAR_NAMED, "Could not get variable named {0}"}, { ER_UNKNOWN_OPCODE, "ERROR! Unknown op code: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Extra illegal tokens: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "misquoted literal... expected double quote!"}, { ER_EXPECTED_SINGLE_QUOTE, "misquoted literal... expected single quote!"}, { ER_EMPTY_EXPRESSION, "Empty expression!"}, { ER_EXPECTED_BUT_FOUND, "Expected {0}, but found: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Programmer assertion is incorrect! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "boolean(...) argument is no longer optional with 19990709 XPath draft."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Found ',' but no preceding argument!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Found ',' but no following argument!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' or '.[predicate]' is illegal syntax. Use 'self::node()[predicate]' instead."}, { ER_ILLEGAL_AXIS_NAME, "illegal axis name: {0}"}, { ER_UNKNOWN_NODETYPE, "Unknown nodetype: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Pattern literal ({0}) needs to be quoted!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} could not be formatted to a number!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Could not create XML TransformerFactory Liaison: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Error! Did not find xpath select expression (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "ERROR! Could not find ENDOP after OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Error occured!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference given for variable out of context or without definition! Name = {0}"}, { ER_AXES_NOT_ALLOWED, "Only child:: and attribute:: axes are allowed in match patterns! Offending axes = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() has an incorrect number of arguments."}, { ER_COUNT_TAKES_1_ARG, "The count function should take one argument!"}, { ER_COULDNOT_FIND_FUNCTION, "Could not find function: {0}"}, { ER_UNSUPPORTED_ENCODING, "Unsupported encoding: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Problem occured in DTM in getNextSibling... trying to recover"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Programmer error: EmptyNodeList can not be written to."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory is not supported by XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "Prefix must resolve to a namespace: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource source) not supported in XPathContext! Can not open {0}"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... not handled by the DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... not handled by the DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison can not handle nodes of type {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper can not handle nodes of type {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse error: SystemID - {0} line - {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse error"}, { ER_INVALID_UTF16_SURROGATE, "Invalid UTF-16 surrogate detected: {0} ?"}, { ER_OIERROR, "IO error"}, { ER_CANNOT_CREATE_URL, "Cannot create url for: {0}"}, { ER_XPATH_READOBJECT, "In XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "function token not found."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Can not deal with XPath type: {0}"}, { ER_NODESET_NOT_MUTABLE, "This NodeSet is not mutable"}, { ER_NODESETDTM_NOT_MUTABLE, "This NodeSetDTM is not mutable"}, { ER_VAR_NOT_RESOLVABLE, "Variable not resolvable: {0}"}, { ER_NULL_ERROR_HANDLER, "Null error handler"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Programmer''s assertion: unknown opcode: {0}"}, { ER_ZERO_OR_ONE, "0 or 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() not supported by XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() not supported by XRTreeFragSelectWrapper"}, /** detach() not supported by XRTreeFragSelectWrapper */ { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() not supported by XRTreeFragSelectWrapper"}, /** num() not supported by XRTreeFragSelectWrapper */ { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() not supported by XRTreeFragSelectWrapper"}, /** xstr() not supported by XRTreeFragSelectWrapper */ { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() not supported by XRTreeFragSelectWrapper"}, /** str() not supported by XRTreeFragSelectWrapper */ { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() not supported by XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() not supported for XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "Could not find variable with the name of {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars can not take a string for an argument"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "The FastStringBuffer argument can not be null"}, { ER_TWO_OR_THREE, "2 or 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Variable accessed before it is bound!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB can not take a string for an argument!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Error! Setting the root of a walker to null!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "This NodeSetDTM can not iterate to a previous node!"}, { ER_NODESET_CANNOT_ITERATE, "This NodeSet can not iterate to a previous node!"}, { ER_NODESETDTM_CANNOT_INDEX, "This NodeSetDTM can not do indexing or counting functions!"}, { ER_NODESET_CANNOT_INDEX, "This NodeSet can not do indexing or counting functions!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Can not call setShouldCacheNodes after nextNode has been called!"}, { ER_ONLY_ALLOWS, "{0} only allows {1} arguments"}, { ER_UNKNOWN_STEP, "Programmer''s assertion in getNextStepPos: unknown stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "A relative location path was expected following the '/' or '//' token."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "A location path was expected, but the following token was encountered\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "A location path was expected, but the end of the XPath expression was found instead."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "A location step was expected following the '/' or '//' token."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "A node test that matches either NCName:* or QName was expected."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "A step pattern was expected, but '/' was encountered."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "A relative path pattern was expected."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a boolean."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a single node. The method getSingleNodeValue applies only to types ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "The method getSnapshotLength cannot be called on the XPathResult of XPath expression ''{0}'' because its XPathResultType is {1}. This method applies only to types UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "The method iterateNext cannot be called on the XPathResult of XPath expression ''{0}'' because its XPathResultType is {1}. This method applies only to types UNORDERED_NODE_ITERATOR_TYPE and ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Document mutated since result was returned. Iterator is invalid."}, { ER_INVALID_XPATH_TYPE, "Invalid XPath type argument: {0}"}, { ER_EMPTY_XPATH_RESULT, "Empty XPath result object"}, { ER_INCOMPATIBLE_TYPES, "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."}, { ER_NULL_RESOLVER, "Unable to resolve prefix with null prefix resolver."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a string."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "The method snapshotItem cannot be called on the XPathResult of XPath expression ''{0}'' because its XPathResultType is {1}. This method applies only to types UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Context node does not belong to the document that is bound to this XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "The context node type is not supported."}, { ER_XPATH_ERROR, "Unknown error in XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a number"}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Extension function: ''{0}'' can not be invoked when the XMLConstants.FEATURE_SECURE_PROCESSING feature is set to true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable for variable {0} returning null"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "UnSupported Return Type : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Source and/or Return Type can not be null"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Source and/or Return Type can not be null"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "{0} argument can not be null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel ) cannot be called with objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) cannot be called with objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Trying to set a feature with a null name: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Trying to set the unknown feature \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Trying to get a feature with a null name: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Trying to get the unknown feature \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Attempting to set a null XPathFunctionResolver:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Attempting to set a null XPathVariableResolver:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "locale name in the format-number function not yet handled!"}, { WG_PROPERTY_NOT_SUPPORTED, "XSL Property not supported: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Do not currently do anything with namespace {0} in property: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException when trying to access XSL system property: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Old syntax: quo(...) is no longer defined in XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath needs a derived object to implement nodeTest!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "function token not found."}, { WG_COULDNOT_FIND_FUNCTION, "Could not find function: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Can not make URL from: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "-E option not supported for DTM parser"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference given for variable out of context or without definition! Name = {0}"}, { WG_UNSUPPORTED_ENCODING, "Unsupported encoding: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "en"}, { "help_language", "en"}, { "language", "en"}, { "BAD_CODE", "Parameter to createMessage was out of bounds"}, { "FORMAT_FAILED", "Exception thrown during messageFormat call"}, { "version", ">>>>>>> Xalan Version "}, { "version2", "<<<<<<<"}, { "yes", "yes"}, { "line", "Line #"}, { "column", "Column #"}, { "xsldone", "XSLProcessor: done"}, { "xpath_option", "xpath options: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select xpath expression]"}, { "optionMatch", " [-match match pattern (for match diagnostics)]"}, { "optionAnyExpr", "Or just an xpath expression will do a diagnostic dump"}, { "noParsermsg1", "XSL Process was not successful."}, { "noParsermsg2", "** Could not find parser **"}, { "noParsermsg3", "Please check your classpath."}, { "noParsermsg4", "If you don't have IBM's XML Parser for Java, you can download it from"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Error: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Warning: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_cs.java0000644000175000017500000012701310721374031025137 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_cs.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_cs extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "Funkce current() nen\u00ed ve vzorku shody povolena!" }, { ER_CURRENT_TAKES_NO_ARGS, "Funkce current() neakceptuje argumenty!" }, { ER_DOCUMENT_REPLACED, "implementace funkce document() byla nahrazena funkc\u00ed org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "Parametr context nem\u00e1 dokument vlastn\u00edka!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce local-name()."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce namespace-uri()."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce normalize-space()."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce number()."}, { ER_NAME_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce name()."}, { ER_STRING_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce string()."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "P\u0159\u00edli\u0161 mnoho argument\u016f funkce string-length()."}, { ER_TRANSLATE_TAKES_3_ARGS, "Funkce translate() akceptuje t\u0159i argumenty!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Funkce unparsed-entity-uri mus\u00ed akceptovat jeden argument!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "Obor n\u00e1zv\u016f axis nebyl je\u0161t\u011b implementov\u00e1n!"}, { ER_UNKNOWN_AXIS, "nezn\u00e1m\u00fd parametr axis: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "nezn\u00e1m\u00e1 operace shody!"}, { ER_INCORRECT_ARG_LENGTH, "Nespr\u00e1vn\u00e1 d\u00e9lka argumentu testu uzlu processing-instruction()!"}, { ER_CANT_CONVERT_TO_NUMBER, "{0} nelze p\u0159ev\u00e9st na parametr number"}, { ER_CANT_CONVERT_TO_NODELIST, "{0} nelze p\u0159ev\u00e9st na parametr NodeList!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0} nelze p\u0159ev\u00e9st na parametr NodeSetDTM!"}, { ER_CANT_CONVERT_TO_TYPE, "{0} nelze p\u0159ev\u00e9st na parametr type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "Funkce getMatchScore o\u010dek\u00e1v\u00e1 parametr!"}, { ER_COULDNOT_GET_VAR_NAMED, "Nelze z\u00edskat prom\u011bnnou s n\u00e1zvem {0}"}, { ER_UNKNOWN_OPCODE, "Chyba! Nezn\u00e1m\u00fd k\u00f3d operace: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Dal\u0161\u00ed nepovolen\u00e9 tokeny: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "nespr\u00e1vn\u011b uveden\u00fd liter\u00e1l... Byly o\u010dek\u00e1v\u00e1ny uvozovky!"}, { ER_EXPECTED_SINGLE_QUOTE, "nespr\u00e1vn\u011b uveden\u00fd liter\u00e1l... Byly o\u010dek\u00e1v\u00e1ny jednoduch\u00e9 uvozovky!"}, { ER_EMPTY_EXPRESSION, "Pr\u00e1zdn\u00fd v\u00fdraz!"}, { ER_EXPECTED_BUT_FOUND, "O\u010dek\u00e1v\u00e1no: {0}, ale nalezeno: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Nespr\u00e1vn\u00e9 tvrzen\u00ed program\u00e1tora! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "booleovsk\u00fd(...) argument ji\u017e nen\u00ed v n\u00e1vrhu 19990709 XPath voliteln\u00fd."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Byl nalezen znak ',' bez p\u0159edchoz\u00edho argumentu!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Byl nalezen znak ',' bez n\u00e1sleduj\u00edc\u00edho argumentu!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "V\u00fdraz '..[predicate]' nebo '.[predicate]' m\u00e1 nespr\u00e1vnou syntaxi. Pou\u017eijte m\u00edsto toho 'self::node()[predicate]'."}, { ER_ILLEGAL_AXIS_NAME, "nepovolen\u00fd n\u00e1zev osy: {0}"}, { ER_UNKNOWN_NODETYPE, "Nezn\u00e1m\u00fd typ uzlu: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Je nutno uv\u00e9st vzorek liter\u00e1lu ({0})!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} nelze zform\u00e1tovat jako \u010d\u00edslo!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Nelze vytvo\u0159it prvek XML TransformerFactory Liaison: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Chyba! Nebyl nalezen v\u00fdraz v\u00fdb\u011bru xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "Chyba! Nebyl nalezen v\u00fdraz ENDOP po OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Do\u0161lo k chyb\u011b!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "Odkaz VariableReference uveden k prom\u011bnn\u00e9 mimo kontext nebo bez definice! N\u00e1zev = {0}"}, { ER_AXES_NOT_ALLOWED, "Ve vzorc\u00edch shody jsou povoleny pouze osy child:: a attribute::! Nepovolen\u00e9 osy = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "nespr\u00e1vn\u00fd po\u010det argument\u016f parametru key()."}, { ER_COUNT_TAKES_1_ARG, "Funkce count mus\u00ed obsahovat jeden argument!"}, { ER_COULDNOT_FIND_FUNCTION, "Nelze nal\u00e9zt funkci: {0}"}, { ER_UNSUPPORTED_ENCODING, "Nepodporovan\u00e9 k\u00f3dov\u00e1n\u00ed: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Ve funkci getNextSibling do\u0161lo v DTM k chyb\u011b... Prob\u00edh\u00e1 pokus o obnovu"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Chyba program\u00e1tora: Do funkce EmptyNodeList nelze zapisovat."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "Funkce XPathContext nepodporuje funkci setDOMFactory!"}, { ER_PREFIX_MUST_RESOLVE, "P\u0159edponu mus\u00ed b\u00fdt mo\u017eno p\u0159elo\u017eit do oboru n\u00e1zv\u016f: {0}"}, { ER_PARSE_NOT_SUPPORTED, "Funkce XPathContext nepodporuje anal\u00fdzu (InputSource source)! {0} - nelze otev\u0159\u00edt"}, { ER_SAX_API_NOT_HANDLED, "Znaky SAX API (char ch[]... nen\u00ed v DTM zpracov\u00e1v\u00e1na!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "Funkce ignorableWhitespace(char ch[]... nen\u00ed v DTM zpracov\u00e1v\u00e1na!"}, { ER_DTM_CANNOT_HANDLE_NODES, "Funkce DTMLiaison nem\u016f\u017ee zpracov\u00e1vat uzly typu {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "Funkce DOM2Helper nem\u016f\u017ee zpracov\u00e1vat uzly typu {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Chyba funkce DOM2Helper.parse: SystemID - {0} \u0159\u00e1dek - {1}"}, { ER_XERCES_PARSE_ERROR, "Chyba funkce DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Byla zji\u0161t\u011bna neplatn\u00e1 n\u00e1hrada UTF-16: {0} ?"}, { ER_OIERROR, "Chyba vstupu/v\u00fdstupu"}, { ER_CANNOT_CREATE_URL, "Nelze vytvo\u0159it url pro: {0}"}, { ER_XPATH_READOBJECT, "Ve funkci XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "nebyl nalezen token funkce."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Nelze pracovat s typem XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Tento prvek NodeSet nelze m\u011bnit"}, { ER_NODESETDTM_NOT_MUTABLE, "Tento prvek NodeSetDTM nelze m\u011bnit"}, { ER_VAR_NOT_RESOLVABLE, "Prom\u011bnnou nelze p\u0159elo\u017eit: {0}"}, { ER_NULL_ERROR_HANDLER, "Obslu\u017en\u00fd program pro zpracov\u00e1n\u00ed chyb hodnoty null"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Tvrzen\u00ed program\u00e1tora: nezn\u00e1m\u00fd k\u00f3d operace: {0}"}, { ER_ZERO_OR_ONE, "0 nebo 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Modul XRTreeFragSelectWrapper nepodporuje rtf()"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Modul XRTreeFragSelectWrapper nepodporuje funkci asNodeIterator()"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Modul XRTreeFragSelectWrapper nepodporuje funkci detach()"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Modul XRTreeFragSelectWrapper nepodporuje funkci num()"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Modul XRTreeFragSelectWrapper nepodporuje funkci xstr()"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Modul XRTreeFragSelectWrapper nepodporuje funkci str()"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "Funkce XStringForChars nepodporuje funkci fsb()"}, { ER_COULD_NOT_FIND_VAR, "Nelze nal\u00e9zt prom\u011bnnou s n\u00e1zvem {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "Argumentem funkce XStringForChars nem\u016f\u017ee b\u00fdt \u0159et\u011bzec"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "Argument funkce FastStringBuffer nem\u016f\u017ee m\u00edt hodnotu null"}, { ER_TWO_OR_THREE, "2 nebo 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "P\u0159\u00edstup k prom\u011bnn\u00e9 p\u0159edt\u00edm, ne\u017e je z\u00e1vazn\u00e1!"}, { ER_FSB_CANNOT_TAKE_STRING, "Argumentem funkce XStringForFSB nem\u016f\u017ee b\u00fdt \u0159et\u011bzec!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Chyba! Nastaven\u00ed ko\u0159ene objektu walker na hodnotu null!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Tato funkce NodeSetDTM nem\u016f\u017ee b\u00fdt stejn\u00e1 jako p\u0159edch\u00e1zej\u00edc\u00ed uzel!"}, { ER_NODESET_CANNOT_ITERATE, "Tato funkce NodeSet nem\u016f\u017ee b\u00fdt stejn\u00e1 jako p\u0159edch\u00e1zej\u00edc\u00ed uzel!"}, { ER_NODESETDTM_CANNOT_INDEX, "Tato funkce NodeSetDTM nem\u016f\u017ee prov\u00e1d\u011bt indexovac\u00ed nebo po\u010detn\u00ed funkce!"}, { ER_NODESET_CANNOT_INDEX, "Tato funkce NodeSet nem\u016f\u017ee prov\u00e1d\u011bt indexovac\u00ed nebo po\u010detn\u00ed funkce!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Nelze volat funkci setShouldCacheNodes pot\u00e9, co byla vol\u00e1na funkce nextNode!"}, { ER_ONLY_ALLOWS, "{0} povoluje pouze {1} argument\u016f"}, { ER_UNKNOWN_STEP, "Tvrzen\u00ed program\u00e1tora ve funkci getNextStepPos: nezn\u00e1m\u00fd typ stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Po tokenu '/' nebo '//' byla o\u010dek\u00e1v\u00e1na cesta relativn\u00edho um\u00edst\u011bn\u00ed."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "O\u010dek\u00e1vala se cesta um\u00edst\u011bn\u00ed, av\u0161ak byl zaznamen\u00e1n n\u00e1sleduj\u00edc\u00ed token\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Byla o\u010dek\u00e1v\u00e1na cesta um\u00edst\u011bn\u00ed, m\u00edsto toho v\u0161ak byl nalezen konec v\u00fdrazu XPath. "}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Po tokenu '/' nebo '//' byl o\u010dek\u00e1v\u00e1n krok um\u00edst\u011bn\u00ed"}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Byl o\u010dek\u00e1v\u00e1n test uzlu, kter\u00fd odpov\u00edd\u00e1 bu\u010f prvk\u016fm NCName:* nebo QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Byl o\u010dek\u00e1v\u00e1n vzorek kroku, av\u0161ak byl zaznamen\u00e1n znak '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Byl o\u010dek\u00e1v\u00e1n vzorek relativn\u00ed cesty."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "Hodnota XPathResult v\u00fdrazu XPath ''{0}'' je typu XPathResultType {1}, kter\u00fd nelze p\u0159ev\u00e9st na booleovsk\u00fd typ. "}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "Hodnota XPathResult v\u00fdrazu XPath ''{0}'' je typu XPathResultType {1}, kter\u00fd nelze p\u0159ev\u00e9st na jedin\u00fd uzel. Metoda getSingleNodeValue je pou\u017eiteln\u00e1 pouze pro typy ANY_UNORDERED_NODE_TYPE a FIRST_ORDERED_NODE_TYPE. "}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "Metodu getSnapshotLength nelze volat v datech XPathResult ani ve v\u00fdrazu XPath ''{0}'', proto\u017ee jej\u00ed typ XPathResultType je {1}. Tato metoda se pou\u017e\u00edv\u00e1 pouze pro typy UNORDERED_NODE_SNAPSHOT_TYPE a ORDERED_NODE_SNAPSHOT_TYPE. "}, { ER_NON_ITERATOR_TYPE, "Metodu iterateNext nelze volat v datech XPathResult ani ve v\u00fdrazu XPath ''{0}'', proto\u017ee jej\u00ed typ XPathResultType je {1}. Tato metoda se pou\u017e\u00edv\u00e1 pouze pro typy UNORDERED_NODE_ITERATOR_TYPE a ORDERED_NODE_ITERATOR_TYPE. "}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Dokument se od doby, kdy byly vr\u00e1ceny v\u00fdsledky, zm\u011bnil. Iter\u00e1tor je neplatn\u00fd."}, { ER_INVALID_XPATH_TYPE, "Neplatn\u00fd argument typu XPath: {0}"}, { ER_EMPTY_XPATH_RESULT, "Pr\u00e1zdn\u00fd objekt v\u00fdsledku XPath"}, { ER_INCOMPATIBLE_TYPES, "Hodnota XPathResult v\u00fdrazu XPath ''{0}'' je typu XPathResultType {1}, kter\u00fd nelze vynucen\u011b p\u0159ev\u00e9st na zadan\u00fd typ XPathResultType {2}. "}, { ER_NULL_RESOLVER, "Nelze \u0159e\u0161it p\u0159edponu \u0159e\u0161itelem (resolver) s p\u0159edponou hodnoty null."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "Hodnota XPathResult v\u00fdrazu XPath ''{0}'' je typu XPathResultType {1}, kter\u00fd nelze p\u0159ev\u00e9st na \u0159et\u011bzec. "}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "Metodu snapshotItem nelze volat v datech XPathResult ani ve v\u00fdrazu of XPath ''{0}'', proto\u017ee jej\u00ed typ XPathResultType je {1}. Tato metoda se pou\u017e\u00edv\u00e1 pouze pro typy UNORDERED_NODE_SNAPSHOT_TYPE a ORDERED_NODE_SNAPSHOT_TYPE. "}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Uzel kontextu nepat\u0159\u00ed mezi dokumenty, kter\u00e9 jsou v\u00e1z\u00e1ny k XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Typ uzlu kontextu nen\u00ed podporov\u00e1n."}, { ER_XPATH_ERROR, "Nezn\u00e1m\u00e1 chyba objektu XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "Hodnota XPathResult v\u00fdrazu XPath ''{0}'' je typu XPathResultType {1}, kter\u00fd nelze p\u0159ev\u00e9st na \u010d\u00edslo. "}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Roz\u0161i\u0159uj\u00edc\u00ed funkci ''{0}'' nelze vyvolat, pokud je funkce XMLConstants.FEATURE_SECURE_PROCESSING nastavena na hodnotu True. "}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "Funkce resolveVariable pro prom\u011bnnou {0} vrac\u00ed hodnotu Null"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Nepodporovan\u00fd n\u00e1vratov\u00fd typ: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Zdrojov\u00fd a n\u00e1vratov\u00fd typ nesm\u00ed m\u00edt hodnotu Null"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "Argument {0} nesm\u00ed m\u00edt hodnotu Null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "Funkci {0}#isObjectModelSupported( String objectModel ) nelze volat s hodnotou objectModel == Null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "Funkci {0}#isObjectModelSupported( String objectModel ) nelze volat s hodnotou objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Pokus o nastaven\u00ed funkce s n\u00e1zvem s hodnotou Null: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Pokus o nastaven\u00ed nezn\u00e1m\u00e9 funkce \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Pokus o na\u010dten\u00ed funkce s n\u00e1zvem s hodnotou Null: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Pokus o z\u00edsk\u00e1n\u00ed nezn\u00e1m\u00e9 funkce \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Pokus o nastaven\u00ed parametru XPathFunctionResolver s hodnotou Null:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Pokus o nastaven\u00ed parametru XPathVariableResolver s hodnotou Null:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "funkce format-number prozat\u00edm nezpracovala n\u00e1zev n\u00e1rodn\u00edho prost\u0159ed\u00ed (locale)!"}, { WG_PROPERTY_NOT_SUPPORTED, "Vlastnost XSL nen\u00ed podporov\u00e1na: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Aktu\u00e1ln\u011b ned\u011blejte nic s oborem n\u00e1zv\u016f {0} vlastnosti: {1}"}, { WG_SECURITY_EXCEPTION, "P\u0159i pokusu o p\u0159\u00edstup k syst\u00e9mov\u00e9 vlastnosti XSL do\u0161lo k v\u00fdjimce SecurityException: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Zastaral\u00e1 syntaxe: quo(...) ji\u017e nen\u00ed v XPath definov\u00e1no."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath pot\u0159ebuje k implementaci funkce nodeTest odvozen\u00fd objekt!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "nebyl nalezen token funkce."}, { WG_COULDNOT_FIND_FUNCTION, "Nelze nal\u00e9zt funkci: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nelze vytvo\u0159it adresu URL z: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Analyz\u00e1tor DTM nepodporuje volbu -E"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "Odkaz VariableReference uveden k prom\u011bnn\u00e9 mimo kontext nebo bez definice! N\u00e1zev = {0}"}, { WG_UNSUPPORTED_ENCODING, "Nepodporovan\u00e9 k\u00f3dov\u00e1n\u00ed: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "cs"}, { "help_language", "cs"}, { "language", "cs"}, { "BAD_CODE", "Parametr funkce createMessage je mimo limit"}, { "FORMAT_FAILED", "P\u0159i vol\u00e1n\u00ed funkce messageFormat do\u0161lo k v\u00fdjimce"}, { "version", ">>>>>>> Verze Xalan "}, { "version2", "<<<<<<<"}, { "yes", "ano"}, { "line", "\u0158\u00e1dek #"}, { "column", "Sloupec #"}, { "xsldone", "XSLProcessor: hotovo"}, { "xpath_option", "volby xpath: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select v\u00fdraz xpath]"}, { "optionMatch", " [-match vzorek shody (pro diagnostiku shody)]"}, { "optionAnyExpr", "Jinak v\u00fdpis diagnostiky provede pouze v\u00fdraz xpath"}, { "noParsermsg1", "Proces XSL nebyl \u00fasp\u011b\u0161n\u00fd."}, { "noParsermsg2", "** Nelze naj\u00edt analyz\u00e1tor **"}, { "noParsermsg3", "Zkontrolujte cestu classpath."}, { "noParsermsg4", "Nem\u00e1te-li analyz\u00e1tor XML jazyka Java spole\u010dnosti IBM, m\u016f\u017eete si jej st\u00e1hnout z adresy:"}, { "noParsermsg5", "AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#chyba"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Chyba: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Varov\u00e1n\u00ed: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("cs", "CZ")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_pl.java0000644000175000017500000012711010721374032025144 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_pl.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_pl extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "Funkcja current() jest niedozwolona we wzorcu!" }, { ER_CURRENT_TAKES_NO_ARGS, "Funkcja current() nie akceptuje argument\u00f3w!" }, { ER_DOCUMENT_REPLACED, "Implementacja funkcji document() zosta\u0142a zast\u0105piona przez org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "Kontekst nie ma dokumentu w\u0142a\u015bciciela!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "Funkcja local-name() ma zbyt wiele argument\u00f3w."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "Funkcja namespace-uri() ma zbyt wiele argument\u00f3w."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "Funkcja normalize-space() ma zbyt wiele argument\u00f3w."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "Funkcja number() ma zbyt wiele argument\u00f3w."}, { ER_NAME_HAS_TOO_MANY_ARGS, "Funkcja name() ma zbyt wiele argument\u00f3w."}, { ER_STRING_HAS_TOO_MANY_ARGS, "Funkcja string() ma zbyt wiele argument\u00f3w."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "Funkcja string-length() ma zbyt wiele argument\u00f3w."}, { ER_TRANSLATE_TAKES_3_ARGS, "Funkcja translate() akceptuje trzy argumenty!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Funkcja unparsed-entity-uri() akceptuje tylko jeden argument!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "O\u015b przestrzeni nazw nie zosta\u0142a jeszcze zaimplementowana!"}, { ER_UNKNOWN_AXIS, "nieznana o\u015b: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "Nieznana operacja uzgadniania!"}, { ER_INCORRECT_ARG_LENGTH, "D\u0142ugo\u015b\u0107 argumentu testu w\u0119z\u0142a processing-instruction() jest niepoprawna!"}, { ER_CANT_CONVERT_TO_NUMBER, "Nie mo\u017cna przekszta\u0142ci\u0107 {0} w liczb\u0119"}, { ER_CANT_CONVERT_TO_NODELIST, "Nie mo\u017cna przekszta\u0142ci\u0107 {0} w NodeList!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Nie mo\u017cna przekszta\u0142ci\u0107 {0} w NodeSetDTM!"}, { ER_CANT_CONVERT_TO_TYPE, "Nie mo\u017cna przekszta\u0142ci\u0107 {0} w type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "Oczekiwano wzorca uzgadniania w getMatchScore!"}, { ER_COULDNOT_GET_VAR_NAMED, "Nie mo\u017cna pobra\u0107 zmiennej o nazwie {0}"}, { ER_UNKNOWN_OPCODE, "B\u0141\u0104D! Nieznany kod operacji: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Nadmiarowe niedozwolone leksemy: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Litera\u0142 bez cudzys\u0142owu... oczekiwano podw\u00f3jnego cudzys\u0142owu!"}, { ER_EXPECTED_SINGLE_QUOTE, "Litera\u0142 bez cudzys\u0142owu... oczekiwano pojedynczego cudzys\u0142owu!"}, { ER_EMPTY_EXPRESSION, "Puste wyra\u017cenie!"}, { ER_EXPECTED_BUT_FOUND, "Oczekiwano {0}, ale znaleziono: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Asercja programisty jest niepoprawna! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "argument boolean(...) nie jest ju\u017c opcjonalny wg projektu 19990709 XPath draft."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Znaleziono znak ',', ale nie ma poprzedzaj\u0105cego argumentu!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Znaleziono znak ',', ale nie ma nast\u0119puj\u0105cego argumentu!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predykat]' lub '.[predykat]' to niedozwolona sk\u0142adnia. U\u017cyj zamiast tego 'self::node()[predykat]'."}, { ER_ILLEGAL_AXIS_NAME, "Niedozwolona nazwa osi: {0}"}, { ER_UNKNOWN_NODETYPE, "Nieznany typ w\u0119z\u0142a: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Litera\u0142 wzorca ({0}) musi by\u0107 w cudzys\u0142owie!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "Nie mo\u017cna sformatowa\u0107 {0} do postaci liczbowej!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Nie mo\u017cna utworzy\u0107 po\u0142\u0105czenia XML TransformerFactory: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "B\u0142\u0105d! Nie znaleziono wyra\u017cenia wyboru xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "B\u0141\u0104D! Nie mo\u017cna znale\u017a\u0107 ENDOP po OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Wyst\u0105pi\u0142 b\u0142\u0105d!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference nadana zmiennej nie nale\u017cy do kontekstu lub nie ma definicji! Nazwa = {0}"}, { ER_AXES_NOT_ALLOWED, "We wzorcach zgodno\u015bci dozwolone s\u0105 tylko osie child:: oraz attribute::! Niew\u0142a\u015bciwe osie = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "Funkcja key() ma niepoprawn\u0105 liczb\u0119 argument\u00f3w."}, { ER_COUNT_TAKES_1_ARG, "Funkcja count() akceptuje tylko jeden argument!"}, { ER_COULDNOT_FIND_FUNCTION, "Nie mo\u017cna znale\u017a\u0107 funkcji: {0}"}, { ER_UNSUPPORTED_ENCODING, "Nieobs\u0142ugiwane kodowanie: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Wyst\u0105pi\u0142 problem w DTM w getNextSibling... pr\u00f3ba wyj\u015bcia z b\u0142\u0119du"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "B\u0142\u0105d programisty: Nie mo\u017cna zapisywa\u0107 do EmptyNodeList."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory nie jest obs\u0142ugiwane przez XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "Przedrostek musi da\u0107 si\u0119 przet\u0142umaczy\u0107 na przestrze\u0144 nazw: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource \u017ar\u00f3d\u0142o) nie jest obs\u0142ugiwane w XPathContext! Nie mo\u017cna otworzy\u0107 {0}"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... nie jest obs\u0142ugiwane przez DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... nie jest obs\u0142ugiwane przez DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison nie mo\u017ce obs\u0142u\u017cy\u0107 w\u0119z\u0142\u00f3w typu {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper nie mo\u017ce obs\u0142u\u017cy\u0107 w\u0119z\u0142\u00f3w typu {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "B\u0142\u0105d DOM2Helper.parse : ID systemu - {0} wiersz - {1}"}, { ER_XERCES_PARSE_ERROR, "B\u0142\u0105d DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Wykryto niepoprawny odpowiednik UTF-16: {0} ?"}, { ER_OIERROR, "B\u0142\u0105d we/wy"}, { ER_CANNOT_CREATE_URL, "Nie mo\u017cna utworzy\u0107 adresu url dla {0}"}, { ER_XPATH_READOBJECT, "W XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "Nie znaleziono leksemu funkcji."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Nie mo\u017cna upora\u0107 si\u0119 z typem XPath {0}"}, { ER_NODESET_NOT_MUTABLE, "Ten NodeSet nie jest zmienny"}, { ER_NODESETDTM_NOT_MUTABLE, "Ten NodeSetDTM nie jest zmienny"}, { ER_VAR_NOT_RESOLVABLE, "Nie mo\u017cna rozstrzygn\u0105\u0107 zmiennej {0}"}, { ER_NULL_ERROR_HANDLER, "Pusta procedura obs\u0142ugi b\u0142\u0119du"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Asercja programisty: nieznany kod opcode: {0}"}, { ER_ZERO_OR_ONE, "0 lub 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Funkcja rtf() nie jest obs\u0142ugiwana przez XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Funkcja asNodeIterator() nie jest obs\u0142ugiwana przez XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Funkcja detach() nie jest obs\u0142ugiwana przez XRTreeFragSelectWrapper"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Funkcja num() nie jest obs\u0142ugiwana przez XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Funkcja xstr() nie jest obs\u0142ugiwana przez XRTreeFragSelectWrapper"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Funkcja str() nie jest obs\u0142ugiwana przez XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "Funkcja fsb() nie jest obs\u0142ugiwana dla XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "Nie mo\u017cna znale\u017a\u0107 zmiennej o nazwie {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars nie mo\u017ce pobra\u0107 ci\u0105gu znak\u00f3w jako argumentu"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "Argument FastStringBuffer nie mo\u017ce by\u0107 pusty"}, { ER_TWO_OR_THREE, "2 lub 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Nast\u0105pi\u0142o odwo\u0142anie do zmiennej, zanim zosta\u0142a ona zwi\u0105zana!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB nie mo\u017ce pobra\u0107 ci\u0105gu znak\u00f3w jako argumentu!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! B\u0142\u0105d! Ustawienie root w\u0119drownika na null!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Ten NodeSetDTM nie mo\u017ce iterowa\u0107 do poprzedniego w\u0119z\u0142a!"}, { ER_NODESET_CANNOT_ITERATE, "Ten NodeSet nie mo\u017ce iterowa\u0107 do poprzedniego w\u0119z\u0142a!"}, { ER_NODESETDTM_CANNOT_INDEX, "Ten NodeSetDTM nie mo\u017ce wykona\u0107 funkcji indeksowania lub zliczania!"}, { ER_NODESET_CANNOT_INDEX, "Ten NodeSet nie mo\u017ce wykona\u0107 funkcji indeksowania lub zliczania!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Nie mo\u017cna wywo\u0142a\u0107 setShouldCacheNodes po wywo\u0142aniu nextNode!"}, { ER_ONLY_ALLOWS, "{0} zezwala tylko na {1} argument\u00f3w"}, { ER_UNKNOWN_STEP, "Asercja programisty w getNextStepPos: nieznany stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Po leksemie '/' oraz '//' oczekiwana by\u0142a \u015bcie\u017cka wzgl\u0119dna po\u0142o\u017cenia."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Oczekiwano \u015bcie\u017cki po\u0142o\u017cenia, ale napotkano nast\u0119puj\u0105cy leksem\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Oczekiwano \u015bcie\u017cki po\u0142o\u017cenia, ale zamiast niej znaleziono koniec wyra\u017cenia XPath."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Po leksemie '/' oraz '//' oczekiwany by\u0142 krok po\u0142o\u017cenia."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Oczekiwano testu w\u0119z\u0142a zgodnego albo z NCName:*, albo z QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Oczekiwano wzorca kroku, ale napotkano '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Oczekiwano wzorca \u015bcie\u017cki wzgl\u0119dnej."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "Rezultat (XPathResult) wyra\u017cenia XPath ''{0}'' ma typ (XPathResultType) {1}, kt\u00f3rego nie mo\u017cna przekszta\u0142ci\u0107 w typ boolowski."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "Rezultat (XPathResult) wyra\u017cenia XPath ''{0}'' ma typ (XPathResultType) {1}, kt\u00f3rego nie mo\u017cna przekszta\u0142ci\u0107 w pojedynczy w\u0119ze\u0142. Metod\u0119 getSingleNodeValue mo\u017cna stosowa\u0107 tylko do typ\u00f3w ANY_UNORDERED_NODE_TYPE oraz FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "Metody getSnapshotLength nie mo\u017cna wywo\u0142a\u0107 na rezultacie (XPathResult) wyra\u017cenia XPath ''{0}'', poniewa\u017c jego typem (XPathResultType) jest {1}. Metod\u0119 t\u0119 mo\u017cna stosowa\u0107 tylko do typ\u00f3w UNORDERED_NODE_SNAPSHOT_TYPE oraz ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "Metody iterateNext nie mo\u017cna wywo\u0142a\u0107 na rezultacie (XPathResult) wyra\u017cenia XPath ''{0}'', poniewa\u017c jego typem (XPathResultType) jest {1}. Metod\u0119 t\u0119 mo\u017cna stosowa\u0107 tylko do typ\u00f3w UNORDERED_NODE_ITERATOR_TYPE oraz ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Dokument uleg\u0142 zmianie od czasu zwr\u00f3cenia rezultatu. Iterator jest niepoprawny."}, { ER_INVALID_XPATH_TYPE, "Niepoprawny argument typu XPath: {0}"}, { ER_EMPTY_XPATH_RESULT, "Pusty obiekt rezultatu XPath"}, { ER_INCOMPATIBLE_TYPES, "Rezultat (XPathResult) wyra\u017cenia XPath ''{0}'' ma typ (XPathResultType) {1}, na kt\u00f3rym nie mo\u017cna wymusi\u0107 dzia\u0142ania jak na okre\u015blonym typie (XPathResultType) {2}."}, { ER_NULL_RESOLVER, "Nie mo\u017cna przet\u0142umaczy\u0107 przedrostka za pomoc\u0105 procedury t\u0142umacz\u0105cej o pustym przedrostku."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "Rezultat (XPathResult) wyra\u017cenia XPath ''{0}'' ma typ (XPathResultType) {1}, kt\u00f3rego nie mo\u017cna przekszta\u0142ci\u0107 w typ \u0142a\u0144cuchowy."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "Metody snapshotItem nie mo\u017cna wywo\u0142a\u0107 na rezultacie (XPathResult) wyra\u017cenia XPath ''{0}'', poniewa\u017c jego typem (XPathResultType) jest {1}. Metod\u0119 t\u0119 mo\u017cna stosowa\u0107 tylko do typ\u00f3w UNORDERED_NODE_SNAPSHOT_TYPE oraz ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "W\u0119ze\u0142 kontekstu nie nale\u017cy do dokumentu, kt\u00f3ry jest zwi\u0105zany z tym interfejsem XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Nieobs\u0142ugiwany typ w\u0119z\u0142a kontekstu."}, { ER_XPATH_ERROR, "Nieznany b\u0142\u0105d w XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "Rezultat (XPathResult) wyra\u017cenia XPath ''{0}'' ma typ (XPathResultType) {1}, kt\u00f3rego nie mo\u017cna przekszta\u0142ci\u0107 w typ liczbowy."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Nie mo\u017cna wywo\u0142a\u0107 funkcji rozszerzenia ''{0}'', kiedy opcja XMLConstants.FEATURE_SECURE_PROCESSING ma warto\u015b\u0107 true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable zwraca warto\u015b\u0107 null dla zmiennej {0}"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Nieobs\u0142ugiwany typ zwracany : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Typ \u017ar\u00f3d\u0142owy i/lub zwracany nie mo\u017ce mie\u0107 warto\u015bci null"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "Argument {0} nie mo\u017ce mie\u0107 warto\u015bci null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "Nie mo\u017cna wywo\u0142a\u0107 {0}#isObjectModelSupported( String objectModel ) ze zmienn\u0105 objectModel o warto\u015bci null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "Nie mo\u017cna wywo\u0142a\u0107 {0}#isObjectModelSupported( String objectModel ) ze zmienn\u0105 objectModel o warto\u015bci \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Pr\u00f3ba ustawienia opcji o nazwie r\u00f3wnej null: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Pr\u00f3ba ustawienia nieznanej opcji \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Pr\u00f3ba pobrania opcji o nazwie r\u00f3wnej null: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Pr\u00f3ba pobrania nieznanej opcji \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Pr\u00f3ba ustawienia XPathFunctionResolver o warto\u015bci null:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Pr\u00f3ba ustawienia XPathVariableResolver o warto\u015bci null:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "Nazwa ustawie\u0144 narodowych w funkcji format-number nie jest jeszcze obs\u0142ugiwana!"}, { WG_PROPERTY_NOT_SUPPORTED, "Nieobs\u0142ugiwana w\u0142a\u015bciwo\u015b\u0107 XSL {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Nie r\u00f3b teraz niczego z przestrzeni\u0105 nazw {0} we w\u0142a\u015bciwo\u015bci {1}"}, { WG_SECURITY_EXCEPTION, "Wyj\u0105tek SecurityException podczas pr\u00f3by dost\u0119pu do w\u0142a\u015bciwo\u015bci systemowej XSL {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Stara sk\u0142adnia: quo(...) nie jest ju\u017c zdefiniowana w XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath potrzebuje obiektu pochodnego, aby zaimplementowa\u0107 nodeTest!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "Nie znaleziono leksemu funkcji."}, { WG_COULDNOT_FIND_FUNCTION, "Nie mo\u017cna znale\u017a\u0107 funkcji: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nie mo\u017cna utworzy\u0107 adresu URL z {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Opcja -E nie jest obs\u0142ugiwana przez analizator DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference nadana zmiennej nie nale\u017cy do kontekstu lub nie ma definicji! Nazwa = {0}"}, { WG_UNSUPPORTED_ENCODING, "Nieobs\u0142ugiwane kodowanie: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "pl"}, { "help_language", "pl"}, { "language", "pl"}, { "BAD_CODE", "Parametr createMessage by\u0142 spoza zakresu"}, { "FORMAT_FAILED", "Podczas wywo\u0142ania messageFormat zg\u0142oszony zosta\u0142 wyj\u0105tek"}, { "version", ">>>>>>> Wersja Xalan "}, { "version2", "<<<<<<<"}, { "yes", "tak"}, { "line", "Nr wiersza: "}, { "column", "Nr kolumny: "}, { "xsldone", "XSLProcessor: gotowe"}, { "xpath_option", "opcje xpath: "}, { "optionIN", "[-in wej\u015bciowyXMLURL]"}, { "optionSelect", "[-select wyra\u017cenie xpath]"}, { "optionMatch", "[-match wzorzec (do diagnostyki odnajdywania zgodno\u015bci ze wzorcem)]"}, { "optionAnyExpr", "Lub po prostu wyra\u017cenie xpath dokona zrzutu diagnostycznego"}, { "noParsermsg1", "Proces XSL nie wykona\u0142 si\u0119 pomy\u015blnie."}, { "noParsermsg2", "** Nie mo\u017cna znale\u017a\u0107 analizatora **"}, { "noParsermsg3", "Sprawd\u017a classpath."}, { "noParsermsg4", "Je\u015bli nie masz analizatora XML dla j\u0119zyka Java firmy IBM, mo\u017cesz go pobra\u0107 "}, { "noParsermsg5", "z serwisu AlphaWorks firmy IBM: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "nr b\u0142\u0119du"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "B\u0142\u0105d: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Ostrze\u017cenie: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "WZORZEC "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("pl", "PL")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_sl.java0000644000175000017500000012273410721374033025157 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_sl.java,v 1.29 2005/02/09 21:44:08 zongaro Exp $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_sl extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "Funkcija current() v primerjalnem vzorcu ni dovoljena!" }, { ER_CURRENT_TAKES_NO_ARGS, "Funkcija current() ne sprejema argumentov!" }, { ER_DOCUMENT_REPLACED, "Implementacija funkcije document() je bila nadome\u0161\u010dena z org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "Kontekst ne vsebuje lastni\u0161kega dokumenta!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() ima preve\u010d argumentov."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() ima preve\u010d argumentov."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() ima preve\u010d argumentov."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() ima preve\u010d argumentov."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() ima preve\u010d argumentov."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() ima preve\u010d argumentov."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() ima preve\u010d argumentov."}, { ER_TRANSLATE_TAKES_3_ARGS, "Funkcija translate() sprejme tri argumente!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Funkcija unparsed-entity-uri bi morala vsebovati en argument!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "Os imenskega prostora \u0161e ni implementirana!"}, { ER_UNKNOWN_AXIS, "neznana os: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "neznana operacija ujemanja!"}, { ER_INCORRECT_ARG_LENGTH, "Dol\u017eina argumenta pri preskusu vozli\u0161\u010da s processing-instruction() ni pravilna!"}, { ER_CANT_CONVERT_TO_NUMBER, "{0} ni mogo\u010de pretvoriti v \u0161tevilko"}, { ER_CANT_CONVERT_TO_NODELIST, "{0} ni mogo\u010de pretvoriti v seznam vozli\u0161\u010d (NodeList)"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0} ni mogo\u010de pretvoriti v NodeSetDTM"}, { ER_CANT_CONVERT_TO_TYPE, "{0} ni mogo\u010de pretvoriti v type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "Pri\u010dakovan primerjalni vzorec v getMatchScore!"}, { ER_COULDNOT_GET_VAR_NAMED, "Nisem na\u0161el predloge z imenom {0}"}, { ER_UNKNOWN_OPCODE, "NAPAKA! Neznana op. koda: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Dodatni neveljavni \u017eetoni: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Napa\u010dno postavljena dobesedna navedba... pri\u010dakovani dvojni narekovaji!"}, { ER_EXPECTED_SINGLE_QUOTE, "Napa\u010dno postavljena dobesedna navedba... pri\u010dakovani enojni narekovaji!"}, { ER_EMPTY_EXPRESSION, "Prazen izraz!"}, { ER_EXPECTED_BUT_FOUND, "Pri\u010dakovano {0}, najdeno: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Programerjeva predpostavka ni pravilna! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "Argument logi\u010dne vrednosti(...) ni ve\u010d izbiren z osnutkom 19990709 XPath."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Najdeno ',' vendar ni predhodnih argumentov!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Najdeno ',' vendar ni slede\u010dih argumentov!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' ali '.[predicate]' je neveljavna sintaksa. Namesto tega uporabite 'self::node()[predicate]'."}, { ER_ILLEGAL_AXIS_NAME, "Neveljavno ime osi: {0}"}, { ER_UNKNOWN_NODETYPE, "Neveljavni tip vozli\u0161\u010da: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Navedek vzorca ({0}) mora biti v navednicah!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} ni mogo\u010de oblikovati v \u0161tevilko!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Ne morem ustvariti zveze XML TransformerFactory: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Napaka! Ne najdem izbirnega izraza xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "NAPAKA! Ne najdem ENDOP po OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Pri\u0161lo je do napake!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "Dani VariableReference je izven konteksta ali brez definicije! Ime = {0}"}, { ER_AXES_NOT_ALLOWED, "V primerjalnih vzorcih so dovoljene samo osi podrejenega:: in atributa::! Sporne osi = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key()ima nepravilno \u0161tevilo argumentov."}, { ER_COUNT_TAKES_1_ARG, "\u0160tevna funkcija zahteva en argument!"}, { ER_COULDNOT_FIND_FUNCTION, "Ne najdem funkcije: {0}"}, { ER_UNSUPPORTED_ENCODING, "Nepodprto kodiranje: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Pri\u0161lo je do te\u017eave v DTM pri getNextSibling... poskus obnovitve"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Programerska napaka: pisanje v EmptyNodeList ni mogo\u010de."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory v XPathContext ni podprt!"}, { ER_PREFIX_MUST_RESOLVE, "Predpona se mora razre\u0161iti v imenski prostor: {0}"}, { ER_PARSE_NOT_SUPPORTED, "Raz\u010dlenitev (vir InputSource) v XPathContext ni podprta! Ne morem odpreti {0}"}, { ER_SAX_API_NOT_HANDLED, "Znaki SAX API(znaka ch[]... ne obravnava DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(znaka ch[]... ne obravnava DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison ne more upravljati z vozli\u0161\u010di tipa {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper ne more upravljati z vozli\u0161\u010di tipa {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Napaka DOM2Helper.parse: ID sistema - {0} vrstica - {1}"}, { ER_XERCES_PARSE_ERROR, "Napaka DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Zaznan neveljaven nadomestek UTF-16: {0} ?"}, { ER_OIERROR, "Napaka V/I"}, { ER_CANNOT_CREATE_URL, "Ne morem ustvariti naslova URL za: {0}"}, { ER_XPATH_READOBJECT, "V XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "ne najdem \u017eetona funkcije."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Ne morem ravnati z tipom XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Ta NodeSet ni spremenljiv"}, { ER_NODESETDTM_NOT_MUTABLE, "Ta NodeSetDTM ni spremenljiv"}, { ER_VAR_NOT_RESOLVABLE, "Spremenljivka ni razre\u0161ljiva: {0}"}, { ER_NULL_ERROR_HANDLER, "Program za obravnavo napak NULL"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Programerjeva izjava: neznana opkoda: {0}"}, { ER_ZERO_OR_ONE, "0 ali 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper ne podpira rtf()"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper ne podpira asNodeIterator()"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper ne podpira detach()"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper ne podpira num()"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper ne podpira xstr()"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper ne podpira str()"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() ni podprt za XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "Spremenljivke z imenom {0} ni mogo\u010de najti"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars ne more uporabiti niza za argument"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "Argument FastStringBuffer ne more biti NULL"}, { ER_TWO_OR_THREE, "2 ali 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Spremenljivka uporabljena \u0161e pred njeno vezavo!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB ne more uporabiti niza za argument!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Napaka! Koren sprehajalca nastavljam na NULL!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Tega NodeSetDTM ni mogo\u010de ponavljati do prej\u0161njega vozli\u0161\u010da!"}, { ER_NODESET_CANNOT_ITERATE, "Tega NodeSet ni mogo\u010de ponavljati do prej\u0161njega vozli\u0161\u010da!"}, { ER_NODESETDTM_CANNOT_INDEX, "Ta NodeSetDTM ne more opravljati funkcij priprave kazala ali \u0161tetja!"}, { ER_NODESET_CANNOT_INDEX, "Ta NodeSet ne more opravljati funkcij priprave kazala ali \u0161tetja!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Za klicem nextNode klic setShouldCacheNodes ni mogo\u010d!"}, { ER_ONLY_ALLOWS, "{0} dovoljuje samo argumente {1}"}, { ER_UNKNOWN_STEP, "Programerjeva izjava v getNextStepPos: neznan stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Za \u017eetonom '/' ali '//' je pri\u010dakovana relativna pot do mesta."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Pri\u010dakovana pot do lokacije, na\u0161jden pa je naslednji \u017eeton\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Namesto pri\u010dakovane poti do lokacije je najden konec izraza XPath."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Za \u017eetonom '/' ali '//' je pri\u010dakovan korak mesta."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Pri\u010dakovan preskus vozli\u0161\u010da, ki ustreza NCImenu:* ali QImenu."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Pri\u010dakovan stopnjevalni vzorec, najden pa je '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Pri\u010dakovan vzorec z relativno potjo."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPathResult izraza XPath ''{0}'' ima XPathResultType {1}, ki ga ni mogoe\u010de pretvoriti v boolovo vrednost."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPathResult izraza XPath ''{0}'' ima XPathResultType {1}, ki ga ni mogo\u010de pretvoriti v eno vozli\u0161\u010de. Metoda getSingleNodeValue velja samo za tipa ANY_UNORDERED_NODE_TYPE in FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "Metoda getSnapshotLength ne more biti priklicana za XPathResult izraza XPath ''{0}'', ker je tip XPathResultType {1}. Ta metoda se nana\u0161a samo na tipa UNORDERED_NODE_SNAPSHOT_TYPE in ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "Metoda iterateNext ne more biti priklicana za XPathResult izraza XPath ''{0}'', ker je tip XPathResultType {1}. Ta metoda se nana\u0161a samo na tipa UNORDERED_NODE_ITERATOR_TYPE in ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Dokument se je spremenil po vrnitvi rezultatov. Iterator je neveljaven."}, { ER_INVALID_XPATH_TYPE, "Neveljaven argument tipa XPath: {0}"}, { ER_EMPTY_XPATH_RESULT, "Prazen objekt rezultatov XPath"}, { ER_INCOMPATIBLE_TYPES, "Rezultat XPathResult izraza XPath ''{0}'' ima XPathResultType {1}, ki ga ni mogo\u010de prisiliti v dolo\u010den tip XPathResultType {2}."}, { ER_NULL_RESOLVER, "Predpone ni bilo mogo\u010de razre\u0161iti z razre\u0161evalnikom predpon NULL."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "Rezultat XPathResult izraza XPath''{0}'' ima XPathResultType {1}, ki ga ni mogo\u010de pretvoriti v niz."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "Metoda snapshotItem ne more biti priklicana za XPathResult izraza XPath ''{0}'', ker je tip XPathResultType {1}. Ta metoda se nana\u0161a samo na tipa UNORDERED_NODE_SNAPSHOT_TYPE in ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Kontekstno vozli\u0161\u010de ne pripada dokumentu, povezanem s tem XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Tip kontekstnega vozli\u0161\u010da ni podprt."}, { ER_XPATH_ERROR, "Neznana napaka v XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPathResult izraza XPath ''{0}'' ima XPathResultType {1}, ki ga ni mogo\u010de pretvoriti v \u0161tevilko."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Raz\u0161iritvene funkcije: ''{0}'' ni mogo\u010de priklicati, kadar je zna\u010dilnost XMLConstants.FEATURE_SECURE_PROCESSING nastavljena na True."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "Funkcija resolveVariable za spremenljivko {0} vra\u010da rezultat ni\u010d"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Nepodprt tip vrnitve : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Vir in/ali Tip vrnitve ne moreta biti ni\u010d"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "Argument {0} ne more biti ni\u010d"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "Funkcije {0}#isObjectModelSupported( String objectModel ) ni mogo\u010de priklicati, kadar je objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "Funkcije {0}#isObjectModelSupported( String objectModel ) ni mogo\u010de priklicati, kadar je objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Poskus nastavitve funkcije brez imena (null name): {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Poskus nastavitve neznane funkcije \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Poskus pridobitve funkcije brez imena (null name): {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Poskus pridobitve neznane funkcije \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Poskus nastavitve XPathFunctionResolver na ni\u010d:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Poskus nastavitve funkcije XPathVariableResolver na ni\u010d:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "Podro\u010dno ime v funkciji za oblikovanje \u0161tevilk \u0161e ni podprto!"}, { WG_PROPERTY_NOT_SUPPORTED, "Lastnost XSL ni podprta: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "V tem trenutku ne po\u010dnite ni\u010desar z imenskim prostorom {0} v lastnosti: {1}"}, { WG_SECURITY_EXCEPTION, "Pri\u0161lo je do SecurityException (varnostna izjema) pri poskusu dostopa do sistemske lastnosti XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Stara sintaksa: quo(...) v XPath ni ve\u010d definiran."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath potrebuje izpeljani objekt za implementacijo nodeTest!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "ne najdem \u017eetona funkcije."}, { WG_COULDNOT_FIND_FUNCTION, "Ne najdem funkcije: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Ne morem narediti naslova URL iz: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Mo\u017enost -E za raz\u010dlenjevalnik DTM ni podprta."}, { WG_ILLEGAL_VARIABLE_REFERENCE, "Dani VariableReference je izven konteksta ali brez definicije! Ime = {0}"}, { WG_UNSUPPORTED_ENCODING, "Nepodprto kodiranje: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "sl"}, { "help_language", "sl"}, { "language", "sl"}, { "BAD_CODE", "Parameter za createMessage presega meje"}, { "FORMAT_FAILED", "Med klicem je messageFormat naletel na izjemo"}, { "version", ">>>>>>> Razli\u010dica Xalan "}, { "version2", "<<<<<<<"}, { "yes", "da"}, { "line", "Vrstica #"}, { "column", "Stolpec #"}, { "xsldone", "XSLProcessor: dokon\u010dano"}, { "xpath_option", "Mo\u017enosti xpath: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select izraz xpath]"}, { "optionMatch", " [-match primerjalni vzorec (za diagnostiko ujemanja)]"}, { "optionAnyExpr", "Ali pa bo samo izraz xpath izvedel diagnosti\u010dni izvoz podatkov"}, { "noParsermsg1", "Postopek XSL ni uspel."}, { "noParsermsg2", "** Nisem na\u0161el raz\u010dlenjevalnika **"}, { "noParsermsg3", "Preverite pot razreda."}, { "noParsermsg4", "\u010ce nimate IBM raz\u010dlenjevalnika za Javo, ga lahko prenesete iz"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Napaka: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Opozorilo: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "VZOREC "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("sl", "SL")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHMessages.java0000644000175000017500000001060010721374030023225 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHMessages.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import org.apache.xml.res.XMLMessages; /** * A utility class for issuing XPath error messages. * @xsl.usage internal */ public class XPATHMessages extends XMLMessages { /** The language specific resource object for XPath messages. */ private static ListResourceBundle XPATHBundle = null; /** The class name of the XPath error message string table. */ private static final String XPATH_ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception { if (XPATHBundle == null) XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES); if (XPATHBundle != null) { return createXPATHMsg(XPATHBundle, msgKey, args); } else return "Could not load any resource bundles."; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted warning string. */ public static final String createXPATHWarning(String msgKey, Object args[]) //throws Exception { if (XPATHBundle == null) XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES); if (XPATHBundle != null) { return createXPATHMsg(XPATHBundle, msgKey, args); } else return "Could not load any resource bundles."; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param fResourceBundle The resource bundle to use. * @param msgKey The message key to use. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createXPATHMsg(ListResourceBundle fResourceBundle, String msgKey, Object args[]) //throws Exception { String fmsg = null; boolean throwex = false; String msg = null; if (msgKey != null) msg = fResourceBundle.getString(msgKey); if (msg == null) { msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE); throwex = true; } if (args != null) { try { // Do this to keep format from crying. // This is better than making a bunch of conditional // code all over the place. int n = args.length; for (int i = 0; i < n; i++) { if (null == args[i]) args[i] = ""; } fmsg = java.text.MessageFormat.format(msg, args); } catch (Exception e) { fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED); fmsg += " " + msg; } } else fmsg = msg; if (throwex) { throw new RuntimeException(fmsg); } return fmsg; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_pt_BR.java0000644000175000017500000012512010721374033025537 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_pt_BR.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_pt_BR extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "A fun\u00e7\u00e3o current() n\u00e3o \u00e9 permitida em um padr\u00e3o de correspond\u00eancia!" }, { ER_CURRENT_TAKES_NO_ARGS, "A fun\u00e7\u00e3o current() n\u00e3o aceita argumentos!" }, { ER_DOCUMENT_REPLACED, "A implementa\u00e7\u00e3o da fun\u00e7\u00e3o document() foi substitu\u00edda por org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "context n\u00e3o possui um documento do propriet\u00e1rio!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() possui argumentos em excesso."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() possui argumentos em excesso."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() possui argumentos em excesso."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() possui argumentos em excesso."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() possui argumentos em excesso."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() possui argumentos em excesso."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() possui argumentos em excesso."}, { ER_TRANSLATE_TAKES_3_ARGS, "A fun\u00e7\u00e3o translate() tem tr\u00eas argumentos!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "A fun\u00e7\u00e3o unparsed-entity-uri deve ter um argumento!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "eixo do espa\u00e7o de nomes ainda n\u00e3o implementado!"}, { ER_UNKNOWN_AXIS, "eixo desconhecido: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "opera\u00e7\u00e3o de correspond\u00eancia desconhecida!"}, { ER_INCORRECT_ARG_LENGTH, "O comprimento de arg do teste de n\u00f3 de processing-instruction() est\u00e1 incorreto! "}, { ER_CANT_CONVERT_TO_NUMBER, "Imposs\u00edvel converter {0} em um n\u00famero"}, { ER_CANT_CONVERT_TO_NODELIST, "Imposs\u00edvel converter {0} em um NodeList!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Imposs\u00edvel converter {0} em um NodeSetDTM!"}, { ER_CANT_CONVERT_TO_TYPE, "Imposs\u00edvel converter {0} em um tipo {1}"}, { ER_EXPECTED_MATCH_PATTERN, "Padr\u00e3o de correspond\u00eancia esperado em getMatchScore!"}, { ER_COULDNOT_GET_VAR_NAMED, "N\u00e3o foi poss\u00edvel obter a vari\u00e1vel {0}"}, { ER_UNKNOWN_OPCODE, "ERRO! C\u00f3digo op desconhecido: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Tokens inv\u00e1lidos extras: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "literal com aspa incorreta... era esperada aspa dupla!"}, { ER_EXPECTED_SINGLE_QUOTE, "literal com aspa incorreta... era esperada aspa simples!"}, { ER_EMPTY_EXPRESSION, "Express\u00e3o vazia!"}, { ER_EXPECTED_BUT_FOUND, "Esperado {0}, mas encontrado: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "A declara\u00e7\u00e3o do programador est\u00e1 incorreta! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "O argumento boolean(...) n\u00e3o \u00e9 mais opcional com o rascunho 19990709 XPath."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Encontrado ',' mas sem argumento precedente!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Encontrado ',' mas sem argumento seguinte!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' ou '.[predicate]' \u00e9 sintaxe inv\u00e1lida. Utilize ent\u00e3o 'self::node()[predicate]'."}, { ER_ILLEGAL_AXIS_NAME, "nome de eixo inv\u00e1lido: {0}"}, { ER_UNKNOWN_NODETYPE, "Tipo de n\u00f3 desconhecido: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "O literal de padr\u00e3o ({0}) precisa ser colocado entre aspas!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} n\u00e3o p\u00f4de ser formatado para um n\u00famero!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "N\u00e3o foi poss\u00edvel criar XML TransformerFactory Liaison: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Erro! N\u00e3o encontrada a express\u00e3o xpath select (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "ERRO! N\u00e3o foi poss\u00edvel encontrar ENDOP ap\u00f3s OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Ocorreu um erro!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference fornecido para a vari\u00e1vel fora de contexto ou sem defini\u00e7\u00e3o! Nome = {0}"}, { ER_AXES_NOT_ALLOWED, "Apenas os eixos child:: e attribute:: s\u00e3o permitidos em padr\u00f5es de correspond\u00eancia! Eixos transgredidos = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() possui um n\u00famero incorreto de argumentos."}, { ER_COUNT_TAKES_1_ARG, "A fun\u00e7\u00e3o count deve ter um argumento!"}, { ER_COULDNOT_FIND_FUNCTION, "N\u00e3o foi poss\u00edvel localizar a fun\u00e7\u00e3o: {0}"}, { ER_UNSUPPORTED_ENCODING, "Codifica\u00e7\u00e3o n\u00e3o suportada: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Ocorreu um problema no DTM em getNextSibling... tentando recuperar"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Erro do programador: EmptyNodeList n\u00e3o pode ser gravado."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory n\u00e3o \u00e9 suportado por XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "O prefixo deve ser resolvido para um espa\u00e7o de nomes: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (origem InputSource) n\u00e3o suportada no XPathContext! Imposs\u00edvel abrir {0}"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... n\u00e3o tratado pelo DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... n\u00e3o tratado pelo DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison n\u00e3o pode tratar n\u00f3s do tipo {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper n\u00e3o pode tratar n\u00f3s do tipo {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse error: SystemID - {0} linha - {1}"}, { ER_XERCES_PARSE_ERROR, "Erro de DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Detectado substituto UTF-16 inv\u00e1lido: {0} ?"}, { ER_OIERROR, "Erro de E/S"}, { ER_CANNOT_CREATE_URL, "Imposs\u00edvel criar url para: {0}"}, { ER_XPATH_READOBJECT, "Em XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "Token function n\u00e3o encontrado."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Imposs\u00edvel lidar com o tipo XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Este NodeSet n\u00e3o \u00e9 mut\u00e1vel"}, { ER_NODESETDTM_NOT_MUTABLE, "Este NodeSetDTM n\u00e3o \u00e9 mut\u00e1vel"}, { ER_VAR_NOT_RESOLVABLE, "A vari\u00e1vel n\u00e3o pode ser resolvida: {0}"}, { ER_NULL_ERROR_HANDLER, "Rotina de tratamento de erros nula"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Declara\u00e7\u00e3o do programador: opcode desconhecido: {0} "}, { ER_ZERO_OR_ONE, "0 ou 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() n\u00e3o suportado por XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() n\u00e3o suportado por XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() n\u00e3o suportado por XRTreeFragSelectWrapper "}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() n\u00e3o suportado por XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() n\u00e3o suportado por XRTreeFragSelectWrapper "}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() n\u00e3o suportado por XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() n\u00e3o suportado para XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "N\u00e3o foi poss\u00edvel encontrar a vari\u00e1vel com o nome {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars n\u00e3o pode obter uma cadeia para um argumento"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "O argumento FastStringBuffer n\u00e3o pode ser nulo"}, { ER_TWO_OR_THREE, "2 ou 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Vari\u00e1vel acessada antes de ser ligada!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB n\u00e3o pode obter uma cadeia para um argumento!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Erro! Definindo a raiz de um transmissor como nula!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Este NodeSetDTM n\u00e3o pode iterar em um n\u00f3 anterior!"}, { ER_NODESET_CANNOT_ITERATE, "Este NodeSet n\u00e3o pode iterar em um n\u00f3 anterior!"}, { ER_NODESETDTM_CANNOT_INDEX, "Este NodeSetDTM n\u00e3o pode executar fun\u00e7\u00f5es de indexa\u00e7\u00e3o ou de contagem!"}, { ER_NODESET_CANNOT_INDEX, "Este NodeSet n\u00e3o pode executar fun\u00e7\u00f5es de indexa\u00e7\u00e3o ou de contagem!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Imposs\u00edvel chamar setShouldCacheNodes depois de nextNode ter sido chamado!"}, { ER_ONLY_ALLOWS, "{0} permite apenas {1} argumento(s)"}, { ER_UNKNOWN_STEP, "Declara\u00e7\u00e3o do programador em getNextStepPos: stepType desconhecido: {0} "}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Era esperado um caminho de localiza\u00e7\u00e3o relativo ap\u00f3s o token '/' ou '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Era esperado um caminho de localiza\u00e7\u00e3o, mas o seguinte token foi encontrado\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Era esperado um caminho de local, mas foi encontrado o final da express\u00e3o XPath: "}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Era esperada uma etapa de localiza\u00e7\u00e3o ap\u00f3s o token '/' ou '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Era esperado um n\u00f3 correspondente a NCName:* ou QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Era esperado um padr\u00e3o de etapa, mas foi encontrado '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Era esperado um padr\u00e3o de caminho relativo."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "O XPathResult da express\u00e3o XPath ''{0}'' tem um XPathResultType de {1} que n\u00e3o pode ser convertido em um booleano."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "O XPathResult da express\u00e3o XPath ''{0}'' tem um XPathResultType de {1} que n\u00e3o pode ser convertido em um \u00fanico n\u00f3. O m\u00e9todo getSingleNodeValue aplica-se apenas aos tipos ANY_UNORDERED_NODE_TYPE e FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "O m\u00e9todo getSnapshotLength n\u00e3o pode ser chamado no XPathResult da express\u00e3o XPath ''{0}'' porque seu XPathResultType \u00e9 {1}. Este m\u00e9todo aplica-se apenas aos tipos UNORDERED_NODE_SNAPSHOT_TYPE e ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "O m\u00e9todo iterateNext n\u00e3o pode ser chamado no XPathResult da express\u00e3o XPath ''{0}'' porque seu XPathResultType \u00e9 {1}. Este m\u00e9todo aplica-se apenas aos tipos UNORDERED_NODE_ITERATOR_TYPE e ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Documento alterado desde o retorno do resultado. O iterador \u00e9 inv\u00e1lido."}, { ER_INVALID_XPATH_TYPE, "Argumento de tipo XPath inv\u00e1lido: {0}"}, { ER_EMPTY_XPATH_RESULT, "Objeto de resultado XPath vazio"}, { ER_INCOMPATIBLE_TYPES, "O XPathResult da express\u00e3o XPath ''{0}'' tem um XPathResultType de {1} que n\u00e3o pode ser for\u00e7ado no XPathResultType especificado de {2}."}, { ER_NULL_RESOLVER, "N\u00e3o foi poss\u00edvel resolver o prefixo com um resolvedor de prefixo nulo."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "O XPathResult da express\u00e3o XPath ''{0}'' tem um XPathResultType de {1} que n\u00e3o pode ser convertido em uma cadeia."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "O m\u00e9todo snapshotItem n\u00e3o pode ser chamado no XPathResult da express\u00e3o XPath ''{0}'' porque seu XPathResultType \u00e9 {1}. Este m\u00e9todo aplica-se apenas aos tipos UNORDERED_NODE_SNAPSHOT_TYPE e ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "O n\u00f3 do contexto n\u00e3o pertence ao documento que est\u00e1 ligado a este XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "O tipo de n\u00f3 de contexto n\u00e3o \u00e9 suportado."}, { ER_XPATH_ERROR, "Erro desconhecido em XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "O XPathResult da express\u00e3o XPath ''{0}'' tem um XPathResultType de {1} que n\u00e3o pode ser convertido em um n\u00famero."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Fun\u00e7\u00e3o de extens\u00e3o: ''{0}'' n\u00e3o pode ser chamado quando o recurso XMLConstants.FEATURE_SECURE_PROCESSING est\u00e1 definido como true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable para a vari\u00e1vel {0} retornando nulo"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Tipo de Retorno N\u00e3o Suportado : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "O Tipo de Origem e/ou Retorno n\u00e3o pode ser nulo"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "O argumento {0} n\u00e3o pode ser nulo"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel ) n\u00e3o pode ser chamado com objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) n\u00e3o pode ser chamado com objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Tentando definir um recurso com um nome nulo: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Tentando definir o recurso desconhecido \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Tentando obter um recurso com um nome nulo: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Tentando obter o recurso desconhecido \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Tentando definir um nulo XPathFunctionResolver:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Tentando definir um nulo XPathVariableResolver:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "nome de locale na fun\u00e7\u00e3o format-number ainda n\u00e3o tratado!"}, { WG_PROPERTY_NOT_SUPPORTED, "Propriedade XSL n\u00e3o suportada: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "N\u00e3o fazer nada no momento com o espa\u00e7o de nomes {0} na propriedade {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException ao tentar acessar a propriedade do sistema XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Sintaxe antiga: quo(...) n\u00e3o est\u00e1 mais definida no XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath precisa de um objeto derivado para implementar nodeTest!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "Token function n\u00e3o encontrado."}, { WG_COULDNOT_FIND_FUNCTION, "N\u00e3o foi poss\u00edvel localizar a fun\u00e7\u00e3o: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Imposs\u00edvel criar URL a partir de: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "A op\u00e7\u00e3o -E n\u00e3o \u00e9 suportada pelo analisador do DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference fornecido para a vari\u00e1vel fora de contexto ou sem defini\u00e7\u00e3o! Nome = {0}"}, { WG_UNSUPPORTED_ENCODING, "Codifica\u00e7\u00e3o n\u00e3o suportada: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "pt"}, { "help_language", "pt"}, { "language", "pt"}, { "BAD_CODE", "O par\u00e2metro para createMessage estava fora dos limites"}, { "FORMAT_FAILED", "Exce\u00e7\u00e3o emitida durante chamada messageFormat"}, { "version", ">>>>>>> Vers\u00e3o Xalan"}, { "version2", "<<<<<<<"}, { "yes", "sim"}, { "line", "Linha n\u00b0"}, { "column", "Coluna n\u00b0"}, { "xsldone", "XSLProcessor: conclu\u00eddo"}, { "xpath_option", "op\u00e7\u00f5es xpath:"}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select xpath expression]"}, { "optionMatch", "[-match match pattern (para corresponder diagn\u00f3sticos)]"}, { "optionAnyExpr", "Ou apenas uma express\u00e3o xpath executar\u00e1 um dump de diagn\u00f3stico"}, { "noParsermsg1", "O Processo XSL n\u00e3o obteve \u00eaxito."}, { "noParsermsg2", "** N\u00e3o foi poss\u00edvel encontrar o analisador **"}, { "noParsermsg3", "Verifique seu classpath."}, { "noParsermsg4", "Se voc\u00ea n\u00e3o tiver o XML Parser para Java da IBM, poder\u00e1 fazer o download dele a partir de"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Erro: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Aviso: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PADR\u00c3O "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("pt", "BR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_ko.java0000644000175000017500000014307610721374033025154 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_ko.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_ko extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "\uc77c\uce58 \ud328\ud134\uc5d0\uc11c current() \ud568\uc218\uac00 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4." }, { ER_CURRENT_TAKES_NO_ARGS, "current() \ud568\uc218\uac00 \uc778\uc218\ub97c \uc2b9\uc778\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4." }, { ER_DOCUMENT_REPLACED, "document() \ud568\uc218 \uad6c\ud604\uc774 org.apache.xalan.xslt.FuncDocument\ub85c \ubc14\ub00c\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_CONTEXT_HAS_NO_OWNERDOC, "\ubb38\ub9e5\uc5d0 \uc18c\uc720\uc790 \ubb38\uc11c\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length()\uc5d0 \ub9ce\uc740 \uc778\uc218\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_TRANSLATE_TAKES_3_ARGS, "translate() \ud568\uc218\uac00 \uc138 \uac1c\uc758 \uc778\uc218\ub97c \ucde8\ud569\ub2c8\ub2e4."}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "unparsed-entity-uri \ud568\uc218\ub294 \ud558\ub098\uc758 \uc778\uc218\ub97c \ucde8\ud574\uc57c \ud569\ub2c8\ub2e4."}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "\uc774\ub984 \uacf5\uac04 \ucd95\uc774 \uc544\uc9c1 \uad6c\ud604\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_UNKNOWN_AXIS, "\uc54c \uc218 \uc5c6\ub294 \ucd95: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "\uc54c \uc218 \uc5c6\ub294 \uc77c\uce58 \uc870\uc791\uc785\ub2c8\ub2e4."}, { ER_INCORRECT_ARG_LENGTH, "processing-instruction() node \ud14c\uc2a4\ud2b8\uc758 \uc778\uc218 \uae38\uc774\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CONVERT_TO_NUMBER, "{0}\uc744(\ub97c) \uc22b\uc790\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CONVERT_TO_NODELIST, "{0}\uc744(\ub97c) NodeList\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0}\uc744(\ub97c) NodeSetDTM\uc73c\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CONVERT_TO_TYPE, "{0}\uc744(\ub97c) \uc720\ud615 \ubc88\ud638 {1}(\uc73c)\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_EXPECTED_MATCH_PATTERN, "\uc608\uc0c1\ub41c getMatchScore\uc758 \ud328\ud134 \uc77c\uce58\uc785\ub2c8\ub2e4."}, { ER_COULDNOT_GET_VAR_NAMED, "\uc774\ub984\uc774 {0}\uc778 \ubcc0\uc218\ub97c \uac00\uc838\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_UNKNOWN_OPCODE, "\uc624\ub958. \uc54c \uc218 \uc5c6\ub294 op \ucf54\ub4dc: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "\uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \ucd94\uac00 \ud1a0\ud070: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "\ub530\uc634\ud45c\uac00 \ud2c0\ub9b0 \ub9ac\ud130\ub7f4\uc774 \uc788\uc2b5\ub2c8\ub2e4. \ud070\ub530\uc634\ud45c\uac00 \uc608\uc0c1\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_EXPECTED_SINGLE_QUOTE, "\ub530\uc634\ud45c\uac00 \ud2c0\ub9b0 \ub9ac\ud130\ub7f4\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc791\uc740\ub530\uc634\ud45c\uac00 \uc608\uc0c1\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_EMPTY_EXPRESSION, "\ube48 \ud45c\ud604\uc2dd\uc785\ub2c8\ub2e4."}, { ER_EXPECTED_BUT_FOUND, "{0}\uc744(\ub97c) \uc608\uc0c1\ud588\uc73c\ub098 {1}\uc774(\uac00) \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "\ud504\ub85c\uadf8\ub798\uba38 \ub2e8\uc5b8\ubb38\uc774 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "19990709 XPath \ucd08\uc548\uc5d0\uc11c\ub294 \ubd80\uc6b8(...) \uc778\uc218\uac00 \ub354 \uc774\uc0c1 \uc120\ud0dd\uc801\uc774\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "','\ub97c \ubc1c\uacac\ud588\uc73c\ub098 \uadf8 \uc55e\uc5d0 \uc5b4\ub5a0\ud55c \uc778\uc218\ub3c4 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "','\ub97c \ubc1c\uacac\ud588\uc73c\ub098 \ub4a4\uc5d0 \uc5b4\ub5a0\ud55c \uc778\uc218\ub3c4 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' \ub610\ub294 '.[predicate]'\ub294 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uad6c\ubb38\uc785\ub2c8\ub2e4. \ub300\uc2e0 'self::node()[predicate]'\ub97c \uc0ac\uc6a9\ud558\uc2ed\uc2dc\uc624."}, { ER_ILLEGAL_AXIS_NAME, "\uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \ucd95 \uc774\ub984: {0}"}, { ER_UNKNOWN_NODETYPE, "\uc54c \uc218 \uc5c6\ub294 \ub178\ub4dc \uc720\ud615: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "\ud328\ud134 \ub9ac\ud130\ub7f4({0})\uc5d0\ub294 \ub530\uc634\ud45c\uac00 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0}\uc740(\ub294) \uc22b\uc790\ub85c \ud3ec\ub9f7\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "XML TransformerFactory Liaison\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "\uc624\ub958. xpath \uc120\ud0dd \ud45c\ud604\uc2dd(-select)\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "\uc624\ub958. OP_LOCATIONPATH \ub4a4\uc5d0 ENDOP\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ERROR_OCCURED, "\uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, { ER_ILLEGAL_VARIABLE_REFERENCE, "\ubcc0\uc218\uc5d0 \ub300\ud574 \uc8fc\uc5b4\uc9c4 VariableReference\uac00 \ubc94\uc704\ub97c \ubc97\uc5b4\ub0ac\uac70\ub098 \uc815\uc758\uac00 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774\ub984 = {0}"}, { ER_AXES_NOT_ALLOWED, "\ud558\uc704:: \ubc0f \uc18d\uc131:: \ucd95\ub9cc \ud328\ud134\uc5d0 \uc77c\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc704\ubc18 \ucd95 = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key()\uc758 \uc778\uc218 \uc218\uac00 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_COUNT_TAKES_1_ARG, "count \ud568\uc218\ub294 \ud558\ub098\uc758 \uc778\uc218\ub97c \ucde8\ud574\uc57c \ud569\ub2c8\ub2e4."}, { ER_COULDNOT_FIND_FUNCTION, "\ud568\uc218\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_UNSUPPORTED_ENCODING, "\uc9c0\uc6d0\ub418\uc9c0 \uc54a\ub294 \uc778\ucf54\ub529: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "getNextSibling\uc758 DTM\uc5d0 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. \ubcf5\uad6c \uc2dc\ub3c4 \uc911\uc785\ub2c8\ub2e4."}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "\ud504\ub85c\uadf8\ub798\uba38 \uc624\ub958: EmptyNodeList\ub97c \uc4f8 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "XPathContext\uc5d0\uc11c setDOMFactory\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_PREFIX_MUST_RESOLVE, "\uc811\ub450\ubd80\ub294 \uc774\ub984 \uacf5\uac04\uc73c\ub85c \ubd84\uc11d\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4: {0}"}, { ER_PARSE_NOT_SUPPORTED, "XPathContext\uc5d0\uc11c \uad6c\ubb38 \ubd84\uc11d(InputSource \uc18c\uc2a4)\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. {0}\uc744(\ub97c) \uc5f4 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SAX_API_NOT_HANDLED, "SAX API \ubb38\uc790(char ch[]... \uac00 DTM\uc5d0 \uc758\ud574 \ucc98\ub9ac\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... \uac00 DTM\uc5d0 \uc758\ud574 \ucc98\ub9ac\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison\uc774 {0} \uc720\ud615\uc758 \ub178\ub4dc\ub97c \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper\uac00 {0} \uc720\ud615\uc758 \ub178\ub4dc\ub97c \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse \uc624\ub958: \uc2dc\uc2a4\ud15c ID - {0} \ud68c\uc120 - {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse \uc624\ub958"}, { ER_INVALID_UTF16_SURROGATE, "\uc798\ubabb\ub41c UTF-16 \ub300\ub9ac\uc790(surrogate)\uac00 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0} ?"}, { ER_OIERROR, "IO \uc624\ub958"}, { ER_CANNOT_CREATE_URL, "url\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_XPATH_READOBJECT, "XPath.readObject\uc758 {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "\ud568\uc218 \ud1a0\ud070\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_DEAL_XPATH_TYPE, "XPath \uc720\ud615\uc744 \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NODESET_NOT_MUTABLE, "\uc774 NodeSet\uac00 \uac00\ubcc0\uc801\uc774\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_NODESETDTM_NOT_MUTABLE, "\uc774 NodeSetDTM\uc774 \uac00\ubcc0\uc801\uc774\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_VAR_NOT_RESOLVABLE, "\ubcc0\uc218\ub97c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NULL_ERROR_HANDLER, "\ub110(null) \uc624\ub958 \ud578\ub4e4\ub7ec"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "\ud504\ub85c\uadf8\ub798\uba38\uc758 \ub2e8\uc5b8\ubb38: \uc54c \uc218 \uc5c6\ub294 op \ucf54\ub4dc: {0}"}, { ER_ZERO_OR_ONE, "0 \ub610\ub294 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper\uc5d0\uc11c rtf()\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper\uc5d0\uc11c asNodeIterator()\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper\uc5d0\uc11c detach()\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper\uc5d0\uc11c num()\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper\uc5d0\uc11c xstr()\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper\uc5d0\uc11c str()\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "XStringForChars\uc5d0 \ub300\ud574 fsb()\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_COULD_NOT_FIND_VAR, "\uc774\ub984\uc774 {0}\uc778 \ubcc0\uc218\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars\ub294 \uc778\uc218\ub85c \ubb38\uc790\uc5f4\uc744 \uac00\uc838\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "FastStringBuffer \uc778\uc218\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_TWO_OR_THREE, "2 \ub610\ub294 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "\ubcc0\uc218\uac00 \ubc14\uc778\ub4dc\ub418\uae30 \uc804\uc5d0 \ubcc0\uc218\uc5d0 \uc561\uc138\uc2a4\ud588\uc2b5\ub2c8\ub2e4."}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB\ub294 \uc778\uc218\ub85c \ubb38\uc790\uc5f4\uc744 \ucde8\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! \uc624\ub958. \uc6cc\ucee4\uc758 \ub8e8\ud2b8\ub85c \ub110(null)\uc774 \uc124\uc815\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_NODESETDTM_CANNOT_ITERATE, "\uc774 NodeSetDTM\uc740 \uc774\uc804 \ub178\ub4dc\uc5d0 \ubc18\ubcf5 \uc801\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NODESET_CANNOT_ITERATE, "\uc774 NodeSet\ub294 \uc774\uc804 \ub178\ub4dc\uc5d0 \ubc18\ubcf5 \uc801\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NODESETDTM_CANNOT_INDEX, "\uc774 NodeSetDTM\uc740 \uc0c9\uc778 \ub610\ub294 \uce74\uc6b4\ud305 \ud568\uc218\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NODESET_CANNOT_INDEX, "\uc774 NodeSet\ub294 \uc0c9\uc778 \ub610\ub294 \uce74\uc6b4\ud305 \ud568\uc218\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "nextNode\uac00 \ud638\ucd9c\ub41c \ud6c4\uc5d0 setShouldCacheNodes\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ONLY_ALLOWS, "{0}\uc740(\ub294) {1} \uc778\uc218\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4."}, { ER_UNKNOWN_STEP, "getNextStepPos\uc5d0 \ud504\ub85c\uadf8\ub798\uba38\uc758 \ub2e8\uc5b8\ubb38\uc774 \uc788\uc74c: \uc54c \uc218 \uc5c6\ub294 stepType: {0} "}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "'/' \ub610\ub294 '//' \ud1a0\ud070 \ub2e4\uc74c\uc5d0 \uad00\ub828 \uc704\uce58 \uacbd\ub85c\uac00 \uc608\uc0c1\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "\uc704\uce58 \uacbd\ub85c\uac00 \uc608\uc0c1\ub418\uc5c8\uc9c0\ub9cc \ub2e4\uc74c \ud1a0\ud070\uc774 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "\uc704\uce58 \uacbd\ub85c\uac00 \uc608\uc0c1\ub418\uc5c8\uc9c0\ub9cc XPath \ud45c\ud604\uc2dd\uc758 \ub05d\uc774 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "'/' \ub610\ub294 '//' \ud1a0\ud070 \ub2e4\uc74c\uc5d0 \uc704\uce58 \ub2e8\uacc4\uac00 \uc608\uc0c1\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "NCName:* \ub610\ub294 QName\uacfc \uc77c\uce58\ud558\ub294 \ub178\ub4dc \ud14c\uc2a4\ud2b8\uac00 \uc608\uc0c1\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "\ub2e8\uacc4 \ud328\ud134\uc774 \uc608\uc0c1\ub418\uc5c8\uc9c0\ub9cc '/'\uac00 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "\uad00\ub828 \uacbd\ub85c \ud328\ud134\uc774 \uc608\uc0c1\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0 \ubd80\uc6b8\ub85c \ubcc0\ud658\ub420 \uc218 \uc5c6\ub294 XPathResultType {1}\uc774(\uac00) \uc788\uc2b5\ub2c8\ub2e4."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0 \ub2e8\uc77c \ub178\ub4dc\ub85c \ubcc0\ud658\ub420 \uc218 \uc5c6\ub294 XPathResultType {1}\uc774(\uac00) \uc788\uc2b5\ub2c8\ub2e4. \uba54\uc18c\ub4dc getSingleNodeValue\ub294 ANY_UNORDERED_NODE_TYPE \ubc0f FIRST_ORDERED_NODE_TYPE \uc720\ud615\uc5d0\ub9cc \uc801\uc6a9\ub429\ub2c8\ub2e4."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "XPathResultType\uc774 {1}\uc774\uae30 \ub54c\ubb38\uc5d0 XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0\uc11c getSnapshotLength \uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774 \uba54\uc18c\ub4dc\ub294 UNORDERED_NODE_SNAPSHOT_TYPE \ubc0f ORDERED_NODE_SNAPSHOT_TYPE \uc720\ud615\uc5d0\ub9cc \uc801\uc6a9\ub429\ub2c8\ub2e4."}, { ER_NON_ITERATOR_TYPE, "XPathResultType\uc774 {1}\uc774\uae30 \ub54c\ubb38\uc5d0 XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0\uc11c iterateNext \uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774 \uba54\uc18c\ub4dc\ub294 UNORDERED_NODE_ITERATOR_TYPE \ubc0f ORDERED_NODE_ITERATOR_TYPE \uc720\ud615\uc5d0\ub9cc \uc801\uc6a9\ub429\ub2c8\ub2e4."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "\uacb0\uacfc\uac00 \ub9ac\ud134\ub418\uc5c8\uc73c\ubbc0\ub85c \ubb38\uc11c\uac00 \ubcc0\uacbd\ub429\ub2c8\ub2e4. \ubc18\ubcf5\uae30\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_INVALID_XPATH_TYPE, "\uc798\ubabb\ub41c XPath \uc720\ud615 \uc778\uc218: {0}"}, { ER_EMPTY_XPATH_RESULT, "\ube44\uc5b4 \uc788\ub294 XPath \uacb0\uacfc \uc624\ube0c\uc81d\ud2b8\uc785\ub2c8\ub2e4."}, { ER_INCOMPATIBLE_TYPES, "XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0 \uc9c0\uc815\ub41c XPathResultType {2}(\uc73c)\ub85c \uac15\uc81c \uc2dc\ud589\ud560 \uc218 \uc5c6\ub294 XPathReultType {1}\uc774(\uac00) \uc788\uc2b5\ub2c8\ub2e4."}, { ER_NULL_RESOLVER, "\ub110(null) \uc811\ub450\ubd80 \ubd84\uc11d\uae30\ub85c \uc811\ub450\ubd80\ub97c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0 \ubb38\uc790\uc5f4\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\ub294 XPathResultType {1}\uc774(\uac00) \uc788\uc2b5\ub2c8\ub2e4."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "XPathResultType\uc774 {1}\uc774\uae30 \ub54c\ubb38\uc5d0 XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0\uc11c snapshotItem \uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774 \uba54\uc18c\ub4dc\ub294 UNORDERED_NODE_SNAPSHOT_TYPE \ubc0f ORDERED_NODE_SNAPSHOT_TYPE \uc720\ud615\uc5d0\ub9cc \uc801\uc6a9\ub429\ub2c8\ub2e4."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "\ucee8\ud14d\uc2a4\ud2b8 \ub178\ub4dc\ub294 \uc774 XPathEvaluator\ub85c \ubc14\uc778\ub4dc\ub418\ub294 \ubb38\uc11c\uc5d0 \ud3ec\ud568\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "\ucee8\ud14d\uc2a4\ud2b8 \ub178\ub4dc \uc720\ud615\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_XPATH_ERROR, "XPath\uc5d0 \uc54c \uc218 \uc5c6\ub294 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPath \ud45c\ud604\uc2dd ''{0}''\uc758 XPathResult\uc5d0 \uc22b\uc790\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\ub294 XPathResultType {1}\uc774(\uac00) \uc788\uc2b5\ub2c8\ub2e4."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "\ud655\uc7a5 \ud568\uc218: XMLConstants.FEATURE_SECURE_PROCESSING \uae30\ub2a5\uc774 true\ub85c \uc124\uc815\ub41c \uacbd\uc6b0 ''{0}''\uc744(\ub97c) \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "{0} \ubcc0\uc218\uc5d0 \ub300\ud55c resolveVariable\uc774 \ub110(null)\uc744 \ub9ac\ud134\ud569\ub2c8\ub2e4."}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "\uc9c0\uc6d0\ub418\uc9c0 \uc54a\ub294 \ub9ac\ud134 \uc720\ud615: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "\uc18c\uc2a4 \ubc0f/\ub610\ub294 \ub9ac\ud134 \uc720\ud615\uc774 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "{0} \uc778\uc218\uac00 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel )\uc740 objectModel == null\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel )\uc740 objectModel == \"\"\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "\ub110(null) \uc774\ub984\uc744 \uc0ac\uc6a9\ud558\uc5ec \uae30\ub2a5\uc744 \uc124\uc815\ud558\ub824\uace0 \ud569\ub2c8\ub2e4: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "\uc54c \uc218 \uc5c6\ub294 \uae30\ub2a5 \"{0}\":{1}#setFeature({0},{2})\ub97c \uc124\uc815\ud558\ub824\uace0 \ud569\ub2c8\ub2e4."}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "\ub110(null) \uc774\ub984\uc744 \uc0ac\uc6a9\ud558\uc5ec \uae30\ub2a5\uc744 \uc124\uc815\ud558\ub824\uace0 \ud569\ub2c8\ub2e4: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "\uc54c \uc218 \uc5c6\ub294 \uae30\ub2a5 \"{0}\"\uc744 \uac00\uc838\uc624\ub824\uace0 \ud569\ub2c8\ub2e4: {1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "\ub110(null)\uc778 XPathFunctionResolver\ub97c \uc124\uc815\ud558\ub824\uace0 \ud569\ub2c8\ub2e4: {0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "\ub110(null)\uc778 XPathVariableResolver\ub97c \uc124\uc815\ud558\ub824\uace0 \ud569\ub2c8\ub2e4: {0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "format-number \ud568\uc218\uc5d0 \uc788\ub294 \ub85c\ucf00\uc77c \uc774\ub984\uc774 \uc544\uc9c1 \ucc98\ub9ac\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { WG_PROPERTY_NOT_SUPPORTED, "XSL \ud2b9\uc131\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "\ud2b9\uc131\uc5d0\uc11c {0} \uc774\ub984 \uacf5\uac04\uacfc \uad00\ub828\ud558\uc5ec \ud604\uc7ac \uc544\ubb34\ub7f0 \uc791\uc5c5\ub3c4 \uc218\ud589\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {1}"}, { WG_SECURITY_EXCEPTION, "XSL \uc2dc\uc2a4\ud15c \ud2b9\uc131\uc5d0 \uc561\uc138\uc2a4\ud558\ub294 \uc911 SecurityException\uc774 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "\uc774\uc804 \uad6c\ubb38: quo(...)\uac00 \ub354 \uc774\uc0c1 XPath\uc5d0 \uc815\uc758\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "nodeTest\ub97c \uad6c\ud604\ud558\ub824\uba74 XPath\uc5d0 \ud30c\uc0dd\ub41c \uc624\ube0c\uc81d\ud2b8\uac00 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { WG_FUNCTION_TOKEN_NOT_FOUND, "\ud568\uc218 \ud1a0\ud070\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { WG_COULDNOT_FIND_FUNCTION, "\ud568\uc218\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "{0}\uc5d0\uc11c URL\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "DTM \uad6c\ubb38 \ubd84\uc11d\uae30\uc5d0 \ub300\ud574 -E \uc635\uc158\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { WG_ILLEGAL_VARIABLE_REFERENCE, "\ubcc0\uc218\uc5d0 \ub300\ud574 \uc8fc\uc5b4\uc9c4 VariableReference\uac00 \ubc94\uc704\ub97c \ubc97\uc5b4\ub0ac\uac70\ub098 \uc815\uc758\uac00 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774\ub984 = {0}"}, { WG_UNSUPPORTED_ENCODING, "\uc9c0\uc6d0\ub418\uc9c0 \uc54a\ub294 \uc778\ucf54\ub529: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "ko"}, { "help_language", "ko"}, { "language", "ko"}, { "BAD_CODE", "createMessage\uc5d0 \ub300\ud55c \ub9e4\uac1c\ubcc0\uc218\uac00 \ubc94\uc704\ub97c \ubc97\uc5b4\ub0ac\uc2b5\ub2c8\ub2e4."}, { "FORMAT_FAILED", "messageFormat \ud638\ucd9c \uc911 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, { "version", ">>>>>>> Xalan \ubc84\uc804 "}, { "version2", "<<<<<<<"}, { "yes", "\uc608"}, { "line", "\ud589 #"}, { "column", "\uc5f4 #"}, { "xsldone", "XSLProcessor: \uc644\ub8cc"}, { "xpath_option", "xpath \uc635\uc158: "}, { "optionIN", "[-in inputXMLURL]"}, { "optionSelect", "[-select xpath expression]"}, { "optionMatch", "[-match match pattern(\uc77c\uce58 \uc9c4\ub2e8\uc6a9)]"}, { "optionAnyExpr", "\ub610\ub294 xpath \ud45c\ud604\uc2dd\ub9cc\uc73c\ub85c \uc9c4\ub2e8 \ub364\ud504\uac00 \uc218\ud589\ub420 \uac83\uc785\ub2c8\ub2e4."}, { "noParsermsg1", "XSL \ud504\ub85c\uc138\uc2a4\uac00 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { "noParsermsg2", "** \uad6c\ubb38 \ubd84\uc11d\uae30\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. **"}, { "noParsermsg3", "\ud074\ub798\uc2a4 \uacbd\ub85c\ub97c \uc810\uac80\ud558\uc2ed\uc2dc\uc624."}, { "noParsermsg4", "Java\uc6a9 IBM XML \uad6c\ubb38 \ubd84\uc11d\uae30\uac00 \uc5c6\uc73c\uba74"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml\uc5d0\uc11c \ub2e4\uc6b4\ub85c\ub4dc\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "\uc624\ub958: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "\uacbd\uace0: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("ko", "KR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_zh_TW.java0000644000175000017500000013134610721374032025572 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_zh_TW.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_zh_TW extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "\u5728\u6bd4\u5c0d\u578b\u6a23\u4e2d\u4e0d\u5141\u8a31\u4f7f\u7528 current() \u51fd\u6578\uff01" }, { ER_CURRENT_TAKES_NO_ARGS, "current() \u51fd\u6578\u4e0d\u63a5\u53d7\u5f15\u6578\uff01" }, { ER_DOCUMENT_REPLACED, "document() \u51fd\u6578\u5be6\u4f5c\u5df2\u88ab org.apache.xalan.xslt.FuncDocument \u53d6\u4ee3\uff01"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "\u74b0\u5883\u5b9a\u7fa9\u6c92\u6709\u64c1\u6709\u8005\u6587\u4ef6\uff01"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() \u6709\u592a\u591a\u5f15\u6578\u3002"}, { ER_TRANSLATE_TAKES_3_ARGS, "translate() \u51fd\u6578\u9700\u8981 3 \u500b\u5f15\u6578\uff01"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "unparsed-entity-uri \u51fd\u6578\u53ea\u9700\u8981 1 \u500b\u5f15\u6578\uff01"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "namespace axis \u5c1a\u672a\u5be6\u4f5c\uff01"}, { ER_UNKNOWN_AXIS, "\u4e0d\u660e\u8ef8\uff1a{0}"}, { ER_UNKNOWN_MATCH_OPERATION, "\u4e0d\u660e\u7684\u6bd4\u5c0d\u4f5c\u696d\uff01"}, { ER_INCORRECT_ARG_LENGTH, "processing-instruction() \u7bc0\u9ede\u6e2c\u8a66\u7684\u5f15\u6578\u9577\u5ea6\u4e0d\u6b63\u78ba\uff01"}, { ER_CANT_CONVERT_TO_NUMBER, "{0} \u7121\u6cd5\u8f49\u63db\u70ba\u6578\u5b57"}, { ER_CANT_CONVERT_TO_NODELIST, "{0} \u7121\u6cd5\u8f49\u63db\u70ba NodeList\uff01"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0} \u7121\u6cd5\u8f49\u63db\u70ba NodeSetDTM\uff01"}, { ER_CANT_CONVERT_TO_TYPE, "\u7121\u6cd5\u5c07 {0} \u8f49\u63db\u70ba type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "\u539f\u9810\u671f\u5728 getMatchScore \u4e2d\u6703\u51fa\u73fe\u6bd4\u5c0d\u578b\u6a23\uff01"}, { ER_COULDNOT_GET_VAR_NAMED, "\u7121\u6cd5\u53d6\u5f97\u8b8a\u6578\u540d\u7a31 {0}"}, { ER_UNKNOWN_OPCODE, "\u932f\u8aa4\uff01\u4e0d\u660e\u4f5c\u696d\u78bc\uff1a{0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "\u984d\u5916\u7684\u4e0d\u5408\u6cd5\u8a18\u865f\uff1a{0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "\u62ec\u932f\u5f15\u865f\u7684\u6587\u5b57... \u539f\u9810\u671f\u70ba\u96d9\u5f15\u865f\uff01"}, { ER_EXPECTED_SINGLE_QUOTE, "\u62ec\u932f\u5f15\u865f\u7684\u6587\u5b57... \u539f\u9810\u671f\u70ba\u55ae\u5f15\u865f\uff01"}, { ER_EMPTY_EXPRESSION, "\u7a7a\u7684\u8868\u793a\u5f0f\uff01"}, { ER_EXPECTED_BUT_FOUND, "\u539f\u9810\u671f\u70ba {0}\uff0c\u537b\u767c\u73fe\uff1a{1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "\u7a0b\u5f0f\u8a2d\u8a08\u5e2b\u5047\u8a2d(Programmer assertion)\u4e0d\u6b63\u78ba\uff01- {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "boolean(...) \u5f15\u6578\u5728 19990709 XPath \u521d\u7a3f\u4e2d\u4e0d\u518d\u662f\u53ef\u9078\u7528\u7684\u3002"}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "\u627e\u5230 ','\uff0c\u4f46\u4e4b\u524d\u6c92\u6709\u5f15\u6578\uff01"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "\u627e\u5230 ','\uff0c\u4f46\u4e4b\u5f8c\u6c92\u6709\u5f15\u6578\uff01"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' \u6216 '.[predicate]' \u662f\u4e0d\u5408\u6cd5\u8a9e\u6cd5\u3002\u8acb\u6539\u7528 'self::node()[predicate]'\u3002"}, { ER_ILLEGAL_AXIS_NAME, "\u4e0d\u5408\u6cd5\u8ef8\u540d\u7a31\uff1a{0}"}, { ER_UNKNOWN_NODETYPE, "\u4e0d\u660e\u7bc0\u9ede\u985e\u578b\uff1a{0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "\u578b\u6a23\u6587\u5b57 ({0}) \u9700\u8981\u7528\u5f15\u865f\u62ec\u4f4f\uff01"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} \u7121\u6cd5\u683c\u5f0f\u5316\u70ba\u6578\u5b57\uff01"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "\u7121\u6cd5\u5efa\u7acb XML TransformerFactory Liaison\uff1a{0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "\u932f\u8aa4\uff01\u6c92\u6709\u627e\u5230 xpath select \u8868\u793a\u5f0f (-select)\u3002"}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "\u932f\u8aa4\uff01\u5728 OP_LOCATIONPATH \u4e4b\u5f8c\u627e\u4e0d\u5230 ENDOP"}, { ER_ERROR_OCCURED, "\u767c\u751f\u932f\u8aa4\uff01"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "\u63d0\u4f9b\u7d66\u8b8a\u6578\u7684 VariableReference \u8d85\u51fa\u74b0\u5883\u5b9a\u7fa9\u6216\u6c92\u6709\u5b9a\u7fa9\uff01\u540d\u7a31 = {0}"}, { ER_AXES_NOT_ALLOWED, "\u6bd4\u5c0d\u578b\u6a23\u4e2d\u53ea\u63a5\u53d7 child:: \u4ee5\u53ca attribute:: \u5169\u7a2e\u8ef8\uff01\u4e0d\u7576\u7684\u8ef8 = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() \u542b\u6709\u4e0d\u6b63\u78ba\u5f15\u6578\u6578\u76ee\u3002"}, { ER_COUNT_TAKES_1_ARG, "count \u51fd\u6578\u53ea\u9700\u8981\u4e00\u500b\u5f15\u6578\uff01"}, { ER_COULDNOT_FIND_FUNCTION, "\u627e\u4e0d\u5230\u51fd\u6578\uff1a{0}"}, { ER_UNSUPPORTED_ENCODING, "\u4e0d\u652f\u63f4\u7de8\u78bc\uff1a{0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "getNextSibling \u6642\u5728 DTM \u767c\u751f\u554f\u984c... \u5617\u8a66\u56de\u5fa9"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "\u7a0b\u5f0f\u8a2d\u8a08\u5e2b\u932f\u8aa4\uff1a\u7121\u6cd5\u5beb\u5165 EmptyNodeList\u3002"}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory \u4e0d\u53d7 XPathContext \u652f\u63f4\uff01"}, { ER_PREFIX_MUST_RESOLVE, "\u5b57\u9996\u5fc5\u9808\u89e3\u6790\u70ba\u540d\u7a31\u7a7a\u9593\uff1a{0}"}, { ER_PARSE_NOT_SUPPORTED, "\u5728 XPathContext \u4e2d\u4e0d\u652f\u63f4\u5256\u6790\uff08InputSource \u539f\u59cb\u6a94\uff09\uff01\u7121\u6cd5\u958b\u555f {0}"}, { ER_SAX_API_NOT_HANDLED, "SAX API character(char ch[]... \u4e0d\u80fd\u88ab DTM \u8655\u7406\uff01"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... \u4e0d\u80fd\u88ab DTM \u8655\u7406\uff01"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison \u4e0d\u80fd\u8655\u7406 {0} \u985e\u578b\u7684\u7bc0\u9ede"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper \u4e0d\u80fd\u8655\u7406 {0} \u985e\u578b\u7684\u7bc0\u9ede"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse \u932f\u8aa4\uff1aSystemID - {0} \u884c - {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse \u932f\u8aa4"}, { ER_INVALID_UTF16_SURROGATE, "\u5075\u6e2c\u5230\u7121\u6548\u7684 UTF-16 \u4ee3\u7406\uff1a{0}?"}, { ER_OIERROR, "IO \u932f\u8aa4"}, { ER_CANNOT_CREATE_URL, "\u7121\u6cd5\u91dd\u5c0d\uff1a{0} \u5efa\u7acb URL"}, { ER_XPATH_READOBJECT, "\u4f4d\u65bc XPath.readObject\uff1a{0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "\u627e\u4e0d\u5230\u51fd\u6578\u8a18\u865f\u3002"}, { ER_CANNOT_DEAL_XPATH_TYPE, "\u7121\u6cd5\u8655\u7406 XPath \u985e\u578b\uff1a{0}"}, { ER_NODESET_NOT_MUTABLE, "\u6b64 NodeSet \u4e0d\u662f\u6613\u8b8a\u7684"}, { ER_NODESETDTM_NOT_MUTABLE, "\u6b64 NodeSetDTM \u4e0d\u662f\u6613\u8b8a\u7684"}, { ER_VAR_NOT_RESOLVABLE, "\u8b8a\u6578\u7121\u6cd5\u89e3\u6790\uff1a{0}"}, { ER_NULL_ERROR_HANDLER, "\u7a7a\u503c\u932f\u8aa4\u8655\u7406\u7a0b\u5f0f"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "\u7a0b\u5f0f\u8a2d\u8a08\u5e2b\u7684\u78ba\u8a8d\uff1a\u4e0d\u660e\u4f5c\u696d\u78bc\uff1a{0}"}, { ER_ZERO_OR_ONE, "0 \u6216 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() \u4e0d\u53d7 XRTreeFragSelectWrapper \u652f\u63f4"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() \u4e0d\u53d7 XRTreeFragSelectWrapper \u652f\u63f4"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() \u4e0d\u53d7 XRTreeFragSelectWrapper \u652f\u63f4"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() \u4e0d\u53d7 XRTreeFragSelectWrapper \u652f\u63f4"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() \u4e0d\u53d7 XRTreeFragSelectWrapper \u652f\u63f4"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() \u4e0d\u53d7 XRTreeFragSelectWrapper \u652f\u63f4"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() \u4e0d\u53d7 XStringForChars \u652f\u63f4"}, { ER_COULD_NOT_FIND_VAR, "\u627e\u4e0d\u5230\u540d\u7a31\u70ba {0} \u7684\u8b8a\u6578"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars \u4e0d\u63a5\u53d7\u5b57\u4e32\u4f5c\u70ba\u5f15\u6578"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "FastStringBuffer \u5f15\u6578\u4e0d\u53ef\u70ba\u7a7a\u503c"}, { ER_TWO_OR_THREE, "2 \u6216 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "\u8b8a\u6578\u5728\u9023\u7d50\u4e4b\u524d\u5373\u88ab\u5b58\u53d6\uff01"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB \u4e0d\u53ef\u4f7f\u7528\u5b57\u4e32\u4f5c\u70ba\u5f15\u6578\uff01"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n!!!! \u932f\u8aa4\uff01\u8a2d\u5b9a Walker \u7684\u6839\u76ee\u9304\u70ba\u7a7a\u503c!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "\u6b64 NodeSetDTM \u4e0d\u53ef\u758a\u4ee3\u70ba\u524d\u4e00\u500b\u7bc0\u9ede\uff01"}, { ER_NODESET_CANNOT_ITERATE, "\u6b64 NodeSet \u4e0d\u53ef\u758a\u4ee3\u70ba\u524d\u4e00\u500b\u7bc0\u9ede\uff01"}, { ER_NODESETDTM_CANNOT_INDEX, "\u6b64 NodeSetDTM \u4e0d\u53ef\u57f7\u884c\u6aa2\u7d22\u6216\u8a08\u6578\u529f\u80fd\uff01"}, { ER_NODESET_CANNOT_INDEX, "\u6b64 NodeSet \u4e0d\u53ef\u57f7\u884c\u6aa2\u7d22\u6216\u8a08\u6578\u529f\u80fd\uff01"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "\u5728\u547c\u53eb nextNode \u4e4b\u5f8c\u4e0d\u80fd\u547c\u53eb setShouldCacheNodes\u3002"}, { ER_ONLY_ALLOWS, "{0} \u53ea\u5141\u8a31 {1} \u5f15\u6578"}, { ER_UNKNOWN_STEP, "\u7a0b\u5f0f\u8a2d\u8a08\u5e2b\u5728 getNextStepPos \u4e2d\u7684\u78ba\u8a8d\uff1a\u4e0d\u660e\u7684 stepType\uff1a{0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "\u9810\u671f\u5728 '/' \u6216 '//' \u8a18\u865f\u4e4b\u5f8c\u70ba\u76f8\u5c0d\u7684\u4f4d\u7f6e\u8def\u5f91\u3002"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "\u5fc5\u9808\u662f\u4f4d\u7f6e\u8def\u5f91\uff0c\u537b\u9047\u5230\u4e0b\u5217\u8a18\u865f\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "\u539f\u9810\u671f\u70ba\u4f4d\u7f6e\u8def\u5f91\uff0c\u4f46\u627e\u5230\u7684\u537b\u662f XPath \u8868\u793a\u5f0f\u7684\u7d50\u5c3e\u3002"}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "\u9810\u671f\u5728 '/' \u6216 '//' \u8a18\u865f\u4e4b\u5f8c\u70ba location step\u3002"}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "\u539f\u9810\u671f\u70ba\u7b26\u5408 NCName:* \u6216 QName \u7684 node test\u3002"}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "\u539f\u9810\u671f\u70ba step pattern\uff0c\u4f46\u537b\u9047\u5230 '/'\u3002"}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "\u539f\u9810\u671f\u70ba\u76f8\u5c0d\u7684\u8def\u5f91\u578b\u6a23\u3002"}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u6709\u7121\u6cd5\u8f49\u63db\u70ba boolean \u7684 {1} \u7684 XPathResultType\u3002"}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u6709\u7121\u6cd5\u8f49\u63db\u70ba\u55ae\u4e00\u7bc0\u9ede\u7684 {1} \u7684 XPathResultType\u3002\u65b9\u6cd5 getSingleNodeValue \u50c5\u9069\u7528\u65bc ANY_UNORDERED_NODE_TYPE \u53ca FIRST_ORDERED_NODE_TYPE \u5169\u7a2e\u985e\u578b\u3002"}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "\u7121\u6cd5\u5728 XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u4e0a\u547c\u53eb\u65b9\u6cd5 getSnapshotLength\uff0c\u56e0\u70ba\u5b83\u7684 XPathResultType \u662f {1}\u3002\u6b64\u65b9\u6cd5\u50c5\u9069\u7528\u65bc UNORDERED_NODE_SNAPSHOT_TYPE \u53ca ORDERED_NODE_SNAPSHOT_TYPE \u5169\u7a2e\u985e\u578b\u3002"}, { ER_NON_ITERATOR_TYPE, "\u7121\u6cd5\u5728 XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u4e0a\u547c\u53eb\u65b9\u6cd5 iterateNext\uff0c\u56e0\u70ba\u5b83\u7684 XPathResultType \u662f {1}\u3002\u6b64\u65b9\u6cd5\u50c5\u9069\u7528\u65bc UNORDERED_NODE_ITERATOR_TYPE \u53ca ORDERED_NODE_ITERATOR_TYPE \u5169\u7a2e\u985e\u578b\u3002"}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "\u81ea\u50b3\u56de\u7d50\u679c\u4e4b\u5f8c\uff0c\u6587\u4ef6\u5df2\u7522\u751f\u8b8a\u5316\u3002\u91cd\u8907\u9805\u76ee\u7121\u6548\u3002"}, { ER_INVALID_XPATH_TYPE, "XPath \u985e\u578b\u5f15\u6578 {0} \u7121\u6548"}, { ER_EMPTY_XPATH_RESULT, "XPath \u7d50\u679c\u7269\u4ef6\u7a7a\u767d"}, { ER_INCOMPATIBLE_TYPES, "XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u6709\u7121\u6cd5\u5f37\u5236\u7f6e\u5165 {2} \u7684\u6307\u5b9a XPathResultType \u4e2d\u7684 {1} \u7684 XPathResultType\u3002"}, { ER_NULL_RESOLVER, "\u7121\u6cd5\u89e3\u6790\u542b\u7a7a\u503c\u5b57\u9996\u89e3\u6790\u5668\u7684\u5b57\u9996\u3002"}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u6709\u7121\u6cd5\u8f49\u63db\u70ba\u5b57\u4e32\u7684 {1} \u7684 XPathResultType\u3002"}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "\u7121\u6cd5\u5728 XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u4e0a\u547c\u53eb\u65b9\u6cd5 snapshotItem\uff0c\u56e0\u70ba\u5b83\u7684 XPathResultType \u662f {1}\u3002\u6b64\u65b9\u6cd5\u50c5\u9069\u7528\u65bc UNORDERED_NODE_SNAPSHOT_TYPE \u53ca ORDERED_NODE_SNAPSHOT_TYPE \u5169\u7a2e\u985e\u578b\u3002"}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "\u74b0\u5883\u5b9a\u7fa9\u7bc0\u9ede\u4e0d\u5c6c\u65bc\u548c\u6b64 XPathEvaluator \u9023\u7d50\u7684\u6587\u4ef6\u3002"}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "\u74b0\u5883\u5b9a\u7fa9\u7bc0\u9ede\u985e\u578b\u672a\u53d7\u652f\u63f4\u3002"}, { ER_XPATH_ERROR, "XPath \u767c\u751f\u4e0d\u660e\u932f\u8aa4\u3002"}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPath \u8868\u793a\u5f0f ''{0}'' \u7684 XPathResult \u6709\u7121\u6cd5\u8f49\u63db\u70ba\u6578\u5b57\u7684 {1} \u7684 XPathResultType\u3002"}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "\u7576 XMLConstants.FEATURE_SECURE_PROCESSING \u7279\u6027\u8a2d\u70ba true \u6642\uff0c\u7121\u6cd5\u547c\u53eb\u5ef6\u4f38\u51fd\u6578\uff1a''{0}''\u3002"}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "\u8b8a\u6578 {0} \u7684 resolveVariable \u50b3\u56de\u7a7a\u503c"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "\u4e0d\u53d7\u652f\u63f4\u7684\u50b3\u56de\u985e\u578b\uff1a{0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "\u539f\u59cb\u6a94\u53ca/\u6216\u50b3\u56de\u985e\u578b\u4e0d\u53ef\u70ba\u7a7a\u503c"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "{0} \u5f15\u6578\u4e0d\u53ef\u70ba\u7a7a\u503c"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "\u7576 objectModel == null \u6642\u7121\u6cd5\u547c\u53eb {0}#isObjectModelSupported(String objectModel )"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "\u7576 objectModel == \"\" \u6642\u7121\u6cd5\u547c\u53eb {0}#isObjectModelSupported(String objectModel )"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "\u5617\u8a66\u8a2d\u5b9a\u4f7f\u7528\u7a7a\u503c\u540d\u7a31\u7684\u7279\u6027\uff1a{0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "\u5617\u8a66\u8a2d\u5b9a\u4e0d\u660e\u7279\u6027 \"{0}\"\uff1a{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "\u5617\u8a66\u53d6\u5f97\u4f7f\u7528\u7a7a\u503c\u540d\u7a31\u7684\u7279\u6027\uff1a{0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "\u5617\u8a66\u53d6\u5f97\u4e0d\u660e\u7279\u6027 \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "\u5617\u8a66\u8a2d\u5b9a\u7a7a\u503c XPathFunctionResolver\uff1a{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "\u5617\u8a66\u8a2d\u5b9a\u7a7a\u503c XPathVariableResolver\uff1a{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "format-number \u51fd\u6578\u4e2d\u7684\u8a9e\u8a00\u74b0\u5883\u540d\u7a31\u5c1a\u672a\u8655\u7406\uff01"}, { WG_PROPERTY_NOT_SUPPORTED, "XSL \u5167\u5bb9\u672a\u53d7\u652f\u63f4\uff1a{0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "\u76ee\u524d\u4e0d\u8981\u5c0d\u5167\u5bb9\uff1a{1} \u4e2d\u7684\u540d\u7a31\u7a7a\u9593 {0} \u505a\u4efb\u4f55\u52d5\u4f5c"}, { WG_SECURITY_EXCEPTION, "\u5617\u8a66\u5b58\u53d6 XSL \u7cfb\u7d71\u5167\u5bb9\uff1a{0} \u6642\u767c\u751f SecurityException"}, { WG_QUO_NO_LONGER_DEFINED, "XPath \u4e2d\u5df2\u4e0d\u518d\u5b9a\u7fa9\u820a\u8a9e\u6cd5\uff1aquo(...)\u3002"}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath \u9700\u8981\u884d\u751f\u7269\u4ef6\u4f86\u5be6\u4f5c nodeTest\uff01"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "\u627e\u4e0d\u5230\u51fd\u6578\u8a18\u865f\u3002"}, { WG_COULDNOT_FIND_FUNCTION, "\u627e\u4e0d\u5230\u51fd\u6578\uff1a{0}"}, { WG_CANNOT_MAKE_URL_FROM, "\u7121\u6cd5\u5f9e\uff1a{0} \u7522\u751f URL"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "-E \u9078\u9805\u4e0d\u53d7 DTM \u5256\u6790\u5668\u652f\u63f4"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "\u63d0\u4f9b\u7d66\u8b8a\u6578\u7684 VariableReference \u8d85\u51fa\u74b0\u5883\u5b9a\u7fa9\u6216\u6c92\u6709\u5b9a\u7fa9\uff01\u540d\u7a31 = {0}"}, { WG_UNSUPPORTED_ENCODING, "\u4e0d\u652f\u63f4\u7de8\u78bc\uff1a{0}"}, // Other miscellaneous text used inside the code... { "ui_language", "zh"}, { "help_language", "zh"}, { "language", "zh"}, { "BAD_CODE", "createMessage \u7684\u53c3\u6578\u8d85\u51fa\u754c\u9650"}, { "FORMAT_FAILED", "\u5728 messageFormat \u547c\u53eb\u671f\u9593\u64f2\u51fa\u7570\u5e38"}, { "version", ">>>>>>> Xalan \u7248\u672c"}, { "version2", "<<<<<<<"}, { "yes", "yes"}, { "line", "\u884c\u865f"}, { "column", "\u6b04\u865f"}, { "xsldone", "XSLProcessor\uff1a\u5b8c\u6210"}, { "xpath_option", "xpath \u9078\u9805\uff1a"}, { "optionIN", "[-in inputXMLURL]"}, { "optionSelect", "[-select xpath \u8868\u793a\u5f0f]"}, { "optionMatch", "[-match \u7b26\u5408\u578b\u6a23\uff08\u7528\u65bc\u6bd4\u5c0d\u8a3a\u65b7\uff09]"}, { "optionAnyExpr", "\u6216\u53ea\u6709\u4e00\u500b xpath \u8868\u793a\u5f0f\u6703\u57f7\u884c\u8a3a\u65b7\u50be\u51fa"}, { "noParsermsg1", "XSL \u7a0b\u5e8f\u6c92\u6709\u9806\u5229\u5b8c\u6210\u3002"}, { "noParsermsg2", "** \u627e\u4e0d\u5230\u5256\u6790\u5668 **"}, { "noParsermsg3", "\u8acb\u6aa2\u67e5\u985e\u5225\u8def\u5f91\u3002"}, { "noParsermsg4", "\u5982\u679c\u60a8\u6c92\u6709 IBM \u7684 XML Parser for Java\uff0c\u53ef\u81ea\u4ee5\u4e0b\u7db2\u5740\u4e0b\u8f09"}, { "noParsermsg5", "IBM \u7684 AlphaWorks\uff1ahttp://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "\u932f\u8aa4\uff1a"; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "\u8b66\u544a\uff1a"; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("zh", "TW")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_it.java0000644000175000017500000012350210721374033025147 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_it.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_it extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "La funzione corrente () non \u00e8 consentita in un modello di corrispondenza." }, { ER_CURRENT_TAKES_NO_ARGS, "La funzione corrente () non accetta argomenti." }, { ER_DOCUMENT_REPLACED, "L'implementazione della funzione documento () \u00e8 stata sostituita da org.apache.xalan.xslt.FuncDocument."}, { ER_CONTEXT_HAS_NO_OWNERDOC, "il contesto non ha un documento proprietario."}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() ha troppi argomenti."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() ha troppi argomenti."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() ha troppi argomenti."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() ha troppi argomenti."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() ha troppi argomenti."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() ha troppi argomenti."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() ha troppi argomenti."}, { ER_TRANSLATE_TAKES_3_ARGS, "La funzione translate() richiede tre argomenti."}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "La funzione unparsed-entity-uri richiede un argomento."}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "namespace axis non ancora implementato."}, { ER_UNKNOWN_AXIS, "asse sconosciuto: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "operazione di corrispondenza sconosciuta."}, { ER_INCORRECT_ARG_LENGTH, "Lunghezza argomento nella prova nodo processing-instruction() non corretta."}, { ER_CANT_CONVERT_TO_NUMBER, "Impossibile convertire {0} in un numero"}, { ER_CANT_CONVERT_TO_NODELIST, "Impossibile convertire {0} in un NodeList."}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Impossibile convertire {0} in un NodeSetDTM."}, { ER_CANT_CONVERT_TO_TYPE, "Impossibile convertire {0} in un type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "Modello corrispondenza previsto in getMatchScore!"}, { ER_COULDNOT_GET_VAR_NAMED, "Impossibile richiamare la variabile denominata {0}"}, { ER_UNKNOWN_OPCODE, "ERRORE! Codice operativo sconosciuto: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Token aggiuntivi non validi: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "letterale con numero di apici errato... previsti i doppi apici."}, { ER_EXPECTED_SINGLE_QUOTE, "letterale con numero di apici errato... previsto un solo apice."}, { ER_EMPTY_EXPRESSION, "Espressione vuota."}, { ER_EXPECTED_BUT_FOUND, "Era previsto {0}, ma \u00e8 stato trovato: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Asserzione programmatore errata. - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "Argomento boolean(...) non pi\u00f9 facoltativo con la versione 19990709 XPath."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Trovata ',' senza argomento che la precede."}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Trovata ',' senza argomento che la segue."}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicato]' o '.[predicato]' \u00e8 una sintassi non valida. Utilizzare 'self::node()[predicato]'."}, { ER_ILLEGAL_AXIS_NAME, "nome asse non valido: {0}"}, { ER_UNKNOWN_NODETYPE, "Nodetype sconosciuto: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Il letterale modello ({0}) deve essere racchiuso fra virgolette."}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} non pu\u00f2 essere formattato in un numero."}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Impossibile creare XML TransformerFactory Liaison: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Errore! Impossibile trovare espressione selezione xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "ERRORE! Impossibile trovare ENDOP dopo OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Si \u00e8 verificato un errore."}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference fornito per la variabile \u00e8 fuori contesto o senza definizione. Nome = {0}"}, { ER_AXES_NOT_ALLOWED, "Sono consentiti solo gli assi child:: e attribute:: nei modelli di corrispondenza. Violazione asse = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() con numero di argomenti scorretto."}, { ER_COUNT_TAKES_1_ARG, "La funzione count richiede un argomento."}, { ER_COULDNOT_FIND_FUNCTION, "Impossibile trovare la funzione: {0}"}, { ER_UNSUPPORTED_ENCODING, "Codifica non supportata: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Si \u00e8 verificato un problema in DTM durante l'esecuzione di getNextSibling... tentativo di recupero in corso"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Errore di programmazione: Impossibile scrivere su EmptyNodeList."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory non supportato da XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "Il prefisso deve risolvere in uno namespace: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource source) non supportato in XPathContext! Impossibile aprire {0}"}, { ER_SAX_API_NOT_HANDLED, "Caratteri SAX API (char ch[]... non gestiti da DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... non gestiti da DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison non pu\u00f2 gestire i nodi di tipo {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper non pu\u00f2 gestire i nodi di tipo {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Errore DOM2Helper.parse: SystemID - {0} riga - {1}"}, { ER_XERCES_PARSE_ERROR, "Errore DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Rilevato surrogato UTF-16 non valido: {0} ?"}, { ER_OIERROR, "Errore IO"}, { ER_CANNOT_CREATE_URL, "Impossibile creare url per: {0}"}, { ER_XPATH_READOBJECT, "In XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "token funzione non trovato."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Impossibile gestire il tipo XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Questo NodeSet non \u00e8 trasformabile"}, { ER_NODESETDTM_NOT_MUTABLE, "Questo NodeSetDTM non \u00e8 trasformabile"}, { ER_VAR_NOT_RESOLVABLE, "Variabile non risolvibile: {0}"}, { ER_NULL_ERROR_HANDLER, "Handler errori nullo"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Asserzione di programmatore: codice operativo sconosciuto: {0}"}, { ER_ZERO_OR_ONE, "0 oppure 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() non supportato da XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() non supportato da XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() non supportato da XRTreeFragSelectWrapper"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() non supportato da XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() non supportato da XRTreeFragSelectWrapper"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() non supportato da XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() non supportato per XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "Impossibile trovare la variabile con il nome {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars non pu\u00f2 accettare una stringa come argomento"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "L'argomento FastStringBuffer non pu\u00f2 essere nullo"}, { ER_TWO_OR_THREE, "2 o 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Variabile acceduta prima che fosse delimitata."}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB non pu\u00f2 accettare una stringa come argomento."}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Errore! Si sta impostando il nodo di partenza su null"}, { ER_NODESETDTM_CANNOT_ITERATE, "NodeSetDTM non pu\u00f2 collegarsi al nodo precedente"}, { ER_NODESET_CANNOT_ITERATE, "NodeSet non pu\u00f2 collegarsi al nodo precedente"}, { ER_NODESETDTM_CANNOT_INDEX, "NodeSetDTM non pu\u00f2 eseguire l'indicizzazione o il conteggio delle funzioni."}, { ER_NODESET_CANNOT_INDEX, "NodeSet non pu\u00f2 eseguire l'indicizzazione o il conteggio delle funzioni."}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Impossibile chiamare setShouldCacheNodes dopo aver chiamato nextNode."}, { ER_ONLY_ALLOWS, "{0} consente solo {1} argomenti"}, { ER_UNKNOWN_STEP, "Asserzione di programmatore in getNextStepPos: stepType sconosciuto: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Era previsto un percorso relativo dopo il token '/' oppure '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Era previsto un percorso, ma \u00e8 stato rilevato il seguente token\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Era previsto un percorso, ma invece \u00e8 stata trovata la fine dell'espressione XPath."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Era previsto un passo di posizione dopo il token '/' oppure '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Era prevista una prova nodo che corrisponde a NCName:* oppure a QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Era previsto un modello passo, ma \u00e8 stato rilevato '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Era previsto un modello percorso relativo."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPathResult dell''''espressione XPath ''{0}'' ha un XPathResultType di {1} che non pu\u00f2 essere convertito in valore booleano."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPathResult dell''''espressione XPath ''{0}'' ha un XPathResultType di {1} che non pu\u00f2 essere convertito in un nodo singolo. Il metodo getSingleNodeValue si applica solo ai tipi ANY_UNORDERED_NODE_TYPE eFIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "Il metodo getSnapshotLength non pu\u00f2 essere chiamato al XPathResult dell''''espressione XPath ''{0}'' poich\u00e9 il XPathResultType \u00e8 {1}. Questo metodo si applica solo ai tipi UNORDERED_NODE_SNAPSHOT_TYPE e ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "Il metodo iterateNext non pu\u00f2 essere chiamato in XPathResult dell''''espressione XPath ''{0}'' poich\u00e9 XPathResultType \u00e8 {1}. Questo metodo si applica solo ai tipi UNORDERED_NODE_ITERATOR_TYPE e ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Documento modificato da quando \u00e8 stato restituito il risultato. Iteratore non valido."}, { ER_INVALID_XPATH_TYPE, "Argomento di tipo XPath non valido: {0}"}, { ER_EMPTY_XPATH_RESULT, "Oggetto risultato XPath vuoto"}, { ER_INCOMPATIBLE_TYPES, "XPathResult dell''''espressione XPath ''{0}'' ha un XPathResultType di {1} che non pu\u00f2 essere convertito nel XPathResultType specificato di {2}."}, { ER_NULL_RESOLVER, "Impossibile risolvere il prefisso con resolver di prefisso nullo."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPathResult dell''''espressione XPath ''{0}'' ha un XPathResultType di {1} che non pu\u00f2 essere convertito in una stringa."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "Il metodo snapshotItem non pu\u00f2 essere chiamato al XPathResult dell''''espressione XPath ''{0}'' poich\u00e9 XPathResultType \u00e8 {1}. Questo metodo si applica solo ai tipi UNORDERED_NODE_SNAPSHOT_TYPE eORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Il nodo di contesto non appartiene al documento collegato a questo XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Il tipo di nodo di contesto non \u00e8 supportato."}, { ER_XPATH_ERROR, "Errore sconosciuto in XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPathResult dell''''espressione XPath ''{0}'' ha un XPathResultType di {1} che non pu\u00f2 essere convertito in un numero"}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Funzione di estensione: Impossibile richiamare ''{0}'' quando la funzione XMLConstants.FEATURE_SECURE_PROCESSING \u00e8 impostata su true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable per la variabile {0} che restituisce null"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Tipo di ritorno non supportato : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Il tipo origine e/o ritorno non pu\u00f2 essere nullo"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "L''''argomento {0} non pu\u00f2 essere nullo"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel ) non pu\u00f2 essere chiamato con objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) non pu\u00f2 essere chiamato con objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Tentativo di impostare una funzione con un nome nullo: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Tentativo di impostare una funzione sconosciuta \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Tentativo di ottenere una funzione con un nome nullo: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Tentativo di ottenere una funzione sconosciuta \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Tentativo di impostare un XPathFunctionResolver:{0}#setXPathFunctionResolver(null) nullo"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Tentativo di impostare una XPathVariableResolver:{0}#setXPathVariableResolver(null) nulla"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "nome locale nella funzione format-number non ancora gestito."}, { WG_PROPERTY_NOT_SUPPORTED, "Propriet\u00e0 XSL non supportata: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Non eseguire alcune azione per lo namespace {0} nella propriet\u00e0: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException durante il tentativo di accesso alla propriet\u00e0 di sistema XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Sintassi obsoleta: quo(...) non \u00e8 pi\u00f9 definito in XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath richiede un oggetto derivato per implementare nodeTest!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "token funzione non trovato."}, { WG_COULDNOT_FIND_FUNCTION, "Impossibile trovare la funzione: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Impossibile ricavare l''''URL da: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Opzione -E non supportata per il parser DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference fornito per la variabile \u00e8 fuori contesto o senza definizione. Nome = {0}"}, { WG_UNSUPPORTED_ENCODING, "Codifica non supportata: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "it"}, { "help_language", "it"}, { "language", "it"}, { "BAD_CODE", "Il parametro per createMessage fuori limite"}, { "FORMAT_FAILED", "Rilevata eccezione durante la chiamata messageFormat"}, { "version", ">>>>>>> Versione Xalan "}, { "version2", "<<<<<<<"}, { "yes", "s\u00ec"}, { "line", "Riga #"}, { "column", "Colonna #"}, { "xsldone", "XSLProcessor: eseguito"}, { "xpath_option", "opzioni xpath: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select espressione xpath]"}, { "optionMatch", " [-match associa il modello (per le diagnostiche di corrispondenza)]"}, { "optionAnyExpr", "Oppure per un'espressione xpath eseguir\u00e0 un dump diagnostico"}, { "noParsermsg1", "Elaborazione XSL non riuscita."}, { "noParsermsg2", "** Impossibile trovare il parser **"}, { "noParsermsg3", "Controllare il classpath."}, { "noParsermsg4", "Se non si possiede IBM XML Parser per Java, \u00e8 possibile scaricarlo da"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#errore"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Errore: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Avvertenza: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "MODELLO "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("it", "IT")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_zh.java0000644000175000017500000013221610721374033025156 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_zh.java 338104 2005-01-23 01:39:54Z mcnamara $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_zh extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "\u5339\u914d\u6a21\u5f0f\u4e2d\u4e0d\u5141\u8bb8\u6709 current() \u51fd\u6570\uff01" }, { ER_CURRENT_TAKES_NO_ARGS, "current() \u51fd\u6570\u4e0d\u63a5\u53d7\u53c2\u6570\uff01" }, { ER_DOCUMENT_REPLACED, "document() \u51fd\u6570\u5b9e\u73b0\u5df2\u88ab org.apache.xalan.xslt.FuncDocument \u66ff\u6362\uff01"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "\u4e0a\u4e0b\u6587\u6ca1\u6709\u6240\u6709\u8005\u6587\u6863\uff01"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() \u7684\u53c2\u6570\u592a\u591a\u3002"}, { ER_TRANSLATE_TAKES_3_ARGS, "translate() \u51fd\u6570\u6709\u4e09\u4e2a\u53c2\u6570\uff01"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "unparsed-entity-uri \u51fd\u6570\u5e94\u6709\u4e00\u4e2a\u53c2\u6570\uff01"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "\u540d\u79f0\u7a7a\u95f4\u8f74\u5c1a\u672a\u5b9e\u73b0\uff01"}, { ER_UNKNOWN_AXIS, "\u672a\u77e5\u8f74\uff1a{0}"}, { ER_UNKNOWN_MATCH_OPERATION, "\u672a\u77e5\u7684\u5339\u914d\u64cd\u4f5c\uff01"}, { ER_INCORRECT_ARG_LENGTH, "processing-instruction() \u8282\u70b9\u6d4b\u8bd5\u7684\u53c2\u6570\u957f\u5ea6\u4e0d\u6b63\u786e\uff01"}, { ER_CANT_CONVERT_TO_NUMBER, "\u65e0\u6cd5\u5c06 {0} \u8f6c\u6362\u6210\u6570\u5b57"}, { ER_CANT_CONVERT_TO_NODELIST, "\u65e0\u6cd5\u5c06 {0} \u8f6c\u6362\u6210 NodeList\uff01"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "\u65e0\u6cd5\u5c06 {0} \u8f6c\u6362\u6210 NodeSetDTM\uff01"}, { ER_CANT_CONVERT_TO_TYPE, "\u65e0\u6cd5\u5c06 {0} \u8f6c\u6362\u6210 type#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "getMatchScore \u4e2d\u51fa\u73b0\u671f\u671b\u7684\u5339\u914d\u6a21\u5f0f\uff01"}, { ER_COULDNOT_GET_VAR_NAMED, "\u65e0\u6cd5\u83b7\u53d6\u540d\u4e3a {0} \u7684\u53d8\u91cf"}, { ER_UNKNOWN_OPCODE, "\u9519\u8bef\uff01\u672a\u77e5\u64cd\u4f5c\u7801\uff1a{0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "\u989d\u5916\u7684\u975e\u6cd5\u6807\u8bb0\uff1a{0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "\u9519\u8bef\u5f15\u7528\u7684\u6587\u5b57... \u5e94\u8be5\u4e3a\u53cc\u5f15\u53f7\uff01"}, { ER_EXPECTED_SINGLE_QUOTE, "\u9519\u8bef\u5f15\u7528\u7684\u6587\u5b57... \u5e94\u8be5\u4e3a\u5355\u5f15\u53f7\uff01"}, { ER_EMPTY_EXPRESSION, "\u7a7a\u8868\u8fbe\u5f0f\uff01"}, { ER_EXPECTED_BUT_FOUND, "\u5e94\u8be5\u4e3a {0}\uff0c\u4f46\u53d1\u73b0\u7684\u662f\uff1a{1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "\u7a0b\u5e8f\u5458\u7684\u65ad\u8a00\u4e0d\u6b63\u786e\uff01\uff0d {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "19990709 XPath \u8349\u7a3f\u4e2d\uff0cboolean(...) \u53c2\u6570\u4e0d\u518d\u53ef\u9009\u3002"}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "\u5df2\u627e\u5230\u201c,\u201d\uff0c\u4f46\u524d\u9762\u6ca1\u6709\u81ea\u53d8\u91cf\uff01"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "\u5df2\u627e\u5230\u201c,\u201d\uff0c\u4f46\u540e\u9762\u6ca1\u6709\u8ddf\u81ea\u53d8\u91cf\uff01"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "\u201c..[predicate]\u201d\u6216\u201c.[predicate]\u201d\u662f\u975e\u6cd5\u7684\u8bed\u6cd5\u3002\u8bf7\u6539\u4e3a\u4f7f\u7528\u201cself::node()[predicate]\u201d\u3002"}, { ER_ILLEGAL_AXIS_NAME, "\u975e\u6cd5\u7684\u8f74\u540d\u79f0\uff1a{0}"}, { ER_UNKNOWN_NODETYPE, "\u672a\u77e5\u8282\u70b9\u7c7b\u578b\uff1a{0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "\u9700\u8981\u5f15\u7528\u6a21\u5f0f\u6587\u5b57\uff08{0}\uff09\uff01"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} \u65e0\u6cd5\u683c\u5f0f\u5316\u4e3a\u6570\u5b57\uff01"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "\u65e0\u6cd5\u521b\u5efa XML TransformerFactory \u8054\u7cfb\uff1a{0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "\u9519\u8bef\uff01\u627e\u4e0d\u5230 xpath \u9009\u62e9\u8868\u8fbe\u5f0f\uff08-select\uff09\u3002"}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "\u9519\u8bef\uff01\u5728 OP_LOCATIONPATH \u4e4b\u540e\u627e\u4e0d\u5230 ENDOP"}, { ER_ERROR_OCCURED, "\u51fa\u73b0\u9519\u8bef\uff01"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference \u8d4b\u7ed9\u4e86\u4e0a\u4e0b\u6587\u5916\u7684\u53d8\u91cf\u6216\u6ca1\u6709\u5b9a\u4e49\u7684\u53d8\u91cf\uff01\u540d\u79f0 = {0}"}, { ER_AXES_NOT_ALLOWED, "\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u53ea\u5141\u8bb8\u51fa\u73b0 child:: \u548c attribute:: \u8f74\uff01\u8fdd\u53cd\u7684\u8f74 = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() \u7684\u53c2\u6570\u4e2a\u6570\u4e0d\u6b63\u786e\u3002"}, { ER_COUNT_TAKES_1_ARG, "count \u51fd\u6570\u5e94\u8be5\u6709\u4e00\u4e2a\u53c2\u6570\uff01"}, { ER_COULDNOT_FIND_FUNCTION, "\u627e\u4e0d\u5230\u51fd\u6570\uff1a{0}"}, { ER_UNSUPPORTED_ENCODING, "\u4e0d\u53d7\u652f\u6301\u7684\u7f16\u7801\uff1a{0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "getNextSibling \u8fc7\u7a0b\u4e2d\uff0cDTM \u4e2d\u51fa\u73b0\u95ee\u9898...\u6b63\u5728\u5c1d\u8bd5\u6062\u590d"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "\u7a0b\u5e8f\u5458\u9519\u8bef\uff1a\u4e0d\u53ef\u5411 EmptyNodeList \u5199\u5165\u5185\u5bb9\u3002"}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "XPathContext \u4e0d\u652f\u6301 setDOMFactory\uff01"}, { ER_PREFIX_MUST_RESOLVE, "\u524d\u7f00\u5fc5\u987b\u89e3\u6790\u4e3a\u540d\u79f0\u7a7a\u95f4\uff1a{0}"}, { ER_PARSE_NOT_SUPPORTED, "XPathContext \u4e2d\u4e0d\u652f\u6301 parse (InputSource source)\uff01\u65e0\u6cd5\u6253\u5f00 {0}"}, { ER_SAX_API_NOT_HANDLED, "DTM \u4e0d\u5904\u7406 SAX API characters(char ch[]...\uff01"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "DTM \u4e0d\u5904\u7406 ignorableWhitespace(char ch[]...\uff01"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison \u4e0d\u80fd\u5904\u7406\u7c7b\u578b {0} \u7684\u8282\u70b9"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper \u4e0d\u80fd\u5904\u7406\u7c7b\u578b {0} \u7684\u8282\u70b9"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse \u9519\u8bef\uff1aSystemID \uff0d \u7b2c {0} \u884c \uff0d {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse \u9519\u8bef"}, { ER_INVALID_UTF16_SURROGATE, "\u68c0\u6d4b\u5230\u65e0\u6548\u7684 UTF-16 \u8d85\u5927\u5b57\u7b26\u96c6\uff1a{0}\uff1f"}, { ER_OIERROR, "IO \u9519\u8bef"}, { ER_CANNOT_CREATE_URL, "\u65e0\u6cd5\u4e3a {0} \u521b\u5efa URL"}, { ER_XPATH_READOBJECT, "\u5728 XPath.readObject \u4e2d\uff1a{0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "\u627e\u4e0d\u5230\u51fd\u6570\u6807\u8bb0\u3002"}, { ER_CANNOT_DEAL_XPATH_TYPE, "\u65e0\u6cd5\u5904\u7406 XPath \u7c7b\u578b\uff1a{0}"}, { ER_NODESET_NOT_MUTABLE, "\u6b64 NodeSet \u662f\u4e0d\u6613\u53d8\u7684"}, { ER_NODESETDTM_NOT_MUTABLE, "\u6b64 NodeSetDTM \u662f\u4e0d\u6613\u53d8\u7684"}, { ER_VAR_NOT_RESOLVABLE, "\u53d8\u91cf\u4e0d\u53ef\u89e3\u6790\uff1a{0}"}, { ER_NULL_ERROR_HANDLER, "\u9519\u8bef\u5904\u7406\u7a0b\u5e8f\u4e3a\u7a7a"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "\u7a0b\u5e8f\u5458\u65ad\u8a00\uff1a\u672a\u77e5\u64cd\u4f5c\u7801\uff1a{0}"}, { ER_ZERO_OR_ONE, "0 \u6216 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper \u4e0d\u652f\u6301 rtf()"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper \u4e0d\u652f\u6301 asNodeIterator()"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper \u4e0d\u652f\u6301 detach()"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper \u4e0d\u652f\u6301 num()"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper \u4e0d\u652f\u6301 xstr()"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper \u4e0d\u652f\u6301 str()"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "XStringForChars \u4e0d\u652f\u6301 fsb()"}, { ER_COULD_NOT_FIND_VAR, "\u627e\u4e0d\u5230\u540d\u4e3a {0} \u7684\u53d8\u91cf"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars \u65e0\u6cd5\u5c06\u5b57\u7b26\u4e32\u4f5c\u4e3a\u81ea\u53d8\u91cf"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "FastStringBuffer \u81ea\u53d8\u91cf\u4e0d\u80fd\u4e3a\u7a7a"}, { ER_TWO_OR_THREE, "2 \u6216 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "\u5728\u7ed1\u5b9a\u524d\u5df2\u8bbf\u95ee\u53d8\u91cf\uff01"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB \u65e0\u6cd5\u5c06\u5b57\u7b26\u4e32\u4f5c\u4e3a\u81ea\u53d8\u91cf\uff01"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n \uff01\uff01\uff01\uff01\u9519\u8bef\uff01\u6b63\u5728\u5c06\u6b65\u884c\u7a0b\u5e8f\u7684\u6839\u8bbe\u7f6e\u4e3a\u7a7a\uff01\uff01\uff01"}, { ER_NODESETDTM_CANNOT_ITERATE, "\u6b64 NodeSetDTM \u65e0\u6cd5\u8fed\u4ee3\u5230\u5148\u524d\u7684\u8282\u70b9\uff01"}, { ER_NODESET_CANNOT_ITERATE, "\u6b64 NodeSet \u65e0\u6cd5\u8fed\u4ee3\u5230\u5148\u524d\u7684\u8282\u70b9\uff01"}, { ER_NODESETDTM_CANNOT_INDEX, "\u6b64 NodeSetDTM \u65e0\u6cd5\u6267\u884c\u7d22\u5f15\u6216\u8ba1\u6570\u529f\u80fd\uff01"}, { ER_NODESET_CANNOT_INDEX, "\u6b64 NodeSet \u65e0\u6cd5\u6267\u884c\u7d22\u5f15\u6216\u8ba1\u6570\u529f\u80fd\uff01"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "\u8c03\u7528 nextNode \u540e\u4e0d\u80fd\u8c03\u7528 setShouldCacheNode\uff01"}, { ER_ONLY_ALLOWS, "{0} \u4ec5\u5141\u8bb8 {1} \u4e2a\u81ea\u53d8\u91cf"}, { ER_UNKNOWN_STEP, "\u7a0b\u5e8f\u5458\u5728 getNextStepPos \u4e2d\u7684\u65ad\u8a00\uff1a\u672a\u77e5\u7684 stepType\uff1a{0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "\u5728\u201c/\u201d\u6216\u201c//\u201d\u6807\u8bb0\u540e\u5e94\u8be5\u51fa\u73b0\u76f8\u5bf9\u4f4d\u7f6e\u8def\u5f84\u3002"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "\u5e94\u8be5\u51fa\u73b0\u4f4d\u7f6e\u8def\u5f84\uff0c\u4f46\u9047\u5230\u4ee5\u4e0b\u6807\u8bb0\u003a{0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "\u5e94\u8be5\u51fa\u73b0\u4f4d\u7f6e\u8def\u5f84\uff0c\u4f46\u53d1\u73b0\u7684\u5374\u662f XPath \u8868\u8fbe\u5f0f\u7684\u7ed3\u5c3e\u3002"}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "\u201c/\u201d\u6216\u201c//\u201d\u6807\u8bb0\u540e\u5e94\u8be5\u51fa\u73b0\u4f4d\u7f6e\u6b65\u9aa4\u3002"}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "\u5e94\u8be5\u51fa\u73b0\u4e0e NCName:* \u6216 QName \u5339\u914d\u7684\u8282\u70b9\u6d4b\u8bd5\u3002"}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "\u5e94\u8be5\u51fa\u73b0\u6b65\u9aa4\u6a21\u5f0f\uff0c\u4f46\u9047\u5230\u4e86\u201c/\u201d\u3002"}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "\u5e94\u8be5\u51fa\u73b0\u76f8\u5bf9\u8def\u5f84\u6a21\u5f0f\u3002"}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u5177\u6709 XPathResultType {1}\uff0c\u8be5\u7c7b\u578b\u4e0d\u80fd\u8f6c\u6362\u4e3a\u5e03\u5c14\u578b\u3002"}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u5177\u6709 XPathResultType {1}\uff0c\u8be5\u7c7b\u578b\u4e0d\u80fd\u8f6c\u6362\u4e3a\u5355\u4e00\u8282\u70b9\u3002getSingleNodeValue \u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u7c7b\u578b ANY_UNORDERED_NODE_TYPE \u548c FIRST_ORDERED_NODE_TYPE\u3002"}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "\u4e0d\u80fd\u5bf9 XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u8c03\u7528 getSnapshotLength \u65b9\u6cd5\uff0c\u56e0\u4e3a\u8be5\u8868\u8fbe\u5f0f\u7684 XPathResult \u7684 XPathResultType \u4e3a {1}\u3002\u6b64\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u7c7b\u578b UNORDERED_NODE_SNAPSHOT_TYPE \u548c ORDERED_NODE_SNAPSHOT_TYPE\u3002"}, { ER_NON_ITERATOR_TYPE, "\u4e0d\u80fd\u5bf9 XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u8c03\u7528 iterateNext \u65b9\u6cd5\uff0c\u56e0\u4e3a\u8be5\u8868\u8fbe\u5f0f\u7684 XPathResult \u7684 XPathResultType \u4e3a {1}\u3002\u6b64\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u7c7b\u578b UNORDERED_NODE_ITERATOR_TYPE \u548c ORDERED_NODE_ITERATOR_TYPE\u3002"}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "\u8fd4\u56de\u7ed3\u679c\u540e\u6587\u6863\u53d1\u751f\u53d8\u5316\u3002\u8fed\u4ee3\u5668\u65e0\u6548\u3002"}, { ER_INVALID_XPATH_TYPE, "\u65e0\u6548\u7684 XPath \u7c7b\u578b\u81ea\u53d8\u91cf\uff1a{0}"}, { ER_EMPTY_XPATH_RESULT, "\u7a7a\u7684 XPath \u7ed3\u679c\u5bf9\u8c61"}, { ER_INCOMPATIBLE_TYPES, "XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u5177\u6709 XPathResultType {1}\uff0c\u8be5\u7c7b\u578b\u4e0d\u80fd\u5f3a\u5236\u8f6c\u6362\u4e3a\u6307\u5b9a\u7684 XPathResultType {2}\u3002"}, { ER_NULL_RESOLVER, "\u65e0\u6cd5\u4f7f\u7528\u7a7a\u7684\u524d\u7f00\u89e3\u6790\u5668\u89e3\u6790\u524d\u7f00\u3002"}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u5177\u6709 XPathResultType {1}\uff0c\u8be5\u7c7b\u578b\u4e0d\u80fd\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u3002"}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "\u4e0d\u80fd\u5bf9 XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u8c03\u7528\u65b9\u6cd5 snapshotItem\uff0c\u56e0\u4e3a\u8be5\u8868\u8fbe\u5f0f\u7684 XPathResult \u7684 XPathResultType \u4e3a {1}\u3002\u6b64\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u7c7b\u578b UNORDERED_NODE_SNAPSHOT_TYPE \u548c ORDERED_NODE_SNAPSHOT_TYPE\u3002"}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "\u4e0a\u4e0b\u6587\u8282\u70b9\u4e0d\u5c5e\u4e8e\u7ed1\u5b9a\u5230\u6b64 XPathEvaluator \u7684\u6587\u6863\u3002"}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "\u4e0d\u652f\u6301\u4e0a\u4e0b\u6587\u8282\u70b9\u7c7b\u578b\u3002"}, { ER_XPATH_ERROR, "XPath \u4e2d\u51fa\u73b0\u672a\u77e5\u9519\u8bef"}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684 XPathResult \u5177\u6709 XPathResultType {1}\uff0c\u8be5\u7c7b\u578b\u4e0d\u80fd\u8f6c\u6362\u4e3a\u6570\u5b57\u3002"}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "\u6269\u5c55\u51fd\u6570\uff1a\u5f53 XMLConstants.FEATURE_SECURE_PROCESSING \u529f\u80fd\u8bbe\u7f6e\u4e3a true \u65f6\uff0c\u65e0\u6cd5\u8c03\u7528\u201c{0}\u201d\u3002"}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "\u53d8\u91cf {0} \u7684 resolveVariable \u6b63\u5728\u8fd4\u56de\u7a7a\u503c"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "\u4e0d\u53d7\u652f\u6301\u7684\u8fd4\u56de\u7c7b\u578b\uff1a{0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "\u6e90\u548c\uff0f\u6216\u8fd4\u56de\u7c7b\u578b\u4e0d\u80fd\u4e3a\u7a7a"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "{0} \u81ea\u53d8\u91cf\u4e0d\u80fd\u4e3a\u7a7a"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel ) \u4e0d\u80fd\u88ab\u8c03\u7528\uff08\u5982\u679c objectModel == null\uff09"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) \u4e0d\u80fd\u88ab\u8c03\u7528\uff08\u5982\u679c objectModel == \"\"\uff09"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "\u6b63\u5728\u5c1d\u8bd5\u8bbe\u7f6e\u540d\u79f0\u4e3a\u7a7a\u7684\u7279\u5f81\uff1a{0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "\u6b63\u5728\u5c1d\u8bd5\u8bbe\u7f6e\u672a\u77e5\u7279\u5f81\u201c{0}\u201d\uff1a{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "\u6b63\u5728\u5c1d\u8bd5\u83b7\u53d6\u540d\u79f0\u4e3a\u7a7a\u7684\u7279\u5f81\uff1a{0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "\u6b63\u5728\u5c1d\u8bd5\u83b7\u53d6\u672a\u77e5\u7279\u5f81\u201c{0}\u201d\uff1a{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "\u6b63\u5728\u8bd5\u56fe\u8bbe\u7f6e\u7a7a\u7684 XPathFunctionResolver\uff1a{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "\u6b63\u5728\u8bd5\u56fe\u8bbe\u7f6e\u7a7a\u7684 XPathVariableResolver\uff1a{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "\u5728\u672a\u5904\u7406\u8fc7\u7684 format-number \u51fd\u6570\u4e2d\u51fa\u73b0\u8bed\u8a00\u73af\u5883\u540d\uff01"}, { WG_PROPERTY_NOT_SUPPORTED, "\u4e0d\u652f\u6301 XSL \u5c5e\u6027\uff1a{0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "\u5f53\u524d\u4e0d\u8981\u5728\u5c5e\u6027 {1} \u4e2d\u5bf9\u540d\u79f0\u7a7a\u95f4 {0} \u8fdb\u884c\u4efb\u4f55\u5904\u7406"}, { WG_SECURITY_EXCEPTION, "\u5728\u8bd5\u56fe\u8bbf\u95ee XSL \u7cfb\u7edf\u5c5e\u6027 {0} \u65f6\u53d1\u751f SecurityException"}, { WG_QUO_NO_LONGER_DEFINED, "XPath \u4e2d\u4e0d\u518d\u5b9a\u4e49\u65e7\u8bed\u6cd5\uff1aquo(...)\u3002"}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath \u9700\u8981\u4e00\u4e2a\u6d3e\u751f\u7684\u5bf9\u8c61\u4ee5\u5b9e\u73b0 nodeTest\uff01"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "\u627e\u4e0d\u5230\u51fd\u6570\u6807\u8bb0\u3002"}, { WG_COULDNOT_FIND_FUNCTION, "\u627e\u4e0d\u5230\u51fd\u6570\uff1a{0}"}, { WG_CANNOT_MAKE_URL_FROM, "\u65e0\u6cd5\u4ece {0} \u751f\u6210 URL"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "DTM \u89e3\u6790\u5668\u4e0d\u652f\u6301 -E \u9009\u9879"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference \u8d4b\u7ed9\u4e86\u4e0a\u4e0b\u6587\u5916\u7684\u53d8\u91cf\u6216\u6ca1\u6709\u5b9a\u4e49\u7684\u53d8\u91cf\uff01\u540d\u79f0 = {0}"}, { WG_UNSUPPORTED_ENCODING, "\u4e0d\u53d7\u652f\u6301\u7684\u7f16\u7801\uff1a{0}"}, // Other miscellaneous text used inside the code... { "ui_language", "zh"}, { "help_language", "zh"}, { "language", "zh"}, { "BAD_CODE", "createMessage \u7684\u53c2\u6570\u8d85\u51fa\u8303\u56f4"}, { "FORMAT_FAILED", "\u5728 messageFormat \u8c03\u7528\u8fc7\u7a0b\u4e2d\u629b\u51fa\u4e86\u5f02\u5e38"}, { "version", ">>>>>>> Xalan \u7248\u672c"}, { "version2", "<<<<<<<"}, { "yes", "\u662f"}, { "line", "\u884c\u53f7"}, { "column", "\u5217\u53f7"}, { "xsldone", "XSLProcessor\uff1a\u5b8c\u6210"}, { "xpath_option", "xpath \u9009\u9879\uff1a"}, { "optionIN", "[-in inputXMLURL]"}, { "optionSelect", "[-select xpath \u8868\u8fbe\u5f0f]"}, { "optionMatch", "[-match \u5339\u914d\u6a21\u5f0f\uff08\u7528\u4e8e\u5339\u914d\u8bca\u65ad\uff09]"}, { "optionAnyExpr", "\u6216\u8005\u4ec5\u4e00\u4e2a xpath \u8868\u8fbe\u5f0f\u5c31\u5c06\u5b8c\u6210\u4e00\u4e2a\u8bca\u65ad\u8f6c\u50a8"}, { "noParsermsg1", "XSL \u5904\u7406\u4e0d\u6210\u529f\u3002"}, { "noParsermsg2", "** \u627e\u4e0d\u5230\u89e3\u6790\u5668 **"}, { "noParsermsg3", "\u8bf7\u68c0\u67e5\u60a8\u7684\u7c7b\u8def\u5f84\u3002"}, { "noParsermsg4", "\u5982\u679c\u6ca1\u6709 IBM \u7684 XML Parser for Java\uff0c\u60a8\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u4f4d\u7f6e\u4e0b\u8f7d\u5b83\uff1a"}, { "noParsermsg5", "IBM \u7684 AlphaWorks\uff1ahttp://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#\u9519\u8bef"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "\u9519\u8bef\uff1a"; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "\u8b66\u544a\uff1a"; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL"; /** Field XML_HEADER */ public static final String XML_HEADER = "XML"; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN"; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("zh", "CN")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_es.java0000644000175000017500000012450510721374033025146 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_es.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_es extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "No est\u00e1 permitida la funci\u00f3n current() en un patr\u00f3n de coincidencia." }, { ER_CURRENT_TAKES_NO_ARGS, "La funci\u00f3n current() no acepta argumentos." }, { ER_DOCUMENT_REPLACED, "La implementaci\u00f3n de la funci\u00f3n document() ha sido sustituida por org.apache.xalan.xslt.FuncDocument."}, { ER_CONTEXT_HAS_NO_OWNERDOC, "El contexto no tiene un documento propietario."}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() tiene demasiados argumentos."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() tiene demasiados argumentos."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() tiene demasiados argumentos."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() tiene demasiados argumentos."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() tiene demasiados argumentos."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() tiene demasiados argumentos."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() tiene demasiados argumentos."}, { ER_TRANSLATE_TAKES_3_ARGS, "La funci\u00f3n translate() utiliza tres argumentos."}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "La funci\u00f3n unparsed-entity-uri deber\u00eda utilizar un solo argumento."}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "Eje de espacio de nombres a\u00fan no implementado."}, { ER_UNKNOWN_AXIS, "Eje desconocido: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "Operaci\u00f3n de coincidencia desconocida."}, { ER_INCORRECT_ARG_LENGTH, "La longitud del argumento de prueba del nodo processing-instruction() es incorrecta."}, { ER_CANT_CONVERT_TO_NUMBER, "No se puede convertir {0} a un n\u00famero"}, { ER_CANT_CONVERT_TO_NODELIST, "No se puede convertir {0} a NodeList."}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "No se puede convertir {0} a NodeSetDTM."}, { ER_CANT_CONVERT_TO_TYPE, "No se puede convertir {0} a un tipo {1}"}, { ER_EXPECTED_MATCH_PATTERN, "Se esperaba un patr\u00f3n de coincidencia en getMatchScore."}, { ER_COULDNOT_GET_VAR_NAMED, "No se ha podido obtener la variable de nombre {0}"}, { ER_UNKNOWN_OPCODE, "ERROR. C\u00f3digo de operaci\u00f3n desconocido: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Se\u00f1ales extra no permitidas: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Literal sin entrecomillar... Se esperaban comillas dobles."}, { ER_EXPECTED_SINGLE_QUOTE, "Literal sin entrecomillar... Se esperaban comillas simples."}, { ER_EMPTY_EXPRESSION, "Expresi\u00f3n vac\u00eda."}, { ER_EXPECTED_BUT_FOUND, "Se esperaba {0}, pero se ha encontrado: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "La aserci\u00f3n del programador es incorrecta. - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "El argumento boolean(...) ya no es opcional con el borrador de XPath 19990709."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Se ha encontrado ',' pero sin argumento precedente."}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Se ha encontrado ',' pero sin argumento siguiente."}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' o '.[predicate]' es una sintaxis no permitida. Utilice 'self::node()[predicate]' en su lugar."}, { ER_ILLEGAL_AXIS_NAME, "Nombre de eje no permitido: {0}"}, { ER_UNKNOWN_NODETYPE, "nodetype desconocido: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "El literal del patr\u00f3n ({0}) tiene que estar entrecomillado."}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "No se ha podido formatear {0} como un n\u00famero."}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "No se ha podido crear Liaison TransformerFactory XML: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Error. No se ha encontrado la expresi\u00f3n de selecci\u00f3n (-select) de xpath."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "ERROR. No se ha podido encontrar ENDOP despu\u00e9s de OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Se ha producido un error."}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference dada para la variable est\u00e1 fuera de contexto o sin definici\u00f3n. Nombre = {0}"}, { ER_AXES_NOT_ALLOWED, "S\u00f3lo se permiten los ejes child:: y attribute:: en patrones de coincidencia. Ejes incorrectos = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() tiene un n\u00famero incorrecto de argumentos."}, { ER_COUNT_TAKES_1_ARG, "La funci\u00f3n count deber\u00eda utilizar un solo argumento."}, { ER_COULDNOT_FIND_FUNCTION, "No se ha podido encontrar la funci\u00f3n: {0}"}, { ER_UNSUPPORTED_ENCODING, "Codificaci\u00f3n no soportada: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Se ha producido un problema en DTM en getNextSibling... Intentando recuperar"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Error del programador: No se puede escribir enEmptyNodeList."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory no soportada por XPathContext."}, { ER_PREFIX_MUST_RESOLVE, "El prefijo debe resolverse como un espacio de nombres: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource source) no soportada en XPathContext. No se puede abrir {0}"}, { ER_SAX_API_NOT_HANDLED, "API SAX characters(char ch[]... no manejada por DTM."}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... no manejada por DTM."}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison no puede manejar nodos de tipo {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper no puede manejar nodos de tipo {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Error DOM2Helper.parse: SystemID - {0} l\u00ednea - {1}"}, { ER_XERCES_PARSE_ERROR, "Error DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "\u00bfSe ha detectado un sustituto UTF-16 no v\u00e1lido: {0}?"}, { ER_OIERROR, "Error de ES"}, { ER_CANNOT_CREATE_URL, "No se puede crear url para: {0}"}, { ER_XPATH_READOBJECT, "En XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "Se\u00f1al de funci\u00f3n no encontrada."}, { ER_CANNOT_DEAL_XPATH_TYPE, "No se puede tratar con el tipo XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Este NodeSet no es mutable"}, { ER_NODESETDTM_NOT_MUTABLE, "Este NodeSetDTM no es mutable"}, { ER_VAR_NOT_RESOLVABLE, "Variable no resoluble: {0}"}, { ER_NULL_ERROR_HANDLER, "Manejador de error nulo"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Aserci\u00f3n del programador: opcode desconocido: {0} "}, { ER_ZERO_OR_ONE, "0 \u00f3 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() no soportada por XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() no soportada por XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() no soportada por XRTreeFragSelectWrapper "}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() no soportada por XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() no soportada por XRTreeFragSelectWrapper "}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() no soportada por XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() no soportada para XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "No se ha podido encontrar la variable con el nombre {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars no puede utilizar una serie para un argumento"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "El argumento FastStringBuffer no puede ser nulo"}, { ER_TWO_OR_THREE, "2 \u00f3 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Se ha accedido a la variable antes de enlazarla."}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB no puede utilizar una serie para un argumento."}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n Error. Estableciendo ra\u00edz de walker como nulo."}, { ER_NODESETDTM_CANNOT_ITERATE, "Este NodeSetDTM no puede iterar a un nodo previo."}, { ER_NODESET_CANNOT_ITERATE, "Este NodeSet no puede iterar a un nodo previo."}, { ER_NODESETDTM_CANNOT_INDEX, "Este NodeSetDTM no puede realizar funciones de indexaci\u00f3n o recuento."}, { ER_NODESET_CANNOT_INDEX, "Este NodeSet no puede realizar funciones de indexaci\u00f3n o recuento."}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "No se puede llamar a setShouldCacheNodes despu\u00e9s de llamar a nextNode."}, { ER_ONLY_ALLOWS, "{0} s\u00f3lo admite {1} argumentos"}, { ER_UNKNOWN_STEP, "Aserci\u00f3n del programador en getNextStepPos: stepType desconocido: {0} "}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Se esperaba una v\u00eda de acceso de ubicaci\u00f3n relativa despu\u00e9s de la se\u00f1al '/' o '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Se esperaba una v\u00eda de acceso de ubicaci\u00f3n, pero se ha encontrado la se\u00f1al siguiente\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Se esperaba una v\u00eda de acceso de ubicaci\u00f3n, pero en su lugar se ha encontrado el final de la expresi\u00f3n XPath."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Se esperaba un paso de ubicaci\u00f3n despu\u00e9s de la se\u00f1al '/' o '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Se esperaba una prueba de nodo coincidente con NCName:* o QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Se esperaba un patr\u00f3n de paso, pero se ha encontrado '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Se esperaba un patr\u00f3n de v\u00eda de acceso relativa."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPathResult de la expresi\u00f3n XPath ''{0}'' tiene un XPathResultType de {1} que no se puede convertir a booleano."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPathResult de la expresi\u00f3n XPath ''{0}'' tiene un XPathResultType de {1} que no se puede convertir a un solo nodo. El m\u00e9todo getSingleNodeValue se aplica s\u00f3lo a tipos ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "No se puede llamar al m\u00e9todo getSnapshotLength en XPathResult de la expresi\u00f3n XPath ''{0}'' porque su XPathResultType es {1}. Este m\u00e9todo se aplica s\u00f3lo a los tipos UNORDERED_NODE_SNAPSHOT_TYPE y ORDERED_NODE_SNAPSHOT_TYPE. "}, { ER_NON_ITERATOR_TYPE, "No se puede llamar al m\u00e9todo iterateNext en XPathResult de la expresi\u00f3n XPath ''{0}'' porque su XPathResultType es {1}. Este m\u00e9todo se aplica s\u00f3lo a los tipos UNORDERED_NODE_ITERATOR_TYPE y ORDERED_NODE_ITERATOR_TYPE. "}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "El documento ha mutado desde que se devolvi\u00f3 el resultado. El iterador no es v\u00e1lido."}, { ER_INVALID_XPATH_TYPE, "Argumento de tipo XPath no v\u00e1lido: {0}"}, { ER_EMPTY_XPATH_RESULT, "Objeto de resultado XPath vac\u00edo"}, { ER_INCOMPATIBLE_TYPES, "XPathResult de la expresi\u00f3n XPath ''{0}'' tiene un XPathResultType de {1} que no se puede forzar al XPathResultType especificado de {2}"}, { ER_NULL_RESOLVER, "Imposible resolver prefijo con un solucionador de prefijo nulo."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPathResult de la expresi\u00f3n XPath ''{0}'' tiene un XPathResultType de {1} que no se puede convertir a una serie."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "No se puede llamar al m\u00e9todo snapshotItem en XPathResult de la expresi\u00f3n XPath ''{0}'' porque su XPathResultType es {1}. Este m\u00e9todo se aplica s\u00f3lo a los tipos UNORDERED_NODE_SNAPSHOT_TYPE y ORDERED_NODE_SNAPSHOT_TYPE. "}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "El nodo de contexto no pertenece al documento que est\u00e1 enlazado a este XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "El tipo de nodo de contexto no est\u00e1 soportado."}, { ER_XPATH_ERROR, "Error desconocido en XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPathResult de la expresi\u00f3n XPath ''{0}'' tiene un XPathResultType de {1} que no se puede convertir a un n\u00famero."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "La funci\u00f3n de extensi\u00f3n: ''{0}'' no se puede invocar si la caracter\u00edstica XMLConstants.FEATURE_SECURE_PROCESSING est\u00e1 establecida en true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable para la variable {0} devuelve null"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Tipo devuelto no soportado : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "El tipo de origen y/o devuelto no puede ser null"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "El argumento {0} no puede ser null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "No se puede llamar a {0}#isObjectModelSupported( String objectModel ) con objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "No se puede llamar a {0}#isObjectModelSupported( String objectModel ) con objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Se ha intentado establecer una caracter\u00edstica con un nombre null: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Se ha intentado establecer la caracter\u00edstica \"{0}\":{1}#setFeature({0},{2}) desconocida"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Se ha intentado obtener una caracter\u00edstica con un nombre null: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Se ha intentado obtener la caracter\u00edstica desconocida \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Se ha intentado establecer un XPathFunctionResolver:{0}#setXPathFunctionResolver(null) null"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Se ha intentado establecer un XPathVariableResolver:{0}#setXPathVariableResolver(null) null"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "No se maneja a\u00fan el nombre de entorno local en la funci\u00f3n format-number."}, { WG_PROPERTY_NOT_SUPPORTED, "Propiedad XSL no soportada: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "No hacer nada actualmente con el espacio de nombres {0} en la propiedad: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException al intentar acceder a la propiedad del sistema XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "La antigua sintaxis: quo(...) ya no est\u00e1 definida en XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath necesita un objeto derivado para implementar nodeTest."}, { WG_FUNCTION_TOKEN_NOT_FOUND, "Se\u00f1al de funci\u00f3n no encontrada."}, { WG_COULDNOT_FIND_FUNCTION, "No se ha podido encontrar la funci\u00f3n: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "No se puede crear URL desde: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Opci\u00f3n -E no soportada para analizador DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference dada para la variable est\u00e1 fuera de contexto o sin definici\u00f3n Nombre = {0}"}, { WG_UNSUPPORTED_ENCODING, "Codificaci\u00f3n no soportada: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "es"}, { "help_language", "es"}, { "language", "es"}, { "BAD_CODE", "El par\u00e1metro para createMessage estaba fuera de los l\u00edmites"}, { "FORMAT_FAILED", "Se ha generado una excepci\u00f3n durante la llamada messageFormat"}, { "version", ">>>>>>> Xalan versi\u00f3n "}, { "version2", "<<<<<<<"}, { "yes", "s\u00ed"}, { "line", "L\u00ednea n\u00fam."}, { "column", "Columna n\u00fam."}, { "xsldone", "XSLProcessor: terminado"}, { "xpath_option", "Opciones de xpath: "}, { "optionIN", "[-in URLXMLEntrada]"}, { "optionSelect", "[-select expresi\u00f3n xpath]"}, { "optionMatch", "[-match patr\u00f3n de coincidencia (para diagn\u00f3sticos de coincidencia)]"}, { "optionAnyExpr", "O simplemente una expresi\u00f3n xpath realizar\u00e1 un vuelco de diagn\u00f3stico"}, { "noParsermsg1", "El proceso XSL no ha sido satisfactorio."}, { "noParsermsg2", "** No se ha podido encontrar el analizador **"}, { "noParsermsg3", "Compruebe la classpath."}, { "noParsermsg4", "Si no dispone del analizador XML para Java de IBM, puede descargarlo de"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Error: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Aviso: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("es", "ES")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_sk.java0000644000175000017500000012630510721374032025153 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_sk.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_sk extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "Funkcia current () nie je povolen\u00e1 v porovn\u00e1vacom vzore!" }, { ER_CURRENT_TAKES_NO_ARGS, "Funkcia current () nepr\u00edma argumenty!" }, { ER_DOCUMENT_REPLACED, "Implement\u00e1cia funkcie document() bola nahraden\u00e1 org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "kontext nem\u00e1 dokument vlastn\u00edka!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() m\u00e1 prive\u013ea argumentov."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() m\u00e1 prive\u013ea argumentov."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() m\u00e1 prive\u013ea argumentov."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() m\u00e1 prive\u013ea argumentov."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() m\u00e1 prive\u013ea argumentov."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() m\u00e1 prive\u013ea argumentov"}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() m\u00e1 prive\u013ea argumentov"}, { ER_TRANSLATE_TAKES_3_ARGS, "Funkcia translate() pr\u00edma tri argumenty!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Funkcia unparsed-entity-uri by mala prija\u0165 jeden argument!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "osi n\u00e1zvov\u00fdch priestorov e\u0161te nie s\u00fa implementovan\u00e9!"}, { ER_UNKNOWN_AXIS, "nezn\u00e1ma os: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "nezn\u00e1ma porovn\u00e1vacia oper\u00e1cia!"}, { ER_INCORRECT_ARG_LENGTH, "Testovanie uzla arg length of processing-instruction() je nespr\u00e1vne!"}, { ER_CANT_CONVERT_TO_NUMBER, "Nie je mo\u017en\u00e9 konvertova\u0165 {0} na \u010d\u00edslo"}, { ER_CANT_CONVERT_TO_NODELIST, "Nie je mo\u017en\u00e9 konvertova\u0165 {0} na NodeList!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Nie je mo\u017en\u00e9 konvertova\u0165 {0} na NodeSetDTM!"}, { ER_CANT_CONVERT_TO_TYPE, "Nie je mo\u017en\u00e1 konverzia {0} na typ#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "O\u010dak\u00e1van\u00fd porovn\u00e1vac\u00ed vzor v getMatchScore!"}, { ER_COULDNOT_GET_VAR_NAMED, "Nie je mo\u017en\u00e9 dosiahnu\u0165 premenn\u00fa s n\u00e1zvom {0}"}, { ER_UNKNOWN_OPCODE, "CHYBA! Nezn\u00e1my k\u00f3d op: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Nadbyto\u010dn\u00e9 neplatn\u00e9 symboly: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Nespr\u00e1vny liter\u00e1l... o\u010dak\u00e1van\u00e1 dvojit\u00e1 cit\u00e1cia!"}, { ER_EXPECTED_SINGLE_QUOTE, "Nespr\u00e1vny liter\u00e1l... o\u010dak\u00e1van\u00e1 jedin\u00e1 cit\u00e1cia!"}, { ER_EMPTY_EXPRESSION, "Pr\u00e1zdny v\u00fdraz!"}, { ER_EXPECTED_BUT_FOUND, "O\u010dak\u00e1vala sa {0}, ale bola n\u00e1jden\u00e1: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Program\u00e1torsk\u00e9 vyjadrenie je nespr\u00e1vne! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "argument boolean(...) u\u017e nie je volite\u013en\u00fd s konceptom 19990709 XPath."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "N\u00e1jdene ',' ale \u017eiaden predch\u00e1dzaj\u00faci argument!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "N\u00e1jden\u00e9 ',' ale \u017eiaden nasleduj\u00faci argument!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' alebo '.[predicate]' je nespr\u00e1vna syntax. Pou\u017eite namiesto toho 'self::node()[predicate]'."}, { ER_ILLEGAL_AXIS_NAME, "Neplatn\u00fd n\u00e1zov osi: {0}"}, { ER_UNKNOWN_NODETYPE, "Nezn\u00e1my typ uzla: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Vzorov\u00fd liter\u00e1l ({0}) potrebuje by\u0165 citovan\u00fd!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} nem\u00f4\u017ee by\u0165 form\u00e1tovan\u00e9 na \u010d\u00edslo!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Nebolo mo\u017en\u00e9 vytvori\u0165 vz\u0165ah XML TransformerFactory: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Chyba! Nena\u0161lo sa vyjadrenie v\u00fdberu xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "CHYBA! Nebolo mo\u017en\u00e9 n\u00e1js\u0165 ENDOP po OP_LOCATIONPATH"}, { ER_ERROR_OCCURED, "Vyskytla sa chyba!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference bol dan\u00fd pre premenn\u00fa mimo kontext, alebo bez defin\u00edcie! N\u00e1zov = {0}"}, { ER_AXES_NOT_ALLOWED, "Len potomok:: atrib\u00fat:: osi s\u00fa povolen\u00e9 v zhodn\u00fdch vzoroch! Chybn\u00e9 osi = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() m\u00e1 nespr\u00e1vny po\u010det argumentov."}, { ER_COUNT_TAKES_1_ARG, "Funkcia count by mala prija\u0165 jeden argument!"}, { ER_COULDNOT_FIND_FUNCTION, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 funkciu: {0}"}, { ER_UNSUPPORTED_ENCODING, "Nepodporovan\u00e9 k\u00f3dovanie: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Vyskytol sa probl\u00e9m v DTM v getNextSibling... pokus o obnovu"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Chyba program\u00e1tora: EmptyNodeList nebolo mo\u017en\u00e9 zap\u00edsa\u0165."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory nie je podporovan\u00e9 XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "Predpona sa mus\u00ed rozl\u00ed\u0161i\u0165 do n\u00e1zvov\u00e9ho priestoru: {0}"}, { ER_PARSE_NOT_SUPPORTED, "anal\u00fdza (InputSource source) nie je podporovan\u00e1 XPathContext! Nie je mo\u017en\u00e9 otvori\u0165 {0}"}, { ER_SAX_API_NOT_HANDLED, "SAX API znaky(char ch[]... nie s\u00fa spracovan\u00e9 DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... nie s\u00fa spracovan\u00e9 DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison nem\u00f4\u017ee spracova\u0165 uzly typu {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper nem\u00f4\u017ee spracova\u0165 uzly typu {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Chyba DOM2Helper.parse: SystemID - {0} riadok - {1}"}, { ER_XERCES_PARSE_ERROR, "chyba DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Bolo zisten\u00e9 neplatn\u00e9 nahradenie UTF-16: {0} ?"}, { ER_OIERROR, "chyba IO"}, { ER_CANNOT_CREATE_URL, "Nie je mo\u017en\u00e9 vytvori\u0165 url pre: {0}"}, { ER_XPATH_READOBJECT, "V XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "nebol n\u00e1jden\u00fd symbol funkcie."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Nie je mo\u017en\u00e9 pracova\u0165 s typom XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Tento NodeSet je nest\u00e1ly"}, { ER_NODESETDTM_NOT_MUTABLE, "Tento NodeSetDTM nie je nest\u00e1ly"}, { ER_VAR_NOT_RESOLVABLE, "Premenn\u00fa nie je mo\u017en\u00e9 rozl\u00ed\u0161i\u0165: {0}"}, { ER_NULL_ERROR_HANDLER, "Nulov\u00fd chybov\u00fd manipula\u010dn\u00fd program"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Tvrdenie program\u00e1tora: nezn\u00e1my opcode: {0}"}, { ER_ZERO_OR_ONE, "0, alebo 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() nie je podporovan\u00fd XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() nie je podporovan\u00fd XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper nepodporuje detach()"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper nepodporuje num()"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper nepodporuje xstr()"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "XRTreeFragSelectWrapper nepodporuje str()"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() nie je podporovan\u00fd pre XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 premenn\u00fa s n\u00e1zvom {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars nem\u00f4\u017ee ako argument prija\u0165 re\u0165azec"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "Argument FastStringBuffer nem\u00f4\u017ee by\u0165 nulov\u00fd"}, { ER_TWO_OR_THREE, "2, alebo 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Premenn\u00e1 bola z\u00edskan\u00e1 sk\u00f4r, ne\u017e bola viazan\u00e1!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB nem\u00f4\u017ee pova\u017eova\u0165 re\u0165azec za argument!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Chyba! Nastavenie root of a walker na null!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Tento NodeSetDTM sa nem\u00f4\u017ee iterova\u0165 na predch\u00e1dzaj\u00faci uzol!"}, { ER_NODESET_CANNOT_ITERATE, "Tento NodeSet sa nem\u00f4\u017ee iterova\u0165 na predch\u00e1dzaj\u00faci uzol!"}, { ER_NODESETDTM_CANNOT_INDEX, "Tento NodeSetDTM nem\u00f4\u017ee vykon\u00e1va\u0165 funkcie indexovania alebo po\u010d\u00edtania!"}, { ER_NODESET_CANNOT_INDEX, "Tento NodeSet nem\u00f4\u017ee vykon\u00e1va\u0165 funkcie indexovania alebo po\u010d\u00edtania!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Nie je mo\u017en\u00e9 vola\u0165 setShouldCacheNodes po volan\u00ed nextNode!"}, { ER_ONLY_ALLOWS, "{0} povo\u013eulje iba {1} argumentov"}, { ER_UNKNOWN_STEP, "Tvrdenie program\u00e1tora v getNextStepPos: nezn\u00e1my stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Po symbole '/' alebo '//' sa o\u010dak\u00e1vala cesta relat\u00edvneho umiestnenia."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "O\u010dak\u00e1vala sa cesta umiestnenia, ale na\u0161iel sa tento symbol \u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Bola o\u010dak\u00e1van\u00e1 cesta umiestnenia, ale namiesto nej bol n\u00e1jden\u00fd koniec v\u00fdrazu XPath."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Po symbole '/' alebo '//' sa o\u010dak\u00e1val krok umiestnenia."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "O\u010dak\u00e1val sa test uzlov, ktor\u00fd sa zhoduje bu\u010f s NCName:* alebo s QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "O\u010dak\u00e1val sa vzor kroku, ale bol zaznamenan\u00fd '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "O\u010dak\u00e1val sa vzor relat\u00edvnej cesty."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPathResult z XPath v\u00fdrazu ''{0}'' m\u00e1 XPathResultType {1}, ktor\u00fd sa ned\u00e1 skonvertova\u0165 do boolovsk\u00e9ho v\u00fdrazu."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPathResult z XPath v\u00fdrazu ''{0}'' m\u00e1 XPathResultType {1}, ktor\u00fd sa ned\u00e1 skonvertova\u0165 do jedn\u00e9ho uzla. Met\u00f3da getSingleNodeValue sa pou\u017e\u00edva iba pre typy ANY_UNORDERED_NODE_TYPE a FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "Met\u00f3da getSnapshotLength sa nem\u00f4\u017ee vola\u0165 na XPathResult z XPath v\u00fdrazu ''{0}'', preto\u017ee jeho XPathResultType je {1}. T\u00e1to met\u00f3da sa pou\u017eije iba pre typy UNORDERED_NODE_SNAPSHOT_TYPE a ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "Met\u00f3da iterateNext sa nem\u00f4\u017ee vola\u0165 na XPathResult z XPath v\u00fdrazu ''{0}'', preto\u017ee jej XPathResultType je {1}. T\u00e1to met\u00f3da sa pou\u017eije iba pre typy UNORDERED_NODE_ITERATOR_TYPE a ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Dokument sa od vr\u00e1tenia v\u00fdsledku zmenil. Iter\u00e1tor je neplatn\u00fd."}, { ER_INVALID_XPATH_TYPE, "Neplatn\u00fd argument typu XPath: {0}"}, { ER_EMPTY_XPATH_RESULT, "Pr\u00e1zdny objekt v\u00fdsledku XPath"}, { ER_INCOMPATIBLE_TYPES, "XPathResult z XPath v\u00fdrazu ''{0}'' m\u00e1 XPathResultType {1}, ktor\u00fd sa ned\u00e1 stla\u010di\u0165 do \u0161pecifikovan\u00e9ho XPathResultType {2}."}, { ER_NULL_RESOLVER, "Nie je mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 predponu s rozli\u0161ova\u010dom nulovej predpony."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPathResult z XPath v\u00fdrazu ''{0}'' m\u00e1 XPathResultType {1}, ktor\u00fd sa ned\u00e1 skonvertova\u0165 na re\u0165azec."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "Met\u00f3da snapshotItem sa nem\u00f4\u017ee vola\u0165 na XPathResult z XPath v\u00fdrazu ''{0}'', preto\u017ee jej XPathResultType je {1}. T\u00e1to met\u00f3da sa pou\u017eije iba pre typy UNORDERED_NODE_SNAPSHOT_TYPE a ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Uzol kontextu nepatr\u00ed k dokumentu, ktor\u00fd je viazan\u00fd na tento XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Typ uzla kontextu nie je podporovan\u00fd."}, { ER_XPATH_ERROR, "Nezn\u00e1ma chyba v XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPathResult z XPath v\u00fdrazu ''{0}'' m\u00e1 XPathResultType {1}, ktor\u00fd sa ned\u00e1 skonvertova\u0165 na \u010d\u00edslo"}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Funkcia roz\u0161\u00edrenia: ''{0}'' sa ned\u00e1 vyvola\u0165, ke\u010f je funkcia XMLConstants.FEATURE_SECURE_PROCESSING nastaven\u00e1 na hodnotu true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable pre premenn\u00fa {0} vracia hodnotu null"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Nepodporovan\u00fd typ n\u00e1vratu : {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Zdroj a/alebo typ n\u00e1vratu nem\u00f4\u017ee ma\u0165 hodnotu null"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "Argument {0} nem\u00f4\u017ee ma\u0165 hodnotu null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( Re\u0165azec objectModel ) nem\u00f4\u017ee by\u0165 volan\u00fd s objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( Re\u0165azec objectModel ) nem\u00f4\u017ee by\u0165 volan\u00fd s objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Prebieha pokus o nastavenie funkcie s n\u00e1zvom null: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Prebieha pokus o nastavenie nezn\u00e1mej funkcie \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Prebieha pokus o z\u00edskanie funkcie s n\u00e1zvom null: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Prebieha pokus o z\u00edskanie nezn\u00e1mej funkcie \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Prebieha pokus o nastavenie hodnoty null pre XPathFunctionResolver:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Prebieha pokus o nastavenie hodnoty null pre XPathVariableResolver:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "n\u00e1zov umiestnenia vo funkcii format-number e\u0161te nebol spracovan\u00fd!"}, { WG_PROPERTY_NOT_SUPPORTED, "Vlastn\u00edctvo XSL nie je podporovan\u00e9: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Nerobte moment\u00e1lne ni\u010d s n\u00e1zvov\u00fdm priestorom {0} vo vlastn\u00edctve: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException po\u010das pokusu o pr\u00edstup do syst\u00e9mov\u00e9ho vlastn\u00edctva XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Star\u00e1 syntax: quo(...) u\u017e nie je v XPath definovan\u00e9."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath potrebuje odvoden\u00fd objekt na implement\u00e1ciu nodeTest!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "nebol n\u00e1jden\u00fd symbol funkcie."}, { WG_COULDNOT_FIND_FUNCTION, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 funkciu: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nie je mo\u017en\u00e9 vytvori\u0165 URL z: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "-E vo\u013eba nie je podporovan\u00e1 syntaktick\u00fdm analyz\u00e1torom DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference bol dan\u00fd pre premenn\u00fa mimo kontext, alebo bez defin\u00edcie! N\u00e1zov = {0}"}, { WG_UNSUPPORTED_ENCODING, "Nepodporovan\u00e9 k\u00f3dovanie: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "en"}, { "help_language", "en"}, { "language", "en"}, { "BAD_CODE", "Parameter na createMessage bol mimo ohrani\u010denia"}, { "FORMAT_FAILED", "V\u00fdnimka po\u010das volania messageFormat"}, { "version", ">>>>>>> Verzia Xalan "}, { "version2", "<<<<<<<"}, { "yes", "\u00e1no"}, { "line", "Riadok #"}, { "column", "St\u013apec #"}, { "xsldone", "XSLProcessor: vykonan\u00e9"}, { "xpath_option", "vo\u013eby xpath: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select vyjadrenie xpath]"}, { "optionMatch", " [-match porovn\u00e1vac\u00ed vzor (pre diagnostiku zhody)]"}, { "optionAnyExpr", "Alebo len vyjadrenie xpath vykon\u00e1 v\u00fdpis pam\u00e4te diagnostiky"}, { "noParsermsg1", "Proces XSL nebol \u00faspe\u0161n\u00fd."}, { "noParsermsg2", "** Nebolo mo\u017en\u00e9 n\u00e1js\u0165 syntaktick\u00fd analyz\u00e1tor **"}, { "noParsermsg3", "Skontroluje, pros\u00edm, svoju classpath."}, { "noParsermsg4", "Ak nem\u00e1te Syntaktick\u00fd analyz\u00e1tor XML pre jazyk Java od firmy IBM, m\u00f4\u017eete si ho stiahnu\u0165 z"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Chyba: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Upozornenie: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/package.html0000644000175000017500000000202610721374030022272 0ustar mkochmkoch XPath resources.

    Contains strings for XPath support that require internationalization.

    libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_ja.java0000644000175000017500000014711710721374033025135 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_ja.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_ja extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "current() \u95a2\u6570\u306f\u30d1\u30bf\u30fc\u30f3\u306e\u30de\u30c3\u30c1\u30f3\u30b0\u3067\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002" }, { ER_CURRENT_TAKES_NO_ARGS, "current() \u95a2\u6570\u306f\u5f15\u6570\u3092\u53d7\u3051\u5165\u308c\u307e\u305b\u3093\u3002" }, { ER_DOCUMENT_REPLACED, "document() \u95a2\u6570\u306e\u5b9f\u88c5\u304c org.apache.xalan.xslt.FuncDocument \u306b\u3088\u308a\u7f6e\u304d\u63db\u3048\u3089\u308c\u307e\u3057\u305f\u3002"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306b\u6240\u6709\u8005\u6587\u66f8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() \u306e\u5f15\u6570\u304c\u591a\u3059\u304e\u307e\u3059\u3002"}, { ER_TRANSLATE_TAKES_3_ARGS, "translate() \u95a2\u6570\u306f 3 \u500b\u306e\u5f15\u6570\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "unparsed-entity-uri \u95a2\u6570\u306f\u5f15\u6570\u3092 1 \u500b\u4f7f\u7528\u3057\u307e\u3059\u3002"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "namespace axis \u304c\u307e\u3060\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_UNKNOWN_AXIS, "\u4e0d\u660e\u306a\u8ef8: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "\u4e0d\u660e\u306e\u30de\u30c3\u30c1\u30f3\u30b0\u64cd\u4f5c\u3002"}, { ER_INCORRECT_ARG_LENGTH, "processing-instruction() \u306e\u30ce\u30fc\u30c9\u30fb\u30c6\u30b9\u30c8\u306e\u5f15\u6570\u306e\u9577\u3055\u304c\u8aa4\u3063\u3066\u3044\u307e\u3059\u3002"}, { ER_CANT_CONVERT_TO_NUMBER, "{0} \u3092\u6570\u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093"}, { ER_CANT_CONVERT_TO_NODELIST, "{0} \u3092 NodeList \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0} \u3092 NodeSetDTM \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_CANT_CONVERT_TO_TYPE, "{0} \u3092 type#{1} \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093"}, { ER_EXPECTED_MATCH_PATTERN, "getMatchScore \u3067\u5fc5\u8981\u306a\u4e00\u81f4\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002"}, { ER_COULDNOT_GET_VAR_NAMED, "{0} \u3068\u3044\u3046\u540d\u524d\u306e\u5909\u6570\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f"}, { ER_UNKNOWN_OPCODE, "\u30a8\u30e9\u30fc: \u4e0d\u660e\u306a\u547d\u4ee4\u30b3\u30fc\u30c9: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "\u4f59\u5206\u306e\u6b63\u3057\u304f\u306a\u3044\u30c8\u30fc\u30af\u30f3: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "\u5f15\u7528\u7b26\u304c\u8aa4\u3063\u3066\u3044\u308b\u30ea\u30c6\u30e9\u30eb... \u4e8c\u91cd\u5f15\u7528\u7b26\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002"}, { ER_EXPECTED_SINGLE_QUOTE, "\u5f15\u7528\u7b26\u304c\u8aa4\u3063\u3066\u3044\u308b\u30ea\u30c6\u30e9\u30eb... \u5358\u4e00\u5f15\u7528\u7b26\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002"}, { ER_EMPTY_EXPRESSION, "\u7a7a\u306e\u5f0f\u3067\u3059\u3002"}, { ER_EXPECTED_BUT_FOUND, "{0} \u304c\u5fc5\u8981\u3067\u3057\u305f\u304c\u3001{1} \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u304c\u8aa4\u3063\u3066\u3044\u307e\u3059\u3002 - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "\u30d6\u30fc\u30eb(...) \u5f15\u6570\u306f 19990709 XPath \u30c9\u30e9\u30d5\u30c8\u3067\u306f\u3082\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "',' \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u304c\u3001\u5148\u7acb\u3064\u5f15\u6570\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "',' \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u304c\u3001\u5f8c\u7d9a\u306e\u5f15\u6570\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' \u307e\u305f\u306f '.[predicate]' \u306f\u6b63\u3057\u304f\u306a\u3044\u69cb\u6587\u3067\u3059\u3002\u4ee3\u308a\u306b 'self::node()[predicate]' \u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { ER_ILLEGAL_AXIS_NAME, "\u6b63\u3057\u304f\u306a\u3044\u8ef8\u306e\u540d\u524d: {0}"}, { ER_UNKNOWN_NODETYPE, "\u4e0d\u660e\u306a\u30ce\u30fc\u30c9\u578b: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "\u30d1\u30bf\u30fc\u30f3\u30fb\u30ea\u30c6\u30e9\u30eb ({0}) \u306b\u306f\u5f15\u7528\u7b26\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} \u3092\u6570\u306b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "XML TransformerFactory Liaison \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "\u30a8\u30e9\u30fc: xpath select \u5f0f (-select) \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "\u30a8\u30e9\u30fc: OP_LOCATIONPATH \u306e\u5f8c\u306b ENDOP \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f"}, { ER_ERROR_OCCURED, "\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308a\u307e\u3057\u305f\u3002"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "\u5909\u6570\u306b\u6307\u5b9a\u3055\u308c\u305f VariableReference \u304c\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u5916\u304b\u3001\u5b9a\u7fa9\u304c\u3042\u308a\u307e\u305b\u3093 \u540d\u524d = {0}"}, { ER_AXES_NOT_ALLOWED, "\u30de\u30c3\u30c1\u30f3\u30b0\u30fb\u30d1\u30bf\u30fc\u30f3\u3067\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u306e\u306f child:: \u8ef8\u304a\u3088\u3073 attribute:: \u8ef8\u306e\u307f\u3067\u3059\u3002 \u554f\u984c\u306e\u8ef8 = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() \u306e\u5f15\u6570\u306e\u6570\u304c\u8aa4\u3063\u3066\u3044\u307e\u3059\u3002"}, { ER_COUNT_TAKES_1_ARG, "count \u95a2\u6570\u306f\u5f15\u6570\u3092 1 \u500b\u4f7f\u7528\u3057\u307e\u3059\u3002"}, { ER_COULDNOT_FIND_FUNCTION, "\u95a2\u6570: {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f"}, { ER_UNSUPPORTED_ENCODING, "\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u306a\u3044\u30a8\u30f3\u30b3\u30fc\u30c9: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "\u554f\u984c\u304c getNextSibling \u5185\u306e DTM \u3067\u8d77\u3053\u308a\u307e\u3057\u305f... \u30ea\u30ab\u30d0\u30ea\u30fc\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u30fb\u30a8\u30e9\u30fc: EmptyNodeList \u3092\u66f8\u304d\u8fbc\u307f\u5148\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory \u306f XPathContext \u306b\u3088\u308a\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002"}, { ER_PREFIX_MUST_RESOLVE, "\u63a5\u982d\u90e8\u306f\u540d\u524d\u7a7a\u9593\u306b\u89e3\u6c7a\u3055\u308c\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource \u30bd\u30fc\u30b9) \u306f XPathContext \u5185\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002 {0} \u3092\u30aa\u30fc\u30d7\u30f3\u3067\u304d\u307e\u305b\u3093"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... \u306f DTM \u306b\u3088\u308a\u51e6\u7406\u3055\u308c\u307e\u305b\u3093\u3002"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... \u306f DTM \u306b\u3088\u308a\u51e6\u7406\u3055\u308c\u307e\u305b\u3093\u3002"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison \u306f\u578b {0} \u306e\u30ce\u30fc\u30c9\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper \u306f\u578b {0} \u306e\u30ce\u30fc\u30c9\u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse \u30a8\u30e9\u30fc: SystemID - {0} \u884c - {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse \u30a8\u30e9\u30fc"}, { ER_INVALID_UTF16_SURROGATE, "\u7121\u52b9\u306a UTF-16 \u30b5\u30ed\u30b2\u30fc\u30c8\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f: {0} ?"}, { ER_OIERROR, "\u5165\u51fa\u529b\u30a8\u30e9\u30fc"}, { ER_CANNOT_CREATE_URL, "{0} \u306e URL \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_XPATH_READOBJECT, "XPath.readObject \u5185: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "\u95a2\u6570\u30c8\u30fc\u30af\u30f3\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, { ER_CANNOT_DEAL_XPATH_TYPE, "XPath \u578b: {0} \u3092\u51e6\u7406\u3067\u304d\u307e\u305b\u3093"}, { ER_NODESET_NOT_MUTABLE, "\u3053\u306e NodeSet \u306f\u53ef\u5909\u3067\u3042\u308a\u307e\u305b\u3093"}, { ER_NODESETDTM_NOT_MUTABLE, "\u3053\u306e NodeSetDTM \u306f\u53ef\u5909\u3067\u3042\u308a\u307e\u305b\u3093"}, { ER_VAR_NOT_RESOLVABLE, "\u5909\u6570\u306f\u89e3\u6c7a\u53ef\u80fd\u3067\u3042\u308a\u307e\u305b\u3093: {0}"}, { ER_NULL_ERROR_HANDLER, "\u30cc\u30eb\u306e\u30a8\u30e9\u30fc\u30fb\u30cf\u30f3\u30c9\u30e9\u30fc"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3: \u4e0d\u660e\u306a\u547d\u4ee4\u30b3\u30fc\u30c9: {0}"}, { ER_ZERO_OR_ONE, "0 \u307e\u305f\u306f 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() \u306f XRTreeFragSelectWrapper \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() \u306f XRTreeFragSelectWrapper \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() \u306f XRTreeFragSelectWrapper \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() \u306f XRTreeFragSelectWrapper \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() \u306f XRTreeFragSelectWrapper \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() \u306f XRTreeFragSelectWrapper \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() \u306f XStringForChars \u306e\u5834\u5408\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { ER_COULD_NOT_FIND_VAR, "\u540d\u524d\u304c {0} \u306e\u5909\u6570\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars \u306f\u5f15\u6570\u306b\u30b9\u30c8\u30ea\u30f3\u30b0\u3092\u4f7f\u7528\u3057\u307e\u305b\u3093"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "FastStringBuffer \u5f15\u6570\u306f\u30cc\u30eb\u306b\u3067\u304d\u307e\u305b\u3093"}, { ER_TWO_OR_THREE, "2 \u307e\u305f\u306f 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "\u5909\u6570\u304c\u30d0\u30a4\u30f3\u30c9\u3055\u308c\u308b\u524d\u306b\u30a2\u30af\u30bb\u30b9\u3055\u308c\u307e\u3057\u305f\u3002"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB \u306f\u5f15\u6570\u306b\u30b9\u30c8\u30ea\u30f3\u30b0\u3092\u4f7f\u7528\u3057\u307e\u305b\u3093\u3002"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n \u30a8\u30e9\u30fc: \u30a6\u30a9\u30fc\u30ab\u30fc\u306e\u30eb\u30fc\u30c8\u3092\u30cc\u30eb\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002"}, { ER_NODESETDTM_CANNOT_ITERATE, "\u3053\u306e NodeSetDTM \u306f\u76f4\u524d\u306e\u30ce\u30fc\u30c9\u3092\u7e70\u308a\u8fd4\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NODESET_CANNOT_ITERATE, "\u3053\u306e NodeSet \u306f\u76f4\u524d\u306e\u30ce\u30fc\u30c9\u3092\u7e70\u308a\u8fd4\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NODESETDTM_CANNOT_INDEX, "\u3053\u306e NodeSetDTM \u306f\u7d22\u5f15\u4ed8\u3051\u3084\u30ab\u30a6\u30f3\u30c8\u306e\u6a5f\u80fd\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NODESET_CANNOT_INDEX, "\u3053\u306e NodeSet \u306f\u7d22\u5f15\u4ed8\u3051\u3084\u30ab\u30a6\u30f3\u30c8\u306e\u6a5f\u80fd\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "nextNode \u3092\u547c\u3073\u51fa\u3057\u305f\u5f8c\u306b setShouldCacheNodes \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_ONLY_ALLOWS, "{0} \u306b\u8a31\u53ef\u3055\u308c\u308b\u5f15\u6570\u306f {1} \u500b\u306e\u307f\u3067\u3059"}, { ER_UNKNOWN_STEP, "getNextStepPos \u5185\u306e\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3: \u4e0d\u660e\u306a stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "\u76f8\u5bfe\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u30fb\u30d1\u30b9\u306f '/' \u307e\u305f\u306f '//' \u30c8\u30fc\u30af\u30f3\u306e\u6b21\u306b\u5fc5\u8981\u3067\u3057\u305f\u3002"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u30fb\u30d1\u30b9\u304c\u5fc5\u8981\u3067\u3057\u305f\u304c\u3001\u6b21\u306e\u30c8\u30fc\u30af\u30f3\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u30fb\u30d1\u30b9\u304c\u5fc5\u8981\u3067\u3057\u305f\u304c\u3001\u4ee3\u308f\u308a\u306b XPath \u5f0f\u306e\u7d42\u308f\u308a\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002"}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u30fb\u30b9\u30c6\u30c3\u30d7\u306f '/' \u307e\u305f\u306f '//' \u30c8\u30fc\u30af\u30f3\u306e\u6b21\u306b\u5fc5\u8981\u3067\u3057\u305f\u3002"}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "NCName:* \u307e\u305f\u306f QName \u306e\u3044\u305a\u308c\u304b\u3068\u4e00\u81f4\u3059\u308b\u30ce\u30fc\u30c9\u30fb\u30c6\u30b9\u30c8\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002"}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "\u30b9\u30c6\u30c3\u30d7\u30fb\u30d1\u30bf\u30fc\u30f3\u304c\u5fc5\u8981\u3067\u3057\u305f\u304c\u3001'/' \u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002"}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "\u76f8\u5bfe\u30d1\u30b9\u30fb\u30d1\u30bf\u30fc\u30f3\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002"}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPath \u5f0f ''{0}'' \u306e XPathResult \u306e XPathResultType \u306f {1} \u3067\u3001\u3053\u308c\u3092\u30d6\u30fc\u30eb\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPath \u5f0f ''{0}'' \u306e XPathResult \u306e XPathResultType \u306f {1} \u3067\u3001\u3053\u308c\u3092\u5358\u4e00\u30ce\u30fc\u30c9\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u30e1\u30bd\u30c3\u30c9 getSingleNodeValue \u304c\u9069\u7528\u3055\u308c\u308b\u306e\u306f\u3001\u578b ANY_UNORDERED_NODE_TYPE \u304a\u3088\u3073 FIRST_ORDERED_NODE_TYPE \u306e\u307f\u3067\u3059\u3002"}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "XPathResultType \u304c {1} \u3067\u3042\u308b\u305f\u3081\u3001\u30e1\u30bd\u30c3\u30c9 getSnapshotLength \u3092 XPath \u5f0f ''{0}'' \u306e XPathResult \u3092\u5bfe\u8c61\u306b\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u9069\u7528\u3055\u308c\u308b\u306e\u306f\u3001\u578b UNORDERED_NODE_SNAPSHOT_TYPE \u304a\u3088\u3073 ORDERED_NODE_SNAPSHOT_TYPE \u306e\u307f\u3067\u3059\u3002"}, { ER_NON_ITERATOR_TYPE, "XPathResultType \u304c {1} \u3067\u3042\u308b\u305f\u3081\u3001\u30e1\u30bd\u30c3\u30c9 iterateNext \u3092 XPath \u5f0f ''{0}'' \u306e XPathResult \u3092\u5bfe\u8c61\u306b\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u9069\u7528\u3055\u308c\u308b\u306e\u306f\u3001\u578b UNORDERED_NODE_ITERATOR_TYPE \u304a\u3088\u3073 ORDERED_NODE_ITERATOR_TYPE \u306e\u307f\u3067\u3059\u3002"}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "\u7d50\u679c\u304c\u623b\u3055\u308c\u305f\u4ee5\u5f8c\u306b\u6587\u66f8\u304c\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc\u304c\u7121\u52b9\u3067\u3059\u3002"}, { ER_INVALID_XPATH_TYPE, "\u7121\u52b9\u306a XPath \u578b\u5f15\u6570: {0}"}, { ER_EMPTY_XPATH_RESULT, "\u7a7a\u306e XPath \u7d50\u679c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8"}, { ER_INCOMPATIBLE_TYPES, "XPath \u5f0f ''{0}'' \u306e XPathResult \u306e XPathResultType \u306f {1} \u3067\u3001\u3053\u308c\u3092\u6307\u5b9a\u3055\u308c\u305f XPathResultType {2} \u306b\u5f37\u5236\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NULL_RESOLVER, "\u63a5\u982d\u90e8\u3092\u30cc\u30eb\u63a5\u982d\u90e8\u30ea\u30be\u30eb\u30d0\u30fc\u306b\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002"}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPath \u5f0f ''{0}'' \u306e XPathResult \u306e XPathResultType \u306f {1} \u3067\u3001\u3053\u308c\u3092\u30b9\u30c8\u30ea\u30f3\u30b0\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "XPathResultType \u304c {1} \u3067\u3042\u308b\u305f\u3081\u3001\u30e1\u30bd\u30c3\u30c9 snapshotItem \u3092 XPath \u5f0f ''{0}'' \u306e XPathResult \u3092\u5bfe\u8c61\u306b\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u9069\u7528\u3055\u308c\u308b\u306e\u306f\u3001\u578b UNORDERED_NODE_SNAPSHOT_TYPE \u304a\u3088\u3073 ORDERED_NODE_SNAPSHOT_TYPE \u306e\u307f\u3067\u3059\u3002"}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30fb\u30ce\u30fc\u30c9\u306f\u3053\u306e XPathEvaluator \u306b\u30d0\u30a4\u30f3\u30c9\u3055\u308c\u3066\u3044\u308b\u6587\u66f8\u306b\u5c5e\u3057\u3066\u3044\u307e\u305b\u3093\u3002"}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30fb\u30ce\u30fc\u30c9\u578b\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_XPATH_ERROR, "XPath \u306b\u4e0d\u660e\u306a\u30a8\u30e9\u30fc\u304c\u3042\u308a\u307e\u3059\u3002"}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPath \u5f0f ''{0}'' \u306e XPathResult \u306e XPathResultType \u306f {1} \u3067\u3001\u3053\u308c\u3092\u6570\u5024\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "XMLConstants.FEATURE_SECURE_PROCESSING \u6a5f\u80fd\u306e\u8a2d\u5b9a\u304c true \u306e\u3068\u304d\u306b\u3001\u62e1\u5f35\u95a2\u6570 ''{0}'' \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "\u5909\u6570 {0} \u306e resolveVariable \u304c NULL \u3092\u623b\u3057\u3066\u3044\u307e\u3059\u3002"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u306a\u3044\u623b\u308a\u5024\u306e\u578b: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Source \u307e\u305f\u306f Return Type\u3001\u3042\u308b\u3044\u306f\u305d\u306e\u4e21\u65b9\u3092\u30cc\u30eb\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "{0} \u5f15\u6570\u306f\u30cc\u30eb\u306b\u3067\u304d\u307e\u305b\u3093\u3002"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "objectModel == null \u3067 {0}#isObjectModelSupported( String objectModel ) \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "objectModel == \"\" \u3067 {0}#isObjectModelSupported( String objectModel ) \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "\u6a5f\u80fd\u3092\u30cc\u30eb\u540d\u3067\u8a2d\u5b9a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "\u4e0d\u660e\u306a\u6a5f\u80fd \"{0}\" \u3092\u8a2d\u5b9a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059: {1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "\u6a5f\u80fd\u3092\u30cc\u30eb\u540d\u3067\u691c\u7d22\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "\u4e0d\u660e\u306a\u6a5f\u80fd \"{0}\" \u3092\u691c\u7d22\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059: {1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "XPathFunctionResolver \u3092\u30cc\u30eb\u3067\u8a2d\u5b9a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059: {0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "XPathVariableResolver \u3092\u30cc\u30eb\u3067\u8a2d\u5b9a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059: {0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u756a\u53f7\u95a2\u6570\u5185\u306e\u30ed\u30b1\u30fc\u30eb\u540d\u306f\u307e\u3060\u51e6\u7406\u3055\u308c\u307e\u305b\u3093\u3002"}, { WG_PROPERTY_NOT_SUPPORTED, "XSL \u30d7\u30ed\u30d1\u30c6\u30a3\u30fc: {0} \u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093"}, { WG_DONT_DO_ANYTHING_WITH_NS, "\u73fe\u5728\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc {1} \u306e\u540d\u524d\u7a7a\u9593 {0} \u3067\u4f55\u3082\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u305b\u3093"}, { WG_SECURITY_EXCEPTION, "XSL \u30b7\u30b9\u30c6\u30e0\u30fb\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc: {0} \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u3068\u304d\u306b SecurityException"}, { WG_QUO_NO_LONGER_DEFINED, "\u65e7\u69cb\u6587: quo(...) \u306f XPath \u5185\u306b\u3082\u3046\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "nodeTest \u3092\u5b9f\u88c5\u3059\u308b\u306b\u306f XPath \u306b\u6d3e\u751f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "\u95a2\u6570\u30c8\u30fc\u30af\u30f3\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, { WG_COULDNOT_FIND_FUNCTION, "\u95a2\u6570: {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f"}, { WG_CANNOT_MAKE_URL_FROM, "URL \u3092 {0} \u304b\u3089\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "-E \u30aa\u30d7\u30b7\u30e7\u30f3\u306f DTM \u30d1\u30fc\u30b5\u30fc\u306e\u5834\u5408\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "\u5909\u6570\u306b\u6307\u5b9a\u3055\u308c\u305f VariableReference \u304c\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u5916\u304b\u3001\u5b9a\u7fa9\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u540d\u524d = {0}"}, { WG_UNSUPPORTED_ENCODING, "\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u306a\u3044\u30a8\u30f3\u30b3\u30fc\u30c9: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "en"}, { "help_language", "en"}, { "language", "en"}, { "BAD_CODE", "createMessage \u3078\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u304c\u7bc4\u56f2\u5916\u3067\u3057\u305f\u3002"}, { "FORMAT_FAILED", "messageFormat \u547c\u3073\u51fa\u3057\u4e2d\u306b\u4f8b\u5916\u304c\u30b9\u30ed\u30fc\u3055\u308c\u307e\u3057\u305f\u3002"}, { "version", ">>>>>>> Xalan \u30d0\u30fc\u30b8\u30e7\u30f3 "}, { "version2", "<<<<<<<"}, { "yes", "\u306f\u3044 (y)"}, { "line", "\u884c #"}, { "column", "\u6841 #"}, { "xsldone", "XSLProcessor: \u5b8c\u4e86"}, { "xpath_option", "xpath \u30aa\u30d7\u30b7\u30e7\u30f3: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select xpath \u5f0f]"}, { "optionMatch", " [-match \u30de\u30c3\u30c1\u30f3\u30b0\u30fb\u30d1\u30bf\u30fc\u30f3 (\u30de\u30c3\u30c1\u30f3\u30b0\u8a3a\u65ad\u7528)]"}, { "optionAnyExpr", "\u3042\u308b\u3044\u306f\u8a3a\u65ad\u30c0\u30f3\u30d7\u3092\u5b9f\u884c\u3059\u308b\u306e\u306f xpath \u5f0f\u3060\u3051\u3067\u3059"}, { "noParsermsg1", "XSL \u51e6\u7406\u306f\u6210\u529f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { "noParsermsg2", "** \u30d1\u30fc\u30b5\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f **"}, { "noParsermsg3", "\u30af\u30e9\u30b9\u30d1\u30b9\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002"}, { "noParsermsg4", "IBM \u306e XML Parser for Java \u304c\u306a\u3044\u5834\u5408\u306f\u3001\u6b21\u306e\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059:"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#\u30a8\u30e9\u30fc"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "\u30a8\u30e9\u30fc: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "\u8b66\u544a: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "\u30d1\u30bf\u30fc\u30f3 "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_en.java0000644000175000017500000000215210721374031025130 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_en.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; /** * Default implementation of XPATHErrorResources. This is just * an empty class. * @xsl.usage advanced */ public class XPATHErrorResources_en extends XPATHErrorResources { } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_de.java0000644000175000017500000012646310721374032025133 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_de.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_de extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "Die Funktion current() ist in einem \u00dcbereinstimmungsmuster nicht zul\u00e4ssig!" }, { ER_CURRENT_TAKES_NO_ARGS, "In der Funktion current() d\u00fcrfen keine Argumente angegeben werden!" }, { ER_DOCUMENT_REPLACED, "Die Implementierung der Funktion document() wurde durch org.apache.xalan.xslt.FuncDocument ersetzt!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "Der Kontextknoten verf\u00fcgt nicht \u00fcber ein Eignerdokument!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() weist zu viele Argumente auf."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() weist zu viele Argumente auf."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() weist zu viele Argumente auf."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() weist zu viele Argumente auf."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() weist zu viele Argumente auf."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() weist zu viele Argumente auf."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() weist zu viele Argumente auf."}, { ER_TRANSLATE_TAKES_3_ARGS, "Die Funktion translate() erfordert drei Argumente!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Die Funktion unparsed-entity-uri sollte ein einziges Argument enthalten!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "Die Namensbereichsachse ist bisher nicht implementiert!"}, { ER_UNKNOWN_AXIS, "Unbekannte Achse: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "Unbekannter \u00dcbereinstimmungsvorgang!"}, { ER_INCORRECT_ARG_LENGTH, "Die L\u00e4nge des Arguments f\u00fcr den Knotentest von processing-instruction() ist falsch!"}, { ER_CANT_CONVERT_TO_NUMBER, "{0} kann nicht in eine Zahl konvertiert werden!"}, { ER_CANT_CONVERT_TO_NODELIST, "{0} kann nicht in NodeList konvertiert werden!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "{0} kann nicht in NodeSetDTM konvertiert werden!"}, { ER_CANT_CONVERT_TO_TYPE, "{0} kann nicht in type#{1} konvertiert werden."}, { ER_EXPECTED_MATCH_PATTERN, "\u00dcbereinstimmungsmuster in getMatchScore erwartet!"}, { ER_COULDNOT_GET_VAR_NAMED, "Die Variable mit dem Namen {0} konnte nicht abgerufen werden."}, { ER_UNKNOWN_OPCODE, "FEHLER! Unbekannter Operationscode: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Zus\u00e4tzliche nicht zul\u00e4ssige Token: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Falsche Anf\u00fchrungszeichen f\u00fcr Literal... Doppelte Anf\u00fchrungszeichen wurden erwartet!"}, { ER_EXPECTED_SINGLE_QUOTE, "Falsche Anf\u00fchrungszeichen f\u00fcr Literal... Einfache Anf\u00fchrungszeichen wurden erwartet!"}, { ER_EMPTY_EXPRESSION, "Leerer Ausdruck!"}, { ER_EXPECTED_BUT_FOUND, "Erwartet wurde {0}, gefunden wurde: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "Festlegung des Programmierers ist falsch! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "Das Argument boolean(...) ist im XPath-Entwurf 19990709 nicht mehr optional."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Gefunden wurde ',' ohne vorangestelltes Argument!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Gefunden wurde ',' ohne nachfolgendes Argument!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' oder '.[predicate]' ist eine nicht zul\u00e4ssige Syntax. Verwenden Sie stattdessen 'self::node()[predicate]'."}, { ER_ILLEGAL_AXIS_NAME, "Nicht zul\u00e4ssiger Achsenname: {0}"}, { ER_UNKNOWN_NODETYPE, "Unbekannter Knotentyp: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "Musterliteral ({0}) muss in Anf\u00fchrungszeichen angegeben werden!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} konnte nicht als Zahl formatiert werden!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "XML-TransformerFactory-Liaison konnte nicht erstellt werden: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Fehler! xpath-Auswahlausdruck (-select) konnte nicht gefunden werden."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "FEHLER! ENDOP konnte nach OP_LOCATIONPATH nicht gefunden werden."}, { ER_ERROR_OCCURED, "Es ist ein Fehler aufgetreten!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "Das f\u00fcr die Variable angegebene Argument VariableReference befindet sich au\u00dferhalb des Kontexts oder weist keine Definition auf! Name = {0}"}, { ER_AXES_NOT_ALLOWED, "Nur die Achsen ''''child::'''' und ''''attribute::'''' sind in Suchmustern zul\u00e4ssig! Fehlerhafte Achsen = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() weist eine falsche Anzahl Argumenten auf."}, { ER_COUNT_TAKES_1_ARG, "Die Funktion count sollte ein einziges Argument enthalten!"}, { ER_COULDNOT_FIND_FUNCTION, "Die Funktion konnte nicht gefunden werden: {0}"}, { ER_UNSUPPORTED_ENCODING, "Nicht unterst\u00fctzte Verschl\u00fcsselung: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "In dem DTM in getNextSibling ist ein Fehler aufgetreten... Wiederherstellung wird durchgef\u00fchrt"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Programmierungsfehler: In EmptyNodeList kann nicht geschrieben werden."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory wird nicht von XPathContext unterst\u00fctzt!"}, { ER_PREFIX_MUST_RESOLVE, "Das Pr\u00e4fix muss in einen Namensbereich aufgel\u00f6st werden: {0}"}, { ER_PARSE_NOT_SUPPORTED, "parse (InputSource Quelle) wird nicht in XPathContext unterst\u00fctzt! {0} kann nicht ge\u00f6ffnet werden."}, { ER_SAX_API_NOT_HANDLED, "SAX-API characters(char ch[]... wird nicht von dem DTM verarbeitet!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... wird nicht von dem DTM verarbeitet!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison kann keine Knoten vom Typ {0} verarbeiten"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper kann keine Knoten vom Typ {0} verarbeiten"}, { ER_XERCES_PARSE_ERROR_DETAILS, "Fehler bei DOM2Helper.parse: System-ID - {0} Zeile - {1}"}, { ER_XERCES_PARSE_ERROR, "Fehler bei DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "Ung\u00fcltige UTF-16-Ersetzung festgestellt: {0} ?"}, { ER_OIERROR, "E/A-Fehler"}, { ER_CANNOT_CREATE_URL, "URL kann nicht erstellt werden f\u00fcr: {0}"}, { ER_XPATH_READOBJECT, "In XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "Funktionstoken wurde nicht gefunden."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Der XPath-Typ kann nicht verarbeitet werden: {0}"}, { ER_NODESET_NOT_MUTABLE, "Diese NodeSet kann nicht ge\u00e4ndert werden"}, { ER_NODESETDTM_NOT_MUTABLE, "Dieses NodeSetDTM kann nicht ge\u00e4ndert werden"}, { ER_VAR_NOT_RESOLVABLE, "Die Variable kann nicht aufgel\u00f6st werden: {0}"}, { ER_NULL_ERROR_HANDLER, "Kein Fehlerbehandlungsprogramm vorhanden"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Programmiererfestlegung: Unbekannter Operationscode: {0}"}, { ER_ZERO_OR_ONE, "0 oder 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() wird nicht von XRTreeFragSelectWrapper unterst\u00fctzt"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() wird nicht von XRTreeFragSelectWrapper unterst\u00fctzt"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() wird nicht von XRTreeFragSelectWrapper unterst\u00fctzt"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() wird nicht von XRTreeFragSelectWrapper unterst\u00fctzt"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() wird nicht von XRTreeFragSelectWrapper unterst\u00fctzt"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() wird nicht von XRTreeFragSelectWrapper unterst\u00fctzt"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() wird nicht f\u00fcr XStringForChars unterst\u00fctzt"}, { ER_COULD_NOT_FIND_VAR, "Die Variable mit dem Namen {0} konnte nicht gefunden werden"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars kann keine Zeichenfolge als Argument enthalten"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "Das Argument FastStringBuffer kann nicht null sein"}, { ER_TWO_OR_THREE, "2 oder 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Auf die Variable wurde zugegriffen, bevor diese gebunden wurde!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB kann keine Zeichenfolge als Argument enthalten!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Fehler! Root eines Walker wird auf null gesetzt!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Dieses NodeSetDTM kann keinen vorherigen Knoten wiederholen!"}, { ER_NODESET_CANNOT_ITERATE, "Diese NodeSet kann keinen vorherigen Knoten wiederholen!"}, { ER_NODESETDTM_CANNOT_INDEX, "Dieses NodeSetDTM kann keine Indexierungs- oder Z\u00e4hlfunktionen ausf\u00fchren!"}, { ER_NODESET_CANNOT_INDEX, "Diese NodeSet kann keine Indexierungs- oder Z\u00e4hlfunktionen ausf\u00fchren!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "setShouldCacheNodes kann nicht aufgerufen werden, nachdem nextNode aufgerufen wurde!"}, { ER_ONLY_ALLOWS, "{0} erlaubt nur {1} Argument(e)"}, { ER_UNKNOWN_STEP, "Programmiererfestlegung in getNextStepPos: stepType unbekannt: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Nach dem Token '/' oder '//' wurde ein relativer Positionspfad erwartet."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Es wurde ein Positionspfad erwartet, aber folgendes Token wurde festgestellt\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "Es wurde ein Positionspfad erwartet, aber das Ende des XPath-Ausdrucks wurde stattdessen gefunden."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Nach dem Token '/' oder '//' wurde ein Positionsschritt erwartet."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Es wurde ein Knotentest erwartet, der entweder NCName:* oder dem QNamen entspricht."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Es wurde ein Schrittmuster erwartet, aber '/' festgestellt."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Es wurde ein Muster eines relativen Pfads erwartet."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "XPathResult des XPath-Ausdrucks ''{0}'' hat einen XPathResultType von {1}, der nicht in einen Booleschen Ausdruck konvertiert werden kann."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "XPathResult des XPath-Ausdrucks ''{0}'' hat einen XPathResultType von {1}, der nicht in einen einzelnen Knoten konvertiert werden kann. Die Methode getSingleNodeValue bezieht sich nur auf die Typen ANY_UNORDERED_NODE_TYPE und FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "Die Methode getSnapshotLength kann nicht \u00fcber XPathResult des XPath-Ausdrucks ''{0}'' aufgerufen werden, da der zugeh\u00f6rige XPathResultType {1} ist. Diese Methode gilt nur f\u00fcr die Typen UNORDERED_NODE_SNAPSHOT_TYPE und ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "Die Methode iterateNext kann nicht \u00fcber XPathResult des XPath-Ausdrucks ''{0}'' aufgerufen werden, da der zugeh\u00f6rige XPathResultType {1} ist. Diese Methode gilt nur f\u00fcr die Typen UNORDERED_NODE_ITERATOR_TYPE und ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "Seit der R\u00fcckgabe des Ergebnisses wurde das Dokument ge\u00e4ndert. Der Iterator ist ung\u00fcltig."}, { ER_INVALID_XPATH_TYPE, "Ung\u00fcltiges XPath-Typenargument: {0}"}, { ER_EMPTY_XPATH_RESULT, "Leeres XPath-Ergebnisobjekt"}, { ER_INCOMPATIBLE_TYPES, "XPathResult des XPath-Ausdrucks ''{0}'' hat einen XPathResultType von {1}, der nicht in den angegebenen XPathResultType {2} konvertiert werden kann."}, { ER_NULL_RESOLVER, "Das Pr\u00e4fix kann nicht mit einer Aufl\u00f6sungsfunktion f\u00fcr Nullpr\u00e4fixe aufgel\u00f6st werden."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "XPathResult des XPath-Ausdrucks ''{0}'' hat einen XPathResultType von {1}, der nicht in eine Zeichenfolge konvertiert werden kann."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "Die Methode snapshotItem kann nicht \u00fcber XPathResult des XPath-Ausdrucks ''{0}'' aufgerufen werden, da der zugeh\u00f6rige XPathResultType {1} ist. Diese Methode gilt nur f\u00fcr die Typen UNORDERED_NODE_SNAPSHOT_TYPE und ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "Kontextknoten geh\u00f6rt nicht zu dem Dokument, das an diesen XPathEvaluator gebunden ist."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "Der Kontextknotentyp wird nicht unterst\u00fctzt."}, { ER_XPATH_ERROR, "Unbekannter Fehler in XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "XPathResult des XPath-Ausdrucks ''{0}'' hat einen XPathResultType von {1}, der nicht in eine Zahl konvertiert werden kann."}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Erweiterungsfunktion: ''{0}'' kann nicht aufgerufen werden, wenn f\u00fcr XMLConstants.FEATURE_SECURE_PROCESSING die Einstellung ''True'' festgelegt wurde."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable f\u00fcr die Variable {0} gibt den Wert Null zur\u00fcck"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Nicht unterst\u00fctzter R\u00fcckgabetyp: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "Quellen- und/oder R\u00fcckgabetyp d\u00fcrfen nicht null sein"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "Das Argument {0} darf nicht den Wert Null haben"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( Zeichenfolge objectModel ) kann nicht aufgerufen werden, wenn objectModel den Wert Null hat"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( Zeichenfolge objectModel ) kann nicht aufgerufen werden, wenn objectModel den Wert \"\" hat"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Es wird versucht, eine Funktion ohne Namensangabe zu definieren: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Es wird versucht, die unbekannte Funktion \"{0}\" zu definieren: {1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Es wird versucht, eine Funktion ohne Namensangabe abzurufen: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Es wird versucht, die unbekannte Funktion \"{0}\" abzurufen: {1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Es wird versucht, XPathFunctionResolver mit dem Wert Null zu definieren: {0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Es wird versucht, XPathVariableResolver mit dem Wert Null zu definieren: {0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "Der Name der L\u00e4ndereinstellung in der Funktion format-number wurde bisher nicht verarbeitet!"}, { WG_PROPERTY_NOT_SUPPORTED, "XSL-Merkmal wird nicht unterst\u00fctzt: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "F\u00fchren Sie derzeit keine Vorg\u00e4nge mit dem Namensbereich {0} in folgendem Merkmal durch: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException beim Zugriff auf XSL-Systemmerkmal: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Veraltete Syntax: quo(...) ist nicht mehr in XPath definiert."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath ben\u00f6tigt f\u00fcr die Implementierung von nodeTest ein abgeleitetes Objekt!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "Funktionstoken wurde nicht gefunden."}, { WG_COULDNOT_FIND_FUNCTION, "Die Funktion konnte nicht gefunden werden: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "URL konnte nicht erstellt werden aus: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Option -E wird f\u00fcr DTM-Parser nicht unterst\u00fctzt"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "Das f\u00fcr die Variable angegebene Argument VariableReference befindet sich au\u00dferhalb des Kontexts oder weist keine Definition auf! Name = {0}"}, { WG_UNSUPPORTED_ENCODING, "Nicht unterst\u00fctzte Verschl\u00fcsselung: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "de"}, { "help_language", "de"}, { "language", "de"}, { "BAD_CODE", "Der Parameter f\u00fcr createMessage lag au\u00dferhalb des g\u00fcltigen Bereichs"}, { "FORMAT_FAILED", "W\u00e4hrend des Aufrufs von messageFormat wurde eine Ausnahmebedingung ausgel\u00f6st"}, { "version", ">>>>>>> Xalan-Version "}, { "version2", "<<<<<<<"}, { "yes", "ja"}, { "line", "Zeilennummer"}, { "column", "Spaltennummer"}, { "xsldone", "XSLProcessor: fertig"}, { "xpath_option", "xpath-Optionen: "}, { "optionIN", "[-in EingabeXMLURL]"}, { "optionSelect", "[-select Xpath-Ausdruck]"}, { "optionMatch", "[-match \u00dcbereinstimmungsmuster (f\u00fcr \u00dcbereinstimmungsdiagnose)]"}, { "optionAnyExpr", "\u00dcber einen einfachen xpath-Ausdruck wird ein Diagnosespeicherauszug erstellt"}, { "noParsermsg1", "XSL-Prozess konnte nicht erfolgreich durchgef\u00fchrt werden."}, { "noParsermsg2", "** Parser konnte nicht gefunden werden **"}, { "noParsermsg3", "Bitte \u00fcberpr\u00fcfen Sie den Klassenpfad."}, { "noParsermsg4", "Wenn Sie nicht \u00fcber einen IBM XML-Parser f\u00fcr Java verf\u00fcgen, k\u00f6nnen Sie ihn \u00fcber"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "FEHLERHAFTER_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FEHLGESCHLAGEN"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#Fehler"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Fehler: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Achtung: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "MUSTER "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_hu.java0000644000175000017500000013020110721374031025137 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_hu.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_hu extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "A current() f\u00fcggv\u00e9ny nem megengedett az illeszt\u00e9si mint\u00e1ban!" }, { ER_CURRENT_TAKES_NO_ARGS, "A current() f\u00fcggv\u00e9ny nem fogad el argumentumokat!" }, { ER_DOCUMENT_REPLACED, "A document() f\u00fcggv\u00e9ny megval\u00f3s\u00edt\u00e1s\u00e1t lecser\u00e9lte az org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "A k\u00f6rnyezetnek nincs tulajdonos dokumentuma!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "A local-name()-nek t\u00fal sok argumentuma van."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "A namespace-uri()-nek t\u00fal sok argumentuma van."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "A normalize-space()-nek t\u00fal sok argumentuma van."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "A number()-nek t\u00fal sok argumentuma van."}, { ER_NAME_HAS_TOO_MANY_ARGS, "A name()-nek t\u00fal sok argumentuma van."}, { ER_STRING_HAS_TOO_MANY_ARGS, "A string()-nek t\u00fal sok argumentuma van."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "A string-length()-nek t\u00fal sok argumentuma van."}, { ER_TRANSLATE_TAKES_3_ARGS, "A translate() f\u00fcggv\u00e9ny h\u00e1rom argumentumot k\u00e9r!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Az unparsed-entity-uri f\u00fcggv\u00e9nyhez egy argumentum sz\u00fcks\u00e9ges!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "A n\u00e9vt\u00e9r tengely m\u00e9g nincs magval\u00f3s\u00edtva!"}, { ER_UNKNOWN_AXIS, "Ismeretlen tengely: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "ismeretlen illeszt\u00e9si m\u0171velet!"}, { ER_INCORRECT_ARG_LENGTH, "A processing-instruction() csom\u00f3pont teszt argumentum\u00e1nak hossza helytelen!"}, { ER_CANT_CONVERT_TO_NUMBER, "A(z) {0} nem konvert\u00e1lhat\u00f3 sz\u00e1mm\u00e1"}, { ER_CANT_CONVERT_TO_NODELIST, "A(z) {0} nem konvert\u00e1lhat\u00f3 NodeList-t\u00e9!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "A(z) {0} nem konvert\u00e1lhat\u00f3 NodeSetDTM-m\u00e9!"}, { ER_CANT_CONVERT_TO_TYPE, "{0} nem konvert\u00e1lhat\u00f3 type#{1} t\u00edpuss\u00e1"}, { ER_EXPECTED_MATCH_PATTERN, "Illeszt\u00e9si mint\u00e1t v\u00e1rtunk a getMatchScore-ban!"}, { ER_COULDNOT_GET_VAR_NAMED, "Nem lehet lek\u00e9rni a(z) {0} nev\u0171 v\u00e1ltoz\u00f3t"}, { ER_UNKNOWN_OPCODE, "HIBA! Ismeretlen opk\u00f3d: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Extra tiltott tokenek: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "rosszul id\u00e9zett liter\u00e1l... dupla id\u00e9z\u0151jelet v\u00e1rtunk!"}, { ER_EXPECTED_SINGLE_QUOTE, "rosszul id\u00e9zett liter\u00e1l... szimpla id\u00e9z\u0151jelet v\u00e1rtunk!"}, { ER_EMPTY_EXPRESSION, "\u00dcres kifejez\u00e9s!"}, { ER_EXPECTED_BUT_FOUND, "{0}-t v\u00e1rtunk, de ezt tal\u00e1ltuk: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "A programoz\u00f3 feltev\u00e9se hib\u00e1s! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "A boolean(...) argumentuma t\u00f6bb\u00e9 nem opcion\u00e1lis az 19990709 XPath v\u00e1zlat szerint."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "','-t tal\u00e1ltunk, de nincs el\u0151tte argumentum!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "','-t tal\u00e1ltunk, de nincs ut\u00e1na argumentum!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "A '..[felt\u00e9tel]' vagy '.[felt\u00e9tel]' szintaktika tiltott. Haszn\u00e1lja ink\u00e1bb a 'self::node()[predicate]' defin\u00edci\u00f3t."}, { ER_ILLEGAL_AXIS_NAME, "Tiltott tengelyn\u00e9v: {0}"}, { ER_UNKNOWN_NODETYPE, "Ismeretlen node-t\u00edpus: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "A minta-liter\u00e1lt ({0}) id\u00e9z\u0151jelek k\u00f6z\u00e9 kell tenni!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "A(z) {0} nem form\u00e1zhat\u00f3 sz\u00e1mm\u00e1!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Nem lehet XML TransformerFactory Liaison-t l\u00e9trehozni: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Hiba! Az xpath kiv\u00e1laszt\u00e1si kifejez\u00e9s nem tal\u00e1lhat\u00f3 (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "HIBA! Nem tal\u00e1lhat\u00f3 ENDOP az OP_LOCATIONPATH ut\u00e1n"}, { ER_ERROR_OCCURED, "Hiba t\u00f6rt\u00e9nt!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "A v\u00e1ltoz\u00f3ra adott VariableReference (v\u00e1ltoz\u00f3hivatkoz\u00e1s) k\u00edv\u00fcl van a k\u00f6rnyezeten vagy nincs defin\u00edci\u00f3ja! N\u00e9v = {0}"}, { ER_AXES_NOT_ALLOWED, "Csak a child:: \u00e9s az attribute:: tengelyek illeszkedhetnek mint\u00e1kra. Zavar\u00f3 tengelyek = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "A key()-nek nem megfelel\u0151 sz\u00e1m\u00fa argumentuma van."}, { ER_COUNT_TAKES_1_ARG, "A count f\u00fcggv\u00e9nyhez csak egy argumentumot lehet megadni!"}, { ER_COULDNOT_FIND_FUNCTION, "Nem tal\u00e1lhat\u00f3 a f\u00fcggv\u00e9ny: {0}"}, { ER_UNSUPPORTED_ENCODING, "Nem t\u00e1mogatott k\u00f3dol\u00e1s: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Probl\u00e9ma mer\u00fclt fel a DTM-ben a getNextSibling-ben... megpr\u00f3b\u00e1ljuk helyrehozni"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Programoz\u00f3i hiba: az EmptyNodeList-be (\u00fcres csom\u00f3pontlist\u00e1ba) nem lehet \u00edrni."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "A setDOMFactory-t nem t\u00e1mogatja az XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "Az el\u0151tagnak egy n\u00e9vt\u00e9rre kell felold\u00f3dnia: {0}"}, { ER_PARSE_NOT_SUPPORTED, "Az elem\u00e9s (InputSource forr\u00e1s) nem t\u00e1mogatott az XPathContext-ben! Nem lehet megnyitni a(z) {0}-t"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... f\u00fcggv\u00e9nyt nem kezeli a DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "Az ignorableWhitespace(char ch[]... f\u00fcggv\u00e9nyt nem kezeli a DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "A DTMLiaison nem tud {0} t\u00edpus\u00fa csom\u00f3pontokat kezelni"}, { ER_XERCES_CANNOT_HANDLE_NODES, "A DOM2Helper nem tud {0} t\u00edpus\u00fa csom\u00f3pontokat kezelni"}, { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse hiba: SystemID - {0} sor - {1}"}, { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse hiba"}, { ER_INVALID_UTF16_SURROGATE, "\u00c9rv\u00e9nytelen UTF-16 helyettes\u00edt\u00e9s: {0} ?"}, { ER_OIERROR, "IO hiba"}, { ER_CANNOT_CREATE_URL, "Nem lehet URL-t l\u00e9trehozni ehhez: {0}"}, { ER_XPATH_READOBJECT, "A XPath.readObject met\u00f3dusban: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "A f\u00fcggv\u00e9ny jelsor nem tal\u00e1lhat\u00f3."}, { ER_CANNOT_DEAL_XPATH_TYPE, "Nem lehet megbirk\u00f3zni az XPath t\u00edpussal: {0}"}, { ER_NODESET_NOT_MUTABLE, "Ez a NodeSet nem illeszthet\u0151 be"}, { ER_NODESETDTM_NOT_MUTABLE, "Ez a NodeSetDTM nem illeszthet\u0151 be"}, { ER_VAR_NOT_RESOLVABLE, "A v\u00e1ltoz\u00f3 nem oldhat\u00f3 fel: {0}"}, { ER_NULL_ERROR_HANDLER, "Null hibakezel\u0151"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Programoz\u00f3i \u00e9rtes\u00edt\u00e9s: ismeretlen m\u0171veletk\u00f3d: {0} "}, { ER_ZERO_OR_ONE, "0 vagy 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Az rtf()-et nem t\u00e1mogatja az XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "Az asNodeIterator()-t nem t\u00e1mogatja az XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "A detach() f\u00fcggv\u00e9nyt nem t\u00e1mogatja az XRTreeFragSelectWrapper"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "A num() f\u00fcggv\u00e9nyt nem t\u00e1mogatja az XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "A xstr() f\u00fcggv\u00e9nyt nem t\u00e1mogatja az XRTreeFragSelectWrapper"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "A str() f\u00fcggv\u00e9nyt nem t\u00e1mogatja az XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "Az fsb() nem t\u00e1mogatott az XStringForChars-n\u00e1l"}, { ER_COULD_NOT_FIND_VAR, "Nem tal\u00e1lhat\u00f3 {0} nev\u0171 v\u00e1ltoz\u00f3"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "Az XStringForChars-nak nem adhat meg karakterl\u00e1nc argumentumot"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "A FastStringBuffer argumentum nem lehet null"}, { ER_TWO_OR_THREE, "2 vagy 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "V\u00e1ltoz\u00f3el\u00e9r\u00e9s \u00e9rt\u00e9kad\u00e1s el\u0151tt!"}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB nem kaphat sztring argumentumot!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Hiba! A bej\u00e1r\u00f3 gy\u00f6ker\u00e9t null-ra \u00e1ll\u00edtotta!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "Ez a NodeSetDTM nem iter\u00e1lhat egy kor\u00e1bbi node-ra!"}, { ER_NODESET_CANNOT_ITERATE, "Ez a NodeSet nem iter\u00e1lhat egy kor\u00e1bbi node-ra!"}, { ER_NODESETDTM_CANNOT_INDEX, "Ez a NodeSetDTM nem indexelhet \u00e9s nem sz\u00e1ml\u00e1lhatja a funkci\u00f3kat!"}, { ER_NODESET_CANNOT_INDEX, "Ez a NodeSet nem indexelhet \u00e9s nem sz\u00e1ml\u00e1lhatja a funkci\u00f3kat!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Nem h\u00edvhat\u00f3 setShouldCacheNodes nextNode h\u00edv\u00e1sa ut\u00e1n!"}, { ER_ONLY_ALLOWS, "{0} csak {1} argumentumot enged\u00e9lyez"}, { ER_UNKNOWN_STEP, "Programoz\u00f3i \u00e9rtes\u00edt\u00e9s getNextStepPos h\u00edv\u00e1sban: ismeretlen stepType: {0} "}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "Egy relat\u00edv elhelyez\u00e9si \u00fatvonalat v\u00e1rtunk a '/' vagy '//' token ut\u00e1n."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "Egy hely \u00fatvonalat v\u00e1rtam, de a k\u00f6vetkez\u0151 tokent tal\u00e1ltam\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "A rendszer hely \u00fatvonalat v\u00e1rt, de helyette az XPath kifejez\u00e9s v\u00e9g\u00e9be \u00fctk\u00f6z\u00f6tt."}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "Egy elhelyez\u00e9si l\u00e9p\u00e9st v\u00e1rtunk a '/' vagy '//' token ut\u00e1n."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "Egy olyan node-tesztet v\u00e1rtunk, ami vagy az NCName:*-ra vagy a QName-re illeszkedik."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "Egy l\u00e9p\u00e9smint\u00e1t v\u00e1rtunk, de '/' szerepelt."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "Relat\u00edv \u00fatvonalat v\u00e1rtunk."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "A(z) ''{0}'' XPath kifejez\u00e9s XPathResult elem\u00e9nek XPathResultType \u00e9rt\u00e9ke {1}, ami nem alak\u00edthat\u00f3 \u00e1t logikai t\u00edpuss\u00e1."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "A(z) ''{0}'' XPath kifejez\u00e9s XPathResult elem\u00e9nek XPathResultType \u00e9rt\u00e9ke {1}, ami nem alak\u00edthat\u00f3 \u00e1t egyetlen csom\u00f3pontt\u00e1. A getSingleNodeValue met\u00f3dus csak az ANY_UNORDERED_NODE_TYPE \u00e9s a FIRST_ORDERED_NODE_TYPE t\u00edpusra alkalmazhat\u00f3. "}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "A getSnapshotLength met\u00f3dus nem h\u00edvhat\u00f3 meg a(z) ''{0}'' XPath kifejez\u00e9s XPathResult \u00e9rt\u00e9k\u00e9re, mert az XPathResultType \u00e9rt\u00e9ke {1}. Ez a met\u00f3dus csak UNORDERED_NODE_SNAPSHOT_TYPE \u00e9s ORDERED_NODE_SNAPSHOT_TYPE t\u00edpusokra alkalmazhat\u00f3."}, { ER_NON_ITERATOR_TYPE, "Az iterateNext met\u00f3dus nem h\u00edvhat\u00f3 meg a(z) ''{0}'' XPath kifejez\u00e9s XPathResult \u00e9rt\u00e9k\u00e9re, mert az XPathResultType \u00e9rt\u00e9ke {1}. Ez a met\u00f3dus csak UNORDERED_NODE_ITERATOR_TYPE \u00e9s ORDERED_NODE_ITERATOR_TYPE t\u00edpusokra alkalmazhat\u00f3."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "A dokumentum megv\u00e1ltozott, mi\u00f3ta az eredm\u00e9ny visszat\u00e9rt. Az iter\u00e1tor \u00e9rv\u00e9nytelen."}, { ER_INVALID_XPATH_TYPE, "\u00c9rv\u00e9nytelen XPath t\u00edpus-argumentum: {0}"}, { ER_EMPTY_XPATH_RESULT, "\u00dcres XPath eredm\u00e9nyobjektum"}, { ER_INCOMPATIBLE_TYPES, "A(z) ''{0}'' XPath kifejez\u00e9s XPathResult elem\u00e9nek XPathResultType \u00e9rt\u00e9ke {1}, ami nem helyezhet\u0151 el a megadott {2} XPathResultType t\u00edpusban. "}, { ER_NULL_RESOLVER, "Nem lehet feloldani a prefixet null prefix-felold\u00f3val."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "A(z) ''{0}'' XPath kifejez\u00e9s XPathResult elem\u00e9nek XPathResultType \u00e9rt\u00e9ke {1}, ami nem alak\u00edthat\u00f3 \u00e1t karaktersorozatt\u00e1. "}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "A snapshotItem met\u00f3dus nem h\u00edvhat\u00f3 meg a(z) ''{0}'' XPath kifejez\u00e9s XPathResult \u00e9rt\u00e9k\u00e9re, mert az XPathResultType \u00e9rt\u00e9ke {1}. Ez a met\u00f3dus csak UNORDERED_NODE_SNAPSHOT_TYPE \u00e9s ORDERED_NODE_SNAPSHOT_TYPE t\u00edpusokra alkalmazhat\u00f3."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "A k\u00f6rnyezeti node nem az XPathEvaluator-hoz tartoz\u00f3 dokumentumhoz tartozik."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "A k\u00f6rnyezeti node t\u00edpusa nem t\u00e1mogatott."}, { ER_XPATH_ERROR, "Ismeretlen hiba az XPath-ban."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "A(z) ''{0}'' XPath kifejez\u00e9s XPathResult elem\u00e9nek XPathResultType \u00e9rt\u00e9ke {1}, ami nem alak\u00edthat\u00f3 \u00e1t sz\u00e1mm\u00e1. "}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "A(z) ''{0}'' b\u0151v\u00edt\u0151 f\u00fcggv\u00e9ny nem h\u00edvhat\u00f3 meg, amikor az XMLConstants.FEATURE_SECURE_PROCESSING szolg\u00e1ltat\u00e1s igazra van \u00e1ll\u00edtva. "}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "A resolveVariable null\u00e9rt\u00e9ket adott vissza a(z) {0} v\u00e1ltoz\u00f3ra"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Nem t\u00e1mogatott visszat\u00e9r\u00e9si t\u00edpus: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "A forr\u00e1s \u00e9s/vagy a visszat\u00e9r\u00e9si t\u00edpus nem lehet null. "}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "A(z) {0} argumentum nem lehet null"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel ) nem h\u00edvhat\u00f3 meg objectModel == null \u00e9rt\u00e9kkel "}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) nem h\u00edvhat\u00f3 meg objectModel == \"\" \u00e9rt\u00e9kkel "}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Pr\u00f3b\u00e1lkoz\u00e1s egy szolg\u00e1ltat\u00e1s be\u00e1ll\u00edt\u00e1s\u00e1ra null n\u00e9vvel: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Pr\u00f3b\u00e1lkoz\u00e1s az ismeretlen \"{0}\" szolg\u00e1ltat\u00e1s be\u00e1ll\u00edt\u00e1s\u00e1ra:{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Null nev\u0171 szolg\u00e1ltat\u00e1st pr\u00f3b\u00e1lt meg beolvasni: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Pr\u00f3b\u00e1lkoz\u00e1s az ismeretlen \"{0}\" szolg\u00e1ltat\u00e1s beolvas\u00e1s\u00e1ra:{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "Null XPathFunctionResolver \u00e9rt\u00e9ket pr\u00f3b\u00e1lt meg be\u00e1ll\u00edtani:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "Null XPathVariableResolver \u00e9rt\u00e9ket pr\u00f3b\u00e1lt meg be\u00e1ll\u00edtani:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "A locale-n\u00e9v a format-number f\u00fcggv\u00e9nyben m\u00e9g nincs kezelve!"}, { WG_PROPERTY_NOT_SUPPORTED, "Az XSL tulajdons\u00e1g nem t\u00e1mogatott: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "Jelenleg ne tegyen semmit a(z) {0} n\u00e9vt\u00e9rrel a tulajdons\u00e1gban: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException az XSL rendszertulajdons\u00e1g el\u00e9r\u00e9s\u00e9n\u00e9l: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "A r\u00e9gi szintaktika: quo(...) t\u00f6bb\u00e9 nincs defini\u00e1lva az XPath-ban."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "Az XPath-nak kell egy sz\u00e1rmaztatott objektum a nodeTest-hez!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "A f\u00fcggv\u00e9ny jelsor nem tal\u00e1lhat\u00f3."}, { WG_COULDNOT_FIND_FUNCTION, "Nem tal\u00e1lhat\u00f3 a f\u00fcggv\u00e9ny: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nem k\u00e9sz\u00edthet\u0151 URL ebb\u0151l: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "A -E opci\u00f3 nem t\u00e1mogatott a DTM \u00e9rtelmez\u0151h\u00f6z"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "A v\u00e1ltoz\u00f3ra adott VariableReference (v\u00e1ltoz\u00f3hivatkoz\u00e1s) k\u00edv\u00fcl van a k\u00f6rnyezeten vagy nincs defin\u00edci\u00f3ja! N\u00e9v = {0}"}, { WG_UNSUPPORTED_ENCODING, "Nem t\u00e1mogatott k\u00f3dol\u00e1s: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "hu"}, { "help_language", "hu"}, { "language", "hu"}, { "BAD_CODE", "A createMessage param\u00e9tere nincs a megfelel\u0151 tartom\u00e1nyban"}, { "FORMAT_FAILED", "Kiv\u00e9tel t\u00f6rt\u00e9nt a messageFormat h\u00edv\u00e1s alatt"}, { "version", ">>>>>>> Xalan verzi\u00f3 "}, { "version2", "<<<<<<<"}, { "yes", "igen"}, { "line", "Sor #"}, { "column", "Oszlop #"}, { "xsldone", "XSLProcessor: k\u00e9sz"}, { "xpath_option", "xpath opci\u00f3i: "}, { "optionIN", " [-in bemenetiXMLURL]"}, { "optionSelect", " [-select xpath kifejez\u00e9s]"}, { "optionMatch", " [-match illeszt\u00e9si minta (az illeszt\u00e9si diagnosztik\u00e1hoz)]"}, { "optionAnyExpr", "Vagy csak egy xpath kifejez\u00e9s megcsin\u00e1l egy diagnosztikai dump-ot"}, { "noParsermsg1", "Az XSL folyamat sikertelen volt."}, { "noParsermsg2", "** Az \u00e9rtelmez\u0151 nem tal\u00e1lhat\u00f3 **"}, { "noParsermsg3", "K\u00e9rem, ellen\u0151rizze az oszt\u00e1ly el\u00e9r\u00e9si utat."}, { "noParsermsg4", "Ha \u00f6nnek nincs meg az IBM Java XML \u00e9rtelmez\u0151je, akkor let\u00f6ltheti az"}, { "noParsermsg5", "IBM AlphaWorks weblapr\u00f3l: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Hiba: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Figyelmeztet\u00e9s: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "MINTA "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("hu", "HU")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_ca.java0000644000175000017500000012450710721374032025123 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_ca.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_ca extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "La funci\u00f3 current() no \u00e9s permesa en un patr\u00f3 de coincid\u00e8ncia." }, { ER_CURRENT_TAKES_NO_ARGS, "La funci\u00f3 current() no accepta arguments." }, { ER_DOCUMENT_REPLACED, "La implementaci\u00f3 de la funci\u00f3 document() s'ha substitu\u00eft per org.apache.xalan.xslt.FuncDocument."}, { ER_CONTEXT_HAS_NO_OWNERDOC, "El context no t\u00e9 un document de propietari."}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() t\u00e9 massa arguments."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() t\u00e9 massa arguments."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() t\u00e9 massa arguments."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() t\u00e9 massa arguments."}, { ER_NAME_HAS_TOO_MANY_ARGS, "name() t\u00e9 massa arguments."}, { ER_STRING_HAS_TOO_MANY_ARGS, "string() t\u00e9 massa arguments."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string-length() t\u00e9 massa arguments."}, { ER_TRANSLATE_TAKES_3_ARGS, "La funci\u00f3 translate() t\u00e9 tres arguments."}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "La funci\u00f3 unparsed-entity-uri ha de tenir un argument."}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "L'eix de l'espai de noms encara no s'ha implementat."}, { ER_UNKNOWN_AXIS, "Eix desconegut: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "Operaci\u00f3 de coincid\u00e8ncia desconeguda."}, { ER_INCORRECT_ARG_LENGTH, "La longitud de l'argument de la prova de node processing-instruction() no \u00e9s correcta."}, { ER_CANT_CONVERT_TO_NUMBER, "No es pot convertir {0} en un n\u00famero."}, { ER_CANT_CONVERT_TO_NODELIST, "No es pot convertir {0} en una NodeList."}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "No es pot convertir {0} en un NodeSetDTM."}, { ER_CANT_CONVERT_TO_TYPE, "No es pot convertir {0} en un tipus #{1}"}, { ER_EXPECTED_MATCH_PATTERN, "El patr\u00f3 de coincid\u00e8ncia de getMatchScore \u00e9s l'esperat."}, { ER_COULDNOT_GET_VAR_NAMED, "No s''ha pogut obtenir la variable {0}."}, { ER_UNKNOWN_OPCODE, "ERROR. Codi op desconegut: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "Senyals addicionals no permesos: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "Les cometes del literal s\u00f3n incorrectes. Hi ha d'haver cometes dobles."}, { ER_EXPECTED_SINGLE_QUOTE, "Les cometes del literal s\u00f3n incorrectes. Hi ha d'haver una cometa simple."}, { ER_EMPTY_EXPRESSION, "Expressi\u00f3 buida."}, { ER_EXPECTED_BUT_FOUND, "S''esperava {0}, per\u00f2 s''ha detectat {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "L''afirmaci\u00f3 del programador \u00e9s incorrecta. - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "L'argument boolean(...) ja no \u00e9s opcional amb l'esborrany d'XPath 19990709."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "S'ha trobat ',' per\u00f2 al davant no hi havia cap argument."}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "S'ha trobat ',' per\u00f2 al darrere no hi havia cap argument."}, { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predicate]' o '.[predicate]' no \u00e9s una sintaxi permesa. En comptes d'aix\u00f2, utilitzeu 'self::node()[predicate]'."}, { ER_ILLEGAL_AXIS_NAME, "Nom d''eix no perm\u00e8s: {0}"}, { ER_UNKNOWN_NODETYPE, "Tipus de node desconegut: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "El literal de patr\u00f3 ({0}) ha d''anar entre cometes."}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} no s''ha pogut formatar com a n\u00famero."}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "No s''ha pogut crear la relaci\u00f3 XML TransformerFactory: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Error. No s'ha trobat l'expressi\u00f3 select d'xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "ERROR. No s'ha trobat ENDOP despr\u00e9s d'OP_LOCATIONPATH."}, { ER_ERROR_OCCURED, "S'ha produ\u00eft un error."}, { ER_ILLEGAL_VARIABLE_REFERENCE, "S''ha donat VariableReference per a una variable fora de context o sense definici\u00f3. Nom = {0}"}, { ER_AXES_NOT_ALLOWED, "Nom\u00e9s es permeten els eixos subordinat:: i atribut:: en els patrons de coincid\u00e8ncia. Eixos incorrectes = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "key() t\u00e9 un nombre incorrecte d'arguments."}, { ER_COUNT_TAKES_1_ARG, "La funci\u00f3 count ha de tenir un argument."}, { ER_COULDNOT_FIND_FUNCTION, "No s''ha pogut trobar la funci\u00f3: {0}"}, { ER_UNSUPPORTED_ENCODING, "Codificaci\u00f3 sense suport: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "S'ha produ\u00eft un error en el DTM de getNextSibling. S'intentar\u00e0 solucionar."}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Error del programador: no es pot escriure a EmptyNodeList."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "XPathContext no d\u00f3na suport a setDOMFactory."}, { ER_PREFIX_MUST_RESOLVE, "El prefix s''ha de resoldre en un espai de noms: {0}"}, { ER_PARSE_NOT_SUPPORTED, "L''an\u00e0lisi (origen InputSource) no t\u00e9 suport a XPathContext. No es pot obrir {0}."}, { ER_SAX_API_NOT_HANDLED, "Els car\u00e0cters de l'API SAX (char ch[]... no es poden gestionar pel DTM."}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... no es poden gestionar pel DTM."}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison no pot gestionar nodes del tipus {0}."}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper no pot gestionar nodes del tipus {0}."}, { ER_XERCES_PARSE_ERROR_DETAILS, "Error de DOM2Helper.parse: ID del sistema - {0} l\u00ednia - {1}"}, { ER_XERCES_PARSE_ERROR, "Error de DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "S''ha detectat un suplent UTF-16 no v\u00e0lid: {0} ?"}, { ER_OIERROR, "Error d'E/S"}, { ER_CANNOT_CREATE_URL, "No es pot crear la URL de: {0}"}, { ER_XPATH_READOBJECT, "En XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "No s'ha trobat el senyal de funci\u00f3."}, { ER_CANNOT_DEAL_XPATH_TYPE, "No s''ha pogut tractar amb el tipus d''XPath: {0}"}, { ER_NODESET_NOT_MUTABLE, "Aquest NodeSet no \u00e9s mutable."}, { ER_NODESETDTM_NOT_MUTABLE, "Aquest NodeSetDTM no \u00e9s mutable."}, { ER_VAR_NOT_RESOLVABLE, "No es pot resoldre la variable: {0}"}, { ER_NULL_ERROR_HANDLER, "Manejador d'error nul"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Afirmaci\u00f3 del programador: opcode desconegut: {0}"}, { ER_ZERO_OR_ONE, "0 o 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() no t\u00e9 suport d'XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() no t\u00e9 suport d'XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() no t\u00e9 suport d'XRTreeFragSelectWrapper"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() no t\u00e9 suport d'XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() no t\u00e9 suport d'XRTreeFragSelectWrapper"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() no t\u00e9 suport d'XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() no t\u00e9 suport d'XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "No s''ha trobat la variable amb el nom de {0}"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars no pot agafar una cadena com a argument."}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "L'argument FastStringBuffer no pot ser nul."}, { ER_TWO_OR_THREE, "2 o 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "S'ha accedit a la variable abans que estigu\u00e9s vinculada."}, { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB no pot agafar una cadena com a argument."}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n Error. S'est\u00e0 establint l'arrel d'un itinerant en nul."}, { ER_NODESETDTM_CANNOT_ITERATE, "Aquest NodeSetDTM no es pot iterar en un node previ"}, { ER_NODESET_CANNOT_ITERATE, "Aquest NodeSet no es pot iterar en un node previ"}, { ER_NODESETDTM_CANNOT_INDEX, "Aquest NodeSetDTM no pot indexar ni efectuar funcions de recompte"}, { ER_NODESET_CANNOT_INDEX, "Aquest NodeSet no pot indexar ni efectuar funcions de recompte"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "No es pot cridar setShouldCacheNodes despr\u00e9s que s'hagi cridat nextNode"}, { ER_ONLY_ALLOWS, "{0} nom\u00e9s permet {1} arguments"}, { ER_UNKNOWN_STEP, "Afirmaci\u00f3 del programador a getNextStepPos: stepType desconegut: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "S'esperava una via d'acc\u00e9s relativa darrere del senyal '/' o '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "S''esperava una via d''acc\u00e9s d''ubicaci\u00f3, per\u00f2 s''ha trobat el senyal seg\u00fcent\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "S'esperava una via d'acc\u00e9s, per\u00f2 enlloc d'aix\u00f2 s'ha trobat el final de l'expressi\u00f3 XPath. "}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "S'esperava un pas d'ubicaci\u00f3 despr\u00e9s del senyal '/' o '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "S'esperava una prova de node que coincid\u00eds amb NCName:* o QName."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "S'esperava un patr\u00f3 de pas per\u00f2 s'ha trobat '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "S'esperava un patr\u00f3 de via d'acc\u00e9s relativa."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "L''expressi\u00f3 XPathResult d''XPath ''{0}'' t\u00e9 un XPathResultType de {1} que no es pot convertir a un cap valor boole\u00e0. "}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "L''expressi\u00f3 XPathResult d''XPath ''{0}'' t\u00e9 un XPathResultType de {1} que no es pot convertir a un node \u00fanic. El m\u00e8tode getSingleNodeValue s''aplica nom\u00e9s al tipus ANY_UNORDERED_NODE_TYPE i FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "El m\u00e8tode getSnapshotLength no es pot cridar a l''expressi\u00f3 XPathResult d''XPath ''{0}'' perqu\u00e8 el seu XPathResultType \u00e9s {1}. Aquest m\u00e8tode nom\u00e9s s''aplica als tipus UNORDERED_NODE_SNAPSHOT_TYPE i ORDERED_NODE_SNAPSHOT_TYPE."}, { ER_NON_ITERATOR_TYPE, "El m\u00e8tode iterateNext no es pot cridar a l''expressi\u00f3 XPathResult d''XPath ''{0}'' perqu\u00e8 el seu XPathResultType \u00e9s {1}. Aquest m\u00e8tode nom\u00e9s s''aplica als tipus UNORDERED_NODE_ITERATOR_TYPE i ORDERED_NODE_ITERATOR_TYPE."}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "El document s'ha modificat des que es van produir els resultats. L'iterador no \u00e9s v\u00e0lid."}, { ER_INVALID_XPATH_TYPE, "L''argument de tipus XPath no \u00e9s v\u00e0lid: {0}"}, { ER_EMPTY_XPATH_RESULT, "L'objecte de resultats XPath est\u00e0 buit."}, { ER_INCOMPATIBLE_TYPES, "L''expressi\u00f3 XPathResult d''XPath ''{0}'' t\u00e9 un XPathResultType de {1} que no es pot encaixar al XPathResultType especificat de {2}."}, { ER_NULL_RESOLVER, "No es pot resoldre el prefix amb un solucionador de prefix nul."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "L''expressi\u00f3 XPathResult d''XPath ''{0}'' t\u00e9 un XPathResultType de {1} que no es pot convertir a cap cadena. "}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "El m\u00e8tode snapshotItem no es pot cridar a l''expressi\u00f3 XPathResult d''XPath ''{0}'' perqu\u00e8 el seu XPathResultType \u00e9s {1}. Aquest m\u00e8tode nom\u00e9s s''aplica als tipus UNORDERED_NODE_SNAPSHOT_TYPE i ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "El node de context no pertany al document vinculat a aquest XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "El tipus de node de context no t\u00e9 suport."}, { ER_XPATH_ERROR, "S'ha produ\u00eft un error desconegut a XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "L''expressi\u00f3 XPathResult d''XPath ''{0}'' t\u00e9 un XPathResultType de {1} que no es pot convertir a cap n\u00famero "}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "Funci\u00f3 d''extensi\u00f3: no es pot invocar ''{0}'' si la caracter\u00edstica XMLConstants.FEATURE_SECURE_PROCESSING s''ha establert en true."}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable de la variable {0} torna el valor nul"}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "Tipus de retorn no suportat: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "El tipus de retorn o d'origen no pot ser nul"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "L''argument {0} no pot ser nul "}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "{0}#isObjectModelSupported( String objectModel) no es pot cridar amb objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "{0}#isObjectModelSupported( String objectModel ) no es pot cridar amb objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "Intent d''establir una caracter\u00edstica amb un nom nul: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "Intent d''establir una caracter\u00edstica desconeguda \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "Intent d''obtenir una caracter\u00edstica amb un nom nul: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "Intent d''obtenir la caracter\u00edstica desconeguda \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "S''ha intentat establir un XPathFunctionResolver nul:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "S''ha intentat establir un XPathVariableResolver null:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "No s'ha gestionat encara el nom d'entorn nacional en la funci\u00f3 format-number."}, { WG_PROPERTY_NOT_SUPPORTED, "La propietat XSL no t\u00e9 suport: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "No feu res ara mateix amb l''espai de noms {0} de la propietat: {1}"}, { WG_SECURITY_EXCEPTION, "S''ha produ\u00eft SecurityException en intentar accedir a la propietat de sistema XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "Sintaxi antiga: quo(...) ja no est\u00e0 definit a XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath necessita un objecte dedu\u00eft per implementar nodeTest."}, { WG_FUNCTION_TOKEN_NOT_FOUND, "No s'ha trobat el senyal de funci\u00f3."}, { WG_COULDNOT_FIND_FUNCTION, "No s''ha pogut trobar la funci\u00f3: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "No es pot crear la URL de: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "L'opci\u00f3 -E no t\u00e9 suport a l'analitzador de DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "S''ha donat VariableReference per a una variable fora de context o sense definici\u00f3. Nom = {0}"}, { WG_UNSUPPORTED_ENCODING, "Codificaci\u00f3 sense suport: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "ca"}, { "help_language", "ca"}, { "language", "ca"}, { "BAD_CODE", "El par\u00e0metre de createMessage estava fora dels l\u00edmits."}, { "FORMAT_FAILED", "S'ha generat una excepci\u00f3 durant la crida messageFormat."}, { "version", ">>>>>>> Versi\u00f3 Xalan "}, { "version2", "<<<<<<<"}, { "yes", "s\u00ed"}, { "line", "L\u00ednia n\u00fam."}, { "column", "Columna n\u00fam."}, { "xsldone", "XSLProcessor: fet"}, { "xpath_option", "Opcions d'xpath: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select expressi\u00f3 xpath]"}, { "optionMatch", " [-match patr\u00f3 coincid\u00e8ncia (per a diagn\u00f2stics de coincid\u00e8ncia)]"}, { "optionAnyExpr", "O nom\u00e9s una expressi\u00f3 xpath far\u00e0 un buidatge de diagn\u00f2stic."}, { "noParsermsg1", "El proc\u00e9s XSL no ha estat correcte."}, { "noParsermsg2", "** No s'ha trobat l'analitzador **"}, { "noParsermsg3", "Comproveu la vostra classpath."}, { "noParsermsg4", "Si no teniu XML Parser for Java d'IBM, el podeu baixar de l'indret web"}, { "noParsermsg5", "AlphaWorks d'IBM: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "#error"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Error: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Av\u00eds: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("ca", "ES")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_sv.java0000644000175000017500000010303510721374032025161 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_sv.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_sv extends XPATHErrorResources { /** Field MAX_CODE */ public static final int MAX_CODE = 108; // this is needed to keep track of the number of messages /** Field MAX_WARNING */ public static final int MAX_WARNING = 11; // this is needed to keep track of the number of warnings /** Field MAX_OTHERS */ public static final int MAX_OTHERS = 20; /** Field MAX_MESSAGES */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ /** Field ERROR0000 */ //public static final int ERROR0000 = 0; { "ERROR0000", "{0}"}, /** Field ER_CURRENT_NOT_ALLOWED_IN_MATCH */ //public static final int ER_CURRENT_NOT_ALLOWED_IN_MATCH = 1; { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "Funktionen current() \u00e4r inte till\u00e5ten i ett matchningsm\u00f6nster!"}, /** Field ER_CURRENT_TAKES_NO_ARGS */ //public static final int ER_CURRENT_TAKES_NO_ARGS = 2; { ER_CURRENT_TAKES_NO_ARGS, "Funktionen current() tar inte emot argument!"}, /** Field ER_DOCUMENT_REPLACED */ //public static final int ER_DOCUMENT_REPLACED = 3; { ER_DOCUMENT_REPLACED, "Implementeringen av funktionen document() har ersatts av org.apache.xalan.xslt.FuncDocument!"}, /** Field ER_CONTEXT_HAS_NO_OWNERDOC */ //public static final int ER_CONTEXT_HAS_NO_OWNERDOC = 4; { ER_CONTEXT_HAS_NO_OWNERDOC, "Kontext saknar \u00e4gardokument!"}, /** Field ER_LOCALNAME_HAS_TOO_MANY_ARGS */ //public static final int ER_LOCALNAME_HAS_TOO_MANY_ARGS = 5; { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "local-name() har f\u00f6r m\u00e5nga argument."}, /** Field ER_NAMESPACEURI_HAS_TOO_MANY_ARGS */ //public static final int ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = 6; { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "namespace-uri() har f\u00f6r m\u00e5nga argument."}, /** Field ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS */ //public static final int ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = 7; { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "normalize-space() har f\u00f6r m\u00e5nga argument."}, /** Field ER_NUMBER_HAS_TOO_MANY_ARGS */ //public static final int ER_NUMBER_HAS_TOO_MANY_ARGS = 8; { ER_NUMBER_HAS_TOO_MANY_ARGS, "number() har f\u00f6r m\u00e5nga argument."}, /** Field ER_NAME_HAS_TOO_MANY_ARGS */ //public static final int ER_NAME_HAS_TOO_MANY_ARGS = 9; { ER_NAME_HAS_TOO_MANY_ARGS, "name() har f\u00f6r m\u00e5nga argument."}, /** Field ER_STRING_HAS_TOO_MANY_ARGS */ //public static final int ER_STRING_HAS_TOO_MANY_ARGS = 10; { ER_STRING_HAS_TOO_MANY_ARGS, "string() har f\u00f6r m\u00e5nga argument."}, /** Field ER_STRINGLENGTH_HAS_TOO_MANY_ARGS */ //public static final int ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = 11; { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "string.length() har f\u00f6r m\u00e5nga argument."}, /** Field ER_TRANSLATE_TAKES_3_ARGS */ //public static final int ER_TRANSLATE_TAKES_3_ARGS = 12; { ER_TRANSLATE_TAKES_3_ARGS, "Funktionen translate() tar emot tre argument!"}, /** Field ER_UNPARSEDENTITYURI_TAKES_1_ARG */ //public static final int ER_UNPARSEDENTITYURI_TAKES_1_ARG = 13; { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "Funktionen unparsed-entity-uri borde ta emot ett argument!"}, /** Field ER_NAMESPACEAXIS_NOT_IMPLEMENTED */ //public static final int ER_NAMESPACEAXIS_NOT_IMPLEMENTED = 14; { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "Namespace-axel inte implementerad \u00e4n!"}, /** Field ER_UNKNOWN_AXIS */ //public static final int ER_UNKNOWN_AXIS = 15; { ER_UNKNOWN_AXIS, "ok\u00e4nd axel: {0}"}, /** Field ER_UNKNOWN_MATCH_OPERATION */ //public static final int ER_UNKNOWN_MATCH_OPERATION = 16; { ER_UNKNOWN_MATCH_OPERATION, "ok\u00e4nd matchningshandling!"}, /** Field ER_INCORRECT_ARG_LENGTH */ //public static final int ER_INCORRECT_ARG_LENGTH = 17; { ER_INCORRECT_ARG_LENGTH, "Nodtests argumentl\u00e4ngd i processing-instruction() \u00e4r inte korrekt!"}, /** Field ER_CANT_CONVERT_TO_NUMBER */ //public static final int ER_CANT_CONVERT_TO_NUMBER = 18; { ER_CANT_CONVERT_TO_NUMBER, "Kan inte konvertera {0} till ett nummer"}, /** Field ER_CANT_CONVERT_TO_NODELIST */ //public static final int ER_CANT_CONVERT_TO_NODELIST = 19; { ER_CANT_CONVERT_TO_NODELIST, "Kan inte konvertera {0} till en NodeList!"}, /** Field ER_CANT_CONVERT_TO_MUTABLENODELIST */ //public static final int ER_CANT_CONVERT_TO_MUTABLENODELIST = 20; { ER_CANT_CONVERT_TO_MUTABLENODELIST, "Kan inte konvertera {0} till en NodeSetDTM!"}, /** Field ER_CANT_CONVERT_TO_TYPE */ //public static final int ER_CANT_CONVERT_TO_TYPE = 21; { ER_CANT_CONVERT_TO_TYPE, "Kan inte konvertera {0} till en type//{1}"}, /** Field ER_EXPECTED_MATCH_PATTERN */ //public static final int ER_EXPECTED_MATCH_PATTERN = 22; { ER_EXPECTED_MATCH_PATTERN, "Matchningsm\u00f6nster i getMatchScore f\u00f6rv\u00e4ntat!"}, /** Field ER_COULDNOT_GET_VAR_NAMED */ //public static final int ER_COULDNOT_GET_VAR_NAMED = 23; { ER_COULDNOT_GET_VAR_NAMED, "Kunde inte h\u00e4mta variabeln {0}"}, /** Field ER_UNKNOWN_OPCODE */ //public static final int ER_UNKNOWN_OPCODE = 24; { ER_UNKNOWN_OPCODE, "FEL! Ok\u00e4nd op-kod: {0}"}, /** Field ER_EXTRA_ILLEGAL_TOKENS */ //public static final int ER_EXTRA_ILLEGAL_TOKENS = 25; { ER_EXTRA_ILLEGAL_TOKENS, "Ytterligare otill\u00e5tna tecken: {0}"}, /** Field ER_EXPECTED_DOUBLE_QUOTE */ //public static final int ER_EXPECTED_DOUBLE_QUOTE = 26; { ER_EXPECTED_DOUBLE_QUOTE, "Litteral omges av fel sorts citationstecken... dubbla citationstecken f\u00f6rv\u00e4ntade!"}, /** Field ER_EXPECTED_SINGLE_QUOTE */ //public static final int ER_EXPECTED_SINGLE_QUOTE = 27; { ER_EXPECTED_SINGLE_QUOTE, "Litteral omges av fel sorts citationstecken... enkla citationstecken f\u00f6rv\u00e4ntade!"}, /** Field ER_EMPTY_EXPRESSION */ //public static final int ER_EMPTY_EXPRESSION = 28; { ER_EMPTY_EXPRESSION, "Tomt uttryck!"}, /** Field ER_EXPECTED_BUT_FOUND */ //public static final int ER_EXPECTED_BUT_FOUND = 29; { ER_EXPECTED_BUT_FOUND, "{0} f\u00f6rv\u00e4ntat, men hittade: {1}"}, /** Field ER_INCORRECT_PROGRAMMER_ASSERTION */ //public static final int ER_INCORRECT_PROGRAMMER_ASSERTION = 30; { ER_INCORRECT_PROGRAMMER_ASSERTION, "Programmerares f\u00f6rs\u00e4kran \u00e4r inte korrekt! - {0}"}, /** Field ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL */ //public static final int ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = 31; { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "boolean(...)-argument \u00e4r inte l\u00e4ngre valfri med 19990709 XPath-utkast."}, /** Field ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG */ //public static final int ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = 32; { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "Hittade ',' men inget f\u00f6reg\u00e5ende argument!"}, /** Field ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG */ //public static final int ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = 33; { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "Hittade ',' men inget efterf\u00f6ljande argument!"}, /** Field ER_PREDICATE_ILLEGAL_SYNTAX */ //public static final int ER_PREDICATE_ILLEGAL_SYNTAX = 34; { ER_PREDICATE_ILLEGAL_SYNTAX, "'..[predikat]' or '.[predikat]' \u00e4r otill\u00e5ten syntax. Anv\u00e4nd 'self::node()[predikat]' ist\u00e4llet."}, /** Field ER_ILLEGAL_AXIS_NAME */ //public static final int ER_ILLEGAL_AXIS_NAME = 35; { ER_ILLEGAL_AXIS_NAME, "otill\u00e5tet axel-namn: {0}"}, /** Field ER_UNKNOWN_NODETYPE */ //public static final int ER_UNKNOWN_NODETYPE = 36; { ER_UNKNOWN_NODETYPE, "ok\u00e4nd nodtyp: {0}"}, /** Field ER_PATTERN_LITERAL_NEEDS_BE_QUOTED */ //public static final int ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = 37; { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "M\u00f6nsterlitteral {0} m\u00e5ste s\u00e4ttas inom citationstecken!"}, /** Field ER_COULDNOT_BE_FORMATTED_TO_NUMBER */ //public static final int ER_COULDNOT_BE_FORMATTED_TO_NUMBER = 38; { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} kunde inte formateras till ett nummer"}, /** Field ER_COULDNOT_CREATE_XMLPROCESSORLIAISON */ //public static final int ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = 39; { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "Kunde inte skapa XML TransformerFactory Liaison: {0}"}, /** Field ER_DIDNOT_FIND_XPATH_SELECT_EXP */ //public static final int ER_DIDNOT_FIND_XPATH_SELECT_EXP = 40; { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "Fel! Hittade inte xpath select-uttryck (-select)."}, /** Field ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH */ //public static final int ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = 41; { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "FEL! Hittade inte ENDOP efter OP_LOCATIONPATH"}, /** Field ER_ERROR_OCCURED */ //public static final int ER_ERROR_OCCURED = 42; { ER_ERROR_OCCURED, "Fel intr\u00e4ffade!"}, /** Field ER_ILLEGAL_VARIABLE_REFERENCE */ //public static final int ER_ILLEGAL_VARIABLE_REFERENCE = 43; { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference angiven f\u00f6r variabel som \u00e4r utanf\u00f6r sammanhanget eller som saknar definition! Namn = {0}"}, /** Field ER_AXES_NOT_ALLOWED */ //public static final int ER_AXES_NOT_ALLOWED = 44; { ER_AXES_NOT_ALLOWED, "Enbart barn::- och attribut::- axlar \u00e4r till\u00e5tna i matchningsm\u00f6nster! Regelvidriga axlar = {0}"}, /** Field ER_KEY_HAS_TOO_MANY_ARGS */ //public static final int ER_KEY_HAS_TOO_MANY_ARGS = 45; { ER_KEY_HAS_TOO_MANY_ARGS, "key() har ett felaktigt antal argument."}, /** Field ER_COUNT_TAKES_1_ARG */ //public static final int ER_COUNT_TAKES_1_ARG = 46; { ER_COUNT_TAKES_1_ARG, "Funktionen count borde ta emot ett argument!"}, /** Field ER_COULDNOT_FIND_FUNCTION */ //public static final int ER_COULDNOT_FIND_FUNCTION = 47; { ER_COULDNOT_FIND_FUNCTION, "Hittade inte funktionen: {0}"}, /** Field ER_UNSUPPORTED_ENCODING */ //public static final int ER_UNSUPPORTED_ENCODING = 48; { ER_UNSUPPORTED_ENCODING, "Ej underst\u00f6dd kodning: {0}"}, /** Field ER_PROBLEM_IN_DTM_NEXTSIBLING */ //public static final int ER_PROBLEM_IN_DTM_NEXTSIBLING = 49; { ER_PROBLEM_IN_DTM_NEXTSIBLING, "Problem intr\u00e4ffade i DTM i getNextSibling... f\u00f6rs\u00f6ker \u00e5terh\u00e4mta"}, /** Field ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL */ //public static final int ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = 50; { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "Programmerarfel: EmptyNodeList kan inte skrivas till."}, /** Field ER_SETDOMFACTORY_NOT_SUPPORTED */ //public static final int ER_SETDOMFACTORY_NOT_SUPPORTED = 51; { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory underst\u00f6ds inte av XPathContext!"}, /** Field ER_PREFIX_MUST_RESOLVE */ //public static final int ER_PREFIX_MUST_RESOLVE = 52; { ER_PREFIX_MUST_RESOLVE, "Prefix must resolve to a namespace: {0}"}, /** Field ER_PARSE_NOT_SUPPORTED */ //public static final int ER_PARSE_NOT_SUPPORTED = 53; { ER_PARSE_NOT_SUPPORTED, "parse (InputSource source) underst\u00f6ds inte av XPathContext! Kan inte \u00f6ppna {0}"}, /** Field ER_SAX_API_NOT_HANDLED */ //public static final int ER_SAX_API_NOT_HANDLED = 57; { ER_SAX_API_NOT_HANDLED, "SAX API-tecken(char ch[]... hanteras inte av DTM!"}, /** Field ER_IGNORABLE_WHITESPACE_NOT_HANDLED */ //public static final int ER_IGNORABLE_WHITESPACE_NOT_HANDLED = 58; { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... hanteras inte av DTM!"}, /** Field ER_DTM_CANNOT_HANDLE_NODES */ //public static final int ER_DTM_CANNOT_HANDLE_NODES = 59; { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison kan inte hantera noder av typen {0}"}, /** Field ER_XERCES_CANNOT_HANDLE_NODES */ //public static final int ER_XERCES_CANNOT_HANDLE_NODES = 60; { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper kan inte hantera noder av typen {0}"}, /** Field ER_XERCES_PARSE_ERROR_DETAILS */ //public static final int ER_XERCES_PARSE_ERROR_DETAILS = 61; { ER_XERCES_PARSE_ERROR_DETAILS, "DOM2Helper.parse-fel: SystemID - {0} rad - {1}"}, /** Field ER_XERCES_PARSE_ERROR */ //public static final int ER_XERCES_PARSE_ERROR = 62; { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse-fel"}, /** Field ER_INVALID_UTF16_SURROGATE */ //public static final int ER_INVALID_UTF16_SURROGATE = 65; { ER_INVALID_UTF16_SURROGATE, "Ogiltigt UTF-16-surrogat uppt\u00e4ckt: {0} ?"}, /** Field ER_OIERROR */ //public static final int ER_OIERROR = 66; { ER_OIERROR, "IO-fel"}, /** Field ER_CANNOT_CREATE_URL */ //public static final int ER_CANNOT_CREATE_URL = 67; { ER_CANNOT_CREATE_URL, "Kan inte skapa url f\u00f6r: {0}"}, /** Field ER_XPATH_READOBJECT */ //public static final int ER_XPATH_READOBJECT = 68; { ER_XPATH_READOBJECT, "I XPath.readObject: {0}"}, /** Field ER_XPATH_READOBJECT */ //public static final int ER_FUNCTION_TOKEN_NOT_FOUND = 69; { ER_FUNCTION_TOKEN_NOT_FOUND, "funktionstecken saknas."}, /** Can not deal with XPath type: */ //public static final int ER_CANNOT_DEAL_XPATH_TYPE = 71; { ER_CANNOT_DEAL_XPATH_TYPE, "Kan inte hantera XPath-typ: {0}"}, /** This NodeSet is not mutable */ //public static final int ER_NODESET_NOT_MUTABLE = 72; { ER_NODESET_NOT_MUTABLE, "NodeSet \u00e4r of\u00f6r\u00e4nderlig"}, /** This NodeSetDTM is not mutable */ //public static final int ER_NODESETDTM_NOT_MUTABLE = 73; { ER_NODESETDTM_NOT_MUTABLE, "NodeSetDTM \u00e4r of\u00f6r\u00e4nderlig"}, /** Variable not resolvable: */ //public static final int ER_VAR_NOT_RESOLVABLE = 74; { ER_VAR_NOT_RESOLVABLE, "Variabel ej l\u00f6sbar: {0}"}, /** Null error handler */ //public static final int ER_NULL_ERROR_HANDLER = 75; { ER_NULL_ERROR_HANDLER, "Null error handler"}, /** Programmer's assertion: unknown opcode */ //public static final int ER_PROG_ASSERT_UNKNOWN_OPCODE = 76; { ER_PROG_ASSERT_UNKNOWN_OPCODE, "Programmerares f\u00f6rs\u00e4kran: ok\u00e4nd op-kod: {0}"}, /** 0 or 1 */ //public static final int ER_ZERO_OR_ONE = 77; { ER_ZERO_OR_ONE, "0 eller 1"}, /** rtf() not supported by XRTreeFragSelectWrapper */ //public static final int ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = 78; { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() underst\u00f6ds inte av XRTreeFragSelectWrapper!"}, /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ //public static final int ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = 79; { ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() underst\u00f6ds inte av XRTreeFragSelectWrapper!"}, /** fsb() not supported for XStringForChars */ //public static final int ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = 80; { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() underst\u00f6ds inte av XRStringForChars!"}, /** Could not find variable with the name of */ //public static final int ER_COULD_NOT_FIND_VAR = 81; { ER_COULD_NOT_FIND_VAR, "Hittade inte variabeln med namn {0}"}, /** XStringForChars can not take a string for an argument */ //public static final int ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = 82; { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "XStringForChars kan inte ta en str\u00e4ng som argument"}, /** The FastStringBuffer argument can not be null */ //public static final int ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = 83; { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "FastStringBuffer-argumentet f\u00e5r inte vara null"}, /* MANTIS_XALAN CHANGE: BEGIN */ /** 2 or 3 */ //public static final int ER_TWO_OR_THREE = 84; { ER_TWO_OR_THREE, "2 eller 3"}, /** Variable accessed before it is bound! */ //public static final int ER_VARIABLE_ACCESSED_BEFORE_BIND = 85; { ER_VARIABLE_ACCESSED_BEFORE_BIND, "Variabeln anv\u00e4ndes innan den bands!"}, /** XStringForFSB can not take a string for an argument! */ //public static final int ER_FSB_CANNOT_TAKE_STRING = 86; { ER_FSB_CANNOT_TAKE_STRING, "XStringForFSB kan inte ha en str\u00e4ng som argument!"}, /** Error! Setting the root of a walker to null! */ //public static final int ER_SETTING_WALKER_ROOT_TO_NULL = 87; { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! Fel! Anger roten f\u00f6r en \"walker\" till null!!!"}, /** This NodeSetDTM can not iterate to a previous node! */ //public static final int ER_NODESETDTM_CANNOT_ITERATE = 88; { ER_NODESETDTM_CANNOT_ITERATE, "Detta NodeSetDTM kan inte iterera till en tidigare nod!"}, /** This NodeSet can not iterate to a previous node! */ //public static final int ER_NODESET_CANNOT_ITERATE = 89; { ER_NODESET_CANNOT_ITERATE, "Detta NodeSet kan inte iterera till en tidigare nod!"}, /** This NodeSetDTM can not do indexing or counting functions! */ //public static final int ER_NODESETDTM_CANNOT_INDEX = 90; { ER_NODESETDTM_CANNOT_INDEX, "Detta NodeSetDTM har inte funktioner f\u00f6r indexering och r\u00e4kning!"}, /** This NodeSet can not do indexing or counting functions! */ //public static final int ER_NODESET_CANNOT_INDEX = 91; { ER_NODESET_CANNOT_INDEX, "Detta NodeSet har inte funktioner f\u00f6r indexering och r\u00e4kning!"}, /** Can not call setShouldCacheNodes after nextNode has been called! */ //public static final int ER_CANNOT_CALL_SETSHOULDCACHENODE = 92; { ER_CANNOT_CALL_SETSHOULDCACHENODE, "Det g\u00e5r inte att anropa setShouldCacheNodes efter att nextNode har anropats!"}, /** {0} only allows {1} arguments */ //public static final int ER_ONLY_ALLOWS = 93; { ER_ONLY_ALLOWS, "{0} till\u00e5ter bara {1} argument"}, /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ //public static final int ER_UNKNOWN_STEP = 94; { ER_UNKNOWN_STEP, "Programmerarkontroll i getNextStepPos: ok\u00e4nt steg Typ: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. /** Problem with RelativeLocationPath */ //public static final int ER_EXPECTED_REL_LOC_PATH = 95; { ER_EXPECTED_REL_LOC_PATH, "En relativ s\u00f6kv\u00e4g f\u00f6rv\u00e4ntades efter token '/' eller '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. /** Problem with LocationPath */ //public static final int ER_EXPECTED_LOC_PATH = 96; { ER_EXPECTED_LOC_PATH, "En plats f\u00f6rv\u00e4ntades, men f\u00f6ljande token p\u00e5tr\u00e4ffades\u003a {0}"}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. /** Problem with Step */ //public static final int ER_EXPECTED_LOC_STEP = 97; { ER_EXPECTED_LOC_STEP, "Ett platssteg f\u00f6rv\u00e4ntades efter token '/' eller '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. /** Problem with NodeTest */ //public static final int ER_EXPECTED_NODE_TEST = 98; { ER_EXPECTED_NODE_TEST, "Ett nodtest som matchar antingen NCName:* eller QName f\u00f6rv\u00e4ntades."}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. /** Expected step pattern */ //public static final int ER_EXPECTED_STEP_PATTERN = 99; { ER_EXPECTED_STEP_PATTERN, "Ett stegm\u00f6nster f\u00f6rv\u00e4ntades, men '/' p\u00e5tr\u00e4ffades."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. /** Expected relative path pattern */ //public static final int ER_EXPECTED_REL_PATH_PATTERN = 100; { ER_EXPECTED_REL_PATH_PATTERN, "Ett m\u00f6nster f\u00f6r relativ s\u00f6kv\u00e4g f\u00f6rv\u00e4ntades."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. /** Field ER_CANT_CONVERT_TO_BOOLEAN */ //public static final int ER_CANT_CONVERT_TO_BOOLEAN = 103; { ER_CANT_CONVERT_TO_BOOLEAN, "Det g\u00e5r inte att konvertera {0} till ett Booleskt v\u00e4rde."}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. /** Field ER_CANT_CONVERT_TO_SINGLENODE */ //public static final int ER_CANT_CONVERT_TO_SINGLENODE = 104; { ER_CANT_CONVERT_TO_SINGLENODE, "Det g\u00e5r inte att konvertera {0} till en enda nod. G\u00e4ller typerna ANY_UNORDERED_NODE_TYPE och FIRST_ORDERED_NODE_TYPE."}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ //public static final int ER_CANT_GET_SNAPSHOT_LENGTH = 105; { ER_CANT_GET_SNAPSHOT_LENGTH, "Det g\u00e5r inte att erh\u00e5lla l\u00e4ngd f\u00f6r \u00f6gonblicksbild p\u00e5 typ: {0}. G\u00e4ller typerna UNORDERED_NODE_SNAPSHOT_TYPE och ORDERED_NODE_SNAPSHOT_TYPE."}, /** Field ER_NON_ITERATOR_TYPE */ //public static final int ER_NON_ITERATOR_TYPE = 106; { ER_NON_ITERATOR_TYPE, "Det g\u00e5r inte att iterera \u00f6ver den icke itererbara typen: {0}"}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. /** Field ER_DOC_MUTATED */ //public static final int ER_DOC_MUTATED = 107; { ER_DOC_MUTATED, "Dokumentet har \u00e4ndrats sedan resultatet genererades. Iterering ogiltig."}, /** Field ER_INVALID_XPATH_TYPE */ //public static final int ER_INVALID_XPATH_TYPE = 108; { ER_INVALID_XPATH_TYPE, "Ogiltigt XPath-typargument: {0}"}, /** Field ER_EMPTY_XPATH_RESULT */ //public static final int ER_EMPTY_XPATH_RESULT = 109; { ER_EMPTY_XPATH_RESULT, "Tomt XPath-resultatobjekt"}, /** Field ER_INCOMPATIBLE_TYPES */ //public static final int ER_INCOMPATIBLE_TYPES = 110; { ER_INCOMPATIBLE_TYPES, "Den genererade typen: {0} kan inte bearbetas i den angivna typen: {1}"}, /** Field ER_NULL_RESOLVER */ //public static final int ER_NULL_RESOLVER = 111; { ER_NULL_RESOLVER, "Det g\u00e5r inte att l\u00f6sa prefixet utan prefixl\u00f6sare."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. /** Field ER_CANT_CONVERT_TO_STRING */ //public static final int ER_CANT_CONVERT_TO_STRING = 112; { ER_CANT_CONVERT_TO_STRING, "Det g\u00e5r inte att konvertera {0} till en str\u00e4ng."}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. /** Field ER_NON_SNAPSHOT_TYPE */ //public static final int ER_NON_SNAPSHOT_TYPE = 113; { ER_NON_SNAPSHOT_TYPE, "Det g\u00e5r inte att anropa snapshotItem p\u00e5 typ: {0}. Metoden g\u00e4ller typerna UNORDERED_NODE_SNAPSHOT_TYPE och ORDERED_NODE_SNAPSHOT_TYPE."}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. /** Field ER_WRONG_DOCUMENT */ //public static final int ER_WRONG_DOCUMENT = 114; { ER_WRONG_DOCUMENT, "Kontextnoden tillh\u00f6r inte dokumentet som \u00e4r bundet till denna XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. /** Field ER_WRONG_NODETYPE */ //public static final int ER_WRONG_NODETYPE = 115; { ER_WRONG_NODETYPE , "Kontextnoden kan inte hanteras."}, /** Field ER_XPATH_ERROR */ //public static final int ER_XPATH_ERROR = 116; { ER_XPATH_ERROR , "Ok\u00e4nt fel i XPath."}, // Warnings... /** Field WG_LOCALE_NAME_NOT_HANDLED */ //public static final int WG_LOCALE_NAME_NOT_HANDLED = 1; { WG_LOCALE_NAME_NOT_HANDLED, "locale-namnet i format-number-funktionen \u00e4nnu inte hanterat!"}, /** Field WG_PROPERTY_NOT_SUPPORTED */ //public static final int WG_PROPERTY_NOT_SUPPORTED = 2; { WG_PROPERTY_NOT_SUPPORTED, "XSL-Egenskap underst\u00f6ds inte: {0}"}, /** Field WG_DONT_DO_ANYTHING_WITH_NS */ //public static final int WG_DONT_DO_ANYTHING_WITH_NS = 3; { WG_DONT_DO_ANYTHING_WITH_NS, "G\u00f6r f\u00f6r n\u00e4rvarande inte n\u00e5gonting med namespace {0} i egenskap: {1}"}, /** Field WG_SECURITY_EXCEPTION */ //public static final int WG_SECURITY_EXCEPTION = 4; { WG_SECURITY_EXCEPTION, "SecurityException vid f\u00f6rs\u00f6k att f\u00e5 tillg\u00e5ng till XSL-systemegenskap: {0}"}, /** Field WG_QUO_NO_LONGER_DEFINED */ //public static final int WG_QUO_NO_LONGER_DEFINED = 5; { WG_QUO_NO_LONGER_DEFINED, "Gammal syntax: quo(...) \u00e4r inte l\u00e4ngre definierad i XPath."}, /** Field WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST */ //public static final int WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = 6; { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "XPath beh\u00f6ver ett deriverat objekt f\u00f6r att implementera nodeTest!"}, /** Field WG_FUNCTION_TOKEN_NOT_FOUND */ //public static final int WG_FUNCTION_TOKEN_NOT_FOUND = 7; { WG_FUNCTION_TOKEN_NOT_FOUND, "funktionstecken saknas."}, /** Field WG_COULDNOT_FIND_FUNCTION */ //public static final int WG_COULDNOT_FIND_FUNCTION = 8; { WG_COULDNOT_FIND_FUNCTION, "Hittade inte funktion: {0}"}, /** Field WG_CANNOT_MAKE_URL_FROM */ //public static final int WG_CANNOT_MAKE_URL_FROM = 9; { WG_CANNOT_MAKE_URL_FROM, "Kan inte skapa URL fr\u00e5n: {0}"}, /** Field WG_EXPAND_ENTITIES_NOT_SUPPORTED */ //public static final int WG_EXPAND_ENTITIES_NOT_SUPPORTED = 10; { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "Alternativet -E underst\u00f6ds inte f\u00f6r DTM-tolk"}, /** Field WG_ILLEGAL_VARIABLE_REFERENCE */ //public static final int WG_ILLEGAL_VARIABLE_REFERENCE = 11; { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference angiven f\u00f6r variabel som \u00e4r utanf\u00f6r sammanhanget eller som saknar definition! Namn = {0}"}, /** Field WG_UNSUPPORTED_ENCODING */ //public static final int WG_UNSUPPORTED_ENCODING = 12; { WG_UNSUPPORTED_ENCODING, "Ej underst\u00f6dd kodning: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "sv"}, { "help_language", "sv"}, { "language", "sv"}, { "BAD_CODE", "Parameter till createMessage ligger utanf\u00f6r till\u00e5tet intervall"}, { "FORMAT_FAILED", "Undantag utl\u00f6st vid messageFormat-anrop"}, { "version", ">>>>>>> Xalan Version"}, { "version2", "<<<<<<<"}, { "yes", "ja"}, { "line", "Rad //"}, { "column", "Kolumn //"}, { "xsldone", "XSLProcessor f\u00e4rdig"}, { "xpath_option", "xpath-alternativ"}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", "[-select xpath-uttryck]"}, { "optionMatch", " [-match matchningsm\u00f6nster (f\u00f6r matchningsdiagnostik)]"}, { "optionAnyExpr", "Eller bara ett xpath-uttryck kommer att g\u00f6ra en diagnostik-dump"}, { "noParsermsg1", "XSL-Process misslyckades."}, { "noParsermsg2", "** Hittade inte tolk **"}, { "noParsermsg3", "V\u00e4nligen kontrollera din classpath"}, { "noParsermsg4", "Om du inte har IBMs XML-Tolk f\u00f6r Java, kan du ladda ner den fr\u00e5n"}, { "noParsermsg5", "IBMs AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"} }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "D\u00c5LIG_KOD"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILDE = "FORMATTERING_MISSLYCKADES"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "//fel"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "Fel: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "Varning: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "M\u00d6NSTER "; } libxalan2-java-2.7.1/src/org/apache/xpath/res/XPATHErrorResources_ru.java0000644000175000017500000020242710721374033025165 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPATHErrorResources_ru.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a Static string constant for the * Key and update the contents array with Key, Value pair * Also you need to update the count of messages(MAX_CODE)or * the count of warnings(MAX_WARNING) [ Information purpose only] * @xsl.usage advanced */ public class XPATHErrorResources_ru extends ListResourceBundle { /* * General notes to translators: * * This file contains error and warning messages related to XPath Error * Handling. * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 8) The context node is the node in the document with respect to which an * XPath expression is being evaluated. * * 9) An iterator is an object that traverses nodes in the tree, one at a time. * * 10) NCName is an XML term used to describe a name that does not contain a * colon (a "no-colon name"). * * 11) QName is an XML term meaning "qualified name". */ /* * static variables */ public static final String ERROR0000 = "ERROR0000"; public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH"; public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS"; public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED"; public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC"; public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS"; public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS"; public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS"; public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS"; public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS"; public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS"; public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS"; public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS"; public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG"; public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED"; public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS"; public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION"; public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH"; public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER"; public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER"; public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST"; public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST"; public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE"; public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN"; public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED"; public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE"; public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS"; public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE"; public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE"; public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION"; public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND"; public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION"; public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL"; public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG"; public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG"; public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX"; public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME"; public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE"; public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED"; public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER"; public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON"; public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP"; public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH"; public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED"; public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE"; public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED"; public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS"; public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG"; public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION"; public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING"; public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING"; public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL"; public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED"; public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED"; public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED"; public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES"; public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS"; public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL"; public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT"; public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND"; public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE"; public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE"; public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE"; /** Variable not resolvable: */ public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE"; /** Null error handler */ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; /** Programmer's assertion: unknown opcode */ public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE"; /** 0 or 1 */ public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE"; /** rtf() not supported by XRTreeFragSelectWrapper */ public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** asNodeIterator() not supported by XRTreeFragSelectWrapper */ public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** fsb() not supported for XStringForChars */ public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS"; /** Could not find variable with the name of */ public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR"; /** XStringForChars can not take a string for an argument */ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING"; /** The FastStringBuffer argument can not be null */ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL"; /** 2 or 3 */ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; /** Variable accessed before it is bound! */ public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND"; /** XStringForFSB can not take a string for an argument! */ public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING"; /** Error! Setting the root of a walker to null! */ public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL"; /** This NodeSetDTM can not iterate to a previous node! */ public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE"; /** This NodeSet can not iterate to a previous node! */ public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE"; /** This NodeSetDTM can not do indexing or counting functions! */ public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX"; /** This NodeSet can not do indexing or counting functions! */ public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX"; /** Can not call setShouldCacheNodes after nextNode has been called! */ public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE"; /** {0} only allows {1} arguments */ public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS"; /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */ public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP"; /** Problem with RelativeLocationPath */ public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH"; /** Problem with LocationPath */ public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH"; public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR"; /** Problem with Step */ public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP"; /** Problem with NodeTest */ public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST"; /** Expected step pattern */ public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN"; /** Expected relative path pattern */ public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN"; /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */ public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN"; /** Field ER_CANT_CONVERT_TO_SINGLENODE */ public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE"; /** Field ER_CANT_GET_SNAPSHOT_LENGTH */ public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH"; /** Field ER_NON_ITERATOR_TYPE */ public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE"; /** Field ER_DOC_MUTATED */ public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED"; public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE"; public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT"; public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES"; public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER"; public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING"; public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE"; public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT"; /* Note to translators: The XPath expression cannot be evaluated with respect * to this type of node. */ /** Field ER_WRONG_NODETYPE */ public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE"; public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR"; //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED"; public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL"; public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE"; public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL"; public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL"; public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL"; public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY"; public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL"; public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN"; public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE"; public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE"; public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER"; public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER"; //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED"; public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED"; public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS"; public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION"; public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED"; public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST"; public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND"; public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED"; public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE"; public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING"; /** detach() not supported by XRTreeFragSelectWrapper */ public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** num() not supported by XRTreeFragSelectWrapper */ public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** xstr() not supported by XRTreeFragSelectWrapper */ public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; /** str() not supported by XRTreeFragSelectWrapper */ public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER"; // Error messages... /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][]{ { "ERROR0000" , "{0}" }, { ER_CURRENT_NOT_ALLOWED_IN_MATCH, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f current() \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f!" }, { ER_CURRENT_TAKES_NO_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 current() \u043d\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432!" }, { ER_DOCUMENT_REPLACED, "\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 document() \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u0430 \u043d\u0430 org.apache.xalan.xslt.FuncDocument!"}, { ER_CONTEXT_HAS_NO_OWNERDOC, "\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442-\u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446!"}, { ER_LOCALNAME_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 local-name() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 namespace-uri() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 normalize-space() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_NUMBER_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 number() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_NAME_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 name() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_STRING_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 string() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 string-length() \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_TRANSLATE_TAKES_3_ARGS, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 translate() \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u0440\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430!"}, { ER_UNPARSEDENTITYURI_TAKES_1_ARG, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 unparsed-entity-uri \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442!"}, { ER_NAMESPACEAXIS_NOT_IMPLEMENTED, "\u041e\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0435\u0449\u0435 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430!"}, { ER_UNKNOWN_AXIS, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u0441\u044c: {0}"}, { ER_UNKNOWN_MATCH_OPERATION, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f!"}, { ER_INCORRECT_ARG_LENGTH, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0443\u0437\u043b\u0430 processing-instruction()!"}, { ER_CANT_CONVERT_TO_NUMBER, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c {0} \u0432 \u0447\u0438\u0441\u043b\u043e"}, { ER_CANT_CONVERT_TO_NODELIST, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c {0} \u0432 NodeList!"}, { ER_CANT_CONVERT_TO_MUTABLENODELIST, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c {0} \u0432 NodeSetDTM!"}, { ER_CANT_CONVERT_TO_TYPE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c {0} \u0432 \u0442\u0438\u043f#{1}"}, { ER_EXPECTED_MATCH_PATTERN, "\u0412 getMatchScore \u043e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f!"}, { ER_COULDNOT_GET_VAR_NAMED, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e {0}"}, { ER_UNKNOWN_OPCODE, "\u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: {0}"}, { ER_EXTRA_ILLEGAL_TOKENS, "\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b: {0}"}, { ER_EXPECTED_DOUBLE_QUOTE, "\u041b\u0438\u0442\u0435\u0440\u0430\u043b \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438... \u041e\u0436\u0438\u0434\u0430\u043b\u0438\u0441\u044c \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438!"}, { ER_EXPECTED_SINGLE_QUOTE, "\u041b\u0438\u0442\u0435\u0440\u0430\u043b \u043d\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438... \u041e\u0436\u0438\u0434\u0430\u043b\u0438\u0441\u044c \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438!"}, { ER_EMPTY_EXPRESSION, "\u041f\u0443\u0441\u0442\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435!"}, { ER_EXPECTED_BUT_FOUND, "\u041e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c {0}, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e: {1}"}, { ER_INCORRECT_PROGRAMMER_ASSERTION, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435! - {0}"}, { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, "\u0412 19990709 XPath \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 boolean(...) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c."}, { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0437\u0430\u043f\u044f\u0442\u0430\u044f ',' \u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0435\u0439 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442!"}, { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0437\u0430\u043f\u044f\u0442\u0430\u044f ',' \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442!"}, { ER_PREDICATE_ILLEGAL_SYNTAX, "\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 '..[\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442]' \u0438\u043b\u0438 '.[\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442]' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 'self::node()[\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442]'."}, { ER_ILLEGAL_AXIS_NAME, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0438\u043c\u044f \u043e\u0441\u0438: {0}"}, { ER_UNKNOWN_NODETYPE, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0443\u0437\u043b\u0430: {0}"}, { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, "\u0412 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b ({0}) \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438!"}, { ER_COULDNOT_BE_FORMATTED_TO_NUMBER, "{0} \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e!"}, { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c XML TransformerFactory Liaison: {0}"}, { ER_DIDNOT_FIND_XPATH_SELECT_EXP, "\u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 xpath (-select)."}, { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH, "\u041e\u0448\u0438\u0431\u043a\u0430! \u041f\u043e\u0441\u043b\u0435 OP_LOCATIONPATH \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 ENDOP"}, { ER_ERROR_OCCURED, "\u041e\u0448\u0438\u0431\u043a\u0430!"}, { ER_ILLEGAL_VARIABLE_REFERENCE, "VariableReference \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u043d \u0432\u043d\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u043b\u0438 \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f! \u0418\u043c\u044f = {0}"}, { ER_AXES_NOT_ALLOWED, "\u0412 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u0438 child:: \u0438 attribute::! \u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043e\u0441\u0438 = {0}"}, { ER_KEY_HAS_TOO_MANY_ARGS, "\u0412 key() \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432."}, { ER_COUNT_TAKES_1_ARG, "\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 count \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442!"}, { ER_COULDNOT_FIND_FUNCTION, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430: {0}"}, { ER_UNSUPPORTED_ENCODING, "\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430: {0}"}, { ER_PROBLEM_IN_DTM_NEXTSIBLING, "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 DTM \u0432 getNextSibling... \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f"}, { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL, "\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: \u0437\u0430\u043f\u0438\u0441\u044c \u0432 EmptyNodeList \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430."}, { ER_SETDOMFACTORY_NOT_SUPPORTED, "setDOMFactory \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XPathContext!"}, { ER_PREFIX_MUST_RESOLVE, "\u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d: {0}"}, { ER_PARSE_NOT_SUPPORTED, "\u0410\u043d\u0430\u043b\u0438\u0437 \u0441 (InputSource \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a) \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 XPathContext! \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044c {0}"}, { ER_SAX_API_NOT_HANDLED, "SAX API characters(char ch[]... \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d DTM!"}, { ER_IGNORABLE_WHITESPACE_NOT_HANDLED, "ignorableWhitespace(char ch[]... \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d DTM!"}, { ER_DTM_CANNOT_HANDLE_NODES, "DTMLiaison \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0443\u0437\u043b\u044b \u0442\u0438\u043f\u0430 {0}"}, { ER_XERCES_CANNOT_HANDLE_NODES, "DOM2Helper \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0443\u0437\u043b\u044b \u0442\u0438\u043f\u0430 {0}"}, { ER_XERCES_PARSE_ERROR_DETAILS, "\u041e\u0448\u0438\u0431\u043a\u0430 DOM2Helper.parse: SystemID - {0} \u0441\u0442\u0440\u043e\u043a\u0430 - {1}"}, { ER_XERCES_PARSE_ERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 DOM2Helper.parse"}, { ER_INVALID_UTF16_SURROGATE, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 UTF-16: {0} ?"}, { ER_OIERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430"}, { ER_CANNOT_CREATE_URL, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c URL \u0434\u043b\u044f {0}"}, { ER_XPATH_READOBJECT, "\u0412 XPath.readObject: {0}"}, { ER_FUNCTION_TOKEN_NOT_FOUND, "\u041c\u0430\u0440\u043a\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d."}, { ER_CANNOT_DEAL_XPATH_TYPE, "\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u0438\u043f\u043e\u043c XPath \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430: {0}"}, { ER_NODESET_NOT_MUTABLE, "\u0414\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 NodeSet \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c"}, { ER_NODESETDTM_NOT_MUTABLE, "\u0414\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 NodeSetDTM \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c"}, { ER_VAR_NOT_RESOLVABLE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e: {0}"}, { ER_NULL_ERROR_HANDLER, "\u041f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043a\u0438"}, { ER_PROG_ASSERT_UNKNOWN_OPCODE, "\u0417\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430: \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0446\u0438\u0438: {0}"}, { ER_ZERO_OR_ONE, "0 \u0438\u043b\u0438 1"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "rtf() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XRTreeFragSelectWrapper"}, { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "asNodeIterator() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XRTreeFragSelectWrapper"}, { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "detach() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 XRTreeFragSelectWrapper"}, { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "num() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 XRTreeFragSelectWrapper"}, { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "xstr() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 XRTreeFragSelectWrapper"}, { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, "str() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 XRTreeFragSelectWrapper"}, { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, "fsb() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XStringForChars"}, { ER_COULD_NOT_FIND_VAR, "\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f {0} \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430"}, { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 XStringForChars \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439"}, { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 FastStringBuffer \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_TWO_OR_THREE, "2 \u0438\u043b\u0438 3"}, { ER_VARIABLE_ACCESSED_BEFORE_BIND, "\u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043e \u0435\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f!"}, { ER_FSB_CANNOT_TAKE_STRING, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 XStringForFSB \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439!"}, { ER_SETTING_WALKER_ROOT_TO_NULL, "\n !!!! \u041e\u0448\u0438\u0431\u043a\u0430! \u041a\u043e\u0440\u043d\u0435\u0432\u043e\u043c\u0443 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 walker \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u043f\u0443\u0441\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435!!!"}, { ER_NODESETDTM_CANNOT_ITERATE, "\u0414\u0430\u043d\u043d\u044b\u0439 NodeSetDTM \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0443\u0437\u043b\u043e\u043c!"}, { ER_NODESET_CANNOT_ITERATE, "\u0414\u0430\u043d\u043d\u044b\u0439 NodeSet \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0443\u0437\u043b\u043e\u043c!"}, { ER_NODESETDTM_CANNOT_INDEX, "\u0414\u0430\u043d\u043d\u044b\u0439 NodeSetDTM \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430!"}, { ER_NODESET_CANNOT_INDEX, "\u0414\u0430\u043d\u043d\u044b\u0439 NodeSet \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430!"}, { ER_CANNOT_CALL_SETSHOULDCACHENODE, "\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c setShouldCacheNodes \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 nextNode!"}, { ER_ONLY_ALLOWS, "\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 {0} \u0440\u0430\u0432\u043d\u043e {1}"}, { ER_UNKNOWN_STEP, "\u0417\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u0432 getNextStepPos: \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 stepType: {0}"}, //Note to translators: A relative location path is a form of XPath expression. // The message indicates that such an expression was expected following the // characters '/' or '//', but was not found. { ER_EXPECTED_REL_LOC_PATH, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u043a\u0435\u0440 '/' \u0438\u043b\u0438 '//'."}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such an expression was expected,but // the characters specified by the substitution text were encountered instead. { ER_EXPECTED_LOC_PATH, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u043f\u0443\u0442\u044c, \u043e\u0434\u043d\u0430\u043a\u043e \u0431\u044b\u043b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0440\u043a\u0435\u0440\u003a {0}"}, // Note to translators: A location path is a form of XPath expression. // The message indicates that syntactically such a subexpression was expected, // but no more characters were found in the expression. { ER_EXPECTED_LOC_PATH_AT_END_EXPR, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u043f\u0443\u0442\u044c \u043a \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0435\u0446 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath. "}, // Note to translators: A location step is part of an XPath expression. // The message indicates that syntactically such an expression was expected // following the specified characters. { ER_EXPECTED_LOC_STEP, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u0448\u0430\u0433 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u043a\u0435\u0440 '/' \u0438\u043b\u0438 '//'."}, // Note to translators: A node test is part of an XPath expression that is // used to test for particular kinds of nodes. In this case, a node test that // consists of an NCName followed by a colon and an asterisk or that consists // of a QName was expected, but was not found. { ER_EXPECTED_NODE_TEST, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u0442\u0435\u0441\u0442 \u0443\u0437\u043b\u0430, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0441 NCName:* \u0438\u043b\u0438 QName. "}, // Note to translators: A step pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but the specified character was found in the expression instead. { ER_EXPECTED_STEP_PATTERN, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0448\u0430\u0433\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u0431\u044b\u043b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d '/'."}, // Note to translators: A relative path pattern is part of an XPath expression. // The message indicates that syntactically such an expression was expected, // but was not found. { ER_EXPECTED_REL_PATH_PATTERN, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type boolean. { ER_CANT_CONVERT_TO_BOOLEAN, "\u0412 XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'' \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 XPathResultType \u0440\u0430\u0432\u043d\u043e {1}, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u043b\u0435\u0432\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. "}, // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and // FIRST_ORDERED_NODE_TYPE. { ER_CANT_CONVERT_TO_SINGLENODE, "\u0412 XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'' \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 XPathResultType \u0440\u0430\u0432\u043d\u043e {1}, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0443\u0437\u0435\u043b. \u041c\u0435\u0442\u043e\u0434 getSingleNodeValue \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0442\u0438\u043f\u0430\u043c ANY_UNORDERED_NODE_TYPE \u0438 FIRST_ORDERED_NODE_TYPE. "}, // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and // ORDERED_NODE_SNAPSHOT_TYPE. { ER_CANT_GET_SNAPSHOT_LENGTH, "\u041c\u0435\u0442\u043e\u0434 getSnapshotLength \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0434\u043b\u044f XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'', \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0433\u043e XPathResultType \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f {1}. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0442\u0438\u043f\u0430\u043c UNORDERED_NODE_SNAPSHOT_TYPE \u0438 ORDERED_NODE_SNAPSHOT_TYPE. "}, { ER_NON_ITERATOR_TYPE, "\u041c\u0435\u0442\u043e\u0434 iterateNext \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0434\u043b\u044f XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'', \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0433\u043e XPathResultType \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f {1}. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0442\u0438\u043f\u0430\u043c UNORDERED_NODE_ITERATOR_TYPE \u0438 ORDERED_NODE_ITERATOR_TYPE. "}, // Note to translators: This message indicates that the document being operated // upon changed, so the iterator object that was being used to traverse the // document has now become invalid. { ER_DOC_MUTATED, "\u0421 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d. \u0418\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c."}, { ER_INVALID_XPATH_TYPE, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 XPath: {0}"}, { ER_EMPTY_XPATH_RESULT, "\u041f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 XPath"}, { ER_INCOMPATIBLE_TYPES, "XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'' \u0438\u043c\u0435\u0435\u0442 XPathResultType {1}, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 XPathResultType {2}. "}, { ER_NULL_RESOLVER, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f."}, // Note to translators: The substitution text is the name of a data type. The // message indicates that a value of a particular type could not be converted // to a value of type string. { ER_CANT_CONVERT_TO_STRING, "\u0412 XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'' \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 XPathResultType \u0440\u0430\u0432\u043d\u043e {1}, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. "}, // Note to translators: Do not translate snapshotItem, // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE. { ER_NON_SNAPSHOT_TYPE, "\u041c\u0435\u0442\u043e\u0434 snapshotItem \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0434\u043b\u044f XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'', \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0433\u043e XPathResultType \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f {1}. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0442\u0438\u043f\u0430\u043c UNORDERED_NODE_SNAPSHOT_TYPE \u0438 ORDERED_NODE_SNAPSHOT_TYPE. "}, // Note to translators: XPathEvaluator is a Java interface name. An // XPathEvaluator is created with respect to a particular XML document, and in // this case the expression represented by this object was being evaluated with // respect to a context node from a different document. { ER_WRONG_DOCUMENT, "\u0423\u0437\u0435\u043b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c XPathEvaluator."}, // Note to translators: The XPath expression cannot be evaluated with respect // to this type of node. { ER_WRONG_NODETYPE, "\u0422\u0438\u043f \u0443\u0437\u043b\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f."}, { ER_XPATH_ERROR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 XPath."}, { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, "\u0412 XPathResult \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}'' \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 XPathResultType \u0440\u0430\u0432\u043d\u043e {1}, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. "}, //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */ { ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f: \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c ''{0}'', \u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 XMLConstants.FEATURE_SECURE_PROCESSING \u0437\u0430\u0434\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true. "}, /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */ { ER_RESOLVE_VARIABLE_RETURNS_NULL, "resolveVariable \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 {0} \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043f\u0443\u0441\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. "}, /** Field ER_UNSUPPORTED_RETURN_TYPE */ { ER_UNSUPPORTED_RETURN_TYPE, "\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430: {0}"}, /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */ { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL, "\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438/\u0438\u043b\u0438 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, /** Field ER_ARG_CANNOT_BE_NULL */ { ER_ARG_CANNOT_BE_NULL, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 {0} \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, /** Field ER_OBJECT_MODEL_NULL */ { ER_OBJECT_MODEL_NULL, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c {0}#isObjectModelSupported( \u0441\u0442\u0440\u043e\u043a\u0430 objectModel ) \u043f\u0440\u0438 objectModel == null"}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_OBJECT_MODEL_EMPTY, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c {0}#isObjectModelSupported( \u0441\u0442\u0440\u043e\u043a\u0430 objectModel ) \u043f\u0440\u0438 objectModel == \"\""}, /** Field ER_OBJECT_MODEL_EMPTY */ { ER_FEATURE_NAME_NULL, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c: {0}#setFeature( null, {1})"}, /** Field ER_FEATURE_UNKNOWN */ { ER_FEATURE_UNKNOWN, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \"{0}\":{1}#setFeature({0},{2})"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_NULL_FEATURE, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c: {0}#getFeature(null)"}, /** Field ER_GETTING_NULL_FEATURE */ { ER_GETTING_UNKNOWN_FEATURE, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \"{0}\":{1}#getFeature({0})"}, /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */ { ER_NULL_XPATH_FUNCTION_RESOLVER, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 XPathFunctionResolver:{0}#setXPathFunctionResolver(null)"}, /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */ { ER_NULL_XPATH_VARIABLE_RESOLVER, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 XPathVariableResolver:{0}#setXPathVariableResolver(null)"}, //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation // Warnings... { WG_LOCALE_NAME_NOT_HANDLED, "\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 format-number \u0435\u0449\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e!"}, { WG_PROPERTY_NOT_SUPPORTED, "\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e XSL \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f: {0}"}, { WG_DONT_DO_ANYTHING_WITH_NS, "\u041d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0439\u0442\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c \u0438\u043c\u0435\u043d {0} \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435: {1}"}, { WG_SECURITY_EXCEPTION, "SecurityException \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 XSL: {0}"}, { WG_QUO_NO_LONGER_DEFINED, "\u0421\u0442\u0430\u0440\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441: quo(...) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 XPath."}, { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST, "\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 nodeTest \u0432 XPath \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442!"}, { WG_FUNCTION_TOKEN_NOT_FOUND, "\u041c\u0430\u0440\u043a\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d."}, { WG_COULDNOT_FIND_FUNCTION, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430: {0}"}, { WG_CANNOT_MAKE_URL_FROM, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c URL \u0438\u0437: {0}"}, { WG_EXPAND_ENTITIES_NOT_SUPPORTED, "\u041e\u043f\u0446\u0438\u044f -E \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c DTM"}, { WG_ILLEGAL_VARIABLE_REFERENCE, "VariableReference \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u043d \u0432\u043d\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u043b\u0438 \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f! \u0418\u043c\u044f = {0}"}, { WG_UNSUPPORTED_ENCODING, "\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430: {0}"}, // Other miscellaneous text used inside the code... { "ui_language", "en"}, { "help_language", "en"}, { "language", "en"}, { "BAD_CODE", "\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 createMessage \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430"}, { "FORMAT_FAILED", "\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 messageFormat"}, { "version", ">>>>>>> \u0412\u0435\u0440\u0441\u0438\u044f Xalan "}, { "version2", "<<<<<<<"}, { "yes", "\u0434\u0430"}, { "line", "\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 "}, { "column", "\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 "}, { "xsldone", "XSLProcessor: \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e"}, { "xpath_option", "\u041e\u043f\u0446\u0438\u0438 xpath: "}, { "optionIN", " [-in inputXMLURL]"}, { "optionSelect", " [-select \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 xpath]"}, { "optionMatch", " [-match \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (\u0434\u043b\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438)]"}, { "optionAnyExpr", "\u0418\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 xpath \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0430\u043c\u043f\u0430"}, { "noParsermsg1", "\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 XSL \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043e\u0448\u0438\u0431\u043a\u0438."}, { "noParsermsg2", "** \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d **"}, { "noParsermsg3", "\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 classpath."}, { "noParsermsg4", "\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 XML Parser for Java \u0444\u0438\u0440\u043c\u044b IBM, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0441\u0430\u0439\u0442\u0430"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "gtone", ">1" }, { "zero", "0" }, { "one", "1" }, { "two" , "2" }, { "three", "3" } }; } // ================= INFRASTRUCTURE ====================== /** Field BAD_CODE */ public static final String BAD_CODE = "BAD_CODE"; /** Field FORMAT_FAILED */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** Field ERROR_RESOURCES */ public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources"; /** Field ERROR_STRING */ public static final String ERROR_STRING = "\u041e\u0448\u0438\u0431\u043a\u0430"; /** Field ERROR_HEADER */ public static final String ERROR_HEADER = "\u041e\u0448\u0438\u0431\u043a\u0430: "; /** Field WARNING_HEADER */ public static final String WARNING_HEADER = "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: "; /** Field XSL_HEADER */ public static final String XSL_HEADER = "XSL "; /** Field XML_HEADER */ public static final String XML_HEADER = "XML "; /** Field QUERY_HEADER */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @return the ResourceBundle * @throws MissingResourceException */ public static final XPATHErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xpath/FoundIndex.java0000644000175000017500000000234110721374032022130 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FoundIndex.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; /** * Class to let us know when it's time to do * a search from the parent because of indexing. * @xsl.usage internal */ public class FoundIndex extends RuntimeException { static final long serialVersionUID = -4643975335243078270L; /** * Constructor FoundIndex * */ public FoundIndex(){} } libxalan2-java-2.7.1/src/org/apache/xpath/ExtensionsProvider.java0000644000175000017500000000367710721374031023753 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionsProvider.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import java.util.Vector; import org.apache.xpath.functions.FuncExtFunction; /** * Interface that XPath objects can call to obtain access to an * ExtensionsTable. * */ public interface ExtensionsProvider { /** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException; /** * Is the extension element available? */ public boolean elementAvailable(String ns, String elemName) throws javax.xml.transform.TransformerException; /** * Execute the extension function. */ public Object extFunction(String ns, String funcName, Vector argVec, Object methodKey) throws javax.xml.transform.TransformerException; /** * Execute the extension function. */ public Object extFunction(FuncExtFunction extFunction, Vector argVec) throws javax.xml.transform.TransformerException; } libxalan2-java-2.7.1/src/org/apache/xpath/axes/0000755000175000017500000000000010736146354020174 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xpath/axes/UnionChildIterator.java0000644000175000017500000001155210721374032024577 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnionChildIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.patterns.NodeTest; /** * This class defines a simplified type of union iterator that only * tests along the child axes. If the conditions are right, it is * much faster than using a UnionPathIterator. */ public class UnionChildIterator extends ChildTestIterator { static final long serialVersionUID = 3500298482193003495L; /** * Even though these may hold full LocPathIterators, this array does * not have to be cloned, since only the node test and predicate * portion are used, and these only need static information. However, * also note that index predicates can not be used! */ private PredicatedNodeTest[] m_nodeTests = null; /** * Constructor for UnionChildIterator */ public UnionChildIterator() { super(null); } /** * Add a node test to the union list. * * @param test reference to a NodeTest, which will be added * directly to the list of node tests (in other words, it will * not be cloned). The parent of this test will be set to * this object. */ public void addNodeTest(PredicatedNodeTest test) { // Increase array size by only 1 at a time. Fix this // if it looks to be a problem. if (null == m_nodeTests) { m_nodeTests = new PredicatedNodeTest[1]; m_nodeTests[0] = test; } else { PredicatedNodeTest[] tests = m_nodeTests; int len = m_nodeTests.length; m_nodeTests = new PredicatedNodeTest[len + 1]; System.arraycopy(tests, 0, m_nodeTests, 0, len); m_nodeTests[len] = test; } test.exprSetParent(this); } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if (m_nodeTests != null) { for (int i = 0; i < m_nodeTests.length; i++) { m_nodeTests[i].fixupVariables(vars, globalsSize); } } } /** * Test whether a specified node is visible in the logical view of a * TreeWalker or NodeIterator. This function will be called by the * implementation of TreeWalker and NodeIterator; it is not intended to * be called directly from user code. * @param n The node to check to see if it passes the filter or not. * @return a constant to determine whether the node is accepted, * rejected, or skipped, as defined above . */ public short acceptNode(int n) { XPathContext xctxt = getXPathContext(); try { xctxt.pushCurrentNode(n); for (int i = 0; i < m_nodeTests.length; i++) { PredicatedNodeTest pnt = m_nodeTests[i]; XObject score = pnt.execute(xctxt, n); if (score != NodeTest.SCORE_NONE) { // Note that we are assuming there are no positional predicates! if (pnt.getPredicateCount() > 0) { if (pnt.executePredicates(n, xctxt)) return DTMIterator.FILTER_ACCEPT; } else return DTMIterator.FILTER_ACCEPT; } } } catch (javax.xml.transform.TransformerException se) { // TODO: Fix this. throw new RuntimeException(se.getMessage()); } finally { xctxt.popCurrentNode(); } return DTMIterator.FILTER_SKIP; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/UnionPathIterator.java0000644000175000017500000003764510721374033024464 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnionPathIterator.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpCodes; import org.apache.xpath.compiler.OpMap; /** * This class extends NodeSetDTM, which implements DTMIterator, * and fetches nodes one at a time in document order based on a XPath * UnionExpr. * As each node is iterated via nextNode(), the node is also stored * in the NodeVector, so that previousNode() can easily be done. * @xsl.usage advanced */ public class UnionPathIterator extends LocPathIterator implements Cloneable, DTMIterator, java.io.Serializable, PathComponent { static final long serialVersionUID = -3910351546843826781L; /** * Constructor to create an instance which you can add location paths to. */ public UnionPathIterator() { super(); // m_mutable = false; // m_cacheNodes = false; m_iterators = null; m_exprs = null; } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); try { if (null != m_exprs) { int n = m_exprs.length; DTMIterator newIters[] = new DTMIterator[n]; for (int i = 0; i < n; i++) { DTMIterator iter = m_exprs[i].asIterator(m_execContext, context); newIters[i] = iter; iter.nextNode(); } m_iterators = newIters; } } catch(Exception e) { throw new org.apache.xml.utils.WrappedRuntimeException(e); } } /** * Add an iterator to the union list. * * @param expr non-null reference to a location path iterator. */ public void addIterator(DTMIterator expr) { // Increase array size by only 1 at a time. Fix this // if it looks to be a problem. if (null == m_iterators) { m_iterators = new DTMIterator[1]; m_iterators[0] = expr; } else { DTMIterator[] exprs = m_iterators; int len = m_iterators.length; m_iterators = new DTMIterator[len + 1]; System.arraycopy(exprs, 0, m_iterators, 0, len); m_iterators[len] = expr; } expr.nextNode(); if(expr instanceof Expression) ((Expression)expr).exprSetParent(this); } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach && null != m_iterators){ int n = m_iterators.length; for(int i = 0; i < n; i++) { m_iterators[i].detach(); } m_iterators = null; } } /** * Create a UnionPathIterator object, including creation * of location path iterators from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * * @throws javax.xml.transform.TransformerException */ public UnionPathIterator(Compiler compiler, int opPos) throws javax.xml.transform.TransformerException { super(); opPos = OpMap.getFirstChildPos(opPos); loadLocationPaths(compiler, opPos, 0); } /** * This will return an iterator capable of handling the union of paths given. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * * @return Object that is derived from LocPathIterator. * * @throws javax.xml.transform.TransformerException */ public static LocPathIterator createUnionIterator(Compiler compiler, int opPos) throws javax.xml.transform.TransformerException { // For the moment, I'm going to first create a full UnionPathIterator, and // then see if I can reduce it to a UnionChildIterator. It would obviously // be more effecient to just test for the conditions for a UnionChildIterator, // and then create that directly. UnionPathIterator upi = new UnionPathIterator(compiler, opPos); int nPaths = upi.m_exprs.length; boolean isAllChildIterators = true; for(int i = 0; i < nPaths; i++) { LocPathIterator lpi = upi.m_exprs[i]; if(lpi.getAxis() != Axis.CHILD) { isAllChildIterators = false; break; } else { // check for positional predicates or position function, which won't work. if(HasPositionalPredChecker.check(lpi)) { isAllChildIterators = false; break; } } } if(isAllChildIterators) { UnionChildIterator uci = new UnionChildIterator(); for(int i = 0; i < nPaths; i++) { PredicatedNodeTest lpi = upi.m_exprs[i]; // I could strip the lpi down to a pure PredicatedNodeTest, but // I don't think it's worth it. Note that the test can be used // as a static object... so it doesn't have to be cloned. uci.addNodeTest(lpi); } return uci; } else return upi; } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { int bits = 0; if (m_exprs != null) { int n = m_exprs.length; for (int i = 0; i < n; i++) { int bit = m_exprs[i].getAnalysisBits(); bits |= bit; } } return bits; } /** * Read the object from a serialization stream. * * @param stream Input stream to read from * * @throws java.io.IOException * @throws javax.xml.transform.TransformerException */ private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, javax.xml.transform.TransformerException { try { stream.defaultReadObject(); m_clones = new IteratorPool(this); } catch (ClassNotFoundException cnfe) { throw new javax.xml.transform.TransformerException(cnfe); } } /** * Get a cloned LocPathIterator that holds the same * position as this iterator. * * @return A clone of this iterator that holds the same node position. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { UnionPathIterator clone = (UnionPathIterator) super.clone(); if (m_iterators != null) { int n = m_iterators.length; clone.m_iterators = new DTMIterator[n]; for (int i = 0; i < n; i++) { clone.m_iterators[i] = (DTMIterator)m_iterators[i].clone(); } } return clone; } /** * Create a new location path iterator. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * * @return New location path iterator. * * @throws javax.xml.transform.TransformerException */ protected LocPathIterator createDTMIterator( Compiler compiler, int opPos) throws javax.xml.transform.TransformerException { LocPathIterator lpi = (LocPathIterator)WalkerFactory.newDTMIterator(compiler, opPos, (compiler.getLocationPathDepth() <= 0)); return lpi; } /** * Initialize the location path iterators. Recursive. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param count The insert position of the iterator. * * @throws javax.xml.transform.TransformerException */ protected void loadLocationPaths(Compiler compiler, int opPos, int count) throws javax.xml.transform.TransformerException { // TODO: Handle unwrapped FilterExpr int steptype = compiler.getOp(opPos); if (steptype == OpCodes.OP_LOCATIONPATH) { loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); m_exprs[count] = createDTMIterator(compiler, opPos); m_exprs[count].exprSetParent(this); } else { // Have to check for unwrapped functions, which the LocPathIterator // doesn't handle. switch (steptype) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1); WalkingIterator iter = new WalkingIterator(compiler.getNamespaceContext()); iter.exprSetParent(this); if(compiler.getLocationPathDepth() <= 0) iter.setIsTopLevel(true); iter.m_firstWalker = new org.apache.xpath.axes.FilterExprWalker(iter); iter.m_firstWalker.init(compiler, opPos, steptype); m_exprs[count] = iter; break; default : m_exprs = new LocPathIterator[count]; } } } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a DTMIterator is created, the first call * to nextNode() returns the first node in the set. * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if(m_foundLast) return DTM.NULL; // Loop through the iterators getting the current fetched // node, and get the earliest occuring in document order int earliestNode = DTM.NULL; if (null != m_iterators) { int n = m_iterators.length; int iteratorUsed = -1; for (int i = 0; i < n; i++) { int node = m_iterators[i].getCurrentNode(); if (DTM.NULL == node) continue; else if (DTM.NULL == earliestNode) { iteratorUsed = i; earliestNode = node; } else { if (node == earliestNode) { // Found a duplicate, so skip past it. m_iterators[i].nextNode(); } else { DTM dtm = getDTM(node); if (dtm.isNodeAfter(node, earliestNode)) { iteratorUsed = i; earliestNode = node; } } } } if (DTM.NULL != earliestNode) { m_iterators[iteratorUsed].nextNode(); incrementCurrentPos(); } else m_foundLast = true; } m_lastFetched = earliestNode; return earliestNode; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { for (int i = 0; i < m_exprs.length; i++) { m_exprs[i].fixupVariables(vars, globalsSize); } } /** * The location path iterators, one for each * location * path contained in the union expression. * @serial */ protected LocPathIterator[] m_exprs; /** * The location path iterators, one for each * location * path contained in the union expression. * @serial */ protected DTMIterator[] m_iterators; /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { // Could be smarter. return -1; } class iterOwner implements ExpressionOwner { int m_index; iterOwner(int index) { m_index = index; } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_exprs[m_index]; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { if(!(exp instanceof LocPathIterator)) { // Yuck. Need FilterExprIter. Or make it so m_exprs can be just // plain expressions? WalkingIterator wi = new WalkingIterator(getPrefixResolver()); FilterExprWalker few = new FilterExprWalker(wi); wi.setFirstWalker(few); few.setInnerExpression(exp); wi.exprSetParent(UnionPathIterator.this); few.exprSetParent(wi); exp.exprSetParent(few); exp = wi; } else exp.exprSetParent(UnionPathIterator.this); m_exprs[m_index] = (LocPathIterator)exp; } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitUnionPath(owner, this)) { if(null != m_exprs) { int n = m_exprs.length; for(int i = 0; i < n; i++) { m_exprs[i].callVisitors(new iterOwner(i), visitor); } } } } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; UnionPathIterator upi = (UnionPathIterator) expr; if (null != m_exprs) { int n = m_exprs.length; if((null == upi.m_exprs) || (upi.m_exprs.length != n)) return false; for (int i = 0; i < n; i++) { if(!m_exprs[i].deepEquals(upi.m_exprs[i])) return false; } } else if (null != upi.m_exprs) { return false; } return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/ChildIterator.java0000644000175000017500000000722510721374030023566 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ChildIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.Compiler; /** * This class implements an optimized iterator for * "node()" patterns, that is, any children of the * context node. * @see org.apache.xpath.axes.LocPathIterator * @xsl.usage advanced */ public class ChildIterator extends LocPathIterator { static final long serialVersionUID = -6935428015142993583L; /** * Create a ChildIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * @param analysis Analysis bits of the entire pattern. * * @throws javax.xml.transform.TransformerException */ ChildIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, false); // This iterator matches all kinds of nodes initNodeTest(DTMFilter.SHOW_ALL); } /** * Return the first node out of the nodeset, if this expression is * a nodeset expression. This is the default implementation for * nodesets. *

    WARNING: Do not mutate this class from this function!

    * @param xctxt The XPath runtime context. * @return the first node out of the nodeset, or DTM.NULL. */ public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException { int current = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(current); return dtm.getFirstChild(current); } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if(m_foundLast) return DTM.NULL; int next; m_lastFetched = next = (DTM.NULL == m_lastFetched) ? m_cdtm.getFirstChild(m_context) : m_cdtm.getNextSibling(m_lastFetched); // m_lastFetched = next; if (DTM.NULL != next) { m_pos++; return next; } else { m_foundLast = true; return DTM.NULL; } } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return org.apache.xml.dtm.Axis.CHILD; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/AxesWalker.java0000644000175000017500000003711610721374033023104 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AxesWalker.java 513117 2007-03-01 03:28:52Z minchau $ */ package org.apache.xpath.axes; import java.util.Vector; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.res.XPATHErrorResources; /** * Serves as common interface for axes Walkers, and stores common * state variables. */ public class AxesWalker extends PredicatedNodeTest implements Cloneable, PathComponent, ExpressionOwner { static final long serialVersionUID = -2966031951306601247L; /** * Construct an AxesWalker using a LocPathIterator. * * @param locPathIterator non-null reference to the parent iterator. */ public AxesWalker(LocPathIterator locPathIterator, int axis) { super( locPathIterator ); m_axis = axis; } public final WalkingIterator wi() { return (WalkingIterator)m_lpi; } /** * Initialize an AxesWalker during the parse of the XPath expression. * * @param compiler The Compiler object that has information about this * walker in the op map. * @param opPos The op code position of this location step. * @param stepType The type of location step. * * @throws javax.xml.transform.TransformerException */ public void init(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { initPredicateInfo(compiler, opPos); // int testType = compiler.getOp(nodeTestOpPos); } /** * Get a cloned AxesWalker. * * @return A new AxesWalker that can be used without mutating this one. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { // Do not access the location path itterator during this operation! AxesWalker clone = (AxesWalker) super.clone(); //clone.setCurrentNode(clone.m_root); // clone.m_isFresh = true; return clone; } /** * Do a deep clone of this walker, including next and previous walkers. * If the this AxesWalker is on the clone list, don't clone but * return the already cloned version. * * @param cloneOwner non-null reference to the cloned location path * iterator to which this clone will be added. * @param cloneList non-null vector of sources in odd elements, and the * corresponding clones in even vectors. * * @return non-null clone, which may be a new clone, or may be a clone * contained on the cloneList. */ AxesWalker cloneDeep(WalkingIterator cloneOwner, Vector cloneList) throws CloneNotSupportedException { AxesWalker clone = findClone(this, cloneList); if(null != clone) return clone; clone = (AxesWalker)this.clone(); clone.setLocPathIterator(cloneOwner); if(null != cloneList) { cloneList.addElement(this); cloneList.addElement(clone); } if(wi().m_lastUsedWalker == this) cloneOwner.m_lastUsedWalker = clone; if(null != m_nextWalker) clone.m_nextWalker = m_nextWalker.cloneDeep(cloneOwner, cloneList); // If you don't check for the cloneList here, you'll go into an // recursive infinate loop. if(null != cloneList) { if(null != m_prevWalker) clone.m_prevWalker = m_prevWalker.cloneDeep(cloneOwner, cloneList); } else { if(null != m_nextWalker) clone.m_nextWalker.m_prevWalker = clone; } return clone; } /** * Find a clone that corresponds to the key argument. * * @param key The original AxesWalker for which there may be a clone. * @param cloneList vector of sources in odd elements, and the * corresponding clones in even vectors, may be null. * * @return A clone that corresponds to the key, or null if key not found. */ static AxesWalker findClone(AxesWalker key, Vector cloneList) { if(null != cloneList) { // First, look for clone on list. int n = cloneList.size(); for (int i = 0; i < n; i+=2) { if(key == cloneList.elementAt(i)) return (AxesWalker)cloneList.elementAt(i+1); } } return null; } /** * Detaches the walker from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. */ public void detach() { m_currentNode = DTM.NULL; m_dtm = null; m_traverser = null; m_isFresh = true; m_root = DTM.NULL; } //=============== TreeWalker Implementation =============== /** * The root node of the TreeWalker, as specified in setRoot(int root). * Note that this may actually be below the current node. * * @return The context node of the step. */ public int getRoot() { return m_root; } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { int axis = getAxis(); int bit = WalkerFactory.getAnalysisBitFromAxes(axis); return bit; } /** * Set the root node of the TreeWalker. * (Not part of the DOM2 TreeWalker interface). * * @param root The context node of this step. */ public void setRoot(int root) { // %OPT% Get this directly from the lpi. XPathContext xctxt = wi().getXPathContext(); m_dtm = xctxt.getDTM(root); m_traverser = m_dtm.getAxisTraverser(m_axis); m_isFresh = true; m_foundLast = false; m_root = root; m_currentNode = root; if (DTM.NULL == root) { throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SETTING_WALKER_ROOT_TO_NULL, null)); //"\n !!!! Error! Setting the root of a walker to null!!!"); } resetProximityPositions(); } /** * The node at which the TreeWalker is currently positioned. *
    The value must not be null. Alterations to the DOM tree may cause * the current node to no longer be accepted by the TreeWalker's * associated filter. currentNode may also be explicitly set to any node, * whether or not it is within the subtree specified by the root node or * would be accepted by the filter and whatToShow flags. Further * traversal occurs relative to currentNode even if it is not part of the * current view by applying the filters in the requested direction (not * changing currentNode where no traversal is possible). * * @return The node at which the TreeWalker is currently positioned, only null * if setRoot has not yet been called. */ public final int getCurrentNode() { return m_currentNode; } /** * Set the next walker in the location step chain. * * * @param walker Reference to AxesWalker derivative, or may be null. */ public void setNextWalker(AxesWalker walker) { m_nextWalker = walker; } /** * Get the next walker in the location step chain. * * * @return Reference to AxesWalker derivative, or null. */ public AxesWalker getNextWalker() { return m_nextWalker; } /** * Set or clear the previous walker reference in the location step chain. * * * @param walker Reference to previous walker reference in the location * step chain, or null. */ public void setPrevWalker(AxesWalker walker) { m_prevWalker = walker; } /** * Get the previous walker reference in the location step chain. * * * @return Reference to previous walker reference in the location * step chain, or null. */ public AxesWalker getPrevWalker() { return m_prevWalker; } /** * This is simply a way to bottle-neck the return of the next node, for * diagnostic purposes. * * @param n Node to return, or null. * * @return The argument. */ private int returnNextNode(int n) { return n; } /** * Get the next node in document order on the axes. * * @return the next node in document order on the axes, or null. */ protected int getNextNode() { if (m_foundLast) return DTM.NULL; if (m_isFresh) { m_currentNode = m_traverser.first(m_root); m_isFresh = false; } // I shouldn't have to do this the check for current node, I think. // numbering\numbering24.xsl fails if I don't do this. I think // it occurs as the walkers are backing up. -sb else if(DTM.NULL != m_currentNode) { m_currentNode = m_traverser.next(m_root, m_currentNode); } if (DTM.NULL == m_currentNode) this.m_foundLast = true; return m_currentNode; } /** * Moves the TreeWalker to the next visible node in document * order relative to the current node, and returns the new node. If the * current node has no next node, or if the search for nextNode attempts * to step upward from the TreeWalker's root node, returns * null , and retains the current node. * @return The new node, or null if the current node has no * next node in the TreeWalker's logical view. */ public int nextNode() { int nextNode = DTM.NULL; AxesWalker walker = wi().getLastUsedWalker(); while (true) { if (null == walker) break; nextNode = walker.getNextNode(); if (DTM.NULL == nextNode) { walker = walker.m_prevWalker; } else { if (walker.acceptNode(nextNode) != DTMIterator.FILTER_ACCEPT) { continue; } if (null == walker.m_nextWalker) { wi().setLastUsedWalker(walker); // return walker.returnNextNode(nextNode); break; } else { AxesWalker prev = walker; walker = walker.m_nextWalker; walker.setRoot(nextNode); walker.m_prevWalker = prev; continue; } } // if(null != nextNode) } // while(null != walker) return nextNode; } //============= End TreeWalker Implementation ============= /** * Get the index of the last node that can be itterated to. * * * @param xctxt XPath runtime context. * * @return the index of the last node that can be itterated to. */ public int getLastPos(XPathContext xctxt) { int pos = getProximityPosition(); AxesWalker walker; try { walker = (AxesWalker) clone(); } catch (CloneNotSupportedException cnse) { return -1; } walker.setPredicateCount(m_predicateIndex); walker.setNextWalker(null); walker.setPrevWalker(null); WalkingIterator lpi = wi(); AxesWalker savedWalker = lpi.getLastUsedWalker(); try { lpi.setLastUsedWalker(walker); int next; while (DTM.NULL != (next = walker.nextNode())) { pos++; } // TODO: Should probably save this in the iterator. } finally { lpi.setLastUsedWalker(savedWalker); } // System.out.println("pos: "+pos); return pos; } //============= State Data ============= /** * The DTM for the root. This can not be used, or must be changed, * for the filter walker, or any walker that can have nodes * from multiple documents. * Never, ever, access this value without going through getDTM(int node). */ private DTM m_dtm; /** * Set the DTM for this walker. * * @param dtm Non-null reference to a DTM. */ public void setDefaultDTM(DTM dtm) { m_dtm = dtm; } /** * Get the DTM for this walker. * * @return Non-null reference to a DTM. */ public DTM getDTM(int node) { // return wi().getXPathContext().getDTM(node); } /** * Returns true if all the nodes in the iteration well be returned in document * order. * Warning: This can only be called after setRoot has been called! * * @return true as a default. */ public boolean isDocOrdered() { return true; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return m_axis; } /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param owner The owner of the visitor, where that path may be * rewritten if needed. * @param visitor The visitor whose appropriate method will be called. */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitStep(owner, this)) { callPredicateVisitors(visitor); if(null != m_nextWalker) { m_nextWalker.callVisitors(this, visitor); } } } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_nextWalker; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_nextWalker = (AxesWalker)exp; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; AxesWalker walker = (AxesWalker)expr; if(this.m_axis != walker.m_axis) return false; return true; } /** * The root node of the TreeWalker, as specified when it was created. */ transient int m_root = DTM.NULL; /** * The node at which the TreeWalker is currently positioned. */ private transient int m_currentNode = DTM.NULL; /** True if an itteration has not begun. */ transient boolean m_isFresh; /** The next walker in the location step chain. * @serial */ protected AxesWalker m_nextWalker; /** The previous walker in the location step chain, or null. * @serial */ AxesWalker m_prevWalker; /** The traversal axis from where the nodes will be filtered. */ protected int m_axis = -1; /** The DTM inner traversal class, that corresponds to the super axis. */ protected DTMAxisTraverser m_traverser; } libxalan2-java-2.7.1/src/org/apache/xpath/axes/IteratorPool.java0000644000175000017500000000614410721374030023453 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IteratorPool.java 475981 2006-11-16 23:35:53Z minchau $ */ package org.apache.xpath.axes; import java.util.ArrayList; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.WrappedRuntimeException; /** * Pool of object of a given type to pick from to help memory usage * @xsl.usage internal */ public final class IteratorPool implements java.io.Serializable { static final long serialVersionUID = -460927331149566998L; /** * Type of objects in this pool. */ private final DTMIterator m_orig; /** * Stack of given objects this points to. */ private final ArrayList m_freeStack; /** * Constructor IteratorPool * * @param original The original iterator from which all others will be cloned. */ public IteratorPool(DTMIterator original) { m_orig = original; m_freeStack = new ArrayList(); } /** * Get an instance of the given object in this pool * * @return An instance of the given object */ public synchronized DTMIterator getInstanceOrThrow() throws CloneNotSupportedException { // Check if the pool is empty. if (m_freeStack.isEmpty()) { // Create a new object if so. return (DTMIterator)m_orig.clone(); } else { // Remove object from end of free pool. DTMIterator result = (DTMIterator)m_freeStack.remove(m_freeStack.size() - 1); return result; } } /** * Get an instance of the given object in this pool * * @return An instance of the given object */ public synchronized DTMIterator getInstance() { // Check if the pool is empty. if (m_freeStack.isEmpty()) { // Create a new object if so. try { return (DTMIterator)m_orig.clone(); } catch (Exception ex) { throw new WrappedRuntimeException(ex); } } else { // Remove object from end of free pool. DTMIterator result = (DTMIterator)m_freeStack.remove(m_freeStack.size() - 1); return result; } } /** * Add an instance of the given object to the pool * * * @param obj Object to add. */ public synchronized void freeInstance(DTMIterator obj) { m_freeStack.add(obj); } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/FilterExprIteratorSimple.java0000644000175000017500000002115510721374031026000 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterExprIteratorSimple.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XNodeSet; /** * Class to use for one-step iteration that doesn't have a predicate, and * doesn't need to set the context. */ public class FilterExprIteratorSimple extends LocPathIterator { static final long serialVersionUID = -6978977187025375579L; /** The contained expression. Should be non-null. * @serial */ private Expression m_expr; /** The result of executing m_expr. Needs to be deep cloned on clone op. */ transient private XNodeSet m_exprObj; private boolean m_mustHardReset = false; private boolean m_canDetachNodeset = true; /** * Create a FilterExprIteratorSimple object. * */ public FilterExprIteratorSimple() { super(null); } /** * Create a FilterExprIteratorSimple object. * */ public FilterExprIteratorSimple(Expression expr) { super(null); m_expr = expr; } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_exprObj = executeFilterExpr(context, m_execContext, getPrefixResolver(), getIsTopLevel(), m_stackFrame, m_expr); } /** * Execute the expression. Meant for reuse by other FilterExpr iterators * that are not derived from this object. */ public static XNodeSet executeFilterExpr(int context, XPathContext xctxt, PrefixResolver prefixResolver, boolean isTopLevel, int stackFrame, Expression expr ) throws org.apache.xml.utils.WrappedRuntimeException { PrefixResolver savedResolver = xctxt.getNamespaceContext(); XNodeSet result = null; try { xctxt.pushCurrentNode(context); xctxt.setNamespaceContext(prefixResolver); // The setRoot operation can take place with a reset operation, // and so we may not be in the context of LocPathIterator#nextNode, // so we have to set up the variable context, execute the expression, // and then restore the variable context. if (isTopLevel) { // System.out.println("calling m_expr.execute(getXPathContext())"); VariableStack vars = xctxt.getVarStack(); // These three statements need to be combined into one operation. int savedStart = vars.getStackFrame(); vars.setStackFrame(stackFrame); result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt); result.setShouldCacheNodes(true); // These two statements need to be combined into one operation. vars.setStackFrame(savedStart); } else result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt); } catch (javax.xml.transform.TransformerException se) { // TODO: Fix... throw new org.apache.xml.utils.WrappedRuntimeException(se); } finally { xctxt.popCurrentNode(); xctxt.setNamespaceContext(savedResolver); } return result; } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if(m_foundLast) return DTM.NULL; int next; if (null != m_exprObj) { m_lastFetched = next = m_exprObj.nextNode(); } else m_lastFetched = next = DTM.NULL; // m_lastFetched = next; if (DTM.NULL != next) { m_pos++; return next; } else { m_foundLast = true; return DTM.NULL; } } /** * Detaches the walker from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. */ public void detach() { if(m_allowDetach) { super.detach(); m_exprObj.detach(); m_exprObj = null; } } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); m_expr.fixupVariables(vars, globalsSize); } /** * Get the inner contained expression of this filter. */ public Expression getInnerExpression() { return m_expr; } /** * Set the inner contained expression of this filter. */ public void setInnerExpression(Expression expr) { expr.exprSetParent(this); m_expr = expr; } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { if (null != m_expr && m_expr instanceof PathComponent) { return ((PathComponent) m_expr).getAnalysisBits(); } return WalkerFactory.BIT_FILTER; } /** * Returns true if all the nodes in the iteration well be returned in document * order. * Warning: This can only be called after setRoot has been called! * * @return true as a default. */ public boolean isDocOrdered() { return m_exprObj.isDocOrdered(); } class filterExprOwner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_expr; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(FilterExprIteratorSimple.this); m_expr = exp; } } /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param visitor The visitor whose appropriate method will be called. */ public void callPredicateVisitors(XPathVisitor visitor) { m_expr.callVisitors(new filterExprOwner(), visitor); super.callPredicateVisitors(visitor); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; FilterExprIteratorSimple fet = (FilterExprIteratorSimple) expr; if (!m_expr.deepEquals(fet.m_expr)) return false; return true; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { if(null != m_exprObj) return m_exprObj.getAxis(); else return Axis.FILTEREDLIST; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/OneStepIteratorForward.java0000644000175000017500000001217410721374030025444 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OneStepIteratorForward.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xpath.Expression; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpMap; /** * This class implements a general iterator for * those LocationSteps with only one step, and perhaps a predicate, * that only go forward (i.e. it can not be used with ancestors, * preceding, etc.) * @see org.apache.xpath.axes#ChildTestIterator * @xsl.usage advanced */ public class OneStepIteratorForward extends ChildTestIterator { static final long serialVersionUID = -1576936606178190566L; /** The traversal axis from where the nodes will be filtered. */ protected int m_axis = -1; /** * Create a OneStepIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ OneStepIteratorForward(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis); int firstStepPos = OpMap.getFirstChildPos(opPos); m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos); } /** * Create a OneStepIterator object that will just traverse the self axes. * * @param axis One of the org.apache.xml.dtm.Axis integers. * * @throws javax.xml.transform.TransformerException */ public OneStepIteratorForward(int axis) { super(null); m_axis = axis; int whatToShow = DTMFilter.SHOW_ALL; initNodeTest(whatToShow); } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(m_axis); } // /** // * Return the first node out of the nodeset, if this expression is // * a nodeset expression. This is the default implementation for // * nodesets. // *

    WARNING: Do not mutate this class from this function!

    // * @param xctxt The XPath runtime context. // * @return the first node out of the nodeset, or DTM.NULL. // */ // public int asNode(XPathContext xctxt) // throws javax.xml.transform.TransformerException // { // if(getPredicateCount() > 0) // return super.asNode(xctxt); // // int current = xctxt.getCurrentNode(); // // DTM dtm = xctxt.getDTM(current); // DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis); // // String localName = getLocalName(); // String namespace = getNamespace(); // int what = m_whatToShow; // // // System.out.println("what: "); // // NodeTest.debugWhatToShow(what); // if(DTMFilter.SHOW_ALL == what // || ((DTMFilter.SHOW_ELEMENT & what) == 0) // || localName == NodeTest.WILD // || namespace == NodeTest.WILD) // { // return traverser.first(current); // } // else // { // int type = getNodeTypeTest(what); // int extendedType = dtm.getExpandedTypeID(namespace, localName, type); // return traverser.first(current, extendedType); // } // } /** * Get the next node via getFirstAttribute && getNextAttribute. */ protected int getNextNode() { m_lastFetched = (DTM.NULL == m_lastFetched) ? m_traverser.first(m_context) : m_traverser.next(m_context, m_lastFetched); return m_lastFetched; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return m_axis; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; if(m_axis != ((OneStepIteratorForward)expr).m_axis) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/FilterExprWalker.java0000644000175000017500000002333410721374030024262 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterExprWalker.java 469367 2006-10-31 04:41:08Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpCodes; import org.apache.xpath.objects.XNodeSet; /** * Walker for the OP_VARIABLE, or OP_EXTFUNCTION, or OP_FUNCTION, or OP_GROUP, * op codes. * @see XPath FilterExpr descriptions */ public class FilterExprWalker extends AxesWalker { static final long serialVersionUID = 5457182471424488375L; /** * Construct a FilterExprWalker using a LocPathIterator. * * @param locPathIterator non-null reference to the parent iterator. */ public FilterExprWalker(WalkingIterator locPathIterator) { super(locPathIterator, Axis.FILTEREDLIST); } /** * Init a FilterExprWalker. * * @param compiler non-null reference to the Compiler that is constructing. * @param opPos positive opcode position for this step. * @param stepType The type of step. * * @throws javax.xml.transform.TransformerException */ public void init(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { super.init(compiler, opPos, stepType); // Smooth over an anomily in the opcode map... switch (stepType) { case OpCodes.OP_FUNCTION : case OpCodes.OP_EXTFUNCTION : m_mustHardReset = true; case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : m_expr = compiler.compile(opPos); m_expr.exprSetParent(this); //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof org.apache.xalan.templates.FuncKey)) if(m_expr instanceof org.apache.xpath.operations.Variable) { // hack/temp workaround m_canDetachNodeset = false; } break; default : m_expr = compiler.compile(opPos + 2); m_expr.exprSetParent(this); } // if(m_expr instanceof WalkingIterator) // { // WalkingIterator wi = (WalkingIterator)m_expr; // if(wi.getFirstWalker() instanceof FilterExprWalker) // { // FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker(); // if(null == fw.getNextWalker()) // { // m_expr = fw.m_expr; // m_expr.exprSetParent(this); // } // } // // } } /** * Detaches the walker from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. */ public void detach() { super.detach(); if (m_canDetachNodeset) { m_exprObj.detach(); } m_exprObj = null; } /** * Set the root node of the TreeWalker. * * @param root non-null reference to the root, or starting point of * the query. */ public void setRoot(int root) { super.setRoot(root); m_exprObj = FilterExprIteratorSimple.executeFilterExpr(root, m_lpi.getXPathContext(), m_lpi.getPrefixResolver(), m_lpi.getIsTopLevel(), m_lpi.m_stackFrame, m_expr); } /** * Get a cloned FilterExprWalker. * * @return A new FilterExprWalker that can be used without mutating this one. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { FilterExprWalker clone = (FilterExprWalker) super.clone(); if (null != m_exprObj) clone.m_exprObj = (XNodeSet) m_exprObj.clone(); return clone; } /** * This method needs to override AxesWalker.acceptNode because FilterExprWalkers * don't need to, and shouldn't, do a node test. * @param n The node to check to see if it passes the filter or not. * @return a constant to determine whether the node is accepted, * rejected, or skipped, as defined above . */ public short acceptNode(int n) { try { if (getPredicateCount() > 0) { countProximityPosition(0); if (!executePredicates(n, m_lpi.getXPathContext())) return DTMIterator.FILTER_SKIP; } return DTMIterator.FILTER_ACCEPT; } catch (javax.xml.transform.TransformerException se) { throw new RuntimeException(se.getMessage()); } } /** * Moves the TreeWalker to the next visible node in document * order relative to the current node, and returns the new node. If the * current node has no next node, or if the search for nextNode attempts * to step upward from the TreeWalker's root node, returns * null , and retains the current node. * @return The new node, or null if the current node has no * next node in the TreeWalker's logical view. */ public int getNextNode() { if (null != m_exprObj) { int next = m_exprObj.nextNode(); return next; } else return DTM.NULL; } /** * Get the index of the last node that can be itterated to. * * * @param xctxt XPath runtime context. * * @return the index of the last node that can be itterated to. */ public int getLastPos(XPathContext xctxt) { return m_exprObj.getLength(); } /** The contained expression. Should be non-null. * @serial */ private Expression m_expr; /** The result of executing m_expr. Needs to be deep cloned on clone op. */ transient private XNodeSet m_exprObj; private boolean m_mustHardReset = false; private boolean m_canDetachNodeset = true; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); m_expr.fixupVariables(vars, globalsSize); } /** * Get the inner contained expression of this filter. */ public Expression getInnerExpression() { return m_expr; } /** * Set the inner contained expression of this filter. */ public void setInnerExpression(Expression expr) { expr.exprSetParent(this); m_expr = expr; } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { if (null != m_expr && m_expr instanceof PathComponent) { return ((PathComponent) m_expr).getAnalysisBits(); } return WalkerFactory.BIT_FILTER; } /** * Returns true if all the nodes in the iteration well be returned in document * order. * Warning: This can only be called after setRoot has been called! * * @return true as a default. */ public boolean isDocOrdered() { return m_exprObj.isDocOrdered(); } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return m_exprObj.getAxis(); } class filterExprOwner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_expr; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(FilterExprWalker.this); m_expr = exp; } } /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param visitor The visitor whose appropriate method will be called. */ public void callPredicateVisitors(XPathVisitor visitor) { m_expr.callVisitors(new filterExprOwner(), visitor); super.callPredicateVisitors(visitor); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; FilterExprWalker walker = (FilterExprWalker)expr; if(!m_expr.deepEquals(walker.m_expr)) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/WalkingIterator.java0000644000175000017500000002341710721374032024142 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WalkingIterator.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpMap; /** * Location path iterator that uses Walkers. */ public class WalkingIterator extends LocPathIterator implements ExpressionOwner { static final long serialVersionUID = 9110225941815665906L; /** * Create a WalkingIterator iterator, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param shouldLoadWalkers True if walkers should be * loaded, or false if this is a derived iterator and * it doesn't wish to load child walkers. * * @throws javax.xml.transform.TransformerException */ WalkingIterator( Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, shouldLoadWalkers); int firstStepPos = OpMap.getFirstChildPos(opPos); if (shouldLoadWalkers) { m_firstWalker = WalkerFactory.loadWalkers(this, compiler, firstStepPos, 0); m_lastUsedWalker = m_firstWalker; } } /** * Create a WalkingIterator object. * * @param nscontext The namespace context for this iterator, * should be OK if null. */ public WalkingIterator(PrefixResolver nscontext) { super(nscontext); } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { int bits = 0; if (null != m_firstWalker) { AxesWalker walker = m_firstWalker; while (null != walker) { int bit = walker.getAnalysisBits(); bits |= bit; walker = walker.getNextWalker(); } } return bits; } /** * Get a cloned WalkingIterator that holds the same * position as this iterator. * * @return A clone of this iterator that holds the same node position. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { WalkingIterator clone = (WalkingIterator) super.clone(); // clone.m_varStackPos = this.m_varStackPos; // clone.m_varStackContext = this.m_varStackContext; if (null != m_firstWalker) { clone.m_firstWalker = m_firstWalker.cloneDeep(clone, null); } return clone; } /** * Reset the iterator. */ public void reset() { super.reset(); if (null != m_firstWalker) { m_lastUsedWalker = m_firstWalker; m_firstWalker.setRoot(m_context); } } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); if(null != m_firstWalker) { m_firstWalker.setRoot(context); m_lastUsedWalker = m_firstWalker; } } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if(m_foundLast) return DTM.NULL; // If the variable stack position is not -1, we'll have to // set our position in the variable stack, so our variable access // will be correct. Iterators that are at the top level of the // expression need to reset the variable stack, while iterators // in predicates do not need to, and should not, since their execution // may be much later than top-level iterators. // m_varStackPos is set in setRoot, which is called // from the execute method. if (-1 == m_stackFrame) { return returnNextNode(m_firstWalker.nextNode()); } else { VariableStack vars = m_execContext.getVarStack(); // These three statements need to be combined into one operation. int savedStart = vars.getStackFrame(); vars.setStackFrame(m_stackFrame); int n = returnNextNode(m_firstWalker.nextNode()); // These two statements need to be combined into one operation. vars.setStackFrame(savedStart); return n; } } /** * Get the head of the walker list. * * @return The head of the walker list, or null * if this iterator does not implement walkers. * @xsl.usage advanced */ public final AxesWalker getFirstWalker() { return m_firstWalker; } /** * Set the head of the walker list. * * @param walker Should be a valid AxesWalker. * @xsl.usage advanced */ public final void setFirstWalker(AxesWalker walker) { m_firstWalker = walker; } /** * Set the last used walker. * * @param walker The last used walker, or null. * @xsl.usage advanced */ public final void setLastUsedWalker(AxesWalker walker) { m_lastUsedWalker = walker; } /** * Get the last used walker. * * @return The last used walker, or null. * @xsl.usage advanced */ public final AxesWalker getLastUsedWalker() { return m_lastUsedWalker; } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach) { AxesWalker walker = m_firstWalker; while (null != walker) { walker.detach(); walker = walker.getNextWalker(); } m_lastUsedWalker = null; // Always call the superclass detach last! super.detach(); } } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_predicateIndex = -1; AxesWalker walker = m_firstWalker; while (null != walker) { walker.fixupVariables(vars, globalsSize); walker = walker.getNextWalker(); } } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitLocationPath(owner, this)) { if(null != m_firstWalker) { m_firstWalker.callVisitors(this, visitor); } } } /** The last used step walker in the walker list. * @serial */ protected AxesWalker m_lastUsedWalker; /** The head of the step walker list. * @serial */ protected AxesWalker m_firstWalker; /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_firstWalker; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_firstWalker = (AxesWalker)exp; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; AxesWalker walker1 = m_firstWalker; AxesWalker walker2 = ((WalkingIterator)expr).m_firstWalker; while ((null != walker1) && (null != walker2)) { if(!walker1.deepEquals(walker2)) return false; walker1 = walker1.getNextWalker(); walker2 = walker2.getNextWalker(); } if((null != walker1) || (null != walker2)) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/DescendantIterator.java0000644000175000017500000002501410721374033024612 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DescendantIterator.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpCodes; import org.apache.xpath.compiler.OpMap; import org.apache.xpath.patterns.NodeTest; /** * This class implements an optimized iterator for * descendant, descendant-or-self, or "//foo" patterns. * @see org.apache.xpath.axes.LocPathIterator * @xsl.usage advanced */ public class DescendantIterator extends LocPathIterator { static final long serialVersionUID = -1190338607743976938L; /** * Create a DescendantIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ DescendantIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, false); int firstStepPos = OpMap.getFirstChildPos(opPos); int stepType = compiler.getOp(firstStepPos); boolean orSelf = (OpCodes.FROM_DESCENDANTS_OR_SELF == stepType); boolean fromRoot = false; if (OpCodes.FROM_SELF == stepType) { orSelf = true; // firstStepPos += 8; } else if(OpCodes.FROM_ROOT == stepType) { fromRoot = true; // Ugly code... will go away when AST work is done. int nextStepPos = compiler.getNextStepPos(firstStepPos); if(compiler.getOp(nextStepPos) == OpCodes.FROM_DESCENDANTS_OR_SELF) orSelf = true; // firstStepPos += 8; } // Find the position of the last step. int nextStepPos = firstStepPos; while(true) { nextStepPos = compiler.getNextStepPos(nextStepPos); if(nextStepPos > 0) { int stepOp = compiler.getOp(nextStepPos); if(OpCodes.ENDOP != stepOp) firstStepPos = nextStepPos; else break; } else break; } // Fix for http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1336 if((analysis & WalkerFactory.BIT_CHILD) != 0) orSelf = false; if(fromRoot) { if(orSelf) m_axis = Axis.DESCENDANTSORSELFFROMROOT; else m_axis = Axis.DESCENDANTSFROMROOT; } else if(orSelf) m_axis = Axis.DESCENDANTORSELF; else m_axis = Axis.DESCENDANT; int whatToShow = compiler.getWhatToShow(firstStepPos); if ((0 == (whatToShow & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_ELEMENT | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == DTMFilter.SHOW_ALL)) initNodeTest(whatToShow); else { initNodeTest(whatToShow, compiler.getStepNS(firstStepPos), compiler.getStepLocalName(firstStepPos)); } initPredicateInfo(compiler, firstStepPos); } /** * Create a DescendantIterator object. * */ public DescendantIterator() { super(null); m_axis = Axis.DESCENDANTSORSELFFROMROOT; int whatToShow = DTMFilter.SHOW_ALL; initNodeTest(whatToShow); } /** * Get a cloned Iterator that is reset to the beginning * of the query. * * @return A cloned NodeIterator set of the start of the query. * * @throws CloneNotSupportedException */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { DescendantIterator clone = (DescendantIterator) super.cloneWithReset(); clone.m_traverser = m_traverser; clone.resetProximityPositions(); return clone; } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * * @return The next Node in the set being iterated over, or * null if there are no more members in that set. * * @throws DOMException * INVALID_STATE_ERR: Raised if this method is called after the * detach method was invoked. */ public int nextNode() { if(m_foundLast) return DTM.NULL; if(DTM.NULL == m_lastFetched) { resetProximityPositions(); } int next; org.apache.xpath.VariableStack vars; int savedStart; if (-1 != m_stackFrame) { vars = m_execContext.getVarStack(); // These three statements need to be combined into one operation. savedStart = vars.getStackFrame(); vars.setStackFrame(m_stackFrame); } else { // Yuck. Just to shut up the compiler! vars = null; savedStart = 0; } try { do { if(0 == m_extendedTypeID) { next = m_lastFetched = (DTM.NULL == m_lastFetched) ? m_traverser.first(m_context) : m_traverser.next(m_context, m_lastFetched); } else { next = m_lastFetched = (DTM.NULL == m_lastFetched) ? m_traverser.first(m_context, m_extendedTypeID) : m_traverser.next(m_context, m_lastFetched, m_extendedTypeID); } if (DTM.NULL != next) { if(DTMIterator.FILTER_ACCEPT == acceptNode(next)) break; else continue; } else break; } while (next != DTM.NULL); if (DTM.NULL != next) { m_pos++; return next; } else { m_foundLast = true; return DTM.NULL; } } finally { if (-1 != m_stackFrame) { // These two statements need to be combined into one operation. vars.setStackFrame(savedStart); } } } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(m_axis); String localName = getLocalName(); String namespace = getNamespace(); int what = m_whatToShow; // System.out.println("what: "); // NodeTest.debugWhatToShow(what); if(DTMFilter.SHOW_ALL == what || NodeTest.WILD.equals(localName) || NodeTest.WILD.equals(namespace)) { m_extendedTypeID = 0; } else { int type = getNodeTypeTest(what); m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type); } } /** * Return the first node out of the nodeset, if this expression is * a nodeset expression. This is the default implementation for * nodesets. *

    WARNING: Do not mutate this class from this function!

    * @param xctxt The XPath runtime context. * @return the first node out of the nodeset, or DTM.NULL. */ public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException { if(getPredicateCount() > 0) return super.asNode(xctxt); int current = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(current); DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis); String localName = getLocalName(); String namespace = getNamespace(); int what = m_whatToShow; // System.out.print(" (DescendantIterator) "); // System.out.println("what: "); // NodeTest.debugWhatToShow(what); if(DTMFilter.SHOW_ALL == what || localName == NodeTest.WILD || namespace == NodeTest.WILD) { return traverser.first(current); } else { int type = getNodeTypeTest(what); int extendedType = dtm.getExpandedTypeID(namespace, localName, type); return traverser.first(current, extendedType); } } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if (m_allowDetach) { m_traverser = null; m_extendedTypeID = 0; // Always call the superclass detach last! super.detach(); } } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return m_axis; } /** The traverser to use to navigate over the descendants. */ transient protected DTMAxisTraverser m_traverser; /** The axis that we are traversing. */ protected int m_axis; /** The extended type ID, not set until setRoot. */ protected int m_extendedTypeID; /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; if(m_axis != ((DescendantIterator)expr).m_axis) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/FilterExprIterator.java0000644000175000017500000001335010721374032024625 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterExprIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.objects.XNodeSet; public class FilterExprIterator extends BasicTestIterator { static final long serialVersionUID = 2552176105165737614L; /** The contained expression. Should be non-null. * @serial */ private Expression m_expr; /** The result of executing m_expr. Needs to be deep cloned on clone op. */ transient private XNodeSet m_exprObj; private boolean m_mustHardReset = false; private boolean m_canDetachNodeset = true; /** * Create a FilterExprIterator object. * */ public FilterExprIterator() { super(null); } /** * Create a FilterExprIterator object. * */ public FilterExprIterator(Expression expr) { super(null); m_expr = expr; } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_exprObj = FilterExprIteratorSimple.executeFilterExpr(context, m_execContext, getPrefixResolver(), getIsTopLevel(), m_stackFrame, m_expr); } /** * Get the next node via getNextXXX. Bottlenecked for derived class override. * @return The next node on the axis, or DTM.NULL. */ protected int getNextNode() { if (null != m_exprObj) { m_lastFetched = m_exprObj.nextNode(); } else m_lastFetched = DTM.NULL; return m_lastFetched; } /** * Detaches the walker from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. */ public void detach() { super.detach(); m_exprObj.detach(); m_exprObj = null; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); m_expr.fixupVariables(vars, globalsSize); } /** * Get the inner contained expression of this filter. */ public Expression getInnerExpression() { return m_expr; } /** * Set the inner contained expression of this filter. */ public void setInnerExpression(Expression expr) { expr.exprSetParent(this); m_expr = expr; } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { if (null != m_expr && m_expr instanceof PathComponent) { return ((PathComponent) m_expr).getAnalysisBits(); } return WalkerFactory.BIT_FILTER; } /** * Returns true if all the nodes in the iteration well be returned in document * order. * Warning: This can only be called after setRoot has been called! * * @return true as a default. */ public boolean isDocOrdered() { return m_exprObj.isDocOrdered(); } class filterExprOwner implements ExpressionOwner { /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_expr; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(FilterExprIterator.this); m_expr = exp; } } /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param visitor The visitor whose appropriate method will be called. */ public void callPredicateVisitors(XPathVisitor visitor) { m_expr.callVisitors(new filterExprOwner(), visitor); super.callPredicateVisitors(visitor); } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; FilterExprIterator fet = (FilterExprIterator) expr; if (!m_expr.deepEquals(fet.m_expr)) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/SubContextList.java0000644000175000017500000000330010721374030023751 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SubContextList.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xpath.XPathContext; /** * A class that implements this interface is a sub context node list, meaning it * is a node list for a location path step for a predicate. * @xsl.usage advanced */ public interface SubContextList { /** * Get the number of nodes in the node list, which, in the XSLT 1 based * counting system, is the last index position. * * * @param xctxt The XPath runtime context. * * @return the number of nodes in the node list. */ public int getLastPos(XPathContext xctxt); /** * Get the current sub-context position. * * @param xctxt The XPath runtime context. * * @return The position of the current node in the list. */ public int getProximityPosition(XPathContext xctxt); } libxalan2-java-2.7.1/src/org/apache/xpath/axes/NodeSequence.java0000644000175000017500000006125010721374033023410 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSequence.java 469367 2006-10-31 04:41:08Z minchau $ */ package org.apache.xpath.axes; import java.util.Vector; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.utils.NodeVector; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * This class is the dynamic wrapper for a Xalan DTMIterator instance, and * provides random access capabilities. */ public class NodeSequence extends XObject implements DTMIterator, Cloneable, PathComponent { static final long serialVersionUID = 3866261934726581044L; /** The index of the last node in the iteration. */ protected int m_last = -1; /** * The index of the next node to be fetched. Useful if this * is a cached iterator, and is being used as random access * NodeList. */ protected int m_next = 0; /** * A cache of a list of nodes obtained from the iterator so far. * This list is appended to until the iterator is exhausted and * the cache is complete. *

    * Multiple NodeSequence objects may share the same cache. */ private IteratorCache m_cache; /** * If this iterator needs to cache nodes that are fetched, they * are stored in the Vector in the generic object. */ protected NodeVector getVector() { NodeVector nv = (m_cache != null) ? m_cache.getVector() : null; return nv; } /** * Get the cache (if any) of nodes obtained from * the iterator so far. Note that the cache keeps * growing until the iterator is walked to exhaustion, * at which point the cache is "complete". */ private IteratorCache getCache() { return m_cache; } /** * Set the vector where nodes will be cached. */ protected void SetVector(NodeVector v) { setObject(v); } /** * If the iterator needs to cache nodes as they are fetched, * then this method returns true. */ public boolean hasCache() { final NodeVector nv = getVector(); return (nv != null); } /** * If this NodeSequence has a cache, and that cache is * fully populated then this method returns true, otherwise * if there is no cache or it is not complete it returns false. */ private boolean cacheComplete() { final boolean complete; if (m_cache != null) { complete = m_cache.isComplete(); } else { complete = false; } return complete; } /** * If this NodeSequence has a cache, mark that it is complete. * This method should be called after the iterator is exhausted. */ private void markCacheComplete() { NodeVector nv = getVector(); if (nv != null) { m_cache.setCacheComplete(true); } } /** * The functional iterator that fetches nodes. */ protected DTMIterator m_iter; /** * Set the functional iterator that fetches nodes. * @param iter The iterator that is to be contained. */ public final void setIter(DTMIterator iter) { m_iter = iter; } /** * Get the functional iterator that fetches nodes. * @return The contained iterator. */ public final DTMIterator getContainedIter() { return m_iter; } /** * The DTMManager to use if we're using a NodeVector only. * We may well want to do away with this, and store it in the NodeVector. */ protected DTMManager m_dtmMgr; // ==== Constructors ==== /** * Create a new NodeSequence from a (already cloned) iterator. * * @param iter Cloned (not static) DTMIterator. * @param context The initial context node. * @param xctxt The execution context. * @param shouldCacheNodes True if this sequence can random access. */ private NodeSequence(DTMIterator iter, int context, XPathContext xctxt, boolean shouldCacheNodes) { setIter(iter); setRoot(context, xctxt); setShouldCacheNodes(shouldCacheNodes); } /** * Create a new NodeSequence from a (already cloned) iterator. * * @param nodeVector */ public NodeSequence(Object nodeVector) { super(nodeVector); if (nodeVector instanceof NodeVector) { SetVector((NodeVector) nodeVector); } if(null != nodeVector) { assertion(nodeVector instanceof NodeVector, "Must have a NodeVector as the object for NodeSequence!"); if(nodeVector instanceof DTMIterator) { setIter((DTMIterator)nodeVector); m_last = ((DTMIterator)nodeVector).getLength(); } } } /** * Construct an empty XNodeSet object. This is used to create a mutable * nodeset to which random nodes may be added. */ private NodeSequence(DTMManager dtmMgr) { super(new NodeVector()); m_last = 0; m_dtmMgr = dtmMgr; } /** * Create a new NodeSequence in an invalid (null) state. */ public NodeSequence() { return; } /** * @see DTMIterator#getDTM(int) */ public DTM getDTM(int nodeHandle) { DTMManager mgr = getDTMManager(); if(null != mgr) return getDTMManager().getDTM(nodeHandle); else { assertion(false, "Can not get a DTM Unless a DTMManager has been set!"); return null; } } /** * @see DTMIterator#getDTMManager() */ public DTMManager getDTMManager() { return m_dtmMgr; } /** * @see DTMIterator#getRoot() */ public int getRoot() { if(null != m_iter) return m_iter.getRoot(); else { // NodeSetDTM will call this, and so it's not a good thing to throw // an assertion here. // assertion(false, "Can not get the root from a non-iterated NodeSequence!"); return DTM.NULL; } } /** * @see DTMIterator#setRoot(int, Object) */ public void setRoot(int nodeHandle, Object environment) { if(null != m_iter) { XPathContext xctxt = (XPathContext)environment; m_dtmMgr = xctxt.getDTMManager(); m_iter.setRoot(nodeHandle, environment); if(!m_iter.isDocOrdered()) { if(!hasCache()) setShouldCacheNodes(true); runTo(-1); m_next=0; } } else assertion(false, "Can not setRoot on a non-iterated NodeSequence!"); } /** * @see DTMIterator#reset() */ public void reset() { m_next = 0; // not resetting the iterator on purpose!!! } /** * @see DTMIterator#getWhatToShow() */ public int getWhatToShow() { return hasCache() ? (DTMFilter.SHOW_ALL & ~DTMFilter.SHOW_ENTITY_REFERENCE) : m_iter.getWhatToShow(); } /** * @see DTMIterator#getExpandEntityReferences() */ public boolean getExpandEntityReferences() { if(null != m_iter) return m_iter.getExpandEntityReferences(); else return true; } /** * @see DTMIterator#nextNode() */ public int nextNode() { // If the cache is on, and the node has already been found, then // just return from the list. NodeVector vec = getVector(); if (null != vec) { // There is a cache if(m_next < vec.size()) { // The node is in the cache, so just return it. int next = vec.elementAt(m_next); m_next++; return next; } else if(cacheComplete() || (-1 != m_last) || (null == m_iter)) { m_next++; return DTM.NULL; } } if (null == m_iter) return DTM.NULL; int next = m_iter.nextNode(); if(DTM.NULL != next) { if(hasCache()) { if(m_iter.isDocOrdered()) { getVector().addElement(next); m_next++; } else { int insertIndex = addNodeInDocOrder(next); if(insertIndex >= 0) m_next++; } } else m_next++; } else { // We have exhausted the iterator, and if there is a cache // it must have all nodes in it by now, so let the cache // know that it is complete. markCacheComplete(); m_last = m_next; m_next++; } return next; } /** * @see DTMIterator#previousNode() */ public int previousNode() { if(hasCache()) { if(m_next <= 0) return DTM.NULL; else { m_next--; return item(m_next); } } else { int n = m_iter.previousNode(); m_next = m_iter.getCurrentPos(); return m_next; } } /** * @see DTMIterator#detach() */ public void detach() { if(null != m_iter) m_iter.detach(); super.detach(); } /** * Calling this with a value of false will cause the nodeset * to be cached. * @see DTMIterator#allowDetachToRelease(boolean) */ public void allowDetachToRelease(boolean allowRelease) { if((false == allowRelease) && !hasCache()) { setShouldCacheNodes(true); } if(null != m_iter) m_iter.allowDetachToRelease(allowRelease); super.allowDetachToRelease(allowRelease); } /** * @see DTMIterator#getCurrentNode() */ public int getCurrentNode() { if(hasCache()) { int currentIndex = m_next-1; NodeVector vec = getVector(); if((currentIndex >= 0) && (currentIndex < vec.size())) return vec.elementAt(currentIndex); else return DTM.NULL; } if(null != m_iter) { return m_iter.getCurrentNode(); } else return DTM.NULL; } /** * @see DTMIterator#isFresh() */ public boolean isFresh() { return (0 == m_next); } /** * @see DTMIterator#setShouldCacheNodes(boolean) */ public void setShouldCacheNodes(boolean b) { if (b) { if(!hasCache()) { SetVector(new NodeVector()); } // else // getVector().RemoveAllNoClear(); // Is this good? } else SetVector(null); } /** * @see DTMIterator#isMutable() */ public boolean isMutable() { return hasCache(); // though may be surprising if it also has an iterator! } /** * @see DTMIterator#getCurrentPos() */ public int getCurrentPos() { return m_next; } /** * @see DTMIterator#runTo(int) */ public void runTo(int index) { int n; if (-1 == index) { int pos = m_next; while (DTM.NULL != (n = nextNode())); m_next = pos; } else if(m_next == index) { return; } else if(hasCache() && m_next < getVector().size()) { m_next = index; } else if((null == getVector()) && (index < m_next)) { while ((m_next >= index) && DTM.NULL != (n = previousNode())); } else { while ((m_next < index) && DTM.NULL != (n = nextNode())); } } /** * @see DTMIterator#setCurrentPos(int) */ public void setCurrentPos(int i) { runTo(i); } /** * @see DTMIterator#item(int) */ public int item(int index) { setCurrentPos(index); int n = nextNode(); m_next = index; return n; } /** * @see DTMIterator#setItem(int, int) */ public void setItem(int node, int index) { NodeVector vec = getVector(); if(null != vec) { int oldNode = vec.elementAt(index); if (oldNode != node && m_cache.useCount() > 1) { /* If we are going to set the node at the given index * to a different value, and the cache is shared * (has a use count greater than 1) * then make a copy of the cache and use it * so we don't overwrite the value for other * users of the cache. */ IteratorCache newCache = new IteratorCache(); final NodeVector nv; try { nv = (NodeVector) vec.clone(); } catch (CloneNotSupportedException e) { // This should never happen e.printStackTrace(); RuntimeException rte = new RuntimeException(e.getMessage()); throw rte; } newCache.setVector(nv); newCache.setCacheComplete(true); m_cache = newCache; vec = nv; // Keep our superclass informed of the current NodeVector super.setObject(nv); /* When we get to here the new cache has * a use count of 1 and when setting a * bunch of values on the same NodeSequence, * such as when sorting, we will keep setting * values in that same copy which has a use count of 1. */ } vec.setElementAt(node, index); m_last = vec.size(); } else m_iter.setItem(node, index); } /** * @see DTMIterator#getLength() */ public int getLength() { IteratorCache cache = getCache(); if(cache != null) { // Nodes from the iterator are cached if (cache.isComplete()) { // All of the nodes from the iterator are cached // so just return the number of nodes in the cache NodeVector nv = cache.getVector(); return nv.size(); } // If this NodeSequence wraps a mutable nodeset, then // m_last will not reflect the size of the nodeset if // it has been mutated... if (m_iter instanceof NodeSetDTM) { return m_iter.getLength(); } if(-1 == m_last) { int pos = m_next; runTo(-1); m_next = pos; } return m_last; } else { return (-1 == m_last) ? (m_last = m_iter.getLength()) : m_last; } } /** * Note: Not a deep clone. * @see DTMIterator#cloneWithReset() */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { NodeSequence seq = (NodeSequence)super.clone(); seq.m_next = 0; if (m_cache != null) { // In making this clone of an iterator we are making // another NodeSequence object it has a reference // to the same IteratorCache object as the original // so we need to remember that more than one // NodeSequence object shares the cache. m_cache.increaseUseCount(); } return seq; } /** * Get a clone of this iterator, but don't reset the iteration in the * process, so that it may be used from the current position. * Note: Not a deep clone. * * @return A clone of this object. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { NodeSequence clone = (NodeSequence) super.clone(); if (null != m_iter) clone.m_iter = (DTMIterator) m_iter.clone(); if (m_cache != null) { // In making this clone of an iterator we are making // another NodeSequence object it has a reference // to the same IteratorCache object as the original // so we need to remember that more than one // NodeSequence object shares the cache. m_cache.increaseUseCount(); } return clone; } /** * @see DTMIterator#isDocOrdered() */ public boolean isDocOrdered() { if(null != m_iter) return m_iter.isDocOrdered(); else return true; // can't be sure? } /** * @see DTMIterator#getAxis() */ public int getAxis() { if(null != m_iter) return m_iter.getAxis(); else { assertion(false, "Can not getAxis from a non-iterated node sequence!"); return 0; } } /** * @see PathComponent#getAnalysisBits() */ public int getAnalysisBits() { if((null != m_iter) && (m_iter instanceof PathComponent)) return ((PathComponent)m_iter).getAnalysisBits(); else return 0; } /** * @see org.apache.xpath.Expression#fixupVariables(Vector, int) */ public void fixupVariables(Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); } /** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @return insertIndex. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ protected int addNodeInDocOrder(int node) { assertion(hasCache(), "addNodeInDocOrder must be done on a mutable sequence!"); int insertIndex = -1; NodeVector vec = getVector(); // This needs to do a binary search, but a binary search // is somewhat tough because the sequence test involves // two nodes. int size = vec.size(), i; for (i = size - 1; i >= 0; i--) { int child = vec.elementAt(i); if (child == node) { i = -2; // Duplicate, suppress insert break; } DTM dtm = m_dtmMgr.getDTM(node); if (!dtm.isNodeAfter(node, child)) { break; } } if (i != -2) { insertIndex = i + 1; vec.insertElementAt(node, insertIndex); } // checkDups(); return insertIndex; } // end addNodeInDocOrder(Vector v, Object obj) /** * It used to be that many locations in the code simply * did an assignment to this.m_obj directly, rather than * calling the setObject(Object) method. The problem is * that our super-class would be updated on what the * cache associated with this NodeSequence, but * we wouldn't know ourselves. *

    * All setting of m_obj is done through setObject() now, * and this method over-rides the super-class method. * So now we are in the loop have an opportunity * to update some caching information. * */ protected void setObject(Object obj) { if (obj instanceof NodeVector) { // Keep our superclass informed of the current NodeVector // ... if we don't the smoketest fails (don't know why). super.setObject(obj); // A copy of the code of what SetVector() would do. NodeVector v = (NodeVector)obj; if (m_cache != null) { m_cache.setVector(v); } else if (v!=null) { m_cache = new IteratorCache(); m_cache.setVector(v); } } else if (obj instanceof IteratorCache) { IteratorCache cache = (IteratorCache) obj; m_cache = cache; m_cache.increaseUseCount(); // Keep our superclass informed of the current NodeVector super.setObject(cache.getVector()); } else { super.setObject(obj); } } /** * Each NodeSequence object has an iterator which is "walked". * As an iterator is walked one obtains nodes from it. * As those nodes are obtained they may be cached, making * the next walking of a copy or clone of the iterator faster. * This field (m_cache) is a reference to such a cache, * which is populated as the iterator is walked. *

    * Note that multiple NodeSequence objects may hold a * reference to the same cache, and also * (and this is important) the same iterator. * The iterator and its cache may be shared among * many NodeSequence objects. *

    * If one of the NodeSequence objects walks ahead * of the others it fills in the cache. * As the others NodeSequence objects catch up they * get their values from * the cache rather than the iterator itself, so * the iterator is only ever walked once and everyone * benefits from the cache. *

    * At some point the cache may be * complete due to walking to the end of one of * the copies of the iterator, and the cache is * then marked as "complete". * and the cache will have no more nodes added to it. *

    * Its use-count is the number of NodeSequence objects that use it. */ private final static class IteratorCache { /** * A list of nodes already obtained from the iterator. * As the iterator is walked the nodes obtained from * it are appended to this list. *

    * Both an iterator and its corresponding cache can * be shared by multiple NodeSequence objects. *

    * For example, consider three NodeSequence objects * ns1, ns2 and ns3 doing such sharing, and the * nodes to be obtaind from the iterator being * the sequence { 33, 11, 44, 22, 55 }. *

    * If ns3.nextNode() is called 3 times the the * underlying iterator will have walked through * 33, 11, 55 and these three nodes will have been put * in the cache. *

    * If ns2.nextNode() is called 2 times it will return * 33 and 11 from the cache, leaving the iterator alone. *

    * If ns1.nextNode() is called 6 times it will return * 33 and 11 from the cache, then get 44, 22, 55 from * the iterator, and appending 44, 22, 55 to the cache. * On the sixth call it is found that the iterator is * exhausted and the cache is marked complete. *

    * Should ns2 or ns3 have nextNode() called they will * know that the cache is complete, and they will * obtain all subsequent nodes from the cache. *

    * Note that the underlying iterator, though shared * is only ever walked once. */ private NodeVector m_vec2; /** * true if the associated iterator is exhausted and * all nodes obtained from it are in the cache. */ private boolean m_isComplete2; private int m_useCount2; IteratorCache() { m_vec2 = null; m_isComplete2 = false; m_useCount2 = 1; return; } /** * Returns count of how many NodeSequence objects share this * IteratorCache object. */ private int useCount() { return m_useCount2; } /** * This method is called when yet another * NodeSequence object uses, or shares * this same cache. * */ private void increaseUseCount() { if (m_vec2 != null) m_useCount2++; } /** * Sets the NodeVector that holds the * growing list of nodes as they are appended * to the cached list. */ private void setVector(NodeVector nv) { m_vec2 = nv; m_useCount2 = 1; } /** * Get the cached list of nodes obtained from * the iterator so far. */ private NodeVector getVector() { return m_vec2; } /** * Call this method with 'true' if the * iterator is exhausted and the cached list * is complete, or no longer growing. */ private void setCacheComplete(boolean b) { m_isComplete2 = b; } /** * Returns true if no cache is complete * and immutable. */ private boolean isComplete() { return m_isComplete2; } } /** * Get the cached list of nodes appended with * values obtained from the iterator as * a NodeSequence is walked when its * nextNode() method is called. */ protected IteratorCache getIteratorCache() { return m_cache; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/SelfIteratorNoPredicate.java0000644000175000017500000000743410721374030025554 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SelfIteratorNoPredicate.java 469263 2006-10-30 20:45:40Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.Compiler; /** * This class implements an optimized iterator for * "." patterns, that is, the self axes without any predicates. * @see org.apache.xpath.axes.LocPathIterator * @xsl.usage advanced */ public class SelfIteratorNoPredicate extends LocPathIterator { static final long serialVersionUID = -4226887905279814201L; /** * Create a SelfIteratorNoPredicate object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * @param analysis Analysis bits. * * @throws javax.xml.transform.TransformerException */ SelfIteratorNoPredicate(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, false); } /** * Create a SelfIteratorNoPredicate object. * * @throws javax.xml.transform.TransformerException */ public SelfIteratorNoPredicate() throws javax.xml.transform.TransformerException { super(null); } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if (m_foundLast) return DTM.NULL; int next; m_lastFetched = next = (DTM.NULL == m_lastFetched) ? m_context : DTM.NULL; // m_lastFetched = next; if (DTM.NULL != next) { m_pos++; return next; } else { m_foundLast = true; return DTM.NULL; } } /** * Return the first node out of the nodeset, if this expression is * a nodeset expression. This is the default implementation for * nodesets. Derived classes should try and override this and return a * value without having to do a clone operation. * @param xctxt The XPath runtime context. * @return the first node out of the nodeset, or DTM.NULL. */ public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException { return xctxt.getCurrentNode(); } /** * Get the index of the last node that can be itterated to. * This probably will need to be overridded by derived classes. * * @param xctxt XPath runtime context. * * @return the index of the last node that can be itterated to. */ public int getLastPos(XPathContext xctxt) { return 1; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/RTFIterator.java0000644000175000017500000000263010721374031023172 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RTFIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ /** * This class implements an RTF Iterator. Currently exists for sole * purpose of enabling EXSLT object-type function to return "RTF". * * @xsl.usage advanced */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTMManager; import org.apache.xpath.NodeSetDTM; public class RTFIterator extends NodeSetDTM { static final long serialVersionUID = 7658117366258528996L; /** * Constructor for RTFIterator */ public RTFIterator(int root, DTMManager manager) { super(root, manager); } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/OneStepIterator.java0000644000175000017500000002242210721374033024117 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OneStepIterator.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpMap; /** * This class implements a general iterator for * those LocationSteps with only one step, and perhaps a predicate. * @see org.apache.xpath.axes#LocPathIterator * @xsl.usage advanced */ public class OneStepIterator extends ChildTestIterator { static final long serialVersionUID = 4623710779664998283L; /** The traversal axis from where the nodes will be filtered. */ protected int m_axis = -1; /** The DTM inner traversal class, that corresponds to the super axis. */ protected DTMAxisIterator m_iterator; /** * Create a OneStepIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ OneStepIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis); int firstStepPos = OpMap.getFirstChildPos(opPos); m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos); } /** * Create a OneStepIterator object. * * @param iterator The DTM iterator which this iterator will use. * @param axis One of Axis.Child, etc., or -1 if the axis is unknown. * * @throws javax.xml.transform.TransformerException */ public OneStepIterator(DTMAxisIterator iterator, int axis) throws javax.xml.transform.TransformerException { super(null); m_iterator = iterator; m_axis = axis; int whatToShow = DTMFilter.SHOW_ALL; initNodeTest(whatToShow); } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); if(m_axis > -1) m_iterator = m_cdtm.getAxisIterator(m_axis); m_iterator.setStartNode(m_context); } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach) { if(m_axis > -1) m_iterator = null; // Always call the superclass detach last! super.detach(); } } /** * Get the next node via getFirstAttribute && getNextAttribute. */ protected int getNextNode() { return m_lastFetched = m_iterator.next(); } /** * Get a cloned iterator. * * @return A new iterator that can be used without mutating this one. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { // Do not access the location path itterator during this operation! OneStepIterator clone = (OneStepIterator) super.clone(); if(m_iterator != null) { clone.m_iterator = m_iterator.cloneIterator(); } return clone; } /** * Get a cloned Iterator that is reset to the beginning * of the query. * * @return A cloned NodeIterator set of the start of the query. * * @throws CloneNotSupportedException */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { OneStepIterator clone = (OneStepIterator) super.cloneWithReset(); clone.m_iterator = m_iterator; return clone; } /** * Tells if this is a reverse axes. Overrides AxesWalker#isReverseAxes. * * @return true for this class. */ public boolean isReverseAxes() { return m_iterator.isReverse(); } /** * Get the current sub-context position. In order to do the * reverse axes count, for the moment this re-searches the axes * up to the predicate. An optimization on this is to cache * the nodes searched, but, for the moment, this case is probably * rare enough that the added complexity isn't worth it. * * @param predicateIndex The predicate index of the proximity position. * * @return The pridicate index, or -1. */ protected int getProximityPosition(int predicateIndex) { if(!isReverseAxes()) return super.getProximityPosition(predicateIndex); // A negative predicate index seems to occur with // (preceding-sibling::*|following-sibling::*)/ancestor::*[position()]/*[position()] // -sb if(predicateIndex < 0) return -1; if (m_proximityPositions[predicateIndex] <= 0) { XPathContext xctxt = getXPathContext(); try { OneStepIterator clone = (OneStepIterator) this.clone(); int root = getRoot(); xctxt.pushCurrentNode(root); clone.setRoot(root, xctxt); // clone.setPredicateCount(predicateIndex); clone.m_predCount = predicateIndex; // Count 'em all int count = 1; int next; while (DTM.NULL != (next = clone.nextNode())) { count++; } m_proximityPositions[predicateIndex] += count; } catch (CloneNotSupportedException cnse) { // can't happen } finally { xctxt.popCurrentNode(); } } return m_proximityPositions[predicateIndex]; } /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. * * @return The number of nodes in the list, always greater or equal to zero. */ public int getLength() { if(!isReverseAxes()) return super.getLength(); // Tell if this is being called from within a predicate. boolean isPredicateTest = (this == m_execContext.getSubContextList()); // And get how many total predicates are part of this step. int predCount = getPredicateCount(); // If we have already calculated the length, and the current predicate // is the first predicate, then return the length. We don't cache // the anything but the length of the list to the first predicate. if (-1 != m_length && isPredicateTest && m_predicateIndex < 1) return m_length; int count = 0; XPathContext xctxt = getXPathContext(); try { OneStepIterator clone = (OneStepIterator) this.cloneWithReset(); int root = getRoot(); xctxt.pushCurrentNode(root); clone.setRoot(root, xctxt); clone.m_predCount = m_predicateIndex; int next; while (DTM.NULL != (next = clone.nextNode())) { count++; } } catch (CloneNotSupportedException cnse) { // can't happen } finally { xctxt.popCurrentNode(); } if (isPredicateTest && m_predicateIndex < 1) m_length = count; return count; } /** * Count backwards one proximity position. * * @param i The predicate index. */ protected void countProximityPosition(int i) { if(!isReverseAxes()) super.countProximityPosition(i); else if (i < m_proximityPositions.length) m_proximityPositions[i]--; } /** * Reset the iterator. */ public void reset() { super.reset(); if(null != m_iterator) m_iterator.reset(); } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return m_axis; } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!super.deepEquals(expr)) return false; if(m_axis != ((OneStepIterator)expr).m_axis) return false; return true; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/package.html0000644000175000017500000000211410721374031022440 0ustar mkochmkoch XPath LocationPath support.

    Implementation of XPath LocationPath support -- primary classes are LocPathIterator and UnionPathIterator.

    libxalan2-java-2.7.1/src/org/apache/xpath/axes/WalkerFactory.java0000644000175000017500000017106310721374031023611 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WalkerFactory.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.Expression; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.FunctionTable; import org.apache.xpath.compiler.OpCodes; import org.apache.xpath.compiler.OpMap; import org.apache.xpath.objects.XNumber; import org.apache.xpath.patterns.ContextMatchStepPattern; import org.apache.xpath.patterns.FunctionPattern; import org.apache.xpath.patterns.NodeTest; import org.apache.xpath.patterns.StepPattern; import org.apache.xpath.res.XPATHErrorResources; /** * This class is both a factory for XPath location path expressions, * which are built from the opcode map output, and an analysis engine * for the location path expressions in order to provide optimization hints. */ public class WalkerFactory { /** * This method is for building an array of possible levels * where the target element(s) could be found for a match. * @param lpi The owning location path iterator. * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return non-null AxesWalker derivative. * * @throws javax.xml.transform.TransformerException * @xsl.usage advanced */ static AxesWalker loadOneWalker( WalkingIterator lpi, Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { AxesWalker firstWalker = null; int stepType = compiler.getOp(stepOpCodePos); if (stepType != OpCodes.ENDOP) { // m_axesWalkers = new AxesWalker[1]; // As we unwind from the recursion, create the iterators. firstWalker = createDefaultWalker(compiler, stepType, lpi, 0); firstWalker.init(compiler, stepOpCodePos, stepType); } return firstWalker; } /** * This method is for building an array of possible levels * where the target element(s) could be found for a match. * @param lpi The owning location path iterator object. * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * @param stepIndex The top-level step index withing the iterator. * * @return non-null AxesWalker derivative. * * @throws javax.xml.transform.TransformerException * @xsl.usage advanced */ static AxesWalker loadWalkers( WalkingIterator lpi, Compiler compiler, int stepOpCodePos, int stepIndex) throws javax.xml.transform.TransformerException { int stepType; AxesWalker firstWalker = null; AxesWalker walker, prevWalker = null; int analysis = analyze(compiler, stepOpCodePos, stepIndex); while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) { walker = createDefaultWalker(compiler, stepOpCodePos, lpi, analysis); walker.init(compiler, stepOpCodePos, stepType); walker.exprSetParent(lpi); // walker.setAnalysis(analysis); if (null == firstWalker) { firstWalker = walker; } else { prevWalker.setNextWalker(walker); walker.setPrevWalker(prevWalker); } prevWalker = walker; stepOpCodePos = compiler.getNextStepPos(stepOpCodePos); if (stepOpCodePos < 0) break; } return firstWalker; } public static boolean isSet(int analysis, int bits) { return (0 != (analysis & bits)); } public static void diagnoseIterator(String name, int analysis, Compiler compiler) { System.out.println(compiler.toString()+", "+name+", " + Integer.toBinaryString(analysis) + ", " + getAnalysisString(analysis)); } /** * Create a new LocPathIterator iterator. The exact type of iterator * returned is based on an analysis of the XPath operations. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The position of the operation code for this itterator. * * @return non-null reference to a LocPathIterator or derivative. * * @throws javax.xml.transform.TransformerException */ public static DTMIterator newDTMIterator( Compiler compiler, int opPos, boolean isTopLevel) throws javax.xml.transform.TransformerException { int firstStepPos = OpMap.getFirstChildPos(opPos); int analysis = analyze(compiler, firstStepPos, 0); boolean isOneStep = isOneStep(analysis); DTMIterator iter; // Is the iteration a one-step attribute pattern (i.e. select="@foo")? if (isOneStep && walksSelfOnly(analysis) && isWild(analysis) && !hasPredicate(analysis)) { if (DEBUG_ITERATOR_CREATION) diagnoseIterator("SelfIteratorNoPredicate", analysis, compiler); // Then use a simple iteration of the attributes, with node test // and predicate testing. iter = new SelfIteratorNoPredicate(compiler, opPos, analysis); } // Is the iteration exactly one child step? else if (walksChildrenOnly(analysis) && isOneStep) { // Does the pattern specify *any* child with no predicate? (i.e. select="child::node()". if (isWild(analysis) && !hasPredicate(analysis)) { if (DEBUG_ITERATOR_CREATION) diagnoseIterator("ChildIterator", analysis, compiler); // Use simple child iteration without any test. iter = new ChildIterator(compiler, opPos, analysis); } else { if (DEBUG_ITERATOR_CREATION) diagnoseIterator("ChildTestIterator", analysis, compiler); // Else use simple node test iteration with predicate test. iter = new ChildTestIterator(compiler, opPos, analysis); } } // Is the iteration a one-step attribute pattern (i.e. select="@foo")? else if (isOneStep && walksAttributes(analysis)) { if (DEBUG_ITERATOR_CREATION) diagnoseIterator("AttributeIterator", analysis, compiler); // Then use a simple iteration of the attributes, with node test // and predicate testing. iter = new AttributeIterator(compiler, opPos, analysis); } else if(isOneStep && !walksFilteredList(analysis)) { if( !walksNamespaces(analysis) && (walksInDocOrder(analysis) || isSet(analysis, BIT_PARENT))) { if (false || DEBUG_ITERATOR_CREATION) diagnoseIterator("OneStepIteratorForward", analysis, compiler); // Then use a simple iteration of the attributes, with node test // and predicate testing. iter = new OneStepIteratorForward(compiler, opPos, analysis); } else { if (false || DEBUG_ITERATOR_CREATION) diagnoseIterator("OneStepIterator", analysis, compiler); // Then use a simple iteration of the attributes, with node test // and predicate testing. iter = new OneStepIterator(compiler, opPos, analysis); } } // Analysis of "//center": // bits: 1001000000001010000000000000011 // count: 3 // root // child:node() // BIT_DESCENDANT_OR_SELF // It's highly possible that we should have a seperate bit set for // "//foo" patterns. // For at least the time being, we can't optimize patterns like // "//table[3]", because this has to be analyzed as // "/descendant-or-self::node()/table[3]" in order for the indexes // to work right. else if (isOptimizableForDescendantIterator(compiler, firstStepPos, 0) // && getStepCount(analysis) <= 3 // && walksDescendants(analysis) // && walksSubtreeOnlyFromRootOrContext(analysis) ) { if (DEBUG_ITERATOR_CREATION) diagnoseIterator("DescendantIterator", analysis, compiler); iter = new DescendantIterator(compiler, opPos, analysis); } else { if(isNaturalDocOrder(compiler, firstStepPos, 0, analysis)) { if (false || DEBUG_ITERATOR_CREATION) { diagnoseIterator("WalkingIterator", analysis, compiler); } iter = new WalkingIterator(compiler, opPos, analysis, true); } else { // if (DEBUG_ITERATOR_CREATION) // diagnoseIterator("MatchPatternIterator", analysis, compiler); // // return new MatchPatternIterator(compiler, opPos, analysis); if (DEBUG_ITERATOR_CREATION) diagnoseIterator("WalkingIteratorSorted", analysis, compiler); iter = new WalkingIteratorSorted(compiler, opPos, analysis, true); } } if(iter instanceof LocPathIterator) ((LocPathIterator)iter).setIsTopLevel(isTopLevel); return iter; } /** * Special purpose function to see if we can optimize the pattern for * a DescendantIterator. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); } /** * Get a corresponding BIT_XXX from an axis. * @param axis One of Axis.ANCESTOR, etc. * @return One of BIT_ANCESTOR, etc. */ static public int getAnalysisBitFromAxes(int axis) { switch (axis) // Generate new traverser { case Axis.ANCESTOR : return BIT_ANCESTOR; case Axis.ANCESTORORSELF : return BIT_ANCESTOR_OR_SELF; case Axis.ATTRIBUTE : return BIT_ATTRIBUTE; case Axis.CHILD : return BIT_CHILD; case Axis.DESCENDANT : return BIT_DESCENDANT; case Axis.DESCENDANTORSELF : return BIT_DESCENDANT_OR_SELF; case Axis.FOLLOWING : return BIT_FOLLOWING; case Axis.FOLLOWINGSIBLING : return BIT_FOLLOWING_SIBLING; case Axis.NAMESPACE : case Axis.NAMESPACEDECLS : return BIT_NAMESPACE; case Axis.PARENT : return BIT_PARENT; case Axis.PRECEDING : return BIT_PRECEDING; case Axis.PRECEDINGSIBLING : return BIT_PRECEDING_SIBLING; case Axis.SELF : return BIT_SELF; case Axis.ALLFROMNODE : return BIT_DESCENDANT_OR_SELF; // case Axis.PRECEDINGANDANCESTOR : case Axis.DESCENDANTSFROMROOT : case Axis.ALL : case Axis.DESCENDANTSORSELFFROMROOT : return BIT_ANY_DESCENDANT_FROM_ROOT; case Axis.ROOT : return BIT_ROOT; case Axis.FILTEREDLIST : return BIT_FILTER; default : return BIT_FILTER; } } static boolean functionProximateOrContainsProximate(Compiler compiler, int opPos) { int endFunc = opPos + compiler.getOp(opPos + 1) - 1; opPos = OpMap.getFirstChildPos(opPos); int funcID = compiler.getOp(opPos); // System.out.println("funcID: "+funcID); // System.out.println("opPos: "+opPos); // System.out.println("endFunc: "+endFunc); switch(funcID) { case FunctionTable.FUNC_LAST: case FunctionTable.FUNC_POSITION: return true; default: opPos++; int i = 0; for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++) { int innerExprOpPos = p+2; int argOp = compiler.getOp(innerExprOpPos); boolean prox = isProximateInnerExpr(compiler, innerExprOpPos); if(prox) return true; } } return false; } static boolean isProximateInnerExpr(Compiler compiler, int opPos) { int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op) { case OpCodes.OP_ARGUMENT: if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; case OpCodes.OP_VARIABLE: case OpCodes.OP_NUMBERLIT: case OpCodes.OP_LITERAL: case OpCodes.OP_LOCATIONPATH: break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } return false; } /** * Tell if the predicates need to have proximity knowledge. */ public static boolean mightBeProximate(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { boolean mightBeProximate = false; int argLen; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : argLen = compiler.getArgLength(opPos); break; default : argLen = compiler.getArgLengthOfStep(opPos); } int predPos = compiler.getFirstPredicateOpPos(opPos); int count = 0; while (OpCodes.OP_PREDICATE == compiler.getOp(predPos)) { count++; int innerExprOpPos = predPos+2; int predOp = compiler.getOp(innerExprOpPos); switch(predOp) { case OpCodes.OP_VARIABLE: return true; // Would need more smarts to tell if this could be a number or not! case OpCodes.OP_LOCATIONPATH: // OK. break; case OpCodes.OP_NUMBER: case OpCodes.OP_NUMBERLIT: return true; // that's all she wrote! case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, innerExprOpPos); if(isProx) return true; break; case OpCodes.OP_GT: case OpCodes.OP_GTE: case OpCodes.OP_LT: case OpCodes.OP_LTE: case OpCodes.OP_EQUALS: int leftPos = OpMap.getFirstChildPos(innerExprOpPos); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true; break; default: return true; // be conservative... } predPos = compiler.getNextOpPos(predPos); } return mightBeProximate; } /** * Special purpose function to see if we can optimize the pattern for * a DescendantIterator. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * @param stepIndex The top-level step index withing the iterator. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ private static boolean isOptimizableForDescendantIterator( Compiler compiler, int stepOpCodePos, int stepIndex) throws javax.xml.transform.TransformerException { int stepType; int stepCount = 0; boolean foundDorDS = false; boolean foundSelf = false; boolean foundDS = false; int nodeTestType = OpCodes.NODETYPE_NODE; while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) { // The DescendantIterator can only do one node test. If there's more // than one, use another iterator. if(nodeTestType != OpCodes.NODETYPE_NODE && nodeTestType != OpCodes.NODETYPE_ROOT) return false; stepCount++; if(stepCount > 3) return false; boolean mightBeProximate = mightBeProximate(compiler, stepOpCodePos, stepType); if(mightBeProximate) return false; switch (stepType) { case OpCodes.FROM_FOLLOWING : case OpCodes.FROM_FOLLOWING_SIBLINGS : case OpCodes.FROM_PRECEDING : case OpCodes.FROM_PRECEDING_SIBLINGS : case OpCodes.FROM_PARENT : case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.FROM_NAMESPACE : case OpCodes.FROM_ANCESTORS : case OpCodes.FROM_ANCESTORS_OR_SELF : case OpCodes.FROM_ATTRIBUTES : case OpCodes.MATCH_ATTRIBUTE : case OpCodes.MATCH_ANY_ANCESTOR : case OpCodes.MATCH_IMMEDIATE_ANCESTOR : return false; case OpCodes.FROM_ROOT : if(1 != stepCount) return false; break; case OpCodes.FROM_CHILDREN : if(!foundDS && !(foundDorDS && foundSelf)) return false; break; case OpCodes.FROM_DESCENDANTS_OR_SELF : foundDS = true; case OpCodes.FROM_DESCENDANTS : if(3 == stepCount) return false; foundDorDS = true; break; case OpCodes.FROM_SELF : if(1 != stepCount) return false; foundSelf = true; break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " // + stepType); } nodeTestType = compiler.getStepTestType(stepOpCodePos); int nextStepOpCodePos = compiler.getNextStepPos(stepOpCodePos); if (nextStepOpCodePos < 0) break; if(OpCodes.ENDOP != compiler.getOp(nextStepOpCodePos)) { if(compiler.countPredicates(stepOpCodePos) > 0) { return false; } } stepOpCodePos = nextStepOpCodePos; } return true; } /** * Analyze the location path and return 32 bits that give information about * the location path as a whole. See the BIT_XXX constants for meaning about * each of the bits. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * @param stepIndex The top-level step index withing the iterator. * * @return 32 bits as an integer that give information about the location * path as a whole. * * @throws javax.xml.transform.TransformerException */ private static int analyze( Compiler compiler, int stepOpCodePos, int stepIndex) throws javax.xml.transform.TransformerException { int stepType; int stepCount = 0; int analysisResult = 0x00000000; // 32 bits of analysis while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) { stepCount++; // String namespace = compiler.getStepNS(stepOpCodePos); // boolean isNSWild = (null != namespace) // ? namespace.equals(NodeTest.WILD) : false; // String localname = compiler.getStepLocalName(stepOpCodePos); // boolean isWild = (null != localname) ? localname.equals(NodeTest.WILD) : false; boolean predAnalysis = analyzePredicate(compiler, stepOpCodePos, stepType); if (predAnalysis) analysisResult |= BIT_PREDICATE; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : analysisResult |= BIT_FILTER; break; case OpCodes.FROM_ROOT : analysisResult |= BIT_ROOT; break; case OpCodes.FROM_ANCESTORS : analysisResult |= BIT_ANCESTOR; break; case OpCodes.FROM_ANCESTORS_OR_SELF : analysisResult |= BIT_ANCESTOR_OR_SELF; break; case OpCodes.FROM_ATTRIBUTES : analysisResult |= BIT_ATTRIBUTE; break; case OpCodes.FROM_NAMESPACE : analysisResult |= BIT_NAMESPACE; break; case OpCodes.FROM_CHILDREN : analysisResult |= BIT_CHILD; break; case OpCodes.FROM_DESCENDANTS : analysisResult |= BIT_DESCENDANT; break; case OpCodes.FROM_DESCENDANTS_OR_SELF : // Use a special bit to to make sure we get the right analysis of "//foo". if (2 == stepCount && BIT_ROOT == analysisResult) { analysisResult |= BIT_ANY_DESCENDANT_FROM_ROOT; } analysisResult |= BIT_DESCENDANT_OR_SELF; break; case OpCodes.FROM_FOLLOWING : analysisResult |= BIT_FOLLOWING; break; case OpCodes.FROM_FOLLOWING_SIBLINGS : analysisResult |= BIT_FOLLOWING_SIBLING; break; case OpCodes.FROM_PRECEDING : analysisResult |= BIT_PRECEDING; break; case OpCodes.FROM_PRECEDING_SIBLINGS : analysisResult |= BIT_PRECEDING_SIBLING; break; case OpCodes.FROM_PARENT : analysisResult |= BIT_PARENT; break; case OpCodes.FROM_SELF : analysisResult |= BIT_SELF; break; case OpCodes.MATCH_ATTRIBUTE : analysisResult |= (BIT_MATCH_PATTERN | BIT_ATTRIBUTE); break; case OpCodes.MATCH_ANY_ANCESTOR : analysisResult |= (BIT_MATCH_PATTERN | BIT_ANCESTOR); break; case OpCodes.MATCH_IMMEDIATE_ANCESTOR : analysisResult |= (BIT_MATCH_PATTERN | BIT_PARENT); break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); } if (OpCodes.NODETYPE_NODE == compiler.getOp(stepOpCodePos + 3)) // child::node() { analysisResult |= BIT_NODETEST_ANY; } stepOpCodePos = compiler.getNextStepPos(stepOpCodePos); if (stepOpCodePos < 0) break; } analysisResult |= (stepCount & BITS_COUNT); return analysisResult; } /** * Tell if the given axis goes downword. Bogus name, if you can think of * a better one, please do tell. This really has to do with inverting * attribute axis. * @param axis One of Axis.XXX. * @return true if the axis is not a child axis and does not go up from * the axis root. */ public static boolean isDownwardAxisOfMany(int axis) { return ((Axis.DESCENDANTORSELF == axis) || (Axis.DESCENDANT == axis) || (Axis.FOLLOWING == axis) // || (Axis.FOLLOWINGSIBLING == axis) || (Axis.PRECEDING == axis) // || (Axis.PRECEDINGSIBLING == axis) ); } /** * Read a LocationPath * as a generalized match pattern. What this means is that the LocationPath * is read backwards, as a test on a given node, to see if it matches the * criteria of the selection, and ends up at the context node. Essentially, * this is a backwards query from a given node, to find the context node. *

    So, the selection "foo/daz[2]" is, in non-abreviated expanded syntax, * "self::node()/following-sibling::foo/child::daz[position()=2]". * Taking this as a match pattern for a probable node, it works out to * "self::daz/parent::foo[child::daz[position()=2 and isPrevStepNode()] * precedingSibling::node()[isContextNodeOfLocationPath()]", adding magic * isPrevStepNode and isContextNodeOfLocationPath operations. Predicates in * the location path have to be executed by the following step, * because they have to know the context of their execution. * * @param mpi The MatchPatternIterator to which the steps will be attached. * @param compiler The compiler that holds the syntax tree/op map to * construct from. * @param stepOpCodePos The current op code position within the opmap. * @param stepIndex The top-level step index withing the iterator. * * @return A StepPattern object, which may contain relative StepPatterns. * * @throws javax.xml.transform.TransformerException */ static StepPattern loadSteps( MatchPatternIterator mpi, Compiler compiler, int stepOpCodePos, int stepIndex) throws javax.xml.transform.TransformerException { if (DEBUG_PATTERN_CREATION) { System.out.println("================"); System.out.println("loadSteps for: "+compiler.getPatternString()); } int stepType; StepPattern step = null; StepPattern firstStep = null, prevStep = null; int analysis = analyze(compiler, stepOpCodePos, stepIndex); while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) { step = createDefaultStepPattern(compiler, stepOpCodePos, mpi, analysis, firstStep, prevStep); if (null == firstStep) { firstStep = step; } else { //prevStep.setNextWalker(step); step.setRelativePathPattern(prevStep); } prevStep = step; stepOpCodePos = compiler.getNextStepPos(stepOpCodePos); if (stepOpCodePos < 0) break; } int axis = Axis.SELF; int paxis = Axis.SELF; StepPattern tail = step; for (StepPattern pat = step; null != pat; pat = pat.getRelativePathPattern()) { int nextAxis = pat.getAxis(); //int nextPaxis = pat.getPredicateAxis(); pat.setAxis(axis); // The predicate axis can't be moved!!! Test Axes103 // pat.setPredicateAxis(paxis); // If we have an attribute or namespace axis that went up, then // it won't find the attribute in the inverse, since the select-to-match // axes are not invertable (an element is a parent of an attribute, but // and attribute is not a child of an element). // If we don't do the magic below, then "@*/ancestor-or-self::*" gets // inverted for match to "self::*/descendant-or-self::@*/parent::node()", // which obviously won't work. // So we will rewrite this as: // "self::*/descendant-or-self::*/attribute::*/parent::node()" // Child has to be rewritten a little differently: // select: "@*/parent::*" // inverted match: "self::*/child::@*/parent::node()" // rewrite: "self::*/attribute::*/parent::node()" // Axes that go down in the select, do not have to have special treatment // in the rewrite. The following inverted match will still not select // anything. // select: "@*/child::*" // inverted match: "self::*/parent::@*/parent::node()" // Lovely business, this. // -sb int whatToShow = pat.getWhatToShow(); if(whatToShow == DTMFilter.SHOW_ATTRIBUTE || whatToShow == DTMFilter.SHOW_NAMESPACE) { int newAxis = (whatToShow == DTMFilter.SHOW_ATTRIBUTE) ? Axis.ATTRIBUTE : Axis.NAMESPACE; if(isDownwardAxisOfMany(axis)) { StepPattern attrPat = new StepPattern(whatToShow, pat.getNamespace(), pat.getLocalName(), //newAxis, pat.getPredicateAxis); newAxis, 0); // don't care about the predicate axis XNumber score = pat.getStaticScore(); pat.setNamespace(null); pat.setLocalName(NodeTest.WILD); attrPat.setPredicates(pat.getPredicates()); pat.setPredicates(null); pat.setWhatToShow(DTMFilter.SHOW_ELEMENT); StepPattern rel = pat.getRelativePathPattern(); pat.setRelativePathPattern(attrPat); attrPat.setRelativePathPattern(rel); attrPat.setStaticScore(score); // This is needed to inverse a following pattern, because of the // wacky Xalan rules for following from an attribute. See axes108. // By these rules, following from an attribute is not strictly // inverseable. if(Axis.PRECEDING == pat.getAxis()) pat.setAxis(Axis.PRECEDINGANDANCESTOR); else if(Axis.DESCENDANT == pat.getAxis()) pat.setAxis(Axis.DESCENDANTORSELF); pat = attrPat; } else if(Axis.CHILD == pat.getAxis()) { // In this case just change the axis. // pat.setWhatToShow(whatToShow); pat.setAxis(Axis.ATTRIBUTE); } } axis = nextAxis; //paxis = nextPaxis; tail = pat; } if(axis < Axis.ALL) { StepPattern selfPattern = new ContextMatchStepPattern(axis, paxis); // We need to keep the new nodetest from affecting the score... XNumber score = tail.getStaticScore(); tail.setRelativePathPattern(selfPattern); tail.setStaticScore(score); selfPattern.setStaticScore(score); } if (DEBUG_PATTERN_CREATION) { System.out.println("Done loading steps: "+step.toString()); System.out.println(""); } return step; // start from last pattern?? //firstStep; } /** * Create a StepPattern that is contained within a LocationPath. * * * @param compiler The compiler that holds the syntax tree/op map to * construct from. * @param stepOpCodePos The current op code position within the opmap. * @param mpi The MatchPatternIterator to which the steps will be attached. * @param analysis 32 bits of analysis, from which the type of AxesWalker * may be influenced. * @param tail The step that is the first step analyzed, but the last * step in the relative match linked list, i.e. the tail. * May be null. * @param head The step that is the current head of the relative * match step linked list. * May be null. * * @return the head of the list. * * @throws javax.xml.transform.TransformerException */ private static StepPattern createDefaultStepPattern( Compiler compiler, int opPos, MatchPatternIterator mpi, int analysis, StepPattern tail, StepPattern head) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(opPos); boolean simpleInit = false; boolean prevIsOneStepDown = true; int whatToShow = compiler.getWhatToShow(opPos); StepPattern ai = null; int axis, predicateAxis; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : prevIsOneStepDown = false; Expression expr; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : expr = compiler.compile(opPos); break; default : expr = compiler.compile(opPos + 2); } axis = Axis.FILTEREDLIST; predicateAxis = Axis.FILTEREDLIST; ai = new FunctionPattern(expr, axis, predicateAxis); simpleInit = true; break; case OpCodes.FROM_ROOT : whatToShow = DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT; axis = Axis.ROOT; predicateAxis = Axis.ROOT; ai = new StepPattern(DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT, axis, predicateAxis); break; case OpCodes.FROM_ATTRIBUTES : whatToShow = DTMFilter.SHOW_ATTRIBUTE; axis = Axis.PARENT; predicateAxis = Axis.ATTRIBUTE; // ai = new StepPattern(whatToShow, Axis.SELF, Axis.SELF); break; case OpCodes.FROM_NAMESPACE : whatToShow = DTMFilter.SHOW_NAMESPACE; axis = Axis.PARENT; predicateAxis = Axis.NAMESPACE; // ai = new StepPattern(whatToShow, axis, predicateAxis); break; case OpCodes.FROM_ANCESTORS : axis = Axis.DESCENDANT; predicateAxis = Axis.ANCESTOR; break; case OpCodes.FROM_CHILDREN : axis = Axis.PARENT; predicateAxis = Axis.CHILD; break; case OpCodes.FROM_ANCESTORS_OR_SELF : axis = Axis.DESCENDANTORSELF; predicateAxis = Axis.ANCESTORORSELF; break; case OpCodes.FROM_SELF : axis = Axis.SELF; predicateAxis = Axis.SELF; break; case OpCodes.FROM_PARENT : axis = Axis.CHILD; predicateAxis = Axis.PARENT; break; case OpCodes.FROM_PRECEDING_SIBLINGS : axis = Axis.FOLLOWINGSIBLING; predicateAxis = Axis.PRECEDINGSIBLING; break; case OpCodes.FROM_PRECEDING : axis = Axis.FOLLOWING; predicateAxis = Axis.PRECEDING; break; case OpCodes.FROM_FOLLOWING_SIBLINGS : axis = Axis.PRECEDINGSIBLING; predicateAxis = Axis.FOLLOWINGSIBLING; break; case OpCodes.FROM_FOLLOWING : axis = Axis.PRECEDING; predicateAxis = Axis.FOLLOWING; break; case OpCodes.FROM_DESCENDANTS_OR_SELF : axis = Axis.ANCESTORORSELF; predicateAxis = Axis.DESCENDANTORSELF; break; case OpCodes.FROM_DESCENDANTS : axis = Axis.ANCESTOR; predicateAxis = Axis.DESCENDANT; break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); } if(null == ai) { whatToShow = compiler.getWhatToShow(opPos); // %REVIEW% ai = new StepPattern(whatToShow, compiler.getStepNS(opPos), compiler.getStepLocalName(opPos), axis, predicateAxis); } if (false || DEBUG_PATTERN_CREATION) { System.out.print("new step: "+ ai); System.out.print(", axis: " + Axis.getNames(ai.getAxis())); System.out.print(", predAxis: " + Axis.getNames(ai.getAxis())); System.out.print(", what: "); System.out.print(" "); ai.debugWhatToShow(ai.getWhatToShow()); } int argLen = compiler.getFirstPredicateOpPos(opPos); ai.setPredicates(compiler.getCompiledPredicates(argLen)); return ai; } /** * Analyze a step and give information about it's predicates. Right now this * just returns true or false if the step has a predicate. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param stepType The type of step, one of OP_GROUP, etc. * * @return true if step has a predicate. * * @throws javax.xml.transform.TransformerException */ static boolean analyzePredicate(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException { int argLen; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : argLen = compiler.getArgLength(opPos); break; default : argLen = compiler.getArgLengthOfStep(opPos); } int pos = compiler.getFirstPredicateOpPos(opPos); int nPredicates = compiler.countPredicates(pos); return (nPredicates > 0) ? true : false; } /** * Create the proper Walker from the axes type. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param lpi The owning location path iterator. * @param analysis 32 bits of analysis, from which the type of AxesWalker * may be influenced. * * @return non-null reference to AxesWalker derivative. * @throws RuntimeException if the input is bad. */ private static AxesWalker createDefaultWalker(Compiler compiler, int opPos, WalkingIterator lpi, int analysis) { AxesWalker ai = null; int stepType = compiler.getOp(opPos); /* System.out.println("0: "+compiler.getOp(opPos)); System.out.println("1: "+compiler.getOp(opPos+1)); System.out.println("2: "+compiler.getOp(opPos+2)); System.out.println("3: "+compiler.getOp(opPos+3)); System.out.println("4: "+compiler.getOp(opPos+4)); System.out.println("5: "+compiler.getOp(opPos+5)); */ boolean simpleInit = false; int totalNumberWalkers = (analysis & BITS_COUNT); boolean prevIsOneStepDown = true; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : prevIsOneStepDown = false; if (DEBUG_WALKER_CREATION) System.out.println("new walker: FilterExprWalker: " + analysis + ", " + compiler.toString()); ai = new FilterExprWalker(lpi); simpleInit = true; break; case OpCodes.FROM_ROOT : ai = new AxesWalker(lpi, Axis.ROOT); break; case OpCodes.FROM_ANCESTORS : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.ANCESTOR); break; case OpCodes.FROM_ANCESTORS_OR_SELF : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.ANCESTORORSELF); break; case OpCodes.FROM_ATTRIBUTES : ai = new AxesWalker(lpi, Axis.ATTRIBUTE); break; case OpCodes.FROM_NAMESPACE : ai = new AxesWalker(lpi, Axis.NAMESPACE); break; case OpCodes.FROM_CHILDREN : ai = new AxesWalker(lpi, Axis.CHILD); break; case OpCodes.FROM_DESCENDANTS : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.DESCENDANT); break; case OpCodes.FROM_DESCENDANTS_OR_SELF : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.DESCENDANTORSELF); break; case OpCodes.FROM_FOLLOWING : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.FOLLOWING); break; case OpCodes.FROM_FOLLOWING_SIBLINGS : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.FOLLOWINGSIBLING); break; case OpCodes.FROM_PRECEDING : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PRECEDING); break; case OpCodes.FROM_PRECEDING_SIBLINGS : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PRECEDINGSIBLING); break; case OpCodes.FROM_PARENT : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PARENT); break; case OpCodes.FROM_SELF : ai = new AxesWalker(lpi, Axis.SELF); break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); } if (simpleInit) { ai.initNodeTest(DTMFilter.SHOW_ALL); } else { int whatToShow = compiler.getWhatToShow(opPos); /* System.out.print("construct: "); NodeTest.debugWhatToShow(whatToShow); System.out.println("or stuff: "+(whatToShow & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_ELEMENT | DTMFilter.SHOW_PROCESSING_INSTRUCTION))); */ if ((0 == (whatToShow & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_NAMESPACE | DTMFilter.SHOW_ELEMENT | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == DTMFilter.SHOW_ALL)) ai.initNodeTest(whatToShow); else { ai.initNodeTest(whatToShow, compiler.getStepNS(opPos), compiler.getStepLocalName(opPos)); } } return ai; } public static String getAnalysisString(int analysis) { StringBuffer buf = new StringBuffer(); buf.append("count: "+getStepCount(analysis)+" "); if((analysis & BIT_NODETEST_ANY) != 0) { buf.append("NTANY|"); } if((analysis & BIT_PREDICATE) != 0) { buf.append("PRED|"); } if((analysis & BIT_ANCESTOR) != 0) { buf.append("ANC|"); } if((analysis & BIT_ANCESTOR_OR_SELF) != 0) { buf.append("ANCOS|"); } if((analysis & BIT_ATTRIBUTE) != 0) { buf.append("ATTR|"); } if((analysis & BIT_CHILD) != 0) { buf.append("CH|"); } if((analysis & BIT_DESCENDANT) != 0) { buf.append("DESC|"); } if((analysis & BIT_DESCENDANT_OR_SELF) != 0) { buf.append("DESCOS|"); } if((analysis & BIT_FOLLOWING) != 0) { buf.append("FOL|"); } if((analysis & BIT_FOLLOWING_SIBLING) != 0) { buf.append("FOLS|"); } if((analysis & BIT_NAMESPACE) != 0) { buf.append("NS|"); } if((analysis & BIT_PARENT) != 0) { buf.append("P|"); } if((analysis & BIT_PRECEDING) != 0) { buf.append("PREC|"); } if((analysis & BIT_PRECEDING_SIBLING) != 0) { buf.append("PRECS|"); } if((analysis & BIT_SELF) != 0) { buf.append(".|"); } if((analysis & BIT_FILTER) != 0) { buf.append("FLT|"); } if((analysis & BIT_ROOT) != 0) { buf.append("R|"); } return buf.toString(); } /** Set to true for diagnostics about walker creation */ static final boolean DEBUG_PATTERN_CREATION = false; /** Set to true for diagnostics about walker creation */ static final boolean DEBUG_WALKER_CREATION = false; /** Set to true for diagnostics about iterator creation */ static final boolean DEBUG_ITERATOR_CREATION = false; public static boolean hasPredicate(int analysis) { return (0 != (analysis & BIT_PREDICATE)); } public static boolean isWild(int analysis) { return (0 != (analysis & BIT_NODETEST_ANY)); } public static boolean walksAncestors(int analysis) { return isSet(analysis, BIT_ANCESTOR | BIT_ANCESTOR_OR_SELF); } public static boolean walksAttributes(int analysis) { return (0 != (analysis & BIT_ATTRIBUTE)); } public static boolean walksNamespaces(int analysis) { return (0 != (analysis & BIT_NAMESPACE)); } public static boolean walksChildren(int analysis) { return (0 != (analysis & BIT_CHILD)); } public static boolean walksDescendants(int analysis) { return isSet(analysis, BIT_DESCENDANT | BIT_DESCENDANT_OR_SELF); } public static boolean walksSubtree(int analysis) { return isSet(analysis, BIT_DESCENDANT | BIT_DESCENDANT_OR_SELF | BIT_CHILD); } public static boolean walksSubtreeOnlyMaybeAbsolute(int analysis) { return walksSubtree(analysis) && !walksExtraNodes(analysis) && !walksUp(analysis) && !walksSideways(analysis) ; } public static boolean walksSubtreeOnly(int analysis) { return walksSubtreeOnlyMaybeAbsolute(analysis) && !isAbsolute(analysis) ; } public static boolean walksFilteredList(int analysis) { return isSet(analysis, BIT_FILTER); } public static boolean walksSubtreeOnlyFromRootOrContext(int analysis) { return walksSubtree(analysis) && !walksExtraNodes(analysis) && !walksUp(analysis) && !walksSideways(analysis) && !isSet(analysis, BIT_FILTER) ; } public static boolean walksInDocOrder(int analysis) { return (walksSubtreeOnlyMaybeAbsolute(analysis) || walksExtraNodesOnly(analysis) || walksFollowingOnlyMaybeAbsolute(analysis)) && !isSet(analysis, BIT_FILTER) ; } public static boolean walksFollowingOnlyMaybeAbsolute(int analysis) { return isSet(analysis, BIT_SELF | BIT_FOLLOWING_SIBLING | BIT_FOLLOWING) && !walksSubtree(analysis) && !walksUp(analysis) && !walksSideways(analysis) ; } public static boolean walksUp(int analysis) { return isSet(analysis, BIT_PARENT | BIT_ANCESTOR | BIT_ANCESTOR_OR_SELF); } public static boolean walksSideways(int analysis) { return isSet(analysis, BIT_FOLLOWING | BIT_FOLLOWING_SIBLING | BIT_PRECEDING | BIT_PRECEDING_SIBLING); } public static boolean walksExtraNodes(int analysis) { return isSet(analysis, BIT_NAMESPACE | BIT_ATTRIBUTE); } public static boolean walksExtraNodesOnly(int analysis) { return walksExtraNodes(analysis) && !isSet(analysis, BIT_SELF) && !walksSubtree(analysis) && !walksUp(analysis) && !walksSideways(analysis) && !isAbsolute(analysis) ; } public static boolean isAbsolute(int analysis) { return isSet(analysis, BIT_ROOT | BIT_FILTER); } public static boolean walksChildrenOnly(int analysis) { return walksChildren(analysis) && !isSet(analysis, BIT_SELF) && !walksExtraNodes(analysis) && !walksDescendants(analysis) && !walksUp(analysis) && !walksSideways(analysis) && (!isAbsolute(analysis) || isSet(analysis, BIT_ROOT)) ; } public static boolean walksChildrenAndExtraAndSelfOnly(int analysis) { return walksChildren(analysis) && !walksDescendants(analysis) && !walksUp(analysis) && !walksSideways(analysis) && (!isAbsolute(analysis) || isSet(analysis, BIT_ROOT)) ; } public static boolean walksDescendantsAndExtraAndSelfOnly(int analysis) { return !walksChildren(analysis) && walksDescendants(analysis) && !walksUp(analysis) && !walksSideways(analysis) && (!isAbsolute(analysis) || isSet(analysis, BIT_ROOT)) ; } public static boolean walksSelfOnly(int analysis) { return isSet(analysis, BIT_SELF) && !walksSubtree(analysis) && !walksUp(analysis) && !walksSideways(analysis) && !isAbsolute(analysis) ; } public static boolean walksUpOnly(int analysis) { return !walksSubtree(analysis) && walksUp(analysis) && !walksSideways(analysis) && !isAbsolute(analysis) ; } public static boolean walksDownOnly(int analysis) { return walksSubtree(analysis) && !walksUp(analysis) && !walksSideways(analysis) && !isAbsolute(analysis) ; } public static boolean walksDownExtraOnly(int analysis) { return walksSubtree(analysis) && walksExtraNodes(analysis) && !walksUp(analysis) && !walksSideways(analysis) && !isAbsolute(analysis) ; } public static boolean canSkipSubtrees(int analysis) { return isSet(analysis, BIT_CHILD) | walksSideways(analysis); } public static boolean canCrissCross(int analysis) { // This could be done faster. Coded for clarity. if(walksSelfOnly(analysis)) return false; else if(walksDownOnly(analysis) && !canSkipSubtrees(analysis)) return false; else if(walksChildrenAndExtraAndSelfOnly(analysis)) return false; else if(walksDescendantsAndExtraAndSelfOnly(analysis)) return false; else if(walksUpOnly(analysis)) return false; else if(walksExtraNodesOnly(analysis)) return false; else if(walksSubtree(analysis) && (walksSideways(analysis) || walksUp(analysis) || canSkipSubtrees(analysis))) return true; else return false; } /** * Tell if the pattern can be 'walked' with the iteration steps in natural * document order, without duplicates. * * @param analysis The general analysis of the pattern. * * @return true if the walk can be done in natural order. * * @throws javax.xml.transform.TransformerException */ static public boolean isNaturalDocOrder(int analysis) { if(canCrissCross(analysis) || isSet(analysis, BIT_NAMESPACE) || walksFilteredList(analysis)) return false; if(walksInDocOrder(analysis)) return true; return false; } /** * Tell if the pattern can be 'walked' with the iteration steps in natural * document order, without duplicates. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * @param stepIndex The top-level step index withing the iterator. * @param analysis The general analysis of the pattern. * * @return true if the walk can be done in natural order. * * @throws javax.xml.transform.TransformerException */ private static boolean isNaturalDocOrder( Compiler compiler, int stepOpCodePos, int stepIndex, int analysis) throws javax.xml.transform.TransformerException { if(canCrissCross(analysis)) return false; // Namespaces can present some problems, so just punt if we're looking for // these. if(isSet(analysis, BIT_NAMESPACE)) return false; // The following, preceding, following-sibling, and preceding sibling can // be found in doc order if we get to this point, but if they occur // together, they produce // duplicates, so it's better for us to eliminate this case so we don't // have to check for duplicates during runtime if we're using a // WalkingIterator. if(isSet(analysis, BIT_FOLLOWING | BIT_FOLLOWING_SIBLING) && isSet(analysis, BIT_PRECEDING | BIT_PRECEDING_SIBLING)) return false; // OK, now we have to check for select="@*/axis::*" patterns, which // can also cause duplicates to happen. But select="axis*/@::*" patterns // are OK, as are select="@foo/axis::*" patterns. // Unfortunately, we can't do this just via the analysis bits. int stepType; int stepCount = 0; boolean foundWildAttribute = false; // Steps that can traverse anything other than down a // subtree or that can produce duplicates when used in // combonation are counted with this variable. int potentialDuplicateMakingStepCount = 0; while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) { stepCount++; switch (stepType) { case OpCodes.FROM_ATTRIBUTES : case OpCodes.MATCH_ATTRIBUTE : if(foundWildAttribute) // Maybe not needed, but be safe. return false; // This doesn't seem to work as a test for wild card. Hmph. // int nodeTestType = compiler.getStepTestType(stepOpCodePos); String localName = compiler.getStepLocalName(stepOpCodePos); // System.err.println("localName: "+localName); if(localName.equals("*")) { foundWildAttribute = true; } break; case OpCodes.FROM_FOLLOWING : case OpCodes.FROM_FOLLOWING_SIBLINGS : case OpCodes.FROM_PRECEDING : case OpCodes.FROM_PRECEDING_SIBLINGS : case OpCodes.FROM_PARENT : case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.FROM_NAMESPACE : case OpCodes.FROM_ANCESTORS : case OpCodes.FROM_ANCESTORS_OR_SELF : case OpCodes.MATCH_ANY_ANCESTOR : case OpCodes.MATCH_IMMEDIATE_ANCESTOR : case OpCodes.FROM_DESCENDANTS_OR_SELF : case OpCodes.FROM_DESCENDANTS : if(potentialDuplicateMakingStepCount > 0) return false; potentialDuplicateMakingStepCount++; case OpCodes.FROM_ROOT : case OpCodes.FROM_CHILDREN : case OpCodes.FROM_SELF : if(foundWildAttribute) return false; break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " // + stepType); } int nextStepOpCodePos = compiler.getNextStepPos(stepOpCodePos); if (nextStepOpCodePos < 0) break; stepOpCodePos = nextStepOpCodePos; } return true; } public static boolean isOneStep(int analysis) { return (analysis & BITS_COUNT) == 0x00000001; } public static int getStepCount(int analysis) { return (analysis & BITS_COUNT); } /** * First 8 bits are the number of top-level location steps. Hopefully * there will never be more that 255 location steps!!! */ public static final int BITS_COUNT = 0x000000FF; /** 4 bits are reserved for future use. */ public static final int BITS_RESERVED = 0x00000F00; /** Bit is on if the expression contains a top-level predicate. */ public static final int BIT_PREDICATE = (0x00001000); /** Bit is on if any of the walkers contain an ancestor step. */ public static final int BIT_ANCESTOR = (0x00001000 << 1); /** Bit is on if any of the walkers contain an ancestor-or-self step. */ public static final int BIT_ANCESTOR_OR_SELF = (0x00001000 << 2); /** Bit is on if any of the walkers contain an attribute step. */ public static final int BIT_ATTRIBUTE = (0x00001000 << 3); /** Bit is on if any of the walkers contain a child step. */ public static final int BIT_CHILD = (0x00001000 << 4); /** Bit is on if any of the walkers contain a descendant step. */ public static final int BIT_DESCENDANT = (0x00001000 << 5); /** Bit is on if any of the walkers contain a descendant-or-self step. */ public static final int BIT_DESCENDANT_OR_SELF = (0x00001000 << 6); /** Bit is on if any of the walkers contain a following step. */ public static final int BIT_FOLLOWING = (0x00001000 << 7); /** Bit is on if any of the walkers contain a following-sibiling step. */ public static final int BIT_FOLLOWING_SIBLING = (0x00001000 << 8); /** Bit is on if any of the walkers contain a namespace step. */ public static final int BIT_NAMESPACE = (0x00001000 << 9); /** Bit is on if any of the walkers contain a parent step. */ public static final int BIT_PARENT = (0x00001000 << 10); /** Bit is on if any of the walkers contain a preceding step. */ public static final int BIT_PRECEDING = (0x00001000 << 11); /** Bit is on if any of the walkers contain a preceding-sibling step. */ public static final int BIT_PRECEDING_SIBLING = (0x00001000 << 12); /** Bit is on if any of the walkers contain a self step. */ public static final int BIT_SELF = (0x00001000 << 13); /** * Bit is on if any of the walkers contain a filter (i.e. id(), extension * function, etc.) step. */ public static final int BIT_FILTER = (0x00001000 << 14); /** Bit is on if any of the walkers contain a root step. */ public static final int BIT_ROOT = (0x00001000 << 15); /** * If any of these bits are on, the expression may likely traverse outside * the given subtree. */ public static final int BITMASK_TRAVERSES_OUTSIDE_SUBTREE = (BIT_NAMESPACE // ?? | BIT_PRECEDING_SIBLING | BIT_PRECEDING | BIT_FOLLOWING_SIBLING | BIT_FOLLOWING | BIT_PARENT // except parent of attrs. | BIT_ANCESTOR_OR_SELF | BIT_ANCESTOR | BIT_FILTER | BIT_ROOT); /** * Bit is on if any of the walkers can go backwards in document * order from the context node. */ public static final int BIT_BACKWARDS_SELF = (0x00001000 << 16); /** Found "//foo" pattern */ public static final int BIT_ANY_DESCENDANT_FROM_ROOT = (0x00001000 << 17); /** * Bit is on if any of the walkers contain an node() test. This is * really only useful if the count is 1. */ public static final int BIT_NODETEST_ANY = (0x00001000 << 18); // can't go higher than 18! /** Bit is on if the expression is a match pattern. */ public static final int BIT_MATCH_PATTERN = (0x00001000 << 19); } libxalan2-java-2.7.1/src/org/apache/xpath/axes/BasicTestIterator.java0000644000175000017500000001434110721374032024423 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BasicTestIterator.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpMap; /** * Base for iterators that handle predicates. Does the basic next * node logic, so all the derived iterator has to do is get the * next node. */ public abstract class BasicTestIterator extends LocPathIterator { static final long serialVersionUID = 3505378079378096623L; /** * Create a LocPathIterator object. * * @param nscontext The namespace context for this iterator, * should be OK if null. */ protected BasicTestIterator() { } /** * Create a LocPathIterator object. * * @param nscontext The namespace context for this iterator, * should be OK if null. */ protected BasicTestIterator(PrefixResolver nscontext) { super(nscontext); } /** * Create a LocPathIterator object, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * * @throws javax.xml.transform.TransformerException */ protected BasicTestIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, false); int firstStepPos = OpMap.getFirstChildPos(opPos); int whatToShow = compiler.getWhatToShow(firstStepPos); if ((0 == (whatToShow & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_NAMESPACE | DTMFilter.SHOW_ELEMENT | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == DTMFilter.SHOW_ALL)) initNodeTest(whatToShow); else { initNodeTest(whatToShow, compiler.getStepNS(firstStepPos), compiler.getStepLocalName(firstStepPos)); } initPredicateInfo(compiler, firstStepPos); } /** * Create a LocPathIterator object, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param shouldLoadWalkers True if walkers should be * loaded, or false if this is a derived iterator and * it doesn't wish to load child walkers. * * @throws javax.xml.transform.TransformerException */ protected BasicTestIterator( Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, shouldLoadWalkers); } /** * Get the next node via getNextXXX. Bottlenecked for derived class override. * @return The next node on the axis, or DTM.NULL. */ protected abstract int getNextNode(); /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if(m_foundLast) { m_lastFetched = DTM.NULL; return DTM.NULL; } if(DTM.NULL == m_lastFetched) { resetProximityPositions(); } int next; org.apache.xpath.VariableStack vars; int savedStart; if (-1 != m_stackFrame) { vars = m_execContext.getVarStack(); // These three statements need to be combined into one operation. savedStart = vars.getStackFrame(); vars.setStackFrame(m_stackFrame); } else { // Yuck. Just to shut up the compiler! vars = null; savedStart = 0; } try { do { next = getNextNode(); if (DTM.NULL != next) { if(DTMIterator.FILTER_ACCEPT == acceptNode(next)) break; else continue; } else break; } while (next != DTM.NULL); if (DTM.NULL != next) { m_pos++; return next; } else { m_foundLast = true; return DTM.NULL; } } finally { if (-1 != m_stackFrame) { // These two statements need to be combined into one operation. vars.setStackFrame(savedStart); } } } /** * Get a cloned Iterator that is reset to the beginning * of the query. * * @return A cloned NodeIterator set of the start of the query. * * @throws CloneNotSupportedException */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { ChildTestIterator clone = (ChildTestIterator) super.cloneWithReset(); clone.resetProximityPositions(); return clone; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/ChildTestIterator.java0000644000175000017500000001243110721374031024422 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ChildTestIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.compiler.Compiler; /** * This class implements an optimized iterator for * children patterns that have a node test, and possibly a predicate. * @see org.apache.xpath.axes.BasicTestIterator * @xsl.usage advanced */ public class ChildTestIterator extends BasicTestIterator { static final long serialVersionUID = -7936835957960705722L; /** The traverser to use to navigate over the descendants. */ transient protected DTMAxisTraverser m_traverser; /** The extended type ID, not set until setRoot. */ // protected int m_extendedTypeID; /** * Create a ChildTestIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ ChildTestIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis); } /** * Create a ChildTestIterator object. * * @param traverser Traverser that tells how the KeyIterator is to be handled. * * @throws javax.xml.transform.TransformerException */ public ChildTestIterator(DTMAxisTraverser traverser) { super(null); m_traverser = traverser; } /** * Get the next node via getNextXXX. Bottlenecked for derived class override. * @return The next node on the axis, or DTM.NULL. */ protected int getNextNode() { if(true /* 0 == m_extendedTypeID */) { m_lastFetched = (DTM.NULL == m_lastFetched) ? m_traverser.first(m_context) : m_traverser.next(m_context, m_lastFetched); } // else // { // m_lastFetched = (DTM.NULL == m_lastFetched) // ? m_traverser.first(m_context, m_extendedTypeID) // : m_traverser.next(m_context, m_lastFetched, // m_extendedTypeID); // } return m_lastFetched; } /** * Get a cloned Iterator that is reset to the beginning * of the query. * * @return A cloned NodeIterator set of the start of the query. * * @throws CloneNotSupportedException */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { ChildTestIterator clone = (ChildTestIterator) super.cloneWithReset(); clone.m_traverser = m_traverser; return clone; } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(Axis.CHILD); // String localName = getLocalName(); // String namespace = getNamespace(); // int what = m_whatToShow; // // System.out.println("what: "); // // NodeTest.debugWhatToShow(what); // if(DTMFilter.SHOW_ALL == what || // ((DTMFilter.SHOW_ELEMENT & what) == 0) // || localName == NodeTest.WILD // || namespace == NodeTest.WILD) // { // m_extendedTypeID = 0; // } // else // { // int type = getNodeTypeTest(what); // m_extendedTypeID = m_cdtm.getExpandedTypeID(namespace, localName, type); // } } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return org.apache.xml.dtm.Axis.CHILD; } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach) { m_traverser = null; // Always call the superclass detach last! super.detach(); } } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/PredicatedNodeTest.java0000644000175000017500000004416210721374032024546 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PredicatedNodeTest.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.objects.XObject; import org.apache.xpath.patterns.NodeTest; public abstract class PredicatedNodeTest extends NodeTest implements SubContextList { static final long serialVersionUID = -6193530757296377351L; /** * Construct an AxesWalker using a LocPathIterator. * * @param locPathIterator non-null reference to the parent iterator. */ PredicatedNodeTest(LocPathIterator locPathIterator) { m_lpi = locPathIterator; } /** * Construct an AxesWalker. The location path iterator will have to be set * before use. */ PredicatedNodeTest() { } /** * Read the object from a serialization stream. * * @param stream Input stream to read from * * @throws java.io.IOException * @throws javax.xml.transform.TransformerException */ private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, javax.xml.transform.TransformerException { try { stream.defaultReadObject(); m_predicateIndex = -1; resetProximityPositions(); } catch (ClassNotFoundException cnfe) { throw new javax.xml.transform.TransformerException(cnfe); } } /** * Get a cloned PrdicatedNodeTest. * * @return A new PredicatedNodeTest that can be used without mutating this one. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { // Do not access the location path itterator during this operation! PredicatedNodeTest clone = (PredicatedNodeTest) super.clone(); if ((null != this.m_proximityPositions) && (this.m_proximityPositions == clone.m_proximityPositions)) { clone.m_proximityPositions = new int[this.m_proximityPositions.length]; System.arraycopy(this.m_proximityPositions, 0, clone.m_proximityPositions, 0, this.m_proximityPositions.length); } if(clone.m_lpi == this) clone.m_lpi = (LocPathIterator)clone; return clone; } // Only for clones for findLastPos. See bug4638. protected int m_predCount = -1; /** * Get the number of predicates that this walker has. * * @return the number of predicates that this walker has. */ public int getPredicateCount() { if(-1 == m_predCount) return (null == m_predicates) ? 0 : m_predicates.length; else return m_predCount; } /** * Set the number of predicates that this walker has. This does more * that one would think, as it creates a new predicate array of the * size of the count argument, and copies count predicates into the new * one from the old, and then reassigns the predicates value. All this * to keep from having to have a predicate count value. * * @param count The number of predicates, which must be equal or less * than the existing count. */ public void setPredicateCount(int count) { if(count > 0) { Expression[] newPredicates = new Expression[count]; for (int i = 0; i < count; i++) { newPredicates[i] = m_predicates[i]; } m_predicates = newPredicates; } else m_predicates = null; } /** * Init predicate info. * * @param compiler The Compiler object that has information about this * walker in the op map. * @param opPos The op code position of this location step. * * @throws javax.xml.transform.TransformerException */ protected void initPredicateInfo(Compiler compiler, int opPos) throws javax.xml.transform.TransformerException { int pos = compiler.getFirstPredicateOpPos(opPos); if(pos > 0) { m_predicates = compiler.getCompiledPredicates(pos); if(null != m_predicates) { for(int i = 0; i < m_predicates.length; i++) { m_predicates[i].exprSetParent(this); } } } } /** * Get a predicate expression at the given index. * * * @param index Index of the predicate. * * @return A predicate expression. */ public Expression getPredicate(int index) { return m_predicates[index]; } /** * Get the current sub-context position. * * @return The node position of this walker in the sub-context node list. */ public int getProximityPosition() { // System.out.println("getProximityPosition - m_predicateIndex: "+m_predicateIndex); return getProximityPosition(m_predicateIndex); } /** * Get the current sub-context position. * * @param xctxt The XPath runtime context. * * @return The node position of this walker in the sub-context node list. */ public int getProximityPosition(XPathContext xctxt) { return getProximityPosition(); } /** * Get the index of the last node that can be itterated to. * * * @param xctxt XPath runtime context. * * @return the index of the last node that can be itterated to. */ public abstract int getLastPos(XPathContext xctxt); /** * Get the current sub-context position. * * @param predicateIndex The index of the predicate where the proximity * should be taken from. * * @return The node position of this walker in the sub-context node list. */ protected int getProximityPosition(int predicateIndex) { return (predicateIndex >= 0) ? m_proximityPositions[predicateIndex] : 0; } /** * Reset the proximity positions counts. */ public void resetProximityPositions() { int nPredicates = getPredicateCount(); if (nPredicates > 0) { if (null == m_proximityPositions) m_proximityPositions = new int[nPredicates]; for (int i = 0; i < nPredicates; i++) { try { initProximityPosition(i); } catch(Exception e) { // TODO: Fix this... throw new org.apache.xml.utils.WrappedRuntimeException(e); } } } } /** * Init the proximity position to zero for a forward axes. * * @param i The index into the m_proximityPositions array. * * @throws javax.xml.transform.TransformerException */ public void initProximityPosition(int i) throws javax.xml.transform.TransformerException { m_proximityPositions[i] = 0; } /** * Count forward one proximity position. * * @param i The index into the m_proximityPositions array, where the increment * will occur. */ protected void countProximityPosition(int i) { // Note that in the case of a UnionChildIterator, this may be a // static object and so m_proximityPositions may indeed be null! int[] pp = m_proximityPositions; if ((null != pp) && (i < pp.length)) pp[i]++; } /** * Tells if this is a reverse axes. * * @return false, unless a derived class overrides. */ public boolean isReverseAxes() { return false; } /** * Get which predicate is executing. * * @return The current predicate index, or -1 if no predicate is executing. */ public int getPredicateIndex() { return m_predicateIndex; } /** * Process the predicates. * * @param context The current context node. * @param xctxt The XPath runtime context. * * @return the result of executing the predicate expressions. * * @throws javax.xml.transform.TransformerException */ boolean executePredicates(int context, XPathContext xctxt) throws javax.xml.transform.TransformerException { int nPredicates = getPredicateCount(); // System.out.println("nPredicates: "+nPredicates); if (nPredicates == 0) return true; PrefixResolver savedResolver = xctxt.getNamespaceContext(); try { m_predicateIndex = 0; xctxt.pushSubContextList(this); xctxt.pushNamespaceContext(m_lpi.getPrefixResolver()); xctxt.pushCurrentNode(context); for (int i = 0; i < nPredicates; i++) { // System.out.println("Executing predicate expression - waiting count: "+m_lpi.getWaitingCount()); XObject pred = m_predicates[i].execute(xctxt); // System.out.println("\nBack from executing predicate expression - waiting count: "+m_lpi.getWaitingCount()); // System.out.println("pred.getType(): "+pred.getType()); if (XObject.CLASS_NUMBER == pred.getType()) { if (DEBUG_PREDICATECOUNTING) { System.out.flush(); System.out.println("\n===== start predicate count ========"); System.out.println("m_predicateIndex: " + m_predicateIndex); // System.out.println("getProximityPosition(m_predicateIndex): " // + getProximityPosition(m_predicateIndex)); System.out.println("pred.num(): " + pred.num()); } int proxPos = this.getProximityPosition(m_predicateIndex); int predIndex = (int) pred.num(); if (proxPos != predIndex) { if (DEBUG_PREDICATECOUNTING) { System.out.println("\nnode context: "+nodeToString(context)); System.out.println("index predicate is false: "+proxPos); System.out.println("\n===== end predicate count ========"); } return false; } else if (DEBUG_PREDICATECOUNTING) { System.out.println("\nnode context: "+nodeToString(context)); System.out.println("index predicate is true: "+proxPos); System.out.println("\n===== end predicate count ========"); } // If there is a proximity index that will not change during the // course of itteration, then we know there can be no more true // occurances of this predicate, so flag that we're done after // this. // // bugzilla 14365 // We can't set m_foundLast = true unless we're sure that -all- // remaining parameters are stable, or else last() fails. Fixed so // only sets m_foundLast if on the last predicate if(m_predicates[i].isStableNumber() && i == nPredicates - 1) { m_foundLast = true; } } else if (!pred.bool()) return false; countProximityPosition(++m_predicateIndex); } } finally { xctxt.popCurrentNode(); xctxt.popNamespaceContext(); xctxt.popSubContextList(); m_predicateIndex = -1; } return true; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); int nPredicates = getPredicateCount(); for (int i = 0; i < nPredicates; i++) { m_predicates[i].fixupVariables(vars, globalsSize); } } /** * Diagnostics. * * @param n Node to give diagnostic information about, or null. * * @return Informative string about the argument. */ protected String nodeToString(int n) { if(DTM.NULL != n) { DTM dtm = m_lpi.getXPathContext().getDTM(n); return dtm.getNodeName(n) + "{" + (n+1) + "}"; } else { return "null"; } } //=============== NodeFilter Implementation =============== /** * Test whether a specified node is visible in the logical view of a * TreeWalker or NodeIterator. This function will be called by the * implementation of TreeWalker and NodeIterator; it is not intended to * be called directly from user code. * @param n The node to check to see if it passes the filter or not. * @return a constant to determine whether the node is accepted, * rejected, or skipped, as defined above . */ public short acceptNode(int n) { XPathContext xctxt = m_lpi.getXPathContext(); try { xctxt.pushCurrentNode(n); XObject score = execute(xctxt, n); // System.out.println("\n::acceptNode - score: "+score.num()+"::"); if (score != NodeTest.SCORE_NONE) { if (getPredicateCount() > 0) { countProximityPosition(0); if (!executePredicates(n, xctxt)) return DTMIterator.FILTER_SKIP; } return DTMIterator.FILTER_ACCEPT; } } catch (javax.xml.transform.TransformerException se) { // TODO: Fix this. throw new RuntimeException(se.getMessage()); } finally { xctxt.popCurrentNode(); } return DTMIterator.FILTER_SKIP; } /** * Get the owning location path iterator. * * @return the owning location path iterator, which should not be null. */ public LocPathIterator getLocPathIterator() { return m_lpi; } /** * Set the location path iterator owner for this walker. Besides * initialization, this function is called during cloning operations. * * @param li non-null reference to the owning location path iterator. */ public void setLocPathIterator(LocPathIterator li) { m_lpi = li; if(this != li) li.exprSetParent(this); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { int n = getPredicateCount(); for (int i = 0; i < n; i++) { if(getPredicate(i).canTraverseOutsideSubtree()) return true; } return false; } /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param visitor The visitor whose appropriate method will be called. */ public void callPredicateVisitors(XPathVisitor visitor) { if (null != m_predicates) { int n = m_predicates.length; for (int i = 0; i < n; i++) { ExpressionOwner predOwner = new PredOwner(i); if (visitor.visitPredicate(predOwner, m_predicates[i])) { m_predicates[i].callVisitors(predOwner, visitor); } } } } /** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; PredicatedNodeTest pnt = (PredicatedNodeTest) expr; if (null != m_predicates) { int n = m_predicates.length; if ((null == pnt.m_predicates) || (pnt.m_predicates.length != n)) return false; for (int i = 0; i < n; i++) { if (!m_predicates[i].deepEquals(pnt.m_predicates[i])) return false; } } else if (null != pnt.m_predicates) return false; return true; } /** This is true if nextNode returns null. */ transient protected boolean m_foundLast = false; /** The owning location path iterator. * @serial */ protected LocPathIterator m_lpi; /** * Which predicate we are executing. */ transient int m_predicateIndex = -1; /** The list of predicate expressions. Is static and does not need * to be deep cloned. * @serial */ private Expression[] m_predicates; /** * An array of counts that correspond to the number * of predicates the step contains. */ transient protected int[] m_proximityPositions; /** If true, diagnostic messages about predicate execution will be posted. */ static final boolean DEBUG_PREDICATECOUNTING = false; class PredOwner implements ExpressionOwner { int m_index; PredOwner(int index) { m_index = index; } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_predicates[m_index]; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(PredicatedNodeTest.this); m_predicates[m_index] = exp; } } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/AttributeIterator.java0000644000175000017500000000452510721374030024506 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributeIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xpath.compiler.Compiler; /** * This class implements an optimized iterator for * attribute axes patterns. * @see org.apache.xpath.axes#ChildTestIterator * @xsl.usage advanced */ public class AttributeIterator extends ChildTestIterator { static final long serialVersionUID = -8417986700712229686L; /** * Create a AttributeIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ AttributeIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis); } /** * Get the next node via getFirstAttribute && getNextAttribute. */ protected int getNextNode() { m_lastFetched = (DTM.NULL == m_lastFetched) ? m_cdtm.getFirstAttribute(m_context) : m_cdtm.getNextAttribute(m_lastFetched); return m_lastFetched; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return org.apache.xml.dtm.Axis.ATTRIBUTE; } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/WalkingIteratorSorted.java0000644000175000017500000001546710721374033025332 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WalkingIteratorSorted.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.compiler.Compiler; /** * This class iterates over set of nodes that needs to be sorted. * @xsl.usage internal */ public class WalkingIteratorSorted extends WalkingIterator { static final long serialVersionUID = -4512512007542368213L; // /** True if the nodes will be found in document order */ // protected boolean m_inNaturalOrder = false; /** True if the nodes will be found in document order, and this can * be determined statically. */ protected boolean m_inNaturalOrderStatic = false; /** * Create a WalkingIteratorSorted object. * * @param nscontext The namespace context for this iterator, * should be OK if null. */ public WalkingIteratorSorted(PrefixResolver nscontext) { super(nscontext); } /** * Create a WalkingIterator iterator, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param shouldLoadWalkers True if walkers should be * loaded, or false if this is a derived iterator and * it doesn't wish to load child walkers. * * @throws javax.xml.transform.TransformerException */ WalkingIteratorSorted( Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, shouldLoadWalkers); } /** * Returns true if all the nodes in the iteration well be returned in document * order. * * @return true as a default. */ public boolean isDocOrdered() { return m_inNaturalOrderStatic; } /** * Tell if the nodeset can be walked in doc order, via static analysis. * * * @return true if the nodeset can be walked in doc order, without sorting. */ boolean canBeWalkedInNaturalDocOrderStatic() { if (null != m_firstWalker) { AxesWalker walker = m_firstWalker; int prevAxis = -1; boolean prevIsSimpleDownAxis = true; for(int i = 0; null != walker; i++) { int axis = walker.getAxis(); if(walker.isDocOrdered()) { boolean isSimpleDownAxis = ((axis == Axis.CHILD) || (axis == Axis.SELF) || (axis == Axis.ROOT)); // Catching the filtered list here is only OK because // FilterExprWalker#isDocOrdered() did the right thing. if(isSimpleDownAxis || (axis == -1)) walker = walker.getNextWalker(); else { boolean isLastWalker = (null == walker.getNextWalker()); if(isLastWalker) { if(walker.isDocOrdered() && (axis == Axis.DESCENDANT || axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT || axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE)) return true; } return false; } } else return false; } return true; } return false; } // /** // * NEEDSDOC Method canBeWalkedInNaturalDocOrder // * // * // * NEEDSDOC (canBeWalkedInNaturalDocOrder) @return // */ // boolean canBeWalkedInNaturalDocOrder() // { // // if (null != m_firstWalker) // { // AxesWalker walker = m_firstWalker; // int prevAxis = -1; // boolean prevIsSimpleDownAxis = true; // // for(int i = 0; null != walker; i++) // { // int axis = walker.getAxis(); // // if(walker.isDocOrdered()) // { // boolean isSimpleDownAxis = ((axis == Axis.CHILD) // || (axis == Axis.SELF) // || (axis == Axis.ROOT)); // // Catching the filtered list here is only OK because // // FilterExprWalker#isDocOrdered() did the right thing. // if(isSimpleDownAxis || (axis == -1)) // walker = walker.getNextWalker(); // else // { // boolean isLastWalker = (null == walker.getNextWalker()); // if(isLastWalker) // { // if(walker.isDocOrdered() && (axis == Axis.DESCENDANT || // axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT // || axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE)) // return true; // } // return false; // } // } // else // return false; // } // return true; // } // return false; // } /** * This function is used to perform some extra analysis of the iterator. * * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); int analysis = getAnalysisBits(); if(WalkerFactory.isNaturalDocOrder(analysis)) { m_inNaturalOrderStatic = true; } else { m_inNaturalOrderStatic = false; // System.out.println("Setting natural doc order to false: "+ // WalkerFactory.getAnalysisString(analysis)); } } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/MatchPatternIterator.java0000644000175000017500000002326510721374030025137 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MatchPatternIterator.java 469314 2006-10-30 23:31:59Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.compiler.OpMap; import org.apache.xpath.objects.XObject; import org.apache.xpath.patterns.NodeTest; import org.apache.xpath.patterns.StepPattern; /** * This class treats a * LocationPath as a * filtered iteration over the tree, evaluating each node in a super axis * traversal against the LocationPath interpreted as a match pattern. This * class is useful to find nodes in document order that are complex paths * whose steps probably criss-cross each other. */ public class MatchPatternIterator extends LocPathIterator { static final long serialVersionUID = -5201153767396296474L; /** This is the select pattern, translated into a match pattern. */ protected StepPattern m_pattern; /** The traversal axis from where the nodes will be filtered. */ protected int m_superAxis = -1; /** The DTM inner traversal class, that corresponds to the super axis. */ protected DTMAxisTraverser m_traverser; /** DEBUG flag for diagnostic dumps. */ private static final boolean DEBUG = false; // protected int m_nsElemBase = DTM.NULL; /** * Create a LocPathIterator object, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param analysis Analysis bits that give general information about the * LocationPath. * * @throws javax.xml.transform.TransformerException */ MatchPatternIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis, false); int firstStepPos = OpMap.getFirstChildPos(opPos); m_pattern = WalkerFactory.loadSteps(this, compiler, firstStepPos, 0); boolean fromRoot = false; boolean walkBack = false; boolean walkDescendants = false; boolean walkAttributes = false; if (0 != (analysis & (WalkerFactory.BIT_ROOT | WalkerFactory.BIT_ANY_DESCENDANT_FROM_ROOT))) fromRoot = true; if (0 != (analysis & (WalkerFactory.BIT_ANCESTOR | WalkerFactory.BIT_ANCESTOR_OR_SELF | WalkerFactory.BIT_PRECEDING | WalkerFactory.BIT_PRECEDING_SIBLING | WalkerFactory.BIT_FOLLOWING | WalkerFactory.BIT_FOLLOWING_SIBLING | WalkerFactory.BIT_PARENT | WalkerFactory.BIT_FILTER))) walkBack = true; if (0 != (analysis & (WalkerFactory.BIT_DESCENDANT_OR_SELF | WalkerFactory.BIT_DESCENDANT | WalkerFactory.BIT_CHILD))) walkDescendants = true; if (0 != (analysis & (WalkerFactory.BIT_ATTRIBUTE | WalkerFactory.BIT_NAMESPACE))) walkAttributes = true; if(false || DEBUG) { System.out.print("analysis: "+Integer.toBinaryString(analysis)); System.out.println(", "+WalkerFactory.getAnalysisString(analysis)); } if(fromRoot || walkBack) { if(walkAttributes) { m_superAxis = Axis.ALL; } else { m_superAxis = Axis.DESCENDANTSFROMROOT; } } else if(walkDescendants) { if(walkAttributes) { m_superAxis = Axis.ALLFROMNODE; } else { m_superAxis = Axis.DESCENDANTORSELF; } } else { m_superAxis = Axis.ALL; } if(false || DEBUG) { System.out.println("axis: "+Axis.getNames(m_superAxis)); } } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(m_superAxis); } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach) { m_traverser = null; // Always call the superclass detach last! super.detach(); } } /** * Get the next node via getNextXXX. Bottlenecked for derived class override. * @return The next node on the axis, or DTM.NULL. */ protected int getNextNode() { m_lastFetched = (DTM.NULL == m_lastFetched) ? m_traverser.first(m_context) : m_traverser.next(m_context, m_lastFetched); return m_lastFetched; } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public int nextNode() { if(m_foundLast) return DTM.NULL; int next; org.apache.xpath.VariableStack vars; int savedStart; if (-1 != m_stackFrame) { vars = m_execContext.getVarStack(); // These three statements need to be combined into one operation. savedStart = vars.getStackFrame(); vars.setStackFrame(m_stackFrame); } else { // Yuck. Just to shut up the compiler! vars = null; savedStart = 0; } try { if(DEBUG) System.out.println("m_pattern"+m_pattern.toString()); do { next = getNextNode(); if (DTM.NULL != next) { if(DTMIterator.FILTER_ACCEPT == acceptNode(next, m_execContext)) break; else continue; } else break; } while (next != DTM.NULL); if (DTM.NULL != next) { if(DEBUG) { System.out.println("next: "+next); System.out.println("name: "+m_cdtm.getNodeName(next)); } incrementCurrentPos(); return next; } else { m_foundLast = true; return DTM.NULL; } } finally { if (-1 != m_stackFrame) { // These two statements need to be combined into one operation. vars.setStackFrame(savedStart); } } } /** * Test whether a specified node is visible in the logical view of a * TreeWalker or NodeIterator. This function will be called by the * implementation of TreeWalker and NodeIterator; it is not intended to * be called directly from user code. * @param n The node to check to see if it passes the filter or not. * @return a constant to determine whether the node is accepted, * rejected, or skipped, as defined above . */ public short acceptNode(int n, XPathContext xctxt) { try { xctxt.pushCurrentNode(n); xctxt.pushIteratorRoot(m_context); if(DEBUG) { System.out.println("traverser: "+m_traverser); System.out.print("node: "+n); System.out.println(", "+m_cdtm.getNodeName(n)); // if(m_cdtm.getNodeName(n).equals("near-east")) System.out.println("pattern: "+m_pattern.toString()); m_pattern.debugWhatToShow(m_pattern.getWhatToShow()); } XObject score = m_pattern.execute(xctxt); if(DEBUG) { // System.out.println("analysis: "+Integer.toBinaryString(m_analysis)); System.out.println("score: "+score); System.out.println("skip: "+(score == NodeTest.SCORE_NONE)); } // System.out.println("\n::acceptNode - score: "+score.num()+"::"); return (score == NodeTest.SCORE_NONE) ? DTMIterator.FILTER_SKIP : DTMIterator.FILTER_ACCEPT; } catch (javax.xml.transform.TransformerException se) { // TODO: Fix this. throw new RuntimeException(se.getMessage()); } finally { xctxt.popCurrentNode(); xctxt.popIteratorRoot(); } } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/ContextNodeList.java0000644000175000017500000000772510721374030024124 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ContextNodeList.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeIterator; /** * Classes who implement this interface can be a * current node list, * also refered to here as a context node list. * @xsl.usage advanced */ public interface ContextNodeList { /** * Get the current node. * * * @return The current node, or null. */ public Node getCurrentNode(); /** * Get the current position, which is one less than * the next nextNode() call will retrieve. i.e. if * you call getCurrentPos() and the return is 0, the next * fetch will take place at index 1. * * @return The position of the * current node * in the current node list. */ public int getCurrentPos(); /** * Reset the iterator. */ public void reset(); /** * If setShouldCacheNodes(true) is called, then nodes will * be cached. They are not cached by default. * * @param b true if the nodes should be cached. */ public void setShouldCacheNodes(boolean b); /** * If an index is requested, NodeSetDTM will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end. * * @param index The index to run to, or -1 if the iterator should be run * to the end. */ public void runTo(int index); /** * Set the current position in the node set. * @param i Must be a valid index. */ public void setCurrentPos(int i); /** * Get the length of the list. * * @return The number of nodes in this node list. */ public int size(); /** * Tells if this NodeSetDTM is "fresh", in other words, if * the first nextNode() that is called will return the * first node in the set. * * @return true if the iteration of this list has not yet begun. */ public boolean isFresh(); /** * Get a cloned Iterator that is reset to the start of the iteration. * * @return A clone of this iteration that has been reset. * * @throws CloneNotSupportedException */ public NodeIterator cloneWithReset() throws CloneNotSupportedException; /** * Get a clone of this iterator. Be aware that this operation may be * somewhat expensive. * * * @return A clone of this object. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException; /** * Get the index of the last node in this list. * * * @return the index of the last node in this list. */ public int getLast(); /** * Set the index of the last node in this list. * * * @param last the index of the last node in this list. */ public void setLast(int last); } libxalan2-java-2.7.1/src/org/apache/xpath/axes/LocPathIterator.java0000644000175000017500000007201510721374031024075 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LocPathIterator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathVisitor; import org.apache.xpath.compiler.Compiler; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; /** * This class extends NodeSetDTM, which implements NodeIterator, * and fetches nodes one at a time in document order based on a XPath * * @xsl.usage advanced */ public abstract class LocPathIterator extends PredicatedNodeTest implements Cloneable, DTMIterator, java.io.Serializable, PathComponent { static final long serialVersionUID = -4602476357268405754L; /** * Create a LocPathIterator object. * */ protected LocPathIterator() { } /** * Create a LocPathIterator object. * * @param nscontext The namespace context for this iterator, * should be OK if null. */ protected LocPathIterator(PrefixResolver nscontext) { setLocPathIterator(this); m_prefixResolver = nscontext; } /** * Create a LocPathIterator object, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * * @throws javax.xml.transform.TransformerException */ protected LocPathIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { this(compiler, opPos, analysis, true); } /** * Create a LocPathIterator object, including creation * of step walkers from the opcode list, and call back * into the Compiler to create predicate expressions. * * @param compiler The Compiler which is creating * this expression. * @param opPos The position of this iterator in the * opcode list from the compiler. * @param shouldLoadWalkers True if walkers should be * loaded, or false if this is a derived iterator and * it doesn't wish to load child walkers. * * @throws javax.xml.transform.TransformerException */ protected LocPathIterator( Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws javax.xml.transform.TransformerException { setLocPathIterator(this); } /** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { int axis = getAxis(); int bit = WalkerFactory.getAnalysisBitFromAxes(axis); return bit; } /** * Read the object from a serialization stream. * * @param stream Input stream to read from * * @throws java.io.IOException * @throws javax.xml.transform.TransformerException */ private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, javax.xml.transform.TransformerException { try { stream.defaultReadObject(); m_clones = new IteratorPool(this); } catch (ClassNotFoundException cnfe) { throw new javax.xml.transform.TransformerException(cnfe); } } /** * Set the environment in which this iterator operates, which should provide: * a node (the context node... same value as "root" defined below) * a pair of non-zero positive integers (the context position and the context size) * a set of variable bindings * a function library * the set of namespace declarations in scope for the expression. * *

    At this time the exact implementation of this environment is application * dependent. Probably a proper interface will be created fairly soon.

    * * @param environment The environment object. */ public void setEnvironment(Object environment) { // no-op for now. } /** * Get an instance of a DTM that "owns" a node handle. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTM using just the iterator. * * @param nodeHandle the nodeHandle. * * @return a non-null DTM reference. */ public DTM getDTM(int nodeHandle) { // %OPT% return m_execContext.getDTM(nodeHandle); } /** * Get an instance of the DTMManager. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTMManager using just the iterator. * * @return a non-null DTMManager reference. */ public DTMManager getDTMManager() { return m_execContext.getDTMManager(); } /** * Execute this iterator, meaning create a clone that can * store state, and initialize it for fast execution from * the current runtime state. When this is called, no actual * query from the current context node is performed. * * @param xctxt The XPath execution context. * * @return An XNodeSet reference that holds this iterator. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XNodeSet iter = new XNodeSet((LocPathIterator)m_clones.getInstance()); iter.setRoot(xctxt.getCurrentNode(), xctxt); return iter; } /** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * @param handler The target content handler. * * @return The result of the expression in the form of a XObject. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. * @throws org.xml.sax.SAXException */ public void executeCharsToContentHandler( XPathContext xctxt, org.xml.sax.ContentHandler handler) throws javax.xml.transform.TransformerException, org.xml.sax.SAXException { LocPathIterator clone = (LocPathIterator)m_clones.getInstance(); int current = xctxt.getCurrentNode(); clone.setRoot(current, xctxt); int node = clone.nextNode(); DTM dtm = clone.getDTM(node); clone.detach(); if(node != DTM.NULL) { dtm.dispatchCharactersEvents(node, handler, false); } } /** * Given an select expression and a context, evaluate the XPath * and return the resulting iterator. * * @param xctxt The execution context. * @param contextNode The node that "." expresses. * @throws TransformerException thrown if the active ProblemListener decides * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException * @xsl.usage experimental */ public DTMIterator asIterator( XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException { XNodeSet iter = new XNodeSet((LocPathIterator)m_clones.getInstance()); iter.setRoot(contextNode, xctxt); return iter; } /** * Tell if the expression is a nodeset expression. * * @return true if the expression can be represented as a nodeset. */ public boolean isNodesetExpr() { return true; } /** * Return the first node out of the nodeset, if this expression is * a nodeset expression. This is the default implementation for * nodesets. Derived classes should try and override this and return a * value without having to do a clone operation. * @param xctxt The XPath runtime context. * @return the first node out of the nodeset, or DTM.NULL. */ public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException { DTMIterator iter = (DTMIterator)m_clones.getInstance(); int current = xctxt.getCurrentNode(); iter.setRoot(current, xctxt); int next = iter.nextNode(); // m_clones.freeInstance(iter); iter.detach(); return next; } /** * Evaluate this operation directly to a boolean. * * @param xctxt The runtime execution context. * * @return The result of the operation as a boolean. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { return (asNode(xctxt) != DTM.NULL); } /** * Set if this is an iterator at the upper level of * the XPath. * * @param b true if this location path is at the top level of the * expression. * @xsl.usage advanced */ public void setIsTopLevel(boolean b) { m_isTopLevel = b; } /** * Get if this is an iterator at the upper level of * the XPath. * * @return true if this location path is at the top level of the * expression. * @xsl.usage advanced */ public boolean getIsTopLevel() { return m_isTopLevel; } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { m_context = context; XPathContext xctxt = (XPathContext)environment; m_execContext = xctxt; m_cdtm = xctxt.getDTM(context); m_currentContextNode = context; // only if top level? // Yech, shouldn't have to do this. -sb if(null == m_prefixResolver) m_prefixResolver = xctxt.getNamespaceContext(); m_lastFetched = DTM.NULL; m_foundLast = false; m_pos = 0; m_length = -1; if (m_isTopLevel) this.m_stackFrame = xctxt.getVarStack().getStackFrame(); // reset(); } /** * Set the next position index of this iterator. * * @param next A value greater than or equal to zero that indicates the next * node position to fetch. */ protected void setNextPosition(int next) { assertion(false, "setNextPosition not supported in this iterator!"); } /** * Get the current position, which is one less than * the next nextNode() call will retrieve. i.e. if * you call getCurrentPos() and the return is 0, the next * fetch will take place at index 1. * * @return A value greater than or equal to zero that indicates the next * node position to fetch. */ public final int getCurrentPos() { return m_pos; } /** * If setShouldCacheNodes(true) is called, then nodes will * be cached. They are not cached by default. * * @param b True if this iterator should cache nodes. */ public void setShouldCacheNodes(boolean b) { assertion(false, "setShouldCacheNodes not supported by this iterater!"); } /** * Tells if this iterator can have nodes added to it or set via * the setItem(int node, int index) method. * * @return True if the nodelist can be mutated. */ public boolean isMutable() { return false; } /** * Set the current position in the node set. * * @param i Must be a valid index greater * than or equal to zero and less than m_cachedNodes.size(). */ public void setCurrentPos(int i) { assertion(false, "setCurrentPos not supported by this iterator!"); } /** * Increment the current position in the node set. */ public void incrementCurrentPos() { m_pos++; } /** * Get the length of the cached nodes. * *

    Note: for the moment at least, this only returns * the size of the nodes that have been fetched to date, * it doesn't attempt to run to the end to make sure we * have found everything. This should be reviewed.

    * * @return The size of the current cache list. */ public int size() { assertion(false, "size() not supported by this iterator!"); return 0; } /** * Returns the index th item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null . * @param index Index into the collection. * @return The node at the index th position in the * NodeList , or null if that is not a valid * index. */ public int item(int index) { assertion(false, "item(int index) not supported by this iterator!"); return 0; } /** * Sets the node at the specified index of this vector to be the * specified node. The previous component at that position is discarded. * *

    The index must be a value greater than or equal to 0 and less * than the current size of the vector. * The iterator must be in cached mode.

    * *

    Meant to be used for sorted iterators.

    * * @param node Node to set * @param index Index of where to set the node */ public void setItem(int node, int index) { assertion(false, "setItem not supported by this iterator!"); } /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. * * @return The number of nodes in the list, always greater or equal to zero. */ public int getLength() { // Tell if this is being called from within a predicate. boolean isPredicateTest = (this == m_execContext.getSubContextList()); // And get how many total predicates are part of this step. int predCount = getPredicateCount(); // If we have already calculated the length, and the current predicate // is the first predicate, then return the length. We don't cache // the anything but the length of the list to the first predicate. if (-1 != m_length && isPredicateTest && m_predicateIndex < 1) return m_length; // I'm a bit worried about this one, since it doesn't have the // checks found above. I suspect it's fine. -sb if (m_foundLast) return m_pos; // Create a clone, and count from the current position to the end // of the list, not taking into account the current predicate and // predicates after the current one. int pos = (m_predicateIndex >= 0) ? getProximityPosition() : m_pos; LocPathIterator clone; try { clone = (LocPathIterator) clone(); } catch (CloneNotSupportedException cnse) { return -1; } // We want to clip off the last predicate, but only if we are a sub // context node list, NOT if we are a context list. See pos68 test, // also test against bug4638. if (predCount > 0 && isPredicateTest) { // Don't call setPredicateCount, because it clones and is slower. clone.m_predCount = m_predicateIndex; // The line above used to be: // clone.m_predCount = predCount - 1; // ...which looks like a dumb bug to me. -sb } int next; while (DTM.NULL != (next = clone.nextNode())) { pos++; } if (isPredicateTest && m_predicateIndex < 1) m_length = pos; return pos; } /** * Tells if this NodeSetDTM is "fresh", in other words, if * the first nextNode() that is called will return the * first node in the set. * * @return true of nextNode has not been called. */ public boolean isFresh() { return (m_pos == 0); } /** * Returns the previous node in the set and moves the position of the * iterator backwards in the set. * @return The previous Node in the set being iterated over, * ornull if there are no more members in that set. */ public int previousNode() { throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null)); //"This NodeSetDTM can not iterate to a previous node!"); } /** * This attribute determines which node types are presented via the * iterator. The available set of constants is defined in the * NodeFilter interface. * *

    This is somewhat useless at this time, since it doesn't * really return information that tells what this iterator will * show. It is here only to fullfill the DOM NodeIterator * interface.

    * * @return For now, always NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE. * @see org.w3c.dom.traversal.NodeIterator */ public int getWhatToShow() { // TODO: ?? return DTMFilter.SHOW_ALL & ~DTMFilter.SHOW_ENTITY_REFERENCE; } /** * The filter used to screen nodes. Not used at this time, * this is here only to fullfill the DOM NodeIterator * interface. * * @return Always null. * @see org.w3c.dom.traversal.NodeIterator */ public DTMFilter getFilter() { return null; } /** * The root node of the Iterator, as specified when it was created. * * @return The "root" of this iterator, which, in XPath terms, * is the node context for this iterator. */ public int getRoot() { return m_context; } /** * The value of this flag determines whether the children of entity * reference nodes are visible to the iterator. If false, they will be * skipped over. *
    To produce a view of the document that has entity references * expanded and does not expose the entity reference node itself, use the * whatToShow flags to hide the entity reference node and set * expandEntityReferences to true when creating the iterator. To produce * a view of the document that has entity reference nodes but no entity * expansion, use the whatToShow flags to show the entity reference node * and set expandEntityReferences to false. * * @return Always true, since entity reference nodes are not * visible in the XPath model. */ public boolean getExpandEntityReferences() { return true; } /** Control over whether it is OK for detach to reset the iterator. */ protected boolean m_allowDetach = true; /** * Specify if it's OK for detach to release the iterator for reuse. * * @param allowRelease true if it is OK for detach to release this iterator * for pooling. */ public void allowDetachToRelease(boolean allowRelease) { m_allowDetach = allowRelease; } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach) { // sb: allow reusing of cached nodes when possible? // m_cachedNodes = null; m_execContext = null; // m_prefixResolver = null; sb: Why would this ever want to be null? m_cdtm = null; m_length = -1; m_pos = 0; m_lastFetched = DTM.NULL; m_context = DTM.NULL; m_currentContextNode = DTM.NULL; m_clones.freeInstance(this); } } /** * Reset the iterator. */ public void reset() { assertion(false, "This iterator can not reset!"); } /** * Get a cloned Iterator that is reset to the beginning * of the query. * * @return A cloned NodeIterator set of the start of the query. * * @throws CloneNotSupportedException */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { LocPathIterator clone; // clone = (LocPathIterator) clone(); clone = (LocPathIterator)m_clones.getInstanceOrThrow(); clone.m_execContext = m_execContext; clone.m_cdtm = m_cdtm; clone.m_context = m_context; clone.m_currentContextNode = m_currentContextNode; clone.m_stackFrame = m_stackFrame; // clone.reset(); return clone; } // /** // * Get a cloned LocPathIterator that holds the same // * position as this iterator. // * // * @return A clone of this iterator that holds the same node position. // * // * @throws CloneNotSupportedException // */ // public Object clone() throws CloneNotSupportedException // { // // LocPathIterator clone = (LocPathIterator) super.clone(); // // return clone; // } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a NodeIterator is created, the first call * to nextNode() returns the first node in the set. * @return The next Node in the set being iterated over, or * null if there are no more members in that set. */ public abstract int nextNode(); /** * Bottleneck the return of a next node, to make returns * easier from nextNode(). * * @param nextNode The next node found, may be null. * * @return The same node that was passed as an argument. */ protected int returnNextNode(int nextNode) { if (DTM.NULL != nextNode) { m_pos++; } m_lastFetched = nextNode; if (DTM.NULL == nextNode) m_foundLast = true; return nextNode; } /** * Return the last fetched node. Needed to support the UnionPathIterator. * * @return The last fetched node, or null if the last fetch was null. */ public int getCurrentNode() { return m_lastFetched; } /** * If an index is requested, NodeSetDTM will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end. * * @param index The index to run to, or -1 if the iterator * should run to the end. */ public void runTo(int index) { if (m_foundLast || ((index >= 0) && (index <= getCurrentPos()))) return; int n; if (-1 == index) { while (DTM.NULL != (n = nextNode())); } else { while (DTM.NULL != (n = nextNode())) { if (getCurrentPos() >= index) break; } } } /** * Tells if we've found the last node yet. * * @return true if the last nextNode returned null. */ public final boolean getFoundLast() { return m_foundLast; } /** * The XPath execution context we are operating on. * * @return XPath execution context this iterator is operating on, * or null if setRoot has not been called. */ public final XPathContext getXPathContext() { return m_execContext; } /** * The node context for the iterator. * * @return The node context, same as getRoot(). */ public final int getContext() { return m_context; } /** * The node context from where the expression is being * executed from (i.e. for current() support). * * @return The top-level node context of the entire expression. */ public final int getCurrentContextNode() { return m_currentContextNode; } /** * Set the current context node for this iterator. * * @param n Must be a non-null reference to the node context. */ public final void setCurrentContextNode(int n) { m_currentContextNode = n; } // /** // * Set the current context node for this iterator. // * // * @param n Must be a non-null reference to the node context. // */ // public void setRoot(int n) // { // m_context = n; // m_cdtm = m_execContext.getDTM(n); // } /** * Return the saved reference to the prefix resolver that * was in effect when this iterator was created. * * @return The prefix resolver or this iterator, which may be null. */ public final PrefixResolver getPrefixResolver() { if(null == m_prefixResolver) { m_prefixResolver = (PrefixResolver)getExpressionOwner(); } return m_prefixResolver; } // /** // * Get the analysis pattern built by the WalkerFactory. // * // * @return The analysis pattern built by the WalkerFactory. // */ // int getAnalysis() // { // return m_analysis; // } // /** // * Set the analysis pattern built by the WalkerFactory. // * // * @param a The analysis pattern built by the WalkerFactory. // */ // void setAnalysis(int a) // { // m_analysis = a; // } /** * @see org.apache.xpath.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor) */ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) { if(visitor.visitLocationPath(owner, this)) { visitor.visitStep(owner, this); callPredicateVisitors(visitor); } } //============= State Data ============= /** * The pool for cloned iterators. Iterators need to be cloned * because the hold running state, and thus the original iterator * expression from the stylesheet pool can not be used. */ transient protected IteratorPool m_clones = new IteratorPool(this); /** * The dtm of the context node. Careful about using this... it may not * be the dtm of the current node. */ transient protected DTM m_cdtm; /** * The stack frame index for this iterator. */ transient int m_stackFrame = -1; /** * Value determined at compile time, indicates that this is an * iterator at the top level of the expression, rather than inside * a predicate. * @serial */ private boolean m_isTopLevel = false; /** The last node that was fetched, usually by nextNode. */ transient public int m_lastFetched = DTM.NULL; /** * The context node for this iterator, which doesn't change through * the course of the iteration. */ transient protected int m_context = DTM.NULL; /** * The node context from where the expression is being * executed from (i.e. for current() support). Different * from m_context in that this is the context for the entire * expression, rather than the context for the subexpression. */ transient protected int m_currentContextNode = DTM.NULL; /** * The current position of the context node. */ transient protected int m_pos = 0; transient protected int m_length = -1; /** * Fast access to the current prefix resolver. It isn't really * clear that this is needed. * @serial */ private PrefixResolver m_prefixResolver; /** * The XPathContext reference, needed for execution of many * operations. */ transient protected XPathContext m_execContext; /** * Returns true if all the nodes in the iteration well be returned in document * order. * * @return true as a default. */ public boolean isDocOrdered() { return true; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return -1; } // /** // * The analysis pattern built by the WalkerFactory. // * TODO: Move to LocPathIterator. // * @see org.apache.xpath.axes.WalkerFactory // * @serial // */ // protected int m_analysis = 0x00000000; /** * @see PredicatedNodeTest#getLastPos(XPathContext) */ public int getLastPos(XPathContext xctxt) { return getLength(); } } libxalan2-java-2.7.1/src/org/apache/xpath/axes/ReverseAxesWalker.java0000644000175000017500000001407510721374031024435 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ReverseAxesWalker.java 513117 2007-03-01 03:28:52Z minchau $ */ package org.apache.xpath.axes; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xpath.XPathContext; /** * Walker for a reverse axes. * @see
    XPath 2.4 Predicates */ public class ReverseAxesWalker extends AxesWalker { static final long serialVersionUID = 2847007647832768941L; /** * Construct an AxesWalker using a LocPathIterator. * * @param locPathIterator The location path iterator that 'owns' this walker. */ ReverseAxesWalker(LocPathIterator locPathIterator, int axis) { super(locPathIterator, axis); } /** * Set the root node of the TreeWalker. * (Not part of the DOM2 TreeWalker interface). * * @param root The context node of this step. */ public void setRoot(int root) { super.setRoot(root); m_iterator = getDTM(root).getAxisIterator(m_axis); m_iterator.setStartNode(root); } /** * Detaches the walker from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. */ public void detach() { m_iterator = null; super.detach(); } /** * Get the next node in document order on the axes. * * @return the next node in document order on the axes, or null. */ protected int getNextNode() { if (m_foundLast) return DTM.NULL; int next = m_iterator.next(); if (m_isFresh) m_isFresh = false; if (DTM.NULL == next) this.m_foundLast = true; return next; } /** * Tells if this is a reverse axes. Overrides AxesWalker#isReverseAxes. * * @return true for this class. */ public boolean isReverseAxes() { return true; } // /** // * Set the root node of the TreeWalker. // * // * @param root The context node of this step. // */ // public void setRoot(int root) // { // super.setRoot(root); // } /** * Get the current sub-context position. In order to do the * reverse axes count, for the moment this re-searches the axes * up to the predicate. An optimization on this is to cache * the nodes searched, but, for the moment, this case is probably * rare enough that the added complexity isn't worth it. * * @param predicateIndex The predicate index of the proximity position. * * @return The pridicate index, or -1. */ protected int getProximityPosition(int predicateIndex) { // A negative predicate index seems to occur with // (preceding-sibling::*|following-sibling::*)/ancestor::*[position()]/*[position()] // -sb if(predicateIndex < 0) return -1; int count = m_proximityPositions[predicateIndex]; if (count <= 0) { AxesWalker savedWalker = wi().getLastUsedWalker(); try { ReverseAxesWalker clone = (ReverseAxesWalker) this.clone(); clone.setRoot(this.getRoot()); clone.setPredicateCount(predicateIndex); clone.setPrevWalker(null); clone.setNextWalker(null); wi().setLastUsedWalker(clone); // Count 'em all count++; int next; while (DTM.NULL != (next = clone.nextNode())) { count++; } m_proximityPositions[predicateIndex] = count; } catch (CloneNotSupportedException cnse) { // can't happen } finally { wi().setLastUsedWalker(savedWalker); } } return count; } /** * Count backwards one proximity position. * * @param i The predicate index. */ protected void countProximityPosition(int i) { if (i < m_proximityPositions.length) m_proximityPositions[i]--; } /** * Get the number of nodes in this node list. The function is probably ill * named? * * * @param xctxt The XPath runtime context. * * @return the number of nodes in this node list. */ public int getLastPos(XPathContext xctxt) { int count = 0; AxesWalker savedWalker = wi().getLastUsedWalker(); try { ReverseAxesWalker clone = (ReverseAxesWalker) this.clone(); clone.setRoot(this.getRoot()); clone.setPredicateCount(m_predicateIndex); clone.setPrevWalker(null); clone.setNextWalker(null); wi().setLastUsedWalker(clone); // Count 'em all // count = 1; int next; while (DTM.NULL != (next = clone.nextNode())) { count++; } } catch (CloneNotSupportedException cnse) { // can't happen } finally { wi().setLastUsedWalker(savedWalker); } return count; } /** * Returns true if all the nodes in the iteration well be returned in document * order. * Warning: This can only be called after setRoot has been called! * * @return false. */ public boolean isDocOrdered() { return false; // I think. } /** The DTM inner traversal class, that corresponds to the super axis. */ protected DTMAxisIterator m_iterator; } libxalan2-java-2.7.1/src/org/apache/xpath/axes/PathComponent.java0000644000175000017500000000241010721374031023600 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PathComponent.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; /** * Classes who implement this information provide information needed for * static analysis of a path component. */ public interface PathComponent { /** * Get the analysis bits for this path component, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits(); } libxalan2-java-2.7.1/src/org/apache/xpath/axes/HasPositionalPredChecker.java0000644000175000017500000001035510721374032025706 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: HasPositionalPredChecker.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath.axes; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.functions.FuncLast; import org.apache.xpath.functions.FuncPosition; import org.apache.xpath.functions.Function; import org.apache.xpath.objects.XNumber; import org.apache.xpath.operations.Div; import org.apache.xpath.operations.Minus; import org.apache.xpath.operations.Mod; import org.apache.xpath.operations.Mult; import org.apache.xpath.operations.Plus; import org.apache.xpath.operations.Quo; import org.apache.xpath.operations.Variable; public class HasPositionalPredChecker extends XPathVisitor { private boolean m_hasPositionalPred = false; private int m_predDepth = 0; /** * Process the LocPathIterator to see if it contains variables * or functions that may make it context dependent. * @param path LocPathIterator that is assumed to be absolute, but needs checking. * @return true if the path is confirmed to be absolute, false if it * may contain context dependencies. */ public static boolean check(LocPathIterator path) { HasPositionalPredChecker hppc = new HasPositionalPredChecker(); path.callVisitors(null, hppc); return hppc.m_hasPositionalPred; } /** * Visit a function. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param func The function reference object. * @return true if the sub expressions should be traversed. */ public boolean visitFunction(ExpressionOwner owner, Function func) { if((func instanceof FuncPosition) || (func instanceof FuncLast)) m_hasPositionalPred = true; return true; } // /** // * Visit a variable reference. // * @param owner The owner of the expression, to which the expression can // * be reset if rewriting takes place. // * @param var The variable reference object. // * @return true if the sub expressions should be traversed. // */ // public boolean visitVariableRef(ExpressionOwner owner, Variable var) // { // m_hasPositionalPred = true; // return true; // } /** * Visit a predicate within a location path. Note that there isn't a * proper unique component for predicates, and that the expression will * be called also for whatever type Expression is. * * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param pred The predicate object. * @return true if the sub expressions should be traversed. */ public boolean visitPredicate(ExpressionOwner owner, Expression pred) { m_predDepth++; if(m_predDepth == 1) { if((pred instanceof Variable) || (pred instanceof XNumber) || (pred instanceof Div) || (pred instanceof Plus) || (pred instanceof Minus) || (pred instanceof Mod) || (pred instanceof Quo) || (pred instanceof Mult) || (pred instanceof org.apache.xpath.operations.Number) || (pred instanceof Function)) m_hasPositionalPred = true; else pred.callVisitors(owner, this); } m_predDepth--; // Don't go have the caller go any further down the subtree. return false; } } libxalan2-java-2.7.1/src/org/apache/xpath/NodeSetDTM.java0000644000175000017500000010711210721374031021774 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSetDTM.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import org.apache.xalan.res.XSLMessages; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.utils.NodeVector; import org.apache.xpath.res.XPATHErrorResources; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** *

    The NodeSetDTM class can act as either a NodeVector, * NodeList, or NodeIterator. However, in order for it to * act as a NodeVector or NodeList, it's required that * setShouldCacheNodes(true) be called before the first * nextNode() is called, in order that nodes can be added * as they are fetched. Derived classes that implement iterators * must override runTo(int index), in order that they may * run the iteration to the given index.

    * *

    Note that we directly implement the DOM's NodeIterator * interface. We do not emulate all the behavior of the * standard NodeIterator. In particular, we do not guarantee * to present a "live view" of the document ... but in XSLT, * the source document should never be mutated, so this should * never be an issue.

    * *

    Thought: Should NodeSetDTM really implement NodeList and NodeIterator, * or should there be specific subclasses of it which do so? The * advantage of doing it all here is that all NodeSetDTMs will respond * to the same calls; the disadvantage is that some of them may return * less-than-enlightening results when you do so.

    * @xsl.usage advanced */ public class NodeSetDTM extends NodeVector implements /* NodeList, NodeIterator, */ DTMIterator, Cloneable { static final long serialVersionUID = 7686480133331317070L; /** * Create an empty nodelist. */ public NodeSetDTM(DTMManager dtmManager) { super(); m_manager = dtmManager; } /** * Create an empty, using the given block size. * * @param blocksize Size of blocks to allocate * @param dummy pass zero for right now... */ public NodeSetDTM(int blocksize, int dummy, DTMManager dtmManager) { super(blocksize); m_manager = dtmManager; } // %TBD% // /** // * Create a NodeSetDTM, and copy the members of the // * given nodelist into it. // * // * @param nodelist List of Nodes to be made members of the new set. // */ // public NodeSetDTM(NodeList nodelist) // { // // super(); // // addNodes(nodelist); // } /** * Create a NodeSetDTM, and copy the members of the * given NodeSetDTM into it. * * @param nodelist Set of Nodes to be made members of the new set. */ public NodeSetDTM(NodeSetDTM nodelist) { super(); m_manager = nodelist.getDTMManager(); m_root = nodelist.getRoot(); addNodes((DTMIterator) nodelist); } /** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * * @param ni Iterator which yields Nodes to be made members of the new set. */ public NodeSetDTM(DTMIterator ni) { super(); m_manager = ni.getDTMManager(); m_root = ni.getRoot(); addNodes(ni); } /** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * * @param iterator Iterator which yields Nodes to be made members of the new set. */ public NodeSetDTM(NodeIterator iterator, XPathContext xctxt) { super(); Node node; m_manager = xctxt.getDTMManager(); while (null != (node = iterator.nextNode())) { int handle = xctxt.getDTMHandleFromNode(node); addNodeInDocOrder(handle, xctxt); } } /** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * */ public NodeSetDTM(NodeList nodeList, XPathContext xctxt) { super(); m_manager = xctxt.getDTMManager(); int n = nodeList.getLength(); for (int i = 0; i < n; i++) { Node node = nodeList.item(i); int handle = xctxt.getDTMHandleFromNode(node); // Do not reorder or strip duplicate nodes from the given DOM nodelist addNode(handle); // addNodeInDocOrder(handle, xctxt); } } /** * Create a NodeSetDTM which contains the given Node. * * @param node Single node to be added to the new set. */ public NodeSetDTM(int node, DTMManager dtmManager) { super(); m_manager = dtmManager; addNode(node); } /** * Set the environment in which this iterator operates, which should provide: * a node (the context node... same value as "root" defined below) * a pair of non-zero positive integers (the context position and the context size) * a set of variable bindings * a function library * the set of namespace declarations in scope for the expression. * *

    At this time the exact implementation of this environment is application * dependent. Probably a proper interface will be created fairly soon.

    * * @param environment The environment object. */ public void setEnvironment(Object environment) { // no-op } /** * @return The root node of the Iterator, as specified when it was created. * For non-Iterator NodeSetDTMs, this will be null. */ public int getRoot() { if(DTM.NULL == m_root) { if(size() > 0) return item(0); else return DTM.NULL; } else return m_root; } /** * Initialize the context values for this expression * after it is cloned. * * @param context The XPath runtime context for this * transformation. */ public void setRoot(int context, Object environment) { // no-op, I guess... (-sb) } /** * Clone this NodeSetDTM. * At this time, we only expect this to be used with LocPathIterators; * it may not work with other kinds of NodeSetDTMs. * * @return a new NodeSetDTM of the same type, having the same state... * though unless overridden in the subclasses, it may not copy all * the state information. * * @throws CloneNotSupportedException if this subclass of NodeSetDTM * does not support the clone() operation. */ public Object clone() throws CloneNotSupportedException { NodeSetDTM clone = (NodeSetDTM) super.clone(); return clone; } /** * Get a cloned Iterator, and reset its state to the beginning of the * iteration. * * @return a new NodeSetDTM of the same type, having the same state... * except that the reset() operation has been called. * * @throws CloneNotSupportedException if this subclass of NodeSetDTM * does not support the clone() operation. */ public DTMIterator cloneWithReset() throws CloneNotSupportedException { NodeSetDTM clone = (NodeSetDTM) clone(); clone.reset(); return clone; } /** * Reset the iterator. May have no effect on non-iterator Nodesets. */ public void reset() { m_next = 0; } /** * This attribute determines which node types are presented via the * iterator. The available set of constants is defined in the * DTMFilter interface. For NodeSetDTMs, the mask has been * hardcoded to show all nodes except EntityReference nodes, which have * no equivalent in the XPath data model. * * @return integer used as a bit-array, containing flags defined in * the DOM's DTMFilter class. The value will be * SHOW_ALL & ~SHOW_ENTITY_REFERENCE, meaning that * only entity references are suppressed. */ public int getWhatToShow() { return DTMFilter.SHOW_ALL & ~DTMFilter.SHOW_ENTITY_REFERENCE; } /** * The filter object used to screen nodes. Filters are applied to * further reduce (and restructure) the DTMIterator's view of the * document. In our case, we will be using hardcoded filters built * into our iterators... but getFilter() is part of the DOM's * DTMIterator interface, so we have to support it. * * @return null, which is slightly misleading. True, there is no * user-written filter object, but in fact we are doing some very * sophisticated custom filtering. A DOM purist might suggest * returning a placeholder object just to indicate that this is * not going to return all nodes selected by whatToShow. */ public DTMFilter getFilter() { return null; } /** * The value of this flag determines whether the children of entity * reference nodes are visible to the iterator. If false, they will be * skipped over. *
    To produce a view of the document that has entity references * expanded and does not expose the entity reference node itself, use the * whatToShow flags to hide the entity reference node and set * expandEntityReferences to true when creating the iterator. To produce * a view of the document that has entity reference nodes but no entity * expansion, use the whatToShow flags to show the entity reference node * and set expandEntityReferences to false. * * @return true for all iterators based on NodeSetDTM, meaning that the * contents of EntityRefrence nodes may be returned (though whatToShow * says that the EntityReferences themselves are not shown.) */ public boolean getExpandEntityReferences() { return true; } /** * Get an instance of a DTM that "owns" a node handle. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTM using just the iterator. * * @param nodeHandle the nodeHandle. * * @return a non-null DTM reference. */ public DTM getDTM(int nodeHandle) { return m_manager.getDTM(nodeHandle); } /* An instance of the DTMManager. */ DTMManager m_manager; /** * Get an instance of the DTMManager. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTMManager using just the iterator. * * @return a non-null DTMManager reference. */ public DTMManager getDTMManager() { return m_manager; } /** * Returns the next node in the set and advances the position of the * iterator in the set. After a DTMIterator is created, the first call * to nextNode() returns the first node in the set. * @return The next Node in the set being iterated over, or * DTM.NULL if there are no more members in that set. * @throws DOMException * INVALID_STATE_ERR: Raised if this method is called after the * detach method was invoked. */ public int nextNode() { if ((m_next) < this.size()) { int next = this.elementAt(m_next); m_next++; return next; } else return DTM.NULL; } /** * Returns the previous node in the set and moves the position of the * iterator backwards in the set. * @return The previous Node in the set being iterated over, * orDTM.NULL if there are no more members in that set. * @throws DOMException * INVALID_STATE_ERR: Raised if this method is called after the * detach method was invoked. * @throws RuntimeException thrown if this NodeSetDTM is not of * a cached type, and hence doesn't know what the previous node was. */ public int previousNode() { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null)); //"This NodeSetDTM can not iterate to a previous node!"); if ((m_next - 1) > 0) { m_next--; return this.elementAt(m_next); } else return DTM.NULL; } /** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. Afterdetach has been invoked, calls to * nextNode orpreviousNode will raise the * exception INVALID_STATE_ERR. *

    * This operation is a no-op in NodeSetDTM, and will not cause * INVALID_STATE_ERR to be raised by later operations. *

    */ public void detach(){} /** * Specify if it's OK for detach to release the iterator for reuse. * * @param allowRelease true if it is OK for detach to release this iterator * for pooling. */ public void allowDetachToRelease(boolean allowRelease) { // no action for right now. } /** * Tells if this NodeSetDTM is "fresh", in other words, if * the first nextNode() that is called will return the * first node in the set. * * @return true if nextNode() would return the first node in the set, * false if it would return a later one. */ public boolean isFresh() { return (m_next == 0); } /** * If an index is requested, NodeSetDTM will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end. * * @param index Position to advance (or retreat) to, with * 0 requesting the reset ("fresh") position and -1 (or indeed * any out-of-bounds value) requesting the final position. * @throws RuntimeException thrown if this NodeSetDTM is not * one of the types which supports indexing/counting. */ public void runTo(int index) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_INDEX, null)); //"This NodeSetDTM can not do indexing or counting functions!"); if ((index >= 0) && (m_next < m_firstFree)) m_next = index; else m_next = m_firstFree - 1; } /** * Returns the indexth item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * * TODO: What happens if index is out of range? * * @param index Index into the collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. */ public int item(int index) { runTo(index); return this.elementAt(index); } /** * The number of nodes in the list. The range of valid child node indices is * 0 to length-1 inclusive. Note that this operation requires * finding all the matching nodes, which may defeat attempts to defer * that work. * * @return integer indicating how many nodes are represented by this list. */ public int getLength() { runTo(-1); return this.size(); } /** * Add a node to the NodeSetDTM. Not all types of NodeSetDTMs support this * operation * * @param n Node to be added * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void addNode(int n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); this.addElement(n); } /** * Insert a node at a given position. * * @param n Node to be added * @param pos Offset at which the node is to be inserted, * with 0 being the first position. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void insertNode(int n, int pos) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); insertElementAt(n, pos); } /** * Remove a node. * * @param n Node to be added * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void removeNode(int n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); this.removeElement(n); } // %TBD% // /** // * Copy NodeList members into this nodelist, adding in // * document order. If a node is null, don't add it. // * // * @param nodelist List of nodes which should now be referenced by // * this NodeSetDTM. // * @throws RuntimeException thrown if this NodeSetDTM is not of // * a mutable type. // */ // public void addNodes(NodeList nodelist) // { // // if (!m_mutable) // throw new RuntimeException("This NodeSetDTM is not mutable!"); // // if (null != nodelist) // defensive to fix a bug that Sanjiva reported. // { // int nChildren = nodelist.getLength(); // // for (int i = 0; i < nChildren; i++) // { // int obj = nodelist.item(i); // // if (null != obj) // { // addElement(obj); // } // } // } // // // checkDups(); // } // %TBD% // /** // *

    Copy NodeList members into this nodelist, adding in // * document order. Only genuine node references will be copied; // * nulls appearing in the source NodeSetDTM will // * not be added to this one.

    // * // *

    In case you're wondering why this function is needed: NodeSetDTM // * implements both DTMIterator and NodeList. If this method isn't // * provided, Java can't decide which of those to use when addNodes() // * is invoked. Providing the more-explicit match avoids that // * ambiguity.)

    // * // * @param ns NodeSetDTM whose members should be merged into this NodeSetDTM. // * @throws RuntimeException thrown if this NodeSetDTM is not of // * a mutable type. // */ // public void addNodes(NodeSetDTM ns) // { // // if (!m_mutable) // throw new RuntimeException("This NodeSetDTM is not mutable!"); // // addNodes((DTMIterator) ns); // } /** * Copy NodeList members into this nodelist, adding in * document order. Null references are not added. * * @param iterator DTMIterator which yields the nodes to be added. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void addNodes(DTMIterator iterator) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); if (null != iterator) // defensive to fix a bug that Sanjiva reported. { int obj; while (DTM.NULL != (obj = iterator.nextNode())) { addElement(obj); } } // checkDups(); } // %TBD% // /** // * Copy NodeList members into this nodelist, adding in // * document order. If a node is null, don't add it. // * // * @param nodelist List of nodes to be added // * @param support The XPath runtime context. // * @throws RuntimeException thrown if this NodeSetDTM is not of // * a mutable type. // */ // public void addNodesInDocOrder(NodeList nodelist, XPathContext support) // { // // if (!m_mutable) // throw new RuntimeException("This NodeSetDTM is not mutable!"); // // int nChildren = nodelist.getLength(); // // for (int i = 0; i < nChildren; i++) // { // int node = nodelist.item(i); // // if (null != node) // { // addNodeInDocOrder(node, support); // } // } // } /** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param iterator DTMIterator which yields the nodes to be added. * @param support The XPath runtime context. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void addNodesInDocOrder(DTMIterator iterator, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); int node; while (DTM.NULL != (node = iterator.nextNode())) { addNodeInDocOrder(node, support); } } // %TBD% // /** // * Add the node list to this node set in document order. // * // * @param start index. // * @param end index. // * @param testIndex index. // * @param nodelist The nodelist to add. // * @param support The XPath runtime context. // * // * @return false always. // * @throws RuntimeException thrown if this NodeSetDTM is not of // * a mutable type. // */ // private boolean addNodesInDocOrder(int start, int end, int testIndex, // NodeList nodelist, XPathContext support) // { // // if (!m_mutable) // throw new RuntimeException("This NodeSetDTM is not mutable!"); // // boolean foundit = false; // int i; // int node = nodelist.item(testIndex); // // for (i = end; i >= start; i--) // { // int child = elementAt(i); // // if (child == node) // { // i = -2; // Duplicate, suppress insert // // break; // } // // if (!support.getDOMHelper().isNodeAfter(node, child)) // { // insertElementAt(node, i + 1); // // testIndex--; // // if (testIndex > 0) // { // boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist, // support); // // if (!foundPrev) // { // addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support); // } // } // // break; // } // } // // if (i == -1) // { // insertElementAt(node, 0); // } // // return foundit; // } /** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @param test true if we should test for doc order * @param support The XPath runtime context. * @return insertIndex. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public int addNodeInDocOrder(int node, boolean test, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); int insertIndex = -1; if (test) { // This needs to do a binary search, but a binary search // is somewhat tough because the sequence test involves // two nodes. int size = size(), i; for (i = size - 1; i >= 0; i--) { int child = elementAt(i); if (child == node) { i = -2; // Duplicate, suppress insert break; } DTM dtm = support.getDTM(node); if (!dtm.isNodeAfter(node, child)) { break; } } if (i != -2) { insertIndex = i + 1; insertElementAt(node, insertIndex); } } else { insertIndex = this.size(); boolean foundit = false; for (int i = 0; i < insertIndex; i++) { if (i == node) { foundit = true; break; } } if (!foundit) addElement(node); } // checkDups(); return insertIndex; } // end addNodeInDocOrder(Vector v, Object obj) /** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @param support The XPath runtime context. * * @return The index where it was inserted. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public int addNodeInDocOrder(int node, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); return addNodeInDocOrder(node, true, support); } // end addNodeInDocOrder(Vector v, Object obj) /** * Get the length of the list. * * @return The size of this node set. */ public int size() { return super.size(); } /** * Append a Node onto the vector. * * @param value The node to be added. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void addElement(int value) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.addElement(value); } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * @param value The node to be inserted. * @param at The index where the insert should occur. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void insertElementAt(int value, int at) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.insertElementAt(value, at); } /** * Append the nodes to the list. * * @param nodes The nodes to be appended to this node set. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void appendNodes(NodeVector nodes) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void removeAllElements() { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.removeAllElements(); } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s The node to be removed. * * @return True if the node was successfully removed * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public boolean removeElement(int s) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); return super.removeElement(s); } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param i The index of the node to be removed. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void removeElementAt(int i) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.removeElementAt(i); } /** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param node The node to be set. * @param index The index of the node to be replaced. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void setElementAt(int node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.setElementAt(node, index); } /** * Same as setElementAt. * * @param node The node to be set. * @param index The index of the node to be replaced. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void setItem(int node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.setElementAt(node, index); } /** * Get the nth element. * * @param i The index of the requested node. * * @return Node at specified index. */ public int elementAt(int i) { runTo(i); return super.elementAt(i); } /** * Tell if the table contains the given node. * * @param s Node to look for * * @return True if the given node was found. */ public boolean contains(int s) { runTo(-1); return super.contains(s); } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @param index Index of where to start the search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(int elem, int index) { runTo(-1); return super.indexOf(elem, index); } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(int elem) { runTo(-1); return super.indexOf(elem); } /** If this node is being used as an iterator, the next index that nextNode() * will return. */ transient protected int m_next = 0; /** * Get the current position, which is one less than * the next nextNode() call will retrieve. i.e. if * you call getCurrentPos() and the return is 0, the next * fetch will take place at index 1. * * @return The the current position index. */ public int getCurrentPos() { return m_next; } /** * Set the current position in the node set. * @param i Must be a valid index. * @throws RuntimeException thrown if this NodeSetDTM is not of * a cached type, and thus doesn't permit indexed access. */ public void setCurrentPos(int i) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_INDEX, null)); //"This NodeSetDTM can not do indexing or counting functions!"); m_next = i; } /** * Return the last fetched node. Needed to support the UnionPathIterator. * * @return the last fetched node. * @throws RuntimeException thrown if this NodeSetDTM is not of * a cached type, and thus doesn't permit indexed access. */ public int getCurrentNode() { if (!m_cacheNodes) throw new RuntimeException( "This NodeSetDTM can not do indexing or counting functions!"); int saved = m_next; // because nextNode always increments // But watch out for copy29, where the root iterator didn't // have nextNode called on it. int current = (m_next > 0) ? m_next-1 : m_next; int n = (current < m_firstFree) ? elementAt(current) : DTM.NULL; m_next = saved; // HACK: I think this is a bit of a hack. -sb return n; } /** True if this list can be mutated. */ transient protected boolean m_mutable = true; /** True if this list is cached. * @serial */ transient protected boolean m_cacheNodes = true; /** The root of the iteration, if available. */ protected int m_root = DTM.NULL; /** * Get whether or not this is a cached node set. * * * @return True if this list is cached. */ public boolean getShouldCacheNodes() { return m_cacheNodes; } /** * If setShouldCacheNodes(true) is called, then nodes will * be cached. They are not cached by default. This switch must * be set before the first call to nextNode is made, to ensure * that all nodes are cached. * * @param b true if this node set should be cached. * @throws RuntimeException thrown if an attempt is made to * request caching after we've already begun stepping through the * nodes in this set. */ public void setShouldCacheNodes(boolean b) { if (!isFresh()) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_CALL_SETSHOULDCACHENODE, null)); //"Can not call setShouldCacheNodes after nextNode has been called!"); m_cacheNodes = b; m_mutable = true; } /** * Tells if this iterator can have nodes added to it or set via * the setItem(int node, int index) method. * * @return True if the nodelist can be mutated. */ public boolean isMutable() { return m_mutable; } transient private int m_last = 0; public int getLast() { return m_last; } public void setLast(int last) { m_last = last; } /** * Returns true if all the nodes in the iteration well be returned in document * order. * * @return true as a default. */ public boolean isDocOrdered() { return true; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return -1; } } libxalan2-java-2.7.1/src/org/apache/xpath/VariableStack.java0000644000175000017500000003737010721374032022612 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VariableStack.java 524812 2007-04-02 15:52:03Z zongaro $ */ package org.apache.xpath; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xpath.objects.XObject; import org.apache.xpath.res.XPATHErrorResources; /** * Defines a class to keep track of a stack for * template arguments and variables. * *

    This has been changed from the previous incarnations of this * class to be fairly low level.

    * @xsl.usage internal */ public class VariableStack implements Cloneable { /** * limitation for 1K */ public static final int CLEARLIMITATION= 1024; /** * Constructor for a variable stack. */ public VariableStack() { reset(); } /** * Constructor for a variable stack. * @param initStackSize The initial stack size. Must be at least one. The * stack can grow if needed. */ public VariableStack(int initStackSize) { // Allow for twice as many variables as stack link entries reset(initStackSize, initStackSize*2); } /** * Returns a clone of this variable stack. * * @return a clone of this variable stack. * * @throws CloneNotSupportedException */ public synchronized Object clone() throws CloneNotSupportedException { VariableStack vs = (VariableStack) super.clone(); // I *think* I can get away with a shallow clone here? vs._stackFrames = (XObject[]) _stackFrames.clone(); vs._links = (int[]) _links.clone(); return vs; } /** * The stack frame where all variables and params will be kept. * @serial */ XObject[] _stackFrames; /** * The top of the stack frame (_stackFrames). * @serial */ int _frameTop; /** * The bottom index of the current frame (relative to _stackFrames). * @serial */ private int _currentFrameBottom; /** * The stack of frame positions. I call 'em links because of distant * * Motorola 68000 assembler memories. :-) * @serial */ int[] _links; /** * The top of the links stack. */ int _linksTop; /** * Get the element at the given index, regardless of stackframe. * * @param i index from zero. * * @return The item at the given index. */ public XObject elementAt(final int i) { return _stackFrames[i]; } /** * Get size of the stack. * * @return the total size of the execution stack. */ public int size() { return _frameTop; } /** * Reset the stack to a start position. */ public void reset() { // If the stack was previously allocated, assume that about the same // amount of stack space will be needed again; otherwise, use a very // large stack size. int linksSize = (_links == null) ? XPathContext.RECURSIONLIMIT : _links.length; int varArraySize = (_stackFrames == null) ? XPathContext.RECURSIONLIMIT * 2 : _stackFrames.length; reset(linksSize, varArraySize); } /** * Reset the stack to a start position. * @param linksSize Initial stack size to use * @param varArraySize Initial variable array size to use */ protected void reset(int linksSize, int varArraySize) { _frameTop = 0; _linksTop = 0; // Don't bother reallocating _links array if it exists already if (_links == null) { _links = new int[linksSize]; } // Adding one here to the stack of frame positions will allow us always // to look one under without having to check if we're at zero. // (As long as the caller doesn't screw up link/unlink.) _links[_linksTop++] = 0; // Get a clean _stackFrames array and discard the old one. _stackFrames = new XObject[varArraySize]; } /** * Set the current stack frame. * * @param sf The new stack frame position. */ public void setStackFrame(int sf) { _currentFrameBottom = sf; } /** * Get the position from where the search should start, * which is either the searchStart property, or the top * of the stack if that value is -1. * * @return The current stack frame position. */ public int getStackFrame() { return _currentFrameBottom; } /** * Allocates memory (called a stackframe) on the stack; used to store * local variables and parameter arguments. * *

    I use the link/unlink concept because of distant * * Motorola 68000 assembler memories.

    * * @param size The size of the stack frame allocation. This ammount should * normally be the maximum number of variables that you can have allocated * at one time in the new stack frame. * * @return The bottom of the stack frame, from where local variable addressing * should start from. */ public int link(final int size) { _currentFrameBottom = _frameTop; _frameTop += size; if (_frameTop >= _stackFrames.length) { XObject newsf[] = new XObject[_stackFrames.length + XPathContext.RECURSIONLIMIT + size]; System.arraycopy(_stackFrames, 0, newsf, 0, _stackFrames.length); _stackFrames = newsf; } if (_linksTop + 1 >= _links.length) { int newlinks[] = new int[_links.length + (CLEARLIMITATION * 2)]; System.arraycopy(_links, 0, newlinks, 0, _links.length); _links = newlinks; } _links[_linksTop++] = _currentFrameBottom; return _currentFrameBottom; } /** * Free up the stack frame that was last allocated with * {@link #link(int size)}. */ public void unlink() { _frameTop = _links[--_linksTop]; _currentFrameBottom = _links[_linksTop - 1]; } /** * Free up the stack frame that was last allocated with * {@link #link(int size)}. * @param currentFrame The current frame to set to * after the unlink. */ public void unlink(int currentFrame) { _frameTop = _links[--_linksTop]; _currentFrameBottom = currentFrame; } /** * Set a local variable or parameter in the current stack frame. * * * @param index Local variable index relative to the current stack * frame bottom. * * @param val The value of the variable that is being set. */ public void setLocalVariable(int index, XObject val) { _stackFrames[index + _currentFrameBottom] = val; } /** * Set a local variable or parameter in the specified stack frame. * * * @param index Local variable index relative to the current stack * frame bottom. * NEEDSDOC @param stackFrame * * @param val The value of the variable that is being set. */ public void setLocalVariable(int index, XObject val, int stackFrame) { _stackFrames[index + stackFrame] = val; } /** * Get a local variable or parameter in the current stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Local variable index relative to the current stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getLocalVariable(XPathContext xctxt, int index) throws TransformerException { index += _currentFrameBottom; XObject val = _stackFrames[index]; if(null == val) throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null), xctxt.getSAXLocator()); // "Variable accessed before it is bound!", xctxt.getSAXLocator()); // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return val; } /** * Get a local variable or parameter in the current stack frame. * * * @param index Local variable index relative to the given * frame bottom. * NEEDSDOC @param frame * * @return The value of the variable. * * @throws TransformerException */ public XObject getLocalVariable(int index, int frame) throws TransformerException { index += frame; XObject val = _stackFrames[index]; return val; } /** * Get a local variable or parameter in the current stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Local variable index relative to the current stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getLocalVariable(XPathContext xctxt, int index, boolean destructiveOK) throws TransformerException { index += _currentFrameBottom; XObject val = _stackFrames[index]; if(null == val) throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null), xctxt.getSAXLocator()); // "Variable accessed before it is bound!", xctxt.getSAXLocator()); // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return destructiveOK ? val : val.getFresh(); } /** * Tell if a local variable has been set or not. * * @param index Local variable index relative to the current stack * frame bottom. * * @return true if the value at the index is not null. * * @throws TransformerException */ public boolean isLocalSet(int index) throws TransformerException { return (_stackFrames[index + _currentFrameBottom] != null); } /** NEEDSDOC Field m_nulls */ private static XObject[] m_nulls = new XObject[CLEARLIMITATION]; /** * Use this to clear the variables in a section of the stack. This is * used to clear the parameter section of the stack, so that default param * values can tell if they've already been set. It is important to note that * this function has a 1K limitation. * * @param start The start position, relative to the current local stack frame. * @param len The number of slots to be cleared. */ public void clearLocalSlots(int start, int len) { start += _currentFrameBottom; System.arraycopy(m_nulls, 0, _stackFrames, start, len); } /** * Set a global variable or parameter in the global stack frame. * * * @param index Local variable index relative to the global stack frame * bottom. * * @param val The value of the variable that is being set. */ public void setGlobalVariable(final int index, final XObject val) { _stackFrames[index] = val; } /** * Get a global variable or parameter from the global stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Global variable index relative to the global stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getGlobalVariable(XPathContext xctxt, final int index) throws TransformerException { XObject val = _stackFrames[index]; // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return val; } /** * Get a global variable or parameter from the global stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Global variable index relative to the global stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getGlobalVariable(XPathContext xctxt, final int index, boolean destructiveOK) throws TransformerException { XObject val = _stackFrames[index]; // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return destructiveOK ? val : val.getFresh(); } /** * Get a variable based on it's qualified name. * This is for external use only. * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param qname The qualified name of the variable. * * @return The evaluated value of the variable. * * @throws javax.xml.transform.TransformerException */ public XObject getVariableOrParam( XPathContext xctxt, org.apache.xml.utils.QName qname) throws javax.xml.transform.TransformerException { org.apache.xml.utils.PrefixResolver prefixResolver = xctxt.getNamespaceContext(); // Get the current ElemTemplateElement, which must be pushed in as the // prefix resolver, and then walk backwards in document order, searching // for an xsl:param element or xsl:variable element that matches our // qname. If we reach the top level, use the StylesheetRoot's composed // list of top level variables and parameters. if (prefixResolver instanceof org.apache.xalan.templates.ElemTemplateElement) { org.apache.xalan.templates.ElemVariable vvar; org.apache.xalan.templates.ElemTemplateElement prev = (org.apache.xalan.templates.ElemTemplateElement) prefixResolver; if (!(prev instanceof org.apache.xalan.templates.Stylesheet)) { while ( !(prev.getParentNode() instanceof org.apache.xalan.templates.Stylesheet) ) { org.apache.xalan.templates.ElemTemplateElement savedprev = prev; while (null != (prev = prev.getPreviousSiblingElem())) { if (prev instanceof org.apache.xalan.templates.ElemVariable) { vvar = (org.apache.xalan.templates.ElemVariable) prev; if (vvar.getName().equals(qname)) return getLocalVariable(xctxt, vvar.getIndex()); } } prev = savedprev.getParentElem(); } } vvar = prev.getStylesheetRoot().getVariableOrParamComposed(qname); if (null != vvar) return getGlobalVariable(xctxt, vvar.getIndex()); } throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{qname.toString()})); //"Variable not resolvable: " + qname); } } // end VariableStack libxalan2-java-2.7.1/src/org/apache/xpath/XPathFactory.java0000644000175000017500000000343410721374033022446 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathFactory.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import javax.xml.transform.SourceLocator; import org.apache.xml.utils.PrefixResolver; /** * Factory class for creating an XPath. Implementors of XPath derivatives * will need to make a derived class of this. * @xsl.usage advanced */ public interface XPathFactory { /** * Create an XPath. * * @param exprString The XPath expression string. * @param locator The location of the expression string, mainly for diagnostic * purposes. * @param prefixResolver This will be called in order to resolve prefixes * to namespace URIs. * @param type One of {@link org.apache.xpath.XPath#SELECT} or * {@link org.apache.xpath.XPath#MATCH}. * * @return an XPath ready for execution. */ XPath create(String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type); } libxalan2-java-2.7.1/src/org/apache/xpath/XPathException.java0000644000175000017500000002063610721374030022775 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XPathException.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import javax.xml.transform.TransformerException; import org.w3c.dom.Node; /** * This class implements an exception object that all * XPath classes will throw in case of an error. This class * extends TransformerException, and may hold other exceptions. In the * case of nested exceptions, printStackTrace will dump * all the traces of the nested exceptions, not just the trace * of this object. * @xsl.usage general */ public class XPathException extends TransformerException { static final long serialVersionUID = 4263549717619045963L; /** The home of the expression that caused the error. * @serial */ Object m_styleNode = null; /** * Get the stylesheet node from where this error originated. * @return The stylesheet node from where this error originated, or null. */ public Object getStylesheetNode() { return m_styleNode; } /** * Set the stylesheet node from where this error originated. * @param styleNode The stylesheet node from where this error originated, or null. */ public void setStylesheetNode(Object styleNode) { m_styleNode = styleNode; } /** A nested exception. * @serial */ protected Exception m_exception; /** * Create an XPathException object that holds * an error message. * @param message The error message. */ public XPathException(String message, ExpressionNode ex) { super(message); this.setLocator(ex); setStylesheetNode(getStylesheetNode(ex)); } /** * Create an XPathException object that holds * an error message. * @param message The error message. */ public XPathException(String message) { super(message); } /** * Get the XSLT ElemVariable that this sub-expression references. In order for * this to work, the SourceLocator must be the owning ElemTemplateElement. * @return The dereference to the ElemVariable, or null if not found. */ public org.w3c.dom.Node getStylesheetNode(ExpressionNode ex) { ExpressionNode owner = getExpressionOwner(ex); if (null != owner && owner instanceof org.w3c.dom.Node) { return ((org.w3c.dom.Node)owner); } return null; } /** * Get the first non-Expression parent of this node. * @return null or first ancestor that is not an Expression. */ protected ExpressionNode getExpressionOwner(ExpressionNode ex) { ExpressionNode parent = ex.exprGetParent(); while((null != parent) && (parent instanceof Expression)) parent = parent.exprGetParent(); return parent; } /** * Create an XPathException object that holds * an error message and the stylesheet node that * the error originated from. * @param message The error message. * @param styleNode The stylesheet node that the error originated from. */ public XPathException(String message, Object styleNode) { super(message); m_styleNode = styleNode; } /** * Create an XPathException object that holds * an error message, the stylesheet node that * the error originated from, and another exception * that caused this exception. * @param message The error message. * @param styleNode The stylesheet node that the error originated from. * @param e The exception that caused this exception. */ public XPathException(String message, Node styleNode, Exception e) { super(message); m_styleNode = styleNode; this.m_exception = e; } /** * Create an XPathException object that holds * an error message, and another exception * that caused this exception. * @param message The error message. * @param e The exception that caused this exception. */ public XPathException(String message, Exception e) { super(message); this.m_exception = e; } /** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. * @param s The stream where the dump will be sent to. */ public void printStackTrace(java.io.PrintStream s) { if (s == null) s = System.err; try { super.printStackTrace(s); } catch (Exception e){} Throwable exception = m_exception; for (int i = 0; (i < 10) && (null != exception); i++) { s.println("---------"); exception.printStackTrace(s); if (exception instanceof TransformerException) { TransformerException se = (TransformerException) exception; Throwable prev = exception; exception = se.getException(); if (prev == exception) break; } else { exception = null; } } } /** * Find the most contained message. * * @return The error message of the originating exception. */ public String getMessage() { String lastMessage = super.getMessage(); Throwable exception = m_exception; while (null != exception) { String nextMessage = exception.getMessage(); if (null != nextMessage) lastMessage = nextMessage; if (exception instanceof TransformerException) { TransformerException se = (TransformerException) exception; Throwable prev = exception; exception = se.getException(); if (prev == exception) break; } else { exception = null; } } return (null != lastMessage) ? lastMessage : ""; } /** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. * @param s The writer where the dump will be sent to. */ public void printStackTrace(java.io.PrintWriter s) { if (s == null) s = new java.io.PrintWriter(System.err); try { super.printStackTrace(s); } catch (Exception e){} boolean isJdk14OrHigher = false; try { Throwable.class.getMethod("getCause",null); isJdk14OrHigher = true; } catch (NoSuchMethodException nsme) { // do nothing } // The printStackTrace method of the Throwable class in jdk 1.4 // and higher will include the cause when printing the backtrace. // The following code is only required when using jdk 1.3 or lower if (!isJdk14OrHigher) { Throwable exception = m_exception; for (int i = 0; (i < 10) && (null != exception); i++) { s.println("---------"); try { exception.printStackTrace(s); } catch (Exception e) { s.println("Could not print stack trace..."); } if (exception instanceof TransformerException) { TransformerException se = (TransformerException) exception; Throwable prev = exception; exception = se.getException(); if (prev == exception) { exception = null; break; } } else { exception = null; } } } } /** * Return the embedded exception, if any. * Overrides javax.xml.transform.TransformerException.getException(). * * @return The embedded exception, or null if there is none. */ public Throwable getException() { return m_exception; } } libxalan2-java-2.7.1/src/org/apache/xpath/WhitespaceStrippingElementMatcher.java0000644000175000017500000000372010721374030026677 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WhitespaceStrippingElementMatcher.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xpath; import javax.xml.transform.TransformerException; import org.w3c.dom.Element; /** * A class that implements this interface can tell if a given element should * strip whitespace nodes from it's children. */ public interface WhitespaceStrippingElementMatcher { /** * Get information about whether or not an element should strip whitespace. * @see strip in XSLT Specification * * @param support The XPath runtime state. * @param targetElement Element to check * * @return true if the whitespace should be stripped. * * @throws TransformerException */ public boolean shouldStripWhiteSpace( XPathContext support, Element targetElement) throws TransformerException; /** * Get information about whether or not whitespace can be stripped. * @see strip in XSLT Specification * * @return true if the whitespace can be stripped. */ public boolean canStripWhiteSpace(); } libxalan2-java-2.7.1/src/org/apache/xml/0000755000175000017500000000000010721374030016674 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/serializer/0000755000175000017500000000000010736146354021061 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/serializer/SecuritySupport.java0000644000175000017500000000741310721374030025121 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToXMLSAXHandler.java0000644000175000017500000005612510721374033024541 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToXMLSAXHandler.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import javax.xml.transform.Result; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; /** * This class receives notification of SAX-like events, and with gathered * information over these calls it will invoke the equivalent SAX methods * on a handler, the ultimate xsl:output method is known to be "xml". * * This class is not a public API. * @xsl.usage internal */ public final class ToXMLSAXHandler extends ToSAXHandler { /** * Keeps track of whether output escaping is currently enabled */ protected boolean m_escapeSetting = true; public ToXMLSAXHandler() { // default constructor (need to set content handler ASAP !) m_prefixMap = new NamespaceMappings(); initCDATA(); } /** * @see Serializer#getOutputFormat() */ public Properties getOutputFormat() { return null; } /** * @see Serializer#getOutputStream() */ public OutputStream getOutputStream() { return null; } /** * @see Serializer#getWriter() */ public Writer getWriter() { return null; } /** * Do nothing for SAX. */ public void indent(int n) throws SAXException { } /** * @see DOMSerializer#serialize(Node) */ public void serialize(Node node) throws IOException { } /** * @see SerializationHandler#setEscaping(boolean) */ public boolean setEscaping(boolean escape) throws SAXException { boolean oldEscapeSetting = m_escapeSetting; m_escapeSetting = escape; if (escape) { processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""); } return oldEscapeSetting; } /** * @see Serializer#setOutputFormat(Properties) */ public void setOutputFormat(Properties format) { } /** * @see Serializer#setOutputStream(OutputStream) */ public void setOutputStream(OutputStream output) { } /** * @see Serializer#setWriter(Writer) */ public void setWriter(Writer writer) { } /** * @see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String) */ public void attributeDecl( String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException { } /** * @see org.xml.sax.ext.DeclHandler#elementDecl(String, String) */ public void elementDecl(String arg0, String arg1) throws SAXException { } /** * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String) */ public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException { } /** * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(String, String) */ public void internalEntityDecl(String arg0, String arg1) throws SAXException { } /** * Receives notification of the end of the document. * @see org.xml.sax.ContentHandler#endDocument() */ public void endDocument() throws SAXException { flushPending(); // Close output document m_saxHandler.endDocument(); if (m_tracer != null) super.fireEndDoc(); } /** * This method is called when all the data needed for a call to the * SAX handler's startElement() method has been gathered. */ protected void closeStartTag() throws SAXException { m_elemContext.m_startTagOpen = false; final String localName = getLocalName(m_elemContext.m_elementName); final String uri = getNamespaceURI(m_elemContext.m_elementName, true); // Now is time to send the startElement event if (m_needToCallStartDocument) { startDocumentInternal(); } m_saxHandler.startElement(uri, localName, m_elemContext.m_elementName, m_attributes); // we've sent the official SAX attributes on their way, // now we don't need them anymore. m_attributes.clear(); if(m_state != null) m_state.setCurrentNode(null); } /** * Closes ane open cdata tag, and * unlike the this.endCDATA() method (from the LexicalHandler) interface, * this "internal" method will send the endCDATA() call to the wrapped * handler. * */ public void closeCDATA() throws SAXException { // Output closing bracket - "]]>" if (m_lexHandler != null && m_cdataTagOpen) { m_lexHandler.endCDATA(); } // There are no longer any calls made to // m_lexHandler.startCDATA() without a balancing call to // m_lexHandler.endCDATA() // so we set m_cdataTagOpen to false to remember this. m_cdataTagOpen = false; } /** * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { // Close any open elements etc. flushPending(); if (namespaceURI == null) { if (m_elemContext.m_elementURI != null) namespaceURI = m_elemContext.m_elementURI; else namespaceURI = getNamespaceURI(qName, true); } if (localName == null) { if (m_elemContext.m_elementLocalName != null) localName = m_elemContext.m_elementLocalName; else localName = getLocalName(qName); } m_saxHandler.endElement(namespaceURI, localName, qName); if (m_tracer != null) super.fireEndElem(qName); /* Pop all namespaces at the current element depth. * We are not waiting for official endPrefixMapping() calls. */ m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, m_saxHandler); m_elemContext = m_elemContext.m_prev; } /** * @see org.xml.sax.ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String prefix) throws SAXException { /* poping all prefix mappings should have been done * in endElement() already */ return; } /** * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { m_saxHandler.ignorableWhitespace(arg0,arg1,arg2); } /** * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator arg0) { m_saxHandler.setDocumentLocator(arg0); } /** * @see org.xml.sax.ContentHandler#skippedEntity(String) */ public void skippedEntity(String arg0) throws SAXException { m_saxHandler.skippedEntity(arg0); } /** * @see org.xml.sax.ContentHandler#startPrefixMapping(String, String) * @param prefix The prefix that maps to the URI * @param uri The URI for the namespace */ public void startPrefixMapping(String prefix, String uri) throws SAXException { startPrefixMapping(prefix, uri, true); } /** * Remember the prefix/uri mapping at the current nested element depth. * * @see org.xml.sax.ContentHandler#startPrefixMapping(String, String) * @param prefix The prefix that maps to the URI * @param uri The URI for the namespace * @param shouldFlush a flag indicating if the mapping applies to the * current element or an up coming child (not used). */ public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws org.xml.sax.SAXException { /* Remember the mapping, and at what depth it was declared * This is one greater than the current depth because these * mappings will apply to the next depth. This is in * consideration that startElement() will soon be called */ boolean pushed; int pushDepth; if (shouldFlush) { flushPending(); // the prefix mapping applies to the child element (one deeper) pushDepth = m_elemContext.m_currentElemDepth + 1; } else { // the prefix mapping applies to the current element pushDepth = m_elemContext.m_currentElemDepth; } pushed = m_prefixMap.pushNamespace(prefix, uri, pushDepth); if (pushed) { m_saxHandler.startPrefixMapping(prefix,uri); if (getShouldOutputNSAttr()) { /* I don't know if we really needto do this. The * callers of this object should have injected both * startPrefixMapping and the attributes. We are * just covering our butt here. */ String name; if (EMPTYSTRING.equals(prefix)) { name = "xmlns"; addAttributeAlways(XMLNS_URI, name, name,"CDATA",uri, false); } else { if (!EMPTYSTRING.equals(uri)) // hack for attribset16 test { // that maps ns1 prefix to "" URI name = "xmlns:" + prefix; /* for something like xmlns:abc="w3.pretend.org" * the uri is the value, that is why we pass it in the * value, or 5th slot of addAttributeAlways() */ addAttributeAlways(XMLNS_URI, prefix, name,"CDATA",uri, false ); } } } } return pushed; } /** * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int) */ public void comment(char[] arg0, int arg1, int arg2) throws SAXException { flushPending(); if (m_lexHandler != null) m_lexHandler.comment(arg0, arg1, arg2); if (m_tracer != null) super.fireCommentEvent(arg0, arg1, arg2); } /** * @see org.xml.sax.ext.LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { /* Normally we would do somthing with this but we ignore it. * The neccessary call to m_lexHandler.endCDATA() will be made * in flushPending(). * * This is so that if we get calls like these: * this.startCDATA(); * this.characters(chars1, off1, len1); * this.endCDATA(); * this.startCDATA(); * this.characters(chars2, off2, len2); * this.endCDATA(); * * that we will only make these calls to the wrapped handlers: * * m_lexHandler.startCDATA(); * m_saxHandler.characters(chars1, off1, len1); * m_saxHandler.characters(chars1, off2, len2); * m_lexHandler.endCDATA(); * * We will merge adjacent CDATA blocks. */ } /** * @see org.xml.sax.ext.LexicalHandler#endDTD() */ public void endDTD() throws SAXException { if (m_lexHandler != null) m_lexHandler.endDTD(); } /** * @see org.xml.sax.ext.LexicalHandler#startEntity(String) */ public void startEntity(String arg0) throws SAXException { if (m_lexHandler != null) m_lexHandler.startEntity(arg0); } /** * @see ExtendedContentHandler#characters(String) */ public void characters(String chars) throws SAXException { final int length = chars.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } chars.getChars(0, length, m_charsBuff, 0); this.characters(m_charsBuff, 0, length); } public ToXMLSAXHandler(ContentHandler handler, String encoding) { super(handler, encoding); initCDATA(); // initNamespaces(); m_prefixMap = new NamespaceMappings(); } public ToXMLSAXHandler( ContentHandler handler, LexicalHandler lex, String encoding) { super(handler, lex, encoding); initCDATA(); // initNamespaces(); m_prefixMap = new NamespaceMappings(); } /** * Start an element in the output document. This might be an XML element * (data type) or a CDATA section. */ public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { startElement( elementNamespaceURI,elementLocalName,elementName, null); } public void startElement(String elementName) throws SAXException { startElement(null, null, elementName, null); } public void characters(char[] ch, int off, int len) throws SAXException { // We do the first two things in flushPending() but we don't // close any open CDATA calls. if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } if (m_elemContext.m_isCdataSection && !m_cdataTagOpen && m_lexHandler != null) { m_lexHandler.startCDATA(); // We have made a call to m_lexHandler.startCDATA() with // no balancing call to m_lexHandler.endCDATA() // so we set m_cdataTagOpen true to remember this. m_cdataTagOpen = true; } /* If there are any occurances of "]]>" in the character data * let m_saxHandler worry about it, we've already warned them with * the previous call of m_lexHandler.startCDATA(); */ m_saxHandler.characters(ch, off, len); // time to generate characters event if (m_tracer != null) fireCharEvent(ch, off, len); } /** * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elemName) throws SAXException { endElement(null, null, elemName); } /** * Send a namespace declaration in the output document. The namespace * declaration will not be include if the namespace is already in scope * with the same prefix. */ public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { startPrefixMapping(prefix,uri,false); } /** * * @see org.xml.sax.ContentHandler#processingInstruction(String, String) * Send a processing instruction to the output document */ public void processingInstruction(String target, String data) throws SAXException { flushPending(); // Pass the processing instruction to the SAX handler m_saxHandler.processingInstruction(target, data); // we don't want to leave serializer to fire off this event, // so do it here. if (m_tracer != null) super.fireEscapingEvent(target, data); } /** * Undeclare the namespace that is currently pointed to by a given * prefix. Inform SAX handler if prefix was previously mapped. */ protected boolean popNamespace(String prefix) { try { if (m_prefixMap.popNamespace(prefix)) { m_saxHandler.endPrefixMapping(prefix); return true; } } catch (SAXException e) { // falls through } return false; } public void startCDATA() throws SAXException { /* m_cdataTagOpen can only be true here if we have ignored the * previous call to this.endCDATA() and the previous call * this.startCDATA() before that is still "open". In this way * we merge adjacent CDATA. If anything else happened after the * ignored call to this.endCDATA() and this call then a call to * flushPending() would have been made which would have * closed the CDATA and set m_cdataTagOpen to false. */ if (!m_cdataTagOpen ) { flushPending(); if (m_lexHandler != null) { m_lexHandler.startCDATA(); // We have made a call to m_lexHandler.startCDATA() with // no balancing call to m_lexHandler.endCDATA() // so we set m_cdataTagOpen true to remember this. m_cdataTagOpen = true; } } } /** * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) */ public void startElement( String namespaceURI, String localName, String name, Attributes atts) throws SAXException { flushPending(); super.startElement(namespaceURI, localName, name, atts); // Handle document type declaration (for first element only) if (m_needToOutputDocTypeDecl) { String doctypeSystem = getDoctypeSystem(); if (doctypeSystem != null && m_lexHandler != null) { String doctypePublic = getDoctypePublic(); if (doctypeSystem != null) m_lexHandler.startDTD( name, doctypePublic, doctypeSystem); } m_needToOutputDocTypeDecl = false; } m_elemContext = m_elemContext.push(namespaceURI, localName, name); // ensurePrefixIsDeclared depends on the current depth, so // the previous increment is necessary where it is. if (namespaceURI != null) ensurePrefixIsDeclared(namespaceURI, name); // add the attributes to the collected ones if (atts != null) addAttributes(atts); // do we really need this CDATA section state? m_elemContext.m_isCdataSection = isCdataSection(); } private void ensurePrefixIsDeclared(String ns, String rawName) throws org.xml.sax.SAXException { if (ns != null && ns.length() > 0) { int index; final boolean no_prefix = ((index = rawName.indexOf(":")) < 0); String prefix = (no_prefix) ? "" : rawName.substring(0, index); if (null != prefix) { String foundURI = m_prefixMap.lookupNamespace(prefix); if ((null == foundURI) || !foundURI.equals(ns)) { this.startPrefixMapping(prefix, ns, false); if (getShouldOutputNSAttr()) { // Bugzilla1133: Generate attribute as well as namespace event. // SAX does expect both. this.addAttributeAlways( "http://www.w3.org/2000/xmlns/", no_prefix ? "xmlns" : prefix, // local name no_prefix ? "xmlns" : ("xmlns:"+ prefix), // qname "CDATA", ns, false); } } } } } /** * Adds the given attribute to the set of attributes, and also makes sure * that the needed prefix/uri mapping is declared, but only if there is a * currently open element. * * @param uri the URI of the attribute * @param localName the local name of the attribute * @param rawName the qualified name of the attribute * @param type the type of the attribute (probably CDATA) * @param value the value of the attribute * @param XSLAttribute true if this attribute is coming from an xsl:attribute element * @see ExtendedContentHandler#addAttribute(String, String, String, String, String) */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException { if (m_elemContext.m_startTagOpen) { ensurePrefixIsDeclared(uri, rawName); addAttributeAlways(uri, localName, rawName, type, value, false); } } /** * Try's to reset the super class and reset this class for * re-use, so that you don't need to create a new serializer * (mostly for performance reasons). * * @return true if the class was successfuly reset. * @see Serializer#reset() */ public boolean reset() { boolean wasReset = false; if (super.reset()) { resetToXMLSAXHandler(); wasReset = true; } return wasReset; } /** * Reset all of the fields owned by ToXMLSAXHandler class * */ private void resetToXMLSAXHandler() { this.m_escapeSetting = true; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/SerializationHandler.java0000644000175000017500000001172110721374030026025 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializationHandler.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import javax.xml.transform.Transformer; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.ext.DeclHandler; /** * This interface is the one that a serializer implements. It is a group of * other interfaces, such as ExtendedContentHandler, ExtendedLexicalHandler etc. * In addition there are other methods, such as reset(). * * This class is public only because it is used in another package, * it is not a public API. * * @xsl.usage internal */ public interface SerializationHandler extends ExtendedContentHandler, ExtendedLexicalHandler, XSLOutputAttributes, DeclHandler, org.xml.sax.DTDHandler, ErrorHandler, DOMSerializer, Serializer { /** * Set the SAX Content handler that the serializer sends its output to. This * method only applies to a ToSAXHandler, not to a ToStream serializer. * * @see Serializer#asContentHandler() * @see ToSAXHandler */ public void setContentHandler(ContentHandler ch); public void close(); /** * Notify that the serializer should take this DOM node as input to be * serialized. * * @param node the DOM node to be serialized. * @throws IOException */ public void serialize(Node node) throws IOException; /** * Turns special character escaping on/off. * * Note that characters will * never, even if this option is set to 'true', be escaped within * CDATA sections in output XML documents. * * @param escape true if escaping is to be set on. */ public boolean setEscaping(boolean escape) throws SAXException; /** * Set the number of spaces to indent for each indentation level. * @param spaces the number of spaces to indent for each indentation level. */ public void setIndentAmount(int spaces); /** * Set the transformer associated with the serializer. * @param transformer the transformer associated with the serializer. */ public void setTransformer(Transformer transformer); /** * Get the transformer associated with the serializer. * @return Transformer the transformer associated with the serializer. */ public Transformer getTransformer(); /** * Used only by TransformerSnapshotImpl to restore the serialization * to a previous state. * * @param mappings NamespaceMappings */ public void setNamespaceMappings(NamespaceMappings mappings); /** * A SerializationHandler accepts SAX-like events, so * it can accumulate attributes or namespace nodes after * a startElement(). *

    * If the SerializationHandler has a Writer or OutputStream, * a call to this method will flush such accumulated * events as a closed start tag for an element. *

    * If the SerializationHandler wraps a ContentHandler, * a call to this method will flush such accumulated * events as a SAX (not SAX-like) calls to * startPrefixMapping() and startElement(). *

    * If one calls endDocument() then one need not call * this method since a call to endDocument() will * do what this method does. However, in some * circumstances, such as with document fragments, * endDocument() is not called and it may be * necessary to call this method to flush * any pending events. *

    * For performance reasons this method should not be called * very often. */ public void flushPending() throws SAXException; /** * Default behavior is to expand DTD entities, * that is the initall default value is true. * @param expand true if DTD entities are to be expanded, * false if they are to be left as DTD entity references. */ public void setDTDEntityExpansion(boolean expand); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/DOM3Serializer.java0000644000175000017500000001517110721374030024451 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.serializer; import java.io.IOException; import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.Node; import org.w3c.dom.ls.LSSerializerFilter; /** * This interface is not intended to be used * by an end user, but rather by an XML parser that is implementing the DOM * Level 3 Load and Save APIs. *

    * * See the DOM Level 3 Load and Save interface at LSSeializer. * * For a list of configuration parameters for DOM Level 3 see DOMConfiguration. * For additional configuration parameters available with the DOM Level 3 Load and Save API LSSerializer see * LSerializer config. *

    * The following example uses a DOM3Serializer indirectly, through an an XML * parser that uses this class as part of its implementation of the DOM Level 3 * Load and Save APIs, and is the prefered way to serialize with DOM Level 3 APIs. *

    * Example: *

     *    public class TestDOM3 {
     *
     *    public static void main(String args[]) throws Exception {
     *        // Get document to serialize
     *        TestDOM3 test = new TestDOM3();
     *        
     *        // Serialize using standard DOM Level 3 Load/Save APIs        
     *        System.out.println(test.testDOM3LS());
     *    }
     *
     *    public org.w3c.dom.Document getDocument() throws Exception {
     *        // Create a simple DOM Document.
     *        javax.xml.parsers.DocumentBuilderFactory factory = 
     *            javax.xml.parsers.DocumentBuilderFactory.newInstance();
     *        javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
     *        byte[] bytes = "".getBytes();
     *        java.io.InputStream is = new java.io.ByteArrayInputStream(bytes);
     *        org.w3c.dom.Document doc = builder.parse(is);
     *        return doc;
     *    }
     *    
     *    //
     *    // This method uses standard DOM Level 3 Load Save APIs:
     *    //   org.w3c.dom.bootstrap.DOMImplementationRegistry
     *    //   org.w3c.dom.ls.DOMImplementationLS
     *    //   org.w3c.dom.ls.DOMImplementationLS
     *    //   org.w3c.dom.ls.LSSerializer
     *    //   org.w3c.dom.DOMConfiguration
     *    //   
     *    // The only thing non-standard in this method is the value set for the
     *    // name of the class implementing the DOM Level 3 Load Save APIs,
     *    // which in this case is:
     *    //   org.apache.xerces.dom.DOMImplementationSourceImpl
     *    //
     *
     *    public String testDOM3LS() throws Exception {
     *        
     *        // Get a simple DOM Document that will be serialized.
     *        org.w3c.dom.Document docToSerialize = getDocument();
     *
     *        // Get a factory (DOMImplementationLS) for creating a Load and Save object.
     *        org.w3c.dom.ls.DOMImplementationLS impl = 
     *            (org.w3c.dom.ls.DOMImplementationLS) 
     *            org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance().getDOMImplementation("LS");
     *
     *        // Use the factory to create an object (LSSerializer) used to 
     *        // write out or save the document.
     *        org.w3c.dom.ls.LSSerializer writer = impl.createLSSerializer();
     *        org.w3c.dom.DOMConfiguration config = writer.getDomConfig();
     *        config.setParameter("format-pretty-print", Boolean.TRUE);
     *        
     *        // Use the LSSerializer to write out or serialize the document to a String.
     *        String serializedXML = writer.writeToString(docToSerialize);
     *        return serializedXML;
     *    }
     *    
     *    }  // end of class TestDOM3
     * 
    * * @see DOMConfiguration * @see LSSerializer * @see org.apache.xml.serializer.Serializer * @see org.apache.xml.serializer.DOMSerializer * * @xsl.usage advanced * */ public interface DOM3Serializer { /** * Serializes the Level 3 DOM node. Throws an exception only if an I/O * exception occured while serializing. * * This interface is a public API. * * @param node the Level 3 DOM node to serialize * @throws IOException if an I/O exception occured while serializing */ public void serializeDOM3(Node node) throws IOException; /** * Sets a DOMErrorHandler on the DOM Level 3 Serializer. * * This interface is a public API. * * @param handler the Level 3 DOMErrorHandler */ public void setErrorHandler(DOMErrorHandler handler); /** * Returns a DOMErrorHandler set on the DOM Level 3 Serializer. * * This interface is a public API. * * @return A Level 3 DOMErrorHandler */ public DOMErrorHandler getErrorHandler(); /** * Sets a LSSerializerFilter on the DOM Level 3 Serializer to filter nodes * during serialization. * * This interface is a public API. * * @param filter the Level 3 LSSerializerFilter */ public void setNodeFilter(LSSerializerFilter filter); /** * Returns a LSSerializerFilter set on the DOM Level 3 Serializer to filter nodes * during serialization. * * This interface is a public API. * * @return The Level 3 LSSerializerFilter */ public LSSerializerFilter getNodeFilter(); /** * Sets the end-of-line sequence of characters to be used during serialization * @param newLine The end-of-line sequence of characters to be used during serialization */ public void setNewLine(char[] newLine); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/EmptySerializer.java0000644000175000017500000005160010721374031025043 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EmptySerializer.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Hashtable; import java.util.Properties; import java.util.Vector; import javax.xml.transform.SourceLocator; import javax.xml.transform.Transformer; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * This class is an adapter class. Its only purpose is to be extended and * for that extended class to over-ride all methods that are to be used. * * This class is not a public API, it is only public because it is used * across package boundaries. * * @xsl.usage internal */ public class EmptySerializer implements SerializationHandler { protected static final String ERR = "EmptySerializer method not over-ridden"; /** * @see SerializationHandler#asContentHandler() */ protected void couldThrowIOException() throws IOException { return; // don't do anything. } protected void couldThrowSAXException() throws SAXException { return; // don't do anything. } protected void couldThrowSAXException(char[] chars, int off, int len) throws SAXException { return; // don't do anything. } protected void couldThrowSAXException(String elemQName) throws SAXException { return; // don't do anything. } protected void couldThrowException() throws Exception { return; // don't do anything. } void aMethodIsCalled() { // throw new RuntimeException(err); return; } /** * @see SerializationHandler#asContentHandler() */ public ContentHandler asContentHandler() throws IOException { couldThrowIOException(); return null; } /** * @see SerializationHandler#setContentHandler(org.xml.sax.ContentHandler) */ public void setContentHandler(ContentHandler ch) { aMethodIsCalled(); } /** * @see SerializationHandler#close() */ public void close() { aMethodIsCalled(); } /** * @see SerializationHandler#getOutputFormat() */ public Properties getOutputFormat() { aMethodIsCalled(); return null; } /** * @see SerializationHandler#getOutputStream() */ public OutputStream getOutputStream() { aMethodIsCalled(); return null; } /** * @see SerializationHandler#getWriter() */ public Writer getWriter() { aMethodIsCalled(); return null; } /** * @see SerializationHandler#reset() */ public boolean reset() { aMethodIsCalled(); return false; } /** * @see SerializationHandler#serialize(org.w3c.dom.Node) */ public void serialize(Node node) throws IOException { couldThrowIOException(); } /** * @see SerializationHandler#setCdataSectionElements(java.util.Vector) */ public void setCdataSectionElements(Vector URI_and_localNames) { aMethodIsCalled(); } /** * @see SerializationHandler#setEscaping(boolean) */ public boolean setEscaping(boolean escape) throws SAXException { couldThrowSAXException(); return false; } /** * @see SerializationHandler#setIndent(boolean) */ public void setIndent(boolean indent) { aMethodIsCalled(); } /** * @see SerializationHandler#setIndentAmount(int) */ public void setIndentAmount(int spaces) { aMethodIsCalled(); } /** * @see SerializationHandler#setOutputFormat(java.util.Properties) */ public void setOutputFormat(Properties format) { aMethodIsCalled(); } /** * @see SerializationHandler#setOutputStream(java.io.OutputStream) */ public void setOutputStream(OutputStream output) { aMethodIsCalled(); } /** * @see SerializationHandler#setVersion(java.lang.String) */ public void setVersion(String version) { aMethodIsCalled(); } /** * @see SerializationHandler#setWriter(java.io.Writer) */ public void setWriter(Writer writer) { aMethodIsCalled(); } /** * @see SerializationHandler#setTransformer(javax.xml.transform.Transformer) */ public void setTransformer(Transformer transformer) { aMethodIsCalled(); } /** * @see SerializationHandler#getTransformer() */ public Transformer getTransformer() { aMethodIsCalled(); return null; } /** * @see SerializationHandler#flushPending() */ public void flushPending() throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#addAttributes(org.xml.sax.Attributes) */ public void addAttributes(Attributes atts) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String) */ public void addAttribute(String name, String value) { aMethodIsCalled(); } /** * @see ExtendedContentHandler#characters(java.lang.String) */ public void characters(String chars) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#endElement(java.lang.String) */ public void endElement(String elemName) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#startDocument() */ public void startDocument() throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String) */ public void startElement(String uri, String localName, String qName) throws SAXException { couldThrowSAXException(qName); } /** * @see ExtendedContentHandler#startElement(java.lang.String) */ public void startElement(String qName) throws SAXException { couldThrowSAXException(qName); } /** * @see ExtendedContentHandler#namespaceAfterStartElement(java.lang.String, java.lang.String) */ public void namespaceAfterStartElement(String uri, String prefix) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#startPrefixMapping(java.lang.String, java.lang.String, boolean) */ public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws SAXException { couldThrowSAXException(); return false; } /** * @see ExtendedContentHandler#entityReference(java.lang.String) */ public void entityReference(String entityName) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#getNamespaceMappings() */ public NamespaceMappings getNamespaceMappings() { aMethodIsCalled(); return null; } /** * @see ExtendedContentHandler#getPrefix(java.lang.String) */ public String getPrefix(String uri) { aMethodIsCalled(); return null; } /** * @see ExtendedContentHandler#getNamespaceURI(java.lang.String, boolean) */ public String getNamespaceURI(String name, boolean isElement) { aMethodIsCalled(); return null; } /** * @see ExtendedContentHandler#getNamespaceURIFromPrefix(java.lang.String) */ public String getNamespaceURIFromPrefix(String prefix) { aMethodIsCalled(); return null; } /** * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) */ public void setDocumentLocator(Locator arg0) { aMethodIsCalled(); } /** * @see org.xml.sax.ContentHandler#endDocument() */ public void endDocument() throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) */ public void startPrefixMapping(String arg0, String arg1) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) */ public void endPrefixMapping(String arg0) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) */ public void startElement( String arg0, String arg1, String arg2, Attributes arg3) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) */ public void endElement(String arg0, String arg1, String arg2) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ public void characters(char[] arg0, int arg1, int arg2) throws SAXException { couldThrowSAXException(arg0, arg1, arg2); } /** * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) */ public void processingInstruction(String arg0, String arg1) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) */ public void skippedEntity(String arg0) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedLexicalHandler#comment(java.lang.String) */ public void comment(String comment) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#startDTD(java.lang.String, java.lang.String, java.lang.String) */ public void startDTD(String arg0, String arg1, String arg2) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#endDTD() */ public void endDTD() throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#startEntity(java.lang.String) */ public void startEntity(String arg0) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#endEntity(java.lang.String) */ public void endEntity(String arg0) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int) */ public void comment(char[] arg0, int arg1, int arg2) throws SAXException { couldThrowSAXException(); } /** * @see XSLOutputAttributes#getDoctypePublic() */ public String getDoctypePublic() { aMethodIsCalled(); return null; } /** * @see XSLOutputAttributes#getDoctypeSystem() */ public String getDoctypeSystem() { aMethodIsCalled(); return null; } /** * @see XSLOutputAttributes#getEncoding() */ public String getEncoding() { aMethodIsCalled(); return null; } /** * @see XSLOutputAttributes#getIndent() */ public boolean getIndent() { aMethodIsCalled(); return false; } /** * @see XSLOutputAttributes#getIndentAmount() */ public int getIndentAmount() { aMethodIsCalled(); return 0; } /** * @see XSLOutputAttributes#getMediaType() */ public String getMediaType() { aMethodIsCalled(); return null; } /** * @see XSLOutputAttributes#getOmitXMLDeclaration() */ public boolean getOmitXMLDeclaration() { aMethodIsCalled(); return false; } /** * @see XSLOutputAttributes#getStandalone() */ public String getStandalone() { aMethodIsCalled(); return null; } /** * @see XSLOutputAttributes#getVersion() */ public String getVersion() { aMethodIsCalled(); return null; } /** * @see XSLOutputAttributes#setCdataSectionElements */ public void setCdataSectionElements(Hashtable h) throws Exception { couldThrowException(); } /** * @see XSLOutputAttributes#setDoctype(java.lang.String, java.lang.String) */ public void setDoctype(String system, String pub) { aMethodIsCalled(); } /** * @see XSLOutputAttributes#setDoctypePublic(java.lang.String) */ public void setDoctypePublic(String doctype) { aMethodIsCalled(); } /** * @see XSLOutputAttributes#setDoctypeSystem(java.lang.String) */ public void setDoctypeSystem(String doctype) { aMethodIsCalled(); } /** * @see XSLOutputAttributes#setEncoding(java.lang.String) */ public void setEncoding(String encoding) { aMethodIsCalled(); } /** * @see XSLOutputAttributes#setMediaType(java.lang.String) */ public void setMediaType(String mediatype) { aMethodIsCalled(); } /** * @see XSLOutputAttributes#setOmitXMLDeclaration(boolean) */ public void setOmitXMLDeclaration(boolean b) { aMethodIsCalled(); } /** * @see XSLOutputAttributes#setStandalone(java.lang.String) */ public void setStandalone(String standalone) { aMethodIsCalled(); } /** * @see org.xml.sax.ext.DeclHandler#elementDecl(java.lang.String, java.lang.String) */ public void elementDecl(String arg0, String arg1) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.DeclHandler#attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void attributeDecl( String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(java.lang.String, java.lang.String) */ public void internalEntityDecl(String arg0, String arg1) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(java.lang.String, java.lang.String, java.lang.String) */ public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) */ public void warning(SAXParseException arg0) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) */ public void error(SAXParseException arg0) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) */ public void fatalError(SAXParseException arg0) throws SAXException { couldThrowSAXException(); } /** * @see Serializer#asDOMSerializer() */ public DOMSerializer asDOMSerializer() throws IOException { couldThrowIOException(); return null; } /** * @see SerializationHandler#setNamespaceMappings(NamespaceMappings) */ public void setNamespaceMappings(NamespaceMappings mappings) { aMethodIsCalled(); } /** * @see ExtendedContentHandler#setSourceLocator(javax.xml.transform.SourceLocator) */ public void setSourceLocator(SourceLocator locator) { aMethodIsCalled(); } /** * @see ExtendedContentHandler#addUniqueAttribute(java.lang.String, java.lang.String, int) */ public void addUniqueAttribute(String name, String value, int flags) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#characters(org.w3c.dom.Node) */ public void characters(Node node) throws SAXException { couldThrowSAXException(); } /** * @see ExtendedContentHandler#addXSLAttribute(java.lang.String, java.lang.String, java.lang.String) */ public void addXSLAttribute(String qName, String value, String uri) { aMethodIsCalled(); } /** * @see ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String) */ public void notationDecl(String arg0, String arg1, String arg2) throws SAXException { couldThrowSAXException(); } /** * @see org.xml.sax.DTDHandler#unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void unparsedEntityDecl( String arg0, String arg1, String arg2, String arg3) throws SAXException { couldThrowSAXException(); } /** * @see SerializationHandler#setDTDEntityExpansion(boolean) */ public void setDTDEntityExpansion(boolean expand) { aMethodIsCalled(); } public String getOutputProperty(String name) { aMethodIsCalled(); return null; } public String getOutputPropertyDefault(String name) { aMethodIsCalled(); return null; } public void setOutputProperty(String name, String val) { aMethodIsCalled(); } public void setOutputPropertyDefault(String name, String val) { aMethodIsCalled(); } /** * @see org.apache.xml.serializer.Serializer#asDOM3Serializer() */ public Object asDOM3Serializer() throws IOException { couldThrowIOException(); return null; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToSAXHandler.java0000644000175000017500000003244510721374032024156 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToSAXHandler.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.util.Vector; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.ext.LexicalHandler; /** * This class is used to provide a base behavior to be inherited * by other To...SAXHandler serializers. * * This class is not a public API. * * @xsl.usage internal */ public abstract class ToSAXHandler extends SerializerBase { public ToSAXHandler() { } public ToSAXHandler( ContentHandler hdlr, LexicalHandler lex, String encoding) { setContentHandler(hdlr); setLexHandler(lex); setEncoding(encoding); } public ToSAXHandler(ContentHandler handler, String encoding) { setContentHandler(handler); setEncoding(encoding); } /** * Underlying SAX handler. Taken from XSLTC */ protected ContentHandler m_saxHandler; /** * Underlying LexicalHandler. Taken from XSLTC */ protected LexicalHandler m_lexHandler; /** * A startPrefixMapping() call on a ToSAXHandler will pass that call * on to the wrapped ContentHandler, but should we also mirror these calls * with matching attributes, if so this field is true. * For example if this field is true then a call such as * startPrefixMapping("prefix1","uri1") will also cause the additional * internally generated attribute xmlns:prefix1="uri1" to be effectively added * to the attributes passed to the wrapped ContentHandler. */ private boolean m_shouldGenerateNSAttribute = true; /** If this is true, then the content handler wrapped by this * serializer implements the TransformState interface which * will give the content handler access to the state of * the transform. */ protected TransformStateSetter m_state = null; /** * Pass callback to the SAX Handler */ protected void startDocumentInternal() throws SAXException { if (m_needToCallStartDocument) { super.startDocumentInternal(); m_saxHandler.startDocument(); m_needToCallStartDocument = false; } } /** * Do nothing. * @see org.xml.sax.ext.LexicalHandler#startDTD(String, String, String) */ public void startDTD(String arg0, String arg1, String arg2) throws SAXException { // do nothing for now } /** * Receive notification of character data. * * @param characters The string of characters to process. * * @throws org.xml.sax.SAXException * * @see ExtendedContentHandler#characters(String) */ public void characters(String characters) throws SAXException { final int len = characters.length(); if (len > m_charsBuff.length) { m_charsBuff = new char[len*2 + 1]; } characters.getChars(0,len, m_charsBuff, 0); characters(m_charsBuff, 0, len); } /** * Receive notification of a comment. * * @see ExtendedLexicalHandler#comment(String) */ public void comment(String comment) throws SAXException { flushPending(); // Ignore if a lexical handler has not been set if (m_lexHandler != null) { final int len = comment.length(); if (len > m_charsBuff.length) { m_charsBuff = new char[len*2 + 1]; } comment.getChars(0,len, m_charsBuff, 0); m_lexHandler.comment(m_charsBuff, 0, len); // time to fire off comment event if (m_tracer != null) super.fireCommentEvent(m_charsBuff, 0, len); } } /** * Do nothing as this is an abstract class. All subclasses will need to * define their behavior if it is different. * @see org.xml.sax.ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { // Redefined in SAXXMLOutput } protected void closeStartTag() throws SAXException { } protected void closeCDATA() throws SAXException { // Redefined in SAXXMLOutput } /** * Receive notification of the beginning of an element, although this is a * SAX method additional namespace or attribute information can occur before * or after this call, that is associated with this element. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.AttributeList * * @throws org.xml.sax.SAXException * * @see org.xml.sax.ContentHandler#startElement(String,String,String,Attributes) */ public void startElement( String arg0, String arg1, String arg2, Attributes arg3) throws SAXException { if (m_state != null) { m_state.resetState(getTransformer()); } // fire off the start element event if (m_tracer != null) super.fireStartElem(arg2); } /** * Sets the LexicalHandler. * @param _lexHandler The LexicalHandler to set */ public void setLexHandler(LexicalHandler _lexHandler) { this.m_lexHandler = _lexHandler; } /** * Sets the SAX ContentHandler. * @param _saxHandler The ContentHandler to set */ public void setContentHandler(ContentHandler _saxHandler) { this.m_saxHandler = _saxHandler; if (m_lexHandler == null && _saxHandler instanceof LexicalHandler) { // we are not overwriting an existing LexicalHandler, and _saxHandler // is also implements LexicalHandler, so lets use it m_lexHandler = (LexicalHandler) _saxHandler; } } /** * Does nothing. The setting of CDATA section elements has an impact on * stream serializers. * @see SerializationHandler#setCdataSectionElements(java.util.Vector) */ public void setCdataSectionElements(Vector URI_and_localNames) { // do nothing } /** Set whether or not namespace declarations (e.g. * xmlns:foo) should appear as attributes of * elements * @param doOutputNSAttr whether or not namespace declarations * should appear as attributes */ public void setShouldOutputNSAttr(boolean doOutputNSAttr) { m_shouldGenerateNSAttribute = doOutputNSAttr; } /** * Returns true if namespace declarations from calls such as * startPrefixMapping("prefix1","uri1") should * also be mirrored with self generated additional attributes of elements * that declare the namespace, for example the attribute xmlns:prefix1="uri1" */ boolean getShouldOutputNSAttr() { return m_shouldGenerateNSAttribute; } /** * This method flushes any pending events, which can be startDocument() * closing the opening tag of an element, or closing an open CDATA section. */ public void flushPending() throws SAXException { if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } if (m_cdataTagOpen) { closeCDATA(); m_cdataTagOpen = false; } } /** * Pass in a reference to a TransformState object, which * can be used during SAX ContentHandler events to obtain * information about he state of the transformation. This * method will be called before each startDocument event. * * @param ts A reference to a TransformState object */ public void setTransformState(TransformStateSetter ts) { this.m_state = ts; } /** * Receives notification that an element starts, but attributes are not * fully known yet. * * @param uri the URI of the namespace of the element (optional) * @param localName the element name, but without prefix (optional) * @param qName the element name, with prefix, if any (required) * * @see ExtendedContentHandler#startElement(String, String, String) */ public void startElement(String uri, String localName, String qName) throws SAXException { if (m_state != null) { m_state.resetState(getTransformer()); } // fire off the start element event if (m_tracer != null) super.fireStartElem(qName); } /** * An element starts, but attributes are not fully known yet. * * @param qName the element name, with prefix (if any). * @see ExtendedContentHandler#startElement(String) */ public void startElement(String qName) throws SAXException { if (m_state != null) { m_state.resetState(getTransformer()); } // fire off the start element event if (m_tracer != null) super.fireStartElem(qName); } /** * This method gets the node's value as a String and uses that String as if * it were an input character notification. * @param node the Node to serialize * @throws org.xml.sax.SAXException */ public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException { // remember the current node if (m_state != null) { m_state.setCurrentNode(node); } // Get the node's value as a String and use that String as if // it were an input character notification. String data = node.getNodeValue(); if (data != null) { this.characters(data); } } /** * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) */ public void fatalError(SAXParseException exc) throws SAXException { super.fatalError(exc); m_needToCallStartDocument = false; if (m_saxHandler instanceof ErrorHandler) { ((ErrorHandler)m_saxHandler).fatalError(exc); } } /** * @see org.xml.sax.ErrorHandler#error(SAXParseException) */ public void error(SAXParseException exc) throws SAXException { super.error(exc); if (m_saxHandler instanceof ErrorHandler) ((ErrorHandler)m_saxHandler).error(exc); } /** * @see org.xml.sax.ErrorHandler#warning(SAXParseException) */ public void warning(SAXParseException exc) throws SAXException { super.warning(exc); if (m_saxHandler instanceof ErrorHandler) ((ErrorHandler)m_saxHandler).warning(exc); } /** * Try's to reset the super class and reset this class for * re-use, so that you don't need to create a new serializer * (mostly for performance reasons). * * @return true if the class was successfuly reset. * @see Serializer#reset() */ public boolean reset() { boolean wasReset = false; if (super.reset()) { resetToSAXHandler(); wasReset = true; } return wasReset; } /** * Reset all of the fields owned by ToSAXHandler class * */ private void resetToSAXHandler() { this.m_lexHandler = null; this.m_saxHandler = null; this.m_state = null; this.m_shouldGenerateNSAttribute = false; } /** * Add a unique attribute */ public void addUniqueAttribute(String qName, String value, int flags) throws SAXException { addAttribute(qName, value); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/SerializerFactory.java0000644000175000017500000001541310721374031025356 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerFactory.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.util.Hashtable; import java.util.Properties; import javax.xml.transform.OutputKeys; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.xml.sax.ContentHandler; /** * This class is a public API, it is a factory for creating serializers. * * The properties object passed to the getSerializer() method should be created by * the OutputPropertiesFactory. Although the properties object * used to create a serializer does not need to be obtained * from OutputPropertiesFactory, * using this factory ensures that the default key/value properties * are set for the given output "method". * *

    * The standard property keys supported are: "method", "version", "encoding", * "omit-xml-declaration", "standalone", doctype-public", * "doctype-system", "cdata-section-elements", "indent", "media-type". * These property keys and their values are described in the XSLT recommendation, * see {@link XSLT 1.0 recommendation} * *

    * The value of the "cdata-section-elements" property key is a whitespace * separated list of elements. If the element is in a namespace then * value is passed in this format: {uri}localName * *

    * The non-standard property keys supported are defined in {@link OutputPropertiesFactory}. * * @see OutputPropertiesFactory * @see Method * @see Serializer */ public final class SerializerFactory { /** * This constructor is private just to prevent the creation of such an object. */ private SerializerFactory() { } /** * Associates output methods to default output formats. */ private static Hashtable m_formats = new Hashtable(); /** * Returns a serializer for the specified output method. The output method * is specified by the value of the property associated with the "method" key. * If no implementation exists that supports the specified output method * an exception of some type will be thrown. * For a list of the output "method" key values see {@link Method}. * * @param format The output format, minimally the "method" property must be set. * @return A suitable serializer. * @throws IllegalArgumentException if method is * null or an appropriate serializer can't be found * @throws Exception if the class for the serializer is found but does not * implement ContentHandler. * @throws WrappedRuntimeException if an exception is thrown while trying to find serializer */ public static Serializer getSerializer(Properties format) { Serializer ser; try { String method = format.getProperty(OutputKeys.METHOD); if (method == null) { String msg = Utils.messages.createMessage( MsgKey.ER_FACTORY_PROPERTY_MISSING, new Object[] { OutputKeys.METHOD}); throw new IllegalArgumentException(msg); } String className = format.getProperty(OutputPropertiesFactory.S_KEY_CONTENT_HANDLER); if (null == className) { // Missing Content Handler property, load default using OutputPropertiesFactory Properties methodDefaults = OutputPropertiesFactory.getDefaultMethodProperties(method); className = methodDefaults.getProperty(OutputPropertiesFactory.S_KEY_CONTENT_HANDLER); if (null == className) { String msg = Utils.messages.createMessage( MsgKey.ER_FACTORY_PROPERTY_MISSING, new Object[] { OutputPropertiesFactory.S_KEY_CONTENT_HANDLER}); throw new IllegalArgumentException(msg); } } ClassLoader loader = ObjectFactory.findClassLoader(); Class cls = ObjectFactory.findProviderClass(className, loader, true); // _serializers.put(method, cls); Object obj = cls.newInstance(); if (obj instanceof SerializationHandler) { // this is one of the supplied serializers ser = (Serializer) cls.newInstance(); ser.setOutputFormat(format); } else { /* * This must be a user defined Serializer. * It had better implement ContentHandler. */ if (obj instanceof ContentHandler) { /* * The user defined serializer defines ContentHandler, * but we need to wrap it with ToXMLSAXHandler which * will collect SAX-like events and emit true * SAX ContentHandler events to the users handler. */ className = SerializerConstants.DEFAULT_SAX_SERIALIZER; cls = ObjectFactory.findProviderClass(className, loader, true); SerializationHandler sh = (SerializationHandler) cls.newInstance(); sh.setContentHandler( (ContentHandler) obj); sh.setOutputFormat(format); ser = sh; } else { // user defined serializer does not implement // ContentHandler, ... very bad throw new Exception( Utils.messages.createMessage( MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, new Object[] { className})); } } } catch (Exception e) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(e); } // If we make it to here ser is not null. return ser; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/SecuritySupport12.java0000644000175000017500000001171610721374030025265 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/WriterToUTF8Buffered.java0000644000175000017500000004077510721374033025621 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WriterToUTF8Buffered.java 469356 2006-10-31 03:20:34Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.io.Writer; /** * This class writes unicode characters to a byte stream (java.io.OutputStream) * as quickly as possible. It buffers the output in an internal * buffer which must be flushed to the OutputStream when done. This flushing * is done via the close() flush() or flushBuffer() method. * * This class is only used internally within Xalan. * * @xsl.usage internal */ final class WriterToUTF8Buffered extends Writer implements WriterChain { /** number of bytes that the byte buffer can hold. * This is a fixed constant is used rather than m_outputBytes.lenght for performance. */ private static final int BYTES_MAX=16*1024; /** number of characters that the character buffer can hold. * This is 1/3 of the number of bytes because UTF-8 encoding * can expand one unicode character by up to 3 bytes. */ private static final int CHARS_MAX=(BYTES_MAX/3); // private static final int /** The byte stream to write to. (sc & sb remove final to compile in JDK 1.1.8) */ private final OutputStream m_os; /** * The internal buffer where data is stored. * (sc & sb remove final to compile in JDK 1.1.8) */ private final byte m_outputBytes[]; private final char m_inputChars[]; /** * The number of valid bytes in the buffer. This value is always * in the range 0 through m_outputBytes.length; elements * m_outputBytes[0] through m_outputBytes[count-1] contain valid * byte data. */ private int count; /** * Create an buffered UTF-8 writer. * * * @param out the underlying output stream. * * @throws UnsupportedEncodingException */ public WriterToUTF8Buffered(OutputStream out) { m_os = out; // get 3 extra bytes to make buffer overflow checking simpler and faster // we won't have to keep checking for a few extra characters m_outputBytes = new byte[BYTES_MAX + 3]; // Big enough to hold the input chars that will be transformed // into output bytes in m_ouputBytes. m_inputChars = new char[CHARS_MAX + 2]; count = 0; // the old body of this constructor, before the buffersize was changed to a constant // this(out, 8*1024); } /** * Create an buffered UTF-8 writer to write data to the * specified underlying output stream with the specified buffer * size. * * @param out the underlying output stream. * @param size the buffer size. * @exception IllegalArgumentException if size <= 0. */ // public WriterToUTF8Buffered(final OutputStream out, final int size) // { // // m_os = out; // // if (size <= 0) // { // throw new IllegalArgumentException( // SerializerMessages.createMessage(SerializerErrorResources.ER_BUFFER_SIZE_LESSTHAN_ZERO, null)); //"Buffer size <= 0"); // } // // m_outputBytes = new byte[size]; // count = 0; // } /** * Write a single character. The character to be written is contained in * the 16 low-order bits of the given integer value; the 16 high-order bits * are ignored. * *

    Subclasses that intend to support efficient single-character output * should override this method. * * @param c int specifying a character to be written. * @exception IOException If an I/O error occurs */ public void write(final int c) throws IOException { /* If we are close to the end of the buffer then flush it. * Remember the buffer can hold a few more bytes than BYTES_MAX */ if (count >= BYTES_MAX) flushBuffer(); if (c < 0x80) { m_outputBytes[count++] = (byte) (c); } else if (c < 0x800) { m_outputBytes[count++] = (byte) (0xc0 + (c >> 6)); m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f)); } else if (c < 0x10000) { m_outputBytes[count++] = (byte) (0xe0 + (c >> 12)); m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f)); m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f)); } else { m_outputBytes[count++] = (byte) (0xf0 + (c >> 18)); m_outputBytes[count++] = (byte) (0x80 + ((c >> 12) & 0x3f)); m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f)); m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f)); } } /** * Write a portion of an array of characters. * * @param chars Array of characters * @param start Offset from which to start writing characters * @param length Number of characters to write * * @exception IOException If an I/O error occurs * * @throws java.io.IOException */ public void write(final char chars[], final int start, final int length) throws java.io.IOException { // We multiply the length by three since this is the maximum length // of the characters that we can put into the buffer. It is possible // for each Unicode character to expand to three bytes. int lengthx3 = 3*length; if (lengthx3 >= BYTES_MAX - count) { // The requested length is greater than the unused part of the buffer flushBuffer(); if (lengthx3 > BYTES_MAX) { /* * The requested length exceeds the size of the buffer. * Cut the buffer up into chunks, each of which will * not cause an overflow to the output buffer m_outputBytes, * and make multiple recursive calls. * Be careful about integer overflows in multiplication. */ int split = length/CHARS_MAX; final int chunks; if (length % CHARS_MAX > 0) chunks = split + 1; else chunks = split; int end_chunk = start; for (int chunk = 1; chunk <= chunks; chunk++) { int start_chunk = end_chunk; end_chunk = start + (int) ((((long) length) * chunk) / chunks); // Adjust the end of the chunk if it ends on a high char // of a Unicode surrogate pair and low char of the pair // is not going to be in the same chunk final char c = chars[end_chunk - 1]; int ic = chars[end_chunk - 1]; if (c >= 0xD800 && c <= 0xDBFF) { // The last Java char that we were going // to process is the first of a // Java surrogate char pair that // represent a Unicode character. if (end_chunk < start + length) { // Avoid spanning by including the low // char in the current chunk of chars. end_chunk++; } else { /* This is the last char of the last chunk, * and it is the high char of a high/low pair with * no low char provided. * TODO: error message needed. * The char array incorrectly ends in a high char * of a high/low surrogate pair, but there is * no corresponding low as the high is the last char */ end_chunk--; } } int len_chunk = (end_chunk - start_chunk); this.write(chars,start_chunk, len_chunk); } return; } } final int n = length+start; final byte[] buf_loc = m_outputBytes; // local reference for faster access int count_loc = count; // local integer for faster access int i = start; { /* This block could be omitted and the code would produce * the same result. But this block exists to give the JIT * a better chance of optimizing a tight and common loop which * occurs when writing out ASCII characters. */ char c; for(; i < n && (c = chars[i])< 0x80 ; i++ ) buf_loc[count_loc++] = (byte)c; } for (; i < n; i++) { final char c = chars[i]; if (c < 0x80) buf_loc[count_loc++] = (byte) (c); else if (c < 0x800) { buf_loc[count_loc++] = (byte) (0xc0 + (c >> 6)); buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f)); } /** * The following else if condition is added to support XML 1.1 Characters for * UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* * Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) * [1101 11yy] [yyxx xxxx] (low surrogate) * * uuuuu = wwww + 1 */ else if (c >= 0xD800 && c <= 0xDBFF) { char high, low; high = c; i++; low = chars[i]; buf_loc[count_loc++] = (byte) (0xF0 | (((high + 0x40) >> 8) & 0xf0)); buf_loc[count_loc++] = (byte) (0x80 | (((high + 0x40) >> 2) & 0x3f)); buf_loc[count_loc++] = (byte) (0x80 | ((low >> 6) & 0x0f) + ((high << 4) & 0x30)); buf_loc[count_loc++] = (byte) (0x80 | (low & 0x3f)); } else { buf_loc[count_loc++] = (byte) (0xe0 + (c >> 12)); buf_loc[count_loc++] = (byte) (0x80 + ((c >> 6) & 0x3f)); buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f)); } } // Store the local integer back into the instance variable count = count_loc; } /** * Write a string. * * @param s String to be written * * @exception IOException If an I/O error occurs */ public void write(final String s) throws IOException { // We multiply the length by three since this is the maximum length // of the characters that we can put into the buffer. It is possible // for each Unicode character to expand to three bytes. final int length = s.length(); int lengthx3 = 3*length; if (lengthx3 >= BYTES_MAX - count) { // The requested length is greater than the unused part of the buffer flushBuffer(); if (lengthx3 > BYTES_MAX) { /* * The requested length exceeds the size of the buffer, * so break it up in chunks that don't exceed the buffer size. */ final int start = 0; int split = length/CHARS_MAX; final int chunks; if (length % CHARS_MAX > 0) chunks = split + 1; else chunks = split; int end_chunk = 0; for (int chunk = 1; chunk <= chunks; chunk++) { int start_chunk = end_chunk; end_chunk = start + (int) ((((long) length) * chunk) / chunks); s.getChars(start_chunk,end_chunk, m_inputChars,0); int len_chunk = (end_chunk - start_chunk); // Adjust the end of the chunk if it ends on a high char // of a Unicode surrogate pair and low char of the pair // is not going to be in the same chunk final char c = m_inputChars[len_chunk - 1]; if (c >= 0xD800 && c <= 0xDBFF) { // Exclude char in this chunk, // to avoid spanning a Unicode character // that is in two Java chars as a high/low surrogate end_chunk--; len_chunk--; if (chunk == chunks) { /* TODO: error message needed. * The String incorrectly ends in a high char * of a high/low surrogate pair, but there is * no corresponding low as the high is the last char * Recover by ignoring this last char. */ } } this.write(m_inputChars,0, len_chunk); } return; } } s.getChars(0, length , m_inputChars, 0); final char[] chars = m_inputChars; final int n = length; final byte[] buf_loc = m_outputBytes; // local reference for faster access int count_loc = count; // local integer for faster access int i = 0; { /* This block could be omitted and the code would produce * the same result. But this block exists to give the JIT * a better chance of optimizing a tight and common loop which * occurs when writing out ASCII characters. */ char c; for(; i < n && (c = chars[i])< 0x80 ; i++ ) buf_loc[count_loc++] = (byte)c; } for (; i < n; i++) { final char c = chars[i]; if (c < 0x80) buf_loc[count_loc++] = (byte) (c); else if (c < 0x800) { buf_loc[count_loc++] = (byte) (0xc0 + (c >> 6)); buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f)); } /** * The following else if condition is added to support XML 1.1 Characters for * UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* * Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) * [1101 11yy] [yyxx xxxx] (low surrogate) * * uuuuu = wwww + 1 */ else if (c >= 0xD800 && c <= 0xDBFF) { char high, low; high = c; i++; low = chars[i]; buf_loc[count_loc++] = (byte) (0xF0 | (((high + 0x40) >> 8) & 0xf0)); buf_loc[count_loc++] = (byte) (0x80 | (((high + 0x40) >> 2) & 0x3f)); buf_loc[count_loc++] = (byte) (0x80 | ((low >> 6) & 0x0f) + ((high << 4) & 0x30)); buf_loc[count_loc++] = (byte) (0x80 | (low & 0x3f)); } else { buf_loc[count_loc++] = (byte) (0xe0 + (c >> 12)); buf_loc[count_loc++] = (byte) (0x80 + ((c >> 6) & 0x3f)); buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f)); } } // Store the local integer back into the instance variable count = count_loc; } /** * Flush the internal buffer * * @throws IOException */ public void flushBuffer() throws IOException { if (count > 0) { m_os.write(m_outputBytes, 0, count); count = 0; } } /** * Flush the stream. If the stream has saved any characters from the * various write() methods in a buffer, write them immediately to their * intended destination. Then, if that destination is another character or * byte stream, flush it. Thus one flush() invocation will flush all the * buffers in a chain of Writers and OutputStreams. * * @exception IOException If an I/O error occurs * * @throws java.io.IOException */ public void flush() throws java.io.IOException { flushBuffer(); m_os.flush(); } /** * Close the stream, flushing it first. Once a stream has been closed, * further write() or flush() invocations will cause an IOException to be * thrown. Closing a previously-closed stream, however, has no effect. * * @exception IOException If an I/O error occurs * * @throws java.io.IOException */ public void close() throws java.io.IOException { flushBuffer(); m_os.close(); } /** * Get the output stream where the events will be serialized to. * * @return reference to the result stream, or null of only a writer was * set. */ public OutputStream getOutputStream() { return m_os; } public Writer getWriter() { // Only one of getWriter() or getOutputStream() can return null // This type of writer wraps an OutputStream, not a Writer. return null; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/Method.java0000644000175000017500000000461710721374032023142 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Method.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; /** * This class defines the constants which are the names of the four default * output methods. *

    * The default output methods defined are: *

      *
    • XML *
    • TEXT *
    • HTML *
    * These constants can be used as an argument to the * OutputPropertiesFactory.getDefaultMethodProperties() method to get * the properties to create a serializer. * * This class is a public API. * * @see OutputPropertiesFactory * @see Serializer * * @xsl.usage general */ public final class Method { /** * A private constructor to prevent the creation of such a class. */ private Method() { } /** * The output method type for XML documents: xml. */ public static final String XML = "xml"; /** * The output method type for HTML documents: html. */ public static final String HTML = "html"; /** * The output method for XHTML documents: xhtml. *

    * This method type is not currently supported. */ public static final String XHTML = "xhtml"; /** * The output method type for text documents: text. */ public static final String TEXT = "text"; /** * The "internal" method, just used when no method is * specified in the style sheet, and a serializer of this type wraps either an * XML or HTML type (depending on the first tag in the output being html or * not) */ public static final String UNKNOWN = ""; } libxalan2-java-2.7.1/src/org/apache/xml/serializer/output_xml.properties0000644000175000017500000000351010721374031025403 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: output_xml.properties 468654 2006-10-28 07:09:23Z minchau $ # # Specify defaults when method="xml". These defaults serve as a base for # other defaults, such as output_html and output_text. # # XSLT properties do not need namespace qualification. method=xml version=1.0 encoding=UTF-8 indent=no omit-xml-declaration=no standalone=no media-type=text/xml # Xalan-specific output properties. These can be overridden in the stylesheet # assigning a xalan namespace. For example: # # # ... # Note that the colon after the protocol needs to be escaped. {http\u003a//xml.apache.org/xalan}indent-amount=0 {http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToXMLStream {http\u003a//xml.apache.org/xalan}entities=org/apache/xml/serializer/XMLEntities libxalan2-java-2.7.1/src/org/apache/xml/serializer/output_text.properties0000644000175000017500000000303210721374031025566 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: output_text.properties 468654 2006-10-28 07:09:23Z minchau $ # # Specify defaults when method="text". # # XSLT properties do not need namespace qualification. method=text media-type=text/plain # Xalan-specific output properties. These can be overridden in the stylesheet # assigning a xalan namespace. For example: # # # ... # Note that the colon after the protocol needs to be escaped. {http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToTextStream libxalan2-java-2.7.1/src/org/apache/xml/serializer/output_unknown.properties0000644000175000017500000000342710721374033026313 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: output_unknown.properties 468654 2006-10-28 07:09:23Z minchau $ # # Specify defaults when no method="..." is specified. # This type of output will quickly switch to "xml" or "html" # depending on the first element name. # # XSLT properties do not need namespace qualification. method=xml version=1.0 encoding=UTF-8 indent=no omit-xml-declaration=no standalone=no media-type=text/xml # Xalan-specific output properties. These can be overridden in the stylesheet # assigning a xalan namespace. For example: # # # ... # Note that the colon after the protocol needs to be escaped. {http\u003a//xml.apache.org/xalan}indent-amount=0 {http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToUnknownStream libxalan2-java-2.7.1/src/org/apache/xml/serializer/NamespaceMappings.java0000644000175000017500000004133110721374031025306 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NamespaceMappings.java 469648 2006-10-31 20:52:27Z minchau $ */ package org.apache.xml.serializer; import java.util.Enumeration; import java.util.Hashtable; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * This class keeps track of the currently defined namespaces. Conceptually the * prefix/uri/depth triplets are pushed on a stack pushed on a stack. The depth * indicates the nesting depth of the element for which the mapping was made. * *

    For example: *

     * 
     *   
     *      
     *      
     *    
     *    
     *    
     * 
     * 
    * * When the element is encounted the prefix "p1" associated with uri * "def" is pushed on the stack with depth 1. * When the first is encountered "p2" and "ghi" are pushed with * depth 2. * When the is encountered "p3" and "jkl" are pushed with depth 3. * When occurs the popNamespaces(3) will pop "p3"/"jkl" off the * stack. Of course popNamespaces(2) would pop anything with depth 2 or * greater. * * So prefix/uri pairs are pushed and poped off the stack as elements are * processed. At any given moment of processing the currently visible prefixes * are on the stack and a prefix can be found given a uri, or a uri can be found * given a prefix. * * This class is intended for internal use only. However, it is made public because * other packages require it. * @xsl.usage internal */ public class NamespaceMappings { /** * This member is continually incremented when new prefixes need to be * generated. ("ns0" "ns1" ...) */ private int count = 0; /** * Each entry (prefix) in this hashtable points to a Stack of URIs * This table maps a prefix (String) to a Stack of NamespaceNodes. * All Namespace nodes in that retrieved stack have the same prefix, * though possibly different URI's or depths. Such a stack must have * mappings at deeper depths push later on such a stack. Mappings pushed * earlier on the stack will have smaller values for MappingRecord.m_declarationDepth. */ private Hashtable m_namespaces = new Hashtable(); /** * This stack is used as a convenience. * It contains the pushed NamespaceNodes (shallowest * to deepest) and is used to delete NamespaceNodes * when leaving the current element depth * to returning to the parent. The mappings of the deepest * depth can be popped of the top and the same node * can be removed from the appropriate prefix stack. * * All prefixes pushed at the current depth can be * removed at the same time by using this stack to * ensure prefix/uri map scopes are closed correctly. */ private Stack m_nodeStack = new Stack(); private static final String EMPTYSTRING = ""; private static final String XML_PREFIX = "xml"; // was "xmlns" /** * Default constructor * @see java.lang.Object#Object() */ public NamespaceMappings() { initNamespaces(); } /** * This method initializes the namespace object with appropriate stacks * and predefines a few prefix/uri pairs which always exist. */ private void initNamespaces() { // The initial prefix mappings will never be deleted because they are at element depth -1 // (a kludge) // Define the default namespace (initially maps to "" uri) Stack stack; MappingRecord nn; nn = new MappingRecord(EMPTYSTRING, EMPTYSTRING, -1); stack = createPrefixStack(EMPTYSTRING); stack.push(nn); // define "xml" namespace nn = new MappingRecord(XML_PREFIX, "http://www.w3.org/XML/1998/namespace", -1); stack = createPrefixStack(XML_PREFIX); stack.push(nn); } /** * Use a namespace prefix to lookup a namespace URI. * * @param prefix String the prefix of the namespace * @return the URI corresponding to the prefix, returns "" * if there is no visible mapping. */ public String lookupNamespace(String prefix) { String uri = null; final Stack stack = getPrefixStack(prefix); if (stack != null && !stack.isEmpty()) { uri = ((MappingRecord) stack.peek()).m_uri; } if (uri == null) uri = EMPTYSTRING; return uri; } MappingRecord getMappingFromPrefix(String prefix) { final Stack stack = (Stack) m_namespaces.get(prefix); return stack != null && !stack.isEmpty() ? ((MappingRecord) stack.peek()) : null; } /** * Given a namespace uri, and the namespaces mappings for the * current element, return the current prefix for that uri. * * @param uri the namespace URI to be search for * @return an existing prefix that maps to the given URI, null if no prefix * maps to the given namespace URI. */ public String lookupPrefix(String uri) { String foundPrefix = null; Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefix = prefix; break; } } return foundPrefix; } MappingRecord getMappingFromURI(String uri) { MappingRecord foundMap = null; Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); MappingRecord map2 = getMappingFromPrefix(prefix); if (map2 != null && (map2.m_uri).equals(uri)) { foundMap = map2; break; } } return foundMap; } /** * Undeclare the namespace that is currently pointed to by a given prefix */ boolean popNamespace(String prefix) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; if ((stack = getPrefixStack(prefix)) != null) { stack.pop(); return true; } return false; } /** * Declare a mapping of a prefix to namespace URI at the given element depth. * @param prefix a String with the prefix for a qualified name * @param uri a String with the uri to which the prefix is to map * @param elemDepth the depth of current declaration */ public boolean pushNamespace(String prefix, String uri, int elemDepth) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; // Get the stack that contains URIs for the specified prefix if ((stack = (Stack) m_namespaces.get(prefix)) == null) { m_namespaces.put(prefix, stack = new Stack()); } if (!stack.empty()) { MappingRecord mr = (MappingRecord)stack.peek(); if (uri.equals(mr.m_uri) || elemDepth == mr.m_declarationDepth) { // If the same prefix/uri mapping is already on the stack // don't push this one. // Or if we have a mapping at the same depth // don't replace by pushing this one. return false; } } MappingRecord map = new MappingRecord(prefix,uri,elemDepth); stack.push(map); m_nodeStack.push(map); return true; } /** * Pop, or undeclare all namespace definitions that are currently * declared at the given element depth, or deepter. * @param elemDepth the element depth for which mappings declared at this * depth or deeper will no longer be valid * @param saxHandler The ContentHandler to notify of any endPrefixMapping() * calls. This parameter can be null. */ void popNamespaces(int elemDepth, ContentHandler saxHandler) { while (true) { if (m_nodeStack.isEmpty()) return; MappingRecord map = (MappingRecord) (m_nodeStack.peek()); int depth = map.m_declarationDepth; if (elemDepth < 1 || map.m_declarationDepth < elemDepth) break; /* the depth of the declared mapping is elemDepth or deeper * so get rid of it */ MappingRecord nm1 = (MappingRecord) m_nodeStack.pop(); // pop the node from the stack String prefix = map.m_prefix; Stack prefixStack = getPrefixStack(prefix); MappingRecord nm2 = (MappingRecord) prefixStack.peek(); if (nm1 == nm2) { // It would be nice to always pop() but we // need to check that the prefix stack still has // the node we want to get rid of. This is because // the optimization of essentially this situation: // // will remove both mappings in because the // new mapping is the same as the masked one and we get // // So we are only removing xmlns:x="" or // xmlns:x="abc" from the depth of element // when going back to if in fact they have // not been optimized away. // prefixStack.pop(); if (saxHandler != null) { try { saxHandler.endPrefixMapping(prefix); } catch (SAXException e) { // not much we can do if they aren't willing to listen } } } } } /** * Generate a new namespace prefix ( ns0, ns1 ...) not used before * @return String a new namespace prefix ( ns0, ns1, ns2 ...) */ public String generateNextPrefix() { return "ns" + (count++); } /** * This method makes a clone of this object. * */ public Object clone() throws CloneNotSupportedException { NamespaceMappings clone = new NamespaceMappings(); clone.m_nodeStack = (NamespaceMappings.Stack) m_nodeStack.clone(); clone.count = this.count; clone.m_namespaces = (Hashtable) m_namespaces.clone(); clone.count = count; return clone; } final void reset() { this.count = 0; this.m_namespaces.clear(); this.m_nodeStack.clear(); initNamespaces(); } /** * Just a little class that ties the 3 fields together * into one object, and this simplifies the pushing * and popping of namespaces to one push or one pop on * one stack rather than on 3 separate stacks. */ class MappingRecord { final String m_prefix; // the prefix final String m_uri; // the uri, possibly "" but never null // the depth of the element where declartion was made final int m_declarationDepth; MappingRecord(String prefix, String uri, int depth) { m_prefix = prefix; m_uri = (uri==null)? EMPTYSTRING : uri; m_declarationDepth = depth; } } /** * Rather than using java.util.Stack, this private class * provides a minimal subset of methods and is faster * because it is not thread-safe. */ private class Stack { private int top = -1; private int max = 20; Object[] m_stack = new Object[max]; public Object clone() throws CloneNotSupportedException { NamespaceMappings.Stack clone = new NamespaceMappings.Stack(); clone.max = this.max; clone.top = this.top; clone.m_stack = new Object[clone.max]; for (int i=0; i <= top; i++) { // We are just copying references to immutable MappingRecord objects here // so it is OK if the clone has references to these. clone.m_stack[i] = this.m_stack[i]; } return clone; } public Stack() { } public Object push(Object o) { top++; if (max <= top) { int newMax = 2*max + 1; Object[] newArray = new Object[newMax]; System.arraycopy(m_stack,0, newArray, 0, max); max = newMax; m_stack = newArray; } m_stack[top] = o; return o; } public Object pop() { Object o; if (0 <= top) { o = m_stack[top]; // m_stack[top] = null; do we really care? top--; } else o = null; return o; } public Object peek() { Object o; if (0 <= top) { o = m_stack[top]; } else o = null; return o; } public Object peek(int idx) { return m_stack[idx]; } public boolean isEmpty() { return (top < 0); } public boolean empty() { return (top < 0); } public void clear() { for (int i=0; i<= top; i++) m_stack[i] = null; top = -1; } public Object getElement(int index) { return m_stack[index]; } } /** * A more type-safe way to get a stack of prefix mappings * from the Hashtable m_namespaces * (this is the only method that does the type cast). */ private Stack getPrefixStack(String prefix) { Stack fs = (Stack) m_namespaces.get(prefix); return fs; } /** * A more type-safe way of saving stacks under the * m_namespaces Hashtable. */ private Stack createPrefixStack(String prefix) { Stack fs = new Stack(); m_namespaces.put(prefix, fs); return fs; } /** * Given a namespace uri, get all prefixes bound to the Namespace URI in the current scope. * * @param uri the namespace URI to be search for * @return An array of Strings which are * all prefixes bound to the namespace URI in the current scope. * An array of zero elements is returned if no prefixes map to the given * namespace URI. */ public String[] lookupAllPrefixes(String uri) { java.util.ArrayList foundPrefixes = new java.util.ArrayList(); Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefixes.add(prefix); } } String[] prefixArray = new String[foundPrefixes.size()]; foundPrefixes.toArray(prefixArray); return prefixArray; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToXMLStream.java0000644000175000017500000005410010721374032024031 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToXMLStream.java 469359 2006-10-31 03:43:19Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import javax.xml.transform.ErrorListener; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.xml.sax.SAXException; /** * This class converts SAX or SAX-like calls to a * serialized xml document. The xsl:output method is "xml". * * This class is used explicitly in code generated by XSLTC, * so it is "public", but it should * be viewed as internal or package private, this is not an API. * * @xsl.usage internal */ public class ToXMLStream extends ToStream { /** * Map that tells which XML characters should have special treatment, and it * provides character to entity name lookup. */ private CharInfo m_xmlcharInfo = CharInfo.getCharInfo(CharInfo.XML_ENTITIES_RESOURCE, Method.XML); /** * Default constructor. */ public ToXMLStream() { m_charInfo = m_xmlcharInfo; initCDATA(); // initialize namespaces m_prefixMap = new NamespaceMappings(); } /** * Copy properties from another SerializerToXML. * * @param xmlListener non-null reference to a SerializerToXML object. */ public void CopyFrom(ToXMLStream xmlListener) { setWriter(xmlListener.m_writer); // m_outputStream = xmlListener.m_outputStream; String encoding = xmlListener.getEncoding(); setEncoding(encoding); setOmitXMLDeclaration(xmlListener.getOmitXMLDeclaration()); m_ispreserve = xmlListener.m_ispreserve; m_preserves = xmlListener.m_preserves; m_isprevtext = xmlListener.m_isprevtext; m_doIndent = xmlListener.m_doIndent; setIndentAmount(xmlListener.getIndentAmount()); m_startNewLine = xmlListener.m_startNewLine; m_needToOutputDocTypeDecl = xmlListener.m_needToOutputDocTypeDecl; setDoctypeSystem(xmlListener.getDoctypeSystem()); setDoctypePublic(xmlListener.getDoctypePublic()); setStandalone(xmlListener.getStandalone()); setMediaType(xmlListener.getMediaType()); m_encodingInfo = xmlListener.m_encodingInfo; m_spaceBeforeClose = xmlListener.m_spaceBeforeClose; m_cdataStartCalled = xmlListener.m_cdataStartCalled; } /** * Receive notification of the beginning of a document. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void startDocumentInternal() throws org.xml.sax.SAXException { if (m_needToCallStartDocument) { super.startDocumentInternal(); m_needToCallStartDocument = false; if (m_inEntityRef) return; m_needToOutputDocTypeDecl = true; m_startNewLine = false; /* The call to getXMLVersion() might emit an error message * and we should emit this message regardless of if we are * writing out an XML header or not. */ final String version = getXMLVersion(); if (getOmitXMLDeclaration() == false) { String encoding = Encodings.getMimeEncoding(getEncoding()); String standalone; if (m_standaloneWasSpecified) { standalone = " standalone=\"" + getStandalone() + "\""; } else { standalone = ""; } try { final java.io.Writer writer = m_writer; writer.write(""); if (m_doIndent) { if (m_standaloneWasSpecified || getDoctypePublic() != null || getDoctypeSystem() != null) { // We almost never put a newline after the XML // header because this XML could be used as // an extenal general parsed entity // and we don't know the context into which it // will be used in the future. Only when // standalone, or a doctype system or public is // specified are we free to insert a new line // after the header. Is it even worth bothering // in these rare cases? writer.write(m_lineSep, 0, m_lineSepLen); } } } catch(IOException e) { throw new SAXException(e); } } } } /** * Receive notification of the end of a document. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void endDocument() throws org.xml.sax.SAXException { flushPending(); if (m_doIndent && !m_isprevtext) { try { outputLineSep(); } catch(IOException e) { throw new SAXException(e); } } flushWriter(); if (m_tracer != null) super.fireEndDoc(); } /** * Starts a whitespace preserving section. All characters printed * within a preserving section are printed without indentation and * without consolidating multiple spaces. This is equivalent to * the xml:space="preserve" attribute. Only XML * and HTML serializers need to support this method. *

    * The contents of the whitespace preserving section will be delivered * through the regular characters event. * * @throws org.xml.sax.SAXException */ public void startPreserving() throws org.xml.sax.SAXException { // Not sure this is really what we want. -sb m_preserves.push(true); m_ispreserve = true; } /** * Ends a whitespace preserving section. * * @see #startPreserving * * @throws org.xml.sax.SAXException */ public void endPreserving() throws org.xml.sax.SAXException { // Not sure this is really what we want. -sb m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop(); } /** * Receive notification of a processing instruction. * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { if (m_inEntityRef) return; flushPending(); if (target.equals(Result.PI_DISABLE_OUTPUT_ESCAPING)) { startNonEscaping(); } else if (target.equals(Result.PI_ENABLE_OUTPUT_ESCAPING)) { endNonEscaping(); } else { try { if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } else if (m_needToCallStartDocument) startDocumentInternal(); if (shouldIndent()) indent(); final java.io.Writer writer = m_writer; writer.write(" 0 && !Character.isSpaceChar(data.charAt(0))) writer.write(' '); int indexOfQLT = data.indexOf("?>"); if (indexOfQLT >= 0) { // See XSLT spec on error recovery of "?>" in PIs. if (indexOfQLT > 0) { writer.write(data.substring(0, indexOfQLT)); } writer.write("? >"); // add space between. if ((indexOfQLT + 2) < data.length()) { writer.write(data.substring(indexOfQLT + 2)); } } else { writer.write(data); } writer.write('?'); writer.write('>'); /* * Don't write out any indentation whitespace now, * because there may be non-whitespace text after this. * * Simply mark that at this point if we do decide * to indent that we should * add a newline on the end of the current line before * the indentation at the start of the next line. */ m_startNewLine = true; } catch(IOException e) { throw new SAXException(e); } } if (m_tracer != null) super.fireEscapingEvent(target, data); } /** * Receive notivication of a entityReference. * * @param name The name of the entity. * * @throws org.xml.sax.SAXException */ public void entityReference(String name) throws org.xml.sax.SAXException { if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } try { if (shouldIndent()) indent(); final java.io.Writer writer = m_writer; writer.write('&'); writer.write(name); writer.write(';'); } catch(IOException e) { throw new SAXException(e); } if (m_tracer != null) super.fireEntityReference(name); } /** * This method is used to add an attribute to the currently open element. * The caller has guaranted that this attribute is unique, which means that it * not been seen before and will not be seen again. * * @param name the qualified name of the attribute * @param value the value of the attribute which can contain only * ASCII printable characters characters in the range 32 to 127 inclusive. * @param flags the bit values of this integer give optimization information. */ public void addUniqueAttribute(String name, String value, int flags) throws SAXException { if (m_elemContext.m_startTagOpen) { try { final String patchedName = patchName(name); final java.io.Writer writer = m_writer; if ((flags & NO_BAD_CHARS) > 0 && m_xmlcharInfo.onlyQuotAmpLtGt) { // "flags" has indicated that the characters // '>' '<' '&' and '"' are not in the value and // m_htmlcharInfo has recorded that there are no other // entities in the range 32 to 127 so we write out the // value directly writer.write(' '); writer.write(patchedName); writer.write("=\""); writer.write(value); writer.write('"'); } else { writer.write(' '); writer.write(patchedName); writer.write("=\""); writeAttrString(writer, value, this.getEncoding()); writer.write('"'); } } catch (IOException e) { throw new SAXException(e); } } } /** * Add an attribute to the current element. * @param uri the URI associated with the element name * @param localName local part of the attribute name * @param rawName prefix:localName * @param type * @param value the value of the attribute * @param xslAttribute true if this attribute is from an xsl:attribute, * false if declared within the elements opening tag. * @throws SAXException */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean xslAttribute) throws SAXException { if (m_elemContext.m_startTagOpen) { boolean was_added = addAttributeAlways(uri, localName, rawName, type, value, xslAttribute); /* * We don't run this block of code if: * 1. The attribute value was only replaced (was_added is false). * 2. The attribute is from an xsl:attribute element (that is handled * in the addAttributeAlways() call just above. * 3. The name starts with "xmlns", i.e. it is a namespace declaration. */ if (was_added && !xslAttribute && !rawName.startsWith("xmlns")) { String prefixUsed = ensureAttributesNamespaceIsDeclared( uri, localName, rawName); if (prefixUsed != null && rawName != null && !rawName.startsWith(prefixUsed)) { // use a different raw name, with the prefix used in the // generated namespace declaration rawName = prefixUsed + ":" + localName; } } addAttributeAlways(uri, localName, rawName, type, value, xslAttribute); } else { /* * The startTag is closed, yet we are adding an attribute? * * Section: 7.1.3 Creating Attributes Adding an attribute to an * element after a PI (for example) has been added to it is an * error. The attributes can be ignored. The spec doesn't explicitly * say this is disallowed, as it does for child elements, but it * makes sense to have the same treatment. * * We choose to ignore the attribute which is added too late. */ // Generate a warning of the ignored attributes // Create the warning message String msg = Utils.messages.createMessage( MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,new Object[]{ localName }); try { // Prepare to issue the warning message Transformer tran = super.getTransformer(); ErrorListener errHandler = tran.getErrorListener(); // Issue the warning message if (null != errHandler && m_sourceLocator != null) errHandler.warning(new TransformerException(msg, m_sourceLocator)); else System.out.println(msg); } catch (TransformerException e){ // A user defined error handler, errHandler, may throw // a TransformerException if it chooses to, and if it does // we will wrap it with a SAXException and re-throw. // Of course if the handler throws another type of // exception, like a RuntimeException, then that is OK too. SAXException se = new SAXException(e); throw se; } } } /** * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elemName) throws SAXException { endElement(null, null, elemName); } /** * This method is used to notify the serializer of a namespace mapping (or node) * that applies to the current element whose startElement() call has already been seen. * The official SAX startPrefixMapping(prefix,uri) is to define a mapping for a child * element that is soon to be seen with a startElement() call. The official SAX call * does not apply to the current element, hence the reason for this method. */ public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_elemContext.m_elementURI == null) { String prefix1 = getPrefixPart(m_elemContext.m_elementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_elemContext.m_elementURI = uri; } } startPrefixMapping(prefix,uri,false); return; } /** * From XSLTC * Declare a prefix to point to a namespace URI. Inform SAX handler * if this is a new prefix mapping. */ protected boolean pushNamespace(String prefix, String uri) { try { if (m_prefixMap.pushNamespace( prefix, uri, m_elemContext.m_currentElemDepth)) { startPrefixMapping(prefix, uri); return true; } } catch (SAXException e) { // falls through } return false; } /** * Try's to reset the super class and reset this class for * re-use, so that you don't need to create a new serializer * (mostly for performance reasons). * * @return true if the class was successfuly reset. */ public boolean reset() { boolean wasReset = false; if (super.reset()) { // Make this call when resetToXMLStream does // something. // resetToXMLStream(); wasReset = true; } return wasReset; } /** * Reset all of the fields owned by ToStream class * */ private void resetToXMLStream() { // This is an empty method, but is kept for future use // as a place holder for a location to reset fields // defined within this class return; } /** * This method checks for the XML version of output document. * If XML version of output document is not specified, then output * document is of version XML 1.0. * If XML version of output doucment is specified, but it is not either * XML 1.0 or XML 1.1, a warning message is generated, the XML Version of * output document is set to XML 1.0 and processing continues. * @return string (XML version) */ private String getXMLVersion() { String xmlVersion = getVersion(); if(xmlVersion == null || xmlVersion.equals(XMLVERSION10)) { xmlVersion = XMLVERSION10; } else if(xmlVersion.equals(XMLVERSION11)) { xmlVersion = XMLVERSION11; } else { String msg = Utils.messages.createMessage( MsgKey.ER_XML_VERSION_NOT_SUPPORTED,new Object[]{ xmlVersion }); try { // Prepare to issue the warning message Transformer tran = super.getTransformer(); ErrorListener errHandler = tran.getErrorListener(); // Issue the warning message if (null != errHandler && m_sourceLocator != null) errHandler.warning(new TransformerException(msg, m_sourceLocator)); else System.out.println(msg); } catch (Exception e){} xmlVersion = XMLVERSION10; } return xmlVersion; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/CharInfo.java0000644000175000017500000007033710721374031023414 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CharInfo.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import java.security.AccessController; import java.security.PrivilegedAction; import javax.xml.transform.TransformerException; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.SystemIDResolver; import org.apache.xml.serializer.utils.Utils; import org.apache.xml.serializer.utils.WrappedRuntimeException; /** * This class provides services that tell if a character should have * special treatement, such as entity reference substitution or normalization * of a newline character. It also provides character to entity reference * lookup. * * DEVELOPERS: See Known Issue in the constructor. * * @xsl.usage internal */ final class CharInfo { /** Given a character, lookup a String to output (e.g. a decorated entity reference). */ private HashMap m_charToString; /** * The name of the HTML entities file. * If specified, the file will be resource loaded with the default class loader. */ public static final String HTML_ENTITIES_RESOURCE = SerializerBase.PKG_NAME+".HTMLEntities"; /** * The name of the XML entities file. * If specified, the file will be resource loaded with the default class loader. */ public static final String XML_ENTITIES_RESOURCE = SerializerBase.PKG_NAME+".XMLEntities"; /** The horizontal tab character, which the parser should always normalize. */ static final char S_HORIZONAL_TAB = 0x09; /** The linefeed character, which the parser should always normalize. */ static final char S_LINEFEED = 0x0A; /** The carriage return character, which the parser should always normalize. */ static final char S_CARRIAGERETURN = 0x0D; static final char S_SPACE = 0x20; static final char S_QUOTE = 0x22; static final char S_LT = 0x3C; static final char S_GT = 0x3E; static final char S_NEL = 0x85; static final char S_LINE_SEPARATOR = 0x2028; /** This flag is an optimization for HTML entities. It false if entities * other than quot (34), amp (38), lt (60) and gt (62) are defined * in the range 0 to 127. * @xsl.usage internal */ boolean onlyQuotAmpLtGt; /** Copy the first 0,1 ... ASCII_MAX values into an array */ static final int ASCII_MAX = 128; /** Array of values is faster access than a set of bits * to quickly check ASCII characters in attribute values, * the value is true if the character in an attribute value * should be mapped to a String. */ private final boolean[] shouldMapAttrChar_ASCII; /** Array of values is faster access than a set of bits * to quickly check ASCII characters in text nodes, * the value is true if the character in a text node * should be mapped to a String. */ private final boolean[] shouldMapTextChar_ASCII; /** An array of bits to record if the character is in the set. * Although information in this array is complete, the * isSpecialAttrASCII array is used first because access to its values * is common and faster. */ private final int array_of_bits[]; // 5 for 32 bit words, 6 for 64 bit words ... /* * This constant is used to shift an integer to quickly * calculate which element its bit is stored in. * 5 for 32 bit words (int) , 6 for 64 bit words (long) */ private static final int SHIFT_PER_WORD = 5; /* * A mask to get the low order bits which are used to * calculate the value of the bit within a given word, * that will represent the presence of the integer in the * set. * * 0x1F for 32 bit words (int), * or 0x3F for 64 bit words (long) */ private static final int LOW_ORDER_BITMASK = 0x1f; /* * This is used for optimizing the lookup of bits representing * the integers in the set. It is the index of the first element * in the array array_of_bits[] that is not used. */ private int firstWordNotUsed; /** * A base constructor just to explicitly create the fields, * with the exception of m_charToString which is handled * by the constructor that delegates base construction to this one. *

    * m_charToString is not created here only for performance reasons, * to avoid creating a Hashtable that will be replaced when * making a mutable copy, {@link #mutableCopyOf(CharInfo)}. * */ private CharInfo() { this.array_of_bits = createEmptySetOfIntegers(65535); this.firstWordNotUsed = 0; this.shouldMapAttrChar_ASCII = new boolean[ASCII_MAX]; this.shouldMapTextChar_ASCII = new boolean[ASCII_MAX]; this.m_charKey = new CharKey(); // Not set here, but in a constructor that uses this one // this.m_charToString = new Hashtable(); this.onlyQuotAmpLtGt = true; return; } private CharInfo(String entitiesResource, String method, boolean internal) { // call the default constructor to create the fields this(); m_charToString = new HashMap(); ResourceBundle entities = null; boolean noExtraEntities = true; // Make various attempts to interpret the parameter as a properties // file or resource file, as follows: // // 1) attempt to load .properties file using ResourceBundle // 2) try using the class loader to find the specified file a resource // file // 3) try treating the resource a URI if (internal) { try { // Load entity property files by using PropertyResourceBundle, // cause of security issure for applets entities = PropertyResourceBundle.getBundle(entitiesResource); } catch (Exception e) {} } if (entities != null) { Enumeration keys = entities.getKeys(); while (keys.hasMoreElements()){ String name = (String) keys.nextElement(); String value = entities.getString(name); int code = Integer.parseInt(value); boolean extra = defineEntity(name, (char) code); if (extra) noExtraEntities = false; } } else { InputStream is = null; // Load user specified resource file by using URL loading, it // requires a valid URI as parameter try { if (internal) { is = CharInfo.class.getResourceAsStream(entitiesResource); } else { ClassLoader cl = ObjectFactory.findClassLoader(); if (cl == null) { is = ClassLoader.getSystemResourceAsStream(entitiesResource); } else { is = cl.getResourceAsStream(entitiesResource); } if (is == null) { try { URL url = new URL(entitiesResource); is = url.openStream(); } catch (Exception e) {} } } if (is == null) { throw new RuntimeException( Utils.messages.createMessage( MsgKey.ER_RESOURCE_COULD_NOT_FIND, new Object[] {entitiesResource, entitiesResource})); } // Fix Bugzilla#4000: force reading in UTF-8 // This creates the de facto standard that Xalan's resource // files must be encoded in UTF-8. This should work in all // JVMs. // // %REVIEW% KNOWN ISSUE: IT FAILS IN MICROSOFT VJ++, which // didn't implement the UTF-8 encoding. Theoretically, we should // simply let it fail in that case, since the JVM is obviously // broken if it doesn't support such a basic standard. But // since there are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In VJ++ // this is apparently ASCII, which is subset of UTF-8... and // since the strings we'll be reading here are also primarily // limited to the 7-bit ASCII range (at least, in English // versions of Xalan), this should work well enough to keep us // on the air until we're ready to officially decommit from // VJ++. BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String line = reader.readLine(); while (line != null) { if (line.length() == 0 || line.charAt(0) == '#') { line = reader.readLine(); continue; } int index = line.indexOf(' '); if (index > 1) { String name = line.substring(0, index); ++index; if (index < line.length()) { String value = line.substring(index); index = value.indexOf(' '); if (index > 0) { value = value.substring(0, index); } int code = Integer.parseInt(value); boolean extra = defineEntity(name, (char) code); if (extra) noExtraEntities = false; } } line = reader.readLine(); } is.close(); } catch (Exception e) { throw new RuntimeException( Utils.messages.createMessage( MsgKey.ER_RESOURCE_COULD_NOT_LOAD, new Object[] { entitiesResource, e.toString(), entitiesResource, e.toString()})); } finally { if (is != null) { try { is.close(); } catch (Exception except) {} } } } onlyQuotAmpLtGt = noExtraEntities; /* Now that we've used get(ch) just above to initialize the * two arrays we will change by adding a tab to the set of * special chars for XML (but not HTML!). * We do this because a tab is always a * special character in an XML attribute, * but only a special character in XML text * if it has an entity defined for it. * This is the reason for this delay. */ if (Method.XML.equals(method)) { // We choose not to escape the quotation mark as " in text nodes shouldMapTextChar_ASCII[S_QUOTE] = false; } if (Method.HTML.equals(method)) { // The XSLT 1.0 recommendation says // "The html output method should not escape < characters occurring in attribute values." // So we don't escape '<' in an attribute for HTML shouldMapAttrChar_ASCII['<'] = false; // We choose not to escape the quotation mark as " in text nodes. shouldMapTextChar_ASCII[S_QUOTE] = false; } } /** * Defines a new character reference. The reference's name and value are * supplied. Nothing happens if the character reference is already defined. *

    Unlike internal entities, character references are a string to single * character mapping. They are used to map non-ASCII characters both on * parsing and printing, primarily for HTML documents. '&lt;' is an * example of a character reference.

    * * @param name The entity's name * @param value The entity's value * @return true if the mapping is not one of: *
      *
    • '<' to "<" *
    • '>' to ">" *
    • '&' to "&" *
    • '"' to """ *
    */ private boolean defineEntity(String name, char value) { StringBuffer sb = new StringBuffer("&"); sb.append(name); sb.append(';'); String entityString = sb.toString(); boolean extra = defineChar2StringMapping(entityString, value); return extra; } /** * A utility object, just used to map characters to output Strings, * needed because a HashMap needs to map an object as a key, not a * Java primitive type, like a char, so this object gets around that * and it is reusable. */ private final CharKey m_charKey; /** * Map a character to a String. For example given * the character '>' this method would return the fully decorated * entity name "<". * Strings for entity references are loaded from a properties file, * but additional mappings defined through calls to defineChar2String() * are possible. Such entity reference mappings could be over-ridden. * * This is reusing a stored key object, in an effort to avoid * heap activity. Unfortunately, that introduces a threading risk. * Simplest fix for now is to make it a synchronized method, or to give * up the reuse; I see very little performance difference between them. * Long-term solution would be to replace the hashtable with a sparse array * keyed directly from the character's integer value; see DTM's * string pool for a related solution. * * @param value The character that should be resolved to * a String, e.g. resolve '>' to "<". * * @return The String that the character is mapped to, or null if not found. * @xsl.usage internal */ String getOutputStringForChar(char value) { // CharKey m_charKey = new CharKey(); //Alternative to synchronized m_charKey.setChar(value); return (String) m_charToString.get(m_charKey); } /** * Tell if the character argument that is from * an attribute value has a mapping to a String. * * @param value the value of a character that is in an attribute value * @return true if the character should have any special treatment, * such as when writing out entity references. * @xsl.usage internal */ final boolean shouldMapAttrChar(int value) { // for performance try the values in the boolean array first, // this is faster access than the BitSet for common ASCII values if (value < ASCII_MAX) return shouldMapAttrChar_ASCII[value]; // rather than java.util.BitSet, our private // implementation is faster (and less general). return get(value); } /** * Tell if the character argument that is from a * text node has a mapping to a String, for example * to map '<' to "<". * * @param value the value of a character that is in a text node * @return true if the character has a mapping to a String, * such as when writing out entity references. * @xsl.usage internal */ final boolean shouldMapTextChar(int value) { // for performance try the values in the boolean array first, // this is faster access than the BitSet for common ASCII values if (value < ASCII_MAX) return shouldMapTextChar_ASCII[value]; // rather than java.util.BitSet, our private // implementation is faster (and less general). return get(value); } private static CharInfo getCharInfoBasedOnPrivilege( final String entitiesFileName, final String method, final boolean internal){ return (CharInfo) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return new CharInfo(entitiesFileName, method, internal);} }); } /** * Factory that reads in a resource file that describes the mapping of * characters to entity references. * * Resource files must be encoded in UTF-8 and have a format like: *
         * # First char # is a comment
         * Entity numericValue
         * quot 34
         * amp 38
         * 
    * (Note: Why don't we just switch to .properties files? Oct-01 -sc) * * @param entitiesResource Name of entities resource file that should * be loaded, which describes that mapping of characters to entity references. * @param method the output method type, which should be one of "xml", "html", "text"... * * @xsl.usage internal */ static CharInfo getCharInfo(String entitiesFileName, String method) { CharInfo charInfo = (CharInfo) m_getCharInfoCache.get(entitiesFileName); if (charInfo != null) { return mutableCopyOf(charInfo); } // try to load it internally - cache try { charInfo = getCharInfoBasedOnPrivilege(entitiesFileName, method, true); // Put the common copy of charInfo in the cache, but return // a copy of it. m_getCharInfoCache.put(entitiesFileName, charInfo); return mutableCopyOf(charInfo); } catch (Exception e) {} // try to load it externally - do not cache try { return getCharInfoBasedOnPrivilege(entitiesFileName, method, false); } catch (Exception e) {} String absoluteEntitiesFileName; if (entitiesFileName.indexOf(':') < 0) { absoluteEntitiesFileName = SystemIDResolver.getAbsoluteURIFromRelative(entitiesFileName); } else { try { absoluteEntitiesFileName = SystemIDResolver.getAbsoluteURI(entitiesFileName, null); } catch (TransformerException te) { throw new WrappedRuntimeException(te); } } return getCharInfoBasedOnPrivilege(entitiesFileName, method, false); } /** * Create a mutable copy of the cached one. * @param charInfo The cached one. * @return */ private static CharInfo mutableCopyOf(CharInfo charInfo) { CharInfo copy = new CharInfo(); int max = charInfo.array_of_bits.length; System.arraycopy(charInfo.array_of_bits,0,copy.array_of_bits,0,max); copy.firstWordNotUsed = charInfo.firstWordNotUsed; max = charInfo.shouldMapAttrChar_ASCII.length; System.arraycopy(charInfo.shouldMapAttrChar_ASCII,0,copy.shouldMapAttrChar_ASCII,0,max); max = charInfo.shouldMapTextChar_ASCII.length; System.arraycopy(charInfo.shouldMapTextChar_ASCII,0,copy.shouldMapTextChar_ASCII,0,max); // utility field copy.m_charKey is already created in the default constructor copy.m_charToString = (HashMap) charInfo.m_charToString.clone(); copy.onlyQuotAmpLtGt = charInfo.onlyQuotAmpLtGt; return copy; } /** * Table of user-specified char infos. * The table maps entify file names (the name of the * property file without the .properties extension) * to CharInfo objects populated with entities defined in * corresponding property file. */ private static Hashtable m_getCharInfoCache = new Hashtable(); /** * Returns the array element holding the bit value for the * given integer * @param i the integer that might be in the set of integers * */ private static int arrayIndex(int i) { return (i >> SHIFT_PER_WORD); } /** * For a given integer in the set it returns the single bit * value used within a given word that represents whether * the integer is in the set or not. */ private static int bit(int i) { int ret = (1 << (i & LOW_ORDER_BITMASK)); return ret; } /** * Creates a new empty set of integers (characters) * @param max the maximum integer to be in the set. */ private int[] createEmptySetOfIntegers(int max) { firstWordNotUsed = 0; // an optimization int[] arr = new int[arrayIndex(max - 1) + 1]; return arr; } /** * Adds the integer (character) to the set of integers. * @param i the integer to add to the set, valid values are * 0, 1, 2 ... up to the maximum that was specified at * the creation of the set. */ private final void set(int i) { setASCIItextDirty(i); setASCIIattrDirty(i); int j = (i >> SHIFT_PER_WORD); // this word is used int k = j + 1; if(firstWordNotUsed < k) // for optimization purposes. firstWordNotUsed = k; array_of_bits[j] |= (1 << (i & LOW_ORDER_BITMASK)); } /** * Return true if the integer (character)is in the set of integers. * * This implementation uses an array of integers with 32 bits per * integer. If a bit is set to 1 the corresponding integer is * in the set of integers. * * @param i an integer that is tested to see if it is the * set of integers, or not. */ private final boolean get(int i) { boolean in_the_set = false; int j = (i >> SHIFT_PER_WORD); // wordIndex(i) // an optimization here, ... a quick test to see // if this integer is beyond any of the words in use if(j < firstWordNotUsed) in_the_set = (array_of_bits[j] & (1 << (i & LOW_ORDER_BITMASK)) ) != 0; // 0L for 64 bit words return in_the_set; } /** * This method returns true if there are some non-standard mappings to * entities other than quot, amp, lt, gt, and its only purpose is for * performance. * @param charToMap The value of the character that is mapped to a String * @param outputString The String to which the character is mapped, usually * an entity reference such as "<". * @return true if the mapping is not one of: *
      *
    • '<' to "<" *
    • '>' to ">" *
    • '&' to "&" *
    • '"' to """ *
    */ private boolean extraEntity(String outputString, int charToMap) { boolean extra = false; if (charToMap < ASCII_MAX) { switch (charToMap) { case '"' : // quot if (!outputString.equals(""")) extra = true; break; case '&' : // amp if (!outputString.equals("&")) extra = true; break; case '<' : // lt if (!outputString.equals("<")) extra = true; break; case '>' : // gt if (!outputString.equals(">")) extra = true; break; default : // other entity in range 0 to 127 extra = true; } } return extra; } /** * If the character is in the ASCII range then * mark it as needing replacement with * a String on output if it occurs in a text node. * @param ch */ private void setASCIItextDirty(int j) { if (0 <= j && j < ASCII_MAX) { shouldMapTextChar_ASCII[j] = true; } } /** * If the character is in the ASCII range then * mark it as needing replacement with * a String on output if it occurs in a attribute value. * @param ch */ private void setASCIIattrDirty(int j) { if (0 <= j && j < ASCII_MAX) { shouldMapAttrChar_ASCII[j] = true; } } /** * Call this method to register a char to String mapping, for example * to map '<' to "<". * @param outputString The String to map to. * @param inputChar The char to map from. * @return true if the mapping is not one of: *
      *
    • '<' to "<" *
    • '>' to ">" *
    • '&' to "&" *
    • '"' to """ *
    */ boolean defineChar2StringMapping(String outputString, char inputChar) { CharKey character = new CharKey(inputChar); m_charToString.put(character, outputString); set(inputChar); // mark the character has having a mapping to a String boolean extraMapping = extraEntity(outputString, inputChar); return extraMapping; } /** * Simple class for fast lookup of char values, when used with * hashtables. You can set the char, then use it as a key. * * @xsl.usage internal */ private static class CharKey extends Object { /** String value */ private char m_char; /** * Constructor CharKey * * @param key char value of this object. */ public CharKey(char key) { m_char = key; } /** * Default constructor for a CharKey. * * @param key char value of this object. */ public CharKey() { } /** * Get the hash value of the character. * * @return hash value of the character. */ public final void setChar(char c) { m_char = c; } /** * Get the hash value of the character. * * @return hash value of the character. */ public final int hashCode() { return (int)m_char; } /** * Override of equals() for this object * * @param obj to compare to * * @return True if this object equals this string value */ public final boolean equals(Object obj) { return ((CharKey)obj).m_char == m_char; } } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/OutputPropertiesFactory.java0000644000175000017500000004744410721374032026634 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OutputPropertiesFactory.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Enumeration; import java.util.Properties; import javax.xml.transform.OutputKeys; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.apache.xml.serializer.utils.WrappedRuntimeException; /** * This class is a factory to generate a set of default properties * of key/value pairs that are used to create a serializer through the * factory {@link SerializerFactory SerilizerFactory}. * The properties generated by this factory * may be modified to non-default values before the SerializerFactory is used to * create a Serializer. *

    * The given output types supported are "xml", "text", and "html". * These type strings can be obtained from the * {@link Method Method} class in this package. *

    * Other constants defined in this class are the non-standard property keys * that can be used to set non-standard property values on a java.util.Properties object * that is used to create or configure a serializer. Here are the non-standard keys: *

      *
    • S_KEY_INDENT_AMOUNT - * The non-standard property key to use to set the indentation amount. * The "indent" key needs to have a value of "yes", and this * properties value is a the number of whitespaces to indent by per * indentation level. * *
    • S_KEY_CONTENT_HANDLER - * This non-standard property key is used to set the name of the fully qualified * Java class that implements the ContentHandler interface. * The output of the serializer will be SAX events sent to this an * object of this class. * *
    • S_KEY_ENTITIES - * This non-standard property key is used to specify the name of the property file * that specifies character to entity reference mappings. A line in such a * file is has the name of the entity and the numeric (base 10) value * of the corresponding character, like this one:
      quot=34
      * *
    • S_USE_URL_ESCAPING - * This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should * use %xx escaping. * *
    • S_OMIT_META_TAG - * This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would * otherwise be supplied. *
    * * @see SerializerFactory * @see Method * @see Serializer */ public final class OutputPropertiesFactory { /** S_BUILTIN_EXTENSIONS_URL is a mnemonic for the XML Namespace *(http://xml.apache.org/xalan) predefined to signify Xalan's * built-in XSLT Extensions. When used in stylesheets, this is often * bound to the "xalan:" prefix. */ private static final String S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xalan"; /** * The old built-in extension url. It is still supported for * backward compatibility. */ private static final String S_BUILTIN_OLD_EXTENSIONS_URL = "http://xml.apache.org/xslt"; //************************************************************ //* PUBLIC CONSTANTS //************************************************************ /** * This is not a public API. * This is the built-in extensions namespace, * reexpressed in {namespaceURI} syntax * suitable for prepending to a localname to produce a "universal * name". */ public static final String S_BUILTIN_EXTENSIONS_UNIVERSAL = "{" + S_BUILTIN_EXTENSIONS_URL + "}"; // Some special Xalan keys. /** * The non-standard property key to use to set the * number of whitepaces to indent by, per indentation level, * if indent="yes". */ public static final String S_KEY_INDENT_AMOUNT = S_BUILTIN_EXTENSIONS_UNIVERSAL + "indent-amount"; /** * The non-standard property key to use to set the * characters to write out as at the end of a line, * rather than the default ones from the runtime. */ public static final String S_KEY_LINE_SEPARATOR = S_BUILTIN_EXTENSIONS_UNIVERSAL + "line-separator"; /** This non-standard property key is used to set the name of the fully qualified * Java class that implements the ContentHandler interface. * Fully qualified name of class with a default constructor that * implements the ContentHandler interface, where the result tree events * will be sent to. */ public static final String S_KEY_CONTENT_HANDLER = S_BUILTIN_EXTENSIONS_UNIVERSAL + "content-handler"; /** * This non-standard property key is used to specify the name of the property file * that specifies character to entity reference mappings. */ public static final String S_KEY_ENTITIES = S_BUILTIN_EXTENSIONS_UNIVERSAL + "entities"; /** * This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should * use %xx escaping. */ public static final String S_USE_URL_ESCAPING = S_BUILTIN_EXTENSIONS_UNIVERSAL + "use-url-escaping"; /** * This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would * otherwise be supplied. */ public static final String S_OMIT_META_TAG = S_BUILTIN_EXTENSIONS_UNIVERSAL + "omit-meta-tag"; /** * The old built-in extension namespace, this is not a public API. */ public static final String S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL = "{" + S_BUILTIN_OLD_EXTENSIONS_URL + "}"; /** * This is not a public API, it is only public because it is used * by outside of this package, * it is the length of the old built-in extension namespace. */ public static final int S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN = S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL.length(); //************************************************************ //* PRIVATE CONSTANTS //************************************************************ private static final String S_XSLT_PREFIX = "xslt.output."; private static final int S_XSLT_PREFIX_LEN = S_XSLT_PREFIX.length(); private static final String S_XALAN_PREFIX = "org.apache.xslt."; private static final int S_XALAN_PREFIX_LEN = S_XALAN_PREFIX.length(); /** Synchronization object for lazy initialization of the above tables. */ private static Integer m_synch_object = new Integer(1); /** the directory in which the various method property files are located */ private static final String PROP_DIR = SerializerBase.PKG_PATH+'/'; /** property file for default XML properties */ private static final String PROP_FILE_XML = "output_xml.properties"; /** property file for default TEXT properties */ private static final String PROP_FILE_TEXT = "output_text.properties"; /** property file for default HTML properties */ private static final String PROP_FILE_HTML = "output_html.properties"; /** property file for default UNKNOWN (Either XML or HTML, to be determined later) properties */ private static final String PROP_FILE_UNKNOWN = "output_unknown.properties"; //************************************************************ //* PRIVATE STATIC FIELDS //************************************************************ /** The default properties of all output files. */ private static Properties m_xml_properties = null; /** The default properties when method="html". */ private static Properties m_html_properties = null; /** The default properties when method="text". */ private static Properties m_text_properties = null; /** The properties when method="" for the "unknown" wrapper */ private static Properties m_unknown_properties = null; private static final Class ACCESS_CONTROLLER_CLASS = findAccessControllerClass(); private static Class findAccessControllerClass() { try { // This Class was introduced in JDK 1.2. With the re-architecture of // security mechanism ( starting in JDK 1.2 ), we have option of // giving privileges to certain part of code using doPrivileged block. // In JDK1.1.X applications won't be having security manager and if // there is security manager ( in applets ), code need to be signed // and trusted for having access to resources. return Class.forName("java.security.AccessController"); } catch (Exception e) { //User may be using older JDK ( JDK <1.2 ). Allow him/her to use it. // But don't try to use doPrivileged } return null; } /** * Creates an empty OutputProperties with the property key/value defaults specified by * a property file. The method argument is used to construct a string of * the form output_[method].properties (for instance, output_html.properties). * The output_xml.properties file is always used as the base. * *

    Anything other than 'text', 'xml', and 'html', will * use the output_xml.properties file.

    * * @param method non-null reference to method name. * * @return Properties object that holds the defaults for the given method. */ static public final Properties getDefaultMethodProperties(String method) { String fileName = null; Properties defaultProperties = null; // According to this article : Double-check locking does not work // http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-toolbox.html try { synchronized (m_synch_object) { if (null == m_xml_properties) // double check { fileName = PROP_FILE_XML; m_xml_properties = loadPropertiesFile(fileName, null); } } if (method.equals(Method.XML)) { defaultProperties = m_xml_properties; } else if (method.equals(Method.HTML)) { if (null == m_html_properties) // double check { fileName = PROP_FILE_HTML; m_html_properties = loadPropertiesFile(fileName, m_xml_properties); } defaultProperties = m_html_properties; } else if (method.equals(Method.TEXT)) { if (null == m_text_properties) // double check { fileName = PROP_FILE_TEXT; m_text_properties = loadPropertiesFile(fileName, m_xml_properties); if (null == m_text_properties.getProperty(OutputKeys.ENCODING)) { String mimeEncoding = Encodings.getMimeEncoding(null); m_text_properties.put( OutputKeys.ENCODING, mimeEncoding); } } defaultProperties = m_text_properties; } else if (method.equals(Method.UNKNOWN)) { if (null == m_unknown_properties) // double check { fileName = PROP_FILE_UNKNOWN; m_unknown_properties = loadPropertiesFile(fileName, m_xml_properties); } defaultProperties = m_unknown_properties; } else { // TODO: Calculate res file from name. defaultProperties = m_xml_properties; } } catch (IOException ioe) { throw new WrappedRuntimeException( Utils.messages.createMessage( MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, new Object[] { fileName, method }), ioe); } // wrap these cached defaultProperties in a new Property object just so // that the caller of this method can't modify the default values return new Properties(defaultProperties); } /** * Load the properties file from a resource stream. If a * key name such as "org.apache.xslt.xxx", fix up the start of * string to be a curly namespace. If a key name starts with * "xslt.output.xxx", clip off "xslt.output.". If a key name *or* a * key value is discovered, check for \u003a in the text, and * fix it up to be ":", since earlier versions of the JDK do not * handle the escape sequence (at least in key names). * * @param resourceName non-null reference to resource name. * @param defaults Default properties, which may be null. */ static private Properties loadPropertiesFile( final String resourceName, Properties defaults) throws IOException { // This static method should eventually be moved to a thread-specific class // so that we can cache the ContextClassLoader and bottleneck all properties file // loading throughout Xalan. Properties props = new Properties(defaults); InputStream is = null; BufferedInputStream bis = null; try { if (ACCESS_CONTROLLER_CLASS != null) { is = (InputStream) AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return OutputPropertiesFactory.class .getResourceAsStream(resourceName); } }); } else { // User may be using older JDK ( JDK < 1.2 ) is = OutputPropertiesFactory.class .getResourceAsStream(resourceName); } bis = new BufferedInputStream(is); props.load(bis); } catch (IOException ioe) { if (defaults == null) { throw ioe; } else { throw new WrappedRuntimeException( Utils.messages.createMessage( MsgKey.ER_COULD_NOT_LOAD_RESOURCE, new Object[] { resourceName }), ioe); //"Could not load '"+resourceName+"' (check CLASSPATH), now using just the defaults ", ioe); } } catch (SecurityException se) { // Repeat IOException handling for sandbox/applet case -sc if (defaults == null) { throw se; } else { throw new WrappedRuntimeException( Utils.messages.createMessage( MsgKey.ER_COULD_NOT_LOAD_RESOURCE, new Object[] { resourceName }), se); //"Could not load '"+resourceName+"' (check CLASSPATH, applet security), now using just the defaults ", se); } } finally { if (bis != null) { bis.close(); } if (is != null) { is.close(); } } // Note that we're working at the HashTable level here, // and not at the Properties level! This is important // because we don't want to modify the default properties. // NB: If fixupPropertyString ends up changing the property // name or value, we need to remove the old key and re-add // with the new key and value. However, then our Enumeration // could lose its place in the HashTable. So, we first // clone the HashTable and enumerate over that since the // clone will not change. When we migrate to Collections, // this code should be revisited and cleaned up to use // an Iterator which may (or may not) alleviate the need for // the clone. Many thanks to Padraig O'hIceadha // for finding this problem. Bugzilla 2000. Enumeration keys = ((Properties) props.clone()).keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); // Now check if the given key was specified as a // System property. If so, the system property // overides the default value in the propery file. String value = null; try { value = System.getProperty(key); } catch (SecurityException se) { // No-op for sandbox/applet case, leave null -sc } if (value == null) value = (String) props.get(key); String newKey = fixupPropertyString(key, true); String newValue = null; try { newValue = System.getProperty(newKey); } catch (SecurityException se) { // No-op for sandbox/applet case, leave null -sc } if (newValue == null) newValue = fixupPropertyString(value, false); else newValue = fixupPropertyString(newValue, false); if (key != newKey || value != newValue) { props.remove(key); props.put(newKey, newValue); } } return props; } /** * Fix up a string in an output properties file according to * the rules of {@link #loadPropertiesFile}. * * @param s non-null reference to string that may need to be fixed up. * @return A new string if fixup occured, otherwise the s argument. */ static private String fixupPropertyString(String s, boolean doClipping) { int index; if (doClipping && s.startsWith(S_XSLT_PREFIX)) { s = s.substring(S_XSLT_PREFIX_LEN); } if (s.startsWith(S_XALAN_PREFIX)) { s = S_BUILTIN_EXTENSIONS_UNIVERSAL + s.substring(S_XALAN_PREFIX_LEN); } if ((index = s.indexOf("\\u003a")) > 0) { String temp = s.substring(index + 6); s = s.substring(0, index) + ":" + temp; } return s; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/Version.java0000644000175000017500000001126210721374031023340 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Version.src 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; /** * Administrative class to keep track of the version number of * the Serializer release. *

    This class implements the upcoming standard of having * org.apache.project-name.Version.getVersion() be a standard way * to get version information.

    * @xsl.usage general */ public final class Version { /** * Get the basic version string for the current Serializer. * Version String formatted like * "Serializer Java v.r[.dd| Dnn]". * * Futurework: have this read version info from jar manifest. * * @return String denoting our current version */ public static String getVersion() { return getProduct()+" "+getImplementationLanguage()+" " +getMajorVersionNum()+"."+getReleaseVersionNum()+"." +( (getDevelopmentVersionNum() > 0) ? ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum())); } /** * Print the processor version to the command line. * * @param argv command line arguments, unused. */ public static void main(String argv[]) { System.out.println(getVersion()); } /** * Name of product: Serializer. */ public static String getProduct() { return "Serializer"; } /** * Implementation Language: Java. */ public static String getImplementationLanguage() { return "Java"; } /** * Major version number. * Version number. This changes only when there is a * significant, externally apparent enhancement from * the previous release. 'n' represents the n'th * version. * * Clients should carefully consider the implications * of new versions as external interfaces and behaviour * may have changed. */ public static int getMajorVersionNum() { return 2; } /** * Release Number. * Release number. This changes when: * - a new set of functionality is to be added, eg, * implementation of a new W3C specification. * - API or behaviour change. * - its designated as a reference release. */ public static int getReleaseVersionNum() { return 7; } /** * Maintenance Drop Number. * Optional identifier used to designate maintenance * drop applied to a specific release and contains * fixes for defects reported. It maintains compatibility * with the release and contains no API changes. * When missing, it designates the final and complete * development drop for a release. */ public static int getMaintenanceVersionNum() { return 1; } /** * Development Drop Number. * Optional identifier designates development drop of * a specific release. D01 is the first development drop * of a new release. * * Development drops are works in progress towards a * compeleted, final release. A specific development drop * may not completely implement all aspects of a new * feature, which may take several development drops to * complete. At the point of the final drop for the * release, the D suffix will be omitted. * * Each 'D' drops can contain functional enhancements as * well as defect fixes. 'D' drops may not be as stable as * the final releases. */ public static int getDevelopmentVersionNum() { try { if ((new String("")).length() == 0) return 0; else return Integer.parseInt(""); } catch (NumberFormatException nfe) { return 0; } } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/AttributesImplSerializer.java0000644000175000017500000002006310721374032026715 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributesImplSerializer.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.util.Hashtable; import org.xml.sax.Attributes; import org.xml.sax.helpers.AttributesImpl; /** * This class extends org.xml.sax.helpers.AttributesImpl which implements org. * xml.sax.Attributes. But for optimization this class adds a Hashtable for * faster lookup of an index by qName, which is commonly done in the stream * serializer. * * @see org.xml.sax.Attributes * * @xsl.usage internal */ public final class AttributesImplSerializer extends AttributesImpl { /** * Hash table of qName/index values to quickly lookup the index * of an attributes qName. qNames are in uppercase in the hash table * to make the search case insensitive. * * The keys to the hashtable to find the index are either * "prefix:localName" or "{uri}localName". */ private final Hashtable m_indexFromQName = new Hashtable(); private final StringBuffer m_buff = new StringBuffer(); /** * This is the number of attributes before switching to the hash table, * and can be tuned, but 12 seems good for now - Brian M. */ private static final int MAX = 12; /** * One less than the number of attributes before switching to * the Hashtable. */ private static final int MAXMinus1 = MAX - 1; /** * This method gets the index of an attribute given its qName. * @param qname the qualified name of the attribute, e.g. "prefix1:locName1" * @return the integer index of the attribute. * @see org.xml.sax.Attributes#getIndex(String) */ public final int getIndex(String qname) { int index; if (super.getLength() < MAX) { // if we haven't got too many attributes let the // super class look it up index = super.getIndex(qname); return index; } // we have too many attributes and the super class is slow // so find it quickly using our Hashtable. Integer i = (Integer)m_indexFromQName.get(qname); if (i == null) index = -1; else index = i.intValue(); return index; } /** * This method adds the attribute, but also records its qName/index pair in * the hashtable for fast lookup by getIndex(qName). * @param uri the URI of the attribute * @param local the local name of the attribute * @param qname the qualified name of the attribute * @param type the type of the attribute * @param val the value of the attribute * * @see org.xml.sax.helpers.AttributesImpl#addAttribute(String, String, String, String, String) * @see #getIndex(String) */ public final void addAttribute( String uri, String local, String qname, String type, String val) { int index = super.getLength(); super.addAttribute(uri, local, qname, type, val); // (index + 1) is now the number of attributes // so either compare (index+1) to MAX, or compare index to (MAX-1) if (index < MAXMinus1) { return; } else if (index == MAXMinus1) { switchOverToHash(MAX); } else { /* add the key with the format of "prefix:localName" */ /* we have just added the attibute, its index is the old length */ Integer i = new Integer(index); m_indexFromQName.put(qname, i); /* now add with key of the format "{uri}localName" */ m_buff.setLength(0); m_buff.append('{').append(uri).append('}').append(local); String key = m_buff.toString(); m_indexFromQName.put(key, i); } return; } /** * We are switching over to having a hash table for quick look * up of attributes, but up until now we haven't kept any * information in the Hashtable, so we now update the Hashtable. * Future additional attributes will update the Hashtable as * they are added. * @param numAtts */ private void switchOverToHash(int numAtts) { for (int index = 0; index < numAtts; index++) { String qName = super.getQName(index); Integer i = new Integer(index); m_indexFromQName.put(qName, i); // Add quick look-up to find with uri/local name pair String uri = super.getURI(index); String local = super.getLocalName(index); m_buff.setLength(0); m_buff.append('{').append(uri).append('}').append(local); String key = m_buff.toString(); m_indexFromQName.put(key, i); } } /** * This method clears the accumulated attributes. * * @see org.xml.sax.helpers.AttributesImpl#clear() */ public final void clear() { int len = super.getLength(); super.clear(); if (MAX <= len) { // if we have had enough attributes and are // using the Hashtable, then clear the Hashtable too. m_indexFromQName.clear(); } } /** * This method sets the attributes, previous attributes are cleared, * it also keeps the hashtable up to date for quick lookup via * getIndex(qName). * @param atts the attributes to copy into these attributes. * @see org.xml.sax.helpers.AttributesImpl#setAttributes(Attributes) * @see #getIndex(String) */ public final void setAttributes(Attributes atts) { super.setAttributes(atts); // we've let the super class add the attributes, but // we need to keep the hash table up to date ourselves for the // potentially new qName/index pairs for quick lookup. int numAtts = atts.getLength(); if (MAX <= numAtts) switchOverToHash(numAtts); } /** * This method gets the index of an attribute given its uri and locanName. * @param uri the URI of the attribute name. * @param localName the local namer (after the ':' ) of the attribute name. * @return the integer index of the attribute. * @see org.xml.sax.Attributes#getIndex(String) */ public final int getIndex(String uri, String localName) { int index; if (super.getLength() < MAX) { // if we haven't got too many attributes let the // super class look it up index = super.getIndex(uri,localName); return index; } // we have too many attributes and the super class is slow // so find it quickly using our Hashtable. // Form the key of format "{uri}localName" m_buff.setLength(0); m_buff.append('{').append(uri).append('}').append(localName); String key = m_buff.toString(); Integer i = (Integer)m_indexFromQName.get(key); if (i == null) index = -1; else index = i.intValue(); return index; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToTextSAXHandler.java0000644000175000017500000002340310721374030025013 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToTextSAXHandler.java 475978 2006-11-16 23:31:20Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; /** * This class converts SAX-like event to SAX events for * xsl:output method "text". * * This class is only to be used internally. This class is not a public API. * * @deprecated As of Xalan 2.7.1, replaced by the use of {@link ToXMLSAXHandler}. * * @xsl.usage internal */ public final class ToTextSAXHandler extends ToSAXHandler { /** * From XSLTC * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elemName) throws SAXException { if (m_tracer != null) super.fireEndElem(elemName); } /** * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ public void endElement(String arg0, String arg1, String arg2) throws SAXException { if (m_tracer != null) super.fireEndElem(arg2); } public ToTextSAXHandler(ContentHandler hdlr, LexicalHandler lex, String encoding) { super(hdlr, lex, encoding); } /** * From XSLTC */ public ToTextSAXHandler(ContentHandler handler, String encoding) { super(handler,encoding); } public void comment(char ch[], int start, int length) throws org.xml.sax.SAXException { if (m_tracer != null) super.fireCommentEvent(ch, start, length); } public void comment(String data) throws org.xml.sax.SAXException { final int length = data.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } data.getChars(0, length, m_charsBuff, 0); comment(m_charsBuff, 0, length); } /** * @see Serializer#getOutputFormat() */ public Properties getOutputFormat() { return null; } /** * @see Serializer#getOutputStream() */ public OutputStream getOutputStream() { return null; } /** * @see Serializer#getWriter() */ public Writer getWriter() { return null; } /** * Does nothing because * the indent attribute is ignored for text output. * */ public void indent(int n) throws SAXException { } /** * @see Serializer#reset() */ public boolean reset() { return false; } /** * @see DOMSerializer#serialize(Node) */ public void serialize(Node node) throws IOException { } /** * @see SerializationHandler#setEscaping(boolean) */ public boolean setEscaping(boolean escape) { return false; } /** * @see SerializationHandler#setIndent(boolean) */ public void setIndent(boolean indent) { } /** * @see Serializer#setOutputFormat(Properties) */ public void setOutputFormat(Properties format) { } /** * @see Serializer#setOutputStream(OutputStream) */ public void setOutputStream(OutputStream output) { } /** * @see Serializer#setWriter(Writer) */ public void setWriter(Writer writer) { } /** * @see ExtendedContentHandler#addAttribute(String, String, String, String, String) */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) { } /** * @see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String) */ public void attributeDecl( String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException { } /** * @see org.xml.sax.ext.DeclHandler#elementDecl(String, String) */ public void elementDecl(String arg0, String arg1) throws SAXException { } /** * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String) */ public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException { } /** * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(String, String) */ public void internalEntityDecl(String arg0, String arg1) throws SAXException { } /** * @see org.xml.sax.ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String arg0) throws SAXException { } /** * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { } /** * From XSLTC * @see org.xml.sax.ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String arg0, String arg1) throws SAXException { if (m_tracer != null) super.fireEscapingEvent(arg0, arg1); } /** * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator arg0) { } /** * @see org.xml.sax.ContentHandler#skippedEntity(String) */ public void skippedEntity(String arg0) throws SAXException { } /** * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) */ public void startElement( String arg0, String arg1, String arg2, Attributes arg3) throws SAXException { flushPending(); super.startElement(arg0, arg1, arg2, arg3); } /** * @see org.xml.sax.ext.LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { } /** * @see org.xml.sax.ext.LexicalHandler#endDTD() */ public void endDTD() throws SAXException { } /** * @see org.xml.sax.ext.LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { } /** * @see org.xml.sax.ext.LexicalHandler#startEntity(String) */ public void startEntity(String arg0) throws SAXException { } /** * From XSLTC * @see ExtendedContentHandler#startElement(String) */ public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { super.startElement(elementNamespaceURI, elementLocalName, elementName); } public void startElement( String elementName) throws SAXException { super.startElement(elementName); } /** * From XSLTC * @see org.xml.sax.ContentHandler#endDocument() */ public void endDocument() throws SAXException { flushPending(); m_saxHandler.endDocument(); if (m_tracer != null) super.fireEndDoc(); } /** * * @see ExtendedContentHandler#characters(String) */ public void characters(String characters) throws SAXException { final int length = characters.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } characters.getChars(0, length, m_charsBuff, 0); m_saxHandler.characters(m_charsBuff, 0, length); } /** * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ public void characters(char[] characters, int offset, int length) throws SAXException { m_saxHandler.characters(characters, offset, length); // time to fire off characters event if (m_tracer != null) super.fireCharEvent(characters, offset, length); } /** * From XSLTC */ public void addAttribute(String name, String value) { // do nothing } public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws SAXException { // no namespace support for HTML return false; } public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { // no namespace support for HTML } public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { // no namespace support for HTML } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/Version.src0000644000175000017500000001140610721374032023207 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Version.src 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; /** * Administrative class to keep track of the version number of * the Serializer release. *

    This class implements the upcoming standard of having * org.apache.project-name.Version.getVersion() be a standard way * to get version information.

    * @xsl.usage general */ public final class Version { /** * Get the basic version string for the current Serializer. * Version String formatted like * "Serializer Java v.r[.dd| Dnn]". * * Futurework: have this read version info from jar manifest. * * @return String denoting our current version */ public static String getVersion() { return getProduct()+" "+getImplementationLanguage()+" " +getMajorVersionNum()+"."+getReleaseVersionNum()+"." +( (getDevelopmentVersionNum() > 0) ? ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum())); } /** * Print the processor version to the command line. * * @param argv command line arguments, unused. */ public static void main(String argv[]) { System.out.println(getVersion()); } /** * Name of product: Serializer. */ public static String getProduct() { return "Serializer"; } /** * Implementation Language: Java. */ public static String getImplementationLanguage() { return "Java"; } /** * Major version number. * Version number. This changes only when there is a * significant, externally apparent enhancement from * the previous release. 'n' represents the n'th * version. * * Clients should carefully consider the implications * of new versions as external interfaces and behaviour * may have changed. */ public static int getMajorVersionNum() { return @version.VERSION@; } /** * Release Number. * Release number. This changes when: * - a new set of functionality is to be added, eg, * implementation of a new W3C specification. * - API or behaviour change. * - its designated as a reference release. */ public static int getReleaseVersionNum() { return @version.RELEASE@; } /** * Maintenance Drop Number. * Optional identifier used to designate maintenance * drop applied to a specific release and contains * fixes for defects reported. It maintains compatibility * with the release and contains no API changes. * When missing, it designates the final and complete * development drop for a release. */ public static int getMaintenanceVersionNum() { return @version.MINOR@; } /** * Development Drop Number. * Optional identifier designates development drop of * a specific release. D01 is the first development drop * of a new release. * * Development drops are works in progress towards a * compeleted, final release. A specific development drop * may not completely implement all aspects of a new * feature, which may take several development drops to * complete. At the point of the final drop for the * release, the D suffix will be omitted. * * Each 'D' drops can contain functional enhancements as * well as defect fixes. 'D' drops may not be as stable as * the final releases. */ public static int getDevelopmentVersionNum() { try { if ((new String("@version.DEVELOPER@")).length() == 0) return 0; else return Integer.parseInt("@version.DEVELOPER@"); } catch (NumberFormatException nfe) { return 0; } } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/SerializerTrace.java0000644000175000017500000001145110721374033025005 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerTrace.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import org.xml.sax.Attributes; /** * This interface defines a set of integer constants that identify trace event * types. * * @xsl.usage internal */ public interface SerializerTrace { /** * Event type generated when a document begins. * */ public static final int EVENTTYPE_STARTDOCUMENT = 1; /** * Event type generated when a document ends. */ public static final int EVENTTYPE_ENDDOCUMENT = 2; /** * Event type generated when an element begins (after the attributes have been processed but before the children have been added). */ public static final int EVENTTYPE_STARTELEMENT = 3; /** * Event type generated when an element ends, after it's children have been added. */ public static final int EVENTTYPE_ENDELEMENT = 4; /** * Event type generated for character data (CDATA and Ignorable Whitespace have their own events). */ public static final int EVENTTYPE_CHARACTERS = 5; /** * Event type generated for ignorable whitespace (I'm not sure how much this is actually called. */ public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6; /** * Event type generated for processing instructions. */ public static final int EVENTTYPE_PI = 7; /** * Event type generated after a comment has been added. */ public static final int EVENTTYPE_COMMENT = 8; /** * Event type generate after an entity ref is created. */ public static final int EVENTTYPE_ENTITYREF = 9; /** * Event type generated after CDATA is generated. */ public static final int EVENTTYPE_CDATA = 10; /** * Event type generated when characters might be written to an output stream, * but these characters never are. They will ultimately be written out via * EVENTTYPE_OUTPUT_CHARACTERS. This type is used as attributes are collected. * Whenever the attributes change this event type is fired. At the very end * however, when the attributes do not change anymore and are going to be * ouput to the document the real characters will be written out using the * EVENTTYPE_OUTPUT_CHARACTERS. */ public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11; /** * Event type generated when characters are written to an output stream. */ public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12; /** * Tell if trace listeners are present. * * @return True if there are trace listeners */ public boolean hasTraceListeners(); /** * Fire startDocument, endDocument events. * * @param eventType One of the EVENTTYPE_XXX constants. */ public void fireGenerateEvent(int eventType); /** * Fire startElement, endElement events. * * @param eventType One of the EVENTTYPE_XXX constants. * @param name The name of the element. * @param atts The SAX attribute list. */ public void fireGenerateEvent(int eventType, String name, Attributes atts); /** * Fire characters, cdata events. * * @param eventType One of the EVENTTYPE_XXX constants. * @param ch The char array from the SAX event. * @param start The start offset to be used in the char array. * @param length The end offset to be used in the chara array. */ public void fireGenerateEvent(int eventType, char ch[], int start, int length); /** * Fire processingInstruction events. * * @param eventType One of the EVENTTYPE_XXX constants. * @param name The name of the processing instruction. * @param data The processing instruction data. */ public void fireGenerateEvent(int eventType, String name, String data); /** * Fire comment and entity ref events. * * @param eventType One of the EVENTTYPE_XXX constants. * @param data The comment or entity ref data. */ public void fireGenerateEvent(int eventType, String data); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/XMLEntities.properties0000644000175000017500000000212310721374030025326 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: XMLEntities.properties 468654 2006-10-28 07:09:23Z minchau $ # # @version $Revision$ $Date: 2006-10-28 03:09:23 -0400 (Sat, 28 Oct 2006) $ # This file must be encoded in UTF-8; see CharInfo.java # # Character entity references for markup-significant # quot=34 amp=38 lt=60 gt=62 libxalan2-java-2.7.1/src/org/apache/xml/serializer/Encodings.java0000644000175000017500000004271310721374030023630 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Encodings.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.Properties; import java.util.StringTokenizer; /** * Provides information about encodings. Depends on the Java runtime * to provides writers for the different encodings. *

    * This class is not a public API. It is only public because it * is used outside of this package. * * @xsl.usage internal */ public final class Encodings extends Object { /** * Standard filename for properties file with encodings data. */ private static final String ENCODINGS_FILE = SerializerBase.PKG_PATH+"/Encodings.properties"; /** * Returns a writer for the specified encoding based on * an output stream. *

    * This is not a public API. * @param output The output stream * @param encoding The encoding MIME name, not a Java name for the encoding. * @return A suitable writer * @throws UnsupportedEncodingException There is no convertor * to support this encoding * @xsl.usage internal */ static Writer getWriter(OutputStream output, String encoding) throws UnsupportedEncodingException { for (int i = 0; i < _encodings.length; ++i) { if (_encodings[i].name.equalsIgnoreCase(encoding)) { try { String javaName = _encodings[i].javaName; OutputStreamWriter osw = new OutputStreamWriter(output,javaName); return osw; } catch (java.lang.IllegalArgumentException iae) // java 1.1.8 { // keep trying } catch (UnsupportedEncodingException usee) { // keep trying } } } try { return new OutputStreamWriter(output, encoding); } catch (java.lang.IllegalArgumentException iae) // java 1.1.8 { throw new UnsupportedEncodingException(encoding); } } /** * Returns the EncodingInfo object for the specified * encoding, never null, although the encoding name * inside the returned EncodingInfo object will be if * we can't find a "real" EncodingInfo for the encoding. *

    * This is not a public API. * * @param encoding The encoding * @return The object that is used to determine if * characters are in the given encoding. * @xsl.usage internal */ static EncodingInfo getEncodingInfo(String encoding) { EncodingInfo ei; String normalizedEncoding = toUpperCaseFast(encoding); ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding); if (ei == null) ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding); if (ei == null) { // We shouldn't have to do this, but just in case. ei = new EncodingInfo(null,null, '\u0000'); } return ei; } /** * Determines if the encoding specified was recognized by the * serializer or not. * * @param encoding The encoding * @return boolean - true if the encoding was recognized else false */ public static boolean isRecognizedEncoding(String encoding) { EncodingInfo ei; String normalizedEncoding = encoding.toUpperCase(); ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding); if (ei == null) ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding); if (ei != null) return true; return false; } /** * A fast and cheap way to uppercase a String that is * only made of printable ASCII characters. *

    * This is not a public API. * @param s a String of ASCII characters * @return an uppercased version of the input String, * possibly the same String. * @xsl.usage internal */ static private String toUpperCaseFast(final String s) { boolean different = false; final int mx = s.length(); char[] chars = new char[mx]; for (int i=0; i < mx; i++) { char ch = s.charAt(i); // is the character a lower case ASCII one? if ('a' <= ch && ch <= 'z') { // a cheap and fast way to uppercase that is good enough ch = (char) (ch + ('A' - 'a')); different = true; // the uppercased String is different } chars[i] = ch; } // A little optimization, don't call String.valueOf() if // the uppercased string is the same as the input string. final String upper; if (different) upper = String.valueOf(chars); else upper = s; return upper; } /** The default encoding, ISO style, ISO style. */ static final String DEFAULT_MIME_ENCODING = "UTF-8"; /** * Get the proper mime encoding. From the XSLT recommendation: "The encoding * attribute specifies the preferred encoding to use for outputting the result * tree. XSLT processors are required to respect values of UTF-8 and UTF-16. * For other values, if the XSLT processor does not support the specified * encoding it may signal an error; if it does not signal an error it should * use UTF-8 or UTF-16 instead. The XSLT processor must not use an encoding * whose name does not match the EncName production of the XML Recommendation * [XML]. If no encoding attribute is specified, then the XSLT processor should * use either UTF-8 or UTF-16." *

    * This is not a public API. * * @param encoding Reference to java-style encoding string, which may be null, * in which case a default will be found. * * @return The ISO-style encoding string, or null if failure. * @xsl.usage internal */ static String getMimeEncoding(String encoding) { if (null == encoding) { try { // Get the default system character encoding. This may be // incorrect if they passed in a writer, but right now there // seems to be no way to get the encoding from a writer. encoding = System.getProperty("file.encoding", "UTF8"); if (null != encoding) { /* * See if the mime type is equal to UTF8. If you don't * do that, then convertJava2MimeEncoding will convert * 8859_1 to "ISO-8859-1", which is not what we want, * I think, and I don't think I want to alter the tables * to convert everything to UTF-8. */ String jencoding = (encoding.equalsIgnoreCase("Cp1252") || encoding.equalsIgnoreCase("ISO8859_1") || encoding.equalsIgnoreCase("8859_1") || encoding.equalsIgnoreCase("UTF8")) ? DEFAULT_MIME_ENCODING : convertJava2MimeEncoding(encoding); encoding = (null != jencoding) ? jencoding : DEFAULT_MIME_ENCODING; } else { encoding = DEFAULT_MIME_ENCODING; } } catch (SecurityException se) { encoding = DEFAULT_MIME_ENCODING; } } else { encoding = convertJava2MimeEncoding(encoding); } return encoding; } /** * Try the best we can to convert a Java encoding to a XML-style encoding. *

    * This is not a public API. * @param encoding non-null reference to encoding string, java style. * * @return ISO-style encoding string. * @xsl.usage internal */ private static String convertJava2MimeEncoding(String encoding) { EncodingInfo enc = (EncodingInfo) _encodingTableKeyJava.get(toUpperCaseFast(encoding)); if (null != enc) return enc.name; return encoding; } /** * Try the best we can to convert a Java encoding to a XML-style encoding. *

    * This is not a public API. * * @param encoding non-null reference to encoding string, java style. * * @return ISO-style encoding string. *

    * This method is not a public API. * @xsl.usage internal */ public static String convertMime2JavaEncoding(String encoding) { for (int i = 0; i < _encodings.length; ++i) { if (_encodings[i].name.equalsIgnoreCase(encoding)) { return _encodings[i].javaName; } } return encoding; } /** * Load a list of all the supported encodings. * * System property "encodings" formatted using URL syntax may define an * external encodings list. Thanks to Sergey Ushakov for the code * contribution! * @xsl.usage internal */ private static EncodingInfo[] loadEncodingInfo() { try { final InputStream is; SecuritySupport ss = SecuritySupport.getInstance(); is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), ENCODINGS_FILE); Properties props = new Properties(); if (is != null) { props.load(is); is.close(); } else { // Seems to be no real need to force failure here, let the // system do its best... The issue is not really very critical, // and the output will be in any case _correct_ though maybe not // always human-friendly... :) // But maybe report/log the resource problem? // Any standard ways to report/log errors (in static context)? } int totalEntries = props.size(); List encodingInfo_list = new ArrayList(); Enumeration keys = props.keys(); for (int i = 0; i < totalEntries; ++i) { String javaName = (String) keys.nextElement(); String val = props.getProperty(javaName); int len = lengthOfMimeNames(val); String mimeName; char highChar; if (len == 0) { // There is no property value, only the javaName, so try and recover mimeName = javaName; highChar = '\u0000'; // don't know the high code point, will need to test every character } else { try { // Get the substring after the Mime names final String highVal = val.substring(len).trim(); highChar = (char) Integer.decode(highVal).intValue(); } catch( NumberFormatException e) { highChar = 0; } String mimeNames = val.substring(0, len); StringTokenizer st = new StringTokenizer(mimeNames, ","); for (boolean first = true; st.hasMoreTokens(); first = false) { mimeName = st.nextToken(); EncodingInfo ei = new EncodingInfo(mimeName, javaName, highChar); encodingInfo_list.add(ei); _encodingTableKeyMime.put(mimeName.toUpperCase(), ei); if (first) _encodingTableKeyJava.put(javaName.toUpperCase(), ei); } } } // Convert the Vector of EncodingInfo objects into an array of them, // as that is the kind of thing this method returns. EncodingInfo[] ret_ei = new EncodingInfo[encodingInfo_list.size()]; encodingInfo_list.toArray(ret_ei); return ret_ei; } catch (java.net.MalformedURLException mue) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(mue); } catch (java.io.IOException ioe) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(ioe); } } /** * Get the length of the Mime names within the property value * @param val The value of the property, which should contain a comma * separated list of Mime names, followed optionally by a space and the * high char value * @return */ private static int lengthOfMimeNames(String val) { // look for the space preceding the optional high char int len = val.indexOf(' '); // If len is zero it means the optional part is not there, so // the value must be all Mime names, so set the length appropriately if (len < 0) len = val.length(); return len; } /** * Return true if the character is the high member of a surrogate pair. *

    * This is not a public API. * @param ch the character to test * @xsl.usage internal */ static boolean isHighUTF16Surrogate(char ch) { return ('\uD800' <= ch && ch <= '\uDBFF'); } /** * Return true if the character is the low member of a surrogate pair. *

    * This is not a public API. * @param ch the character to test * @xsl.usage internal */ static boolean isLowUTF16Surrogate(char ch) { return ('\uDC00' <= ch && ch <= '\uDFFF'); } /** * Return the unicode code point represented by the high/low surrogate pair. *

    * This is not a public API. * @param highSurrogate the high char of the high/low pair * @param lowSurrogate the low char of the high/low pair * @xsl.usage internal */ static int toCodePoint(char highSurrogate, char lowSurrogate) { int codePoint = ((highSurrogate - 0xd800) << 10) + (lowSurrogate - 0xdc00) + 0x10000; return codePoint; } /** * Return the unicode code point represented by the char. * A bit of a dummy method, since all it does is return the char, * but as an int value. *

    * This is not a public API. * @param ch the char. * @xsl.usage internal */ static int toCodePoint(char ch) { int codePoint = ch; return codePoint; } /** * Characters with values at or below the high code point are * in the encoding. Code point values above this one may or may * not be in the encoding, but lower ones certainly are. *

    * This is for performance. * * @param encoding The encoding * @return The code point for which characters at or below this code point * are in the encoding. Characters with higher code point may or may not be * in the encoding. A value of zero is returned if the high code point is unknown. *

    * This method is not a public API. * @xsl.usage internal */ static public char getHighChar(String encoding) { final char highCodePoint; EncodingInfo ei; String normalizedEncoding = toUpperCaseFast(encoding); ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding); if (ei == null) ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding); if (ei != null) highCodePoint = ei.getHighChar(); else highCodePoint = 0; return highCodePoint; } private static final Hashtable _encodingTableKeyJava = new Hashtable(); private static final Hashtable _encodingTableKeyMime = new Hashtable(); private static final EncodingInfo[] _encodings = loadEncodingInfo(); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/TransformStateSetter.java0000644000175000017500000000332310721374033026057 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformStateSetter.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import javax.xml.transform.Transformer; import org.w3c.dom.Node; /** * This interface is meant to be used by a base interface to * TransformState, but which as only the setters which have non Xalan * specific types in their signature, so that there are no dependancies * of the serializer on Xalan. * * This interface is not a public API, it is only public because it is * used by Xalan. * * @see org.apache.xalan.transformer.TransformState * @xsl.usage internal */ public interface TransformStateSetter { /** * Set the current node. * * @param n The current node. */ void setCurrentNode(Node n); /** * Reset the state on the given transformer object. * * @param transformer */ void resetState(Transformer transformer); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ElemDesc.java0000644000175000017500000001332110721374033023374 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemDesc.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import org.apache.xml.serializer.utils.StringToIntTable; /** * This class has a series of flags (bit values) that describe an HTML element *

    * This class is not a public API. * It is public because it is used outside of this package. * * @xsl.usage internal */ public final class ElemDesc { /** Bit flags to tell about this element type. */ private int m_flags; /** * Table of attribute names to integers, which contain bit flags telling about * the attributes. */ private StringToIntTable m_attrs = null; /** Bit position if this element type is empty. */ static final int EMPTY = (1 << 1); /** Bit position if this element type is a flow. */ private static final int FLOW = (1 << 2); /** Bit position if this element type is a block. */ static final int BLOCK = (1 << 3); /** Bit position if this element type is a block form. */ static final int BLOCKFORM = (1 << 4); /** Bit position if this element type is a block form field set. */ static final int BLOCKFORMFIELDSET = (1 << 5); /** Bit position if this element type is CDATA. */ private static final int CDATA = (1 << 6); /** Bit position if this element type is PCDATA. */ private static final int PCDATA = (1 << 7); /** Bit position if this element type is should be raw characters. */ static final int RAW = (1 << 8); /** Bit position if this element type should be inlined. */ private static final int INLINE = (1 << 9); /** Bit position if this element type is INLINEA. */ private static final int INLINEA = (1 << 10); /** Bit position if this element type is an inline label. */ static final int INLINELABEL = (1 << 11); /** Bit position if this element type is a font style. */ static final int FONTSTYLE = (1 << 12); /** Bit position if this element type is a phrase. */ static final int PHRASE = (1 << 13); /** Bit position if this element type is a form control. */ static final int FORMCTRL = (1 << 14); /** Bit position if this element type is ???. */ static final int SPECIAL = (1 << 15); /** Bit position if this element type is ???. */ static final int ASPECIAL = (1 << 16); /** Bit position if this element type is an odd header element. */ static final int HEADMISC = (1 << 17); /** Bit position if this element type is a head element (i.e. H1, H2, etc.) */ static final int HEAD = (1 << 18); /** Bit position if this element type is a list. */ static final int LIST = (1 << 19); /** Bit position if this element type is a preformatted type. */ static final int PREFORMATTED = (1 << 20); /** Bit position if this element type is whitespace sensitive. */ static final int WHITESPACESENSITIVE = (1 << 21); /** Bit position if this element type is a header element (i.e. HEAD). */ static final int HEADELEM = (1 << 22); /** Bit position if this element is the "HTML" element */ static final int HTMLELEM = (1 << 23); /** Bit position if this attribute type is a URL. */ public static final int ATTRURL = (1 << 1); /** Bit position if this attribute type is an empty type. */ public static final int ATTREMPTY = (1 << 2); /** * Construct an ElemDesc from a set of bit flags. * * * @param flags Bit flags that describe the basic properties of this element type. */ ElemDesc(int flags) { m_flags = flags; } /** * Tell if this element type has the basic bit properties that are passed * as an argument. * * @param flags Bit flags that describe the basic properties of interest. * * @return true if any of the flag bits are true. */ private boolean is(int flags) { // int which = (m_flags & flags); return (m_flags & flags) != 0; } int getFlags() { return m_flags; } /** * Set an attribute name and it's bit properties. * * * @param name non-null name of attribute, in upper case. * @param flags flag bits. */ void setAttr(String name, int flags) { if (null == m_attrs) m_attrs = new StringToIntTable(); m_attrs.put(name, flags); } /** * Tell if any of the bits of interest are set for a named attribute type. * * @param name non-null reference to attribute name, in any case. * @param flags flag mask. * * @return true if any of the flags are set for the named attribute. */ public boolean isAttrFlagSet(String name, int flags) { return (null != m_attrs) ? ((m_attrs.getIgnoreCase(name) & flags) != 0) : false; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/output_html.properties0000644000175000017500000000353510721374033025560 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: output_html.properties 468654 2006-10-28 07:09:23Z minchau $ # # Specify defaults when method="html". These defaults use output_xml.properties # as a base. # # XSLT properties do not need namespace qualification. method=html indent=yes media-type=text/html version=4.0 # Xalan-specific output properties. These can be overridden in the stylesheet # assigning a xalan namespace. For example: # # # ... # Note that the colon after the protocol needs to be escaped. {http\u003a//xml.apache.org/xalan}indent-amount=0 {http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToHTMLStream {http\u003a//xml.apache.org/xalan}entities=org/apache/xml/serializer/HTMLEntities {http\u003a//xml.apache.org/xalan}use-url-escaping=yes {http\u003a//xml.apache.org/xalan}omit-meta-tag=no libxalan2-java-2.7.1/src/org/apache/xml/serializer/HTMLEntities.properties0000644000175000017500000001105710721374031025441 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: HTMLEntities.properties 468654 2006-10-28 07:09:23Z minchau $ # # @version $Revision$ $Date: 2006-10-28 03:09:23 -0400 (Sat, 28 Oct 2006) $ # This file must be encoded in UTF-8; see CharInfo.java # # Character entity references for markup-significant # quot=34 amp=38 lt=60 gt=62 nbsp=160 # # Character entity references for ISO 8859-1 characters # iexcl=161 cent=162 pound=163 curren=164 yen=165 brvbar=166 sect=167 uml=168 copy=169 ordf=170 laquo=171 not=172 shy=173 reg=174 macr=175 deg=176 plusmn=177 sup2=178 sup3=179 acute=180 micro=181 para=182 middot=183 cedil=184 sup1=185 ordm=186 raquo=187 frac14=188 frac12=189 frac34=190 iquest=191 Agrave=192 Aacute=193 Acirc=194 Atilde=195 Auml=196 Aring=197 AElig=198 Ccedil=199 Egrave=200 Eacute=201 Ecirc=202 Euml=203 Igrave=204 Iacute=205 Icirc=206 Iuml=207 ETH=208 Ntilde=209 Ograve=210 Oacute=211 Ocirc=212 Otilde=213 Ouml=214 times=215 Oslash=216 Ugrave=217 Uacute=218 Ucirc=219 Uuml=220 Yacute=221 THORN=222 szlig=223 agrave=224 aacute=225 acirc=226 atilde=227 auml=228 aring=229 aelig=230 ccedil=231 egrave=232 eacute=233 ecirc=234 euml=235 igrave=236 iacute=237 icirc=238 iuml=239 eth=240 ntilde=241 ograve=242 oacute=243 ocirc=244 otilde=245 ouml=246 divide=247 oslash=248 ugrave=249 uacute=250 ucirc=251 uuml=252 yacute=253 thorn=254 yuml=255 # # Character entity references for symbols, mathematical symbols, and Greek letters # # Latin Extended -- Netscape can't handle # fnof 402 # # Greek - Netscape can't handle these # Alpha 913 # Beta 914 # Gamma 915 # Delta 916 # Epsilon 917 # Zeta 918 # Eta 919 # Theta 920 # Iota 921 # Kappa 922 # Lambda 923 # Mu 924 # Nu 925 # Xi 926 # Omicron 927 # Pi 928 # Rho 929 # Sigma 931 # Tau 932 # Upsilon 933 # Phi 934 # Chi 935 # Psi 936 # Omega 937 # alpha 945 # beta 946 # gamma 947 # delta 948 # epsilon 949 # zeta 950 # eta 951 # theta 952 # iota 953 # kappa 954 # lambda 955 # mu 956 # nu 957 # xi 958 # omicron 959 # pi 960 # rho 961 # sigmaf 962 # sigma 963 # tau 964 # upsilon 965 # phi 966 # chi 967 # psi 968 # omega 969 # thetasym 977 # upsih 978 # piv 982 # # General Punctuation bull=8226 hellip=8230 prime=8242 Prime=8243 oline=8254 frasl=8260 # # Letterlike Symbols weierp=8472 image=8465 real=8476 trade=8482 alefsym=8501 # # Arrows larr=8592 uarr=8593 rarr=8594 darr=8595 harr=8596 crarr=8629 lArr=8656 uArr=8657 rArr=8658 dArr=8659 hArr=8660 # # Mathematical Operators forall=8704 part=8706 exist=8707 empty=8709 nabla=8711 isin=8712 notin=8713 ni=8715 prod=8719 sum=8721 minus=8722 lowast=8727 radic=8730 prop=8733 infin=8734 ang=8736 and=8743 or=8744 cap=8745 cup=8746 int=8747 there4=8756 sim=8764 cong=8773 asymp=8776 ne=8800 equiv=8801 le=8804 ge=8805 sub=8834 sup=8835 nsub=8836 sube=8838 supe=8839 oplus=8853 otimes=8855 perp=8869 sdot=8901 # # Miscellaneous Technical lceil=8968 rceil=8969 lfloor=8970 rfloor=8971 lang=9001 rang=9002 # # Geometric Shapes loz=9674 # # Miscellaneous Symbols spades=9824 clubs=9827 hearts=9829 diams=9830 # # Character entity references for internationalization characters # # Latin Extended-A # Netscape can't handle! # OElig 338 # oelig 339 #-- NN 4.7 does not seem to support these, so they might ought to be commented. # Scaron 352 # scaron 353 # Yuml 376 # # Spacing Modifier Letters -- Netscape can't handle # circ 710 # tilde 732 # # General Punctuation ensp=8194 emsp=8195 thinsp=8201 zwnj=8204 zwj=8205 lrm=8206 rlm=8207 ndash=8211 mdash=8212 lsquo=8216 rsquo=8217 sbquo=8218 ldquo=8220 rdquo=8221 bdquo=8222 dagger=8224 Dagger=8225 permil=8240 lsaquo=8249 rsaquo=8250 euro=8364 libxalan2-java-2.7.1/src/org/apache/xml/serializer/SerializerConstants.java0000644000175000017500000000414010721374030025715 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerConstants.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; /** * Constants used in serialization, such as the string "xmlns" * @xsl.usage internal */ interface SerializerConstants { /** To insert ]]> in a CDATA section by ending the last CDATA section with * ]] and starting the next CDATA section with > */ static final String CDATA_CONTINUE = "]]]]>"; /** * The constant "]]>" */ static final String CDATA_DELIMITER_CLOSE = "]]>"; static final String CDATA_DELIMITER_OPEN = " 0) { char[] chars = new char[count]; for(int i=0; i Subclasses that intend to support efficient single-character output * should override this method. * * @param c int specifying a character to be written. * @exception IOException If an I/O error occurs */ public void write(final int c) throws IOException { // send to the real writer if (m_writer != null) m_writer.write(c); // ---------- from here on just collect for tracing purposes /* If we are close to the end of the buffer then flush it. * Remember the buffer can hold a few more characters than buf_length */ if (count >= buf_length) flushBuffer(); if (c < 0x80) { buf[count++] = (byte) (c); } else if (c < 0x800) { buf[count++] = (byte) (0xc0 + (c >> 6)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } else { buf[count++] = (byte) (0xe0 + (c >> 12)); buf[count++] = (byte) (0x80 + ((c >> 6) & 0x3f)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } } /** * Write a portion of an array of characters. * * @param chars Array of characters * @param start Offset from which to start writing characters * @param length Number of characters to write * * @exception IOException If an I/O error occurs * * @throws java.io.IOException */ public void write(final char chars[], final int start, final int length) throws java.io.IOException { // send to the real writer if (m_writer != null) m_writer.write(chars, start, length); // from here on just collect for tracing purposes int lengthx3 = (length << 1) + length; if (lengthx3 >= buf_length) { /* If the request length exceeds the size of the output buffer, * flush the output buffer and make the buffer bigger to handle. */ flushBuffer(); setBufferSize(2 * lengthx3); } if (lengthx3 > buf_length - count) { flushBuffer(); } final int n = length + start; for (int i = start; i < n; i++) { final char c = chars[i]; if (c < 0x80) buf[count++] = (byte) (c); else if (c < 0x800) { buf[count++] = (byte) (0xc0 + (c >> 6)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } else { buf[count++] = (byte) (0xe0 + (c >> 12)); buf[count++] = (byte) (0x80 + ((c >> 6) & 0x3f)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } } } /** * Write a string. * * @param s String to be written * * @exception IOException If an I/O error occurs */ public void write(final String s) throws IOException { // send to the real writer if (m_writer != null) m_writer.write(s); // from here on just collect for tracing purposes final int length = s.length(); // We multiply the length by three since this is the maximum length // of the characters that we can put into the buffer. It is possible // for each Unicode character to expand to three bytes. int lengthx3 = (length << 1) + length; if (lengthx3 >= buf_length) { /* If the request length exceeds the size of the output buffer, * flush the output buffer and make the buffer bigger to handle. */ flushBuffer(); setBufferSize(2 * lengthx3); } if (lengthx3 > buf_length - count) { flushBuffer(); } for (int i = 0; i < length; i++) { final char c = s.charAt(i); if (c < 0x80) buf[count++] = (byte) (c); else if (c < 0x800) { buf[count++] = (byte) (0xc0 + (c >> 6)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } else { buf[count++] = (byte) (0xe0 + (c >> 12)); buf[count++] = (byte) (0x80 + ((c >> 6) & 0x3f)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } } } /** * Get the writer that this one directly wraps. */ public Writer getWriter() { return m_writer; } /** * Get the OutputStream that is the at the end of the * chain of writers. */ public OutputStream getOutputStream() { OutputStream retval = null; if (m_writer instanceof WriterChain) retval = ((WriterChain) m_writer).getOutputStream(); return retval; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/0000755000175000017500000000000010736146354022221 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/XMLChar.java0000644000175000017500000014631210721374033024320 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xml.serializer.utils; import java.util.Arrays; /** * THIS IS A COPY OF THE XERCES-2J CLASS org.apache.xerces.utls.XMLChar * * This class defines the basic XML character properties. The data * in this class can be used to verify that a character is a valid * XML character or if the character is a space, name start, or name * character. *

    * A series of convenience methods are supplied to ease the burden * of the developer. Because inlining the checks can improve per * character performance, the tables of character properties are * public. Using the character as an index into the CHARS * array and applying the appropriate mask flag (e.g. * MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments * for the isValid method for details. * * @author Glenn Marcy, IBM * @author Andy Clark, IBM * @author Eric Ye, IBM * @author Arnaud Le Hors, IBM * @author Michael Glavassevich, IBM * @author Rahul Srivastava, Sun Microsystems Inc. * * @version $Id: $ */ public class XMLChar { // // Constants // /** Character flags. */ private static final byte[] CHARS = new byte[1 << 16]; /** Valid character mask. */ public static final int MASK_VALID = 0x01; /** Space character mask. */ public static final int MASK_SPACE = 0x02; /** Name start character mask. */ public static final int MASK_NAME_START = 0x04; /** Name character mask. */ public static final int MASK_NAME = 0x08; /** Pubid character mask. */ public static final int MASK_PUBID = 0x10; /** * Content character mask. Special characters are those that can * be considered the start of markup, such as '<' and '&'. * The various newline characters are considered special as well. * All other valid XML characters can be considered content. *

    * This is an optimization for the inner loop of character scanning. */ public static final int MASK_CONTENT = 0x20; /** NCName start character mask. */ public static final int MASK_NCNAME_START = 0x40; /** NCName character mask. */ public static final int MASK_NCNAME = 0x80; // // Static initialization // static { // Initializing the Character Flag Array // Code generated by: XMLCharGenerator. CHARS[9] = 35; CHARS[10] = 19; CHARS[13] = 19; CHARS[32] = 51; CHARS[33] = 49; CHARS[34] = 33; Arrays.fill(CHARS, 35, 38, (byte) 49 ); // Fill 3 of value (byte) 49 CHARS[38] = 1; Arrays.fill(CHARS, 39, 45, (byte) 49 ); // Fill 6 of value (byte) 49 Arrays.fill(CHARS, 45, 47, (byte) -71 ); // Fill 2 of value (byte) -71 CHARS[47] = 49; Arrays.fill(CHARS, 48, 58, (byte) -71 ); // Fill 10 of value (byte) -71 CHARS[58] = 61; CHARS[59] = 49; CHARS[60] = 1; CHARS[61] = 49; CHARS[62] = 33; Arrays.fill(CHARS, 63, 65, (byte) 49 ); // Fill 2 of value (byte) 49 Arrays.fill(CHARS, 65, 91, (byte) -3 ); // Fill 26 of value (byte) -3 Arrays.fill(CHARS, 91, 93, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[93] = 1; CHARS[94] = 33; CHARS[95] = -3; CHARS[96] = 33; Arrays.fill(CHARS, 97, 123, (byte) -3 ); // Fill 26 of value (byte) -3 Arrays.fill(CHARS, 123, 183, (byte) 33 ); // Fill 60 of value (byte) 33 CHARS[183] = -87; Arrays.fill(CHARS, 184, 192, (byte) 33 ); // Fill 8 of value (byte) 33 Arrays.fill(CHARS, 192, 215, (byte) -19 ); // Fill 23 of value (byte) -19 CHARS[215] = 33; Arrays.fill(CHARS, 216, 247, (byte) -19 ); // Fill 31 of value (byte) -19 CHARS[247] = 33; Arrays.fill(CHARS, 248, 306, (byte) -19 ); // Fill 58 of value (byte) -19 Arrays.fill(CHARS, 306, 308, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 308, 319, (byte) -19 ); // Fill 11 of value (byte) -19 Arrays.fill(CHARS, 319, 321, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 321, 329, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[329] = 33; Arrays.fill(CHARS, 330, 383, (byte) -19 ); // Fill 53 of value (byte) -19 CHARS[383] = 33; Arrays.fill(CHARS, 384, 452, (byte) -19 ); // Fill 68 of value (byte) -19 Arrays.fill(CHARS, 452, 461, (byte) 33 ); // Fill 9 of value (byte) 33 Arrays.fill(CHARS, 461, 497, (byte) -19 ); // Fill 36 of value (byte) -19 Arrays.fill(CHARS, 497, 500, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 500, 502, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 502, 506, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 506, 536, (byte) -19 ); // Fill 30 of value (byte) -19 Arrays.fill(CHARS, 536, 592, (byte) 33 ); // Fill 56 of value (byte) 33 Arrays.fill(CHARS, 592, 681, (byte) -19 ); // Fill 89 of value (byte) -19 Arrays.fill(CHARS, 681, 699, (byte) 33 ); // Fill 18 of value (byte) 33 Arrays.fill(CHARS, 699, 706, (byte) -19 ); // Fill 7 of value (byte) -19 Arrays.fill(CHARS, 706, 720, (byte) 33 ); // Fill 14 of value (byte) 33 Arrays.fill(CHARS, 720, 722, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 722, 768, (byte) 33 ); // Fill 46 of value (byte) 33 Arrays.fill(CHARS, 768, 838, (byte) -87 ); // Fill 70 of value (byte) -87 Arrays.fill(CHARS, 838, 864, (byte) 33 ); // Fill 26 of value (byte) 33 Arrays.fill(CHARS, 864, 866, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 866, 902, (byte) 33 ); // Fill 36 of value (byte) 33 CHARS[902] = -19; CHARS[903] = -87; Arrays.fill(CHARS, 904, 907, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[907] = 33; CHARS[908] = -19; CHARS[909] = 33; Arrays.fill(CHARS, 910, 930, (byte) -19 ); // Fill 20 of value (byte) -19 CHARS[930] = 33; Arrays.fill(CHARS, 931, 975, (byte) -19 ); // Fill 44 of value (byte) -19 CHARS[975] = 33; Arrays.fill(CHARS, 976, 983, (byte) -19 ); // Fill 7 of value (byte) -19 Arrays.fill(CHARS, 983, 986, (byte) 33 ); // Fill 3 of value (byte) 33 CHARS[986] = -19; CHARS[987] = 33; CHARS[988] = -19; CHARS[989] = 33; CHARS[990] = -19; CHARS[991] = 33; CHARS[992] = -19; CHARS[993] = 33; Arrays.fill(CHARS, 994, 1012, (byte) -19 ); // Fill 18 of value (byte) -19 Arrays.fill(CHARS, 1012, 1025, (byte) 33 ); // Fill 13 of value (byte) 33 Arrays.fill(CHARS, 1025, 1037, (byte) -19 ); // Fill 12 of value (byte) -19 CHARS[1037] = 33; Arrays.fill(CHARS, 1038, 1104, (byte) -19 ); // Fill 66 of value (byte) -19 CHARS[1104] = 33; Arrays.fill(CHARS, 1105, 1117, (byte) -19 ); // Fill 12 of value (byte) -19 CHARS[1117] = 33; Arrays.fill(CHARS, 1118, 1154, (byte) -19 ); // Fill 36 of value (byte) -19 CHARS[1154] = 33; Arrays.fill(CHARS, 1155, 1159, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 1159, 1168, (byte) 33 ); // Fill 9 of value (byte) 33 Arrays.fill(CHARS, 1168, 1221, (byte) -19 ); // Fill 53 of value (byte) -19 Arrays.fill(CHARS, 1221, 1223, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 1223, 1225, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 1225, 1227, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 1227, 1229, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 1229, 1232, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 1232, 1260, (byte) -19 ); // Fill 28 of value (byte) -19 Arrays.fill(CHARS, 1260, 1262, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 1262, 1270, (byte) -19 ); // Fill 8 of value (byte) -19 Arrays.fill(CHARS, 1270, 1272, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 1272, 1274, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 1274, 1329, (byte) 33 ); // Fill 55 of value (byte) 33 Arrays.fill(CHARS, 1329, 1367, (byte) -19 ); // Fill 38 of value (byte) -19 Arrays.fill(CHARS, 1367, 1369, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[1369] = -19; Arrays.fill(CHARS, 1370, 1377, (byte) 33 ); // Fill 7 of value (byte) 33 Arrays.fill(CHARS, 1377, 1415, (byte) -19 ); // Fill 38 of value (byte) -19 Arrays.fill(CHARS, 1415, 1425, (byte) 33 ); // Fill 10 of value (byte) 33 Arrays.fill(CHARS, 1425, 1442, (byte) -87 ); // Fill 17 of value (byte) -87 CHARS[1442] = 33; Arrays.fill(CHARS, 1443, 1466, (byte) -87 ); // Fill 23 of value (byte) -87 CHARS[1466] = 33; Arrays.fill(CHARS, 1467, 1470, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[1470] = 33; CHARS[1471] = -87; CHARS[1472] = 33; Arrays.fill(CHARS, 1473, 1475, (byte) -87 ); // Fill 2 of value (byte) -87 CHARS[1475] = 33; CHARS[1476] = -87; Arrays.fill(CHARS, 1477, 1488, (byte) 33 ); // Fill 11 of value (byte) 33 Arrays.fill(CHARS, 1488, 1515, (byte) -19 ); // Fill 27 of value (byte) -19 Arrays.fill(CHARS, 1515, 1520, (byte) 33 ); // Fill 5 of value (byte) 33 Arrays.fill(CHARS, 1520, 1523, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 1523, 1569, (byte) 33 ); // Fill 46 of value (byte) 33 Arrays.fill(CHARS, 1569, 1595, (byte) -19 ); // Fill 26 of value (byte) -19 Arrays.fill(CHARS, 1595, 1600, (byte) 33 ); // Fill 5 of value (byte) 33 CHARS[1600] = -87; Arrays.fill(CHARS, 1601, 1611, (byte) -19 ); // Fill 10 of value (byte) -19 Arrays.fill(CHARS, 1611, 1619, (byte) -87 ); // Fill 8 of value (byte) -87 Arrays.fill(CHARS, 1619, 1632, (byte) 33 ); // Fill 13 of value (byte) 33 Arrays.fill(CHARS, 1632, 1642, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 1642, 1648, (byte) 33 ); // Fill 6 of value (byte) 33 CHARS[1648] = -87; Arrays.fill(CHARS, 1649, 1720, (byte) -19 ); // Fill 71 of value (byte) -19 Arrays.fill(CHARS, 1720, 1722, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 1722, 1727, (byte) -19 ); // Fill 5 of value (byte) -19 CHARS[1727] = 33; Arrays.fill(CHARS, 1728, 1743, (byte) -19 ); // Fill 15 of value (byte) -19 CHARS[1743] = 33; Arrays.fill(CHARS, 1744, 1748, (byte) -19 ); // Fill 4 of value (byte) -19 CHARS[1748] = 33; CHARS[1749] = -19; Arrays.fill(CHARS, 1750, 1765, (byte) -87 ); // Fill 15 of value (byte) -87 Arrays.fill(CHARS, 1765, 1767, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 1767, 1769, (byte) -87 ); // Fill 2 of value (byte) -87 CHARS[1769] = 33; Arrays.fill(CHARS, 1770, 1774, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 1774, 1776, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 1776, 1786, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 1786, 2305, (byte) 33 ); // Fill 519 of value (byte) 33 Arrays.fill(CHARS, 2305, 2308, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[2308] = 33; Arrays.fill(CHARS, 2309, 2362, (byte) -19 ); // Fill 53 of value (byte) -19 Arrays.fill(CHARS, 2362, 2364, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[2364] = -87; CHARS[2365] = -19; Arrays.fill(CHARS, 2366, 2382, (byte) -87 ); // Fill 16 of value (byte) -87 Arrays.fill(CHARS, 2382, 2385, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2385, 2389, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 2389, 2392, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2392, 2402, (byte) -19 ); // Fill 10 of value (byte) -19 Arrays.fill(CHARS, 2402, 2404, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 2404, 2406, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2406, 2416, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 2416, 2433, (byte) 33 ); // Fill 17 of value (byte) 33 Arrays.fill(CHARS, 2433, 2436, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[2436] = 33; Arrays.fill(CHARS, 2437, 2445, (byte) -19 ); // Fill 8 of value (byte) -19 Arrays.fill(CHARS, 2445, 2447, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2447, 2449, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2449, 2451, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2451, 2473, (byte) -19 ); // Fill 22 of value (byte) -19 CHARS[2473] = 33; Arrays.fill(CHARS, 2474, 2481, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[2481] = 33; CHARS[2482] = -19; Arrays.fill(CHARS, 2483, 2486, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2486, 2490, (byte) -19 ); // Fill 4 of value (byte) -19 Arrays.fill(CHARS, 2490, 2492, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[2492] = -87; CHARS[2493] = 33; Arrays.fill(CHARS, 2494, 2501, (byte) -87 ); // Fill 7 of value (byte) -87 Arrays.fill(CHARS, 2501, 2503, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2503, 2505, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 2505, 2507, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2507, 2510, (byte) -87 ); // Fill 3 of value (byte) -87 Arrays.fill(CHARS, 2510, 2519, (byte) 33 ); // Fill 9 of value (byte) 33 CHARS[2519] = -87; Arrays.fill(CHARS, 2520, 2524, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 2524, 2526, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[2526] = 33; Arrays.fill(CHARS, 2527, 2530, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 2530, 2532, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 2532, 2534, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2534, 2544, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 2544, 2546, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2546, 2562, (byte) 33 ); // Fill 16 of value (byte) 33 CHARS[2562] = -87; Arrays.fill(CHARS, 2563, 2565, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2565, 2571, (byte) -19 ); // Fill 6 of value (byte) -19 Arrays.fill(CHARS, 2571, 2575, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 2575, 2577, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2577, 2579, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2579, 2601, (byte) -19 ); // Fill 22 of value (byte) -19 CHARS[2601] = 33; Arrays.fill(CHARS, 2602, 2609, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[2609] = 33; Arrays.fill(CHARS, 2610, 2612, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[2612] = 33; Arrays.fill(CHARS, 2613, 2615, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[2615] = 33; Arrays.fill(CHARS, 2616, 2618, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2618, 2620, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[2620] = -87; CHARS[2621] = 33; Arrays.fill(CHARS, 2622, 2627, (byte) -87 ); // Fill 5 of value (byte) -87 Arrays.fill(CHARS, 2627, 2631, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 2631, 2633, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 2633, 2635, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2635, 2638, (byte) -87 ); // Fill 3 of value (byte) -87 Arrays.fill(CHARS, 2638, 2649, (byte) 33 ); // Fill 11 of value (byte) 33 Arrays.fill(CHARS, 2649, 2653, (byte) -19 ); // Fill 4 of value (byte) -19 CHARS[2653] = 33; CHARS[2654] = -19; Arrays.fill(CHARS, 2655, 2662, (byte) 33 ); // Fill 7 of value (byte) 33 Arrays.fill(CHARS, 2662, 2674, (byte) -87 ); // Fill 12 of value (byte) -87 Arrays.fill(CHARS, 2674, 2677, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 2677, 2689, (byte) 33 ); // Fill 12 of value (byte) 33 Arrays.fill(CHARS, 2689, 2692, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[2692] = 33; Arrays.fill(CHARS, 2693, 2700, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[2700] = 33; CHARS[2701] = -19; CHARS[2702] = 33; Arrays.fill(CHARS, 2703, 2706, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[2706] = 33; Arrays.fill(CHARS, 2707, 2729, (byte) -19 ); // Fill 22 of value (byte) -19 CHARS[2729] = 33; Arrays.fill(CHARS, 2730, 2737, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[2737] = 33; Arrays.fill(CHARS, 2738, 2740, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[2740] = 33; Arrays.fill(CHARS, 2741, 2746, (byte) -19 ); // Fill 5 of value (byte) -19 Arrays.fill(CHARS, 2746, 2748, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[2748] = -87; CHARS[2749] = -19; Arrays.fill(CHARS, 2750, 2758, (byte) -87 ); // Fill 8 of value (byte) -87 CHARS[2758] = 33; Arrays.fill(CHARS, 2759, 2762, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[2762] = 33; Arrays.fill(CHARS, 2763, 2766, (byte) -87 ); // Fill 3 of value (byte) -87 Arrays.fill(CHARS, 2766, 2784, (byte) 33 ); // Fill 18 of value (byte) 33 CHARS[2784] = -19; Arrays.fill(CHARS, 2785, 2790, (byte) 33 ); // Fill 5 of value (byte) 33 Arrays.fill(CHARS, 2790, 2800, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 2800, 2817, (byte) 33 ); // Fill 17 of value (byte) 33 Arrays.fill(CHARS, 2817, 2820, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[2820] = 33; Arrays.fill(CHARS, 2821, 2829, (byte) -19 ); // Fill 8 of value (byte) -19 Arrays.fill(CHARS, 2829, 2831, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2831, 2833, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2833, 2835, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2835, 2857, (byte) -19 ); // Fill 22 of value (byte) -19 CHARS[2857] = 33; Arrays.fill(CHARS, 2858, 2865, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[2865] = 33; Arrays.fill(CHARS, 2866, 2868, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2868, 2870, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2870, 2874, (byte) -19 ); // Fill 4 of value (byte) -19 Arrays.fill(CHARS, 2874, 2876, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[2876] = -87; CHARS[2877] = -19; Arrays.fill(CHARS, 2878, 2884, (byte) -87 ); // Fill 6 of value (byte) -87 Arrays.fill(CHARS, 2884, 2887, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2887, 2889, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 2889, 2891, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 2891, 2894, (byte) -87 ); // Fill 3 of value (byte) -87 Arrays.fill(CHARS, 2894, 2902, (byte) 33 ); // Fill 8 of value (byte) 33 Arrays.fill(CHARS, 2902, 2904, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 2904, 2908, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 2908, 2910, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[2910] = 33; Arrays.fill(CHARS, 2911, 2914, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 2914, 2918, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 2918, 2928, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 2928, 2946, (byte) 33 ); // Fill 18 of value (byte) 33 Arrays.fill(CHARS, 2946, 2948, (byte) -87 ); // Fill 2 of value (byte) -87 CHARS[2948] = 33; Arrays.fill(CHARS, 2949, 2955, (byte) -19 ); // Fill 6 of value (byte) -19 Arrays.fill(CHARS, 2955, 2958, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2958, 2961, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[2961] = 33; Arrays.fill(CHARS, 2962, 2966, (byte) -19 ); // Fill 4 of value (byte) -19 Arrays.fill(CHARS, 2966, 2969, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2969, 2971, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[2971] = 33; CHARS[2972] = -19; CHARS[2973] = 33; Arrays.fill(CHARS, 2974, 2976, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2976, 2979, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2979, 2981, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 2981, 2984, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2984, 2987, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 2987, 2990, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 2990, 2998, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[2998] = 33; Arrays.fill(CHARS, 2999, 3002, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 3002, 3006, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3006, 3011, (byte) -87 ); // Fill 5 of value (byte) -87 Arrays.fill(CHARS, 3011, 3014, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 3014, 3017, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[3017] = 33; Arrays.fill(CHARS, 3018, 3022, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 3022, 3031, (byte) 33 ); // Fill 9 of value (byte) 33 CHARS[3031] = -87; Arrays.fill(CHARS, 3032, 3047, (byte) 33 ); // Fill 15 of value (byte) 33 Arrays.fill(CHARS, 3047, 3056, (byte) -87 ); // Fill 9 of value (byte) -87 Arrays.fill(CHARS, 3056, 3073, (byte) 33 ); // Fill 17 of value (byte) 33 Arrays.fill(CHARS, 3073, 3076, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[3076] = 33; Arrays.fill(CHARS, 3077, 3085, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[3085] = 33; Arrays.fill(CHARS, 3086, 3089, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[3089] = 33; Arrays.fill(CHARS, 3090, 3113, (byte) -19 ); // Fill 23 of value (byte) -19 CHARS[3113] = 33; Arrays.fill(CHARS, 3114, 3124, (byte) -19 ); // Fill 10 of value (byte) -19 CHARS[3124] = 33; Arrays.fill(CHARS, 3125, 3130, (byte) -19 ); // Fill 5 of value (byte) -19 Arrays.fill(CHARS, 3130, 3134, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3134, 3141, (byte) -87 ); // Fill 7 of value (byte) -87 CHARS[3141] = 33; Arrays.fill(CHARS, 3142, 3145, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[3145] = 33; Arrays.fill(CHARS, 3146, 3150, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 3150, 3157, (byte) 33 ); // Fill 7 of value (byte) 33 Arrays.fill(CHARS, 3157, 3159, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 3159, 3168, (byte) 33 ); // Fill 9 of value (byte) 33 Arrays.fill(CHARS, 3168, 3170, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 3170, 3174, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3174, 3184, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 3184, 3202, (byte) 33 ); // Fill 18 of value (byte) 33 Arrays.fill(CHARS, 3202, 3204, (byte) -87 ); // Fill 2 of value (byte) -87 CHARS[3204] = 33; Arrays.fill(CHARS, 3205, 3213, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[3213] = 33; Arrays.fill(CHARS, 3214, 3217, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[3217] = 33; Arrays.fill(CHARS, 3218, 3241, (byte) -19 ); // Fill 23 of value (byte) -19 CHARS[3241] = 33; Arrays.fill(CHARS, 3242, 3252, (byte) -19 ); // Fill 10 of value (byte) -19 CHARS[3252] = 33; Arrays.fill(CHARS, 3253, 3258, (byte) -19 ); // Fill 5 of value (byte) -19 Arrays.fill(CHARS, 3258, 3262, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3262, 3269, (byte) -87 ); // Fill 7 of value (byte) -87 CHARS[3269] = 33; Arrays.fill(CHARS, 3270, 3273, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[3273] = 33; Arrays.fill(CHARS, 3274, 3278, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 3278, 3285, (byte) 33 ); // Fill 7 of value (byte) 33 Arrays.fill(CHARS, 3285, 3287, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 3287, 3294, (byte) 33 ); // Fill 7 of value (byte) 33 CHARS[3294] = -19; CHARS[3295] = 33; Arrays.fill(CHARS, 3296, 3298, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 3298, 3302, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3302, 3312, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 3312, 3330, (byte) 33 ); // Fill 18 of value (byte) 33 Arrays.fill(CHARS, 3330, 3332, (byte) -87 ); // Fill 2 of value (byte) -87 CHARS[3332] = 33; Arrays.fill(CHARS, 3333, 3341, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[3341] = 33; Arrays.fill(CHARS, 3342, 3345, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[3345] = 33; Arrays.fill(CHARS, 3346, 3369, (byte) -19 ); // Fill 23 of value (byte) -19 CHARS[3369] = 33; Arrays.fill(CHARS, 3370, 3386, (byte) -19 ); // Fill 16 of value (byte) -19 Arrays.fill(CHARS, 3386, 3390, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3390, 3396, (byte) -87 ); // Fill 6 of value (byte) -87 Arrays.fill(CHARS, 3396, 3398, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 3398, 3401, (byte) -87 ); // Fill 3 of value (byte) -87 CHARS[3401] = 33; Arrays.fill(CHARS, 3402, 3406, (byte) -87 ); // Fill 4 of value (byte) -87 Arrays.fill(CHARS, 3406, 3415, (byte) 33 ); // Fill 9 of value (byte) 33 CHARS[3415] = -87; Arrays.fill(CHARS, 3416, 3424, (byte) 33 ); // Fill 8 of value (byte) 33 Arrays.fill(CHARS, 3424, 3426, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 3426, 3430, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3430, 3440, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 3440, 3585, (byte) 33 ); // Fill 145 of value (byte) 33 Arrays.fill(CHARS, 3585, 3631, (byte) -19 ); // Fill 46 of value (byte) -19 CHARS[3631] = 33; CHARS[3632] = -19; CHARS[3633] = -87; Arrays.fill(CHARS, 3634, 3636, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 3636, 3643, (byte) -87 ); // Fill 7 of value (byte) -87 Arrays.fill(CHARS, 3643, 3648, (byte) 33 ); // Fill 5 of value (byte) 33 Arrays.fill(CHARS, 3648, 3654, (byte) -19 ); // Fill 6 of value (byte) -19 Arrays.fill(CHARS, 3654, 3663, (byte) -87 ); // Fill 9 of value (byte) -87 CHARS[3663] = 33; Arrays.fill(CHARS, 3664, 3674, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 3674, 3713, (byte) 33 ); // Fill 39 of value (byte) 33 Arrays.fill(CHARS, 3713, 3715, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[3715] = 33; CHARS[3716] = -19; Arrays.fill(CHARS, 3717, 3719, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 3719, 3721, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[3721] = 33; CHARS[3722] = -19; Arrays.fill(CHARS, 3723, 3725, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[3725] = -19; Arrays.fill(CHARS, 3726, 3732, (byte) 33 ); // Fill 6 of value (byte) 33 Arrays.fill(CHARS, 3732, 3736, (byte) -19 ); // Fill 4 of value (byte) -19 CHARS[3736] = 33; Arrays.fill(CHARS, 3737, 3744, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[3744] = 33; Arrays.fill(CHARS, 3745, 3748, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[3748] = 33; CHARS[3749] = -19; CHARS[3750] = 33; CHARS[3751] = -19; Arrays.fill(CHARS, 3752, 3754, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 3754, 3756, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[3756] = 33; Arrays.fill(CHARS, 3757, 3759, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[3759] = 33; CHARS[3760] = -19; CHARS[3761] = -87; Arrays.fill(CHARS, 3762, 3764, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 3764, 3770, (byte) -87 ); // Fill 6 of value (byte) -87 CHARS[3770] = 33; Arrays.fill(CHARS, 3771, 3773, (byte) -87 ); // Fill 2 of value (byte) -87 CHARS[3773] = -19; Arrays.fill(CHARS, 3774, 3776, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 3776, 3781, (byte) -19 ); // Fill 5 of value (byte) -19 CHARS[3781] = 33; CHARS[3782] = -87; CHARS[3783] = 33; Arrays.fill(CHARS, 3784, 3790, (byte) -87 ); // Fill 6 of value (byte) -87 Arrays.fill(CHARS, 3790, 3792, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 3792, 3802, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 3802, 3864, (byte) 33 ); // Fill 62 of value (byte) 33 Arrays.fill(CHARS, 3864, 3866, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 3866, 3872, (byte) 33 ); // Fill 6 of value (byte) 33 Arrays.fill(CHARS, 3872, 3882, (byte) -87 ); // Fill 10 of value (byte) -87 Arrays.fill(CHARS, 3882, 3893, (byte) 33 ); // Fill 11 of value (byte) 33 CHARS[3893] = -87; CHARS[3894] = 33; CHARS[3895] = -87; CHARS[3896] = 33; CHARS[3897] = -87; Arrays.fill(CHARS, 3898, 3902, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3902, 3904, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 3904, 3912, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[3912] = 33; Arrays.fill(CHARS, 3913, 3946, (byte) -19 ); // Fill 33 of value (byte) -19 Arrays.fill(CHARS, 3946, 3953, (byte) 33 ); // Fill 7 of value (byte) 33 Arrays.fill(CHARS, 3953, 3973, (byte) -87 ); // Fill 20 of value (byte) -87 CHARS[3973] = 33; Arrays.fill(CHARS, 3974, 3980, (byte) -87 ); // Fill 6 of value (byte) -87 Arrays.fill(CHARS, 3980, 3984, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 3984, 3990, (byte) -87 ); // Fill 6 of value (byte) -87 CHARS[3990] = 33; CHARS[3991] = -87; CHARS[3992] = 33; Arrays.fill(CHARS, 3993, 4014, (byte) -87 ); // Fill 21 of value (byte) -87 Arrays.fill(CHARS, 4014, 4017, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 4017, 4024, (byte) -87 ); // Fill 7 of value (byte) -87 CHARS[4024] = 33; CHARS[4025] = -87; Arrays.fill(CHARS, 4026, 4256, (byte) 33 ); // Fill 230 of value (byte) 33 Arrays.fill(CHARS, 4256, 4294, (byte) -19 ); // Fill 38 of value (byte) -19 Arrays.fill(CHARS, 4294, 4304, (byte) 33 ); // Fill 10 of value (byte) 33 Arrays.fill(CHARS, 4304, 4343, (byte) -19 ); // Fill 39 of value (byte) -19 Arrays.fill(CHARS, 4343, 4352, (byte) 33 ); // Fill 9 of value (byte) 33 CHARS[4352] = -19; CHARS[4353] = 33; Arrays.fill(CHARS, 4354, 4356, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[4356] = 33; Arrays.fill(CHARS, 4357, 4360, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[4360] = 33; CHARS[4361] = -19; CHARS[4362] = 33; Arrays.fill(CHARS, 4363, 4365, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[4365] = 33; Arrays.fill(CHARS, 4366, 4371, (byte) -19 ); // Fill 5 of value (byte) -19 Arrays.fill(CHARS, 4371, 4412, (byte) 33 ); // Fill 41 of value (byte) 33 CHARS[4412] = -19; CHARS[4413] = 33; CHARS[4414] = -19; CHARS[4415] = 33; CHARS[4416] = -19; Arrays.fill(CHARS, 4417, 4428, (byte) 33 ); // Fill 11 of value (byte) 33 CHARS[4428] = -19; CHARS[4429] = 33; CHARS[4430] = -19; CHARS[4431] = 33; CHARS[4432] = -19; Arrays.fill(CHARS, 4433, 4436, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 4436, 4438, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 4438, 4441, (byte) 33 ); // Fill 3 of value (byte) 33 CHARS[4441] = -19; Arrays.fill(CHARS, 4442, 4447, (byte) 33 ); // Fill 5 of value (byte) 33 Arrays.fill(CHARS, 4447, 4450, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[4450] = 33; CHARS[4451] = -19; CHARS[4452] = 33; CHARS[4453] = -19; CHARS[4454] = 33; CHARS[4455] = -19; CHARS[4456] = 33; CHARS[4457] = -19; Arrays.fill(CHARS, 4458, 4461, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 4461, 4463, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 4463, 4466, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 4466, 4468, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[4468] = 33; CHARS[4469] = -19; Arrays.fill(CHARS, 4470, 4510, (byte) 33 ); // Fill 40 of value (byte) 33 CHARS[4510] = -19; Arrays.fill(CHARS, 4511, 4520, (byte) 33 ); // Fill 9 of value (byte) 33 CHARS[4520] = -19; Arrays.fill(CHARS, 4521, 4523, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[4523] = -19; Arrays.fill(CHARS, 4524, 4526, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 4526, 4528, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 4528, 4535, (byte) 33 ); // Fill 7 of value (byte) 33 Arrays.fill(CHARS, 4535, 4537, (byte) -19 ); // Fill 2 of value (byte) -19 CHARS[4537] = 33; CHARS[4538] = -19; CHARS[4539] = 33; Arrays.fill(CHARS, 4540, 4547, (byte) -19 ); // Fill 7 of value (byte) -19 Arrays.fill(CHARS, 4547, 4587, (byte) 33 ); // Fill 40 of value (byte) 33 CHARS[4587] = -19; Arrays.fill(CHARS, 4588, 4592, (byte) 33 ); // Fill 4 of value (byte) 33 CHARS[4592] = -19; Arrays.fill(CHARS, 4593, 4601, (byte) 33 ); // Fill 8 of value (byte) 33 CHARS[4601] = -19; Arrays.fill(CHARS, 4602, 7680, (byte) 33 ); // Fill 3078 of value (byte) 33 Arrays.fill(CHARS, 7680, 7836, (byte) -19 ); // Fill 156 of value (byte) -19 Arrays.fill(CHARS, 7836, 7840, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 7840, 7930, (byte) -19 ); // Fill 90 of value (byte) -19 Arrays.fill(CHARS, 7930, 7936, (byte) 33 ); // Fill 6 of value (byte) 33 Arrays.fill(CHARS, 7936, 7958, (byte) -19 ); // Fill 22 of value (byte) -19 Arrays.fill(CHARS, 7958, 7960, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 7960, 7966, (byte) -19 ); // Fill 6 of value (byte) -19 Arrays.fill(CHARS, 7966, 7968, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 7968, 8006, (byte) -19 ); // Fill 38 of value (byte) -19 Arrays.fill(CHARS, 8006, 8008, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 8008, 8014, (byte) -19 ); // Fill 6 of value (byte) -19 Arrays.fill(CHARS, 8014, 8016, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 8016, 8024, (byte) -19 ); // Fill 8 of value (byte) -19 CHARS[8024] = 33; CHARS[8025] = -19; CHARS[8026] = 33; CHARS[8027] = -19; CHARS[8028] = 33; CHARS[8029] = -19; CHARS[8030] = 33; Arrays.fill(CHARS, 8031, 8062, (byte) -19 ); // Fill 31 of value (byte) -19 Arrays.fill(CHARS, 8062, 8064, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 8064, 8117, (byte) -19 ); // Fill 53 of value (byte) -19 CHARS[8117] = 33; Arrays.fill(CHARS, 8118, 8125, (byte) -19 ); // Fill 7 of value (byte) -19 CHARS[8125] = 33; CHARS[8126] = -19; Arrays.fill(CHARS, 8127, 8130, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 8130, 8133, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[8133] = 33; Arrays.fill(CHARS, 8134, 8141, (byte) -19 ); // Fill 7 of value (byte) -19 Arrays.fill(CHARS, 8141, 8144, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 8144, 8148, (byte) -19 ); // Fill 4 of value (byte) -19 Arrays.fill(CHARS, 8148, 8150, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 8150, 8156, (byte) -19 ); // Fill 6 of value (byte) -19 Arrays.fill(CHARS, 8156, 8160, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 8160, 8173, (byte) -19 ); // Fill 13 of value (byte) -19 Arrays.fill(CHARS, 8173, 8178, (byte) 33 ); // Fill 5 of value (byte) 33 Arrays.fill(CHARS, 8178, 8181, (byte) -19 ); // Fill 3 of value (byte) -19 CHARS[8181] = 33; Arrays.fill(CHARS, 8182, 8189, (byte) -19 ); // Fill 7 of value (byte) -19 Arrays.fill(CHARS, 8189, 8400, (byte) 33 ); // Fill 211 of value (byte) 33 Arrays.fill(CHARS, 8400, 8413, (byte) -87 ); // Fill 13 of value (byte) -87 Arrays.fill(CHARS, 8413, 8417, (byte) 33 ); // Fill 4 of value (byte) 33 CHARS[8417] = -87; Arrays.fill(CHARS, 8418, 8486, (byte) 33 ); // Fill 68 of value (byte) 33 CHARS[8486] = -19; Arrays.fill(CHARS, 8487, 8490, (byte) 33 ); // Fill 3 of value (byte) 33 Arrays.fill(CHARS, 8490, 8492, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(CHARS, 8492, 8494, (byte) 33 ); // Fill 2 of value (byte) 33 CHARS[8494] = -19; Arrays.fill(CHARS, 8495, 8576, (byte) 33 ); // Fill 81 of value (byte) 33 Arrays.fill(CHARS, 8576, 8579, (byte) -19 ); // Fill 3 of value (byte) -19 Arrays.fill(CHARS, 8579, 12293, (byte) 33 ); // Fill 3714 of value (byte) 33 CHARS[12293] = -87; CHARS[12294] = 33; CHARS[12295] = -19; Arrays.fill(CHARS, 12296, 12321, (byte) 33 ); // Fill 25 of value (byte) 33 Arrays.fill(CHARS, 12321, 12330, (byte) -19 ); // Fill 9 of value (byte) -19 Arrays.fill(CHARS, 12330, 12336, (byte) -87 ); // Fill 6 of value (byte) -87 CHARS[12336] = 33; Arrays.fill(CHARS, 12337, 12342, (byte) -87 ); // Fill 5 of value (byte) -87 Arrays.fill(CHARS, 12342, 12353, (byte) 33 ); // Fill 11 of value (byte) 33 Arrays.fill(CHARS, 12353, 12437, (byte) -19 ); // Fill 84 of value (byte) -19 Arrays.fill(CHARS, 12437, 12441, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(CHARS, 12441, 12443, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 12443, 12445, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 12445, 12447, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(CHARS, 12447, 12449, (byte) 33 ); // Fill 2 of value (byte) 33 Arrays.fill(CHARS, 12449, 12539, (byte) -19 ); // Fill 90 of value (byte) -19 CHARS[12539] = 33; Arrays.fill(CHARS, 12540, 12543, (byte) -87 ); // Fill 3 of value (byte) -87 Arrays.fill(CHARS, 12543, 12549, (byte) 33 ); // Fill 6 of value (byte) 33 Arrays.fill(CHARS, 12549, 12589, (byte) -19 ); // Fill 40 of value (byte) -19 Arrays.fill(CHARS, 12589, 19968, (byte) 33 ); // Fill 7379 of value (byte) 33 Arrays.fill(CHARS, 19968, 40870, (byte) -19 ); // Fill 20902 of value (byte) -19 Arrays.fill(CHARS, 40870, 44032, (byte) 33 ); // Fill 3162 of value (byte) 33 Arrays.fill(CHARS, 44032, 55204, (byte) -19 ); // Fill 11172 of value (byte) -19 Arrays.fill(CHARS, 55204, 55296, (byte) 33 ); // Fill 92 of value (byte) 33 Arrays.fill(CHARS, 57344, 65534, (byte) 33 ); // Fill 8190 of value (byte) 33 } // () // // Public static methods // /** * Returns true if the specified character is a supplemental character. * * @param c The character to check. */ public static boolean isSupplemental(int c) { return (c >= 0x10000 && c <= 0x10FFFF); } /** * Returns true the supplemental character corresponding to the given * surrogates. * * @param h The high surrogate. * @param l The low surrogate. */ public static int supplemental(char h, char l) { return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; } /** * Returns the high surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char highSurrogate(int c) { return (char) (((c - 0x00010000) >> 10) + 0xD800); } /** * Returns the low surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char lowSurrogate(int c) { return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); } /** * Returns whether the given character is a high surrogate * * @param c The character to check. */ public static boolean isHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDBFF); } /** * Returns whether the given character is a low surrogate * * @param c The character to check. */ public static boolean isLowSurrogate(int c) { return (0xDC00 <= c && c <= 0xDFFF); } /** * Returns true if the specified character is valid. This method * also checks the surrogate character range from 0x10000 to 0x10FFFF. *

    * If the program chooses to apply the mask directly to the * CHARS array, then they are responsible for checking * the surrogate character range. * * @param c The character to check. */ public static boolean isValid(int c) { return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isValid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):boolean /** * Returns true if the specified character can be considered content. * * @param c The character to check. */ public static boolean isContent(int c) { return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isContent(int):boolean /** * Returns true if the specified character can be considered markup. * Markup characters include '<', '&', and '%'. * * @param c The character to check. */ public static boolean isMarkup(int c) { return c == '<' || c == '&' || c == '%'; } // isMarkup(int):boolean /** * Returns true if the specified character is a space character * as defined by production [3] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isSpace(int c) { return c <= 0x20 && (CHARS[c] & MASK_SPACE) != 0; } // isSpace(int):boolean /** * Returns true if the specified character is a valid name start * character as defined by production [5] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; } // isNameStart(int):boolean /** * Returns true if the specified character is a valid name * character as defined by production [4] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; } // isName(int):boolean /** * Returns true if the specified character is a valid NCName start * character as defined by production [4] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; } // isNCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName * character as defined by production [5] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; } // isNCName(int):boolean /** * Returns true if the specified character is a valid Pubid * character as defined by production [13] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isPubid(int c) { return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; } // isPubid(int):boolean /* * [5] Name ::= (Letter | '_' | ':') (NameChar)* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) return false; char ch = name.charAt(0); if( isNameStart(ch) == false) return false; for (int i = 1; i < name.length(); i++ ) { ch = name.charAt(i); if( isName( ch ) == false ){ return false; } } return true; } // isValidName(String):boolean /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) return false; char ch = ncName.charAt(0); if( isNCNameStart(ch) == false) return false; for (int i = 1; i < ncName.length(); i++ ) { ch = ncName.charAt(i); if( isNCName( ch ) == false ){ return false; } } return true; } // isValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) return false; for (int i = 0; i < nmtoken.length(); i++ ) { char ch = nmtoken.charAt(i); if( ! isName( ch ) ){ return false; } } return true; } // isValidName(String):boolean // encodings /** * Returns true if the encoding name is a valid IANA encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * IANA encoding name. * * @param ianaEncoding The IANA encoding name. */ public static boolean isValidIANAEncoding(String ianaEncoding) { if (ianaEncoding != null) { int length = ianaEncoding.length(); if (length > 0) { char c = ianaEncoding.charAt(0); if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { for (int i = 1; i < length; i++) { c = ianaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } } return false; } // isValidIANAEncoding(String):boolean /** * Returns true if the encoding name is a valid Java encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * Java encoding name. * * @param javaEncoding The Java encoding name. */ public static boolean isValidJavaEncoding(String javaEncoding) { if (javaEncoding != null) { int length = javaEncoding.length(); if (length > 0) { for (int i = 1; i < length; i++) { char c = javaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } return false; } // isValidIANAEncoding(String):boolean } // class XMLChar libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_zh_CN.java0000644000175000017500000000205410721374033027736 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_zh_CN.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; public class SerializerMessages_zh_CN extends SerializerMessages_zh { } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_ca.java0000644000175000017500000003175410721374031027327 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_ca.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_ca extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "La clau del missatge ''{0}'' no est\u00e0 a la classe del missatge ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "El format del missatge ''{0}'' a la classe del missatge ''{1}'' ha fallat." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "La classe de serialitzador ''{0}'' no implementa org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "No s''ha trobat el recurs [ {0} ].\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "No s''ha pogut carregar el recurs [ {0} ]: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Grand\u00e0ria del buffer <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "S''ha detectat un suplent UTF-16 no v\u00e0lid: {0} ?" }, { MsgKey.ER_OIERROR, "Error d'E/S" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "No es pot afegir l''atribut {0} despr\u00e9s dels nodes subordinats o abans que es produeixi un element. Es passar\u00e0 per alt l''atribut." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "No s''ha declarat l''espai de noms pel prefix ''{0}''." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "L''atribut ''{0}'' es troba fora de l''element." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "La declaraci\u00f3 de l''espai de noms ''{0}''=''{1}'' es troba fora de l''element." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "No s''ha pogut carregar ''{0}'' (comproveu CLASSPATH), ara s''est\u00e0 fent servir els valors per defecte." }, { MsgKey.ER_ILLEGAL_CHARACTER, "S''ha intentat un car\u00e0cter de sortida del valor integral {0} que no est\u00e0 representat a una codificaci\u00f3 de sortida especificada de {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "No s''ha pogut carregar el fitxer de propietats ''{0}'' del m\u00e8tode de sortida ''{1}'' (comproveu CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "N\u00famero de port no v\u00e0lid" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "El port no es pot establir quan el sistema principal \u00e9s nul" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "El format de l'adre\u00e7a del sistema principal no \u00e9s el correcte" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "L'esquema no t\u00e9 conformitat." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "No es pot establir un esquema des d'una cadena nul\u00b7la" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "La via d'acc\u00e9s cont\u00e9 una seq\u00fc\u00e8ncia d'escapament no v\u00e0lida" }, { MsgKey.ER_PATH_INVALID_CHAR, "La via d''acc\u00e9s cont\u00e9 un car\u00e0cter no v\u00e0lid {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "El fragment cont\u00e9 un car\u00e0cter no v\u00e0lid" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "El fragment no es pot establir si la via d'acc\u00e9s \u00e9s nul\u00b7la" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "El fragment nom\u00e9s es pot establir per a un URI gen\u00e8ric" }, { MsgKey.ER_NO_SCHEME_IN_URI, "No s'ha trobat cap esquema a l'URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "No es pot inicialitzar l'URI amb par\u00e0metres buits" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "No es pot especificar un fragment tant en la via d'acc\u00e9s com en el fragment" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "No es pot especificar una cadena de consulta en la via d'acc\u00e9s i la cadena de consulta" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "No es pot especificar el port si no s'especifica el sistema principal" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "No es pot especificar informaci\u00f3 de l'usuari si no s'especifica el sistema principal" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Av\u00eds: la versi\u00f3 del document de sortida s''ha sol\u00b7licitat que sigui ''{0}''. Aquesta versi\u00f3 de XML no est\u00e0 suportada. La versi\u00f3 del document de sortida ser\u00e0 ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Es necessita l'esquema" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "L''objecte de propietats passat a SerializerFactory no t\u00e9 cap propietat ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Av\u00eds: el temps d''execuci\u00f3 de Java no d\u00f3na suport a la codificaci\u00f3 ''{0}''." }, {MsgKey.ER_FEATURE_NOT_FOUND, "El par\u00e0metre ''{0}'' no es reconeix."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "El par\u00e0metre ''{0}'' es reconeix per\u00f2 el valor sol\u00b7licitat no es pot establir."}, {MsgKey.ER_STRING_TOO_LONG, "La cadena resultant \u00e9s massa llarga per cabre en una DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "El tipus de valor per a aquest nom de par\u00e0metre \u00e9s incompatible amb el tipus de valor esperat."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "La destinaci\u00f3 de sortida per a les dades que s'ha d'escriure era nul\u00b7la."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "S'ha trobat una codificaci\u00f3 no suportada."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "El node no s'ha pogut serialitzat."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "La secci\u00f3 CDATA cont\u00e9 un o m\u00e9s marcadors d'acabament ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "No s'ha pogut crear cap inst\u00e0ncia per comprovar si t\u00e9 un format correcte o no. El par\u00e0metre del tipus ben format es va establir en cert, per\u00f2 la comprovaci\u00f3 de format no s'ha pogut realitzar." }, {MsgKey.ER_WF_INVALID_CHARACTER, "El node ''{0}'' cont\u00e9 car\u00e0cters XML no v\u00e0lids." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "S''ha trobat un car\u00e0cter XML no v\u00e0lid (Unicode: 0x{0}) en el comentari." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "S''ha trobat un car\u00e0cter XML no v\u00e0lid (Unicode: 0x{0}) en les dades d''instrucci\u00f3 de proc\u00e9s." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "S''ha trobat un car\u00e0cter XML no v\u00e0lid (Unicode: 0x''{0})'' en els continguts de la CDATASection." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "S''ha trobat un car\u00e0cter XML no v\u00e0lid (Unicode: 0x''{0})'' en el contingut de dades de car\u00e0cter del node." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "S''han trobat car\u00e0cters XML no v\u00e0lids al node {0} anomenat ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "La cadena \"--\" no est\u00e0 permesa dins dels comentaris." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "El valor d''atribut \"{1}\" associat amb un tipus d''element \"{0}\" no pot contenir el car\u00e0cter ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "La refer\u00e8ncia de l''entitat no analitzada \"&{0};\" no est\u00e0 permesa." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "La refer\u00e8ncia externa de l''entitat \"&{0};\" no est\u00e0 permesa en un valor d''atribut." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "El prefix \"{0}\" no es pot vincular a l''espai de noms \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "El nom local de l''element \"{0}\" \u00e9s nul." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "El nom local d''atr \"{0}\" \u00e9s nul." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "El text de recanvi del node de l''entitat \"{0}\" cont\u00e9 un node d''element \"{1}\" amb un prefix de no enlla\u00e7at \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "El text de recanvi del node de l''entitat \"{0}\" cont\u00e9 un node d''atribut \"{1}\" amb un prefix de no enlla\u00e7at \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/StringToIntTable.java0000644000175000017500000001131010721374033026243 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringToIntTable.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; /** * A very simple lookup table that stores a list of strings, the even * number strings being keys, and the odd number strings being values. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * This class is not a public API, it is only public so it can be used * in org.apache.xml.serializer. * * @xsl.usage internal */ public final class StringToIntTable { public static final int INVALID_KEY = -10000; /** Block size to allocate */ private int m_blocksize; /** Array of strings this table points to. Associated with ints * in m_values */ private String m_map[]; /** Array of ints this table points. Associated with strings from * m_map. */ private int m_values[]; /** Number of ints in the table */ private int m_firstFree = 0; /** Size of this table */ private int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public StringToIntTable() { m_blocksize = 8; m_mapSize = m_blocksize; m_map = new String[m_blocksize]; m_values = new int[m_blocksize]; } /** * Construct a StringToIntTable, using the given block size. * * @param blocksize Size of block to allocate */ public StringToIntTable(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new String[blocksize]; m_values = new int[m_blocksize]; } /** * Get the length of the list. * * @return the length of the list */ public final int getLength() { return m_firstFree; } /** * Append a string onto the vector. * * @param key String to append * @param value The int value of the string */ public final void put(String key, int value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; int newValues[] = new int[m_mapSize]; System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1); m_values = newValues; } m_map[m_firstFree] = key; m_values[m_firstFree] = value; m_firstFree++; } /** * Tell if the table contains the given string. * * @param key String to look for * * @return The String's int value * */ public final int get(String key) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equals(key)) return m_values[i]; } return INVALID_KEY; } /** * Tell if the table contains the given string. Ignore case. * * @param key String to look for * * @return The string's int value */ public final int getIgnoreCase(String key) { if (null == key) return INVALID_KEY; for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equalsIgnoreCase(key)) return m_values[i]; } return INVALID_KEY; } /** * Tell if the table contains the given string. * * @param key String to look for * * @return True if the string is in the table */ public final boolean contains(String key) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equals(key)) return true; } return false; } /** * Return array of keys in the table. * * @return Array of strings */ public final String[] keys() { String [] keysArr = new String[m_firstFree]; for (int i = 0; i < m_firstFree; i++) { keysArr[i] = m_map[i]; } return keysArr; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_ja.java0000644000175000017500000004245610721374032027340 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_ja.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_ja extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "\u30e1\u30c3\u30bb\u30fc\u30b8\u30fb\u30ad\u30fc ''{0}'' \u306f\u30e1\u30c3\u30bb\u30fc\u30b8\u30fb\u30af\u30e9\u30b9 ''{1}'' \u306b\u3042\u308a\u307e\u305b\u3093\u3002" }, { MsgKey.BAD_MSGFORMAT, "\u30e1\u30c3\u30bb\u30fc\u30b8\u30fb\u30af\u30e9\u30b9 ''{1}'' \u306e\u30e1\u30c3\u30bb\u30fc\u30b8 ''{0}'' \u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u8a2d\u5b9a\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002" }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "\u30b7\u30ea\u30a2\u30e9\u30a4\u30b6\u30fc\u30fb\u30af\u30e9\u30b9 ''{0}'' \u306f org.xml.sax.ContentHandler \u3092\u5b9f\u88c5\u3057\u307e\u305b\u3093\u3002" }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "\u30ea\u30bd\u30fc\u30b9 [ {0} ] \u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "\u30ea\u30bd\u30fc\u30b9 [ {0} ] \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u30d0\u30c3\u30d5\u30a1\u30fc\u30fb\u30b5\u30a4\u30ba <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\u7121\u52b9\u306a UTF-16 \u30b5\u30ed\u30b2\u30fc\u30c8\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f: {0} ?" }, { MsgKey.ER_OIERROR, "\u5165\u51fa\u529b\u30a8\u30e9\u30fc" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "\u4e0b\u4f4d\u30ce\u30fc\u30c9\u306e\u5f8c\u307e\u305f\u306f\u8981\u7d20\u304c\u751f\u6210\u3055\u308c\u308b\u524d\u306b\u5c5e\u6027 {0} \u306f\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002 \u5c5e\u6027\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002" }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "\u63a5\u982d\u90e8 ''{0}'' \u306e\u540d\u524d\u7a7a\u9593\u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002" }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "\u5c5e\u6027 ''{0}'' \u304c\u8981\u7d20\u306e\u5916\u5074\u3067\u3059\u3002" }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "\u540d\u524d\u7a7a\u9593\u5ba3\u8a00 ''{0}''=''{1}'' \u304c\u8981\u7d20\u306e\u5916\u5074\u3067\u3059\u3002" }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "''{0}'' \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f (CLASSPATH \u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044)\u3002\u73fe\u5728\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u3082\u306e\u306e\u307f\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002" }, { MsgKey.ER_ILLEGAL_CHARACTER, "{1} \u306e\u6307\u5b9a\u3055\u308c\u305f\u51fa\u529b\u30a8\u30f3\u30b3\u30fc\u30c9\u3067\u8868\u305b\u306a\u3044\u6574\u6570\u5024 {0} \u306e\u6587\u5b57\u306e\u51fa\u529b\u3092\u8a66\u307f\u307e\u3057\u305f\u3002" }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "\u51fa\u529b\u30e1\u30bd\u30c3\u30c9 ''{1}'' \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u30fb\u30d5\u30a1\u30a4\u30eb ''{0}'' \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f (CLASSPATH \u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044)" }, { MsgKey.ER_INVALID_PORT, "\u7121\u52b9\u306a\u30dd\u30fc\u30c8\u756a\u53f7" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "\u30db\u30b9\u30c8\u304c\u30cc\u30eb\u3067\u3042\u308b\u3068\u30dd\u30fc\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "\u30db\u30b9\u30c8\u306f\u3046\u307e\u304f\u69cb\u6210\u3055\u308c\u305f\u30a2\u30c9\u30ec\u30b9\u3067\u3042\u308a\u307e\u305b\u3093" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "\u30b9\u30ad\u30fc\u30e0\u306f\u4e00\u81f4\u3057\u3066\u3044\u307e\u305b\u3093\u3002" }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "\u30cc\u30eb\u30fb\u30b9\u30c8\u30ea\u30f3\u30b0\u304b\u3089\u306f\u30b9\u30ad\u30fc\u30e0\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u30d1\u30b9\u306b\u7121\u52b9\u306a\u30a8\u30b9\u30b1\u30fc\u30d7\u30fb\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059" }, { MsgKey.ER_PATH_INVALID_CHAR, "\u30d1\u30b9\u306b\u7121\u52b9\u6587\u5b57: {0} \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059" }, { MsgKey.ER_FRAG_INVALID_CHAR, "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306b\u7121\u52b9\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "\u30d1\u30b9\u304c\u30cc\u30eb\u3067\u3042\u308b\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "\u7dcf\u79f0 URI \u306e\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3057\u304b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_NO_SCHEME_IN_URI, "\u30b9\u30ad\u30fc\u30e0\u306f URI \u3067\u898b\u3064\u304b\u308a\u307e\u305b\u3093" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "URI \u306f\u7a7a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306f\u30d1\u30b9\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306e\u4e21\u65b9\u306b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "\u7167\u4f1a\u30b9\u30c8\u30ea\u30f3\u30b0\u306f\u30d1\u30b9\u304a\u3088\u3073\u7167\u4f1a\u30b9\u30c8\u30ea\u30f3\u30b0\u5185\u306b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "\u30db\u30b9\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "\u30db\u30b9\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f Userinfo \u3092\u6307\u5b9a\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "\u8b66\u544a: \u51fa\u529b\u6587\u66f8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u3057\u3066 ''{0}'' \u304c\u8981\u6c42\u3055\u308c\u307e\u3057\u305f\u3002 \u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e XML \u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002 \u51fa\u529b\u6587\u66f8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f ''1.0'' \u306b\u306a\u308a\u307e\u3059\u3002" }, { MsgKey.ER_SCHEME_REQUIRED, "\u30b9\u30ad\u30fc\u30e0\u304c\u5fc5\u8981\u3067\u3059\u3002" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "SerializerFactory \u306b\u6e21\u3055\u308c\u305f Properties \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f ''{0}'' \u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u304c\u3042\u308a\u307e\u305b\u3093\u3002" }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "\u8b66\u544a: \u30a8\u30f3\u30b3\u30fc\u30c9 ''{0}'' \u306f\u3053\u306e Java \u30e9\u30f3\u30bf\u30a4\u30e0\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002" }, {MsgKey.ER_FEATURE_NOT_FOUND, "\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc ''{0}'' \u306f\u8a8d\u8b58\u3055\u308c\u307e\u305b\u3093\u3002"}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc ''{0}'' \u306f\u8a8d\u8b58\u3055\u308c\u307e\u3059\u304c\u3001\u8981\u6c42\u3055\u308c\u305f\u5024\u306f\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002"}, {MsgKey.ER_STRING_TOO_LONG, "\u7d50\u679c\u306e\u30b9\u30c8\u30ea\u30f3\u30b0\u304c\u9577\u3059\u304e\u308b\u305f\u3081\u3001DOMString \u5185\u306b\u53ce\u307e\u308a\u307e\u305b\u3093: ''{0}''\u3002"}, {MsgKey.ER_TYPE_MISMATCH_ERR, "\u3053\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u540d\u306e\u5024\u306e\u578b\u306f\u3001\u671f\u5f85\u3055\u308c\u308b\u5024\u306e\u578b\u3068\u4e0d\u9069\u5408\u3067\u3059\u3002"}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "\u66f8\u304d\u8fbc\u307e\u308c\u308b\u30c7\u30fc\u30bf\u306e\u51fa\u529b\u5b9b\u5148\u304c\u30cc\u30eb\u3067\u3059\u3002"}, {MsgKey.ER_UNSUPPORTED_ENCODING, "\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u306a\u3044\u30a8\u30f3\u30b3\u30fc\u30c9\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f\u3002"}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "\u30ce\u30fc\u30c9\u3092\u76f4\u5217\u5316\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "CDATA \u30bb\u30af\u30b7\u30e7\u30f3\u306b 1 \u3064\u4ee5\u4e0a\u306e\u7d42\u4e86\u30de\u30fc\u30ab\u30fc ']]>' \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002"}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "\u6574\u5f62\u5f0f\u6027\u30c1\u30a7\u30c3\u30ab\u30fc\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 well-formed \u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u8a2d\u5b9a\u306f true \u3067\u3057\u305f\u304c\u3001\u6574\u5f62\u5f0f\u6027\u306e\u691c\u67fb\u306f\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002" }, {MsgKey.ER_WF_INVALID_CHARACTER, "\u30ce\u30fc\u30c9 ''{0}'' \u306b\u7121\u52b9\u306a XML \u6587\u5b57\u304c\u3042\u308a\u307e\u3059\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "\u30b3\u30e1\u30f3\u30c8\u306e\u4e2d\u306b\u7121\u52b9\u306a XML \u6587\u5b57 (Unicode: 0x{0}) \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\u51e6\u7406\u547d\u4ee4\u30c7\u30fc\u30bf\u306e\u4e2d\u306b\u7121\u52b9\u306a XML \u6587\u5b57 (Unicode: 0x{0}) \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "CDATA \u30bb\u30af\u30b7\u30e7\u30f3\u306e\u4e2d\u306b\u7121\u52b9\u306a XML \u6587\u5b57 (Unicode: 0x{0}) \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "\u30ce\u30fc\u30c9\u306e\u6587\u5b57\u30c7\u30fc\u30bf\u306e\u5185\u5bb9\u306b\u7121\u52b9\u306a XML \u6587\u5b57 (Unicode: 0x{0}) \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "''{1}'' \u3068\u3044\u3046\u540d\u524d\u306e {0} \u30ce\u30fc\u30c9\u306e\u4e2d\u306b\u7121\u52b9\u306a XML \u6587\u5b57\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002" }, { MsgKey.ER_WF_DASH_IN_COMMENT, "\u30b9\u30c8\u30ea\u30f3\u30b0 \"--\" \u306f\u30b3\u30e1\u30f3\u30c8\u5185\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002" }, {MsgKey.ER_WF_LT_IN_ATTVAL, "\u8981\u7d20\u578b \"{0}\" \u306b\u95a2\u9023\u3057\u305f\u5c5e\u6027 \"{1}\" \u306e\u5024\u306b\u306f ''<'' \u6587\u5b57\u3092\u542b\u3081\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3002" }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "\u89e3\u6790\u5bfe\u8c61\u5916\u5b9f\u4f53\u53c2\u7167 \"&{0};\" \u306f\u8a31\u53ef\u3055\u308c\u307e\u305b\u3093\u3002" }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "\u5c5e\u6027\u5024\u3067\u306e\u5916\u90e8\u5b9f\u4f53\u53c2\u7167 \"&{0};\" \u306f\u8a31\u53ef\u3055\u308c\u307e\u305b\u3093\u3002" }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "\u63a5\u982d\u90e8 \"{0}\" \u306f\u540d\u524d\u7a7a\u9593 \"{1}\" \u306b\u7d50\u5408\u3067\u304d\u307e\u305b\u3093\u3002" }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "\u8981\u7d20 \"{0}\" \u306e\u30ed\u30fc\u30ab\u30eb\u540d\u304c\u30cc\u30eb\u3067\u3059\u3002" }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "\u5c5e\u6027 \"{0}\" \u306e\u30ed\u30fc\u30ab\u30eb\u540d\u304c\u30cc\u30eb\u3067\u3059\u3002" }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "\u5b9f\u4f53\u30ce\u30fc\u30c9 \"{0}\" \u306e\u7f6e\u63db\u30c6\u30ad\u30b9\u30c8\u306b\u3001\u672a\u7d50\u5408\u306e\u63a5\u982d\u90e8 \"{2}\" \u3092\u6301\u3064\u8981\u7d20\u30ce\u30fc\u30c9 \"{1}\" \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002" }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "\u5b9f\u4f53\u30ce\u30fc\u30c9 \"{0}\" \u306e\u7f6e\u63db\u30c6\u30ad\u30b9\u30c8\u306b\u3001\u672a\u7d50\u5408\u306e\u63a5\u982d\u90e8 \"{2}\" \u3092\u6301\u3064\u5c5e\u6027\u30ce\u30fc\u30c9 \"{1}\" \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002" }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/XML11Char.java0000644000175000017500000003753410721374033024467 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xml.serializer.utils; import java.util.Arrays; /** * THIS IS A COPY OF THE XERCES-2J CLASS org.apache.xerces.utls.XMLChar * * This class defines the basic properties of characters in XML 1.1. The data * in this class can be used to verify that a character is a valid * XML 1.1 character or if the character is a space, name start, or name * character. *

    * A series of convenience methods are supplied to ease the burden * of the developer. Using the character as an index into the XML11CHARS * array and applying the appropriate mask flag (e.g. * MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments * for the isValid method for details. * * @author Glenn Marcy, IBM * @author Andy Clark, IBM * @author Arnaud Le Hors, IBM * @author Neil Graham, IBM * @author Michael Glavassevich, IBM * * @version $Id: $ */ public class XML11Char { // // Constants // /** Character flags for XML 1.1. */ private static final byte XML11CHARS [] = new byte [1 << 16]; /** XML 1.1 Valid character mask. */ public static final int MASK_XML11_VALID = 0x01; /** XML 1.1 Space character mask. */ public static final int MASK_XML11_SPACE = 0x02; /** XML 1.1 Name start character mask. */ public static final int MASK_XML11_NAME_START = 0x04; /** XML 1.1 Name character mask. */ public static final int MASK_XML11_NAME = 0x08; /** XML 1.1 control character mask */ public static final int MASK_XML11_CONTROL = 0x10; /** XML 1.1 content for external entities (valid - "special" chars - control chars) */ public static final int MASK_XML11_CONTENT = 0x20; /** XML namespaces 1.1 NCNameStart */ public static final int MASK_XML11_NCNAME_START = 0x40; /** XML namespaces 1.1 NCName */ public static final int MASK_XML11_NCNAME = 0x80; /** XML 1.1 content for internal entities (valid - "special" chars) */ public static final int MASK_XML11_CONTENT_INTERNAL = MASK_XML11_CONTROL | MASK_XML11_CONTENT; // // Static initialization // static { // Initializing the Character Flag Array // Code generated by: XML11CharGenerator. Arrays.fill(XML11CHARS, 1, 9, (byte) 17 ); // Fill 8 of value (byte) 17 XML11CHARS[9] = 35; XML11CHARS[10] = 3; Arrays.fill(XML11CHARS, 11, 13, (byte) 17 ); // Fill 2 of value (byte) 17 XML11CHARS[13] = 3; Arrays.fill(XML11CHARS, 14, 32, (byte) 17 ); // Fill 18 of value (byte) 17 XML11CHARS[32] = 35; Arrays.fill(XML11CHARS, 33, 38, (byte) 33 ); // Fill 5 of value (byte) 33 XML11CHARS[38] = 1; Arrays.fill(XML11CHARS, 39, 45, (byte) 33 ); // Fill 6 of value (byte) 33 Arrays.fill(XML11CHARS, 45, 47, (byte) -87 ); // Fill 2 of value (byte) -87 XML11CHARS[47] = 33; Arrays.fill(XML11CHARS, 48, 58, (byte) -87 ); // Fill 10 of value (byte) -87 XML11CHARS[58] = 45; XML11CHARS[59] = 33; XML11CHARS[60] = 1; Arrays.fill(XML11CHARS, 61, 65, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(XML11CHARS, 65, 91, (byte) -19 ); // Fill 26 of value (byte) -19 Arrays.fill(XML11CHARS, 91, 93, (byte) 33 ); // Fill 2 of value (byte) 33 XML11CHARS[93] = 1; XML11CHARS[94] = 33; XML11CHARS[95] = -19; XML11CHARS[96] = 33; Arrays.fill(XML11CHARS, 97, 123, (byte) -19 ); // Fill 26 of value (byte) -19 Arrays.fill(XML11CHARS, 123, 127, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(XML11CHARS, 127, 133, (byte) 17 ); // Fill 6 of value (byte) 17 XML11CHARS[133] = 35; Arrays.fill(XML11CHARS, 134, 160, (byte) 17 ); // Fill 26 of value (byte) 17 Arrays.fill(XML11CHARS, 160, 183, (byte) 33 ); // Fill 23 of value (byte) 33 XML11CHARS[183] = -87; Arrays.fill(XML11CHARS, 184, 192, (byte) 33 ); // Fill 8 of value (byte) 33 Arrays.fill(XML11CHARS, 192, 215, (byte) -19 ); // Fill 23 of value (byte) -19 XML11CHARS[215] = 33; Arrays.fill(XML11CHARS, 216, 247, (byte) -19 ); // Fill 31 of value (byte) -19 XML11CHARS[247] = 33; Arrays.fill(XML11CHARS, 248, 768, (byte) -19 ); // Fill 520 of value (byte) -19 Arrays.fill(XML11CHARS, 768, 880, (byte) -87 ); // Fill 112 of value (byte) -87 Arrays.fill(XML11CHARS, 880, 894, (byte) -19 ); // Fill 14 of value (byte) -19 XML11CHARS[894] = 33; Arrays.fill(XML11CHARS, 895, 8192, (byte) -19 ); // Fill 7297 of value (byte) -19 Arrays.fill(XML11CHARS, 8192, 8204, (byte) 33 ); // Fill 12 of value (byte) 33 Arrays.fill(XML11CHARS, 8204, 8206, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(XML11CHARS, 8206, 8232, (byte) 33 ); // Fill 26 of value (byte) 33 XML11CHARS[8232] = 35; Arrays.fill(XML11CHARS, 8233, 8255, (byte) 33 ); // Fill 22 of value (byte) 33 Arrays.fill(XML11CHARS, 8255, 8257, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(XML11CHARS, 8257, 8304, (byte) 33 ); // Fill 47 of value (byte) 33 Arrays.fill(XML11CHARS, 8304, 8592, (byte) -19 ); // Fill 288 of value (byte) -19 Arrays.fill(XML11CHARS, 8592, 11264, (byte) 33 ); // Fill 2672 of value (byte) 33 Arrays.fill(XML11CHARS, 11264, 12272, (byte) -19 ); // Fill 1008 of value (byte) -19 Arrays.fill(XML11CHARS, 12272, 12289, (byte) 33 ); // Fill 17 of value (byte) 33 Arrays.fill(XML11CHARS, 12289, 55296, (byte) -19 ); // Fill 43007 of value (byte) -19 Arrays.fill(XML11CHARS, 57344, 63744, (byte) 33 ); // Fill 6400 of value (byte) 33 Arrays.fill(XML11CHARS, 63744, 64976, (byte) -19 ); // Fill 1232 of value (byte) -19 Arrays.fill(XML11CHARS, 64976, 65008, (byte) 33 ); // Fill 32 of value (byte) 33 Arrays.fill(XML11CHARS, 65008, 65534, (byte) -19 ); // Fill 526 of value (byte) -19 } // () // // Public static methods // /** * Returns true if the specified character is a space character * as amdended in the XML 1.1 specification. * * @param c The character to check. */ public static boolean isXML11Space(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_SPACE) != 0); } // isXML11Space(int):boolean /** * Returns true if the specified character is valid. This method * also checks the surrogate character range from 0x10000 to 0x10FFFF. *

    * If the program chooses to apply the mask directly to the * XML11CHARS array, then they are responsible for checking * the surrogate character range. * * @param c The character to check. */ public static boolean isXML11Valid(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11Valid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isXML11Invalid(int c) { return !isXML11Valid(c); } // isXML11Invalid(int):boolean /** * Returns true if the specified character is valid and permitted outside * of a character reference. * That is, this method will return false for the same set as * isXML11Valid, except it also reports false for "control characters". * * @param c The character to check. */ public static boolean isXML11ValidLiteral(int c) { return ((c < 0x10000 && ((XML11CHARS[c] & MASK_XML11_VALID) != 0 && (XML11CHARS[c] & MASK_XML11_CONTROL) == 0)) || (0x10000 <= c && c <= 0x10FFFF)); } // isXML11ValidLiteral(int):boolean /** * Returns true if the specified character can be considered * content in an external parsed entity. * * @param c The character to check. */ public static boolean isXML11Content(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11Content(int):boolean /** * Returns true if the specified character can be considered * content in an internal parsed entity. * * @param c The character to check. */ public static boolean isXML11InternalEntityContent(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_CONTENT_INTERNAL) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11InternalEntityContent(int):boolean /** * Returns true if the specified character is a valid name start * character as defined by production [4] in the XML 1.1 * specification. * * @param c The character to check. */ public static boolean isXML11NameStart(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME_START) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NameStart(int):boolean /** * Returns true if the specified character is a valid name * character as defined by production [4a] in the XML 1.1 * specification. * * @param c The character to check. */ public static boolean isXML11Name(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME) != 0) || (c >= 0x10000 && c < 0xF0000); } // isXML11Name(int):boolean /** * Returns true if the specified character is a valid NCName start * character as defined by production [4] in Namespaces in XML * 1.1 recommendation. * * @param c The character to check. */ public static boolean isXML11NCNameStart(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NCNAME_START) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName * character as defined by production [5] in Namespaces in XML * 1.1 recommendation. * * @param c The character to check. */ public static boolean isXML11NCName(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NCNAME) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NCName(int):boolean /** * Returns whether the given character is a valid * high surrogate for a name character. This includes * all high surrogates for characters [0x10000-0xEFFFF]. * In other words everything excluding planes 15 and 16. * * @param c The character to check. */ public static boolean isXML11NameHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDB7F); } /* * [5] Name ::= NameStartChar NameChar* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.1 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isXML11ValidName(String name) { int length = name.length(); if (length == 0) return false; int i = 1; char ch = name.charAt(0); if( !isXML11NameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = name.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = name.charAt(i); if ( !isXML11Name(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = name.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } // isXML11ValidName(String):boolean /* * from the namespace 1.1 rec * [4] NCName ::= NCNameStartChar NCNameChar* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.1 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isXML11ValidNCName(String ncName) { int length = ncName.length(); if (length == 0) return false; int i = 1; char ch = ncName.charAt(0); if( !isXML11NCNameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = ncName.charAt(i); if ( !isXML11NCName(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } // isXML11ValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.1 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isXML11ValidNmtoken(String nmtoken) { int length = nmtoken.length(); if (length == 0) return false; for (int i = 0; i < length; ++i ) { char ch = nmtoken.charAt(i); if( !isXML11Name(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = nmtoken.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } } return true; } // isXML11ValidName(String):boolean } // class XML11Char libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/WrappedRuntimeException.java0000644000175000017500000000443610721374031027705 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WrappedRuntimeException.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; /** * This class is for throwing important checked exceptions * over non-checked methods. It should be used with care, * and in limited circumstances. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * This class is not a public API, it is only public because it is * used by org.apache.xml.serializer. * @xsl.usage internal */ public final class WrappedRuntimeException extends RuntimeException { static final long serialVersionUID = 7140414456714658073L; /** Primary checked exception. * @serial */ private Exception m_exception; /** * Construct a WrappedRuntimeException from a * checked exception. * * @param e Primary checked exception */ public WrappedRuntimeException(Exception e) { super(e.getMessage()); m_exception = e; } /** * Constructor WrappedRuntimeException * * * @param msg Exception information. * @param e Primary checked exception */ public WrappedRuntimeException(String msg, Exception e) { super(msg); m_exception = e; } /** * Get the checked exception that this runtime exception wraps. * * @return The primary checked exception */ public Exception getException() { return m_exception; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages.java0000644000175000017500000003077710721374033026672 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in the serializer. * * @xsl.usage internal */ public class SerializerMessages extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "The message key ''{0}'' is not in the message class ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "The format of message ''{0}'' in message class ''{1}'' failed." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "The serializer class ''{0}'' does not implement org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "The resource [ {0} ] could not be found.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "The resource [ {0} ] could not load: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Buffer size <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Invalid UTF-16 surrogate detected: {0} ?" }, { MsgKey.ER_OIERROR, "IO error" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Cannot add attribute {0} after child nodes or before an element is produced. Attribute will be ignored." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "Namespace for prefix ''{0}'' has not been declared." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Attribute ''{0}'' outside of element." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Namespace declaration ''{0}''=''{1}'' outside of element." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Could not load ''{0}'' (check CLASSPATH), now using just the defaults" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Attempt to output character of integral value {0} that is not represented in specified output encoding of {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Could not load the propery file ''{0}'' for output method ''{1}'' (check CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "Invalid port number" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Port cannot be set when host is null" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Host is not a well formed address" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "The scheme is not conformant." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Cannot set scheme from null string" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Path contains invalid escape sequence" }, { MsgKey.ER_PATH_INVALID_CHAR, "Path contains invalid character: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment contains invalid character" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Fragment cannot be set when path is null" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment can only be set for a generic URI" }, { MsgKey.ER_NO_SCHEME_IN_URI, "No scheme found in URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Cannot initialize URI with empty parameters" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment cannot be specified in both the path and fragment" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Query string cannot be specified in path and query string" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Port may not be specified if host is not specified" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Userinfo may not be specified if host is not specified" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Warning: The version of the output document is requested to be ''{0}''. This version of XML is not supported. The version of the output document will be ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Scheme is required!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "The Properties object passed to the SerializerFactory does not have a ''{0}'' property." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Warning: The encoding ''{0}'' is not supported by the Java runtime." }, {MsgKey.ER_FEATURE_NOT_FOUND, "The parameter ''{0}'' is not recognized."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "The parameter ''{0}'' is recognized but the requested value cannot be set."}, {MsgKey.ER_STRING_TOO_LONG, "The resulting string is too long to fit in a DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "The value type for this parameter name is incompatible with the expected value type."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "The output destination for data to be written to was null."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "An unsupported encoding is encountered."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "The node could not be serialized."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "The CDATA Section contains one or more termination markers ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "An instance of the Well-Formedness checker could not be created. The well-formed parameter was set to true but well-formedness checking can not be performed." }, {MsgKey.ER_WF_INVALID_CHARACTER, "The node ''{0}'' contains invalid XML characters." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "An invalid XML character (Unicode: 0x{0}) was found in the comment." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "An invalid XML character (Unicode: 0x{0}) was found in the processing instructiondata." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "An invalid XML character (Unicode: 0x{0}) was found in the contents of the CDATASection." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "An invalid XML character (Unicode: 0x{0}) was found in the node''s character data content." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "An invalid XML character(s) was found in the {0} node named ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "The string \"--\" is not permitted within comments." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "The value of attribute \"{1}\" associated with an element type \"{0}\" must not contain the ''<'' character." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "The unparsed entity reference \"&{0};\" is not permitted." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "The external entity reference \"&{0};\" is not permitted in an attribute value." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "The prefix \"{0}\" can not be bound to namespace \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "The local name of element \"{0}\" is null." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "The local name of attr \"{0}\" is null." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "The replacement text of the entity node \"{0}\" contains an element node \"{1}\" with an unbound prefix \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "The replacement text of the entity node \"{0}\" contains an attribute node \"{1}\" with an unbound prefix \"{2}\"." }, { MsgKey.ER_WRITING_INTERNAL_SUBSET, "An error occured while writing the internal subset." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/URI.java0000644000175000017500000013545710721374031023527 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: URI.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import java.io.IOException; import java.io.Serializable; /** * A class to represent a Uniform Resource Identifier (URI). This class * is designed to handle the parsing of URIs and provide access to * the various components (scheme, host, port, userinfo, path, query * string and fragment) that may constitute a URI. *

    * Parsing of a URI specification is done according to the URI * syntax described in RFC 2396 * . Every URI consists * of a scheme, followed by a colon (':'), followed by a scheme-specific * part. For URIs that follow the "generic URI" syntax, the scheme- * specific part begins with two slashes ("//") and may be followed * by an authority segment (comprised of user information, host, and * port), path segment, query segment and fragment. Note that RFC 2396 * no longer specifies the use of the parameters segment and excludes * the "user:password" syntax as part of the authority segment. If * "user:password" appears in a URI, the entire user/password string * is stored as userinfo. *

    * For URIs that do not follow the "generic URI" syntax (e.g. mailto), * the entire scheme-specific part is treated as the "path" portion * of the URI. *

    * Note that, unlike the java.net.URL class, this class does not provide * any built-in network access functionality nor does it provide any * scheme-specific functionality (for example, it does not know a * default port for a specific scheme). Rather, it only knows the * grammar and basic set of operations that can be applied to a URI. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * A minor change from the original is that this class no longer implements * Serializable, and the serialVersionUID magic field is dropped, and * the class is no longer "public". * * @xsl.usage internal */ final class URI { /** * MalformedURIExceptions are thrown in the process of building a URI * or setting fields on a URI when an operation would result in an * invalid URI specification. * */ public static class MalformedURIException extends IOException { /** * Constructs a MalformedURIException with no specified * detail message. */ public MalformedURIException() { super(); } /** * Constructs a MalformedURIException with the * specified detail message. * * @param p_msg the detail message. */ public MalformedURIException(String p_msg) { super(p_msg); } } /** reserved characters */ private static final String RESERVED_CHARACTERS = ";/?:@&=+$,"; /** * URI punctuation mark characters - these, combined with * alphanumerics, constitute the "unreserved" characters */ private static final String MARK_CHARACTERS = "-_.!~*'() "; /** scheme can be composed of alphanumerics and these characters */ private static final String SCHEME_CHARACTERS = "+-."; /** * userinfo can be composed of unreserved, escaped and these * characters */ private static final String USERINFO_CHARACTERS = ";:&=+$,"; /** Stores the scheme (usually the protocol) for this URI. * @serial */ private String m_scheme = null; /** If specified, stores the userinfo for this URI; otherwise null. * @serial */ private String m_userinfo = null; /** If specified, stores the host for this URI; otherwise null. * @serial */ private String m_host = null; /** If specified, stores the port for this URI; otherwise -1. * @serial */ private int m_port = -1; /** If specified, stores the path for this URI; otherwise null. * @serial */ private String m_path = null; /** * If specified, stores the query string for this URI; otherwise * null. * @serial */ private String m_queryString = null; /** If specified, stores the fragment for this URI; otherwise null. * @serial */ private String m_fragment = null; /** Indicate whether in DEBUG mode */ private static boolean DEBUG = false; /** * Construct a new and uninitialized URI. */ public URI(){} /** * Construct a new URI from another URI. All fields for this URI are * set equal to the fields of the URI passed in. * * @param p_other the URI to copy (cannot be null) */ public URI(URI p_other) { initialize(p_other); } /** * Construct a new URI from a URI specification string. If the * specification follows the "generic URI" syntax, (two slashes * following the first colon), the specification will be parsed * accordingly - setting the scheme, userinfo, host,port, path, query * string and fragment fields as necessary. If the specification does * not follow the "generic URI" syntax, the specification is parsed * into a scheme and scheme-specific part (stored as the path) only. * * @param p_uriSpec the URI specification string (cannot be null or * empty) * * @throws MalformedURIException if p_uriSpec violates any syntax * rules */ public URI(String p_uriSpec) throws MalformedURIException { this((URI) null, p_uriSpec); } /** * Construct a new URI from a base URI and a URI specification string. * The URI specification string may be a relative URI. * * @param p_base the base URI (cannot be null if p_uriSpec is null or * empty) * @param p_uriSpec the URI specification string (cannot be null or * empty if p_base is null) * * @throws MalformedURIException if p_uriSpec violates any syntax * rules */ public URI(URI p_base, String p_uriSpec) throws MalformedURIException { initialize(p_base, p_uriSpec); } /** * Construct a new URI that does not follow the generic URI syntax. * Only the scheme and scheme-specific part (stored as the path) are * initialized. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_schemeSpecificPart the scheme-specific part (cannot be * null or empty) * * @throws MalformedURIException if p_scheme violates any * syntax rules */ public URI(String p_scheme, String p_schemeSpecificPart) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException( "Cannot construct URI with null/empty scheme!"); } if (p_schemeSpecificPart == null || p_schemeSpecificPart.trim().length() == 0) { throw new MalformedURIException( "Cannot construct URI with null/empty scheme-specific part!"); } setScheme(p_scheme); setPath(p_schemeSpecificPart); } /** * Construct a new URI that follows the generic URI syntax from its * component parts. Each component is validated for syntax and some * basic semantic checks are performed as well. See the individual * setter methods for specifics. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_host the hostname or IPv4 address for the URI * @param p_path the URI path - if the path contains '?' or '#', * then the query string and/or fragment will be * set from the path; however, if the query and * fragment are specified both in the path and as * separate parameters, an exception is thrown * @param p_queryString the URI query string (cannot be specified * if path is null) * @param p_fragment the URI fragment (cannot be specified if path * is null) * * @throws MalformedURIException if any of the parameters violates * syntax rules or semantic rules */ public URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment) throws MalformedURIException { this(p_scheme, null, p_host, -1, p_path, p_queryString, p_fragment); } /** * Construct a new URI that follows the generic URI syntax from its * component parts. Each component is validated for syntax and some * basic semantic checks are performed as well. See the individual * setter methods for specifics. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_userinfo the URI userinfo (cannot be specified if host * is null) * @param p_host the hostname or IPv4 address for the URI * @param p_port the URI port (may be -1 for "unspecified"; cannot * be specified if host is null) * @param p_path the URI path - if the path contains '?' or '#', * then the query string and/or fragment will be * set from the path; however, if the query and * fragment are specified both in the path and as * separate parameters, an exception is thrown * @param p_queryString the URI query string (cannot be specified * if path is null) * @param p_fragment the URI fragment (cannot be specified if path * is null) * * @throws MalformedURIException if any of the parameters violates * syntax rules or semantic rules */ public URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_REQUIRED, null)); //"Scheme is required!"); } if (p_host == null) { if (p_userinfo != null) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_NO_USERINFO_IF_NO_HOST, null)); //"Userinfo may not be specified if host is not specified!"); } if (p_port != -1) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_NO_PORT_IF_NO_HOST, null)); //"Port may not be specified if host is not specified!"); } } if (p_path != null) { if (p_path.indexOf('?') != -1 && p_queryString != null) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_NO_QUERY_STRING_IN_PATH, null)); //"Query string cannot be specified in path and query string!"); } if (p_path.indexOf('#') != -1 && p_fragment != null) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, null)); //"Fragment cannot be specified in both the path and fragment!"); } } setScheme(p_scheme); setHost(p_host); setPort(p_port); setUserinfo(p_userinfo); setPath(p_path); setQueryString(p_queryString); setFragment(p_fragment); } /** * Initialize all fields of this URI from another URI. * * @param p_other the URI to copy (cannot be null) */ private void initialize(URI p_other) { m_scheme = p_other.getScheme(); m_userinfo = p_other.getUserinfo(); m_host = p_other.getHost(); m_port = p_other.getPort(); m_path = p_other.getPath(); m_queryString = p_other.getQueryString(); m_fragment = p_other.getFragment(); } /** * Initializes this URI from a base URI and a URI specification string. * See RFC 2396 Section 4 and Appendix B for specifications on parsing * the URI and Section 5 for specifications on resolving relative URIs * and relative paths. * * @param p_base the base URI (may be null if p_uriSpec is an absolute * URI) * @param p_uriSpec the URI spec string which may be an absolute or * relative URI (can only be null/empty if p_base * is not null) * * @throws MalformedURIException if p_base is null and p_uriSpec * is not an absolute URI or if * p_uriSpec violates syntax rules */ private void initialize(URI p_base, String p_uriSpec) throws MalformedURIException { if (p_base == null && (p_uriSpec == null || p_uriSpec.trim().length() == 0)) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, null)); //"Cannot initialize URI with empty parameters."); } // just make a copy of the base if spec is empty if (p_uriSpec == null || p_uriSpec.trim().length() == 0) { initialize(p_base); return; } String uriSpec = p_uriSpec.trim(); int uriSpecLen = uriSpec.length(); int index = 0; // check for scheme int colonIndex = uriSpec.indexOf(':'); if (colonIndex < 0) { if (p_base == null) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_NO_SCHEME_IN_URI, new Object[]{uriSpec})); //"No scheme found in URI: "+uriSpec); } } else { initializeScheme(uriSpec); uriSpec = uriSpec.substring(colonIndex+1); uriSpecLen = uriSpec.length(); } // two slashes means generic URI syntax, so we get the authority if (uriSpec.startsWith("//")) { index += 2; int startPos = index; // get authority - everything up to path, query or fragment char testChar = '\0'; while (index < uriSpecLen) { testChar = uriSpec.charAt(index); if (testChar == '/' || testChar == '?' || testChar == '#') { break; } index++; } // if we found authority, parse it out, otherwise we set the // host to empty string if (index > startPos) { initializeAuthority(uriSpec.substring(startPos, index)); } else { m_host = ""; } } initializePath(uriSpec.substring(index)); // Resolve relative URI to base URI - see RFC 2396 Section 5.2 // In some cases, it might make more sense to throw an exception // (when scheme is specified is the string spec and the base URI // is also specified, for example), but we're just following the // RFC specifications if (p_base != null) { // check to see if this is the current doc - RFC 2396 5.2 #2 // note that this is slightly different from the RFC spec in that // we don't include the check for query string being null // - this handles cases where the urispec is just a query // string or a fragment (e.g. "?y" or "#s") - // see which // identified this as a bug in the RFC if (m_path.length() == 0 && m_scheme == null && m_host == null) { m_scheme = p_base.getScheme(); m_userinfo = p_base.getUserinfo(); m_host = p_base.getHost(); m_port = p_base.getPort(); m_path = p_base.getPath(); if (m_queryString == null) { m_queryString = p_base.getQueryString(); } return; } // check for scheme - RFC 2396 5.2 #3 // if we found a scheme, it means absolute URI, so we're done if (m_scheme == null) { m_scheme = p_base.getScheme(); } // check for authority - RFC 2396 5.2 #4 // if we found a host, then we've got a network path, so we're done if (m_host == null) { m_userinfo = p_base.getUserinfo(); m_host = p_base.getHost(); m_port = p_base.getPort(); } else { return; } // check for absolute path - RFC 2396 5.2 #5 if (m_path.length() > 0 && m_path.startsWith("/")) { return; } // if we get to this point, we need to resolve relative path // RFC 2396 5.2 #6 String path = new String(); String basePath = p_base.getPath(); // 6a - get all but the last segment of the base URI path if (basePath != null) { int lastSlash = basePath.lastIndexOf('/'); if (lastSlash != -1) { path = basePath.substring(0, lastSlash + 1); } } // 6b - append the relative URI path path = path.concat(m_path); // 6c - remove all "./" where "." is a complete path segment index = -1; while ((index = path.indexOf("/./")) != -1) { path = path.substring(0, index + 1).concat(path.substring(index + 3)); } // 6d - remove "." if path ends with "." as a complete path segment if (path.endsWith("/.")) { path = path.substring(0, path.length() - 1); } // 6e - remove all "/../" where "" is a complete // path segment not equal to ".." index = -1; int segIndex = -1; String tempString = null; while ((index = path.indexOf("/../")) > 0) { tempString = path.substring(0, path.indexOf("/../")); segIndex = tempString.lastIndexOf('/'); if (segIndex != -1) { if (!tempString.substring(segIndex++).equals("..")) { path = path.substring(0, segIndex).concat(path.substring(index + 4)); } } } // 6f - remove ending "/.." where "" is a // complete path segment if (path.endsWith("/..")) { tempString = path.substring(0, path.length() - 3); segIndex = tempString.lastIndexOf('/'); if (segIndex != -1) { path = path.substring(0, segIndex + 1); } } m_path = path; } } /** * Initialize the scheme for this URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * * @throws MalformedURIException if URI does not have a conformant * scheme */ private void initializeScheme(String p_uriSpec) throws MalformedURIException { int uriSpecLen = p_uriSpec.length(); int index = 0; String scheme = null; char testChar = '\0'; while (index < uriSpecLen) { testChar = p_uriSpec.charAt(index); if (testChar == ':' || testChar == '/' || testChar == '?' || testChar == '#') { break; } index++; } scheme = p_uriSpec.substring(0, index); if (scheme.length() == 0) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_NO_SCHEME_INURI, null)); //"No scheme found in URI."); } else { setScheme(scheme); } } /** * Initialize the authority (userinfo, host and port) for this * URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * * @throws MalformedURIException if p_uriSpec violates syntax rules */ private void initializeAuthority(String p_uriSpec) throws MalformedURIException { int index = 0; int start = 0; int end = p_uriSpec.length(); char testChar = '\0'; String userinfo = null; // userinfo is everything up @ if (p_uriSpec.indexOf('@', start) != -1) { while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '@') { break; } index++; } userinfo = p_uriSpec.substring(start, index); index++; } // host is everything up to ':' String host = null; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == ':') { break; } index++; } host = p_uriSpec.substring(start, index); int port = -1; if (host.length() > 0) { // port if (testChar == ':') { index++; start = index; while (index < end) { index++; } String portStr = p_uriSpec.substring(start, index); if (portStr.length() > 0) { for (int i = 0; i < portStr.length(); i++) { if (!isDigit(portStr.charAt(i))) { throw new MalformedURIException( portStr + " is invalid. Port should only contain digits!"); } } try { port = Integer.parseInt(portStr); } catch (NumberFormatException nfe) { // can't happen } } } } setHost(host); setPort(port); setUserinfo(userinfo); } /** * Initialize the path for this URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * * @throws MalformedURIException if p_uriSpec violates syntax rules */ private void initializePath(String p_uriSpec) throws MalformedURIException { if (p_uriSpec == null) { throw new MalformedURIException( "Cannot initialize path from null string!"); } int index = 0; int start = 0; int end = p_uriSpec.length(); char testChar = '\0'; // path - everything up to query string or fragment while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '?' || testChar == '#') { break; } // check for valid escape sequence if (testChar == '%') { if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1)) ||!isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, null)); //"Path contains invalid escape sequence!"); } } else if (!isReservedCharacter(testChar) &&!isUnreservedCharacter(testChar)) { if ('\\' != testChar) throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_PATH_INVALID_CHAR, new Object[]{String.valueOf(testChar)})); //"Path contains invalid character: " //+ testChar); } index++; } m_path = p_uriSpec.substring(start, index); // query - starts with ? and up to fragment or end if (testChar == '?') { index++; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '#') { break; } if (testChar == '%') { if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1)) ||!isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Query string contains invalid escape sequence!"); } } else if (!isReservedCharacter(testChar) &&!isUnreservedCharacter(testChar)) { throw new MalformedURIException( "Query string contains invalid character:" + testChar); } index++; } m_queryString = p_uriSpec.substring(start, index); } // fragment - starts with # if (testChar == '#') { index++; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '%') { if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1)) ||!isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Fragment contains invalid escape sequence!"); } } else if (!isReservedCharacter(testChar) &&!isUnreservedCharacter(testChar)) { throw new MalformedURIException( "Fragment contains invalid character:" + testChar); } index++; } m_fragment = p_uriSpec.substring(start, index); } } /** * Get the scheme for this URI. * * @return the scheme for this URI */ public String getScheme() { return m_scheme; } /** * Get the scheme-specific part for this URI (everything following the * scheme and the first colon). See RFC 2396 Section 5.2 for spec. * * @return the scheme-specific part for this URI */ public String getSchemeSpecificPart() { StringBuffer schemespec = new StringBuffer(); if (m_userinfo != null || m_host != null || m_port != -1) { schemespec.append("//"); } if (m_userinfo != null) { schemespec.append(m_userinfo); schemespec.append('@'); } if (m_host != null) { schemespec.append(m_host); } if (m_port != -1) { schemespec.append(':'); schemespec.append(m_port); } if (m_path != null) { schemespec.append((m_path)); } if (m_queryString != null) { schemespec.append('?'); schemespec.append(m_queryString); } if (m_fragment != null) { schemespec.append('#'); schemespec.append(m_fragment); } return schemespec.toString(); } /** * Get the userinfo for this URI. * * @return the userinfo for this URI (null if not specified). */ public String getUserinfo() { return m_userinfo; } /** * Get the host for this URI. * * @return the host for this URI (null if not specified). */ public String getHost() { return m_host; } /** * Get the port for this URI. * * @return the port for this URI (-1 if not specified). */ public int getPort() { return m_port; } /** * Get the path for this URI (optionally with the query string and * fragment). * * @param p_includeQueryString if true (and query string is not null), * then a "?" followed by the query string * will be appended * @param p_includeFragment if true (and fragment is not null), * then a "#" followed by the fragment * will be appended * * @return the path for this URI possibly including the query string * and fragment */ public String getPath(boolean p_includeQueryString, boolean p_includeFragment) { StringBuffer pathString = new StringBuffer(m_path); if (p_includeQueryString && m_queryString != null) { pathString.append('?'); pathString.append(m_queryString); } if (p_includeFragment && m_fragment != null) { pathString.append('#'); pathString.append(m_fragment); } return pathString.toString(); } /** * Get the path for this URI. Note that the value returned is the path * only and does not include the query string or fragment. * * @return the path for this URI. */ public String getPath() { return m_path; } /** * Get the query string for this URI. * * @return the query string for this URI. Null is returned if there * was no "?" in the URI spec, empty string if there was a * "?" but no query string following it. */ public String getQueryString() { return m_queryString; } /** * Get the fragment for this URI. * * @return the fragment for this URI. Null is returned if there * was no "#" in the URI spec, empty string if there was a * "#" but no fragment following it. */ public String getFragment() { return m_fragment; } /** * Set the scheme for this URI. The scheme is converted to lowercase * before it is set. * * @param p_scheme the scheme for this URI (cannot be null) * * @throws MalformedURIException if p_scheme is not a conformant * scheme name */ public void setScheme(String p_scheme) throws MalformedURIException { if (p_scheme == null) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_FROM_NULL_STRING, null)); //"Cannot set scheme from null string!"); } if (!isConformantSchemeName(p_scheme)) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_NOT_CONFORMANT, null)); //"The scheme is not conformant."); } m_scheme = p_scheme.toLowerCase(); } /** * Set the userinfo for this URI. If a non-null value is passed in and * the host value is null, then an exception is thrown. * * @param p_userinfo the userinfo for this URI * * @throws MalformedURIException if p_userinfo contains invalid * characters */ public void setUserinfo(String p_userinfo) throws MalformedURIException { if (p_userinfo == null) { m_userinfo = null; } else { if (m_host == null) { throw new MalformedURIException( "Userinfo cannot be set when host is null!"); } // userinfo can contain alphanumerics, mark characters, escaped // and ';',':','&','=','+','$',',' int index = 0; int end = p_userinfo.length(); char testChar = '\0'; while (index < end) { testChar = p_userinfo.charAt(index); if (testChar == '%') { if (index + 2 >= end ||!isHex(p_userinfo.charAt(index + 1)) ||!isHex(p_userinfo.charAt(index + 2))) { throw new MalformedURIException( "Userinfo contains invalid escape sequence!"); } } else if (!isUnreservedCharacter(testChar) && USERINFO_CHARACTERS.indexOf(testChar) == -1) { throw new MalformedURIException( "Userinfo contains invalid character:" + testChar); } index++; } } m_userinfo = p_userinfo; } /** * Set the host for this URI. If null is passed in, the userinfo * field is also set to null and the port is set to -1. * * @param p_host the host for this URI * * @throws MalformedURIException if p_host is not a valid IP * address or DNS hostname. */ public void setHost(String p_host) throws MalformedURIException { if (p_host == null || p_host.trim().length() == 0) { m_host = p_host; m_userinfo = null; m_port = -1; } else if (!isWellFormedAddress(p_host)) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!"); } m_host = p_host; } /** * Set the port for this URI. -1 is used to indicate that the port is * not specified, otherwise valid port numbers are between 0 and 65535. * If a valid port number is passed in and the host field is null, * an exception is thrown. * * @param p_port the port number for this URI * * @throws MalformedURIException if p_port is not -1 and not a * valid port number */ public void setPort(int p_port) throws MalformedURIException { if (p_port >= 0 && p_port <= 65535) { if (m_host == null) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_PORT_WHEN_HOST_NULL, null)); //"Port cannot be set when host is null!"); } } else if (p_port != -1) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_INVALID_PORT, null)); //"Invalid port number!"); } m_port = p_port; } /** * Set the path for this URI. If the supplied path is null, then the * query string and fragment are set to null as well. If the supplied * path includes a query string and/or fragment, these fields will be * parsed and set as well. Note that, for URIs following the "generic * URI" syntax, the path specified should start with a slash. * For URIs that do not follow the generic URI syntax, this method * sets the scheme-specific part. * * @param p_path the path for this URI (may be null) * * @throws MalformedURIException if p_path contains invalid * characters */ public void setPath(String p_path) throws MalformedURIException { if (p_path == null) { m_path = null; m_queryString = null; m_fragment = null; } else { initializePath(p_path); } } /** * Append to the end of the path of this URI. If the current path does * not end in a slash and the path to be appended does not begin with * a slash, a slash will be appended to the current path before the * new segment is added. Also, if the current path ends in a slash * and the new segment begins with a slash, the extra slash will be * removed before the new segment is appended. * * @param p_addToPath the new segment to be added to the current path * * @throws MalformedURIException if p_addToPath contains syntax * errors */ public void appendPath(String p_addToPath) throws MalformedURIException { if (p_addToPath == null || p_addToPath.trim().length() == 0) { return; } if (!isURIString(p_addToPath)) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_PATH_INVALID_CHAR, new Object[]{p_addToPath})); //"Path contains invalid character!"); } if (m_path == null || m_path.trim().length() == 0) { if (p_addToPath.startsWith("/")) { m_path = p_addToPath; } else { m_path = "/" + p_addToPath; } } else if (m_path.endsWith("/")) { if (p_addToPath.startsWith("/")) { m_path = m_path.concat(p_addToPath.substring(1)); } else { m_path = m_path.concat(p_addToPath); } } else { if (p_addToPath.startsWith("/")) { m_path = m_path.concat(p_addToPath); } else { m_path = m_path.concat("/" + p_addToPath); } } } /** * Set the query string for this URI. A non-null value is valid only * if this is an URI conforming to the generic URI syntax and * the path value is not null. * * @param p_queryString the query string for this URI * * @throws MalformedURIException if p_queryString is not null and this * URI does not conform to the generic * URI syntax or if the path is null */ public void setQueryString(String p_queryString) throws MalformedURIException { if (p_queryString == null) { m_queryString = null; } else if (!isGenericURI()) { throw new MalformedURIException( "Query string can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( "Query string cannot be set when path is null!"); } else if (!isURIString(p_queryString)) { throw new MalformedURIException( "Query string contains invalid character!"); } else { m_queryString = p_queryString; } } /** * Set the fragment for this URI. A non-null value is valid only * if this is a URI conforming to the generic URI syntax and * the path value is not null. * * @param p_fragment the fragment for this URI * * @throws MalformedURIException if p_fragment is not null and this * URI does not conform to the generic * URI syntax or if the path is null */ public void setFragment(String p_fragment) throws MalformedURIException { if (p_fragment == null) { m_fragment = null; } else if (!isGenericURI()) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( Utils.messages.createMessage(MsgKey.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!"); } else if (!isURIString(p_fragment)) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!"); } else { m_fragment = p_fragment; } } /** * Determines if the passed-in Object is equivalent to this URI. * * @param p_test the Object to test for equality. * * @return true if p_test is a URI with all values equal to this * URI, false otherwise */ public boolean equals(Object p_test) { if (p_test instanceof URI) { URI testURI = (URI) p_test; if (((m_scheme == null && testURI.m_scheme == null) || (m_scheme != null && testURI.m_scheme != null && m_scheme.equals( testURI.m_scheme))) && ((m_userinfo == null && testURI.m_userinfo == null) || (m_userinfo != null && testURI.m_userinfo != null && m_userinfo.equals( testURI.m_userinfo))) && ((m_host == null && testURI.m_host == null) || (m_host != null && testURI.m_host != null && m_host.equals( testURI.m_host))) && m_port == testURI.m_port && ((m_path == null && testURI.m_path == null) || (m_path != null && testURI.m_path != null && m_path.equals( testURI.m_path))) && ((m_queryString == null && testURI.m_queryString == null) || (m_queryString != null && testURI.m_queryString != null && m_queryString.equals( testURI.m_queryString))) && ((m_fragment == null && testURI.m_fragment == null) || (m_fragment != null && testURI.m_fragment != null && m_fragment.equals( testURI.m_fragment)))) { return true; } } return false; } /** * Get the URI as a string specification. See RFC 2396 Section 5.2. * * @return the URI string specification */ public String toString() { StringBuffer uriSpecString = new StringBuffer(); if (m_scheme != null) { uriSpecString.append(m_scheme); uriSpecString.append(':'); } uriSpecString.append(getSchemeSpecificPart()); return uriSpecString.toString(); } /** * Get the indicator as to whether this URI uses the "generic URI" * syntax. * * @return true if this URI uses the "generic URI" syntax, false * otherwise */ public boolean isGenericURI() { // presence of the host (whether valid or empty) means // double-slashes which means generic uri return (m_host != null); } /** * Determine whether a scheme conforms to the rules for a scheme name. * A scheme is conformant if it starts with an alphanumeric, and * contains only alphanumerics, '+','-' and '.'. * * * @param p_scheme The sheme name to check * @return true if the scheme is conformant, false otherwise */ public static boolean isConformantSchemeName(String p_scheme) { if (p_scheme == null || p_scheme.trim().length() == 0) { return false; } if (!isAlpha(p_scheme.charAt(0))) { return false; } char testChar; for (int i = 1; i < p_scheme.length(); i++) { testChar = p_scheme.charAt(i); if (!isAlphanum(testChar) && SCHEME_CHARACTERS.indexOf(testChar) == -1) { return false; } } return true; } /** * Determine whether a string is syntactically capable of representing * a valid IPv4 address or the domain name of a network host. A valid * IPv4 address consists of four decimal digit groups separated by a * '.'. A hostname consists of domain labels (each of which must * begin and end with an alphanumeric but may contain '-') separated * & by a '.'. See RFC 2396 Section 3.2.2. * * * @param p_address The address string to check * @return true if the string is a syntactically valid IPv4 address * or hostname */ public static boolean isWellFormedAddress(String p_address) { if (p_address == null) { return false; } String address = p_address.trim(); int addrLength = address.length(); if (addrLength == 0 || addrLength > 255) { return false; } if (address.startsWith(".") || address.startsWith("-")) { return false; } // rightmost domain label starting with digit indicates IP address // since top level domain label can only start with an alpha // see RFC 2396 Section 3.2.2 int index = address.lastIndexOf('.'); if (address.endsWith(".")) { index = address.substring(0, index).lastIndexOf('.'); } if (index + 1 < addrLength && isDigit(p_address.charAt(index + 1))) { char testChar; int numDots = 0; // make sure that 1) we see only digits and dot separators, 2) that // any dot separator is preceded and followed by a digit and // 3) that we find 3 dots for (int i = 0; i < addrLength; i++) { testChar = address.charAt(i); if (testChar == '.') { if (!isDigit(address.charAt(i - 1)) || (i + 1 < addrLength &&!isDigit(address.charAt(i + 1)))) { return false; } numDots++; } else if (!isDigit(testChar)) { return false; } } if (numDots != 3) { return false; } } else { // domain labels can contain alphanumerics and '-" // but must start and end with an alphanumeric char testChar; for (int i = 0; i < addrLength; i++) { testChar = address.charAt(i); if (testChar == '.') { if (!isAlphanum(address.charAt(i - 1))) { return false; } if (i + 1 < addrLength &&!isAlphanum(address.charAt(i + 1))) { return false; } } else if (!isAlphanum(testChar) && testChar != '-') { return false; } } } return true; } /** * Determine whether a char is a digit. * * * @param p_char the character to check * @return true if the char is betweeen '0' and '9', false otherwise */ private static boolean isDigit(char p_char) { return p_char >= '0' && p_char <= '9'; } /** * Determine whether a character is a hexadecimal character. * * * @param p_char the character to check * @return true if the char is betweeen '0' and '9', 'a' and 'f' * or 'A' and 'F', false otherwise */ private static boolean isHex(char p_char) { return (isDigit(p_char) || (p_char >= 'a' && p_char <= 'f') || (p_char >= 'A' && p_char <= 'F')); } /** * Determine whether a char is an alphabetic character: a-z or A-Z * * * @param p_char the character to check * @return true if the char is alphabetic, false otherwise */ private static boolean isAlpha(char p_char) { return ((p_char >= 'a' && p_char <= 'z') || (p_char >= 'A' && p_char <= 'Z')); } /** * Determine whether a char is an alphanumeric: 0-9, a-z or A-Z * * * @param p_char the character to check * @return true if the char is alphanumeric, false otherwise */ private static boolean isAlphanum(char p_char) { return (isAlpha(p_char) || isDigit(p_char)); } /** * Determine whether a character is a reserved character: * ';', '/', '?', ':', '@', '&', '=', '+', '$' or ',' * * * @param p_char the character to check * @return true if the string contains any reserved characters */ private static boolean isReservedCharacter(char p_char) { return RESERVED_CHARACTERS.indexOf(p_char) != -1; } /** * Determine whether a char is an unreserved character. * * * @param p_char the character to check * @return true if the char is unreserved, false otherwise */ private static boolean isUnreservedCharacter(char p_char) { return (isAlphanum(p_char) || MARK_CHARACTERS.indexOf(p_char) != -1); } /** * Determine whether a given string contains only URI characters (also * called "uric" in RFC 2396). uric consist of all reserved * characters, unreserved characters and escaped characters. * * * @param p_uric URI string * @return true if the string is comprised of uric, false otherwise */ private static boolean isURIString(String p_uric) { if (p_uric == null) { return false; } int end = p_uric.length(); char testChar = '\0'; for (int i = 0; i < end; i++) { testChar = p_uric.charAt(i); if (testChar == '%') { if (i + 2 >= end ||!isHex(p_uric.charAt(i + 1)) ||!isHex(p_uric.charAt(i + 2))) { return false; } else { i += 2; continue; } } if (isReservedCharacter(testChar) || isUnreservedCharacter(testChar)) { continue; } else { return false; } } return true; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/AttList.java0000644000175000017500000001550210721374030024437 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttList.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.xml.sax.Attributes; /** * Wraps a DOM attribute list in a SAX Attributes. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * A minor changes from that package are: * DOMHelper reference changed to DOM2Helper, class is not "public" * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public final class AttList implements Attributes { /** List of attribute nodes */ NamedNodeMap m_attrs; /** Index of last attribute node */ int m_lastIndex; // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! // DOM2Helper m_dh = new DOM2Helper(); /** Local reference to DOMHelper */ DOM2Helper m_dh; // /** // * Constructor AttList // * // * // * @param attrs List of attributes this will contain // */ // public AttList(NamedNodeMap attrs) // { // // m_attrs = attrs; // m_lastIndex = m_attrs.getLength() - 1; // m_dh = new DOM2Helper(); // } /** * Constructor AttList * * * @param attrs List of attributes this will contain * @param dh DOMHelper */ public AttList(NamedNodeMap attrs, DOM2Helper dh) { m_attrs = attrs; m_lastIndex = m_attrs.getLength() - 1; m_dh = dh; } /** * Get the number of attribute nodes in the list * * * @return number of attribute nodes */ public int getLength() { return m_attrs.getLength(); } /** * Look up an attribute's Namespace URI by index. * * @param index The attribute index (zero-based). * @return The Namespace URI, or the empty string if none * is available, or null if the index is out of * range. */ public String getURI(int index) { String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index))); if(null == ns) ns = ""; return ns; } /** * Look up an attribute's local name by index. * * @param index The attribute index (zero-based). * @return The local name, or the empty string if Namespace * processing is not being performed, or null * if the index is out of range. */ public String getLocalName(int index) { return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index))); } /** * Look up an attribute's qualified name by index. * * * @param i The attribute index (zero-based). * * @return The attribute's qualified name */ public String getQName(int i) { return ((Attr) m_attrs.item(i)).getName(); } /** * Get the attribute's node type by index * * * @param i The attribute index (zero-based) * * @return the attribute's node type */ public String getType(int i) { return "CDATA"; // for the moment } /** * Get the attribute's node value by index * * * @param i The attribute index (zero-based) * * @return the attribute's node value */ public String getValue(int i) { return ((Attr) m_attrs.item(i)).getValue(); } /** * Get the attribute's node type by name * * * @param name Attribute name * * @return the attribute's node type */ public String getType(String name) { return "CDATA"; // for the moment } /** * Look up an attribute's type by Namespace name. * * @param uri The Namespace URI, or the empty String if the * name has no Namespace URI. * @param localName The local name of the attribute. * @return The attribute type as a string, or null if the * attribute is not in the list or if Namespace * processing is not being performed. */ public String getType(String uri, String localName) { return "CDATA"; // for the moment } /** * Look up an attribute's value by name. * * * @param name The attribute node's name * * @return The attribute node's value */ public String getValue(String name) { Attr attr = ((Attr) m_attrs.getNamedItem(name)); return (null != attr) ? attr.getValue() : null; } /** * Look up an attribute's value by Namespace name. * * @param uri The Namespace URI, or the empty String if the * name has no Namespace URI. * @param localName The local name of the attribute. * @return The attribute value as a string, or null if the * attribute is not in the list. */ public String getValue(String uri, String localName) { Node a=m_attrs.getNamedItemNS(uri,localName); return (a==null) ? null : a.getNodeValue(); } /** * Look up the index of an attribute by Namespace name. * * @param uri The Namespace URI, or the empty string if * the name has no Namespace URI. * @param localPart The attribute's local name. * @return The index of the attribute, or -1 if it does not * appear in the list. */ public int getIndex(String uri, String localPart) { for(int i=m_attrs.getLength()-1;i>=0;--i) { Node a=m_attrs.item(i); String u=a.getNamespaceURI(); if( (u==null ? uri==null : u.equals(uri)) && a.getLocalName().equals(localPart) ) return i; } return -1; } /** * Look up the index of an attribute by raw XML 1.0 name. * * @param qName The qualified (prefixed) name. * @return The index of the attribute, or -1 if it does not * appear in the list. */ public int getIndex(String qName) { for(int i=m_attrs.getLength()-1;i>=0;--i) { Node a=m_attrs.item(i); if(a.getNodeName().equals(qName) ) return i; } return -1; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/BoolStack.java0000644000175000017500000001144010721374031024732 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BoolStack.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; /** * Simple stack for boolean values. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * A minor changes from that package are: * doesn't implement Clonable * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public final class BoolStack { /** Array of boolean values */ private boolean m_values[]; /** Array size allocated */ private int m_allocatedSize; /** Index into the array of booleans */ private int m_index; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public BoolStack() { this(32); } /** * Construct a IntVector, using the given block size. * * @param size array size to allocate */ public BoolStack(int size) { m_allocatedSize = size; m_values = new boolean[size]; m_index = -1; } /** * Get the length of the list. * * @return Current length of the list */ public final int size() { return m_index + 1; } /** * Clears the stack. * */ public final void clear() { m_index = -1; } /** * Pushes an item onto the top of this stack. * * * @param val the boolean to be pushed onto this stack. * @return the item argument. */ public final boolean push(boolean val) { if (m_index == m_allocatedSize - 1) grow(); return (m_values[++m_index] = val); } /** * Removes the object at the top of this stack and returns that * object as the value of this function. * * @return The object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final boolean pop() { return m_values[m_index--]; } /** * Removes the object at the top of this stack and returns the * next object at the top as the value of this function. * * * @return Next object to the top or false if none there */ public final boolean popAndTop() { m_index--; return (m_index >= 0) ? m_values[m_index] : false; } /** * Set the item at the top of this stack * * * @param b Object to set at the top of this stack */ public final void setTop(boolean b) { m_values[m_index] = b; } /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final boolean peek() { return m_values[m_index]; } /** * Looks at the object at the top of this stack without removing it * from the stack. If the stack is empty, it returns false. * * @return the object at the top of this stack. */ public final boolean peekOrFalse() { return (m_index > -1) ? m_values[m_index] : false; } /** * Looks at the object at the top of this stack without removing it * from the stack. If the stack is empty, it returns true. * * @return the object at the top of this stack. */ public final boolean peekOrTrue() { return (m_index > -1) ? m_values[m_index] : true; } /** * Tests if this stack is empty. * * @return true if this stack is empty; * false otherwise. */ public boolean isEmpty() { return (m_index == -1); } /** * Grows the size of the stack * */ private void grow() { m_allocatedSize *= 2; boolean newVector[] = new boolean[m_allocatedSize]; System.arraycopy(m_values, 0, newVector, 0, m_index + 1); m_values = newVector; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/MsgKey.java0000644000175000017500000001575310721374030024262 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MsgKey.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; /** * This class is not a public API, * It is used internally by serializer and is public, * in the Java sense, only because its use crosses * package boundaries. *

    * This class holds only the message keys used * when generating messages. */ public class MsgKey { /** An internal error with the messages, * this is the message to use if the message key can't be found */ public static final String BAD_MSGKEY = "BAD_MSGKEY"; /** * An internal error with the messages, * this is the message to use if the message format operation failed. */ public static final String BAD_MSGFORMAT = "BAD_MSGFORMAT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_OIERROR = "ER_OIERROR"; public static final String ER_NAMESPACE_PREFIX = "ER_NAMESPACE_PREFIX"; public static final String ER_STRAY_ATTRIBUTE = "ER_STRAY_ATTRIBUTE"; public static final String ER_STRAY_NAMESPACE = "ER_STRAY_NAMESPACE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_COULD_NOT_LOAD_METHOD_PROPERTY = "ER_COULD_NOT_LOAD_METHOD_PROPERTY"; public static final String ER_SERIALIZER_NOT_CONTENTHANDLER = "ER_SERIALIZER_NOT_CONTENTHANDLER"; public static final String ER_ILLEGAL_ATTRIBUTE_POSITION = "ER_ILLEGAL_ATTRIBUTE_POSITION"; public static final String ER_ILLEGAL_CHARACTER = "ER_ILLEGAL_CHARACTER"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_FOR_GENERIC_URI = "ER_FRAG_FOR_GENERIC_URI"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_XML_VERSION_NOT_SUPPORTED = "ER_XML_VERSION_NOT_SUPPORTED"; public static final String ER_FACTORY_PROPERTY_MISSING = "ER_FACTORY_PROPERTY_MISSING"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; // DOM Exceptions public static final String ER_FEATURE_NOT_FOUND = "FEATURE_NOT_FOUND"; public static final String ER_FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED"; public static final String ER_STRING_TOO_LONG = "DOMSTRING_SIZE_ERR"; public static final String ER_TYPE_MISMATCH_ERR = "TYPE_MISMATCH_ERR"; // DOM Level 3 load and save messages public static final String ER_NO_OUTPUT_SPECIFIED = "no-output-specified"; public static final String ER_UNSUPPORTED_ENCODING = "unsupported-encoding"; public static final String ER_ELEM_UNBOUND_PREFIX_IN_ENTREF = "unbound-prefix-in-entity-reference"; public static final String ER_ATTR_UNBOUND_PREFIX_IN_ENTREF = "unbound-prefix-in-entity-reference"; public static final String ER_CDATA_SECTIONS_SPLIT = "cdata-sections-splitted"; public static final String ER_WF_INVALID_CHARACTER = "wf-invalid-character"; public static final String ER_WF_INVALID_CHARACTER_IN_NODE_NAME = "wf-invalid-character-in-node-name"; // DOM Level 3 Implementation specific Exceptions public static final String ER_UNABLE_TO_SERIALIZE_NODE = "ER_UNABLE_TO_SERIALIZE_NODE"; public static final String ER_WARNING_WF_NOT_CHECKED = "ER_WARNING_WF_NOT_CHECKED"; public static final String ER_WF_INVALID_CHARACTER_IN_COMMENT = "ER_WF_INVALID_CHARACTER_IN_COMMENT"; public static final String ER_WF_INVALID_CHARACTER_IN_PI = "ER_WF_INVALID_CHARACTER_IN_PI"; public static final String ER_WF_INVALID_CHARACTER_IN_CDATA = "ER_WF_INVALID_CHARACTER_IN_CDATA"; public static final String ER_WF_INVALID_CHARACTER_IN_TEXT = "ER_WF_INVALID_CHARACTER_IN_TEXT"; public static final String ER_WF_DASH_IN_COMMENT = "ER_WF_DASH_IN_COMMENT"; public static final String ER_WF_LT_IN_ATTVAL = "ER_WF_LT_IN_ATTVAL"; public static final String ER_WF_REF_TO_UNPARSED_ENT = "ER_WF_REF_TO_UNPARSED_ENT"; public static final String ER_WF_REF_TO_EXTERNAL_ENT = "ER_WF_REF_TO_EXTERNAL_ENT"; public static final String ER_NS_PREFIX_CANNOT_BE_BOUND = "ER_NS_PREFIX_CANNOT_BE_BOUND"; public static final String ER_NULL_LOCAL_ELEMENT_NAME = "ER_NULL_LOCAL_ELEMENT_NAME"; public static final String ER_NULL_LOCAL_ATTR_NAME = "ER_NULL_LOCAL_ATTR_NAME"; public static final String ER_WRITING_INTERNAL_SUBSET = "ER_WRITING_INTERNAL_SUBSET"; } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_fr.java0000644000175000017500000003253710721374030027352 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_fr.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_fr extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "La cl\u00e9 du message ''{0}'' ne se trouve pas dans la classe du message ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Le format du message ''{0}'' de la classe du message ''{1}'' est incorrect." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "La classe de la m\u00e9thode de s\u00e9rialisation ''{0}'' n''impl\u00e9mente pas org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "La ressource [ {0} ] est introuvable.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "La ressource [ {0} ] n''a pas pu charger : {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Taille du tampon <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Substitut UTF-16 non valide d\u00e9tect\u00e9 : {0} ?" }, { MsgKey.ER_OIERROR, "Erreur d'E-S" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Ajout impossible de l''attribut {0} apr\u00e8s des noeuds enfants ou avant la production d''un \u00e9l\u00e9ment. L''attribut est ignor\u00e9." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "L''espace de noms du pr\u00e9fixe ''{0}'' n''a pas \u00e9t\u00e9 d\u00e9clar\u00e9." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "L''attribut ''{0}'' est \u00e0 l''ext\u00e9rieur de l''\u00e9l\u00e9ment." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "La d\u00e9claration d''espace de noms ''{0}''=''{1}'' est \u00e0 l''ext\u00e9rieur de l''\u00e9l\u00e9ment." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Impossible de charger ''{0}'' (v\u00e9rifier CLASSPATH), les valeurs par d\u00e9faut sont donc employ\u00e9es" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Tentative de sortie d''un caract\u00e8re de la valeur enti\u00e8re {0} non repr\u00e9sent\u00e9e dans l''encodage de sortie de {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Impossible de charger le fichier de propri\u00e9t\u00e9s ''{0}'' pour la m\u00e9thode de sortie ''{1}'' (v\u00e9rifier CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "Num\u00e9ro de port non valide" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Le port ne peut \u00eatre d\u00e9fini quand l'h\u00f4te est vide" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "L'h\u00f4te n'est pas une adresse bien form\u00e9e" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Le processus n'est pas conforme." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Impossible de d\u00e9finir le processus \u00e0 partir de la cha\u00eene vide" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Le chemin d'acc\u00e8s contient une s\u00e9quence d'\u00e9chappement non valide" }, { MsgKey.ER_PATH_INVALID_CHAR, "Le chemin contient un caract\u00e8re non valide : {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Le fragment contient un caract\u00e8re non valide" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Le fragment ne peut \u00eatre d\u00e9fini quand le chemin d'acc\u00e8s est vide" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Le fragment ne peut \u00eatre d\u00e9fini que pour un URI g\u00e9n\u00e9rique" }, { MsgKey.ER_NO_SCHEME_IN_URI, "Processus introuvable dans l'URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Impossible d'initialiser l'URI avec des param\u00e8tres vides" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Le fragment ne doit pas \u00eatre indiqu\u00e9 \u00e0 la fois dans le chemin et dans le fragment" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "La cha\u00eene de requ\u00eate ne doit pas figurer dans un chemin et une cha\u00eene de requ\u00eate" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Le port peut ne pas \u00eatre sp\u00e9cifi\u00e9 si l'h\u00f4te n'est pas sp\u00e9cifi\u00e9" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Userinfo ne peut \u00eatre sp\u00e9cifi\u00e9 si l'h\u00f4te ne l'est pas" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Avertissement : La version du document de sortie doit \u00eatre ''{0}''. Cette version XML n''est pas prise en charge. La version du document de sortie sera ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Processus requis !" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "L''objet Properties transmis \u00e0 SerializerFactory ne dispose pas de propri\u00e9t\u00e9 ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Avertissement : Le codage ''{0}'' n''est pas pris en charge par l''environnement d''ex\u00e9cution Java." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Le param\u00e8tre ''{0}'' n''est pas reconnu."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Le param\u00e8tre ''{0}'' est reconnu mas la valeur demand\u00e9e ne peut pas \u00eatre d\u00e9finie."}, {MsgKey.ER_STRING_TOO_LONG, "La cha\u00eene obtenue est trop longue pour un DOMString : ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Le type de valeur de ce param\u00e8tre est incompatible avec le type de valeur attendu."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "La sortie de destination des donn\u00e9es \u00e0 \u00e9crire \u00e9tait vide."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Codage non pris en charge."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Le noeud ne peut pas \u00eatre s\u00e9rialis\u00e9."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "La section CDATA contient un ou plusieurs marqueurs de fin ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Aucune instance du programme de v\u00e9rification de la formation n'a pu \u00eatre cr\u00e9\u00e9e. La valeur true a \u00e9t\u00e9 attribu\u00e9e au param\u00e8tre well-formed mais la v\u00e9rification de la formation n'a pas pu \u00eatre effectu\u00e9e." }, {MsgKey.ER_WF_INVALID_CHARACTER, "Le noeud ''{0}'' contient des caract\u00e8res XML non valides." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "Un caract\u00e8re XML non valide (Unicode : 0x{0}) a \u00e9t\u00e9 trouv\u00e9 dans le commentaire." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "Un caract\u00e8re XML non valide (Unicode : 0x{0}) a \u00e9t\u00e9 trouv\u00e9 dans les donn\u00e9es de l''instruction de traitement." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "Un caract\u00e8re XML non valide (Unicode: 0x{0}) a \u00e9t\u00e9 trouv\u00e9 dans le contenu de la CDATASection" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "Un caract\u00e8re XML non valide (Unicode : 0x{0}) a \u00e9t\u00e9 trouv\u00e9 dans le contenu des donn\u00e9es de type caract\u00e8res du noeud." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "Un ou plusieurs caract\u00e8res non valides ont \u00e9t\u00e9 trouv\u00e9s dans le noeud {0} nomm\u00e9 ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "La cha\u00eene \"--\" est interdite dans des commentaires." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "La valeur de l''attribut \"{1}\" associ\u00e9 \u00e0 un type d''\u00e9l\u00e9ment \"{0}\" ne doit pas contenir le caract\u00e8re ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "La r\u00e9f\u00e9rence d''entit\u00e9 non analys\u00e9e \"&{0};\" n''est pas admise." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "La r\u00e9f\u00e9rence d''entit\u00e9 externe \"&{0};\" n''est pas admise dans une valeur d''attribut." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "Le pr\u00e9fixe \"{0}\" ne peut pas \u00eatre li\u00e9 \u00e0 l''espace de noms \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Le nom local de l''\u00e9l\u00e9ment \"{0}\" a une valeur null." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Le nom local de l''attribut \"{0}\" a une valeur null." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "le texte de remplacement du noeud de l''entit\u00e9 \"{0}\" contaient un noeud d''\u00e9l\u00e9ment \"{1}\" avec un pr\u00e9fixe non li\u00e9 \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "Le texte de remplacement du noeud de l''entit\u00e9 \"{0}\" contient un noeud d''attribut \"{1}\" avec un pr\u00e9fixe non li\u00e9 \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_pt_BR.java0000644000175000017500000003175610721374030027753 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_pt_BR.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_pt_BR extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "A chave de mensagem ''{0}'' n\u00e3o est\u00e1 na classe de mensagem ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "O formato da mensagem ''{0}'' na classe de mensagem ''{1}'' falhou." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "A classe de serializador ''{0}'' n\u00e3o implementa org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "O recurso [ {0} ] n\u00e3o p\u00f4de ser encontrado.\n{1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "O recurso [ {0} ] n\u00e3o p\u00f4de carregar: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Tamanho do buffer <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Detectado substituto UTF-16 inv\u00e1lido: {0} ?" }, { MsgKey.ER_OIERROR, "Erro de E/S" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Imposs\u00edvel incluir atributo {0} depois de n\u00f3s filhos ou antes da gera\u00e7\u00e3o de um elemento. O atributo ser\u00e1 ignorado." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "O espa\u00e7o de nomes do prefixo ''{0}'' n\u00e3o foi declarado. " }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Atributo ''{0}'' fora do elemento. " }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Declara\u00e7\u00e3o de espa\u00e7o de nomes ''{0}''=''{1}'' fora do elemento. " }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "N\u00e3o foi poss\u00edvel carregar ''{0}'' (verifique CLASSPATH) agora , utilizando somente os padr\u00f5es" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Tentativa de processar o caractere de um valor integral {0} que n\u00e3o \u00e9 representado na codifica\u00e7\u00e3o de sa\u00edda especificada de {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "N\u00e3o foi poss\u00edvel carregar o arquivo de propriedade ''{0}'' para o m\u00e9todo de sa\u00edda ''{1}'' (verifique CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "N\u00famero de porta inv\u00e1lido" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "A porta n\u00e3o pode ser definida quando o host \u00e9 nulo" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "O host n\u00e3o \u00e9 um endere\u00e7o formado corretamente" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "O esquema n\u00e3o est\u00e1 em conformidade." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Imposs\u00edvel definir esquema a partir da cadeia nula" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "O caminho cont\u00e9m seq\u00fc\u00eancia de escape inv\u00e1lida" }, { MsgKey.ER_PATH_INVALID_CHAR, "O caminho cont\u00e9m caractere inv\u00e1lido: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "O fragmento cont\u00e9m caractere inv\u00e1lido" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "O fragmento n\u00e3o pode ser definido quando o caminho \u00e9 nulo" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "O fragmento s\u00f3 pode ser definido para um URI gen\u00e9rico" }, { MsgKey.ER_NO_SCHEME_IN_URI, "Nenhum esquema encontrado no URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Imposs\u00edvel inicializar URI com par\u00e2metros vazios" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "O fragmento n\u00e3o pode ser especificado no caminho e fragmento" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "A cadeia de consulta n\u00e3o pode ser especificada na cadeia de consulta e caminho" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Port n\u00e3o pode ser especificado se host n\u00e3o for especificado" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Userinfo n\u00e3o pode ser especificado se host n\u00e3o for especificado" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Aviso: A vers\u00e3o do documento de sa\u00edda precisa ser ''{0}''. Essa vers\u00e3o do XML n\u00e3o \u00e9 suportada. A vers\u00e3o do documento de sa\u00edda ser\u00e1 ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "O esquema \u00e9 obrigat\u00f3rio!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "O objeto Properties transmitido para SerializerFactory n\u00e3o tem uma propriedade ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Aviso: A codifica\u00e7\u00e3o ''{0}'' n\u00e3o \u00e9 suportada pelo Java Runtime." }, {MsgKey.ER_FEATURE_NOT_FOUND, "O par\u00e2metro ''{0}'' n\u00e3o \u00e9 reconhecido."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "O par\u00e2metro ''{0}'' \u00e9 reconhecido, mas o valor pedido n\u00e3o pode ser definido. "}, {MsgKey.ER_STRING_TOO_LONG, "A cadeia resultante \u00e9 muito longa para caber em uma DOMString: ''{0}''. "}, {MsgKey.ER_TYPE_MISMATCH_ERR, "O tipo de valor para este nome de par\u00e2metro \u00e9 incompat\u00edvel com o tipo de valor esperado. "}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "O destino de sa\u00edda para os dados a serem gravados era nulo. "}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Uma codifica\u00e7\u00e3o n\u00e3o suportada foi encontrada. "}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "O n\u00f3 n\u00e3o p\u00f4de ser serializado."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "A Se\u00e7\u00e3o CDATA cont\u00e9m um ou mais marcadores de t\u00e9rmino ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Uma inst\u00e2ncia do verificador Well-Formedness n\u00e3o p\u00f4de ser criada. O par\u00e2metro well-formed foi definido como true, mas a verifica\u00e7\u00e3o well-formedness n\u00e3o pode ser executada." }, {MsgKey.ER_WF_INVALID_CHARACTER, "O n\u00f3 ''{0}'' cont\u00e9m caracteres XML inv\u00e1lidos. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado no coment\u00e1rio. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado no processo instructiondata." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado nos conte\u00fados do CDATASection. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "Um caractere XML inv\u00e1lido (Unicode: 0x{0}) foi encontrado no conte\u00fado dos dados de caractere dos n\u00f3s. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "Um caractere inv\u00e1lido foi encontrado no {0} do n\u00f3 denominado ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "A cadeia \"--\" n\u00e3o \u00e9 permitida dentro dos coment\u00e1rios. " }, {MsgKey.ER_WF_LT_IN_ATTVAL, "O valor do atributo \"{1}\" associado a um tipo de elemento \"{0}\" n\u00e3o deve conter o caractere ''<''. " }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "A refer\u00eancia de entidade n\u00e3o analisada \"&{0};\" n\u00e3o \u00e9 permitida. " }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "A refer\u00eancia de entidade externa \"&{0};\" n\u00e3o \u00e9 permitida em um valor de atributo. " }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "O prefixo \"{0}\" n\u00e3o pode ser vinculado ao espa\u00e7o de nomes \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "O nome local do elemento \"{0}\" \u00e9 nulo." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "O nome local do atributo \"{0}\" \u00e9 nulo." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "O texto de substitui\u00e7\u00e3o do n\u00f3 de entidade \"{0}\" cont\u00e9m um n\u00f3 de elemento \"{1}\" com um prefixo n\u00e3o vinculado \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "O texto de substitui\u00e7\u00e3o do n\u00f3 de entidade \"{0}\" cont\u00e9m um n\u00f3 de atributo \"{1}\" com um prefixo n\u00e3o vinculado \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_it.java0000644000175000017500000003132010721374032027346 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_it.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_it extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "La chiave messaggio ''{0}'' non si trova nella classe del messaggio ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Il formato del messaggio ''{0}'' nella classe del messaggio ''{1}'' non \u00e8 riuscito." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "La classe del serializzatore ''{0}'' non implementa org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Risorsa [ {0} ] non trovata.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Dimensione buffer <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Rilevato surrogato UTF-16 non valido: {0} ?" }, { MsgKey.ER_OIERROR, "Errore IO" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Impossibile aggiungere l''''attributo {0} dopo i nodi secondari o prima che sia prodotto un elemento. L''''attributo verr\u00e0 ignorato." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "Lo spazio nomi per il prefisso ''{0}'' non \u00e8 stato dichiarato." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "L''''attributo ''{0}'' al di fuori dell''''elemento." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Dichiarazione dello spazio nome ''{0}''=''{1}'' al di fuori dell''''elemento." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Impossibile caricare ''{0}'' (verificare CLASSPATH), verranno utilizzati i valori predefiniti" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Tentare di generare l''''output del carattere di valor integrale {0} che non \u00e8 rappresentato nella codifica di output specificata di {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Impossibile caricare il file delle propriet\u00e0 ''{0}'' per il metodo di emissione ''{1}'' (verificare CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "Numero di porta non valido" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "La porta non pu\u00f2 essere impostata se l'host \u00e8 nullo" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Host non \u00e8 un'indirizzo corretto" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Lo schema non \u00e8 conforme." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Impossibile impostare lo schema da una stringa nulla" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Il percorso contiene sequenza di escape non valida" }, { MsgKey.ER_PATH_INVALID_CHAR, "Il percorso contiene un carattere non valido: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Il frammento contiene un carattere non valido" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Il frammento non pu\u00f2 essere impostato se il percorso \u00e8 nullo" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Il frammento pu\u00f2 essere impostato solo per un URI generico" }, { MsgKey.ER_NO_SCHEME_IN_URI, "Non \u00e8 stato trovato alcuno schema nell'URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Impossibile inizializzare l'URI con i parametri vuoti" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Il frammento non pu\u00f2 essere specificato sia nel percorso che nel frammento" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "La stringa di interrogazione non pu\u00f2 essere specificata nella stringa di interrogazione e percorso." }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "La porta non pu\u00f2 essere specificata se l'host non S specificato" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Userinfo non pu\u00f2 essere specificato se l'host non S specificato" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Attenzione: La versione del documento di emissione \u00e8 obbligatorio che sia ''{0}''. Questa versione di XML non \u00e8 supportata. La versione del documento di emissione sar\u00e0 ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Lo schema \u00e8 obbligatorio." }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "L''''oggetto Properties passato al SerializerFactory non ha una propriet\u00e0 ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Avvertenza: La codifica ''{0}'' non \u00e8 supportata da Java runtime." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Il parametro ''{0}'' non \u00e8 riconosciuto."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Il parametro ''{0}'' \u00e8 riconosciuto ma non \u00e8 possibile impostare il valore richiesto."}, {MsgKey.ER_STRING_TOO_LONG, "La stringa risultante \u00e8 troppo lunga per essere inserita in DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Il tipo di valore per questo nome di parametro non \u00e8 compatibile con il tipo di valore previsto."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "La destinazione di output in cui scrivere i dati era nulla."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "\u00c8 stata rilevata una codifica non supportata."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Impossibile serializzare il nodo."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "La Sezione CDATA contiene uno o pi\u00f9 markers di termine ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Impossibile creare un'istanza del controllore Well-Formedness. Il parametro well-formed \u00e8 stato impostato su true ma non \u00e8 possibile eseguire i controlli well-formedness." }, {MsgKey.ER_WF_INVALID_CHARACTER, "Il nodo ''{0}'' contiene caratteri XML non validi." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "Trovato un carattere XML non valido (Unicode: 0x{0}) nel commento." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "Carattere XML non valido (Unicode: 0x{0}) rilevato nell''elaborazione di instructiondata." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "Carattere XML non valido (Unicode: 0x{0}) rilevato nel contenuto di CDATASection." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "Carattere XML non valido (Unicode: 0x{0}) rilevato nel contenuto dati di caratteri del nodo. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "Carattere XML non valido rilevato nel nodo {0} denominato ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "La stringa \"--\" non \u00e8 consentita nei commenti." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "Il valore dell''''attributo \"{1}\" associato con un tipo di elemento \"{0}\" non deve contenere il carattere ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Il riferimento entit\u00e0 non analizzata \"&{0};\" non \u00e8 permesso." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "Il riferimento all''''entit\u00e0 esterna \"&{0};\" non \u00e8 permesso in un valore attributo." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "Il prefisso \"{0}\" non pu\u00f2 essere associato allo spazio nome \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Il nome locale dell''''elemento \"{0}\" \u00e8 null." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Il nome locale dell''''attributo \"{0}\" \u00e8 null." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "Il testo di sostituzione del nodo di entit\u00e0 \"{0}\" contiene un nodo di elemento \"{1}\" con un prefisso non associato \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "Il testo di sostituzione del nodo di entit\u00e0 \"{0}\" contiene un nodo di attributo \"{1}\" con un prefisso non associato \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_zh_TW.java0000644000175000017500000003341110721374033027771 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_zh_TW.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_zh_TW extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "\u8a0a\u606f\u9375 ''{0}'' \u4e0d\u5728\u8a0a\u606f\u985e\u5225 ''{1}'' \u4e2d" }, { MsgKey.BAD_MSGFORMAT, "\u8a0a\u606f\u985e\u5225 ''{1}'' \u4e2d\u7684\u8a0a\u606f ''{0}'' \u683c\u5f0f\u5316\u5931\u6557\u3002" }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "Serializer \u985e\u5225 ''{0}'' \u4e0d\u5be6\u4f5c org.xml.sax.ContentHandler\u3002" }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "\u627e\u4e0d\u5230\u8cc7\u6e90 [ {0} ]\u3002\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "\u7121\u6cd5\u8f09\u5165\u8cc7\u6e90 [ {0} ]\uff1a{1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u7de9\u885d\u5340\u5927\u5c0f <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\u5075\u6e2c\u5230\u7121\u6548\u7684 UTF-16 \u4ee3\u7406\uff1a{0}?" }, { MsgKey.ER_OIERROR, "IO \u932f\u8aa4" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "\u5728\u7522\u751f\u5b50\u9805\u7bc0\u9ede\u4e4b\u5f8c\uff0c\u6216\u5728\u7522\u751f\u5143\u7d20\u4e4b\u524d\uff0c\u4e0d\u53ef\u65b0\u589e\u5c6c\u6027 {0}\u3002\u5c6c\u6027\u6703\u88ab\u5ffd\u7565\u3002" }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "\u5b57\u9996 ''{0}'' \u7684\u540d\u7a31\u7a7a\u9593\u5c1a\u672a\u5ba3\u544a\u3002" }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "\u5c6c\u6027 ''{0}'' \u8d85\u51fa\u5143\u7d20\u5916\u3002" }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "\u540d\u7a31\u7a7a\u9593\u5ba3\u544a ''{0}''=''{1}'' \u8d85\u51fa\u5143\u7d20\u5916\u3002" }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "\u7121\u6cd5\u8f09\u5165 ''{0}''\uff08\u6aa2\u67e5 CLASSPATH\uff09\uff0c\u76ee\u524d\u53ea\u4f7f\u7528\u9810\u8a2d\u503c" }, { MsgKey.ER_ILLEGAL_CHARACTER, "\u8a66\u5716\u8f38\u51fa\u4e0d\u662f\u4ee5\u6307\u5b9a\u7684\u8f38\u51fa\u7de8\u78bc {1} \u5448\u73fe\u7684\u6574\u6578\u503c {0} \u7684\u5b57\u5143\u3002" }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "\u7121\u6cd5\u8f09\u5165\u8f38\u51fa\u65b9\u6cd5 ''{1}''\uff08\u6aa2\u67e5 CLASSPATH\uff09\u7684\u5167\u5bb9\u6a94 ''{0}''" }, { MsgKey.ER_INVALID_PORT, "\u7121\u6548\u7684\u57e0\u7de8\u865f" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "\u4e3b\u6a5f\u70ba\u7a7a\u503c\u6642\uff0c\u7121\u6cd5\u8a2d\u5b9a\u57e0" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "\u4e3b\u6a5f\u6c92\u6709\u5b8c\u6574\u7684\u4f4d\u5740" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "\u7db1\u8981\u4e0d\u662f conformant\u3002" }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "\u7121\u6cd5\u5f9e\u7a7a\u5b57\u4e32\u8a2d\u5b9a\u7db1\u8981" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u8def\u5f91\u5305\u542b\u7121\u6548\u7684\u8df3\u812b\u5b57\u5143" }, { MsgKey.ER_PATH_INVALID_CHAR, "\u8def\u5f91\u5305\u542b\u7121\u6548\u7684\u5b57\u5143\uff1a{0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "\u7247\u6bb5\u5305\u542b\u7121\u6548\u7684\u5b57\u5143" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "\u8def\u5f91\u70ba\u7a7a\u503c\u6642\uff0c\u7121\u6cd5\u8a2d\u5b9a\u7247\u6bb5" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "\u53ea\u80fd\u5c0d\u901a\u7528\u7684 URI \u8a2d\u5b9a\u7247\u6bb5" }, { MsgKey.ER_NO_SCHEME_IN_URI, "\u5728 URI \u627e\u4e0d\u5230\u7db1\u8981" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "\u7121\u6cd5\u4ee5\u7a7a\u767d\u53c3\u6578\u8d77\u59cb\u8a2d\u5b9a URI" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "\u7247\u6bb5\u7121\u6cd5\u540c\u6642\u5728\u8def\u5f91\u548c\u7247\u6bb5\u4e2d\u6307\u5b9a" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "\u5728\u8def\u5f91\u53ca\u67e5\u8a62\u5b57\u4e32\u4e2d\u4e0d\u53ef\u6307\u5b9a\u67e5\u8a62\u5b57\u4e32" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "\u5982\u679c\u6c92\u6709\u6307\u5b9a\u4e3b\u6a5f\uff0c\u4e0d\u53ef\u6307\u5b9a\u57e0" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "\u5982\u679c\u6c92\u6709\u6307\u5b9a\u4e3b\u6a5f\uff0c\u4e0d\u53ef\u6307\u5b9a Userinfo" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "\u8b66\u544a\uff1a\u8f38\u51fa\u6587\u4ef6\u7684\u7248\u672c\u8981\u6c42\u662f ''{0}''\u3002\u672a\u652f\u63f4\u9019\u500b\u7248\u672c\u7684 XML\u3002\u8f38\u51fa\u6587\u4ef6\u7684\u7248\u672c\u6703\u662f ''1.0''\u3002" }, { MsgKey.ER_SCHEME_REQUIRED, "\u7db1\u8981\u662f\u5fc5\u9700\u7684\uff01" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "\u50b3\u905e\u5230 SerializerFactory \u7684 Properties \u7269\u4ef6\u6c92\u6709 ''{0}'' \u5167\u5bb9\u3002" }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "\u8b66\u544a\uff1aJava \u57f7\u884c\u6642\u671f\u4e0d\u652f\u63f4\u7de8\u78bc ''{0}''\u3002" }, {MsgKey.ER_FEATURE_NOT_FOUND, "\u7121\u6cd5\u8fa8\u8b58\u53c3\u6578 ''{0}''\u3002"}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "\u53ef\u8fa8\u8b58 ''{0}'' \u53c3\u6578\uff0c\u4f46\u6240\u8981\u6c42\u7684\u503c\u7121\u6cd5\u8a2d\u5b9a\u3002"}, {MsgKey.ER_STRING_TOO_LONG, "\u7d50\u679c\u5b57\u4e32\u904e\u9577\uff0c\u7121\u6cd5\u7f6e\u5165 DOMString: ''{0}'' \u4e2d\u3002"}, {MsgKey.ER_TYPE_MISMATCH_ERR, "\u9019\u500b\u53c3\u6578\u540d\u7a31\u7684\u503c\u985e\u578b\u8207\u671f\u671b\u503c\u985e\u578b\u4e0d\u76f8\u5bb9\u3002"}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "\u8cc7\u6599\u8981\u5beb\u5165\u7684\u8f38\u51fa\u76ee\u7684\u5730\u70ba\u7a7a\u503c\u3002"}, {MsgKey.ER_UNSUPPORTED_ENCODING, "\u767c\u73fe\u4e0d\u652f\u63f4\u7684\u7de8\u78bc\u3002"}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "\u7bc0\u9ede\u7121\u6cd5\u5e8f\u5217\u5316\u3002"}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "CDATA \u5340\u6bb5\u5305\u542b\u4e00\u6216\u591a\u500b\u7d42\u6b62\u6a19\u8a18 ']]>'\u3002"}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "\u7121\u6cd5\u5efa\u7acb\u300c\u5f62\u5f0f\u5b8c\u6574\u300d\u6aa2\u67e5\u7a0b\u5f0f\u7684\u5be6\u4f8b\u3002Well-formed \u53c3\u6578\u96d6\u8a2d\u70ba true\uff0c\u4f46\u7121\u6cd5\u57f7\u884c\u5f62\u5f0f\u5b8c\u6574\u6aa2\u67e5\u3002" }, {MsgKey.ER_WF_INVALID_CHARACTER, "\u7bc0\u9ede ''{0}'' \u5305\u542b\u7121\u6548\u7684 XML \u5b57\u5143\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "\u5728\u8a3b\u89e3\u4e2d\u767c\u73fe\u7121\u6548\u7684 XML \u5b57\u5143 (Unicode: 0x{0})\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\u5728\u8655\u7406\u7a0b\u5e8f instructiondata \u4e2d\u767c\u73fe\u7121\u6548\u7684 XML \u5b57\u5143 (Unicode: 0x{0})\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "\u5728 CDATASection \u7684\u5167\u5bb9\u4e2d\u767c\u73fe\u7121\u6548\u7684 XML \u5b57\u5143 (Unicode: 0x{0})\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "\u5728\u7bc0\u9ede\u7684\u5b57\u5143\u8cc7\u6599\u5167\u5bb9\u4e2d\u767c\u73fe\u7121\u6548\u7684 XML \u5b57\u5143 (Unicode: 0x{0})\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "\u5728\u540d\u70ba ''{1}'' \u7684 ''{0}'' \u4e2d\u767c\u73fe\u7121\u6548\u7684 XML \u5b57\u5143\u3002" }, { MsgKey.ER_WF_DASH_IN_COMMENT, "\u8a3b\u89e3\u4e2d\u4e0d\u5141\u8a31\u4f7f\u7528\u5b57\u4e32 \"--\"\u3002" }, {MsgKey.ER_WF_LT_IN_ATTVAL, "\u8207\u5143\u7d20\u985e\u578b \"{0}\" \u76f8\u95dc\u806f\u7684\u5c6c\u6027 \"{1}\" \u503c\u4e0d\u53ef\u5305\u542b ''<'' \u5b57\u5143\u3002" }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "\u4e0d\u5141\u8a31\u4f7f\u7528\u672a\u5256\u6790\u7684\u5be6\u9ad4\u53c3\u7167 \"&{0};\"\u3002" }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "\u5c6c\u6027\u503c\u4e2d\u4e0d\u5141\u8a31\u4f7f\u7528\u5916\u90e8\u5be6\u9ad4\u53c3\u7167 \"&{0};\"\u3002" }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "\u5b57\u9996 \"{0}\" \u7121\u6cd5\u9023\u7d50\u5230\u540d\u7a31\u7a7a\u9593 \"{1}\"\u3002" }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "\u5143\u7d20 \"{0}\" \u7684\u672c\u7aef\u540d\u7a31\u662f\u7a7a\u503c\u3002" }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "\u5c6c\u6027 \"{0}\" \u7684\u672c\u7aef\u540d\u7a31\u662f\u7a7a\u503c\u3002" }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "\u5be6\u9ad4\u7bc0\u9ede \"{0}\" \u7684\u53d6\u4ee3\u6587\u5b57\u5305\u542b\u9644\u6709\u5df2\u5207\u65b7\u9023\u7d50\u5b57\u9996 \"{2}\" \u7684\u5143\u7d20\u7bc0\u9ede \"{1}\"\u3002" }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "\u5be6\u9ad4\u7bc0\u9ede \"{0}\" \u7684\u53d6\u4ee3\u6587\u5b57\u5305\u542b\u9644\u6709\u5df2\u5207\u65b7\u9023\u7d50\u5b57\u9996 \"{2}\" \u7684\u5c6c\u6027\u7bc0\u9ede \"{1}\"\u3002" }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_pl.java0000644000175000017500000003175010721374031027353 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_pl.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_pl extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "Klucz komunikatu ''{0}'' nie znajduje si\u0119 w klasie komunikat\u00f3w ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Nie powiod\u0142o si\u0119 sformatowanie komunikatu ''{0}'' w klasie komunikat\u00f3w ''{1}''." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "Klasa szereguj\u0105ca ''{0}'' nie implementuje org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Nie mo\u017cna znale\u017a\u0107 zasobu [ {0} ].\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Zas\u00f3b [ {0} ] nie m\u00f3g\u0142 za\u0142adowa\u0107: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Wielko\u015b\u0107 buforu <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Wykryto niepoprawny odpowiednik UTF-16: {0} ?" }, { MsgKey.ER_OIERROR, "B\u0142\u0105d we/wy" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Nie mo\u017cna doda\u0107 atrybutu {0} po bezpo\u015brednich w\u0119z\u0142ach potomnych ani przed wyprodukowaniem elementu. Atrybut zostanie zignorowany." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "Nie zadeklarowano przestrzeni nazw dla przedrostka ''{0}''." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Atrybut ''{0}'' znajduje si\u0119 poza elementem." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Deklaracja przestrzeni nazw ''{0}''=''{1}'' znajduje si\u0119 poza elementem." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Nie mo\u017cna za\u0142adowa\u0107 ''{0}'' (sprawd\u017a CLASSPATH) - u\u017cywane s\u0105 teraz warto\u015bci domy\u015blne" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Pr\u00f3ba wyprowadzenia znaku warto\u015bci ca\u0142kowitej {0}, kt\u00f3ry nie jest reprezentowany w podanym kodowaniu wyj\u015bciowym {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Nie mo\u017cna za\u0142adowa\u0107 pliku w\u0142a\u015bciwo\u015bci ''{0}'' dla metody wyj\u015bciowej ''{1}'' (sprawd\u017a CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "Niepoprawny numer portu" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Nie mo\u017cna ustawi\u0107 portu, kiedy host jest pusty" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Host nie jest poprawnie skonstruowanym adresem" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Schemat nie jest zgodny." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Nie mo\u017cna ustawi\u0107 schematu z pustego ci\u0105gu znak\u00f3w" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u015acie\u017cka zawiera nieznan\u0105 sekwencj\u0119 o zmienionym znaczeniu" }, { MsgKey.ER_PATH_INVALID_CHAR, "\u015acie\u017cka zawiera niepoprawny znak {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment zawiera niepoprawny znak" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Nie mo\u017cna ustawi\u0107 fragmentu, kiedy \u015bcie\u017cka jest pusta" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment mo\u017cna ustawi\u0107 tylko dla og\u00f3lnego URI" }, { MsgKey.ER_NO_SCHEME_IN_URI, "Nie znaleziono schematu w URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Nie mo\u017cna zainicjowa\u0107 URI z pustymi parametrami" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Nie mo\u017cna poda\u0107 fragmentu jednocze\u015bnie w \u015bcie\u017cce i fragmencie" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Tekstu zapytania nie mo\u017cna poda\u0107 w tek\u015bcie \u015bcie\u017cki i zapytania" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Nie mo\u017cna poda\u0107 portu, je\u015bli nie podano hosta" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Nie mo\u017cna poda\u0107 informacji o u\u017cytkowniku, je\u015bli nie podano hosta" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Ostrze\u017cenie: Wymagan\u0105 wersj\u0105 dokumentu wyj\u015bciowego jest ''{0}''. Ta wersja XML nie jest obs\u0142ugiwana. Wersj\u0105 dokumentu wyj\u015bciowego b\u0119dzie ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Schemat jest wymagany!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "Obiekt klasy Properties przekazany do klasy SerializerFactory nie ma w\u0142a\u015bciwo\u015bci ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Ostrze\u017cenie: dekodowany ''{0}'' nie jest obs\u0142ugiwany przez \u015brodowisko wykonawcze Java." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Parametr ''{0}'' nie zosta\u0142 rozpoznany."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Parametr ''{0}'' zosta\u0142 rozpoznany, ale nie mo\u017cna ustawi\u0107 \u017c\u0105danej warto\u015bci."}, {MsgKey.ER_STRING_TOO_LONG, "Wynikowy \u0142a\u0144cuch jest zbyt d\u0142ugi, aby si\u0119 zmie\u015bci\u0107 w obiekcie DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Typ warto\u015bci parametru o tej nazwie jest niezgodny z oczekiwanym typem warto\u015bci. "}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "Docelowe miejsce zapisu danych wyj\u015bciowych by\u0142o puste (null)."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Napotkano nieobs\u0142ugiwane kodowanie."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Nie mo\u017cna przekszta\u0142ci\u0107 w\u0119z\u0142a do postaci szeregowej."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "Sekcja CDATA zawiera jeden lub kilka znacznik\u00f3w zako\u0144czenia ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Nie mo\u017cna utworzy\u0107 instancji obiektu sprawdzaj\u0105cego Well-Formedness. Parametr well-formed ustawiono na warto\u015b\u0107 true, ale nie mo\u017cna by\u0142o dokona\u0107 sprawdzenia poprawno\u015bci konstrukcji." }, {MsgKey.ER_WF_INVALID_CHARACTER, "W\u0119ze\u0142 ''{0}'' zawiera niepoprawne znaki XML." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "W komentarzu znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "W danych instrukcji przetwarzania znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "W sekcji CDATA znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "W tre\u015bci danych znakowych w\u0119z\u0142a znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "W {0} o nazwie ''{1}'' znaleziono niepoprawne znaki XML." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "Ci\u0105g znak\u00f3w \"--\" jest niedozwolony w komentarzu." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "Warto\u015b\u0107 atrybutu \"{1}\" zwi\u0105zanego z typem elementu \"{0}\" nie mo\u017ce zawiera\u0107 znaku ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Odwo\u0142anie do encji nieprzetwarzanej \"&{0};\" jest niedozwolone." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "Odwo\u0142anie do zewn\u0119trznej encji \"&{0};\" jest niedozwolone w warto\u015bci atrybutu." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "Nie mo\u017cna zwi\u0105za\u0107 przedrostka \"{0}\" z przestrzeni\u0105 nazw \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Nazwa lokalna elementu \"{0}\" jest pusta (null)." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Nazwa lokalna atrybutu \"{0}\" jest pusta (null)." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "Tekst zast\u0119puj\u0105cy w\u0119z\u0142a encji \"{0}\" zawiera w\u0119ze\u0142 elementu \"{1}\" o niezwi\u0105zanym przedrostku \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "Tekst zast\u0119puj\u0105cy w\u0119z\u0142a encji \"{0}\" zawiera w\u0119ze\u0142 atrybutu \"{1}\" o niezwi\u0105zanym przedrostku \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_sk.java0000644000175000017500000003177410721374031027363 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_sk.java,v 1.7 2005/03/07 20:34:36 minchau Exp $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_sk extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "K\u013e\u00fa\u010d spr\u00e1vy ''{0}'' sa nenach\u00e1dza v triede spr\u00e1v ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Zlyhal form\u00e1t spr\u00e1vy ''{0}'' v triede spr\u00e1v ''{1}''." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "Trieda serializ\u00e1tora ''{0}'' neimplementuje org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Prostriedok [ {0} ] nemohol by\u0165 n\u00e1jden\u00fd.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Prostriedok [ {0} ] sa nedal na\u010d\u00edta\u0165: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Ve\u013ekos\u0165 vyrovn\u00e1vacej pam\u00e4te <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Bolo zisten\u00e9 neplatn\u00e9 nahradenie UTF-16: {0} ?" }, { MsgKey.ER_OIERROR, "chyba IO" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Nie je mo\u017en\u00e9 prida\u0165 atrib\u00fat {0} po uzloch potomka alebo pred vytvoren\u00edm elementu. Atrib\u00fat bude ignorovan\u00fd." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "N\u00e1zvov\u00fd priestor pre predponu ''{0}'' nebol deklarovan\u00fd." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Atrib\u00fat ''{0}'' je mimo prvku." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Deklar\u00e1cia n\u00e1zvov\u00e9ho priestoru ''{0}''=''{1}'' je mimo prvku." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Nebolo mo\u017en\u00e9 zavies\u0165 ''{0}'' (skontrolujte CLASSPATH), teraz sa pou\u017e\u00edvaj\u00fa iba \u0161tandardn\u00e9 nastavenia" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Pokus o v\u00fdstup znaku integr\u00e1lnej hodnoty {0}, ktor\u00e1 nie je reprezentovan\u00e1 v zadanom v\u00fdstupnom k\u00f3dovan\u00ed {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Nebolo mo\u017en\u00e9 zavies\u0165 s\u00fabor vlastnost\u00ed ''{0}'' pre v\u00fdstupn\u00fa met\u00f3du ''{1}'' (skontrolujte CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "Neplatn\u00e9 \u010d\u00edslo portu" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Nem\u00f4\u017ee by\u0165 stanoven\u00fd port, ak je hostite\u013e nulov\u00fd" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Hostite\u013e nie je spr\u00e1vne form\u00e1tovan\u00e1 adresa" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Nezhodn\u00e1 sch\u00e9ma." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Nie je mo\u017en\u00e9 stanovi\u0165 sch\u00e9mu z nulov\u00e9ho re\u0165azca" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Cesta obsahuje neplatn\u00fa \u00fanikov\u00fa sekvenciu" }, { MsgKey.ER_PATH_INVALID_CHAR, "Cesta obsahuje neplatn\u00fd znak: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment obsahuje neplatn\u00fd znak" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Ak je cesta nulov\u00e1, nem\u00f4\u017ee by\u0165 stanoven\u00fd fragment" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment m\u00f4\u017ee by\u0165 stanoven\u00fd len pre v\u0161eobecn\u00e9 URI" }, { MsgKey.ER_NO_SCHEME_IN_URI, "V URI nebola n\u00e1jden\u00e1 \u017eiadna sch\u00e9ma" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Nie je mo\u017en\u00e9 inicializova\u0165 URI s pr\u00e1zdnymi parametrami" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment nem\u00f4\u017ee by\u0165 zadan\u00fd v ceste, ani vo fragmente" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Re\u0165azec dotazu nem\u00f4\u017ee by\u0165 zadan\u00fd v ceste a re\u0165azci dotazu" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Ak nebol zadan\u00fd hostite\u013e, mo\u017eno nebol zadan\u00fd port" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Ak nebol zadan\u00fd hostite\u013e, mo\u017eno nebolo zadan\u00e9 userinfo" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Varovanie: Verzia v\u00fdstupn\u00e9ho dokumentu mus\u00ed by\u0165 povinne ''{0}''. T\u00e1to verzia XML nie je podporovan\u00e1. Verzia v\u00fdstupn\u00e9ho dokumentu bude ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Je po\u017eadovan\u00e1 sch\u00e9ma!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "Objekt Properties, ktor\u00fd pre\u0161iel do SerializerFactory, nem\u00e1 vlastnos\u0165 ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Varovanie: Java runtime nepodporuje k\u00f3dovanie ''{0}''." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Parameter ''{0}'' nebol rozpoznan\u00fd."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Parameter ''{0}'' bol rozpoznan\u00fd, ale vy\u017eadovan\u00e1 hodnota sa ned\u00e1 nastavi\u0165."}, {MsgKey.ER_STRING_TOO_LONG, "V\u00fdsledn\u00fd re\u0165azec je pr\u00edli\u0161 dlh\u00fd a nezmest\u00ed sa do DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Typ hodnoty pre tento n\u00e1zov parametra je nekompatibiln\u00fd s o\u010dak\u00e1van\u00fdm typom hodnoty."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "Cie\u013e v\u00fdstupu pre zap\u00edsanie \u00fadajov bol null."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Bolo zaznamenan\u00e9 nepodporovan\u00e9 k\u00f3dovanie."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Uzol nebolo mo\u017en\u00e9 serializova\u0165."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "\u010cas\u0165 CDATA obsahuje jeden alebo viacer\u00e9 ozna\u010dova\u010de konca ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Nebolo mo\u017en\u00e9 vytvori\u0165 in\u0161tanciu kontrol\u00f3ra Well-Formedness. Parameter well-formed bol nastaven\u00fd na hodnotu true, ale kontrola well-formedness sa ned\u00e1 vykona\u0165." }, {MsgKey.ER_WF_INVALID_CHARACTER, "Uzol ''{0}'' obsahuje neplatn\u00e9 znaky XML." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "V koment\u00e1ri bol n\u00e1jden\u00fd neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "Pri spracovan\u00ed d\u00e1t in\u0161trukci\u00ed sa na\u0161iel neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "V obsahu CDATASection sa na\u0161iel neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "V obsahu znakov\u00fdch d\u00e1t uzla sa na\u0161iel neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "V uzle {0} s n\u00e1zvom ''{1}'' sa na\u0161iel neplatn\u00fd znak XML." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "Re\u0165azec \"--\" nie je povolen\u00fd v r\u00e1mci koment\u00e1rov." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "Hodnota atrib\u00fatu \"{1}\", ktor\u00e1 je priraden\u00e1 k prvku typu \"{0}\", nesmie obsahova\u0165 znak ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Neanalyzovan\u00fd odkaz na entitu \"&{0};\" nie je povolen\u00fd." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "Odkaz na extern\u00fa entitu \"&{0};\" nie je povolen\u00fd v hodnote atrib\u00fatu." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "Predpona \"{0}\" nem\u00f4\u017ee by\u0165 naviazan\u00e1 na n\u00e1zvov\u00fd priestor \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Lok\u00e1lny n\u00e1zov prvku \"{0}\" je null." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Lok\u00e1lny n\u00e1zov atrib\u00fatu \"{0}\" je null." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "N\u00e1hradn\u00fd text pre uzol entity \"{0}\" obsahuje uzol prvku \"{1}\" s nenaviazanou predponou \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "N\u00e1hradn\u00fd text uzla entity \"{0}\" obsahuje uzol atrib\u00fatu \"{1}\" s nenaviazanou predponou \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/DOM2Helper.java0000644000175000017500000001004410721374032024712 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM2Helper.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import org.w3c.dom.Node; /** * This class provides a DOM level 2 "helper", which provides services currently * not provided be the DOM standard. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * The differences from the original class are: * it doesn't extend DOMHelper, not depricated, * dropped method isNodeAfter(Node node1, Node node2) * dropped method parse(InputSource) * dropped method supportSAX() * dropped method setDocument(doc) * dropped method checkNode(Node) * dropped method getDocument() * dropped method getElementByID(String id, Document doc) * dropped method getParentOfNode(Node node) * dropped field Document m_doc; * made class non-public * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public final class DOM2Helper { /** * Construct an instance. */ public DOM2Helper(){} /** * Returns the local name of the given node, as defined by the * XML Namespaces specification. This is prepared to handle documents * built using DOM Level 1 methods by falling back upon explicitly * parsing the node name. * * @param n Node to be examined * * @return String containing the local name, or null if the node * was not assigned a Namespace. */ public String getLocalNameOfNode(Node n) { String name = n.getLocalName(); return (null == name) ? getLocalNameOfNodeFallback(n) : name; } /** * Returns the local name of the given node. If the node's name begins * with a namespace prefix, this is the part after the colon; otherwise * it's the full node name. * * This method is copied from org.apache.xml.utils.DOMHelper * * @param n the node to be examined. * * @return String containing the Local Name */ private String getLocalNameOfNodeFallback(Node n) { String qname = n.getNodeName(); int index = qname.indexOf(':'); return (index < 0) ? qname : qname.substring(index + 1); } /** * Returns the Namespace Name (Namespace URI) for the given node. * In a Level 2 DOM, you can ask the node itself. Note, however, that * doing so conflicts with our decision in getLocalNameOfNode not * to trust the that the DOM was indeed created using the Level 2 * methods. If Level 1 methods were used, these two functions will * disagree with each other. *

    * TODO: Reconcile with getLocalNameOfNode. * * @param n Node to be examined * * @return String containing the Namespace URI bound to this DOM node * at the time the Node was created. */ public String getNamespaceOfNode(Node n) { return n.getNamespaceURI(); } /** Field m_useDOM2getNamespaceURI is a compile-time flag which * gates some of the parser options used to build a DOM -- but * that code is commented out at this time and nobody else * references it, so I've commented this out as well. */ //private boolean m_useDOM2getNamespaceURI = false; } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_de.java0000644000175000017500000003177510721374031027337 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_de.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_de extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "Der Nachrichtenschl\u00fcssel ''{0}'' ist nicht in der Nachrichtenklasse ''{1}'' enthalten." }, { MsgKey.BAD_MSGFORMAT, "Das Format der Nachricht ''{0}'' in der Nachrichtenklasse ''{1}'' ist fehlgeschlagen." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "Die Parallel-Seriell-Umsetzerklasse ''{0}'' implementiert org.xml.sax.ContentHandler nicht." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Die Ressource [ {0} ] konnte nicht gefunden werden.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Die Ressource [ {0} ] konnte nicht geladen werden: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Puffergr\u00f6\u00dfe <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Ung\u00fcltige UTF-16-Ersetzung festgestellt: {0} ?" }, { MsgKey.ER_OIERROR, "E/A-Fehler" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Attribut {0} kann nicht nach Kindknoten oder vor dem Erstellen eines Elements hinzugef\u00fcgt werden. Das Attribut wird ignoriert." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "Der Namensbereich f\u00fcr Pr\u00e4fix ''{0}'' wurde nicht deklariert." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Attribut ''{0}'' befindet sich nicht in einem Element." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Namensbereichdeklaration ''{0}''=''{1}'' befindet sich nicht in einem Element." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "''{0}'' konnte nicht geladen werden (CLASSPATH pr\u00fcfen). Es werden die Standardwerte verwendet." }, { MsgKey.ER_ILLEGAL_CHARACTER, "Es wurde versucht, ein Zeichen des Integralwerts {0} auszugeben, der nicht in der angegebenen Ausgabeverschl\u00fcsselung von {1} dargestellt ist." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Die Merkmaldatei ''{0}'' konnte f\u00fcr die Ausgabemethode ''{1}'' nicht geladen werden (CLASSPATH pr\u00fcfen)" }, { MsgKey.ER_INVALID_PORT, "Ung\u00fcltige Portnummer" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Der Port kann nicht festgelegt werden, wenn der Host gleich Null ist." }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Der Host ist keine syntaktisch korrekte Adresse." }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Das Schema ist nicht angepasst." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Schema kann nicht von Nullzeichenfolge festgelegt werden." }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Der Pfad enth\u00e4lt eine ung\u00fcltige Escapezeichenfolge." }, { MsgKey.ER_PATH_INVALID_CHAR, "Pfad enth\u00e4lt ung\u00fcltiges Zeichen: {0}." }, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment enth\u00e4lt ein ung\u00fcltiges Zeichen." }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Fragment kann nicht festgelegt werden, wenn der Pfad gleich Null ist." }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment kann nur f\u00fcr eine generische URI (Uniform Resource Identifier) festgelegt werden." }, { MsgKey.ER_NO_SCHEME_IN_URI, "Kein Schema gefunden in URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "URI (Uniform Resource Identifier) kann nicht mit leeren Parametern initialisiert werden." }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment kann nicht im Pfad und im Fragment angegeben werden." }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Abfragezeichenfolge kann nicht im Pfad und in der Abfragezeichenfolge angegeben werden." }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Der Port kann nicht angegeben werden, wenn der Host nicht angegeben wurde." }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Benutzerinformationen k\u00f6nnen nicht angegeben werden, wenn der Host nicht angegeben wurde." }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Warnung: Die Version des Ausgabedokuments muss ''{0}'' lauten. Diese XML-Version wird nicht unterst\u00fctzt. Die Version des Ausgabedokuments ist ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Schema ist erforderlich!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "Das an SerializerFactory \u00fcbermittelte Merkmalobjekt weist kein Merkmal ''{0}'' auf." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Warnung: Die Codierung ''{0}'' wird von Java Runtime nicht unterst\u00fctzt." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Der Parameter ''{0}'' wird nicht erkannt."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Der Parameter ''{0}'' wird erkannt, der angeforderte Wert kann jedoch nicht festgelegt werden."}, {MsgKey.ER_STRING_TOO_LONG, "Die Ergebniszeichenfolge ist zu lang f\u00fcr eine DOM-Zeichenfolge: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Der Werttyp f\u00fcr diesen Parameternamen ist nicht kompatibel mit dem erwarteten Werttyp."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "Das Ausgabeziel f\u00fcr die zu schreibenden Daten war leer."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Eine nicht unterst\u00fctzte Codierung wurde festgestellt."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Der Knoten konnte nicht serialisiert werden."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "Der Abschnitt CDATA enth\u00e4lt mindestens eine Beendigungsmarkierung ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Eine Instanz des Pr\u00fcfprogramms f\u00fcr korrekte Formatierung konnte nicht erstellt werden. F\u00fcr den korrekt formatierten Parameter wurde der Wert 'True' festgelegt, die Pr\u00fcfung auf korrekte Formatierung kann jedoch nicht durchgef\u00fchrt werden." }, {MsgKey.ER_WF_INVALID_CHARACTER, "Der Knoten ''{0}'' enth\u00e4lt ung\u00fcltige XML-Zeichen." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "Im Kommentar wurde ein ung\u00fcltiges XML-Zeichen (Unicode: 0x{0}) gefunden." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "In der Verarbeitungsanweisung wurde ein ung\u00fcltiges XML-Zeichen (Unicode: 0x{0}) gefunden." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "Im Inhalt von CDATASection wurde ein ung\u00fcltiges XML-Zeichen (Unicode: 0x{0}) gefunden." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "Ein ung\u00fcltiges XML-Zeichen (Unicode: 0x{0}) wurde im Inhalt der Zeichendaten des Knotens gefunden." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "Ung\u00fcltige XML-Zeichen wurden gefunden in {0} im Knoten ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "Die Zeichenfolge \"--\" ist innerhalb von Kommentaren nicht zul\u00e4ssig." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "Der Wert des Attributs \"{1}\" mit einem Elementtyp \"{0}\" darf nicht das Zeichen ''<'' enthalten." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Der syntaktisch nicht analysierte Entit\u00e4tenverweis \"&{0};\" ist nicht zul\u00e4ssig." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "Der externe Entit\u00e4tenverweis \"&{0};\" ist in einem Attributwert nicht zul\u00e4ssig." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "Das Pr\u00e4fix \"{0}\" kann nicht an den Namensbereich \"{1}\" gebunden werden." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Der lokale Name von Element \"{0}\" ist nicht angegeben." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Der lokale Name des Attributs \"{0}\" ist nicht angegeben." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "Der Ersatztext des Entit\u00e4tenknotens \"{0}\" enth\u00e4lt einen Elementknoten \"{1}\" mit einem nicht gebundenen Pr\u00e4fix \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "Der Ersatztext des Entit\u00e4tenknotens \"{0}\" enth\u00e4lt einen Attributknoten \"{1}\" mit einem nicht gebundenen Pr\u00e4fix \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_ko.java0000644000175000017500000004017510721374032027353 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_ko.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_ko extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "''{0}'' \uba54\uc2dc\uc9c0 \ud0a4\uac00 ''{1}'' \uba54\uc2dc\uc9c0 \ud074\ub798\uc2a4\uc5d0 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.BAD_MSGFORMAT, "''{1}'' \uba54\uc2dc\uc9c0 \ud074\ub798\uc2a4\uc5d0 \uc788\ub294 ''{0}'' \uba54\uc2dc\uc9c0\uc758 \ud615\uc2dd\uc774 \uc798\ubabb \ub418\uc5c8\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "''{0}'' \uc9c1\ub82c \ud504\ub85c\uadf8\ub7a8 \ud074\ub798\uc2a4\uac00 org.xml.sax.ContentHandler\ub97c \uad6c\ud604\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "[ {0} ] \uc790\uc6d0\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\n{1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "[ {0} ] \uc790\uc6d0\uc774 {1} \n {2} \t {3}\uc744(\ub97c) \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "\ubc84\ud37c \ud06c\uae30 <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\uc798\ubabb\ub41c UTF-16 \ub300\ub9ac\uc790(surrogate)\uac00 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0} ?" }, { MsgKey.ER_OIERROR, "IO \uc624\ub958" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "\ud558\uc704 \ub178\ub4dc\uac00 \uc0dd\uc131\ub41c \uc774\ud6c4 \ub610\ub294 \uc694\uc18c\uac00 \uc791\uc131\ub418\uae30 \uc774\uc804\uc5d0 {0} \uc18d\uc131\uc744 \ucd94\uac00\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc18d\uc131\uc774 \ubb34\uc2dc\ub429\ub2c8\ub2e4." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "''{0}'' \uc811\ub450\ubd80\uc5d0 \ub300\ud55c \uc774\ub984 \uacf5\uac04\uc774 \uc120\uc5b8\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "''{0}'' \uc18d\uc131\uc774 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "''{0}''=''{1}'' \uc774\ub984 \uacf5\uac04 \uc120\uc5b8\uc774 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "''{0}''(CLASSPATH \ud655\uc778)\uc744(\ub97c) \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc73c\ubbc0\ub85c, \ud604\uc7ac \uae30\ubcf8\uac12\ub9cc\uc744 \uc0ac\uc6a9\ud558\ub294 \uc911\uc785\ub2c8\ub2e4." }, { MsgKey.ER_ILLEGAL_CHARACTER, "{1}\uc758 \uc9c0\uc815\ub41c \ucd9c\ub825 \uc778\ucf54\ub529\uc5d0 \ud45c\uc2dc\ub418\uc9c0 \uc54a\uc740 \ubb34\uacb0\uc131 \uac12 {0}\uc758 \ubb38\uc790\ub97c \ucd9c\ub825\ud558\uc2ed\uc2dc\uc624. " }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "''{1}'' \ucd9c\ub825 \uba54\uc18c\ub4dc(CLASSPATH \ud655\uc778)\uc5d0 \ub300\ud55c ''{0}'' \ud2b9\uc131 \ud30c\uc77c\uc744 \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_INVALID_PORT, "\uc798\ubabb\ub41c \ud3ec\ud2b8 \ubc88\ud638" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "\ud638\uc2a4\ud2b8\uac00 \ub110(null)\uc774\uba74 \ud3ec\ud2b8\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "\ud638\uc2a4\ud2b8\uac00 \uc644\uc804\ud55c \uc8fc\uc18c\uac00 \uc544\ub2d9\ub2c8\ub2e4." }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "\uc2a4\ud0a4\ub9c8\uac00 \uc77c\uce58\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "\ub110(null) \ubb38\uc790\uc5f4\uc5d0\uc11c \uc2a4\ud0a4\ub9c8\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\uacbd\ub85c\uc5d0 \uc798\ubabb\ub41c \uc774\uc2a4\ucf00\uc774\ud504 \uc21c\uc11c\uac00 \uc788\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_PATH_INVALID_CHAR, "\uacbd\ub85c\uc5d0 \uc798\ubabb\ub41c \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "\ub2e8\ud3b8\uc5d0 \uc798\ubabb\ub41c \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "\uacbd\ub85c\uac00 \ub110(null)\uc774\uba74 \ub2e8\ud3b8\uc744 \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "\uc77c\ubc18 URI\uc5d0 \ub300\ud574\uc11c\ub9cc \ub2e8\ud3b8\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_NO_SCHEME_IN_URI, "URI\uc5d0 \uc2a4\ud0a4\ub9c8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "\ube48 \ub9e4\uac1c\ubcc0\uc218\ub85c URI\ub97c \ucd08\uae30\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "\uacbd\ub85c \ubc0f \ub2e8\ud3b8 \ub458 \ub2e4\uc5d0 \ub2e8\ud3b8\uc744 \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "\uacbd\ub85c \ubc0f \uc870\ud68c \ubb38\uc790\uc5f4\uc5d0 \uc870\ud68c \ubb38\uc790\uc5f4\uc744 \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "\ud638\uc2a4\ud2b8\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 \ud3ec\ud2b8\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "\ud638\uc2a4\ud2b8\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 Userinfo\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "\uacbd\uace0: \uc694\uccad\ub41c \ucd9c\ub825 \ubb38\uc11c\uc758 \ubc84\uc804\uc740 ''{0}''\uc785\ub2c8\ub2e4. \ud558\uc9c0\ub9cc \uc774 XML \ubc84\uc804\uc740 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ucd9c\ub825 \ubb38\uc11c\uc758 \ubc84\uc804\uc740 ''1.0''\uc774 \ub429\ub2c8\ub2e4." }, { MsgKey.ER_SCHEME_REQUIRED, "\uc2a4\ud0a4\ub9c8\uac00 \ud544\uc694\ud569\ub2c8\ub2e4." }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "SerializerFactory\uc5d0 \uc804\ub2ec\ub41c \ud2b9\uc131 \uc624\ube0c\uc81d\ud2b8\uc5d0 ''{0}'' \ud2b9\uc131\uc774 \uc5c6\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "\uacbd\uace0: ''{0}'' \uc778\ucf54\ub529\uc740 Java Runtime\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4." }, {MsgKey.ER_FEATURE_NOT_FOUND, "''{0}'' \ub9e4\uac1c\ubcc0\uc218\ub97c \uc778\uc2dd\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "''{0}'' \ub9e4\uac1c\ubcc0\uc218\ub294 \uc778\uc2dd\ud560 \uc218 \uc788\uc73c\ub098 \uc694\uccad\ub41c \uac12\uc744 \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {MsgKey.ER_STRING_TOO_LONG, "\uacb0\uacfc \ubb38\uc790\uc5f4\uc774 \ub108\ubb34 \uae38\uc5b4 DOMString\uc5d0 \ub9de\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: ''{0}'' "}, {MsgKey.ER_TYPE_MISMATCH_ERR, "\uc774 \ub9e4\uac1c\ubcc0\uc218 \uc774\ub984\uc5d0 \ub300\ud55c \uac12 \uc720\ud615\uc774 \uc608\uc0c1 \uac12 \uc720\ud615\uacfc \ud638\ud658\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "\ub370\uc774\ud130\ub97c \uae30\ub85d\ud560 \ucd9c\ub825 \ub300\uc0c1\uc774 \ub110(null)\uc785\ub2c8\ub2e4."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "\uc9c0\uc6d0\ub418\uc9c0 \uc54a\ub294 \uc778\ucf54\ub529\uc774 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "\ub178\ub4dc\ub97c \uc9c1\ub82c\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "CDATA \uc139\uc158\uc5d0 \uc885\ub8cc \ud45c\uc2dc \ubb38\uc790\uc778 ']]>'\uac00 \ud558\ub098 \uc774\uc0c1 \ud3ec\ud568\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Well-Formedness \uac80\uc0ac\uae30\uc758 \uc778\uc2a4\ud134\uc2a4\ub97c \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. Well-Formed \ub9e4\uac1c\ubcc0\uc218\uac00 true\ub85c \uc124\uc815\ub418\uc5c8\uc9c0\ub9cc Well-Formedness \uac80\uc0ac\ub97c \uc218\ud589\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, {MsgKey.ER_WF_INVALID_CHARACTER, "''{0}'' \ub178\ub4dc\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 XML \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "\uc124\uba85\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 XML \ubb38\uc790(Unicode: 0x{0})\uac00 \uc788\uc2b5\ub2c8\ub2e4. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\ucc98\ub9ac \uba85\ub839\uc5b4 \ub370\uc774\ud130\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 XML \ubb38\uc790(Unicode: 0x{0})\uac00 \uc788\uc2b5\ub2c8\ub2e4 " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "CDATASection\uc758 \ub0b4\uc6a9\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 XML \ubb38\uc790(Unicode: 0x{0})\uac00 \uc788\uc2b5\ub2c8\ub2e4. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "\ub178\ub4dc\uc758 \ubb38\uc790 \ub370\uc774\ud130 \ub0b4\uc6a9\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 XML \ubb38\uc790(Unicode: 0x{0})\uac00 \uc788\uc2b5\ub2c8\ub2e4. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "\uc774\ub984\uc774 ''{1}''\uc778 {0} \ub178\ub4dc\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 XML \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4. " }, { MsgKey.ER_WF_DASH_IN_COMMENT, "\uc124\uba85 \ub0b4\uc5d0\uc11c\ub294 \"--\" \ubb38\uc790\uc5f4\uc774 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "\"{0}\" \uc694\uc18c \uc720\ud615\uacfc \uc5f0\uad00\ub41c \"{1}\" \uc18d\uc131\uac12\uc5d0 ''<'' \ubb38\uc790\uac00 \ud3ec\ud568\ub418\uba74 \uc548\ub429\ub2c8\ub2e4." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "\"&{0};\"\uc758 \uad6c\ubd84 \ubd84\uc11d\ub418\uc9c0 \uc54a\uc740 \uc5d4\ud2f0\ud2f0 \ucc38\uc870\ub294 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. " }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "\uc18d\uc131\uac12\uc5d0\ub294 \"&{0};\" \uc678\ubd80 \uc5d4\ud2f0\ud2f0 \ucc38\uc870\uac00 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. " }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "\"{0}\" \uc811\ub450\ubd80\ub97c \"{1}\" \uc774\ub984 \uacf5\uac04\uc5d0 \ubc14\uc778\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "\"{0}\" \uc694\uc18c\uc758 \ub85c\uceec \uc774\ub984\uc774 \ub110(null)\uc785\ub2c8\ub2e4." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "\"{0}\" \uc18d\uc131\uc758 \ub85c\uceec \uc774\ub984\uc774 \ub110(null)\uc785\ub2c8\ub2e4." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "\"{0}\" \uc5d4\ud2f0\ud2f0 \ub178\ub4dc\uc758 \ub300\uccb4 \ud14d\uc2a4\ud2b8\uc5d0 \ubc14\uc778\ub4dc\ub418\uc9c0 \uc54a\uc740 \uc811\ub450\ubd80 \"{2}\"\uc744(\ub97c) \uac16\ub294 \"{1}\" \uc694\uc18c \ub178\ub4dc\uac00 \uc788\uc2b5\ub2c8\ub2e4." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "\"{0}\" \uc5d4\ud2f0\ud2f0 \ub178\ub4dc\uc758 \ub300\uccb4 \ud14d\uc2a4\ud2b8\uc5d0 \ubc14\uc778\ub4dc\ub418\uc9c0 \uc54a\uc740 \uc811\ub450\ubd80 \"{2}\"\uc744(\ub97c) \uac16\ub294 \"{1}\" \uc18d\uc131 \ub178\ub4dc\uac00 \uc788\uc2b5\ub2c8\ub2e4." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_ru.java0000644000175000017500000006030610721374032027366 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_ru.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_ru extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "\u041a\u043b\u044e\u0447 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f ''{0}'' \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "\u0424\u043e\u0440\u043c\u0430\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f ''{0}'' \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f ''{1}'' \u0432\u044b\u0437\u0432\u0430\u043b \u043e\u0448\u0438\u0431\u043a\u0443. " }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "\u041a\u043b\u0430\u0441\u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 ''{0}'' \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 org.xml.sax.ContentHandler. " }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "\u0420\u0435\u0441\u0443\u0440\u0441 [ {0} ] \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441 [ {0} ]: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 UTF-16: {0} ?" }, { MsgKey.ER_OIERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 {0} \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u0443\u0437\u043b\u043e\u0432 \u0438 \u0434\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0410\u0442\u0440\u0438\u0431\u0443\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d. " }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 ''{0}'' \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e. " }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}'' \u0432\u043d\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. " }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d ''{0}''=''{1}'' \u0432\u043d\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. " }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c ''{0}'' (\u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 CLASSPATH), \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e" }, { MsgKey.ER_ILLEGAL_CHARACTER, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {0} \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 {1}. " }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0441\u0432\u043e\u0439\u0441\u0442\u0432 ''{0}'' \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 ''{1}'' (\u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0440\u0442\u0430" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0445\u043e\u0441\u0442\u0430" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "\u0421\u0445\u0435\u043c\u0430 \u043d\u0435 \u043a\u043e\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0430." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u0412 \u0438\u043c\u0435\u043d\u0438 \u043f\u0443\u0442\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430\u044f Esc-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c" }, { MsgKey.ER_PATH_INVALID_CHAR, "\u0412 \u0438\u043c\u0435\u043d\u0438 \u043f\u0443\u0442\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u0443\u0442\u0438" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 URI" }, { MsgKey.ER_NO_SCHEME_IN_URI, "\u0412 URI \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0441\u0445\u0435\u043c\u0430" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c URI \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043f\u0443\u0442\u0438 \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0443\u0442\u0438 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d \u0445\u043e\u0441\u0442" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d \u0445\u043e\u0441\u0442" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 ''{0}''. \u042d\u0442\u0430 \u0432\u0435\u0440\u0441\u0438\u044f XML \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0412\u0435\u0440\u0441\u0438\u0435\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 ''1.0''. " }, { MsgKey.ER_SCHEME_REQUIRED, "\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0441\u0445\u0435\u043c\u0430!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "\u041e\u0431\u044a\u0435\u043a\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 SerializerFactory, \u043d\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c ''{0}''. " }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 ''{0}'' \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u043e\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Java." }, {MsgKey.ER_FEATURE_NOT_FOUND, "\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ''{0}'' \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d. "}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ''{0}'' \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d, \u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. "}, {MsgKey.ER_STRING_TOO_LONG, "\u0421\u0442\u0440\u043e\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 DOMString: ''{0}''. "}, {MsgKey.ER_TYPE_MISMATCH_ERR, "\u0422\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0441 \u044d\u0442\u0438 \u0438\u043c\u0435\u043d\u0435\u043c \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. "}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. "}, {MsgKey.ER_UNSUPPORTED_ENCODING, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u043d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430. "}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0437\u0435\u043b. "}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "\u0420\u0430\u0437\u0434\u0435\u043b CDATA \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 ']]>'. "}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true, \u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. " }, {MsgKey.ER_WF_INVALID_CHARACTER, "\u0423\u0437\u0435\u043b ''{0}'' \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b XML. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "\u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b XML (\u042e\u043d\u0438\u043a\u043e\u0434: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 instructiondata \u0431\u044b\u043b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b XML (\u042e\u043d\u0438\u043a\u043e\u0434: 0x{0}). " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "\u0412 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c CDATASection \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b XML (\u042e\u043d\u0438\u043a\u043e\u0434: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "\u0412 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0437\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b XML (\u042e\u043d\u0438\u043a\u043e\u0434: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b XML \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u0432 \u0443\u0437\u043b\u0435 {0} \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{1}''. " }, { MsgKey.ER_WF_DASH_IN_COMMENT, "\u0421\u0442\u0440\u043e\u043a\u0430 \"--\" \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. " }, {MsgKey.ER_WF_LT_IN_ATTVAL, "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \"{1}\", \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0442\u0438\u043f\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \"{0}\", \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b ''<''. " }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "\u041d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \"&{0};\" \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430. " }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "\u0412\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \"&{0};\" \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430 \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. " }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "\u041f\u0440\u0435\u0444\u0438\u043a\u0441 \"{0}\" \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d \"{1}\". " }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \"{0}\" \u043f\u0443\u0441\u0442\u043e. " }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \"{0}\" \u043f\u0443\u0441\u0442\u043e. " }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043c\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u0437\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \"{0}\" \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0437\u0435\u043b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \"{1}\" \u0441 \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c \"{2}\". " }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "\u0422\u0435\u043a\u0441\u0442 \u0437\u0430\u043c\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u0437\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \"{0}\" \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0437\u0435\u043b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \"{1}\" \u0441 \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c \"{2}\". " }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_zh.java0000644000175000017500000003367110721374032027366 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_zh.java,v 1.7 2005/03/07 20:34:36 minchau Exp $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_zh extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "\u6d88\u606f\u5bc6\u94a5\u201c{0}\u201d\u4e0d\u5728\u6d88\u606f\u7c7b\u201c{1}\u201d\u4e2d" }, { MsgKey.BAD_MSGFORMAT, "\u6d88\u606f\u7c7b\u201c{1}\u201d\u4e2d\u7684\u6d88\u606f\u201c{0}\u201d\u7684\u683c\u5f0f\u65e0\u6548\u3002" }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "\u4e32\u884c\u5668\u7c7b\u201c{0}\u201d\u4e0d\u80fd\u5b9e\u73b0 org.xml.sax.ContentHandler\u3002" }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "\u627e\u4e0d\u5230\u8d44\u6e90 [ {0} ]\u3002\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "\u8d44\u6e90 [ {0} ] \u65e0\u6cd5\u88c5\u5165\uff1a{1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u7f13\u51b2\u533a\u5927\u5c0f <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\u68c0\u6d4b\u5230\u65e0\u6548\u7684 UTF-16 \u8d85\u5927\u5b57\u7b26\u96c6\uff1a{0}\uff1f" }, { MsgKey.ER_OIERROR, "IO \u9519\u8bef" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "\u5728\u751f\u6210\u5b50\u8282\u70b9\u4e4b\u540e\u6216\u5728\u751f\u6210\u5143\u7d20\u4e4b\u524d\u65e0\u6cd5\u6dfb\u52a0\u5c5e\u6027 {0}\u3002\u5c06\u5ffd\u7565\u5c5e\u6027\u3002" }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "\u5c1a\u672a\u58f0\u660e\u524d\u7f00\u201c{0}\u201d\u7684\u540d\u79f0\u7a7a\u95f4\u3002" }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "\u5c5e\u6027\u201c{0}\u201d\u5728\u5143\u7d20\u5916\u3002" }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "\u540d\u79f0\u7a7a\u95f4\u58f0\u660e\u201c{0}\u201d=\u201c{1}\u201d\u5728\u5143\u7d20\u5916\u3002" }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "\u65e0\u6cd5\u88c5\u5165\u201c{0}\u201d\uff08\u68c0\u67e5 CLASSPATH\uff09\uff0c\u73b0\u5728\u53ea\u4f7f\u7528\u7f3a\u7701\u503c" }, { MsgKey.ER_ILLEGAL_CHARACTER, "\u5c1d\u8bd5\u8f93\u51fa\u6574\u6570\u503c {0}\uff08\u5b83\u4e0d\u662f\u4ee5\u6307\u5b9a\u7684 {1} \u8f93\u51fa\u7f16\u7801\u8868\u793a\uff09\u7684\u5b57\u7b26\u3002" }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "\u65e0\u6cd5\u4e3a\u8f93\u51fa\u65b9\u6cd5\u201c{1}\u201d\u88c5\u5165\u5c5e\u6027\u6587\u4ef6\u201c{0}\u201d\uff08\u68c0\u67e5 CLASSPATH\uff09" }, { MsgKey.ER_INVALID_PORT, "\u7aef\u53e3\u53f7\u65e0\u6548" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "\u4e3b\u673a\u4e3a\u7a7a\u65f6\uff0c\u65e0\u6cd5\u8bbe\u7f6e\u7aef\u53e3" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "\u4e3b\u673a\u4e0d\u662f\u683c\u5f0f\u6b63\u786e\u7684\u5730\u5740" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "\u6a21\u5f0f\u4e0d\u4e00\u81f4\u3002" }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "\u65e0\u6cd5\u4ece\u7a7a\u5b57\u7b26\u4e32\u8bbe\u7f6e\u6a21\u5f0f" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u8def\u5f84\u5305\u542b\u65e0\u6548\u7684\u8f6c\u4e49\u5e8f\u5217" }, { MsgKey.ER_PATH_INVALID_CHAR, "\u8def\u5f84\u5305\u542b\u65e0\u6548\u7684\u5b57\u7b26\uff1a{0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "\u7247\u6bb5\u5305\u542b\u65e0\u6548\u7684\u5b57\u7b26" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "\u8def\u5f84\u4e3a\u7a7a\u65f6\uff0c\u65e0\u6cd5\u8bbe\u7f6e\u7247\u6bb5" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "\u53ea\u80fd\u4e3a\u7c7b\u5c5e URI \u8bbe\u7f6e\u7247\u6bb5" }, { MsgKey.ER_NO_SCHEME_IN_URI, "URI \u4e2d\u627e\u4e0d\u5230\u4efb\u4f55\u6a21\u5f0f" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "\u4e0d\u80fd\u4ee5\u7a7a\u53c2\u6570\u521d\u59cb\u5316 URI" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "\u8def\u5f84\u548c\u7247\u6bb5\u4e2d\u90fd\u4e0d\u80fd\u6307\u5b9a\u7247\u6bb5" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "\u8def\u5f84\u548c\u67e5\u8be2\u5b57\u7b26\u4e32\u4e2d\u4e0d\u80fd\u6307\u5b9a\u67e5\u8be2\u5b57\u7b26\u4e32" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u4e3b\u673a\uff0c\u5219\u4e0d\u53ef\u4ee5\u6307\u5b9a\u7aef\u53e3" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u4e3b\u673a\uff0c\u5219\u4e0d\u53ef\u4ee5\u6307\u5b9a\u7528\u6237\u4fe1\u606f" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "\u8b66\u544a\uff1a\u8981\u6c42\u8f93\u51fa\u6587\u6863\u7684\u7248\u672c\u662f\u201c{0}\u201d\u3002\u4e0d\u652f\u6301\u6b64 XML \u7248\u672c\u3002\u8f93\u51fa\u6587\u6863\u7684\u7248\u672c\u5c06\u4f1a\u662f\u201c1.0\u201d\u3002" }, { MsgKey.ER_SCHEME_REQUIRED, "\u6a21\u5f0f\u662f\u5fc5\u9700\u7684\uff01" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "\u4f20\u9012\u7ed9 SerializerFactory \u7684 Properties \u5bf9\u8c61\u4e0d\u5177\u6709\u5c5e\u6027\u201c{0}\u201d\u3002" }, {MsgKey.ER_FEATURE_NOT_FOUND, "\u672a\u8bc6\u522b\u51fa\u53c2\u6570\u201c{0}\u201d\u3002"}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "\u5df2\u8bc6\u522b\u51fa\u53c2\u6570\u201c{0}\u201d\uff0c\u4f46\u65e0\u6cd5\u8bbe\u7f6e\u8bf7\u6c42\u7684\u503c\u3002"}, {MsgKey.ER_STRING_TOO_LONG, "\u4ea7\u751f\u7684\u5b57\u7b26\u4e32\u8fc7\u957f\u4e0d\u80fd\u88c5\u5165 DOMString\uff1a\u201c{0}\u201d\u3002"}, {MsgKey.ER_TYPE_MISMATCH_ERR, "\u6b64\u53c2\u6570\u540d\u79f0\u7684\u503c\u7c7b\u578b\u4e0e\u671f\u671b\u7684\u503c\u7c7b\u578b\u4e0d\u517c\u5bb9\u3002"}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "\u5c06\u8981\u5199\u5165\u6570\u636e\u7684\u8f93\u51fa\u76ee\u6807\u4e3a\u7a7a\u3002"}, {MsgKey.ER_UNSUPPORTED_ENCODING, "\u9047\u5230\u4e0d\u53d7\u652f\u6301\u7684\u7f16\u7801\u3002"}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "\u65e0\u6cd5\u5c06\u8282\u70b9\u5e8f\u5217\u5316\u3002 "}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "CDATA \u90e8\u5206\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u7ec8\u6b62\u6807\u8bb0\u201c]]>\u201d\u3002"}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "\u65e0\u6cd5\u521b\u5efa\u683c\u5f0f\u6b63\u786e\u6027\u68c0\u67e5\u5668\u7684\u5b9e\u4f8b\u3002\u201c\u683c\u5f0f\u6b63\u786e\u201d\u53c2\u6570\u5df2\u8bbe\u7f6e\u4e3a true\uff0c\u4f46\u65e0\u6cd5\u6267\u884c\u683c\u5f0f\u6b63\u786e\u6027\u68c0\u67e5\u3002" }, {MsgKey.ER_WF_INVALID_CHARACTER, "\u8282\u70b9\u201c{0}\u201d\u5305\u542b\u65e0\u6548\u7684 XML \u5b57\u7b26\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "\u5728\u6ce8\u91ca\u4e2d\u627e\u5230\u65e0\u6548\u7684 XML \u5b57\u7b26 (Unicode: 0x''{0})''\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\u5728\u5904\u7406\u6307\u4ee4\u6570\u636e\u4e2d\u627e\u5230\u65e0\u6548\u7684 XML \u5b57\u7b26 (Unicode: 0x''{0})''\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "\u5728 CDATA \u90e8\u5206\u7684\u5185\u5bb9\u4e2d\u627e\u5230\u65e0\u6548\u7684 XML \u5b57\u7b26 (Unicode: 0x''{0})''\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "\u5728\u8282\u70b9\u7684\u5b57\u7b26\u6570\u636e\u5185\u5bb9\u4e2d\u627e\u5230\u65e0\u6548\u7684 XML \u5b57\u7b26 (Unicode: 0x''{0})''\u3002" }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "\u540d\u79f0\u4e3a\u201c{1})\u201d\u7684\u201c{0})\u201d\u4e2d\u627e\u5230\u65e0\u6548\u7684 XML \u5b57\u7b26\u3002" }, { MsgKey.ER_WF_DASH_IN_COMMENT, "\u6ce8\u91ca\u4e2d\u4e0d\u5141\u8bb8\u6709\u5b57\u7b26\u4e32\u201c--\u201d\u3002" }, {MsgKey.ER_WF_LT_IN_ATTVAL, "\u4e0e\u5143\u7d20\u7c7b\u578b\u201c{0}\u201d\u5173\u8054\u7684\u5c5e\u6027\u201c{1}\u201d\u7684\u503c\u4e0d\u5f97\u5305\u542b\u201c<\u201d\u5b57\u7b26\u3002" }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "\u4e0d\u5141\u8bb8\u6709\u672a\u89e3\u6790\u7684\u5b9e\u4f53\u5f15\u7528\u201c&{0};\u201d\u3002" }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "\u5c5e\u6027\u503c\u4e2d\u4e0d\u5141\u8bb8\u6709\u5916\u90e8\u5b9e\u4f53\u5f15\u7528\u201c&{0};\u201d\u3002" }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "\u524d\u7f00\u201c{0}\u201d\u4e0d\u80fd\u7ed1\u5b9a\u5230\u540d\u79f0\u7a7a\u95f4\u201c{1}\u201d\u3002" }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "\u5143\u7d20\u201c{0}\u201d\u7684\u5c40\u90e8\u540d\u4e3a\u7a7a\u3002" }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "\u5c5e\u6027\u201c{0}\u201d\u7684\u5c40\u90e8\u540d\u4e3a\u7a7a\u3002" }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "\u5b9e\u4f53\u8282\u70b9\u201c{0}\u201d\u7684\u66ff\u4ee3\u6587\u672c\u4e2d\u5305\u542b\u5143\u7d20\u8282\u70b9\u201c{1}\u201d\uff0c\u8be5\u8282\u70b9\u5177\u6709\u672a\u7ed1\u5b9a\u7684\u524d\u7f00\u201c{2}\u201d\u3002" }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "\u5b9e\u4f53\u8282\u70b9\u201c{0}\u201d\u7684\u66ff\u4ee3\u6587\u672c\u4e2d\u5305\u542b\u5c5e\u6027\u8282\u70b9\u201c{1}\u201d\uff0c\u8be5\u8282\u70b9\u5177\u6709\u672a\u7ed1\u5b9a\u7684\u524d\u7f00\u201c{2}\u201d\u3002" }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/Messages.java0000644000175000017500000002765310721374031024635 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Messages.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * A utility class for issuing error messages. * * A user of this class normally would create a singleton * instance of this class, passing the name * of the message class on the constructor. For example: * * static Messages x = new Messages("org.package.MyMessages"); * * Later the message is typically generated this way if there are no * substitution arguments: * * String msg = x.createMessage(org.package.MyMessages.KEY_ONE, null); * * If there are arguments substitutions then something like this: * * String filename = ...; * String directory = ...; * String msg = x.createMessage(org.package.MyMessages.KEY_TWO, * new Object[] {filename, directory) ); * * * The constructor of an instance of this class must be given * the class name of a class that extends java.util.ListResourceBundle * ("org.package.MyMessages" in the example above). * The name should not have any language suffix * which will be added automatically by this utility class. * * The message class ("org.package.MyMessages") * must define the abstract method getContents() that is * declared in its base class, for example: * * public Object[][] getContents() {return contents;} * * * It is suggested that the message class expose its * message keys like this: * * public static final String KEY_ONE = "KEY1"; * public static final String KEY_TWO = "KEY2"; * . . . * * and used through their names (KEY_ONE ...) rather than * their values ("KEY1" ...). * * The field contents (returned by getContents() * should be initialized something like this: * * public static final Object[][] contents = { * { KEY_ONE, "Something has gone wrong!" }, * { KEY_TWO, "The file ''{0}'' does not exist in directory ''{1}''." }, * . . . * { KEY_N, "Message N" } } * * * Where that section of code with the KEY to Message mappings * (where the message classes 'contents' field is initialized) * can have the Message strings translated in an alternate language * in a errorResourceClass with a language suffix. * * More sophisticated use of this class would be to pass null * when contructing it, but then call loadResourceBundle() * before creating any messages. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public final class Messages { /** The local object to use. */ private final Locale m_locale = Locale.getDefault(); /** The language specific resource object for messages. */ private ListResourceBundle m_resourceBundle; /** The class name of the error message string table with no language suffix. */ private String m_resourceBundleName; /** * Constructor. * @param resourceBundle the class name of the ListResourceBundle * that the instance of this class is associated with and will use when * creating messages. * The class name is without a language suffix. If the value passed * is null then loadResourceBundle(errorResourceClass) needs to be called * explicitly before any messages are created. * * @xsl.usage internal */ Messages(String resourceBundle) { m_resourceBundleName = resourceBundle; } /* * Set the Locale object to use. If this method is not called the * default locale is used. This method needs to be called before * loadResourceBundle(). * * @param locale non-null reference to Locale object. * @xsl.usage internal */ // public void setLocale(Locale locale) // { // m_locale = locale; // } /** * Get the Locale object that is being used. * * @return non-null reference to Locale object. * @xsl.usage internal */ private Locale getLocale() { return m_locale; } /** * Get the ListResourceBundle being used by this Messages instance which was * previously set by a call to loadResourceBundle(className) * @xsl.usage internal */ private ListResourceBundle getResourceBundle() { return m_resourceBundle; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. * @xsl.usage internal */ public final String createMessage(String msgKey, Object args[]) { if (m_resourceBundle == null) m_resourceBundle = loadResourceBundle(m_resourceBundleName); if (m_resourceBundle != null) { return createMsg(m_resourceBundle, msgKey, args); } else return "Could not load the resource bundles: "+ m_resourceBundleName; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param errorCode The key for the message text. * * @param fResourceBundle The resource bundle to use. * @param msgKey The message key to use. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. * @xsl.usage internal */ private final String createMsg( ListResourceBundle fResourceBundle, String msgKey, Object args[]) //throws Exception { String fmsg = null; boolean throwex = false; String msg = null; if (msgKey != null) msg = fResourceBundle.getString(msgKey); else msgKey = ""; if (msg == null) { throwex = true; /* The message is not in the bundle . . . this is bad, * so try to get the message that the message is not in the bundle */ try { msg = java.text.MessageFormat.format( MsgKey.BAD_MSGKEY, new Object[] { msgKey, m_resourceBundleName }); } catch (Exception e) { /* even the message that the message is not in the bundle is * not there ... this is really bad */ msg = "The message key '" + msgKey + "' is not in the message class '" + m_resourceBundleName+"'"; } } else if (args != null) { try { // Do this to keep format from crying. // This is better than making a bunch of conditional // code all over the place. int n = args.length; for (int i = 0; i < n; i++) { if (null == args[i]) args[i] = ""; } fmsg = java.text.MessageFormat.format(msg, args); // if we get past the line above we have create the message ... hurray! } catch (Exception e) { throwex = true; try { // Get the message that the format failed. fmsg = java.text.MessageFormat.format( MsgKey.BAD_MSGFORMAT, new Object[] { msgKey, m_resourceBundleName }); fmsg += " " + msg; } catch (Exception formatfailed) { // We couldn't even get the message that the format of // the message failed ... so fall back to English. fmsg = "The format of message '" + msgKey + "' in message class '" + m_resourceBundleName + "' failed."; } } } else fmsg = msg; if (throwex) { throw new RuntimeException(fmsg); } return fmsg; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements ListResourceBundle, * without language suffix. * @return the ResourceBundle * @throws MissingResourceException * @xsl.usage internal */ private ListResourceBundle loadResourceBundle(String resourceBundle) throws MissingResourceException { m_resourceBundleName = resourceBundle; Locale locale = getLocale(); ListResourceBundle lrb; try { ResourceBundle rb = ResourceBundle.getBundle(m_resourceBundleName, locale); lrb = (ListResourceBundle) rb; } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. lrb = (ListResourceBundle) ResourceBundle.getBundle( m_resourceBundleName, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles." + m_resourceBundleName, m_resourceBundleName, ""); } } m_resourceBundle = lrb; return lrb; } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which can be appended to a resource name * @xsl.usage internal */ private static String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_hu.java0000644000175000017500000003327310721374033027360 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_hu.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_hu extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "A(z) ''{0}'' \u00fczenetkulcs nem tal\u00e1lhat\u00f3 a(z) ''{1}'' \u00fczenetoszt\u00e1lyban." }, { MsgKey.BAD_MSGFORMAT, "A(z) ''{1}'' \u00fczenetoszt\u00e1ly ''{0}'' \u00fczenet\u00e9nek form\u00e1tuma hib\u00e1s." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "A(z) ''{0}'' p\u00e9ld\u00e1nyos\u00edt\u00f3 oszt\u00e1ly nem val\u00f3s\u00edtja meg az org.xml.sax.ContentHandler f\u00fcggv\u00e9nyt." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "A(z) [ {0} ] er\u0151forr\u00e1s nem tal\u00e1lhat\u00f3.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "A(z) [ {0} ] er\u0151forr\u00e1st nem lehet bet\u00f6lteni: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Pufferm\u00e9ret <= 0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\u00c9rv\u00e9nytelen UTF-16 helyettes\u00edt\u00e9s: {0} ?" }, { MsgKey.ER_OIERROR, "IO hiba" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Nem lehet {0} attrib\u00fatumot hozz\u00e1adni ut\u00f3d csom\u00f3pontok ut\u00e1n vagy egy elem el\u0151\u00e1ll\u00edt\u00e1sa el\u0151tt. Az attrib\u00fatum figyelmen k\u00edv\u00fcl marad." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "A(z) ''{0}'' el\u0151tag n\u00e9vtere nincs deklar\u00e1lva." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "A(z) ''{0}'' attrib\u00fatum k\u00edv\u00fcl esik az elemen." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "A(z) ''{0}''=''{1}'' n\u00e9vt\u00e9rdeklar\u00e1ci\u00f3 k\u00edv\u00fcl esik az elemen." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Nem lehet bet\u00f6lteni ''{0}'' er\u0151forr\u00e1st (ellen\u0151rizze a CLASSPATH be\u00e1ll\u00edt\u00e1st), a rendszer az alap\u00e9rtelmez\u00e9seket haszn\u00e1lja." }, { MsgKey.ER_ILLEGAL_CHARACTER, "K\u00eds\u00e9rletet tett {0} \u00e9rt\u00e9k\u00e9nek karakteres ki\u00edr\u00e1s\u00e1ra, de nem jelen\u00edthet\u0151 meg a megadott {1} kimeneti k\u00f3dol\u00e1ssal." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Nem lehet bet\u00f6lteni a(z) ''{0}'' tulajdons\u00e1gf\u00e1jlt a(z) ''{1}'' met\u00f3dushoz (ellen\u0151rizze a CLASSPATH be\u00e1ll\u00edt\u00e1st)" }, { MsgKey.ER_INVALID_PORT, "\u00c9rv\u00e9nytelen portsz\u00e1m" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "A portot nem \u00e1ll\u00edthatja be, ha a hoszt null" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "A hoszt nem j\u00f3l form\u00e1zott c\u00edm" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "A s\u00e9ma nem megfelel\u0151." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Nem lehet be\u00e1ll\u00edtani a s\u00e9m\u00e1t null karaktersorozatb\u00f3l" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Az el\u00e9r\u00e9si \u00fat \u00e9rv\u00e9nytelen vez\u00e9rl\u0151 jelsorozatot tartalmaz" }, { MsgKey.ER_PATH_INVALID_CHAR, "Az el\u00e9r\u00e9si \u00fat \u00e9rv\u00e9nytelen karaktert tartalmaz: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "A t\u00f6red\u00e9k \u00e9rv\u00e9nytelen karaktert tartalmaz" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "A t\u00f6red\u00e9ket nem \u00e1ll\u00edthatja be, ha az el\u00e9r\u00e9si \u00fat null" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Csak \u00e1ltal\u00e1nos URI-hoz \u00e1ll\u00edthat be t\u00f6red\u00e9ket" }, { MsgKey.ER_NO_SCHEME_IN_URI, "Nem tal\u00e1lhat\u00f3 s\u00e9ma az URI-ban" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Az URI nem inicializ\u00e1lhat\u00f3 \u00fcres param\u00e9terekkel" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Nem adhat meg t\u00f6red\u00e9ket az el\u00e9r\u00e9si \u00fatban \u00e9s a t\u00f6red\u00e9kben is" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Nem adhat meg lek\u00e9rdez\u00e9si karaktersorozatot az el\u00e9r\u00e9si \u00fatban \u00e9s a lek\u00e9rdez\u00e9si karaktersorozatban" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Nem adhatja meg a portot, ha nincs megadva hoszt" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Nem adhatja meg a felhaszn\u00e1l\u00f3i inform\u00e1ci\u00f3kat, ha nincs megadva hoszt" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Figyelmeztet\u00e9s: A kimeneti dokumentum k\u00e9rt verzi\u00f3ja ''{0}''. Az XML ezen verzi\u00f3ja nem t\u00e1mogatott. A kimeneti dokumentum verzi\u00f3ja ''1.0'' lesz." }, { MsgKey.ER_SCHEME_REQUIRED, "S\u00e9m\u00e1ra van sz\u00fcks\u00e9g!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "A SerializerFactory oszt\u00e1lynak \u00e1tadott Properties objektumnak nincs ''{0}'' tulajdons\u00e1ga." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Figyelmeztet\u00e9s: A(z) ''{0}'' k\u00f3dol\u00e1st nem t\u00e1mogatja a Java fut\u00e1si k\u00f6rnyezet." }, {MsgKey.ER_FEATURE_NOT_FOUND, "A(z) ''{0}'' param\u00e9ter nem ismerhet\u0151 fel."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "A(z) ''{0}'' param\u00e9ter ismert, de a k\u00e9rt \u00e9rt\u00e9k nem \u00e1ll\u00edthat\u00f3 be."}, {MsgKey.ER_STRING_TOO_LONG, "A l\u00e9trej\u00f6v\u0151 karaktersorozat t\u00fal hossz\u00fa, nem f\u00e9r el egy DOMString-ben: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "A param\u00e9tern\u00e9v \u00e9rt\u00e9k\u00e9nek t\u00edpusa nem kompatibilis a v\u00e1rt t\u00edpussal."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "Az adatki\u00edr\u00e1s c\u00e9ljak\u00e9nt megadott \u00e9rt\u00e9k \u00fcres volt."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Nem t\u00e1mogatott k\u00f3dol\u00e1s."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "A csom\u00f3pont nem p\u00e9ld\u00e1nyos\u00edthat\u00f3."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "A CDATA szakasz legal\u00e1bb egy ']]>' lez\u00e1r\u00f3 jelz\u0151t tartalmaz."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "A szab\u00e1lyos form\u00e1z\u00e1st ellen\u0151rz\u0151 p\u00e9ld\u00e1nyt nem siker\u00fclt l\u00e9trehozni. A well-formed param\u00e9ter \u00e9rt\u00e9ke true, de a szab\u00e1lyos form\u00e1z\u00e1st nem lehet ellen\u0151rizni." }, {MsgKey.ER_WF_INVALID_CHARACTER, "A(z) ''{0}'' csom\u00f3pont \u00e9rv\u00e9nytelen XML karaktereket tartalmaz." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "\u00c9rv\u00e9nytelen XML karakter (Unicode: 0x{0}) szerepelt a megjegyz\u00e9sben." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\u00c9rv\u00e9nytelen XML karakter (Unicode: 0x{0}) szerepelt a feldolgoz\u00e1si utas\u00edt\u00e1sadatokban." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "\u00c9rv\u00e9nytelen XML karakter (Unicode: 0x{0}) szerepelt a CDATASection tartalm\u00e1ban." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "\u00c9rv\u00e9nytelen XML karakter (Unicode: 0x{0}) szerepelt a csom\u00f3pont karakteradat tartalm\u00e1ban." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "\u00c9rv\u00e9nytelen XML karakter tal\u00e1lhat\u00f3 a(z) ''{1}'' nev\u0171 {0} csom\u00f3pontban." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "A \"--\" karaktersorozat nem megengedett a megjegyz\u00e9sekben." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "A(z) \"{0}\" elemt\u00edpussal t\u00e1rs\u00edtott \"{1}\" attrib\u00fatum \u00e9rt\u00e9ke nem tartalmazhat ''<'' karaktert." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Az \u00e9rtelmez\u00e9s n\u00e9lk\u00fcli \"&{0};\" entit\u00e1shivatkoz\u00e1s nem megengedett." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "A(z) \"&{0};\" k\u00fcls\u0151 entit\u00e1shivatkoz\u00e1s nem megengedett egy attrib\u00fatum\u00e9rt\u00e9kben." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "A(z) \"{0}\" el\u0151tag nem k\u00f6thet\u0151 a(z) \"{1}\" n\u00e9vt\u00e9rhez." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "A(z) \"{0}\" elem helyi neve null." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "A(z) \"{0}\" attrib\u00fatum helyi neve null." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "A(z) \"{0}\" entit\u00e1scsom\u00f3pont helyettes\u00edt\u0151 sz\u00f6vege a(z) \"{1}\" elemcsom\u00f3pontot tartalmazza, amelynek nem k\u00f6t\u00f6tt el\u0151tagja \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "A(z) \"{0}\" entit\u00e1scsom\u00f3pont helyettes\u00edt\u0151 sz\u00f6vege a(z) \"{1}\" attrib\u00fatum-csom\u00f3pontot tartalmazza, amelynek nem k\u00f6t\u00f6tt el\u0151tagja \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_sv.java0000644000175000017500000000731210721374031027365 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_sv.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; public class SerializerMessages_sv extends ListResourceBundle { public Object[][] getContents() { Object[][] contents = new Object[][] { // BAD_MSGKEY needs translation // BAD_MSGFORMAT needs translation // ER_SERIALIZER_NOT_CONTENTHANDLER needs translation // ER_RESOURCE_COULD_NOT_FIND needs translation // ER_RESOURCE_COULD_NOT_LOAD needs translation // ER_BUFFER_SIZE_LESSTHAN_ZERO needs translation // ER_INVALID_UTF16_SURROGATE needs translation // ER_OIERROR needs translation // ER_ILLEGAL_ATTRIBUTE_POSITION needs translation // ER_NAMESPACE_PREFIX needs translation // ER_STRAY_ATTRIBUTE needs translation // ER_STRAY_NAMESPACE needs translation // ER_COULD_NOT_LOAD_RESOURCE needs translation // ER_ILLEGAL_CHARACTER needs translation // ER_COULD_NOT_LOAD_METHOD_PROPERTY needs translation { MsgKey.ER_INVALID_PORT, "Ogiltigt portnummer"}, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Port kan inte s\u00e4ttas n\u00e4r v\u00e4rd \u00e4r null"}, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "V\u00e4rd \u00e4r inte en v\u00e4lformulerad adress"}, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Schemat \u00e4r inte likformigt."}, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Kan inte s\u00e4tta schema fr\u00e5n null-str\u00e4ng"}, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "V\u00e4g inneh\u00e5ller ogiltig flyktsekvens"}, { MsgKey.ER_PATH_INVALID_CHAR, "V\u00e4g inneh\u00e5ller ogiltigt tecken: {0}"}, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment inneh\u00e5ller ogiltigt tecken"}, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Fragment kan inte s\u00e4ttas n\u00e4r v\u00e4g \u00e4r null"}, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment kan bara s\u00e4ttas f\u00f6r en allm\u00e4n URI"}, { MsgKey.ER_NO_SCHEME_IN_URI, "Schema saknas i URI: {0}"}, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Kan inte initialisera URI med tomma parametrar"}, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment kan inte anges i b\u00e5de v\u00e4gen och fragmentet"}, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "F\u00f6rfr\u00e5gan-str\u00e4ng kan inte anges i v\u00e4g och f\u00f6rfr\u00e5gan-str\u00e4ng"}, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Port f\u00e5r inte anges om v\u00e4rden inte \u00e4r angiven"}, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Userinfo f\u00e5r inte anges om v\u00e4rden inte \u00e4r angiven"}, { MsgKey.ER_SCHEME_REQUIRED, "Schema kr\u00e4vs!"} }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/Utils.java0000644000175000017500000000266210721374032024160 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Utils.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; /** * This class contains utilities used by the serializer. * * This class is not a public API, it is only public because it is * used by the serializer. * * @xsl.usage internal */ public final class Utils { /** * A singleton Messages object is used to load the * given resource bundle just once, it is * used by multiple transformations as long as the JVM stays up. */ public static final Messages messages= new Messages(SerializerMessages.class.getName()); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_tr.java0000644000175000017500000003253210721374033027366 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_tr.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_tr extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "''{0}'' ileti anahtar\u0131 ''{1}'' ileti s\u0131n\u0131f\u0131nda yok" }, { MsgKey.BAD_MSGFORMAT, "''{1}'' ileti s\u0131n\u0131f\u0131ndaki ''{0}'' iletisinin bi\u00e7imi ba\u015far\u0131s\u0131z." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "''{0}'' diziselle\u015ftirme s\u0131n\u0131f\u0131 org.xml.sax.ContentHandler s\u0131n\u0131f\u0131n\u0131 ger\u00e7ekle\u015ftirmiyor." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Kaynak [ {0} ] bulunamad\u0131.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Kaynak [ {0} ] y\u00fckleyemedi: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Arabellek b\u00fcy\u00fckl\u00fc\u011f\u00fc <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "UTF-16 yerine kullan\u0131lan de\u011fer ge\u00e7ersiz: {0} ?" }, { MsgKey.ER_OIERROR, "G\u00c7 hatas\u0131" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Alt d\u00fc\u011f\u00fcmlerden sonra ya da bir \u00f6\u011fe \u00fcretilmeden \u00f6nce {0} \u00f6zniteli\u011fi eklenemez. \u00d6znitelik yoksay\u0131lacak." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "''{0}'' \u00f6nekine ili\u015fkin ad alan\u0131 bildirilmedi." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "''{0}'' \u00f6zniteli\u011fi \u00f6\u011fenin d\u0131\u015f\u0131nda." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "''{0}''=''{1}'' ad alan\u0131 bildirimi \u00f6\u011fenin d\u0131\u015f\u0131nda." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "''{0}'' y\u00fcklenemedi (CLASSPATH de\u011fi\u015fkeninizi inceleyin), yaln\u0131zca varsay\u0131lanlar kullan\u0131l\u0131yor" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Belirtilen {1} \u00e7\u0131k\u0131\u015f kodlamas\u0131nda g\u00f6sterilmeyen {0} t\u00fcmlev de\u011feri karakteri \u00e7\u0131k\u0131\u015f giri\u015fimi." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "''{1}'' \u00e7\u0131k\u0131\u015f y\u00f6ntemi i\u00e7in ''{0}'' \u00f6zellik dosyas\u0131 y\u00fcklenemedi (CLASSPATH de\u011fi\u015fkenini inceleyin)" }, { MsgKey.ER_INVALID_PORT, "Kap\u0131 numaras\u0131 ge\u00e7ersiz" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Anasistem bo\u015f de\u011ferliyken kap\u0131 tan\u0131mlanamaz" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Anasistem do\u011fru bi\u00e7imli bir adres de\u011fil" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "\u015eema uyumlu de\u011fil." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Bo\u015f de\u011ferli dizgiden \u015fema tan\u0131mlanamaz" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Yol ge\u00e7ersiz ka\u00e7\u0131\u015f dizisi i\u00e7eriyor" }, { MsgKey.ER_PATH_INVALID_CHAR, "Yol ge\u00e7ersiz karakter i\u00e7eriyor: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Par\u00e7a ge\u00e7ersiz karakter i\u00e7eriyor" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Yol bo\u015f de\u011ferliyken par\u00e7a tan\u0131mlanamaz" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Par\u00e7a yaln\u0131zca soysal URI i\u00e7in tan\u0131mlanabilir" }, { MsgKey.ER_NO_SCHEME_IN_URI, "URI i\u00e7inde \u015fema bulunamad\u0131" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Bo\u015f de\u011fi\u015ftirgelerle URI kullan\u0131ma haz\u0131rlanamaz" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Par\u00e7a hem yolda, hem de par\u00e7ada belirtilemez" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Yol ve sorgu dizgisinde sorgu dizgisi belirtilemez" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Anasistem belirtilmediyse kap\u0131 belirtilemez" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Anasistem belirtilmediyse kullan\u0131c\u0131 bilgisi belirtilemez" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Uyar\u0131: \u00c7\u0131k\u0131\u015f belgesinin s\u00fcr\u00fcm\u00fcn\u00fcn ''{0}'' olmas\u0131 isteniyor. Bu XML s\u00fcr\u00fcm\u00fc desteklenmez. \u00c7\u0131k\u0131\u015f dosyas\u0131n\u0131n s\u00fcr\u00fcm\u00fc ''1.0'' olacak." }, { MsgKey.ER_SCHEME_REQUIRED, "\u015eema gerekli!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "SerializerFactory''ye ge\u00e7irilen Properties nesnesinin bir ''{0}'' \u00f6zelli\u011fi yok." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Uyar\u0131: ''{0}'' kodlamas\u0131 Java Runtime taraf\u0131ndan desteklenmiyor." }, {MsgKey.ER_FEATURE_NOT_FOUND, "''{0}'' de\u011fi\u015ftirgesi tan\u0131nm\u0131yor."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "''{0}'' de\u011fi\u015ftirgesi tan\u0131n\u0131yor, ancak istenen de\u011fer tan\u0131mlanam\u0131yor."}, {MsgKey.ER_STRING_TOO_LONG, "Sonu\u00e7 dizgisi DOMString i\u00e7in \u00e7ok uzun: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Bu de\u011fi\u015ftirge ad\u0131na ili\u015fkin de\u011fer tipi, beklenen de\u011fer tipiyle uyumlu de\u011fil."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "Yaz\u0131lacak verilerin \u00e7\u0131k\u0131\u015f hedefi bo\u015f de\u011ferli."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Desteklenmeyen bir kodlama saptand\u0131."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "D\u00fc\u011f\u00fcm diziselle\u015ftirilemedi."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "CDATA k\u0131sm\u0131nda bir ya da daha \u00e7ok ']]>' sonland\u0131rma imleyicisi var."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Well-Formedness denet\u015feyicisinin somut \u00f6rne\u011fi yarat\u0131lamad\u0131. well-formed de\u011fi\u015ftirgesi true de\u011ferine ayarland\u0131, ancak do\u011fru bi\u00e7im denetimi ger\u00e7ekle\u015ftirilemiyor." }, {MsgKey.ER_WF_INVALID_CHARACTER, "''{0}'' d\u00fc\u011f\u00fcm\u00fc ge\u00e7ersiz XML karakterleri i\u00e7eriyor." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "A\u00e7\u0131klamada ge\u00e7ersiz bir XML karakteri (Unicode: 0x{0}) saptand\u0131." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "\u0130\u015fleme y\u00f6nergesi verilerinde ge\u00e7ersiz bir XML karakteri (Unicode: 0x{0}) saptand\u0131." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "CDATASection i\u00e7eri\u011finde ge\u00e7ersiz bir XML karakteri (Unicode: 0x{0}) saptand\u0131." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "D\u00fc\u011f\u00fcm\u00fcn karakter verileri i\u00e7eri\u011finde ge\u00e7ersiz bir XML karakteri (Unicode: 0x{0}) saptand\u0131." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "''{1}'' adl\u0131 {0} d\u00fc\u011f\u00fcm\u00fcnde ge\u00e7ersiz XML karakteri saptand\u0131." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "A\u00e7\u0131klamalar i\u00e7inde \"--\" dizgisine izin verilmez." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "\"{0}\" \u00f6\u011fe tipiyle ili\u015fkilendirilen \"{1}\" \u00f6zniteli\u011finin de\u011feri ''<'' karakteri i\u00e7ermemelidir." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "\"&{0};\" ayr\u0131\u015ft\u0131r\u0131lmam\u0131\u015f varl\u0131k ba\u015fvurusuna izin verilmez." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "\u00d6znitelik de\u011ferinde \"&{0};\" d\u0131\u015f varl\u0131k ba\u015fvurusuna izin verilmez." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "\"{0}\" \u00f6neki \"{1}\" ad alan\u0131na ba\u011flanam\u0131yor." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "\"{0}\" \u00f6\u011fesinin yerel ad\u0131 bo\u015f de\u011ferli." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "\"{0}\" \u00f6zniteli\u011finin yerel ad\u0131 bo\u015f de\u011ferli." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "\"{0}\" varl\u0131k d\u00fc\u011f\u00fcm\u00fcn\u00fcn yerine koyma metninde, ba\u011flanmam\u0131\u015f \"{2}\" \u00f6neki bulunan bir \u00f6\u011fe d\u00fc\u011f\u00fcm\u00fc (\"{1}\") var." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "\"{0}\" varl\u0131k d\u00fc\u011f\u00fcm\u00fcn\u00fcn yerine koyma metninde, ba\u011flanmam\u0131\u015f \"{2}\" \u00f6neki bulunan bir \u00f6znitelik d\u00fc\u011f\u00fcm\u00fc (\"{1}\") var." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_en.java0000644000175000017500000000213510721374030027334 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_en.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; /** * Default implementation. This is just an empty class. * @xsl.usage internal */ public final class SerializerMessages_en extends SerializerMessages { } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_es.java0000644000175000017500000003174710721374031027355 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_es.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_es extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "La clave de mensaje ''{0}'' no est\u00e1 en la clase de mensaje ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Se ha producido un error en el formato de mensaje ''{0}'' de la clase de mensaje ''{1}''." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "La clase serializer ''{0}'' no implementa org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "No se ha podido encontrar el recurso [ {0} ].\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "No se ha podido cargar el recurso [ {0} ]: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Tama\u00f1o de almacenamiento intermedio <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "\u00bfSe ha detectado un sustituto UTF-16 no v\u00e1lido: {0}?" }, { MsgKey.ER_OIERROR, "Error de ES" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "No se puede a\u00f1adir el atributo {0} despu\u00e9s de nodos hijo o antes de que se produzca un elemento. Se ignorar\u00e1 el atributo." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "No se ha declarado el espacio de nombres para el prefijo ''{0}''." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Atributo ''{0}'' fuera del elemento." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Declaraci\u00f3n del espacio de nombres ''{0}''=''{1}'' fuera del elemento." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "No se ha podido cargar ''{0}'' (compruebe la CLASSPATH), ahora s\u00f3lo se est\u00e1n utilizando los valores predeterminados" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Se ha intentado dar salida a un car\u00e1cter del valor integral {0} que no est\u00e1 representado en la codificaci\u00f3n de salida especificada de {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "No se ha podido cargar el archivo de propiedades ''{0}'' para el m\u00e9todo de salida ''{1}'' (compruebe la CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "N\u00famero de puerto no v\u00e1lido" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "No se puede establecer el puerto si el sistema principal es nulo" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "El sistema principal no es una direcci\u00f3n bien formada" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "El esquema no es compatible." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "No se puede establecer un esquema de una serie nula" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "La v\u00eda de acceso contiene una secuencia de escape no v\u00e1lida" }, { MsgKey.ER_PATH_INVALID_CHAR, "La v\u00eda de acceso contiene un car\u00e1cter no v\u00e1lido: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "El fragmento contiene un car\u00e1cter no v\u00e1lido" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "No se puede establecer el fragmento si la v\u00eda de acceso es nula" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "S\u00f3lo se puede establecer el fragmento para un URI gen\u00e9rico" }, { MsgKey.ER_NO_SCHEME_IN_URI, "No se ha encontrado un esquema en el URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "No se puede inicializar el URI con par\u00e1metros vac\u00edos" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "No se puede especificar el fragmento en la v\u00eda de acceso y en el fragmento" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "No se puede especificar la serie de consulta en la v\u00eda de acceso y en la serie de consulta" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "No se puede especificar el puerto si no se ha especificado el sistema principal" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "No se puede especificar la informaci\u00f3n de usuario si no se ha especificado el sistema principal" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Aviso: la versi\u00f3n del documento de salida tiene que ser ''{0}''. No se admite esta versi\u00f3n de XML. La versi\u00f3n del documento de salida ser\u00e1 ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "\u00a1Se necesita un esquema!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "El objeto Properties pasado a SerializerFactory no tiene una propiedad ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Aviso: La codificaci\u00f3n ''{0}'' no est\u00e1 soportada por Java Runtime." }, {MsgKey.ER_FEATURE_NOT_FOUND, "El par\u00e1metro ''{0}'' no se reconoce."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Se reconoce el par\u00e1metro ''{0}'' pero no puede establecerse el valor solicitado."}, {MsgKey.ER_STRING_TOO_LONG, "La serie producida es demasiado larga para ajustarse a DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "El tipo de valor para este nombre de par\u00e1metro es incompatible con el tipo de valor esperado."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "El destino de salida de escritura de los datos es nulo."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Se ha encontrado una codificaci\u00f3n no soportada."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "No se ha podido serializar el nodo."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "La secci\u00f3n CDATA contiene uno o m\u00e1s marcadores ']]>' de terminaci\u00f3n."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "No se ha podido crear una instancia del comprobador de gram\u00e1tica correcta. El par\u00e1metro well-formed se ha establecido en true pero no se puede realizar la comprobaci\u00f3n de gram\u00e1tica correcta." }, {MsgKey.ER_WF_INVALID_CHARACTER, "El nodo ''{0}'' contiene caracteres XML no v\u00e1lidos." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "Se ha encontrado un car\u00e1cter XML no v\u00e1lido (Unicode: 0x{0}) en el comentario." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "Se ha encontrado un car\u00e1cter XML no v\u00e1lido (Unicode: 0x{0}) en los datos de la instrucci\u00f3n de proceso." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "Se ha encontrado un car\u00e1cter XML no v\u00e1lido (Unicode: 0x{0}) en el contenido de CDATASection." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "Se ha encontrado un car\u00e1cter XML no v\u00e1lido (Unicode: 0x{0}) en el contenido de datos de caracteres del nodo." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "Se ha encontrado un car\u00e1cter o caracteres XML no v\u00e1lidos en el nodo {0} denominado ''{1}''." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "No se permite la serie \"--\" dentro de los comentarios." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "El valor del atributo \"{1}\" asociado a un tipo de elemento \"{0}\" no debe contener el car\u00e1cter ''''<''''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "No se permite la referencia de entidad no analizada \"&{0};\"." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "La referencia de entidad externa \"&{0};\" no est\u00e1 permitida en un valor de atributo." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "No se puede encontrar el prefijo \"{0}\" en el espacio de nombres \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "El nombre local del elemento \"{0}\" es null." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "El nombre local del atributo \"{0}\" es null." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "El texto de sustituci\u00f3n del nodo de entidad \"{0}\" contiene un nodo de elemento \"{1}\" con un prefijo no enlazado \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "El texto de sustituci\u00f3n del nodo de entidad \"{0}\" contiene un nodo de atributo \"{1}\" con un prefijo no enlazado \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SystemIDResolver.java0000644000175000017500000002252710721374031026304 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SystemIDResolver.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer.utils; import java.io.File; import javax.xml.transform.TransformerException; import org.apache.xml.serializer.utils.URI.MalformedURIException; /** * This class is used to resolve relative URIs and SystemID * strings into absolute URIs. * *

    This is a generic utility for resolving URIs, other than the * fact that it's declared to throw TransformerException. Please * see code comments for details on how resolution is performed.

    * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public final class SystemIDResolver { /** * Get an absolute URI from a given relative URI (local path). * *

    The relative URI is a local filesystem path. The path can be * absolute or relative. If it is a relative path, it is resolved relative * to the system property "user.dir" if it is available; if not (i.e. in an * Applet perhaps which throws SecurityException) then we just return the * relative path. The space and backslash characters are also replaced to * generate a good absolute URI.

    * * @param localPath The relative URI to resolve * * @return Resolved absolute URI */ public static String getAbsoluteURIFromRelative(String localPath) { if (localPath == null || localPath.length() == 0) return ""; // If the local path is a relative path, then it is resolved against // the "user.dir" system property. String absolutePath = localPath; if (!isAbsolutePath(localPath)) { try { absolutePath = getAbsolutePathFromRelativePath(localPath); } // user.dir not accessible from applet catch (SecurityException se) { return "file:" + localPath; } } String urlString; if (null != absolutePath) { if (absolutePath.startsWith(File.separator)) urlString = "file://" + absolutePath; else urlString = "file:///" + absolutePath; } else urlString = "file:" + localPath; return replaceChars(urlString); } /** * Return an absolute path from a relative path. * * @param relativePath A relative path * @return The absolute path */ private static String getAbsolutePathFromRelativePath(String relativePath) { return new File(relativePath).getAbsolutePath(); } /** * Return true if the systemId denotes an absolute URI . * * @param systemId The systemId string * @return true if the systemId is an an absolute URI */ public static boolean isAbsoluteURI(String systemId) { /** http://www.ietf.org/rfc/rfc2396.txt * Authors should be aware that a path segment which contains a colon * character cannot be used as the first segment of a relative URI path * (e.g., "this:that"), because it would be mistaken for a scheme name. **/ /** * %REVIEW% Can we assume here that systemId is a valid URI? * It looks like we cannot ( See discussion of this common problem in * Bugzilla Bug 22777 ). **/ //"fix" for Bugzilla Bug 22777 if(isWindowsAbsolutePath(systemId)){ return false; } final int fragmentIndex = systemId.indexOf('#'); final int queryIndex = systemId.indexOf('?'); final int slashIndex = systemId.indexOf('/'); final int colonIndex = systemId.indexOf(':'); //finding substring before '#', '?', and '/' int index = systemId.length() -1; if(fragmentIndex > 0) index = fragmentIndex; if((queryIndex > 0) && (queryIndex 0) && (slashIndex 0) && (colonIndex 2 && systemId.charAt(1) == ':' && Character.isLetter(systemId.charAt(0)) && (systemId.charAt(2) == '\\' || systemId.charAt(2) == '/')) return true; else return false; } /** * Replace spaces with "%20" and backslashes with forward slashes in * the input string to generate a well-formed URI string. * * @param str The input string * @return The string after conversion */ private static String replaceChars(String str) { StringBuffer buf = new StringBuffer(str); int length = buf.length(); for (int i = 0; i < length; i++) { char currentChar = buf.charAt(i); // Replace space with "%20" if (currentChar == ' ') { buf.setCharAt(i, '%'); buf.insert(i+1, "20"); length = length + 2; i = i + 2; } // Replace backslash with forward slash else if (currentChar == '\\') { buf.setCharAt(i, '/'); } } return buf.toString(); } /** * Take a SystemID string and try to turn it into a good absolute URI. * * @param systemId A URI string, which may be absolute or relative. * * @return The resolved absolute URI */ public static String getAbsoluteURI(String systemId) { String absoluteURI = systemId; if (isAbsoluteURI(systemId)) { // Only process the systemId if it starts with "file:". if (systemId.startsWith("file:")) { String str = systemId.substring(5); // Resolve the absolute path if the systemId starts with "file:///" // or "file:/". Don't do anything if it only starts with "file://". if (str != null && str.startsWith("/")) { if (str.startsWith("///") || !str.startsWith("//")) { // A Windows path containing a drive letter can be relative. // A Unix path starting with "file:/" is always absolute. int secondColonIndex = systemId.indexOf(':', 5); if (secondColonIndex > 0) { String localPath = systemId.substring(secondColonIndex-1); try { if (!isAbsolutePath(localPath)) absoluteURI = systemId.substring(0, secondColonIndex-1) + getAbsolutePathFromRelativePath(localPath); } catch (SecurityException se) { return systemId; } } } } else { return getAbsoluteURIFromRelative(systemId.substring(5)); } return replaceChars(absoluteURI); } else return systemId; } else return getAbsoluteURIFromRelative(systemId); } /** * Take a SystemID string and try to turn it into a good absolute URI. * * @param urlString SystemID string * @param base The URI string used as the base for resolving the systemID * * @return The resolved absolute URI * @throws TransformerException thrown if the string can't be turned into a URI. */ public static String getAbsoluteURI(String urlString, String base) throws TransformerException { if (base == null) return getAbsoluteURI(urlString); String absoluteBase = getAbsoluteURI(base); URI uri = null; try { URI baseURI = new URI(absoluteBase); uri = new URI(baseURI, urlString); } catch (MalformedURIException mue) { throw new TransformerException(mue); } return replaceChars(uri.toString()); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_cs.java0000644000175000017500000003211710721374033027345 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_cs.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_cs extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "Kl\u00ed\u010d zpr\u00e1vy ''{0}'' nen\u00ed obsa\u017een ve t\u0159\u00edd\u011b zpr\u00e1v ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Form\u00e1t zpr\u00e1vy ''{0}'' ve t\u0159\u00edd\u011b zpr\u00e1v ''{1}'' selhal. " }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "T\u0159\u00edda serializace ''{0}'' neimplementuje obslu\u017en\u00fd program org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Nelze naj\u00edt zdroj [ {0} ].\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Nelze zav\u00e9st zdroj [ {0} ]: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Velikost vyrovn\u00e1vac\u00ed pam\u011bti <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Byla zji\u0161t\u011bna neplatn\u00e1 n\u00e1hrada UTF-16: {0} ?" }, { MsgKey.ER_OIERROR, "Chyba vstupu/v\u00fdstupu" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Nelze p\u0159idat atribut {0} po uzlech potomk\u016f ani p\u0159ed t\u00edm, ne\u017e je vytvo\u0159en prvek. Atribut bude ignorov\u00e1n." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "Obor n\u00e1zv\u016f pro p\u0159edponu ''{0}'' nebyl deklarov\u00e1n." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Atribut ''{0}'' se nach\u00e1z\u00ed vn\u011b prvku." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Deklarace oboru n\u00e1zv\u016f ''{0}''=''{1}'' se nach\u00e1z\u00ed vn\u011b prvku." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Nelze zav\u00e9st prost\u0159edek ''{0}'' (zkontrolujte prom\u011bnnou CLASSPATH) - budou pou\u017eity pouze v\u00fdchoz\u00ed prost\u0159edky" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Byl proveden pokus o v\u00fdstup znaku s celo\u010d\u00edselnou hodnotou {0}, kter\u00e1 nen\u00ed reprezentov\u00e1na v ur\u010den\u00e9m v\u00fdstupn\u00edm k\u00f3dov\u00e1n\u00ed {1}." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Nelze na\u010d\u00edst soubor vlastnost\u00ed ''{0}'' pro v\u00fdstupn\u00ed metodu ''{1}'' (zkontrolujte prom\u011bnnou CLASSPATH)." }, { MsgKey.ER_INVALID_PORT, "Neplatn\u00e9 \u010d\u00edslo portu." }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "M\u00e1-li hostitel hodnotu null, nelze nastavit port." }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Adresa hostitele m\u00e1 nespr\u00e1vn\u00fd form\u00e1t." }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Sch\u00e9ma nevyhovuje." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Nelze nastavit sch\u00e9ma \u0159et\u011bzce s hodnotou null." }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Cesta obsahuje neplatnou escape sekvenci" }, { MsgKey.ER_PATH_INVALID_CHAR, "Cesta obsahuje neplatn\u00fd znak: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment obsahuje neplatn\u00fd znak." }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "M\u00e1-li cesta hodnotu null, nelze nastavit fragment." }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment lze nastavit jen u generick\u00e9ho URI." }, { MsgKey.ER_NO_SCHEME_IN_URI, "V URI nebylo nalezeno \u017e\u00e1dn\u00e9 sch\u00e9ma" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "URI nelze inicializovat s pr\u00e1zdn\u00fdmi parametry." }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment nelze ur\u010dit z\u00e1rove\u0148 v cest\u011b i ve fragmentu." }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "V \u0159et\u011bzci cesty a dotazu nelze zadat \u0159et\u011bzec dotazu." }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Nen\u00ed-li ur\u010den hostitel, nelze zadat port." }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Nen\u00ed-li ur\u010den hostitel, nelze zadat \u00fadaje o u\u017eivateli." }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Varov\u00e1n\u00ed: Je po\u017eadov\u00e1na verze ''{0}'' v\u00fdstupn\u00edho dokumentu. Tato verze form\u00e1tu XML nen\u00ed podporov\u00e1na. Bude pou\u017eita verze ''1.0'' v\u00fdstupn\u00edho dokumentu. " }, { MsgKey.ER_SCHEME_REQUIRED, "Je vy\u017eadov\u00e1no sch\u00e9ma!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "Objekt vlastnost\u00ed p\u0159edan\u00fd faktorii SerializerFactory neobsahuje vlastnost ''{0}''. " }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Varov\u00e1n\u00ed: K\u00f3dov\u00e1n\u00ed ''{0}'' nen\u00ed v b\u011bhov\u00e9m prost\u0159ed\u00ed Java podporov\u00e1no." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Parametr ''{0}'' nebyl rozpozn\u00e1n."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Parametr ''{0}'' byl rozpozn\u00e1n, ale nelze nastavit po\u017eadovanou hodnotu."}, {MsgKey.ER_STRING_TOO_LONG, "V\u00fdsledn\u00fd \u0159et\u011bzec je p\u0159\u00edli\u0161 dlouh\u00fd pro \u0159et\u011bzec DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Typ hodnoty pro tento n\u00e1zev parametru nen\u00ed kompatibiln\u00ed s o\u010dek\u00e1van\u00fdm typem hodnoty."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "C\u00edlov\u00e9 um\u00edst\u011bn\u00ed v\u00fdstupu pro data ur\u010den\u00e1 k z\u00e1pisu je rovno hodnot\u011b Null. "}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Bylo nalezeno nepodporovan\u00e9 k\u00f3dov\u00e1n\u00ed."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Nelze prov\u00e9st serializaci uzlu. "}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "Sekce CDATA obsahuje jednu nebo v\u00edce ukon\u010dovac\u00edch zna\u010dek ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Nelze vytvo\u0159it instanci modulu pro kontrolu spr\u00e1vn\u00e9ho utvo\u0159en\u00ed. Parametr spr\u00e1vn\u00e9ho utvo\u0159en\u00ed byl nastaven na hodnotu true, nepoda\u0159ilo se v\u0161ak zkontrolovat spr\u00e1vnost utvo\u0159en\u00ed. " }, {MsgKey.ER_WF_INVALID_CHARACTER, "Uzel ''{0}'' obsahuje neplatn\u00e9 znaky XML. " }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "V pozn\u00e1mce byl zji\u0161t\u011bn neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "V datech instrukce zpracov\u00e1n\u00ed byl nalezen neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "V odd\u00edlu CDATASection byl nalezen neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "V obsahu znakov\u00fdch dat uzlu byl nalezen neplatn\u00fd znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "V objektu {0} s n\u00e1zvem ''{1}'' byl nalezen neplatn\u00fd znak XML. " }, { MsgKey.ER_WF_DASH_IN_COMMENT, "V pozn\u00e1mk\u00e1ch nen\u00ed povolen \u0159et\u011bzec \"--\"." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "Hodnota atributu \"{1}\" souvisej\u00edc\u00edho s typem prvku \"{0}\" nesm\u00ed obsahovat znak ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Odkaz na neanalyzovanou entitu \"&{0};\" nen\u00ed povolen." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "Extern\u00ed odkaz na entitu \"&{0};\" nen\u00ed v hodnot\u011b atributu povolen." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "P\u0159edpona \"{0}\" nesm\u00ed b\u00fdt v\u00e1zan\u00e1 k oboru n\u00e1zv\u016f \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Lok\u00e1ln\u00ed n\u00e1zev prvku \"{0}\" m\u00e1 hodnotu Null. " }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Lok\u00e1ln\u00ed n\u00e1zev atributu \"{0}\" m\u00e1 hodnotu Null. " }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "Nov\u00fd text uzlu entity \"{0}\" obsahuje uzel prvku \"{1}\" s nesv\u00e1zanou p\u0159edponou \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "Nov\u00fd text uzlu entity \"{0}\" obsahuje uzel atributu \"{1}\" s nesv\u00e1zanou p\u0159edponou \"{2}\". " }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/utils/SerializerMessages_sl.java0000644000175000017500000003031010721374032027346 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerMessages_sl.java,v 1.7 2005/03/07 20:34:36 minchau Exp $ */ package org.apache.xml.serializer.utils; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * An instance of this class is a ListResourceBundle that * has the required getContents() method that returns * an array of message-key/message associations. *

    * The message keys are defined in {@link MsgKey}. The * messages that those keys map to are defined here. *

    * The messages in the English version are intended to be * translated. * * This class is not a public API, it is only public because it is * used in org.apache.xml.serializer. * * @xsl.usage internal */ public class SerializerMessages_sl extends ListResourceBundle { /* * This file contains error and warning messages related to * Serializer Error Handling. * * General notes to translators: * 1) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 2) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 3) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * */ /** The lookup table for error messages. */ public Object[][] getContents() { Object[][] contents = new Object[][] { { MsgKey.BAD_MSGKEY, "Klju\u010d sporo\u010dila ''{0}'' ni v rezredu sporo\u010dila ''{1}''" }, { MsgKey.BAD_MSGFORMAT, "Format sporo\u010dila ''{0}'' v razredu sporo\u010dila ''{1}'' je spodletel." }, { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, "Razred serializerja ''{0}'' ne izvede org.xml.sax.ContentHandler." }, { MsgKey.ER_RESOURCE_COULD_NOT_FIND, "Vira [ {0} ] ni mogo\u010de najti.\n {1}" }, { MsgKey.ER_RESOURCE_COULD_NOT_LOAD, "Sredstva [ {0} ] ni bilo mogo\u010de nalo\u017eiti: {1} \n {2} \t {3}" }, { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO, "Velikost medpomnilnika <=0" }, { MsgKey.ER_INVALID_UTF16_SURROGATE, "Zaznan neveljaven nadomestek UTF-16: {0} ?" }, { MsgKey.ER_OIERROR, "Napaka V/I" }, { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION, "Atributa {0} ne morem dodati za podrejenimi vozli\u0161\u010di ali pred izdelavo elementa. Atribut bo prezrt." }, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ { MsgKey.ER_NAMESPACE_PREFIX, "Imenski prostor za predpono ''{0}'' ni bil naveden." }, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ { MsgKey.ER_STRAY_ATTRIBUTE, "Atribut ''{0}'' je zunaj elementa." }, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ { MsgKey.ER_STRAY_NAMESPACE, "Deklaracija imenskega prostora ''{0}''=''{1}'' je zunaj elementa." }, { MsgKey.ER_COULD_NOT_LOAD_RESOURCE, "Ni bilo mogo\u010de nalo\u017eiti ''{0}'' (preverite CLASSPATH), trenutno se uporabljajo samo privzete vrednosti" }, { MsgKey.ER_ILLEGAL_CHARACTER, "Poskus izpisa znaka integralne vrednosti {0}, ki v navedenem izhodnem kodiranju {1} ni zastopan." }, { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY, "Datoteke z lastnostmi ''{0}'' ni bilo mogo\u010de nalo\u017eiti za izhodno metodo ''{1}'' (preverite CLASSPATH)" }, { MsgKey.ER_INVALID_PORT, "Neveljavna \u0161tevilka vrat" }, { MsgKey.ER_PORT_WHEN_HOST_NULL, "Ko je gostitelj NULL, nastavitev vrat ni mogo\u010da" }, { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED, "Naslov gostitelja ni pravilno oblikovan" }, { MsgKey.ER_SCHEME_NOT_CONFORMANT, "Shema ni skladna." }, { MsgKey.ER_SCHEME_FROM_NULL_STRING, "Ni mogo\u010de nastaviti sheme iz niza NULL" }, { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Pot vsebuje neveljavno zaporedje za izhod" }, { MsgKey.ER_PATH_INVALID_CHAR, "Pot vsebuje neveljaven znak: {0}" }, { MsgKey.ER_FRAG_INVALID_CHAR, "Fragment vsebuje neveljaven znak" }, { MsgKey.ER_FRAG_WHEN_PATH_NULL, "Ko je pot NULL, nastavitev fragmenta ni mogo\u010da" }, { MsgKey.ER_FRAG_FOR_GENERIC_URI, "Fragment je lahko nastavljen samo za splo\u0161ni URI" }, { MsgKey.ER_NO_SCHEME_IN_URI, "Ne najdem sheme v URI" }, { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS, "Ni mogo\u010de inicializirati URI-ja s praznimi parametri" }, { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment ne more biti hkrati naveden v poti in v fragmentu" }, { MsgKey.ER_NO_QUERY_STRING_IN_PATH, "Poizvedbeni niz ne more biti naveden v nizu poti in poizvedbenem nizu" }, { MsgKey.ER_NO_PORT_IF_NO_HOST, "Vrata ne morejo biti navedena, \u010de ni naveden gostitelj" }, { MsgKey.ER_NO_USERINFO_IF_NO_HOST, "Informacije o uporabniku ne morejo biti navedene, \u010de ni naveden gostitelj" }, { MsgKey.ER_XML_VERSION_NOT_SUPPORTED, "Opozorilo: Zahtevana razli\u010dica izhodnega dokumenta je ''{0}''. Ta razli\u010dica XML ni podprta. Razli\u010dica izhodnega dokumenta bo ''1.0''." }, { MsgKey.ER_SCHEME_REQUIRED, "Zahtevana je shema!" }, /* * Note to translators: The words 'Properties' and * 'SerializerFactory' in this message are Java class names * and should not be translated. */ { MsgKey.ER_FACTORY_PROPERTY_MISSING, "Predmet Properties (lastnosti), ki je prene\u0161en v SerializerFactory, nima lastnosti ''{0}''." }, { MsgKey.ER_ENCODING_NOT_SUPPORTED, "Opozorilo: Izvajalno okolje Java ne podpira kodiranja ''{0}''." }, {MsgKey.ER_FEATURE_NOT_FOUND, "Parameter ''{0}'' ni prepoznan."}, {MsgKey.ER_FEATURE_NOT_SUPPORTED, "Parameter ''{0}'' je prepoznan, vendar pa zahtevane vrednosti ni mogo\u010de nastaviti."}, {MsgKey.ER_STRING_TOO_LONG, "Nastali niz je predolg za DOMString: ''{0}''."}, {MsgKey.ER_TYPE_MISMATCH_ERR, "Tip vrednosti za to ime parametra je nezdru\u017eljiv s pri\u010dakovanim tipom vrednosti."}, {MsgKey.ER_NO_OUTPUT_SPECIFIED, "Izhodno mesto za vpisovanje podatkov je bilo ni\u010d."}, {MsgKey.ER_UNSUPPORTED_ENCODING, "Odkrito je nepodprto kodiranje."}, {MsgKey.ER_UNABLE_TO_SERIALIZE_NODE, "Vozli\u0161\u010da ni mogo\u010de serializirati."}, {MsgKey.ER_CDATA_SECTIONS_SPLIT, "Odsek CDATA vsebuje enega ali ve\u010d ozna\u010devalnikov prekinitve ']]>'."}, {MsgKey.ER_WARNING_WF_NOT_CHECKED, "Primerka preverjevalnika Well-Formedness ni bilo mogo\u010de ustvariti. Parameter well-formed je bil nastavljen na True, ampak ni mogo\u010de preveriti well-formedness." }, {MsgKey.ER_WF_INVALID_CHARACTER, "Vozli\u0161\u010de ''{0}'' vsebuje neveljavne znake XML." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, "V komentarju je bil najden neveljaven XML znak (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, "V podatkih navodila za obdelavo je bil najden neveljaven znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, "V vsebini odseka CDATASection je bil najden neveljaven znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, "V podatkovni vsebini znaka vozli\u0161\u010da je bil najden neveljaven znak XML (Unicode: 0x{0})." }, { MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, "V vozli\u0161\u010du {0} z imenom ''{1}'' je bil najden neveljaven znak XML." }, { MsgKey.ER_WF_DASH_IN_COMMENT, "Niz \"--\" ni dovoljen v komentarjih." }, {MsgKey.ER_WF_LT_IN_ATTVAL, "Vrednost atributa \"{1}\", ki je povezan s tipom elementa \"{0}\", ne sme vsebovati znaka ''<''." }, {MsgKey.ER_WF_REF_TO_UNPARSED_ENT, "Neraz\u010dlenjeni sklic entitete \"&{0};\" ni dovoljen." }, {MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, "Zunanji sklic entitete \"&{0};\" ni dovoljen v vrednosti atributa." }, {MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, "Predpona \"{0}\" ne more biti povezana z imenskim prostorom \"{1}\"." }, {MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, "Lokalno ime elementa \"{0}\" je ni\u010d." }, {MsgKey.ER_NULL_LOCAL_ATTR_NAME, "Lokalno ime atributa \"{0}\" je ni\u010d." }, { MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, "Besedilo za zamenjavo za vozli\u0161\u010de entitete \"{0}\" vsebuje vozli\u0161\u010de elementa \"{1}\" z nevezano predpono \"{2}\"." }, { MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, "Besedilo za zamenjavo za vozli\u0161\u010de entitete \"{0}\" vsebuje vozli\u0161\u010de atributa \"{1}\" z nevezano predpono \"{2}\"." }, }; return contents; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/DOMSerializer.java0000644000175000017500000000463610721374033024375 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMSerializer.java 475350 2006-11-15 18:39:15Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import org.w3c.dom.Node; /** * Interface for a DOM serializer implementation. *

    * The DOMSerializer is a facet of a serializer and is obtained from the * asDOMSerializer() method of the ({@link Serializer}) interface. * A serializer may or may not support a DOM serializer, if it does not then the * return value from asDOMSerializer() is null. *

    * Example: *

     * // Create a document to be serialized
     * org.w3c.dom.Document doc = ...;
     * 
     * // Create a Serializer that will be used
     * // to serialize the document  
     * org.apache.xml.serializer.Serializer ser = ...;
     *
     * // Set the Writer to write output to, and 
     * // serialize the DOM using that Serializer
     * java.io.StringWriter sw = new java.io.StringWriter();
     * ser.setWriter(sw);
     * DOMSerialzier dser = ser.asDOMSerializer();
     * dser.serialize(doc);
     * 
     * // Write out the serialized XML in the String.
     * System.out.println(sw.toString());
     * 
    * * @see OutputPropertiesFactory * @see SerializerFactory * @see Serializer * * @xsl.usage general * */ public interface DOMSerializer { /** * Serializes the DOM node. Throws an exception only if an I/O * exception occured while serializing. * * This interface is a public API. * * @param node the DOM node to serialize * @throws IOException if an I/O exception occured while serializing */ public void serialize(Node node) throws IOException; } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToUnknownStream.java0000644000175000017500000011566210721374032025043 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToUnknownStream.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import java.util.Vector; import javax.xml.transform.SourceLocator; import javax.xml.transform.Transformer; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; /** *This class wraps another SerializationHandler. The wrapped object will either * handler XML or HTML, which is not known until a little later when the first XML * tag is seen. If the first tag is then the wrapped object is an HTML * handler, otherwise it is an XML handler. * * This class effectively caches the first few calls to it then passes them * on to the wrapped handler (once it exists). After that subsequent calls a * simply passed directly to the wrapped handler. * * The user of this class doesn't know if the output is ultimatley XML or HTML. * * This class is not a public API, it is public because it is used within Xalan. * @xsl.usage internal */ public final class ToUnknownStream extends SerializerBase { /** * The wrapped handler, initially XML but possibly switched to HTML */ private SerializationHandler m_handler; /** * A String with no characters */ private static final String EMPTYSTRING = ""; /** * true if the underlying handler (XML or HTML) is fully initialized */ private boolean m_wrapped_handler_not_initialized = false; /** * the prefix of the very first tag in the document */ private String m_firstElementPrefix; /** * the element name (including any prefix) of the very first tag in the document */ private String m_firstElementName; /** * the namespace URI associated with the first element */ private String m_firstElementURI; /** * the local name (no prefix) associated with the first element */ private String m_firstElementLocalName = null; /** * true if the first tag has been emitted to the wrapped handler */ private boolean m_firstTagNotEmitted = true; /** * A collection of namespace URI's (only for first element). * _namespacePrefix has the matching prefix for these URI's */ private Vector m_namespaceURI = null; /** * A collection of namespace Prefix (only for first element) * _namespaceURI has the matching URIs for these prefix' */ private Vector m_namespacePrefix = null; /** * true if startDocument() was called before the underlying handler * was initialized */ private boolean m_needToCallStartDocument = false; /** * true if setVersion() was called before the underlying handler * was initialized */ private boolean m_setVersion_called = false; /** * true if setDoctypeSystem() was called before the underlying handler * was initialized */ private boolean m_setDoctypeSystem_called = false; /** * true if setDoctypePublic() was called before the underlying handler * was initialized */ private boolean m_setDoctypePublic_called = false; /** * true if setMediaType() was called before the underlying handler * was initialized */ private boolean m_setMediaType_called = false; /** * Default constructor. * Initially this object wraps an XML Stream object, so _handler is never null. * That may change later to an HTML Stream object. */ public ToUnknownStream() { m_handler = new ToXMLStream(); } /** * @see Serializer#asContentHandler() * @return the wrapped XML or HTML handler */ public ContentHandler asContentHandler() throws IOException { /* don't return the real handler ( m_handler ) because * that would expose the real handler to the outside. * Keep m_handler private so it can be internally swapped * to an HTML handler. */ return this; } /** * @see SerializationHandler#close() */ public void close() { m_handler.close(); } /** * @see Serializer#getOutputFormat() * @return the properties of the underlying handler */ public Properties getOutputFormat() { return m_handler.getOutputFormat(); } /** * @see Serializer#getOutputStream() * @return the OutputStream of the underlying XML or HTML handler */ public OutputStream getOutputStream() { return m_handler.getOutputStream(); } /** * @see Serializer#getWriter() * @return the Writer of the underlying XML or HTML handler */ public Writer getWriter() { return m_handler.getWriter(); } /** * passes the call on to the underlying HTML or XML handler * @see Serializer#reset() * @return ??? */ public boolean reset() { return m_handler.reset(); } /** * Converts the DOM node to output * @param node the DOM node to transform to output * @see DOMSerializer#serialize(Node) * */ public void serialize(Node node) throws IOException { if (m_firstTagNotEmitted) { flush(); } m_handler.serialize(node); } /** * @see SerializationHandler#setEscaping(boolean) */ public boolean setEscaping(boolean escape) throws SAXException { return m_handler.setEscaping(escape); } /** * Set the properties of the handler * @param format the output properties to set * @see Serializer#setOutputFormat(Properties) */ public void setOutputFormat(Properties format) { m_handler.setOutputFormat(format); } /** * Sets the output stream to write to * @param output the OutputStream to write to * @see Serializer#setOutputStream(OutputStream) */ public void setOutputStream(OutputStream output) { m_handler.setOutputStream(output); } /** * Sets the writer to write to * @param writer the writer to write to * @see Serializer#setWriter(Writer) */ public void setWriter(Writer writer) { m_handler.setWriter(writer); } /** * Adds an attribute to the currenly open tag * @param uri the URI of a namespace * @param localName the attribute name, without prefix * @param rawName the attribute name, with prefix (if any) * @param type the type of the attribute, typically "CDATA" * @param value the value of the parameter * @param XSLAttribute true if this attribute is coming from an xsl:attribute element * @see ExtendedContentHandler#addAttribute(String, String, String, String, String) */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.addAttribute(uri, localName, rawName, type, value, XSLAttribute); } /** * Adds an attribute to the currenly open tag * @param rawName the attribute name, with prefix (if any) * @param value the value of the parameter * @see ExtendedContentHandler#addAttribute(String, String) */ public void addAttribute(String rawName, String value) { if (m_firstTagNotEmitted) { flush(); } m_handler.addAttribute(rawName, value); } /** * Adds a unique attribute to the currenly open tag */ public void addUniqueAttribute(String rawName, String value, int flags) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.addUniqueAttribute(rawName, value, flags); } /** * Converts the String to a character array and calls the SAX method * characters(char[],int,int); * * @see ExtendedContentHandler#characters(String) */ public void characters(String chars) throws SAXException { final int length = chars.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } chars.getChars(0, length, m_charsBuff, 0); this.characters(m_charsBuff, 0, length); } /** * Pass the call on to the underlying handler * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elementName) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.endElement(elementName); } /** * @see org.xml.sax.ContentHandler#startPrefixMapping(String, String) * @param prefix The prefix that maps to the URI * @param uri The URI for the namespace */ public void startPrefixMapping(String prefix, String uri) throws SAXException { this.startPrefixMapping(prefix,uri, true); } /** * This method is used when a prefix/uri namespace mapping * is indicated after the element was started with a * startElement() and before and endElement(). * startPrefixMapping(prefix,uri) would be used before the * startElement() call. * @param uri the URI of the namespace * @param prefix the prefix associated with the given URI. * * @see ExtendedContentHandler#namespaceAfterStartElement(String, String) */ public void namespaceAfterStartElement(String prefix, String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_firstTagNotEmitted && m_firstElementURI == null && m_firstElementName != null) { String prefix1 = getPrefixPart(m_firstElementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_firstElementURI = uri; } } startPrefixMapping(prefix,uri, false); } public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException { boolean pushed = false; if (m_firstTagNotEmitted) { if (m_firstElementName != null && shouldFlush) { /* we've already seen a startElement, and this is a prefix mapping * for the up coming element, so flush the old element * then send this event on its way. */ flush(); pushed = m_handler.startPrefixMapping(prefix, uri, shouldFlush); } else { if (m_namespacePrefix == null) { m_namespacePrefix = new Vector(); m_namespaceURI = new Vector(); } m_namespacePrefix.addElement(prefix); m_namespaceURI.addElement(uri); if (m_firstElementURI == null) { if (prefix.equals(m_firstElementPrefix)) m_firstElementURI = uri; } } } else { pushed = m_handler.startPrefixMapping(prefix, uri, shouldFlush); } return pushed; } /** * This method cannot be cached because default is different in * HTML and XML (we need more than a boolean). */ public void setVersion(String version) { m_handler.setVersion(version); // Cache call to setVersion() // super.setVersion(version); m_setVersion_called = true; } /** * @see org.xml.sax.ContentHandler#startDocument() */ public void startDocument() throws SAXException { m_needToCallStartDocument = true; } public void startElement(String qName) throws SAXException { this.startElement(null, null, qName, null); } public void startElement(String namespaceURI, String localName, String qName) throws SAXException { this.startElement(namespaceURI, localName, qName, null); } public void startElement( String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException { /* we are notified of the start of an element */ if (m_firstTagNotEmitted) { /* we have not yet sent the first element on its way */ if (m_firstElementName != null) { /* this is not the first element, but a later one. * But we have the old element pending, so flush it out, * then send this one on its way. */ flush(); m_handler.startElement(namespaceURI, localName, elementName, atts); } else { /* this is the very first element that we have seen, * so save it for flushing later. We may yet get to know its * URI due to added attributes. */ m_wrapped_handler_not_initialized = true; m_firstElementName = elementName; // null if not known m_firstElementPrefix = getPrefixPartUnknown(elementName); // null if not known m_firstElementURI = namespaceURI; // null if not known m_firstElementLocalName = localName; if (m_tracer != null) firePseudoElement(elementName); /* we don't want to call our own addAttributes, which * merely delegates to the wrapped handler, but we want to * add these attributes to m_attributes. So me must call super. * addAttributes() In this case m_attributes is only used for the * first element, after that this class totally delegates to the * wrapped handler which is either XML or HTML. */ if (atts != null) super.addAttributes(atts); // if there are attributes, then lets make the flush() // call the startElement on the handler and send the // attributes on their way. if (atts != null) flush(); } } else { // this is not the first element, but a later one, so just // send it on its way. m_handler.startElement(namespaceURI, localName, elementName, atts); } } /** * Pass the call on to the underlying handler * @see ExtendedLexicalHandler#comment(String) */ public void comment(String comment) throws SAXException { if (m_firstTagNotEmitted && m_firstElementName != null) { emitFirstTag(); } else if (m_needToCallStartDocument) { m_handler.startDocument(); m_needToCallStartDocument = false; } m_handler.comment(comment); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getDoctypePublic() */ public String getDoctypePublic() { return m_handler.getDoctypePublic(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getDoctypeSystem() */ public String getDoctypeSystem() { return m_handler.getDoctypeSystem(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getEncoding() */ public String getEncoding() { return m_handler.getEncoding(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getIndent() */ public boolean getIndent() { return m_handler.getIndent(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getIndentAmount() */ public int getIndentAmount() { return m_handler.getIndentAmount(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getMediaType() */ public String getMediaType() { return m_handler.getMediaType(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getOmitXMLDeclaration() */ public boolean getOmitXMLDeclaration() { return m_handler.getOmitXMLDeclaration(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getStandalone() */ public String getStandalone() { return m_handler.getStandalone(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getVersion() */ public String getVersion() { return m_handler.getVersion(); } /** * @see XSLOutputAttributes#setDoctype(String, String) */ public void setDoctype(String system, String pub) { m_handler.setDoctypePublic(pub); m_handler.setDoctypeSystem(system); } /** * Set the doctype in the underlying XML handler. Remember that this method * was called, just in case we need to transfer this doctype to an HTML handler * @param doctype the public doctype to set * @see XSLOutputAttributes#setDoctypePublic(String) */ public void setDoctypePublic(String doctype) { m_handler.setDoctypePublic(doctype); m_setDoctypePublic_called = true; } /** * Set the doctype in the underlying XML handler. Remember that this method * was called, just in case we need to transfer this doctype to an HTML handler * @param doctype the system doctype to set * @see XSLOutputAttributes#setDoctypeSystem(String) */ public void setDoctypeSystem(String doctype) { m_handler.setDoctypeSystem(doctype); m_setDoctypeSystem_called = true; } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setEncoding(String) */ public void setEncoding(String encoding) { m_handler.setEncoding(encoding); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setIndent(boolean) */ public void setIndent(boolean indent) { m_handler.setIndent(indent); } /** * Pass the call on to the underlying handler */ public void setIndentAmount(int value) { m_handler.setIndentAmount(value); } /** * @see XSLOutputAttributes#setMediaType(String) */ public void setMediaType(String mediaType) { m_handler.setMediaType(mediaType); m_setMediaType_called = true; } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setOmitXMLDeclaration(boolean) */ public void setOmitXMLDeclaration(boolean b) { m_handler.setOmitXMLDeclaration(b); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setStandalone(String) */ public void setStandalone(String standalone) { m_handler.setStandalone(standalone); } /** * @see XSLOutputAttributes#setVersion(String) */ /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String) */ public void attributeDecl( String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException { m_handler.attributeDecl(arg0, arg1, arg2, arg3, arg4); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#elementDecl(String, String) */ public void elementDecl(String arg0, String arg1) throws SAXException { if (m_firstTagNotEmitted) { emitFirstTag(); } m_handler.elementDecl(arg0, arg1); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String) */ public void externalEntityDecl( String name, String publicId, String systemId) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.externalEntityDecl(name, publicId, systemId); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(String, String) */ public void internalEntityDecl(String arg0, String arg1) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.internalEntityDecl(arg0, arg1); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ public void characters(char[] characters, int offset, int length) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.characters(characters, offset, length); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#endDocument() */ public void endDocument() throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.endDocument(); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if (m_firstTagNotEmitted) { flush(); if (namespaceURI == null && m_firstElementURI != null) namespaceURI = m_firstElementURI; if (localName == null && m_firstElementLocalName != null) localName = m_firstElementLocalName; } m_handler.endElement(namespaceURI, localName, qName); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String prefix) throws SAXException { m_handler.endPrefixMapping(prefix); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.ignorableWhitespace(ch, start, length); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.processingInstruction(target, data); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator locator) { m_handler.setDocumentLocator(locator); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#skippedEntity(String) */ public void skippedEntity(String name) throws SAXException { m_handler.skippedEntity(name); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int) */ public void comment(char[] ch, int start, int length) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.comment(ch, start, length); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { m_handler.endCDATA(); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#endDTD() */ public void endDTD() throws SAXException { m_handler.endDTD(); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#endEntity(String) */ public void endEntity(String name) throws SAXException { if (m_firstTagNotEmitted) { emitFirstTag(); } m_handler.endEntity(name); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { m_handler.startCDATA(); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#startDTD(String, String, String) */ public void startDTD(String name, String publicId, String systemId) throws SAXException { m_handler.startDTD(name, publicId, systemId); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#startEntity(String) */ public void startEntity(String name) throws SAXException { m_handler.startEntity(name); } /** * Initialize the wrapped output stream (XML or HTML). * If the stream handler should be HTML, then replace the XML handler with * an HTML handler. After than send the starting method calls that were cached * to the wrapped handler. * */ private void initStreamOutput() throws SAXException { // Try to rule out if this is an not to be an HTML document based on prefix boolean firstElementIsHTML = isFirstElemHTML(); if (firstElementIsHTML) { // create an HTML output handler, and initialize it // keep a reference to the old handler, ... it will soon be gone SerializationHandler oldHandler = m_handler; /* We have to make sure we get an output properties with the proper * defaults for the HTML method. The easiest way to do this is to * have the OutputProperties class do it. */ Properties htmlProperties = OutputPropertiesFactory.getDefaultMethodProperties(Method.HTML); Serializer serializer = SerializerFactory.getSerializer(htmlProperties); // The factory should be returning a ToStream // Don't know what to do if it doesn't // i.e. the user has over-ridden the content-handler property // for html m_handler = (SerializationHandler) serializer; //m_handler = new ToHTMLStream(); Writer writer = oldHandler.getWriter(); if (null != writer) m_handler.setWriter(writer); else { OutputStream os = oldHandler.getOutputStream(); if (null != os) m_handler.setOutputStream(os); } // need to copy things from the old handler to the new one here // if (_setVersion_called) // { m_handler.setVersion(oldHandler.getVersion()); // } // if (_setDoctypeSystem_called) // { m_handler.setDoctypeSystem(oldHandler.getDoctypeSystem()); // } // if (_setDoctypePublic_called) // { m_handler.setDoctypePublic(oldHandler.getDoctypePublic()); // } // if (_setMediaType_called) // { m_handler.setMediaType(oldHandler.getMediaType()); // } m_handler.setTransformer(oldHandler.getTransformer()); } /* Now that we have a real wrapped handler (XML or HTML) lets * pass any cached calls to it */ // Call startDocument() if necessary if (m_needToCallStartDocument) { m_handler.startDocument(); m_needToCallStartDocument = false; } // the wrapped handler is now fully initialized m_wrapped_handler_not_initialized = false; } private void emitFirstTag() throws SAXException { if (m_firstElementName != null) { if (m_wrapped_handler_not_initialized) { initStreamOutput(); m_wrapped_handler_not_initialized = false; } // Output first tag m_handler.startElement(m_firstElementURI, null, m_firstElementName, m_attributes); // don't need the collected attributes of the first element anymore. m_attributes = null; // Output namespaces of first tag if (m_namespacePrefix != null) { final int n = m_namespacePrefix.size(); for (int i = 0; i < n; i++) { final String prefix = (String) m_namespacePrefix.elementAt(i); final String uri = (String) m_namespaceURI.elementAt(i); m_handler.startPrefixMapping(prefix, uri, false); } m_namespacePrefix = null; m_namespaceURI = null; } m_firstTagNotEmitted = false; } } /** * Utility function for calls to local-name(). * * Don't want to override static function on SerializerBase * So added Unknown suffix to method name. */ private String getLocalNameUnknown(String value) { int idx = value.lastIndexOf(':'); if (idx >= 0) value = value.substring(idx + 1); idx = value.lastIndexOf('@'); if (idx >= 0) value = value.substring(idx + 1); return (value); } /** * Utility function to return prefix * * Don't want to override static function on SerializerBase * So added Unknown suffix to method name. */ private String getPrefixPartUnknown(String qname) { final int index = qname.indexOf(':'); return (index > 0) ? qname.substring(0, index) : EMPTYSTRING; } /** * Determine if the firts element in the document is or * This uses the cached first element name, first element prefix and the * cached namespaces from previous method calls * * @return true if the first element is an opening tag */ private boolean isFirstElemHTML() { boolean isHTML; // is the first tag html, not considering the prefix ? isHTML = getLocalNameUnknown(m_firstElementName).equalsIgnoreCase("html"); // Try to rule out if this is not to be an HTML document based on URI if (isHTML && m_firstElementURI != null && !EMPTYSTRING.equals(m_firstElementURI)) { // the element has a non-trivial namespace isHTML = false; } // Try to rule out if this is an not to be an HTML document based on prefix if (isHTML && m_namespacePrefix != null) { /* the first element has a name of "html", but lets check the prefix. * If the prefix points to a namespace with a URL that is not "" * then the doecument doesn't start with an tag, and isn't html */ final int max = m_namespacePrefix.size(); for (int i = 0; i < max; i++) { final String prefix = (String) m_namespacePrefix.elementAt(i); final String uri = (String) m_namespaceURI.elementAt(i); if (m_firstElementPrefix != null && m_firstElementPrefix.equals(prefix) && !EMPTYSTRING.equals(uri)) { // The first element has a prefix, so it can't be isHTML = false; break; } } } return isHTML; } /** * @see Serializer#asDOMSerializer() */ public DOMSerializer asDOMSerializer() throws IOException { return m_handler.asDOMSerializer(); } /** * @param URI_and_localNames Vector a list of pairs of URI/localName * specified in the cdata-section-elements attribute. * @see SerializationHandler#setCdataSectionElements(java.util.Vector) */ public void setCdataSectionElements(Vector URI_and_localNames) { m_handler.setCdataSectionElements(URI_and_localNames); } /** * @see ExtendedContentHandler#addAttributes(org.xml.sax.Attributes) */ public void addAttributes(Attributes atts) throws SAXException { m_handler.addAttributes(atts); } /** * Get the current namespace mappings. * Simply returns the mappings of the wrapped handler. * @see ExtendedContentHandler#getNamespaceMappings() */ public NamespaceMappings getNamespaceMappings() { NamespaceMappings mappings = null; if (m_handler != null) { mappings = m_handler.getNamespaceMappings(); } return mappings; } /** * @see SerializationHandler#flushPending() */ public void flushPending() throws SAXException { flush(); m_handler.flushPending(); } private void flush() { try { if (m_firstTagNotEmitted) { emitFirstTag(); } if (m_needToCallStartDocument) { m_handler.startDocument(); m_needToCallStartDocument = false; } } catch(SAXException e) { throw new RuntimeException(e.toString()); } } /** * @see ExtendedContentHandler#getPrefix */ public String getPrefix(String namespaceURI) { return m_handler.getPrefix(namespaceURI); } /** * @see ExtendedContentHandler#entityReference(java.lang.String) */ public void entityReference(String entityName) throws SAXException { m_handler.entityReference(entityName); } /** * @see ExtendedContentHandler#getNamespaceURI(java.lang.String, boolean) */ public String getNamespaceURI(String qname, boolean isElement) { return m_handler.getNamespaceURI(qname, isElement); } public String getNamespaceURIFromPrefix(String prefix) { return m_handler.getNamespaceURIFromPrefix(prefix); } public void setTransformer(Transformer t) { m_handler.setTransformer(t); if ((t instanceof SerializerTrace) && (((SerializerTrace) t).hasTraceListeners())) { m_tracer = (SerializerTrace) t; } else { m_tracer = null; } } public Transformer getTransformer() { return m_handler.getTransformer(); } /** * @see SerializationHandler#setContentHandler(org.xml.sax.ContentHandler) */ public void setContentHandler(ContentHandler ch) { m_handler.setContentHandler(ch); } /** * This method is used to set the source locator, which might be used to * generated an error message. * @param locator the source locator * * @see ExtendedContentHandler#setSourceLocator(javax.xml.transform.SourceLocator) */ public void setSourceLocator(SourceLocator locator) { m_handler.setSourceLocator(locator); } protected void firePseudoElement(String elementName) { if (m_tracer != null) { StringBuffer sb = new StringBuffer(); sb.append('<'); sb.append(elementName); // convert the StringBuffer to a char array and // emit the trace event that these characters "might" // be written char ch[] = sb.toString().toCharArray(); m_tracer.fireGenerateEvent( SerializerTrace.EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS, ch, 0, ch.length); } } /** * @see org.apache.xml.serializer.Serializer#asDOM3Serializer() */ public Object asDOM3Serializer() throws IOException { return m_handler.asDOM3Serializer(); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/OutputPropertyUtils.java0000644000175000017500000000563510721374033026012 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OutputPropertyUtils.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.util.Properties; /** * This class contains some static methods that act as helpers when parsing a * Java Property object. * * This class is not a public API. * It is only public because it is used outside of this package. * * @see java.util.Properties * @xsl.usage internal */ public final class OutputPropertyUtils { /** * Searches for the boolean property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * false if the property is not found, or if the value is other * than "yes". * * @param key the property key. * @param props the list of properties that will be searched. * @return the value in this property list as a boolean value, or false * if null or not "yes". */ public static boolean getBooleanProperty(String key, Properties props) { String s = props.getProperty(key); if (null == s || !s.equals("yes")) return false; else return true; } /** * Searches for the int property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * false if the property is not found, or if the value is other * than "yes". * * @param key the property key. * @param props the list of properties that will be searched. * @return the value in this property list as a int value, or 0 * if null or not a number. */ public static int getIntProperty(String key, Properties props) { String s = props.getProperty(key); if (null == s) return 0; else return Integer.parseInt(s); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToHTMLSAXHandler.java0000644000175000017500000005545510721374032024651 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToHTMLSAXHandler.java 475978 2006-11-16 23:31:20Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import javax.xml.transform.Result; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; /** * This class accepts SAX-like calls, then sends true SAX calls to a * wrapped SAX handler. There is optimization done knowing that the ultimate * output is HTML. * * This class is not a public API. * * @deprecated As of Xalan 2.7.1, replaced by the use of {@link ToXMLSAXHandler}. * * @xsl.usage internal */ public final class ToHTMLSAXHandler extends ToSAXHandler { /** * Handle document type declaration (for first element only) */ private boolean m_dtdHandled = false; /** * Keeps track of whether output escaping is currently enabled */ protected boolean m_escapeSetting = true; /** * Returns null. * @return null * @see Serializer#getOutputFormat() */ public Properties getOutputFormat() { return null; } /** * Reurns null * @return null * @see Serializer#getOutputStream() */ public OutputStream getOutputStream() { return null; } /** * Returns null * @return null * @see Serializer#getWriter() */ public Writer getWriter() { return null; } /** * Does nothing. * */ public void indent(int n) throws SAXException { } /** * Does nothing. * @see DOMSerializer#serialize(Node) */ public void serialize(Node node) throws IOException { return; } /** * Turns special character escaping on/off. * * * @param escape true if escaping is to be set on. * * @see SerializationHandler#setEscaping(boolean) */ public boolean setEscaping(boolean escape) throws SAXException { boolean oldEscapeSetting = m_escapeSetting; m_escapeSetting = escape; if (escape) { processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""); } return oldEscapeSetting; } /** * Does nothing * @param indent the number of spaces to indent per indentation level * (ignored) * @see SerializationHandler#setIndent(boolean) */ public void setIndent(boolean indent) { } /** * Does nothing. * @param format this parameter is not used * @see Serializer#setOutputFormat(Properties) */ public void setOutputFormat(Properties format) { } /** * Does nothing. * @param output this parameter is ignored * @see Serializer#setOutputStream(OutputStream) */ public void setOutputStream(OutputStream output) { } /** * Does nothing. * @param writer this parameter is ignored. * @see Serializer#setWriter(Writer) */ public void setWriter(Writer writer) { } /** * @see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String) */ /** * Does nothing. * * @param eName this parameter is ignored * @param aName this parameter is ignored * @param type this parameter is ignored * @param valueDefault this parameter is ignored * @param value this parameter is ignored * @see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String,String,String) */ public void attributeDecl( String eName, String aName, String type, String valueDefault, String value) throws SAXException { } /** * Does nothing. * @see org.xml.sax.ext.DeclHandler#elementDecl(String, String) */ public void elementDecl(String name, String model) throws SAXException { return; } /** * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String) */ public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException { } /** * Does nothing. * * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void internalEntityDecl(String name, String value) throws SAXException { } /** * Receive notification of the end of an element. * *

    The SAX parser will invoke this method at the end of every * element in the XML document; there will be a corresponding * startElement() event for every endElement() event (even when the * element is empty).

    * *

    If the element name has a namespace prefix, the prefix will * still be attached to the name.

    * * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified name (with prefix), or the * empty string if qualified names are not available. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ public void endElement(String uri, String localName, String qName) throws SAXException { flushPending(); m_saxHandler.endElement(uri, localName, qName); // time to fire off endElement event if (m_tracer != null) super.fireEndElem(qName); } /** * Does nothing. */ public void endPrefixMapping(String prefix) throws SAXException { } /** * Does nothing. * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { } /** * Receive notification of a processing instruction. * *

    The Parser will invoke this method once for each processing * instruction found: note that processing instructions may occur * before or after the main document element.

    * *

    A SAX parser should never report an XML declaration (XML 1.0, * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.

    * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException * @see org.xml.sax.ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { flushPending(); m_saxHandler.processingInstruction(target,data); // time to fire off processing instruction event if (m_tracer != null) super.fireEscapingEvent(target,data); } /** * Does nothing. * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator arg0) { // do nothing } /** * Does nothing. * @see org.xml.sax.ContentHandler#skippedEntity(String) */ public void skippedEntity(String arg0) throws SAXException { } /** * Receive notification of the beginning of an element, although this is a * SAX method additional namespace or attribute information can occur before * or after this call, that is associated with this element. * * * @param namespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The elements name. * @param atts The attributes attached to the element, if any. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.AttributeList * * @throws org.xml.sax.SAXException * * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) */ public void startElement( String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { flushPending(); super.startElement(namespaceURI, localName, qName, atts); m_saxHandler.startElement(namespaceURI, localName, qName, atts); m_elemContext.m_startTagOpen = false; } /** * Receive notification of a comment anywhere in the document. This callback * will be used for comments inside or outside the document element. * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws org.xml.sax.SAXException The application may raise an exception. * * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int) */ public void comment(char[] ch, int start, int length) throws SAXException { flushPending(); if (m_lexHandler != null) m_lexHandler.comment(ch, start, length); // time to fire off comment event if (m_tracer != null) super.fireCommentEvent(ch, start, length); return; } /** * Does nothing. * @see org.xml.sax.ext.LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { return; } /** * Does nothing. * @see org.xml.sax.ext.LexicalHandler#endDTD() */ public void endDTD() throws SAXException { } /** * Does nothing. * @see org.xml.sax.ext.LexicalHandler#startCDATA() */ public void startCDATA() throws SAXException { } /** * Does nothing. * @see org.xml.sax.ext.LexicalHandler#startEntity(String) */ public void startEntity(String arg0) throws SAXException { } /** * Receive notification of the end of a document. * *

    The SAX parser will invoke this method only once, and it will * be the last method invoked during the parse. The parser shall * not invoke this method until it has either abandoned parsing * (because of an unrecoverable error) or reached the end of * input.

    * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException * * */ public void endDocument() throws SAXException { flushPending(); // Close output document m_saxHandler.endDocument(); if (m_tracer != null) super.fireEndDoc(); } /** * This method is called when all the data needed for a call to the * SAX handler's startElement() method has been gathered. */ protected void closeStartTag() throws SAXException { m_elemContext.m_startTagOpen = false; // Now is time to send the startElement event m_saxHandler.startElement( EMPTYSTRING, m_elemContext.m_elementName, m_elemContext.m_elementName, m_attributes); m_attributes.clear(); } /** * Do nothing. * @see SerializationHandler#close() */ public void close() { return; } /** * Receive notification of character data. * * @param chars The string of characters to process. * * @throws org.xml.sax.SAXException * * @see ExtendedContentHandler#characters(String) */ public void characters(final String chars) throws SAXException { final int length = chars.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length * 2 + 1]; } chars.getChars(0, length, m_charsBuff, 0); this.characters(m_charsBuff, 0, length); } /** * A constructor * @param handler the wrapped SAX content handler * @param encoding the encoding of the output HTML document */ public ToHTMLSAXHandler(ContentHandler handler, String encoding) { super(handler,encoding); } /** * A constructor. * @param handler the wrapped SAX content handler * @param lex the wrapped lexical handler * @param encoding the encoding of the output HTML document */ public ToHTMLSAXHandler( ContentHandler handler, LexicalHandler lex, String encoding) { super(handler,lex,encoding); } /** * An element starts, but attributes are not fully known yet. * * @param elementNamespaceURI the URI of the namespace of the element * (optional) * @param elementLocalName the element name, but without prefix * (optional) * @param elementName the element name, with prefix, if any (required) * * @see ExtendedContentHandler#startElement(String) */ public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { super.startElement(elementNamespaceURI, elementLocalName, elementName); flushPending(); // Handle document type declaration (for first element only) if (!m_dtdHandled) { String doctypeSystem = getDoctypeSystem(); String doctypePublic = getDoctypePublic(); if ((doctypeSystem != null) || (doctypePublic != null)) { if (m_lexHandler != null) m_lexHandler.startDTD( elementName, doctypePublic, doctypeSystem); } m_dtdHandled = true; } m_elemContext = m_elemContext.push(elementNamespaceURI, elementLocalName, elementName); } /** * An element starts, but attributes are not fully known yet. * * @param elementName the element name, with prefix, if any * * @see ExtendedContentHandler#startElement(String) */ public void startElement(String elementName) throws SAXException { this.startElement(null,null, elementName); } /** * Receive notification of the end of an element. * @param elementName The element type name * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elementName) throws SAXException { flushPending(); m_saxHandler.endElement(EMPTYSTRING, elementName, elementName); // time to fire off endElement event if (m_tracer != null) super.fireEndElem(elementName); } /** * Receive notification of character data. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param off The start position in the array. * @param len The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator * * @throws org.xml.sax.SAXException * * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ public void characters(char[] ch, int off, int len) throws SAXException { flushPending(); m_saxHandler.characters(ch, off, len); // time to fire off characters event if (m_tracer != null) super.fireCharEvent(ch, off, len); } /** * This method flushes any pending events, which can be startDocument() * closing the opening tag of an element, or closing an open CDATA section. */ public void flushPending() throws SAXException { if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } // Close any open element if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } } /** * Handle a prefix/uri mapping, which is associated with a startElement() * that is soon to follow. Need to close any open start tag to make * sure than any name space attributes due to this event are associated wih * the up comming element, not the current one. * @see ExtendedContentHandler#startPrefixMapping * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI the prefix is mapped to. * @param shouldFlush true if any open tags need to be closed first, this * will impact which element the mapping applies to (open parent, or its up * comming child) * @return returns true if the call made a change to the current * namespace information, false if it did not change anything, e.g. if the * prefix/namespace mapping was already in scope from before. * * @throws org.xml.sax.SAXException The client may throw * an exception during processing. */ public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws SAXException { // no namespace support for HTML if (shouldFlush) flushPending(); m_saxHandler.startPrefixMapping(prefix,uri); return false; } /** * Begin the scope of a prefix-URI Namespace mapping * just before another element is about to start. * This call will close any open tags so that the prefix mapping * will not apply to the current element, but the up comming child. * * @see org.xml.sax.ContentHandler#startPrefixMapping * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI the prefix is mapped to. * * @throws org.xml.sax.SAXException The client may throw * an exception during processing. * */ public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { startPrefixMapping(prefix,uri,true); } /** * This method is used when a prefix/uri namespace mapping * is indicated after the element was started with a * startElement() and before and endElement(). * startPrefixMapping(prefix,uri) would be used before the * startElement() call. * @param prefix the prefix associated with the given URI. * @param uri the URI of the namespace * * @see ExtendedContentHandler#namespaceAfterStartElement(String, String) */ public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_elemContext.m_elementURI == null) { String prefix1 = getPrefixPart(m_elemContext.m_elementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_elemContext.m_elementURI = uri; } } startPrefixMapping(prefix,uri,false); } /** * Try's to reset the super class and reset this class for * re-use, so that you don't need to create a new serializer * (mostly for performance reasons). * * @return true if the class was successfuly reset. * @see Serializer#reset() */ public boolean reset() { boolean wasReset = false; if (super.reset()) { resetToHTMLSAXHandler(); wasReset = true; } return wasReset; } /** * Reset all of the fields owned by ToHTMLSAXHandler class * */ private void resetToHTMLSAXHandler() { this.m_dtdHandled = false; this.m_escapeSetting = true; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/WriterToASCI.java0000644000175000017500000001036110721374031024131 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WriterToASCI.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; /** * This class writes ASCII to a byte stream as quickly as possible. For the * moment it does not do buffering, though I reserve the right to do some * buffering down the line if I can prove that it will be faster even if the * output stream is buffered. * * This class is only used internally within Xalan. * * @xsl.usage internal */ class WriterToASCI extends Writer implements WriterChain { /** The byte stream to write to. */ private final OutputStream m_os; /** * Create an unbuffered ASCII writer. * * * @param os The byte stream to write to. */ public WriterToASCI(OutputStream os) { m_os = os; } /** * Write a portion of an array of characters. * * @param chars Array of characters * @param start Offset from which to start writing characters * @param length Number of characters to write * * @exception IOException If an I/O error occurs * * @throws java.io.IOException */ public void write(char chars[], int start, int length) throws java.io.IOException { int n = length+start; for (int i = start; i < n; i++) { m_os.write(chars[i]); } } /** * Write a single character. The character to be written is contained in * the 16 low-order bits of the given integer value; the 16 high-order bits * are ignored. * *

    Subclasses that intend to support efficient single-character output * should override this method. * * @param c int specifying a character to be written. * @exception IOException If an I/O error occurs */ public void write(int c) throws IOException { m_os.write(c); } /** * Write a string. * * @param s String to be written * * @exception IOException If an I/O error occurs */ public void write(String s) throws IOException { int n = s.length(); for (int i = 0; i < n; i++) { m_os.write(s.charAt(i)); } } /** * Flush the stream. If the stream has saved any characters from the * various write() methods in a buffer, write them immediately to their * intended destination. Then, if that destination is another character or * byte stream, flush it. Thus one flush() invocation will flush all the * buffers in a chain of Writers and OutputStreams. * * @exception IOException If an I/O error occurs */ public void flush() throws java.io.IOException { m_os.flush(); } /** * Close the stream, flushing it first. Once a stream has been closed, * further write() or flush() invocations will cause an IOException to be * thrown. Closing a previously-closed stream, however, has no effect. * * @exception IOException If an I/O error occurs */ public void close() throws java.io.IOException { m_os.close(); } /** * Get the output stream where the events will be serialized to. * * @return reference to the result stream, or null of only a writer was * set. */ public OutputStream getOutputStream() { return m_os; } /** * Get the writer that this writer directly chains to. */ public Writer getWriter() { return null; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/Encodings.properties0000644000175000017500000002651610721374033025111 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: Encodings.properties 468654 2006-10-28 07:09:23Z minchau $ # # Each entry in this properties file is: # 1) The Java name for the encoding # 2) A comma separated list of the MIME names for the encoding, # with the first one being the preferred MIME name. # 3) An optional high char. Characters at or below this value are # definately in the encoding, but characters above it may or may not be. # This value is given only for performance reasons. # A value of zero is the same as no value at all. # # For example this line in this file: # ASCII ASCII,US-ASCII 0x007F # Means the Java name for the encoding is "ASCII". The MIME names for this # encoding which may appear in a stylesheet are "ASCII" or "US-ASCII" # and the optional high code point value is given, and it is 0X007F # which means that the contiguous block of chars from # 0x0001 to 0x007F ( 127 in base 10) are all in the encoding. # Higher values above this char might be in the encoding, although in the # case of this particular encoding there are no higher chars. # # # , # # ASCII ASCII,US-ASCII 0x007F # # Big5, Traditional Chinese Big5 BIG5,csBig5 0x007F #Big5 with Hong Kong extensions, Traditional Chinese (incorporating 2001 revision) Big5_HKSCS BIG5-HKSCS 0x007F # USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia Cp037 EBCDIC-CP-US,EBCDIC-CP-CA,EBCDIC-CP-WT,EBCDIC-CP-NL,IBM037 0x0019 # IBM Austria, Germany Cp273 IBM273,csIBM273 0x0019 Cp274 csIBM274,EBCDIC-BE Cp275 csIBM275,EBCDIC-BR # IBM Denmark, Norway Cp277 EBCDIC-CP-DK,EBCDIC-CP-NO,IBM277,csIBM277 0x0019 # IBM Finland, Sweden Cp278 EBCDIC-CP-FI,EBCDIC-CP-SE,IBM278,csIBM278 0x0019 # IBM Italy Cp280 EBCDIC-CP-IT,IBM280,csIBM280 0x0019 Cp281 EBCDIC-JP-E,csIBM281 # IBM Catalan/Spain, Spanish Latin America Cp284 EBCDIC-CP-ES,IBM284,csIBM284 0x0019 # IBM United Kingdom, Ireland Cp285 EBCDIC-CP-GB,IBM284,csIBM285 0x0019 Cp290 EBCDIC-JP-kana,IBM290,csIBM290 0x0019 # IBM France Cp297 EBCDIC-CP-FR,IBM297,csIBM297 0x0019 # IBM Arabic Cp420 EBCDIC-CP-AR1,IBM420,csIBM420 0x0019 Cp423 EBCDIC-CP-GR,IBM423,csIBM423 # IBM Hebrew Cp424 EBCDIC-CP-HE,IBM424,csIBM424 0x0019 Cp437 437,IBM437,csPC8CodePage437 0x007F # EBCDIC 500V1 Cp500 EBCDIC-CP-CH,EBCDIC-CP-BE,IBM500,csIBM500 0x0019 # PC Baltic Cp775 IBM775,csPC775Baltic 0x007F # IBM Thailand extended SBCS Cp838 IBM-Thai,838,csIBMThai 0x0019 # MS-DOS Latin-1 Cp850 850,csPC850Multilingual,IBM850 0x007F Cp851 851,IBM851,csIBM851 # MS-DOS Latin-2 Cp852 IBM852,852,csPCp852 0x007F # IBM Cyrillic Cp855 IBM855,855,csIBM855 0x007F # IBM Turkish Cp857 IBM857,857,csIBM857 0x007F # Variant of Cp850 with Euro character Cp858 IBM00858 0x007F # MS-DOS Portuguese Cp860 860,csIBM860,IBM860 0x007F # MS-DOS Icelandic Cp861 IBM861,861,csIBM861,cp-is 0x007F # Cp862 IBM862,862,csPCi62LatinHebrew 0x007F # MS-DOS Canadian French Cp863 IBM863,863,csIBM863 0x007F # PC Arabic Cp864 IBM864,864,csIBM864 0x007F # MS-DOS Nordic Cp865 IBM865,865,csIBM865 0x007F # MS-DOS Russian Cp866 IBM866,866,csIBM866 0x007F # MS-DOS Pakistan Cp868 IBM868,cp-ar,csIBM868 0x007F # IBM Modern Greek Cp869 IBM869,869,cp-gr,csIBM869 0x007F # IBM Multilingual Latin-2 Cp870 EBCDIC-CP-ROECE,EBCDIC-CP-YU,IBM870,csIBM870 0x0019 # IBM Iceland Cp871 EBCDIC-CP-IS,IBM871,csIBM871 0x0019 Cp880 EBCDIC-Cyrillic,IBM880,csIBM880 Cp891 IBM891,csIBM891 Cp903 IBM903,csIBM903 Cp904 IBM904,csIBM904 Cp905 IBM905,csIBM905,EBCDIC-CP-TR # IBM Pakistan (Urdu) Cp918 EBCDIC-CP-AR2,IBM918,csIBM918 0x0019 # GBK, Simplified Chinese Cp936 GBK,MS936,WINDOWS-936 # IBM Latin-5, Turkey Cp1026 IBM1026,csIBM1026 0x0019 # Latin-1 character set for EBCDIC hosts Cp1047 IBM1047,IBM-1047 0x0019 # Variant of Cp037 with Euro character Cp1140 IBM01140 0x0019 # Variant of Cp273 with Euro character Cp1141 IBM01141 0x0019 # Variant of Cp277 with Euro character Cp1142 IBM01142 0x0019 # Variant of Cp278 with Euro character Cp1143 IBM01143 0x0019 # Variant of Cp280 with Euro character Cp1144 IBM01144 0x0019 # Variant of Cp284 with Euro character Cp1145 IBM01145 0x0019 # Variant of Cp285 with Euro character Cp1146 IBM01146 0x0019 # Variant of Cp297 with Euro character Cp1147 IBM01147 0x0019 # Variant of Cp500 with Euro character Cp1148 IBM01148 0x0019 # Variant of Cp871 with Euro character Cp1149 IBM01149 0x0019 Cp1250 WINDOWS-1250 0x007F Cp1251 WINDOWS-1251 0x007F Cp1252 WINDOWS-1252 0x007F Cp1253 WINDOWS-1253 0x007F Cp1254 WINDOWS-1254 0x007F # Windows Hebrew Cp1255 WINDOWS-1255 0x007F # Windows Arabic Cp1256 WINDOWS-1256 0x007F Cp1257 WINDOWS-1257 0x007F # Windows Vietnamese Cp1258 WINDOWS-1258 0x007F EUC-CN EUC-CN 0x007F EUC_CN EUC-CN 0x007F # #JISX 0201, 0208 and 0212, EUC encoding Japanese EUC-JP EUC-JP 0x007F EUC_JP EUC-JP 0x007F # KS C 5601, EUC encoding, Korean EUC-KR EUC-KR 0x007F EUC_KR EUC-KR 0x007F # CNS11643 (Plane 1-7,15), EUC encoding, Traditional Chinese EUC-TW EUC-TW 0x007F EUC_TW EUC-TW,x-EUC-TW 0x007F EUCJIS EUC-JP 0x007F # # GB2312, EUC encoding, Simplified Chinese GB2312 GB2312 0x007F # GB2312 and CNS11643 in ISO 2022 CN form, Simplified and Traditional Chinese (conversion to Unicode only) ISO2022CN ISO-2022-CN # JIS X 0201, 0208, in ISO 2022 form, Japanese ISO2022JP ISO-2022-JP # ISO 2022 KR, Korean ISO2022KR ISO-2022-KR 0x007F # # ISO8859-1 ISO-8859-1 0x00FF ISO8859_1 ISO-8859-1 0x00FF 8859-1 ISO-8859-1 0x00FF 8859_1 ISO-8859-1 0x00FF # ISO8859-2 ISO-8859-2 0x00A0 ISO8859_2 ISO-8859-2 0x00A0 8859-2 ISO-8859-2 0x00A0 8859_2 ISO-8859-2 0x00A0 # # Latin Alphabet No. 3 ISO8859-3 ISO-8859-3 0x00A0 ISO8859_3 ISO-8859-3 0x00A0 8859-3 ISO-8859-3 0x00A0 8859_3 ISO-8859-3 0x00A0 # ISO8859-4 ISO-8859-4 0x00A0 ISO8859_4 ISO-8859-4 0x00A0 8859-4 ISO-8859-4 0x00A0 8859_4 ISO-8859-4 0x00A0 # ISO8859-5 ISO-8859-5 0x00A0 ISO8859_5 ISO-8859-5 0x00A0 8859-5 ISO-8859-5 0x00A0 8859_5 ISO-8859-5 0x00A0 # # Latin/Arabic Alphabet ISO8859-6 ISO-8859-6 0x00A0 ISO8859_6 ISO-8859-6 0x00A0 8859-6 ISO-8859-6 0x00A0 8859_6 ISO-8859-6 0x00A0 # ISO8859-7 ISO-8859-7 0x00A0 ISO8859_7 ISO-8859-7 0x00A0 8859-7 ISO-8859-7 0x00A0 8859_7 ISO-8859-7 0x00A0 # ISO8859-8 ISO-8859-8 0x00A0 ISO8859_8 ISO-8859-8 0x00A0 8859-8 ISO-8859-8 0x00A0 8859_8 ISO-8859-8 0x00A0 # ISO8859-9 ISO-8859-9 0x00CF ISO8859_9 ISO-8859-9 0x00CF 8859-9 ISO-8859-9 0x00CF 8859_9 ISO-8859-9 0x00CF # ISO8859-10 ISO-8859-10 0x007E ISO8859_10 ISO-8859-10 0x007E ISO8859-11 ISO-8859-11 0x007E ISO8859_11 ISO-8859-11 0x007E ISO8859-12 ISO-8859-12 0x007F ISO8859_12 ISO-8859-12 0x007F ISO8859-13 ISO-8859-13 0x00A0 ISO8859_13 ISO-8859-13 0x00A0 ISO8859-14 ISO-8859-14 0x007E ISO8859_14 ISO-8859-14 0x007E ISO8859-15 ISO-8859-15 0x00A3 ISO8859_15 ISO-8859-15 0x00A3 JIS ISO-2022-JP 0x007F KOI8_R KOI8-R 0x007F KSC5601 EUC-KR 0x007F KS_C_5601-1987 KS_C_5601-1987,iso-ir-149,KS_C_5601-1989,KSC_5601,csKSC56011987 0x007F MacTEC MacRoman # Windows Japanese MS932 windows-31j # Shift-JIS, Japanese SJIS SHIFT_JIS 0x007F # TIS620, Thai TIS620 TIS-620 UTF8 UTF-8 0xFFFF Unicode UNICODE,UTF-16 0xFFFF # note that more character set names and their aliases # can be found at http://www.iana.org/assignments/character-sets libxalan2-java-2.7.1/src/org/apache/xml/serializer/ElemContext.java0000644000175000017500000001734710721374031024154 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemContext.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; /** * This class is a stack frame that consists of * information about the element currently being processed * by a serializer. Consider this example: *

     *   
     *     
     *     
     *     
     *     
     *   
     * 
    * * A stack frame will be pushed for "A" at depth 1, * then another one for "B1" at depth 2. * Then "B1" stackframe is popped. When the stack frame for "B2" is * pushed, this implementation re-uses the old stack fram object used * by "B1" to be efficient at not creating too many of these object. * * This is by no means a public class, and neither are its fields or methods, * they are all helper fields for a serializer. * * The purpose of this class is to be more consistent with pushing information * when a new element is being serialized and more quickly restoring the old * information about the parent element with a simple pop() when the * child element is done. Previously there was some redundant and error-prone * calculations going on to retore information. * * @xsl.usage internal */ final class ElemContext { // Fields that form the context of the element /** * The nesting depth of the element inside other elements. */ final int m_currentElemDepth; /** HTML field, the element description of the HTML element */ ElemDesc m_elementDesc = null; /** * The local name of the element. */ String m_elementLocalName = null; /** * The fully qualified name of the element (with prefix, if any). */ String m_elementName = null; /** * The URI of the element. * If this value is null it means that the URI is not yet determined * for the element. Valid values are the empty string "", meaning * that it is in no namespace, or a string of non-zero length. */ String m_elementURI = null; /** If the element is in the cdata-section-names list * then the value is true. If it is true the text children of the element * should be output in CDATA section blocks. */ boolean m_isCdataSection; /** True if the current element has output escaping disabled. * This is true for SCRIPT and STYLE elements. */ boolean m_isRaw = false; /** The next element "stack frame". This value will only be * set once as deeper stack frames are not deleted when popped off, * but are rather re-used when a push is required. * * This makes for very fast pushing and popping of stack frames * because very few stack frame objects are ever created, they are * mostly re-used. This re-use saves object creation but it also means * that connections between the frames via m_next and m_prev * never changes either. Just the contents of the frames change * as they are re-used. Only the reference to the current stack frame, which * is held by the serializer is changed via a quick pop() or push(). */ private ElemContext m_next; /** The previous element "stack frame". */ final ElemContext m_prev; /** * Set to true when a start tag is started, or open, but not all the * attributes or namespace information is yet collected. */ boolean m_startTagOpen = false; /** * Constructor to create the root of the element contexts. * */ ElemContext() { // this assignment means can never pop this context off m_prev = this; // depth 0 because it doesn't correspond to any element m_currentElemDepth = 0; } /** * Constructor to create the "stack frame" for a given element depth. * * This implementation will re-use the context at each depth. If * a documents deepest element depth is N then there will be (N+1) * such objects created, no more than that. * * @param previous The "stack frame" corresponding to the new * elements parent element. */ private ElemContext(final ElemContext previous) { m_prev = previous; m_currentElemDepth = previous.m_currentElemDepth + 1; } /** * Pop the current "stack frame". * @return Returns the parent "stack frame" of the one popped. */ final ElemContext pop() { /* a very simple pop. No clean up is done of the deeper * stack frame. All deeper stack frames are still attached * but dormant, just waiting to be re-used. */ return this.m_prev; } /** * This method pushes an element "stack frame" * but with no initialization of values in that frame. * This method is used for optimization purposes, like when pushing * a stack frame for an HTML "IMG" tag which has no children and * the stack frame will almost immediately be popped. */ final ElemContext push() { ElemContext frame = this.m_next; if (frame == null) { /* We have never been at this depth yet, and there is no * stack frame to re-use, so we now make a new one. */ frame = new ElemContext(this); this.m_next = frame; } /* * We shouldn't need to set this true because we should just * be pushing a dummy stack frame that will be instantly popped. * Yet we need to be ready in case this element does have * unexpected children. */ frame.m_startTagOpen = true; return frame; } /** * Push an element context on the stack. This context keeps track of * information gathered about the element. * @param uri The URI for the namespace for the element name, * can be null if it is not yet known. * @param localName The local name of the element (no prefix), * can be null. * @param qName The qualified name (with prefix, if any) * of the element, this parameter is required. */ final ElemContext push( final String uri, final String localName, final String qName) { ElemContext frame = this.m_next; if (frame == null) { /* We have never been at this depth yet, and there is no * stack frame to re-use, so we now make a new one. */ frame = new ElemContext(this); this.m_next = frame; } // Initialize, or reset values in the new or re-used stack frame. frame.m_elementName = qName; frame.m_elementLocalName = localName; frame.m_elementURI = uri; frame.m_isCdataSection = false; frame.m_startTagOpen = true; // is_Raw is already set in the HTML startElement() method // frame.m_isRaw = false; return frame; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToStream.java0000644000175000017500000037222210721374030023456 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToStream.java 475894 2006-11-16 19:43:59Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.EmptyStackException; import java.util.Enumeration; import java.util.Iterator; import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.apache.xml.serializer.utils.WrappedRuntimeException; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * This abstract class is a base class for other stream * serializers (xml, html, text ...) that write output to a stream. * * @xsl.usage internal */ abstract public class ToStream extends SerializerBase { private static final String COMMENT_BEGIN = ""; /** Stack to keep track of disabling output escaping. */ protected BoolStack m_disableOutputEscapingStates = new BoolStack(); /** * The encoding information associated with this serializer. * Although initially there is no encoding, * there is a dummy EncodingInfo object that will say * that every character is in the encoding. This is useful * for a serializer that is in temporary output state and has * no associated encoding. A serializer in final output state * will have an encoding, and will worry about whether * single chars or surrogate pairs of high/low chars form * characters in the output encoding. */ EncodingInfo m_encodingInfo = new EncodingInfo(null,null, '\u0000'); /** * Stack to keep track of whether or not we need to * preserve whitespace. * * Used to push/pop values used for the field m_ispreserve, but * m_ispreserve is only relevant if m_doIndent is true. * If m_doIndent is false this field has no impact. * */ protected BoolStack m_preserves = new BoolStack(); /** * State flag to tell if preservation of whitespace * is important. * * Used only in shouldIndent() but only if m_doIndent is true. * If m_doIndent is false this flag has no impact. * */ protected boolean m_ispreserve = false; /** * State flag that tells if the previous node processed * was text, so we can tell if we should preserve whitespace. * * Used in endDocument() and shouldIndent() but * only if m_doIndent is true. * If m_doIndent is false this flag has no impact. */ protected boolean m_isprevtext = false; private static final char[] s_systemLineSep; static { SecuritySupport ss = SecuritySupport.getInstance(); s_systemLineSep = ss.getSystemProperty("line.separator").toCharArray(); } /** * The system line separator for writing out line breaks. * The default value is from the system property, * but this value can be set through the xsl:output * extension attribute xalan:line-separator. */ protected char[] m_lineSep = s_systemLineSep; /** * True if the the system line separator is to be used. */ protected boolean m_lineSepUse = true; /** * The length of the line seperator, since the write is done * one character at a time. */ protected int m_lineSepLen = m_lineSep.length; /** * Map that tells which characters should have special treatment, and it * provides character to entity name lookup. */ protected CharInfo m_charInfo; /** True if we control the buffer, and we should flush the output on endDocument. */ boolean m_shouldFlush = true; /** * Add space before '/>' for XHTML. */ protected boolean m_spaceBeforeClose = false; /** * Flag to signal that a newline should be added. * * Used only in indent() which is called only if m_doIndent is true. * If m_doIndent is false this flag has no impact. */ boolean m_startNewLine; /** * Tells if we're in an internal document type subset. */ protected boolean m_inDoctype = false; /** * Flag to quickly tell if the encoding is UTF8. */ boolean m_isUTF8 = false; /** * remembers if we are in between the startCDATA() and endCDATA() callbacks */ protected boolean m_cdataStartCalled = false; /** * If this flag is true DTD entity references are not left as-is, * which is exiting older behavior. */ private boolean m_expandDTDEntities = true; /** * Default constructor */ public ToStream() { } /** * This helper method to writes out "]]>" when closing a CDATA section. * * @throws org.xml.sax.SAXException */ protected void closeCDATA() throws org.xml.sax.SAXException { try { m_writer.write(CDATA_DELIMITER_CLOSE); // write out a CDATA section closing "]]>" m_cdataTagOpen = false; // Remember that we have done so. } catch (IOException e) { throw new SAXException(e); } } /** * Serializes the DOM node. Throws an exception only if an I/O * exception occured while serializing. * * @param node Node to serialize. * @throws IOException An I/O exception occured while serializing */ public void serialize(Node node) throws IOException { try { TreeWalker walker = new TreeWalker(this); walker.traverse(node); } catch (org.xml.sax.SAXException se) { throw new WrappedRuntimeException(se); } } /** * Taken from XSLTC */ protected boolean m_escaping = true; /** * Flush the formatter's result stream. * * @throws org.xml.sax.SAXException */ protected final void flushWriter() throws org.xml.sax.SAXException { final java.io.Writer writer = m_writer; if (null != writer) { try { if (writer instanceof WriterToUTF8Buffered) { if (m_shouldFlush) ((WriterToUTF8Buffered) writer).flush(); else ((WriterToUTF8Buffered) writer).flushBuffer(); } if (writer instanceof WriterToASCI) { if (m_shouldFlush) writer.flush(); } else { // Flush always. // Not a great thing if the writer was created // by this class, but don't have a choice. writer.flush(); } } catch (IOException ioe) { throw new org.xml.sax.SAXException(ioe); } } } OutputStream m_outputStream; /** * Get the output stream where the events will be serialized to. * * @return reference to the result stream, or null of only a writer was * set. */ public OutputStream getOutputStream() { return m_outputStream; } // Implement DeclHandler /** * Report an element type declaration. * *

    The content model will consist of the string "EMPTY", the * string "ANY", or a parenthesised group, optionally followed * by an occurrence indicator. The model will be normalized so * that all whitespace is removed,and will include the enclosing * parentheses.

    * * @param name The element type name. * @param model The content model as a normalized string. * @exception SAXException The application may raise an exception. */ public void elementDecl(String name, String model) throws SAXException { // Do not inline external DTD if (m_inExternalDTD) return; try { final java.io.Writer writer = m_writer; DTDprolog(); writer.write("'); writer.write(m_lineSep, 0, m_lineSepLen); } catch (IOException e) { throw new SAXException(e); } } /** * Report an internal entity declaration. * *

    Only the effective (first) declaration for each entity * will be reported.

    * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param value The replacement text of the entity. * @exception SAXException The application may raise an exception. * @see #externalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void internalEntityDecl(String name, String value) throws SAXException { // Do not inline external DTD if (m_inExternalDTD) return; try { DTDprolog(); outputEntityDecl(name, value); } catch (IOException e) { throw new SAXException(e); } } /** * Output the doc type declaration. * * @param name non-null reference to document type name. * NEEDSDOC @param value * * @throws org.xml.sax.SAXException */ void outputEntityDecl(String name, String value) throws IOException { final java.io.Writer writer = m_writer; writer.write(""); writer.write(m_lineSep, 0, m_lineSepLen); } /** * Output a system-dependent line break. * * @throws org.xml.sax.SAXException */ protected final void outputLineSep() throws IOException { m_writer.write(m_lineSep, 0, m_lineSepLen); } void setProp(String name, String val, boolean defaultVal) { if (val != null) { char first = getFirstCharLocName(name); switch (first) { case 'c': if (OutputKeys.CDATA_SECTION_ELEMENTS.equals(name)) { String cdataSectionNames = val; addCdataSectionElements(cdataSectionNames); } break; case 'd': if (OutputKeys.DOCTYPE_SYSTEM.equals(name)) { this.m_doctypeSystem = val; } else if (OutputKeys.DOCTYPE_PUBLIC.equals(name)) { this.m_doctypePublic = val; if (val.startsWith("-//W3C//DTD XHTML")) m_spaceBeforeClose = true; } break; case 'e': String newEncoding = val; if (OutputKeys.ENCODING.equals(name)) { String possible_encoding = Encodings.getMimeEncoding(val); if (possible_encoding != null) { // if the encoding is being set, try to get the // preferred // mime-name and set it too. super.setProp("mime-name", possible_encoding, defaultVal); } final String oldExplicitEncoding = getOutputPropertyNonDefault(OutputKeys.ENCODING); final String oldDefaultEncoding = getOutputPropertyDefault(OutputKeys.ENCODING); if ( (defaultVal && ( oldDefaultEncoding == null || !oldDefaultEncoding.equalsIgnoreCase(newEncoding))) || ( !defaultVal && (oldExplicitEncoding == null || !oldExplicitEncoding.equalsIgnoreCase(newEncoding) ))) { // We are trying to change the default or the non-default setting of the encoding to a different value // from what it was EncodingInfo encodingInfo = Encodings.getEncodingInfo(newEncoding); if (newEncoding != null && encodingInfo.name == null) { // We tried to get an EncodingInfo for Object for the given // encoding, but it came back with an internall null name // so the encoding is not supported by the JDK, issue a message. final String msg = Utils.messages.createMessage( MsgKey.ER_ENCODING_NOT_SUPPORTED,new Object[]{ newEncoding }); final String msg2 = "Warning: encoding \"" + newEncoding + "\" not supported, using " + Encodings.DEFAULT_MIME_ENCODING; try { // Prepare to issue the warning message final Transformer tran = super.getTransformer(); if (tran != null) { final ErrorListener errHandler = tran .getErrorListener(); // Issue the warning message if (null != errHandler && m_sourceLocator != null) { errHandler .warning(new TransformerException( msg, m_sourceLocator)); errHandler .warning(new TransformerException( msg2, m_sourceLocator)); } else { System.out.println(msg); System.out.println(msg2); } } else { System.out.println(msg); System.out.println(msg2); } } catch (Exception e) { } // We said we are using UTF-8, so use it newEncoding = Encodings.DEFAULT_MIME_ENCODING; val = Encodings.DEFAULT_MIME_ENCODING; // to store the modified value into the properties a little later encodingInfo = Encodings.getEncodingInfo(newEncoding); } // The encoding was good, or was forced to UTF-8 above // If there is already a non-default set encoding and we // are trying to set the default encoding, skip the this block // as the non-default value is already the one to use. if (defaultVal == false || oldExplicitEncoding == null) { m_encodingInfo = encodingInfo; if (newEncoding != null) m_isUTF8 = newEncoding.equals(Encodings.DEFAULT_MIME_ENCODING); // if there was a previously set OutputStream OutputStream os = getOutputStream(); if (os != null) { Writer w = getWriter(); // If the writer was previously set, but // set by the user, or if the new encoding is the same // as the old encoding, skip this block String oldEncoding = getOutputProperty(OutputKeys.ENCODING); if ((w == null || !m_writer_set_by_user) && !newEncoding.equalsIgnoreCase(oldEncoding)) { // Make the change of encoding in our internal // table, then call setOutputStreamInternal // which will stomp on the old Writer (if any) // with a new Writer with the new encoding. super.setProp(name, val, defaultVal); setOutputStreamInternal(os,false); } } } } } break; case 'i': if (OutputPropertiesFactory.S_KEY_INDENT_AMOUNT.equals(name)) { setIndentAmount(Integer.parseInt(val)); } else if (OutputKeys.INDENT.equals(name)) { boolean b = "yes".equals(val) ? true : false; m_doIndent = b; } break; case 'l': if (OutputPropertiesFactory.S_KEY_LINE_SEPARATOR.equals(name)) { m_lineSep = val.toCharArray(); m_lineSepLen = m_lineSep.length; } break; case 'm': if (OutputKeys.MEDIA_TYPE.equals(name)) { m_mediatype = val; } break; case 'o': if (OutputKeys.OMIT_XML_DECLARATION.equals(name)) { boolean b = "yes".equals(val) ? true : false; this.m_shouldNotWriteXMLHeader = b; } break; case 's': // if standalone was explicitly specified if (OutputKeys.STANDALONE.equals(name)) { if (defaultVal) { setStandaloneInternal(val); } else { m_standaloneWasSpecified = true; setStandaloneInternal(val); } } break; case 'v': if (OutputKeys.VERSION.equals(name)) { m_version = val; } break; default: break; } super.setProp(name, val, defaultVal); } } /** * Specifies an output format for this serializer. It the * serializer has already been associated with an output format, * it will switch to the new format. This method should not be * called while the serializer is in the process of serializing * a document. * * @param format The output format to use */ public void setOutputFormat(Properties format) { boolean shouldFlush = m_shouldFlush; if (format != null) { // Set the default values first, // and the non-default values after that, // just in case there is some unexpected // residual values left over from over-ridden default values Enumeration propNames; propNames = format.propertyNames(); while (propNames.hasMoreElements()) { String key = (String) propNames.nextElement(); // Get the value, possibly a default value String value = format.getProperty(key); // Get the non-default value (if any). String explicitValue = (String) format.get(key); if (explicitValue == null && value != null) { // This is a default value this.setOutputPropertyDefault(key,value); } if (explicitValue != null) { // This is an explicit non-default value this.setOutputProperty(key,explicitValue); } } } // Access this only from the Hashtable level... we don't want to // get default properties. String entitiesFileName = (String) format.get(OutputPropertiesFactory.S_KEY_ENTITIES); if (null != entitiesFileName) { String method = (String) format.get(OutputKeys.METHOD); m_charInfo = CharInfo.getCharInfo(entitiesFileName, method); } m_shouldFlush = shouldFlush; } /** * Returns the output format for this serializer. * * @return The output format in use */ public Properties getOutputFormat() { Properties def = new Properties(); { Set s = getOutputPropDefaultKeys(); Iterator i = s.iterator(); while (i.hasNext()) { String key = (String) i.next(); String val = getOutputPropertyDefault(key); def.put(key, val); } } Properties props = new Properties(def); { Set s = getOutputPropKeys(); Iterator i = s.iterator(); while (i.hasNext()) { String key = (String) i.next(); String val = getOutputPropertyNonDefault(key); if (val != null) props.put(key, val); } } return props; } /** * Specifies a writer to which the document should be serialized. * This method should not be called while the serializer is in * the process of serializing a document. * * @param writer The output writer stream */ public void setWriter(Writer writer) { setWriterInternal(writer, true); } private boolean m_writer_set_by_user; private void setWriterInternal(Writer writer, boolean setByUser) { m_writer_set_by_user = setByUser; m_writer = writer; // if we are tracing events we need to trace what // characters are written to the output writer. if (m_tracer != null) { boolean noTracerYet = true; Writer w2 = m_writer; while (w2 instanceof WriterChain) { if (w2 instanceof SerializerTraceWriter) { noTracerYet = false; break; } w2 = ((WriterChain)w2).getWriter(); } if (noTracerYet) m_writer = new SerializerTraceWriter(m_writer, m_tracer); } } /** * Set if the operating systems end-of-line line separator should * be used when serializing. If set false NL character * (decimal 10) is left alone, otherwise the new-line will be replaced on * output with the systems line separator. For example on UNIX this is * NL, while on Windows it is two characters, CR NL, where CR is the * carriage-return (decimal 13). * * @param use_sytem_line_break True if an input NL is replaced with the * operating systems end-of-line separator. * @return The previously set value of the serializer. */ public boolean setLineSepUse(boolean use_sytem_line_break) { boolean oldValue = m_lineSepUse; m_lineSepUse = use_sytem_line_break; return oldValue; } /** * Specifies an output stream to which the document should be * serialized. This method should not be called while the * serializer is in the process of serializing a document. *

    * The encoding specified in the output properties is used, or * if no encoding was specified, the default for the selected * output method. * * @param output The output stream */ public void setOutputStream(OutputStream output) { setOutputStreamInternal(output, true); } private void setOutputStreamInternal(OutputStream output, boolean setByUser) { m_outputStream = output; String encoding = getOutputProperty(OutputKeys.ENCODING); if (Encodings.DEFAULT_MIME_ENCODING.equalsIgnoreCase(encoding)) { // We wrap the OutputStream with a writer, but // not one set by the user setWriterInternal(new WriterToUTF8Buffered(output), false); } else if ( "WINDOWS-1250".equals(encoding) || "US-ASCII".equals(encoding) || "ASCII".equals(encoding)) { setWriterInternal(new WriterToASCI(output), false); } else if (encoding != null) { Writer osw = null; try { osw = Encodings.getWriter(output, encoding); } catch (UnsupportedEncodingException uee) { osw = null; } if (osw == null) { System.out.println( "Warning: encoding \"" + encoding + "\" not supported" + ", using " + Encodings.DEFAULT_MIME_ENCODING); encoding = Encodings.DEFAULT_MIME_ENCODING; setEncoding(encoding); try { osw = Encodings.getWriter(output, encoding); } catch (UnsupportedEncodingException e) { // We can't really get here, UTF-8 is always supported // This try-catch exists to make the compiler happy e.printStackTrace(); } } setWriterInternal(osw,false); } else { // don't have any encoding, but we have an OutputStream Writer osw = new OutputStreamWriter(output); setWriterInternal(osw,false); } } /** * @see SerializationHandler#setEscaping(boolean) */ public boolean setEscaping(boolean escape) { final boolean temp = m_escaping; m_escaping = escape; return temp; } /** * Might print a newline character and the indentation amount * of the given depth. * * @param depth the indentation depth (element nesting depth) * * @throws org.xml.sax.SAXException if an error occurs during writing. */ protected void indent(int depth) throws IOException { if (m_startNewLine) outputLineSep(); /* For m_indentAmount > 0 this extra test might be slower * but Xalan's default value is 0, so this extra test * will run faster in that situation. */ if (m_indentAmount > 0) printSpace(depth * m_indentAmount); } /** * Indent at the current element nesting depth. * @throws IOException */ protected void indent() throws IOException { indent(m_elemContext.m_currentElemDepth); } /** * Prints n spaces. * @param n Number of spaces to print. * * @throws org.xml.sax.SAXException if an error occurs when writing. */ private void printSpace(int n) throws IOException { final java.io.Writer writer = m_writer; for (int i = 0; i < n; i++) { writer.write(' '); } } /** * Report an attribute type declaration. * *

    Only the effective (first) declaration for an attribute will * be reported. The type will be one of the strings "CDATA", * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", * "ENTITIES", or "NOTATION", or a parenthesized token group with * the separator "|" and all whitespace removed.

    * * @param eName The name of the associated element. * @param aName The name of the attribute. * @param type A string representing the attribute type. * @param valueDefault A string representing the attribute default * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if * none of these applies. * @param value A string representing the attribute's default value, * or null if there is none. * @exception SAXException The application may raise an exception. */ public void attributeDecl( String eName, String aName, String type, String valueDefault, String value) throws SAXException { // Do not inline external DTD if (m_inExternalDTD) return; try { final java.io.Writer writer = m_writer; DTDprolog(); writer.write("'); writer.write(m_lineSep, 0, m_lineSepLen); } catch (IOException e) { throw new SAXException(e); } } /** * Get the character stream where the events will be serialized to. * * @return Reference to the result Writer, or null. */ public Writer getWriter() { return m_writer; } /** * Report a parsed external entity declaration. * *

    Only the effective (first) declaration for each entity * will be reported.

    * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param publicId The declared public identifier of the entity, or * null if none was declared. * @param systemId The declared system identifier of the entity. * @exception SAXException The application may raise an exception. * @see #internalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void externalEntityDecl( String name, String publicId, String systemId) throws SAXException { try { DTDprolog(); m_writer.write(""); m_writer.write(m_lineSep, 0, m_lineSepLen); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Tell if this character can be written without escaping. */ protected boolean escapingNotNeeded(char ch) { final boolean ret; if (ch < 127) { // This is the old/fast code here, but is this // correct for all encodings? if (ch >= CharInfo.S_SPACE || (CharInfo.S_LINEFEED == ch || CharInfo.S_CARRIAGERETURN == ch || CharInfo.S_HORIZONAL_TAB == ch)) ret= true; else ret = false; } else { ret = m_encodingInfo.isInEncoding(ch); } return ret; } /** * Once a surrogate has been detected, write out the pair of * characters if it is in the encoding, or if there is no * encoding, otherwise write out an entity reference * of the value of the unicode code point of the character * represented by the high/low surrogate pair. *

    * An exception is thrown if there is no low surrogate in the pair, * because the array ends unexpectely, or if the low char is there * but its value is such that it is not a low surrogate. * * @param c the first (high) part of the surrogate, which * must be confirmed before calling this method. * @param ch Character array. * @param i position Where the surrogate was detected. * @param end The end index of the significant characters. * @return 0 if the pair of characters was written out as-is, * the unicode code point of the character represented by * the surrogate pair if an entity reference with that value * was written out. * * @throws IOException * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected. */ protected int writeUTF16Surrogate(char c, char ch[], int i, int end) throws IOException { int codePoint = 0; if (i + 1 >= end) { throw new IOException( Utils.messages.createMessage( MsgKey.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString((int) c)})); } final char high = c; final char low = ch[i+1]; if (!Encodings.isLowUTF16Surrogate(low)) { throw new IOException( Utils.messages.createMessage( MsgKey.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString((int) c) + " " + Integer.toHexString(low)})); } final java.io.Writer writer = m_writer; // If we make it to here we have a valid high, low surrogate pair if (m_encodingInfo.isInEncoding(c,low)) { // If the character formed by the surrogate pair // is in the encoding, so just write it out writer.write(ch,i,2); } else { // Don't know what to do with this char, it is // not in the encoding and not a high char in // a surrogate pair, so write out as an entity ref final String encoding = getEncoding(); if (encoding != null) { /* The output encoding is known, * so somthing is wrong. */ codePoint = Encodings.toCodePoint(high, low); // not in the encoding, so write out a character reference writer.write('&'); writer.write('#'); writer.write(Integer.toString(codePoint)); writer.write(';'); } else { /* The output encoding is not known, * so just write it out as-is. */ writer.write(ch, i, 2); } } // non-zero only if character reference was written out. return codePoint; } /** * Handle one of the default entities, return false if it * is not a default entity. * * @param ch character to be escaped. * @param i index into character array. * @param chars non-null reference to character array. * @param len length of chars. * @param fromTextNode true if the characters being processed * are from a text node, false if they are from an attribute value * @param escLF true if the linefeed should be escaped. * * @return i+1 if the character was written, else i. * * @throws java.io.IOException */ int accumDefaultEntity( java.io.Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException { if (!escLF && CharInfo.S_LINEFEED == ch) { writer.write(m_lineSep, 0, m_lineSepLen); } else { // if this is text node character and a special one of those, // or if this is a character from attribute value and a special one of those if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))) { String outputStringForChar = m_charInfo.getOutputStringForChar(ch); if (null != outputStringForChar) { writer.write(outputStringForChar); } else return i; } else return i; } return i + 1; } /** * Normalize the characters, but don't escape. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @param isCData true if a CDATA block should be built around the characters. * @param useSystemLineSeparator true if the operating systems * end-of-line separator should be output rather than a new-line character. * * @throws IOException * @throws org.xml.sax.SAXException */ void writeNormalizedChars( char ch[], int start, int length, boolean isCData, boolean useSystemLineSeparator) throws IOException, org.xml.sax.SAXException { final java.io.Writer writer = m_writer; int end = start + length; for (int i = start; i < end; i++) { char c = ch[i]; if (CharInfo.S_LINEFEED == c && useSystemLineSeparator) { writer.write(m_lineSep, 0, m_lineSepLen); } else if (isCData && (!escapingNotNeeded(c))) { // if (i != 0) if (m_cdataTagOpen) closeCDATA(); // This needs to go into a function... if (Encodings.isHighUTF16Surrogate(c)) { writeUTF16Surrogate(c, ch, i, end); i++ ; // process two input characters } else { writer.write("&#"); String intStr = Integer.toString((int) c); writer.write(intStr); writer.write(';'); } // if ((i != 0) && (i < (end - 1))) // if (!m_cdataTagOpen && (i < (end - 1))) // { // writer.write(CDATA_DELIMITER_OPEN); // m_cdataTagOpen = true; // } } else if ( isCData && ((i < (end - 2)) && (']' == c) && (']' == ch[i + 1]) && ('>' == ch[i + 2]))) { writer.write(CDATA_CONTINUE); i += 2; } else { if (escapingNotNeeded(c)) { if (isCData && !m_cdataTagOpen) { writer.write(CDATA_DELIMITER_OPEN); m_cdataTagOpen = true; } writer.write(c); } // This needs to go into a function... else if (Encodings.isHighUTF16Surrogate(c)) { if (m_cdataTagOpen) closeCDATA(); writeUTF16Surrogate(c, ch, i, end); i++; // process two input characters } else { if (m_cdataTagOpen) closeCDATA(); writer.write("&#"); String intStr = Integer.toString((int) c); writer.write(intStr); writer.write(';'); } } } } /** * Ends an un-escaping section. * * @see #startNonEscaping * * @throws org.xml.sax.SAXException */ public void endNonEscaping() throws org.xml.sax.SAXException { m_disableOutputEscapingStates.pop(); } /** * Starts an un-escaping section. All characters printed within an un- * escaping section are printed as is, without escaping special characters * into entity references. Only XML and HTML serializers need to support * this method. *

    The contents of the un-escaping section will be delivered through the * regular characters event. * * @throws org.xml.sax.SAXException */ public void startNonEscaping() throws org.xml.sax.SAXException { m_disableOutputEscapingStates.push(true); } /** * Receive notification of cdata. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator * * @throws org.xml.sax.SAXException */ protected void cdata(char ch[], int start, final int length) throws org.xml.sax.SAXException { try { final int old_start = start; if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } m_ispreserve = true; if (shouldIndent()) indent(); boolean writeCDataBrackets = (((length >= 1) && escapingNotNeeded(ch[start]))); /* Write out the CDATA opening delimiter only if * we are supposed to, and if we are not already in * the middle of a CDATA section */ if (writeCDataBrackets && !m_cdataTagOpen) { m_writer.write(CDATA_DELIMITER_OPEN); m_cdataTagOpen = true; } // writer.write(ch, start, length); if (isEscapingDisabled()) { charactersRaw(ch, start, length); } else writeNormalizedChars(ch, start, length, true, m_lineSepUse); /* used to always write out CDATA closing delimiter here, * but now we delay, so that we can merge CDATA sections on output. * need to write closing delimiter later */ if (writeCDataBrackets) { /* if the CDATA section ends with ] don't leave it open * as there is a chance that an adjacent CDATA sections * starts with ]>. * We don't want to merge ]] with > , or ] with ]> */ if (ch[start + length - 1] == ']') closeCDATA(); } // time to fire off CDATA event if (m_tracer != null) super.fireCDATAEvent(ch, old_start, length); } catch (IOException ioe) { throw new org.xml.sax.SAXException( Utils.messages.createMessage( MsgKey.ER_OIERROR, null), ioe); //"IO error", ioe); } } /** * Tell if the character escaping should be disabled for the current state. * * @return true if the character escaping should be disabled. */ private boolean isEscapingDisabled() { return m_disableOutputEscapingStates.peekOrFalse(); } /** * If available, when the disable-output-escaping attribute is used, * output raw text without escaping. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @throws org.xml.sax.SAXException */ protected void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { if (m_inEntityRef) return; try { if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } m_ispreserve = true; m_writer.write(ch, start, length); } catch (IOException e) { throw new SAXException(e); } } /** * Receive notification of character data. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param chars The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator * * @throws org.xml.sax.SAXException */ public void characters(final char chars[], final int start, final int length) throws org.xml.sax.SAXException { // It does not make sense to continue with rest of the method if the number of // characters to read from array is 0. // Section 7.6.1 of XSLT 1.0 (http://www.w3.org/TR/xslt#value-of) suggest no text node // is created if string is empty. if (length == 0 || (m_inEntityRef && !m_expandDTDEntities)) return; m_docIsEmpty = false; if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } else if (m_needToCallStartDocument) { startDocumentInternal(); } if (m_cdataStartCalled || m_elemContext.m_isCdataSection) { /* either due to startCDATA() being called or due to * cdata-section-elements atribute, we need this as cdata */ cdata(chars, start, length); return; } if (m_cdataTagOpen) closeCDATA(); if (m_disableOutputEscapingStates.peekOrFalse() || (!m_escaping)) { charactersRaw(chars, start, length); // time to fire off characters generation event if (m_tracer != null) super.fireCharEvent(chars, start, length); return; } if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } try { int i; int startClean; // skip any leading whitspace // don't go off the end and use a hand inlined version // of isWhitespace(ch) final int end = start + length; int lastDirtyCharProcessed = start - 1; // last non-clean character that was processed // that was processed final Writer writer = m_writer; boolean isAllWhitespace = true; // process any leading whitspace i = start; while (i < end && isAllWhitespace) { char ch1 = chars[i]; if (m_charInfo.shouldMapTextChar(ch1)) { // The character is supposed to be replaced by a String // so write out the clean whitespace characters accumulated // so far // then the String. writeOutCleanChars(chars, i, lastDirtyCharProcessed); String outputStringForChar = m_charInfo .getOutputStringForChar(ch1); writer.write(outputStringForChar); // We can't say that everything we are writing out is // all whitespace, we just wrote out a String. isAllWhitespace = false; lastDirtyCharProcessed = i; // mark the last non-clean // character processed i++; } else { // The character is clean, but is it a whitespace ? switch (ch1) { // TODO: Any other whitespace to consider? case CharInfo.S_SPACE: // Just accumulate the clean whitespace i++; break; case CharInfo.S_LINEFEED: lastDirtyCharProcessed = processLineFeed(chars, i, lastDirtyCharProcessed, writer); i++; break; case CharInfo.S_CARRIAGERETURN: writeOutCleanChars(chars, i, lastDirtyCharProcessed); writer.write(" "); lastDirtyCharProcessed = i; i++; break; case CharInfo.S_HORIZONAL_TAB: // Just accumulate the clean whitespace i++; break; default: // The character was clean, but not a whitespace // so break the loop to continue with this character // (we don't increment index i !!) isAllWhitespace = false; break; } } } /* If there is some non-whitespace, mark that we may need * to preserve this. This is only important if we have indentation on. */ if (i < end || !isAllWhitespace) m_ispreserve = true; for (; i < end; i++) { char ch = chars[i]; if (m_charInfo.shouldMapTextChar(ch)) { // The character is supposed to be replaced by a String // e.g. '&' --> "&" // e.g. '<' --> "<" writeOutCleanChars(chars, i, lastDirtyCharProcessed); String outputStringForChar = m_charInfo.getOutputStringForChar(ch); writer.write(outputStringForChar); lastDirtyCharProcessed = i; } else { if (ch <= 0x1F) { // Range 0x00 through 0x1F inclusive // // This covers the non-whitespace control characters // in the range 0x1 to 0x1F inclusive. // It also covers the whitespace control characters in the same way: // 0x9 TAB // 0xA NEW LINE // 0xD CARRIAGE RETURN // // We also cover 0x0 ... It isn't valid // but we will output "�" // The default will handle this just fine, but this // is a little performance boost to handle the more // common TAB, NEW-LINE, CARRIAGE-RETURN switch (ch) { case CharInfo.S_HORIZONAL_TAB: // Leave whitespace TAB as a real character break; case CharInfo.S_LINEFEED: lastDirtyCharProcessed = processLineFeed(chars, i, lastDirtyCharProcessed, writer); break; case CharInfo.S_CARRIAGERETURN: writeOutCleanChars(chars, i, lastDirtyCharProcessed); writer.write(" "); lastDirtyCharProcessed = i; // Leave whitespace carriage return as a real character break; default: writeOutCleanChars(chars, i, lastDirtyCharProcessed); writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); lastDirtyCharProcessed = i; break; } } else if (ch < 0x7F) { // Range 0x20 through 0x7E inclusive // Normal ASCII chars, do nothing, just add it to // the clean characters } else if (ch <= 0x9F){ // Range 0x7F through 0x9F inclusive // More control characters, including NEL (0x85) writeOutCleanChars(chars, i, lastDirtyCharProcessed); writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); lastDirtyCharProcessed = i; } else if (ch == CharInfo.S_LINE_SEPARATOR) { // LINE SEPARATOR writeOutCleanChars(chars, i, lastDirtyCharProcessed); writer.write("
"); lastDirtyCharProcessed = i; } else if (m_encodingInfo.isInEncoding(ch)) { // If the character is in the encoding, and // not in the normal ASCII range, we also // just leave it get added on to the clean characters } else { // This is a fallback plan, we should never get here // but if the character wasn't previously handled // (i.e. isn't in the encoding, etc.) then what // should we do? We choose to write out an entity writeOutCleanChars(chars, i, lastDirtyCharProcessed); writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); lastDirtyCharProcessed = i; } } } // we've reached the end. Any clean characters at the // end of the array than need to be written out? startClean = lastDirtyCharProcessed + 1; if (i > startClean) { int lengthClean = i - startClean; m_writer.write(chars, startClean, lengthClean); } // For indentation purposes, mark that we've just writen text out m_isprevtext = true; } catch (IOException e) { throw new SAXException(e); } // time to fire off characters generation event if (m_tracer != null) super.fireCharEvent(chars, start, length); } private int processLineFeed(final char[] chars, int i, int lastProcessed, final Writer writer) throws IOException { if (!m_lineSepUse || (m_lineSepLen ==1 && m_lineSep[0] == CharInfo.S_LINEFEED)){ // We are leaving the new-line alone, and it is just // being added to the 'clean' characters, // so the last dirty character processed remains unchanged } else { writeOutCleanChars(chars, i, lastProcessed); writer.write(m_lineSep, 0, m_lineSepLen); lastProcessed = i; } return lastProcessed; } private void writeOutCleanChars(final char[] chars, int i, int lastProcessed) throws IOException { int startClean; startClean = lastProcessed + 1; if (startClean < i) { int lengthClean = i - startClean; m_writer.write(chars, startClean, lengthClean); } } /** * This method checks if a given character is between C0 or C1 range * of Control characters. * This method is added to support Control Characters for XML 1.1 * If a given character is TAB (0x09), LF (0x0A) or CR (0x0D), this method * return false. Since they are whitespace characters, no special processing is needed. * * @param ch * @return boolean */ private static boolean isCharacterInC0orC1Range(char ch) { if(ch == 0x09 || ch == 0x0A || ch == 0x0D) return false; else return (ch >= 0x7F && ch <= 0x9F)|| (ch >= 0x01 && ch <= 0x1F); } /** * This method checks if a given character either NEL (0x85) or LSEP (0x2028) * These are new end of line charcters added in XML 1.1. These characters must be * written as Numeric Character References (NCR) in XML 1.1 output document. * * @param ch * @return boolean */ private static boolean isNELorLSEPCharacter(char ch) { return (ch == 0x85 || ch == 0x2028); } /** * Process a dirty character and any preeceding clean characters * that were not yet processed. * @param chars array of characters being processed * @param end one (1) beyond the last character * in chars to be processed * @param i the index of the dirty character * @param ch the character in chars[i] * @param lastDirty the last dirty character previous to i * @param fromTextNode true if the characters being processed are * from a text node, false if they are from an attribute value. * @return the index of the last character processed */ private int processDirty( char[] chars, int end, int i, char ch, int lastDirty, boolean fromTextNode) throws IOException { int startClean = lastDirty + 1; // if we have some clean characters accumulated // process them before the dirty one. if (i > startClean) { int lengthClean = i - startClean; m_writer.write(chars, startClean, lengthClean); } // process the "dirty" character if (CharInfo.S_LINEFEED == ch && fromTextNode) { m_writer.write(m_lineSep, 0, m_lineSepLen); } else { startClean = accumDefaultEscape( m_writer, (char)ch, i, chars, end, fromTextNode, false); i = startClean - 1; } // Return the index of the last character that we just processed // which is a dirty character. return i; } /** * Receive notification of character data. * * @param s The string of characters to process. * * @throws org.xml.sax.SAXException */ public void characters(String s) throws org.xml.sax.SAXException { if (m_inEntityRef && !m_expandDTDEntities) return; final int length = s.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length * 2 + 1]; } s.getChars(0, length, m_charsBuff, 0); characters(m_charsBuff, 0, length); } /** * Escape and writer.write a character. * * @param ch character to be escaped. * @param i index into character array. * @param chars non-null reference to character array. * @param len length of chars. * @param fromTextNode true if the characters being processed are * from a text node, false if the characters being processed are from * an attribute value. * @param escLF true if the linefeed should be escaped. * * @return i+1 if a character was written, i+2 if two characters * were written out, else return i. * * @throws org.xml.sax.SAXException */ private int accumDefaultEscape( Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException { int pos = accumDefaultEntity(writer, ch, i, chars, len, fromTextNode, escLF); if (i == pos) { if (Encodings.isHighUTF16Surrogate(ch)) { // Should be the UTF-16 low surrogate of the hig/low pair. char next; // Unicode code point formed from the high/low pair. int codePoint = 0; if (i + 1 >= len) { throw new IOException( Utils.messages.createMessage( MsgKey.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString(ch)})); //"Invalid UTF-16 surrogate detected: " //+Integer.toHexString(ch)+ " ?"); } else { next = chars[++i]; if (!(Encodings.isLowUTF16Surrogate(next))) throw new IOException( Utils.messages.createMessage( MsgKey .ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString(ch) + " " + Integer.toHexString(next)})); //"Invalid UTF-16 surrogate detected: " //+Integer.toHexString(ch)+" "+Integer.toHexString(next)); codePoint = Encodings.toCodePoint(ch,next); } writer.write("&#"); writer.write(Integer.toString(codePoint)); writer.write(';'); pos += 2; // count the two characters that went into writing out this entity } else { /* This if check is added to support control characters in XML 1.1. * If a character is a Control Character within C0 and C1 range, it is desirable * to write it out as Numeric Character Reference(NCR) regardless of XML Version * being used for output document. */ if (isCharacterInC0orC1Range(ch) || isNELorLSEPCharacter(ch)) { writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); } else if ((!escapingNotNeeded(ch) || ( (fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch)))) && m_elemContext.m_currentElemDepth > 0) { writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); } else { writer.write(ch); } pos++; // count the single character that was processed } } return pos; } /** * Receive notification of the beginning of an element, although this is a * SAX method additional namespace or attribute information can occur before * or after this call, that is associated with this element. * * * @param namespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param name The element type name. * @param atts The attributes attached to the element, if any. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.AttributeList * * @throws org.xml.sax.SAXException */ public void startElement( String namespaceURI, String localName, String name, Attributes atts) throws org.xml.sax.SAXException { if (m_inEntityRef) return; if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; m_docIsEmpty = false; } else if (m_cdataTagOpen) closeCDATA(); try { if (m_needToOutputDocTypeDecl) { if(null != getDoctypeSystem()) { outputDocTypeDecl(name, true); } m_needToOutputDocTypeDecl = false; } /* before we over-write the current elementLocalName etc. * lets close out the old one (if we still need to) */ if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } if (namespaceURI != null) ensurePrefixIsDeclared(namespaceURI, name); m_ispreserve = false; if (shouldIndent() && m_startNewLine) { indent(); } m_startNewLine = true; final java.io.Writer writer = m_writer; writer.write('<'); writer.write(name); } catch (IOException e) { throw new SAXException(e); } // process the attributes now, because after this SAX call they might be gone if (atts != null) addAttributes(atts); m_elemContext = m_elemContext.push(namespaceURI,localName,name); m_isprevtext = false; if (m_tracer != null) firePseudoAttributes(); } /** * Receive notification of the beginning of an element, additional * namespace or attribute information can occur before or after this call, * that is associated with this element. * * * @param elementNamespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param elementLocalName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param elementName The element type name. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.AttributeList * * @throws org.xml.sax.SAXException */ public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { startElement(elementNamespaceURI, elementLocalName, elementName, null); } public void startElement(String elementName) throws SAXException { startElement(null, null, elementName, null); } /** * Output the doc type declaration. * * @param name non-null reference to document type name. * NEEDSDOC @param closeDecl * * @throws java.io.IOException */ void outputDocTypeDecl(String name, boolean closeDecl) throws SAXException { if (m_cdataTagOpen) closeCDATA(); try { final java.io.Writer writer = m_writer; writer.write(""); writer.write(m_lineSep, 0, m_lineSepLen); closeDecl = false; // done closing } else writer.write('\"'); } } catch (IOException e) { throw new SAXException(e); } } /** * Process the attributes, which means to write out the currently * collected attributes to the writer. The attributes are not * cleared by this method * * @param writer the writer to write processed attributes to. * @param nAttrs the number of attributes in m_attributes * to be processed * * @throws java.io.IOException * @throws org.xml.sax.SAXException */ public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, SAXException { /* real SAX attributes are not passed in, so process the * attributes that were collected after the startElement call. * _attribVector is a "cheap" list for Stream serializer output * accumulated over a series of calls to attribute(name,value) */ String encoding = getEncoding(); for (int i = 0; i < nAttrs; i++) { // elementAt is JDK 1.1.8 final String name = m_attributes.getQName(i); final String value = m_attributes.getValue(i); writer.write(' '); writer.write(name); writer.write("=\""); writeAttrString(writer, value, encoding); writer.write('\"'); } } /** * Returns the specified string after substituting specials, * and UTF-16 surrogates for chracter references &#xnn. * * @param string String to convert to XML format. * @param encoding CURRENTLY NOT IMPLEMENTED. * * @throws java.io.IOException */ public void writeAttrString( Writer writer, String string, String encoding) throws IOException { final int len = string.length(); if (len > m_attrBuff.length) { m_attrBuff = new char[len*2 + 1]; } string.getChars(0,len, m_attrBuff, 0); final char[] stringChars = m_attrBuff; for (int i = 0; i < len; i++) { char ch = stringChars[i]; if (m_charInfo.shouldMapAttrChar(ch)) { // The character is supposed to be replaced by a String // e.g. '&' --> "&" // e.g. '<' --> "<" accumDefaultEscape(writer, ch, i, stringChars, len, false, true); } else { if (0x0 <= ch && ch <= 0x1F) { // Range 0x00 through 0x1F inclusive // This covers the non-whitespace control characters // in the range 0x1 to 0x1F inclusive. // It also covers the whitespace control characters in the same way: // 0x9 TAB // 0xA NEW LINE // 0xD CARRIAGE RETURN // // We also cover 0x0 ... It isn't valid // but we will output "�" // The default will handle this just fine, but this // is a little performance boost to handle the more // common TAB, NEW-LINE, CARRIAGE-RETURN switch (ch) { case CharInfo.S_HORIZONAL_TAB: writer.write(" "); break; case CharInfo.S_LINEFEED: writer.write(" "); break; case CharInfo.S_CARRIAGERETURN: writer.write(" "); break; default: writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); break; } } else if (ch < 0x7F) { // Range 0x20 through 0x7E inclusive // Normal ASCII chars writer.write(ch); } else if (ch <= 0x9F){ // Range 0x7F through 0x9F inclusive // More control characters writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); } else if (ch == CharInfo.S_LINE_SEPARATOR) { // LINE SEPARATOR writer.write("
"); } else if (m_encodingInfo.isInEncoding(ch)) { // If the character is in the encoding, and // not in the normal ASCII range, we also // just write it out writer.write(ch); } else { // This is a fallback plan, we should never get here // but if the character wasn't previously handled // (i.e. isn't in the encoding, etc.) then what // should we do? We choose to write out a character ref writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); } } } } /** * Receive notification of the end of an element. * * * @param namespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param name The element type name * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException { if (m_inEntityRef) return; // namespaces declared at the current depth are no longer valid // so get rid of them m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null); try { final java.io.Writer writer = m_writer; if (m_elemContext.m_startTagOpen) { if (m_tracer != null) super.fireStartElem(m_elemContext.m_elementName); int nAttrs = m_attributes.getLength(); if (nAttrs > 0) { processAttributes(m_writer, nAttrs); // clear attributes object for re-use with next element m_attributes.clear(); } if (m_spaceBeforeClose) writer.write(" />"); else writer.write("/>"); /* don't need to pop cdataSectionState because * this element ended so quickly that we didn't get * to push the state. */ } else { if (m_cdataTagOpen) closeCDATA(); if (shouldIndent()) indent(m_elemContext.m_currentElemDepth - 1); writer.write('<'); writer.write('/'); writer.write(name); writer.write('>'); } } catch (IOException e) { throw new SAXException(e); } if (!m_elemContext.m_startTagOpen && m_doIndent) { m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop(); } m_isprevtext = false; // fire off the end element event if (m_tracer != null) super.fireEndElem(name); m_elemContext = m_elemContext.m_prev; } /** * Receive notification of the end of an element. * @param name The element type name * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void endElement(String name) throws org.xml.sax.SAXException { endElement(null, null, name); } /** * Begin the scope of a prefix-URI Namespace mapping * just before another element is about to start. * This call will close any open tags so that the prefix mapping * will not apply to the current element, but the up comming child. * * @see org.xml.sax.ContentHandler#startPrefixMapping * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI the prefix is mapped to. * * @throws org.xml.sax.SAXException The client may throw * an exception during processing. * */ public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { // the "true" causes the flush of any open tags startPrefixMapping(prefix, uri, true); } /** * Handle a prefix/uri mapping, which is associated with a startElement() * that is soon to follow. Need to close any open start tag to make * sure than any name space attributes due to this event are associated wih * the up comming element, not the current one. * @see ExtendedContentHandler#startPrefixMapping * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI the prefix is mapped to. * @param shouldFlush true if any open tags need to be closed first, this * will impact which element the mapping applies to (open parent, or its up * comming child) * @return returns true if the call made a change to the current * namespace information, false if it did not change anything, e.g. if the * prefix/namespace mapping was already in scope from before. * * @throws org.xml.sax.SAXException The client may throw * an exception during processing. * * */ public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws org.xml.sax.SAXException { /* Remember the mapping, and at what depth it was declared * This is one greater than the current depth because these * mappings will apply to the next depth. This is in * consideration that startElement() will soon be called */ boolean pushed; int pushDepth; if (shouldFlush) { flushPending(); // the prefix mapping applies to the child element (one deeper) pushDepth = m_elemContext.m_currentElemDepth + 1; } else { // the prefix mapping applies to the current element pushDepth = m_elemContext.m_currentElemDepth; } pushed = m_prefixMap.pushNamespace(prefix, uri, pushDepth); if (pushed) { /* Brian M.: don't know if we really needto do this. The * callers of this object should have injected both * startPrefixMapping and the attributes. We are * just covering our butt here. */ String name; if (EMPTYSTRING.equals(prefix)) { name = "xmlns"; addAttributeAlways(XMLNS_URI, name, name, "CDATA", uri, false); } else { if (!EMPTYSTRING.equals(uri)) // hack for XSLTC attribset16 test { // that maps ns1 prefix to "" URI name = "xmlns:" + prefix; /* for something like xmlns:abc="w3.pretend.org" * the uri is the value, that is why we pass it in the * value, or 5th slot of addAttributeAlways() */ addAttributeAlways(XMLNS_URI, prefix, name, "CDATA", uri, false); } } } return pushed; } /** * Receive notification of an XML comment anywhere in the document. This * callback will be used for comments inside or outside the document * element, including comments in the external DTD subset (if read). * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws org.xml.sax.SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws org.xml.sax.SAXException { int start_old = start; if (m_inEntityRef) return; if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } else if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } try { final int limit = start + length; boolean wasDash = false; if (m_cdataTagOpen) closeCDATA(); if (shouldIndent()) indent(); final java.io.Writer writer = m_writer; writer.write(COMMENT_BEGIN); // Detect occurrences of two consecutive dashes, handle as necessary. for (int i = start; i < limit; i++) { if (wasDash && ch[i] == '-') { writer.write(ch, start, i - start); writer.write(" -"); start = i + 1; } wasDash = (ch[i] == '-'); } // if we have some chars in the comment if (length > 0) { // Output the remaining characters (if any) final int remainingChars = (limit - start); if (remainingChars > 0) writer.write(ch, start, remainingChars); // Protect comment end from a single trailing dash if (ch[limit - 1] == '-') writer.write(' '); } writer.write(COMMENT_END); } catch (IOException e) { throw new SAXException(e); } /* * Don't write out any indentation whitespace now, * because there may be non-whitespace text after this. * * Simply mark that at this point if we do decide * to indent that we should * add a newline on the end of the current line before * the indentation at the start of the next line. */ m_startNewLine = true; // time to generate comment event if (m_tracer != null) super.fireCommentEvent(ch, start_old,length); } /** * Report the end of a CDATA section. * @throws org.xml.sax.SAXException The application may raise an exception. * * @see #startCDATA */ public void endCDATA() throws org.xml.sax.SAXException { if (m_cdataTagOpen) closeCDATA(); m_cdataStartCalled = false; } /** * Report the end of DTD declarations. * @throws org.xml.sax.SAXException The application may raise an exception. * @see #startDTD */ public void endDTD() throws org.xml.sax.SAXException { try { if (m_needToOutputDocTypeDecl) { outputDocTypeDecl(m_elemContext.m_elementName, false); m_needToOutputDocTypeDecl = false; } final java.io.Writer writer = m_writer; if (!m_inDoctype) writer.write("]>"); else { writer.write('>'); } writer.write(m_lineSep, 0, m_lineSepLen); } catch (IOException e) { throw new SAXException(e); } } /** * End the scope of a prefix-URI Namespace mapping. * @see org.xml.sax.ContentHandler#endPrefixMapping * * @param prefix The prefix that was being mapping. * @throws org.xml.sax.SAXException The client may throw * an exception during processing. */ public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException { // do nothing } /** * Receive notification of ignorable whitespace in element content. * * Not sure how to get this invoked quite yet. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #characters * * @throws org.xml.sax.SAXException */ public void ignorableWhitespace(char ch[], int start, int length) throws org.xml.sax.SAXException { if (0 == length) return; characters(ch, start, length); } /** * Receive notification of a skipped entity. * @see org.xml.sax.ContentHandler#skippedEntity * * @param name The name of the skipped entity. If it is a * parameter entity, the name will begin with '%', * and if it is the external DTD subset, it will be the string * "[dtd]". * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping * another exception. */ public void skippedEntity(String name) throws org.xml.sax.SAXException { // TODO: Should handle } /** * Report the start of a CDATA section. * * @throws org.xml.sax.SAXException The application may raise an exception. * @see #endCDATA */ public void startCDATA() throws org.xml.sax.SAXException { m_cdataStartCalled = true; } /** * Report the beginning of an entity. * * The start and end of the document entity are not reported. * The start and end of the external DTD subset are reported * using the pseudo-name "[dtd]". All other events must be * properly nested within start/end entity events. * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @throws org.xml.sax.SAXException The application may raise an exception. * @see #endEntity * @see org.xml.sax.ext.DeclHandler#internalEntityDecl * @see org.xml.sax.ext.DeclHandler#externalEntityDecl */ public void startEntity(String name) throws org.xml.sax.SAXException { if (name.equals("[dtd]")) m_inExternalDTD = true; if (!m_expandDTDEntities && !m_inExternalDTD) { /* Only leave the entity as-is if * we've been told not to expand them * and this is not the magic [dtd] name. */ startNonEscaping(); characters("&" + name + ';'); endNonEscaping(); } m_inEntityRef = true; } /** * For the enclosing elements starting tag write out * out any attributes followed by ">" * * @throws org.xml.sax.SAXException */ protected void closeStartTag() throws SAXException { if (m_elemContext.m_startTagOpen) { try { if (m_tracer != null) super.fireStartElem(m_elemContext.m_elementName); int nAttrs = m_attributes.getLength(); if (nAttrs > 0) { processAttributes(m_writer, nAttrs); // clear attributes object for re-use with next element m_attributes.clear(); } m_writer.write('>'); } catch (IOException e) { throw new SAXException(e); } /* whether Xalan or XSLTC, we have the prefix mappings now, so * lets determine if the current element is specified in the cdata- * section-elements list. */ if (m_CdataElems != null) m_elemContext.m_isCdataSection = isCdataSection(); if (m_doIndent) { m_isprevtext = false; m_preserves.push(m_ispreserve); } } } /** * Report the start of DTD declarations, if any. * * Any declarations are assumed to be in the internal subset unless * otherwise indicated. * * @param name The document type name. * @param publicId The declared public identifier for the * external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the * external DTD subset, or null if none was declared. * @throws org.xml.sax.SAXException The application may raise an * exception. * @see #endDTD * @see #startEntity */ public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException { setDoctypeSystem(systemId); setDoctypePublic(publicId); m_elemContext.m_elementName = name; m_inDoctype = true; } /** * Returns the m_indentAmount. * @return int */ public int getIndentAmount() { return m_indentAmount; } /** * Sets the m_indentAmount. * * @param m_indentAmount The m_indentAmount to set */ public void setIndentAmount(int m_indentAmount) { this.m_indentAmount = m_indentAmount; } /** * Tell if, based on space preservation constraints and the doIndent property, * if an indent should occur. * * @return True if an indent should occur. */ protected boolean shouldIndent() { return m_doIndent && (!m_ispreserve && !m_isprevtext) && m_elemContext.m_currentElemDepth > 0; } /** * Searches for the list of qname properties with the specified key in the * property list. If the key is not found in this property list, the default * property list, and its defaults, recursively, are then checked. The * method returns null if the property is not found. * * @param key the property key. * @param props the list of properties to search in. * * Sets the vector of local-name/URI pairs of the cdata section elements * specified in the cdata-section-elements property. * * This method is essentially a copy of getQNameProperties() from * OutputProperties. Eventually this method should go away and a call * to setCdataSectionElements(Vector v) should be made directly. */ private void setCdataSectionElements(String key, Properties props) { String s = props.getProperty(key); if (null != s) { // Vector of URI/LocalName pairs Vector v = new Vector(); int l = s.length(); boolean inCurly = false; StringBuffer buf = new StringBuffer(); // parse through string, breaking on whitespaces. I do this instead // of a tokenizer so I can track whitespace inside of curly brackets, // which theoretically shouldn't happen if they contain legal URLs. for (int i = 0; i < l; i++) { char c = s.charAt(i); if (Character.isWhitespace(c)) { if (!inCurly) { if (buf.length() > 0) { addCdataSectionElement(buf.toString(), v); buf.setLength(0); } continue; } } else if ('{' == c) inCurly = true; else if ('}' == c) inCurly = false; buf.append(c); } if (buf.length() > 0) { addCdataSectionElement(buf.toString(), v); buf.setLength(0); } // call the official, public method to set the collected names setCdataSectionElements(v); } } /** * Adds a URI/LocalName pair of strings to the list. * * @param URI_and_localName String of the form "{uri}local" or "local" * * @return a QName object */ private void addCdataSectionElement(String URI_and_localName, Vector v) { StringTokenizer tokenizer = new StringTokenizer(URI_and_localName, "{}", false); String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) { // add null URI and the local name v.addElement(null); v.addElement(s1); } else { // add URI, then local name v.addElement(s1); v.addElement(s2); } } /** * Remembers the cdata sections specified in the cdata-section-elements. * The "official way to set URI and localName pairs. * This method should be used by both Xalan and XSLTC. * * @param URI_and_localNames a vector of pairs of Strings (URI/local) */ public void setCdataSectionElements(Vector URI_and_localNames) { // convert to the new way. if (URI_and_localNames != null) { final int len = URI_and_localNames.size() - 1; if (len > 0) { final StringBuffer sb = new StringBuffer(); for (int i = 0; i < len; i += 2) { // whitspace separated "{uri1}local1 {uri2}local2 ..." if (i != 0) sb.append(' '); final String uri = (String) URI_and_localNames.elementAt(i); final String localName = (String) URI_and_localNames.elementAt(i + 1); if (uri != null) { // If there is no URI don't put this in, just the localName then. sb.append('{'); sb.append(uri); sb.append('}'); } sb.append(localName); } m_StringOfCDATASections = sb.toString(); } } initCdataElems(m_StringOfCDATASections); } /** * Makes sure that the namespace URI for the given qualified attribute name * is declared. * @param ns the namespace URI * @param rawName the qualified name * @return returns null if no action is taken, otherwise it returns the * prefix used in declaring the namespace. * @throws SAXException */ protected String ensureAttributesNamespaceIsDeclared( String ns, String localName, String rawName) throws org.xml.sax.SAXException { if (ns != null && ns.length() > 0) { // extract the prefix in front of the raw name int index = 0; String prefixFromRawName = (index = rawName.indexOf(":")) < 0 ? "" : rawName.substring(0, index); if (index > 0) { // we have a prefix, lets see if it maps to a namespace String uri = m_prefixMap.lookupNamespace(prefixFromRawName); if (uri != null && uri.equals(ns)) { // the prefix in the raw name is already maps to the given namespace uri // so we don't need to do anything return null; } else { // The uri does not map to the prefix in the raw name, // so lets make the mapping. this.startPrefixMapping(prefixFromRawName, ns, false); this.addAttribute( "http://www.w3.org/2000/xmlns/", prefixFromRawName, "xmlns:" + prefixFromRawName, "CDATA", ns, false); return prefixFromRawName; } } else { // we don't have a prefix in the raw name. // Does the URI map to a prefix already? String prefix = m_prefixMap.lookupPrefix(ns); if (prefix == null) { // uri is not associated with a prefix, // so lets generate a new prefix to use prefix = m_prefixMap.generateNextPrefix(); this.startPrefixMapping(prefix, ns, false); this.addAttribute( "http://www.w3.org/2000/xmlns/", prefix, "xmlns:" + prefix, "CDATA", ns, false); } return prefix; } } return null; } void ensurePrefixIsDeclared(String ns, String rawName) throws org.xml.sax.SAXException { if (ns != null && ns.length() > 0) { int index; final boolean no_prefix = ((index = rawName.indexOf(":")) < 0); String prefix = (no_prefix) ? "" : rawName.substring(0, index); if (null != prefix) { String foundURI = m_prefixMap.lookupNamespace(prefix); if ((null == foundURI) || !foundURI.equals(ns)) { this.startPrefixMapping(prefix, ns); // Bugzilla1133: Generate attribute as well as namespace event. // SAX does expect both. this.addAttributeAlways( "http://www.w3.org/2000/xmlns/", no_prefix ? "xmlns" : prefix, // local name no_prefix ? "xmlns" : ("xmlns:"+ prefix), // qname "CDATA", ns, false); } } } } /** * This method flushes any pending events, which can be startDocument() * closing the opening tag of an element, or closing an open CDATA section. */ public void flushPending() throws SAXException { if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } if (m_cdataTagOpen) { closeCDATA(); m_cdataTagOpen = false; } if (m_writer != null) { try { m_writer.flush(); } catch(IOException e) { // what? me worry? } } } public void setContentHandler(ContentHandler ch) { // this method is really only useful in the ToSAXHandler classes but it is // in the interface. If the method defined here is ever called // we are probably in trouble. } /** * Adds the given attribute to the set of attributes, even if there is * no currently open element. This is useful if a SAX startPrefixMapping() * should need to add an attribute before the element name is seen. * * This method is a copy of its super classes method, except that some * tracing of events is done. This is so the tracing is only done for * stream serializers, not for SAX ones. * * @param uri the URI of the attribute * @param localName the local name of the attribute * @param rawName the qualified name of the attribute * @param type the type of the attribute (probably CDATA) * @param value the value of the attribute * @param xslAttribute true if this attribute is coming from an xsl:attribute element. * @return true if the attribute value was added, * false if the attribute already existed and the value was * replaced with the new value. */ public boolean addAttributeAlways( String uri, String localName, String rawName, String type, String value, boolean xslAttribute) { boolean was_added; int index; if (uri == null || localName == null || uri.length() == 0) index = m_attributes.getIndex(rawName); else { index = m_attributes.getIndex(uri, localName); } if (index >= 0) { String old_value = null; if (m_tracer != null) { old_value = m_attributes.getValue(index); if (value.equals(old_value)) old_value = null; } /* We've seen the attribute before. * We may have a null uri or localName, but all we really * want to re-set is the value anyway. */ m_attributes.setValue(index, value); was_added = false; if (old_value != null) firePseudoAttributes(); } else { // the attribute doesn't exist yet, create it if (xslAttribute) { /* * This attribute is from an xsl:attribute element so we take some care in * adding it, e.g. * * 2 * * * We are adding attr1 and attr2 both as attributes of elem1, * and this code is adding attr2 (the xsl:attribute ). * We could have a collision with the prefix like in the example above. */ // In the example above, is there a prefix like foo ? final int colonIndex = rawName.indexOf(':'); if (colonIndex > 0) { String prefix = rawName.substring(0,colonIndex); NamespaceMappings.MappingRecord existing_mapping = m_prefixMap.getMappingFromPrefix(prefix); /* Before adding this attribute (foo:attr2), * is the prefix for it (foo) already mapped at the current depth? */ if (existing_mapping != null && existing_mapping.m_declarationDepth == m_elemContext.m_currentElemDepth && !existing_mapping.m_uri.equals(uri)) { /* * There is an existing mapping of this prefix, * it differs from the one we need, * and unfortunately it is at the current depth so we * can not over-ride it. */ /* * Are we lucky enough that an existing other prefix maps to this URI ? */ prefix = m_prefixMap.lookupPrefix(uri); if (prefix == null) { /* Unfortunately there is no existing prefix that happens to map to ours, * so to avoid a prefix collision we must generated a new prefix to use. * This is OK because the prefix URI mapping * defined in the xsl:attribute is short in scope, * just the xsl:attribute element itself, * and at this point in serialization the body of the * xsl:attribute, if any, is just a String. Right? * . . . I sure hope so - Brian M. */ prefix = m_prefixMap.generateNextPrefix(); } rawName = prefix + ':' + localName; } } try { /* This is our last chance to make sure the namespace for this * attribute is declared, especially if we just generated an alternate * prefix to avoid a collision (the new prefix/rawName will go out of scope * soon and be lost ... last chance here. */ String prefixUsed = ensureAttributesNamespaceIsDeclared( uri, localName, rawName); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } } m_attributes.addAttribute(uri, localName, rawName, type, value); was_added = true; if (m_tracer != null) firePseudoAttributes(); } return was_added; } /** * To fire off the pseudo characters of attributes, as they currently * exist. This method should be called everytime an attribute is added, * or when an attribute value is changed, or an element is created. */ protected void firePseudoAttributes() { if (m_tracer != null) { try { // flush out the " 0) { // make a writer that internally appends to the same // StringBuffer java.io.Writer writer = new ToStream.WritertoStringBuffer(sb); processAttributes(writer, nAttrs); // Don't clear the attributes! // We only want to see what would be written out // at this point, we don't want to loose them. } sb.append('>'); // the potential > after the attributes. // convert the StringBuffer to a char array and // emit the trace event that these characters "might" // be written char ch[] = sb.toString().toCharArray(); m_tracer.fireGenerateEvent( SerializerTrace.EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS, ch, 0, ch.length); } catch (IOException ioe) { // ignore ? } catch (SAXException se) { // ignore ? } } } /** * This inner class is used only to collect attribute values * written by the method writeAttrString() into a string buffer. * In this manner trace events, and the real writing of attributes will use * the same code. */ private class WritertoStringBuffer extends java.io.Writer { final private StringBuffer m_stringbuf; /** * @see java.io.Writer#write(char[], int, int) */ WritertoStringBuffer(StringBuffer sb) { m_stringbuf = sb; } public void write(char[] arg0, int arg1, int arg2) throws IOException { m_stringbuf.append(arg0, arg1, arg2); } /** * @see java.io.Writer#flush() */ public void flush() throws IOException { } /** * @see java.io.Writer#close() */ public void close() throws IOException { } public void write(int i) { m_stringbuf.append((char) i); } public void write(String s) { m_stringbuf.append(s); } } /** * @see SerializationHandler#setTransformer(Transformer) */ public void setTransformer(Transformer transformer) { super.setTransformer(transformer); if (m_tracer != null && !(m_writer instanceof SerializerTraceWriter) ) setWriterInternal(new SerializerTraceWriter(m_writer, m_tracer), false); } /** * Try's to reset the super class and reset this class for * re-use, so that you don't need to create a new serializer * (mostly for performance reasons). * * @return true if the class was successfuly reset. */ public boolean reset() { boolean wasReset = false; if (super.reset()) { resetToStream(); wasReset = true; } return wasReset; } /** * Reset all of the fields owned by ToStream class * */ private void resetToStream() { this.m_cdataStartCalled = false; /* The stream is being reset. It is one of * ToXMLStream, ToHTMLStream ... and this type can't be changed * so neither should m_charInfo which is associated with the * type of Stream. Just leave m_charInfo as-is for the next re-use. * */ // this.m_charInfo = null; // don't set to null this.m_disableOutputEscapingStates.clear(); // this.m_encodingInfo = null; // don't set to null this.m_escaping = true; // Leave m_format alone for now - Brian M. // this.m_format = null; this.m_expandDTDEntities = true; this.m_inDoctype = false; this.m_ispreserve = false; this.m_isprevtext = false; this.m_isUTF8 = false; // ?? used anywhere ?? this.m_lineSep = s_systemLineSep; this.m_lineSepLen = s_systemLineSep.length; this.m_lineSepUse = true; // this.m_outputStream = null; // Don't reset it may be re-used this.m_preserves.clear(); this.m_shouldFlush = true; this.m_spaceBeforeClose = false; this.m_startNewLine = false; this.m_writer_set_by_user = false; } /** * Sets the character encoding coming from the xsl:output encoding stylesheet attribute. * @param encoding the character encoding */ public void setEncoding(String encoding) { setOutputProperty(OutputKeys.ENCODING,encoding); } /** * Simple stack for boolean values. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * A minor changes from that package are: * doesn't implement Clonable * * @xsl.usage internal */ static final class BoolStack { /** Array of boolean values */ private boolean m_values[]; /** Array size allocated */ private int m_allocatedSize; /** Index into the array of booleans */ private int m_index; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public BoolStack() { this(32); } /** * Construct a IntVector, using the given block size. * * @param size array size to allocate */ public BoolStack(int size) { m_allocatedSize = size; m_values = new boolean[size]; m_index = -1; } /** * Get the length of the list. * * @return Current length of the list */ public final int size() { return m_index + 1; } /** * Clears the stack. * */ public final void clear() { m_index = -1; } /** * Pushes an item onto the top of this stack. * * * @param val the boolean to be pushed onto this stack. * @return the item argument. */ public final boolean push(boolean val) { if (m_index == m_allocatedSize - 1) grow(); return (m_values[++m_index] = val); } /** * Removes the object at the top of this stack and returns that * object as the value of this function. * * @return The object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final boolean pop() { return m_values[m_index--]; } /** * Removes the object at the top of this stack and returns the * next object at the top as the value of this function. * * * @return Next object to the top or false if none there */ public final boolean popAndTop() { m_index--; return (m_index >= 0) ? m_values[m_index] : false; } /** * Set the item at the top of this stack * * * @param b Object to set at the top of this stack */ public final void setTop(boolean b) { m_values[m_index] = b; } /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final boolean peek() { return m_values[m_index]; } /** * Looks at the object at the top of this stack without removing it * from the stack. If the stack is empty, it returns false. * * @return the object at the top of this stack. */ public final boolean peekOrFalse() { return (m_index > -1) ? m_values[m_index] : false; } /** * Looks at the object at the top of this stack without removing it * from the stack. If the stack is empty, it returns true. * * @return the object at the top of this stack. */ public final boolean peekOrTrue() { return (m_index > -1) ? m_values[m_index] : true; } /** * Tests if this stack is empty. * * @return true if this stack is empty; * false otherwise. */ public boolean isEmpty() { return (m_index == -1); } /** * Grows the size of the stack * */ private void grow() { m_allocatedSize *= 2; boolean newVector[] = new boolean[m_allocatedSize]; System.arraycopy(m_values, 0, newVector, 0, m_index + 1); m_values = newVector; } } // Implement DTDHandler /** * If this method is called, the serializer is used as a * DTDHandler, which changes behavior how the serializer * handles document entities. * @see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String) */ public void notationDecl(String name, String pubID, String sysID) throws SAXException { // TODO Auto-generated method stub try { DTDprolog(); m_writer.write(""); m_writer.write(m_lineSep, 0, m_lineSepLen); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * If this method is called, the serializer is used as a * DTDHandler, which changes behavior how the serializer * handles document entities. * @see org.xml.sax.DTDHandler#unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void unparsedEntityDecl(String name, String pubID, String sysID, String notationName) throws SAXException { // TODO Auto-generated method stub try { DTDprolog(); m_writer.write(""); m_writer.write(m_lineSep, 0, m_lineSepLen); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * A private helper method to output the * @throws SAXException * @throws IOException */ private void DTDprolog() throws SAXException, IOException { final java.io.Writer writer = m_writer; if (m_needToOutputDocTypeDecl) { outputDocTypeDecl(m_elemContext.m_elementName, false); m_needToOutputDocTypeDecl = false; } if (m_inDoctype) { writer.write(" ["); writer.write(m_lineSep, 0, m_lineSepLen); m_inDoctype = false; } } /** * If set to false the serializer does not expand DTD entities, * but leaves them as is, the default value is true; */ public void setDTDEntityExpansion(boolean expand) { m_expandDTDEntities = expand; } /** * Sets the end of line characters to be used during serialization * @param eolChars A character array corresponding to the characters to be used. */ public void setNewLine (char[] eolChars) { m_lineSep = eolChars; m_lineSepLen = eolChars.length; } /** * Remembers the cdata sections specified in the cdata-section-elements by appending the given * cdata section elements to the list. This method can be called multiple times, but once an * element is put in the list of cdata section elements it can not be removed. * This method should be used by both Xalan and XSLTC. * * @param URI_and_localNames a whitespace separated list of element names, each element * is a URI in curly braces (optional) and a local name. An example of such a parameter is: * "{http://company.com}price {myURI2}book chapter" */ public void addCdataSectionElements(String URI_and_localNames) { if (URI_and_localNames != null) initCdataElems(URI_and_localNames); if (m_StringOfCDATASections == null) m_StringOfCDATASections = URI_and_localNames; else m_StringOfCDATASections += (" " + URI_and_localNames); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToTextStream.java0000644000175000017500000005213310721374032024321 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToTextStream.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * This class is not a public API. * It is only public because it is used in other packages. * This class converts SAX or SAX-like calls to a * serialized document for xsl:output method of "text". * @xsl.usage internal */ public class ToTextStream extends ToStream { /** * Default constructor. */ public ToTextStream() { super(); } /** * Receive notification of the beginning of a document. * *

    The SAX parser will invoke this method only once, before any * other methods in this interface or in DTDHandler (except for * setDocumentLocator).

    * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ protected void startDocumentInternal() throws org.xml.sax.SAXException { super.startDocumentInternal(); m_needToCallStartDocument = false; // No action for the moment. } /** * Receive notification of the end of a document. * *

    The SAX parser will invoke this method only once, and it will * be the last method invoked during the parse. The parser shall * not invoke this method until it has either abandoned parsing * (because of an unrecoverable error) or reached the end of * input.

    * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void endDocument() throws org.xml.sax.SAXException { flushPending(); flushWriter(); if (m_tracer != null) super.fireEndDoc(); } /** * Receive notification of the beginning of an element. * *

    The Parser will invoke this method at the beginning of every * element in the XML document; there will be a corresponding * endElement() event for every startElement() event (even when the * element is empty). All of the element's content will be * reported, in order, before the corresponding endElement() * event.

    * *

    If the element name has a namespace prefix, the prefix will * still be attached. Note that the attribute list provided will * contain only attributes with explicit values (specified or * defaulted): #IMPLIED attributes will be omitted.

    * * * @param namespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param name The qualified name (with prefix), or the * empty string if qualified names are not available. * @param atts The attributes attached to the element, if any. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #endElement * @see org.xml.sax.AttributeList * * @throws org.xml.sax.SAXException */ public void startElement( String namespaceURI, String localName, String name, Attributes atts) throws org.xml.sax.SAXException { // time to fire off startElement event if (m_tracer != null) { super.fireStartElem(name); this.firePseudoAttributes(); } return; } /** * Receive notification of the end of an element. * *

    The SAX parser will invoke this method at the end of every * element in the XML document; there will be a corresponding * startElement() event for every endElement() event (even when the * element is empty).

    * *

    If the element name has a namespace prefix, the prefix will * still be attached to the name.

    * * * @param namespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param name The qualified name (with prefix), or the * empty string if qualified names are not available. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException { if (m_tracer != null) super.fireEndElem(name); } /** * Receive notification of character data. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator */ public void characters(char ch[], int start, int length) throws org.xml.sax.SAXException { flushPending(); try { if (inTemporaryOutputState()) { /* leave characters un-processed as we are * creating temporary output, the output generated by * this serializer will be input to a final serializer * later on and it will do the processing in final * output state (not temporary output state). * * A "temporary" ToTextStream serializer is used to * evaluate attribute value templates (for example), * and the result of evaluating such a thing * is fed into a final serializer later on. */ m_writer.write(ch, start, length); } else { // In final output state we do process the characters! writeNormalizedChars(ch, start, length, m_lineSepUse); } if (m_tracer != null) super.fireCharEvent(ch, start, length); } catch(IOException ioe) { throw new SAXException(ioe); } } /** * If available, when the disable-output-escaping attribute is used, * output raw text without escaping. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { try { writeNormalizedChars(ch, start, length, m_lineSepUse); } catch(IOException ioe) { throw new SAXException(ioe); } } /** * Normalize the characters, but don't escape. Different from * SerializerToXML#writeNormalizedChars because it does not attempt to do * XML escaping at all. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @param useLineSep true if the operating systems * end-of-line separator should be output rather than a new-line character. * * @throws IOException * @throws org.xml.sax.SAXException */ void writeNormalizedChars( final char ch[], final int start, final int length, final boolean useLineSep) throws IOException, org.xml.sax.SAXException { final String encoding = getEncoding(); final java.io.Writer writer = m_writer; final int end = start + length; /* copy a few "constants" before the loop for performance */ final char S_LINEFEED = CharInfo.S_LINEFEED; // This for() loop always increments i by one at the end // of the loop. Additional increments of i adjust for when // two input characters (a high/low UTF16 surrogate pair) // are processed. for (int i = start; i < end; i++) { final char c = ch[i]; if (S_LINEFEED == c && useLineSep) { writer.write(m_lineSep, 0, m_lineSepLen); // one input char processed } else if (m_encodingInfo.isInEncoding(c)) { writer.write(c); // one input char processed } else if (Encodings.isHighUTF16Surrogate(c)) { final int codePoint = writeUTF16Surrogate(c, ch, i, end); if (codePoint != 0) { // I think we can just emit the message, // not crash and burn. final String integralValue = Integer.toString(codePoint); final String msg = Utils.messages.createMessage( MsgKey.ER_ILLEGAL_CHARACTER, new Object[] { integralValue, encoding }); //Older behavior was to throw the message, //but newer gentler behavior is to write a message to System.err //throw new SAXException(msg); System.err.println(msg); } i++; // two input chars processed } else { // Don't know what to do with this char, it is // not in the encoding and not a high char in // a surrogate pair, so write out as an entity ref if (encoding != null) { /* The output encoding is known, * so somthing is wrong. */ // not in the encoding, so write out a character reference writer.write('&'); writer.write('#'); writer.write(Integer.toString(c)); writer.write(';'); // I think we can just emit the message, // not crash and burn. final String integralValue = Integer.toString(c); final String msg = Utils.messages.createMessage( MsgKey.ER_ILLEGAL_CHARACTER, new Object[] { integralValue, encoding }); //Older behavior was to throw the message, //but newer gentler behavior is to write a message to System.err //throw new SAXException(msg); System.err.println(msg); } else { /* The output encoding is not known, * so just write it out as-is. */ writer.write(c); } // one input char was processed } } } /** * Receive notification of cdata. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator */ public void cdata(char ch[], int start, int length) throws org.xml.sax.SAXException { try { writeNormalizedChars(ch, start, length, m_lineSepUse); if (m_tracer != null) super.fireCDATAEvent(ch, start, length); } catch(IOException ioe) { throw new SAXException(ioe); } } /** * Receive notification of ignorable whitespace in element content. * *

    Validating Parsers must use this method to report each chunk * of ignorable whitespace (see the W3C XML 1.0 recommendation, * section 2.10): non-validating parsers may also use this method * if they are capable of parsing and using content models.

    * *

    SAX parsers may return all contiguous whitespace in a single * chunk, or they may split it into several chunks; however, all of * the characters in any single event must come from the same * external entity, so that the Locator provides useful * information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #characters * * @throws org.xml.sax.SAXException */ public void ignorableWhitespace(char ch[], int start, int length) throws org.xml.sax.SAXException { try { writeNormalizedChars(ch, start, length, m_lineSepUse); } catch(IOException ioe) { throw new SAXException(ioe); } } /** * Receive notification of a processing instruction. * *

    The Parser will invoke this method once for each processing * instruction found: note that processing instructions may occur * before or after the main document element.

    * *

    A SAX parser should never report an XML declaration (XML 1.0, * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.

    * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { // flush anything pending first flushPending(); if (m_tracer != null) super.fireEscapingEvent(target, data); } /** * Called when a Comment is to be constructed. * Note that Xalan will normally invoke the other version of this method. * %REVIEW% In fact, is this one ever needed, or was it a mistake? * * @param data The comment data. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void comment(String data) throws org.xml.sax.SAXException { final int length = data.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } data.getChars(0, length, m_charsBuff, 0); comment(m_charsBuff, 0, length); } /** * Report an XML comment anywhere in the document. * * This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read). * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws org.xml.sax.SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws org.xml.sax.SAXException { flushPending(); if (m_tracer != null) super.fireCommentEvent(ch, start, length); } /** * Receive notivication of a entityReference. * * @param name non-null reference to the name of the entity. * * @throws org.xml.sax.SAXException */ public void entityReference(String name) throws org.xml.sax.SAXException { if (m_tracer != null) super.fireEntityReference(name); } /** * @see ExtendedContentHandler#addAttribute(String, String, String, String, String) */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) { // do nothing, just forget all about the attribute } /** * @see org.xml.sax.ext.LexicalHandler#endCDATA() */ public void endCDATA() throws SAXException { // do nothing } /** * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elemName) throws SAXException { if (m_tracer != null) super.fireEndElem(elemName); } /** * From XSLTC */ public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { if (m_needToCallStartDocument) startDocumentInternal(); // time to fire off startlement event. if (m_tracer != null) { super.fireStartElem(elementName); this.firePseudoAttributes(); } return; } /** * From XSLTC */ public void characters(String characters) throws SAXException { final int length = characters.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } characters.getChars(0, length, m_charsBuff, 0); characters(m_charsBuff, 0, length); } /** * From XSLTC */ public void addAttribute(String name, String value) { // do nothing, forget about the attribute } /** * Add a unique attribute */ public void addUniqueAttribute(String qName, String value, int flags) throws SAXException { // do nothing, forget about the attribute } public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws SAXException { // no namespace support for HTML return false; } public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { // no namespace support for HTML } public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { // no namespace support for HTML } public void flushPending() throws org.xml.sax.SAXException { if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/package.html0000644000175000017500000000362210721374032023333 0ustar mkochmkoch Xalan Serializer Package.

    Processes SAX events into streams.

    The {@link org.apache.xml.serializer.SerializerFactory} is used to create a {@link org.apache.xml.serializer.Serializer} from a set of output properties (see {@link javax.xml.transform.OutputKeys}).

    {@link org.apache.xml.serializer.ToStream} acts as the main baseclass for the Xalan serializer implementations. {@link org.apache.xml.serializer.ToHTMLStream} derives from this to implement HTML serialization. {@link org.apache.xml.serializer.ToTextStream} implements plain text serialization. {@link org.apache.xml.serializer.ToXMLStream} implements XML serialization.

    XML mapping from characters to entity references is defined in XMLEntities.res. HTML entity reference mapping is defined in HTMLEntities.res.

    Encoding information is defined in {@link org.apache.xml.serializer.Encodings}.

    libxalan2-java-2.7.1/src/org/apache/xml/serializer/ExtendedLexicalHandler.java0000644000175000017500000000300010721374031026242 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtendedLexicalHandler.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import org.xml.sax.SAXException; /** * This interface has extensions to the standard SAX LexicalHandler interface. * This interface is intended to be used by a serializer. * @xsl.usage internal */ public interface ExtendedLexicalHandler extends org.xml.sax.ext.LexicalHandler { /** * This method is used to notify of a comment * @param comment the comment, but unlike the SAX comment() method this * method takes a String rather than a character array. * @throws SAXException */ public void comment(String comment) throws SAXException; } libxalan2-java-2.7.1/src/org/apache/xml/serializer/XSLOutputAttributes.java0000644000175000017500000002172110721374030025651 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLOutputAttributes.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.util.Vector; /** * This interface has methods associated with the XSLT xsl:output attribues * specified in the stylesheet that effect the format of the document output. * * In an XSLT stylesheet these attributes appear for example as: *
     *  
     * 
    * The xsl:output attributes covered in this interface are: *
     * version
     * encoding
     * omit-xml-declarations
     * standalone
     * doctype-public
     * doctype-system
     * cdata-section-elements
     * indent
     * media-type
     * 
    * * The one attribute not covered in this interface is method as * this value is implicitly chosen by the serializer that is created, for * example ToXMLStream vs. ToHTMLStream or another one. * * This interface is only used internally within Xalan. * * @xsl.usage internal */ interface XSLOutputAttributes { /** * Returns the previously set value of the value to be used as the public * identifier in the document type declaration (DTD). * *@return the public identifier to be used in the DOCTYPE declaration in the * output document. */ public String getDoctypePublic(); /** * Returns the previously set value of the value to be used * as the system identifier in the document type declaration (DTD). * @return the system identifier to be used in the DOCTYPE declaration in * the output document. * */ public String getDoctypeSystem(); /** * @return the character encoding to be used in the output document. */ public String getEncoding(); /** * @return true if the output document should be indented to visually * indicate its structure. */ public boolean getIndent(); /** * @return the number of spaces to indent for each indentation level. */ public int getIndentAmount(); /** * @return the mediatype the media-type or MIME type associated with the * output document. */ public String getMediaType(); /** * @return true if the XML declaration is to be omitted from the output * document. */ public boolean getOmitXMLDeclaration(); /** * @return a value of "yes" if the standalone delaration is to * be included in the output document. */ public String getStandalone(); /** * @return the version of the output format. */ public String getVersion(); /** * Sets the value coming from the xsl:output cdata-section-elements * stylesheet property. * * This sets the elements whose text elements are to be output as CDATA * sections. * @param URI_and_localNames pairs of namespace URI and local names that * identify elements whose text elements are to be output as CDATA sections. * The namespace of the local element must be the given URI to match. The * qName is not given because the prefix does not matter, only the namespace * URI to which that prefix would map matters, so the prefix itself is not * relevant in specifying which elements have their text to be output as * CDATA sections. */ public void setCdataSectionElements(Vector URI_and_localNames); /** Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties * @param system the system identifier to be used in the DOCTYPE declaration * in the output document. * @param pub the public identifier to be used in the DOCTYPE declaration in * the output document. */ public void setDoctype(String system, String pub); /** Set the value coming from the xsl:output doctype-public stylesheet attribute. * @param doctype the public identifier to be used in the DOCTYPE * declaration in the output document. */ public void setDoctypePublic(String doctype); /** Set the value coming from the xsl:output doctype-system stylesheet attribute. * @param doctype the system identifier to be used in the DOCTYPE * declaration in the output document. */ public void setDoctypeSystem(String doctype); /** * Sets the character encoding coming from the xsl:output encoding stylesheet attribute. * @param encoding the character encoding */ public void setEncoding(String encoding); /** * Sets the value coming from the xsl:output indent stylesheet * attribute. * @param indent true if the output document should be indented to visually * indicate its structure. */ public void setIndent(boolean indent); /** * Sets the value coming from the xsl:output media-type stylesheet attribute. * @param mediatype the media-type or MIME type associated with the output * document. */ public void setMediaType(String mediatype); /** * Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute * @param b true if the XML declaration is to be omitted from the output * document. */ public void setOmitXMLDeclaration(boolean b); /** * Sets the value coming from the xsl:output standalone stylesheet attribute. * @param standalone a value of "yes" indicates that the * standalone delaration is to be included in the output * document. */ public void setStandalone(String standalone); /** * Sets the value coming from the xsl:output version attribute. * @param version the version of the output format. */ public void setVersion(String version); /** * Get the value for a property that affects seraialization, * if a property was set return that value, otherwise return * the default value, otherwise return null. * @param name The name of the property, which is just the local name * if it is in no namespace, but is the URI in curly braces followed by * the local name if it is in a namespace, for example: *
      *
    • "encoding" *
    • "method" *
    • "{http://xml.apache.org/xalan}indent-amount" *
    • "{http://xml.apache.org/xalan}line-separator" *
    * @return The value of the parameter */ public String getOutputProperty(String name); /** * Get the default value for a property that affects seraialization, * or null if there is none. It is possible that a non-default value * was set for the property, however the value returned by this method * is unaffected by any non-default settings. * @param name The name of the property. * @return The default value of the parameter, or null if there is no default value. */ public String getOutputPropertyDefault(String name); /** * Set the non-default value for a property that affects seraialization. * @param name The name of the property, which is just the local name * if it is in no namespace, but is the URI in curly braces followed by * the local name if it is in a namespace, for example: *
      *
    • "encoding" *
    • "method" *
    • "{http://xml.apache.org/xalan}indent-amount" *
    • "{http://xml.apache.org/xalan}line-separator" *
    * @val The non-default value of the parameter */ public void setOutputProperty(String name, String val); /** * Set the default value for a property that affects seraialization. * @param name The name of the property, which is just the local name * if it is in no namespace, but is the URI in curly braces followed by * the local name if it is in a namespace, for example: *
      *
    • "encoding" *
    • "method" *
    • "{http://xml.apache.org/xalan}indent-amount" *
    • "{http://xml.apache.org/xalan}line-separator" *
    * @val The default value of the parameter */ public void setOutputPropertyDefault(String name, String val); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/EncodingInfo.java0000644000175000017500000005366710721374032024275 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EncodingInfo.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; /** * Holds information about a given encoding, which is the Java name for the * encoding, the equivalent ISO name. *

    * An object of this type has two useful methods *

     * isInEncoding(char ch);
     * 
    * which can be called if the character is not the high one in * a surrogate pair and: *
     * isInEncoding(char high, char low);
     * 
    * which can be called if the two characters from a high/low surrogate pair. *

    * An EncodingInfo object is a node in a binary search tree. Such a node * will answer if a character is in the encoding, and do so for a given * range of unicode values (m_first to * m_last). It will handle a certain range of values * explicitly (m_explFirst to m_explLast). * If the unicode point is before that explicit range, that is it * is in the range m_first <= value < m_explFirst, then it will delegate to another EncodingInfo object for The root * of such a tree, m_before. Likewise for values in the range * m_explLast < value <= m_last, but delgating to m_after *

    * Actually figuring out if a code point is in the encoding is expensive. So the * purpose of this tree is to cache such determinations, and not to build the * entire tree of information at the start, but only build up as much of the * tree as is used during the transformation. *

    * This Class is not a public API, and should only be used internally within * the serializer. *

    * This class is not a public API. * @xsl.usage internal */ public final class EncodingInfo extends Object { /** * Not all characters in an encoding are in on contiguous group, * however there is a lowest contiguous group starting at '\u0001' * and working up to m_highCharInContiguousGroup. *

    * This is the char for which chars at or below this value are * definately in the encoding, although for chars * above this point they might be in the encoding. * This exists for performance, especially for ASCII characters * because for ASCII all chars in the range '\u0001' to '\u007F' * are in the encoding. * */ private final char m_highCharInContiguousGroup; /** * The ISO encoding name. */ final String name; /** * The name used by the Java convertor. */ final String javaName; /** * A helper object that we can ask if a * single char, or a surrogate UTF-16 pair * of chars that form a single character, * is in this encoding. */ private InEncoding m_encoding; /** * This is not a public API. It returns true if the * char in question is in the encoding. * @param ch the char in question. *

    * This method is not a public API. * @xsl.usage internal */ public boolean isInEncoding(char ch) { if (m_encoding == null) { m_encoding = new EncodingImpl(); // One could put alternate logic in here to // instantiate another object that implements the // InEncoding interface. For example if the JRE is 1.4 or up // we could have an object that uses JRE 1.4 methods } return m_encoding.isInEncoding(ch); } /** * This is not a public API. It returns true if the * character formed by the high/low pair is in the encoding. * @param high a char that the a high char of a high/low surrogate pair. * @param low a char that is the low char of a high/low surrogate pair. *

    * This method is not a public API. * @xsl.usage internal */ public boolean isInEncoding(char high, char low) { if (m_encoding == null) { m_encoding = new EncodingImpl(); // One could put alternate logic in here to // instantiate another object that implements the // InEncoding interface. For example if the JRE is 1.4 or up // we could have an object that uses JRE 1.4 methods } return m_encoding.isInEncoding(high, low); } /** * Create an EncodingInfo object based on the ISO name and Java name. * If both parameters are null any character will be considered to * be in the encoding. This is useful for when the serializer is in * temporary output state, and has no assciated encoding. * * @param name reference to the ISO name. * @param javaName reference to the Java encoding name. * @param highChar The char for which characters at or below this value are * definately in the * encoding, although for characters above this point they might be in the encoding. */ public EncodingInfo(String name, String javaName, char highChar) { this.name = name; this.javaName = javaName; this.m_highCharInContiguousGroup = highChar; } /** * A simple interface to isolate the implementation. * We could also use some new JRE 1.4 methods in another implementation * provided we use reflection with them. *

    * This interface is not a public API, * and should only be used internally within the serializer. * @xsl.usage internal */ private interface InEncoding { /** * Returns true if the char is in the encoding */ public boolean isInEncoding(char ch); /** * Returns true if the high/low surrogate pair forms * a character that is in the encoding. */ public boolean isInEncoding(char high, char low); } /** * This class implements the */ private class EncodingImpl implements InEncoding { public boolean isInEncoding(char ch1) { final boolean ret; int codePoint = Encodings.toCodePoint(ch1); if (codePoint < m_explFirst) { // The unicode value is before the range // that we explictly manage, so we delegate the answer. // If we don't have an m_before object to delegate to, make one. if (m_before == null) m_before = new EncodingImpl( m_encoding, m_first, m_explFirst - 1, codePoint); ret = m_before.isInEncoding(ch1); } else if (m_explLast < codePoint) { // The unicode value is after the range // that we explictly manage, so we delegate the answer. // If we don't have an m_after object to delegate to, make one. if (m_after == null) m_after = new EncodingImpl( m_encoding, m_explLast + 1, m_last, codePoint); ret = m_after.isInEncoding(ch1); } else { // The unicode value is in the range we explitly handle final int idx = codePoint - m_explFirst; // If we already know the answer, just return it. if (m_alreadyKnown[idx]) ret = m_isInEncoding[idx]; else { // We don't know the answer, so find out, // which may be expensive, then cache the answer ret = inEncoding(ch1, m_encoding); m_alreadyKnown[idx] = true; m_isInEncoding[idx] = ret; } } return ret; } public boolean isInEncoding(char high, char low) { final boolean ret; int codePoint = Encodings.toCodePoint(high,low); if (codePoint < m_explFirst) { // The unicode value is before the range // that we explictly manage, so we delegate the answer. // If we don't have an m_before object to delegate to, make one. if (m_before == null) m_before = new EncodingImpl( m_encoding, m_first, m_explFirst - 1, codePoint); ret = m_before.isInEncoding(high,low); } else if (m_explLast < codePoint) { // The unicode value is after the range // that we explictly manage, so we delegate the answer. // If we don't have an m_after object to delegate to, make one. if (m_after == null) m_after = new EncodingImpl( m_encoding, m_explLast + 1, m_last, codePoint); ret = m_after.isInEncoding(high,low); } else { // The unicode value is in the range we explitly handle final int idx = codePoint - m_explFirst; // If we already know the answer, just return it. if (m_alreadyKnown[idx]) ret = m_isInEncoding[idx]; else { // We don't know the answer, so find out, // which may be expensive, then cache the answer ret = inEncoding(high, low, m_encoding); m_alreadyKnown[idx] = true; m_isInEncoding[idx] = ret; } } return ret; } /** * The encoding. */ final private String m_encoding; /** * m_first through m_last is the range of unicode * values that this object will return an answer on. * It may delegate to a similar object with a different * range */ final private int m_first; /** * m_explFirst through m_explLast is the range of unicode * value that this object handles explicitly and does not * delegate to a similar object. */ final private int m_explFirst; final private int m_explLast; final private int m_last; /** * The object, of the same type as this one, * that handles unicode values in a range before * the range explictly handled by this object, and * to which this object may delegate. */ private InEncoding m_before; /** * The object, of the same type as this one, * that handles unicode values in a range after * the range explictly handled by this object, and * to which this object may delegate. */ private InEncoding m_after; /** * The number of unicode values explicitly handled * by a single EncodingInfo object. This value is * tuneable, but is set to 128 because that covers the * entire low range of ASCII type chars within a single * object. */ private static final int RANGE = 128; /** * A flag to record if we already know the answer * for the given unicode value. */ final private boolean m_alreadyKnown[] = new boolean[RANGE]; /** * A table holding the answer on whether the given unicode * value is in the encoding. */ final private boolean m_isInEncoding[] = new boolean[RANGE]; private EncodingImpl() { // This object will answer whether any unicode value // is in the encoding, it handles values 0 through Integer.MAX_VALUE this(javaName, 0, Integer.MAX_VALUE, (char) 0); } private EncodingImpl(String encoding, int first, int last, int codePoint) { // Set the range of unicode values that this object manages // either explicitly or implicitly. m_first = first; m_last = last; // Set the range of unicode values that this object // explicitly manages m_explFirst = codePoint; m_explLast = codePoint + (RANGE-1); m_encoding = encoding; if (javaName != null) { // Some optimization. if (0 <= m_explFirst && m_explFirst <= 127) { // This particular EncodingImpl explicitly handles // characters in the low range. if ("UTF8".equals(javaName) || "UTF-16".equals(javaName) || "ASCII".equals(javaName) || "US-ASCII".equals(javaName) || "Unicode".equals(javaName) || "UNICODE".equals(javaName) || javaName.startsWith("ISO8859")) { // Not only does this EncodingImpl object explicitly // handle chracters in the low range, it is // also one that we know something about, without // needing to call inEncoding(char ch, String encoding) // for this low range // // By initializing the table ahead of time // for these low values, we prevent the expensive // inEncoding(char ch, String encoding) // from being called, at least for these common // encodings. for (int unicode = 1; unicode < 127; unicode++) { final int idx = unicode - m_explFirst; if (0 <= idx && idx < RANGE) { m_alreadyKnown[idx] = true; m_isInEncoding[idx] = true; } } } } /* A little bit more than optimization. * * We will say that any character is in the encoding if * we don't have an encoding. * This is meaningful when the serializer is being used * in temporary output state, where we are not writing to * the final output tree. It is when writing to the * final output tree that we need to worry about the output * encoding */ if (javaName == null) { for (int idx = 0; idx < m_alreadyKnown.length; idx++) { m_alreadyKnown[idx] = true; m_isInEncoding[idx] = true; } } } } } /** * This is heart of the code that determines if a given character * is in the given encoding. This method is probably expensive, * and the answer should be cached. *

    * This method is not a public API, * and should only be used internally within the serializer. * @param ch the char in question, that is not a high char of * a high/low surrogate pair. * @param encoding the Java name of the enocding. * * @xsl.usage internal * */ private static boolean inEncoding(char ch, String encoding) { boolean isInEncoding; try { char cArray[] = new char[1]; cArray[0] = ch; // Construct a String from the char String s = new String(cArray); // Encode the String into a sequence of bytes // using the given, named charset. byte[] bArray = s.getBytes(encoding); isInEncoding = inEncoding(ch, bArray); } catch (Exception e) { isInEncoding = false; // If for some reason the encoding is null, e.g. // for a temporary result tree, we should just // say that every character is in the encoding. if (encoding == null) isInEncoding = true; } return isInEncoding; } /** * This is heart of the code that determines if a given high/low * surrogate pair forms a character that is in the given encoding. * This method is probably expensive, and the answer should be cached. *

    * This method is not a public API, * and should only be used internally within the serializer. * @param high the high char of * a high/low surrogate pair. * @param low the low char of a high/low surrogate pair. * @param encoding the Java name of the encoding. * * @xsl.usage internal * */ private static boolean inEncoding(char high, char low, String encoding) { boolean isInEncoding; try { char cArray[] = new char[2]; cArray[0] = high; cArray[1] = low; // Construct a String from the char String s = new String(cArray); // Encode the String into a sequence of bytes // using the given, named charset. byte[] bArray = s.getBytes(encoding); isInEncoding = inEncoding(high,bArray); } catch (Exception e) { isInEncoding = false; } return isInEncoding; } /** * This method is the core of determining if character * is in the encoding. The method is not foolproof, because * s.getBytes(encoding) has specified behavior only if the * characters are in the specified encoding. However this * method tries it's best. * @param ch the char that was converted using getBytes, or * the first char of a high/low pair that was converted. * @param data the bytes written out by the call to s.getBytes(encoding); * @return true if the character is in the encoding. */ private static boolean inEncoding(char ch, byte[] data) { final boolean isInEncoding; // If the string written out as data is not in the encoding, // the output is not specified according to the documentation // on the String.getBytes(encoding) method, // but we do our best here. if (data==null || data.length == 0) { isInEncoding = false; } else { if (data[0] == 0) isInEncoding = false; else if (data[0] == '?' && ch != '?') isInEncoding = false; /* * else if (isJapanese) { * // isJapanese is really * // ( "EUC-JP".equals(javaName) * // || "EUC_JP".equals(javaName) * // || "SJIS".equals(javaName) ) * * // Work around some bugs in JRE for Japanese * if(data[0] == 0x21) * isInEncoding = false; * else if (ch == 0xA5) * isInEncoding = false; * else * isInEncoding = true; * } */ else { // We don't know for sure, but it looks like it is in the encoding isInEncoding = true; } } return isInEncoding; } /** * This method exists for performance reasons. *

    * Except for '\u0000', if a char is less than or equal to the value * returned by this method then it in the encoding. *

    * The characters in an encoding are not contiguous, however * there is a lowest group of chars starting at '\u0001' upto and * including the char returned by this method that are all in the encoding. * So the char returned by this method essentially defines the lowest * contiguous group. *

    * chars above the value returned might be in the encoding, but * chars at or below the value returned are definately in the encoding. *

    * In any case however, the isInEncoding(char) method can be used * regardless of the value of the char returned by this method. *

    * If the value returned is '\u0000' it means that every character must be tested * with an isInEncoding method {@link #isInEncoding(char)} or {@link #isInEncoding(char, char)} * for surrogate pairs. *

    * This method is not a public API. * @xsl.usage internal */ public final char getHighChar() { return m_highCharInContiguousGroup; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/SerializerBase.java0000644000175000017500000015506410721374033024632 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerBase.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.util.HashMap; import java.util.Set; import javax.xml.transform.OutputKeys; import javax.xml.transform.SourceLocator; import javax.xml.transform.Transformer; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * This class acts as a base class for the XML "serializers" * and the stream serializers. * It contains a number of common fields and methods. * * @xsl.usage internal */ public abstract class SerializerBase implements SerializationHandler, SerializerConstants { SerializerBase() { return; } /** * The name of the package that this class is in. *

    * Not a public API. */ public static final String PKG_NAME; /** * The same as the name of the package that this class is in * except that '.' are replaced with '/'. *

    * Not a public API. */ public static final String PKG_PATH; static { String fullyQualifiedName = SerializerBase.class.getName(); int lastDot = fullyQualifiedName.lastIndexOf('.'); if (lastDot < 0) { PKG_NAME = ""; } else { PKG_NAME = fullyQualifiedName.substring(0, lastDot); } StringBuffer sb = new StringBuffer(); for (int i = 0; i < PKG_NAME.length(); i++) { char ch = PKG_NAME.charAt(i); if (ch == '.') sb.append('/'); else sb.append(ch); } PKG_PATH = sb.toString(); } /** * To fire off the end element trace event * @param name Name of element */ protected void fireEndElem(String name) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDELEMENT,name, (Attributes)null); } } /** * Report the characters trace event * @param chars content of characters * @param start starting index of characters to output * @param length number of characters to output */ protected void fireCharEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CHARACTERS, chars, start,length); } } /** * true if we still need to call startDocumentInternal() */ protected boolean m_needToCallStartDocument = true; /** True if a trailing "]]>" still needs to be written to be * written out. Used to merge adjacent CDATA sections */ protected boolean m_cdataTagOpen = false; /** * All the attributes of the current element, collected from * startPrefixMapping() calls, or addAddtribute() calls, or * from the SAX attributes in a startElement() call. */ protected AttributesImplSerializer m_attributes = new AttributesImplSerializer(); /** * Tells if we're in an EntityRef event. */ protected boolean m_inEntityRef = false; /** This flag is set while receiving events from the external DTD */ protected boolean m_inExternalDTD = false; /** * The System ID for the doc type. */ protected String m_doctypeSystem; /** * The public ID for the doc type. */ protected String m_doctypePublic; /** * Flag to tell that we need to add the doctype decl, which we can't do * until the first element is encountered. */ boolean m_needToOutputDocTypeDecl = true; /** * Tells if we should write the XML declaration. */ protected boolean m_shouldNotWriteXMLHeader = false; /** * The standalone value for the doctype. */ private String m_standalone; /** * True if standalone was specified. */ protected boolean m_standaloneWasSpecified = false; /** * Flag to tell if indenting (pretty-printing) is on. */ protected boolean m_doIndent = false; /** * Amount to indent. */ protected int m_indentAmount = 0; /** * Tells the XML version, for writing out to the XML decl. */ protected String m_version = null; /** * The mediatype. Not used right now. */ protected String m_mediatype; /** * The transformer that was around when this output handler was created (if * any). */ private Transformer m_transformer; /** * Namespace support, that keeps track of currently defined * prefix/uri mappings. As processed elements come and go, so do * the associated mappings for that element. */ protected NamespaceMappings m_prefixMap; /** * Handle for firing generate events. This interface may be implemented * by the referenced transformer object. */ protected SerializerTrace m_tracer; protected SourceLocator m_sourceLocator; /** * The writer to send output to. This field is only used in the ToStream * serializers, but exists here just so that the fireStartDoc() and * other fire... methods can flush this writer when tracing. */ protected java.io.Writer m_writer = null; /** * A reference to "stack frame" corresponding to * the current element. Such a frame is pushed at a startElement() * and popped at an endElement(). This frame contains information about * the element, such as its namespace URI. */ protected ElemContext m_elemContext = new ElemContext(); /** * A utility buffer for converting Strings passed to * character() methods to character arrays. * Reusing this buffer means not creating a new character array * everytime and it runs faster. */ protected char[] m_charsBuff = new char[60]; /** * A utility buffer for converting Strings passed to * attribute methods to character arrays. * Reusing this buffer means not creating a new character array * everytime and it runs faster. */ protected char[] m_attrBuff = new char[30]; /** * Receive notification of a comment. * * @see ExtendedLexicalHandler#comment(String) */ public void comment(String data) throws SAXException { m_docIsEmpty = false; final int length = data.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length * 2 + 1]; } data.getChars(0, length, m_charsBuff, 0); comment(m_charsBuff, 0, length); } /** * If at runtime, when the qname of the attribute is * known, another prefix is specified for the attribute, then we can * patch or hack the name with this method. For * a qname of the form "ns?:otherprefix:name", this function patches the * qname by simply ignoring "otherprefix". * TODO: This method is a HACK! We do not have access to the * XML file, it sometimes generates a NS prefix of the form "ns?" for * an attribute. */ protected String patchName(String qname) { final int lastColon = qname.lastIndexOf(':'); if (lastColon > 0) { final int firstColon = qname.indexOf(':'); final String prefix = qname.substring(0, firstColon); final String localName = qname.substring(lastColon + 1); // If uri is "" then ignore prefix final String uri = m_prefixMap.lookupNamespace(prefix); if (uri != null && uri.length() == 0) { return localName; } else if (firstColon != lastColon) { return prefix + ':' + localName; } } return qname; } /** * Returns the local name of a qualified name. If the name has no prefix, * then it works as the identity (SAX2). * @param qname the qualified name * @return the name, but excluding any prefix and colon. */ protected static String getLocalName(String qname) { final int col = qname.lastIndexOf(':'); return (col > 0) ? qname.substring(col + 1) : qname; } /** * Receive an object for locating the origin of SAX document events. * * @param locator An object that can return the location of any SAX document * event. * * Receive an object for locating the origin of SAX document events. * *

    SAX parsers are strongly encouraged (though not absolutely * required) to supply a locator: if it does so, it must supply * the locator to the application by invoking this method before * invoking any of the other methods in the DocumentHandler * interface.

    * *

    The locator allows the application to determine the end * position of any document-related event, even if the parser is * not reporting an error. Typically, the application will * use this information for reporting its own errors (such as * character content that does not match an application's * business rules). The information returned by the locator * is probably not sufficient for use with a search engine.

    * *

    Note that the locator will return correct information only * during the invocation of the events in this interface. The * application should not attempt to use it at any other time.

    */ public void setDocumentLocator(Locator locator) { return; // I don't do anything with this yet. } /** * Adds the given attribute to the set of collected attributes , but only if * there is a currently open element. * * An element is currently open if a startElement() notification has * occured but the start of the element has not yet been written to the * output. In the stream case this means that we have not yet been forced * to close the elements opening tag by another notification, such as a * character notification. * * @param uri the URI of the attribute * @param localName the local name of the attribute * @param rawName the qualified name of the attribute * @param type the type of the attribute (probably CDATA) * @param value the value of the attribute * @param XSLAttribute true if this attribute is coming from an xsl:attriute element * @see ExtendedContentHandler#addAttribute(String, String, String, String, String) */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException { if (m_elemContext.m_startTagOpen) { addAttributeAlways(uri, localName, rawName, type, value, XSLAttribute); } } /** * Adds the given attribute to the set of attributes, even if there is * no currently open element. This is useful if a SAX startPrefixMapping() * should need to add an attribute before the element name is seen. * * @param uri the URI of the attribute * @param localName the local name of the attribute * @param rawName the qualified name of the attribute * @param type the type of the attribute (probably CDATA) * @param value the value of the attribute * @param XSLAttribute true if this attribute is coming from an xsl:attribute element * @return true if the attribute was added, * false if an existing value was replaced. */ public boolean addAttributeAlways( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) { boolean was_added; // final int index = // (localName == null || uri == null) ? // m_attributes.getIndex(rawName):m_attributes.getIndex(uri, localName); int index; // if (localName == null || uri == null){ // index = m_attributes.getIndex(rawName); // } // else { // index = m_attributes.getIndex(uri, localName); // } if (localName == null || uri == null || uri.length() == 0) index = m_attributes.getIndex(rawName); else { index = m_attributes.getIndex(uri,localName); } if (index >= 0) { /* We've seen the attribute before. * We may have a null uri or localName, but all * we really want to re-set is the value anyway. */ m_attributes.setValue(index,value); was_added = false; } else { // the attribute doesn't exist yet, create it m_attributes.addAttribute(uri, localName, rawName, type, value); was_added = true; } return was_added; } /** * Adds the given attribute to the set of collected attributes, * but only if there is a currently open element. * * @param name the attribute's qualified name * @param value the value of the attribute */ public void addAttribute(String name, final String value) { if (m_elemContext.m_startTagOpen) { final String patchedName = patchName(name); final String localName = getLocalName(patchedName); final String uri = getNamespaceURI(patchedName, false); addAttributeAlways(uri,localName, patchedName, "CDATA", value, false); } } /** * Adds the given xsl:attribute to the set of collected attributes, * but only if there is a currently open element. * * @param name the attribute's qualified name (prefix:localName) * @param value the value of the attribute * @param uri the URI that the prefix of the name points to */ public void addXSLAttribute(String name, final String value, final String uri) { if (m_elemContext.m_startTagOpen) { final String patchedName = patchName(name); final String localName = getLocalName(patchedName); addAttributeAlways(uri,localName, patchedName, "CDATA", value, true); } } /** * Add the given attributes to the currently collected ones. These * attributes are always added, regardless of whether on not an element * is currently open. * @param atts List of attributes to add to this list */ public void addAttributes(Attributes atts) throws SAXException { int nAtts = atts.getLength(); for (int i = 0; i < nAtts; i++) { String uri = atts.getURI(i); if (null == uri) uri = ""; addAttributeAlways( uri, atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i), false); } } /** * Return a {@link ContentHandler} interface into this serializer. * If the serializer does not support the {@link ContentHandler} * interface, it should return null. * * @return A {@link ContentHandler} interface into this serializer, * or null if the serializer is not SAX 2 capable * @throws IOException An I/O exception occured */ public ContentHandler asContentHandler() throws IOException { return this; } /** * Report the end of an entity. * * @param name The name of the entity that is ending. * @throws org.xml.sax.SAXException The application may raise an exception. * @see #startEntity */ public void endEntity(String name) throws org.xml.sax.SAXException { if (name.equals("[dtd]")) m_inExternalDTD = false; m_inEntityRef = false; if (m_tracer != null) this.fireEndEntity(name); } /** * Flush and close the underlying java.io.Writer. This method applies to * ToStream serializers, not ToSAXHandler serializers. * @see ToStream */ public void close() { // do nothing (base behavior) } /** * Initialize global variables */ protected void initCDATA() { // CDATA stack // _cdataStack = new Stack(); // _cdataStack.push(new Integer(-1)); // push dummy value } /** * Returns the character encoding to be used in the output document. * @return the character encoding to be used in the output document. */ public String getEncoding() { return getOutputProperty(OutputKeys.ENCODING); } /** * Sets the character encoding coming from the xsl:output encoding stylesheet attribute. * @param m_encoding the character encoding */ public void setEncoding(String encoding) { setOutputProperty(OutputKeys.ENCODING,encoding); } /** * Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute * @param b true if the XML declaration is to be omitted from the output * document. */ public void setOmitXMLDeclaration(boolean b) { String val = b ? "yes":"no"; setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,val); } /** * @return true if the XML declaration is to be omitted from the output * document. */ public boolean getOmitXMLDeclaration() { return m_shouldNotWriteXMLHeader; } /** * Returns the previously set value of the value to be used as the public * identifier in the document type declaration (DTD). * *@return the public identifier to be used in the DOCTYPE declaration in the * output document. */ public String getDoctypePublic() { return m_doctypePublic; } /** Set the value coming from the xsl:output doctype-public stylesheet attribute. * @param doctypePublic the public identifier to be used in the DOCTYPE * declaration in the output document. */ public void setDoctypePublic(String doctypePublic) { setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic); } /** * Returns the previously set value of the value to be used * as the system identifier in the document type declaration (DTD). * @return the system identifier to be used in the DOCTYPE declaration in * the output document. * */ public String getDoctypeSystem() { return m_doctypeSystem; } /** Set the value coming from the xsl:output doctype-system stylesheet attribute. * @param doctypeSystem the system identifier to be used in the DOCTYPE * declaration in the output document. */ public void setDoctypeSystem(String doctypeSystem) { setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem); } /** Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties * @param doctypeSystem the system identifier to be used in the DOCTYPE * declaration in the output document. * @param doctypePublic the public identifier to be used in the DOCTYPE * declaration in the output document. */ public void setDoctype(String doctypeSystem, String doctypePublic) { setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem); setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic); } /** * Sets the value coming from the xsl:output standalone stylesheet attribute. * @param standalone a value of "yes" indicates that the * standalone delaration is to be included in the output * document. This method remembers if the value was explicitly set using * this method, verses if the value is the default value. */ public void setStandalone(String standalone) { setOutputProperty(OutputKeys.STANDALONE, standalone); } /** * Sets the XSL standalone attribute, but does not remember if this is a * default or explicite setting. * @param standalone "yes" | "no" */ protected void setStandaloneInternal(String standalone) { if ("yes".equals(standalone)) m_standalone = "yes"; else m_standalone = "no"; } /** * Gets the XSL standalone attribute * @return a value of "yes" if the standalone delaration is to * be included in the output document. * @see XSLOutputAttributes#getStandalone() */ public String getStandalone() { return m_standalone; } /** * @return true if the output document should be indented to visually * indicate its structure. */ public boolean getIndent() { return m_doIndent; } /** * Gets the mediatype the media-type or MIME type associated with the output * document. * @return the mediatype the media-type or MIME type associated with the * output document. */ public String getMediaType() { return m_mediatype; } /** * Gets the version of the output format. * @return the version of the output format. */ public String getVersion() { return m_version; } /** * Sets the value coming from the xsl:output version attribute. * @param version the version of the output format. * @see SerializationHandler#setVersion(String) */ public void setVersion(String version) { setOutputProperty(OutputKeys.VERSION, version); } /** * Sets the value coming from the xsl:output media-type stylesheet attribute. * @param mediaType the non-null media-type or MIME type associated with the * output document. * @see javax.xml.transform.OutputKeys#MEDIA_TYPE * @see SerializationHandler#setMediaType(String) */ public void setMediaType(String mediaType) { setOutputProperty(OutputKeys.MEDIA_TYPE,mediaType); } /** * @return the number of spaces to indent for each indentation level. */ public int getIndentAmount() { return m_indentAmount; } /** * Sets the indentation amount. * @param m_indentAmount The m_indentAmount to set */ public void setIndentAmount(int m_indentAmount) { this.m_indentAmount = m_indentAmount; } /** * Sets the value coming from the xsl:output indent stylesheet * attribute. * @param doIndent true if the output document should be indented to * visually indicate its structure. * @see XSLOutputAttributes#setIndent(boolean) */ public void setIndent(boolean doIndent) { String val = doIndent ? "yes":"no"; setOutputProperty(OutputKeys.INDENT,val); } /** * This method is used when a prefix/uri namespace mapping * is indicated after the element was started with a * startElement() and before and endElement(). * startPrefixMapping(prefix,uri) would be used before the * startElement() call. * @param uri the URI of the namespace * @param prefix the prefix associated with the given URI. * * @see ExtendedContentHandler#namespaceAfterStartElement(String, String) */ public void namespaceAfterStartElement(String uri, String prefix) throws SAXException { // default behavior is to do nothing } /** * Return a {@link DOMSerializer} interface into this serializer. If the * serializer does not support the {@link DOMSerializer} interface, it should * return null. * * @return A {@link DOMSerializer} interface into this serializer, or null * if the serializer is not DOM capable * @throws IOException An I/O exception occured * @see Serializer#asDOMSerializer() */ public DOMSerializer asDOMSerializer() throws IOException { return this; } /** * Tell if two strings are equal, without worry if the first string is null. * * @param p String reference, which may be null. * @param t String reference, which may be null. * * @return true if strings are equal. */ private static final boolean subPartMatch(String p, String t) { return (p == t) || ((null != p) && (p.equals(t))); } /** * Returns the local name of a qualified name. * If the name has no prefix, * then it works as the identity (SAX2). * * @param qname a qualified name * @return returns the prefix of the qualified name, * or null if there is no prefix. */ protected static final String getPrefixPart(String qname) { final int col = qname.indexOf(':'); return (col > 0) ? qname.substring(0, col) : null; //return (col > 0) ? qname.substring(0,col) : ""; } /** * Some users of the serializer may need the current namespace mappings * @return the current namespace mappings (prefix/uri) * @see ExtendedContentHandler#getNamespaceMappings() */ public NamespaceMappings getNamespaceMappings() { return m_prefixMap; } /** * Returns the prefix currently pointing to the given URI (if any). * @param namespaceURI the uri of the namespace in question * @return a prefix pointing to the given URI (if any). * @see ExtendedContentHandler#getPrefix(String) */ public String getPrefix(String namespaceURI) { String prefix = m_prefixMap.lookupPrefix(namespaceURI); return prefix; } /** * Returns the URI of an element or attribute. Note that default namespaces * do not apply directly to attributes. * @param qname a qualified name * @param isElement true if the qualified name is the name of * an element. * @return returns the namespace URI associated with the qualified name. */ public String getNamespaceURI(String qname, boolean isElement) { String uri = EMPTYSTRING; int col = qname.lastIndexOf(':'); final String prefix = (col > 0) ? qname.substring(0, col) : EMPTYSTRING; if (!EMPTYSTRING.equals(prefix) || isElement) { if (m_prefixMap != null) { uri = m_prefixMap.lookupNamespace(prefix); if (uri == null && !prefix.equals(XMLNS_PREFIX)) { throw new RuntimeException( Utils.messages.createMessage( MsgKey.ER_NAMESPACE_PREFIX, new Object[] { qname.substring(0, col) } )); } } } return uri; } /** * Returns the URI of prefix (if any) * * @param prefix the prefix whose URI is searched for * @return the namespace URI currently associated with the * prefix, null if the prefix is undefined. */ public String getNamespaceURIFromPrefix(String prefix) { String uri = null; if (m_prefixMap != null) uri = m_prefixMap.lookupNamespace(prefix); return uri; } /** * Entity reference event. * * @param name Name of entity * * @throws org.xml.sax.SAXException */ public void entityReference(String name) throws org.xml.sax.SAXException { flushPending(); startEntity(name); endEntity(name); if (m_tracer != null) fireEntityReference(name); } /** * Sets the transformer associated with this serializer * @param t the transformer associated with this serializer. * @see SerializationHandler#setTransformer(Transformer) */ public void setTransformer(Transformer t) { m_transformer = t; // If this transformer object implements the SerializerTrace interface // then assign m_tracer to the transformer object so it can be used // to fire trace events. if ((m_transformer instanceof SerializerTrace) && (((SerializerTrace) m_transformer).hasTraceListeners())) { m_tracer = (SerializerTrace) m_transformer; } else { m_tracer = null; } } /** * Gets the transformer associated with this serializer * @return returns the transformer associated with this serializer. * @see SerializationHandler#getTransformer() */ public Transformer getTransformer() { return m_transformer; } /** * This method gets the nodes value as a String and uses that String as if * it were an input character notification. * @param node the Node to serialize * @throws org.xml.sax.SAXException */ public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException { flushPending(); String data = node.getNodeValue(); if (data != null) { final int length = data.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length * 2 + 1]; } data.getChars(0, length, m_charsBuff, 0); characters(m_charsBuff, 0, length); } } /** * @see org.xml.sax.ErrorHandler#error(SAXParseException) */ public void error(SAXParseException exc) throws SAXException { } /** * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) */ public void fatalError(SAXParseException exc) throws SAXException { m_elemContext.m_startTagOpen = false; } /** * @see org.xml.sax.ErrorHandler#warning(SAXParseException) */ public void warning(SAXParseException exc) throws SAXException { } /** * To fire off start entity trace event * @param name Name of entity */ protected void fireStartEntity(String name) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENTITYREF, name); } } /** * Report the characters event * @param chars content of characters * @param start starting index of characters to output * @param length number of characters to output */ // protected void fireCharEvent(char[] chars, int start, int length) // throws org.xml.sax.SAXException // { // if (m_tracer != null) // m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CHARACTERS, chars, start,length); // } // /** * This method is only used internally when flushing the writer from the * various fire...() trace events. Due to the writer being wrapped with * SerializerTraceWriter it may cause the flush of these trace events: * EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS * EVENTTYPE_OUTPUT_CHARACTERS * which trace the output written to the output stream. * */ private void flushMyWriter() { if (m_writer != null) { try { m_writer.flush(); } catch(IOException ioe) { } } } /** * Report the CDATA trace event * @param chars content of CDATA * @param start starting index of characters to output * @param length number of characters to output */ protected void fireCDATAEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CDATA, chars, start,length); } } /** * Report the comment trace event * @param chars content of comment * @param start starting index of comment to output * @param length number of characters to output */ protected void fireCommentEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_COMMENT, new String(chars, start, length)); } } /** * To fire off end entity trace event * @param name Name of entity */ public void fireEndEntity(String name) throws org.xml.sax.SAXException { if (m_tracer != null) flushMyWriter(); // we do not need to handle this. } /** * To fire off start document trace event */ protected void fireStartDoc() throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTDOCUMENT); } } /** * To fire off end document trace event */ protected void fireEndDoc() throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDDOCUMENT); } } /** * Report the start element trace event. This trace method needs to be * called just before the attributes are cleared. * * @param elemName the qualified name of the element * */ protected void fireStartElem(String elemName) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTELEMENT, elemName, m_attributes); } } /** * To fire off the end element event * @param name Name of element */ // protected void fireEndElem(String name) // throws org.xml.sax.SAXException // { // if (m_tracer != null) // m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDELEMENT,name, (Attributes)null); // } /** * To fire off the PI trace event * @param name Name of PI */ protected void fireEscapingEvent(String name, String data) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_PI,name, data); } } /** * To fire off the entity reference trace event * @param name Name of entity reference */ protected void fireEntityReference(String name) throws org.xml.sax.SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENTITYREF,name, (Attributes)null); } } /** * Receive notification of the beginning of a document. * This method is never a self generated call, * but only called externally. * *

    The SAX parser will invoke this method only once, before any * other methods in this interface or in DTDHandler (except for * setDocumentLocator).

    * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void startDocument() throws org.xml.sax.SAXException { // if we do get called with startDocument(), handle it right away startDocumentInternal(); m_needToCallStartDocument = false; return; } /** * This method handles what needs to be done at a startDocument() call, * whether from an external caller, or internally called in the * serializer. For historical reasons the serializer is flexible to * startDocument() not always being called. * Even if no external call is * made into startDocument() this method will always be called as a self * generated internal startDocument, it handles what needs to be done at a * startDocument() call. * * This method exists just to make sure that startDocument() is only ever * called from an external caller, which in principle is just a matter of * style. * * @throws SAXException */ protected void startDocumentInternal() throws org.xml.sax.SAXException { if (m_tracer != null) this.fireStartDoc(); } /** * This method is used to set the source locator, which might be used to * generated an error message. * @param locator the source locator * * @see ExtendedContentHandler#setSourceLocator(javax.xml.transform.SourceLocator) */ public void setSourceLocator(SourceLocator locator) { m_sourceLocator = locator; } /** * Used only by TransformerSnapshotImpl to restore the serialization * to a previous state. * * @param mappings NamespaceMappings */ public void setNamespaceMappings(NamespaceMappings mappings) { m_prefixMap = mappings; } public boolean reset() { resetSerializerBase(); return true; } /** * Reset all of the fields owned by SerializerBase * */ private void resetSerializerBase() { this.m_attributes.clear(); this.m_CdataElems = null; this.m_cdataTagOpen = false; this.m_docIsEmpty = true; this.m_doctypePublic = null; this.m_doctypeSystem = null; this.m_doIndent = false; this.m_elemContext = new ElemContext(); this.m_indentAmount = 0; this.m_inEntityRef = false; this.m_inExternalDTD = false; this.m_mediatype = null; this.m_needToCallStartDocument = true; this.m_needToOutputDocTypeDecl = false; if (m_OutputProps != null) this.m_OutputProps.clear(); if (m_OutputPropsDefault != null) this.m_OutputPropsDefault.clear(); if (this.m_prefixMap != null) this.m_prefixMap.reset(); this.m_shouldNotWriteXMLHeader = false; this.m_sourceLocator = null; this.m_standalone = null; this.m_standaloneWasSpecified = false; this.m_StringOfCDATASections = null; this.m_tracer = null; this.m_transformer = null; this.m_version = null; // don't set writer to null, so that it might be re-used //this.m_writer = null; } /** * Returns true if the serializer is used for temporary output rather than * final output. * * This concept is made clear in the XSLT 2.0 draft. */ final boolean inTemporaryOutputState() { /* This is a hack. We should really be letting the serializer know * that it is in temporary output state with an explicit call, but * from a pragmatic point of view (for now anyways) having no output * encoding at all, not even the default UTF-8 indicates that the serializer * is being used for temporary RTF. */ return (getEncoding() == null); } /** * This method adds an attribute the the current element, * but should not be used for an xsl:attribute child. * @see ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException { if (m_elemContext.m_startTagOpen) { addAttributeAlways(uri, localName, rawName, type, value, false); } } /** * @see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String) */ public void notationDecl(String arg0, String arg1, String arg2) throws SAXException { // This method just provides a definition to satisfy the interface // A particular sub-class of SerializerBase provides the implementation (if desired) } /** * @see org.xml.sax.DTDHandler#unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public void unparsedEntityDecl( String arg0, String arg1, String arg2, String arg3) throws SAXException { // This method just provides a definition to satisfy the interface // A particular sub-class of SerializerBase provides the implementation (if desired) } /** * If set to false the serializer does not expand DTD entities, * but leaves them as is, the default value is true. */ public void setDTDEntityExpansion(boolean expand) { // This method just provides a definition to satisfy the interface // A particular sub-class of SerializerBase provides the implementation (if desired) } /** * The CDATA section names stored in a whitespace separateed list with * each element being a word of the form "{uri}localName" This list * comes from the cdata-section-elements attribute. * * This field replaces m_cdataSectionElements Vector. */ protected String m_StringOfCDATASections = null; boolean m_docIsEmpty = true; void initCdataElems(String s) { if (s != null) { int max = s.length(); // true if we are in the middle of a pair of curly braces that delimit a URI boolean inCurly = false; // true if we found a URI but haven't yet processed the local name boolean foundURI = false; StringBuffer buf = new StringBuffer(); String uri = null; String localName = null; // parse through string, breaking on whitespaces. I do this instead // of a tokenizer so I can track whitespace inside of curly brackets, // which theoretically shouldn't happen if they contain legal URLs. for (int i = 0; i < max; i++) { char c = s.charAt(i); if (Character.isWhitespace(c)) { if (!inCurly) { if (buf.length() > 0) { localName = buf.toString(); if (!foundURI) uri = ""; addCDATAElement(uri,localName); buf.setLength(0); foundURI = false; } continue; } else buf.append(c); // add whitespace to the URI } else if ('{' == c) // starting a URI inCurly = true; else if ('}' == c) { // we just ended a URI, add the URI to the vector foundURI = true; uri = buf.toString(); buf.setLength(0); inCurly = false; } else { // append non-whitespace, non-curly to current URI or localName being gathered. buf.append(c); } } if (buf.length() > 0) { // We have one last localName to process. localName = buf.toString(); if (!foundURI) uri = ""; addCDATAElement(uri,localName); } } } protected java.util.Hashtable m_CdataElems = null; private void addCDATAElement(String uri, String localName) { if (m_CdataElems == null) { m_CdataElems = new java.util.Hashtable(); } java.util.Hashtable h = (java.util.Hashtable) m_CdataElems.get(localName); if (h == null) { h = new java.util.Hashtable(); m_CdataElems.put(localName,h); } h.put(uri,uri); } /** * Return true if nothing has been sent to this result tree yet. *

    * This is not a public API. * * @xsl.usage internal */ public boolean documentIsEmpty() { // If we haven't called startDocument() yet, then this document is empty return m_docIsEmpty && (m_elemContext.m_currentElemDepth == 0); } /** * Return true if the current element in m_elemContext * is a CDATA section. * CDATA sections are specified in the attribute * cdata-section-names or in the JAXP equivalent property. * In any case the format of the value of such a property is: *

         * "{uri1}localName1 {uri2}localName2 . . . "
         * 
    * *

    * This method is not a public API, but is only used internally by the serializer. */ protected boolean isCdataSection() { boolean b = false; if (null != m_StringOfCDATASections) { if (m_elemContext.m_elementLocalName == null) { String localName = getLocalName(m_elemContext.m_elementName); m_elemContext.m_elementLocalName = localName; } if ( m_elemContext.m_elementURI == null) { m_elemContext.m_elementURI = getElementURI(); } else if ( m_elemContext.m_elementURI.length() == 0) { if ( m_elemContext.m_elementName == null) { m_elemContext.m_elementName = m_elemContext.m_elementLocalName; // leave URI as "", meaning in no namespace } else if (m_elemContext.m_elementLocalName.length() < m_elemContext.m_elementName.length()){ // We were told the URI was "", yet the name has a prefix since the name is longer than the localname. // So we will fix that incorrect information here. m_elemContext.m_elementURI = getElementURI(); } } java.util.Hashtable h = (java.util.Hashtable) m_CdataElems.get(m_elemContext.m_elementLocalName); if (h != null) { Object obj = h.get(m_elemContext.m_elementURI); if (obj != null) b = true; } } return b; } /** * Before this call m_elementContext.m_elementURI is null, * which means it is not yet known. After this call it * is non-null, but possibly "" meaning that it is in the * default namespace. * * @return The URI of the element, never null, but possibly "". */ private String getElementURI() { String uri = null; // At this point in processing we have received all the // namespace mappings // As we still don't know the elements namespace, // we now figure it out. String prefix = getPrefixPart(m_elemContext.m_elementName); if (prefix == null) { // no prefix so lookup the URI of the default namespace uri = m_prefixMap.lookupNamespace(""); } else { uri = m_prefixMap.lookupNamespace(prefix); } if (uri == null) { // We didn't find the namespace for the // prefix ... ouch, that shouldn't happen. // This is a hack, we really don't know // the namespace uri = EMPTYSTRING; } return uri; } /** * Get the value of an output property, * the explicit value, if any, otherwise the * default value, if any, otherwise null. */ public String getOutputProperty(String name) { String val = getOutputPropertyNonDefault(name); // If no explicit value, try to get the default value if (val == null) val = getOutputPropertyDefault(name); return val; } /** * Get the value of an output property, * not the default value. If there is a default * value, but no non-default value this method * will return null. *

    * */ public String getOutputPropertyNonDefault(String name ) { return getProp(name,false); } /** * Return a {@link DOM3Serializer} interface into this serializer. If the * serializer does not support the {@link DOM3Serializer} interface, it should * return null. * * @return A {@link DOM3Serializer} interface into this serializer, or null * if the serializer is not DOM capable * @throws IOException An I/O exception occured * @see org.apache.xml.serializer.Serializer#asDOM3Serializer() */ public Object asDOM3Serializer() throws IOException { return new org.apache.xml.serializer.dom3.DOM3SerializerImpl(this); } /** * Get the default value of an xsl:output property, * which would be null only if no default value exists * for the property. */ public String getOutputPropertyDefault(String name) { return getProp(name, true); } /** * Set the value for the output property, typically from * an xsl:output element, but this does not change what * the default value is. */ public void setOutputProperty(String name, String val) { setProp(name,val,false); } /** * Set the default value for an output property, but this does * not impact any explicitly set value. */ public void setOutputPropertyDefault(String name, String val) { setProp(name,val,true); } /** * A mapping of keys to explicitly set values, for example if * and has an "encoding" attribute, this * map will have what that attribute maps to. */ private HashMap m_OutputProps; /** * A mapping of keys to default values, for example if * the default value of the encoding is "UTF-8" then this * map will have that "encoding" maps to "UTF-8". */ private HashMap m_OutputPropsDefault; Set getOutputPropDefaultKeys() { return m_OutputPropsDefault.keySet(); } Set getOutputPropKeys() { return m_OutputProps.keySet(); } private String getProp(String name, boolean defaultVal) { if (m_OutputProps == null) { m_OutputProps = new HashMap(); m_OutputPropsDefault = new HashMap(); } String val; if (defaultVal) val = (String) m_OutputPropsDefault.get(name); else val = (String) m_OutputProps.get(name); return val; } /** * * @param name The name of the property, e.g. "{http://myprop}indent-tabs" or "indent". * @param val The value of the property, e.g. "4" * @param defaultVal true if this is a default value being set for the property as * opposed to a user define on, set say explicitly in the stylesheet or via JAXP */ void setProp(String name, String val, boolean defaultVal) { if (m_OutputProps == null) { m_OutputProps = new HashMap(); m_OutputPropsDefault = new HashMap(); } if (defaultVal) m_OutputPropsDefault.put(name,val); else { if (OutputKeys.CDATA_SECTION_ELEMENTS.equals(name) && val != null) { initCdataElems(val); String oldVal = (String) m_OutputProps.get(name); String newVal; if (oldVal == null) newVal = oldVal + ' ' + val; else newVal = val; m_OutputProps.put(name,newVal); } else { m_OutputProps.put(name,val); } } } /** * Get the first char of the local name * @param name Either a local name, or a local name * preceeded by a uri enclosed in curly braces. */ static char getFirstCharLocName(String name) { final char first; int i = name.indexOf('}'); if (i < 0) first = name.charAt(0); else first = name.charAt(i+1); return first; } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/WriterChain.java0000644000175000017500000000703410721374033024136 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WriterChain.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; /** * It is unfortunate that java.io.Writer is a class rather than an interface. * The serializer has a number of classes that extend java.io.Writer * and which send their ouput to a yet another wrapped Writer or OutputStream. * * The purpose of this interface is to force such classes to over-ride all of * the important methods defined on the java.io.Writer class, namely these: * * write(int val) * write(char[] chars) * write(char[] chars, int start, int count) * write(String chars) * write(String chars, int start, int count) * flush() * close() * * In this manner nothing will accidentally go directly to * the base class rather than to the wrapped Writer or OutputStream. * * The purpose of this class is to have a uniform way of chaining the output of one writer to * the next writer in the chain. In addition there are methods to obtain the Writer or * OutputStream that this object sends its output to. * * This interface is only for internal use withing the serializer. * @xsl.usage internal */ interface WriterChain { /** This method forces us to over-ride the method defined in java.io.Writer */ public void write(int val) throws IOException; /** This method forces us to over-ride the method defined in java.io.Writer */ public void write(char[] chars) throws IOException; /** This method forces us to over-ride the method defined in java.io.Writer */ public void write(char[] chars, int start, int count) throws IOException; /** This method forces us to over-ride the method defined in java.io.Writer */ public void write(String chars) throws IOException; /** This method forces us to over-ride the method defined in java.io.Writer */ public void write(String chars, int start, int count) throws IOException; /** This method forces us to over-ride the method defined in java.io.Writer */ public void flush() throws IOException; /** This method forces us to over-ride the method defined in java.io.Writer */ public void close() throws IOException; /** * If this method returns null, getOutputStream() must return non-null. * Get the writer that this writer sends its output to. * * It is possible that the Writer returned by this method does not * implement the WriterChain interface. */ public java.io.Writer getWriter(); /** * If this method returns null, getWriter() must return non-null. * Get the OutputStream that this writer sends its output to. */ public java.io.OutputStream getOutputStream(); } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ExtendedContentHandler.java0000644000175000017500000002465010721374031026311 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtendedContentHandler.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import javax.xml.transform.SourceLocator; import org.xml.sax.SAXException; /** * This interface describes extensions to the SAX ContentHandler interface. * It is intended to be used by a serializer. The methods on this interface will * implement SAX- like behavior. This allows the gradual collection of * information rather than having it all up front. For example the call *

     * startElement(namespaceURI,localName,qName,atts)
     * 
    * could be replaced with the calls *
     * startElement(namespaceURI,localName,qName)
     * addAttributes(atts)
     * 
    * If there are no attributes the second call can be dropped. If attributes are * to be added one at a time with calls to *
     * addAttribute(namespaceURI, localName, qName, type, value)
     * 
    * @xsl.usage internal */ public interface ExtendedContentHandler extends org.xml.sax.ContentHandler { /** * Add at attribute to the current element * @param uri the namespace URI of the attribute name * @param localName the local name of the attribute (without prefix) * @param rawName the qualified name of the attribute * @param type the attribute type typically character data (CDATA) * @param value the value of the attribute * @param XSLAttribute true if the added attribute is coming from an xsl:attribute element * @throws SAXException */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException; /** * Add attributes to the current element * @param atts the attributes to add. * @throws SAXException */ public void addAttributes(org.xml.sax.Attributes atts) throws org.xml.sax.SAXException; /** * Add an attribute to the current element. The namespace URI of the * attribute will be calculated from the prefix of qName. The local name * will be derived from qName and the type will be assumed to be "CDATA". * @param qName * @param value */ public void addAttribute(String qName, String value); /** * This method is used to notify of a character event, but passing the data * as a character String rather than the standard character array. * @param chars the character data * @throws SAXException */ public void characters(String chars) throws SAXException; /** * This method is used to notify of a character event, but passing the data * as a DOM Node rather than the standard character array. * @param node a DOM Node containing text. * @throws SAXException */ public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException; /** * This method is used to notify that an element has ended. Unlike the * standard SAX method *
         * endElement(namespaceURI,localName,qName)
         * 
    * only the last parameter is passed. If needed the serializer can derive * the localName from the qualified name and derive the namespaceURI from * its implementation. * @param elemName the fully qualified element name. * @throws SAXException */ public void endElement(String elemName) throws SAXException; /** * This method is used to notify that an element is starting. * This method is just like the standard SAX method *
         * startElement(uri,localName,qname,atts)
         * 
    * but without the attributes. * @param uri the namespace URI of the element * @param localName the local name (without prefix) of the element * @param qName the qualified name of the element * * @throws SAXException */ public void startElement(String uri, String localName, String qName) throws org.xml.sax.SAXException; /** * This method is used to notify of the start of an element * @param qName the fully qualified name of the element * @throws SAXException */ public void startElement(String qName) throws SAXException; /** * This method is used to notify that a prefix mapping is to start, but * after an element is started. The SAX method call *
         * startPrefixMapping(prefix,uri)
         * 
    * is used just before an element starts and applies to the element to come, * not to the current element. This method applies to the current element. * For example one could make the calls in this order: *
         * startElement("prfx8:elem9")
         * namespaceAfterStartElement("http://namespace8","prfx8")
         * 
    * * @param uri the namespace URI being declared * @param prefix the prefix that maps to the given namespace * @throws SAXException */ public void namespaceAfterStartElement(String uri, String prefix) throws SAXException; /** * This method is used to notify that a prefix maping is to start, which can * be for the current element, or for the one to come. * @param prefix the prefix that maps to the given URI * @param uri the namespace URI of the given prefix * @param shouldFlush if true this call is like the SAX * startPrefixMapping(prefix,uri) call and the mapping applies to the * element to come. If false the mapping applies to the current element. * @return boolean false if the prefix mapping was already in effect (in * other words we are just re-declaring), true if this is a new, never * before seen mapping for the element. * @throws SAXException */ public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws SAXException; /** * Notify of an entity reference. * @param entityName the name of the entity * @throws SAXException */ public void entityReference(String entityName) throws SAXException; /** * This method returns an object that has the current namespace mappings in * effect. * * @return NamespaceMappings an object that has the current namespace * mappings in effect. */ public NamespaceMappings getNamespaceMappings(); /** * This method returns the prefix that currently maps to the given namespace * URI. * @param uri the namespace URI * @return String the prefix that currently maps to the given URI. */ public String getPrefix(String uri); /** * This method gets the prefix associated with a current element or * attribute name. * @param name the qualified name of an element, or attribute * @param isElement true if it is an element name, false if it is an * atttribute name * @return String the namespace URI associated with the element or * attribute. */ public String getNamespaceURI(String name, boolean isElement); /** * This method returns the namespace URI currently associated with the * prefix. * @param prefix a prefix of an element or attribute. * @return String the namespace URI currently associated with the prefix. */ public String getNamespaceURIFromPrefix(String prefix); /** * This method is used to set the source locator, which might be used to * generated an error message. * @param locator the source locator */ public void setSourceLocator(SourceLocator locator); // Bit constants for addUniqueAttribute(). // The attribute value contains no bad characters. A "bad" character is one which // is greater than 126 or it is one of '<', '>', '&' or '"'. public static final int NO_BAD_CHARS = 0x1; // An HTML empty attribute (e.g.

    See also the Document Object Model (DOM) Level 3 Core Specification. * This class is a copy of the Xerces-2J class org.apache.xerces.dom.DOMLocatorImpl.java v 1.10 * * @author Gopal Sharma, SUN Microsystems Inc. * @version $Id: * * @xsl.usage internal */ final class DOMLocatorImpl implements DOMLocator { // // Data // /** * The column number where the error occured, * or -1 if there is no column number available. */ private final int fColumnNumber; /** * The line number where the error occured, * or -1 if there is no line number available. */ private final int fLineNumber; /** related data node*/ private final Node fRelatedNode; /** * The URI where the error occured, * or null if there is no URI available. */ private final String fUri; /** * The byte offset into the input source this locator is pointing to or -1 * if there is no byte offset available */ private final int fByteOffset; /** * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], * offset into the input source this locator is pointing to or -1 if there * is no UTF-16 offset available. */ private final int fUtf16Offset; // // Constructors // DOMLocatorImpl(){ fColumnNumber = -1; fLineNumber = -1; fRelatedNode = null; fUri = null; fByteOffset = -1; fUtf16Offset = -1; } DOMLocatorImpl (int lineNumber, int columnNumber, String uri ){ fLineNumber = lineNumber ; fColumnNumber = columnNumber ; fUri = uri; fRelatedNode = null; fByteOffset = -1; fUtf16Offset = -1; } // DOMLocatorImpl (int lineNumber, int columnNumber, String uri ) DOMLocatorImpl (int lineNumber, int columnNumber, int utf16Offset, String uri ){ fLineNumber = lineNumber ; fColumnNumber = columnNumber ; fUri = uri; fUtf16Offset = utf16Offset; fRelatedNode = null; fByteOffset = -1; } // DOMLocatorImpl (int lineNumber, int columnNumber, int utf16Offset, String uri ) DOMLocatorImpl (int lineNumber, int columnNumber, int byteoffset, Node relatedData, String uri ){ fLineNumber = lineNumber ; fColumnNumber = columnNumber ; fByteOffset = byteoffset ; fRelatedNode = relatedData ; fUri = uri; fUtf16Offset = -1; } // DOMLocatorImpl (int lineNumber, int columnNumber, int offset, Node errorNode, String uri ) DOMLocatorImpl (int lineNumber, int columnNumber, int byteoffset, Node relatedData, String uri, int utf16Offset ){ fLineNumber = lineNumber ; fColumnNumber = columnNumber ; fByteOffset = byteoffset ; fRelatedNode = relatedData ; fUri = uri; fUtf16Offset = utf16Offset; } // DOMLocatorImpl (int lineNumber, int columnNumber, int offset, Node errorNode, String uri ) /** * The line number where the error occured, or -1 if there is no line * number available. */ public int getLineNumber(){ return fLineNumber; } /** * The column number where the error occured, or -1 if there is no column * number available. */ public int getColumnNumber(){ return fColumnNumber; } /** * The URI where the error occured, or null if there is no URI available. */ public String getUri(){ return fUri; } public Node getRelatedNode(){ return fRelatedNode; } /** * The byte offset into the input source this locator is pointing to or -1 * if there is no byte offset available */ public int getByteOffset(){ return fByteOffset; } /** * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], * offset into the input source this locator is pointing to or -1 if there * is no UTF-16 offset available. */ public int getUtf16Offset(){ return fUtf16Offset; } }// class DOMLocatorImpl libxalan2-java-2.7.1/src/org/apache/xml/serializer/dom3/DOMErrorImpl.java0000644000175000017500000001105310721374033025030 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: $ */ package org.apache.xml.serializer.dom3; import org.w3c.dom.DOMError; import org.w3c.dom.DOMLocator; /** * Implementation of the DOM Level 3 DOMError interface. * *

    See also the DOMError Interface definition from Document Object Model (DOM) Level 3 Core Specification. * * @xsl.usage internal */ final class DOMErrorImpl implements DOMError { /** private data members */ // The DOMError Severity private short fSeverity = DOMError.SEVERITY_WARNING; // The Error message private String fMessage = null; // A String indicating which related data is expected in relatedData. private String fType; // The platform related exception private Exception fException = null; // private Object fRelatedData; // The location of the exception private DOMLocatorImpl fLocation = new DOMLocatorImpl(); // // Constructors // /** * Default constructor. */ DOMErrorImpl () { } /** * @param severity * @param message * @param type */ DOMErrorImpl(short severity, String message, String type) { fSeverity = severity; fMessage = message; fType = type; } /** * @param severity * @param message * @param type * @param exception */ DOMErrorImpl(short severity, String message, String type, Exception exception) { fSeverity = severity; fMessage = message; fType = type; fException = exception; } /** * @param severity * @param message * @param type * @param exception * @param relatedData * @param location */ DOMErrorImpl(short severity, String message, String type, Exception exception, Object relatedData, DOMLocatorImpl location) { fSeverity = severity; fMessage = message; fType = type; fException = exception; fRelatedData = relatedData; fLocation = location; } /** * The severity of the error, either SEVERITY_WARNING, * SEVERITY_ERROR, or SEVERITY_FATAL_ERROR. * * @return A short containing the DOMError severity */ public short getSeverity() { return fSeverity; } /** * The DOMError message string. * * @return String */ public String getMessage() { return fMessage; } /** * The location of the DOMError. * * @return A DOMLocator object containing the DOMError location. */ public DOMLocator getLocation() { return fLocation; } /** * The related platform dependent exception if any. * * @return A java.lang.Exception */ public Object getRelatedException(){ return fException; } /** * Returns a String indicating which related data is expected in relatedData. * * @return A String */ public String getType(){ return fType; } /** * The related DOMError.type dependent data if any. * * @return java.lang.Object */ public Object getRelatedData(){ return fRelatedData; } public void reset(){ fSeverity = DOMError.SEVERITY_WARNING; fException = null; fMessage = null; fType = null; fRelatedData = null; fLocation = null; } }// class DOMErrorImpl libxalan2-java-2.7.1/src/org/apache/xml/serializer/dom3/DOMConstants.java0000644000175000017500000001234610721374032025076 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: $ */ package org.apache.xml.serializer.dom3; /** * DOM Constants used by the DOM Level 3 LSSerializer implementation. * * @xsl.usage internal */ final class DOMConstants { // // Constants: DOM Level 3 feature ids // public static final String DOM3_REC_URL = "http://www.w3.org/TR/DOM-Level-3-LS"; public static final String XERCES_URL = "http://xml.apache.org/xerces-2j"; // The namespace used to qualified DOM Level 3 DOMConfiguration parameters public static final String S_DOM3_PROPERTIES_NS = "{" + DOMConstants.DOM3_REC_URL + "}"; public static final String S_XERCES_PROPERTIES_NS = "{" + DOMConstants.XERCES_URL + "}"; // xmlns namespaces private static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/"; // namespace prefix private static final String XMLNS_PREFIX = "xmlns"; // ************************************************************************ // DOM Level 3 DOM Configuration parameter names // ************************************************************************ // DOM Level 3 parameters defined in Core public static final String DOM_CANONICAL_FORM = "canonical-form"; // Unsupported, we only appear to support this public static final String DOM_CDATA_SECTIONS = "cdata-sections"; public static final String DOM_CHECK_CHAR_NORMALIZATION = "check-character-normalization"; // Unsupported public static final String DOM_COMMENTS = "comments"; public static final String DOM_DATATYPE_NORMALIZATION = "datatype-normalization"; // Unsupported public static final String DOM_ELEMENT_CONTENT_WHITESPACE = "element-content-whitespace"; public static final String DOM_ENTITIES = "entities"; public static final String DOM_INFOSET = "infoset"; public static final String DOM_NAMESPACES = "namespaces"; public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations"; public static final String DOM_NORMALIZE_CHARACTERS = "normalize-characters"; // Unsupported public static final String DOM_SPLIT_CDATA = "split-cdata-sections"; public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema"; // Unsopported public static final String DOM_VALIDATE = "validate"; // Unsopported public static final String DOM_WELLFORMED = "well-formed"; // DOM Level 3 Save public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content"; public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print"; public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS = "ignore-unknown-character-denormalizations"; // Unsupported public static final String DOM_XMLDECL = "xml-declaration"; // DOM Properties public static final String DOM_ERROR_HANDLER = "error-handler"; public static final String DOM_SCHEMA_TYPE = "schema-type"; // Unsupported public static final String DOM_SCHEMA_LOCATION = "schema-location"; // Unsupported // ************************************************************************ // XSL Output properties // The xsl:output 'indent' property used in LSSerializer public static final String S_XSL_OUTPUT_INDENT = "indent"; // The xsl:output 'indent' property used in LSSerializer public static final String S_XSL_OUTPUT_ENCODING = "encoding"; // The xsl:output 'omit-xml-declaration' property used in LSSerializer public static final String S_XSL_OUTPUT_OMIT_XML_DECL = "omit-xml-declaration"; // The xerces serializer specific 'omit-xml-declaration' property used in LSSerializer public static final String S_XML_VERSION = "xml-version"; // public static final String S_XSL_VALUE_ENTITIES = "org/apache/xml/serializer/XMLEntities"; // Parameter values public static final String DOM3_EXPLICIT_TRUE = "explicit:yes"; public static final String DOM3_DEFAULT_TRUE = "default:yes"; public static final String DOM3_EXPLICIT_FALSE = "explicit:no"; public static final String DOM3_DEFAULT_FALSE = "default:no"; // DOM Exceptions public static final String DOM_EXCEPTION_FEATURE_NOT_FOUND = "FEATURE_NOT_FOUND"; public static final String DOM_EXCEPTION_FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED"; public static final String DOM_LSEXCEPTION_SERIALIZER_ERR = "SERIALIZER_ERROR"; } libxalan2-java-2.7.1/src/org/apache/xml/serializer/dom3/NamespaceSupport.java0000644000175000017500000002305610721374032026053 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: $ */ package org.apache.xml.serializer.dom3; import java.util.Enumeration; import java.util.NoSuchElementException; /** * Namespace support for XML document handlers. This class doesn't * perform any error checking and assumes that all strings passed * as arguments to methods are unique symbols. The SymbolTable class * can be used for this purpose. * * Derived from org.apache.xerces.util.NamespaceSupport * * @author Andy Clark, IBM * * @version $Id: Exp $ */ public class NamespaceSupport { static final String PREFIX_XML = "xml".intern(); static final String PREFIX_XMLNS = "xmlns".intern(); /** * The XML Namespace ("http://www.w3.org/XML/1998/namespace"). This is * the Namespace URI that is automatically mapped to the "xml" prefix. */ public final static String XML_URI = "http://www.w3.org/XML/1998/namespace".intern(); /** * XML Information Set REC * all namespace attributes (including those named xmlns, * whose [prefix] property has no value) have a namespace URI of http://www.w3.org/2000/xmlns/ */ public final static String XMLNS_URI = "http://www.w3.org/2000/xmlns/".intern(); // // Data // /** * Namespace binding information. This array is composed of a * series of tuples containing the namespace binding information: * <prefix, uri>. The default size can be set to anything * as long as it is a power of 2 greater than 1. * * @see #fNamespaceSize * @see #fContext */ protected String[] fNamespace = new String[16 * 2]; /** The top of the namespace information array. */ protected int fNamespaceSize; // NOTE: The constructor depends on the initial context size // being at least 1. -Ac /** * Context indexes. This array contains indexes into the namespace * information array. The index at the current context is the start * index of declared namespace bindings and runs to the size of the * namespace information array. * * @see #fNamespaceSize */ protected int[] fContext = new int[8]; /** The current context. */ protected int fCurrentContext; protected String[] fPrefixes = new String[16]; // // Constructors // /** Default constructor. */ public NamespaceSupport() { } // () // // Public methods // /** * @see org.apache.xerces.xni.NamespaceContext#reset() */ public void reset() { // reset namespace and context info fNamespaceSize = 0; fCurrentContext = 0; fContext[fCurrentContext] = fNamespaceSize; // bind "xml" prefix to the XML uri fNamespace[fNamespaceSize++] = PREFIX_XML; fNamespace[fNamespaceSize++] = XML_URI; // bind "xmlns" prefix to the XMLNS uri fNamespace[fNamespaceSize++] = PREFIX_XMLNS; fNamespace[fNamespaceSize++] = XMLNS_URI; ++fCurrentContext; } // reset(SymbolTable) /** * @see org.apache.xerces.xni.NamespaceContext#pushContext() */ public void pushContext() { // extend the array, if necessary if (fCurrentContext + 1 == fContext.length) { int[] contextarray = new int[fContext.length * 2]; System.arraycopy(fContext, 0, contextarray, 0, fContext.length); fContext = contextarray; } // push context fContext[++fCurrentContext] = fNamespaceSize; } // pushContext() /** * @see org.apache.xerces.xni.NamespaceContext#popContext() */ public void popContext() { fNamespaceSize = fContext[fCurrentContext--]; } // popContext() /** * @see org.apache.xerces.xni.NamespaceContext#declarePrefix(String, String) */ public boolean declarePrefix(String prefix, String uri) { // ignore "xml" and "xmlns" prefixes if (prefix == PREFIX_XML || prefix == PREFIX_XMLNS) { return false; } // see if prefix already exists in current context for (int i = fNamespaceSize; i > fContext[fCurrentContext]; i -= 2) { //if (fNamespace[i - 2] == prefix) { if (fNamespace[i - 2].equals(prefix) ) { // REVISIT: [Q] Should the new binding override the // previously declared binding or should it // it be ignored? -Ac // NOTE: The SAX2 "NamespaceSupport" helper allows // re-bindings with the new binding overwriting // the previous binding. -Ac fNamespace[i - 1] = uri; return true; } } // resize array, if needed if (fNamespaceSize == fNamespace.length) { String[] namespacearray = new String[fNamespaceSize * 2]; System.arraycopy(fNamespace, 0, namespacearray, 0, fNamespaceSize); fNamespace = namespacearray; } // bind prefix to uri in current context fNamespace[fNamespaceSize++] = prefix; fNamespace[fNamespaceSize++] = uri; return true; } // declarePrefix(String,String):boolean /** * @see org.apache.xerces.xni.NamespaceContext#getURI(String) */ public String getURI(String prefix) { // find prefix in current context for (int i = fNamespaceSize; i > 0; i -= 2) { //if (fNamespace[i - 2] == prefix) { if (fNamespace[i - 2].equals(prefix) ) { return fNamespace[i - 1]; } } // prefix not found return null; } // getURI(String):String /** * @see org.apache.xerces.xni.NamespaceContext#getPrefix(String) */ public String getPrefix(String uri) { // find uri in current context for (int i = fNamespaceSize; i > 0; i -= 2) { //if (fNamespace[i - 1] == uri) { if (fNamespace[i - 1].equals(uri) ) { //if (getURI(fNamespace[i - 2]) == uri) if (getURI(fNamespace[i - 2]).equals(uri) ) return fNamespace[i - 2]; } } // uri not found return null; } // getPrefix(String):String /** * @see org.apache.xerces.xni.NamespaceContext#getDeclaredPrefixCount() */ public int getDeclaredPrefixCount() { return (fNamespaceSize - fContext[fCurrentContext]) / 2; } // getDeclaredPrefixCount():int /** * @see org.apache.xerces.xni.NamespaceContext#getDeclaredPrefixAt(int) */ public String getDeclaredPrefixAt(int index) { return fNamespace[fContext[fCurrentContext] + index * 2]; } // getDeclaredPrefixAt(int):String /** * @see org.apache.xerces.xni.NamespaceContext#getAllPrefixes() */ public Enumeration getAllPrefixes() { int count = 0; if (fPrefixes.length < (fNamespace.length/2)) { // resize prefix array String[] prefixes = new String[fNamespaceSize]; fPrefixes = prefixes; } String prefix = null; boolean unique = true; for (int i = 2; i < (fNamespaceSize-2); i += 2) { prefix = fNamespace[i + 2]; for (int k=0;kDOMString to the list. * * @param domString A string to add to the list */ public void add(String param) { fStrings.add(param); } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/dom3/DOM3TreeWalker.java0000644000175000017500000024247110721374033025257 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: $ */ package org.apache.xml.serializer.dom3; import java.io.File; import java.io.IOException; import java.io.Writer; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import org.apache.xml.serializer.dom3.NamespaceSupport; import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.apache.xml.serializer.utils.XML11Char; import org.apache.xml.serializer.utils.XMLChar; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.Entity; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.w3c.dom.ls.LSSerializerFilter; import org.w3c.dom.traversal.NodeFilter; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.LocatorImpl; /** * Built on org.apache.xml.serializer.TreeWalker and adds functionality to * traverse and serialize a DOM Node (Level 2 or Level 3) as specified in * the DOM Level 3 LS Recommedation by evaluating and applying DOMConfiguration * parameters and filters if any during serialization. * * @xsl.usage internal */ final class DOM3TreeWalker { /** * The SerializationHandler, it extends ContentHandler and when * this class is instantiated via the constructor provided, a * SerializationHandler object is passed to it. */ private SerializationHandler fSerializer = null; /** We do not need DOM2Helper since DOM Level 3 LS applies to DOM Level 2 or newer */ /** Locator object for this TreeWalker */ private LocatorImpl fLocator = new LocatorImpl(); /** ErrorHandler */ private DOMErrorHandler fErrorHandler = null; /** LSSerializerFilter */ private LSSerializerFilter fFilter = null; /** If the serializer is an instance of a LexicalHandler */ private LexicalHandler fLexicalHandler = null; private int fWhatToShowFilter; /** New Line character to use in serialization */ private String fNewLine = null; /** DOMConfiguration Properties */ private Properties fDOMConfigProperties = null; /** Keeps track if we are in an entity reference when entities=true */ private boolean fInEntityRef = false; /** Stores the version of the XML document to be serialize */ private String fXMLVersion = null; /** XML Version, default 1.0 */ private boolean fIsXMLVersion11 = false; /** Is the Node a Level 3 DOM node */ private boolean fIsLevel3DOM = false; /** DOM Configuration Parameters */ private int fFeatures = 0; /** Flag indicating whether following text to be processed is raw text */ boolean fNextIsRaw = false; // private static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/"; // private static final String XMLNS_PREFIX = "xmlns"; // private static final String XML_URI = "http://www.w3.org/XML/1998/namespace"; // private static final String XML_PREFIX = "xml"; /** stores namespaces in scope */ protected NamespaceSupport fNSBinder; /** stores all namespace bindings on the current element */ protected NamespaceSupport fLocalNSBinder; /** stores the current element depth */ private int fElementDepth = 0; // *********************************************************************** // DOMConfiguration paramter settings // *********************************************************************** // Parameter canonical-form, true [optional] - NOT SUPPORTED private final static int CANONICAL = 0x1 << 0; // Parameter cdata-sections, true [required] (default) private final static int CDATA = 0x1 << 1; // Parameter check-character-normalization, true [optional] - NOT SUPPORTED private final static int CHARNORMALIZE = 0x1 << 2; // Parameter comments, true [required] (default) private final static int COMMENTS = 0x1 << 3; // Parameter datatype-normalization, true [optional] - NOT SUPPORTED private final static int DTNORMALIZE = 0x1 << 4; // Parameter element-content-whitespace, true [required] (default) - value - false [optional] NOT SUPPORTED private final static int ELEM_CONTENT_WHITESPACE = 0x1 << 5; // Parameter entities, true [required] (default) private final static int ENTITIES = 0x1 << 6; // Parameter infoset, true [required] (default), false has no effect --> True has no effect for the serializer private final static int INFOSET = 0x1 << 7; // Parameter namespaces, true [required] (default) private final static int NAMESPACES = 0x1 << 8; // Parameter namespace-declarations, true [required] (default) private final static int NAMESPACEDECLS = 0x1 << 9; // Parameter normalize-characters, true [optional] - NOT SUPPORTED private final static int NORMALIZECHARS = 0x1 << 10; // Parameter split-cdata-sections, true [required] (default) private final static int SPLITCDATA = 0x1 << 11; // Parameter validate, true [optional] - NOT SUPPORTED private final static int VALIDATE = 0x1 << 12; // Parameter validate-if-schema, true [optional] - NOT SUPPORTED private final static int SCHEMAVALIDATE = 0x1 << 13; // Parameter split-cdata-sections, true [required] (default) private final static int WELLFORMED = 0x1 << 14; // Parameter discard-default-content, true [required] (default) // Not sure how this will be used in level 2 Documents private final static int DISCARDDEFAULT = 0x1 << 15; // Parameter format-pretty-print, true [optional] private final static int PRETTY_PRINT = 0x1 << 16; // Parameter ignore-unknown-character-denormalizations, true [required] (default) // We currently do not support XML 1.1 character normalization private final static int IGNORE_CHAR_DENORMALIZE = 0x1 << 17; // Parameter discard-default-content, true [required] (default) private final static int XMLDECL = 0x1 << 18; /** * Constructor. * @param contentHandler serialHandler The implemention of the SerializationHandler interface */ DOM3TreeWalker( SerializationHandler serialHandler, DOMErrorHandler errHandler, LSSerializerFilter filter, String newLine) { fSerializer = serialHandler; //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default? fErrorHandler = errHandler; fFilter = filter; fLexicalHandler = null; fNewLine = newLine; fNSBinder = new NamespaceSupport(); fLocalNSBinder = new NamespaceSupport(); fDOMConfigProperties = fSerializer.getOutputFormat(); fSerializer.setDocumentLocator(fLocator); initProperties(fDOMConfigProperties); try { // Bug see Bugzilla 26741 fLocator.setSystemId( System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) { // user.dir not accessible from applet } } /** * Perform a pre-order traversal non-recursive style. * * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * * @throws TransformerException */ public void traverse(Node pos) throws org.xml.sax.SAXException { this.fSerializer.startDocument(); // Determine if the Node is a DOM Level 3 Core Node. if (pos.getNodeType() != Node.DOCUMENT_NODE) { Document ownerDoc = pos.getOwnerDocument(); if (ownerDoc != null && ownerDoc.getImplementation().hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } else { if (((Document) pos) .getImplementation() .hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } if (fSerializer instanceof LexicalHandler) { fLexicalHandler = ((LexicalHandler) this.fSerializer); } if (fFilter != null) fWhatToShowFilter = fFilter.getWhatToShow(); Node top = pos; while (null != pos) { startNode(pos); Node nextNode = null; nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if (top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || (top.equals(pos))) { if (null != pos) endNode(pos); nextNode = null; break; } } } pos = nextNode; } this.fSerializer.endDocument(); } /** * Perform a pre-order traversal non-recursive style. * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * @param top Node in the tree where to end traversal * * @throws TransformerException */ public void traverse(Node pos, Node top) throws org.xml.sax.SAXException { this.fSerializer.startDocument(); // Determine if the Node is a DOM Level 3 Core Node. if (pos.getNodeType() != Node.DOCUMENT_NODE) { Document ownerDoc = pos.getOwnerDocument(); if (ownerDoc != null && ownerDoc.getImplementation().hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } else { if (((Document) pos) .getImplementation() .hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } if (fSerializer instanceof LexicalHandler) { fLexicalHandler = ((LexicalHandler) this.fSerializer); } if (fFilter != null) fWhatToShowFilter = fFilter.getWhatToShow(); while (null != pos) { startNode(pos); Node nextNode = null; nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if ((null != top) && top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || ((null != top) && top.equals(pos))) { nextNode = null; break; } } } pos = nextNode; } this.fSerializer.endDocument(); } /** * Optimized dispatch of characters. */ private final void dispatachChars(Node node) throws org.xml.sax.SAXException { if (fSerializer != null) { this.fSerializer.characters(node); } else { String data = ((Text) node).getData(); this.fSerializer.characters(data.toCharArray(), 0, data.length()); } } /** * Start processing given node * * @param node Node to process * * @throws org.xml.sax.SAXException */ protected void startNode(Node node) throws org.xml.sax.SAXException { if (node instanceof Locator) { Locator loc = (Locator) node; fLocator.setColumnNumber(loc.getColumnNumber()); fLocator.setLineNumber(loc.getLineNumber()); fLocator.setPublicId(loc.getPublicId()); fLocator.setSystemId(loc.getSystemId()); } else { fLocator.setColumnNumber(0); fLocator.setLineNumber(0); } switch (node.getNodeType()) { case Node.DOCUMENT_TYPE_NODE : serializeDocType((DocumentType) node, true); break; case Node.COMMENT_NODE : serializeComment((Comment) node); break; case Node.DOCUMENT_FRAGMENT_NODE : // Children are traversed break; case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : serializeElement((Element) node, true); break; case Node.PROCESSING_INSTRUCTION_NODE : serializePI((ProcessingInstruction) node); break; case Node.CDATA_SECTION_NODE : serializeCDATASection((CDATASection) node); break; case Node.TEXT_NODE : serializeText((Text) node); break; case Node.ENTITY_REFERENCE_NODE : serializeEntityReference((EntityReference) node, true); break; default : } } /** * End processing of given node * * * @param node Node we just finished processing * * @throws org.xml.sax.SAXException */ protected void endNode(Node node) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_NODE : break; case Node.DOCUMENT_TYPE_NODE : serializeDocType((DocumentType) node, false); break; case Node.ELEMENT_NODE : serializeElement((Element) node, false); break; case Node.CDATA_SECTION_NODE : break; case Node.ENTITY_REFERENCE_NODE : serializeEntityReference((EntityReference) node, false); break; default : } } // *********************************************************************** // Node serialization methods // *********************************************************************** /** * Applies a filter on the node to serialize * * @param node The Node to serialize * @return True if the node is to be serialized else false if the node * is to be rejected or skipped. */ protected boolean applyFilter(Node node, int nodeType) { if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) { short code = fFilter.acceptNode(node); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : return false; // skip the node default : // fall through.. } } return true; } /** * Serializes a Document Type Node. * * @param node The Docuemnt Type Node to serialize * @param bStart Invoked at the start or end of node. Default true. */ protected void serializeDocType(DocumentType node, boolean bStart) throws SAXException { // The DocType and internalSubset can not be modified in DOM and is // considered to be well-formed as the outcome of successful parsing. String docTypeName = node.getNodeName(); String publicId = node.getPublicId(); String systemId = node.getSystemId(); String internalSubset = node.getInternalSubset(); //DocumentType nodes are never passed to the filter if (internalSubset != null && !"".equals(internalSubset)) { if (bStart) { try { // The Serializer does not provide a way to write out the // DOCTYPE internal subset via an event call, so we write it // out here. Writer writer = fSerializer.getWriter(); StringBuffer dtd = new StringBuffer(); dtd.append(""); dtd.append(new String(fNewLine)); writer.write(dtd.toString()); writer.flush(); } catch (IOException e) { throw new SAXException(Utils.messages.createMessage( MsgKey.ER_WRITING_INTERNAL_SUBSET, null), e); } } // else if !bStart do nothing } else { if (bStart) { if (fLexicalHandler != null) { fLexicalHandler.startDTD(docTypeName, publicId, systemId); } } else { if (fLexicalHandler != null) { fLexicalHandler.endDTD(); } } } } /** * Serializes a Comment Node. * * @param node The Comment Node to serialize */ protected void serializeComment(Comment node) throws SAXException { // comments=true if ((fFeatures & COMMENTS) != 0) { String data = node.getData(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCommentWellFormed(data); } if (fLexicalHandler != null) { // apply the LSSerializer filter after the operations requested by the // DOMConfiguration parameters have been applied if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) { return; } fLexicalHandler.comment(data.toCharArray(), 0, data.length()); } } } /** * Serializes an Element Node. * * @param node The Element Node to serialize * @param bStart Invoked at the start or end of node. */ protected void serializeElement(Element node, boolean bStart) throws SAXException { if (bStart) { fElementDepth++; // We use the Xalan specific startElement and starPrefixMapping calls // (and addAttribute and namespaceAfterStartElement) as opposed to // SAX specific, for performance reasons as they reduce the overhead // of creating an AttList object upfront. // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isElementWellFormed(node); } // REVISIT: We apply the LSSerializer filter for elements before // namesapce fixup if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } // namespaces=true, record and fixup namspaced element if ((fFeatures & NAMESPACES) != 0) { fNSBinder.pushContext(); fLocalNSBinder.reset(); recordLocalNSDecl(node); fixupElementNS(node); } // Namespace normalization fSerializer.startElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); serializeAttList(node); } else { fElementDepth--; // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } this.fSerializer.endElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); // since endPrefixMapping was not used by SerializationHandler it was removed // for performance reasons. if ((fFeatures & NAMESPACES) != 0 ) { fNSBinder.popContext(); } } } /** * Serializes the Attr Nodes of an Element. * * @param node The OwnerElement whose Attr Nodes are to be serialized. */ protected void serializeAttList(Element node) throws SAXException { NamedNodeMap atts = node.getAttributes(); int nAttrs = atts.getLength(); for (int i = 0; i < nAttrs; i++) { Node attr = atts.item(i); String localName = attr.getLocalName(); String attrName = attr.getNodeName(); String attrPrefix = attr.getPrefix() == null ? "" : attr.getPrefix(); String attrValue = attr.getNodeValue(); // Determine the Attr's type. String type = null; if (fIsLevel3DOM) { type = ((Attr) attr).getSchemaTypeInfo().getTypeName(); } type = type == null ? "CDATA" : type; String attrNS = attr.getNamespaceURI(); if (attrNS !=null && attrNS.length() == 0) { attrNS=null; // we must remove prefix for this attribute attrName=attr.getLocalName(); } boolean isSpecified = ((Attr) attr).getSpecified(); boolean addAttr = true; boolean applyFilter = false; boolean xmlnsAttr = attrName.equals("xmlns") || attrName.startsWith("xmlns:"); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isAttributeWellFormed(attr); } //----------------------------------------------------------------- // start Attribute namespace fixup //----------------------------------------------------------------- // namespaces=true, normalize all non-namespace attributes // Step 3. Attribute if ((fFeatures & NAMESPACES) != 0 && !xmlnsAttr) { // If the Attr has a namespace URI if (attrNS != null) { attrPrefix = attrPrefix == null ? "" : attrPrefix; String declAttrPrefix = fNSBinder.getPrefix(attrNS); String declAttrNS = fNSBinder.getURI(attrPrefix); // attribute has no prefix (default namespace decl does not apply to // attributes) // OR // attribute prefix is not declared // OR // conflict: attribute has a prefix that conflicts with a binding if ("".equals(attrPrefix) || "".equals(declAttrPrefix) || !attrPrefix.equals(declAttrPrefix)) { // namespaceURI matches an in scope declaration of one or // more prefixes if (declAttrPrefix != null && !"".equals(declAttrPrefix)) { // pick the prefix that was found and change attribute's // prefix and nodeName. attrPrefix = declAttrPrefix; if (declAttrPrefix.length() > 0 ) { attrName = declAttrPrefix + ":" + localName; } else { attrName = localName; } } else { // The current prefix is not null and it has no in scope // declaration if (attrPrefix != null && !"".equals(attrPrefix) && declAttrNS == null) { // declare this prefix if ((fFeatures & NAMESPACEDECLS) != 0) { fSerializer.addAttribute(XMLNS_URI, attrPrefix, XMLNS_PREFIX + ":" + attrPrefix, "CDATA", attrNS); fNSBinder.declarePrefix(attrPrefix, attrNS); fLocalNSBinder.declarePrefix(attrPrefix, attrNS); } } else { // find a prefix following the pattern "NS" +index // (starting at 1) // make sure this prefix is not declared in the current // scope. int counter = 1; attrPrefix = "NS" + counter++; while (fLocalNSBinder.getURI(attrPrefix) != null) { attrPrefix = "NS" + counter++; } // change attribute's prefix and Name attrName = attrPrefix + ":" + localName; // create a local namespace declaration attribute // Add the xmlns declaration attribute if ((fFeatures & NAMESPACEDECLS) != 0) { fSerializer.addAttribute(XMLNS_URI, attrPrefix, XMLNS_PREFIX + ":" + attrPrefix, "CDATA", attrNS); fNSBinder.declarePrefix(attrPrefix, attrNS); fLocalNSBinder.declarePrefix(attrPrefix, attrNS); } } } } } else { // if the Attr has no namespace URI // Attr has no localName if (localName == null) { // DOM Level 1 node! String msg = Utils.messages.createMessage( MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, new Object[] { attrName }); if (fErrorHandler != null) { fErrorHandler .handleError(new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null, null, null)); } } else { // uri=null and no colon // attr has no namespace URI and no prefix // no action is required, since attrs don't use default } } } // discard-default-content=true // Default attr's are not passed to the filter and this contraint // is applied only when discard-default-content=true // What about default xmlns attributes???? check for xmlnsAttr if ((((fFeatures & DISCARDDEFAULT) != 0) && isSpecified) || ((fFeatures & DISCARDDEFAULT) == 0)) { applyFilter = true; } else { addAttr = false; } if (applyFilter) { // apply the filter for Attributes that are not default attributes // or namespace decl attributes if (fFilter != null && (fFilter.getWhatToShow() & NodeFilter.SHOW_ATTRIBUTE) != 0) { if (!xmlnsAttr) { short code = fFilter.acceptNode(attr); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : addAttr = false; break; default : //fall through.. } } } } // if the node is a namespace node if (addAttr && xmlnsAttr) { // If namespace-declarations=true, add the node , else don't add it if ((fFeatures & NAMESPACEDECLS) != 0) { // The namespace may have been fixed up, in that case don't add it. if (localName != null && !"".equals(localName)) { fSerializer.addAttribute(attrNS, localName, attrName, type, attrValue); } } } else if ( addAttr && !xmlnsAttr) { // if the node is not a namespace node // If namespace-declarations=true, add the node with the Attr nodes namespaceURI // else add the node setting it's namespace to null or else the serializer will later // attempt to add a xmlns attr for the prefixed attribute if (((fFeatures & NAMESPACEDECLS) != 0) && (attrNS != null)) { fSerializer.addAttribute( attrNS, localName, attrName, type, attrValue); } else { fSerializer.addAttribute( "", localName, attrName, type, attrValue); } } // if (xmlnsAttr && ((fFeatures & NAMESPACEDECLS) != 0)) { int index; // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" . String prefix = (index = attrName.indexOf(":")) < 0 ? "" : attrName.substring(index + 1); if (!"".equals(prefix)) { fSerializer.namespaceAfterStartElement(prefix, attrValue); } } } } /** * Serializes an ProcessingInstruction Node. * * @param node The ProcessingInstruction Node to serialize */ protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } } /** * Serializes an CDATASection Node. * * @param node The CDATASection Node to serialize */ protected void serializeCDATASection(CDATASection node) throws SAXException { // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCDATASectionWellFormed(node); } // cdata-sections = true if ((fFeatures & CDATA) != 0) { // split-cdata-sections = true // Assumption: This parameter has an effect only when // cdata-sections=true // ToStream, by default splits cdata-sections. Hence the check // below. String nodeValue = node.getNodeValue(); int endIndex = nodeValue.indexOf("]]>"); if ((fFeatures & SPLITCDATA) != 0) { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_WARNING, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT, null, relatedData, null)); } } } else { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT)); } // Report an error and return. What error??? return; } } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; } // splits the cdata-section if (fLexicalHandler != null) { fLexicalHandler.startCDATA(); } dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); } } else { dispatachChars(node); } } /** * Serializes an Text Node. * * @param node The Text Node to serialize */ protected void serializeText(Text node) throws SAXException { if (fNextIsRaw) { fNextIsRaw = false; fSerializer.processingInstruction( javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); fSerializer.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { // keep track of dispatch or not to avoid duplicaiton of filter code boolean bDispatch = false; // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isTextWellFormed(node); } // if the node is whitespace // Determine the Attr's type. boolean isElementContentWhitespace = false; if (fIsLevel3DOM) { isElementContentWhitespace = node.isElementContentWhitespace(); } if (isElementContentWhitespace) { // element-content-whitespace=true if ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) { bDispatch = true; } } else { bDispatch = true; } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_TEXT)) { return; } if (bDispatch) { dispatachChars(node); } } } /** * Serializes an EntityReference Node. * * @param node The EntityReference Node to serialize * @param bStart Inicates if called from start or endNode */ protected void serializeEntityReference( EntityReference node, boolean bStart) throws SAXException { if (bStart) { EntityReference eref = node; // entities=true if ((fFeatures & ENTITIES) != 0) { // perform well-formedness and other checking only if // entities = true // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isEntityReferneceWellFormed(node); } // check "unbound-prefix-in-entity-reference" [fatal] // Raised if the configuration parameter "namespaces" is set to true if ((fFeatures & NAMESPACES) != 0) { checkUnboundPrefixInEntRef(node); } // The filter should not apply in this case, since the // EntityReference is not being expanded. // should we pass entity reference nodes to the filter??? } if (fLexicalHandler != null) { // startEntity outputs only Text but not Element, Attr, Comment // and PI child nodes. It does so by setting the m_inEntityRef // in ToStream and using this to decide if a node is to be // serialized or not. fLexicalHandler.startEntity(eref.getNodeName()); } } else { EntityReference eref = node; // entities=true or false, if (fLexicalHandler != null) { fLexicalHandler.endEntity(eref.getNodeName()); } } } // *********************************************************************** // Methods to check well-formedness // *********************************************************************** /** * Taken from org.apache.xerces.dom.CoreDocumentImpl * * Check the string against XML's definition of acceptable names for * elements and attributes and so on using the XMLCharacterProperties * utility class */ protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); } /** * Taken from org.apache.xerces.dom.CoreDocumentImpl * * Checks if the given qualified name is legal with respect * to the version of XML to which this document must conform. * * @param prefix prefix of qualified name * @param local local part of qualified name */ protected boolean isValidQName( String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; } /** * Checks if a XML character is well-formed * * @param characters A String of characters to be checked for Well-Formedness * @param refInvalidChar A reference to the character to be returned that was determined invalid. */ protected boolean isWFXMLChar(String chardata, Character refInvalidChar) { if (chardata == null || (chardata.length() == 0)) { return true; } char[] dataarray = chardata.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { //we need to check all characters as per production rules of XML11 int i = 0; while (i < datalength) { if (XML11Char.isXML11Invalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // version of the document is XML 1.0 else { // we need to check all characters as per production rules of XML 1.0 int i = 0; while (i < datalength) { if (XMLChar.isInvalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // end-else fDocument.isXMLVersion() return true; } // isXMLCharWF /** * Checks if a XML character is well-formed. If there is a problem with * the character a non-null Character is returned else null is returned. * * @param characters A String of characters to be checked for Well-Formedness * @return Character A reference to the character to be returned that was determined invalid. */ protected Character isWFXMLChar(String chardata) { Character refInvalidChar; if (chardata == null || (chardata.length() == 0)) { return null; } char[] dataarray = chardata.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { //we need to check all characters as per production rules of XML11 int i = 0; while (i < datalength) { if (XML11Char.isXML11Invalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return refInvalidChar; } } } // version of the document is XML 1.0 else { // we need to check all characters as per production rules of XML 1.0 int i = 0; while (i < datalength) { if (XMLChar.isInvalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return refInvalidChar; } } } // end-else fDocument.isXMLVersion() return null; } // isXMLCharWF /** * Checks if a comment node is well-formed * * @param data The contents of the comment node * @return a boolean indiacating if the comment is well-formed or not. */ protected void isCommentWellFormed(String data) { if (data == null || (data.length() == 0)) { return; } char[] dataarray = data.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { // we need to check all chracters as per production rules of XML11 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XML11Char.isXML11Invalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } // version of the document is XML 1.0 else { // we need to check all chracters as per production rules of XML 1.0 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XMLChar.isInvalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } return; } /** * Checks if an element node is well-formed, by checking its Name for well-formedness. * * @param data The contents of the comment node * @return a boolean indiacating if the comment is well-formed or not. */ protected void isElementWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Element", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } } /** * Checks if an attr node is well-formed, by checking it's Name and value * for well-formedness. * * @param data The contents of the comment node * @return a boolean indiacating if the comment is well-formed or not. */ protected void isAttributeWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Attr", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Check the Attr's node value // WFC: No < in Attribute Values String value = node.getNodeValue(); if (value.indexOf('<') >= 0) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_LT_IN_ATTVAL, new Object[] { ((Attr) node).getOwnerElement().getNodeName(), node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_LT_IN_ATTVAL, null, null, null)); } } // we need to loop through the children of attr nodes and check their values for // well-formedness NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); // An attribute node with no text or entity ref child for example // doc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns"); // followes by // element.setAttributeNodeNS(attribute); // can potentially lead to this situation. If the attribute // was a prefix Namespace attribute declaration then then DOM Core // should have some exception defined for this. if (child == null) { // we should probably report an error continue; } switch (child.getNodeType()) { case Node.TEXT_NODE : isTextWellFormed((Text) child); break; case Node.ENTITY_REFERENCE_NODE : isEntityReferneceWellFormed((EntityReference) child); break; default : } } // TODO: // WFC: Check if the attribute prefix is bound to // http://www.w3.org/2000/xmlns/ // WFC: Unique Att Spec // Perhaps pass a seen boolean value to this method. serializeAttList will determine // if the attr was seen before. } /** * Checks if a PI node is well-formed, by checking it's Name and data * for well-formedness. * * @param data The contents of the comment node */ protected void isPIWellFormed(ProcessingInstruction node) { // Is the PI Target a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "ProcessingInstruction", node.getTarget()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Does the PI Data carry valid XML characters // REVISIT: Should we check if the PI DATA contains a ?> ??? Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } /** * Checks if an CDATASection node is well-formed, by checking it's data * for well-formedness. Note that the presence of a CDATA termination mark * in the contents of a CDATASection is handled by the parameter * spli-cdata-sections * * @param data The contents of the comment node */ protected void isCDATASectionWellFormed(CDATASection node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); //if (!isWFXMLChar(node.getData(), invalidChar)) { if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } /** * Checks if an Text node is well-formed, by checking if it contains invalid * XML characters. * * @param data The contents of the comment node */ protected void isTextWellFormed(Text node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } /** * Checks if an EntityRefernece node is well-formed, by checking it's node name. Then depending * on whether it is referenced in Element content or in an Attr Node, checks if the EntityReference * references an unparsed entity or a external entity and if so throws raises the * appropriate well-formedness error. * * @param data The contents of the comment node * @parent The parent of the EntityReference Node */ protected void isEntityReferneceWellFormed(EntityReference node) { // Is the EntityReference name a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "EntityReference", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // determine the parent node Node parent = node.getParentNode(); // Traverse the declared entities and check if the nodeName and namespaceURI // of the EntityReference matches an Entity. If so, check the if the notationName // is not null, if so, report an error. DocumentType docType = node.getOwnerDocument().getDoctype(); if (docType != null) { NamedNodeMap entities = docType.getEntities(); for (int i = 0; i < entities.getLength(); i++) { Entity ent = (Entity) entities.item(i); String nodeName = node.getNodeName() == null ? "" : node.getNodeName(); String nodeNamespaceURI = node.getNamespaceURI() == null ? "" : node.getNamespaceURI(); String entName = ent.getNodeName() == null ? "" : ent.getNodeName(); String entNamespaceURI = ent.getNamespaceURI() == null ? "" : ent.getNamespaceURI(); // If referenced in Element content // WFC: Parsed Entity if (parent.getNodeType() == Node.ELEMENT_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_UNPARSED_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_UNPARSED_ENT, null, null, null)); } } } } // end if WFC: Parsed Entity // If referenced in an Attr value // WFC: No External Entity References if (parent.getNodeType() == Node.ATTRIBUTE_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getPublicId() != null || ent.getSystemId() != null || ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, null, null, null)); } } } } //end if WFC: No External Entity References } } } // isEntityReferneceWellFormed /** * If the configuration parameter "namespaces" is set to true, this methods * checks if an entity whose replacement text contains unbound namespace * prefixes is referenced in a location where there are no bindings for * the namespace prefixes and if so raises a LSException with the error-type * "unbound-prefix-in-entity-reference" * * @param Node, The EntityReference nodes whose children are to be checked */ protected void checkUnboundPrefixInEntRef(Node node) { Node child, next; for (child = node.getFirstChild(); child != null; child = next) { next = child.getNextSibling(); if (child.getNodeType() == Node.ELEMENT_NODE) { //If a NamespaceURI is not declared for the current //node's prefix, raise a fatal error. String prefix = child.getPrefix(); if (prefix != null && fNSBinder.getURI(prefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), prefix }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } NamedNodeMap attrs = child.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { String attrPrefix = attrs.item(i).getPrefix(); if (attrPrefix != null && fNSBinder.getURI(attrPrefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), attrs.item(i)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } } } if (child.hasChildNodes()) { checkUnboundPrefixInEntRef(child); } } } // *********************************************************************** // Namespace normalization // *********************************************************************** /** * Records local namespace declarations, to be used for normalization later * * @param Node, The element node, whose namespace declarations are to be recorded */ protected void recordLocalNSDecl(Node node) { NamedNodeMap atts = ((Element) node).getAttributes(); int length = atts.getLength(); for (int i = 0; i < length; i++) { Node attr = atts.item(i); String localName = attr.getLocalName(); String attrPrefix = attr.getPrefix(); String attrValue = attr.getNodeValue(); String attrNS = attr.getNamespaceURI(); localName = localName == null || XMLNS_PREFIX.equals(localName) ? "" : localName; attrPrefix = attrPrefix == null ? "" : attrPrefix; attrValue = attrValue == null ? "" : attrValue; attrNS = attrNS == null ? "" : attrNS; // check if attribute is a namespace decl if (XMLNS_URI.equals(attrNS)) { // No prefix may be bound to http://www.w3.org/2000/xmlns/. if (XMLNS_URI.equals(attrValue)) { String msg = Utils.messages.createMessage( MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, new Object[] { attrPrefix, XMLNS_URI }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, null, null, null)); } } else { // store the namespace-declaration if (XMLNS_PREFIX.equals(attrPrefix) ) { // record valid decl if (attrValue.length() != 0) { fNSBinder.declarePrefix(localName, attrValue); } else { // Error; xmlns:prefix="" } } else { // xmlns // empty prefix is always bound ("" or some string) fNSBinder.declarePrefix("", attrValue); } } } } } /** * Fixes an element's namespace * * @param Node, The element node, whose namespace is to be fixed */ protected void fixupElementNS(Node node) throws SAXException { String namespaceURI = ((Element) node).getNamespaceURI(); String prefix = ((Element) node).getPrefix(); String localName = ((Element) node).getLocalName(); if (namespaceURI != null) { //if ( Element's prefix/namespace pair (or default namespace, // if no prefix) are within the scope of a binding ) prefix = prefix == null ? "" : prefix; String inScopeNamespaceURI = fNSBinder.getURI(prefix); if ((inScopeNamespaceURI != null && inScopeNamespaceURI.equals(namespaceURI))) { // do nothing, declaration in scope is inherited } else { // Create a local namespace declaration attr for this namespace, // with Element's current prefix (or a default namespace, if // no prefix). If there's a conflicting local declaration // already present, change its value to use this namespace. // Add the xmlns declaration attribute //fNSBinder.pushNamespace(prefix, namespaceURI, fElementDepth); if ((fFeatures & NAMESPACEDECLS) != 0) { if ("".equals(prefix) || "".equals(namespaceURI)) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceURI); } else { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX + ":" + prefix, namespaceURI); } } fLocalNSBinder.declarePrefix(prefix, namespaceURI); fNSBinder.declarePrefix(prefix, namespaceURI); } } else { // Element has no namespace // DOM Level 1 if (localName == null || "".equals(localName)) { // DOM Level 1 node! String msg = Utils.messages.createMessage( MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null, null, null)); } } else { namespaceURI = fNSBinder.getURI(""); if (namespaceURI !=null && namespaceURI.length() > 0) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, ""); fLocalNSBinder.declarePrefix("", ""); fNSBinder.declarePrefix("", ""); } } } } /** * This table is a quick lookup of a property key (String) to the integer that * is the bit to flip in the fFeatures field, so the integers should have * values 1,2,4,8,16... * */ private static final Hashtable s_propKeys = new Hashtable(); static { // Initialize the mappings of property keys to bit values (Integer objects) // or mappings to a String object "", which indicates we are interested // in the property, but it does not have a simple bit value to flip // cdata-sections int i = CDATA; Integer val = new Integer(i); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, val); // comments int i1 = COMMENTS; val = new Integer(i1); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, val); // element-content-whitespace int i2 = ELEM_CONTENT_WHITESPACE; val = new Integer(i2); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, val); int i3 = ENTITIES; // entities val = new Integer(i3); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, val); // namespaces int i4 = NAMESPACES; val = new Integer(i4); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, val); // namespace-declarations int i5 = NAMESPACEDECLS; val = new Integer(i5); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, val); // split-cdata-sections int i6 = SPLITCDATA; val = new Integer(i6); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, val); // discard-default-content int i7 = WELLFORMED; val = new Integer(i7); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, val); // discard-default-content int i8 = DISCARDDEFAULT; val = new Integer(i8); s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, val); // We are interested in these properties, but they don't have a simple // bit value to deal with. s_propKeys.put( DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT, ""); s_propKeys.put(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, ""); s_propKeys.put( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION, ""); s_propKeys.put(DOMConstants.S_XSL_OUTPUT_ENCODING, ""); s_propKeys.put(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, ""); } /** * Initializes fFeatures based on the DOMConfiguration Parameters set. * * @param properties DOMConfiguraiton properties that were set and which are * to be used while serializing the DOM. */ protected void initProperties(Properties properties) { for (Enumeration keys = properties.keys(); keys.hasMoreElements();) { final String key = (String) keys.nextElement(); // caonical-form // Other features will be enabled or disabled when this is set to true or false. // error-handler; set via the constructor // infoset // Other features will be enabled or disabled when this is set to true // A quick lookup for the given set of properties (cdata-sections ...) final Object iobj = s_propKeys.get(key); if (iobj != null) { if (iobj instanceof Integer) { // Dealing with a property that has a simple bit value that // we need to set // cdata-sections // comments // element-content-whitespace // entities // namespaces // namespace-declarations // split-cdata-sections // well-formed // discard-default-content final int BITFLAG = ((Integer) iobj).intValue(); if ((properties.getProperty(key).endsWith("yes"))) { fFeatures = fFeatures | BITFLAG; } else { fFeatures = fFeatures & ~BITFLAG; } } else { // We are interested in the property, but it is not // a simple bit that we need to set. if ((DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT) .equals(key)) { // format-pretty-print; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setIndent(true); fSerializer.setIndentAmount(3); } else { fSerializer.setIndent(false); } } else if ( (DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL).equals( key)) { // omit-xml-declaration; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setOmitXMLDeclaration(true); } else { fSerializer.setOmitXMLDeclaration(false); } } else if ( ( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION).equals( key)) { // Retreive the value of the XML Version attribute via the xml-version String version = properties.getProperty(key); if ("1.1".equals(version)) { fIsXMLVersion11 = true; fSerializer.setVersion(version); } else { fSerializer.setVersion("1.0"); } } else if ( (DOMConstants.S_XSL_OUTPUT_ENCODING).equals(key)) { // Retreive the value of the XML Encoding attribute String encoding = properties.getProperty(key); if (encoding != null) { fSerializer.setEncoding(encoding); } } else if ((DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES).equals(key)) { // Preserve entity references in the document if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setDTDEntityExpansion(false); } else { fSerializer.setDTDEntityExpansion(true); } } else { // We shouldn't get here, ever, now what? } } } } // Set the newLine character to use if (fNewLine != null) { fSerializer.setOutputProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR, fNewLine); } } } //TreeWalker libxalan2-java-2.7.1/src/org/apache/xml/serializer/dom3/LSSerializerImpl.java0000644000175000017500000022442610721374030025756 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: $ */ package org.apache.xml.serializer.dom3; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; import java.util.StringTokenizer; import org.apache.xml.serializer.DOM3Serializer; import org.apache.xml.serializer.Encodings; import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.SystemIDResolver; import org.apache.xml.serializer.utils.Utils; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.DOMException; import org.w3c.dom.DOMStringList; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.ls.LSException; import org.w3c.dom.ls.LSOutput; import org.w3c.dom.ls.LSSerializer; import org.w3c.dom.ls.LSSerializerFilter; /** * Implemenatation of DOM Level 3 org.w3c.ls.LSSerializer and * org.w3c.dom.ls.DOMConfiguration. Serialization is achieved by delegating * serialization calls to org.apache.xml.serializer.ToStream or * one of its derived classes depending on the serialization method, while walking * the DOM in DOM3TreeWalker. * @see org.w3c.dom.ls.LSSerializer * @see org.w3c.dom.DOMConfiguration * * @version $Id: * * @xsl.usage internal */ final public class LSSerializerImpl implements DOMConfiguration, LSSerializer { // The default end-of-line character sequence used in serialization. private static final String DEFAULT_END_OF_LINE; static { String lineSeparator = (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { return System.getProperty("line.separator"); } catch (SecurityException ex) {} return null; } }); // The DOM Level 3 Load and Save specification requires that implementations choose a default // sequence which matches one allowed by XML 1.0 (or XML 1.1). If the value of "line.separator" // isn't one of the XML 1.0 end-of-line sequences then we select "\n" as the default value. DEFAULT_END_OF_LINE = lineSeparator != null && (lineSeparator.equals("\r\n") || lineSeparator.equals("\r")) ? lineSeparator : "\n"; } /** private data members */ private Serializer fXMLSerializer = null; // Tracks DOMConfiguration features. protected int fFeatures = 0; // Common DOM serializer private DOM3Serializer fDOMSerializer = null; // A filter set on the LSSerializer private LSSerializerFilter fSerializerFilter = null; // Stores the nodeArg parameter to speed up multiple writes of the same node. private Node fVisitedNode = null; // The end-of-line character sequence used in serialization. "\n" is whats used on the web. private String fEndOfLine = DEFAULT_END_OF_LINE; // The DOMErrorhandler. private DOMErrorHandler fDOMErrorHandler = null; // The Configuration parameter to pass to the Underlying serilaizer. private Properties fDOMConfigProperties = null; // The encoding to use during serialization. private String fEncoding; // ************************************************************************ // DOM Level 3 DOM Configuration parameter names // ************************************************************************ // Parameter canonical-form, true [optional] - NOT SUPPORTED private final static int CANONICAL = 0x1 << 0; // Parameter cdata-sections, true [required] (default) private final static int CDATA = 0x1 << 1; // Parameter check-character-normalization, true [optional] - NOT SUPPORTED private final static int CHARNORMALIZE = 0x1 << 2; // Parameter comments, true [required] (default) private final static int COMMENTS = 0x1 << 3; // Parameter datatype-normalization, true [optional] - NOT SUPPORTED private final static int DTNORMALIZE = 0x1 << 4; // Parameter element-content-whitespace, true [required] (default) - value - false [optional] NOT SUPPORTED private final static int ELEM_CONTENT_WHITESPACE = 0x1 << 5; // Parameter entities, true [required] (default) private final static int ENTITIES = 0x1 << 6; // Parameter infoset, true [required] (default), false has no effect --> True has no effect for the serializer private final static int INFOSET = 0x1 << 7; // Parameter namespaces, true [required] (default) private final static int NAMESPACES = 0x1 << 8; // Parameter namespace-declarations, true [required] (default) private final static int NAMESPACEDECLS = 0x1 << 9; // Parameter normalize-characters, true [optional] - NOT SUPPORTED private final static int NORMALIZECHARS = 0x1 << 10; // Parameter split-cdata-sections, true [required] (default) private final static int SPLITCDATA = 0x1 << 11; // Parameter validate, true [optional] - NOT SUPPORTED private final static int VALIDATE = 0x1 << 12; // Parameter validate-if-schema, true [optional] - NOT SUPPORTED private final static int SCHEMAVALIDATE = 0x1 << 13; // Parameter split-cdata-sections, true [required] (default) private final static int WELLFORMED = 0x1 << 14; // Parameter discard-default-content, true [required] (default) // Not sure how this will be used in level 2 Documents private final static int DISCARDDEFAULT = 0x1 << 15; // Parameter format-pretty-print, true [optional] private final static int PRETTY_PRINT = 0x1 << 16; // Parameter ignore-unknown-character-denormalizations, true [required] (default) // We currently do not support XML 1.1 character normalization private final static int IGNORE_CHAR_DENORMALIZE = 0x1 << 17; // Parameter discard-default-content, true [required] (default) private final static int XMLDECL = 0x1 << 18; // ************************************************************************ // Recognized parameters for which atleast one value can be set private String fRecognizedParameters [] = { DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM_COMMENTS, DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM_ENTITIES, DOMConstants.DOM_INFOSET, DOMConstants.DOM_NAMESPACES, DOMConstants.DOM_NAMESPACE_DECLARATIONS, //DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM_VALIDATE, DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM_WELLFORMED, DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM_FORMAT_PRETTY_PRINT, DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, DOMConstants.DOM_XMLDECL, DOMConstants.DOM_ERROR_HANDLER }; /** * Constructor: Creates a LSSerializerImpl object. The underlying * XML 1.0 or XML 1.1 org.apache.xml.serializer.Serializer object is * created and initialized the first time any of the write methods are * invoked to serialize the Node. Subsequent write methods on the same * LSSerializerImpl object will use the previously created Serializer object. */ public LSSerializerImpl () { // set default parameters fFeatures |= CDATA; fFeatures |= COMMENTS; fFeatures |= ELEM_CONTENT_WHITESPACE; fFeatures |= ENTITIES; fFeatures |= NAMESPACES; fFeatures |= NAMESPACEDECLS; fFeatures |= SPLITCDATA; fFeatures |= WELLFORMED; fFeatures |= DISCARDDEFAULT; fFeatures |= XMLDECL; // New OutputFormat properties fDOMConfigProperties = new Properties(); // Initialize properties to be passed on the underlying serializer initializeSerializerProps(); // Create the underlying serializer. Properties configProps = OutputPropertiesFactory.getDefaultMethodProperties("xml"); // change xml version from 1.0 to 1.1 //configProps.setProperty("version", "1.1"); // Get a serializer that seriailizes according the the properties, // which in this case is to xml fXMLSerializer = SerializerFactory.getSerializer(configProps); // Initialize Serializer fXMLSerializer.setOutputFormat(fDOMConfigProperties); } /** * Initializes the underlying serializer's configuration depending on the * default DOMConfiguration parameters. This method must be called before a * node is to be serialized. * * @xsl.usage internal */ public void initializeSerializerProps () { // canonical-form fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM3_DEFAULT_FALSE); // cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_TRUE); // "check-character-normalization" fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // comments fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); // datatype-normalization fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // element-content-whitespace fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); // entities fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // error-handler // Should we set our default ErrorHandler /* * if (fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER) != null) { * fDOMErrorHandler = * (DOMErrorHandler)fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER); } */ // infoset if ((fFeatures & INFOSET) != 0) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); } // namespaces fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); // namespace-declarations fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); // normalize-characters /* fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM3_DEFAULT_FALSE); */ // split-cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_DEFAULT_TRUE); // validate fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE, DOMConstants.DOM3_DEFAULT_FALSE); // validate-if-schema fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); // well-formed fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); // pretty-print fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_INDENT, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty( OutputPropertiesFactory.S_KEY_INDENT_AMOUNT, Integer.toString(3)); // // discard-default-content fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_DEFAULT_TRUE); // xml-declaration fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); } // ************************************************************************ // DOMConfiguraiton implementation // ************************************************************************ /** * Checks if setting a parameter to a specific value is supported. * * @see org.w3c.dom.DOMConfiguration#canSetParameter(java.lang.String, java.lang.Object) * @since DOM Level 3 * @param name A String containing the DOMConfiguration parameter name. * @param value An Object specifying the value of the corresponding parameter. */ public boolean canSetParameter(String name, Object value) { if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){ // both values supported return true; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported return !((Boolean)value).booleanValue(); } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported return ((Boolean)value).booleanValue(); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) && value == null || value instanceof DOMErrorHandler){ return true; } return false; } /** * This method returns the value of a parameter if known. * * @see org.w3c.dom.DOMConfiguration#getParameter(java.lang.String) * * @param name A String containing the DOMConfiguration parameter name * whose value is to be returned. * @return Object The value of the parameter if known. */ public Object getParameter(String name) throws DOMException { if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { return ((fFeatures & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { return ((fFeatures & CDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { return ((fFeatures & ENTITIES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { return ((fFeatures & NAMESPACES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { return ((fFeatures & NAMESPACEDECLS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { return ((fFeatures & SPLITCDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { return ((fFeatures & WELLFORMED) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { return ((fFeatures & DISCARDDEFAULT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { return ((fFeatures & XMLDECL) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)){ if ((fFeatures & ENTITIES) == 0 && (fFeatures & CDATA) == 0 && (fFeatures & ELEM_CONTENT_WHITESPACE) != 0 && (fFeatures & NAMESPACES) != 0 && (fFeatures & NAMESPACEDECLS) != 0 && (fFeatures & WELLFORMED) != 0 && (fFeatures & COMMENTS) != 0) { return Boolean.TRUE; } return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) { return fDOMErrorHandler; } else if ( name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { return null; } else { // Here we have to add the Xalan specific DOM Message Formatter String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } } /** * This method returns a of the parameters supported by this DOMConfiguration object * and for which at least one value can be set by the application * * @see org.w3c.dom.DOMConfiguration#getParameterNames() * * @return DOMStringList A list of DOMConfiguration parameters recognized * by the serializer */ public DOMStringList getParameterNames() { return new DOMStringListImpl(fRecognizedParameters); } /** * This method sets the value of the named parameter. * * @see org.w3c.dom.DOMConfiguration#setParameter(java.lang.String, java.lang.Object) * * @param name A String containing the DOMConfiguration parameter name. * @param value An Object contaiing the parameters value to set. */ public void setParameter(String name, Object value) throws DOMException { // If the value is a boolean if (value instanceof Boolean) { boolean state = ((Boolean) value).booleanValue(); if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { fFeatures = state ? fFeatures | COMMENTS : fFeatures & ~COMMENTS; // comments if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { fFeatures = state ? fFeatures | CDATA : fFeatures & ~CDATA; // cdata-sections if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { fFeatures = state ? fFeatures | ENTITIES : fFeatures & ~ENTITIES; // entities if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { fFeatures = state ? fFeatures | NAMESPACES : fFeatures & ~NAMESPACES; // namespaces if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name .equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { fFeatures = state ? fFeatures | NAMESPACEDECLS : fFeatures & ~NAMESPACEDECLS; // namespace-declarations if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { fFeatures = state ? fFeatures | SPLITCDATA : fFeatures & ~SPLITCDATA; // split-cdata-sections if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { fFeatures = state ? fFeatures | WELLFORMED : fFeatures & ~WELLFORMED; // well-formed if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name .equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { fFeatures = state ? fFeatures | DISCARDDEFAULT : fFeatures & ~DISCARDDEFAULT; // discard-default-content if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { fFeatures = state ? fFeatures | PRETTY_PRINT : fFeatures & ~PRETTY_PRINT; // format-pretty-print if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { fFeatures = state ? fFeatures | XMLDECL : fFeatures & ~XMLDECL; if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); } else { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "yes"); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { fFeatures = state ? fFeatures | ELEM_CONTENT_WHITESPACE : fFeatures & ~ELEM_CONTENT_WHITESPACE; // element-content-whitespace if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported if (!state) { // Here we have to add the Xalan specific DOM Message Formatter String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported if (state) { String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } else { if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { fDOMConfigProperties.setProperty(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION + DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE); } /* else if (name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM3_EXPLICIT_FALSE); } */ } } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)) { // infoset if (state) { fFeatures &= ~ENTITIES; fFeatures &= ~CDATA; fFeatures &= ~SCHEMAVALIDATE; fFeatures &= ~DTNORMALIZE; fFeatures |= NAMESPACES; fFeatures |= NAMESPACEDECLS; fFeatures |= WELLFORMED; fFeatures |= ELEM_CONTENT_WHITESPACE; fFeatures |= COMMENTS; fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE); } } else { // If this is a non-boolean parameter a type mismatch should be thrown. if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } // Parameter is not recognized String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } } // If the parameter value is not a boolean else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) { if (value == null || value instanceof DOMErrorHandler) { fDOMErrorHandler = (DOMErrorHandler)value; } else { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } } else if ( name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { if (value != null) { if (!(value instanceof String)) { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } } else { // If this is a boolean parameter a type mismatch should be thrown. if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)) { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } // Parameter is not recognized String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } } // ************************************************************************ // ************************************************************************ // DOMConfiguraiton implementation // ************************************************************************ /** * Returns the DOMConfiguration of the LSSerializer. * * @see org.w3c.dom.ls.LSSerializer#getDomConfig() * @since DOM Level 3 * @return A DOMConfiguration object. */ public DOMConfiguration getDomConfig() { return (DOMConfiguration)this; } /** * Returns the DOMConfiguration of the LSSerializer. * * @see org.w3c.dom.ls.LSSerializer#getFilter() * @since DOM Level 3 * @return A LSSerializerFilter object. */ public LSSerializerFilter getFilter() { return fSerializerFilter; } /** * Returns the End-Of-Line sequence of characters to be used in the XML * being serialized. If none is set a default "\n" is returned. * * @see org.w3c.dom.ls.LSSerializer#getNewLine() * @since DOM Level 3 * @return A String containing the end-of-line character sequence used in * serialization. */ public String getNewLine() { return fEndOfLine; } /** * Set a LSSerilizerFilter on the LSSerializer. When set, the filter is * called before each node is serialized which depending on its implemention * determines if the node is to be serialized or not. * * @see org.w3c.dom.ls.LSSerializer#setFilter * @since DOM Level 3 * @param filter A LSSerializerFilter to be applied to the stream to serialize. */ public void setFilter(LSSerializerFilter filter) { fSerializerFilter = filter; } /** * Sets the End-Of-Line sequence of characters to be used in the XML * being serialized. Setting this attribute to null will reset its * value to the default value i.e. "\n". * * @see org.w3c.dom.ls.LSSerializer#setNewLine * @since DOM Level 3 * @param newLine a String that is the end-of-line character sequence to be used in * serialization. */ public void setNewLine(String newLine) { fEndOfLine = (newLine != null) ? newLine : DEFAULT_END_OF_LINE; } /** * Serializes the specified node to the specified LSOutput and returns true if the Node * was successfully serialized. * * @see org.w3c.dom.ls.LSSerializer#write(org.w3c.dom.Node, org.w3c.dom.ls.LSOutput) * @since DOM Level 3 * @param nodeArg The Node to serialize. * @throws org.w3c.dom.ls.LSException SERIALIZE_ERR: Raised if the * LSSerializer was unable to serialize the node. * */ public boolean write(Node nodeArg, LSOutput destination) throws LSException { // If the destination is null if (destination == null) { String msg = Utils.messages .createMessage( MsgKey.ER_NO_OUTPUT_SPECIFIED, null); if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_NO_OUTPUT_SPECIFIED)); } throw new LSException(LSException.SERIALIZE_ERR, msg); } // If nodeArg is null, return false. Should we throw and LSException instead? if (nodeArg == null ) { return false; } // Obtain a reference to the serializer to use // Serializer serializer = getXMLSerializer(xmlVersion); Serializer serializer = fXMLSerializer; serializer.reset(); // If the node has not been seen if ( nodeArg != fVisitedNode) { // Determine the XML Document version of the Node String xmlVersion = getXMLVersion(nodeArg); // Determine the encoding: 1.LSOutput.encoding, 2.Document.inputEncoding, 3.Document.xmlEncoding. fEncoding = destination.getEncoding(); if (fEncoding == null ) { fEncoding = getInputEncoding(nodeArg); fEncoding = fEncoding != null ? fEncoding : getXMLEncoding(nodeArg) == null? "UTF-8": getXMLEncoding(nodeArg); } // If the encoding is not recognized throw an exception. // Note: The serializer defaults to UTF-8 when created if (!Encodings.isRecognizedEncoding(fEncoding)) { String msg = Utils.messages .createMessage( MsgKey.ER_UNSUPPORTED_ENCODING, null); if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_UNSUPPORTED_ENCODING)); } throw new LSException(LSException.SERIALIZE_ERR, msg); } serializer.getOutputFormat().setProperty("version", xmlVersion); // Set the output encoding and xml version properties fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION, xmlVersion); fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_ENCODING, fEncoding); // If the node to be serialized is not a Document, Element, or Entity // node // then the XML declaration, or text declaration, should be never be // serialized. if ( (nodeArg.getNodeType() != Node.DOCUMENT_NODE || nodeArg.getNodeType() != Node.ELEMENT_NODE || nodeArg.getNodeType() != Node.ENTITY_NODE) && ((fFeatures & XMLDECL) != 0)) { fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, DOMConstants.DOM3_DEFAULT_FALSE); } fVisitedNode = nodeArg; } // Update the serializer properties fXMLSerializer.setOutputFormat(fDOMConfigProperties); // try { // The LSSerializer will use the LSOutput object to determine // where to serialize the output to in the following order the // first one that is not null and not an empty string will be // used: 1.LSOutput.characterStream, 2.LSOutput.byteStream, // 3. LSOutput.systemId // 1.LSOutput.characterStream Writer writer = destination.getCharacterStream(); if (writer == null ) { // 2.LSOutput.byteStream OutputStream outputStream = destination.getByteStream(); if ( outputStream == null) { // 3. LSOutput.systemId String uri = destination.getSystemId(); if (uri == null) { String msg = Utils.messages .createMessage( MsgKey.ER_NO_OUTPUT_SPECIFIED, null); if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_NO_OUTPUT_SPECIFIED)); } throw new LSException(LSException.SERIALIZE_ERR, msg); } else { // Expand the System Id and obtain an absolute URI for it. String absoluteURI = SystemIDResolver.getAbsoluteURI(uri); URL url = new URL(absoluteURI); OutputStream urlOutStream = null; String protocol = url.getProtocol(); String host = url.getHost(); // For file protocols, there is no need to use a URL to get its // corresponding OutputStream // Scheme names consist of a sequence of characters. The lower case // letters "a"--"z", digits, and the characters plus ("+"), period // ("."), and hyphen ("-") are allowed. For resiliency, programs // interpreting URLs should treat upper case letters as equivalent to // lower case in scheme names (e.g., allow "HTTP" as well as "http"). if (protocol.equalsIgnoreCase("file") && (host == null || host.length() == 0 || host.equals("localhost"))) { // do we also need to check for host.equals(hostname) urlOutStream = new FileOutputStream(getPathWithoutEscapes(url.getPath())); } else { // This should support URL's whose schemes are mentioned in // RFC1738 other than file URLConnection urlCon = url.openConnection(); urlCon.setDoInput(false); urlCon.setDoOutput(true); urlCon.setUseCaches(false); urlCon.setAllowUserInteraction(false); // When writing to a HTTP URI, a HTTP PUT is performed. if (urlCon instanceof HttpURLConnection) { HttpURLConnection httpCon = (HttpURLConnection) urlCon; httpCon.setRequestMethod("PUT"); } urlOutStream = urlCon.getOutputStream(); } // set the OutputStream to that obtained from the systemId serializer.setOutputStream(urlOutStream); } } else { // 2.LSOutput.byteStream serializer.setOutputStream(outputStream); } } else { // 1.LSOutput.characterStream serializer.setWriter(writer); } // The associated media type by default is set to text/xml on // org.apache.xml.serializer.SerializerBase. // Get a reference to the serializer then lets you serilize a DOM // Use this hack till Xalan support JAXP1.3 if (fDOMSerializer == null) { fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer(); } // Set the error handler on the DOM3Serializer interface implementation if (fDOMErrorHandler != null) { fDOMSerializer.setErrorHandler(fDOMErrorHandler); } // Set the filter on the DOM3Serializer interface implementation if (fSerializerFilter != null) { fDOMSerializer.setNodeFilter(fSerializerFilter); } // Set the NewLine character to be used fDOMSerializer.setNewLine(fEndOfLine.toCharArray()); // Serializer your DOM, where node is an org.w3c.dom.Node // Assuming that Xalan's serializer can serialize any type of DOM node fDOMSerializer.serializeDOM3(nodeArg); } catch( UnsupportedEncodingException ue) { String msg = Utils.messages .createMessage( MsgKey.ER_UNSUPPORTED_ENCODING, null); if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_UNSUPPORTED_ENCODING, ue)); } throw (LSException) createLSException(LSException.SERIALIZE_ERR, ue).fillInStackTrace(); } catch (LSException lse) { // Rethrow LSException. throw lse; } catch (RuntimeException e) { throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } catch (Exception e) { if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, e.getMessage(), null, e)); } throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } return true; } /** * Serializes the specified node and returns a String with the serialized * data to the caller. * * @see org.w3c.dom.ls.LSSerializer#writeToString(org.w3c.dom.Node) * @since DOM Level 3 * @param nodeArg The Node to serialize. * @throws org.w3c.dom.ls.LSException SERIALIZE_ERR: Raised if the * LSSerializer was unable to serialize the node. * */ public String writeToString(Node nodeArg) throws DOMException, LSException { // return null is nodeArg is null. Should an Exception be thrown instead? if (nodeArg == null) { return null; } // Should we reset the serializer configuration before each write operation? // Obtain a reference to the serializer to use Serializer serializer = fXMLSerializer; serializer.reset(); if (nodeArg != fVisitedNode){ // Determine the XML Document version of the Node String xmlVersion = getXMLVersion(nodeArg); serializer.getOutputFormat().setProperty("version", xmlVersion); // Set the output encoding and xml version properties fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION, xmlVersion); fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_ENCODING, "UTF-16"); // If the node to be serialized is not a Document, Element, or Entity // node // then the XML declaration, or text declaration, should be never be // serialized. if ((nodeArg.getNodeType() != Node.DOCUMENT_NODE || nodeArg.getNodeType() != Node.ELEMENT_NODE || nodeArg.getNodeType() != Node.ENTITY_NODE) && ((fFeatures & XMLDECL) != 0)) { fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, DOMConstants.DOM3_DEFAULT_FALSE); } fVisitedNode = nodeArg; } // Update the serializer properties fXMLSerializer.setOutputFormat(fDOMConfigProperties); // StringWriter to Output to StringWriter output = new StringWriter(); // try { // Set the Serializer's Writer to a StringWriter serializer.setWriter(output); // Get a reference to the serializer then lets you serilize a DOM // Use this hack till Xalan support JAXP1.3 if (fDOMSerializer == null) { fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer(); } // Set the error handler on the DOM3Serializer interface implementation if (fDOMErrorHandler != null) { fDOMSerializer.setErrorHandler(fDOMErrorHandler); } // Set the filter on the DOM3Serializer interface implementation if (fSerializerFilter != null) { fDOMSerializer.setNodeFilter(fSerializerFilter); } // Set the NewLine character to be used fDOMSerializer.setNewLine(fEndOfLine.toCharArray()); // Serializer your DOM, where node is an org.w3c.dom.Node fDOMSerializer.serializeDOM3(nodeArg); } catch (LSException lse) { // Rethrow LSException. throw lse; } catch (RuntimeException e) { throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } catch (Exception e) { if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, e.getMessage(), null, e)); } throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } // return the serialized string return output.toString(); } /** * Serializes the specified node to the specified URI and returns true if the Node * was successfully serialized. * * @see org.w3c.dom.ls.LSSerializer#writeToURI(org.w3c.dom.Node, String) * @since DOM Level 3 * @param nodeArg The Node to serialize. * @throws org.w3c.dom.ls.LSException SERIALIZE_ERR: Raised if the * LSSerializer was unable to serialize the node. * */ public boolean writeToURI(Node nodeArg, String uri) throws LSException { // If nodeArg is null, return false. Should we throw and LSException instead? if (nodeArg == null ) { return false; } // Obtain a reference to the serializer to use Serializer serializer = fXMLSerializer; serializer.reset(); if (nodeArg != fVisitedNode) { // Determine the XML Document version of the Node String xmlVersion = getXMLVersion(nodeArg); // Determine the encoding: 1.LSOutput.encoding, // 2.Document.inputEncoding, 3.Document.xmlEncoding. fEncoding = getInputEncoding(nodeArg); if (fEncoding == null ) { fEncoding = fEncoding != null ? fEncoding : getXMLEncoding(nodeArg) == null? "UTF-8": getXMLEncoding(nodeArg); } serializer.getOutputFormat().setProperty("version", xmlVersion); // Set the output encoding and xml version properties fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION, xmlVersion); fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_ENCODING, fEncoding); // If the node to be serialized is not a Document, Element, or Entity // node // then the XML declaration, or text declaration, should be never be // serialized. if ( (nodeArg.getNodeType() != Node.DOCUMENT_NODE || nodeArg.getNodeType() != Node.ELEMENT_NODE || nodeArg.getNodeType() != Node.ENTITY_NODE) && ((fFeatures & XMLDECL) != 0)) { fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, DOMConstants.DOM3_DEFAULT_FALSE); } fVisitedNode = nodeArg; } // Update the serializer properties fXMLSerializer.setOutputFormat(fDOMConfigProperties); // try { // If the specified encoding is not supported an // "unsupported-encoding" fatal error is raised. ?? if (uri == null) { String msg = Utils.messages.createMessage( MsgKey.ER_NO_OUTPUT_SPECIFIED, null); if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_NO_OUTPUT_SPECIFIED)); } throw new LSException(LSException.SERIALIZE_ERR, msg); } else { // REVISIT: Can this be used to get an absolute expanded URI String absoluteURI = SystemIDResolver.getAbsoluteURI(uri); URL url = new URL(absoluteURI); OutputStream urlOutStream = null; String protocol = url.getProtocol(); String host = url.getHost(); // For file protocols, there is no need to use a URL to get its // corresponding OutputStream // Scheme names consist of a sequence of characters. The lower // case letters "a"--"z", digits, and the characters plus ("+"), // period ("."), and hyphen ("-") are allowed. For resiliency, // programs interpreting URLs should treat upper case letters as // equivalent to lower case in scheme names // (e.g., allow "HTTP" as well as "http"). if (protocol.equalsIgnoreCase("file") && (host == null || host.length() == 0 || host .equals("localhost"))) { // do we also need to check for host.equals(hostname) urlOutStream = new FileOutputStream(getPathWithoutEscapes(url.getPath())); } else { // This should support URL's whose schemes are mentioned in // RFC1738 other than file URLConnection urlCon = url.openConnection(); urlCon.setDoInput(false); urlCon.setDoOutput(true); urlCon.setUseCaches(false); urlCon.setAllowUserInteraction(false); // When writing to a HTTP URI, a HTTP PUT is performed. if (urlCon instanceof HttpURLConnection) { HttpURLConnection httpCon = (HttpURLConnection) urlCon; httpCon.setRequestMethod("PUT"); } urlOutStream = urlCon.getOutputStream(); } // set the OutputStream to that obtained from the systemId serializer.setOutputStream(urlOutStream); } // Get a reference to the serializer then lets you serilize a DOM // Use this hack till Xalan support JAXP1.3 if (fDOMSerializer == null) { fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer(); } // Set the error handler on the DOM3Serializer interface implementation if (fDOMErrorHandler != null) { fDOMSerializer.setErrorHandler(fDOMErrorHandler); } // Set the filter on the DOM3Serializer interface implementation if (fSerializerFilter != null) { fDOMSerializer.setNodeFilter(fSerializerFilter); } // Set the NewLine character to be used fDOMSerializer.setNewLine(fEndOfLine.toCharArray()); // Serializer your DOM, where node is an org.w3c.dom.Node // Assuming that Xalan's serializer can serialize any type of DOM // node fDOMSerializer.serializeDOM3(nodeArg); } catch (LSException lse) { // Rethrow LSException. throw lse; } catch (RuntimeException e) { throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } catch (Exception e) { if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, e.getMessage(), null, e)); } throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } return true; } // ************************************************************************ // ************************************************************************ // Implementaion methods // ************************************************************************ /** * Determines the XML Version of the Document Node to serialize. If the Document Node * is not a DOM Level 3 Node, then the default version returned is 1.0. * * @param nodeArg The Node to serialize * @return A String containing the version pseudo-attribute of the XMLDecl. * @throws Throwable if the DOM implementation does not implement Document.getXmlVersion() */ //protected String getXMLVersion(Node nodeArg) throws Throwable { protected String getXMLVersion(Node nodeArg) { Document doc = null; // Determine the XML Version of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the DOM Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getXmlVersion(); } } // The version will be treated as "1.0" which may result in // an ill-formed document being serialized. // If nodeArg does not have an ownerDocument, treat this as XML 1.0 return "1.0"; } /** * Determines the XML Encoding of the Document Node to serialize. If the Document Node * is not a DOM Level 3 Node, then the default encoding "UTF-8" is returned. * * @param nodeArg The Node to serialize * @return A String containing the encoding pseudo-attribute of the XMLDecl. * @throws Throwable if the DOM implementation does not implement Document.getXmlEncoding() */ protected String getXMLEncoding(Node nodeArg) { Document doc = null; // Determine the XML Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the XML Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getXmlEncoding(); } } // The default encoding is UTF-8 except for the writeToString method return "UTF-8"; } /** * Determines the Input Encoding of the Document Node to serialize. If the Document Node * is not a DOM Level 3 Node, then null is returned. * * @param nodeArg The Node to serialize * @return A String containing the input encoding. */ protected String getInputEncoding(Node nodeArg) { Document doc = null; // Determine the Input Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the DOM Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getInputEncoding(); } } // The default encoding returned is null return null; } /** * This method returns the LSSerializer's error handler. * * @return Returns the fDOMErrorHandler. */ public DOMErrorHandler getErrorHandler() { return fDOMErrorHandler; } /** * Replaces all escape sequences in the given path with their literal characters. */ private static String getPathWithoutEscapes(String origPath) { if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) { // Locate the escape characters StringTokenizer tokenizer = new StringTokenizer(origPath, "%"); StringBuffer result = new StringBuffer(origPath.length()); int size = tokenizer.countTokens(); result.append(tokenizer.nextToken()); for(int i = 1; i < size; ++i) { String token = tokenizer.nextToken(); if (token.length() >= 2 && isHexDigit(token.charAt(0)) && isHexDigit(token.charAt(1))) { // Decode the 2 digit hexadecimal number following % in '%nn' result.append((char)Integer.valueOf(token.substring(0, 2), 16).intValue()); token = token.substring(2); } result.append(token); } return result.toString(); } return origPath; } /** * Returns true if the given character is a valid hex character. */ private static boolean isHexDigit(char c) { return (c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F'); } /** * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set. */ private static LSException createLSException(short code, Throwable cause) { LSException lse = new LSException(code, cause != null ? cause.getMessage() : null); if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) { try { ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause}); } // Something went wrong. There's not much we can do about it. catch (Exception e) {} } return lse; } /** * Holder of methods from java.lang.Throwable. */ static class ThrowableMethods { // Method: java.lang.Throwable.initCause(java.lang.Throwable) private static java.lang.reflect.Method fgThrowableInitCauseMethod = null; // Flag indicating whether or not Throwable methods available. private static boolean fgThrowableMethodsAvailable = false; private ThrowableMethods() {} // Attempt to get methods for java.lang.Throwable on class initialization. static { try { fgThrowableInitCauseMethod = Throwable.class.getMethod("initCause", new Class [] {Throwable.class}); fgThrowableMethodsAvailable = true; } // ClassNotFoundException, NoSuchMethodException or SecurityException // Whatever the case, we cannot use java.lang.Throwable.initCause(java.lang.Throwable). catch (Exception exc) { fgThrowableInitCauseMethod = null; fgThrowableMethodsAvailable = false; } } } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/ToHTMLStream.java0000644000175000017500000025050010721374030024135 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ToHTMLStream.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.util.Properties; import javax.xml.transform.Result; import org.apache.xml.serializer.utils.MsgKey; import org.apache.xml.serializer.utils.Utils; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * This serializer takes a series of SAX or * SAX-like events and writes its output * to the given stream. * * This class is not a public API, it is public * because it is used from another package. * * @xsl.usage internal */ public class ToHTMLStream extends ToStream { /** This flag is set while receiving events from the DTD */ protected boolean m_inDTD = false; /** True if the current element is a block element. (seems like * this needs to be a stack. -sb). */ private boolean m_inBlockElem = false; /** * Map that tells which XML characters should have special treatment, and it * provides character to entity name lookup. */ private final CharInfo m_htmlcharInfo = // new CharInfo(CharInfo.HTML_ENTITIES_RESOURCE); CharInfo.getCharInfo(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML); /** A digital search trie for fast, case insensitive lookup of ElemDesc objects. */ static final Trie m_elementFlags = new Trie(); static { initTagReference(m_elementFlags); } static void initTagReference(Trie m_elementFlags) { // HTML 4.0 loose DTD m_elementFlags.put("BASEFONT", new ElemDesc(0 | ElemDesc.EMPTY)); m_elementFlags.put( "FRAME", new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put("FRAMESET", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("NOFRAMES", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put( "ISINDEX", new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put( "APPLET", new ElemDesc(0 | ElemDesc.WHITESPACESENSITIVE)); m_elementFlags.put("CENTER", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("DIR", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("MENU", new ElemDesc(0 | ElemDesc.BLOCK)); // HTML 4.0 strict DTD m_elementFlags.put("TT", new ElemDesc(0 | ElemDesc.FONTSTYLE)); m_elementFlags.put("I", new ElemDesc(0 | ElemDesc.FONTSTYLE)); m_elementFlags.put("B", new ElemDesc(0 | ElemDesc.FONTSTYLE)); m_elementFlags.put("BIG", new ElemDesc(0 | ElemDesc.FONTSTYLE)); m_elementFlags.put("SMALL", new ElemDesc(0 | ElemDesc.FONTSTYLE)); m_elementFlags.put("EM", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("STRONG", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("DFN", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("CODE", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("SAMP", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("KBD", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("VAR", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("CITE", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("ABBR", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put("ACRONYM", new ElemDesc(0 | ElemDesc.PHRASE)); m_elementFlags.put( "SUP", new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL)); m_elementFlags.put( "SUB", new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL)); m_elementFlags.put( "SPAN", new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL)); m_elementFlags.put( "BDO", new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL)); m_elementFlags.put( "BR", new ElemDesc( 0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put("BODY", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put( "ADDRESS", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put( "DIV", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put("A", new ElemDesc(0 | ElemDesc.SPECIAL)); m_elementFlags.put( "MAP", new ElemDesc( 0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL | ElemDesc.BLOCK)); m_elementFlags.put( "AREA", new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put( "LINK", new ElemDesc( 0 | ElemDesc.HEADMISC | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put( "IMG", new ElemDesc( 0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL | ElemDesc.EMPTY | ElemDesc.WHITESPACESENSITIVE)); m_elementFlags.put( "OBJECT", new ElemDesc( 0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL | ElemDesc.HEADMISC | ElemDesc.WHITESPACESENSITIVE)); m_elementFlags.put("PARAM", new ElemDesc(0 | ElemDesc.EMPTY)); m_elementFlags.put( "HR", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET | ElemDesc.EMPTY)); m_elementFlags.put( "P", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put( "H1", new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK)); m_elementFlags.put( "H2", new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK)); m_elementFlags.put( "H3", new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK)); m_elementFlags.put( "H4", new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK)); m_elementFlags.put( "H5", new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK)); m_elementFlags.put( "H6", new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK)); m_elementFlags.put( "PRE", new ElemDesc(0 | ElemDesc.PREFORMATTED | ElemDesc.BLOCK)); m_elementFlags.put( "Q", new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL)); m_elementFlags.put( "BLOCKQUOTE", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put("INS", new ElemDesc(0)); m_elementFlags.put("DEL", new ElemDesc(0)); m_elementFlags.put( "DL", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put("DT", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("DD", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put( "OL", new ElemDesc(0 | ElemDesc.LIST | ElemDesc.BLOCK)); m_elementFlags.put( "UL", new ElemDesc(0 | ElemDesc.LIST | ElemDesc.BLOCK)); m_elementFlags.put("LI", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("FORM", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("LABEL", new ElemDesc(0 | ElemDesc.FORMCTRL)); m_elementFlags.put( "INPUT", new ElemDesc( 0 | ElemDesc.FORMCTRL | ElemDesc.INLINELABEL | ElemDesc.EMPTY)); m_elementFlags.put( "SELECT", new ElemDesc(0 | ElemDesc.FORMCTRL | ElemDesc.INLINELABEL)); m_elementFlags.put("OPTGROUP", new ElemDesc(0)); m_elementFlags.put("OPTION", new ElemDesc(0)); m_elementFlags.put( "TEXTAREA", new ElemDesc(0 | ElemDesc.FORMCTRL | ElemDesc.INLINELABEL)); m_elementFlags.put( "FIELDSET", new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM)); m_elementFlags.put("LEGEND", new ElemDesc(0)); m_elementFlags.put( "BUTTON", new ElemDesc(0 | ElemDesc.FORMCTRL | ElemDesc.INLINELABEL)); m_elementFlags.put( "TABLE", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put("CAPTION", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("THEAD", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("TFOOT", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("TBODY", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("COLGROUP", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put( "COL", new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put("TR", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put("TH", new ElemDesc(0)); m_elementFlags.put("TD", new ElemDesc(0)); m_elementFlags.put( "HEAD", new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.HEADELEM)); m_elementFlags.put("TITLE", new ElemDesc(0 | ElemDesc.BLOCK)); m_elementFlags.put( "BASE", new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put( "META", new ElemDesc( 0 | ElemDesc.HEADMISC | ElemDesc.EMPTY | ElemDesc.BLOCK)); m_elementFlags.put( "STYLE", new ElemDesc( 0 | ElemDesc.HEADMISC | ElemDesc.RAW | ElemDesc.BLOCK)); m_elementFlags.put( "SCRIPT", new ElemDesc( 0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL | ElemDesc.HEADMISC | ElemDesc.RAW)); m_elementFlags.put( "NOSCRIPT", new ElemDesc( 0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM | ElemDesc.BLOCKFORMFIELDSET)); m_elementFlags.put("HTML", new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.HTMLELEM)); // From "John Ky" elemDesc = (ElemDesc) m_elementFlags.get("frame"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL); elemDesc.setAttr("NORESIZE",ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("head"); elemDesc.setAttr("PROFILE", ElemDesc.ATTRURL); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("hr"); elemDesc.setAttr("NOSHADE", ElemDesc.ATTREMPTY); // ---------------------------------------------- // HTML 4.0, section 16.5 elemDesc = (ElemDesc) m_elementFlags.get("iframe"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL); // ---------------------------------------------- // Netscape 4 extension elemDesc = (ElemDesc) m_elementFlags.get("ilayer"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("img"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL); elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL); elemDesc.setAttr("ISMAP", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("input"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL); elemDesc.setAttr("CHECKED", ElemDesc.ATTREMPTY); elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY); elemDesc.setAttr("ISMAP", ElemDesc.ATTREMPTY); elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("ins"); elemDesc.setAttr("CITE", ElemDesc.ATTRURL); // ---------------------------------------------- // Netscape 4 extension elemDesc = (ElemDesc) m_elementFlags.get("layer"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("link"); elemDesc.setAttr("HREF", ElemDesc.ATTRURL); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("menu"); elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("object"); elemDesc.setAttr("CLASSID", ElemDesc.ATTRURL); elemDesc.setAttr("CODEBASE", ElemDesc.ATTRURL); elemDesc.setAttr("DATA", ElemDesc.ATTRURL); elemDesc.setAttr("ARCHIVE", ElemDesc.ATTRURL); elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL); elemDesc.setAttr("DECLARE", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("ol"); elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("optgroup"); elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("option"); elemDesc.setAttr("SELECTED", ElemDesc.ATTREMPTY); elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("q"); elemDesc.setAttr("CITE", ElemDesc.ATTRURL); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("script"); elemDesc.setAttr("SRC", ElemDesc.ATTRURL); elemDesc.setAttr("FOR", ElemDesc.ATTRURL); elemDesc.setAttr("DEFER", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("select"); elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY); elemDesc.setAttr("MULTIPLE", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("table"); elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY); // Internet-Explorer extension // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("td"); elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("textarea"); elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY); elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("th"); elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY); // ---------------------------------------------- // The nowrap attribute of a tr element is both // a Netscape and Internet-Explorer extension elemDesc = (ElemDesc) m_elementFlags.get("tr"); elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY); // ---------------------------------------------- elemDesc = (ElemDesc) m_elementFlags.get("ul"); elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY); } /** * Dummy element for elements not found. */ static private final ElemDesc m_dummy = new ElemDesc(0 | ElemDesc.BLOCK); /** True if URLs should be specially escaped with the %xx form. */ private boolean m_specialEscapeURLs = true; /** True if the META tag should be omitted. */ private boolean m_omitMetaTag = false; /** * Tells if the formatter should use special URL escaping. * * @param bool True if URLs should be specially escaped with the %xx form. */ public void setSpecialEscapeURLs(boolean bool) { m_specialEscapeURLs = bool; } /** * Tells if the formatter should omit the META tag. * * @param bool True if the META tag should be omitted. */ public void setOmitMetaTag(boolean bool) { m_omitMetaTag = bool; } /** * Specifies an output format for this serializer. It the * serializer has already been associated with an output format, * it will switch to the new format. This method should not be * called while the serializer is in the process of serializing * a document. * * This method can be called multiple times before starting * the serialization of a particular result-tree. In principle * all serialization parameters can be changed, with the exception * of method="html" (it must be method="html" otherwise we * shouldn't even have a ToHTMLStream object here!) * * @param format The output format or serialzation parameters * to use. */ public void setOutputFormat(Properties format) { /* * If "format" does not contain the property * S_USE_URL_ESCAPING, then don't set this value at all, * just leave as-is rather than explicitly setting it. */ String value; value = format.getProperty(OutputPropertiesFactory.S_USE_URL_ESCAPING); if (value != null) { m_specialEscapeURLs = OutputPropertyUtils.getBooleanProperty( OutputPropertiesFactory.S_USE_URL_ESCAPING, format); } /* * If "format" does not contain the property * S_OMIT_META_TAG, then don't set this value at all, * just leave as-is rather than explicitly setting it. */ value = format.getProperty(OutputPropertiesFactory.S_OMIT_META_TAG); if (value != null) { m_omitMetaTag = OutputPropertyUtils.getBooleanProperty( OutputPropertiesFactory.S_OMIT_META_TAG, format); } super.setOutputFormat(format); } /** * Tells if the formatter should use special URL escaping. * * @return True if URLs should be specially escaped with the %xx form. */ private final boolean getSpecialEscapeURLs() { return m_specialEscapeURLs; } /** * Tells if the formatter should omit the META tag. * * @return True if the META tag should be omitted. */ private final boolean getOmitMetaTag() { return m_omitMetaTag; } /** * Get a description of the given element. * * @param name non-null name of element, case insensitive. * * @return non-null reference to ElemDesc, which may be m_dummy if no * element description matches the given name. */ public static final ElemDesc getElemDesc(String name) { /* this method used to return m_dummy when name was null * but now it doesn't check and and requires non-null name. */ Object obj = m_elementFlags.get(name); if (null != obj) return (ElemDesc)obj; return m_dummy; } /** * A Trie that is just a copy of the "static" one. * We need this one to be able to use the faster, but not thread-safe * method Trie.get2(name) */ private Trie m_htmlInfo = new Trie(m_elementFlags); /** * Calls to this method could be replaced with calls to * getElemDesc(name), but this one should be faster. */ private ElemDesc getElemDesc2(String name) { Object obj = m_htmlInfo.get2(name); if (null != obj) return (ElemDesc)obj; return m_dummy; } /** * Default constructor. */ public ToHTMLStream() { super(); // we are just constructing this thing, no output properties // have been used, so we will set the right default for // indenting anyways m_doIndent = true; m_charInfo = m_htmlcharInfo; // initialize namespaces m_prefixMap = new NamespaceMappings(); } /** The name of the current element. */ // private String m_currentElementName = null; /** * Receive notification of the beginning of a document. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ protected void startDocumentInternal() throws org.xml.sax.SAXException { super.startDocumentInternal(); m_needToCallStartDocument = false; m_needToOutputDocTypeDecl = true; m_startNewLine = false; setOmitXMLDeclaration(true); } /** * This method should only get called once. * If a DOCTYPE declaration needs to get written out, it will * be written out. If it doesn't need to be written out, then * the call to this method has no effect. */ private void outputDocTypeDecl(String name) throws SAXException { if (true == m_needToOutputDocTypeDecl) { String doctypeSystem = getDoctypeSystem(); String doctypePublic = getDoctypePublic(); if ((null != doctypeSystem) || (null != doctypePublic)) { final java.io.Writer writer = m_writer; try { writer.write("'); outputLineSep(); } catch(IOException e) { throw new SAXException(e); } } } m_needToOutputDocTypeDecl = false; } /** * Receive notification of the end of a document. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public final void endDocument() throws org.xml.sax.SAXException { flushPending(); if (m_doIndent && !m_isprevtext) { try { outputLineSep(); } catch(IOException e) { throw new SAXException(e); } } flushWriter(); if (m_tracer != null) super.fireEndDoc(); } /** * Receive notification of the beginning of an element. * * * @param namespaceURI * @param localName * @param name The element type name. * @param atts The attributes attached to the element, if any. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #endElement * @see org.xml.sax.AttributeList */ public void startElement( String namespaceURI, String localName, String name, Attributes atts) throws org.xml.sax.SAXException { ElemContext elemContext = m_elemContext; // clean up any pending things first if (elemContext.m_startTagOpen) { closeStartTag(); elemContext.m_startTagOpen = false; } else if (m_cdataTagOpen) { closeCDATA(); m_cdataTagOpen = false; } else if (m_needToCallStartDocument) { startDocumentInternal(); m_needToCallStartDocument = false; } if (m_needToOutputDocTypeDecl) { String n = name; if (n == null || n.length() == 0) { // If the lexical QName is not given // use the localName in the DOCTYPE n = localName; } outputDocTypeDecl(n); } // if this element has a namespace then treat it like XML if (null != namespaceURI && namespaceURI.length() > 0) { super.startElement(namespaceURI, localName, name, atts); return; } try { // getElemDesc2(name) is faster than getElemDesc(name) ElemDesc elemDesc = getElemDesc2(name); int elemFlags = elemDesc.getFlags(); // deal with indentation issues first if (m_doIndent) { boolean isBlockElement = (elemFlags & ElemDesc.BLOCK) != 0; if (m_ispreserve) m_ispreserve = false; else if ( (null != elemContext.m_elementName) && (!m_inBlockElem || isBlockElement) /* && !isWhiteSpaceSensitive */ ) { m_startNewLine = true; indent(); } m_inBlockElem = !isBlockElement; } // save any attributes for later processing if (atts != null) addAttributes(atts); m_isprevtext = false; final java.io.Writer writer = m_writer; writer.write('<'); writer.write(name); if (m_tracer != null) firePseudoAttributes(); if ((elemFlags & ElemDesc.EMPTY) != 0) { // an optimization for elements which are expected // to be empty. m_elemContext = elemContext.push(); /* XSLTC sometimes calls namespaceAfterStartElement() * so we need to remember the name */ m_elemContext.m_elementName = name; m_elemContext.m_elementDesc = elemDesc; return; } else { elemContext = elemContext.push(namespaceURI,localName,name); m_elemContext = elemContext; elemContext.m_elementDesc = elemDesc; elemContext.m_isRaw = (elemFlags & ElemDesc.RAW) != 0; } if ((elemFlags & ElemDesc.HEADELEM) != 0) { // This is the element, do some special processing closeStartTag(); elemContext.m_startTagOpen = false; if (!m_omitMetaTag) { if (m_doIndent) indent(); writer.write( ""); } } } catch (IOException e) { throw new SAXException(e); } } /** * Receive notification of the end of an element. * * * @param namespaceURI * @param localName * @param name The element type name * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public final void endElement( final String namespaceURI, final String localName, final String name) throws org.xml.sax.SAXException { // deal with any pending issues if (m_cdataTagOpen) closeCDATA(); // if the element has a namespace, treat it like XML, not HTML if (null != namespaceURI && namespaceURI.length() > 0) { super.endElement(namespaceURI, localName, name); return; } try { ElemContext elemContext = m_elemContext; final ElemDesc elemDesc = elemContext.m_elementDesc; final int elemFlags = elemDesc.getFlags(); final boolean elemEmpty = (elemFlags & ElemDesc.EMPTY) != 0; // deal with any indentation issues if (m_doIndent) { final boolean isBlockElement = (elemFlags&ElemDesc.BLOCK) != 0; boolean shouldIndent = false; if (m_ispreserve) { m_ispreserve = false; } else if (m_doIndent && (!m_inBlockElem || isBlockElement)) { m_startNewLine = true; shouldIndent = true; } if (!elemContext.m_startTagOpen && shouldIndent) indent(elemContext.m_currentElemDepth - 1); m_inBlockElem = !isBlockElement; } final java.io.Writer writer = m_writer; if (!elemContext.m_startTagOpen) { writer.write("'); } else { // the start-tag open when this method was called, // so we need to process it now. if (m_tracer != null) super.fireStartElem(name); // the starting tag was still open when we received this endElement() call // so we need to process any gathered attributes NOW, before they go away. int nAttrs = m_attributes.getLength(); if (nAttrs > 0) { processAttributes(m_writer, nAttrs); // clear attributes object for re-use with next element m_attributes.clear(); } if (!elemEmpty) { // As per Dave/Paul recommendation 12/06/2000 // if (shouldIndent) // writer.write('>'); // indent(m_currentIndent); writer.write(">'); } else { writer.write('>'); } } // clean up because the element has ended if ((elemFlags & ElemDesc.WHITESPACESENSITIVE) != 0) m_ispreserve = true; m_isprevtext = false; // fire off the end element event if (m_tracer != null) super.fireEndElem(name); // OPTIMIZE-EMPTY if (elemEmpty) { // a quick exit if the HTML element had no children. // This block of code can be removed if the corresponding block of code // in startElement() also labeled with "OPTIMIZE-EMPTY" is also removed m_elemContext = elemContext.m_prev; return; } // some more clean because the element has ended. if (!elemContext.m_startTagOpen) { if (m_doIndent && !m_preserves.isEmpty()) m_preserves.pop(); } m_elemContext = elemContext.m_prev; // m_isRawStack.pop(); } catch (IOException e) { throw new SAXException(e); } } /** * Process an attribute. * @param writer The writer to write the processed output to. * @param name The name of the attribute. * @param value The value of the attribute. * @param elemDesc The description of the HTML element * that has this attribute. * * @throws org.xml.sax.SAXException */ protected void processAttribute( java.io.Writer writer, String name, String value, ElemDesc elemDesc) throws IOException { writer.write(' '); if ( ((value.length() == 0) || value.equalsIgnoreCase(name)) && elemDesc != null && elemDesc.isAttrFlagSet(name, ElemDesc.ATTREMPTY)) { writer.write(name); } else { // %REVIEW% %OPT% // Two calls to single-char write may NOT // be more efficient than one to string-write... writer.write(name); writer.write("=\""); if ( elemDesc != null && elemDesc.isAttrFlagSet(name, ElemDesc.ATTRURL)) writeAttrURI(writer, value, m_specialEscapeURLs); else writeAttrString(writer, value, this.getEncoding()); writer.write('"'); } } /** * Tell if a character is an ASCII digit. */ private boolean isASCIIDigit(char c) { return (c >= '0' && c <= '9'); } /** * Make an integer into an HH hex value. * Does no checking on the size of the input, since this * is only meant to be used locally by writeAttrURI. * * @param i must be a value less than 255. * * @return should be a two character string. */ private static String makeHHString(int i) { String s = Integer.toHexString(i).toUpperCase(); if (s.length() == 1) { s = "0" + s; } return s; } /** * Dmitri Ilyin: Makes sure if the String is HH encoded sign. * @param str must be 2 characters long * * @return true or false */ private boolean isHHSign(String str) { boolean sign = true; try { char r = (char) Integer.parseInt(str, 16); } catch (NumberFormatException e) { sign = false; } return sign; } /** * Write the specified string after substituting non ASCII characters, * with %HH, where HH is the hex of the byte value. * * @param string String to convert to XML format. * @param doURLEscaping True if we should try to encode as * per http://www.ietf.org/rfc/rfc2396.txt. * * @throws org.xml.sax.SAXException if a bad surrogate pair is detected. */ public void writeAttrURI( final java.io.Writer writer, String string, boolean doURLEscaping) throws IOException { // http://www.ietf.org/rfc/rfc2396.txt says: // A URI is always in an "escaped" form, since escaping or unescaping a // completed URI might change its semantics. Normally, the only time // escape encodings can safely be made is when the URI is being created // from its component parts; each component may have its own set of // characters that are reserved, so only the mechanism responsible for // generating or interpreting that component can determine whether or // not escaping a character will change its semantics. Likewise, a URI // must be separated into its components before the escaped characters // within those components can be safely decoded. // // ...So we do our best to do limited escaping of the URL, without // causing damage. If the URL is already properly escaped, in theory, this // function should not change the string value. final int end = string.length(); if (end > m_attrBuff.length) { m_attrBuff = new char[end*2 + 1]; } string.getChars(0,end, m_attrBuff, 0); final char[] chars = m_attrBuff; int cleanStart = 0; int cleanLength = 0; char ch = 0; for (int i = 0; i < end; i++) { ch = chars[i]; if ((ch < 32) || (ch > 126)) { if (cleanLength > 0) { writer.write(chars, cleanStart, cleanLength); cleanLength = 0; } if (doURLEscaping) { // Encode UTF16 to UTF8. // Reference is Unicode, A Primer, by Tony Graham. // Page 92. // Note that Kay doesn't escape 0x20... // if(ch == 0x20) // Not sure about this... -sb // { // writer.write(ch); // } // else if (ch <= 0x7F) { writer.write('%'); writer.write(makeHHString(ch)); } else if (ch <= 0x7FF) { // Clear low 6 bits before rotate, put high 4 bits in low byte, // and set two high bits. int high = (ch >> 6) | 0xC0; int low = (ch & 0x3F) | 0x80; // First 6 bits, + high bit writer.write('%'); writer.write(makeHHString(high)); writer.write('%'); writer.write(makeHHString(low)); } else if (Encodings.isHighUTF16Surrogate(ch)) // high surrogate { // I'm sure this can be done in 3 instructions, but I choose // to try and do it exactly like it is done in the book, at least // until we are sure this is totally clean. I don't think performance // is a big issue with this particular function, though I could be // wrong. Also, the stuff below clearly does more masking than // it needs to do. // Clear high 6 bits. int highSurrogate = ((int) ch) & 0x03FF; // Middle 4 bits (wwww) + 1 // "Note that the value of wwww from the high surrogate bit pattern // is incremented to make the uuuuu bit pattern in the scalar value // so the surrogate pair don't address the BMP." int wwww = ((highSurrogate & 0x03C0) >> 6); int uuuuu = wwww + 1; // next 4 bits int zzzz = (highSurrogate & 0x003C) >> 2; // low 2 bits int yyyyyy = ((highSurrogate & 0x0003) << 4) & 0x30; // Get low surrogate character. ch = chars[++i]; // Clear high 6 bits. int lowSurrogate = ((int) ch) & 0x03FF; // put the middle 4 bits into the bottom of yyyyyy (byte 3) yyyyyy = yyyyyy | ((lowSurrogate & 0x03C0) >> 6); // bottom 6 bits. int xxxxxx = (lowSurrogate & 0x003F); int byte1 = 0xF0 | (uuuuu >> 2); // top 3 bits of uuuuu int byte2 = 0x80 | (((uuuuu & 0x03) << 4) & 0x30) | zzzz; int byte3 = 0x80 | yyyyyy; int byte4 = 0x80 | xxxxxx; writer.write('%'); writer.write(makeHHString(byte1)); writer.write('%'); writer.write(makeHHString(byte2)); writer.write('%'); writer.write(makeHHString(byte3)); writer.write('%'); writer.write(makeHHString(byte4)); } else { int high = (ch >> 12) | 0xE0; // top 4 bits int middle = ((ch & 0x0FC0) >> 6) | 0x80; // middle 6 bits int low = (ch & 0x3F) | 0x80; // First 6 bits, + high bit writer.write('%'); writer.write(makeHHString(high)); writer.write('%'); writer.write(makeHHString(middle)); writer.write('%'); writer.write(makeHHString(low)); } } else if (escapingNotNeeded(ch)) { writer.write(ch); } else { writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); } // In this character range we have first written out any previously accumulated // "clean" characters, then processed the current more complicated character, // which may have incremented "i". // We now we reset the next possible clean character. cleanStart = i + 1; } // Since http://www.ietf.org/rfc/rfc2396.txt refers to the URI grammar as // not allowing quotes in the URI proper syntax, nor in the fragment // identifier, we believe that it's OK to double escape quotes. else if (ch == '"') { // If the character is a '%' number number, try to avoid double-escaping. // There is a question if this is legal behavior. // Dmitri Ilyin: to check if '%' number number is invalid. It must be checked if %xx is a sign, that would be encoded // The encoded signes are in Hex form. So %xx my be in form %3C that is "<" sign. I will try to change here a little. // if( ((i+2) < len) && isASCIIDigit(stringArray[i+1]) && isASCIIDigit(stringArray[i+2]) ) // We are no longer escaping '%' if (cleanLength > 0) { writer.write(chars, cleanStart, cleanLength); cleanLength = 0; } // Mike Kay encodes this as ", so he may know something I don't? if (doURLEscaping) writer.write("%22"); else writer.write("""); // we have to escape this, I guess. // We have written out any clean characters, then the escaped '%' and now we // We now we reset the next possible clean character. cleanStart = i + 1; } else if (ch == '&') { // HTML 4.01 reads, "Authors should use "&" (ASCII decimal 38) // instead of "&" to avoid confusion with the beginning of a character // reference (entity reference open delimiter). if (cleanLength > 0) { writer.write(chars, cleanStart, cleanLength); cleanLength = 0; } writer.write("&"); cleanStart = i + 1; } else { // no processing for this character, just count how // many characters in a row that we have that need no processing cleanLength++; } } // are there any clean characters at the end of the array // that we haven't processed yet? if (cleanLength > 1) { // if the whole string can be written out as-is do so // otherwise write out the clean chars at the end of the // array if (cleanStart == 0) writer.write(string); else writer.write(chars, cleanStart, cleanLength); } else if (cleanLength == 1) { // a little optimization for 1 clean character // (we could have let the previous if(...) handle them all) writer.write(ch); } } /** * Writes the specified string after substituting specials, * and UTF-16 surrogates for character references &#xnn. * * @param string String to convert to XML format. * @param encoding CURRENTLY NOT IMPLEMENTED. * * @throws org.xml.sax.SAXException */ public void writeAttrString( final java.io.Writer writer, String string, String encoding) throws IOException { final int end = string.length(); if (end > m_attrBuff.length) { m_attrBuff = new char[end * 2 + 1]; } string.getChars(0, end, m_attrBuff, 0); final char[] chars = m_attrBuff; int cleanStart = 0; int cleanLength = 0; char ch = 0; for (int i = 0; i < end; i++) { ch = chars[i]; // System.out.println("SPECIALSSIZE: "+SPECIALSSIZE); // System.out.println("ch: "+(int)ch); // System.out.println("m_maxCharacter: "+(int)m_maxCharacter); // System.out.println("m_attrCharsMap[ch]: "+(int)m_attrCharsMap[ch]); if (escapingNotNeeded(ch) && (!m_charInfo.shouldMapAttrChar(ch))) { cleanLength++; } else if ('<' == ch || '>' == ch) { cleanLength++; // no escaping in this case, as specified in 15.2 } else if ( ('&' == ch) && ((i + 1) < end) && ('{' == chars[i + 1])) { cleanLength++; // no escaping in this case, as specified in 15.2 } else { if (cleanLength > 0) { writer.write(chars,cleanStart,cleanLength); cleanLength = 0; } int pos = accumDefaultEntity(writer, ch, i, chars, end, false, true); if (i != pos) { i = pos - 1; } else { if (Encodings.isHighUTF16Surrogate(ch)) { writeUTF16Surrogate(ch, chars, i, end); i++; // two input characters processed // this increments by one and the for() // loop itself increments by another one. } // The next is kind of a hack to keep from escaping in the case // of Shift_JIS and the like. /* else if ((ch < m_maxCharacter) && (m_maxCharacter == 0xFFFF) && (ch != 160)) { writer.write(ch); // no escaping in this case } else */ String outputStringForChar = m_charInfo.getOutputStringForChar(ch); if (null != outputStringForChar) { writer.write(outputStringForChar); } else if (escapingNotNeeded(ch)) { writer.write(ch); // no escaping in this case } else { writer.write("&#"); writer.write(Integer.toString(ch)); writer.write(';'); } } cleanStart = i + 1; } } // end of for() // are there any clean characters at the end of the array // that we haven't processed yet? if (cleanLength > 1) { // if the whole string can be written out as-is do so // otherwise write out the clean chars at the end of the // array if (cleanStart == 0) writer.write(string); else writer.write(chars, cleanStart, cleanLength); } else if (cleanLength == 1) { // a little optimization for 1 clean character // (we could have let the previous if(...) handle them all) writer.write(ch); } } /** * Receive notification of character data. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param chars The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator * * @throws org.xml.sax.SAXException */ public final void characters(char chars[], int start, int length) throws org.xml.sax.SAXException { if (m_elemContext.m_isRaw) { try { // Clean up some pending issues. if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } m_ispreserve = true; writeNormalizedChars(chars, start, length, false, m_lineSepUse); // time to generate characters event if (m_tracer != null) super.fireCharEvent(chars, start, length); return; } catch (IOException ioe) { throw new org.xml.sax.SAXException( Utils.messages.createMessage(MsgKey.ER_OIERROR,null),ioe); } } else { super.characters(chars, start, length); } } /** * Receive notification of cdata. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator * * @throws org.xml.sax.SAXException */ public final void cdata(char ch[], int start, int length) throws org.xml.sax.SAXException { if ((null != m_elemContext.m_elementName) && (m_elemContext.m_elementName.equalsIgnoreCase("SCRIPT") || m_elemContext.m_elementName.equalsIgnoreCase("STYLE"))) { try { if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } m_ispreserve = true; if (shouldIndent()) indent(); // writer.write(ch, start, length); writeNormalizedChars(ch, start, length, true, m_lineSepUse); } catch (IOException ioe) { throw new org.xml.sax.SAXException( Utils.messages.createMessage( MsgKey.ER_OIERROR, null), ioe); //"IO error", ioe); } } else { super.cdata(ch, start, length); } } /** * Receive notification of a processing instruction. * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { // Process any pending starDocument and startElement first. flushPending(); // Use a fairly nasty hack to tell if the next node is supposed to be // unescaped text. if (target.equals(Result.PI_DISABLE_OUTPUT_ESCAPING)) { startNonEscaping(); } else if (target.equals(Result.PI_ENABLE_OUTPUT_ESCAPING)) { endNonEscaping(); } else { try { // clean up any pending things first if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } else if (m_cdataTagOpen) { closeCDATA(); } else if (m_needToCallStartDocument) { startDocumentInternal(); } /* * Perhaps processing instructions can be written out in HTML before * the DOCTYPE, in which case this could be emitted with the * startElement call, that knows the name of the document element * doing it right. */ if (true == m_needToOutputDocTypeDecl) outputDocTypeDecl("html"); // best guess for the upcoming element if (shouldIndent()) indent(); final java.io.Writer writer = m_writer; //writer.write(" 0 && !Character.isSpaceChar(data.charAt(0))) writer.write(' '); //writer.write(data + ">"); // different from XML writer.write(data); // different from XML writer.write('>'); // different from XML // Always output a newline char if not inside of an // element. The whitespace is not significant in that // case. if (m_elemContext.m_currentElemDepth <= 0) outputLineSep(); m_startNewLine = true; } catch(IOException e) { throw new SAXException(e); } } // now generate the PI event if (m_tracer != null) super.fireEscapingEvent(target, data); } /** * Receive notivication of a entityReference. * * @param name non-null reference to entity name string. * * @throws org.xml.sax.SAXException */ public final void entityReference(String name) throws org.xml.sax.SAXException { try { final java.io.Writer writer = m_writer; writer.write('&'); writer.write(name); writer.write(';'); } catch(IOException e) { throw new SAXException(e); } } /** * @see ExtendedContentHandler#endElement(String) */ public final void endElement(String elemName) throws SAXException { endElement(null, null, elemName); } /** * Process the attributes, which means to write out the currently * collected attributes to the writer. The attributes are not * cleared by this method * * @param writer the writer to write processed attributes to. * @param nAttrs the number of attributes in m_attributes * to be processed * * @throws org.xml.sax.SAXException */ public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException,SAXException { /* * process the collected attributes */ for (int i = 0; i < nAttrs; i++) { processAttribute( writer, m_attributes.getQName(i), m_attributes.getValue(i), m_elemContext.m_elementDesc); } } /** * For the enclosing elements starting tag write out out any attributes * followed by ">". At this point we also mark if this element is * a cdata-section-element. * *@throws org.xml.sax.SAXException */ protected void closeStartTag() throws SAXException { try { // finish processing attributes, time to fire off the start element event if (m_tracer != null) super.fireStartElem(m_elemContext.m_elementName); int nAttrs = m_attributes.getLength(); if (nAttrs>0) { processAttributes(m_writer, nAttrs); // clear attributes object for re-use with next element m_attributes.clear(); } m_writer.write('>'); /* At this point we have the prefix mappings now, so * lets determine if the current element is specified in the cdata- * section-elements list. */ if (m_CdataElems != null) // if there are any cdata sections m_elemContext.m_isCdataSection = isCdataSection(); if (m_doIndent) { m_isprevtext = false; m_preserves.push(m_ispreserve); } } catch(IOException e) { throw new SAXException(e); } } /** * This method is used when a prefix/uri namespace mapping * is indicated after the element was started with a * startElement() and before and endElement(). * startPrefixMapping(prefix,uri) would be used before the * startElement() call. * @param uri the URI of the namespace * @param prefix the prefix associated with the given URI. * * @see ExtendedContentHandler#namespaceAfterStartElement(String, String) */ public void namespaceAfterStartElement(String prefix, String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_elemContext.m_elementURI == null) { String prefix1 = getPrefixPart(m_elemContext.m_elementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_elemContext.m_elementURI = uri; } } startPrefixMapping(prefix,uri,false); } public void startDTD(String name, String publicId, String systemId) throws SAXException { m_inDTD = true; super.startDTD(name, publicId, systemId); } /** * Report the end of DTD declarations. * @throws org.xml.sax.SAXException The application may raise an exception. * @see #startDTD */ public void endDTD() throws org.xml.sax.SAXException { m_inDTD = false; /* for ToHTMLStream the DOCTYPE is entirely output in the * startDocumentInternal() method, so don't do anything here */ } /** * This method does nothing. */ public void attributeDecl( String eName, String aName, String type, String valueDefault, String value) throws SAXException { // The internal DTD subset is not serialized by the ToHTMLStream serializer } /** * This method does nothing. */ public void elementDecl(String name, String model) throws SAXException { // The internal DTD subset is not serialized by the ToHTMLStream serializer } /** * This method does nothing. */ public void internalEntityDecl(String name, String value) throws SAXException { // The internal DTD subset is not serialized by the ToHTMLStream serializer } /** * This method does nothing. */ public void externalEntityDecl( String name, String publicId, String systemId) throws SAXException { // The internal DTD subset is not serialized by the ToHTMLStream serializer } /** * This method is used to add an attribute to the currently open element. * The caller has guaranted that this attribute is unique, which means that it * not been seen before and will not be seen again. * * @param name the qualified name of the attribute * @param value the value of the attribute which can contain only * ASCII printable characters characters in the range 32 to 127 inclusive. * @param flags the bit values of this integer give optimization information. */ public void addUniqueAttribute(String name, String value, int flags) throws SAXException { try { final java.io.Writer writer = m_writer; if ((flags & NO_BAD_CHARS) > 0 && m_htmlcharInfo.onlyQuotAmpLtGt) { // "flags" has indicated that the characters // '>' '<' '&' and '"' are not in the value and // m_htmlcharInfo has recorded that there are no other // entities in the range 0 to 127 so we write out the // value directly writer.write(' '); writer.write(name); writer.write("=\""); writer.write(value); writer.write('"'); } else if ( (flags & HTML_ATTREMPTY) > 0 && (value.length() == 0 || value.equalsIgnoreCase(name))) { writer.write(' '); writer.write(name); } else { writer.write(' '); writer.write(name); writer.write("=\""); if ((flags & HTML_ATTRURL) > 0) { writeAttrURI(writer, value, m_specialEscapeURLs); } else { writeAttrString(writer, value, this.getEncoding()); } writer.write('"'); } } catch (IOException e) { throw new SAXException(e); } } public void comment(char ch[], int start, int length) throws SAXException { // The internal DTD subset is not serialized by the ToHTMLStream serializer if (m_inDTD) return; // Clean up some pending issues, just in case // this call is coming right after a startElement() // or we are in the middle of writing out CDATA // or if a startDocument() call was not received if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } else if (m_cdataTagOpen) { closeCDATA(); } else if (m_needToCallStartDocument) { startDocumentInternal(); } /* * Perhaps comments can be written out in HTML before the DOCTYPE. * In this case we might delete this call to writeOutDOCTYPE, and * it would be handled within the startElement() call. */ if (m_needToOutputDocTypeDecl) outputDocTypeDecl("html"); // best guess for the upcoming element super.comment(ch, start, length); } public boolean reset() { boolean ret = super.reset(); if (!ret) return false; resetToHTMLStream(); return true; } private void resetToHTMLStream() { // m_htmlcharInfo remains unchanged // m_htmlInfo = null; // Don't reset m_inBlockElem = false; m_inDTD = false; m_omitMetaTag = false; m_specialEscapeURLs = true; } static class Trie { /** * A digital search trie for 7-bit ASCII text * The API is a subset of java.util.Hashtable * The key must be a 7-bit ASCII string * The value may be any Java Object * One can get an object stored in a trie from its key, * but the search is either case sensitive or case * insensitive to the characters in the key, and this * choice of sensitivity or insensitivity is made when * the Trie is created, before any objects are put in it. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * @xsl.usage internal */ /** Size of the m_nextChar array. */ public static final int ALPHA_SIZE = 128; /** The root node of the tree. */ final Node m_Root; /** helper buffer to convert Strings to char arrays */ private char[] m_charBuffer = new char[0]; /** true if the search for an object is lower case only with the key */ private final boolean m_lowerCaseOnly; /** * Construct the trie that has a case insensitive search. */ public Trie() { m_Root = new Node(); m_lowerCaseOnly = false; } /** * Construct the trie given the desired case sensitivity with the key. * @param lowerCaseOnly true if the search keys are to be loser case only, * not case insensitive. */ public Trie(boolean lowerCaseOnly) { m_Root = new Node(); m_lowerCaseOnly = lowerCaseOnly; } /** * Put an object into the trie for lookup. * * @param key must be a 7-bit ASCII string * @param value any java object. * * @return The old object that matched key, or null. */ public Object put(String key, Object value) { final int len = key.length(); if (len > m_charBuffer.length) { // make the biggest buffer ever needed in get(String) m_charBuffer = new char[len]; } Node node = m_Root; for (int i = 0; i < len; i++) { Node nextNode = node.m_nextChar[Character.toLowerCase(key.charAt(i))]; if (nextNode != null) { node = nextNode; } else { for (; i < len; i++) { Node newNode = new Node(); if (m_lowerCaseOnly) { // put this value into the tree only with a lower case key node.m_nextChar[Character.toLowerCase( key.charAt(i))] = newNode; } else { // put this value into the tree with a case insensitive key node.m_nextChar[Character.toUpperCase( key.charAt(i))] = newNode; node.m_nextChar[Character.toLowerCase( key.charAt(i))] = newNode; } node = newNode; } break; } } Object ret = node.m_Value; node.m_Value = value; return ret; } /** * Get an object that matches the key. * * @param key must be a 7-bit ASCII string * * @return The object that matches the key, or null. */ public Object get(final String key) { final int len = key.length(); /* If the name is too long, we won't find it, this also keeps us * from overflowing m_charBuffer */ if (m_charBuffer.length < len) return null; Node node = m_Root; switch (len) // optimize the look up based on the number of chars { // case 0 looks silly, but the generated bytecode runs // faster for lookup of elements of length 2 with this in // and a fair bit faster. Don't know why. case 0 : { return null; } case 1 : { final char ch = key.charAt(0); if (ch < ALPHA_SIZE) { node = node.m_nextChar[ch]; if (node != null) return node.m_Value; } return null; } // comment out case 2 because the default is faster // case 2 : // { // final char ch0 = key.charAt(0); // final char ch1 = key.charAt(1); // if (ch0 < ALPHA_SIZE && ch1 < ALPHA_SIZE) // { // node = node.m_nextChar[ch0]; // if (node != null) // { // // if (ch1 < ALPHA_SIZE) // { // node = node.m_nextChar[ch1]; // if (node != null) // return node.m_Value; // } // } // } // return null; // } default : { for (int i = 0; i < len; i++) { // A thread-safe way to loop over the characters final char ch = key.charAt(i); if (ALPHA_SIZE <= ch) { // the key is not 7-bit ASCII so we won't find it here return null; } node = node.m_nextChar[ch]; if (node == null) return null; } return node.m_Value; } } } /** * The node representation for the trie. * @xsl.usage internal */ private class Node { /** * Constructor, creates a Node[ALPHA_SIZE]. */ Node() { m_nextChar = new Node[ALPHA_SIZE]; m_Value = null; } /** The next nodes. */ final Node m_nextChar[]; /** The value. */ Object m_Value; } /** * Construct the trie from another Trie. * Both the existing Trie and this new one share the same table for * lookup, and it is assumed that the table is fully populated and * not changing anymore. * * @param existingTrie the Trie that this one is a copy of. */ public Trie(Trie existingTrie) { // copy some fields from the existing Trie into this one. m_Root = existingTrie.m_Root; m_lowerCaseOnly = existingTrie.m_lowerCaseOnly; // get a buffer just big enough to hold the longest key in the table. int max = existingTrie.getLongestKeyLength(); m_charBuffer = new char[max]; } /** * Get an object that matches the key. * This method is faster than get(), but is not thread-safe. * * @param key must be a 7-bit ASCII string * * @return The object that matches the key, or null. */ public Object get2(final String key) { final int len = key.length(); /* If the name is too long, we won't find it, this also keeps us * from overflowing m_charBuffer */ if (m_charBuffer.length < len) return null; Node node = m_Root; switch (len) // optimize the look up based on the number of chars { // case 0 looks silly, but the generated bytecode runs // faster for lookup of elements of length 2 with this in // and a fair bit faster. Don't know why. case 0 : { return null; } case 1 : { final char ch = key.charAt(0); if (ch < ALPHA_SIZE) { node = node.m_nextChar[ch]; if (node != null) return node.m_Value; } return null; } default : { /* Copy string into array. This is not thread-safe because * it modifies the contents of m_charBuffer. If multiple * threads were to use this Trie they all would be * using this same array (not good). So this * method is not thread-safe, but it is faster because * converting to a char[] and looping over elements of * the array is faster than a String's charAt(i). */ key.getChars(0, len, m_charBuffer, 0); for (int i = 0; i < len; i++) { final char ch = m_charBuffer[i]; if (ALPHA_SIZE <= ch) { // the key is not 7-bit ASCII so we won't find it here return null; } node = node.m_nextChar[ch]; if (node == null) return null; } return node.m_Value; } } } /** * Get the length of the longest key used in the table. */ public int getLongestKeyLength() { return m_charBuffer.length; } } } libxalan2-java-2.7.1/src/org/apache/xml/serializer/TreeWalker.java0000644000175000017500000003623310721374032023766 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TreeWalker.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.File; import org.apache.xml.serializer.utils.AttList; import org.apache.xml.serializer.utils.DOM2Helper; import org.w3c.dom.Comment; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.LocatorImpl; /** * This class does a pre-order walk of the DOM tree, calling a ContentHandler * interface as it goes. * * This class is a copy of the one in org.apache.xml.utils. * It exists to cut the serializers dependancy on that package. * * @xsl.usage internal */ public final class TreeWalker { /** Local reference to a ContentHandler */ final private ContentHandler m_contentHandler; /** * If m_contentHandler is a SerializationHandler, then this is * a reference to the same object. */ final private SerializationHandler m_Serializer; // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! // DOM2Helper m_dh = new DOM2Helper(); /** DomHelper for this TreeWalker */ final protected DOM2Helper m_dh; /** Locator object for this TreeWalker */ final private LocatorImpl m_locator = new LocatorImpl(); /** * Get the ContentHandler used for the tree walk. * * @return the ContentHandler used for the tree walk */ public ContentHandler getContentHandler() { return m_contentHandler; } public TreeWalker(ContentHandler ch) { this(ch,null); } /** * Constructor. * @param contentHandler The implemention of the * contentHandler operation (toXMLString, digest, ...) */ public TreeWalker(ContentHandler contentHandler, String systemId) { // Set the content handler m_contentHandler = contentHandler; if (m_contentHandler instanceof SerializationHandler) { m_Serializer = (SerializationHandler) m_contentHandler; } else m_Serializer = null; // Set the system ID, if it is given m_contentHandler.setDocumentLocator(m_locator); if (systemId != null) m_locator.setSystemId(systemId); else { try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) {// user.dir not accessible from applet } } // Set the document locator if (m_contentHandler != null) m_contentHandler.setDocumentLocator(m_locator); try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se){// user.dir not accessible from applet } m_dh = new DOM2Helper(); } /** * Perform a pre-order traversal non-recursive style. * * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * * @throws TransformerException */ public void traverse(Node pos) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); Node top = pos; while (null != pos) { startNode(pos); Node nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if (top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || (top.equals(pos))) { if (null != pos) endNode(pos); nextNode = null; break; } } } pos = nextNode; } this.m_contentHandler.endDocument(); } /** * Perform a pre-order traversal non-recursive style. * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * @param top Node in the tree where to end traversal * * @throws TransformerException */ public void traverse(Node pos, Node top) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); while (null != pos) { startNode(pos); Node nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if ((null != top) && top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || ((null != top) && top.equals(pos))) { nextNode = null; break; } } } pos = nextNode; } this.m_contentHandler.endDocument(); } /** Flag indicating whether following text to be processed is raw text */ boolean nextIsRaw = false; /** * Optimized dispatch of characters. */ private final void dispatachChars(Node node) throws org.xml.sax.SAXException { if(m_Serializer != null) { this.m_Serializer.characters(node); } else { String data = ((Text) node).getData(); this.m_contentHandler.characters(data.toCharArray(), 0, data.length()); } } /** * Start processing given node * * * @param node Node to process * * @throws org.xml.sax.SAXException */ protected void startNode(Node node) throws org.xml.sax.SAXException { // TODO: // A Serializer implements ContentHandler, but not NodeConsumer // so drop this reference to NodeConsumer which would otherwise // pull in all sorts of things // if (m_contentHandler instanceof NodeConsumer) // { // ((NodeConsumer) m_contentHandler).setOriginatingNode(node); // } // TODO: if (node instanceof Locator) { Locator loc = (Locator)node; m_locator.setColumnNumber(loc.getColumnNumber()); m_locator.setLineNumber(loc.getLineNumber()); m_locator.setPublicId(loc.getPublicId()); m_locator.setSystemId(loc.getSystemId()); } else { m_locator.setColumnNumber(0); m_locator.setLineNumber(0); } switch (node.getNodeType()) { case Node.COMMENT_NODE : { String data = ((Comment) node).getData(); if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.comment(data.toCharArray(), 0, data.length()); } } break; case Node.DOCUMENT_FRAGMENT_NODE : // ??; break; case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : Element elem_node = (Element) node; { // Make sure the namespace node // for the element itself is declared // to the ContentHandler String uri = elem_node.getNamespaceURI(); if (uri != null) { String prefix = elem_node.getPrefix(); if (prefix==null) prefix=""; this.m_contentHandler.startPrefixMapping(prefix,uri); } } NamedNodeMap atts = elem_node.getAttributes(); int nAttrs = atts.getLength(); // System.out.println("TreeWalker#startNode: "+node.getNodeName()); // Make sure the namespace node of // each attribute is declared to the ContentHandler for (int i = 0; i < nAttrs; i++) { final Node attr = atts.item(i); final String attrName = attr.getNodeName(); final int colon = attrName.indexOf(':'); final String prefix; // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue()); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" . if (colon < 0) prefix = ""; else prefix = attrName.substring(colon + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); } else if (colon > 0) { prefix = attrName.substring(0,colon); String uri = attr.getNamespaceURI(); if (uri != null) this.m_contentHandler.startPrefixMapping(prefix,uri); } } String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(), new AttList(atts, m_dh)); break; case Node.PROCESSING_INSTRUCTION_NODE : { ProcessingInstruction pi = (ProcessingInstruction) node; String name = pi.getNodeName(); // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { nextIsRaw = true; } else { this.m_contentHandler.processingInstruction(pi.getNodeName(), pi.getData()); } } break; case Node.CDATA_SECTION_NODE : { boolean isLexH = (m_contentHandler instanceof LexicalHandler); LexicalHandler lh = isLexH ? ((LexicalHandler) this.m_contentHandler) : null; if (isLexH) { lh.startCDATA(); } dispatachChars(node); { if (isLexH) { lh.endCDATA(); } } } break; case Node.TEXT_NODE : { //String data = ((Text) node).getData(); if (nextIsRaw) { nextIsRaw = false; m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { dispatachChars(node); } } break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { ((LexicalHandler) this.m_contentHandler).startEntity( eref.getNodeName()); } else { // warning("Can not output entity to a pure SAX ContentHandler"); } } break; default : } } /** * End processing of given node * * * @param node Node we just finished processing * * @throws org.xml.sax.SAXException */ protected void endNode(Node node) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName()); if (m_Serializer == null) { // Don't bother with endPrefixMapping calls if the ContentHandler is a // SerializationHandler because SerializationHandler's ignore the // endPrefixMapping() calls anyways. . . . This is an optimization. Element elem_node = (Element) node; NamedNodeMap atts = elem_node.getAttributes(); int nAttrs = atts.getLength(); // do the endPrefixMapping calls in reverse order // of the startPrefixMapping calls for (int i = (nAttrs-1); 0 <= i; i--) { final Node attr = atts.item(i); final String attrName = attr.getNodeName(); final int colon = attrName.indexOf(':'); final String prefix; if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" . if (colon < 0) prefix = ""; else prefix = attrName.substring(colon + 1); this.m_contentHandler.endPrefixMapping(prefix); } else if (colon > 0) { prefix = attrName.substring(0, colon); this.m_contentHandler.endPrefixMapping(prefix); } } { String uri = elem_node.getNamespaceURI(); if (uri != null) { String prefix = elem_node.getPrefix(); if (prefix==null) prefix=""; this.m_contentHandler.endPrefixMapping(prefix); } } } break; case Node.CDATA_SECTION_NODE : break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.endEntity(eref.getNodeName()); } } break; default : } } } //TreeWalker libxalan2-java-2.7.1/src/org/apache/xml/serializer/ObjectFactory.java0000644000175000017500000006367610721374031024471 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468654 2006-10-28 07:09:23Z minchau $ */ package org.apache.xml.serializer; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Properties; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

    * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

    * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @xsl.usage internal */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

      *
    1. query the system property using System.getProperty *
    2. read META-INF/services/factoryId file *
    3. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 8859254254255146542L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xml/serializer/Serializer.java0000644000175000017500000002212410721374032024024 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Serializer.java 471981 2006-11-07 04:28:00Z minchau $ */ package org.apache.xml.serializer; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import org.xml.sax.ContentHandler; /** * The Serializer interface is implemented by a serializer to enable users to: *
      *
    • get and set streams or writers *
    • configure the serializer with key/value properties *
    • get an org.xml.sax.ContentHandler or a DOMSerializer to provide input to *
    * *

    * Here is an example using the asContentHandler() method: *

     * java.util.Properties props = 
     *   OutputPropertiesFactory.getDefaultMethodProperties(Method.TEXT);
     * Serializer ser = SerializerFactory.getSerializer(props);
     * java.io.PrintStream ostream = System.out; 
     * ser.setOutputStream(ostream);
     * 
     * // Provide the SAX input events
     * ContentHandler handler = ser.asContentHandler();
     * handler.startDocument();
     * char[] chars = { 'a', 'b', 'c' };
     * handler.characters(chars, 0, chars.length);
     * handler.endDocument();
     * 
     * ser.reset(); // get ready to use the serializer for another document
     *              // of the same output method (TEXT).
     * 
    * *

    * As an alternate to supplying a series of SAX events as input through the * ContentHandler interface, the input to serialize may be given as a DOM. *

    * For example: *

     * org.w3c.dom.Document     inputDoc;
     * org.apache.xml.serializer.Serializer   ser;
     * java.io.Writer owriter;
     * 
     * java.util.Properties props = 
     *   OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
     * Serializer ser = SerializerFactory.getSerializer(props);
     * owriter = ...;  // create a writer to serialize the document to
     * ser.setWriter( owriter );
     * 
     * inputDoc = ...; // create the DOM document to be serialized
     * DOMSerializer dser = ser.asDOMSerializer(); // a DOM will be serialized
     * dser.serialize(inputDoc); // serialize the DOM, sending output to owriter
     * 
     * ser.reset(); // get ready to use the serializer for another document
     *              // of the same output method.
     * 
    * * This interface is a public API. * * @see Method * @see OutputPropertiesFactory * @see SerializerFactory * @see DOMSerializer * @see ContentHandler * * @xsl.usage general */ public interface Serializer { /** * Specifies an output stream to which the document should be * serialized. This method should not be called while the * serializer is in the process of serializing a document. *

    * The encoding specified in the output {@link Properties} is used, or * if no encoding was specified, the default for the selected * output method. *

    * Only one of setWriter() or setOutputStream() should be called. * * @param output The output stream */ public void setOutputStream(OutputStream output); /** * Get the output stream where the events will be serialized to. * * @return reference to the result stream, or null if only a writer was * set. */ public OutputStream getOutputStream(); /** * Specifies a writer to which the document should be serialized. * This method should not be called while the serializer is in * the process of serializing a document. *

    * The encoding specified for the output {@link Properties} must be * identical to the output format used with the writer. * *

    * Only one of setWriter() or setOutputStream() should be called. * * @param writer The output writer stream */ public void setWriter(Writer writer); /** * Get the character stream where the events will be serialized to. * * @return Reference to the result Writer, or null. */ public Writer getWriter(); /** * Specifies an output format for this serializer. It the * serializer has already been associated with an output format, * it will switch to the new format. This method should not be * called while the serializer is in the process of serializing * a document. *

    * The standard property keys supported are: "method", "version", "encoding", * "omit-xml-declaration", "standalone", doctype-public", * "doctype-system", "cdata-section-elements", "indent", "media-type". * These property keys and their values are described in the XSLT recommendation, * see {@link XSLT 1.0 recommendation} *

    * The non-standard property keys supported are defined in {@link OutputPropertiesFactory}. * *

    * This method can be called multiple times before a document is serialized. Each * time it is called more, or over-riding property values, can be specified. One * property value that can not be changed is that of the "method" property key. *

    * The value of the "cdata-section-elements" property key is a whitespace * separated list of elements. If the element is in a namespace then * value is passed in this format: {uri}localName *

    * If the "cdata-section-elements" key is specified on multiple calls * to this method the set of elements specified in the value * is not replaced from one call to the * next, but it is cumulative across the calls. * * @param format The output format to use, as a set of key/value pairs. */ public void setOutputFormat(Properties format); /** * Returns the output format properties for this serializer. * * @return The output format key/value pairs in use. */ public Properties getOutputFormat(); /** * Return a {@link ContentHandler} interface to provide SAX input to. * Through the returned object the document to be serailized, * as a series of SAX events, can be provided to the serialzier. * If the serializer does not support the {@link ContentHandler} * interface, it will return null. *

    * In principle only one of asDOMSerializer() or asContentHander() * should be called. * * @return A {@link ContentHandler} interface into this serializer, * or null if the serializer is not SAX 2 capable * @throws IOException An I/O exception occured */ public ContentHandler asContentHandler() throws IOException; /** * Return a {@link DOMSerializer} interface into this serializer. * Through the returned object the document to be serialized, * a DOM, can be provided to the serializer. * If the serializer does not support the {@link DOMSerializer} * interface, it should return null. *

    * In principle only one of asDOMSerializer() or asContentHander() * should be called. * * @return A {@link DOMSerializer} interface into this serializer, * or null if the serializer is not DOM capable * @throws IOException An I/O exception occured */ public DOMSerializer asDOMSerializer() throws IOException; /** * This method resets the serializer. * If this method returns true, the * serializer may be used for subsequent serialization of new * documents. It is possible to change the output format and * output stream prior to serializing, or to reuse the existing * output format and output stream or writer. * * @return True if serializer has been reset and can be reused */ public boolean reset(); /** * Return an Object into this serializer to be cast to a DOM3Serializer. * Through the returned object the document to be serialized, * a DOM (Level 3), can be provided to the serializer. * If the serializer does not support casting to a {@link DOM3Serializer} * interface, it should return null. *

    * In principle only one of asDOM3Serializer() or asContentHander() * should be called. * * @return An Object to be cast to a DOM3Serializer interface into this serializer, * or null if the serializer is not DOM capable * @throws IOException An I/O exception occured */ public Object asDOM3Serializer() throws IOException; } libxalan2-java-2.7.1/src/org/apache/xml/utils/0000755000175000017500000000000010736146354020050 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/utils/XMLChar.java0000644000175000017500000005677110721374030022155 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.utils; /** * This class defines the basic XML character properties. The data * in this class can be used to verify that a character is a valid * XML character or if the character is a space, name start, or name * character. *

    * A series of convenience methods are supplied to ease the burden * of the developer. Because inlining the checks can improve per * character performance, the tables of character properties are * public. Using the character as an index into the CHARS * array and applying the appropriate mask flag (e.g. * MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments * for the isValid method for details. * * @author Glenn Marcy, IBM * @author Andy Clark, IBM * @author Eric Ye, IBM * @author Arnaud Le Hors, IBM * @author Rahul Srivastava, Sun Microsystems Inc. * * @version $Id: XMLChar.java,v 1.7 2002/01/29 01:15:18 lehors Exp $ */ public class XMLChar { // // Constants // /** Character flags. */ private static final byte[] CHARS = new byte[1 << 16]; /** Valid character mask. */ public static final int MASK_VALID = 0x01; /** Space character mask. */ public static final int MASK_SPACE = 0x02; /** Name start character mask. */ public static final int MASK_NAME_START = 0x04; /** Name character mask. */ public static final int MASK_NAME = 0x08; /** Pubid character mask. */ public static final int MASK_PUBID = 0x10; /** * Content character mask. Special characters are those that can * be considered the start of markup, such as '<' and '&'. * The various newline characters are considered special as well. * All other valid XML characters can be considered content. *

    * This is an optimization for the inner loop of character scanning. */ public static final int MASK_CONTENT = 0x20; /** NCName start character mask. */ public static final int MASK_NCNAME_START = 0x40; /** NCName character mask. */ public static final int MASK_NCNAME = 0x80; // // Static initialization // static { // // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | // [#xE000-#xFFFD] | [#x10000-#x10FFFF] // int charRange[] = { 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD, }; // // [3] S ::= (#x20 | #x9 | #xD | #xA)+ // int spaceChar[] = { 0x0020, 0x0009, 0x000D, 0x000A, }; // // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | // CombiningChar | Extender // int nameChar[] = { 0x002D, 0x002E, // '-' and '.' }; // // [5] Name ::= (Letter | '_' | ':') (NameChar)* // int nameStartChar[] = { 0x003A, 0x005F, // ':' and '_' }; // // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] // int pubidChar[] = { 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D, 0x005F }; int pubidRange[] = { 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A }; // // [84] Letter ::= BaseChar | Ideographic // int letterRange[] = { // BaseChar 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6, 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E, 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217, 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1, 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C, 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4, 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5, 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA, 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7, 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6, 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990, 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD, 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10, 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36, 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B, 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3, 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28, 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D, 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95, 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA, 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10, 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61, 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3, 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10, 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E, 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88, 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB, 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47, 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103, 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155, 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF, 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9, 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D, 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC, 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB, 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B, 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C, 0xAC00, 0xD7A3, // Ideographic 0x3021, 0x3029, 0x4E00, 0x9FA5, }; int letterChar[] = { // BaseChar 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5, 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C, 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0, 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E, 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E, 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B, 0x1F5D, 0x1FBE, 0x2126, 0x212E, // Ideographic 0x3007, }; // // [87] CombiningChar ::= ... // int combiningCharRange[] = { 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1, 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652, 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8, 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954, 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8, 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48, 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5, 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43, 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83, 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03, 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56, 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD, 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48, 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9, 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84, 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7, 0x20D0, 0x20DC, 0x302A, 0x302F, }; int combiningCharChar[] = { 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A, }; // // [88] Digit ::= ... // int digitRange[] = { 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F, 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F, 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F, 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29, }; // // [89] Extender ::= ... // int extenderRange[] = { 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE, }; int extenderChar[] = { 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005, }; // // SpecialChar ::= '<', '&', '\n', '\r', ']' // int specialChar[] = { '<', '&', '\n', '\r', ']', }; // // Initialize // // set valid characters for (int i = 0; i < charRange.length; i += 2) { for (int j = charRange[i]; j <= charRange[i + 1]; j++) { CHARS[j] |= MASK_VALID | MASK_CONTENT; } } // remove special characters for (int i = 0; i < specialChar.length; i++) { CHARS[specialChar[i]] = (byte)(CHARS[specialChar[i]] & ~MASK_CONTENT); } // set space characters for (int i = 0; i < spaceChar.length; i++) { CHARS[spaceChar[i]] |= MASK_SPACE; } // set name start characters for (int i = 0; i < nameStartChar.length; i++) { CHARS[nameStartChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } for (int i = 0; i < letterRange.length; i += 2) { for (int j = letterRange[i]; j <= letterRange[i + 1]; j++) { CHARS[j] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } } for (int i = 0; i < letterChar.length; i++) { CHARS[letterChar[i]] |= MASK_NAME_START | MASK_NAME | MASK_NCNAME_START | MASK_NCNAME; } // set name characters for (int i = 0; i < nameChar.length; i++) { CHARS[nameChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < digitRange.length; i += 2) { for (int j = digitRange[i]; j <= digitRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharRange.length; i += 2) { for (int j = combiningCharRange[i]; j <= combiningCharRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < combiningCharChar.length; i++) { CHARS[combiningCharChar[i]] |= MASK_NAME | MASK_NCNAME; } for (int i = 0; i < extenderRange.length; i += 2) { for (int j = extenderRange[i]; j <= extenderRange[i + 1]; j++) { CHARS[j] |= MASK_NAME | MASK_NCNAME; } } for (int i = 0; i < extenderChar.length; i++) { CHARS[extenderChar[i]] |= MASK_NAME | MASK_NCNAME; } // remove ':' from allowable MASK_NCNAME_START and MASK_NCNAME chars CHARS[':'] &= ~(MASK_NCNAME_START | MASK_NCNAME); // set Pubid characters for (int i = 0; i < pubidChar.length; i++) { CHARS[pubidChar[i]] |= MASK_PUBID; } for (int i = 0; i < pubidRange.length; i += 2) { for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++) { CHARS[j] |= MASK_PUBID; } } } // () // // Public static methods // /** * Returns true if the specified character is a supplemental character. * * @param c The character to check. */ public static boolean isSupplemental(int c) { return (c >= 0x10000 && c <= 0x10FFFF); } /** * Returns true the supplemental character corresponding to the given * surrogates. * * @param h The high surrogate. * @param l The low surrogate. */ public static int supplemental(char h, char l) { return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; } /** * Returns the high surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char highSurrogate(int c) { return (char) (((c - 0x00010000) >> 10) + 0xD800); } /** * Returns the low surrogate of a supplemental character * * @param c The supplemental character to "split". */ public static char lowSurrogate(int c) { return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); } /** * Returns whether the given character is a high surrogate * * @param c The character to check. */ public static boolean isHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDBFF); } /** * Returns whether the given character is a low surrogate * * @param c The character to check. */ public static boolean isLowSurrogate(int c) { return (0xDC00 <= c && c <= 0xDFFF); } /** * Returns true if the specified character is valid. This method * also checks the surrogate character range from 0x10000 to 0x10FFFF. *

    * If the program chooses to apply the mask directly to the * CHARS array, then they are responsible for checking * the surrogate character range. * * @param c The character to check. */ public static boolean isValid(int c) { return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isValid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):boolean /** * Returns true if the specified character can be considered content. * * @param c The character to check. */ public static boolean isContent(int c) { return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isContent(int):boolean /** * Returns true if the specified character can be considered markup. * Markup characters include '<', '&', and '%'. * * @param c The character to check. */ public static boolean isMarkup(int c) { return c == '<' || c == '&' || c == '%'; } // isMarkup(int):boolean /** * Returns true if the specified character is a space character * as defined by production [3] in the XML 1.0 specification. * * @param c The character to check. */ public static boolean isSpace(int c) { return c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0; } // isSpace(int):boolean /** * Returns true if the specified character is a valid name start * character as defined by production [5] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; } // isNameStart(int):boolean /** * Returns true if the specified character is a valid name * character as defined by production [4] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; } // isName(int):boolean /** * Returns true if the specified character is a valid NCName start * character as defined by production [4] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCNameStart(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; } // isNCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName * character as defined by production [5] in Namespaces in XML * recommendation. * * @param c The character to check. */ public static boolean isNCName(int c) { return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; } // isNCName(int):boolean /** * Returns true if the specified character is a valid Pubid * character as defined by production [13] in the XML 1.0 * specification. * * @param c The character to check. */ public static boolean isPubid(int c) { return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; } // isPubid(int):boolean /* * [5] Name ::= (Letter | '_' | ':') (NameChar)* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) return false; char ch = name.charAt(0); if( isNameStart(ch) == false) return false; for (int i = 1; i < name.length(); i++ ) { ch = name.charAt(i); if( isName( ch ) == false ){ return false; } } return true; } // isValidName(String):boolean /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) return false; char ch = ncName.charAt(0); if( isNCNameStart(ch) == false) return false; for (int i = 1; i < ncName.length(); i++ ) { ch = ncName.charAt(i); if( isNCName( ch ) == false ){ return false; } } return true; } // isValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) return false; for (int i = 0; i < nmtoken.length(); i++ ) { char ch = nmtoken.charAt(i); if( ! isName( ch ) ){ return false; } } return true; } // isValidName(String):boolean // encodings /** * Returns true if the encoding name is a valid IANA encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * IANA encoding name. * * @param ianaEncoding The IANA encoding name. */ public static boolean isValidIANAEncoding(String ianaEncoding) { if (ianaEncoding != null) { int length = ianaEncoding.length(); if (length > 0) { char c = ianaEncoding.charAt(0); if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { for (int i = 1; i < length; i++) { c = ianaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } } return false; } // isValidIANAEncoding(String):boolean /** * Returns true if the encoding name is a valid Java encoding. * This method does not verify that there is a decoder available * for this encoding, only that the characters are valid for an * Java encoding name. * * @param javaEncoding The Java encoding name. */ public static boolean isValidJavaEncoding(String javaEncoding) { if (javaEncoding != null) { int length = javaEncoding.length(); if (length > 0) { for (int i = 1; i < length; i++) { char c = javaEncoding.charAt(i); if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-') { return false; } } return true; } } return false; } // isValidIANAEncoding(String):boolean /** * Simple check to determine if qname is legal. If it returns false * then str is illegal; if it returns true then * str is legal. */ public static boolean isValidQName(String str) { final int colon = str.indexOf(':'); if (colon == 0 || colon == str.length() - 1) { return false; } if (colon > 0) { final String prefix = str.substring(0,colon); final String localPart = str.substring(colon+1); return isValidNCName(prefix) && isValidNCName(localPart); } else { return isValidNCName(str); } } } // class XMLChar libxalan2-java-2.7.1/src/org/apache/xml/utils/QName.java0000644000175000017500000005025010721374031021703 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: QName.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.Stack; import java.util.StringTokenizer; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.w3c.dom.Element; /** * Class to represent a qualified name: "The name of an internal XSLT object, * specifically a named template (see [7 Named Templates]), a mode (see [6.7 Modes]), * an attribute set (see [8.1.4 Named Attribute Sets]), a key (see [14.2 Keys]), * a locale (see [14.3 Number Formatting]), a variable or a parameter (see * [12 Variables and Parameters]) is specified as a QName. If it has a prefix, * then the prefix is expanded into a URI reference using the namespace declarations * in effect on the attribute in which the name occurs. The expanded name * consisting of the local part of the name and the possibly null URI reference * is used as the name of the object. The default namespace is not used for * unprefixed names." * @xsl.usage general */ public class QName implements java.io.Serializable { static final long serialVersionUID = 467434581652829920L; /** * The local name. * @serial */ protected String _localName; /** * The namespace URI. * @serial */ protected String _namespaceURI; /** * The namespace prefix. * @serial */ protected String _prefix; /** * The XML namespace. */ public static final String S_XMLNAMESPACEURI = "http://www.w3.org/XML/1998/namespace"; /** * The cached hashcode, which is calculated at construction time. * @serial */ private int m_hashCode; /** * Constructs an empty QName. * 20001019: Try making this public, to support Serializable? -- JKESS */ public QName(){} /** * Constructs a new QName with the specified namespace URI and * local name. * * @param namespaceURI The namespace URI if known, or null * @param localName The local name */ public QName(String namespaceURI, String localName) { this(namespaceURI, localName, false); } /** * Constructs a new QName with the specified namespace URI and * local name. * * @param namespaceURI The namespace URI if known, or null * @param localName The local name * @param validate If true the new QName will be validated and an IllegalArgumentException will * be thrown if it is invalid. */ public QName(String namespaceURI, String localName, boolean validate) { // This check was already here. So, for now, I will not add it to the validation // that is done when the validate parameter is true. if (localName == null) throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null"); if (validate) { if (!XML11Char.isXML11ValidNCName(localName)) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName"); } } _namespaceURI = namespaceURI; _localName = localName; m_hashCode = toString().hashCode(); } /** * Constructs a new QName with the specified namespace URI, prefix * and local name. * * @param namespaceURI The namespace URI if known, or null * @param prefix The namespace prefix is known, or null * @param localName The local name * */ public QName(String namespaceURI, String prefix, String localName) { this(namespaceURI, prefix, localName, false); } /** * Constructs a new QName with the specified namespace URI, prefix * and local name. * * @param namespaceURI The namespace URI if known, or null * @param prefix The namespace prefix is known, or null * @param localName The local name * @param validate If true the new QName will be validated and an IllegalArgumentException will * be thrown if it is invalid. */ public QName(String namespaceURI, String prefix, String localName, boolean validate) { // This check was already here. So, for now, I will not add it to the validation // that is done when the validate parameter is true. if (localName == null) throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null"); if (validate) { if (!XML11Char.isXML11ValidNCName(localName)) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName"); } if ((null != prefix) && (!XML11Char.isXML11ValidNCName(prefix))) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_PREFIX_INVALID,null )); //"Argument 'prefix' not a valid NCName"); } } _namespaceURI = namespaceURI; _prefix = prefix; _localName = localName; m_hashCode = toString().hashCode(); } /** * Construct a QName from a string, without namespace resolution. Good * for a few odd cases. * * @param localName Local part of qualified name * */ public QName(String localName) { this(localName, false); } /** * Construct a QName from a string, without namespace resolution. Good * for a few odd cases. * * @param localName Local part of qualified name * @param validate If true the new QName will be validated and an IllegalArgumentException will * be thrown if it is invalid. */ public QName(String localName, boolean validate) { // This check was already here. So, for now, I will not add it to the validation // that is done when the validate parameter is true. if (localName == null) throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null"); if (validate) { if (!XML11Char.isXML11ValidNCName(localName)) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName"); } } _namespaceURI = null; _localName = localName; m_hashCode = toString().hashCode(); } /** * Construct a QName from a string, resolving the prefix * using the given namespace stack. The default namespace is * not resolved. * * @param qname Qualified name to resolve * @param namespaces Namespace stack to use to resolve namespace */ public QName(String qname, Stack namespaces) { this(qname, namespaces, false); } /** * Construct a QName from a string, resolving the prefix * using the given namespace stack. The default namespace is * not resolved. * * @param qname Qualified name to resolve * @param namespaces Namespace stack to use to resolve namespace * @param validate If true the new QName will be validated and an IllegalArgumentException will * be thrown if it is invalid. */ public QName(String qname, Stack namespaces, boolean validate) { String namespace = null; String prefix = null; int indexOfNSSep = qname.indexOf(':'); if (indexOfNSSep > 0) { prefix = qname.substring(0, indexOfNSSep); if (prefix.equals("xml")) { namespace = S_XMLNAMESPACEURI; } // Do we want this? else if (prefix.equals("xmlns")) { return; } else { int depth = namespaces.size(); for (int i = depth - 1; i >= 0; i--) { NameSpace ns = (NameSpace) namespaces.elementAt(i); while (null != ns) { if ((null != ns.m_prefix) && prefix.equals(ns.m_prefix)) { namespace = ns.m_uri; i = -1; break; } ns = ns.m_next; } } } if (null == namespace) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_PREFIX_MUST_RESOLVE, new Object[]{ prefix })); //"Prefix must resolve to a namespace: "+prefix); } } _localName = (indexOfNSSep < 0) ? qname : qname.substring(indexOfNSSep + 1); if (validate) { if ((_localName == null) || (!XML11Char.isXML11ValidNCName(_localName))) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName"); } } _namespaceURI = namespace; _prefix = prefix; m_hashCode = toString().hashCode(); } /** * Construct a QName from a string, resolving the prefix * using the given namespace context and prefix resolver. * The default namespace is not resolved. * * @param qname Qualified name to resolve * @param namespaceContext Namespace Context to use * @param resolver Prefix resolver for this context */ public QName(String qname, Element namespaceContext, PrefixResolver resolver) { this(qname, namespaceContext, resolver, false); } /** * Construct a QName from a string, resolving the prefix * using the given namespace context and prefix resolver. * The default namespace is not resolved. * * @param qname Qualified name to resolve * @param namespaceContext Namespace Context to use * @param resolver Prefix resolver for this context * @param validate If true the new QName will be validated and an IllegalArgumentException will * be thrown if it is invalid. */ public QName(String qname, Element namespaceContext, PrefixResolver resolver, boolean validate) { _namespaceURI = null; int indexOfNSSep = qname.indexOf(':'); if (indexOfNSSep > 0) { if (null != namespaceContext) { String prefix = qname.substring(0, indexOfNSSep); _prefix = prefix; if (prefix.equals("xml")) { _namespaceURI = S_XMLNAMESPACEURI; } // Do we want this? else if (prefix.equals("xmlns")) { return; } else { _namespaceURI = resolver.getNamespaceForPrefix(prefix, namespaceContext); } if (null == _namespaceURI) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_PREFIX_MUST_RESOLVE, new Object[]{ prefix })); //"Prefix must resolve to a namespace: "+prefix); } } else { // TODO: error or warning... } } _localName = (indexOfNSSep < 0) ? qname : qname.substring(indexOfNSSep + 1); if (validate) { if ((_localName == null) || (!XML11Char.isXML11ValidNCName(_localName))) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName"); } } m_hashCode = toString().hashCode(); } /** * Construct a QName from a string, resolving the prefix * using the given namespace stack. The default namespace is * not resolved. * * @param qname Qualified name to resolve * @param resolver Prefix resolver for this context */ public QName(String qname, PrefixResolver resolver) { this(qname, resolver, false); } /** * Construct a QName from a string, resolving the prefix * using the given namespace stack. The default namespace is * not resolved. * * @param qname Qualified name to resolve * @param resolver Prefix resolver for this context * @param validate If true the new QName will be validated and an IllegalArgumentException will * be thrown if it is invalid. */ public QName(String qname, PrefixResolver resolver, boolean validate) { String prefix = null; _namespaceURI = null; int indexOfNSSep = qname.indexOf(':'); if (indexOfNSSep > 0) { prefix = qname.substring(0, indexOfNSSep); if (prefix.equals("xml")) { _namespaceURI = S_XMLNAMESPACEURI; } else { _namespaceURI = resolver.getNamespaceForPrefix(prefix); } if (null == _namespaceURI) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_PREFIX_MUST_RESOLVE, new Object[]{ prefix })); //"Prefix must resolve to a namespace: "+prefix); } _localName = qname.substring(indexOfNSSep + 1); } else if (indexOfNSSep == 0) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_NAME_CANT_START_WITH_COLON, null)); } else { _localName = qname; } if (validate) { if ((_localName == null) || (!XML11Char.isXML11ValidNCName(_localName))) { throw new IllegalArgumentException(XMLMessages.createXMLMessage( XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName"); } } m_hashCode = toString().hashCode(); _prefix = prefix; } /** * Returns the namespace URI. Returns null if the namespace URI * is not known. * * @return The namespace URI, or null */ public String getNamespaceURI() { return _namespaceURI; } /** * Returns the namespace prefix. Returns null if the namespace * prefix is not known. * * @return The namespace prefix, or null */ public String getPrefix() { return _prefix; } /** * Returns the local part of the qualified name. * * @return The local part of the qualified name */ public String getLocalName() { return _localName; } /** * Return the string representation of the qualified name, using the * prefix if available, or the '{ns}foo' notation if not. Performs * string concatenation, so beware of performance issues. * * @return the string representation of the namespace */ public String toString() { return _prefix != null ? (_prefix + ":" + _localName) : (_namespaceURI != null ? ("{"+_namespaceURI + "}" + _localName) : _localName); } /** * Return the string representation of the qualified name using the * the '{ns}foo' notation. Performs * string concatenation, so beware of performance issues. * * @return the string representation of the namespace */ public String toNamespacedString() { return (_namespaceURI != null ? ("{"+_namespaceURI + "}" + _localName) : _localName); } /** * Get the namespace of the qualified name. * * @return the namespace URI of the qualified name */ public String getNamespace() { return getNamespaceURI(); } /** * Get the local part of the qualified name. * * @return the local part of the qualified name */ public String getLocalPart() { return getLocalName(); } /** * Return the cached hashcode of the qualified name. * * @return the cached hashcode of the qualified name */ public int hashCode() { return m_hashCode; } /** * Override equals and agree that we're equal if * the passed object is a string and it matches * the name of the arg. * * @param ns Namespace URI to compare to * @param localPart Local part of qualified name to compare to * * @return True if the local name and uri match */ public boolean equals(String ns, String localPart) { String thisnamespace = getNamespaceURI(); return getLocalName().equals(localPart) && (((null != thisnamespace) && (null != ns)) ? thisnamespace.equals(ns) : ((null == thisnamespace) && (null == ns))); } /** * Override equals and agree that we're equal if * the passed object is a QName and it matches * the name of the arg. * * @return True if the qualified names are equal */ public boolean equals(Object object) { if (object == this) return true; if (object instanceof QName) { QName qname = (QName) object; String thisnamespace = getNamespaceURI(); String thatnamespace = qname.getNamespaceURI(); return getLocalName().equals(qname.getLocalName()) && (((null != thisnamespace) && (null != thatnamespace)) ? thisnamespace.equals(thatnamespace) : ((null == thisnamespace) && (null == thatnamespace))); } else return false; } /** * Given a string, create and return a QName object * * * @param name String to use to create QName * * @return a QName object */ public static QName getQNameFromString(String name) { StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); QName qname; String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) qname = new QName(null, s1); else qname = new QName(s1, s2); return qname; } /** * This function tells if a raw attribute name is a * xmlns attribute. * * @param attRawName Raw name of attribute * * @return True if the attribute starts with or is equal to xmlns */ public static boolean isXMLNSDecl(String attRawName) { return (attRawName.startsWith("xmlns") && (attRawName.equals("xmlns") || attRawName.startsWith("xmlns:"))); } /** * This function tells if a raw attribute name is a * xmlns attribute. * * @param attRawName Raw name of attribute * * @return Prefix of attribute */ public static String getPrefixFromXMLNSDecl(String attRawName) { int index = attRawName.indexOf(':'); return (index >= 0) ? attRawName.substring(index + 1) : ""; } /** * Returns the local name of the given node. * * @param qname Input name * * @return Local part of the name if prefixed, or the given name if not */ public static String getLocalPart(String qname) { int index = qname.indexOf(':'); return (index < 0) ? qname : qname.substring(index + 1); } /** * Returns the local name of the given node. * * @param qname Input name * * @return Prefix of name or empty string if none there */ public static String getPrefixPart(String qname) { int index = qname.indexOf(':'); return (index >= 0) ? qname.substring(0, index) : ""; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/StringVector.java0000644000175000017500000001144510721374031023336 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringVector.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple table that stores a list of strings, optimized * for small lists. * @xsl.usage internal */ public class StringVector implements java.io.Serializable { static final long serialVersionUID = 4995234972032919748L; /** @serial Size of blocks to allocate */ protected int m_blocksize; /** @serial Array of strings this contains */ protected String m_map[]; /** @serial Number of strings this contains */ protected int m_firstFree = 0; /** @serial Size of the array */ protected int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public StringVector() { m_blocksize = 8; m_mapSize = m_blocksize; m_map = new String[m_blocksize]; } /** * Construct a StringVector, using the given block size. * * @param blocksize Size of the blocks to allocate */ public StringVector(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new String[blocksize]; } /** * Get the length of the list. * * @return Number of strings in the list */ public int getLength() { return m_firstFree; } /** * Get the length of the list. * * @return Number of strings in the list */ public final int size() { return m_firstFree; } /** * Append a string onto the vector. * * @param value Sting to add to the vector */ public final void addElement(String value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = value; m_firstFree++; } /** * Get the nth element. * * @param i Index of string to find * * @return String at given index */ public final String elementAt(int i) { return m_map[i]; } /** * Tell if the table contains the given string. * * @param s String to look for * * @return True if the string is in this table */ public final boolean contains(String s) { if (null == s) return false; for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equals(s)) return true; } return false; } /** * Tell if the table contains the given string. Ignore case. * * @param s String to find * * @return True if the String is in this vector */ public final boolean containsIgnoreCase(String s) { if (null == s) return false; for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equalsIgnoreCase(s)) return true; } return false; } /** * Tell if the table contains the given string. * * @param s String to push into the vector */ public final void push(String s) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = s; m_firstFree++; } /** * Pop the tail of this vector. * * @return The String last added to this vector or null not found. * The string is removed from the vector. */ public final String pop() { if (m_firstFree <= 0) return null; m_firstFree--; String s = m_map[m_firstFree]; m_map[m_firstFree] = null; return s; } /** * Get the string at the tail of this vector without popping. * * @return The string at the tail of this vector. */ public final String peek() { return (m_firstFree <= 0) ? null : m_map[m_firstFree - 1]; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/DOMHelper.java0000644000175000017500000013155110721374033022467 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMHelper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.Hashtable; import java.util.Vector; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xml.dtm.ref.DTMNodeProxy; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.w3c.dom.Attr; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.Entity; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.Text; /** * @deprecated Since the introduction of the DTM, this class will be removed. * This class provides a front-end to DOM implementations, providing * a number of utility functions that either aren't yet standardized * by the DOM spec or that are defined in optional DOM modules and * hence may not be present in all DOMs. */ public class DOMHelper { /** * DOM Level 1 did not have a standard mechanism for creating a new * Document object. This function provides a DOM-implementation-independent * abstraction for that for that concept. It's typically used when * outputting a new DOM as the result of an operation. *

    * TODO: This isn't directly compatable with DOM Level 2. * The Level 2 createDocument call also creates the root * element, and thus requires that you know what that element will be * before creating the Document. We should think about whether we want * to change this code, and the callers, so we can use the DOM's own * method. (It's also possible that DOM Level 3 may relax this * sequence, but you may give up some intelligence in the DOM by * doing so; the intent was that knowing the document type and root * element might let the DOM automatically switch to a specialized * subclass for particular kinds of documents.) * * @param isSecureProcessing state of the secure processing feature. * @return The newly created DOM Document object, with no children, or * null if we can't find a DOM implementation that permits creating * new empty Documents. */ public static Document createDocument(boolean isSecureProcessing) { try { // Use an implementation of the JAVA API for XML Parsing 1.0 to // create a DOM Document node to contain the result. DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setNamespaceAware(true); dfactory.setValidating(true); if (isSecureProcessing) { try { dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (ParserConfigurationException pce) {} } DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); Document outNode = docBuilder.newDocument(); return outNode; } catch (ParserConfigurationException pce) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null)); //"createDocument() not supported in XPathContext!"); // return null; } } /** * DOM Level 1 did not have a standard mechanism for creating a new * Document object. This function provides a DOM-implementation-independent * abstraction for that for that concept. It's typically used when * outputting a new DOM as the result of an operation. * * @return The newly created DOM Document object, with no children, or * null if we can't find a DOM implementation that permits creating * new empty Documents. */ public static Document createDocument() { return createDocument(false); } /** * Tells, through the combination of the default-space attribute * on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the * xml:space attribute, whether or not extra whitespace should be stripped * from the node. Literal elements from template elements should * not be tested with this function. * @param textNode A text node from the source tree. * @return true if the text node should be stripped of extra whitespace. * * @throws javax.xml.transform.TransformerException * @xsl.usage advanced */ public boolean shouldStripSourceNode(Node textNode) throws javax.xml.transform.TransformerException { // return (null == m_envSupport) ? false : m_envSupport.shouldStripSourceNode(textNode); return false; } /** * Supports the XPath function GenerateID by returning a unique * identifier string for any given DOM Node. *

    * Warning: The base implementation uses the Node object's hashCode(), * which is NOT guaranteed to be unique. If that method hasn't been * overridden in this DOM ipmlementation, most Java implementions will * derive it from the object's address and should be OK... but if * your DOM uses a different definition of hashCode (eg hashing the * contents of the subtree), or if your DOM may have multiple objects * that represent a single Node in the data structure (eg via proxying), * you may need to find another way to assign a unique identifier. *

    * Also, be aware that if nodes are destroyed and recreated, there is * an open issue regarding whether an ID may be reused. Currently * we're assuming that the input document is stable for the duration * of the XPath/XSLT operation, so this shouldn't arise in this context. *

    * (DOM Level 3 is investigating providing a unique node "key", but * that won't help Level 1 and Level 2 implementations.) * * @param node whose identifier you want to obtain * * @return a string which should be different for every Node object. */ public String getUniqueID(Node node) { return "N" + Integer.toHexString(node.hashCode()).toUpperCase(); } /** * Figure out whether node2 should be considered as being later * in the document than node1, in Document Order as defined * by the XPath model. This may not agree with the ordering defined * by other XML applications. *

    * There are some cases where ordering isn't defined, and neither are * the results of this function -- though we'll generally return true. * * TODO: Make sure this does the right thing with attribute nodes!!! * * @param node1 DOM Node to perform position comparison on. * @param node2 DOM Node to perform position comparison on . * * @return false if node2 comes before node1, otherwise return true. * You can think of this as * (node1.documentOrderPosition <= node2.documentOrderPosition). */ public static boolean isNodeAfter(Node node1, Node node2) { if (node1 == node2 || isNodeTheSame(node1, node2)) return true; // Default return value, if there is no defined ordering boolean isNodeAfter = true; Node parent1 = getParentOfNode(node1); Node parent2 = getParentOfNode(node2); // Optimize for most common case if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) // then we know they are siblings { if (null != parent1) isNodeAfter = isNodeAfterSibling(parent1, node1, node2); else { // If both parents are null, ordering is not defined. // We're returning a value in lieu of throwing an exception. // Not a case we expect to arise in XPath, but beware if you // try to reuse this method. // We can just fall through in this case, which allows us // to hit the debugging code at the end of the function. //return isNodeAfter; } } else { // General strategy: Figure out the lengths of the two // ancestor chains, reconcile the lengths, and look for // the lowest common ancestor. If that ancestor is one of // the nodes being compared, it comes before the other. // Otherwise perform a sibling compare. // // NOTE: If no common ancestor is found, ordering is undefined // and we return the default value of isNodeAfter. // Count parents in each ancestor chain int nParents1 = 2, nParents2 = 2; // include node & parent obtained above while (parent1 != null) { nParents1++; parent1 = getParentOfNode(parent1); } while (parent2 != null) { nParents2++; parent2 = getParentOfNode(parent2); } // Initially assume scan for common ancestor starts with // the input nodes. Node startNode1 = node1, startNode2 = node2; // If one ancestor chain is longer, adjust its start point // so we're comparing at the same depths if (nParents1 < nParents2) { // Adjust startNode2 to depth of startNode1 int adjust = nParents2 - nParents1; for (int i = 0; i < adjust; i++) { startNode2 = getParentOfNode(startNode2); } } else if (nParents1 > nParents2) { // adjust startNode1 to depth of startNode2 int adjust = nParents1 - nParents2; for (int i = 0; i < adjust; i++) { startNode1 = getParentOfNode(startNode1); } } Node prevChild1 = null, prevChild2 = null; // so we can "back up" // Loop up the ancestor chain looking for common parent while (null != startNode1) { if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2)) // common parent? { if (null == prevChild1) // first time in loop? { // Edge condition: one is the ancestor of the other. isNodeAfter = (nParents1 < nParents2) ? true : false; break; // from while loop } else { // Compare ancestors below lowest-common as siblings isNodeAfter = isNodeAfterSibling(startNode1, prevChild1, prevChild2); break; // from while loop } } // end if(startNode1 == startNode2) // Move up one level and try again prevChild1 = startNode1; startNode1 = getParentOfNode(startNode1); prevChild2 = startNode2; startNode2 = getParentOfNode(startNode2); } // end while(parents exist to examine) } // end big else (not immediate siblings) // WARNING: The following diagnostic won't report the early // "same node" case. Fix if/when needed. /* -- please do not remove... very useful for diagnostics -- System.out.println("node1 = "+node1.getNodeName()+"("+node1.getNodeType()+")"+ ", node2 = "+node2.getNodeName() +"("+node2.getNodeType()+")"+ ", isNodeAfter = "+isNodeAfter); */ return isNodeAfter; } // end isNodeAfter(Node node1, Node node2) /** * Use DTMNodeProxy to determine whether two nodes are the same. * * @param node1 The first DOM node to compare. * @param node2 The second DOM node to compare. * @return true if the two nodes are the same. */ public static boolean isNodeTheSame(Node node1, Node node2) { if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2); else return (node1 == node2); } /** * Figure out if child2 is after child1 in document order. *

    * Warning: Some aspects of "document order" are not well defined. * For example, the order of attributes is considered * meaningless in XML, and the order reported by our model will * be consistant for a given invocation but may not * match that of either the source file or the serialized output. * * @param parent Must be the parent of both child1 and child2. * @param child1 Must be the child of parent and not equal to child2. * @param child2 Must be the child of parent and not equal to child1. * @return true if child 2 is after child1 in document order. */ private static boolean isNodeAfterSibling(Node parent, Node child1, Node child2) { boolean isNodeAfterSibling = false; short child1type = child1.getNodeType(); short child2type = child2.getNodeType(); if ((Node.ATTRIBUTE_NODE != child1type) && (Node.ATTRIBUTE_NODE == child2type)) { // always sort attributes before non-attributes. isNodeAfterSibling = false; } else if ((Node.ATTRIBUTE_NODE == child1type) && (Node.ATTRIBUTE_NODE != child2type)) { // always sort attributes before non-attributes. isNodeAfterSibling = true; } else if (Node.ATTRIBUTE_NODE == child1type) { NamedNodeMap children = parent.getAttributes(); int nNodes = children.getLength(); boolean found1 = false, found2 = false; // Count from the start until we find one or the other. for (int i = 0; i < nNodes; i++) { Node child = children.item(i); if (child1 == child || isNodeTheSame(child1, child)) { if (found2) { isNodeAfterSibling = false; break; } found1 = true; } else if (child2 == child || isNodeTheSame(child2, child)) { if (found1) { isNodeAfterSibling = true; break; } found2 = true; } } } else { // TODO: Check performance of alternate solution: // There are two choices here: Count from the start of // the document until we find one or the other, or count // from one until we find or fail to find the other. // Either can wind up scanning all the siblings in the worst // case, which on a wide document can be a lot of work but // is more typically is a short list. // Scanning from the start involves two tests per iteration, // but it isn't clear that scanning from the middle doesn't // yield more iterations on average. // We should run some testcases. Node child = parent.getFirstChild(); boolean found1 = false, found2 = false; while (null != child) { // Node child = children.item(i); if (child1 == child || isNodeTheSame(child1, child)) { if (found2) { isNodeAfterSibling = false; break; } found1 = true; } else if (child2 == child || isNodeTheSame(child2, child)) { if (found1) { isNodeAfterSibling = true; break; } found2 = true; } child = child.getNextSibling(); } } return isNodeAfterSibling; } // end isNodeAfterSibling(Node parent, Node child1, Node child2) //========================================================== // SECTION: Namespace resolution //========================================================== /** * Get the depth level of this node in the tree (equals 1 for * a parentless node). * * @param n Node to be examined. * @return the number of ancestors, plus one * @xsl.usage internal */ public short getLevel(Node n) { short level = 1; while (null != (n = getParentOfNode(n))) { level++; } return level; } /** * Given an XML Namespace prefix and a context in which the prefix * is to be evaluated, return the Namespace Name this prefix was * bound to. Note that DOM Level 3 is expected to provide a version of * this which deals with the DOM's "early binding" behavior. * * Default handling: * * @param prefix String containing namespace prefix to be resolved, * without the ':' which separates it from the localname when used * in a Node Name. The empty sting signifies the default namespace * at this point in the document. * @param namespaceContext Element which provides context for resolution. * (We could extend this to work for other nodes by first seeking their * nearest Element ancestor.) * * @return a String containing the Namespace URI which this prefix * represents in the specified context. */ public String getNamespaceForPrefix(String prefix, Element namespaceContext) { int type; Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec } else if(prefix.equals("xmlns")) { // Hardcoded in the DOM spec, expected to be adopted by // Namespace spec. NOTE: Namespace declarations _must_ use // the xmlns: prefix; other prefixes declared as belonging // to this namespace will not be recognized and should // probably be rejected by parsers as erroneous declarations. namespace = "http://www.w3.org/2000/xmlns/"; } else { // Attribute name for this prefix's declaration String declname=(prefix=="") ? "xmlns" : "xmlns:"+prefix; // Scan until we run out of Elements or have resolved the namespace while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { // Look for the appropriate Namespace Declaration attribute, // either "xmlns:prefix" or (if prefix is "") "xmlns". // TODO: This does not handle "implicit declarations" // which may be created when the DOM is edited. DOM Level // 3 will define how those should be interpreted. But // this issue won't arise in freshly-parsed DOMs. // NOTE: declname is set earlier, outside the loop. Attr attr=((Element)parent).getAttributeNode(declname); if(attr!=null) { namespace = attr.getNodeValue(); break; } } parent = getParentOfNode(parent); } } return namespace; } /** * An experiment for the moment. */ Hashtable m_NSInfos = new Hashtable(); /** Object to put into the m_NSInfos table that tells that a node has not been * processed, but has xmlns namespace decls. */ protected static final NSInfo m_NSInfoUnProcWithXMLNS = new NSInfo(false, true); /** Object to put into the m_NSInfos table that tells that a node has not been * processed, but has no xmlns namespace decls. */ protected static final NSInfo m_NSInfoUnProcWithoutXMLNS = new NSInfo(false, false); /** Object to put into the m_NSInfos table that tells that a node has not been * processed, and has no xmlns namespace decls, and has no ancestor decls. */ protected static final NSInfo m_NSInfoUnProcNoAncestorXMLNS = new NSInfo(false, false, NSInfo.ANCESTORNOXMLNS); /** Object to put into the m_NSInfos table that tells that a node has been * processed, and has xmlns namespace decls. */ protected static final NSInfo m_NSInfoNullWithXMLNS = new NSInfo(true, true); /** Object to put into the m_NSInfos table that tells that a node has been * processed, and has no xmlns namespace decls. */ protected static final NSInfo m_NSInfoNullWithoutXMLNS = new NSInfo(true, false); /** Object to put into the m_NSInfos table that tells that a node has been * processed, and has no xmlns namespace decls. and has no ancestor decls. */ protected static final NSInfo m_NSInfoNullNoAncestorXMLNS = new NSInfo(true, false, NSInfo.ANCESTORNOXMLNS); /** Vector of node (odd indexes) and NSInfos (even indexes) that tell if * the given node is a candidate for ancestor namespace processing. */ protected Vector m_candidateNoAncestorXMLNS = new Vector(); /** * Returns the namespace of the given node. Differs from simply getting * the node's prefix and using getNamespaceForPrefix in that it attempts * to cache some of the data in NSINFO objects, to avoid repeated lookup. * TODO: Should we consider moving that logic into getNamespaceForPrefix? * * @param n Node to be examined. * * @return String containing the Namespace Name (uri) for this node. * Note that this is undefined for any nodes other than Elements and * Attributes. */ public String getNamespaceOfNode(Node n) { String namespaceOfPrefix; boolean hasProcessedNS; NSInfo nsInfo; short ntype = n.getNodeType(); if (Node.ATTRIBUTE_NODE != ntype) { Object nsObj = m_NSInfos.get(n); // return value nsInfo = (nsObj == null) ? null : (NSInfo) nsObj; hasProcessedNS = (nsInfo == null) ? false : nsInfo.m_hasProcessedNS; } else { hasProcessedNS = false; nsInfo = null; } if (hasProcessedNS) { namespaceOfPrefix = nsInfo.m_namespace; } else { namespaceOfPrefix = null; String nodeName = n.getNodeName(); int indexOfNSSep = nodeName.indexOf(':'); String prefix; if (Node.ATTRIBUTE_NODE == ntype) { if (indexOfNSSep > 0) { prefix = nodeName.substring(0, indexOfNSSep); } else { // Attributes don't use the default namespace, so if // there isn't a prefix, we're done. return namespaceOfPrefix; } } else { prefix = (indexOfNSSep >= 0) ? nodeName.substring(0, indexOfNSSep) : ""; } boolean ancestorsHaveXMLNS = false; boolean nHasXMLNS = false; if (prefix.equals("xml")) { namespaceOfPrefix = QName.S_XMLNAMESPACEURI; } else { int parentType; Node parent = n; while ((null != parent) && (null == namespaceOfPrefix)) { if ((null != nsInfo) && (nsInfo.m_ancestorHasXMLNSAttrs == NSInfo.ANCESTORNOXMLNS)) { break; } parentType = parent.getNodeType(); if ((null == nsInfo) || nsInfo.m_hasXMLNSAttrs) { boolean elementHasXMLNS = false; if (parentType == Node.ELEMENT_NODE) { NamedNodeMap nnm = parent.getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { Node attr = nnm.item(i); String aname = attr.getNodeName(); if (aname.charAt(0) == 'x') { boolean isPrefix = aname.startsWith("xmlns:"); if (aname.equals("xmlns") || isPrefix) { if (n == parent) nHasXMLNS = true; elementHasXMLNS = true; ancestorsHaveXMLNS = true; String p = isPrefix ? aname.substring(6) : ""; if (p.equals(prefix)) { namespaceOfPrefix = attr.getNodeValue(); break; } } } } } if ((Node.ATTRIBUTE_NODE != parentType) && (null == nsInfo) && (n != parent)) { nsInfo = elementHasXMLNS ? m_NSInfoUnProcWithXMLNS : m_NSInfoUnProcWithoutXMLNS; m_NSInfos.put(parent, nsInfo); } } if (Node.ATTRIBUTE_NODE == parentType) { parent = getParentOfNode(parent); } else { m_candidateNoAncestorXMLNS.addElement(parent); m_candidateNoAncestorXMLNS.addElement(nsInfo); parent = parent.getParentNode(); } if (null != parent) { Object nsObj = m_NSInfos.get(parent); // return value nsInfo = (nsObj == null) ? null : (NSInfo) nsObj; } } int nCandidates = m_candidateNoAncestorXMLNS.size(); if (nCandidates > 0) { if ((false == ancestorsHaveXMLNS) && (null == parent)) { for (int i = 0; i < nCandidates; i += 2) { Object candidateInfo = m_candidateNoAncestorXMLNS.elementAt(i + 1); if (candidateInfo == m_NSInfoUnProcWithoutXMLNS) { m_NSInfos.put(m_candidateNoAncestorXMLNS.elementAt(i), m_NSInfoUnProcNoAncestorXMLNS); } else if (candidateInfo == m_NSInfoNullWithoutXMLNS) { m_NSInfos.put(m_candidateNoAncestorXMLNS.elementAt(i), m_NSInfoNullNoAncestorXMLNS); } } } m_candidateNoAncestorXMLNS.removeAllElements(); } } if (Node.ATTRIBUTE_NODE != ntype) { if (null == namespaceOfPrefix) { if (ancestorsHaveXMLNS) { if (nHasXMLNS) m_NSInfos.put(n, m_NSInfoNullWithXMLNS); else m_NSInfos.put(n, m_NSInfoNullWithoutXMLNS); } else { m_NSInfos.put(n, m_NSInfoNullNoAncestorXMLNS); } } else { m_NSInfos.put(n, new NSInfo(namespaceOfPrefix, nHasXMLNS)); } } } return namespaceOfPrefix; } /** * Returns the local name of the given node. If the node's name begins * with a namespace prefix, this is the part after the colon; otherwise * it's the full node name. * * @param n the node to be examined. * * @return String containing the Local Name */ public String getLocalNameOfNode(Node n) { String qname = n.getNodeName(); int index = qname.indexOf(':'); return (index < 0) ? qname : qname.substring(index + 1); } /** * Returns the element name with the namespace prefix (if any) replaced * by the Namespace URI it was bound to. This is not a standard * representation of a node name, but it allows convenient * single-string comparison of the "universal" names of two nodes. * * @param elem Element to be examined. * * @return String in the form "namespaceURI:localname" if the node * belongs to a namespace, or simply "localname" if it doesn't. * @see #getExpandedAttributeName */ public String getExpandedElementName(Element elem) { String namespace = getNamespaceOfNode(elem); return (null != namespace) ? namespace + ":" + getLocalNameOfNode(elem) : getLocalNameOfNode(elem); } /** * Returns the attribute name with the namespace prefix (if any) replaced * by the Namespace URI it was bound to. This is not a standard * representation of a node name, but it allows convenient * single-string comparison of the "universal" names of two nodes. * * @param attr Attr to be examined * * @return String in the form "namespaceURI:localname" if the node * belongs to a namespace, or simply "localname" if it doesn't. * @see #getExpandedElementName */ public String getExpandedAttributeName(Attr attr) { String namespace = getNamespaceOfNode(attr); return (null != namespace) ? namespace + ":" + getLocalNameOfNode(attr) : getLocalNameOfNode(attr); } //========================================================== // SECTION: DOM Helper Functions //========================================================== /** * Tell if the node is ignorable whitespace. Note that this can * be determined only in the context of a DTD or other Schema, * and that DOM Level 2 has nostandardized DOM API which can * return that information. * @deprecated * * @param node Node to be examined * * @return CURRENTLY HARDCODED TO FALSE, but should return true if * and only if the node is of type Text, contains only whitespace, * and does not appear as part of the #PCDATA content of an element. * (Note that determining this last may require allowing for * Entity References.) */ public boolean isIgnorableWhitespace(Text node) { boolean isIgnorable = false; // return value // TODO: I can probably do something to figure out if this // space is ignorable from just the information in // the DOM tree. // -- You need to be able to distinguish whitespace // that is #PCDATA from whitespace that isn't. That requires // DTD support, which won't be standardized until DOM Level 3. return isIgnorable; } /** * Get the first unparented node in the ancestor chain. * @deprecated * * @param node Starting node, to specify which chain to chase * * @return the topmost ancestor. */ public Node getRoot(Node node) { Node root = null; while (node != null) { root = node; node = getParentOfNode(node); } return root; } /** * Get the root node of the document tree, regardless of * whether or not the node passed in is a document node. *

    * TODO: This doesn't handle DocumentFragments or "orphaned" subtrees * -- it's currently returning ownerDocument even when the tree is * not actually part of the main Document tree. We should either * rewrite the description to say that it finds the Document node, * or change the code to walk up the ancestor chain. * * @param n Node to be examined * * @return the Document node. Note that this is not the correct answer * if n was (or was a child of) a DocumentFragment or an orphaned node, * as can arise if the DOM has been edited rather than being generated * by a parser. */ public Node getRootNode(Node n) { int nt = n.getNodeType(); return ( (Node.DOCUMENT_NODE == nt) || (Node.DOCUMENT_FRAGMENT_NODE == nt) ) ? n : n.getOwnerDocument(); } /** * Test whether the given node is a namespace decl node. In DOM Level 2 * this can be done in a namespace-aware manner, but in Level 1 DOMs * it has to be done by testing the node name. * * @param n Node to be examined. * * @return boolean -- true iff the node is an Attr whose name is * "xmlns" or has the "xmlns:" prefix. */ public boolean isNamespaceNode(Node n) { if (Node.ATTRIBUTE_NODE == n.getNodeType()) { String attrName = n.getNodeName(); return (attrName.startsWith("xmlns:") || attrName.equals("xmlns")); } return false; } /** * Obtain the XPath-model parent of a DOM node -- ownerElement for Attrs, * parent for other nodes. *

    * Background: The DOM believes that you must be your Parent's * Child, and thus Attrs don't have parents. XPath said that Attrs * do have their owning Element as their parent. This function * bridges the difference, either by using the DOM Level 2 ownerElement * function or by using a "silly and expensive function" in Level 1 * DOMs. *

    * (There's some discussion of future DOMs generalizing ownerElement * into ownerNode and making it work on all types of nodes. This * still wouldn't help the users of Level 1 or Level 2 DOMs) *

    * * @param node Node whose XPath parent we want to obtain * * @return the parent of the node, or the ownerElement if it's an * Attr node, or null if the node is an orphan. * * @throws RuntimeException if the Document has no root element. * This can't arise if the Document was created * via the DOM Level 2 factory methods, but is possible if other * mechanisms were used to obtain it */ public static Node getParentOfNode(Node node) throws RuntimeException { Node parent; short nodeType = node.getNodeType(); if (Node.ATTRIBUTE_NODE == nodeType) { Document doc = node.getOwnerDocument(); /* TBD: if(null == doc) { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT, null));//"Attribute child does not have an owner document!"); } */ // Given how expensive the tree walk may be, we should first ask // whether this DOM can answer the question for us. The additional // test does slow down Level 1 DOMs slightly. DOMHelper2, which // is currently specialized for Xerces, assumes it can use the // Level 2 solution. We might want to have an intermediate stage, // which would assume DOM Level 2 but not assume Xerces. // // (Shouldn't have to check whether impl is null in a compliant DOM, // but let's be paranoid for a moment...) DOMImplementation impl=doc.getImplementation(); if(impl!=null && impl.hasFeature("Core","2.0")) { parent=((Attr)node).getOwnerElement(); return parent; } // DOM Level 1 solution, as fallback. Hugely expensive. Element rootElem = doc.getDocumentElement(); if (null == rootElem) { throw new RuntimeException( XMLMessages.createXMLMessage( XMLErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, null)); //"Attribute child does not have an owner document element!"); } parent = locateAttrParent(rootElem, node); } else { parent = node.getParentNode(); // if((Node.DOCUMENT_NODE != nodeType) && (null == parent)) // { // throw new RuntimeException("Child does not have parent!"); // } } return parent; } /** * Given an ID, return the element. This can work only if the document * is interpreted in the context of a DTD or Schema, since otherwise * we don't know which attributes are or aren't IDs. *

    * Note that DOM Level 1 had no ability to retrieve this information. * DOM Level 2 introduced it but does not promise that it will be * supported in all DOMs; those which can't support it will always * return null. *

    * TODO: getElementByID is currently unimplemented. Support DOM Level 2? * * @param id The unique identifier to be searched for. * @param doc The document to search within. * @return CURRENTLY HARDCODED TO NULL, but it should be: * The node which has this unique identifier, or null if there * is no such node or this DOM can't reliably recognize it. */ public Element getElementByID(String id, Document doc) { return null; } /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. *

    * XML processors may choose to use the System Identifier (if one * is provided) to resolve the entity, rather than the URI in the * Public Identifier. The details are dependent on the processor, and * we would have to support some form of plug-in resolver to handle * this properly. Currently, we simply return the System Identifier if * present, and hope that it a usable URI or that our caller can * map it to one. * TODO: Resolve Public Identifiers... or consider changing function name. *

    * If we find a relative URI * reference, XML expects it to be resolved in terms of the base URI * of the document. The DOM doesn't do that for us, and it isn't * entirely clear whether that should be done here; currently that's * pushed up to a higher levelof our application. (Note that DOM Level * 1 didn't store the document's base URI.) * TODO: Consider resolving Relative URIs. *

    * (The DOM's statement that "An XML processor may choose to * completely expand entities before the structure model is passed * to the DOM" refers only to parsed entities, not unparsed, and hence * doesn't affect this function.) * * @param name A string containing the Entity Name of the unparsed * entity. * @param doc Document node for the document to be searched. * * @return String containing the URI of the Unparsed Entity, or an * empty string if no such entity exists. */ public String getUnparsedEntityURI(String name, Document doc) { String url = ""; DocumentType doctype = doc.getDoctype(); if (null != doctype) { NamedNodeMap entities = doctype.getEntities(); if(null == entities) return url; Entity entity = (Entity) entities.getNamedItem(name); if(null == entity) return url; String notationName = entity.getNotationName(); if (null != notationName) // then it's unparsed { // The draft says: "The XSLT processor may use the public // identifier to generate a URI for the entity instead of the URI // specified in the system identifier. If the XSLT processor does // not use the public identifier to generate the URI, it must use // the system identifier; if the system identifier is a relative // URI, it must be resolved into an absolute URI using the URI of // the resource containing the entity declaration as the base // URI [RFC2396]." // So I'm falling a bit short here. url = entity.getSystemId(); if (null == url) { url = entity.getPublicId(); } else { // This should be resolved to an absolute URL, but that's hard // to do from here. } } } return url; } /** * Support for getParentOfNode; walks a DOM tree until it finds * the Element which owns the Attr. This is hugely expensive, and * if at all possible you should use the DOM Level 2 Attr.ownerElement() * method instead. *

    * The DOM Level 1 developers expected that folks would keep track * of the last Element they'd seen and could recover the info from * that source. Obviously that doesn't work very well if the only * information you've been presented with is the Attr. The DOM Level 2 * getOwnerElement() method fixes that, but only for Level 2 and * later DOMs. * * @param elem Element whose subtree is to be searched for this Attr * @param attr Attr whose owner is to be located. * * @return the first Element whose attribute list includes the provided * attr. In modern DOMs, this will also be the only such Element. (Early * DOMs had some hope that Attrs might be sharable, but this idea has * been abandoned.) */ private static Node locateAttrParent(Element elem, Node attr) { Node parent = null; // This should only be called for Level 1 DOMs, so we don't have to // worry about namespace issues. In later levels, it's possible // for a DOM to have two Attrs with the same NodeName but // different namespaces, and we'd need to get getAttributeNodeNS... // but later levels also have Attr.getOwnerElement. Attr check=elem.getAttributeNode(attr.getNodeName()); if(check==attr) parent = elem; if (null == parent) { for (Node node = elem.getFirstChild(); null != node; node = node.getNextSibling()) { if (Node.ELEMENT_NODE == node.getNodeType()) { parent = locateAttrParent((Element) node, attr); if (null != parent) break; } } } return parent; } /** * The factory object used for creating nodes * in the result tree. */ protected Document m_DOMFactory = null; /** * Store the factory object required to create DOM nodes * in the result tree. In fact, that's just the result tree's * Document node... * * @param domFactory The DOM Document Node within whose context * the result tree will be built. */ public void setDOMFactory(Document domFactory) { this.m_DOMFactory = domFactory; } /** * Retrieve the factory object required to create DOM nodes * in the result tree. * * @return The result tree's DOM Document Node. */ public Document getDOMFactory() { if (null == this.m_DOMFactory) { this.m_DOMFactory = createDocument(); } return this.m_DOMFactory; } /** * Get the textual contents of the node. See * getNodeData(Node,FastStringBuffer) for discussion of how * whitespace nodes are handled. * * @param node DOM Node to be examined * @return String containing a concatenation of all the * textual content within that node. * @see #getNodeData(Node,FastStringBuffer) * */ public static String getNodeData(Node node) { FastStringBuffer buf = StringBufferPool.get(); String s; try { getNodeData(node, buf); s = (buf.length() > 0) ? buf.toString() : ""; } finally { StringBufferPool.free(buf); } return s; } /** * Retrieve the text content of a DOM subtree, appending it into a * user-supplied FastStringBuffer object. Note that attributes are * not considered part of the content of an element. *

    * There are open questions regarding whitespace stripping. * Currently we make no special effort in that regard, since the standard * DOM doesn't yet provide DTD-based information to distinguish * whitespace-in-element-context from genuine #PCDATA. Note that we * should probably also consider xml:space if/when we address this. * DOM Level 3 may solve the problem for us. * * @param node Node whose subtree is to be walked, gathering the * contents of all Text or CDATASection nodes. * @param buf FastStringBuffer into which the contents of the text * nodes are to be concatenated. */ public static void getNodeData(Node node, FastStringBuffer buf) { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE : case Node.DOCUMENT_NODE : case Node.ELEMENT_NODE : { for (Node child = node.getFirstChild(); null != child; child = child.getNextSibling()) { getNodeData(child, buf); } } break; case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : buf.append(node.getNodeValue()); break; case Node.ATTRIBUTE_NODE : buf.append(node.getNodeValue()); break; case Node.PROCESSING_INSTRUCTION_NODE : // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING); break; default : // ignore break; } } } libxalan2-java-2.7.1/src/org/apache/xml/utils/SecuritySupport.java0000644000175000017500000000735310721374031024114 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.utils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/DOMBuilder.java0000644000175000017500000006104210721374032022632 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMBuilder.java 472634 2006-11-08 20:43:55Z jycli $ */ package org.apache.xml.utils; import java.util.Stack; import java.util.Vector; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; import org.w3c.dom.CDATASection; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.ext.LexicalHandler; /** * This class takes SAX events (in addition to some extra events * that SAX doesn't handle yet) and adds the result to a document * or document fragment. * @xsl.usage general */ public class DOMBuilder implements ContentHandler, LexicalHandler { /** Root document */ public Document m_doc; /** Current node */ protected Node m_currentNode = null; /** The root node */ protected Node m_root = null; /** The next sibling node */ protected Node m_nextSibling = null; /** First node of document fragment or null if not a DocumentFragment */ public DocumentFragment m_docFrag = null; /** Vector of element nodes */ protected Stack m_elemStack = new Stack(); /** Namespace support */ protected Vector m_prefixMappings = new Vector(); /** * DOMBuilder instance constructor... it will add the DOM nodes * to the document fragment. * * @param doc Root document * @param node Current node */ public DOMBuilder(Document doc, Node node) { m_doc = doc; m_currentNode = m_root = node; if (node instanceof Element) m_elemStack.push(node); } /** * DOMBuilder instance constructor... it will add the DOM nodes * to the document fragment. * * @param doc Root document * @param docFrag Document fragment */ public DOMBuilder(Document doc, DocumentFragment docFrag) { m_doc = doc; m_docFrag = docFrag; } /** * DOMBuilder instance constructor... it will add the DOM nodes * to the document. * * @param doc Root document */ public DOMBuilder(Document doc) { m_doc = doc; } /** * Get the root document or DocumentFragment of the DOM being created. * * @return The root document or document fragment if not null */ public Node getRootDocument() { return (null != m_docFrag) ? (Node) m_docFrag : (Node) m_doc; } /** * Get the root node of the DOM tree. */ public Node getRootNode() { return m_root; } /** * Get the node currently being processed. * * @return the current node being processed */ public Node getCurrentNode() { return m_currentNode; } /** * Set the next sibling node, which is where the result nodes * should be inserted before. * * @param nextSibling the next sibling node. */ public void setNextSibling(Node nextSibling) { m_nextSibling = nextSibling; } /** * Return the next sibling node. * * @return the next sibling node. */ public Node getNextSibling() { return m_nextSibling; } /** * Return null since there is no Writer for this class. * * @return null */ public java.io.Writer getWriter() { return null; } /** * Append a node to the current container. * * @param newNode New node to append */ protected void append(Node newNode) throws org.xml.sax.SAXException { Node currentNode = m_currentNode; if (null != currentNode) { if (currentNode == m_root && m_nextSibling != null) currentNode.insertBefore(newNode, m_nextSibling); else currentNode.appendChild(newNode); // System.out.println(newNode.getNodeName()); } else if (null != m_docFrag) { if (m_nextSibling != null) m_docFrag.insertBefore(newNode, m_nextSibling); else m_docFrag.appendChild(newNode); } else { boolean ok = true; short type = newNode.getNodeType(); if (type == Node.TEXT_NODE) { String data = newNode.getNodeValue(); if ((null != data) && (data.trim().length() > 0)) { throw new org.xml.sax.SAXException( XMLMessages.createXMLMessage( XMLErrorResources.ER_CANT_OUTPUT_TEXT_BEFORE_DOC, null)); //"Warning: can't output text before document element! Ignoring..."); } ok = false; } else if (type == Node.ELEMENT_NODE) { if (m_doc.getDocumentElement() != null) { ok = false; throw new org.xml.sax.SAXException( XMLMessages.createXMLMessage( XMLErrorResources.ER_CANT_HAVE_MORE_THAN_ONE_ROOT, null)); //"Can't have more than one root on a DOM!"); } } if (ok) { if (m_nextSibling != null) m_doc.insertBefore(newNode, m_nextSibling); else m_doc.appendChild(newNode); } } } /** * Receive an object for locating the origin of SAX document events. * *

    SAX parsers are strongly encouraged (though not absolutely * required) to supply a locator: if it does so, it must supply * the locator to the application by invoking this method before * invoking any of the other methods in the ContentHandler * interface.

    * *

    The locator allows the application to determine the end * position of any document-related event, even if the parser is * not reporting an error. Typically, the application will * use this information for reporting its own errors (such as * character content that does not match an application's * business rules). The information returned by the locator * is probably not sufficient for use with a search engine.

    * *

    Note that the locator will return correct information only * during the invocation of the events in this interface. The * application should not attempt to use it at any other time.

    * * @param locator An object that can return the location of * any SAX document event. * @see org.xml.sax.Locator */ public void setDocumentLocator(Locator locator) { // No action for the moment. } /** * Receive notification of the beginning of a document. * *

    The SAX parser will invoke this method only once, before any * other methods in this interface or in DTDHandler (except for * setDocumentLocator).

    */ public void startDocument() throws org.xml.sax.SAXException { // No action for the moment. } /** * Receive notification of the end of a document. * *

    The SAX parser will invoke this method only once, and it will * be the last method invoked during the parse. The parser shall * not invoke this method until it has either abandoned parsing * (because of an unrecoverable error) or reached the end of * input.

    */ public void endDocument() throws org.xml.sax.SAXException { // No action for the moment. } /** * Receive notification of the beginning of an element. * *

    The Parser will invoke this method at the beginning of every * element in the XML document; there will be a corresponding * endElement() event for every startElement() event (even when the * element is empty). All of the element's content will be * reported, in order, before the corresponding endElement() * event.

    * *

    If the element name has a namespace prefix, the prefix will * still be attached. Note that the attribute list provided will * contain only attributes with explicit values (specified or * defaulted): #IMPLIED attributes will be omitted.

    * * * @param ns The namespace of the node * @param localName The local part of the qualified name * @param name The element name. * @param atts The attributes attached to the element, if any. * @see #endElement * @see org.xml.sax.Attributes */ public void startElement( String ns, String localName, String name, Attributes atts) throws org.xml.sax.SAXException { Element elem; // Note that the namespace-aware call must be used to correctly // construct a Level 2 DOM, even for non-namespaced nodes. if ((null == ns) || (ns.length() == 0)) elem = m_doc.createElementNS(null,name); else elem = m_doc.createElementNS(ns, name); append(elem); try { int nAtts = atts.getLength(); if (0 != nAtts) { for (int i = 0; i < nAtts; i++) { //System.out.println("type " + atts.getType(i) + " name " + atts.getLocalName(i) ); // First handle a possible ID attribute if (atts.getType(i).equalsIgnoreCase("ID")) setIDAttribute(atts.getValue(i), elem); String attrNS = atts.getURI(i); if("".equals(attrNS)) attrNS = null; // DOM represents no-namespace as null // System.out.println("attrNS: "+attrNS+", localName: "+atts.getQName(i) // +", qname: "+atts.getQName(i)+", value: "+atts.getValue(i)); // Crimson won't let us set an xmlns: attribute on the DOM. String attrQName = atts.getQName(i); // In SAX, xmlns[:] attributes have an empty namespace, while in DOM they // should have the xmlns namespace if (attrQName.startsWith("xmlns:") || attrQName.equals("xmlns")) { attrNS = "http://www.w3.org/2000/xmlns/"; } // ALWAYS use the DOM Level 2 call! elem.setAttributeNS(attrNS,attrQName, atts.getValue(i)); } } /* * Adding namespace nodes to the DOM tree; */ int nDecls = m_prefixMappings.size(); String prefix, declURL; for (int i = 0; i < nDecls; i += 2) { prefix = (String) m_prefixMappings.elementAt(i); if (prefix == null) continue; declURL = (String) m_prefixMappings.elementAt(i + 1); elem.setAttributeNS("http://www.w3.org/2000/xmlns/", prefix, declURL); } m_prefixMappings.clear(); // append(elem); m_elemStack.push(elem); m_currentNode = elem; // append(elem); } catch(java.lang.Exception de) { // de.printStackTrace(); throw new org.xml.sax.SAXException(de); } } /** * Receive notification of the end of an element. * *

    The SAX parser will invoke this method at the end of every * element in the XML document; there will be a corresponding * startElement() event for every endElement() event (even when the * element is empty).

    * *

    If the element name has a namespace prefix, the prefix will * still be attached to the name.

    * * * @param ns the namespace of the element * @param localName The local part of the qualified name of the element * @param name The element name */ public void endElement(String ns, String localName, String name) throws org.xml.sax.SAXException { m_elemStack.pop(); m_currentNode = m_elemStack.isEmpty() ? null : (Node)m_elemStack.peek(); } /** * Set an ID string to node association in the ID table. * * @param id The ID string. * @param elem The associated ID. */ public void setIDAttribute(String id, Element elem) { // Do nothing. This method is meant to be overiden. } /** * Receive notification of character data. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @see #ignorableWhitespace * @see org.xml.sax.Locator */ public void characters(char ch[], int start, int length) throws org.xml.sax.SAXException { if(isOutsideDocElem() && org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error if (m_inCData) { cdata(ch, start, length); return; } String s = new String(ch, start, length); Node childNode; childNode = m_currentNode != null ? m_currentNode.getLastChild(): null; if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){ ((Text)childNode).appendData(s); } else{ Text text = m_doc.createTextNode(s); append(text); } } /** * If available, when the disable-output-escaping attribute is used, * output raw text without escaping. A PI will be inserted in front * of the node with the name "lotusxsl-next-is-raw" and a value of * "formatter-to-dom". * * @param ch Array containing the characters * @param start Index to start of characters in the array * @param length Number of characters in the array */ public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { if(isOutsideDocElem() && org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createProcessingInstruction("xslt-next-is-raw", "formatter-to-dom")); append(m_doc.createTextNode(s)); } /** * Report the beginning of an entity. * * The start and end of the document entity are not reported. * The start and end of the external DTD subset are reported * using the pseudo-name "[dtd]". All other events must be * properly nested within start/end entity events. * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @see #endEntity * @see org.xml.sax.ext.DeclHandler#internalEntityDecl * @see org.xml.sax.ext.DeclHandler#externalEntityDecl */ public void startEntity(String name) throws org.xml.sax.SAXException { // Almost certainly the wrong behavior... // entityReference(name); } /** * Report the end of an entity. * * @param name The name of the entity that is ending. * @see #startEntity */ public void endEntity(String name) throws org.xml.sax.SAXException{} /** * Receive notivication of a entityReference. * * @param name name of the entity reference */ public void entityReference(String name) throws org.xml.sax.SAXException { append(m_doc.createEntityReference(name)); } /** * Receive notification of ignorable whitespace in element content. * *

    Validating Parsers must use this method to report each chunk * of ignorable whitespace (see the W3C XML 1.0 recommendation, * section 2.10): non-validating parsers may also use this method * if they are capable of parsing and using content models.

    * *

    SAX parsers may return all contiguous whitespace in a single * chunk, or they may split it into several chunks; however, all of * the characters in any single event must come from the same * external entity, so that the Locator provides useful * information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @see #characters */ public void ignorableWhitespace(char ch[], int start, int length) throws org.xml.sax.SAXException { if(isOutsideDocElem()) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createTextNode(s)); } /** * Tell if the current node is outside the document element. * * @return true if the current node is outside the document element. */ private boolean isOutsideDocElem() { return (null == m_docFrag) && m_elemStack.size() == 0 && (null == m_currentNode || m_currentNode.getNodeType() == Node.DOCUMENT_NODE); } /** * Receive notification of a processing instruction. * *

    The Parser will invoke this method once for each processing * instruction found: note that processing instructions may occur * before or after the main document element.

    * *

    A SAX parser should never report an XML declaration (XML 1.0, * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.

    * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { append(m_doc.createProcessingInstruction(target, data)); } /** * Report an XML comment anywhere in the document. * * This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read). * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. */ public void comment(char ch[], int start, int length) throws org.xml.sax.SAXException { append(m_doc.createComment(new String(ch, start, length))); } /** Flag indicating that we are processing a CData section */ protected boolean m_inCData = false; /** * Report the start of a CDATA section. * * @see #endCDATA */ public void startCDATA() throws org.xml.sax.SAXException { m_inCData = true; append(m_doc.createCDATASection("")); } /** * Report the end of a CDATA section. * * @see #startCDATA */ public void endCDATA() throws org.xml.sax.SAXException { m_inCData = false; } /** * Receive notification of cdata. * *

    The Parser will call this method to report each chunk of * character data. SAX parsers may return all contiguous character * data in a single chunk, or they may split it into several * chunks; however, all of the characters in any single event * must come from the same external entity, so that the Locator * provides useful information.

    * *

    The application must not attempt to read from the array * outside of the specified range.

    * *

    Note that some parsers will report whitespace using the * ignorableWhitespace() method rather than this one (validating * parsers must do so).

    * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @see #ignorableWhitespace * @see org.xml.sax.Locator */ public void cdata(char ch[], int start, int length) throws org.xml.sax.SAXException { if(isOutsideDocElem() && org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); CDATASection section =(CDATASection) m_currentNode.getLastChild(); section.appendData(s); } /** * Report the start of DTD declarations, if any. * * Any declarations are assumed to be in the internal subset * unless otherwise indicated. * * @param name The document type name. * @param publicId The declared public identifier for the * external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the * external DTD subset, or null if none was declared. * @see #endDTD * @see #startEntity */ public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException { // Do nothing for now. } /** * Report the end of DTD declarations. * * @see #startDTD */ public void endDTD() throws org.xml.sax.SAXException { // Do nothing for now. } /** * Begin the scope of a prefix-URI Namespace mapping. * *

    The information from this event is not necessary for * normal Namespace processing: the SAX XML reader will * automatically replace prefixes for element and attribute * names when the http://xml.org/sax/features/namespaces * feature is true (the default).

    * *

    There are cases, however, when applications need to * use prefixes in character data or in attribute values, * where they cannot safely be expanded automatically; the * start/endPrefixMapping event supplies the information * to the application to expand prefixes in those contexts * itself, if necessary.

    * *

    Note that start/endPrefixMapping events are not * guaranteed to be properly nested relative to each-other: * all startPrefixMapping events will occur before the * corresponding startElement event, and all endPrefixMapping * events will occur after the corresponding endElement event, * but their order is not guaranteed.

    * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI the prefix is mapped to. * @see #endPrefixMapping * @see #startElement */ public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { if(null == prefix || prefix.equals("")) prefix = "xmlns"; else prefix = "xmlns:"+prefix; m_prefixMappings.addElement(prefix); m_prefixMappings.addElement(uri); } /** * End the scope of a prefix-URI mapping. * *

    See startPrefixMapping for details. This event will * always occur after the corresponding endElement event, * but the order of endPrefixMapping events is not otherwise * guaranteed.

    * * @param prefix The prefix that was being mapping. * @see #startPrefixMapping * @see #endElement */ public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException{} /** * Receive notification of a skipped entity. * *

    The Parser will invoke this method once for each entity * skipped. Non-validating processors may skip entities if they * have not seen the declarations (because, for example, the * entity was declared in an external DTD subset). All processors * may skip external entities, depending on the values of the * http://xml.org/sax/features/external-general-entities and the * http://xml.org/sax/features/external-parameter-entities * properties.

    * * @param name The name of the skipped entity. If it is a * parameter entity, the name will begin with '%'. */ public void skippedEntity(String name) throws org.xml.sax.SAXException{} } libxalan2-java-2.7.1/src/org/apache/xml/utils/SuballocatedIntVector.java0000644000175000017500000004001710721374031025142 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SuballocatedIntVector.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple table that stores a list of int. Very similar API to our * IntVector class (same API); different internal storage. * * This version uses an array-of-arrays solution. Read/write access is thus * a bit slower than the simple IntVector, and basic storage is a trifle * higher due to the top-level array -- but appending is O(1) fast rather * than O(N**2) slow, which will swamp those costs in situations where * long vectors are being built up. * * Known issues: * * Some methods are private because they haven't yet been tested properly. * * Retrieval performance is critical, since this is used at the core * of the DTM model. (Append performance is almost as important.) * That's pushing me toward just letting reads from unset indices * throw exceptions or return stale data; safer behavior would have * performance costs. * */ public class SuballocatedIntVector { /** Size of blocks to allocate */ protected int m_blocksize; /** Bitwise addressing (much faster than div/remainder */ protected int m_SHIFT, m_MASK; /** The default number of blocks to (over)allocate by */ protected static final int NUMBLOCKS_DEFAULT = 32; /** The number of blocks to (over)allocate by */ protected int m_numblocks = NUMBLOCKS_DEFAULT; /** Array of arrays of ints */ protected int m_map[][]; /** Number of ints in array */ protected int m_firstFree = 0; /** "Shortcut" handle to m_map[0]. Surprisingly helpful for short vectors. */ protected int m_map0[]; /** "Shortcut" handle to most recently added row of m_map. * Very helpful during construction. * @xsl.usage internal */ protected int m_buildCache[]; protected int m_buildCacheStartIndex; /** * Default constructor. Note that the default * block size is currently 2K, which may be overkill for * small lists and undershootng for large ones. */ public SuballocatedIntVector() { this(2048); } /** * Construct a IntVector, using the given block size and number * of blocks. For efficiency, we will round the requested size * off to a power of two. * * @param blocksize Size of block to allocate * @param numblocks Number of blocks to allocate * */ public SuballocatedIntVector(int blocksize, int numblocks) { //m_blocksize = blocksize; for(m_SHIFT=0;0!=(blocksize>>>=1);++m_SHIFT) ; m_blocksize=1<sz) // Whups; had that backward! m_firstFree = sz; } /** * Append a int onto the vector. * * @param value Int to add to the list */ public void addElement(int value) { int indexRelativeToCache = m_firstFree - m_buildCacheStartIndex; // Is the new index an index into the cache row of m_map? if(indexRelativeToCache >= 0 && indexRelativeToCache < m_blocksize) { m_buildCache[indexRelativeToCache]=value; ++m_firstFree; } else { // Growing the outer array should be rare. We initialize to a // total of m_blocksize squared elements, which at the default // size is 4M integers... and we grow by at least that much each // time. However, attempts to microoptimize for this (assume // long enough and catch exceptions) yield no noticable // improvement. int index=m_firstFree>>>m_SHIFT; int offset=m_firstFree&m_MASK; if(index>=m_map.length) { int newsize=index+m_numblocks; int[][] newMap=new int[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } int[] block=m_map[index]; if(null==block) block=m_map[index]=new int[m_blocksize]; block[offset]=value; // Cache the current row of m_map. Next m_blocksize-1 // values added will go to this row. m_buildCache = block; m_buildCacheStartIndex = m_firstFree-offset; ++m_firstFree; } } /** * Append several int values onto the vector. * * @param value Int to add to the list */ private void addElements(int value, int numberOfElements) { if(m_firstFree+numberOfElements>>m_SHIFT; int offset=m_firstFree&m_MASK; m_firstFree+=numberOfElements; while( numberOfElements>0) { if(index>=m_map.length) { int newsize=index+m_numblocks; int[][] newMap=new int[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } int[] block=m_map[index]; if(null==block) block=m_map[index]=new int[m_blocksize]; int copied=(m_blocksize-offset < numberOfElements) ? m_blocksize-offset : numberOfElements; numberOfElements-=copied; while(copied-- > 0) block[offset++]=value; ++index;offset=0; } } } /** * Append several slots onto the vector, but do not set the values. * Note: "Not Set" means the value is unspecified. * * @param numberOfElements Int to add to the list */ private void addElements(int numberOfElements) { int newlen=m_firstFree+numberOfElements; if(newlen>m_blocksize) { int index=m_firstFree>>>m_SHIFT; int newindex=(m_firstFree+numberOfElements)>>>m_SHIFT; for(int i=index+1;i<=newindex;++i) m_map[i]=new int[m_blocksize]; } m_firstFree=newlen; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * Insertion may be an EXPENSIVE operation! * * @param value Int to insert * @param at Index of where to insert */ private void insertElementAt(int value, int at) { if(at==m_firstFree) addElement(value); else if (at>m_firstFree) { int index=at>>>m_SHIFT; if(index>=m_map.length) { int newsize=index+m_numblocks; int[][] newMap=new int[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } int[] block=m_map[index]; if(null==block) block=m_map[index]=new int[m_blocksize]; int offset=at&m_MASK; block[offset]=value; m_firstFree=offset+1; } else { int index=at>>>m_SHIFT; int maxindex=m_firstFree>>>m_SHIFT; // %REVIEW% (m_firstFree+1?) ++m_firstFree; int offset=at&m_MASK; int push; // ***** Easier to work down from top? while(index<=maxindex) { int copylen=m_blocksize-offset-1; int[] block=m_map[index]; if(null==block) { push=0; block=m_map[index]=new int[m_blocksize]; } else { push=block[m_blocksize-1]; System.arraycopy(block, offset , block, offset+1, copylen); } block[offset]=value; value=push; offset=0; ++index; } } } /** * Wipe it out. Currently defined as equivalent to setSize(0). */ public void removeAllElements() { m_firstFree = 0; m_buildCache = m_map0; m_buildCacheStartIndex = 0; } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s Int to remove from array * * @return True if the int was removed, false if it was not found */ private boolean removeElement(int s) { int at=indexOf(s,0); if(at<0) return false; removeElementAt(at); return true; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param i index of where to remove and int */ private void removeElementAt(int at) { // No point in removing elements that "don't exist"... if(at>>m_SHIFT; int maxindex=m_firstFree>>>m_SHIFT; int offset=at&m_MASK; while(index<=maxindex) { int copylen=m_blocksize-offset-1; int[] block=m_map[index]; if(null==block) block=m_map[index]=new int[m_blocksize]; else System.arraycopy(block, offset+1, block, offset, copylen); if(index>>m_SHIFT; int offset=at&m_MASK; if(index>=m_map.length) { int newsize=index+m_numblocks; int[][] newMap=new int[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } int[] block=m_map[index]; if(null==block) block=m_map[index]=new int[m_blocksize]; block[offset]=value; } if(at>=m_firstFree) m_firstFree=at+1; } /** * Get the nth element. This is often at the innermost loop of an * application, so performance is critical. * * @param i index of value to get * * @return value at given index. If that value wasn't previously set, * the result is undefined for performance reasons. It may throw an * exception (see below), may return zero, or (if setSize has previously * been used) may return stale data. * * @throws ArrayIndexOutOfBoundsException if the index was _clearly_ * unreasonable (negative, or past the highest block). * * @throws NullPointerException if the index points to a block that could * have existed (based on the highest index used) but has never had anything * set into it. * %REVIEW% Could add a catch to create the block in that case, or return 0. * Try/Catch is _supposed_ to be nearly free when not thrown to. Do we * believe that? Should we have a separate safeElementAt? */ public int elementAt(int i) { // This is actually a significant optimization! if(i>>m_SHIFT][i&m_MASK]; } /** * Tell if the table contains the given node. * * @param s object to look for * * @return true if the object is in the list */ private boolean contains(int s) { return (indexOf(s,0) >= 0); } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem object to look for * @param index Index of where to begin search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(int elem, int index) { if(index>=m_firstFree) return -1; int bindex=index>>>m_SHIFT; int boffset=index&m_MASK; int maxindex=m_firstFree>>>m_SHIFT; int[] block; for(;bindex>>m_SHIFT; index>=0; --index) { int[] block=m_map[index]; if(block!=null) for(int offset=boffset; offset>=0; --offset) if(block[offset]==elem) return offset+index*m_blocksize; boffset=0; // after first } return -1; } /** * Return the internal m_map0 array * @return the m_map0 array */ public final int[] getMap0() { return m_map0; } /** * Return the m_map double array * @return the internal map of array of arrays */ public final int[][] getMap() { return m_map; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/ObjectVector.java0000644000175000017500000002425510721374030023300 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.utils; /** * A very simple table that stores a list of objects. * * This version is based on a "realloc" strategy -- a simle array is * used, and when more storage is needed, a larger array is obtained * and all existing data is recopied into it. As a result, read/write * access to existing nodes is O(1) fast but appending may be O(N**2) * slow. * @xsl.usage internal */ public class ObjectVector implements Cloneable { /** Size of blocks to allocate */ protected int m_blocksize; /** Array of objects */ protected Object m_map[]; /** Number of ints in array */ protected int m_firstFree = 0; /** Size of array */ protected int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public ObjectVector() { m_blocksize = 32; m_mapSize = m_blocksize; m_map = new Object[m_blocksize]; } /** * Construct a IntVector, using the given block size. * * @param blocksize Size of block to allocate */ public ObjectVector(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new Object[blocksize]; } /** * Construct a IntVector, using the given block size. * * @param blocksize Size of block to allocate */ public ObjectVector(int blocksize, int increaseSize) { m_blocksize = increaseSize; m_mapSize = blocksize; m_map = new Object[blocksize]; } /** * Copy constructor for ObjectVector * * @param v Existing ObjectVector to copy */ public ObjectVector(ObjectVector v) { m_map = new Object[v.m_mapSize]; m_mapSize = v.m_mapSize; m_firstFree = v.m_firstFree; m_blocksize = v.m_blocksize; System.arraycopy(v.m_map, 0, m_map, 0, m_firstFree); } /** * Get the length of the list. * * @return length of the list */ public final int size() { return m_firstFree; } /** * Get the length of the list. * * @return length of the list */ public final void setSize(int sz) { m_firstFree = sz; } /** * Append an object onto the vector. * * @param value Object to add to the list */ public final void addElement(Object value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; Object newMap[] = new Object[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = value; m_firstFree++; } /** * Append several Object values onto the vector. * * @param value Object to add to the list */ public final void addElements(Object value, int numberOfElements) { if ((m_firstFree + numberOfElements) >= m_mapSize) { m_mapSize += (m_blocksize+numberOfElements); Object newMap[] = new Object[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } for (int i = 0; i < numberOfElements; i++) { m_map[m_firstFree] = value; m_firstFree++; } } /** * Append several slots onto the vector, but do not set the values. * * @param numberOfElements number of slots to append */ public final void addElements(int numberOfElements) { if ((m_firstFree + numberOfElements) >= m_mapSize) { m_mapSize += (m_blocksize+numberOfElements); Object newMap[] = new Object[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_firstFree += numberOfElements; } /** * Inserts the specified object in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * @param value Object to insert * @param at Index of where to insert */ public final void insertElementAt(Object value, int at) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; Object newMap[] = new Object[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } if (at <= (m_firstFree - 1)) { System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at); } m_map[at] = value; m_firstFree++; } /** * Remove all elements objects from the list. */ public final void removeAllElements() { for (int i = 0; i < m_firstFree; i++) { m_map[i] = null; } m_firstFree = 0; } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s Object to remove from array * * @return True if the object was removed, false if it was not found */ public final boolean removeElement(Object s) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i] == s) { if ((i + 1) < m_firstFree) System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i); else m_map[i] = null; m_firstFree--; return true; } } return false; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param i index of where to remove an object */ public final void removeElementAt(int i) { if (i > m_firstFree) System.arraycopy(m_map, i + 1, m_map, i, m_firstFree); else m_map[i] = null; m_firstFree--; } /** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param value object to set * @param index Index of where to set the object */ public final void setElementAt(Object value, int index) { m_map[index] = value; } /** * Get the nth element. * * @param i index of object to get * * @return object at given index */ public final Object elementAt(int i) { return m_map[i]; } /** * Tell if the table contains the given Object. * * @param s object to look for * * @return true if the object is in the list */ public final boolean contains(Object s) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i] == s) return true; } return false; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem object to look for * @param index Index of where to begin search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int indexOf(Object elem, int index) { for (int i = index; i < m_firstFree; i++) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem object to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int indexOf(Object elem) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Object to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int lastIndexOf(Object elem) { for (int i = (m_firstFree - 1); i >= 0; i--) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; } /* * Reset the array to the supplied size. * * @param size */ public final void setToSize(int size) { Object newMap[] = new Object[size]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree); m_mapSize = size; m_map = newMap; } /** * Returns clone of current ObjectVector * * @return clone of current ObjectVector */ public Object clone() throws CloneNotSupportedException { return new ObjectVector(this); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/StringToIntTable.java0000644000175000017500000001067310721374032024104 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringToIntTable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple lookup table that stores a list of strings, the even * number strings being keys, and the odd number strings being values. * @xsl.usage internal */ public class StringToIntTable { public static final int INVALID_KEY = -10000; /** Block size to allocate */ private int m_blocksize; /** Array of strings this table points to. Associated with ints * in m_values */ private String m_map[]; /** Array of ints this table points. Associated with strings from * m_map. */ private int m_values[]; /** Number of ints in the table */ private int m_firstFree = 0; /** Size of this table */ private int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public StringToIntTable() { m_blocksize = 8; m_mapSize = m_blocksize; m_map = new String[m_blocksize]; m_values = new int[m_blocksize]; } /** * Construct a StringToIntTable, using the given block size. * * @param blocksize Size of block to allocate */ public StringToIntTable(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new String[blocksize]; m_values = new int[m_blocksize]; } /** * Get the length of the list. * * @return the length of the list */ public final int getLength() { return m_firstFree; } /** * Append a string onto the vector. * * @param key String to append * @param value The int value of the string */ public final void put(String key, int value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; int newValues[] = new int[m_mapSize]; System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1); m_values = newValues; } m_map[m_firstFree] = key; m_values[m_firstFree] = value; m_firstFree++; } /** * Tell if the table contains the given string. * * @param key String to look for * * @return The String's int value * */ public final int get(String key) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equals(key)) return m_values[i]; } return INVALID_KEY; } /** * Tell if the table contains the given string. Ignore case. * * @param key String to look for * * @return The string's int value */ public final int getIgnoreCase(String key) { if (null == key) return INVALID_KEY; for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equalsIgnoreCase(key)) return m_values[i]; } return INVALID_KEY; } /** * Tell if the table contains the given string. * * @param key String to look for * * @return True if the string is in the table */ public final boolean contains(String key) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equals(key)) return true; } return false; } /** * Return array of keys in the table. * * @return Array of strings */ public final String[] keys() { String [] keysArr = new String[m_firstFree]; for (int i = 0; i < m_firstFree; i++) { keysArr[i] = m_map[i]; } return keysArr; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/NameSpace.java0000644000175000017500000000351210721374030022534 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NameSpace.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.Serializable; /** * A representation of a namespace. One of these will * be pushed on the namespace stack for each * element. * @xsl.usage advanced */ public class NameSpace implements Serializable { static final long serialVersionUID = 1471232939184881839L; /** Next NameSpace element on the stack. * @serial */ public NameSpace m_next = null; /** Prefix of this NameSpace element. * @serial */ public String m_prefix; /** Namespace URI of this NameSpace element. * @serial */ public String m_uri; // if null, then Element namespace is empty. /** * Construct a namespace for placement on the * result tree namespace stack. * * @param prefix Prefix of this element * @param uri URI of this element */ public NameSpace(String prefix, String uri) { m_prefix = prefix; m_uri = uri; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/StringComparable.java0000644000175000017500000002033410721374033024140 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringComparable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.Vector; import java.text.Collator; import java.text.RuleBasedCollator; import java.text.CollationElementIterator; import java.util.Locale; import java.text.CollationKey; /** * International friendly string comparison with case-order * @author Igor Hersht, igorh@ca.ibm.com */ public class StringComparable implements Comparable { public final static int UNKNOWN_CASE = -1; public final static int UPPER_CASE = 1; public final static int LOWER_CASE = 2; private String m_text; private Locale m_locale; private RuleBasedCollator m_collator; private String m_caseOrder; private int m_mask = 0xFFFFFFFF; public StringComparable(final String text, final Locale locale, final Collator collator, final String caseOrder){ m_text = text; m_locale = locale; m_collator = (RuleBasedCollator)collator; m_caseOrder = caseOrder; m_mask = getMask(m_collator.getStrength()); } public final static Comparable getComparator( final String text, final Locale locale, final Collator collator, final String caseOrder){ if((caseOrder == null) ||(caseOrder.length() == 0)){// no case-order specified return ((RuleBasedCollator)collator).getCollationKey(text); }else{ return new StringComparable(text, locale, collator, caseOrder); } } public final String toString(){return m_text;} public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } } private final int getCaseDiff (final String text, final String pattern){ final int savedStrength = m_collator.getStrength(); final int savedDecomposition = m_collator.getDecomposition(); m_collator.setStrength(Collator.TERTIARY);// not to ignore case m_collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION );// corresponds NDF final int diff[] =getFirstCaseDiff (text, pattern, m_locale); m_collator.setStrength(savedStrength);// restore m_collator.setDecomposition(savedDecomposition); //restore if(diff != null){ if((m_caseOrder).equals("upper-first")){ if(diff[0] == UPPER_CASE){ return -1; }else{ return 1; } }else{// lower-first if(diff[0] == LOWER_CASE){ return -1; }else{ return 1; } } }else{// No case differences return 0; } } private final int[] getFirstCaseDiff(final String text, final String pattern, final Locale locale){ final CollationElementIterator targIter = m_collator.getCollationElementIterator(text); final CollationElementIterator patIter = m_collator.getCollationElementIterator(pattern); int startTarg = -1; int endTarg = -1; int startPatt = -1; int endPatt = -1; final int done = getElement(CollationElementIterator.NULLORDER); int patternElement = 0, targetElement = 0; boolean getPattern = true, getTarget = true; while (true) { if (getPattern){ startPatt = patIter.getOffset(); patternElement = getElement(patIter.next()); endPatt = patIter.getOffset(); } if ((getTarget)){ startTarg = targIter.getOffset(); targetElement = getElement(targIter.next()); endTarg = targIter.getOffset(); } getTarget = getPattern = true; if ((patternElement == done) ||( targetElement == done)) { return null; } else if (targetElement == 0) { getPattern = false; } else if (patternElement == 0) { getTarget = false; } else if (targetElement != patternElement) {// mismatch if((startPatt < endPatt) && (startTarg < endTarg)){ final String subText = text.substring(startTarg, endTarg); final String subPatt = pattern.substring(startPatt, endPatt); final String subTextUp = subText.toUpperCase(locale); final String subPattUp = subPatt.toUpperCase(locale); if(m_collator.compare(subTextUp, subPattUp) != 0){ // not case diffference continue; } int diff[] = {UNKNOWN_CASE, UNKNOWN_CASE}; if(m_collator.compare(subText, subTextUp) == 0){ diff[0] = UPPER_CASE; }else if(m_collator.compare(subText, subText.toLowerCase(locale)) == 0){ diff[0] = LOWER_CASE; } if(m_collator.compare(subPatt, subPattUp) == 0){ diff[1] = UPPER_CASE; }else if(m_collator.compare(subPatt, subPatt.toLowerCase(locale)) == 0){ diff[1] = LOWER_CASE; } if(((diff[0] == UPPER_CASE) && ( diff[1] == LOWER_CASE)) || ((diff[0] == LOWER_CASE) && ( diff[1] == UPPER_CASE))){ return diff; }else{// not case diff continue; } }else{ continue; } } } } // Return a mask for the part of the order we're interested in private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } } //get collation element with given strength // from the element with max strength private final int getElement(int maxStrengthElement){ return (maxStrengthElement & m_mask); } }//StringComparable libxalan2-java-2.7.1/src/org/apache/xml/utils/SecuritySupport12.java0000644000175000017500000001165610721374031024260 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.utils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/WrongParserException.java0000644000175000017500000000257610721374030025041 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WrongParserException.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * Certain functions may throw this error if they are paired with * the incorrect parser. * @xsl.usage general */ public class WrongParserException extends RuntimeException { static final long serialVersionUID = 6481643018533043846L; /** * Create a WrongParserException object. * @param message The error message that should be reported to the user. */ public WrongParserException(String message) { super(message); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/DefaultErrorHandler.java0000644000175000017500000003100210721374030024567 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DefaultErrorHandler.java 524806 2007-04-02 15:51:39Z zongaro $ */ package org.apache.xml.utils; import java.io.PrintStream; import java.io.PrintWriter; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * Implement SAX error handler for default reporting. * @xsl.usage general */ public class DefaultErrorHandler implements ErrorHandler, ErrorListener { PrintWriter m_pw; /** * if this flag is set to true, we will rethrow the exception on * the error() and fatalError() methods. If it is false, the errors * are reported to System.err. */ boolean m_throwExceptionOnError = true; /** * Constructor DefaultErrorHandler */ public DefaultErrorHandler(PrintWriter pw) { m_pw = pw; } /** * Constructor DefaultErrorHandler */ public DefaultErrorHandler(PrintStream pw) { m_pw = new PrintWriter(pw, true); } /** * Constructor DefaultErrorHandler */ public DefaultErrorHandler() { this(true); } /** * Constructor DefaultErrorHandler */ public DefaultErrorHandler(boolean throwExceptionOnError) { // Defer creation of a PrintWriter until it's actually needed m_throwExceptionOnError = throwExceptionOnError; } /** * Retrieve java.io.PrintWriter to which errors are being * directed. * @return The PrintWriter installed via the constructor * or the default PrintWriter */ public PrintWriter getErrorWriter() { // Defer creating the java.io.PrintWriter until an error needs to be // reported. if (m_pw == null) { m_pw = new PrintWriter(System.err, true); } return m_pw; } /** * Receive notification of a warning. * *

    SAX parsers will use this method to report conditions that * are not errors or fatal errors as defined by the XML 1.0 * recommendation. The default behaviour is to take no action.

    * *

    The SAX parser must continue to provide normal parsing events * after invoking this method: it should still be possible for the * application to process the document through to the end.

    * * @param exception The warning information encapsulated in a * SAX parse exception. * @throws SAXException Any SAX exception, possibly * wrapping another exception. */ public void warning(SAXParseException exception) throws SAXException { PrintWriter pw = getErrorWriter(); printLocation(pw, exception); pw.println("Parser warning: " + exception.getMessage()); } /** * Receive notification of a recoverable error. * *

    This corresponds to the definition of "error" in section 1.2 * of the W3C XML 1.0 Recommendation. For example, a validating * parser would use this callback to report the violation of a * validity constraint. The default behaviour is to take no * action.

    * *

    The SAX parser must continue to provide normal parsing events * after invoking this method: it should still be possible for the * application to process the document through to the end. If the * application cannot do so, then the parser should report a fatal * error even if the XML 1.0 recommendation does not require it to * do so.

    * * @param exception The error information encapsulated in a * SAX parse exception. * @throws SAXException Any SAX exception, possibly * wrapping another exception. */ public void error(SAXParseException exception) throws SAXException { //printLocation(exception); // getErrorWriter().println(exception.getMessage()); throw exception; } /** * Receive notification of a non-recoverable error. * *

    This corresponds to the definition of "fatal error" in * section 1.2 of the W3C XML 1.0 Recommendation. For example, a * parser would use this callback to report the violation of a * well-formedness constraint.

    * *

    The application must assume that the document is unusable * after the parser has invoked this method, and should continue * (if at all) only for the sake of collecting addition error * messages: in fact, SAX parsers are free to stop reporting any * other events once this method has been invoked.

    * * @param exception The error information encapsulated in a * SAX parse exception. * @throws SAXException Any SAX exception, possibly * wrapping another exception. */ public void fatalError(SAXParseException exception) throws SAXException { // printLocation(exception); // getErrorWriter().println(exception.getMessage()); throw exception; } /** * Receive notification of a warning. * *

    SAX parsers will use this method to report conditions that * are not errors or fatal errors as defined by the XML 1.0 * recommendation. The default behaviour is to take no action.

    * *

    The SAX parser must continue to provide normal parsing events * after invoking this method: it should still be possible for the * application to process the document through to the end.

    * * @param exception The warning information encapsulated in a * SAX parse exception. * @throws javax.xml.transform.TransformerException Any SAX exception, possibly * wrapping another exception. * @see javax.xml.transform.TransformerException */ public void warning(TransformerException exception) throws TransformerException { PrintWriter pw = getErrorWriter(); printLocation(pw, exception); pw.println(exception.getMessage()); } /** * Receive notification of a recoverable error. * *

    This corresponds to the definition of "error" in section 1.2 * of the W3C XML 1.0 Recommendation. For example, a validating * parser would use this callback to report the violation of a * validity constraint. The default behaviour is to take no * action.

    * *

    The SAX parser must continue to provide normal parsing events * after invoking this method: it should still be possible for the * application to process the document through to the end. If the * application cannot do so, then the parser should report a fatal * error even if the XML 1.0 recommendation does not require it to * do so.

    * * @param exception The error information encapsulated in a * SAX parse exception. * @throws javax.xml.transform.TransformerException Any SAX exception, possibly * wrapping another exception. * @see javax.xml.transform.TransformerException */ public void error(TransformerException exception) throws TransformerException { // If the m_throwExceptionOnError flag is true, rethrow the exception. // Otherwise report the error to System.err. if (m_throwExceptionOnError) throw exception; else { PrintWriter pw = getErrorWriter(); printLocation(pw, exception); pw.println(exception.getMessage()); } } /** * Receive notification of a non-recoverable error. * *

    This corresponds to the definition of "fatal error" in * section 1.2 of the W3C XML 1.0 Recommendation. For example, a * parser would use this callback to report the violation of a * well-formedness constraint.

    * *

    The application must assume that the document is unusable * after the parser has invoked this method, and should continue * (if at all) only for the sake of collecting addition error * messages: in fact, SAX parsers are free to stop reporting any * other events once this method has been invoked.

    * * @param exception The error information encapsulated in a * SAX parse exception. * @throws javax.xml.transform.TransformerException Any SAX exception, possibly * wrapping another exception. * @see javax.xml.transform.TransformerException */ public void fatalError(TransformerException exception) throws TransformerException { // If the m_throwExceptionOnError flag is true, rethrow the exception. // Otherwise report the error to System.err. if (m_throwExceptionOnError) throw exception; else { PrintWriter pw = getErrorWriter(); printLocation(pw, exception); pw.println(exception.getMessage()); } } public static void ensureLocationSet(TransformerException exception) { // SourceLocator locator = exception.getLocator(); SourceLocator locator = null; Throwable cause = exception; // Try to find the locator closest to the cause. do { if(cause instanceof SAXParseException) { locator = new SAXSourceLocator((SAXParseException)cause); } else if (cause instanceof TransformerException) { SourceLocator causeLocator = ((TransformerException)cause).getLocator(); if(null != causeLocator) locator = causeLocator; } if(cause instanceof TransformerException) cause = ((TransformerException)cause).getCause(); else if(cause instanceof SAXException) cause = ((SAXException)cause).getException(); else cause = null; } while(null != cause); exception.setLocator(locator); } public static void printLocation(PrintStream pw, TransformerException exception) { printLocation(new PrintWriter(pw), exception); } public static void printLocation(java.io.PrintStream pw, org.xml.sax.SAXParseException exception) { printLocation(new PrintWriter(pw), exception); } public static void printLocation(PrintWriter pw, Throwable exception) { SourceLocator locator = null; Throwable cause = exception; // Try to find the locator closest to the cause. do { if(cause instanceof SAXParseException) { locator = new SAXSourceLocator((SAXParseException)cause); } else if (cause instanceof TransformerException) { SourceLocator causeLocator = ((TransformerException)cause).getLocator(); if(null != causeLocator) locator = causeLocator; } if(cause instanceof TransformerException) cause = ((TransformerException)cause).getCause(); else if(cause instanceof WrappedRuntimeException) cause = ((WrappedRuntimeException)cause).getException(); else if(cause instanceof SAXException) cause = ((SAXException)cause).getException(); else cause = null; } while(null != cause); if(null != locator) { // getErrorWriter().println("Parser fatal error: "+exception.getMessage()); String id = (null != locator.getPublicId() ) ? locator.getPublicId() : (null != locator.getSystemId()) ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown"; pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber() + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; "); } else pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")"); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/XML11Char.java0000644000175000017500000004070710721374033022312 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xml.utils; import java.util.Arrays; /** * THIS IS A COPY OF THE XERCES-2J CLASS org.apache.xerces.utls.XMLChar * * This class defines the basic properties of characters in XML 1.1. The data * in this class can be used to verify that a character is a valid * XML 1.1 character or if the character is a space, name start, or name * character. *

    * A series of convenience methods are supplied to ease the burden * of the developer. Using the character as an index into the XML11CHARS * array and applying the appropriate mask flag (e.g. * MASK_VALID), yields the same results as calling the * convenience methods. There is one exception: check the comments * for the isValid method for details. * * @version $Id: XML11Char.java 468655 2006-10-28 07:12:06Z minchau $ */ public class XML11Char { // // Constants // /** Character flags for XML 1.1. */ private static final byte XML11CHARS [] = new byte [1 << 16]; /** XML 1.1 Valid character mask. */ public static final int MASK_XML11_VALID = 0x01; /** XML 1.1 Space character mask. */ public static final int MASK_XML11_SPACE = 0x02; /** XML 1.1 Name start character mask. */ public static final int MASK_XML11_NAME_START = 0x04; /** XML 1.1 Name character mask. */ public static final int MASK_XML11_NAME = 0x08; /** XML 1.1 control character mask */ public static final int MASK_XML11_CONTROL = 0x10; /** XML 1.1 content for external entities (valid - "special" chars - control chars) */ public static final int MASK_XML11_CONTENT = 0x20; /** XML namespaces 1.1 NCNameStart */ public static final int MASK_XML11_NCNAME_START = 0x40; /** XML namespaces 1.1 NCName */ public static final int MASK_XML11_NCNAME = 0x80; /** XML 1.1 content for internal entities (valid - "special" chars) */ public static final int MASK_XML11_CONTENT_INTERNAL = MASK_XML11_CONTROL | MASK_XML11_CONTENT; // // Static initialization // static { // Initializing the Character Flag Array // Code generated by: XML11CharGenerator. Arrays.fill(XML11CHARS, 1, 9, (byte) 17 ); // Fill 8 of value (byte) 17 XML11CHARS[9] = 35; XML11CHARS[10] = 3; Arrays.fill(XML11CHARS, 11, 13, (byte) 17 ); // Fill 2 of value (byte) 17 XML11CHARS[13] = 3; Arrays.fill(XML11CHARS, 14, 32, (byte) 17 ); // Fill 18 of value (byte) 17 XML11CHARS[32] = 35; Arrays.fill(XML11CHARS, 33, 38, (byte) 33 ); // Fill 5 of value (byte) 33 XML11CHARS[38] = 1; Arrays.fill(XML11CHARS, 39, 45, (byte) 33 ); // Fill 6 of value (byte) 33 Arrays.fill(XML11CHARS, 45, 47, (byte) -87 ); // Fill 2 of value (byte) -87 XML11CHARS[47] = 33; Arrays.fill(XML11CHARS, 48, 58, (byte) -87 ); // Fill 10 of value (byte) -87 XML11CHARS[58] = 45; XML11CHARS[59] = 33; XML11CHARS[60] = 1; Arrays.fill(XML11CHARS, 61, 65, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(XML11CHARS, 65, 91, (byte) -19 ); // Fill 26 of value (byte) -19 Arrays.fill(XML11CHARS, 91, 93, (byte) 33 ); // Fill 2 of value (byte) 33 XML11CHARS[93] = 1; XML11CHARS[94] = 33; XML11CHARS[95] = -19; XML11CHARS[96] = 33; Arrays.fill(XML11CHARS, 97, 123, (byte) -19 ); // Fill 26 of value (byte) -19 Arrays.fill(XML11CHARS, 123, 127, (byte) 33 ); // Fill 4 of value (byte) 33 Arrays.fill(XML11CHARS, 127, 133, (byte) 17 ); // Fill 6 of value (byte) 17 XML11CHARS[133] = 35; Arrays.fill(XML11CHARS, 134, 160, (byte) 17 ); // Fill 26 of value (byte) 17 Arrays.fill(XML11CHARS, 160, 183, (byte) 33 ); // Fill 23 of value (byte) 33 XML11CHARS[183] = -87; Arrays.fill(XML11CHARS, 184, 192, (byte) 33 ); // Fill 8 of value (byte) 33 Arrays.fill(XML11CHARS, 192, 215, (byte) -19 ); // Fill 23 of value (byte) -19 XML11CHARS[215] = 33; Arrays.fill(XML11CHARS, 216, 247, (byte) -19 ); // Fill 31 of value (byte) -19 XML11CHARS[247] = 33; Arrays.fill(XML11CHARS, 248, 768, (byte) -19 ); // Fill 520 of value (byte) -19 Arrays.fill(XML11CHARS, 768, 880, (byte) -87 ); // Fill 112 of value (byte) -87 Arrays.fill(XML11CHARS, 880, 894, (byte) -19 ); // Fill 14 of value (byte) -19 XML11CHARS[894] = 33; Arrays.fill(XML11CHARS, 895, 8192, (byte) -19 ); // Fill 7297 of value (byte) -19 Arrays.fill(XML11CHARS, 8192, 8204, (byte) 33 ); // Fill 12 of value (byte) 33 Arrays.fill(XML11CHARS, 8204, 8206, (byte) -19 ); // Fill 2 of value (byte) -19 Arrays.fill(XML11CHARS, 8206, 8232, (byte) 33 ); // Fill 26 of value (byte) 33 XML11CHARS[8232] = 35; Arrays.fill(XML11CHARS, 8233, 8255, (byte) 33 ); // Fill 22 of value (byte) 33 Arrays.fill(XML11CHARS, 8255, 8257, (byte) -87 ); // Fill 2 of value (byte) -87 Arrays.fill(XML11CHARS, 8257, 8304, (byte) 33 ); // Fill 47 of value (byte) 33 Arrays.fill(XML11CHARS, 8304, 8592, (byte) -19 ); // Fill 288 of value (byte) -19 Arrays.fill(XML11CHARS, 8592, 11264, (byte) 33 ); // Fill 2672 of value (byte) 33 Arrays.fill(XML11CHARS, 11264, 12272, (byte) -19 ); // Fill 1008 of value (byte) -19 Arrays.fill(XML11CHARS, 12272, 12289, (byte) 33 ); // Fill 17 of value (byte) 33 Arrays.fill(XML11CHARS, 12289, 55296, (byte) -19 ); // Fill 43007 of value (byte) -19 Arrays.fill(XML11CHARS, 57344, 63744, (byte) 33 ); // Fill 6400 of value (byte) 33 Arrays.fill(XML11CHARS, 63744, 64976, (byte) -19 ); // Fill 1232 of value (byte) -19 Arrays.fill(XML11CHARS, 64976, 65008, (byte) 33 ); // Fill 32 of value (byte) 33 Arrays.fill(XML11CHARS, 65008, 65534, (byte) -19 ); // Fill 526 of value (byte) -19 } // () // // Public static methods // /** * Returns true if the specified character is a space character * as amdended in the XML 1.1 specification. * * @param c The character to check. */ public static boolean isXML11Space(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_SPACE) != 0); } // isXML11Space(int):boolean /** * Returns true if the specified character is valid. This method * also checks the surrogate character range from 0x10000 to 0x10FFFF. *

    * If the program chooses to apply the mask directly to the * XML11CHARS array, then they are responsible for checking * the surrogate character range. * * @param c The character to check. */ public static boolean isXML11Valid(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_VALID) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11Valid(int):boolean /** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isXML11Invalid(int c) { return !isXML11Valid(c); } // isXML11Invalid(int):boolean /** * Returns true if the specified character is valid and permitted outside * of a character reference. * That is, this method will return false for the same set as * isXML11Valid, except it also reports false for "control characters". * * @param c The character to check. */ public static boolean isXML11ValidLiteral(int c) { return ((c < 0x10000 && ((XML11CHARS[c] & MASK_XML11_VALID) != 0 && (XML11CHARS[c] & MASK_XML11_CONTROL) == 0)) || (0x10000 <= c && c <= 0x10FFFF)); } // isXML11ValidLiteral(int):boolean /** * Returns true if the specified character can be considered * content in an external parsed entity. * * @param c The character to check. */ public static boolean isXML11Content(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_CONTENT) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11Content(int):boolean /** * Returns true if the specified character can be considered * content in an internal parsed entity. * * @param c The character to check. */ public static boolean isXML11InternalEntityContent(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_CONTENT_INTERNAL) != 0) || (0x10000 <= c && c <= 0x10FFFF); } // isXML11InternalEntityContent(int):boolean /** * Returns true if the specified character is a valid name start * character as defined by production [4] in the XML 1.1 * specification. * * @param c The character to check. */ public static boolean isXML11NameStart(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME_START) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NameStart(int):boolean /** * Returns true if the specified character is a valid name * character as defined by production [4a] in the XML 1.1 * specification. * * @param c The character to check. */ public static boolean isXML11Name(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NAME) != 0) || (c >= 0x10000 && c < 0xF0000); } // isXML11Name(int):boolean /** * Returns true if the specified character is a valid NCName start * character as defined by production [4] in Namespaces in XML * 1.1 recommendation. * * @param c The character to check. */ public static boolean isXML11NCNameStart(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NCNAME_START) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NCNameStart(int):boolean /** * Returns true if the specified character is a valid NCName * character as defined by production [5] in Namespaces in XML * 1.1 recommendation. * * @param c The character to check. */ public static boolean isXML11NCName(int c) { return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_NCNAME) != 0) || (0x10000 <= c && c < 0xF0000); } // isXML11NCName(int):boolean /** * Returns whether the given character is a valid * high surrogate for a name character. This includes * all high surrogates for characters [0x10000-0xEFFFF]. * In other words everything excluding planes 15 and 16. * * @param c The character to check. */ public static boolean isXML11NameHighSurrogate(int c) { return (0xD800 <= c && c <= 0xDB7F); } /* * [5] Name ::= NameStartChar NameChar* */ /** * Check to see if a string is a valid Name according to [5] * in the XML 1.1 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isXML11ValidName(String name) { int length = name.length(); if (length == 0) return false; int i = 1; char ch = name.charAt(0); if( !isXML11NameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = name.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = name.charAt(i); if ( !isXML11Name(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = name.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } // isXML11ValidName(String):boolean /* * from the namespace 1.1 rec * [4] NCName ::= NCNameStartChar NCNameChar* */ /** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.1 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isXML11ValidNCName(String ncName) { int length = ncName.length(); if (length == 0) return false; int i = 1; char ch = ncName.charAt(0); if( !isXML11NCNameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = ncName.charAt(i); if ( !isXML11NCName(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } // isXML11ValidNCName(String):boolean /* * [7] Nmtoken ::= (NameChar)+ */ /** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.1 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isXML11ValidNmtoken(String nmtoken) { int length = nmtoken.length(); if (length == 0) return false; for (int i = 0; i < length; ++i ) { char ch = nmtoken.charAt(i); if( !isXML11Name(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = nmtoken.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } } return true; } // isXML11ValidName(String):boolean /** * Simple check to determine if qname is legal. If it returns false * then str is illegal; if it returns true then * str is legal. */ public static boolean isXML11ValidQName(String str) { final int colon = str.indexOf(':'); if (colon == 0 || colon == str.length() - 1) { return false; } if (colon > 0) { final String prefix = str.substring(0,colon); final String localPart = str.substring(colon+1); return isXML11ValidNCName(prefix) && isXML11ValidNCName(localPart); } else { return isXML11ValidNCName(str); } } } // class XML11Char libxalan2-java-2.7.1/src/org/apache/xml/utils/NodeConsumer.java0000644000175000017500000000256210721374032023307 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeConsumer.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import org.w3c.dom.Node; /** * The tree walker will test for this interface, and call * setOriginatingNode before calling the SAX event. For creating * DOM backpointers for things that are normally created via * SAX events. */ public interface NodeConsumer { /** * Set the node that is originating the SAX event. * * @param n Reference to node that originated the current event. */ public void setOriginatingNode(Node n); } libxalan2-java-2.7.1/src/org/apache/xml/utils/SAXSourceLocator.java0000644000175000017500000001256610721374030024051 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAXSourceLocator.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.Serializable; import javax.xml.transform.SourceLocator; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.LocatorImpl; /** * Class SAXSourceLocator extends org.xml.sax.helpers.LocatorImpl * for the purpose of implementing the SourceLocator interface, * and thus can be both a SourceLocator and a SAX Locator. */ public class SAXSourceLocator extends LocatorImpl implements SourceLocator, Serializable { static final long serialVersionUID = 3181680946321164112L; /** The SAX Locator object. * @serial */ Locator m_locator; /** * Constructor SAXSourceLocator * */ public SAXSourceLocator(){} /** * Constructor SAXSourceLocator * * * @param locator Source locator */ public SAXSourceLocator(Locator locator) { m_locator = locator; this.setColumnNumber(locator.getColumnNumber()); this.setLineNumber(locator.getLineNumber()); this.setPublicId(locator.getPublicId()); this.setSystemId(locator.getSystemId()); } /** * Constructor SAXSourceLocator * * * @param locator Source locator */ public SAXSourceLocator(javax.xml.transform.SourceLocator locator) { m_locator = null; this.setColumnNumber(locator.getColumnNumber()); this.setLineNumber(locator.getLineNumber()); this.setPublicId(locator.getPublicId()); this.setSystemId(locator.getSystemId()); } /** * Constructor SAXSourceLocator * * * @param spe SAXParseException exception. */ public SAXSourceLocator(SAXParseException spe) { this.setLineNumber( spe.getLineNumber() ); this.setColumnNumber( spe.getColumnNumber() ); this.setPublicId( spe.getPublicId() ); this.setSystemId( spe.getSystemId() ); } /** * Return the public identifier for the current document event. * *

    The return value is the public identifier of the document * entity or of the external parsed entity in which the markup * triggering the event appears.

    * * @return A string containing the public identifier, or * null if none is available. * @see #getSystemId */ public String getPublicId() { return (null == m_locator) ? super.getPublicId() : m_locator.getPublicId(); } /** * Return the system identifier for the current document event. * *

    The return value is the system identifier of the document * entity or of the external parsed entity in which the markup * triggering the event appears.

    * *

    If the system identifier is a URL, the parser must resolve it * fully before passing it to the application.

    * * @return A string containing the system identifier, or null * if none is available. * @see #getPublicId */ public String getSystemId() { return (null == m_locator) ? super.getSystemId() : m_locator.getSystemId(); } /** * Return the line number where the current document event ends. * *

    Warning: The return value from the method * is intended only as an approximation for the sake of error * reporting; it is not intended to provide sufficient information * to edit the character content of the original XML document.

    * *

    The return value is an approximation of the line number * in the document entity or external parsed entity where the * markup triggering the event appears.

    * * @return The line number, or -1 if none is available. * @see #getColumnNumber */ public int getLineNumber() { return (null == m_locator) ? super.getLineNumber() : m_locator.getLineNumber(); } /** * Return the column number where the current document event ends. * *

    Warning: The return value from the method * is intended only as an approximation for the sake of error * reporting; it is not intended to provide sufficient information * to edit the character content of the original XML document.

    * *

    The return value is an approximation of the column number * in the document entity or external parsed entity where the * markup triggering the event appears.

    * * @return The column number, or -1 if none is available. * @see #getLineNumber */ public int getColumnNumber() { return (null == m_locator) ? super.getColumnNumber() : m_locator.getColumnNumber(); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/XMLStringFactoryDefault.java0000644000175000017500000000537110721374032025373 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLStringFactoryDefault.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * The default implementation of XMLStringFactory. * This implementation creates XMLStringDefault objects. */ public class XMLStringFactoryDefault extends XMLStringFactory { // A constant representing the empty String private static final XMLStringDefault EMPTY_STR = new XMLStringDefault(""); /** * Create a new XMLString from a Java string. * * * @param string Java String reference, which must be non-null. * * @return An XMLString object that wraps the String reference. */ public XMLString newstr(String string) { return new XMLStringDefault(string); } /** * Create a XMLString from a FastStringBuffer. * * * @param fsb FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public XMLString newstr(FastStringBuffer fsb, int start, int length) { return new XMLStringDefault(fsb.getString(start, length)); } /** * Create a XMLString from a FastStringBuffer. * * * @param string FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public XMLString newstr(char[] string, int start, int length) { return new XMLStringDefault(new String(string, start, length)); } /** * Get a cheap representation of an empty string. * * @return An non-null reference to an XMLString that represents "". */ public XMLString emptystr() { return EMPTY_STR; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/WrappedRuntimeException.java0000644000175000017500000000400110721374033025522 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WrappedRuntimeException.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * This class is for throwing important checked exceptions * over non-checked methods. It should be used with care, * and in limited circumstances. */ public class WrappedRuntimeException extends RuntimeException { static final long serialVersionUID = 7140414456714658073L; /** Primary checked exception. * @serial */ private Exception m_exception; /** * Construct a WrappedRuntimeException from a * checked exception. * * @param e Primary checked exception */ public WrappedRuntimeException(Exception e) { super(e.getMessage()); m_exception = e; } /** * Constructor WrappedRuntimeException * * * @param msg Exception information. * @param e Primary checked exception */ public WrappedRuntimeException(String msg, Exception e) { super(msg); m_exception = e; } /** * Get the checked exception that this runtime exception wraps. * * @return The primary checked exception */ public Exception getException() { return m_exception; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/RawCharacterHandler.java0000644000175000017500000000300410721374030024540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RawCharacterHandler.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * An interface that a Serializer/ContentHandler/ContentHandler must * implement in order for disable-output-escaping to work. * @xsl.usage advanced */ public interface RawCharacterHandler { /** * Serialize the characters without escaping. * * @param ch Array of characters * @param start Start index of characters in the array * @param length Number of characters in the array * * @throws javax.xml.transform.TransformerException */ public void charactersRaw(char ch[], int start, int length) throws javax.xml.transform.TransformerException; } libxalan2-java-2.7.1/src/org/apache/xml/utils/URI.java0000644000175000017500000013745310721374032021355 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: URI.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.IOException; import java.io.Serializable; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; /** * A class to represent a Uniform Resource Identifier (URI). This class * is designed to handle the parsing of URIs and provide access to * the various components (scheme, host, port, userinfo, path, query * string and fragment) that may constitute a URI. *

    * Parsing of a URI specification is done according to the URI * syntax described in RFC 2396 * . Every URI consists * of a scheme, followed by a colon (':'), followed by a scheme-specific * part. For URIs that follow the "generic URI" syntax, the scheme- * specific part begins with two slashes ("//") and may be followed * by an authority segment (comprised of user information, host, and * port), path segment, query segment and fragment. Note that RFC 2396 * no longer specifies the use of the parameters segment and excludes * the "user:password" syntax as part of the authority segment. If * "user:password" appears in a URI, the entire user/password string * is stored as userinfo. *

    * For URIs that do not follow the "generic URI" syntax (e.g. mailto), * the entire scheme-specific part is treated as the "path" portion * of the URI. *

    * Note that, unlike the java.net.URL class, this class does not provide * any built-in network access functionality nor does it provide any * scheme-specific functionality (for example, it does not know a * default port for a specific scheme). Rather, it only knows the * grammar and basic set of operations that can be applied to a URI. * * */ public class URI implements Serializable { static final long serialVersionUID = 7096266377907081897L; /** * MalformedURIExceptions are thrown in the process of building a URI * or setting fields on a URI when an operation would result in an * invalid URI specification. * */ public static class MalformedURIException extends IOException { /** * Constructs a MalformedURIException with no specified * detail message. */ public MalformedURIException() { super(); } /** * Constructs a MalformedURIException with the * specified detail message. * * @param p_msg the detail message. */ public MalformedURIException(String p_msg) { super(p_msg); } } /** reserved characters */ private static final String RESERVED_CHARACTERS = ";/?:@&=+$,"; /** * URI punctuation mark characters - these, combined with * alphanumerics, constitute the "unreserved" characters */ private static final String MARK_CHARACTERS = "-_.!~*'() "; /** scheme can be composed of alphanumerics and these characters */ private static final String SCHEME_CHARACTERS = "+-."; /** * userinfo can be composed of unreserved, escaped and these * characters */ private static final String USERINFO_CHARACTERS = ";:&=+$,"; /** Stores the scheme (usually the protocol) for this URI. * @serial */ private String m_scheme = null; /** If specified, stores the userinfo for this URI; otherwise null. * @serial */ private String m_userinfo = null; /** If specified, stores the host for this URI; otherwise null. * @serial */ private String m_host = null; /** If specified, stores the port for this URI; otherwise -1. * @serial */ private int m_port = -1; /** If specified, stores the path for this URI; otherwise null. * @serial */ private String m_path = null; /** * If specified, stores the query string for this URI; otherwise * null. * @serial */ private String m_queryString = null; /** If specified, stores the fragment for this URI; otherwise null. * @serial */ private String m_fragment = null; /** Indicate whether in DEBUG mode */ private static boolean DEBUG = false; /** * Construct a new and uninitialized URI. */ public URI(){} /** * Construct a new URI from another URI. All fields for this URI are * set equal to the fields of the URI passed in. * * @param p_other the URI to copy (cannot be null) */ public URI(URI p_other) { initialize(p_other); } /** * Construct a new URI from a URI specification string. If the * specification follows the "generic URI" syntax, (two slashes * following the first colon), the specification will be parsed * accordingly - setting the scheme, userinfo, host,port, path, query * string and fragment fields as necessary. If the specification does * not follow the "generic URI" syntax, the specification is parsed * into a scheme and scheme-specific part (stored as the path) only. * * @param p_uriSpec the URI specification string (cannot be null or * empty) * * @throws MalformedURIException if p_uriSpec violates any syntax * rules */ public URI(String p_uriSpec) throws MalformedURIException { this((URI) null, p_uriSpec); } /** * Construct a new URI from a base URI and a URI specification string. * The URI specification string may be a relative URI. * * @param p_base the base URI (cannot be null if p_uriSpec is null or * empty) * @param p_uriSpec the URI specification string (cannot be null or * empty if p_base is null) * * @throws MalformedURIException if p_uriSpec violates any syntax * rules */ public URI(URI p_base, String p_uriSpec) throws MalformedURIException { initialize(p_base, p_uriSpec); } /** * Construct a new URI that does not follow the generic URI syntax. * Only the scheme and scheme-specific part (stored as the path) are * initialized. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_schemeSpecificPart the scheme-specific part (cannot be * null or empty) * * @throws MalformedURIException if p_scheme violates any * syntax rules */ public URI(String p_scheme, String p_schemeSpecificPart) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException( "Cannot construct URI with null/empty scheme!"); } if (p_schemeSpecificPart == null || p_schemeSpecificPart.trim().length() == 0) { throw new MalformedURIException( "Cannot construct URI with null/empty scheme-specific part!"); } setScheme(p_scheme); setPath(p_schemeSpecificPart); } /** * Construct a new URI that follows the generic URI syntax from its * component parts. Each component is validated for syntax and some * basic semantic checks are performed as well. See the individual * setter methods for specifics. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_host the hostname or IPv4 address for the URI * @param p_path the URI path - if the path contains '?' or '#', * then the query string and/or fragment will be * set from the path; however, if the query and * fragment are specified both in the path and as * separate parameters, an exception is thrown * @param p_queryString the URI query string (cannot be specified * if path is null) * @param p_fragment the URI fragment (cannot be specified if path * is null) * * @throws MalformedURIException if any of the parameters violates * syntax rules or semantic rules */ public URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment) throws MalformedURIException { this(p_scheme, null, p_host, -1, p_path, p_queryString, p_fragment); } /** * Construct a new URI that follows the generic URI syntax from its * component parts. Each component is validated for syntax and some * basic semantic checks are performed as well. See the individual * setter methods for specifics. * * @param p_scheme the URI scheme (cannot be null or empty) * @param p_userinfo the URI userinfo (cannot be specified if host * is null) * @param p_host the hostname or IPv4 address for the URI * @param p_port the URI port (may be -1 for "unspecified"; cannot * be specified if host is null) * @param p_path the URI path - if the path contains '?' or '#', * then the query string and/or fragment will be * set from the path; however, if the query and * fragment are specified both in the path and as * separate parameters, an exception is thrown * @param p_queryString the URI query string (cannot be specified * if path is null) * @param p_fragment the URI fragment (cannot be specified if path * is null) * * @throws MalformedURIException if any of the parameters violates * syntax rules or semantic rules */ public URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_REQUIRED, null)); //"Scheme is required!"); } if (p_host == null) { if (p_userinfo != null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_USERINFO_IF_NO_HOST, null)); //"Userinfo may not be specified if host is not specified!"); } if (p_port != -1) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_PORT_IF_NO_HOST, null)); //"Port may not be specified if host is not specified!"); } } if (p_path != null) { if (p_path.indexOf('?') != -1 && p_queryString != null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_QUERY_STRING_IN_PATH, null)); //"Query string cannot be specified in path and query string!"); } if (p_path.indexOf('#') != -1 && p_fragment != null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_FRAGMENT_STRING_IN_PATH, null)); //"Fragment cannot be specified in both the path and fragment!"); } } setScheme(p_scheme); setHost(p_host); setPort(p_port); setUserinfo(p_userinfo); setPath(p_path); setQueryString(p_queryString); setFragment(p_fragment); } /** * Initialize all fields of this URI from another URI. * * @param p_other the URI to copy (cannot be null) */ private void initialize(URI p_other) { m_scheme = p_other.getScheme(); m_userinfo = p_other.getUserinfo(); m_host = p_other.getHost(); m_port = p_other.getPort(); m_path = p_other.getPath(); m_queryString = p_other.getQueryString(); m_fragment = p_other.getFragment(); } /** * Initializes this URI from a base URI and a URI specification string. * See RFC 2396 Section 4 and Appendix B for specifications on parsing * the URI and Section 5 for specifications on resolving relative URIs * and relative paths. * * @param p_base the base URI (may be null if p_uriSpec is an absolute * URI) * @param p_uriSpec the URI spec string which may be an absolute or * relative URI (can only be null/empty if p_base * is not null) * * @throws MalformedURIException if p_base is null and p_uriSpec * is not an absolute URI or if * p_uriSpec violates syntax rules */ private void initialize(URI p_base, String p_uriSpec) throws MalformedURIException { if (p_base == null && (p_uriSpec == null || p_uriSpec.trim().length() == 0)) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_INIT_URI_EMPTY_PARMS, null)); //"Cannot initialize URI with empty parameters."); } // just make a copy of the base if spec is empty if (p_uriSpec == null || p_uriSpec.trim().length() == 0) { initialize(p_base); return; } String uriSpec = p_uriSpec.trim(); int uriSpecLen = uriSpec.length(); int index = 0; // check for scheme int colonIndex = uriSpec.indexOf(':'); if (colonIndex < 0) { if (p_base == null) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_SCHEME_IN_URI, new Object[]{uriSpec})); //"No scheme found in URI: "+uriSpec); } } else { initializeScheme(uriSpec); uriSpec = uriSpec.substring(colonIndex+1); // This is a fix for XALANJ-2059. if(m_scheme != null && p_base != null) { // a) If starts with a slash (/), it means is absolute // and p_base can be ignored. // For example, // uriSpec = file:/myDIR/myXSLFile.xsl // p_base = file:/myWork/ // // Here, uriSpec has absolute path after scheme file and : // Hence p_base can be ignored. // // b) Similarily, according to RFC 2396, uri is resolved for relative to // if scheme in is same as scheme in , else p_base can be ignored. // // c) if is not hierarchical, it can be ignored. // if(uriSpec.startsWith("/") || !m_scheme.equals(p_base.m_scheme) || !p_base.getSchemeSpecificPart().startsWith("/")) { p_base = null; } } // Fix for XALANJ-2059 uriSpecLen = uriSpec.length(); } // two slashes means generic URI syntax, so we get the authority if (uriSpec.startsWith("//")) { index += 2; int startPos = index; // get authority - everything up to path, query or fragment char testChar = '\0'; while (index < uriSpecLen) { testChar = uriSpec.charAt(index); if (testChar == '/' || testChar == '?' || testChar == '#') { break; } index++; } // if we found authority, parse it out, otherwise we set the // host to empty string if (index > startPos) { initializeAuthority(uriSpec.substring(startPos, index)); } else { m_host = ""; } } initializePath(uriSpec.substring(index)); // Resolve relative URI to base URI - see RFC 2396 Section 5.2 // In some cases, it might make more sense to throw an exception // (when scheme is specified is the string spec and the base URI // is also specified, for example), but we're just following the // RFC specifications if (p_base != null) { // check to see if this is the current doc - RFC 2396 5.2 #2 // note that this is slightly different from the RFC spec in that // we don't include the check for query string being null // - this handles cases where the urispec is just a query // string or a fragment (e.g. "?y" or "#s") - // see which // identified this as a bug in the RFC if (m_path.length() == 0 && m_scheme == null && m_host == null) { m_scheme = p_base.getScheme(); m_userinfo = p_base.getUserinfo(); m_host = p_base.getHost(); m_port = p_base.getPort(); m_path = p_base.getPath(); if (m_queryString == null) { m_queryString = p_base.getQueryString(); } return; } // check for scheme - RFC 2396 5.2 #3 // if we found a scheme, it means absolute URI, so we're done if (m_scheme == null) { m_scheme = p_base.getScheme(); } // check for authority - RFC 2396 5.2 #4 // if we found a host, then we've got a network path, so we're done if (m_host == null) { m_userinfo = p_base.getUserinfo(); m_host = p_base.getHost(); m_port = p_base.getPort(); } else { return; } // check for absolute path - RFC 2396 5.2 #5 if (m_path.length() > 0 && m_path.startsWith("/")) { return; } // if we get to this point, we need to resolve relative path // RFC 2396 5.2 #6 String path = new String(); String basePath = p_base.getPath(); // 6a - get all but the last segment of the base URI path if (basePath != null) { int lastSlash = basePath.lastIndexOf('/'); if (lastSlash != -1) { path = basePath.substring(0, lastSlash + 1); } } // 6b - append the relative URI path path = path.concat(m_path); // 6c - remove all "./" where "." is a complete path segment index = -1; while ((index = path.indexOf("/./")) != -1) { path = path.substring(0, index + 1).concat(path.substring(index + 3)); } // 6d - remove "." if path ends with "." as a complete path segment if (path.endsWith("/.")) { path = path.substring(0, path.length() - 1); } // 6e - remove all "/../" where "" is a complete // path segment not equal to ".." index = -1; int segIndex = -1; String tempString = null; while ((index = path.indexOf("/../")) > 0) { tempString = path.substring(0, path.indexOf("/../")); segIndex = tempString.lastIndexOf('/'); if (segIndex != -1) { if (!tempString.substring(segIndex++).equals("..")) { path = path.substring(0, segIndex).concat(path.substring(index + 4)); } } } // 6f - remove ending "/.." where "" is a // complete path segment if (path.endsWith("/..")) { tempString = path.substring(0, path.length() - 3); segIndex = tempString.lastIndexOf('/'); if (segIndex != -1) { path = path.substring(0, segIndex + 1); } } m_path = path; } } /** * Initialize the scheme for this URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * * @throws MalformedURIException if URI does not have a conformant * scheme */ private void initializeScheme(String p_uriSpec) throws MalformedURIException { int uriSpecLen = p_uriSpec.length(); int index = 0; String scheme = null; char testChar = '\0'; while (index < uriSpecLen) { testChar = p_uriSpec.charAt(index); if (testChar == ':' || testChar == '/' || testChar == '?' || testChar == '#') { break; } index++; } scheme = p_uriSpec.substring(0, index); if (scheme.length() == 0) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_SCHEME_INURI, null)); //"No scheme found in URI."); } else { setScheme(scheme); } } /** * Initialize the authority (userinfo, host and port) for this * URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * * @throws MalformedURIException if p_uriSpec violates syntax rules */ private void initializeAuthority(String p_uriSpec) throws MalformedURIException { int index = 0; int start = 0; int end = p_uriSpec.length(); char testChar = '\0'; String userinfo = null; // userinfo is everything up @ if (p_uriSpec.indexOf('@', start) != -1) { while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '@') { break; } index++; } userinfo = p_uriSpec.substring(start, index); index++; } // host is everything up to ':' String host = null; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == ':') { break; } index++; } host = p_uriSpec.substring(start, index); int port = -1; if (host.length() > 0) { // port if (testChar == ':') { index++; start = index; while (index < end) { index++; } String portStr = p_uriSpec.substring(start, index); if (portStr.length() > 0) { for (int i = 0; i < portStr.length(); i++) { if (!isDigit(portStr.charAt(i))) { throw new MalformedURIException( portStr + " is invalid. Port should only contain digits!"); } } try { port = Integer.parseInt(portStr); } catch (NumberFormatException nfe) { // can't happen } } } } setHost(host); setPort(port); setUserinfo(userinfo); } /** * Initialize the path for this URI from a URI string spec. * * @param p_uriSpec the URI specification (cannot be null) * * @throws MalformedURIException if p_uriSpec violates syntax rules */ private void initializePath(String p_uriSpec) throws MalformedURIException { if (p_uriSpec == null) { throw new MalformedURIException( "Cannot initialize path from null string!"); } int index = 0; int start = 0; int end = p_uriSpec.length(); char testChar = '\0'; // path - everything up to query string or fragment while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '?' || testChar == '#') { break; } // check for valid escape sequence if (testChar == '%') { if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1)) ||!isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, null)); //"Path contains invalid escape sequence!"); } } else if (!isReservedCharacter(testChar) &&!isUnreservedCharacter(testChar)) { if ('\\' != testChar) throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_PATH_INVALID_CHAR, new Object[]{String.valueOf(testChar)})); //"Path contains invalid character: " //+ testChar); } index++; } m_path = p_uriSpec.substring(start, index); // query - starts with ? and up to fragment or end if (testChar == '?') { index++; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '#') { break; } if (testChar == '%') { if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1)) ||!isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Query string contains invalid escape sequence!"); } } else if (!isReservedCharacter(testChar) &&!isUnreservedCharacter(testChar)) { throw new MalformedURIException( "Query string contains invalid character:" + testChar); } index++; } m_queryString = p_uriSpec.substring(start, index); } // fragment - starts with # if (testChar == '#') { index++; start = index; while (index < end) { testChar = p_uriSpec.charAt(index); if (testChar == '%') { if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1)) ||!isHex(p_uriSpec.charAt(index + 2))) { throw new MalformedURIException( "Fragment contains invalid escape sequence!"); } } else if (!isReservedCharacter(testChar) &&!isUnreservedCharacter(testChar)) { throw new MalformedURIException( "Fragment contains invalid character:" + testChar); } index++; } m_fragment = p_uriSpec.substring(start, index); } } /** * Get the scheme for this URI. * * @return the scheme for this URI */ public String getScheme() { return m_scheme; } /** * Get the scheme-specific part for this URI (everything following the * scheme and the first colon). See RFC 2396 Section 5.2 for spec. * * @return the scheme-specific part for this URI */ public String getSchemeSpecificPart() { StringBuffer schemespec = new StringBuffer(); if (m_userinfo != null || m_host != null || m_port != -1) { schemespec.append("//"); } if (m_userinfo != null) { schemespec.append(m_userinfo); schemespec.append('@'); } if (m_host != null) { schemespec.append(m_host); } if (m_port != -1) { schemespec.append(':'); schemespec.append(m_port); } if (m_path != null) { schemespec.append((m_path)); } if (m_queryString != null) { schemespec.append('?'); schemespec.append(m_queryString); } if (m_fragment != null) { schemespec.append('#'); schemespec.append(m_fragment); } return schemespec.toString(); } /** * Get the userinfo for this URI. * * @return the userinfo for this URI (null if not specified). */ public String getUserinfo() { return m_userinfo; } /** * Get the host for this URI. * * @return the host for this URI (null if not specified). */ public String getHost() { return m_host; } /** * Get the port for this URI. * * @return the port for this URI (-1 if not specified). */ public int getPort() { return m_port; } /** * Get the path for this URI (optionally with the query string and * fragment). * * @param p_includeQueryString if true (and query string is not null), * then a "?" followed by the query string * will be appended * @param p_includeFragment if true (and fragment is not null), * then a "#" followed by the fragment * will be appended * * @return the path for this URI possibly including the query string * and fragment */ public String getPath(boolean p_includeQueryString, boolean p_includeFragment) { StringBuffer pathString = new StringBuffer(m_path); if (p_includeQueryString && m_queryString != null) { pathString.append('?'); pathString.append(m_queryString); } if (p_includeFragment && m_fragment != null) { pathString.append('#'); pathString.append(m_fragment); } return pathString.toString(); } /** * Get the path for this URI. Note that the value returned is the path * only and does not include the query string or fragment. * * @return the path for this URI. */ public String getPath() { return m_path; } /** * Get the query string for this URI. * * @return the query string for this URI. Null is returned if there * was no "?" in the URI spec, empty string if there was a * "?" but no query string following it. */ public String getQueryString() { return m_queryString; } /** * Get the fragment for this URI. * * @return the fragment for this URI. Null is returned if there * was no "#" in the URI spec, empty string if there was a * "#" but no fragment following it. */ public String getFragment() { return m_fragment; } /** * Set the scheme for this URI. The scheme is converted to lowercase * before it is set. * * @param p_scheme the scheme for this URI (cannot be null) * * @throws MalformedURIException if p_scheme is not a conformant * scheme name */ public void setScheme(String p_scheme) throws MalformedURIException { if (p_scheme == null) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_FROM_NULL_STRING, null)); //"Cannot set scheme from null string!"); } if (!isConformantSchemeName(p_scheme)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_NOT_CONFORMANT, null)); //"The scheme is not conformant."); } m_scheme = p_scheme.toLowerCase(); } /** * Set the userinfo for this URI. If a non-null value is passed in and * the host value is null, then an exception is thrown. * * @param p_userinfo the userinfo for this URI * * @throws MalformedURIException if p_userinfo contains invalid * characters */ public void setUserinfo(String p_userinfo) throws MalformedURIException { if (p_userinfo == null) { m_userinfo = null; } else { if (m_host == null) { throw new MalformedURIException( "Userinfo cannot be set when host is null!"); } // userinfo can contain alphanumerics, mark characters, escaped // and ';',':','&','=','+','$',',' int index = 0; int end = p_userinfo.length(); char testChar = '\0'; while (index < end) { testChar = p_userinfo.charAt(index); if (testChar == '%') { if (index + 2 >= end ||!isHex(p_userinfo.charAt(index + 1)) ||!isHex(p_userinfo.charAt(index + 2))) { throw new MalformedURIException( "Userinfo contains invalid escape sequence!"); } } else if (!isUnreservedCharacter(testChar) && USERINFO_CHARACTERS.indexOf(testChar) == -1) { throw new MalformedURIException( "Userinfo contains invalid character:" + testChar); } index++; } } m_userinfo = p_userinfo; } /** * Set the host for this URI. If null is passed in, the userinfo * field is also set to null and the port is set to -1. * * @param p_host the host for this URI * * @throws MalformedURIException if p_host is not a valid IP * address or DNS hostname. */ public void setHost(String p_host) throws MalformedURIException { if (p_host == null || p_host.trim().length() == 0) { m_host = p_host; m_userinfo = null; m_port = -1; } else if (!isWellFormedAddress(p_host)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!"); } m_host = p_host; } /** * Set the port for this URI. -1 is used to indicate that the port is * not specified, otherwise valid port numbers are between 0 and 65535. * If a valid port number is passed in and the host field is null, * an exception is thrown. * * @param p_port the port number for this URI * * @throws MalformedURIException if p_port is not -1 and not a * valid port number */ public void setPort(int p_port) throws MalformedURIException { if (p_port >= 0 && p_port <= 65535) { if (m_host == null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_PORT_WHEN_HOST_NULL, null)); //"Port cannot be set when host is null!"); } } else if (p_port != -1) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_PORT, null)); //"Invalid port number!"); } m_port = p_port; } /** * Set the path for this URI. If the supplied path is null, then the * query string and fragment are set to null as well. If the supplied * path includes a query string and/or fragment, these fields will be * parsed and set as well. Note that, for URIs following the "generic * URI" syntax, the path specified should start with a slash. * For URIs that do not follow the generic URI syntax, this method * sets the scheme-specific part. * * @param p_path the path for this URI (may be null) * * @throws MalformedURIException if p_path contains invalid * characters */ public void setPath(String p_path) throws MalformedURIException { if (p_path == null) { m_path = null; m_queryString = null; m_fragment = null; } else { initializePath(p_path); } } /** * Append to the end of the path of this URI. If the current path does * not end in a slash and the path to be appended does not begin with * a slash, a slash will be appended to the current path before the * new segment is added. Also, if the current path ends in a slash * and the new segment begins with a slash, the extra slash will be * removed before the new segment is appended. * * @param p_addToPath the new segment to be added to the current path * * @throws MalformedURIException if p_addToPath contains syntax * errors */ public void appendPath(String p_addToPath) throws MalformedURIException { if (p_addToPath == null || p_addToPath.trim().length() == 0) { return; } if (!isURIString(p_addToPath)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_PATH_INVALID_CHAR, new Object[]{p_addToPath})); //"Path contains invalid character!"); } if (m_path == null || m_path.trim().length() == 0) { if (p_addToPath.startsWith("/")) { m_path = p_addToPath; } else { m_path = "/" + p_addToPath; } } else if (m_path.endsWith("/")) { if (p_addToPath.startsWith("/")) { m_path = m_path.concat(p_addToPath.substring(1)); } else { m_path = m_path.concat(p_addToPath); } } else { if (p_addToPath.startsWith("/")) { m_path = m_path.concat(p_addToPath); } else { m_path = m_path.concat("/" + p_addToPath); } } } /** * Set the query string for this URI. A non-null value is valid only * if this is an URI conforming to the generic URI syntax and * the path value is not null. * * @param p_queryString the query string for this URI * * @throws MalformedURIException if p_queryString is not null and this * URI does not conform to the generic * URI syntax or if the path is null */ public void setQueryString(String p_queryString) throws MalformedURIException { if (p_queryString == null) { m_queryString = null; } else if (!isGenericURI()) { throw new MalformedURIException( "Query string can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( "Query string cannot be set when path is null!"); } else if (!isURIString(p_queryString)) { throw new MalformedURIException( "Query string contains invalid character!"); } else { m_queryString = p_queryString; } } /** * Set the fragment for this URI. A non-null value is valid only * if this is a URI conforming to the generic URI syntax and * the path value is not null. * * @param p_fragment the fragment for this URI * * @throws MalformedURIException if p_fragment is not null and this * URI does not conform to the generic * URI syntax or if the path is null */ public void setFragment(String p_fragment) throws MalformedURIException { if (p_fragment == null) { m_fragment = null; } else if (!isGenericURI()) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!"); } else if (!isURIString(p_fragment)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!"); } else { m_fragment = p_fragment; } } /** * Determines if the passed-in Object is equivalent to this URI. * * @param p_test the Object to test for equality. * * @return true if p_test is a URI with all values equal to this * URI, false otherwise */ public boolean equals(Object p_test) { if (p_test instanceof URI) { URI testURI = (URI) p_test; if (((m_scheme == null && testURI.m_scheme == null) || (m_scheme != null && testURI.m_scheme != null && m_scheme.equals( testURI.m_scheme))) && ((m_userinfo == null && testURI.m_userinfo == null) || (m_userinfo != null && testURI.m_userinfo != null && m_userinfo.equals( testURI.m_userinfo))) && ((m_host == null && testURI.m_host == null) || (m_host != null && testURI.m_host != null && m_host.equals( testURI.m_host))) && m_port == testURI.m_port && ((m_path == null && testURI.m_path == null) || (m_path != null && testURI.m_path != null && m_path.equals( testURI.m_path))) && ((m_queryString == null && testURI.m_queryString == null) || (m_queryString != null && testURI.m_queryString != null && m_queryString.equals( testURI.m_queryString))) && ((m_fragment == null && testURI.m_fragment == null) || (m_fragment != null && testURI.m_fragment != null && m_fragment.equals( testURI.m_fragment)))) { return true; } } return false; } /** * Get the URI as a string specification. See RFC 2396 Section 5.2. * * @return the URI string specification */ public String toString() { StringBuffer uriSpecString = new StringBuffer(); if (m_scheme != null) { uriSpecString.append(m_scheme); uriSpecString.append(':'); } uriSpecString.append(getSchemeSpecificPart()); return uriSpecString.toString(); } /** * Get the indicator as to whether this URI uses the "generic URI" * syntax. * * @return true if this URI uses the "generic URI" syntax, false * otherwise */ public boolean isGenericURI() { // presence of the host (whether valid or empty) means // double-slashes which means generic uri return (m_host != null); } /** * Determine whether a scheme conforms to the rules for a scheme name. * A scheme is conformant if it starts with an alphanumeric, and * contains only alphanumerics, '+','-' and '.'. * * * @param p_scheme The sheme name to check * @return true if the scheme is conformant, false otherwise */ public static boolean isConformantSchemeName(String p_scheme) { if (p_scheme == null || p_scheme.trim().length() == 0) { return false; } if (!isAlpha(p_scheme.charAt(0))) { return false; } char testChar; for (int i = 1; i < p_scheme.length(); i++) { testChar = p_scheme.charAt(i); if (!isAlphanum(testChar) && SCHEME_CHARACTERS.indexOf(testChar) == -1) { return false; } } return true; } /** * Determine whether a string is syntactically capable of representing * a valid IPv4 address or the domain name of a network host. A valid * IPv4 address consists of four decimal digit groups separated by a * '.'. A hostname consists of domain labels (each of which must * begin and end with an alphanumeric but may contain '-') separated * & by a '.'. See RFC 2396 Section 3.2.2. * * * @param p_address The address string to check * @return true if the string is a syntactically valid IPv4 address * or hostname */ public static boolean isWellFormedAddress(String p_address) { if (p_address == null) { return false; } String address = p_address.trim(); int addrLength = address.length(); if (addrLength == 0 || addrLength > 255) { return false; } if (address.startsWith(".") || address.startsWith("-")) { return false; } // rightmost domain label starting with digit indicates IP address // since top level domain label can only start with an alpha // see RFC 2396 Section 3.2.2 int index = address.lastIndexOf('.'); if (address.endsWith(".")) { index = address.substring(0, index).lastIndexOf('.'); } if (index + 1 < addrLength && isDigit(p_address.charAt(index + 1))) { char testChar; int numDots = 0; // make sure that 1) we see only digits and dot separators, 2) that // any dot separator is preceded and followed by a digit and // 3) that we find 3 dots for (int i = 0; i < addrLength; i++) { testChar = address.charAt(i); if (testChar == '.') { if (!isDigit(address.charAt(i - 1)) || (i + 1 < addrLength &&!isDigit(address.charAt(i + 1)))) { return false; } numDots++; } else if (!isDigit(testChar)) { return false; } } if (numDots != 3) { return false; } } else { // domain labels can contain alphanumerics and '-" // but must start and end with an alphanumeric char testChar; for (int i = 0; i < addrLength; i++) { testChar = address.charAt(i); if (testChar == '.') { if (!isAlphanum(address.charAt(i - 1))) { return false; } if (i + 1 < addrLength &&!isAlphanum(address.charAt(i + 1))) { return false; } } else if (!isAlphanum(testChar) && testChar != '-') { return false; } } } return true; } /** * Determine whether a char is a digit. * * * @param p_char the character to check * @return true if the char is betweeen '0' and '9', false otherwise */ private static boolean isDigit(char p_char) { return p_char >= '0' && p_char <= '9'; } /** * Determine whether a character is a hexadecimal character. * * * @param p_char the character to check * @return true if the char is betweeen '0' and '9', 'a' and 'f' * or 'A' and 'F', false otherwise */ private static boolean isHex(char p_char) { return (isDigit(p_char) || (p_char >= 'a' && p_char <= 'f') || (p_char >= 'A' && p_char <= 'F')); } /** * Determine whether a char is an alphabetic character: a-z or A-Z * * * @param p_char the character to check * @return true if the char is alphabetic, false otherwise */ private static boolean isAlpha(char p_char) { return ((p_char >= 'a' && p_char <= 'z') || (p_char >= 'A' && p_char <= 'Z')); } /** * Determine whether a char is an alphanumeric: 0-9, a-z or A-Z * * * @param p_char the character to check * @return true if the char is alphanumeric, false otherwise */ private static boolean isAlphanum(char p_char) { return (isAlpha(p_char) || isDigit(p_char)); } /** * Determine whether a character is a reserved character: * ';', '/', '?', ':', '@', '&', '=', '+', '$' or ',' * * * @param p_char the character to check * @return true if the string contains any reserved characters */ private static boolean isReservedCharacter(char p_char) { return RESERVED_CHARACTERS.indexOf(p_char) != -1; } /** * Determine whether a char is an unreserved character. * * * @param p_char the character to check * @return true if the char is unreserved, false otherwise */ private static boolean isUnreservedCharacter(char p_char) { return (isAlphanum(p_char) || MARK_CHARACTERS.indexOf(p_char) != -1); } /** * Determine whether a given string contains only URI characters (also * called "uric" in RFC 2396). uric consist of all reserved * characters, unreserved characters and escaped characters. * * * @param p_uric URI string * @return true if the string is comprised of uric, false otherwise */ private static boolean isURIString(String p_uric) { if (p_uric == null) { return false; } int end = p_uric.length(); char testChar = '\0'; for (int i = 0; i < end; i++) { testChar = p_uric.charAt(i); if (testChar == '%') { if (i + 2 >= end ||!isHex(p_uric.charAt(i + 1)) ||!isHex(p_uric.charAt(i + 2))) { return false; } else { i += 2; continue; } } if (isReservedCharacter(testChar) || isUnreservedCharacter(testChar)) { continue; } else { return false; } } return true; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/AttList.java0000644000175000017500000001465010721374031022272 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttList.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.xml.sax.Attributes; /** * Wraps a DOM attribute list in a SAX Attributes. * @xsl.usage internal */ public class AttList implements Attributes { /** List of attribute nodes */ NamedNodeMap m_attrs; /** Index of last attribute node */ int m_lastIndex; // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! // DOM2Helper m_dh = new DOM2Helper(); /** Local reference to DOMHelper */ DOMHelper m_dh; // /** // * Constructor AttList // * // * // * @param attrs List of attributes this will contain // */ // public AttList(NamedNodeMap attrs) // { // // m_attrs = attrs; // m_lastIndex = m_attrs.getLength() - 1; // m_dh = new DOM2Helper(); // } /** * Constructor AttList * * * @param attrs List of attributes this will contain * @param dh DOMHelper */ public AttList(NamedNodeMap attrs, DOMHelper dh) { m_attrs = attrs; m_lastIndex = m_attrs.getLength() - 1; m_dh = dh; } /** * Get the number of attribute nodes in the list * * * @return number of attribute nodes */ public int getLength() { return m_attrs.getLength(); } /** * Look up an attribute's Namespace URI by index. * * @param index The attribute index (zero-based). * @return The Namespace URI, or the empty string if none * is available, or null if the index is out of * range. */ public String getURI(int index) { String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index))); if(null == ns) ns = ""; return ns; } /** * Look up an attribute's local name by index. * * @param index The attribute index (zero-based). * @return The local name, or the empty string if Namespace * processing is not being performed, or null * if the index is out of range. */ public String getLocalName(int index) { return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index))); } /** * Look up an attribute's qualified name by index. * * * @param i The attribute index (zero-based). * * @return The attribute's qualified name */ public String getQName(int i) { return ((Attr) m_attrs.item(i)).getName(); } /** * Get the attribute's node type by index * * * @param i The attribute index (zero-based) * * @return the attribute's node type */ public String getType(int i) { return "CDATA"; // for the moment } /** * Get the attribute's node value by index * * * @param i The attribute index (zero-based) * * @return the attribute's node value */ public String getValue(int i) { return ((Attr) m_attrs.item(i)).getValue(); } /** * Get the attribute's node type by name * * * @param name Attribute name * * @return the attribute's node type */ public String getType(String name) { return "CDATA"; // for the moment } /** * Look up an attribute's type by Namespace name. * * @param uri The Namespace URI, or the empty String if the * name has no Namespace URI. * @param localName The local name of the attribute. * @return The attribute type as a string, or null if the * attribute is not in the list or if Namespace * processing is not being performed. */ public String getType(String uri, String localName) { return "CDATA"; // for the moment } /** * Look up an attribute's value by name. * * * @param name The attribute node's name * * @return The attribute node's value */ public String getValue(String name) { Attr attr = ((Attr) m_attrs.getNamedItem(name)); return (null != attr) ? attr.getValue() : null; } /** * Look up an attribute's value by Namespace name. * * @param uri The Namespace URI, or the empty String if the * name has no Namespace URI. * @param localName The local name of the attribute. * @return The attribute value as a string, or null if the * attribute is not in the list. */ public String getValue(String uri, String localName) { Node a=m_attrs.getNamedItemNS(uri,localName); return (a==null) ? null : a.getNodeValue(); } /** * Look up the index of an attribute by Namespace name. * * @param uri The Namespace URI, or the empty string if * the name has no Namespace URI. * @param localPart The attribute's local name. * @return The index of the attribute, or -1 if it does not * appear in the list. */ public int getIndex(String uri, String localPart) { for(int i=m_attrs.getLength()-1;i>=0;--i) { Node a=m_attrs.item(i); String u=a.getNamespaceURI(); if( (u==null ? uri==null : u.equals(uri)) && a.getLocalName().equals(localPart) ) return i; } return -1; } /** * Look up the index of an attribute by raw XML 1.0 name. * * @param qName The qualified (prefixed) name. * @return The index of the attribute, or -1 if it does not * appear in the list. */ public int getIndex(String qName) { for(int i=m_attrs.getLength()-1;i>=0;--i) { Node a=m_attrs.item(i); if(a.getNodeName().equals(qName) ) return i; } return -1; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/BoolStack.java0000644000175000017500000001112010721374031022554 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BoolStack.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * Simple stack for boolean values. * @xsl.usage internal */ public final class BoolStack implements Cloneable { /** Array of boolean values */ private boolean m_values[]; /** Array size allocated */ private int m_allocatedSize; /** Index into the array of booleans */ private int m_index; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public BoolStack() { this(32); } /** * Construct a IntVector, using the given block size. * * @param size array size to allocate */ public BoolStack(int size) { m_allocatedSize = size; m_values = new boolean[size]; m_index = -1; } /** * Get the length of the list. * * @return Current length of the list */ public final int size() { return m_index + 1; } /** * Clears the stack. * */ public final void clear() { m_index = -1; } /** * Pushes an item onto the top of this stack. * * * @param val the boolean to be pushed onto this stack. * @return the item argument. */ public final boolean push(boolean val) { if (m_index == m_allocatedSize - 1) grow(); return (m_values[++m_index] = val); } /** * Removes the object at the top of this stack and returns that * object as the value of this function. * * @return The object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final boolean pop() { return m_values[m_index--]; } /** * Removes the object at the top of this stack and returns the * next object at the top as the value of this function. * * * @return Next object to the top or false if none there */ public final boolean popAndTop() { m_index--; return (m_index >= 0) ? m_values[m_index] : false; } /** * Set the item at the top of this stack * * * @param b Object to set at the top of this stack */ public final void setTop(boolean b) { m_values[m_index] = b; } /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final boolean peek() { return m_values[m_index]; } /** * Looks at the object at the top of this stack without removing it * from the stack. If the stack is empty, it returns false. * * @return the object at the top of this stack. */ public final boolean peekOrFalse() { return (m_index > -1) ? m_values[m_index] : false; } /** * Looks at the object at the top of this stack without removing it * from the stack. If the stack is empty, it returns true. * * @return the object at the top of this stack. */ public final boolean peekOrTrue() { return (m_index > -1) ? m_values[m_index] : true; } /** * Tests if this stack is empty. * * @return true if this stack is empty; * false otherwise. */ public boolean isEmpty() { return (m_index == -1); } /** * Grows the size of the stack * */ private void grow() { m_allocatedSize *= 2; boolean newVector[] = new boolean[m_allocatedSize]; System.arraycopy(m_values, 0, newVector, 0, m_index + 1); m_values = newVector; } public Object clone() throws CloneNotSupportedException { return super.clone(); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/PrefixResolverDefault.java0000644000175000017500000001031710721374032025167 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PrefixResolverDefault.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * This class implements a generic PrefixResolver that * can be used to perform prefix-to-namespace lookup * for the XPath object. * @xsl.usage general */ public class PrefixResolverDefault implements PrefixResolver { /** * The context to resolve the prefix from, if the context * is not given. */ Node m_context; /** * Construct a PrefixResolverDefault object. * @param xpathExpressionContext The context from * which XPath expression prefixes will be resolved. * Warning: This will not work correctly if xpathExpressionContext * is an attribute node. */ public PrefixResolverDefault(Node xpathExpressionContext) { m_context = xpathExpressionContext; } /** * Given a namespace, get the corrisponding prefix. This assumes that * the PrevixResolver hold's it's own namespace context, or is a namespace * context itself. * @param prefix Prefix to resolve. * @return Namespace that prefix resolves to, or null if prefix * is not bound. */ public String getNamespaceForPrefix(String prefix) { return getNamespaceForPrefix(prefix, m_context); } /** * Given a namespace, get the corrisponding prefix. * Warning: This will not work correctly if namespaceContext * is an attribute node. * @param prefix Prefix to resolve. * @param namespaceContext Node from which to start searching for a * xmlns attribute that binds a prefix to a namespace. * @return Namespace that prefix resolves to, or null if prefix * is not bound. */ public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node namespaceContext) { Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = Constants.S_XMLNAMESPACEURI; } else { int type; while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { if (parent.getNodeName().indexOf(prefix+":") == 0) return parent.getNamespaceURI(); NamedNodeMap nnm = parent.getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { Node attr = nnm.item(i); String aname = attr.getNodeName(); boolean isPrefix = aname.startsWith("xmlns:"); if (isPrefix || aname.equals("xmlns")) { int index = aname.indexOf(':'); String p = isPrefix ? aname.substring(index + 1) : ""; if (p.equals(prefix)) { namespace = attr.getNodeValue(); break; } } } } parent = parent.getParentNode(); } } return namespace; } /** * Return the base identifier. * * @return null */ public String getBaseIdentifier() { return null; } /** * @see PrefixResolver#handlesNullPrefixes() */ public boolean handlesNullPrefixes() { return false; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/ElemDesc.java0000644000175000017500000001371210721374032022366 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemDesc.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.Hashtable; /** * This class is in support of SerializerToHTML, and acts as a sort * of element representative for HTML elements. * @xsl.usage internal */ class ElemDesc { /** Table of attributes for the element */ Hashtable m_attrs = null; /** Element's flags, describing the role this element plays during * formatting of the document. This is used as a bitvector; more than one flag * may be set at a time, bitwise-ORed together. Mnemonic and bits * have been assigned to the flag values. NOTE: Some bits are * currently assigned multiple mnemonics; it is the caller's * responsibility to disambiguate these if necessary. */ int m_flags; /** Defines mnemonic and bit-value for the EMPTY flag */ static final int EMPTY = (1 << 1); /** Defines mnemonic and bit-value for the FLOW flag */ static final int FLOW = (1 << 2); /** Defines mnemonic and bit-value for the BLOCK flag */ static final int BLOCK = (1 << 3); /** Defines mnemonic and bit-value for the BLOCKFORM flag */ static final int BLOCKFORM = (1 << 4); /** Defines mnemonic and bit-value for the BLOCKFORMFIELDSET flag */ static final int BLOCKFORMFIELDSET = (1 << 5); /** Defines mnemonic and bit-value for the CDATA flag */ static final int CDATA = (1 << 6); /** Defines mnemonic and bit-value for the PCDATA flag */ static final int PCDATA = (1 << 7); /** Defines mnemonic and bit-value for the RAW flag */ static final int RAW = (1 << 8); /** Defines mnemonic and bit-value for the INLINE flag */ static final int INLINE = (1 << 9); /** Defines mnemonic and bit-value for the INLINEA flag */ static final int INLINEA = (1 << 10); /** Defines mnemonic and bit-value for the INLINELABEL flag */ static final int INLINELABEL = (1 << 11); /** Defines mnemonic and bit-value for the FONTSTYLE flag */ static final int FONTSTYLE = (1 << 12); /** Defines mnemonic and bit-value for the PHRASE flag */ static final int PHRASE = (1 << 13); /** Defines mnemonic and bit-value for the FORMCTRL flag */ static final int FORMCTRL = (1 << 14); /** Defines mnemonic and bit-value for the SPECIAL flag */ static final int SPECIAL = (1 << 15); /** Defines mnemonic and bit-value for the ASPECIAL flag */ static final int ASPECIAL = (1 << 16); /** Defines mnemonic and bit-value for the HEADMISC flag */ static final int HEADMISC = (1 << 17); /** Defines mnemonic and bit-value for the HEAD flag */ static final int HEAD = (1 << 18); /** Defines mnemonic and bit-value for the LIST flag */ static final int LIST = (1 << 19); /** Defines mnemonic and bit-value for the PREFORMATTED flag */ static final int PREFORMATTED = (1 << 20); /** Defines mnemonic and bit-value for the WHITESPACESENSITIVE flag */ static final int WHITESPACESENSITIVE = (1 << 21); /** Defines mnemonic and bit-value for the ATTRURL flag */ static final int ATTRURL = (1 << 1); /** Defines mnemonic and bit-value for the ATTREMPTY flag */ static final int ATTREMPTY = (1 << 2); /** * Construct an ElementDescription with an initial set of flags. * * @param flags Element flags * @see m_flags */ ElemDesc(int flags) { m_flags = flags; } /** * "is (this element described by these flags)". * * This might more properly be called areFlagsSet(). It accepts an * integer (being used as a bitvector) and checks whether all the * corresponding bits are set in our internal flags. Note that this * test is performed as a bitwise AND, not an equality test, so a * 0 bit in the input means "don't test", not "must be set false". * * @param flags Vector of flags to compare against this element's flags * * @return true if the flags set in the parameter are also set in the * element's stored flags. * * @see m_flags * @see isAttrFlagSet */ boolean is(int flags) { // int which = (m_flags & flags); return (m_flags & flags) != 0; } /** * Set a new attribute for this element * * * @param name Attribute name * @param flags Attibute flags */ void setAttr(String name, int flags) { if (null == m_attrs) m_attrs = new Hashtable(); m_attrs.put(name, new Integer(flags)); } /** * Find out if a flag is set in a given attribute of this element * * * @param name Attribute name * @param flags Flag to check * * @return True if the flag is set in the attribute. Returns false * if the attribute is not found * @see m_flags */ boolean isAttrFlagSet(String name, int flags) { if (null != m_attrs) { Integer _flags = (Integer) m_attrs.get(name); if (null != _flags) { return (_flags.intValue() & flags) != 0; } } return false; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/Constants.java0000644000175000017500000001076610721374033022670 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Constants.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * Primary constants used by the XSLT Processor * @xsl.usage advanced */ public class Constants { /** * Mnemonics for standard XML Namespace URIs, as Java Strings: *

      *
    • S_XMLNAMESPACEURI (http://www.w3.org/XML/1998/namespace) is the * URI permanantly assigned to the "xml:" prefix. This is used for some * features built into the XML specification itself, such as xml:space * and xml:lang. It was defined by the W3C's XML Namespaces spec.
    • *
    • S_XSLNAMESPACEURL (http://www.w3.org/1999/XSL/Transform) is the * URI which indicates that a name may be an XSLT directive. In most * XSLT stylesheets, this is bound to the "xsl:" prefix. It's defined * by the W3C's XSLT Recommendation.
    • *
    • S_OLDXSLNAMESPACEURL (http://www.w3.org/XSL/Transform/1.0) was * used in early prototypes of XSLT processors for much the same purpose * as S_XSLNAMESPACEURL. It is now considered obsolete, and the version * of XSLT which it signified is not fully compatable with the final * XSLT Recommendation, so what it really signifies is a badly obsolete * stylesheet.
    • *
    */ public static final String S_XMLNAMESPACEURI = "http://www.w3.org/XML/1998/namespace", S_XSLNAMESPACEURL = "http://www.w3.org/1999/XSL/Transform", S_OLDXSLNAMESPACEURL = "http://www.w3.org/XSL/Transform/1.0"; /** Authorship mnemonics, as Java Strings. Not standardized, * as far as I know. *
      *
    • S_VENDOR -- the name of the organization/individual who published * this XSLT processor.
    • *
    • S_VENDORURL -- URL where one can attempt to retrieve more * information about this publisher and product.
    • *
    */ public static final String S_VENDOR = "Apache Software Foundation", S_VENDORURL = "http://xml.apache.org"; /** S_BUILTIN_EXTENSIONS_URL is a mnemonic for the XML Namespace *(http://xml.apache.org/xalan) predefined to signify Xalan's * built-in XSLT Extensions. When used in stylesheets, this is often * bound to the "xalan:" prefix. */ public static final String S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xalan"; /** * The old built-in extension url. It is still supported for * backward compatibility. */ public static final String S_BUILTIN_OLD_EXTENSIONS_URL = "http://xml.apache.org/xslt"; /** * Xalan extension namespaces. */ public static final String // The old namespace for Java extension S_EXTENSIONS_OLD_JAVA_URL = "http://xml.apache.org/xslt/java", // The new namespace for Java extension S_EXTENSIONS_JAVA_URL = "http://xml.apache.org/xalan/java", S_EXTENSIONS_LOTUSXSL_JAVA_URL = "http://xsl.lotus.com/java", S_EXTENSIONS_XALANLIB_URL = "http://xml.apache.org/xalan", S_EXTENSIONS_REDIRECT_URL = "http://xml.apache.org/xalan/redirect", S_EXTENSIONS_PIPE_URL = "http://xml.apache.org/xalan/PipeDocument", S_EXTENSIONS_SQL_URL = "http://xml.apache.org/xalan/sql"; /** * EXSLT extension namespaces. */ public static final String S_EXSLT_COMMON_URL = "http://exslt.org/common", S_EXSLT_MATH_URL = "http://exslt.org/math", S_EXSLT_SETS_URL = "http://exslt.org/sets", S_EXSLT_DATETIME_URL = "http://exslt.org/dates-and-times", S_EXSLT_FUNCTIONS_URL = "http://exslt.org/functions", S_EXSLT_DYNAMIC_URL = "http://exslt.org/dynamic", S_EXSLT_STRINGS_URL = "http://exslt.org/strings"; /** * The minimum version of XSLT supported by this processor. */ public static final double XSLTVERSUPPORTED = 1.0; } libxalan2-java-2.7.1/src/org/apache/xml/utils/SuballocatedByteVector.java0000644000175000017500000003401010721374031025307 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SuballocatedByteVector.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple table that stores a list of byte. Very similar API to our * IntVector class (same API); different internal storage. * * This version uses an array-of-arrays solution. Read/write access is thus * a bit slower than the simple IntVector, and basic storage is a trifle * higher due to the top-level array -- but appending is O(1) fast rather * than O(N**2) slow, which will swamp those costs in situations where * long vectors are being built up. * * Known issues: * * Some methods are private because they haven't yet been tested properly. * * If an element has not been set (because we skipped it), its value will * initially be 0. Shortening the vector does not clear old storage; if you * then skip values and setElementAt a higher index again, you may see old data * reappear in the truncated-and-restored section. Doing anything else would * have performance costs. * @xsl.usage internal */ public class SuballocatedByteVector { /** Size of blocks to allocate */ protected int m_blocksize; /** Number of blocks to (over)allocate by */ protected int m_numblocks=32; /** Array of arrays of bytes */ protected byte m_map[][]; /** Number of bytes in array */ protected int m_firstFree = 0; /** "Shortcut" handle to m_map[0] */ protected byte m_map0[]; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public SuballocatedByteVector() { this(2048); } /** * Construct a ByteVector, using the given block size. * * @param blocksize Size of block to allocate */ public SuballocatedByteVector(int blocksize) { m_blocksize = blocksize; m_map0=new byte[blocksize]; m_map = new byte[m_numblocks][]; m_map[0]=m_map0; } /** * Construct a ByteVector, using the given block size. * * @param blocksize Size of block to allocate */ public SuballocatedByteVector(int blocksize, int increaseSize) { // increaseSize not currently used. this(blocksize); } /** * Get the length of the list. * * @return length of the list */ public int size() { return m_firstFree; } /** * Set the length of the list. * * @return length of the list */ private void setSize(int sz) { if(m_firstFree=m_map.length) { int newsize=index+m_numblocks; byte[][] newMap=new byte[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } byte[] block=m_map[index]; if(null==block) block=m_map[index]=new byte[m_blocksize]; block[offset]=value; } } /** * Append several byte values onto the vector. * * @param value Byte to add to the list */ private void addElements(byte value, int numberOfElements) { if(m_firstFree+numberOfElements0) { if(index>=m_map.length) { int newsize=index+m_numblocks; byte[][] newMap=new byte[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } byte[] block=m_map[index]; if(null==block) block=m_map[index]=new byte[m_blocksize]; int copied=(m_blocksize-offset < numberOfElements) ? m_blocksize-offset : numberOfElements; numberOfElements-=copied; while(copied-- > 0) block[offset++]=value; ++index;offset=0; } } } /** * Append several slots onto the vector, but do not set the values. * Note: "Not Set" means the value is unspecified. * * @param numberOfElements */ private void addElements(int numberOfElements) { int newlen=m_firstFree+numberOfElements; if(newlen>m_blocksize) { int index=m_firstFree%m_blocksize; int newindex=(m_firstFree+numberOfElements)%m_blocksize; for(int i=index+1;i<=newindex;++i) m_map[i]=new byte[m_blocksize]; } m_firstFree=newlen; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * Insertion may be an EXPENSIVE operation! * * @param value Byte to insert * @param at Index of where to insert */ private void insertElementAt(byte value, int at) { if(at==m_firstFree) addElement(value); else if (at>m_firstFree) { int index=at/m_blocksize; if(index>=m_map.length) { int newsize=index+m_numblocks; byte[][] newMap=new byte[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } byte[] block=m_map[index]; if(null==block) block=m_map[index]=new byte[m_blocksize]; int offset=at%m_blocksize; block[offset]=value; m_firstFree=offset+1; } else { int index=at/m_blocksize; int maxindex=m_firstFree+1/m_blocksize; ++m_firstFree; int offset=at%m_blocksize; byte push; // ***** Easier to work down from top? while(index<=maxindex) { int copylen=m_blocksize-offset-1; byte[] block=m_map[index]; if(null==block) { push=0; block=m_map[index]=new byte[m_blocksize]; } else { push=block[m_blocksize-1]; System.arraycopy(block, offset , block, offset+1, copylen); } block[offset]=value; value=push; offset=0; ++index; } } } /** * Wipe it out. */ public void removeAllElements() { m_firstFree = 0; } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s Byte to remove from array * * @return True if the byte was removed, false if it was not found */ private boolean removeElement(byte s) { int at=indexOf(s,0); if(at<0) return false; removeElementAt(at); return true; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param at index of where to remove a byte */ private void removeElementAt(int at) { // No point in removing elements that "don't exist"... if(at=m_map.length) { int newsize=index+m_numblocks; byte[][] newMap=new byte[newsize][]; System.arraycopy(m_map, 0, newMap, 0, m_map.length); m_map=newMap; } byte[] block=m_map[index]; if(null==block) block=m_map[index]=new byte[m_blocksize]; block[offset]=value; if(at>=m_firstFree) m_firstFree=at+1; } /** * Get the nth element. This is often at the innermost loop of an * application, so performance is critical. * * @param i index of value to get * * @return value at given index. If that value wasn't previously set, * the result is undefined for performance reasons. It may throw an * exception (see below), may return zero, or (if setSize has previously * been used) may return stale data. * * @throws ArrayIndexOutOfBoundsException if the index was _clearly_ * unreasonable (negative, or past the highest block). * * @throws NullPointerException if the index points to a block that could * have existed (based on the highest index used) but has never had anything * set into it. * %REVIEW% Could add a catch to create the block in that case, or return 0. * Try/Catch is _supposed_ to be nearly free when not thrown to. Do we * believe that? Should we have a separate safeElementAt? */ public byte elementAt(int i) { // %OPT% Does this really buy us anything? Test versus division for small, // test _plus_ division for big docs. if(i= 0); } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem object to look for * @param index Index of where to begin search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(byte elem, int index) { if(index>=m_firstFree) return -1; int bindex=index/m_blocksize; int boffset=index%m_blocksize; int maxindex=m_firstFree/m_blocksize; byte[] block; for(;bindex=0; --index) { byte[] block=m_map[index]; if(block!=null) for(int offset=boffset; offset>=0; --offset) if(block[offset]==elem) return offset+index*m_blocksize; boffset=0; // after first } return -1; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/LocaleUtility.java0000644000175000017500000000511010721374032023461 0ustar mkochmkoch /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LocaleUtility.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.Locale; /** * @author Igor Hersht, igorh@ca.ibm.com */ public class LocaleUtility { /** * IETF RFC 1766 tag separator */ public final static char IETF_SEPARATOR = '-'; public final static String EMPTY_STRING = ""; public static Locale langToLocale(String lang) { if((lang == null) || lang.equals(EMPTY_STRING)){ // not specified => getDefault return Locale.getDefault(); } String language = EMPTY_STRING; String country = EMPTY_STRING; String variant = EMPTY_STRING; int i1 = lang.indexOf(IETF_SEPARATOR); if (i1 < 0) { language = lang; } else { language = lang.substring(0, i1); ++i1; int i2 = lang.indexOf(IETF_SEPARATOR, i1); if (i2 < 0) { country = lang.substring(i1); } else { country = lang.substring(i1, i2); variant = lang.substring(i2+1); } } if(language.length() == 2){ language = language.toLowerCase(); }else { language = EMPTY_STRING; } if(country.length() == 2){ country = country.toUpperCase(); }else { country = EMPTY_STRING; } if((variant.length() > 0) && ((language.length() == 2) ||(country.length() == 2))){ variant = variant.toUpperCase(); }else{ variant = EMPTY_STRING; } return new Locale(language, country, variant ); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/ObjectStack.java0000644000175000017500000001157210721374033023104 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.utils; import java.util.EmptyStackException; /** * Implement a stack of simple integers. * * %OPT% * This is currently based on ObjectVector, which permits fast acess but pays a * heavy recopying penalty if/when its size is increased. If we expect deep * stacks, we should consider a version based on ChunkedObjectVector. * @xsl.usage internal */ public class ObjectStack extends ObjectVector { /** * Default constructor. Note that the default * block size is very small, for small lists. */ public ObjectStack() { super(); } /** * Construct a ObjectVector, using the given block size. * * @param blocksize Size of block to allocate */ public ObjectStack(int blocksize) { super(blocksize); } /** * Copy constructor for ObjectStack * * @param v ObjectStack to copy */ public ObjectStack (ObjectStack v) { super(v); } /** * Pushes an item onto the top of this stack. * * @param i the int to be pushed onto this stack. * @return the item argument. */ public Object push(Object i) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; Object newMap[] = new Object[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = i; m_firstFree++; return i; } /** * Removes the object at the top of this stack and returns that * object as the value of this function. * * @return The object at the top of this stack. */ public Object pop() { Object val = m_map[--m_firstFree]; m_map[m_firstFree] = null; return val; } /** * Quickly pops a number of items from the stack. */ public void quickPop(int n) { m_firstFree -= n; } /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public Object peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } /** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public Object peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } /** * Sets an object at a the top of the statck * * * @param val object to set at the top * @throws EmptyStackException if this stack is empty. */ public void setTop(Object val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } /** * Tests if this stack is empty. * * @return true if this stack is empty; * false otherwise. * @since JDK1.0 */ public boolean empty() { return m_firstFree == 0; } /** * Returns where an object is on this stack. * * @param o the desired object. * @return the distance from the top of the stack where the object is] * located; the return value -1 indicates that the * object is not on the stack. * @since JDK1.0 */ public int search(Object o) { int i = lastIndexOf(o); if (i >= 0) { return size() - i; } return -1; } /** * Returns clone of current ObjectStack * * @return clone of current ObjectStack */ public Object clone() throws CloneNotSupportedException { return (ObjectStack) super.clone(); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/DOM2Helper.java0000644000175000017500000002516210721374030022546 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM2Helper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.InputSource; /** * @deprecated Since the introduction of the DTM, this class will be removed. * This class provides a DOM level 2 "helper", which provides services currently * not provided be the DOM standard. */ public class DOM2Helper extends DOMHelper { /** * Construct an instance. */ public DOM2Helper(){} /** * Check node to see if it was created by a DOM implementation * that this helper is intended to support. This is currently * disabled, and assumes all nodes are acceptable rather than checking * that they implement org.apache.xerces.dom.NodeImpl. * * @param node The node to be tested. * * @throws TransformerException if the node is not one which this * DOM2Helper can support. If we return without throwing the exception, * the node is compatable. * @xsl.usage internal */ public void checkNode(Node node) throws TransformerException { // if(!(node instanceof org.apache.xerces.dom.NodeImpl)) // throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XERCES_CANNOT_HANDLE_NODES, new Object[]{((Object)node).getClass()})); //"DOM2Helper can not handle nodes of type" //+((Object)node).getClass()); } /** * Returns true if the DOM implementation handled by this helper * supports the SAX ContentHandler interface. * * @return true (since Xerces does). */ public boolean supportsSAX() { return true; } /** Field m_doc: Document Node for the document this helper is currently * accessing or building * @see #setDocument * @see #getDocument * */ private Document m_doc; /** * Specify which document this helper is currently operating on. * * @param doc The DOM Document node for this document. * @see #getDocument */ public void setDocument(Document doc) { m_doc = doc; } /** * Query which document this helper is currently operating on. * * @return The DOM Document node for this document. * @see #setDocument */ public Document getDocument() { return m_doc; } /** * Parse an XML document. * *

    Right now the Xerces DOMParser class is used. This needs * fixing, either via jaxp, or via some other, standard method.

    * *

    The application can use this method to instruct the SAX parser * to begin parsing an XML document from any valid input * source (a character stream, a byte stream, or a URI).

    * *

    Applications may not invoke this method while a parse is in * progress (they should create a new Parser instead for each * additional XML document). Once a parse is complete, an * application may reuse the same Parser object, possibly with a * different input source.

    * * @param source The input source for the top-level of the * XML document. * * @throws TransformerException if any checked exception is thrown. * @xsl.usage internal */ public void parse(InputSource source) throws TransformerException { try { // I guess I should use JAXP factory here... when it's legal. // org.apache.xerces.parsers.DOMParser parser // = new org.apache.xerces.parsers.DOMParser(); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); builderFactory.setNamespaceAware(true); builderFactory.setValidating(true); DocumentBuilder parser = builderFactory.newDocumentBuilder(); /* // domParser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", getShouldExpandEntityRefs()? false : true); if(m_useDOM2getNamespaceURI) { parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true); parser.setFeature("http://xml.org/sax/features/namespaces", true); } else { parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); } parser.setFeature("http://apache.org/xml/features/allow-java-encodings", true); */ parser.setErrorHandler( new org.apache.xml.utils.DefaultErrorHandler()); // if(null != m_entityResolver) // { // System.out.println("Setting the entity resolver."); // parser.setEntityResolver(m_entityResolver); // } setDocument(parser.parse(source)); } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } catch (ParserConfigurationException pce) { throw new TransformerException(pce); } catch (IOException ioe) { throw new TransformerException(ioe); } // setDocument(((org.apache.xerces.parsers.DOMParser)parser).getDocument()); } /** * Given an XML ID, return the element. This requires assistance from the * DOM and parser, and is meaningful only in the context of a DTD * or schema which declares attributes as being of type ID. This * information may or may not be available in all parsers, may or * may not be available for specific documents, and may or may not * be available when validation is not turned on. * * @param id The ID to search for, as a String. * @param doc The document to search within, as a DOM Document node. * @return DOM Element node with an attribute of type ID whose value * uniquely matches the requested id string, or null if there isn't * such an element or if the DOM can't answer the question for other * reasons. */ public Element getElementByID(String id, Document doc) { return doc.getElementById(id); } /** * Figure out whether node2 should be considered as being later * in the document than node1, in Document Order as defined * by the XPath model. This may not agree with the ordering defined * by other XML applications. *

    * There are some cases where ordering isn't defined, and neither are * the results of this function -- though we'll generally return true. *

    * TODO: Make sure this does the right thing with attribute nodes!!! * * @param node1 DOM Node to perform position comparison on. * @param node2 DOM Node to perform position comparison on . * * @return false if node2 comes before node1, otherwise return true. * You can think of this as * (node1.documentOrderPosition <= node2.documentOrderPosition). */ public static boolean isNodeAfter(Node node1, Node node2) { // Assume first that the nodes are DTM nodes, since discovering node // order is massivly faster for the DTM. if(node1 instanceof DOMOrder && node2 instanceof DOMOrder) { int index1 = ((DOMOrder) node1).getUid(); int index2 = ((DOMOrder) node2).getUid(); return index1 <= index2; } else { // isNodeAfter will return true if node is after countedNode // in document order. The base isNodeAfter is sloooow (relatively). return DOMHelper.isNodeAfter(node1, node2); } } /** * Get the XPath-model parent of a node. This version takes advantage * of the DOM Level 2 Attr.ownerElement() method; the base version we * would otherwise inherit is prepared to fall back on exhaustively * walking the document to find an Attr's parent. * * @param node Node to be examined * * @return the DOM parent of the input node, if there is one, or the * ownerElement if the input node is an Attr, or null if the node is * a Document, a DocumentFragment, or an orphan. */ public static Node getParentOfNode(Node node) { Node parent=node.getParentNode(); if(parent==null && (Node.ATTRIBUTE_NODE == node.getNodeType()) ) parent=((Attr) node).getOwnerElement(); return parent; } /** * Returns the local name of the given node, as defined by the * XML Namespaces specification. This is prepared to handle documents * built using DOM Level 1 methods by falling back upon explicitly * parsing the node name. * * @param n Node to be examined * * @return String containing the local name, or null if the node * was not assigned a Namespace. */ public String getLocalNameOfNode(Node n) { String name = n.getLocalName(); return (null == name) ? super.getLocalNameOfNode(n) : name; } /** * Returns the Namespace Name (Namespace URI) for the given node. * In a Level 2 DOM, you can ask the node itself. Note, however, that * doing so conflicts with our decision in getLocalNameOfNode not * to trust the that the DOM was indeed created using the Level 2 * methods. If Level 1 methods were used, these two functions will * disagree with each other. *

    * TODO: Reconcile with getLocalNameOfNode. * * @param n Node to be examined * * @return String containing the Namespace URI bound to this DOM node * at the time the Node was created. */ public String getNamespaceOfNode(Node n) { return n.getNamespaceURI(); } /** Field m_useDOM2getNamespaceURI is a compile-time flag which * gates some of the parser options used to build a DOM -- but * that code is commented out at this time and nobody else * references it, so I've commented this out as well. */ //private boolean m_useDOM2getNamespaceURI = false; } libxalan2-java-2.7.1/src/org/apache/xml/utils/StylesheetPIHandler.java0000644000175000017500000002550510721374033024571 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StylesheetPIHandler.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.sax.SAXSource; import org.apache.xml.utils.SystemIDResolver; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; /** * Search for the xml-stylesheet processing instructions in an XML document. * @see Associating Style Sheets with XML documents, Version 1.0 */ public class StylesheetPIHandler extends DefaultHandler { /** The baseID of the document being processed. */ String m_baseID; /** The desired media criteria. */ String m_media; /** The desired title criteria. */ String m_title; /** The desired character set criteria. */ String m_charset; /** A list of SAXSource objects that match the criteria. */ Vector m_stylesheets = new Vector(); // Add code to use a URIResolver. Patch from Dmitri Ilyin. /** * The object that implements the URIResolver interface, * or null. */ URIResolver m_uriResolver; /** * Get the object that will be used to resolve URIs in href * in xml-stylesheet processing instruction. * * @param resolver An object that implements the URIResolver interface, * or null. */ public void setURIResolver(URIResolver resolver) { m_uriResolver = resolver; } /** * Get the object that will be used to resolve URIs in href * in xml-stylesheet processing instruction. * * @return The URIResolver that was set with setURIResolver. */ public URIResolver getURIResolver() { return m_uriResolver; } /** * Construct a StylesheetPIHandler instance that will search * for xml-stylesheet PIs based on the given criteria. * * @param baseID The base ID of the XML document, needed to resolve * relative IDs. * @param media The desired media criteria. * @param title The desired title criteria. * @param charset The desired character set criteria. */ public StylesheetPIHandler(String baseID, String media, String title, String charset) { m_baseID = baseID; m_media = media; m_title = title; m_charset = charset; } /** * Return the last stylesheet found that match the constraints. * * @return Source object that references the last stylesheet reference * that matches the constraints. */ public Source getAssociatedStylesheet() { int sz = m_stylesheets.size(); if (sz > 0) { Source source = (Source) m_stylesheets.elementAt(sz-1); return source; } else return null; } /** * Handle the xml-stylesheet processing instruction. * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction * @see Associating Style Sheets with XML documents, Version 1.0 */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { if (target.equals("xml-stylesheet")) { String href = null; // CDATA #REQUIRED String type = null; // CDATA #REQUIRED String title = null; // CDATA #IMPLIED String media = null; // CDATA #IMPLIED String charset = null; // CDATA #IMPLIED boolean alternate = false; // (yes|no) "no" StringTokenizer tokenizer = new StringTokenizer(data, " \t=\n", true); boolean lookedAhead = false; Source source = null; String token = ""; while (tokenizer.hasMoreTokens()) { if (!lookedAhead) token = tokenizer.nextToken(); else lookedAhead = false; if (tokenizer.hasMoreTokens() && (token.equals(" ") || token.equals("\t") || token.equals("="))) continue; String name = token; if (name.equals("type")) { token = tokenizer.nextToken(); while (tokenizer.hasMoreTokens() && (token.equals(" " ) || token.equals("\t") || token.equals("="))) token = tokenizer.nextToken(); type = token.substring(1, token.length() - 1); } else if (name.equals("href")) { token = tokenizer.nextToken(); while (tokenizer.hasMoreTokens() && (token.equals(" " ) || token.equals("\t") || token.equals("="))) token = tokenizer.nextToken(); href = token; if (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); // If the href value has parameters to be passed to a // servlet(something like "foobar?id=12..."), // we want to make sure we get them added to // the href value. Without this check, we would move on // to try to process another attribute and that would be // wrong. // We need to set lookedAhead here to flag that we // already have the next token. while ( token.equals("=") && tokenizer.hasMoreTokens()) { href = href + token + tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); lookedAhead = true; } else { break; } } } href = href.substring(1, href.length() - 1); try { // Add code to use a URIResolver. Patch from Dmitri Ilyin. if (m_uriResolver != null) { source = m_uriResolver.resolve(href, m_baseID); } else { href = SystemIDResolver.getAbsoluteURI(href, m_baseID); source = new SAXSource(new InputSource(href)); } } catch(TransformerException te) { throw new org.xml.sax.SAXException(te); } } else if (name.equals("title")) { token = tokenizer.nextToken(); while (tokenizer.hasMoreTokens() && (token.equals(" " ) || token.equals("\t") || token.equals("="))) token = tokenizer.nextToken(); title = token.substring(1, token.length() - 1); } else if (name.equals("media")) { token = tokenizer.nextToken(); while (tokenizer.hasMoreTokens() && (token.equals(" " ) || token.equals("\t") || token.equals("="))) token = tokenizer.nextToken(); media = token.substring(1, token.length() - 1); } else if (name.equals("charset")) { token = tokenizer.nextToken(); while (tokenizer.hasMoreTokens() && (token.equals(" " ) || token.equals("\t") || token.equals("="))) token = tokenizer.nextToken(); charset = token.substring(1, token.length() - 1); } else if (name.equals("alternate")) { token = tokenizer.nextToken(); while (tokenizer.hasMoreTokens() && (token.equals(" " ) || token.equals("\t") || token.equals("="))) token = tokenizer.nextToken(); alternate = token.substring(1, token.length() - 1).equals("yes"); } } if ((null != type) && (type.equals("text/xsl") || type.equals("text/xml") || type.equals("application/xml+xslt")) && (null != href)) { if (null != m_media) { if (null != media) { if (!media.equals(m_media)) return; } else return; } if (null != m_charset) { if (null != charset) { if (!charset.equals(m_charset)) return; } else return; } if (null != m_title) { if (null != title) { if (!title.equals(m_title)) return; } else return; } m_stylesheets.addElement(source); } } } /** * The spec notes that "The xml-stylesheet processing instruction is allowed only in the prolog of an XML document.", * so, at least for right now, I'm going to go ahead an throw a TransformerException * in order to stop the parse. * * @param namespaceURI The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param qName The qualified name (with prefix). * @param atts The specified or defaulted attributes. * * @throws StopParseException since there can be no valid xml-stylesheet processing * instructions past the first element. */ public void startElement( String namespaceURI, String localName, String qName, Attributes atts) throws org.xml.sax.SAXException { throw new StopParseException(); } /** * Added additional getter and setter methods for the Base Id * to fix bugzilla bug 24187 * */ public void setBaseId(String baseId) { m_baseID = baseId; } public String getBaseId() { return m_baseID ; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/NamespaceSupport2.java0000644000175000017500000006146310721374031024265 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NamespaceSupport2.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.EmptyStackException; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; /** * Encapsulate Namespace tracking logic for use by SAX drivers. * *

    This class is an attempt to rewrite the SAX NamespaceSupport * "helper" class for improved efficiency. It can be used to track the * namespace declarations currently in scope, providing lookup * routines to map prefixes to URIs and vice versa.

    * *

    ISSUE: For testing purposes, I've extended NamespaceSupport even * though I'm completely reasserting all behaviors and fields. * Wasteful.... But SAX did not put an interface under that object and * we seem to have written that SAX class into our APIs... and I don't * want to argue with it right now.

    * * @see org.xml.sax.helpers.NamespaceSupport * */ public class NamespaceSupport2 extends org.xml.sax.helpers.NamespaceSupport { //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// private Context2 currentContext; // Current point on the double-linked stack //////////////////////////////////////////////////////////////////// // Constants. //////////////////////////////////////////////////////////////////// /** * The XML Namespace as a constant. * *

    This is the Namespace URI that is automatically mapped * to the "xml" prefix.

    */ public final static String XMLNS = "http://www.w3.org/XML/1998/namespace"; //////////////////////////////////////////////////////////////////// // Constructor. //////////////////////////////////////////////////////////////////// /** * Create a new Namespace support object. */ public NamespaceSupport2 () { reset(); } //////////////////////////////////////////////////////////////////// // Context management. //////////////////////////////////////////////////////////////////// /** * Reset this Namespace support object for reuse. * *

    It is necessary to invoke this method before reusing the * Namespace support object for a new session.

    */ public void reset () { // Discarding the whole stack doesn't save us a lot versus // creating a new NamespaceSupport. Do we care, or should we // change this to just reset the root context? currentContext = new Context2(null); currentContext.declarePrefix("xml", XMLNS); } /** * Start a new Namespace context. * *

    Normally, you should push a new context at the beginning * of each XML element: the new context will automatically inherit * the declarations of its parent context, but it will also keep * track of which declarations were made within this context.

    * *

    The Namespace support object always starts with a base context * already in force: in this context, only the "xml" prefix is * declared.

    * * @see #popContext */ public void pushContext () { // JJK: Context has a parent pointer. // That means we don't need a stack to pop. // We may want to retain for reuse, but that can be done via // a child pointer. Context2 parentContext=currentContext; currentContext = parentContext.getChild(); if (currentContext == null){ currentContext = new Context2(parentContext); } else{ // JJK: This will wipe out any leftover data // if we're reusing a previously allocated Context. currentContext.setParent(parentContext); } } /** * Revert to the previous Namespace context. * *

    Normally, you should pop the context at the end of each * XML element. After popping the context, all Namespace prefix * mappings that were previously in force are restored.

    * *

    You must not attempt to declare additional Namespace * prefixes after popping a context, unless you push another * context first.

    * * @see #pushContext */ public void popContext () { Context2 parentContext=currentContext.getParent(); if(parentContext==null) throw new EmptyStackException(); else currentContext = parentContext; } //////////////////////////////////////////////////////////////////// // Operations within a context. //////////////////////////////////////////////////////////////////// /** * Declare a Namespace prefix. * *

    This method declares a prefix in the current Namespace * context; the prefix will remain in force until this context * is popped, unless it is shadowed in a descendant context.

    * *

    To declare a default Namespace, use the empty string. The * prefix must not be "xml" or "xmlns".

    * *

    Note that you must not declare a prefix after * you've pushed and popped another Namespace.

    * *

    Note that there is an asymmetry in this library: while {@link * #getPrefix getPrefix} will not return the default "" prefix, * even if you have declared one; to check for a default prefix, * you have to look it up explicitly using {@link #getURI getURI}. * This asymmetry exists to make it easier to look up prefixes * for attribute names, where the default prefix is not allowed.

    * * @param prefix The prefix to declare, or null for the empty * string. * @param uri The Namespace URI to associate with the prefix. * @return true if the prefix was legal, false otherwise * @see #processName * @see #getURI * @see #getPrefix */ public boolean declarePrefix (String prefix, String uri) { if (prefix.equals("xml") || prefix.equals("xmlns")) { return false; } else { currentContext.declarePrefix(prefix, uri); return true; } } /** * Process a raw XML 1.0 name. * *

    This method processes a raw XML 1.0 name in the current * context by removing the prefix and looking it up among the * prefixes currently declared. The return value will be the * array supplied by the caller, filled in as follows:

    * *
    *
    parts[0]
    *
    The Namespace URI, or an empty string if none is * in use.
    *
    parts[1]
    *
    The local name (without prefix).
    *
    parts[2]
    *
    The original raw name.
    *
    * *

    All of the strings in the array will be internalized. If * the raw name has a prefix that has not been declared, then * the return value will be null.

    * *

    Note that attribute names are processed differently than * element names: an unprefixed element name will received the * default Namespace (if any), while an unprefixed element name * will not.

    * * @param qName The raw XML 1.0 name to be processed. * @param parts A string array supplied by the caller, capable of * holding at least three members. * @param isAttribute A flag indicating whether this is an * attribute name (true) or an element name (false). * @return The supplied array holding three internalized strings * representing the Namespace URI (or empty string), the * local name, and the raw XML 1.0 name; or null if there * is an undeclared prefix. * @see #declarePrefix * @see java.lang.String#intern */ public String [] processName (String qName, String[] parts, boolean isAttribute) { String[] name=currentContext.processName(qName, isAttribute); if(name==null) return null; // JJK: This recopying is required because processName may return // a cached result. I Don't Like It. ***** System.arraycopy(name,0,parts,0,3); return parts; } /** * Look up a prefix and get the currently-mapped Namespace URI. * *

    This method looks up the prefix in the current context. * Use the empty string ("") for the default Namespace.

    * * @param prefix The prefix to look up. * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. * @see #getPrefix * @see #getPrefixes */ public String getURI (String prefix) { return currentContext.getURI(prefix); } /** * Return an enumeration of all prefixes currently declared. * *

    Note: if there is a default prefix, it will not be * returned in this enumeration; check for the default prefix * using the {@link #getURI getURI} with an argument of "".

    * * @return An enumeration of all prefixes declared in the * current context except for the empty (default) * prefix. * @see #getDeclaredPrefixes * @see #getURI */ public Enumeration getPrefixes () { return currentContext.getPrefixes(); } /** * Return one of the prefixes mapped to a Namespace URI. * *

    If more than one prefix is currently mapped to the same * URI, this method will make an arbitrary selection; if you * want all of the prefixes, use the {@link #getPrefixes} * method instead.

    * *

    Note: this will never return the empty * (default) prefix; to check for a default prefix, use the {@link * #getURI getURI} method with an argument of "".

    * * @param uri The Namespace URI. * @return One of the prefixes currently mapped to the URI supplied, * or null if none is mapped or if the URI is assigned to * the default Namespace. * @see #getPrefixes(java.lang.String) * @see #getURI */ public String getPrefix (String uri) { return currentContext.getPrefix(uri); } /** * Return an enumeration of all prefixes currently declared for a URI. * *

    This method returns prefixes mapped to a specific Namespace * URI. The xml: prefix will be included. If you want only one * prefix that's mapped to the Namespace URI, and you don't care * which one you get, use the {@link #getPrefix getPrefix} * method instead.

    * *

    Note: the empty (default) prefix is * never included in this enumeration; to check for the * presence of a default Namespace, use the {@link #getURI getURI} * method with an argument of "".

    * * @param uri The Namespace URI. * @return An enumeration of all prefixes declared in the * current context. * @see #getPrefix * @see #getDeclaredPrefixes * @see #getURI */ public Enumeration getPrefixes (String uri) { // JJK: The old code involved creating a vector, filling it // with all the matching prefixes, and then getting its // elements enumerator. Wastes storage, wastes cycles if we // don't actually need them all. Better to either implement // a specific enumerator for these prefixes... or a filter // around the all-prefixes enumerator, which comes out to // roughly the same thing. // // **** Currently a filter. That may not be most efficient // when I'm done restructuring storage! return new PrefixForUriEnumerator(this,uri,getPrefixes()); } /** * Return an enumeration of all prefixes declared in this context. * *

    The empty (default) prefix will be included in this * enumeration; note that this behaviour differs from that of * {@link #getPrefix} and {@link #getPrefixes}.

    * * @return An enumeration of all prefixes declared in this * context. * @see #getPrefixes * @see #getURI */ public Enumeration getDeclaredPrefixes () { return currentContext.getDeclaredPrefixes(); } } //////////////////////////////////////////////////////////////////// // Local classes. // These were _internal_ classes... but in fact they don't have to be, // and may be more efficient if they aren't. //////////////////////////////////////////////////////////////////// /** * Implementation of Enumeration filter, wrapped * aroung the get-all-prefixes version of the operation. This is NOT * necessarily the most efficient approach; finding the URI and then asking * what prefixes apply to it might make much more sense. */ class PrefixForUriEnumerator implements Enumeration { private Enumeration allPrefixes; private String uri; private String lookahead=null; private NamespaceSupport2 nsup; // Kluge: Since one can't do a constructor on an // anonymous class (as far as I know)... PrefixForUriEnumerator(NamespaceSupport2 nsup,String uri, Enumeration allPrefixes) { this.nsup=nsup; this.uri=uri; this.allPrefixes=allPrefixes; } public boolean hasMoreElements() { if(lookahead!=null) return true; while(allPrefixes.hasMoreElements()) { String prefix=(String)allPrefixes.nextElement(); if(uri.equals(nsup.getURI(prefix))) { lookahead=prefix; return true; } } return false; } public Object nextElement() { if(hasMoreElements()) { String tmp=lookahead; lookahead=null; return tmp; } else throw new java.util.NoSuchElementException(); } } /** * Internal class for a single Namespace context. * *

    This module caches and reuses Namespace contexts, so the number allocated * will be equal to the element depth of the document, not to the total * number of elements (i.e. 5-10 rather than tens of thousands).

    */ final class Context2 { //////////////////////////////////////////////////////////////// // Manefest Constants //////////////////////////////////////////////////////////////// /** * An empty enumeration. */ private final static Enumeration EMPTY_ENUMERATION = new Vector().elements(); //////////////////////////////////////////////////////////////// // Protected state. //////////////////////////////////////////////////////////////// Hashtable prefixTable; Hashtable uriTable; Hashtable elementNameTable; Hashtable attributeNameTable; String defaultNS = null; //////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////// private Vector declarations = null; private boolean tablesDirty = false; private Context2 parent = null; private Context2 child = null; /** * Create a new Namespace context. */ Context2 (Context2 parent) { if(parent==null) { prefixTable = new Hashtable(); uriTable = new Hashtable(); elementNameTable=null; attributeNameTable=null; } else setParent(parent); } /** * @returns The child Namespace context object, or null if this * is the last currently on the chain. */ Context2 getChild() { return child; } /** * @returns The parent Namespace context object, or null if this * is the root. */ Context2 getParent() { return parent; } /** * (Re)set the parent of this Namespace context. * This is separate from the c'tor because it's re-applied * when a Context2 is reused by push-after-pop. * * @param context The parent Namespace context object. */ void setParent (Context2 parent) { this.parent = parent; parent.child = this; // JJK: Doubly-linked declarations = null; prefixTable = parent.prefixTable; uriTable = parent.uriTable; elementNameTable = parent.elementNameTable; attributeNameTable = parent.attributeNameTable; defaultNS = parent.defaultNS; tablesDirty = false; } /** * Declare a Namespace prefix for this context. * * @param prefix The prefix to declare. * @param uri The associated Namespace URI. * @see org.xml.sax.helpers.NamespaceSupport2#declarePrefix */ void declarePrefix (String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new Vector(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.addElement(prefix); } /** * Process a raw XML 1.0 name in this context. * * @param qName The raw XML 1.0 name. * @param isAttribute true if this is an attribute name. * @return An array of three strings containing the * URI part (or empty string), the local part, * and the raw name, all internalized, or null * if there is an undeclared prefix. * @see org.xml.sax.helpers.NamespaceSupport2#processName */ String [] processName (String qName, boolean isAttribute) { String name[]; Hashtable table; // Select the appropriate table. if (isAttribute) { if(elementNameTable==null) elementNameTable=new Hashtable(); table = elementNameTable; } else { if(attributeNameTable==null) attributeNameTable=new Hashtable(); table = attributeNameTable; } // Start by looking in the cache, and // return immediately if the name // is already known in this content name = (String[])table.get(qName); if (name != null) { return name; } // We haven't seen this name in this // context before. name = new String[3]; int index = qName.indexOf(':'); // No prefix. if (index == -1) { if (isAttribute || defaultNS == null) { name[0] = ""; } else { name[0] = defaultNS; } name[1] = qName.intern(); name[2] = name[1]; } // Prefix else { String prefix = qName.substring(0, index); String local = qName.substring(index+1); String uri; if ("".equals(prefix)) { uri = defaultNS; } else { uri = (String)prefixTable.get(prefix); } if (uri == null) { return null; } name[0] = uri; name[1] = local.intern(); name[2] = qName.intern(); } // Save in the cache for future use. table.put(name[2], name); tablesDirty = true; return name; } /** * Look up the URI associated with a prefix in this context. * * @param prefix The prefix to look up. * @return The associated Namespace URI, or null if none is * declared. * @see org.xml.sax.helpers.NamespaceSupport2#getURI */ String getURI (String prefix) { if ("".equals(prefix)) { return defaultNS; } else if (prefixTable == null) { return null; } else { return (String)prefixTable.get(prefix); } } /** * Look up one of the prefixes associated with a URI in this context. * *

    Since many prefixes may be mapped to the same URI, * the return value may be unreliable.

    * * @param uri The URI to look up. * @return The associated prefix, or null if none is declared. * @see org.xml.sax.helpers.NamespaceSupport2#getPrefix */ String getPrefix (String uri) { if (uriTable == null) { return null; } else { return (String)uriTable.get(uri); } } /** * Return an enumeration of prefixes declared in this context. * * @return An enumeration of prefixes (possibly empty). * @see org.xml.sax.helpers.NamespaceSupport2#getDeclaredPrefixes */ Enumeration getDeclaredPrefixes () { if (declarations == null) { return EMPTY_ENUMERATION; } else { return declarations.elements(); } } /** * Return an enumeration of all prefixes currently in force. * *

    The default prefix, if in force, is not * returned, and will have to be checked for separately.

    * * @return An enumeration of prefixes (never empty). * @see org.xml.sax.helpers.NamespaceSupport2#getPrefixes */ Enumeration getPrefixes () { if (prefixTable == null) { return EMPTY_ENUMERATION; } else { return prefixTable.keys(); } } //////////////////////////////////////////////////////////////// // Internal methods. //////////////////////////////////////////////////////////////// /** * Copy on write for the internal tables in this context. * *

    This class is optimized for the normal case where most * elements do not contain Namespace declarations. In that case, * the Context2 will share data structures with its parent. * New tables are obtained only when new declarations are issued, * so they can be popped off the stack.

    * *

    JJK: **** Alternative: each Context2 might declare * _only_ its local bindings, and delegate upward if not found.

    */ private void copyTables () { // Start by copying our parent's bindings prefixTable = (Hashtable)prefixTable.clone(); uriTable = (Hashtable)uriTable.clone(); // Replace the caches with empty ones, rather than // trying to determine which bindings should be flushed. // As far as I can tell, these caches are never actually // used in Xalan... More efficient to remove the whole // cache system? **** if(elementNameTable!=null) elementNameTable=new Hashtable(); if(attributeNameTable!=null) attributeNameTable=new Hashtable(); tablesDirty = true; } } // end of NamespaceSupport2.java libxalan2-java-2.7.1/src/org/apache/xml/utils/StringBufferPool.java0000644000175000017500000000401110721374033024130 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringBufferPool.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * This class pools string buffers, since they are reused so often. * String buffers are good candidates for pooling, because of * their supporting character arrays. * @xsl.usage internal */ public class StringBufferPool { /** The global pool of string buffers. */ private static ObjectPool m_stringBufPool = new ObjectPool(org.apache.xml.utils.FastStringBuffer.class); /** * Get the first free instance of a string buffer, or create one * if there are no free instances. * * @return A string buffer ready for use. */ public synchronized static FastStringBuffer get() { return (FastStringBuffer) m_stringBufPool.getInstance(); } /** * Return a string buffer back to the pool. * * @param sb Must be a non-null reference to a string buffer. */ public synchronized static void free(FastStringBuffer sb) { // Since this isn't synchronized, setLength must be // done before the instance is freed. // Fix attributed to Peter Speck . sb.setLength(0); m_stringBufPool.freeInstance(sb); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/ObjectPool.java0000644000175000017500000001035510721374030022743 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectPool.java 475981 2006-11-16 23:35:53Z minchau $ */ package org.apache.xml.utils; import java.util.ArrayList; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; /** * Pool of object of a given type to pick from to help memory usage * @xsl.usage internal */ public class ObjectPool implements java.io.Serializable { static final long serialVersionUID = -8519013691660936643L; /** Type of objects in this pool. * @serial */ private final Class objectType; /** Stack of given objects this points to. * @serial */ private final ArrayList freeStack; /** * Constructor ObjectPool * * @param type Type of objects for this pool */ public ObjectPool(Class type) { objectType = type; freeStack = new ArrayList(); } /** * Constructor ObjectPool * * @param className Fully qualified name of the type of objects for this pool. */ public ObjectPool(String className) { try { objectType = ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); } catch(ClassNotFoundException cnfe) { throw new WrappedRuntimeException(cnfe); } freeStack = new ArrayList(); } /** * Constructor ObjectPool * * * @param type Type of objects for this pool * @param size Size of vector to allocate */ public ObjectPool(Class type, int size) { objectType = type; freeStack = new ArrayList(size); } /** * Constructor ObjectPool * */ public ObjectPool() { objectType = null; freeStack = new ArrayList(); } /** * Get an instance of the given object in this pool if available * * * @return an instance of the given object if available or null */ public synchronized Object getInstanceIfFree() { // Check if the pool is empty. if (!freeStack.isEmpty()) { // Remove object from end of free pool. Object result = freeStack.remove(freeStack.size() - 1); return result; } return null; } /** * Get an instance of the given object in this pool * * * @return An instance of the given object */ public synchronized Object getInstance() { // Check if the pool is empty. if (freeStack.isEmpty()) { // Create a new object if so. try { return objectType.newInstance(); } catch (InstantiationException ex){} catch (IllegalAccessException ex){} // Throw unchecked exception for error in pool configuration. throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_EXCEPTION_CREATING_POOL, null)); //"exception creating new instance for pool"); } else { // Remove object from end of free pool. Object result = freeStack.remove(freeStack.size() - 1); return result; } } /** * Add an instance of the given object to the pool * * * @param obj Object to add. */ public synchronized void freeInstance(Object obj) { // Make sure the object is of the correct type. // Remove safety. -sb // if (objectType.isInstance(obj)) // { freeStack.add(obj); // } // else // { // throw new IllegalArgumentException("argument type invalid for pool"); // } } } libxalan2-java-2.7.1/src/org/apache/xml/utils/PrefixResolver.java0000644000175000017500000000553010721374031023662 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PrefixResolver.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * The class that implements this interface can resolve prefixes to * namespaces. Examples would include resolving the meaning of a * prefix at a particular point in a document, or mapping the prefixes * used in an XPath expression. * @xsl.usage advanced */ public interface PrefixResolver { /** * Given a namespace, get the corrisponding prefix. This assumes that * the PrefixResolver holds its own namespace context, or is a namespace * context itself. * * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. * * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. */ String getNamespaceForPrefix(String prefix); /** * Given a namespace, get the corresponding prefix, based on the context node. * * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. * @param context The node context from which to look up the URI. * * @return The associated Namespace URI as a string, or null if the prefix * is undeclared in this context. */ String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context); /** * Return the base identifier. * * @return The base identifier from where relative URIs should be absolutized, or null * if the base ID is unknown. *

    * CAVEAT: Note that the base URI in an XML document may vary with where * you are in the document, if part of the doc's contents were brought in * via an external entity reference or if mechanisms such as xml:base have * been used. Unless this PrefixResolver is bound to a specific portion of * the document, or has been kept up to date via some other mechanism, it * may not accurately reflect that context information. */ public String getBaseIdentifier(); public boolean handlesNullPrefixes(); } libxalan2-java-2.7.1/src/org/apache/xml/utils/FastStringBuffer.java0000644000175000017500000012652710721374032024134 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FastStringBuffer.java 469279 2006-10-30 21:18:02Z minchau $ */ package org.apache.xml.utils; /** * Bare-bones, unsafe, fast string buffer. No thread-safety, no * parameter range checking, exposed fields. Note that in typical * applications, thread-safety of a StringBuffer is a somewhat * dubious concept in any case. *

    * Note that Stree and DTM used a single FastStringBuffer as a string pool, * by recording start and length indices within this single buffer. This * minimizes heap overhead, but of course requires more work when retrieving * the data. *

    * FastStringBuffer operates as a "chunked buffer". Doing so * reduces the need to recopy existing information when an append * exceeds the space available; we just allocate another chunk and * flow across to it. (The array of chunks may need to grow, * admittedly, but that's a much smaller object.) Some excess * recopying may arise when we extract Strings which cross chunk * boundaries; larger chunks make that less frequent. *

    * The size values are parameterized, to allow tuning this code. In * theory, Result Tree Fragments might want to be tuned differently * from the main document's text. *

    * %REVIEW% An experiment in self-tuning is * included in the code (using nested FastStringBuffers to achieve * variation in chunk sizes), but this implementation has proven to * be problematic when data may be being copied from the FSB into itself. * We should either re-architect that to make this safe (if possible) * or remove that code and clean up for performance/maintainability reasons. *

    */ public class FastStringBuffer { // If nonzero, forces the inial chunk size. /**/static final int DEBUG_FORCE_INIT_BITS=0; // %BUG% %REVIEW% *****PROBLEM SUSPECTED: If data from an FSB is being copied // back into the same FSB (variable set from previous variable, for example) // and blocksize changes in mid-copy... there's risk of severe malfunction in // the read process, due to how the resizing code re-jiggers storage. Arggh. // If we want to retain the variable-size-block feature, we need to reconsider // that issue. For now, I have forced us into fixed-size mode. static final boolean DEBUG_FORCE_FIXED_CHUNKSIZE=true; /** Manifest constant: Suppress leading whitespace. * This should be used when normalize-to-SAX is called for the first chunk of a * multi-chunk output, or one following unsuppressed whitespace in a previous * chunk. * @see #sendNormalizedSAXcharacters(org.xml.sax.ContentHandler,int,int) */ public static final int SUPPRESS_LEADING_WS=0x01; /** Manifest constant: Suppress trailing whitespace. * This should be used when normalize-to-SAX is called for the last chunk of a * multi-chunk output; it may have to be or'ed with SUPPRESS_LEADING_WS. */ public static final int SUPPRESS_TRAILING_WS=0x02; /** Manifest constant: Suppress both leading and trailing whitespace. * This should be used when normalize-to-SAX is called for a complete string. * (I'm not wild about the name of this one. Ideas welcome.) * @see #sendNormalizedSAXcharacters(org.xml.sax.ContentHandler,int,int) */ public static final int SUPPRESS_BOTH = SUPPRESS_LEADING_WS | SUPPRESS_TRAILING_WS; /** Manifest constant: Carry trailing whitespace of one chunk as leading * whitespace of the next chunk. Used internally; I don't see any reason * to make it public right now. */ private static final int CARRY_WS=0x04; /** * Field m_chunkBits sets our chunking strategy, by saying how many * bits of index can be used within a single chunk before flowing over * to the next chunk. For example, if m_chunkbits is set to 15, each * chunk can contain up to 2^15 (32K) characters */ int m_chunkBits = 15; /** * Field m_maxChunkBits affects our chunk-growth strategy, by saying what * the largest permissible chunk size is in this particular FastStringBuffer * hierarchy. */ int m_maxChunkBits = 15; /** * Field m_rechunkBits affects our chunk-growth strategy, by saying how * many chunks should be allocated at one size before we encapsulate them * into the first chunk of the next size up. For example, if m_rechunkBits * is set to 3, then after 8 chunks at a given size we will rebundle * them as the first element of a FastStringBuffer using a chunk size * 8 times larger (chunkBits shifted left three bits). */ int m_rebundleBits = 2; /** * Field m_chunkSize establishes the maximum size of one chunk of the array * as 2**chunkbits characters. * (Which may also be the minimum size if we aren't tuning for storage) */ int m_chunkSize; // =1<<(m_chunkBits-1); /** * Field m_chunkMask is m_chunkSize-1 -- in other words, m_chunkBits * worth of low-order '1' bits, useful for shift-and-mask addressing * within the chunks. */ int m_chunkMask; // =m_chunkSize-1; /** * Field m_array holds the string buffer's text contents, using an * array-of-arrays. Note that this array, and the arrays it contains, may be * reallocated when necessary in order to allow the buffer to grow; * references to them should be considered to be invalidated after any * append. However, the only time these arrays are directly exposed * is in the sendSAXcharacters call. */ char[][] m_array; /** * Field m_lastChunk is an index into m_array[], pointing to the last * chunk of the Chunked Array currently in use. Note that additional * chunks may actually be allocated, eg if the FastStringBuffer had * previously been truncated or if someone issued an ensureSpace request. *

    * The insertion point for append operations is addressed by the combination * of m_lastChunk and m_firstFree. */ int m_lastChunk = 0; /** * Field m_firstFree is an index into m_array[m_lastChunk][], pointing to * the first character in the Chunked Array which is not part of the * FastStringBuffer's current content. Since m_array[][] is zero-based, * the length of that content can be calculated as * (m_lastChunk< * For coding convenience, I've expressed both allocation sizes in terms of * a number of bits. That's needed for the final size of a chunk, * to permit fast and efficient shift-and-mask addressing. It's less critical * for the inital size, and may be reconsidered. *

    * An alternative would be to accept integer sizes and round to powers of two; * that really doesn't seem to buy us much, if anything. * * @param initChunkBits Length in characters of the initial allocation * of a chunk, expressed in log-base-2. (That is, 10 means allocate 1024 * characters.) Later chunks will use larger allocation units, to trade off * allocation speed of large document against storage efficiency of small * ones. * @param maxChunkBits Number of character-offset bits that should be used for * addressing within a chunk. Maximum length of a chunk is 2^chunkBits * characters. * @param rebundleBits Number of character-offset bits that addressing should * advance before we attempt to take a step from initChunkBits to maxChunkBits */ public FastStringBuffer(int initChunkBits, int maxChunkBits, int rebundleBits) { if(DEBUG_FORCE_INIT_BITS!=0) initChunkBits=DEBUG_FORCE_INIT_BITS; // %REVIEW% // Should this force to larger value, or smaller? Smaller less efficient, but if // someone requested variable mode it's because they care about storage space. // On the other hand, given the other changes I'm making, odds are that we should // adopt the larger size. Dither, dither, dither... This is just stopgap workaround // anyway; we need a permanant solution. // if(DEBUG_FORCE_FIXED_CHUNKSIZE) maxChunkBits=initChunkBits; //if(DEBUG_FORCE_FIXED_CHUNKSIZE) initChunkBits=maxChunkBits; m_array = new char[16][]; // Don't bite off more than we're prepared to swallow! if (initChunkBits > maxChunkBits) initChunkBits = maxChunkBits; m_chunkBits = initChunkBits; m_maxChunkBits = maxChunkBits; m_rebundleBits = rebundleBits; m_chunkSize = 1 << (initChunkBits); m_chunkMask = m_chunkSize - 1; m_array[0] = new char[m_chunkSize]; } /** * Construct a FastStringBuffer, using a default rebundleBits value. * * NEEDSDOC @param initChunkBits * NEEDSDOC @param maxChunkBits */ public FastStringBuffer(int initChunkBits, int maxChunkBits) { this(initChunkBits, maxChunkBits, 2); } /** * Construct a FastStringBuffer, using default maxChunkBits and * rebundleBits values. *

    * ISSUE: Should this call assert initial size, or fixed size? * Now configured as initial, with a default for fixed. * * NEEDSDOC @param initChunkBits */ public FastStringBuffer(int initChunkBits) { this(initChunkBits, 15, 2); } /** * Construct a FastStringBuffer, using a default allocation policy. */ public FastStringBuffer() { // 10 bits is 1K. 15 bits is 32K. Remember that these are character // counts, so actual memory allocation unit is doubled for UTF-16 chars. // // For reference: In the original FastStringBuffer, we simply // overallocated by blocksize (default 1KB) on each buffer-growth. this(10, 15, 2); } /** * Get the length of the list. Synonym for length(). * * @return the number of characters in the FastStringBuffer's content. */ public final int size() { return (m_lastChunk << m_chunkBits) + m_firstFree; } /** * Get the length of the list. Synonym for size(). * * @return the number of characters in the FastStringBuffer's content. */ public final int length() { return (m_lastChunk << m_chunkBits) + m_firstFree; } /** * Discard the content of the FastStringBuffer, and most of the memory * that was allocated by it, restoring the initial state. Note that this * may eventually be different from setLength(0), which see. */ public final void reset() { m_lastChunk = 0; m_firstFree = 0; // Recover the original chunk size FastStringBuffer innermost = this; while (innermost.m_innerFSB != null) { innermost = innermost.m_innerFSB; } m_chunkBits = innermost.m_chunkBits; m_chunkSize = innermost.m_chunkSize; m_chunkMask = innermost.m_chunkMask; // Discard the hierarchy m_innerFSB = null; m_array = new char[16][0]; m_array[0] = new char[m_chunkSize]; } /** * Directly set how much of the FastStringBuffer's storage is to be * considered part of its content. This is a fast but hazardous * operation. It is not protected against negative values, or values * greater than the amount of storage currently available... and even * if additional storage does exist, its contents are unpredictable. * The only safe use for our setLength() is to truncate the FastStringBuffer * to a shorter string. * * @param l New length. If l<0 or l>=getLength(), this operation will * not report an error but future operations will almost certainly fail. */ public final void setLength(int l) { m_lastChunk = l >>> m_chunkBits; if (m_lastChunk == 0 && m_innerFSB != null) { // Replace this FSB with the appropriate inner FSB, truncated m_innerFSB.setLength(l, this); } else { m_firstFree = l & m_chunkMask; // There's an edge case if l is an exact multiple of m_chunkBits, which risks leaving // us pointing at the start of a chunk which has not yet been allocated. Rather than // pay the cost of dealing with that in the append loops (more scattered and more // inner-loop), we correct it here by moving to the safe side of that // line -- as we would have left the indexes had we appended up to that point. if(m_firstFree==0 && m_lastChunk>0) { --m_lastChunk; m_firstFree=m_chunkSize; } } } /** * Subroutine for the public setLength() method. Deals with the fact * that truncation may require restoring one of the innerFSBs * * NEEDSDOC @param l * NEEDSDOC @param rootFSB */ private final void setLength(int l, FastStringBuffer rootFSB) { m_lastChunk = l >>> m_chunkBits; if (m_lastChunk == 0 && m_innerFSB != null) { m_innerFSB.setLength(l, rootFSB); } else { // Undo encapsulation -- pop the innerFSB data back up to root. // Inefficient, but attempts to keep the code simple. rootFSB.m_chunkBits = m_chunkBits; rootFSB.m_maxChunkBits = m_maxChunkBits; rootFSB.m_rebundleBits = m_rebundleBits; rootFSB.m_chunkSize = m_chunkSize; rootFSB.m_chunkMask = m_chunkMask; rootFSB.m_array = m_array; rootFSB.m_innerFSB = m_innerFSB; rootFSB.m_lastChunk = m_lastChunk; // Finally, truncate this sucker. rootFSB.m_firstFree = l & m_chunkMask; } } /** * Note that this operation has been somewhat deoptimized by the shift to a * chunked array, as there is no factory method to produce a String object * directly from an array of arrays and hence a double copy is needed. * By using ensureCapacity we hope to minimize the heap overhead of building * the intermediate StringBuffer. *

    * (It really is a pity that Java didn't design String as a final subclass * of MutableString, rather than having StringBuffer be a separate hierarchy. * We'd avoid a lot of double-buffering.) * * @return the contents of the FastStringBuffer as a standard Java string. */ public final String toString() { int length = (m_lastChunk << m_chunkBits) + m_firstFree; return getString(new StringBuffer(length), 0, 0, length).toString(); } /** * Append a single character onto the FastStringBuffer, growing the * storage if necessary. *

    * NOTE THAT after calling append(), previously obtained * references to m_array[][] may no longer be valid.... * though in fact they should be in this instance. * * @param value character to be appended. */ public final void append(char value) { char[] chunk; // We may have preallocated chunks. If so, all but last should // be at full size. if (m_firstFree < m_chunkSize) // Simplified test single-character-fits chunk = m_array[m_lastChunk]; else { // Extend array? int i = m_array.length; if (m_lastChunk + 1 == i) { char[][] newarray = new char[i + 16][]; System.arraycopy(m_array, 0, newarray, 0, i); m_array = newarray; } // Advance one chunk chunk = m_array[++m_lastChunk]; if (chunk == null) { // Hierarchical encapsulation if (m_lastChunk == 1 << m_rebundleBits && m_chunkBits < m_maxChunkBits) { // Should do all the work of both encapsulating // existing data and establishing new sizes/offsets m_innerFSB = new FastStringBuffer(this); } // Add a chunk. chunk = m_array[m_lastChunk] = new char[m_chunkSize]; } m_firstFree = 0; } // Space exists in the chunk. Append the character. chunk[m_firstFree++] = value; } /** * Append the contents of a String onto the FastStringBuffer, * growing the storage if necessary. *

    * NOTE THAT after calling append(), previously obtained * references to m_array[] may no longer be valid. * * @param value String whose contents are to be appended. */ public final void append(String value) { if (value == null) return; int strlen = value.length(); if (0 == strlen) return; int copyfrom = 0; char[] chunk = m_array[m_lastChunk]; int available = m_chunkSize - m_firstFree; // Repeat while data remains to be copied while (strlen > 0) { // Copy what fits if (available > strlen) available = strlen; value.getChars(copyfrom, copyfrom + available, m_array[m_lastChunk], m_firstFree); strlen -= available; copyfrom += available; // If there's more left, allocate another chunk and continue if (strlen > 0) { // Extend array? int i = m_array.length; if (m_lastChunk + 1 == i) { char[][] newarray = new char[i + 16][]; System.arraycopy(m_array, 0, newarray, 0, i); m_array = newarray; } // Advance one chunk chunk = m_array[++m_lastChunk]; if (chunk == null) { // Hierarchical encapsulation if (m_lastChunk == 1 << m_rebundleBits && m_chunkBits < m_maxChunkBits) { // Should do all the work of both encapsulating // existing data and establishing new sizes/offsets m_innerFSB = new FastStringBuffer(this); } // Add a chunk. chunk = m_array[m_lastChunk] = new char[m_chunkSize]; } available = m_chunkSize; m_firstFree = 0; } } // Adjust the insert point in the last chunk, when we've reached it. m_firstFree += available; } /** * Append the contents of a StringBuffer onto the FastStringBuffer, * growing the storage if necessary. *

    * NOTE THAT after calling append(), previously obtained * references to m_array[] may no longer be valid. * * @param value StringBuffer whose contents are to be appended. */ public final void append(StringBuffer value) { if (value == null) return; int strlen = value.length(); if (0 == strlen) return; int copyfrom = 0; char[] chunk = m_array[m_lastChunk]; int available = m_chunkSize - m_firstFree; // Repeat while data remains to be copied while (strlen > 0) { // Copy what fits if (available > strlen) available = strlen; value.getChars(copyfrom, copyfrom + available, m_array[m_lastChunk], m_firstFree); strlen -= available; copyfrom += available; // If there's more left, allocate another chunk and continue if (strlen > 0) { // Extend array? int i = m_array.length; if (m_lastChunk + 1 == i) { char[][] newarray = new char[i + 16][]; System.arraycopy(m_array, 0, newarray, 0, i); m_array = newarray; } // Advance one chunk chunk = m_array[++m_lastChunk]; if (chunk == null) { // Hierarchical encapsulation if (m_lastChunk == 1 << m_rebundleBits && m_chunkBits < m_maxChunkBits) { // Should do all the work of both encapsulating // existing data and establishing new sizes/offsets m_innerFSB = new FastStringBuffer(this); } // Add a chunk. chunk = m_array[m_lastChunk] = new char[m_chunkSize]; } available = m_chunkSize; m_firstFree = 0; } } // Adjust the insert point in the last chunk, when we've reached it. m_firstFree += available; } /** * Append part of the contents of a Character Array onto the * FastStringBuffer, growing the storage if necessary. *

    * NOTE THAT after calling append(), previously obtained * references to m_array[] may no longer be valid. * * @param chars character array from which data is to be copied * @param start offset in chars of first character to be copied, * zero-based. * @param length number of characters to be copied */ public final void append(char[] chars, int start, int length) { int strlen = length; if (0 == strlen) return; int copyfrom = start; char[] chunk = m_array[m_lastChunk]; int available = m_chunkSize - m_firstFree; // Repeat while data remains to be copied while (strlen > 0) { // Copy what fits if (available > strlen) available = strlen; System.arraycopy(chars, copyfrom, m_array[m_lastChunk], m_firstFree, available); strlen -= available; copyfrom += available; // If there's more left, allocate another chunk and continue if (strlen > 0) { // Extend array? int i = m_array.length; if (m_lastChunk + 1 == i) { char[][] newarray = new char[i + 16][]; System.arraycopy(m_array, 0, newarray, 0, i); m_array = newarray; } // Advance one chunk chunk = m_array[++m_lastChunk]; if (chunk == null) { // Hierarchical encapsulation if (m_lastChunk == 1 << m_rebundleBits && m_chunkBits < m_maxChunkBits) { // Should do all the work of both encapsulating // existing data and establishing new sizes/offsets m_innerFSB = new FastStringBuffer(this); } // Add a chunk. chunk = m_array[m_lastChunk] = new char[m_chunkSize]; } available = m_chunkSize; m_firstFree = 0; } } // Adjust the insert point in the last chunk, when we've reached it. m_firstFree += available; } /** * Append the contents of another FastStringBuffer onto * this FastStringBuffer, growing the storage if necessary. *

    * NOTE THAT after calling append(), previously obtained * references to m_array[] may no longer be valid. * * @param value FastStringBuffer whose contents are * to be appended. */ public final void append(FastStringBuffer value) { // Complicating factor here is that the two buffers may use // different chunk sizes, and even if they're the same we're // probably on a different alignment due to previously appended // data. We have to work through the source in bite-sized chunks. if (value == null) return; int strlen = value.length(); if (0 == strlen) return; int copyfrom = 0; char[] chunk = m_array[m_lastChunk]; int available = m_chunkSize - m_firstFree; // Repeat while data remains to be copied while (strlen > 0) { // Copy what fits if (available > strlen) available = strlen; int sourcechunk = (copyfrom + value.m_chunkSize - 1) >>> value.m_chunkBits; int sourcecolumn = copyfrom & value.m_chunkMask; int runlength = value.m_chunkSize - sourcecolumn; if (runlength > available) runlength = available; System.arraycopy(value.m_array[sourcechunk], sourcecolumn, m_array[m_lastChunk], m_firstFree, runlength); if (runlength != available) System.arraycopy(value.m_array[sourcechunk + 1], 0, m_array[m_lastChunk], m_firstFree + runlength, available - runlength); strlen -= available; copyfrom += available; // If there's more left, allocate another chunk and continue if (strlen > 0) { // Extend array? int i = m_array.length; if (m_lastChunk + 1 == i) { char[][] newarray = new char[i + 16][]; System.arraycopy(m_array, 0, newarray, 0, i); m_array = newarray; } // Advance one chunk chunk = m_array[++m_lastChunk]; if (chunk == null) { // Hierarchical encapsulation if (m_lastChunk == 1 << m_rebundleBits && m_chunkBits < m_maxChunkBits) { // Should do all the work of both encapsulating // existing data and establishing new sizes/offsets m_innerFSB = new FastStringBuffer(this); } // Add a chunk. chunk = m_array[m_lastChunk] = new char[m_chunkSize]; } available = m_chunkSize; m_firstFree = 0; } } // Adjust the insert point in the last chunk, when we've reached it. m_firstFree += available; } /** * @return true if the specified range of characters are all whitespace, * as defined by XMLCharacterRecognizer. *

    * CURRENTLY DOES NOT CHECK FOR OUT-OF-RANGE. * * @param start Offset of first character in the range. * @param length Number of characters to send. */ public boolean isWhitespace(int start, int length) { int sourcechunk = start >>> m_chunkBits; int sourcecolumn = start & m_chunkMask; int available = m_chunkSize - sourcecolumn; boolean chunkOK; while (length > 0) { int runlength = (length <= available) ? length : available; if (sourcechunk == 0 && m_innerFSB != null) chunkOK = m_innerFSB.isWhitespace(sourcecolumn, runlength); else chunkOK = org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace( m_array[sourcechunk], sourcecolumn, runlength); if (!chunkOK) return false; length -= runlength; ++sourcechunk; sourcecolumn = 0; available = m_chunkSize; } return true; } /** * @param start Offset of first character in the range. * @param length Number of characters to send. * @return a new String object initialized from the specified range of * characters. */ public String getString(int start, int length) { int startColumn = start & m_chunkMask; int startChunk = start >>> m_chunkBits; if (startColumn + length < m_chunkMask && m_innerFSB == null) { return getOneChunkString(startChunk, startColumn, length); } return getString(new StringBuffer(length), startChunk, startColumn, length).toString(); } protected String getOneChunkString(int startChunk, int startColumn, int length) { return new String(m_array[startChunk], startColumn, length); } /** * @param sb StringBuffer to be appended to * @param start Offset of first character in the range. * @param length Number of characters to send. * @return sb with the requested text appended to it */ StringBuffer getString(StringBuffer sb, int start, int length) { return getString(sb, start >>> m_chunkBits, start & m_chunkMask, length); } /** * Internal support for toString() and getString(). * PLEASE NOTE SIGNATURE CHANGE from earlier versions; it now appends into * and returns a StringBuffer supplied by the caller. This simplifies * m_innerFSB support. *

    * Note that this operation has been somewhat deoptimized by the shift to a * chunked array, as there is no factory method to produce a String object * directly from an array of arrays and hence a double copy is needed. * By presetting length we hope to minimize the heap overhead of building * the intermediate StringBuffer. *

    * (It really is a pity that Java didn't design String as a final subclass * of MutableString, rather than having StringBuffer be a separate hierarchy. * We'd avoid a lot of double-buffering.) * * * @param sb * @param startChunk * @param startColumn * @param length * * @return the contents of the FastStringBuffer as a standard Java string. */ StringBuffer getString(StringBuffer sb, int startChunk, int startColumn, int length) { int stop = (startChunk << m_chunkBits) + startColumn + length; int stopChunk = stop >>> m_chunkBits; int stopColumn = stop & m_chunkMask; // Factored out //StringBuffer sb=new StringBuffer(length); for (int i = startChunk; i < stopChunk; ++i) { if (i == 0 && m_innerFSB != null) m_innerFSB.getString(sb, startColumn, m_chunkSize - startColumn); else sb.append(m_array[i], startColumn, m_chunkSize - startColumn); startColumn = 0; // after first chunk } if (stopChunk == 0 && m_innerFSB != null) m_innerFSB.getString(sb, startColumn, stopColumn - startColumn); else if (stopColumn > startColumn) sb.append(m_array[stopChunk], startColumn, stopColumn - startColumn); return sb; } /** * Get a single character from the string buffer. * * * @param pos character position requested. * @return A character from the requested position. */ public char charAt(int pos) { int startChunk = pos >>> m_chunkBits; if (startChunk == 0 && m_innerFSB != null) return m_innerFSB.charAt(pos & m_chunkMask); else return m_array[startChunk][pos & m_chunkMask]; } /** * Sends the specified range of characters as one or more SAX characters() * events. * Note that the buffer reference passed to the ContentHandler may be * invalidated if the FastStringBuffer is edited; it's the user's * responsibility to manage access to the FastStringBuffer to prevent this * problem from arising. *

    * Note too that there is no promise that the output will be sent as a * single call. As is always true in SAX, one logical string may be split * across multiple blocks of memory and hence delivered as several * successive events. * * @param ch SAX ContentHandler object to receive the event. * @param start Offset of first character in the range. * @param length Number of characters to send. * @exception org.xml.sax.SAXException may be thrown by handler's * characters() method. */ public void sendSAXcharacters( org.xml.sax.ContentHandler ch, int start, int length) throws org.xml.sax.SAXException { int startChunk = start >>> m_chunkBits; int startColumn = start & m_chunkMask; if (startColumn + length < m_chunkMask && m_innerFSB == null) { ch.characters(m_array[startChunk], startColumn, length); return; } int stop = start + length; int stopChunk = stop >>> m_chunkBits; int stopColumn = stop & m_chunkMask; for (int i = startChunk; i < stopChunk; ++i) { if (i == 0 && m_innerFSB != null) m_innerFSB.sendSAXcharacters(ch, startColumn, m_chunkSize - startColumn); else ch.characters(m_array[i], startColumn, m_chunkSize - startColumn); startColumn = 0; // after first chunk } // Last, or only, chunk if (stopChunk == 0 && m_innerFSB != null) m_innerFSB.sendSAXcharacters(ch, startColumn, stopColumn - startColumn); else if (stopColumn > startColumn) { ch.characters(m_array[stopChunk], startColumn, stopColumn - startColumn); } } /** * Sends the specified range of characters as one or more SAX characters() * events, normalizing the characters according to XSLT rules. * * @param ch SAX ContentHandler object to receive the event. * @param start Offset of first character in the range. * @param length Number of characters to send. * @return normalization status to apply to next chunk (because we may * have been called recursively to process an inner FSB): *

    *
    0
    *
    if this output did not end in retained whitespace, and thus whitespace * at the start of the following chunk (if any) should be converted to a * single space. *
    SUPPRESS_LEADING_WS
    *
    if this output ended in retained whitespace, and thus whitespace * at the start of the following chunk (if any) should be completely * suppressed.
    * *
    * @exception org.xml.sax.SAXException may be thrown by handler's * characters() method. */ public int sendNormalizedSAXcharacters( org.xml.sax.ContentHandler ch, int start, int length) throws org.xml.sax.SAXException { // This call always starts at the beginning of the // string being written out, either because it was called directly or // because it was an m_innerFSB recursion. This is important since // it gives us a well-known initial state for this flag: int stateForNextChunk=SUPPRESS_LEADING_WS; int stop = start + length; int startChunk = start >>> m_chunkBits; int startColumn = start & m_chunkMask; int stopChunk = stop >>> m_chunkBits; int stopColumn = stop & m_chunkMask; for (int i = startChunk; i < stopChunk; ++i) { if (i == 0 && m_innerFSB != null) stateForNextChunk= m_innerFSB.sendNormalizedSAXcharacters(ch, startColumn, m_chunkSize - startColumn); else stateForNextChunk= sendNormalizedSAXcharacters(m_array[i], startColumn, m_chunkSize - startColumn, ch,stateForNextChunk); startColumn = 0; // after first chunk } // Last, or only, chunk if (stopChunk == 0 && m_innerFSB != null) stateForNextChunk= // %REVIEW% Is this update really needed? m_innerFSB.sendNormalizedSAXcharacters(ch, startColumn, stopColumn - startColumn); else if (stopColumn > startColumn) { stateForNextChunk= // %REVIEW% Is this update really needed? sendNormalizedSAXcharacters(m_array[stopChunk], startColumn, stopColumn - startColumn, ch, stateForNextChunk | SUPPRESS_TRAILING_WS); } return stateForNextChunk; } static final char[] SINGLE_SPACE = {' '}; /** * Internal method to directly normalize and dispatch the character array. * This version is aware of the fact that it may be called several times * in succession if the data is made up of multiple "chunks", and thus * must actively manage the handling of leading and trailing whitespace. * * Note: The recursion is due to the possible recursion of inner FSBs. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @param handler SAX ContentHandler object to receive the event. * @param edgeTreatmentFlags How leading/trailing spaces should be handled. * This is a bitfield contining two flags, bitwise-ORed together: *
    *
    SUPPRESS_LEADING_WS
    *
    When false, causes leading whitespace to be converted to a single * space; when true, causes it to be discarded entirely. * Should be set TRUE for the first chunk, and (in multi-chunk output) * whenever the previous chunk ended in retained whitespace.
    *
    SUPPRESS_TRAILING_WS
    *
    When false, causes trailing whitespace to be converted to a single * space; when true, causes it to be discarded entirely. * Should be set TRUE for the last or only chunk. *
    *
    * @return normalization status, as in the edgeTreatmentFlags parameter: *
    *
    0
    *
    if this output did not end in retained whitespace, and thus whitespace * at the start of the following chunk (if any) should be converted to a * single space. *
    SUPPRESS_LEADING_WS
    *
    if this output ended in retained whitespace, and thus whitespace * at the start of the following chunk (if any) should be completely * suppressed.
    * *
    * * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ static int sendNormalizedSAXcharacters(char ch[], int start, int length, org.xml.sax.ContentHandler handler, int edgeTreatmentFlags) throws org.xml.sax.SAXException { boolean processingLeadingWhitespace = ((edgeTreatmentFlags & SUPPRESS_LEADING_WS) != 0); boolean seenWhitespace = ((edgeTreatmentFlags & CARRY_WS) != 0); int currPos = start; int limit = start+length; // Strip any leading spaces first, if required if (processingLeadingWhitespace) { for (; currPos < limit && XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } // If we've only encountered leading spaces, the // current state remains unchanged if (currPos == limit) { return edgeTreatmentFlags; } } // If we get here, there are no more leading spaces to strip while (currPos < limit) { int startNonWhitespace = currPos; // Grab a chunk of non-whitespace characters for (; currPos < limit && !XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } // Non-whitespace seen - emit them, along with a single // space for any preceding whitespace characters if (startNonWhitespace != currPos) { if (seenWhitespace) { handler.characters(SINGLE_SPACE, 0, 1); seenWhitespace = false; } handler.characters(ch, startNonWhitespace, currPos - startNonWhitespace); } int startWhitespace = currPos; // Consume any whitespace characters for (; currPos < limit && XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } if (startWhitespace != currPos) { seenWhitespace = true; } } return (seenWhitespace ? CARRY_WS : 0) | (edgeTreatmentFlags & SUPPRESS_TRAILING_WS); } /** * Directly normalize and dispatch the character array. * * @param ch The characters from the XML document. * @param start The start position in the array. * @param length The number of characters to read from the array. * @param handler SAX ContentHandler object to receive the event. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public static void sendNormalizedSAXcharacters(char ch[], int start, int length, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException { sendNormalizedSAXcharacters(ch, start, length, handler, SUPPRESS_BOTH); } /** * Sends the specified range of characters as sax Comment. *

    * Note that, unlike sendSAXcharacters, this has to be done as a single * call to LexicalHandler#comment. * * @param ch SAX LexicalHandler object to receive the event. * @param start Offset of first character in the range. * @param length Number of characters to send. * @exception org.xml.sax.SAXException may be thrown by handler's * characters() method. */ public void sendSAXComment( org.xml.sax.ext.LexicalHandler ch, int start, int length) throws org.xml.sax.SAXException { // %OPT% Do it this way for now... String comment = getString(start, length); ch.comment(comment.toCharArray(), 0, length); } /** * Copies characters from this string into the destination character * array. * * @param srcBegin index of the first character in the string * to copy. * @param srcEnd index after the last character in the string * to copy. * @param dst the destination array. * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: *

    • srcBegin is negative. *
    • srcBegin is greater than srcEnd *
    • srcEnd is greater than the length of this * string *
    • dstBegin is negative *
    • dstBegin+(srcEnd-srcBegin) is larger than * dst.length
    * @exception NullPointerException if dst is null */ private void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { // %TBD% Joe needs to write this function. Make public when implemented. } /** * Encapsulation c'tor. After this is called, the source FastStringBuffer * will be reset to use the new object as its m_innerFSB, and will have * had its chunk size reset appropriately. IT SHOULD NEVER BE CALLED * EXCEPT WHEN source.length()==1<<(source.m_chunkBits+source.m_rebundleBits) * * NEEDSDOC @param source */ private FastStringBuffer(FastStringBuffer source) { // Copy existing information into new encapsulation m_chunkBits = source.m_chunkBits; m_maxChunkBits = source.m_maxChunkBits; m_rebundleBits = source.m_rebundleBits; m_chunkSize = source.m_chunkSize; m_chunkMask = source.m_chunkMask; m_array = source.m_array; m_innerFSB = source.m_innerFSB; // These have to be adjusted because we're calling just at the time // when we would be about to allocate another chunk m_lastChunk = source.m_lastChunk - 1; m_firstFree = source.m_chunkSize; // Establish capsule as the Inner FSB, reset chunk sizes/addressing source.m_array = new char[16][]; source.m_innerFSB = this; // Since we encapsulated just as we were about to append another // chunk, return ready to create the chunk after the innerFSB // -- 1, not 0. source.m_lastChunk = 1; source.m_firstFree = 0; source.m_chunkBits += m_rebundleBits; source.m_chunkSize = 1 << (source.m_chunkBits); source.m_chunkMask = source.m_chunkSize - 1; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/DOMOrder.java0000644000175000017500000000304210721374030022311 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMOrder.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * @deprecated Since the introduction of the DTM, this class will be removed. * Nodes that implement this index can return a document order index. * Eventually, this will be replaced by DOM 3 methods. * (compareDocumentOrder and/or compareTreePosition.) */ public interface DOMOrder { /** * Get the UID (document order index). * * @return integer whose relative value corresponds to document order * -- that is, if node1.getUid() Xalan utilities.

    Implementation of Xalan utility classes. This package is also shared by XPath. There *should* be no outward dependencies to XPath or Xalan by classes in this package.

    libxalan2-java-2.7.1/src/org/apache/xml/utils/res/0000755000175000017500000000000010736146354020641 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_ja_JP_I.java0000644000175000017500000000650410721374031025113 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_ja_JP_I.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Japanese (Katakana) resource bundle. * @xsl.usage internal */ public class XResources_ja_JP_I extends XResourceBundle { /** * Get the association table for this resource. * * * @return the association table for this resource. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x30a4, 0x30ed, 0x30cf, 0x30cb, 0x30db, 0x30d8, 0x30c8, 0x30c1, 0x30ea, 0x30cc, 0x30eb, 0x30f2, 0x30ef, 0x30ab, 0x30e8, 0x30bf, 0x30ec, 0x30bd, 0x30c4, 0x30cd, 0x30ca, 0x30e9, 0x30e0, 0x30a6, 0x30f0, 0x30ce, 0x30aa, 0x30af, 0x30e4, 0x30de, 0x30b1, 0x30d5, 0x30b3, 0x30a8, 0x30c6, 0x30a2, 0x30b5, 0x30ad, 0x30e6, 0x30e1, 0x30df, 0x30b7, 0x30f1, 0x30d2, 0x30e2, 0x30bb, 0x30b9 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(10000000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, //These only used for mutiplicative-additive numbering // Note that we are using longs and that the last two // multipliers are not supported. This is a known limitation. { "multiplier", new LongArrayWrapper( new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 }) }, // chinese only?? { "zero", new CharArrayWrapper(new char[0]) }, { "digits", new CharArrayWrapper( new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_de.java0000644000175000017500000000506110721374032024246 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_de.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_de.properties // /** * The German resource bundle. * @xsl.usage internal */ public class XResources_de extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "de" }, { "help_language", "de" }, { "language", "de" }, { "alphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering //{"numberGroups", new int[]{10,1}}, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}}, //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... //{"tables", new String[]{"tens", "digits"}} }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_zh_CN.java0000644000175000017500000000560710721374032024665 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_zh_CN.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Chinese resource bundle. * @xsl.usage internal */ public class XResources_zh_CN extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "zh" }, { "help_language", "zh" }, { "language", "zh" }, { "alphabet", new CharArrayWrapper( new char[]{ 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(100000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, // simplified chinese { "zero", new CharArrayWrapper(new char[]{ 0x96f6 }) }, //These only used for mutiplicative-additive numbering { "multiplier", new LongArrayWrapper(new long[]{ 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0x4ebf, 0x4e07, 0x5343, 0x767e, 0x5341 }) }, { "digits", new CharArrayWrapper( new char[]{ 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d }) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_ka.java0000644000175000017500000000617310721374032024256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_ka.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Georgian resource bundle. * @xsl.usage internal */ public class XResources_ka extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "ka" }, { "help_language", "ka" }, { "language", "ka" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10f1, 0x10D7, 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10f2, 0x10DD, 0x10DE, 0x10DF, 0x10E0, 0x10E1, 0x10E2, 0x10E3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8, 0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10F4, 0x10EF, 0x10F0 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer(10000000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1000, 100, 10, 1 }) }, //These used for additive numbering { "digits", new CharArrayWrapper( new char[]{ 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10f1, 0x10D7 }) }, { "tens", new CharArrayWrapper( new char[]{ 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10f2, 0x10DD, 0x10DE, 0x10DF }) }, { "hundreds", new CharArrayWrapper( new char[]{ 0x10E0, 0x10E1, 0x10E2, 0x10E3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8 }) }, { "thousands", new CharArrayWrapper( new char[]{ 0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10F4, 0x10EF, 0x10F0 }) }, { "tables", new StringArrayWrapper(new String[]{ "thousands", "hundreds", "tens", "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResourceBundle.java0000644000175000017500000001146310721374033024551 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResourceBundle.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * The default (english) resource bundle. * @xsl.usage internal */ public class XResourceBundle extends ListResourceBundle { /** Error resource constants */ public static final String ERROR_RESOURCES = "org.apache.xalan.res.XSLTErrorResources", XSLT_RESOURCE = "org.apache.xml.utils.res.XResourceBundle", LANG_BUNDLE_NAME = "org.apache.xml.utils.res.XResources", MULT_ORDER = "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS = "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT = "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING = "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD = "multiplicative-additive", LANG_MULTIPLIER = "multiplier", LANG_MULTIPLIER_CHAR = "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES = "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET = "tradAlphabet"; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className Name of local-specific subclass. * @param locale the locale to prefer when searching for the bundle */ public static final XResourceBundle loadResourceBundle( String className, Locale locale) throws MissingResourceException { String suffix = getResourceSuffix(locale); //System.out.println("resource " + className + suffix); try { // first try with the given locale String resourceName = className + suffix; return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XResourceBundle) ResourceBundle.getBundle( XSLT_RESOURCE, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String lang = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); String suffix = "_" + locale.getLanguage(); if (lang.equals("zh")) suffix += "_" + country; if (country.equals("JP")) suffix += "_" + country + "_" + variant; return suffix; } /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" }, { "alphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' })}, { "tradAlphabet", new CharArrayWrapper(new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_sv.java0000644000175000017500000000506210721374032024307 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_sv.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_sv.properties // /** * The Swedish resource bundle. * @xsl.usage internal */ public class XResources_sv extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "sv" }, { "help_language", "sv" }, { "language", "sv" }, { "alphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering //{"numberGroups", new int[]{10,1}}, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}}, //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... //{"tables", new String[]{"tens", "digits"}} }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_ko.java0000644000175000017500000000552410721374033024274 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_ko.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_ko.properties // /** * The Korean resource bundle. * @xsl.usage internal */ public class XResources_ko extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "ko" }, { "help_language", "ko" }, { "language", "ko" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, 0x3145, 0x3147, 0x3148, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3151, 0x3153, 0x3155, 0x3157, 0x315b, 0x315c, 0x3160, 0x3161, 0x3163})}, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(100000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, // chinese only ?? { "zero", new CharArrayWrapper(new char[0]) }, //These only used for mutiplicative-additive numbering { "multiplier", new LongArrayWrapper(new long[]{ 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0xc5b5, 0xb9cc, 0xcc9c, 0xbc31, 0xc2ed }) }, { "digits", new CharArrayWrapper( new char[]{ 0xc77c, 0xc774, 0xc0bc, 0xc0ac, 0xc624, 0xc721, 0xce60, 0xd314, 0xad6c}) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_he.java0000644000175000017500000000535110721374033024255 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_he.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Hebrew resource bundle. * @xsl.usage internal */ public class XResources_he extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "he" }, { "help_language", "he" }, { "language", "he" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "RightToLeft" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 10, 1 }) }, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, { "digits", new CharArrayWrapper( new char[]{ 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8 }) }, { "tens", new CharArrayWrapper( new char[]{ 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1 }) }, //hundreds, etc... { "tables", new StringArrayWrapper(new String[]{ "tens", "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_it.java0000644000175000017500000000506210721374033024274 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_it.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_it.properties // /** * The Italian resource bundle. * @xsl.usage internal */ public class XResources_it extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "it" }, { "help_language", "it" }, { "language", "it" }, { "alphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering //{"numberGroups", new int[]{10,1}}, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}}, //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... //{"tables", new String[]{"tens", "digits"}} }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_es.java0000644000175000017500000000506210721374032024266 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_es.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_es.properties // /** * The Spanish resource bundle. * @xsl.usage internal */ public class XResources_es extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "es" }, { "help_language", "es" }, { "language", "es" }, { "alphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering //{"numberGroups", new int[]{10,1}}, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}}, //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... //{"tables", new String[]{"tens", "digits"}} }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_el.java0000644000175000017500000000646410721374030024264 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_el.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Greek resource bundle. * @xsl.usage internal */ public class XResources_el extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "el" }, { "help_language", "el" }, { "language", "el" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering //{"numbering", "additive"}, { "numbering", "multiplicative-additive" }, { "multiplierOrder", "precedes" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 100, 10, 1 }) }, //These only used for mutiplicative-additive numbering { "multiplier", new LongArrayWrapper(new long[]{ 1000 }) }, { "multiplierChar", new CharArrayWrapper(new char[]{ 0x03d9 }) }, // chinese only?? { "zero", new CharArrayWrapper(new char[0]) }, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, { "digits", new CharArrayWrapper( new char[]{ 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03db, 0x03b6, 0x03b7, 0x03b8 }) }, { "tens", new CharArrayWrapper( new char[]{ 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03df }) }, { "hundreds", new CharArrayWrapper( new char[]{ 0x03c1, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03e1 }) }, //{"thousands", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... { "tables", new StringArrayWrapper(new String[]{ "hundreds", "tens", "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_ja_JP_HI.java0000644000175000017500000000652210721374031025223 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_ja_JP_HI.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Japanese (Hiragana) resource bundle. * @xsl.usage internal */ public class XResources_ja_JP_HI extends XResourceBundle { /** * Get the association table for this resource. * * * @return the association table for this resource. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x3044, 0x308d, 0x306f, 0x306b, 0x307b, 0x3078, 0x3068, 0x3061, 0x308a, 0x306c, 0x308b, 0x3092, 0x308f, 0x304b, 0x3088, 0x305f, 0x308c, 0x305d, 0x3064, 0x306d, 0x306a, 0x3089, 0x3080, 0x3046, 0x3090, 0x306e, 0x304a, 0x304f, 0x3084, 0x307e, 0x3051, 0x3075, 0x3053, 0x3048, 0x3066, 0x3042, 0x3055, 0x304d, 0x3086, 0x3081, 0x307f, 0x3057, 0x3091, 0x3072, 0x3082, 0x305b, 0x3059 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(10000000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, //These only used for mutiplicative-additive numbering // Note that we are using longs and that the last two // multipliers are not supported. This is a known limitation. { "multiplier", new LongArrayWrapper( new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 }) }, // chinese only?? { "zero", new CharArrayWrapper(new char[0]) }, { "digits", new CharArrayWrapper( new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_cy.java0000644000175000017500000000625310721374032024275 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_cy.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; /** * The Cyrillic resource bundle. * @xsl.usage internal */ public class XResources_cy extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "cy" }, { "help_language", "cy" }, { "language", "cy" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x0430, 0x0432, 0x0433, 0x0434, 0x0435, 0x0437, 0x0438, 0x0439, 0x04A9, 0x0457, 0x043A, 0x043B, 0x043C, 0x043D, 0x046F, 0x043E, 0x043F, 0x0447, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0470, 0x0460, 0x0446 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering //{"numbering", "additive"}, { "numbering", "multiplicative-additive" }, { "multiplierOrder", "precedes" }, // largest numerical value //{"MaxNumericalValue", new Integer(10000000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 100, 10, 1 }) }, //These only used for mutiplicative-additive numbering { "multiplier", new LongArrayWrapper(new long[]{ 1000 }) }, { "multiplierChar", new CharArrayWrapper(new char[]{ 0x03D9 }) }, // chinese only?? { "zero", new CharArrayWrapper(new char[0]) }, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, { "digits", new CharArrayWrapper( new char[]{ 0x0430, 0x0432, 0x0433, 0x0434, 0x0435, 0x0437, 0x0438, 0x0439, 0x04A9 }) }, { "tens", new CharArrayWrapper( new char[]{ 0x0457, 0x043A, 0x043B, 0x043C, 0x043D, 0x046F, 0x043E, 0x043F, 0x0447 }) }, { "hundreds", new CharArrayWrapper( new char[]{ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0470, 0x0460, 0x0446 }) }, { "tables", new StringArrayWrapper(new String[]{ "hundreds", "tens", "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResourceBundleBase.java0000644000175000017500000000325010721374032025336 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResourceBundleBase.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; import java.util.ListResourceBundle; /** * This is an interface for error messages. This class is misnamed, * and should be called XalanResourceBundle, or some such. * @xsl.usage internal */ abstract public class XResourceBundleBase extends ListResourceBundle { /** * Get the error string associated with the error code * * @param errorCode Error code * * @return error string associated with the given error code */ abstract public String getMessageKey(int errorCode); /** * Get the warning string associated with the error code * * @param errorCode Error code * * @return warning string associated with the given error code */ abstract public String getWarningKey(int errorCode); } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/LongArrayWrapper.java0000644000175000017500000000250210721374031024727 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LongArrayWrapper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; /** * * It is a mutable object to wrap the long[] used in * the contents of the XResourceBundle class */ public class LongArrayWrapper { private long[] m_long; public LongArrayWrapper(long[] arg){ m_long = arg; } public long getLong(int index){ return m_long[index]; } public int getLength(){ return m_long.length; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/IntArrayWrapper.java0000644000175000017500000000246610721374032024574 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntArrayWrapper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; /** * * It is a mutable object to wrap the int[] used in * the contents of the XResourceBundle class */ public class IntArrayWrapper { private int[] m_int; public IntArrayWrapper(int[] arg){ m_int = arg; } public int getInt(int index){ return m_int[index]; } public int getLength(){ return m_int.length; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_zh_TW.java0000644000175000017500000000562010721374031024711 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_zh_TW.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Chinese(Taiwan) resource bundle. * @xsl.usage internal */ public class XResources_zh_TW extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "zh" }, { "help_language", "zh" }, { "language", "zh" }, { "alphabet", new CharArrayWrapper( new char[]{ 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(100000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, // simplified chinese { "zero", new CharArrayWrapper(new char[]{ 0x96f6 }) }, //These only used for mutiplicative-additive numbering { "multiplier", new LongArrayWrapper(new long[]{ 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0x5104, 0x842c, 0x4edf, 0x4f70, 0x62fe }) }, { "digits", new CharArrayWrapper( new char[]{ 0x58f9, 0x8cb3, 0x53c3, 0x8086, 0x4f0d, 0x9678, 0x67d2, 0x634c, 0x7396 }) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_ja_JP_HA.java0000644000175000017500000000645610721374032025222 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_ja_JP_HA.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Japanese (Hiragana) resource bundle. * @xsl.usage internal */ public class XResources_ja_JP_HA extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x3042, 0x3044, 0x3046, 0x3048, 0x304a, 0x304b, 0x304d, 0x304f, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305b, 0x305d, 0x305f, 0x3061, 0x3064, 0x3066, 0x3068, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3072, 0x3075, 0x3078, 0x307b, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(10000000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, //These only used for mutiplicative-additive numbering // Note that we are using longs and that the last two // multipliers are not supported. This is a known limitation. { "multiplier", new LongArrayWrapper( new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 }) }, // chinese only? { "zero", new CharArrayWrapper(new char[0]) }, { "digits", new CharArrayWrapper( new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_fr.java0000644000175000017500000000506110721374031024264 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_fr.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_fr.properties // /** * The French resource bundle. * @xsl.usage internal */ public class XResources_fr extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "fr" }, { "help_language", "fr" }, { "language", "fr" }, { "alphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering //{"numberGroups", new int[]{10,1}}, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}}, //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... //{"tables", new String[]{"tens", "digits"}} }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_en.java0000644000175000017500000000506210721374031024260 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_en.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The English resource bundle. * @xsl.usage internal */ public class XResources_en extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" }, { "alphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' })}, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering //{"numberGroups", new int[]{10,1}}, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}}, //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}}, //hundreds, etc... //{"tables", new String[]{"tens", "digits"}} }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/CharArrayWrapper.java0000644000175000017500000000250210721374030024704 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CharArrayWrapper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; /** * * It is a mutable object to wrap the char[] used in * the contents of the XResourceBundle class */ public class CharArrayWrapper { private char[] m_char; public CharArrayWrapper(char[] arg){ m_char = arg; } public char getChar(int index){ return m_char[index]; } public int getLength(){ return m_char.length; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/StringArrayWrapper.java0000644000175000017500000000253410721374030025302 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringArrayWrapper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; /** * * It is a mutable object to wrap the String[] used in * the contents of the XResourceBundle class */ public class StringArrayWrapper { private String[] m_string; public StringArrayWrapper(String[] arg){ m_string = arg; } public String getString(int index){ return m_string[index]; } public int getLength(){ return m_string.length; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_ja_JP_A.java0000644000175000017500000000645410721374032025110 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_ja_JP_A.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Japanese (Katakana) resource bundle. * @xsl.usage internal */ public class XResources_ja_JP_A extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "multiplicative-additive" }, { "multiplierOrder", "follows" }, // largest numerical value //{"MaxNumericalValue", new Integer(10000000000)}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1 }) }, //These only used for mutiplicative-additive numbering // Note that we are using longs and that the last two // multipliers are not supported. This is a known limitation. { "multiplier", new LongArrayWrapper( new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 }) }, { "multiplierChar", new CharArrayWrapper( new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 }) }, // chinese only? { "zero", new CharArrayWrapper(new char[0]) }, { "digits", new CharArrayWrapper( new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }) }, { "tables", new StringArrayWrapper( new String[]{ "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/res/XResources_hy.java0000644000175000017500000000636710721374032024310 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XResources_hy.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils.res; // // LangResources_en.properties // /** * The Armenian resource bundle. * @xsl.usage internal */ public class XResources_hy extends XResourceBundle { /** * Get the association list. * * @return The association list. */ public Object[][] getContents() { return new Object[][] { { "ui_language", "hy" }, { "help_language", "hy" }, { "language", "hy" }, { "alphabet", new CharArrayWrapper( new char[]{ 0x0561, 0x0562, 0x0563, 0x0564, 0x0565, 0x0566, 0x0567, 0x0568, 0x0569, 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F, 0x0567, 0x0568, 0x0572, 0x0573, 0x0574, 0x0575, 0x0576, 0x0577, 0x0578, 0x0579, 0x057A, 0x057B, 0x057C, 0x057D, 0x057E, 0x057F, 0x0580, 0x0581, 0x0582, 0x0583, 0x0584 }) }, { "tradAlphabet", new CharArrayWrapper( new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) }, //language orientation { "orientation", "LeftToRight" }, //language numbering { "numbering", "additive" }, // largest numerical value //{"MaxNumericalValue", new Integer()}, //These would not be used for EN. Only used for traditional numbering { "numberGroups", new IntArrayWrapper(new int[]{ 1000, 100, 10, 1 }) }, //These only used for mutiplicative-additive numbering //{"multiplier", "10"}, //{"multiplierChar", "M"}, //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}}, { "digits", new CharArrayWrapper( new char[]{ 0x0561, 0x0562, 0x0563, 0x0564, 0x0565, 0x0566, 0x0567, 0x0568, 0x0569 }) }, { "tens", new CharArrayWrapper( new char[]{ 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F, 0x0567, 0x0568, 0x0572 }) }, { "hundreds", new CharArrayWrapper( new char[]{ 0x0573, 0x0574, 0x0575, 0x0576, 0x0577, 0x0578, 0x0579, 0x057A, 0x057B }) }, { "thousands", new CharArrayWrapper( new char[]{ 0x057C, 0x057D, 0x057E, 0x057F, 0x0580, 0x0581, 0x0582, 0x0583, 0x0584 }) }, { "tables", new StringArrayWrapper(new String[]{ "thousands", "hundreds", "tens", "digits" }) } }; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/SerializableLocatorImpl.java0000644000175000017500000001461010721374032025457 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializableLocatorImpl.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * The standard SAX implementation of LocatorImpl is not serializable, * limiting its utility as "a persistent snapshot of a locator". * This is a quick hack to make it so. Note that it makes more sense * in many cases to set up fields to hold this data rather than pointing * at another object... but that decision should be made on architectural * grounds rather than serializability. *

    * It isn't clear whether subclassing LocatorImpl and adding serialization * methods makes more sense than copying it and just adding Serializable * to its interface. Since it's so simple, I've taken the latter approach * for now. * * @see org.xml.sax.helpers.LocatorImpl * @see org.xml.sax.Locator Locator * @since XalanJ2 * @author Joe Kesselman * @version 1.0 */ public class SerializableLocatorImpl implements org.xml.sax.Locator, java.io.Serializable { static final long serialVersionUID = -2660312888446371460L; /** * Zero-argument constructor. * *

    SAX says "This will not normally be useful, since the main purpose * of this class is to make a snapshot of an existing Locator." In fact, * it _is_ sometimes useful when you want to construct a new Locator * pointing to a specific location... which, after all, is why the * setter methods are provided. *

    */ public SerializableLocatorImpl () { } /** * Copy constructor. * *

    Create a persistent copy of the current state of a locator. * When the original locator changes, this copy will still keep * the original values (and it can be used outside the scope of * DocumentHandler methods).

    * * @param locator The locator to copy. */ public SerializableLocatorImpl (org.xml.sax.Locator locator) { setPublicId(locator.getPublicId()); setSystemId(locator.getSystemId()); setLineNumber(locator.getLineNumber()); setColumnNumber(locator.getColumnNumber()); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.Locator //////////////////////////////////////////////////////////////////// /** * Return the saved public identifier. * * @return The public identifier as a string, or null if none * is available. * @see org.xml.sax.Locator#getPublicId * @see #setPublicId */ public String getPublicId () { return publicId; } /** * Return the saved system identifier. * * @return The system identifier as a string, or null if none * is available. * @see org.xml.sax.Locator#getSystemId * @see #setSystemId */ public String getSystemId () { return systemId; } /** * Return the saved line number (1-based). * * @return The line number as an integer, or -1 if none is available. * @see org.xml.sax.Locator#getLineNumber * @see #setLineNumber */ public int getLineNumber () { return lineNumber; } /** * Return the saved column number (1-based). * * @return The column number as an integer, or -1 if none is available. * @see org.xml.sax.Locator#getColumnNumber * @see #setColumnNumber */ public int getColumnNumber () { return columnNumber; } //////////////////////////////////////////////////////////////////// // Setters for the properties (not in org.xml.sax.Locator) //////////////////////////////////////////////////////////////////// /** * Set the public identifier for this locator. * * @param publicId The new public identifier, or null * if none is available. * @see #getPublicId */ public void setPublicId (String publicId) { this.publicId = publicId; } /** * Set the system identifier for this locator. * * @param systemId The new system identifier, or null * if none is available. * @see #getSystemId */ public void setSystemId (String systemId) { this.systemId = systemId; } /** * Set the line number for this locator (1-based). * * @param lineNumber The line number, or -1 if none is available. * @see #getLineNumber */ public void setLineNumber (int lineNumber) { this.lineNumber = lineNumber; } /** * Set the column number for this locator (1-based). * * @param columnNumber The column number, or -1 if none is available. * @see #getColumnNumber */ public void setColumnNumber (int columnNumber) { this.columnNumber = columnNumber; } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// /** * The public ID. * @serial */ private String publicId; /** * The system ID. * @serial */ private String systemId; /** * The line number. * @serial */ private int lineNumber; /** * The column number. * @serial */ private int columnNumber; } // end of LocatorImpl.java libxalan2-java-2.7.1/src/org/apache/xml/utils/NSInfo.java0000644000175000017500000000665410721374032022050 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NSInfo.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * This class holds information about the namespace info * of a node. It is used to optimize namespace lookup in * a generic DOM. * @xsl.usage internal */ public class NSInfo { /** * Constructor NSInfo * * * @param hasProcessedNS Flag indicating whether namespaces * have been processed for this node * @param hasXMLNSAttrs Flag indicating whether this node * has XMLNS attributes. */ public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs) { m_hasProcessedNS = hasProcessedNS; m_hasXMLNSAttrs = hasXMLNSAttrs; m_namespace = null; m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED; } // Unused at the moment /** * Constructor NSInfo * * * @param hasProcessedNS Flag indicating whether namespaces * have been processed for this node * @param hasXMLNSAttrs Flag indicating whether this node * has XMLNS attributes. * @param ancestorHasXMLNSAttrs Flag indicating whether one of this node's * ancestor has XMLNS attributes. */ public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs, int ancestorHasXMLNSAttrs) { m_hasProcessedNS = hasProcessedNS; m_hasXMLNSAttrs = hasXMLNSAttrs; m_ancestorHasXMLNSAttrs = ancestorHasXMLNSAttrs; m_namespace = null; } /** * Constructor NSInfo * * * @param namespace The namespace URI * @param hasXMLNSAttrs Flag indicating whether this node * has XMLNS attributes. */ public NSInfo(String namespace, boolean hasXMLNSAttrs) { m_hasProcessedNS = true; m_hasXMLNSAttrs = hasXMLNSAttrs; m_namespace = namespace; m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED; } /** The namespace URI */ public String m_namespace; /** Flag indicating whether this node has an XMLNS attribute */ public boolean m_hasXMLNSAttrs; /** Flag indicating whether namespaces have been processed for this node */ public boolean m_hasProcessedNS; /** Flag indicating whether one of this node's ancestor has an XMLNS attribute */ public int m_ancestorHasXMLNSAttrs; /** Constant for ancestors XMLNS atributes not processed */ public static final int ANCESTORXMLNSUNPROCESSED = 0; /** Constant indicating an ancestor has an XMLNS attribute */ public static final int ANCESTORHASXMLNS = 1; /** Constant indicating ancestors don't have an XMLNS attribute */ public static final int ANCESTORNOXMLNS = 2; } libxalan2-java-2.7.1/src/org/apache/xml/utils/ListingErrorHandler.java0000644000175000017500000004626210721374032024634 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ListingErrorHandler.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.URL; import java.net.URLConnection; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * Sample implementation of similar SAX ErrorHandler and JAXP ErrorListener. * *

    This implementation is suitable for various use cases, and * provides some basic configuration API's as well to control * when we re-throw errors, etc.

    * * @author shane_curcuru@us.ibm.com * @version $Id: ListingErrorHandler.java 468655 2006-10-28 07:12:06Z minchau $ * @xsl.usage general */ public class ListingErrorHandler implements ErrorHandler, ErrorListener { protected PrintWriter m_pw = null; /** * Constructor ListingErrorHandler; user-supplied PrintWriter. */ public ListingErrorHandler(PrintWriter pw) { if (null == pw) throw new NullPointerException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, null)); // "ListingErrorHandler created with null PrintWriter!"); m_pw = pw; } /** * Constructor ListingErrorHandler; uses System.err. */ public ListingErrorHandler() { m_pw = new PrintWriter(System.err, true); } /* ======== Implement org.xml.sax.ErrorHandler ======== */ /** * Receive notification of a warning. * *

    SAX parsers will use this method to report conditions that * are not errors or fatal errors as defined by the XML 1.0 * recommendation. The default behaviour is to take no action.

    * *

    The SAX parser must continue to provide normal parsing events * after invoking this method: it should still be possible for the * application to process the document through to the end.

    * *

    Filters may use this method to report other, non-XML warnings * as well.

    * * @param exception The warning information encapsulated in a * SAX parse exception. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception; only if setThrowOnWarning is true. * @see org.xml.sax.SAXParseException */ public void warning (SAXParseException exception) throws SAXException { logExceptionLocation(m_pw, exception); // Note: should we really call .toString() below, since // sometimes the message is not properly set? m_pw.println("warning: " + exception.getMessage()); m_pw.flush(); if (getThrowOnWarning()) throw exception; } /** * Receive notification of a recoverable error. * *

    This corresponds to the definition of "error" in section 1.2 * of the W3C XML 1.0 Recommendation. For example, a validating * parser would use this callback to report the violation of a * validity constraint. The default behaviour is to take no * action.

    * *

    The SAX parser must continue to provide normal parsing events * after invoking this method: it should still be possible for the * application to process the document through to the end. If the * application cannot do so, then the parser should report a fatal * error even if the XML 1.0 recommendation does not require it to * do so.

    * *

    Filters may use this method to report other, non-XML errors * as well.

    * * @param exception The error information encapsulated in a * SAX parse exception. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception; only if setThrowOnErroris true. * @see org.xml.sax.SAXParseException */ public void error (SAXParseException exception) throws SAXException { logExceptionLocation(m_pw, exception); m_pw.println("error: " + exception.getMessage()); m_pw.flush(); if (getThrowOnError()) throw exception; } /** * Receive notification of a non-recoverable error. * *

    This corresponds to the definition of "fatal error" in * section 1.2 of the W3C XML 1.0 Recommendation. For example, a * parser would use this callback to report the violation of a * well-formedness constraint.

    * *

    The application must assume that the document is unusable * after the parser has invoked this method, and should continue * (if at all) only for the sake of collecting addition error * messages: in fact, SAX parsers are free to stop reporting any * other events once this method has been invoked.

    * * @param exception The error information encapsulated in a * SAX parse exception. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception; only if setThrowOnFatalError is true. * @see org.xml.sax.SAXParseException */ public void fatalError (SAXParseException exception) throws SAXException { logExceptionLocation(m_pw, exception); m_pw.println("fatalError: " + exception.getMessage()); m_pw.flush(); if (getThrowOnFatalError()) throw exception; } /* ======== Implement javax.xml.transform.ErrorListener ======== */ /** * Receive notification of a warning. * *

    {@link javax.xml.transform.Transformer} can use this method to report * conditions that are not errors or fatal errors. The default behaviour * is to take no action.

    * *

    After invoking this method, the Transformer must continue with * the transformation. It should still be possible for the * application to process the document through to the end.

    * * @param exception The warning information encapsulated in a * transformer exception. * * @throws javax.xml.transform.TransformerException only if * setThrowOnWarning is true. * * @see javax.xml.transform.TransformerException */ public void warning(TransformerException exception) throws TransformerException { logExceptionLocation(m_pw, exception); m_pw.println("warning: " + exception.getMessage()); m_pw.flush(); if (getThrowOnWarning()) throw exception; } /** * Receive notification of a recoverable error. * *

    The transformer must continue to try and provide normal transformation * after invoking this method. It should still be possible for the * application to process the document through to the end if no other errors * are encountered.

    * * @param exception The error information encapsulated in a * transformer exception. * * @throws javax.xml.transform.TransformerException only if * setThrowOnError is true. * * @see javax.xml.transform.TransformerException */ public void error(TransformerException exception) throws TransformerException { logExceptionLocation(m_pw, exception); m_pw.println("error: " + exception.getMessage()); m_pw.flush(); if (getThrowOnError()) throw exception; } /** * Receive notification of a non-recoverable error. * *

    The transformer must continue to try and provide normal transformation * after invoking this method. It should still be possible for the * application to process the document through to the end if no other errors * are encountered, but there is no guarantee that the output will be * useable.

    * * @param exception The error information encapsulated in a * transformer exception. * * @throws javax.xml.transform.TransformerException only if * setThrowOnError is true. * * @see javax.xml.transform.TransformerException */ public void fatalError(TransformerException exception) throws TransformerException { logExceptionLocation(m_pw, exception); m_pw.println("error: " + exception.getMessage()); m_pw.flush(); if (getThrowOnError()) throw exception; } /* ======== Implement worker methods ======== */ /** * Print out location information about the exception. * * Cribbed from DefaultErrorHandler.printLocation() * @param pw PrintWriter to send output to * @param exception TransformerException or SAXParseException * to log information about */ public static void logExceptionLocation(PrintWriter pw, Throwable exception) { if (null == pw) pw = new PrintWriter(System.err, true); SourceLocator locator = null; Throwable cause = exception; // Try to find the locator closest to the cause. do { // Find the current locator, if one present if(cause instanceof SAXParseException) { // A SAXSourceLocator is a Xalan helper class // that implements both a SourceLocator and a SAX Locator //@todo check that the new locator actually has // as much or more information as the // current one already does locator = new SAXSourceLocator((SAXParseException)cause); } else if (cause instanceof TransformerException) { SourceLocator causeLocator = ((TransformerException)cause).getLocator(); if(null != causeLocator) { locator = causeLocator; } } // Then walk back down the chain of exceptions if(cause instanceof TransformerException) cause = ((TransformerException)cause).getCause(); else if(cause instanceof WrappedRuntimeException) cause = ((WrappedRuntimeException)cause).getException(); else if(cause instanceof SAXException) cause = ((SAXException)cause).getException(); else cause = null; } while(null != cause); // Formatting note: mimic javac-like errors: // path\filename:123: message-here // systemId:L=1;C=2: message-here if(null != locator) { String id = (locator.getPublicId() != locator.getPublicId()) ? locator.getPublicId() : (null != locator.getSystemId()) ? locator.getSystemId() : "SystemId-Unknown"; pw.print(id + ":Line=" + locator.getLineNumber() + ";Column=" + locator.getColumnNumber()+": "); pw.println("exception:" + exception.getMessage()); pw.println("root-cause:" + ((null != cause) ? cause.getMessage() : "null")); logSourceLine(pw, locator); } else { pw.print("SystemId-Unknown:locator-unavailable: "); pw.println("exception:" + exception.getMessage()); pw.println("root-cause:" + ((null != cause) ? cause.getMessage() : "null")); } } /** * Print out the specific source line that caused the exception, * if possible to load it. * * @param pw PrintWriter to send output to * @param locator Xalan wrapper for either a JAXP or a SAX * source location object */ public static void logSourceLine(PrintWriter pw, SourceLocator locator) { if (null == locator) return; if (null == pw) pw = new PrintWriter(System.err, true); String url = locator.getSystemId(); // Bail immediately if we get SystemId-Unknown //@todo future improvement: attempt to get resource // from a publicId if possible if (null == url) { pw.println("line: (No systemId; cannot read file)"); pw.println(); return; } //@todo attempt to get DOM backpointer or other ids try { int line = locator.getLineNumber(); int column = locator.getColumnNumber(); pw.println("line: " + getSourceLine(url, line)); StringBuffer buf = new StringBuffer("line: "); for (int i = 1; i < column; i++) { buf.append(' '); } buf.append('^'); pw.println(buf.toString()); } catch (Exception e) { pw.println("line: logSourceLine unavailable due to: " + e.getMessage()); pw.println(); } } /** * Return the specific source line that caused the exception, * if possible to load it; allow exceptions to be thrown. * * @author shane_curcuru@us.ibm.com */ protected static String getSourceLine(String sourceUrl, int lineNum) throws Exception { URL url = null; // Get a URL from the sourceUrl try { // Try to get a URL from it as-is url = new URL(sourceUrl); } catch (java.net.MalformedURLException mue) { int indexOfColon = sourceUrl.indexOf(':'); int indexOfSlash = sourceUrl.indexOf('/'); if ((indexOfColon != -1) && (indexOfSlash != -1) && (indexOfColon < indexOfSlash)) { // The url is already absolute, but we could not get // the system to form it, so bail throw mue; } else { // The url is relative, so attempt to get absolute url = new URL(SystemIDResolver.getAbsoluteURI(sourceUrl)); // If this fails, allow the exception to propagate } } String line = null; InputStream is = null; BufferedReader br = null; try { // Open the URL and read to our specified line URLConnection uc = url.openConnection(); is = uc.getInputStream(); br = new BufferedReader(new InputStreamReader(is)); // Not the most efficient way, but it works // (Feel free to patch to seek to the appropriate line) for (int i = 1; i <= lineNum; i++) { line = br.readLine(); } } // Allow exceptions to propagate from here, but ensure // streams are closed! finally { br.close(); is.close(); } // Return whatever we found return line; } /* ======== Implement settable properties ======== */ /** * User-settable behavior: when to re-throw exceptions. * *

    This allows per-instance configuration of * ListingErrorHandlers. You can ask us to either throw * an exception when we're called for various warning / * error / fatalErrors, or simply log them and continue.

    * * @param b if we should throw an exception on warnings */ public void setThrowOnWarning(boolean b) { throwOnWarning = b; } /** * User-settable behavior: when to re-throw exceptions. * * @return if we throw an exception on warnings */ public boolean getThrowOnWarning() { return throwOnWarning; } /** If we should throw exception on warnings; default:false. */ protected boolean throwOnWarning = false; /** * User-settable behavior: when to re-throw exceptions. * *

    This allows per-instance configuration of * ListingErrorHandlers. You can ask us to either throw * an exception when we're called for various warning / * error / fatalErrors, or simply log them and continue.

    * *

    Note that the behavior of many parsers/transformers * after an error is not necessarily defined!

    * * @param b if we should throw an exception on errors */ public void setThrowOnError(boolean b) { throwOnError = b; } /** * User-settable behavior: when to re-throw exceptions. * * @return if we throw an exception on errors */ public boolean getThrowOnError() { return throwOnError; } /** If we should throw exception on errors; default:true. */ protected boolean throwOnError = true; /** * User-settable behavior: when to re-throw exceptions. * *

    This allows per-instance configuration of * ListingErrorHandlers. You can ask us to either throw * an exception when we're called for various warning / * error / fatalErrors, or simply log them and continue.

    * *

    Note that the behavior of many parsers/transformers * after a fatalError is not necessarily defined, most * products will probably barf if you continue.

    * * @param b if we should throw an exception on fatalErrors */ public void setThrowOnFatalError(boolean b) { throwOnFatalError = b; } /** * User-settable behavior: when to re-throw exceptions. * * @return if we throw an exception on fatalErrors */ public boolean getThrowOnFatalError() { return throwOnFatalError; } /** If we should throw exception on fatalErrors; default:true. */ protected boolean throwOnFatalError = true; } libxalan2-java-2.7.1/src/org/apache/xml/utils/XMLReaderManager.java0000644000175000017500000001365210721374031023765 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLReaderManager.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.Hashtable; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.SAXException; /** * Creates XMLReader objects and caches them for re-use. * This class follows the singleton pattern. */ public class XMLReaderManager { private static final String NAMESPACES_FEATURE = "http://xml.org/sax/features/namespaces"; private static final String NAMESPACE_PREFIXES_FEATURE = "http://xml.org/sax/features/namespace-prefixes"; private static final XMLReaderManager m_singletonManager = new XMLReaderManager(); /** * Parser factory to be used to construct XMLReader objects */ private static SAXParserFactory m_parserFactory; /** * Cache of XMLReader objects */ private ThreadLocal m_readers; /** * Keeps track of whether an XMLReader object is in use. */ private Hashtable m_inUse; /** * Hidden constructor */ private XMLReaderManager() { } /** * Retrieves the singleton reader manager */ public static XMLReaderManager getInstance() { return m_singletonManager; } /** * Retrieves a cached XMLReader for this thread, or creates a new * XMLReader, if the existing reader is in use. When the caller no * longer needs the reader, it must release it with a call to * {@link #releaseXMLReader}. */ public synchronized XMLReader getXMLReader() throws SAXException { XMLReader reader; boolean readerInUse; if (m_readers == null) { // When the m_readers.get() method is called for the first time // on a thread, a new XMLReader will automatically be created. m_readers = new ThreadLocal(); } if (m_inUse == null) { m_inUse = new Hashtable(); } // If the cached reader for this thread is in use, construct a new // one; otherwise, return the cached reader. reader = (XMLReader) m_readers.get(); boolean threadHasReader = (reader != null); if (!threadHasReader || m_inUse.get(reader) == Boolean.TRUE) { try { try { // According to JAXP 1.2 specification, if a SAXSource // is created using a SAX InputSource the Transformer or // TransformerFactory creates a reader via the // XMLReaderFactory if setXMLReader is not used reader = XMLReaderFactory.createXMLReader(); } catch (Exception e) { try { // If unable to create an instance, let's try to use // the XMLReader from JAXP if (m_parserFactory == null) { m_parserFactory = SAXParserFactory.newInstance(); m_parserFactory.setNamespaceAware(true); } reader = m_parserFactory.newSAXParser().getXMLReader(); } catch (ParserConfigurationException pce) { throw pce; // pass along pce } } try { reader.setFeature(NAMESPACES_FEATURE, true); reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false); } catch (SAXException se) { // Try to carry on if we've got a parser that // doesn't know about namespace prefixes. } } catch (ParserConfigurationException ex) { throw new SAXException(ex); } catch (FactoryConfigurationError ex1) { throw new SAXException(ex1.toString()); } catch (NoSuchMethodError ex2) { } catch (AbstractMethodError ame) { } // Cache the XMLReader if this is the first time we've created // a reader for this thread. if (!threadHasReader) { m_readers.set(reader); m_inUse.put(reader, Boolean.TRUE); } } else { m_inUse.put(reader, Boolean.TRUE); } return reader; } /** * Mark the cached XMLReader as available. If the reader was not * actually in the cache, do nothing. * * @param reader The XMLReader that's being released. */ public synchronized void releaseXMLReader(XMLReader reader) { // If the reader that's being released is the cached reader // for this thread, remove it from the m_isUse list. if (m_readers.get() == reader && reader != null) { m_inUse.remove(reader); } } } libxalan2-java-2.7.1/src/org/apache/xml/utils/StopParseException.java0000644000175000017500000000272410721374031024504 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StopParseException.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * This is a special exception that is used to stop parsing when * search for an element. For instance, when searching for xml:stylesheet * PIs, it is used to stop the parse once the document element is found. * @see StylesheetPIHandler * @xsl.usage internal */ public class StopParseException extends org.xml.sax.SAXException { static final long serialVersionUID = 210102479218258961L; /** * Constructor StopParseException. */ StopParseException() { super("Stylesheet PIs found, stop the parse"); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/ThreadControllerWrapper.java0000644000175000017500000000553610721374031025525 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ThreadControllerWrapper.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A utility class that wraps the ThreadController, which is used * by IncrementalSAXSource for the incremental building of DTM. */ public class ThreadControllerWrapper { /** The ThreadController pool */ private static ThreadController m_tpool = new ThreadController(); public static Thread runThread(Runnable runnable, int priority) { return m_tpool.run(runnable, priority); } public static void waitThread(Thread worker, Runnable task) throws InterruptedException { m_tpool.waitThread(worker, task); } /** * Thread controller utility class for incremental SAX source. Must * be overriden with a derived class to support thread pooling. * * All thread-related stuff is in this class. */ public static class ThreadController { /** * Will get a thread from the pool, execute the task * and return the thread to the pool. * * The return value is used only to wait for completion * * * NEEDSDOC @param task * @param priority if >0 the task will run with the given priority * ( doesn't seem to be used in xalan, since it's allways the default ) * @return The thread that is running the task, can be used * to wait for completion */ public Thread run(Runnable task, int priority) { Thread t = new Thread(task); t.start(); // if( priority > 0 ) // t.setPriority( priority ); return t; } /** * Wait until the task is completed on the worker * thread. * * NEEDSDOC @param worker * NEEDSDOC @param task * * @throws InterruptedException */ public void waitThread(Thread worker, Runnable task) throws InterruptedException { // This should wait until the transformThread is considered not alive. worker.join(); } } } libxalan2-java-2.7.1/src/org/apache/xml/utils/StringToStringTable.java0000644000175000017500000001262310721374033024616 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringToStringTable.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple lookup table that stores a list of strings, the even * number strings being keys, and the odd number strings being values. * @xsl.usage internal */ public class StringToStringTable { /** Size of blocks to allocate */ private int m_blocksize; /** Array of strings this contains */ private String m_map[]; /** Number of strings this contains */ private int m_firstFree = 0; /** Size of this table */ private int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public StringToStringTable() { m_blocksize = 16; m_mapSize = m_blocksize; m_map = new String[m_blocksize]; } /** * Construct a StringToStringTable, using the given block size. * * @param blocksize Size of blocks to allocate */ public StringToStringTable(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new String[blocksize]; } /** * Get the length of the list. * * @return Number of strings in the list */ public final int getLength() { return m_firstFree; } /** * Append a string onto the vector. * The strings go to the even locations in the array * and the values in the odd. * * @param key String to add to the list * @param value Value of the string */ public final void put(String key, String value) { if ((m_firstFree + 2) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = key; m_firstFree++; m_map[m_firstFree] = value; m_firstFree++; } /** * Tell if the table contains the given string. * * @param key String to look up * * @return return the value of the string or null if not found. */ public final String get(String key) { for (int i = 0; i < m_firstFree; i += 2) { if (m_map[i].equals(key)) return m_map[i + 1]; } return null; } /** * Remove the given string and its value from this table. * * @param key String to remove from the table */ public final void remove(String key) { for (int i = 0; i < m_firstFree; i += 2) { if (m_map[i].equals(key)) { if ((i + 2) < m_firstFree) System.arraycopy(m_map, i + 2, m_map, i, m_firstFree - (i + 2)); m_firstFree -= 2; m_map[m_firstFree] = null; m_map[m_firstFree + 1] = null; break; } } } /** * Tell if the table contains the given string. Ignore case * * @param key String to look up * * @return The value of the string or null if not found */ public final String getIgnoreCase(String key) { if (null == key) return null; for (int i = 0; i < m_firstFree; i += 2) { if (m_map[i].equalsIgnoreCase(key)) return m_map[i + 1]; } return null; } /** * Tell if the table contains the given string in the value. * * @param val Value of the string to look up * * @return the string associated with the given value or null if not found */ public final String getByValue(String val) { for (int i = 1; i < m_firstFree; i += 2) { if (m_map[i].equals(val)) return m_map[i - 1]; } return null; } /** * Get the nth element. * * @param i index of the string to look up. * * @return The string at the given index. */ public final String elementAt(int i) { return m_map[i]; } /** * Tell if the table contains the given string. * * @param key String to look up * * @return True if the given string is in this table */ public final boolean contains(String key) { for (int i = 0; i < m_firstFree; i += 2) { if (m_map[i].equals(key)) return true; } return false; } /** * Tell if the table contains the given string. * * @param val value to look up * * @return True if the given value is in the table. */ public final boolean containsValue(String val) { for (int i = 1; i < m_firstFree; i += 2) { if (m_map[i].equals(val)) return true; } return false; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/MutableAttrListImpl.java0000644000175000017500000001034010721374033024602 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MutableAttrListImpl.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.Serializable; import org.xml.sax.Attributes; import org.xml.sax.helpers.AttributesImpl; /** * Mutable version of AttributesImpl. * @xsl.usage advanced */ public class MutableAttrListImpl extends AttributesImpl implements Serializable { static final long serialVersionUID = 6289452013442934470L; /** * Construct a new, empty AttributesImpl object. */ public MutableAttrListImpl() { super(); } /** * Copy an existing Attributes object. * *

    This constructor is especially useful inside a start * element event.

    * * @param atts The existing Attributes object. */ public MutableAttrListImpl(Attributes atts) { super(atts); } /** * Add an attribute to the end of the list. * *

    For the sake of speed, this method does no checking * to see if the attribute is already in the list: that is * the responsibility of the application.

    * * @param uri The Namespace URI, or the empty string if * none is available or Namespace processing is not * being performed. * @param localName The local name, or the empty string if * Namespace processing is not being performed. * @param qName The qualified (prefixed) name, or the empty string * if qualified names are not available. * @param type The attribute type as a string. * @param value The attribute value. */ public void addAttribute(String uri, String localName, String qName, String type, String value) { if (null == uri) uri = ""; // getIndex(qName) seems to be more reliable than getIndex(uri, localName), // in the case of the xmlns attribute anyway. int index = this.getIndex(qName); // int index = this.getIndex(uri, localName); // System.out.println("MutableAttrListImpl#addAttribute: "+uri+":"+localName+", "+index+", "+qName+", "+this); if (index >= 0) this.setAttribute(index, uri, localName, qName, type, value); else super.addAttribute(uri, localName, qName, type, value); } /** * Add the contents of the attribute list to this list. * * @param atts List of attributes to add to this list */ public void addAttributes(Attributes atts) { int nAtts = atts.getLength(); for (int i = 0; i < nAtts; i++) { String uri = atts.getURI(i); if (null == uri) uri = ""; String localName = atts.getLocalName(i); String qname = atts.getQName(i); int index = this.getIndex(uri, localName); // System.out.println("MutableAttrListImpl#addAttributes: "+uri+":"+localName+", "+index+", "+atts.getQName(i)+", "+this); if (index >= 0) this.setAttribute(index, uri, localName, qname, atts.getType(i), atts.getValue(i)); else addAttribute(uri, localName, qname, atts.getType(i), atts.getValue(i)); } } /** * Return true if list contains the given (raw) attribute name. * * @param name Raw name of attribute to look for * * @return true if an attribute is found with this name */ public boolean contains(String name) { return getValue(name) != null; } } // end of MutableAttrListImpl.java libxalan2-java-2.7.1/src/org/apache/xml/utils/Hashtree2Node.java0000644000175000017500000001212610721374030023334 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Hashtree2Node.java 475902 2006-11-16 20:03:16Z minchau $ */ package org.apache.xml.utils; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * Simple static utility to convert Hashtable to a Node. * * @see org.apache.xalan.xslt.EnvironmentCheck * @see org.apache.xalan.lib.Extensions * @author shane_curcuru@us.ibm.com * @version $Id: Hashtree2Node.java 475902 2006-11-16 20:03:16Z minchau $ * @xsl.usage general */ public abstract class Hashtree2Node { /** * Convert a Hashtable into a Node tree. * *

    The hash may have either Hashtables as values (in which * case we recurse) or other values, in which case we print them * as <item> elements, with a 'key' attribute with the value * of the key, and the element contents as the value.

    * *

    If args are null we simply return without doing anything. * If we encounter an error, we will attempt to add an 'ERROR' * Element with exception info; if that doesn't work we simply * return without doing anything else byt printStackTrace().

    * * @param hash to get info from (may have sub-hashtables) * @param name to use as parent element for appended node * futurework could have namespace and prefix as well * @param container Node to append our report to * @param factory Document providing createElement, etc. services */ public static void appendHashToNode(Hashtable hash, String name, Node container, Document factory) { // Required arguments must not be null if ((null == container) || (null == factory) || (null == hash)) { return; } // name we will provide a default value for String elemName = null; if ((null == name) || ("".equals(name))) elemName = "appendHashToNode"; else elemName = name; try { Element hashNode = factory.createElement(elemName); container.appendChild(hashNode); Enumeration keys = hash.keys(); List v = new ArrayList(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); String keyStr = key.toString(); Object item = hash.get(key); if (item instanceof Hashtable) { // Ensure a pre-order traversal; add this hashes // items before recursing to child hashes // Save name and hash in two steps v.add(keyStr); v.add((Hashtable) item); } else { try { // Add item to node Element node = factory.createElement("item"); node.setAttribute("key", keyStr); node.appendChild(factory.createTextNode((String)item)); hashNode.appendChild(node); } catch (Exception e) { Element node = factory.createElement("item"); node.setAttribute("key", keyStr); node.appendChild(factory.createTextNode("ERROR: Reading " + key + " threw: " + e.toString())); hashNode.appendChild(node); } } } // Now go back and do the saved hashes Iterator it = v.iterator(); while (it.hasNext()) { // Retrieve name and hash in two steps String n = (String) it.next(); Hashtable h = (Hashtable) it.next(); appendHashToNode(h, n, hashNode, factory); } } catch (Exception e2) { // Ooops, just bail (suggestions for a safe thing // to do in this case appreciated) e2.printStackTrace(); } } } libxalan2-java-2.7.1/src/org/apache/xml/utils/XMLStringFactory.java0000644000175000017500000000470610721374032024067 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLStringFactory.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A concrete class that implements this interface creates XMLString objects. */ public abstract class XMLStringFactory { /** * Create a new XMLString from a Java string. * * * @param string Java String reference, which must be non-null. * * @return An XMLString object that wraps the String reference. */ public abstract XMLString newstr(String string); /** * Create a XMLString from a FastStringBuffer. * * * @param string FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public abstract XMLString newstr(FastStringBuffer string, int start, int length); /** * Create a XMLString from a FastStringBuffer. * * * @param string FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public abstract XMLString newstr(char[] string, int start, int length); /** * Get a cheap representation of an empty string. * * @return An non-null reference to an XMLString that represents "". */ public abstract XMLString emptystr(); } libxalan2-java-2.7.1/src/org/apache/xml/utils/XMLStringDefault.java0000644000175000017500000007667210721374031024056 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLStringDefault.java 570109 2007-08-27 13:31:35Z zongaro $ */ package org.apache.xml.utils; import java.util.Locale; /** * The default implementation of the XMLString interface, * which is just a simple wrapper of a String object. */ public class XMLStringDefault implements XMLString { private String m_str; /** * Create a XMLStringDefault object from a String */ public XMLStringDefault(String str) { m_str = str; } /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { } /** * Directly call the * comment method on the passed LexicalHandler for the * string-value. * * @param lh A non-null reference to a LexicalHandler. * * @throws org.xml.sax.SAXException */ public void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh) throws org.xml.sax.SAXException { } /** * Conditionally trim all leading and trailing whitespace in the specified String. * All strings of white space are * replaced by a single space character (#x20), except spaces after punctuation which * receive double spaces if doublePunctuationSpaces is true. * This function may be useful to a formatter, but to get first class * results, the formatter should probably do it's own white space handling * based on the semantics of the formatting object. * * @param trimHead Trim leading whitespace? * @param trimTail Trim trailing whitespace? * @param doublePunctuationSpaces Use double spaces for punctuation? * @return The trimmed string. */ public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail, boolean doublePunctuationSpaces) { return new XMLStringDefault(m_str.trim()); } /** * Returns the length of this string. * * @return the length of the sequence of characters represented by this * object. */ public int length() { return m_str.length(); } /** * Returns the character at the specified index. An index ranges * from 0 to length() - 1. The first character * of the sequence is at index 0, the next at index * 1, and so on, as for array indexing. * * @param index the index of the character. * @return the character at the specified index of this string. * The first character is at index 0. * @exception IndexOutOfBoundsException if the index * argument is negative or not less than the length of this * string. */ public char charAt(int index) { return m_str.charAt(index); } /** * Copies characters from this string into the destination character * array. * * @param srcBegin index of the first character in the string * to copy. * @param srcEnd index after the last character in the string * to copy. * @param dst the destination array. * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: *
    • srcBegin is negative. *
    • srcBegin is greater than srcEnd *
    • srcEnd is greater than the length of this * string *
    • dstBegin is negative *
    • dstBegin+(srcEnd-srcBegin) is larger than * dst.length
    * @exception NullPointerException if dst is null */ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { int destIndex = dstBegin; for (int i = srcBegin; i < srcEnd; i++) { dst[destIndex++] = m_str.charAt(i); } } /** * Compares this string to the specified String. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this String against. * @return true if the Strings are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(String obj2) { return m_str.equals(obj2); } /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param anObject the object to compare this String * against. * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(XMLString anObject) { return m_str.equals(anObject.toString()); } /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param anObject the object to compare this String * against. * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public boolean equals(Object anObject) { return m_str.equals(anObject); } /** * Compares this String to another String, * ignoring case considerations. Two strings are considered equal * ignoring case if they are of the same length, and corresponding * characters in the two strings are equal ignoring case. * * @param anotherString the String to compare this * String against. * @return true if the argument is not null * and the Strings are equal, * ignoring case; false otherwise. * @see #equals(Object) * @see java.lang.Character#toLowerCase(char) * @see java.lang.Character#toUpperCase(char) */ public boolean equalsIgnoreCase(String anotherString) { return m_str.equalsIgnoreCase(anotherString); } /** * Compares two strings lexicographically. * * @param anotherString the String to be compared. * @return the value 0 if the argument string is equal to * this string; a value less than 0 if this string * is lexicographically less than the string argument; and a * value greater than 0 if this string is * lexicographically greater than the string argument. * @exception java.lang.NullPointerException if anotherString * is null. */ public int compareTo(XMLString anotherString) { return m_str.compareTo(anotherString.toString()); } /** * Compares two strings lexicographically, ignoring case considerations. * This method returns an integer whose sign is that of * this.toUpperCase().toLowerCase().compareTo( * str.toUpperCase().toLowerCase()). *

    * Note that this method does not take locale into account, * and will result in an unsatisfactory ordering for certain locales. * The java.text package provides collators to allow * locale-sensitive ordering. * * @param str the String to be compared. * @return a negative integer, zero, or a positive integer as the * the specified String is greater than, equal to, or less * than this String, ignoring case considerations. * @see java.text.Collator#compare(String, String) * @since 1.2 */ public int compareToIgnoreCase(XMLString str) { return m_str.compareToIgnoreCase(str.toString()); } /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *

       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(String prefix, int toffset) { return m_str.startsWith(prefix, toffset); } /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *
       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public boolean startsWith(XMLString prefix, int toffset) { return m_str.startsWith(prefix.toString(), toffset); } /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. * @since JDK1. 0 */ public boolean startsWith(String prefix) { return m_str.startsWith(prefix); } /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. * @since JDK1. 0 */ public boolean startsWith(XMLString prefix) { return m_str.startsWith(prefix.toString()); } /** * Tests if this string ends with the specified suffix. * * @param suffix the suffix. * @return true if the character sequence represented by the * argument is a suffix of the character sequence represented by * this object; false otherwise. Note that the * result will be true if the argument is the * empty string or is equal to this String object * as determined by the {@link #equals(Object)} method. * @exception java.lang.NullPointerException if suffix is * null. */ public boolean endsWith(String suffix) { return m_str.endsWith(suffix); } /** * Returns a hashcode for this string. The hashcode for a * String object is computed as *
       * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
       * 
    * using int arithmetic, where s[i] is the * ith character of the string, n is the length of * the string, and ^ indicates exponentiation. * (The hash value of the empty string is zero.) * * @return a hash code value for this object. */ public int hashCode() { return m_str.hashCode(); } /** * Returns the index within this string of the first occurrence of the * specified character. If a character with value ch occurs * in the character sequence represented by this String * object, then the index of the first such occurrence is returned -- * that is, the smallest value k such that: *
       * this.charAt(k) == ch
       * 
    * is true. If no such character occurs in this string, * then -1 is returned. * * @param ch a character. * @return the index of the first occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public int indexOf(int ch) { return m_str.indexOf(ch); } /** * Returns the index within this string of the first occurrence of the * specified character, starting the search at the specified index. *

    * If a character with value ch occurs in the character * sequence represented by this String object at an index * no smaller than fromIndex, then the index of the first * such occurrence is returned--that is, the smallest value k * such that: *

       * (this.charAt(k) == ch) && (k >= fromIndex)
       * 
    * is true. If no such character occurs in this string at or after * position fromIndex, then -1 is returned. *

    * There is no restriction on the value of fromIndex. If it * is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param ch a character. * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in the * character sequence represented by this object that is greater * than or equal to fromIndex, or -1 * if the character does not occur. */ public int indexOf(int ch, int fromIndex) { return m_str.indexOf(ch, fromIndex); } /** * Returns the index within this string of the last occurrence of the * specified character. That is, the index returned is the largest * value k such that: *

       * this.charAt(k) == ch
       * 
    * is true. * The String is searched backwards starting at the last character. * * @param ch a character. * @return the index of the last occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public int lastIndexOf(int ch) { return m_str.lastIndexOf(ch); } /** * Returns the index within this string of the last occurrence of the * specified character, searching backward starting at the specified * index. That is, the index returned is the largest value k * such that: *
       * this.charAt(k) == ch) && (k <= fromIndex)
       * 
    * is true. * * @param ch a character. * @param fromIndex the index to start the search from. There is no * restriction on the value of fromIndex. If it is * greater than or equal to the length of this string, it has * the same effect as if it were equal to one less than the * length of this string: this entire string may be searched. * If it is negative, it has the same effect as if it were -1: * -1 is returned. * @return the index of the last occurrence of the character in the * character sequence represented by this object that is less * than or equal to fromIndex, or -1 * if the character does not occur before that point. */ public int lastIndexOf(int ch, int fromIndex) { return m_str.lastIndexOf(ch, fromIndex); } /** * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: *
       * this.startsWith(str, k)
       * 
    * is true. * * @param str any string. * @return if the string argument occurs as a substring within this * object, then the index of the first character of the first * such substring is returned; if it does not occur as a * substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int indexOf(String str) { return m_str.indexOf(str); } /** * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: *
       * this.startsWith(str, k)
       * 
    * is true. * * @param str any string. * @return if the string argument occurs as a substring within this * object, then the index of the first character of the first * such substring is returned; if it does not occur as a * substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int indexOf(XMLString str) { return m_str.indexOf(str.toString()); } /** * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. The integer * returned is the smallest value k such that: *
       * this.startsWith(str, k) && (k >= fromIndex)
       * 
    * is true. *

    * There is no restriction on the value of fromIndex. If * it is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param str the substring to search for. * @param fromIndex the index to start the search from. * @return If the string argument occurs as a substring within this * object at a starting index no smaller than * fromIndex, then the index of the first character * of the first such substring is returned. If it does not occur * as a substring starting at fromIndex or beyond, * -1 is returned. * @exception java.lang.NullPointerException if str is * null */ public int indexOf(String str, int fromIndex) { return m_str.indexOf(str, fromIndex); } /** * Returns the index within this string of the rightmost occurrence * of the specified substring. The rightmost empty string "" is * considered to occur at the index value this.length(). * The returned index is the largest value k such that *

       * this.startsWith(str, k)
       * 
    * is true. * * @param str the substring to search for. * @return if the string argument occurs one or more times as a substring * within this object, then the index of the first character of * the last such substring is returned. If it does not occur as * a substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int lastIndexOf(String str) { return m_str.lastIndexOf(str); } /** * Returns the index within this string of the last occurrence of * the specified substring. * * @param str the substring to search for. * @param fromIndex the index to start the search from. There is no * restriction on the value of fromIndex. If it is greater than * the length of this string, it has the same effect as if it * were equal to the length of this string: this entire string * may be searched. If it is negative, it has the same effect * as if it were -1: -1 is returned. * @return If the string argument occurs one or more times as a substring * within this object at a starting index no greater than * fromIndex, then the index of the first character of * the last such substring is returned. If it does not occur as a * substring starting at fromIndex or earlier, * -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public int lastIndexOf(String str, int fromIndex) { return m_str.lastIndexOf(str, fromIndex); } /** * Returns a new string that is a substring of this string. The * substring begins with the character at the specified index and * extends to the end of this string.

    * Examples: *

       * "unhappy".substring(2) returns "happy"
       * "Harbison".substring(3) returns "bison"
       * "emptiness".substring(9) returns "" (an empty string)
       * 
    * * @param beginIndex the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if * beginIndex is negative or larger than the * length of this String object. */ public XMLString substring(int beginIndex) { return new XMLStringDefault(m_str.substring(beginIndex)); } /** * Returns a new string that is a substring of this string. The * substring begins at the specified beginIndex and * extends to the character at index endIndex - 1. * Thus the length of the substring is endIndex-beginIndex. * * @param beginIndex the beginning index, inclusive. * @param endIndex the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if the * beginIndex is negative, or * endIndex is larger than the length of * this String object, or * beginIndex is larger than * endIndex. */ public XMLString substring(int beginIndex, int endIndex) { return new XMLStringDefault(m_str.substring(beginIndex, endIndex)); } /** * Concatenates the specified string to the end of this string. * * @param str the String that is concatenated to the end * of this String. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. * @exception java.lang.NullPointerException if str is * null. */ public XMLString concat(String str) { return new XMLStringDefault(m_str.concat(str)); } /** * Converts all of the characters in this String to lower * case using the rules of the given Locale. * * @param locale use the case transformation rules for this locale * @return the String, converted to lowercase. * @see java.lang.Character#toLowerCase(char) * @see java.lang.String#toUpperCase(Locale) */ public XMLString toLowerCase(Locale locale) { return new XMLStringDefault(m_str.toLowerCase(locale)); } /** * Converts all of the characters in this String to lower * case using the rules of the default locale, which is returned * by Locale.getDefault. *

    * * @return the string, converted to lowercase. * @see java.lang.Character#toLowerCase(char) * @see java.lang.String#toLowerCase(Locale) */ public XMLString toLowerCase() { return new XMLStringDefault(m_str.toLowerCase()); } /** * Converts all of the characters in this String to upper * case using the rules of the given locale. * @param locale use the case transformation rules for this locale * @return the String, converted to uppercase. * @see java.lang.Character#toUpperCase(char) * @see java.lang.String#toLowerCase(Locale) */ public XMLString toUpperCase(Locale locale) { return new XMLStringDefault(m_str.toUpperCase(locale)); } /** * Converts all of the characters in this String to upper * case using the rules of the default locale, which is returned * by Locale.getDefault. * *

    * If no character in this string has a different uppercase version, * based on calling the toUpperCase method defined by * Character, then the original string is returned. *

    * Otherwise, this method creates a new String object * representing a character sequence identical in length to the * character sequence represented by this String object and * with every character equal to the result of applying the method * Character.toUpperCase to the corresponding character of * this String object.

    * Examples: *

       * "Fahrvergnügen".toUpperCase() returns "FAHRVERGNÜGEN"
       * "Visit Ljubinje!".toUpperCase() returns "VISIT LJUBINJE!"
       * 
    * * @return the string, converted to uppercase. * @see java.lang.Character#toUpperCase(char) * @see java.lang.String#toUpperCase(Locale) */ public XMLString toUpperCase() { return new XMLStringDefault(m_str.toUpperCase()); } /** * Removes white space from both ends of this string. *

    * If this String object represents an empty character * sequence, or the first and last characters of character sequence * represented by this String object both have codes * greater than '\u0020' (the space character), then a * reference to this String object is returned. *

    * Otherwise, if there is no character with a code greater than * '\u0020' in the string, then a new * String object representing an empty string is created * and returned. *

    * Otherwise, let k be the index of the first character in the * string whose code is greater than '\u0020', and let * m be the index of the last character in the string whose code * is greater than '\u0020'. A new String * object is created, representing the substring of this string that * begins with the character at index k and ends with the * character at index m-that is, the result of * this.substring(km+1). *

    * This method may be used to trim * {@link Character#isSpace(char) whitespace} from the beginning and end * of a string; in fact, it trims all ASCII control characters as well. * * @return this string, with white space removed from the front and end. */ public XMLString trim() { return new XMLStringDefault(m_str.trim()); } /** * This object (which is already a string!) is itself returned. * * @return the string itself. */ public String toString() { return m_str; } /** * Tell if this object contains a java String object. * * @return true if this XMLString can return a string without creating one. */ public boolean hasString() { return true; } /** * Convert a string to a double -- Allowed input is in fixed * notation ddd.fff. * * @return A double value representation of the string, or return Double.NaN * if the string can not be converted. */ public double toDouble() { try { return Double.valueOf(m_str).doubleValue(); } catch (NumberFormatException nfe) { return Double.NaN; } } } libxalan2-java-2.7.1/src/org/apache/xml/utils/XMLString.java0000644000175000017500000007332010721374030022533 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLString.java 570109 2007-08-27 13:31:35Z zongaro $ */ package org.apache.xml.utils; import java.util.Locale; /** * This class is meant to be an interface to character strings, whether they * be java Strings or org.apache.xml.utils.FastStringBuffers, or * other character data. By using XMLString, character copies can be reduced * in the XML pipeline. */ public interface XMLString { /** * Directly call the * characters method on the passed ContentHandler for the * string-value. Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public abstract void dispatchCharactersEvents(org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException; /** * Directly call the * comment method on the passed LexicalHandler for the * string-value. * * @param lh A non-null reference to a LexicalHandler. * * @throws org.xml.sax.SAXException */ public abstract void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh) throws org.xml.sax.SAXException; /** * Conditionally trim all leading and trailing whitespace in the specified String. * All strings of white space are * replaced by a single space character (#x20), except spaces after punctuation which * receive double spaces if doublePunctuationSpaces is true. * This function may be useful to a formatter, but to get first class * results, the formatter should probably do it's own white space handling * based on the semantics of the formatting object. * * @param trimHead Trim leading whitespace? * @param trimTail Trim trailing whitespace? * @param doublePunctuationSpaces Use double spaces for punctuation? * @return The trimmed string. */ public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail, boolean doublePunctuationSpaces); /** * Returns the length of this string. * * @return the length of the sequence of characters represented by this * object. */ public abstract int length(); /** * Returns the character at the specified index. An index ranges * from 0 to length() - 1. The first character * of the sequence is at index 0, the next at index * 1, and so on, as for array indexing. * * @param index the index of the character. * @return the character at the specified index of this string. * The first character is at index 0. * @exception IndexOutOfBoundsException if the index * argument is negative or not less than the length of this * string. */ public abstract char charAt(int index); /** * Copies characters from this string into the destination character * array. * * @param srcBegin index of the first character in the string * to copy. * @param srcEnd index after the last character in the string * to copy. * @param dst the destination array. * @param dstBegin the start offset in the destination array. * @exception IndexOutOfBoundsException If any of the following * is true: *

    • srcBegin is negative. *
    • srcBegin is greater than srcEnd *
    • srcEnd is greater than the length of this * string *
    • dstBegin is negative *
    • dstBegin+(srcEnd-srcBegin) is larger than * dst.length
    * @exception NullPointerException if dst is null */ public abstract void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin); /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is an XMLString object that represents * the same sequence of characters as this object. * * @param anObject the object to compare this String * against. * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public abstract boolean equals(XMLString anObject); /** * Compares this string to the specified String. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param anotherString the object to compare this String * against. * @return true if the Strings are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public abstract boolean equals(String anotherString); /** * Compares this string to the specified object. * The result is true if and only if the argument is not * null and is a String object that represents * the same sequence of characters as this object. * * @param anObject the object to compare this String * against. * @return true if the String are equal; * false otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */ public abstract boolean equals(Object anObject); /** * Compares this String to another String, * ignoring case considerations. Two strings are considered equal * ignoring case if they are of the same length, and corresponding * characters in the two strings are equal ignoring case. * * @param anotherString the String to compare this * String against. * @return true if the argument is not null * and the Strings are equal, * ignoring case; false otherwise. * @see #equals(Object) * @see java.lang.Character#toLowerCase(char) * @see java.lang.Character#toUpperCase(char) */ public abstract boolean equalsIgnoreCase(String anotherString); /** * Compares two strings lexicographically. * * @param anotherString the String to be compared. * @return the value 0 if the argument string is equal to * this string; a value less than 0 if this string * is lexicographically less than the string argument; and a * value greater than 0 if this string is * lexicographically greater than the string argument. * @exception java.lang.NullPointerException if anotherString * is null. */ public abstract int compareTo(XMLString anotherString); /** * Compares two strings lexicographically, ignoring case considerations. * This method returns an integer whose sign is that of * this.toUpperCase().toLowerCase().compareTo( * str.toUpperCase().toLowerCase()). *

    * Note that this method does not take locale into account, * and will result in an unsatisfactory ordering for certain locales. * The java.text package provides collators to allow * locale-sensitive ordering. * * @param str the String to be compared. * @return a negative integer, zero, or a positive integer as the * the specified String is greater than, equal to, or less * than this String, ignoring case considerations. * @see java.text.Collator#compare(String, String) * @since 1.2 */ public abstract int compareToIgnoreCase(XMLString str); /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *

       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public abstract boolean startsWith(String prefix, int toffset); /** * Tests if this string starts with the specified prefix beginning * a specified index. * * @param prefix the prefix. * @param toffset where to begin looking in the string. * @return true if the character sequence represented by the * argument is a prefix of the substring of this object starting * at index toffset; false otherwise. * The result is false if toffset is * negative or greater than the length of this * String object; otherwise the result is the same * as the result of the expression *
       *          this.subString(toffset).startsWith(prefix)
       *          
    * @exception java.lang.NullPointerException if prefix is * null. */ public abstract boolean startsWith(XMLString prefix, int toffset); /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. * @since JDK1. 0 */ public abstract boolean startsWith(String prefix); /** * Tests if this string starts with the specified prefix. * * @param prefix the prefix. * @return true if the character sequence represented by the * argument is a prefix of the character sequence represented by * this string; false otherwise. * Note also that true will be returned if the * argument is an empty string or is equal to this * String object as determined by the * {@link #equals(Object)} method. * @exception java.lang.NullPointerException if prefix is * null. * @since JDK1. 0 */ public abstract boolean startsWith(XMLString prefix); /** * Tests if this string ends with the specified suffix. * * @param suffix the suffix. * @return true if the character sequence represented by the * argument is a suffix of the character sequence represented by * this object; false otherwise. Note that the * result will be true if the argument is the * empty string or is equal to this String object * as determined by the {@link #equals(Object)} method. * @exception java.lang.NullPointerException if suffix is * null. */ public abstract boolean endsWith(String suffix); /** * Returns a hashcode for this string. The hashcode for a * String object is computed as *
       * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
       * 
    * using int arithmetic, where s[i] is the * ith character of the string, n is the length of * the string, and ^ indicates exponentiation. * (The hash value of the empty string is zero.) * * @return a hash code value for this object. */ public abstract int hashCode(); /** * Returns the index within this string of the first occurrence of the * specified character. If a character with value ch occurs * in the character sequence represented by this String * object, then the index of the first such occurrence is returned -- * that is, the smallest value k such that: *
       * this.charAt(k) == ch
       * 
    * is true. If no such character occurs in this string, * then -1 is returned. * * @param ch a character. * @return the index of the first occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public abstract int indexOf(int ch); /** * Returns the index within this string of the first occurrence of the * specified character, starting the search at the specified index. *

    * If a character with value ch occurs in the character * sequence represented by this String object at an index * no smaller than fromIndex, then the index of the first * such occurrence is returned--that is, the smallest value k * such that: *

       * (this.charAt(k) == ch) && (k >= fromIndex)
       * 
    * is true. If no such character occurs in this string at or after * position fromIndex, then -1 is returned. *

    * There is no restriction on the value of fromIndex. If it * is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param ch a character. * @param fromIndex the index to start the search from. * @return the index of the first occurrence of the character in the * character sequence represented by this object that is greater * than or equal to fromIndex, or -1 * if the character does not occur. */ public abstract int indexOf(int ch, int fromIndex); /** * Returns the index within this string of the last occurrence of the * specified character. That is, the index returned is the largest * value k such that: *

       * this.charAt(k) == ch
       * 
    * is true. * The String is searched backwards starting at the last character. * * @param ch a character. * @return the index of the last occurrence of the character in the * character sequence represented by this object, or * -1 if the character does not occur. */ public abstract int lastIndexOf(int ch); /** * Returns the index within this string of the last occurrence of the * specified character, searching backward starting at the specified * index. That is, the index returned is the largest value k * such that: *
       * this.charAt(k) == ch) && (k <= fromIndex)
       * 
    * is true. * * @param ch a character. * @param fromIndex the index to start the search from. There is no * restriction on the value of fromIndex. If it is * greater than or equal to the length of this string, it has * the same effect as if it were equal to one less than the * length of this string: this entire string may be searched. * If it is negative, it has the same effect as if it were -1: * -1 is returned. * @return the index of the last occurrence of the character in the * character sequence represented by this object that is less * than or equal to fromIndex, or -1 * if the character does not occur before that point. */ public abstract int lastIndexOf(int ch, int fromIndex); /** * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: *
       * this.startsWith(str, k)
       * 
    * is true. * * @param str any string. * @return if the string argument occurs as a substring within this * object, then the index of the first character of the first * such substring is returned; if it does not occur as a * substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public abstract int indexOf(String str); /** * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: *
       * this.startsWith(str, k)
       * 
    * is true. * * @param str any string. * @return if the string argument occurs as a substring within this * object, then the index of the first character of the first * such substring is returned; if it does not occur as a * substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public abstract int indexOf(XMLString str); /** * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. The integer * returned is the smallest value k such that: *
       * this.startsWith(str, k) && (k >= fromIndex)
       * 
    * is true. *

    * There is no restriction on the value of fromIndex. If * it is negative, it has the same effect as if it were zero: this entire * string may be searched. If it is greater than the length of this * string, it has the same effect as if it were equal to the length of * this string: -1 is returned. * * @param str the substring to search for. * @param fromIndex the index to start the search from. * @return If the string argument occurs as a substring within this * object at a starting index no smaller than * fromIndex, then the index of the first character * of the first such substring is returned. If it does not occur * as a substring starting at fromIndex or beyond, * -1 is returned. * @exception java.lang.NullPointerException if str is * null */ public abstract int indexOf(String str, int fromIndex); /** * Returns the index within this string of the rightmost occurrence * of the specified substring. The rightmost empty string "" is * considered to occur at the index value this.length(). * The returned index is the largest value k such that *

       * this.startsWith(str, k)
       * 
    * is true. * * @param str the substring to search for. * @return if the string argument occurs one or more times as a substring * within this object, then the index of the first character of * the last such substring is returned. If it does not occur as * a substring, -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public abstract int lastIndexOf(String str); /** * Returns the index within this string of the last occurrence of * the specified substring. * * @param str the substring to search for. * @param fromIndex the index to start the search from. There is no * restriction on the value of fromIndex. If it is greater than * the length of this string, it has the same effect as if it * were equal to the length of this string: this entire string * may be searched. If it is negative, it has the same effect * as if it were -1: -1 is returned. * @return If the string argument occurs one or more times as a substring * within this object at a starting index no greater than * fromIndex, then the index of the first character of * the last such substring is returned. If it does not occur as a * substring starting at fromIndex or earlier, * -1 is returned. * @exception java.lang.NullPointerException if str is * null. */ public abstract int lastIndexOf(String str, int fromIndex); /** * Returns a new string that is a substring of this string. The * substring begins with the character at the specified index and * extends to the end of this string.

    * Examples: *

       * "unhappy".substring(2) returns "happy"
       * "Harbison".substring(3) returns "bison"
       * "emptiness".substring(9) returns "" (an empty string)
       * 
    * * @param beginIndex the beginning index, inclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if * beginIndex is negative or larger than the * length of this String object. */ public abstract XMLString substring(int beginIndex); /** * Returns a new string that is a substring of this string. The * substring begins at the specified beginIndex and * extends to the character at index endIndex - 1. * Thus the length of the substring is endIndex-beginIndex. * * @param beginIndex the beginning index, inclusive. * @param endIndex the ending index, exclusive. * @return the specified substring. * @exception IndexOutOfBoundsException if the * beginIndex is negative, or * endIndex is larger than the length of * this String object, or * beginIndex is larger than * endIndex. */ public abstract XMLString substring(int beginIndex, int endIndex); /** * Concatenates the specified string to the end of this string. * * @param str the String that is concatenated to the end * of this String. * @return a string that represents the concatenation of this object's * characters followed by the string argument's characters. * @exception java.lang.NullPointerException if str is * null. */ public abstract XMLString concat(String str); /** * Converts all of the characters in this String to lower * case using the rules of the given Locale. * * @param locale use the case transformation rules for this locale * @return the String, converted to lowercase. * @see java.lang.Character#toLowerCase(char) * @see java.lang.String#toUpperCase(Locale) */ public abstract XMLString toLowerCase(Locale locale); /** * Converts all of the characters in this String to lower * case using the rules of the default locale, which is returned * by Locale.getDefault. *

    * * @return the string, converted to lowercase. * @see java.lang.Character#toLowerCase(char) * @see java.lang.String#toLowerCase(Locale) */ public abstract XMLString toLowerCase(); /** * Converts all of the characters in this String to upper * case using the rules of the given locale. * @param locale use the case transformation rules for this locale * @return the String, converted to uppercase. * @see java.lang.Character#toUpperCase(char) * @see java.lang.String#toLowerCase(Locale) */ public abstract XMLString toUpperCase(Locale locale); /** * Converts all of the characters in this String to upper * case using the rules of the default locale, which is returned * by Locale.getDefault. * *

    * If no character in this string has a different uppercase version, * based on calling the toUpperCase method defined by * Character, then the original string is returned. *

    * Otherwise, this method creates a new String object * representing a character sequence identical in length to the * character sequence represented by this String object and * with every character equal to the result of applying the method * Character.toUpperCase to the corresponding character of * this String object.

    * Examples: *

       * "Fahrvergnügen".toUpperCase() returns "FAHRVERGNÜGEN"
       * "Visit Ljubinje!".toUpperCase() returns "VISIT LJUBINJE!"
       * 
    * * @return the string, converted to uppercase. * @see java.lang.Character#toUpperCase(char) * @see java.lang.String#toUpperCase(Locale) */ public abstract XMLString toUpperCase(); /** * Removes white space from both ends of this string. *

    * If this String object represents an empty character * sequence, or the first and last characters of character sequence * represented by this String object both have codes * greater than '\u0020' (the space character), then a * reference to this String object is returned. *

    * Otherwise, if there is no character with a code greater than * '\u0020' in the string, then a new * String object representing an empty string is created * and returned. *

    * Otherwise, let k be the index of the first character in the * string whose code is greater than '\u0020', and let * m be the index of the last character in the string whose code * is greater than '\u0020'. A new String * object is created, representing the substring of this string that * begins with the character at index k and ends with the * character at index m-that is, the result of * this.substring(km+1). *

    * This method may be used to trim * {@link Character#isSpace(char) whitespace} from the beginning and end * of a string; in fact, it trims all ASCII control characters as well. * * @return this string, with white space removed from the front and end. */ public abstract XMLString trim(); /** * This object (which is already a string!) is itself returned. * * @return the string itself. */ public abstract String toString(); /** * Tell if this object contains a java String object. * * @return true if this XMLString can return a string without creating one. */ public abstract boolean hasString(); /** * Convert a string to a double -- Allowed input is in fixed * notation ddd.fff. * * @return A double value representation of the string, or return Double.NaN * if the string can not be converted. */ public double toDouble(); } libxalan2-java-2.7.1/src/org/apache/xml/utils/TreeWalker.java0000644000175000017500000003450310721374032022753 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TreeWalker.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.File; import org.w3c.dom.Comment; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.LocatorImpl; /** * This class does a pre-order walk of the DOM tree, calling a ContentHandler * interface as it goes. * @xsl.usage advanced */ public class TreeWalker { /** Local reference to a ContentHandler */ private ContentHandler m_contentHandler = null; // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! // DOM2Helper m_dh = new DOM2Helper(); /** DomHelper for this TreeWalker */ protected DOMHelper m_dh; /** Locator object for this TreeWalker */ private LocatorImpl m_locator = new LocatorImpl(); /** * Get the ContentHandler used for the tree walk. * * @return the ContentHandler used for the tree walk */ public ContentHandler getContentHandler() { return m_contentHandler; } /** * Get the ContentHandler used for the tree walk. * * @return the ContentHandler used for the tree walk */ public void setContentHandler(ContentHandler ch) { m_contentHandler = ch; } /** * Constructor. * @param contentHandler The implemention of the * @param systemId System identifier for the document. * contentHandler operation (toXMLString, digest, ...) */ public TreeWalker(ContentHandler contentHandler, DOMHelper dh, String systemId) { this.m_contentHandler = contentHandler; m_contentHandler.setDocumentLocator(m_locator); if (systemId != null) m_locator.setSystemId(systemId); else { try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) {// user.dir not accessible from applet } } m_dh = dh; } /** * Constructor. * @param contentHandler The implemention of the * contentHandler operation (toXMLString, digest, ...) */ public TreeWalker(ContentHandler contentHandler, DOMHelper dh) { this.m_contentHandler = contentHandler; m_contentHandler.setDocumentLocator(m_locator); try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se){// user.dir not accessible from applet } m_dh = dh; } /** * Constructor. * @param contentHandler The implemention of the * contentHandler operation (toXMLString, digest, ...) */ public TreeWalker(ContentHandler contentHandler) { this.m_contentHandler = contentHandler; if (m_contentHandler != null) m_contentHandler.setDocumentLocator(m_locator); try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se){// user.dir not accessible from applet } m_dh = new DOM2Helper(); } /** * Perform a pre-order traversal non-recursive style. * * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * * @throws TransformerException */ public void traverse(Node pos) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); traverseFragment(pos); this.m_contentHandler.endDocument(); } /** * Perform a pre-order traversal non-recursive style. * * In contrast to the traverse() method this method will not issue * startDocument() and endDocument() events to the SAX listener. * * @param pos Node in the tree where to start traversal * * @throws TransformerException */ public void traverseFragment(Node pos) throws org.xml.sax.SAXException { Node top = pos; while (null != pos) { startNode(pos); Node nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if (top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || (top.equals(pos))) { if (null != pos) endNode(pos); nextNode = null; break; } } } pos = nextNode; } } /** * Perform a pre-order traversal non-recursive style. * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * @param top Node in the tree where to end traversal * * @throws TransformerException */ public void traverse(Node pos, Node top) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); while (null != pos) { startNode(pos); Node nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if ((null != top) && top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || ((null != top) && top.equals(pos))) { nextNode = null; break; } } } pos = nextNode; } this.m_contentHandler.endDocument(); } /** Flag indicating whether following text to be processed is raw text */ boolean nextIsRaw = false; /** * Optimized dispatch of characters. */ private final void dispatachChars(Node node) throws org.xml.sax.SAXException { if(m_contentHandler instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler) { ((org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)m_contentHandler).characters(node); } else { String data = ((Text) node).getData(); this.m_contentHandler.characters(data.toCharArray(), 0, data.length()); } } /** * Start processing given node * * * @param node Node to process * * @throws org.xml.sax.SAXException */ protected void startNode(Node node) throws org.xml.sax.SAXException { if (m_contentHandler instanceof NodeConsumer) { ((NodeConsumer) m_contentHandler).setOriginatingNode(node); } if (node instanceof Locator) { Locator loc = (Locator)node; m_locator.setColumnNumber(loc.getColumnNumber()); m_locator.setLineNumber(loc.getLineNumber()); m_locator.setPublicId(loc.getPublicId()); m_locator.setSystemId(loc.getSystemId()); } else { m_locator.setColumnNumber(0); m_locator.setLineNumber(0); } switch (node.getNodeType()) { case Node.COMMENT_NODE : { String data = ((Comment) node).getData(); if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.comment(data.toCharArray(), 0, data.length()); } } break; case Node.DOCUMENT_FRAGMENT_NODE : // ??; break; case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : NamedNodeMap atts = ((Element) node).getAttributes(); int nAttrs = atts.getLength(); // System.out.println("TreeWalker#startNode: "+node.getNodeName()); for (int i = 0; i < nAttrs; i++) { Node attr = atts.item(i); String attrName = attr.getNodeName(); // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue()); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue()); int index; // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" . String prefix = (index = attrName.indexOf(":")) < 0 ? "" : attrName.substring(index + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); } } // System.out.println("m_dh.getNamespaceOfNode(node): "+m_dh.getNamespaceOfNode(node)); // System.out.println("m_dh.getLocalNameOfNode(node): "+m_dh.getLocalNameOfNode(node)); String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(), new AttList(atts, m_dh)); break; case Node.PROCESSING_INSTRUCTION_NODE : { ProcessingInstruction pi = (ProcessingInstruction) node; String name = pi.getNodeName(); // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { nextIsRaw = true; } else { this.m_contentHandler.processingInstruction(pi.getNodeName(), pi.getData()); } } break; case Node.CDATA_SECTION_NODE : { boolean isLexH = (m_contentHandler instanceof LexicalHandler); LexicalHandler lh = isLexH ? ((LexicalHandler) this.m_contentHandler) : null; if (isLexH) { lh.startCDATA(); } dispatachChars(node); { if (isLexH) { lh.endCDATA(); } } } break; case Node.TEXT_NODE : { //String data = ((Text) node).getData(); if (nextIsRaw) { nextIsRaw = false; m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { dispatachChars(node); } } break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { ((LexicalHandler) this.m_contentHandler).startEntity( eref.getNodeName()); } else { // warning("Can not output entity to a pure SAX ContentHandler"); } } break; default : } } /** * End processing of given node * * * @param node Node we just finished processing * * @throws org.xml.sax.SAXException */ protected void endNode(Node node) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName()); NamedNodeMap atts = ((Element) node).getAttributes(); int nAttrs = atts.getLength(); for (int i = 0; i < nAttrs; i++) { Node attr = atts.item(i); String attrName = attr.getNodeName(); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { int index; // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" . String prefix = (index = attrName.indexOf(":")) < 0 ? "" : attrName.substring(index + 1); this.m_contentHandler.endPrefixMapping(prefix); } } break; case Node.CDATA_SECTION_NODE : break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.endEntity(eref.getNodeName()); } } break; default : } } } //TreeWalker libxalan2-java-2.7.1/src/org/apache/xml/utils/IntVector.java0000644000175000017500000002421110721374030022614 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntVector.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple table that stores a list of int. * * This version is based on a "realloc" strategy -- a simle array is * used, and when more storage is needed, a larger array is obtained * and all existing data is recopied into it. As a result, read/write * access to existing nodes is O(1) fast but appending may be O(N**2) * slow. See also SuballocatedIntVector. * @xsl.usage internal */ public class IntVector implements Cloneable { /** Size of blocks to allocate */ protected int m_blocksize; /** Array of ints */ protected int m_map[]; // IntStack is trying to see this directly /** Number of ints in array */ protected int m_firstFree = 0; /** Size of array */ protected int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public IntVector() { m_blocksize = 32; m_mapSize = m_blocksize; m_map = new int[m_blocksize]; } /** * Construct a IntVector, using the given block size. * * @param blocksize Size of block to allocate */ public IntVector(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new int[blocksize]; } /** * Construct a IntVector, using the given block size. * * @param blocksize Size of block to allocate */ public IntVector(int blocksize, int increaseSize) { m_blocksize = increaseSize; m_mapSize = blocksize; m_map = new int[blocksize]; } /** * Copy constructor for IntVector * * @param v Existing IntVector to copy */ public IntVector(IntVector v) { m_map = new int[v.m_mapSize]; m_mapSize = v.m_mapSize; m_firstFree = v.m_firstFree; m_blocksize = v.m_blocksize; System.arraycopy(v.m_map, 0, m_map, 0, m_firstFree); } /** * Get the length of the list. * * @return length of the list */ public final int size() { return m_firstFree; } /** * Get the length of the list. * * @return length of the list */ public final void setSize(int sz) { m_firstFree = sz; } /** * Append a int onto the vector. * * @param value Int to add to the list */ public final void addElement(int value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = value; m_firstFree++; } /** * Append several int values onto the vector. * * @param value Int to add to the list */ public final void addElements(int value, int numberOfElements) { if ((m_firstFree + numberOfElements) >= m_mapSize) { m_mapSize += (m_blocksize+numberOfElements); int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } for (int i = 0; i < numberOfElements; i++) { m_map[m_firstFree] = value; m_firstFree++; } } /** * Append several slots onto the vector, but do not set the values. * * @param numberOfElements Int to add to the list */ public final void addElements(int numberOfElements) { if ((m_firstFree + numberOfElements) >= m_mapSize) { m_mapSize += (m_blocksize+numberOfElements); int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_firstFree += numberOfElements; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * @param value Int to insert * @param at Index of where to insert */ public final void insertElementAt(int value, int at) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } if (at <= (m_firstFree - 1)) { System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at); } m_map[at] = value; m_firstFree++; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. */ public final void removeAllElements() { for (int i = 0; i < m_firstFree; i++) { m_map[i] = java.lang.Integer.MIN_VALUE; } m_firstFree = 0; } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s Int to remove from array * * @return True if the int was removed, false if it was not found */ public final boolean removeElement(int s) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i] == s) { if ((i + 1) < m_firstFree) System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i); else m_map[i] = java.lang.Integer.MIN_VALUE; m_firstFree--; return true; } } return false; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param i index of where to remove and int */ public final void removeElementAt(int i) { if (i > m_firstFree) System.arraycopy(m_map, i + 1, m_map, i, m_firstFree); else m_map[i] = java.lang.Integer.MIN_VALUE; m_firstFree--; } /** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param value object to set * @param index Index of where to set the object */ public final void setElementAt(int value, int index) { m_map[index] = value; } /** * Get the nth element. * * @param i index of object to get * * @return object at given index */ public final int elementAt(int i) { return m_map[i]; } /** * Tell if the table contains the given node. * * @param s object to look for * * @return true if the object is in the list */ public final boolean contains(int s) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i] == s) return true; } return false; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem object to look for * @param index Index of where to begin search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int indexOf(int elem, int index) { for (int i = index; i < m_firstFree; i++) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem object to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int indexOf(int elem) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Object to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int lastIndexOf(int elem) { for (int i = (m_firstFree - 1); i >= 0; i--) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; } /** * Returns clone of current IntVector * * @return clone of current IntVector */ public Object clone() throws CloneNotSupportedException { return new IntVector(this); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/ObjectFactory.java0000644000175000017500000006357710721374032023461 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.utils; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

    * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

    * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

      *
    1. query the system property using System.getProperty *
    2. read META-INF/services/factoryId file *
    3. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 2036619216663421552L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xml/utils/IntStack.java0000644000175000017500000001147210721374033022427 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntStack.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.util.EmptyStackException; /** * Implement a stack of simple integers. * * %OPT% * This is currently based on IntVector, which permits fast acess but pays a * heavy recopying penalty if/when its size is increased. If we expect deep * stacks, we should consider a version based on ChunkedIntVector. * @xsl.usage internal */ public class IntStack extends IntVector { /** * Default constructor. Note that the default * block size is very small, for small lists. */ public IntStack() { super(); } /** * Construct a IntVector, using the given block size. * * @param blocksize Size of block to allocate */ public IntStack(int blocksize) { super(blocksize); } /** * Copy constructor for IntStack * * @param v IntStack to copy */ public IntStack (IntStack v) { super(v); } /** * Pushes an item onto the top of this stack. * * @param i the int to be pushed onto this stack. * @return the item argument. */ public int push(int i) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = i; m_firstFree++; return i; } /** * Removes the object at the top of this stack and returns that * object as the value of this function. * * @return The object at the top of this stack. */ public final int pop() { return m_map[--m_firstFree]; } /** * Quickly pops a number of items from the stack. */ public final void quickPop(int n) { m_firstFree -= n; } /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack. * @throws EmptyStackException if this stack is empty. */ public final int peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } /** * Looks at the object at the position the stack counting down n items. * * @param n The number of items down, indexed from zero. * @return the object at n items down. * @throws EmptyStackException if this stack is empty. */ public int peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } /** * Sets an object at a the top of the statck * * * @param val object to set at the top * @throws EmptyStackException if this stack is empty. */ public void setTop(int val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } /** * Tests if this stack is empty. * * @return true if this stack is empty; * false otherwise. * @since JDK1.0 */ public boolean empty() { return m_firstFree == 0; } /** * Returns where an object is on this stack. * * @param o the desired object. * @return the distance from the top of the stack where the object is] * located; the return value -1 indicates that the * object is not on the stack. * @since JDK1.0 */ public int search(int o) { int i = lastIndexOf(o); if (i >= 0) { return size() - i; } return -1; } /** * Returns clone of current IntStack * * @return clone of current IntStack */ public Object clone() throws CloneNotSupportedException { return (IntStack) super.clone(); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/UnImplNode.java0000644000175000017500000015631710721374032022730 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnImplNode.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.TypeInfo; /** * To be subclassed by classes that wish to fake being nodes. * @xsl.usage internal */ public class UnImplNode implements Node, Element, NodeList, Document { /** * Constructor UnImplNode * */ public UnImplNode(){} /** * Throw an error. * * @param msg Message Key for the error */ public void error(String msg) { System.out.println("DOM ERROR! class: " + this.getClass().getName()); throw new RuntimeException(XMLMessages.createXMLMessage(msg, null)); } /** * Throw an error. * * @param msg Message Key for the error * @param args Array of arguments to be used in the error message */ public void error(String msg, Object[] args) { System.out.println("DOM ERROR! class: " + this.getClass().getName()); throw new RuntimeException(XMLMessages.createXMLMessage(msg, args)); //"UnImplNode error: "+msg); } /** * Unimplemented. See org.w3c.dom.Node * * @param newChild New node to append to the list of this node's children * * @return null * * @throws DOMException */ public Node appendChild(Node newChild) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"appendChild not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return false */ public boolean hasChildNodes() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasChildNodes not supported!"); return false; } /** * Unimplemented. See org.w3c.dom.Node * * @return 0 */ public short getNodeType() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeType not supported!"); return 0; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Node getParentNode() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getParentNode not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public NodeList getChildNodes() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getChildNodes not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Node getFirstChild() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getFirstChild not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Node getLastChild() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLastChild not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Node getNextSibling() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNextSibling not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.NodeList * * @return 0 */ public int getLength() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLength not supported!"); return 0; } // getLength():int /** * Unimplemented. See org.w3c.dom.NodeList * * @param index index of a child of this node in its list of children * * @return null */ public Node item(int index) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"item not supported!"); return null; } // item(int):Node /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Document getOwnerDocument() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerDocument not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public String getTagName() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getTagName not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public String getNodeName() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeName not supported!"); return null; } /** Unimplemented. See org.w3c.dom.Node */ public void normalize() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"normalize not supported!"); } /** * Unimplemented. See org.w3c.dom.Element * * @param name Name of the element * * @return null */ public NodeList getElementsByTagName(String name) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagName not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * @param oldAttr Attribute to be removed from this node's list of attributes * * @return null * * @throws DOMException */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNode not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * @param newAttr Attribute node to be added to this node's list of attributes * * @return null * * @throws DOMException */ public Attr setAttributeNode(Attr newAttr) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNode not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * * @param name Name of an attribute * * @return false */ public boolean hasAttribute(String name) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttribute not supported!"); return false; } /** * Unimplemented. See org.w3c.dom.Element * * * @param name * @param x * * @return false */ public boolean hasAttributeNS(String name, String x) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributeNS not supported!"); return false; } /** * Unimplemented. See org.w3c.dom.Element * * * @param name Attribute node name * * @return null */ public Attr getAttributeNode(String name) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNode not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * @param name Attribute node name to remove from list of attributes * * @throws DOMException */ public void removeAttribute(String name) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttribute not supported!"); } /** * Unimplemented. See org.w3c.dom.Element * * @param name Name of attribute to set * @param value Value of attribute * * @throws DOMException */ public void setAttribute(String name, String value) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttribute not supported!"); } /** * Unimplemented. See org.w3c.dom.Element * * @param name Name of attribute to get * * @return null */ public String getAttribute(String name) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttribute not supported!"); return null; } /** * Unimplemented. Introduced in DOM Level 2. * * @return false */ public boolean hasAttributes() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributes not supported!"); return false; } /** * Unimplemented. See org.w3c.dom.Element * * @param namespaceURI Namespace URI of the element * @param localName Local part of qualified name of the element * * @return null */ public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagNameNS not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * @param newAttr Attribute to set * * @return null * * @throws DOMException */ public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNodeNS not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * @param namespaceURI Namespace URI of attribute node to get * @param localName Local part of qualified name of attribute node to get * * @return null */ public Attr getAttributeNodeNS(String namespaceURI, String localName) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNodeNS not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Element * * @param namespaceURI Namespace URI of attribute node to remove * @param localName Local part of qualified name of attribute node to remove * * @throws DOMException */ public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNS not supported!"); } /** * Unimplemented. See org.w3c.dom.Element * * @param namespaceURI Namespace URI of attribute node to set * NEEDSDOC @param qualifiedName * @param value value of attribute * * @throws DOMException */ public void setAttributeNS( String namespaceURI, String qualifiedName, String value) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNS not supported!"); } /** * Unimplemented. See org.w3c.dom.Element * * @param namespaceURI Namespace URI of attribute node to get * @param localName Local part of qualified name of attribute node to get * * @return null */ public String getAttributeNS(String namespaceURI, String localName) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Node getPreviousSibling() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPreviousSibling not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @param deep Flag indicating whether to clone deep (clone member variables) * * @return null */ public Node cloneNode(boolean deep) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"cloneNode not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null * * @throws DOMException */ public String getNodeValue() throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeValue not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @param nodeValue Value to set this node to * * @throws DOMException */ public void setNodeValue(String nodeValue) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setNodeValue not supported!"); } /** * Unimplemented. See org.w3c.dom.Node * * * NEEDSDOC @param value * @return value Node value * * @throws DOMException */ // public String getValue () // { // error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getValue not supported!"); // return null; // } /** * Unimplemented. See org.w3c.dom.Node * * @param value Value to set this node to * * @throws DOMException */ public void setValue(String value) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!"); } /** * Returns the name of this attribute. * * @return the name of this attribute. */ // public String getName() // { // return this.getNodeName(); // } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public Element getOwnerElement() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerElement not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return False */ public boolean getSpecified() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!"); return false; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public NamedNodeMap getAttributes() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributes not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @param newChild New child node to insert * @param refChild Insert in front of this child * * @return null * * @throws DOMException */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"insertBefore not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @param newChild Replace existing child with this one * @param oldChild Existing child to be replaced * * @return null * * @throws DOMException */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @param oldChild Child to be removed * * @return null * * @throws DOMException */ public Node removeChild(Node oldChild) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!"); return null; } /** * Tests whether the DOM implementation implements a specific feature and * that feature is supported by this node. * @param feature The name of the feature to test. This is the same name * which can be passed to the method hasFeature on * DOMImplementation. * @param version This is the version number of the feature to test. In * Level 2, version 1, this is the string "2.0". If the version is not * specified, supporting any version of the feature will cause the * method to return true. * * @return Returns false * @since DOM Level 2 */ public boolean isSupported(String feature, String version) { return false; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public String getNamespaceURI() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNamespaceURI not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public String getPrefix() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPrefix not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Node * * @param prefix Prefix to set for this node * * @throws DOMException */ public void setPrefix(String prefix) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setPrefix not supported!"); } /** * Unimplemented. See org.w3c.dom.Node * * @return null */ public String getLocalName() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLocalName not supported!"); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @return null */ public DocumentType getDoctype() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @return null */ public DOMImplementation getImplementation() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @return null */ public Element getDocumentElement() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param tagName Element tag name * * @return null * * @throws DOMException */ public Element createElement(String tagName) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @return null */ public DocumentFragment createDocumentFragment() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param data Data for text node * * @return null */ public Text createTextNode(String data) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param data Data for comment * * @return null */ public Comment createComment(String data) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param data Data for CDATA section * * @return null * * @throws DOMException */ public CDATASection createCDATASection(String data) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param target Target for Processing instruction * @param data Data for Processing instruction * * @return null * * @throws DOMException */ public ProcessingInstruction createProcessingInstruction( String target, String data) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param name Attribute name * * @return null * * @throws DOMException */ public Attr createAttribute(String name) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param name Entity Reference name * * @return null * * @throws DOMException */ public EntityReference createEntityReference(String name) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param importedNode The node to import. * @param deep If true, recursively import the subtree under * the specified node; if false, import only the node * itself, as explained above. This has no effect on Attr * , EntityReference, and Notation nodes. * * @return null * * @throws DOMException */ public Node importNode(Node importedNode, boolean deep) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param namespaceURI Namespace URI for the element * @param qualifiedName Qualified name of the element * * @return null * * @throws DOMException */ public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param namespaceURI Namespace URI of the attribute * @param qualifiedName Qualified name of the attribute * * @return null * * @throws DOMException */ public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. See org.w3c.dom.Document * * @param elementId ID of the element to get * * @return null */ public Element getElementById(String elementId) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Set Node data * * * @param data data to set for this node * * @throws DOMException */ public void setData(String data) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } /** * Unimplemented. * * @param offset Start offset of substring to extract. * @param count The length of the substring to extract. * * @return null * * @throws DOMException */ public String substringData(int offset, int count) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * Unimplemented. * * @param arg String data to append * * @throws DOMException */ public void appendData(String arg) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } /** * Unimplemented. * * @param offset Start offset of substring to insert. * NEEDSDOC @param arg * * @throws DOMException */ public void insertData(int offset, String arg) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } /** * Unimplemented. * * @param offset Start offset of substring to delete. * @param count The length of the substring to delete. * * @throws DOMException */ public void deleteData(int offset, int count) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } /** * Unimplemented. * * @param offset Start offset of substring to replace. * @param count The length of the substring to replace. * @param arg substring to replace with * * @throws DOMException */ public void replaceData(int offset, int count, String arg) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } /** * Unimplemented. * * @param offset Offset into text to split * * @return null, unimplemented * * @throws DOMException */ public Text splitText(int offset) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** * NEEDSDOC Method adoptNode * * * NEEDSDOC @param source * * NEEDSDOC (adoptNode) @return * * @throws DOMException */ public Node adoptNode(Node source) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying, as part of the XML declaration, the encoding * of this document. This is null when unspecified. * @since DOM Level 3 * * NEEDSDOC ($objectName$) @return */ public String getInputEncoding() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying, as part of the XML declaration, the encoding * of this document. This is null when unspecified. * @since DOM Level 3 * * NEEDSDOC @param encoding */ public void setInputEncoding(String encoding) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying whether errors checking is enforced or not. * When set to false, the implementation is free to not * test every possible error case normally defined on DOM operations, * and not raise any DOMException. In case of error, the * behavior is undefined. This attribute is true by * defaults. * @since DOM Level 3 * * NEEDSDOC ($objectName$) @return */ public boolean getStrictErrorChecking() { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return false; } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying whether errors checking is enforced or not. * When set to false, the implementation is free to not * test every possible error case normally defined on DOM operations, * and not raise any DOMException. In case of error, the * behavior is undefined. This attribute is true by * defaults. * @since DOM Level 3 * * NEEDSDOC @param strictErrorChecking */ public void setStrictErrorChecking(boolean strictErrorChecking) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); } // RAMESH : Pending proper implementation of DOM Level 3 public Object setUserData(String key, Object data, UserDataHandler handler) { return getOwnerDocument().setUserData( key, data, handler); } /** * Retrieves the object associated to a key on a this node. The object * must first have been set to this node by calling * setUserData with the same key. * @param key The key the object is associated to. * @return Returns the DOMObject associated to the given key * on this node, or null if there was none. * @since DOM Level 3 */ public Object getUserData(String key) { return getOwnerDocument().getUserData( key); } /** * This method returns a specialized object which implements the * specialized APIs of the specified feature and version. The * specialized object may also be obtained by using binding-specific * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations. * @param feature The name of the feature requested (case-insensitive). * @param version This is the version number of the feature to test. If * the version is null or the empty string, supporting * any version of the feature will cause the method to return an * object that supports at least one version of the feature. * @return Returns an object which implements the specialized APIs of * the specified feature and version, if any, or null if * there is no object which implements interfaces associated with that * feature. If the DOMObject returned by this method * implements the Node interface, it must delegate to the * primary core Node and not return results inconsistent * with the primary core Node such as attributes, * childNodes, etc. * @since DOM Level 3 */ public Object getFeature(String feature, String version) { // we don't have any alternate node, either this node does the job // or we don't have anything that does return isSupported(feature, version) ? this : null; } /** * Tests whether two nodes are equal. *
    This method tests for equality of nodes, not sameness (i.e., * whether the two nodes are references to the same object) which can be * tested with Node.isSameNode. All nodes that are the same * will also be equal, though the reverse may not be true. *
    Two nodes are equal if and only if the following conditions are * satisfied: The two nodes are of the same type.The following string * attributes are equal: nodeName, localName, * namespaceURI, prefix, nodeValue * , baseURI. This is: they are both null, or * they have the same length and are character for character identical. * The attributes NamedNodeMaps are equal. * This is: they are both null, or they have the same * length and for each node that exists in one map there is a node that * exists in the other map and is equal, although not necessarily at the * same index.The childNodes NodeLists are * equal. This is: they are both null, or they have the * same length and contain equal nodes at the same index. This is true * for Attr nodes as for any other type of node. Note that * normalization can affect equality; to avoid this, nodes should be * normalized before being compared. *
    For two DocumentType nodes to be equal, the following * conditions must also be satisfied: The following string attributes * are equal: publicId, systemId, * internalSubset.The entities * NamedNodeMaps are equal.The notations * NamedNodeMaps are equal. *
    On the other hand, the following do not affect equality: the * ownerDocument attribute, the specified * attribute for Attr nodes, the * isWhitespaceInElementContent attribute for * Text nodes, as well as any user data or event listeners * registered on the nodes. * @param arg The node to compare equality with. * @param deep If true, recursively compare the subtrees; if * false, compare only the nodes themselves (and its * attributes, if it is an Element). * @return If the nodes, and possibly subtrees are equal, * true otherwise false. * @since DOM Level 3 */ public boolean isEqualNode(Node arg) { if (arg == this) { return true; } if (arg.getNodeType() != getNodeType()) { return false; } // in theory nodeName can't be null but better be careful // who knows what other implementations may be doing?... if (getNodeName() == null) { if (arg.getNodeName() != null) { return false; } } else if (!getNodeName().equals(arg.getNodeName())) { return false; } if (getLocalName() == null) { if (arg.getLocalName() != null) { return false; } } else if (!getLocalName().equals(arg.getLocalName())) { return false; } if (getNamespaceURI() == null) { if (arg.getNamespaceURI() != null) { return false; } } else if (!getNamespaceURI().equals(arg.getNamespaceURI())) { return false; } if (getPrefix() == null) { if (arg.getPrefix() != null) { return false; } } else if (!getPrefix().equals(arg.getPrefix())) { return false; } if (getNodeValue() == null) { if (arg.getNodeValue() != null) { return false; } } else if (!getNodeValue().equals(arg.getNodeValue())) { return false; } /* if (getBaseURI() == null) { if (((NodeImpl) arg).getBaseURI() != null) { return false; } } else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) { return false; } */ return true; } /** * DOM Level 3: * Look up the namespace URI associated to the given prefix, starting from this node. * Use lookupNamespaceURI(null) to lookup the default namespace * * @param namespaceURI * @return th URI for the namespace * @since DOM Level 3 */ public String lookupNamespaceURI(String specifiedPrefix) { short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE : { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (namespace !=null) { // REVISIT: is it possible that prefix is empty string? if (specifiedPrefix== null && prefix==specifiedPrefix) { // looking for default namespace return namespace; } else if (prefix != null && prefix.equals(specifiedPrefix)) { // non default namespace return namespace; } } if (this.hasAttributes()) { NamedNodeMap map = this.getAttributes(); int length = map.getLength(); for (int i=0;inamespaceURI is the * default namespace or not. * @param namespaceURI The namespace URI to look for. * @return true if the specified namespaceURI * is the default namespace, false otherwise. * @since DOM Level 3 */ public boolean isDefaultNamespace(String namespaceURI){ /* // REVISIT: remove casts when DOM L3 becomes REC. short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); // REVISIT: is it possible that prefix is empty string? if (prefix == null || prefix.length() == 0) { if (namespaceURI == null) { return (namespace == namespaceURI); } return namespaceURI.equals(namespace); } if (this.hasAttributes()) { ElementImpl elem = (ElementImpl)this; NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns"); if (attr != null) { String value = attr.getNodeValue(); if (namespaceURI == null) { return (namespace == value); } return namespaceURI.equals(value); } } NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); } return false; } case Node.DOCUMENT_NODE:{ return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI); } case Node.ENTITY_NODE : case Node.NOTATION_NODE: case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE: // type is unknown return false; case Node.ATTRIBUTE_NODE:{ if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) { return ownerNode.isDefaultNamespace(namespaceURI); } return false; } default:{ NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); } return false; } } */ return false; } /** * * DOM Level 3: * Look up the prefix associated to the given namespace URI, starting from this node. * * @param namespaceURI * @return the prefix for the namespace */ public String lookupPrefix(String namespaceURI){ // REVISIT: When Namespaces 1.1 comes out this may not be true // Prefix can't be bound to null namespace if (namespaceURI == null) { return null; } short type = this.getNodeType(); switch (type) { /* case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); // to flip out children return lookupNamespacePrefix(namespaceURI, (ElementImpl)this); } case Node.DOCUMENT_NODE:{ return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI); } */ case Node.ENTITY_NODE : case Node.NOTATION_NODE: case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE: // type is unknown return null; case Node.ATTRIBUTE_NODE:{ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) { return getOwnerElement().lookupPrefix(namespaceURI); } return null; } default:{ /* NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.lookupPrefix(namespaceURI); } */ return null; } } } /** * Returns whether this node is the same node as the given one. *
    This method provides a way to determine whether two * Node references returned by the implementation reference * the same object. When two Node references are references * to the same object, even if through a proxy, the references may be * used completely interchangably, such that all attributes have the * same values and calling the same DOM method on either reference * always has exactly the same effect. * @param other The node to test against. * @return Returns true if the nodes are the same, * false otherwise. * @since DOM Level 3 */ public boolean isSameNode(Node other) { // we do not use any wrapper so the answer is obvious return this == other; } /** * This attribute returns the text content of this node and its * descendants. When it is defined to be null, setting it has no effect. * When set, any possible children this node may have are removed and * replaced by a single Text node containing the string * this attribute is set to. On getting, no serialization is performed, * the returned string does not contain any markup. No whitespace * normalization is performed, the returned string does not contain the * element content whitespaces . Similarly, on setting, no parsing is * performed either, the input string is taken as pure textual content. *
    The string returned is made of the text content of this node * depending on its type, as defined below: * * * * * * * * * * * * * * * * * *
    Node typeContent
    * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent * attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes
    ATTRIBUTE_NODE, TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE * nodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE * null
    * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @exception DOMException * DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. * @since DOM Level 3 */ public void setTextContent(String textContent) throws DOMException { setNodeValue(textContent); } /** * This attribute returns the text content of this node and its * descendants. When it is defined to be null, setting it has no effect. * When set, any possible children this node may have are removed and * replaced by a single Text node containing the string * this attribute is set to. On getting, no serialization is performed, * the returned string does not contain any markup. No whitespace * normalization is performed, the returned string does not contain the * element content whitespaces . Similarly, on setting, no parsing is * performed either, the input string is taken as pure textual content. *
    The string returned is made of the text content of this node * depending on its type, as defined below: * * * * * * * * * * * * * * * * * *
    Node typeContent
    * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent * attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes
    ATTRIBUTE_NODE, TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE * nodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE * null
    * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @exception DOMException * DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. * @since DOM Level 3 */ public String getTextContent() throws DOMException { return getNodeValue(); // overriden in some subclasses } /** * Compares a node with this node with regard to their position in the * document. * @param other The node to compare against this node. * @return Returns how the given node is positioned relatively to this * node. * @since DOM Level 3 */ public short compareDocumentPosition(Node other) throws DOMException { return 0; } /** * The absolute base URI of this node or null if undefined. * This value is computed according to . However, when the * Document supports the feature "HTML" , the base URI is * computed using first the value of the href attribute of the HTML BASE * element if any, and the value of the documentURI * attribute from the Document interface otherwise. *
    When the node is an Element, a Document * or a a ProcessingInstruction, this attribute represents * the properties [base URI] defined in . When the node is a * Notation, an Entity, or an * EntityReference, this attribute represents the * properties [declaration base URI] in the . How will this be affected * by resolution of relative namespace URIs issue?It's not.Should this * only be on Document, Element, ProcessingInstruction, Entity, and * Notation nodes, according to the infoset? If not, what is it equal to * on other nodes? Null? An empty string? I think it should be the * parent's.No.Should this be read-only and computed or and actual * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and * teleconference 30 May 2001).If the base HTML element is not yet * attached to a document, does the insert change the Document.baseURI? * Yes. (F2F 26 Sep 2001) * @since DOM Level 3 */ public String getBaseURI() { return null; } /** * DOM Level 3 * Renaming node */ public Node renameNode(Node n, String namespaceURI, String name) throws DOMException{ return n; } /** * DOM Level 3 * Normalize document. */ public void normalizeDocument(){ } /** * The configuration used when Document.normalizeDocument is * invoked. * @since DOM Level 3 */ public DOMConfiguration getDomConfig(){ return null; } /** DOM Level 3 feature: documentURI */ protected String fDocumentURI; /** * DOM Level 3 */ public void setDocumentURI(String documentURI){ fDocumentURI= documentURI; } /** * DOM Level 3 * The location of the document or null if undefined. *
    Beware that when the Document supports the feature * "HTML" , the href attribute of the HTML BASE element takes precedence * over this attribute. * @since DOM Level 3 */ public String getDocumentURI(){ return fDocumentURI; } /** DOM Level 3 feature: Document actualEncoding */ protected String actualEncoding; /** * DOM Level 3 * An attribute specifying the actual encoding of this document. This is * null otherwise. *
    This attribute represents the property [character encoding scheme] * defined in . * @since DOM Level 3 */ public String getActualEncoding() { return actualEncoding; } /** * DOM Level 3 * An attribute specifying the actual encoding of this document. This is * null otherwise. *
    This attribute represents the property [character encoding scheme] * defined in . * @since DOM Level 3 */ public void setActualEncoding(String value) { actualEncoding = value; } /** * DOM Level 3 */ public Text replaceWholeText(String content) throws DOMException{ /* if (needsSyncData()) { synchronizeData(); } // make sure we can make the replacement if (!canModify(nextSibling)) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); } Node parent = this.getParentNode(); if (content == null || content.length() == 0) { // remove current node if (parent !=null) { // check if node in the tree parent.removeChild(this); return null; } } Text currentNode = null; if (isReadOnly()){ Text newNode = this.ownerDocument().createTextNode(content); if (parent !=null) { // check if node in the tree parent.insertBefore(newNode, this); parent.removeChild(this); currentNode = newNode; } else { return newNode; } } else { this.setData(content); currentNode = this; } Node sibling = currentNode.getNextSibling(); while ( sibling !=null) { parent.removeChild(sibling); sibling = currentNode.getNextSibling(); } return currentNode; */ return null; //Pending } /** * DOM Level 3 * Returns all text of Text nodes logically-adjacent text * nodes to this node, concatenated in document order. * @since DOM Level 3 */ public String getWholeText(){ /* if (needsSyncData()) { synchronizeData(); } if (nextSibling == null) { return data; } StringBuffer buffer = new StringBuffer(); if (data != null && data.length() != 0) { buffer.append(data); } getWholeText(nextSibling, buffer); return buffer.toString(); */ return null; // PENDING } /** * DOM Level 3 * Returns whether this text node contains whitespace in element content, * often abusively called "ignorable whitespace". */ public boolean isWhitespaceInElementContent(){ return false; } /** * NON-DOM: set the type of this attribute to be ID type. * * @param id */ public void setIdAttribute(boolean id){ //PENDING } /** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttribute(String name, boolean makeId) { //PENDING } /** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttributeNode(Attr at, boolean makeId) { //PENDING } /** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttributeNS(String namespaceURI, String localName, boolean makeId) { //PENDING } /** * Method getSchemaTypeInfo. * @return TypeInfo */ public TypeInfo getSchemaTypeInfo(){ return null; //PENDING } public boolean isId() { return false; //PENDING } private String xmlEncoding; public String getXmlEncoding ( ) { return xmlEncoding; } public void setXmlEncoding ( String xmlEncoding ) { this.xmlEncoding = xmlEncoding; } private boolean xmlStandalone; public boolean getXmlStandalone() { return xmlStandalone; } public void setXmlStandalone(boolean xmlStandalone) throws DOMException { this.xmlStandalone = xmlStandalone; } private String xmlVersion; public String getXmlVersion() { return xmlVersion; } public void setXmlVersion(String xmlVersion) throws DOMException { this.xmlVersion = xmlVersion; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/NodeVector.java0000644000175000017500000003712010721374031022753 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeVector.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.Serializable; import org.apache.xml.dtm.DTM; /** * A very simple table that stores a list of Nodes. * @xsl.usage internal */ public class NodeVector implements Serializable, Cloneable { static final long serialVersionUID = -713473092200731870L; /** * Size of blocks to allocate. * @serial */ private int m_blocksize; /** * Array of nodes this points to. * @serial */ private int m_map[]; /** * Number of nodes in this NodeVector. * @serial */ protected int m_firstFree = 0; /** * Size of the array this points to. * @serial */ private int m_mapSize; // lazy initialization /** * Default constructor. */ public NodeVector() { m_blocksize = 32; m_mapSize = 0; } /** * Construct a NodeVector, using the given block size. * * @param blocksize Size of blocks to allocate */ public NodeVector(int blocksize) { m_blocksize = blocksize; m_mapSize = 0; } /** * Get a cloned LocPathIterator. * * @return A clone of this * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { NodeVector clone = (NodeVector) super.clone(); if ((null != this.m_map) && (this.m_map == clone.m_map)) { clone.m_map = new int[this.m_map.length]; System.arraycopy(this.m_map, 0, clone.m_map, 0, this.m_map.length); } return clone; } /** * Get the length of the list. * * @return Number of nodes in this NodeVector */ public int size() { return m_firstFree; } /** * Append a Node onto the vector. * * @param value Node to add to the vector */ public void addElement(int value) { if ((m_firstFree + 1) >= m_mapSize) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } else { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } } m_map[m_firstFree] = value; m_firstFree++; } /** * Append a Node onto the vector. * * @param value Node to add to the vector */ public final void push(int value) { int ff = m_firstFree; if ((ff + 1) >= m_mapSize) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } else { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, ff + 1); m_map = newMap; } } m_map[ff] = value; ff++; m_firstFree = ff; } /** * Pop a node from the tail of the vector and return the result. * * @return the node at the tail of the vector */ public final int pop() { m_firstFree--; int n = m_map[m_firstFree]; m_map[m_firstFree] = DTM.NULL; return n; } /** * Pop a node from the tail of the vector and return the * top of the stack after the pop. * * @return The top of the stack after it's been popped */ public final int popAndTop() { m_firstFree--; m_map[m_firstFree] = DTM.NULL; return (m_firstFree == 0) ? DTM.NULL : m_map[m_firstFree - 1]; } /** * Pop a node from the tail of the vector. */ public final void popQuick() { m_firstFree--; m_map[m_firstFree] = DTM.NULL; } /** * Return the node at the top of the stack without popping the stack. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @return Node at the top of the stack or null if stack is empty. */ public final int peepOrNull() { return ((null != m_map) && (m_firstFree > 0)) ? m_map[m_firstFree - 1] : DTM.NULL; } /** * Push a pair of nodes into the stack. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @param v1 First node to add to vector * @param v2 Second node to add to vector */ public final void pushPair(int v1, int v2) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } else { if ((m_firstFree + 2) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree); m_map = newMap; } } m_map[m_firstFree] = v1; m_map[m_firstFree + 1] = v2; m_firstFree += 2; } /** * Pop a pair of nodes from the tail of the stack. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. */ public final void popPair() { m_firstFree -= 2; m_map[m_firstFree] = DTM.NULL; m_map[m_firstFree + 1] = DTM.NULL; } /** * Set the tail of the stack to the given node. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @param n Node to set at the tail of vector */ public final void setTail(int n) { m_map[m_firstFree - 1] = n; } /** * Set the given node one position from the tail. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @param n Node to set */ public final void setTailSub1(int n) { m_map[m_firstFree - 2] = n; } /** * Return the node at the tail of the vector without popping * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @return Node at the tail of the vector */ public final int peepTail() { return m_map[m_firstFree - 1]; } /** * Return the node one position from the tail without popping. * Special purpose method for TransformerImpl, pushElemTemplateElement. * Performance critical. * * @return Node one away from the tail */ public final int peepTailSub1() { return m_map[m_firstFree - 2]; } /** * Insert a node in order in the list. * * @param value Node to insert */ public void insertInOrder(int value) { for (int i = 0; i < m_firstFree; i++) { if (value < m_map[i]) { insertElementAt(value, i); return; } } addElement(value); } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. * * @param value Node to insert * @param at Position where to insert */ public void insertElementAt(int value, int at) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } else if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } if (at <= (m_firstFree - 1)) { System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at); } m_map[at] = value; m_firstFree++; } /** * Append the nodes to the list. * * @param nodes NodeVector to append to this list */ public void appendNodes(NodeVector nodes) { int nNodes = nodes.size(); if (null == m_map) { m_mapSize = nNodes + m_blocksize; m_map = new int[m_mapSize]; } else if ((m_firstFree + nNodes) >= m_mapSize) { m_mapSize += (nNodes + m_blocksize); int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes); m_map = newMap; } System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes); m_firstFree += nNodes; } /** * Inserts the specified node in this vector at the specified index. * Each component in this vector with an index greater or equal to * the specified index is shifted upward to have an index one greater * than the value it had previously. */ public void removeAllElements() { if (null == m_map) return; for (int i = 0; i < m_firstFree; i++) { m_map[i] = DTM.NULL; } m_firstFree = 0; } /** * Set the length to zero, but don't clear the array. */ public void RemoveAllNoClear() { if (null == m_map) return; m_firstFree = 0; } /** * Removes the first occurrence of the argument from this vector. * If the object is found in this vector, each component in the vector * with an index greater or equal to the object's index is shifted * downward to have an index one smaller than the value it had * previously. * * @param s Node to remove from the list * * @return True if the node was successfully removed */ public boolean removeElement(int s) { if (null == m_map) return false; for (int i = 0; i < m_firstFree; i++) { int node = m_map[i]; if (node == s) { if (i > m_firstFree) System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i); else m_map[i] = DTM.NULL; m_firstFree--; return true; } } return false; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * index is shifted downward to have an index one smaller than * the value it had previously. * * @param i Index of node to remove */ public void removeElementAt(int i) { if (null == m_map) return; if (i > m_firstFree) System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i); else m_map[i] = DTM.NULL; } /** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param node Node to set * @param index Index of where to set the node */ public void setElementAt(int node, int index) { if (null == m_map) { m_map = new int[m_blocksize]; m_mapSize = m_blocksize; } if(index == -1) addElement(node); m_map[index] = node; } /** * Get the nth element. * * @param i Index of node to get * * @return Node at specified index */ public int elementAt(int i) { if (null == m_map) return DTM.NULL; return m_map[i]; } /** * Tell if the table contains the given node. * * @param s Node to look for * * @return True if the given node was found. */ public boolean contains(int s) { if (null == m_map) return false; for (int i = 0; i < m_firstFree; i++) { int node = m_map[i]; if (node == s) return true; } return false; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @param index Index of where to start the search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(int elem, int index) { if (null == m_map) return -1; for (int i = index; i < m_firstFree; i++) { int node = m_map[i]; if (node == elem) return i; } return -1; } /** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method. * * @param elem Node to look for * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public int indexOf(int elem) { if (null == m_map) return -1; for (int i = 0; i < m_firstFree; i++) { int node = m_map[i]; if (node == elem) return i; } return -1; } /** * Sort an array using a quicksort algorithm. * * @param a The array to be sorted. * @param lo0 The low index. * @param hi0 The high index. * * @throws Exception */ public void sort(int a[], int lo0, int hi0) throws Exception { int lo = lo0; int hi = hi0; // pause(lo, hi); if (lo >= hi) { return; } else if (lo == hi - 1) { /* * sort a two element list by swapping if necessary */ if (a[lo] > a[hi]) { int T = a[lo]; a[lo] = a[hi]; a[hi] = T; } return; } /* * Pick a pivot and move it out of the way */ int pivot = a[(lo + hi) / 2]; a[(lo + hi) / 2] = a[hi]; a[hi] = pivot; while (lo < hi) { /* * Search forward from a[lo] until an element is found that * is greater than the pivot or lo >= hi */ while (a[lo] <= pivot && lo < hi) { lo++; } /* * Search backward from a[hi] until element is found that * is less than the pivot, or lo >= hi */ while (pivot <= a[hi] && lo < hi) { hi--; } /* * Swap elements a[lo] and a[hi] */ if (lo < hi) { int T = a[lo]; a[lo] = a[hi]; a[hi] = T; // pause(); } // if (stopRequested) { // return; // } } /* * Put the median in the "center" of the list */ a[hi0] = a[hi]; a[hi] = pivot; /* * Recursive calls, elements a[lo0] to a[lo-1] are less than or * equal to pivot, elements a[hi+1] to a[hi0] are greater than * pivot. */ sort(a, lo0, lo - 1); sort(a, hi + 1, hi0); } /** * Sort an array using a quicksort algorithm. * * @throws Exception */ public void sort() throws Exception { sort(m_map, 0, m_firstFree - 1); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/XMLCharacterRecognizer.java0000644000175000017500000000603110721374031025205 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLCharacterRecognizer.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * Class used to verify whether the specified ch * conforms to the XML 1.0 definition of whitespace. * @xsl.usage internal */ public class XMLCharacterRecognizer { /** * Returns whether the specified ch conforms to the XML 1.0 definition * of whitespace. Refer to * the definition of S for details. * @param ch Character to check as XML whitespace. * @return =true if ch is XML whitespace; otherwise =false. */ public static boolean isWhiteSpace(char ch) { return (ch == 0x20) || (ch == 0x09) || (ch == 0xD) || (ch == 0xA); } /** * Tell if the string is whitespace. * * @param ch Character array to check as XML whitespace. * @param start Start index of characters in the array * @param length Number of characters in the array * @return True if the characters in the array are * XML whitespace; otherwise, false. */ public static boolean isWhiteSpace(char ch[], int start, int length) { int end = start + length; for (int s = start; s < end; s++) { if (!isWhiteSpace(ch[s])) return false; } return true; } /** * Tell if the string is whitespace. * * @param buf StringBuffer to check as XML whitespace. * @return True if characters in buffer are XML whitespace, false otherwise */ public static boolean isWhiteSpace(StringBuffer buf) { int n = buf.length(); for (int i = 0; i < n; i++) { if (!isWhiteSpace(buf.charAt(i))) return false; } return true; } /** * Tell if the string is whitespace. * * @param s String to check as XML whitespace. * @return True if characters in buffer are XML whitespace, false otherwise */ public static boolean isWhiteSpace(String s) { if(null != s) { int n = s.length(); for (int i = 0; i < n; i++) { if (!isWhiteSpace(s.charAt(i))) return false; } } return true; } } libxalan2-java-2.7.1/src/org/apache/xml/utils/SystemIDResolver.java0000644000175000017500000002210210721374030024117 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SystemIDResolver.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; import java.io.File; import javax.xml.transform.TransformerException; import org.apache.xml.utils.URI.MalformedURIException; /** * This class is used to resolve relative URIs and SystemID * strings into absolute URIs. * *

    This is a generic utility for resolving URIs, other than the * fact that it's declared to throw TransformerException. Please * see code comments for details on how resolution is performed.

    * @xsl.usage internal */ public class SystemIDResolver { /** * Get an absolute URI from a given relative URI (local path). * *

    The relative URI is a local filesystem path. The path can be * absolute or relative. If it is a relative path, it is resolved relative * to the system property "user.dir" if it is available; if not (i.e. in an * Applet perhaps which throws SecurityException) then we just return the * relative path. The space and backslash characters are also replaced to * generate a good absolute URI.

    * * @param localPath The relative URI to resolve * * @return Resolved absolute URI */ public static String getAbsoluteURIFromRelative(String localPath) { if (localPath == null || localPath.length() == 0) return ""; // If the local path is a relative path, then it is resolved against // the "user.dir" system property. String absolutePath = localPath; if (!isAbsolutePath(localPath)) { try { absolutePath = getAbsolutePathFromRelativePath(localPath); } // user.dir not accessible from applet catch (SecurityException se) { return "file:" + localPath; } } String urlString; if (null != absolutePath) { if (absolutePath.startsWith(File.separator)) urlString = "file://" + absolutePath; else urlString = "file:///" + absolutePath; } else urlString = "file:" + localPath; return replaceChars(urlString); } /** * Return an absolute path from a relative path. * * @param relativePath A relative path * @return The absolute path */ private static String getAbsolutePathFromRelativePath(String relativePath) { return new File(relativePath).getAbsolutePath(); } /** * Return true if the systemId denotes an absolute URI . * * @param systemId The systemId string * @return true if the systemId is an an absolute URI */ public static boolean isAbsoluteURI(String systemId) { /** http://www.ietf.org/rfc/rfc2396.txt * Authors should be aware that a path segment which contains a colon * character cannot be used as the first segment of a relative URI path * (e.g., "this:that"), because it would be mistaken for a scheme name. **/ /** * %REVIEW% Can we assume here that systemId is a valid URI? * It looks like we cannot ( See discussion of this common problem in * Bugzilla Bug 22777 ). **/ //"fix" for Bugzilla Bug 22777 if(isWindowsAbsolutePath(systemId)){ return false; } final int fragmentIndex = systemId.indexOf('#'); final int queryIndex = systemId.indexOf('?'); final int slashIndex = systemId.indexOf('/'); final int colonIndex = systemId.indexOf(':'); //finding substring before '#', '?', and '/' int index = systemId.length() -1; if(fragmentIndex > 0) index = fragmentIndex; if((queryIndex > 0) && (queryIndex 0) && (slashIndex 0) && (colonIndex 2 && systemId.charAt(1) == ':' && Character.isLetter(systemId.charAt(0)) && (systemId.charAt(2) == '\\' || systemId.charAt(2) == '/')) return true; else return false; } /** * Replace spaces with "%20" and backslashes with forward slashes in * the input string to generate a well-formed URI string. * * @param str The input string * @return The string after conversion */ private static String replaceChars(String str) { StringBuffer buf = new StringBuffer(str); int length = buf.length(); for (int i = 0; i < length; i++) { char currentChar = buf.charAt(i); // Replace space with "%20" if (currentChar == ' ') { buf.setCharAt(i, '%'); buf.insert(i+1, "20"); length = length + 2; i = i + 2; } // Replace backslash with forward slash else if (currentChar == '\\') { buf.setCharAt(i, '/'); } } return buf.toString(); } /** * Take a SystemID string and try to turn it into a good absolute URI. * * @param systemId A URI string, which may be absolute or relative. * * @return The resolved absolute URI */ public static String getAbsoluteURI(String systemId) { String absoluteURI = systemId; if (isAbsoluteURI(systemId)) { // Only process the systemId if it starts with "file:". if (systemId.startsWith("file:")) { String str = systemId.substring(5); // Resolve the absolute path if the systemId starts with "file:///" // or "file:/". Don't do anything if it only starts with "file://". if (str != null && str.startsWith("/")) { if (str.startsWith("///") || !str.startsWith("//")) { // A Windows path containing a drive letter can be relative. // A Unix path starting with "file:/" is always absolute. int secondColonIndex = systemId.indexOf(':', 5); if (secondColonIndex > 0) { String localPath = systemId.substring(secondColonIndex-1); try { if (!isAbsolutePath(localPath)) absoluteURI = systemId.substring(0, secondColonIndex-1) + getAbsolutePathFromRelativePath(localPath); } catch (SecurityException se) { return systemId; } } } } else { return getAbsoluteURIFromRelative(systemId.substring(5)); } return replaceChars(absoluteURI); } else return systemId; } else return getAbsoluteURIFromRelative(systemId); } /** * Take a SystemID string and try to turn it into a good absolute URI. * * @param urlString SystemID string * @param base The URI string used as the base for resolving the systemID * * @return The resolved absolute URI * @throws TransformerException thrown if the string can't be turned into a URI. */ public static String getAbsoluteURI(String urlString, String base) throws TransformerException { if (base == null) return getAbsoluteURI(urlString); String absoluteBase = getAbsoluteURI(base); URI uri = null; try { URI baseURI = new URI(absoluteBase); uri = new URI(baseURI, urlString); } catch (MalformedURIException mue) { throw new TransformerException(mue); } return replaceChars(uri.toString()); } } libxalan2-java-2.7.1/src/org/apache/xml/utils/StringToStringTableVector.java0000644000175000017500000001106410721374033025777 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringToStringTableVector.java 468655 2006-10-28 07:12:06Z minchau $ */ package org.apache.xml.utils; /** * A very simple table that stores a list of StringToStringTables, optimized * for small lists. * @xsl.usage internal */ public class StringToStringTableVector { /** Size of blocks to allocate */ private int m_blocksize; /** Array of StringToStringTable objects */ private StringToStringTable m_map[]; /** Number of StringToStringTable objects in this array */ private int m_firstFree = 0; /** Size of this array */ private int m_mapSize; /** * Default constructor. Note that the default * block size is very small, for small lists. */ public StringToStringTableVector() { m_blocksize = 8; m_mapSize = m_blocksize; m_map = new StringToStringTable[m_blocksize]; } /** * Construct a StringToStringTableVector, using the given block size. * * @param blocksize Size of blocks to allocate */ public StringToStringTableVector(int blocksize) { m_blocksize = blocksize; m_mapSize = blocksize; m_map = new StringToStringTable[blocksize]; } /** * Get the length of the list. * * @return Number of StringToStringTable objects in the list */ public final int getLength() { return m_firstFree; } /** * Get the length of the list. * * @return Number of StringToStringTable objects in the list */ public final int size() { return m_firstFree; } /** * Append a StringToStringTable object onto the vector. * * @param value StringToStringTable object to add */ public final void addElement(StringToStringTable value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; StringToStringTable newMap[] = new StringToStringTable[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = value; m_firstFree++; } /** * Given a string, find the last added occurance value * that matches the key. * * @param key String to look up * * @return the last added occurance value that matches the key * or null if not found. */ public final String get(String key) { for (int i = m_firstFree - 1; i >= 0; --i) { String nsuri = m_map[i].get(key); if (nsuri != null) return nsuri; } return null; } /** * Given a string, find out if there is a value in this table * that matches the key. * * @param key String to look for * * @return True if the string was found in table, null if not */ public final boolean containsKey(String key) { for (int i = m_firstFree - 1; i >= 0; --i) { if (m_map[i].get(key) != null) return true; } return false; } /** * Remove the last element. */ public final void removeLastElem() { if (m_firstFree > 0) { m_map[m_firstFree] = null; m_firstFree--; } } /** * Get the nth element. * * @param i Index of element to find * * @return The StringToStringTable object at the given index */ public final StringToStringTable elementAt(int i) { return m_map[i]; } /** * Tell if the table contains the given StringToStringTable. * * @param s The StringToStringTable to find * * @return True if the StringToStringTable is found */ public final boolean contains(StringToStringTable s) { for (int i = 0; i < m_firstFree; i++) { if (m_map[i].equals(s)) return true; } return false; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/0000755000175000017500000000000010736146354017474 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/dtm/SecuritySupport.java0000644000175000017500000000735110721374032023537 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.dtm; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/SecuritySupport12.java0000644000175000017500000001165410721374033023704 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xml.dtm; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/Axis.java0000644000175000017500000001573310721374033021243 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Axis.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * Specifies values related to XPath Axes. *

    The ancestor, descendant, following, preceding and self axes partition a * document (ignoring attribute and namespace nodes): they do not overlap * and together they contain all the nodes in the document.

    * */ public final class Axis { /** * The ancestor axis contains the ancestors of the context node; * the ancestors of the context node consist of the parent of context * node and the parent's parent and so on; thus, the ancestor axis will * always include the root node, unless the context node is the root node. */ public static final int ANCESTOR = 0; /** * the ancestor-or-self axis contains the context node and the ancestors of * the context node; thus, the ancestor axis will always include the * root node. */ public static final int ANCESTORORSELF = 1; /** * the attribute axis contains the attributes of the context node; the axis * will be empty unless the context node is an element. */ public static final int ATTRIBUTE = 2; /** The child axis contains the children of the context node. */ public static final int CHILD = 3; /** * The descendant axis contains the descendants of the context node; * a descendant is a child or a child of a child and so on; thus the * descendant axis never contains attribute or namespace nodes. */ public static final int DESCENDANT = 4; /** * The descendant-or-self axis contains the context node and the * descendants of the context node. */ public static final int DESCENDANTORSELF = 5; /** * the following axis contains all nodes in the same document as the * context node that are after the context node in document order, excluding * any descendants and excluding attribute nodes and namespace nodes. */ public static final int FOLLOWING = 6; /** * The following-sibling axis contains all the following siblings of the * context node; if the context node is an attribute node or namespace node, * the following-sibling axis is empty. */ public static final int FOLLOWINGSIBLING = 7; /** * The namespace axis contains the namespace nodes of the context node; the * axis will be empty unless the context node is an element. */ public static final int NAMESPACEDECLS = 8; /** * The namespace axis contains the namespace nodes of the context node; the * axis will be empty unless the context node is an element. */ public static final int NAMESPACE = 9; /** * The parent axis contains the parent of the context node, * if there is one. */ public static final int PARENT = 10; /** * The preceding axis contains all nodes in the same document as the context * node that are before the context node in document order, excluding any * ancestors and excluding attribute nodes and namespace nodes */ public static final int PRECEDING = 11; /** * The preceding-sibling axis contains all the preceding siblings of the * context node; if the context node is an attribute node or namespace node, * the preceding-sibling axis is empty. */ public static final int PRECEDINGSIBLING = 12; /** The self axis contains just the context node itself. */ public static final int SELF = 13; /** * A non-xpath axis, traversing the subtree including the subtree * root, descendants, attributes, and namespace node decls. */ public static final int ALLFROMNODE = 14; /** * A non-xpath axis, traversing the the preceding and the ancestor nodes, * needed for inverseing select patterns to match patterns. */ public static final int PRECEDINGANDANCESTOR = 15; // =========================================== // All axis past this are absolute. /** * A non-xpath axis, returns all nodes in the tree from and including the * root. */ public static final int ALL = 16; /** * A non-xpath axis, returns all nodes that aren't namespaces or attributes, * from and including the root. */ public static final int DESCENDANTSFROMROOT = 17; /** * A non-xpath axis, returns all nodes that aren't namespaces or attributes, * from and including the root. */ public static final int DESCENDANTSORSELFFROMROOT = 18; /** * A non-xpath axis, returns root only. */ public static final int ROOT = 19; /** * A non-xpath axis, for functions. */ public static final int FILTEREDLIST = 20; /** * A table to identify whether an axis is a reverse axis; */ private static final boolean[] isReverse = { true, // ancestor true, // ancestor-or-self false, // attribute false, // child false, // descendant false, // descendant-or-self false, // following false, // following-sibling false, // namespace false, // namespace-declarations false, // parent (one node, has no order) true, // preceding true, // preceding-sibling false // self (one node, has no order) }; /** The names of the axes for diagnostic purposes. */ private static final String[] names = { "ancestor", // 0 "ancestor-or-self", // 1 "attribute", // 2 "child", // 3 "descendant", // 4 "descendant-or-self", // 5 "following", // 6 "following-sibling", // 7 "namespace-decls", // 8 "namespace", // 9 "parent", // 10 "preceding", // 11 "preceding-sibling", // 12 "self", // 13 "all-from-node", // 14 "preceding-and-ancestor", // 15 "all", // 16 "descendants-from-root", // 17 "descendants-or-self-from-root", // 18 "root", // 19 "filtered-list" // 20 }; public static boolean isReverse(int axis){ return isReverse[axis]; } public static String getNames(int index){ return names[index]; } public static int getNamesLength(){ return names.length; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMManager.java0000644000175000017500000003505610721374030022253 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMManager.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.XMLStringFactory; /** * A DTMManager instance can be used to create DTM and * DTMIterator objects, and manage the DTM objects in the system. * *

    The system property that determines which Factory implementation * to create is named "org.apache.xml.utils.DTMFactory". This * property names a concrete subclass of the DTMFactory abstract * class. If the property is not defined, a platform default is be used.

    * *

    An instance of this class must be safe to use across * thread instances. It is expected that a client will create a single instance * of a DTMManager to use across multiple threads. This will allow sharing * of DTMs across multiple processes.

    * *

    Note: this class is incomplete right now. It will be pretty much * modeled after javax.xml.transform.TransformerFactory in terms of its * factory support.

    * *

    State: In progress!!

    */ public abstract class DTMManager { /** The default property name to load the manager. */ private static final String defaultPropName = "org.apache.xml.dtm.DTMManager"; /** The default class name to use as the manager. */ private static String defaultClassName = "org.apache.xml.dtm.ref.DTMManagerDefault"; /** * Factory for creating XMLString objects. * %TBD% Make this set by the caller. */ protected XMLStringFactory m_xsf = null; /** * Default constructor is protected on purpose. */ protected DTMManager(){} /** * Get the XMLStringFactory used for the DTMs. * * * @return a valid XMLStringFactory object, or null if it hasn't been set yet. */ public XMLStringFactory getXMLStringFactory() { return m_xsf; } /** * Set the XMLStringFactory used for the DTMs. * * * @param xsf a valid XMLStringFactory object, should not be null. */ public void setXMLStringFactory(XMLStringFactory xsf) { m_xsf = xsf; } /** * Obtain a new instance of a DTMManager. * This static method creates a new factory instance * This method uses the following ordered lookup procedure to determine * the DTMManager implementation class to * load: *
      *
    • * Use the org.apache.xml.dtm.DTMManager system * property. *
    • *
    • * Use the JAVA_HOME(the parent directory where jdk is * installed)/lib/xalan.properties for a property file that contains the * name of the implementation class keyed on the same value as the * system property defined above. *
    • *
    • * Use the Services API (as detailed in the JAR specification), if * available, to determine the classname. The Services API will look * for a classname in the file * META-INF/services/org.apache.xml.dtm.DTMManager * in jars available to the runtime. *
    • *
    • * Use the default DTMManager classname, which is * org.apache.xml.dtm.ref.DTMManagerDefault. *
    • *
    * * Once an application has obtained a reference to a * DTMManager it can use the factory to configure * and obtain parser instances. * * @return new DTMManager instance, never null. * * @throws DTMConfigurationException * if the implementation is not available or cannot be instantiated. */ public static DTMManager newInstance(XMLStringFactory xsf) throws DTMConfigurationException { DTMManager factoryImpl = null; try { factoryImpl = (DTMManager) ObjectFactory .createObject(defaultPropName, defaultClassName); } catch (ObjectFactory.ConfigurationError e) { throw new DTMConfigurationException(XMLMessages.createXMLMessage( XMLErrorResources.ER_NO_DEFAULT_IMPL, null), e.getException()); //"No default implementation found"); } if (factoryImpl == null) { throw new DTMConfigurationException(XMLMessages.createXMLMessage( XMLErrorResources.ER_NO_DEFAULT_IMPL, null)); //"No default implementation found"); } factoryImpl.setXMLStringFactory(xsf); return factoryImpl; } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * * (More parameters may eventually need to be added for error handling * and entity resolution, and to better control selection of implementations.) * * @param source the specification of the source object, which may be null, * in which case it is assumed that node construction will take * by some other means. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * * @return a non-null DTM reference. */ public abstract DTM getDTM(javax.xml.transform.Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing); /** * Get the instance of DTM that "owns" a node handle. * * @param nodeHandle the nodeHandle. * * @return a non-null DTM reference. */ public abstract DTM getDTM(int nodeHandle); /** * Given a W3C DOM node, try and return a DTM handle. * Note: calling this may be non-optimal. * * @param node Non-null reference to a DOM node. * * @return a valid DTM handle. */ public abstract int getDTMHandleFromNode(org.w3c.dom.Node node); /** * Creates a DTM representing an empty DocumentFragment object. * @return a non-null DTM reference. */ public abstract DTM createDocumentFragment(); /** * Release a DTM either to a lru pool, or completely remove reference. * DTMs without system IDs are always hard deleted. * State: experimental. * * @param dtm The DTM to be released. * @param shouldHardDelete True if the DTM should be removed no matter what. * @return true if the DTM was removed, false if it was put back in a lru pool. */ public abstract boolean release(DTM dtm, boolean shouldHardDelete); /** * Create a new DTMIterator based on an XPath * UnionExpr. * * @param xpathCompiler ??? Somehow we need to pass in a subpart of the * expression. I hate to do this with strings, since the larger expression * has already been parsed. * * @param pos The position in the expression. * @return The newly created DTMIterator. */ public abstract DTMIterator createDTMIterator(Object xpathCompiler, int pos); /** * Create a new DTMIterator based on an XPath * UnionExpr. * * @param xpathString Must be a valid string expressing a * UnionExpr. * * @param presolver An object that can resolve prefixes to namespace URLs. * * @return The newly created DTMIterator. */ public abstract DTMIterator createDTMIterator(String xpathString, PrefixResolver presolver); /** * Create a new DTMIterator based only on a whatToShow * and a DTMFilter. The traversal semantics are defined as the * descendant access. *

    * Note that DTMIterators may not be an exact match to DOM * NodeIterators. They are initialized and used in much the same way * as a NodeIterator, but their response to document mutation is not * currently defined. * * @param whatToShow This flag specifies which node types may appear in * the logical view of the tree presented by the iterator. See the * description of NodeFilter for the set of possible * SHOW_ values.These flags can be combined using * OR. * @param filter The NodeFilter to be used with this * DTMFilter, or null to indicate no filter. * @param entityReferenceExpansion The value of this flag determines * whether entity reference nodes are expanded. * * @return The newly created DTMIterator. */ public abstract DTMIterator createDTMIterator(int whatToShow, DTMFilter filter, boolean entityReferenceExpansion); /** * Create a new DTMIterator that holds exactly one node. * * @param node The node handle that the DTMIterator will iterate to. * * @return The newly created DTMIterator. */ public abstract DTMIterator createDTMIterator(int node); /* Flag indicating whether an incremental transform is desired */ public boolean m_incremental = false; /* * Flag set by FEATURE_SOURCE_LOCATION. * This feature specifies whether the transformation phase should * keep track of line and column numbers for the input source * document. */ public boolean m_source_location = false; /** * Get a flag indicating whether an incremental transform is desired * @return incremental boolean. * */ public boolean getIncremental() { return m_incremental; } /** * Set a flag indicating whether an incremental transform is desired * This flag should have the same value as the FEATURE_INCREMENTAL feature * which is set by the TransformerFactory.setAttribut() method before a * DTMManager is created * @param incremental boolean to use to set m_incremental. * */ public void setIncremental(boolean incremental) { m_incremental = incremental; } /** * Get a flag indicating whether the transformation phase should * keep track of line and column numbers for the input source * document. * @return source location boolean * */ public boolean getSource_location() { return m_source_location; } /** * Set a flag indicating whether the transformation phase should * keep track of line and column numbers for the input source * document. * This flag should have the same value as the FEATURE_SOURCE_LOCATION feature * which is set by the TransformerFactory.setAttribut() method before a * DTMManager is created * @param sourceLocation boolean to use to set m_source_location */ public void setSource_location(boolean sourceLocation){ m_source_location = sourceLocation; } // -------------------- private methods -------------------- /** * Temp debug code - this will be removed after we test everything */ private static boolean debug; static { try { debug = System.getProperty("dtm.debug") != null; } catch (SecurityException ex){} } /** This value, set at compile time, controls how many bits of the * DTM node identifier numbers are used to identify a node within a * document, and thus sets the maximum number of nodes per * document. The remaining bits are used to identify the DTM * document which contains this node. * * If you change IDENT_DTM_NODE_BITS, be sure to rebuild _ALL_ the * files which use it... including the IDKey testcases. * * (FuncGenerateKey currently uses the node identifier directly and * thus is affected when this changes. The IDKEY results will still be * _correct_ (presuming no other breakage), but simple equality * comparison against the previous "golden" files will probably * complain.) * */ public static final int IDENT_DTM_NODE_BITS = 16; /** When this bitmask is ANDed with a DTM node handle number, the result * is the low bits of the node's index number within that DTM. To obtain * the high bits, add the DTM ID portion's offset as assigned in the DTM * Manager. */ public static final int IDENT_NODE_DEFAULT = (1<>> IDENT_DTM_NODE_BITS) + 1; /** * %TBD% Doc * * NEEDSDOC @param dtm * * NEEDSDOC ($objectName$) @return */ public abstract int getDTMIdentity(DTM dtm); /** * %TBD% Doc * * NEEDSDOC ($objectName$) @return */ public int getDTMIdentityMask() { return IDENT_DTM_DEFAULT; } /** * %TBD% Doc * * NEEDSDOC ($objectName$) @return */ public int getNodeIdentityMask() { return IDENT_NODE_DEFAULT; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/0000755000175000017500000000000010736146354020250 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMTreeWalker.java0000644000175000017500000002554710721374031023527 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMTreeWalker.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.NodeConsumer; import org.apache.xml.utils.XMLString; import org.xml.sax.ContentHandler; import org.xml.sax.ext.LexicalHandler; /** * This class does a pre-order walk of the DTM tree, calling a ContentHandler * interface as it goes. As such, it's more like the Visitor design pattern * than like the DOM's TreeWalker. * * I think normally this class should not be needed, because * of DTM#dispatchToEvents. * @xsl.usage advanced */ public class DTMTreeWalker { /** Local reference to a ContentHandler */ private ContentHandler m_contentHandler = null; /** DomHelper for this TreeWalker */ protected DTM m_dtm; /** * Set the DTM to be traversed. * * @param dtm The Document Table Model to be used. */ public void setDTM(DTM dtm) { m_dtm = dtm; } /** * Get the ContentHandler used for the tree walk. * * @return the ContentHandler used for the tree walk */ public ContentHandler getcontentHandler() { return m_contentHandler; } /** * Set the ContentHandler used for the tree walk. * * @param ch the ContentHandler to be the result of the tree walk. */ public void setcontentHandler(ContentHandler ch) { m_contentHandler = ch; } /** * Constructor. */ public DTMTreeWalker() { } /** * Constructor. * @param contentHandler The implemention of the * contentHandler operation (toXMLString, digest, ...) */ public DTMTreeWalker(ContentHandler contentHandler, DTM dtm) { this.m_contentHandler = contentHandler; m_dtm = dtm; } /** Perform a non-recursive pre-order/post-order traversal, * operating as a Visitor. startNode (preorder) and endNode * (postorder) are invoked for each node as we traverse over them, * with the result that the node is written out to m_contentHandler. * * @param pos Node in the tree at which to start (and end) traversal -- * in other words, the root of the subtree to traverse over. * * @throws TransformerException */ public void traverse(int pos) throws org.xml.sax.SAXException { // %REVIEW% Why isn't this just traverse(pos,pos)? int top = pos; // Remember the root of this subtree while (DTM.NULL != pos) { startNode(pos); int nextNode = m_dtm.getFirstChild(pos); while (DTM.NULL == nextNode) { endNode(pos); if (top == pos) break; nextNode = m_dtm.getNextSibling(pos); if (DTM.NULL == nextNode) { pos = m_dtm.getParent(pos); if ((DTM.NULL == pos) || (top == pos)) { // %REVIEW% This condition isn't tested in traverse(pos,top) // -- bug? if (DTM.NULL != pos) endNode(pos); nextNode = DTM.NULL; break; } } } pos = nextNode; } } /** Perform a non-recursive pre-order/post-order traversal, * operating as a Visitor. startNode (preorder) and endNode * (postorder) are invoked for each node as we traverse over them, * with the result that the node is written out to m_contentHandler. * * @param pos Node in the tree where to start traversal * @param top Node in the tree where to end traversal. * If top==DTM.NULL, run through end of document. * * @throws TransformerException */ public void traverse(int pos, int top) throws org.xml.sax.SAXException { // %OPT% Can we simplify the loop conditionals by adding: // if(top==DTM.NULL) top=0 // -- or by simply ignoring this case and relying on the fact that // pos will never equal DTM.NULL until we're ready to exit? while (DTM.NULL != pos) { startNode(pos); int nextNode = m_dtm.getFirstChild(pos); while (DTM.NULL == nextNode) { endNode(pos); if ((DTM.NULL != top) && top == pos) break; nextNode = m_dtm.getNextSibling(pos); if (DTM.NULL == nextNode) { pos = m_dtm.getParent(pos); if ((DTM.NULL == pos) || ((DTM.NULL != top) && (top == pos))) { nextNode = DTM.NULL; break; } } } pos = nextNode; } } /** Flag indicating whether following text to be processed is raw text */ boolean nextIsRaw = false; /** * Optimized dispatch of characters. */ private final void dispatachChars(int node) throws org.xml.sax.SAXException { m_dtm.dispatchCharactersEvents(node, m_contentHandler, false); } /** * Start processing given node * * * @param node Node to process * * @throws org.xml.sax.SAXException */ protected void startNode(int node) throws org.xml.sax.SAXException { if (m_contentHandler instanceof NodeConsumer) { // %TBD% // ((NodeConsumer) m_contentHandler).setOriginatingNode(node); } switch (m_dtm.getNodeType(node)) { case DTM.COMMENT_NODE : { XMLString data = m_dtm.getStringValue(node); if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); data.dispatchAsComment(lh); } } break; case DTM.DOCUMENT_FRAGMENT_NODE : // ??; break; case DTM.DOCUMENT_NODE : this.m_contentHandler.startDocument(); break; case DTM.ELEMENT_NODE : DTM dtm = m_dtm; for (int nsn = dtm.getFirstNamespaceNode(node, true); DTM.NULL != nsn; nsn = dtm.getNextNamespaceNode(node, nsn, true)) { // String prefix = dtm.getPrefix(nsn); String prefix = dtm.getNodeNameX(nsn); this.m_contentHandler.startPrefixMapping(prefix, dtm.getNodeValue(nsn)); } // System.out.println("m_dh.getNamespaceOfNode(node): "+m_dh.getNamespaceOfNode(node)); // System.out.println("m_dh.getLocalNameOfNode(node): "+m_dh.getLocalNameOfNode(node)); String ns = dtm.getNamespaceURI(node); if(null == ns) ns = ""; // %OPT% !! org.xml.sax.helpers.AttributesImpl attrs = new org.xml.sax.helpers.AttributesImpl(); for (int i = dtm.getFirstAttribute(node); i != DTM.NULL; i = dtm.getNextAttribute(i)) { attrs.addAttribute(dtm.getNamespaceURI(i), dtm.getLocalName(i), dtm.getNodeName(i), "CDATA", dtm.getNodeValue(i)); } this.m_contentHandler.startElement(ns, m_dtm.getLocalName(node), m_dtm.getNodeName(node), attrs); break; case DTM.PROCESSING_INSTRUCTION_NODE : { String name = m_dtm.getNodeName(node); // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { nextIsRaw = true; } else { this.m_contentHandler.processingInstruction(name, m_dtm.getNodeValue(node)); } } break; case DTM.CDATA_SECTION_NODE : { boolean isLexH = (m_contentHandler instanceof LexicalHandler); LexicalHandler lh = isLexH ? ((LexicalHandler) this.m_contentHandler) : null; if (isLexH) { lh.startCDATA(); } dispatachChars(node); { if (isLexH) { lh.endCDATA(); } } } break; case DTM.TEXT_NODE : { if (nextIsRaw) { nextIsRaw = false; m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { dispatachChars(node); } } break; case DTM.ENTITY_REFERENCE_NODE : { if (m_contentHandler instanceof LexicalHandler) { ((LexicalHandler) this.m_contentHandler).startEntity( m_dtm.getNodeName(node)); } else { // warning("Can not output entity to a pure SAX ContentHandler"); } } break; default : } } /** * End processing of given node * * * @param node Node we just finished processing * * @throws org.xml.sax.SAXException */ protected void endNode(int node) throws org.xml.sax.SAXException { switch (m_dtm.getNodeType(node)) { case DTM.DOCUMENT_NODE : this.m_contentHandler.endDocument(); break; case DTM.ELEMENT_NODE : String ns = m_dtm.getNamespaceURI(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, m_dtm.getLocalName(node), m_dtm.getNodeName(node)); for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != nsn; nsn = m_dtm.getNextNamespaceNode(node, nsn, true)) { // String prefix = m_dtm.getPrefix(nsn); String prefix = m_dtm.getNodeNameX(nsn); this.m_contentHandler.endPrefixMapping(prefix); } break; case DTM.CDATA_SECTION_NODE : break; case DTM.ENTITY_REFERENCE_NODE : { if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.endEntity(m_dtm.getNodeName(node)); } } break; default : } } } //TreeWalker libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/SecuritySupport.java0000644000175000017500000000745010721374032024313 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/CoroutineManager.java0000644000175000017500000003565410721374032024360 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CoroutineManager.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.util.BitSet; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; /** *

    Support the coroutine design pattern.

    * *

    A coroutine set is a very simple cooperative non-preemptive * multitasking model, where the switch from one task to another is * performed via an explicit request. Coroutines interact according to * the following rules:

    * *
      *
    • One coroutine in the set has control, which it retains until it * either exits or resumes another coroutine.
    • *
    • A coroutine is activated when it is resumed by some other coroutine * for the first time.
    • *
    • An active coroutine that gives up control by resuming another in * the set retains its context -- including call stack and local variables * -- so that if/when it is resumed, it will proceed from the point at which * it last gave up control.
    • *
    * *

    Coroutines can be thought of as falling somewhere between pipes and * subroutines. Like call/return, there is an explicit flow of control * from one coroutine to another. Like pipes, neither coroutine is * actually "in charge", and neither must exit in order to transfer * control to the other.

    * *

    One classic application of coroutines is in compilers, where both * the parser and the lexer are maintaining complex state * information. The parser resumes the lexer to process incoming * characters into lexical tokens, and the lexer resumes the parser * when it has reached a point at which it has a reliably interpreted * set of tokens available for semantic processing. Structuring this * as call-and-return would require saving and restoring a * considerable amount of state each time. Structuring it as two tasks * connected by a queue may involve higher overhead (in systems which * can optimize the coroutine metaphor), isn't necessarily as clear in * intent, may have trouble handling cases where data flows in both * directions, and may not handle some of the more complex cases where * more than two coroutines are involved.

    * *

    Most coroutine systems also provide a way to pass data between the * source and target of a resume operation; this is sometimes referred * to as "yielding" a value. Others rely on the fact that, since only * one member of a coroutine set is running at a time and does not * lose control until it chooses to do so, data structures may be * directly shared between them with only minimal precautions.

    * *

    "Note: This should not be taken to mean that producer/consumer * problems should be always be done with coroutines." Queueing is * often a better solution when only two threads of execution are * involved and full two-way handshaking is not required. It's a bit * difficult to find short pedagogical examples that require * coroutines for a clear solution.

    * *

    The fact that only one of a group of coroutines is running at a * time, and the control transfer between them is explicit, simplifies * their possible interactions, and in some implementations permits * them to be implemented more efficiently than general multitasking. * In some situations, coroutines can be compiled out entirely; * in others, they may only require a few instructions more than a * simple function call.

    * *

    This version is built on top of standard Java threading, since * that's all we have available right now. It's been encapsulated for * code clarity and possible future optimization.

    * *

    (Two possible approaches: wait-notify based and queue-based. Some * folks think that a one-item queue is a cleaner solution because it's * more abstract -- but since coroutine _is_ an abstraction I'm not really * worried about that; folks should be able to switch this code without * concern.)

    * *

    %TBD% THIS SHOULD BE AN INTERFACE, to facilitate building other * implementations... perhaps including a true coroutine system * someday, rather than controlled threading. Arguably Coroutine * itself should be an interface much like Runnable, but I think that * can be built on top of this.

    * */ public class CoroutineManager { /** "Is this coroutine ID number already in use" lookup table. * Currently implemented as a bitset as a compromise between * compactness and speed of access, but obviously other solutions * could be applied. * */ BitSet m_activeIDs=new BitSet(); /** Limit on the coroutine ID numbers accepted. I didn't want the * in-use table to grow without bound. If we switch to a more efficient * sparse-array mechanism, it may be possible to raise or eliminate * this boundary. * @xsl.usage internal */ static final int m_unreasonableId=1024; /** Internal field used to hold the data being explicitly passed * from one coroutine to another during a co_resume() operation. * (Of course implicit data sharing may also occur; one of the reasons * for using coroutines is that you're guaranteed that none of the * other coroutines in your set are using shared structures at the time * you access them.) * * %REVIEW% It's been proposed that we be able to pass types of data * other than Object -- more specific object types, or * lighter-weight primitives. This would seem to create a potential * explosion of "pass x recieve y back" methods (or require * fracturing resume into two calls, resume-other and * wait-to-be-resumed), and the weight issue could be managed by * reusing a mutable buffer object to contain the primitive * (remember that only one coroutine runs at a time, so once the * buffer's set it won't be walked on). Typechecking objects is * interesting from a code-robustness point of view, but it's * unclear whether it makes sense to encapsulate that in the * coroutine code or let the callers do it, since it depends on RTTI * either way. Restricting the parameters to objects implementing a * specific CoroutineParameter interface does _not_ seem to be a net * win; applications can do so if they want via front-end code, but * there seem to be too many use cases involving passing an existing * object type that you may not have the freedom to alter and may * not want to spend time wrapping another object around. * */ Object m_yield=null; // Expose??? final static int NOBODY=-1; final static int ANYBODY=-1; /** Internal field used to confirm that the coroutine now waking up is * in fact the one we intended to resume. Some such selection mechanism * is needed when more that two coroutines are operating within the same * group. */ int m_nextCoroutine=NOBODY; /**

    Each coroutine in the set managed by a single * CoroutineManager is identified by a small positive integer. This * brings up the question of how to manage those integers to avoid * reuse... since if two coroutines use the same ID number, resuming * that ID could resume either. I can see arguments for either * allowing applications to select their own numbers (they may want * to declare mnemonics via manefest constants) or generating * numbers on demand. This routine's intended to support both * approaches.

    * *

    %REVIEW% We could use an object as the identifier. Not sure * it's a net gain, though it would allow the thread to be its own * ID. Ponder.

    * * @param coroutineID If >=0, requests that we reserve this number. * If <0, requests that we find, reserve, and return an available ID * number. * * @return If >=0, the ID number to be used by this coroutine. If <0, * an error occurred -- the ID requested was already in use, or we * couldn't assign one without going over the "unreasonable value" mark * */ public synchronized int co_joinCoroutineSet(int coroutineID) { if(coroutineID>=0) { if(coroutineID>=m_unreasonableId || m_activeIDs.get(coroutineID)) return -1; } else { // What I want is "Find first clear bit". That doesn't exist. // JDK1.2 added "find last set bit", but that doesn't help now. coroutineID=0; while(coroutineID=m_unreasonableId) return -1; } m_activeIDs.set(coroutineID); return coroutineID; } /** In the standard coroutine architecture, coroutines are * identified by their method names and are launched and run up to * their first yield by simply resuming them; its's presumed that * this recognizes the not-already-running case and does the right * thing. We seem to need a way to achieve that same threadsafe * run-up... eg, start the coroutine with a wait. * * %TBD% whether this makes any sense... * * @param thisCoroutine the identifier of this coroutine, so we can * recognize when we are being resumed. * @exception java.lang.NoSuchMethodException if thisCoroutine isn't * a registered member of this group. %REVIEW% whether this is the * best choice. * */ public synchronized Object co_entry_pause(int thisCoroutine) throws java.lang.NoSuchMethodException { if(!m_activeIDs.get(thisCoroutine)) throw new java.lang.NoSuchMethodException(); while(m_nextCoroutine != thisCoroutine) { try { wait(); } catch(java.lang.InterruptedException e) { // %TBD% -- Declare? Encapsulate? Ignore? Or // dance widdershins about the instruction cache? } } return m_yield; } /** Transfer control to another coroutine which has already been started and * is waiting on this CoroutineManager. We won't return from this call * until that routine has relinquished control. * * %TBD% What should we do if toCoroutine isn't registered? Exception? * * @param arg_object A value to be passed to the other coroutine. * @param thisCoroutine Integer identifier for this coroutine. This is the * ID we watch for to see if we're the ones being resumed. * @param toCoroutine Integer identifier for the coroutine we wish to * invoke. * @exception java.lang.NoSuchMethodException if toCoroutine isn't a * registered member of this group. %REVIEW% whether this is the best choice. * */ public synchronized Object co_resume(Object arg_object,int thisCoroutine,int toCoroutine) throws java.lang.NoSuchMethodException { if(!m_activeIDs.get(toCoroutine)) throw new java.lang.NoSuchMethodException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COROUTINE_NOT_AVAIL, new Object[]{Integer.toString(toCoroutine)})); //"Coroutine not available, id="+toCoroutine); // We expect these values to be overwritten during the notify()/wait() // periods, as other coroutines in this set get their opportunity to run. m_yield=arg_object; m_nextCoroutine=toCoroutine; notify(); while(m_nextCoroutine != thisCoroutine || m_nextCoroutine==ANYBODY || m_nextCoroutine==NOBODY) { try { // System.out.println("waiting..."); wait(); } catch(java.lang.InterruptedException e) { // %TBD% -- Declare? Encapsulate? Ignore? Or // dance deasil about the program counter? } } if(m_nextCoroutine==NOBODY) { // Pass it along co_exit(thisCoroutine); // And inform this coroutine that its partners are Going Away // %REVIEW% Should this throw/return something more useful? throw new java.lang.NoSuchMethodException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COROUTINE_CO_EXIT, null)); //"CoroutineManager recieved co_exit() request"); } return m_yield; } /** Terminate this entire set of coroutines. The others will be * deregistered and have exceptions thrown at them. Note that this * is intended as a panic-shutdown operation; under normal * circumstances a coroutine should always end with co_exit_to() in * order to politely inform at least one of its partners that it is * going away. * * %TBD% This may need significantly more work. * * %TBD% Should this just be co_exit_to(,,CoroutineManager.PANIC)? * * @param thisCoroutine Integer identifier for the coroutine requesting exit. * */ public synchronized void co_exit(int thisCoroutine) { m_activeIDs.clear(thisCoroutine); m_nextCoroutine=NOBODY; // %REVIEW% notify(); } /** Make the ID available for reuse and terminate this coroutine, * transferring control to the specified coroutine. Note that this * returns immediately rather than waiting for any further coroutine * traffic, so the thread can proceed with other shutdown activities. * * @param arg_object A value to be passed to the other coroutine. * @param thisCoroutine Integer identifier for the coroutine leaving the set. * @param toCoroutine Integer identifier for the coroutine we wish to * invoke. * @exception java.lang.NoSuchMethodException if toCoroutine isn't a * registered member of this group. %REVIEW% whether this is the best choice. * */ public synchronized void co_exit_to(Object arg_object,int thisCoroutine,int toCoroutine) throws java.lang.NoSuchMethodException { if(!m_activeIDs.get(toCoroutine)) throw new java.lang.NoSuchMethodException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COROUTINE_NOT_AVAIL, new Object[]{Integer.toString(toCoroutine)})); //"Coroutine not available, id="+toCoroutine); // We expect these values to be overwritten during the notify()/wait() // periods, as other coroutines in this set get their opportunity to run. m_yield=arg_object; m_nextCoroutine=toCoroutine; m_activeIDs.clear(thisCoroutine); notify(); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMNodeIterator.java0000644000175000017500000001407710721374031024055 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMNodeIterator.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMDOMException; import org.apache.xml.dtm.DTMIterator; import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeFilter; /** * DTMNodeIterator gives us an implementation of the * DTMNodeIterator which returns DOM nodes. * * Please note that this is not necessarily equivlaent to a DOM * NodeIterator operating over the same document. In particular: *
      * *
    • If there are several Text nodes in logical succession (ie, * across CDATASection and EntityReference boundaries), we will return * only the first; the caller is responsible for stepping through * them. * (%REVIEW% Provide a convenience routine here to assist, pending * proposed DOM Level 3 getAdjacentText() operation?)
    • * *
    • Since the whole XPath/XSLT architecture assumes that the source * document is not altered while we're working with it, we do not * promise to implement the DOM NodeIterator's "maintain current * position" response to document mutation.
    • * *
    • Since our design for XPath NodeIterators builds a stateful * filter directly into the traversal object, getNodeFilter() is not * supported.
    • * *
    * *

    State: In progress!!

    * */ public class DTMNodeIterator implements org.w3c.dom.traversal.NodeIterator { private DTMIterator dtm_iter; private boolean valid=true; //================================================================ // Methods unique to this class /** Public constructor: Wrap a DTMNodeIterator around an existing * and preconfigured DTMIterator * */ public DTMNodeIterator(DTMIterator dtmIterator) { try { dtm_iter=(DTMIterator)dtmIterator.clone(); } catch(CloneNotSupportedException cnse) { throw new org.apache.xml.utils.WrappedRuntimeException(cnse); } } /** Access the wrapped DTMIterator. I'm not sure whether anyone will * need this or not, but let's write it and think about it. * */ public DTMIterator getDTMIterator() { return dtm_iter; } //================================================================ // org.w3c.dom.traversal.NodeFilter API follows /** Detaches the NodeIterator from the set which it iterated over, * releasing any computational resources and placing the iterator in * the INVALID state. * */ public void detach() { // Theoretically, we could release dtm_iter at this point. But // some of the operations may still want to consult it even though // navigation is now invalid. valid=false; } /** The value of this flag determines whether the children * of entity reference nodes are visible to the iterator. * * @return false, always (the DTM model flattens entity references) * */ public boolean getExpandEntityReferences() { return false; } /** Return a handle to the filter used to screen nodes. * * This is ill-defined in Xalan's usage of Nodeiterator, where we have * built stateful XPath-based filtering directly into the traversal * object. We could return something which supports the NodeFilter interface * and allows querying whether a given node would be permitted if it appeared * as our next node, but in the current implementation that would be very * complex -- and just isn't all that useful. * * @throws DOMException -- NOT_SUPPORTED_ERROR because I can't think * of anything more useful to do in this case * */ public NodeFilter getFilter() { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** @return The root node of the NodeIterator, as specified * when it was created. * */ public Node getRoot() { int handle=dtm_iter.getRoot(); return dtm_iter.getDTM(handle).getNode(handle); } /** Return a mask describing which node types are presented via the * iterator. **/ public int getWhatToShow() { return dtm_iter.getWhatToShow(); } /** @return the next node in the set and advance the position of the * iterator in the set. * * @throws DOMException - INVALID_STATE_ERR Raised if this method is * called after the detach method was invoked. * */ public Node nextNode() throws DOMException { if(!valid) throw new DTMDOMException(DOMException.INVALID_STATE_ERR); int handle=dtm_iter.nextNode(); if (handle==DTM.NULL) return null; return dtm_iter.getDTM(handle).getNode(handle); } /** @return the next previous in the set and advance the position of the * iterator in the set. * * @throws DOMException - INVALID_STATE_ERR Raised if this method is * called after the detach method was invoked. * */ public Node previousNode() { if(!valid) throw new DTMDOMException(DOMException.INVALID_STATE_ERR); int handle=dtm_iter.previousNode(); if (handle==DTM.NULL) return null; return dtm_iter.getDTM(handle).getNode(handle); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/EmptyIterator.java0000644000175000017500000000367410721374030023721 0ustar mkochmkoch /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EmptyIterator.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTM; /** * DTM Empty Axis Iterator. The class is immutable */ public final class EmptyIterator implements DTMAxisIterator { private static final EmptyIterator INSTANCE = new EmptyIterator(); public static DTMAxisIterator getInstance() {return INSTANCE;} private EmptyIterator(){} public final int next(){ return END; } public final DTMAxisIterator reset(){ return this; } public final int getLast(){ return 0; } public final int getPosition(){ return 1; } public final void setMark(){} public final void gotoMark(){} public final DTMAxisIterator setStartNode(int node){ return this; } public final int getStartNode(){ return END; } public final boolean isReverse(){return false;} public final DTMAxisIterator cloneIterator(){ return this; } public final void setRestartable(boolean isRestartable) {} public final int getNodeByPosition(int position){ return END; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMNodeProxy.java0000644000175000017500000017535310721374030023411 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMNodeProxy.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.util.Vector; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMDOMException; import org.apache.xpath.NodeSet; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.TypeInfo; /** * DTMNodeProxy presents a DOM Node API front-end to the DTM model. *

    * It does _not_ attempt to address the "node identity" question; no effort * is made to prevent the creation of multiple proxies referring to a single * DTM node. Users can create a mechanism for managing this, or relinquish the * use of "==" and use the .sameNodeAs() mechanism, which is under * consideration for future versions of the DOM. *

    * DTMNodeProxy may be subclassed further to present specific DOM node types. * * @see org.w3c.dom * @xsl.usage internal */ public class DTMNodeProxy implements Node, Document, Text, Element, Attr, ProcessingInstruction, Comment, DocumentFragment { /** The DTM for this node. */ public DTM dtm; /** The DTM node handle. */ int node; /** The return value as Empty String. */ private static final String EMPTYSTRING = ""; /** The DOMImplementation object */ static final DOMImplementation implementation=new DTMNodeProxyImplementation(); /** * Create a DTMNodeProxy Node representing a specific Node in a DTM * * @param dtm The DTM Reference, must be non-null. * @param node The DTM node handle. */ public DTMNodeProxy(DTM dtm, int node) { this.dtm = dtm; this.node = node; } /** * NON-DOM: Return the DTM model * * @return The DTM that this proxy is a representative for. */ public final DTM getDTM() { return dtm; } /** * NON-DOM: Return the DTM node number * * @return The DTM node handle. */ public final int getDTMNodeNumber() { return node; } /** * Test for equality based on node number. * * @param node A DTM node proxy reference. * * @return true if the given node has the same handle as this node. */ public final boolean equals(Node node) { try { DTMNodeProxy dtmp = (DTMNodeProxy) node; // return (dtmp.node == this.node); // Patch attributed to Gary L Peskin return (dtmp.node == this.node) && (dtmp.dtm == this.dtm); } catch (ClassCastException cce) { return false; } } /** * Test for equality based on node number. * * @param node A DTM node proxy reference. * * @return true if the given node has the same handle as this node. */ public final boolean equals(Object node) { try { // DTMNodeProxy dtmp = (DTMNodeProxy)node; // return (dtmp.node == this.node); // Patch attributed to Gary L Peskin return equals((Node) node); } catch (ClassCastException cce) { return false; } } /** * FUTURE DOM: Test node identity, in lieu of Node==Node * * @param other * * @return true if the given node has the same handle as this node. */ public final boolean sameNodeAs(Node other) { if (!(other instanceof DTMNodeProxy)) return false; DTMNodeProxy that = (DTMNodeProxy) other; return this.dtm == that.dtm && this.node == that.node; } /** * * * @see org.w3c.dom.Node */ public final String getNodeName() { return dtm.getNodeName(node); } /** * A PI's "target" states what processor channel the PI's data * should be directed to. It is defined differently in HTML and XML. *

    * In XML, a PI's "target" is the first (whitespace-delimited) token * following the " * In HTML, target is always null. *

    * Note that getNodeName is aliased to getTarget. * * */ public final String getTarget() { return dtm.getNodeName(node); } // getTarget():String /** * * * @see org.w3c.dom.Node as of DOM Level 2 */ public final String getLocalName() { return dtm.getLocalName(node); } /** * @return The prefix for this node. * @see org.w3c.dom.Node as of DOM Level 2 */ public final String getPrefix() { return dtm.getPrefix(node); } /** * * @param prefix * * @throws DOMException * @see org.w3c.dom.Node as of DOM Level 2 -- DTMNodeProxy is read-only */ public final void setPrefix(String prefix) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * * @see org.w3c.dom.Node as of DOM Level 2 */ public final String getNamespaceURI() { return dtm.getNamespaceURI(node); } /** Ask whether we support a given DOM feature. * In fact, we do not _fully_ support any DOM feature -- we're a * read-only subset -- so arguably we should always return false. * Or we could say that we support DOM Core Level 2 but all nodes * are read-only. Unclear which answer is least misleading. * * NON-DOM method. This was present in early drafts of DOM Level 2, * but was renamed isSupported. It's present here only because it's * cheap, harmless, and might help some poor fool who is still trying * to use an early Working Draft of the DOM. * * @param feature * @param version * * @return false */ public final boolean supports(String feature, String version) { return implementation.hasFeature(feature,version); //throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** Ask whether we support a given DOM feature. * In fact, we do not _fully_ support any DOM feature -- we're a * read-only subset -- so arguably we should always return false. * * @param feature * @param version * * @return false * @see org.w3c.dom.Node as of DOM Level 2 */ public final boolean isSupported(String feature, String version) { return implementation.hasFeature(feature,version); // throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * * @throws DOMException * @see org.w3c.dom.Node */ public final String getNodeValue() throws DOMException { return dtm.getNodeValue(node); } /** * @return The string value of the node * * @throws DOMException */ public final String getStringValue() throws DOMException { return dtm.getStringValue(node).toString(); } /** * * @param nodeValue * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final void setNodeValue(String nodeValue) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * * @see org.w3c.dom.Node */ public final short getNodeType() { return (short) dtm.getNodeType(node); } /** * * * @see org.w3c.dom.Node */ public final Node getParentNode() { if (getNodeType() == Node.ATTRIBUTE_NODE) return null; int newnode = dtm.getParent(node); return (newnode == DTM.NULL) ? null : dtm.getNode(newnode); } /** * * * @see org.w3c.dom.Node */ public final Node getOwnerNode() { int newnode = dtm.getParent(node); return (newnode == DTM.NULL) ? null : dtm.getNode(newnode); } /** * * * @see org.w3c.dom.Node */ public final NodeList getChildNodes() { // Annoyingly, AxisIterators do not currently implement DTMIterator, so // we can't just wap DTMNodeList around an Axis.CHILD iterator. // Instead, we've created a special-case operating mode for that object. return new DTMChildIterNodeList(dtm,node); // throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * @see org.w3c.dom.Node */ public final Node getFirstChild() { int newnode = dtm.getFirstChild(node); return (newnode == DTM.NULL) ? null : dtm.getNode(newnode); } /** * * * @see org.w3c.dom.Node */ public final Node getLastChild() { int newnode = dtm.getLastChild(node); return (newnode == DTM.NULL) ? null : dtm.getNode(newnode); } /** * * * @see org.w3c.dom.Node */ public final Node getPreviousSibling() { int newnode = dtm.getPreviousSibling(node); return (newnode == DTM.NULL) ? null : dtm.getNode(newnode); } /** * * * @see org.w3c.dom.Node */ public final Node getNextSibling() { // Attr's Next is defined at DTM level, but not at DOM level. if (dtm.getNodeType(node) == Node.ATTRIBUTE_NODE) return null; int newnode = dtm.getNextSibling(node); return (newnode == DTM.NULL) ? null : dtm.getNode(newnode); } // DTMNamedNodeMap m_attrs; /** * * * @see org.w3c.dom.Node */ public final NamedNodeMap getAttributes() { return new DTMNamedNodeMap(dtm, node); } /** * Method hasAttribute * * * @param name * * */ public boolean hasAttribute(String name) { return DTM.NULL != dtm.getAttributeNode(node,null,name); } /** * Method hasAttributeNS * * * @param namespaceURI * @param localName * * */ public boolean hasAttributeNS(String namespaceURI, String localName) { return DTM.NULL != dtm.getAttributeNode(node,namespaceURI,localName); } /** * * * @see org.w3c.dom.Node */ public final Document getOwnerDocument() { // Note that this uses the DOM-compatable version of the call return (Document)(dtm.getNode(dtm.getOwnerDocument(node))); } /** * * @param newChild * @param refChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node insertBefore(Node newChild, Node refChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param newChild * @param oldChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param oldChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node removeChild(Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param newChild * * * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node appendChild(Node newChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * * @see org.w3c.dom.Node */ public final boolean hasChildNodes() { return (DTM.NULL != dtm.getFirstChild(node)); } /** * * @param deep * * * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node cloneNode(boolean deep) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * @see org.w3c.dom.Document */ public final DocumentType getDoctype() { return null; } /** * * * @see org.w3c.dom.Document */ public final DOMImplementation getImplementation() { return implementation; } /** This is a bit of a problem in DTM, since a DTM may be a Document * Fragment and hence not have a clear-cut Document Element. We can * make it work in the well-formed cases but would that be confusing for others? * * * @see org.w3c.dom.Document */ public final Element getDocumentElement() { int dochandle=dtm.getDocument(); int elementhandle=DTM.NULL; for(int kidhandle=dtm.getFirstChild(dochandle); kidhandle!=DTM.NULL; kidhandle=dtm.getNextSibling(kidhandle)) { switch(dtm.getNodeType(kidhandle)) { case Node.ELEMENT_NODE: if(elementhandle!=DTM.NULL) { elementhandle=DTM.NULL; // More than one; ill-formed. kidhandle=dtm.getLastChild(dochandle); // End loop } else elementhandle=kidhandle; break; // These are harmless; document is still wellformed case Node.COMMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: case Node.DOCUMENT_TYPE_NODE: break; default: elementhandle=DTM.NULL; // ill-formed kidhandle=dtm.getLastChild(dochandle); // End loop break; } } if(elementhandle==DTM.NULL) throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); else return (Element)(dtm.getNode(elementhandle)); } /** * * @param tagName * * * * @throws DOMException * @see org.w3c.dom.Document */ public final Element createElement(String tagName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * @see org.w3c.dom.Document */ public final DocumentFragment createDocumentFragment() { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param data * * * @see org.w3c.dom.Document */ public final Text createTextNode(String data) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param data * * * @see org.w3c.dom.Document */ public final Comment createComment(String data) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param data * * * * @throws DOMException * @see org.w3c.dom.Document */ public final CDATASection createCDATASection(String data) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param target * @param data * * * * @throws DOMException * @see org.w3c.dom.Document */ public final ProcessingInstruction createProcessingInstruction( String target, String data) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param name * * * * @throws DOMException * @see org.w3c.dom.Document */ public final Attr createAttribute(String name) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param name * * * * @throws DOMException * @see org.w3c.dom.Document */ public final EntityReference createEntityReference(String name) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param tagname * * * @see org.w3c.dom.Document */ public final NodeList getElementsByTagName(String tagname) { Vector listVector = new Vector(); Node retNode = dtm.getNode(node); if (retNode != null) { boolean isTagNameWildCard = "*".equals(tagname); if (DTM.ELEMENT_NODE == retNode.getNodeType()) { NodeList nodeList = retNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { traverseChildren(listVector, nodeList.item(i), tagname, isTagNameWildCard); } } else if (DTM.DOCUMENT_NODE == retNode.getNodeType()) { traverseChildren(listVector, dtm.getNode(node), tagname, isTagNameWildCard); } } int size = listVector.size(); NodeSet nodeSet = new NodeSet(size); for (int i = 0; i < size; i++) { nodeSet.addNode((Node) listVector.elementAt(i)); } return (NodeList) nodeSet; } /** * * @param listVector * @param tempNode * @param tagname * @param isTagNameWildCard * * * Private method to be used for recursive iterations to obtain elements by tag name. */ private final void traverseChildren ( Vector listVector, Node tempNode, String tagname, boolean isTagNameWildCard) { if (tempNode == null) { return; } else { if (tempNode.getNodeType() == DTM.ELEMENT_NODE && (isTagNameWildCard || tempNode.getNodeName().equals(tagname))) { listVector.add(tempNode); } if(tempNode.hasChildNodes()) { NodeList nodeList = tempNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { traverseChildren(listVector, nodeList.item(i), tagname, isTagNameWildCard); } } } } /** * * @param importedNode * @param deep * * * * @throws DOMException * @see org.w3c.dom.Document as of DOM Level 2 -- DTMNodeProxy is read-only */ public final Node importNode(Node importedNode, boolean deep) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param namespaceURI * @param qualifiedName * * * * @throws DOMException * @see org.w3c.dom.Document as of DOM Level 2 */ public final Element createElementNS( String namespaceURI, String qualifiedName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param qualifiedName * * * * @throws DOMException * @see org.w3c.dom.Document as of DOM Level 2 */ public final Attr createAttributeNS( String namespaceURI, String qualifiedName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param localName * * * @see org.w3c.dom.Document as of DOM Level 2 */ public final NodeList getElementsByTagNameNS(String namespaceURI, String localName) { Vector listVector = new Vector(); Node retNode = dtm.getNode(node); if (retNode != null) { boolean isNamespaceURIWildCard = "*".equals(namespaceURI); boolean isLocalNameWildCard = "*".equals(localName); if (DTM.ELEMENT_NODE == retNode.getNodeType()) { NodeList nodeList = retNode.getChildNodes(); for(int i = 0; i < nodeList.getLength(); i++) { traverseChildren(listVector, nodeList.item(i), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard); } } else if(DTM.DOCUMENT_NODE == retNode.getNodeType()) { traverseChildren(listVector, dtm.getNode(node), namespaceURI, localName, isNamespaceURIWildCard, isLocalNameWildCard); } } int size = listVector.size(); NodeSet nodeSet = new NodeSet(size); for (int i = 0; i < size; i++) { nodeSet.addNode((Node)listVector.elementAt(i)); } return (NodeList) nodeSet; } /** * * @param listVector * @param tempNode * @param namespaceURI * @param localname * @param isNamespaceURIWildCard * @param isLocalNameWildCard * * Private method to be used for recursive iterations to obtain elements by tag name * and namespaceURI. */ private final void traverseChildren ( Vector listVector, Node tempNode, String namespaceURI, String localname, boolean isNamespaceURIWildCard, boolean isLocalNameWildCard) { if (tempNode == null) { return; } else { if (tempNode.getNodeType() == DTM.ELEMENT_NODE && (isLocalNameWildCard || tempNode.getLocalName().equals(localname))) { String nsURI = tempNode.getNamespaceURI(); if ((namespaceURI == null && nsURI == null) || isNamespaceURIWildCard || (namespaceURI != null && namespaceURI.equals(nsURI))) { listVector.add(tempNode); } } if(tempNode.hasChildNodes()) { NodeList nl = tempNode.getChildNodes(); for(int i = 0; i < nl.getLength(); i++) { traverseChildren(listVector, nl.item(i), namespaceURI, localname, isNamespaceURIWildCard, isLocalNameWildCard); } } } } /** * * @param elementId * * * @see org.w3c.dom.Document as of DOM Level 2 */ public final Element getElementById(String elementId) { return (Element) dtm.getNode(dtm.getElementById(elementId)); } /** * * @param offset * * * * @throws DOMException * @see org.w3c.dom.Text */ public final Text splitText(int offset) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final String getData() throws DOMException { return dtm.getNodeValue(node); } /** * * @param data * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void setData(String data) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * @see org.w3c.dom.CharacterData */ public final int getLength() { // %OPT% This should do something smarter? return dtm.getNodeValue(node).length(); } /** * * @param offset * @param count * * * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final String substringData(int offset, int count) throws DOMException { return getData().substring(offset,offset+count); } /** * * @param arg * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void appendData(String arg) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param offset * @param arg * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void insertData(int offset, String arg) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param offset * @param count * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void deleteData(int offset, int count) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param offset * @param count * @param arg * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void replaceData(int offset, int count, String arg) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * @see org.w3c.dom.Element */ public final String getTagName() { return dtm.getNodeName(node); } /** * * @param name * * * @see org.w3c.dom.Element */ public final String getAttribute(String name) { DTMNamedNodeMap map = new DTMNamedNodeMap(dtm, node); Node node = map.getNamedItem(name); return (null == node) ? EMPTYSTRING : node.getNodeValue(); } /** * * @param name * @param value * * @throws DOMException * @see org.w3c.dom.Element */ public final void setAttribute(String name, String value) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param name * * @throws DOMException * @see org.w3c.dom.Element */ public final void removeAttribute(String name) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param name * * * @see org.w3c.dom.Element */ public final Attr getAttributeNode(String name) { DTMNamedNodeMap map = new DTMNamedNodeMap(dtm, node); return (Attr)map.getNamedItem(name); } /** * * @param newAttr * * * * @throws DOMException * @see org.w3c.dom.Element */ public final Attr setAttributeNode(Attr newAttr) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param oldAttr * * * * @throws DOMException * @see org.w3c.dom.Element */ public final Attr removeAttributeNode(Attr oldAttr) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * Introduced in DOM Level 2. * * */ public boolean hasAttributes() { return DTM.NULL != dtm.getFirstAttribute(node); } /** @see org.w3c.dom.Element */ public final void normalize() { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param localName * * * @see org.w3c.dom.Element */ public final String getAttributeNS(String namespaceURI, String localName) { Node retNode = null; int n = dtm.getAttributeNode(node,namespaceURI,localName); if(n != DTM.NULL) retNode = dtm.getNode(n); return (null == retNode) ? EMPTYSTRING : retNode.getNodeValue(); } /** * * @param namespaceURI * @param qualifiedName * @param value * * @throws DOMException * @see org.w3c.dom.Element */ public final void setAttributeNS( String namespaceURI, String qualifiedName, String value) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param localName * * @throws DOMException * @see org.w3c.dom.Element */ public final void removeAttributeNS(String namespaceURI, String localName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param localName * * * @see org.w3c.dom.Element */ public final Attr getAttributeNodeNS(String namespaceURI, String localName) { Attr retAttr = null; int n = dtm.getAttributeNode(node,namespaceURI,localName); if(n != DTM.NULL) retAttr = (Attr) dtm.getNode(n); return retAttr; } /** * * @param newAttr * * * * @throws DOMException * @see org.w3c.dom.Element */ public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * * @see org.w3c.dom.Attr */ public final String getName() { return dtm.getNodeName(node); } /** * * * @see org.w3c.dom.Attr */ public final boolean getSpecified() { // We really don't know which attributes might have come from the // source document versus from the DTD. Treat them all as having // been provided by the user. // %REVIEW% if/when we become aware of DTDs/schemae. return true; } /** * * * @see org.w3c.dom.Attr */ public final String getValue() { return dtm.getNodeValue(node); } /** * * @param value * @see org.w3c.dom.Attr */ public final void setValue(String value) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * Get the owner element of an attribute. * * * @see org.w3c.dom.Attr as of DOM Level 2 */ public final Element getOwnerElement() { if (getNodeType() != Node.ATTRIBUTE_NODE) return null; // In XPath and DTM data models, unlike DOM, an Attr's parent is its // owner element. int newnode = dtm.getParent(node); return (newnode == DTM.NULL) ? null : (Element)(dtm.getNode(newnode)); } /** * NEEDSDOC Method adoptNode * * * NEEDSDOC @param source * * * * @throws DOMException */ public Node adoptNode(Node source) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying, as part of the XML declaration, the encoding * of this document. This is null when unspecified. * @since DOM Level 3 * * */ public String getInputEncoding() { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying whether errors checking is enforced or not. * When set to false, the implementation is free to not * test every possible error case normally defined on DOM operations, * and not raise any DOMException. In case of error, the * behavior is undefined. This attribute is true by * defaults. * @since DOM Level 3 * * */ public boolean getStrictErrorChecking() { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** *

    Based on the Document * Object Model (DOM) Level 3 Core Specification of 07 April 2004.. *

    * An attribute specifying whether errors checking is enforced or not. * When set to false, the implementation is free to not * test every possible error case normally defined on DOM operations, * and not raise any DOMException. In case of error, the * behavior is undefined. This attribute is true by * defaults. * @since DOM Level 3 * * NEEDSDOC @param strictErrorChecking */ public void setStrictErrorChecking(boolean strictErrorChecking) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** Inner class to support getDOMImplementation. */ static class DTMNodeProxyImplementation implements DOMImplementation { public DocumentType createDocumentType(String qualifiedName,String publicId, String systemId) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } public Document createDocument(String namespaceURI,String qualfiedName,DocumentType doctype) { // Could create a DTM... but why, when it'd have to be permanantly empty? throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** Ask whether we support a given DOM feature. * * In fact, we do not _fully_ support any DOM feature -- we're a * read-only subset -- so arguably we should always return false. * On the other hand, it may be more practically useful to return * true and simply treat the whole DOM as read-only, failing on the * methods we can't support. I'm not sure which would be more useful * to the caller. */ public boolean hasFeature(String feature,String version) { if( ("CORE".equals(feature.toUpperCase()) || "XML".equals(feature.toUpperCase())) && ("1.0".equals(version) || "2.0".equals(version)) ) return true; return false; } /** * This method returns a specialized object which implements the * specialized APIs of the specified feature and version. The * specialized object may also be obtained by using binding-specific * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations . * @param feature The name of the feature requested (case-insensitive). * @param version This is the version number of the feature to test. If * the version is null or the empty string, supporting * any version of the feature will cause the method to return an * object that supports at least one version of the feature. * @return Returns an object which implements the specialized APIs of * the specified feature and version, if any, or null if * there is no object which implements interfaces associated with that * feature. If the DOMObject returned by this method * implements the Node interface, it must delegate to the * primary core Node and not return results inconsistent * with the primary core Node such as attributes, * childNodes, etc. * @since DOM Level 3 */ public Object getFeature(String feature, String version) { // we don't have any alternate node, either this node does the job // or we don't have anything that does //return hasFeature(feature, version) ? this : null; return null; //PENDING } } //RAMESH : Pending proper implementation of DOM Level 3 public Object setUserData(String key, Object data, UserDataHandler handler) { return getOwnerDocument().setUserData( key, data, handler); } /** * Retrieves the object associated to a key on a this node. The object * must first have been set to this node by calling * setUserData with the same key. * @param key The key the object is associated to. * @return Returns the DOMObject associated to the given key * on this node, or null if there was none. * @since DOM Level 3 */ public Object getUserData(String key) { return getOwnerDocument().getUserData( key); } /** * This method returns a specialized object which implements the * specialized APIs of the specified feature and version. The * specialized object may also be obtained by using binding-specific * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations. * @param feature The name of the feature requested (case-insensitive). * @param version This is the version number of the feature to test. If * the version is null or the empty string, supporting * any version of the feature will cause the method to return an * object that supports at least one version of the feature. * @return Returns an object which implements the specialized APIs of * the specified feature and version, if any, or null if * there is no object which implements interfaces associated with that * feature. If the DOMObject returned by this method * implements the Node interface, it must delegate to the * primary core Node and not return results inconsistent * with the primary core Node such as attributes, * childNodes, etc. * @since DOM Level 3 */ public Object getFeature(String feature, String version) { // we don't have any alternate node, either this node does the job // or we don't have anything that does return isSupported(feature, version) ? this : null; } /** * Tests whether two nodes are equal. *
    This method tests for equality of nodes, not sameness (i.e., * whether the two nodes are references to the same object) which can be * tested with Node.isSameNode. All nodes that are the same * will also be equal, though the reverse may not be true. *
    Two nodes are equal if and only if the following conditions are * satisfied: The two nodes are of the same type.The following string * attributes are equal: nodeName, localName, * namespaceURI, prefix, nodeValue * , baseURI. This is: they are both null, or * they have the same length and are character for character identical. * The attributes NamedNodeMaps are equal. * This is: they are both null, or they have the same * length and for each node that exists in one map there is a node that * exists in the other map and is equal, although not necessarily at the * same index.The childNodes NodeLists are * equal. This is: they are both null, or they have the * same length and contain equal nodes at the same index. This is true * for Attr nodes as for any other type of node. Note that * normalization can affect equality; to avoid this, nodes should be * normalized before being compared. *
    For two DocumentType nodes to be equal, the following * conditions must also be satisfied: The following string attributes * are equal: publicId, systemId, * internalSubset.The entities * NamedNodeMaps are equal.The notations * NamedNodeMaps are equal. *
    On the other hand, the following do not affect equality: the * ownerDocument attribute, the specified * attribute for Attr nodes, the * isWhitespaceInElementContent attribute for * Text nodes, as well as any user data or event listeners * registered on the nodes. * @param arg The node to compare equality with. * @param deep If true, recursively compare the subtrees; if * false, compare only the nodes themselves (and its * attributes, if it is an Element). * @return If the nodes, and possibly subtrees are equal, * true otherwise false. * @since DOM Level 3 */ public boolean isEqualNode(Node arg) { if (arg == this) { return true; } if (arg.getNodeType() != getNodeType()) { return false; } // in theory nodeName can't be null but better be careful // who knows what other implementations may be doing?... if (getNodeName() == null) { if (arg.getNodeName() != null) { return false; } } else if (!getNodeName().equals(arg.getNodeName())) { return false; } if (getLocalName() == null) { if (arg.getLocalName() != null) { return false; } } else if (!getLocalName().equals(arg.getLocalName())) { return false; } if (getNamespaceURI() == null) { if (arg.getNamespaceURI() != null) { return false; } } else if (!getNamespaceURI().equals(arg.getNamespaceURI())) { return false; } if (getPrefix() == null) { if (arg.getPrefix() != null) { return false; } } else if (!getPrefix().equals(arg.getPrefix())) { return false; } if (getNodeValue() == null) { if (arg.getNodeValue() != null) { return false; } } else if (!getNodeValue().equals(arg.getNodeValue())) { return false; } /* if (getBaseURI() == null) { if (((NodeImpl) arg).getBaseURI() != null) { return false; } } else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) { return false; } */ return true; } /** * DOM Level 3: * Look up the namespace URI associated to the given prefix, starting from this node. * Use lookupNamespaceURI(null) to lookup the default namespace * * @param namespaceURI * @return th URI for the namespace * @since DOM Level 3 */ public String lookupNamespaceURI(String specifiedPrefix) { short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE : { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (namespace !=null) { // REVISIT: is it possible that prefix is empty string? if (specifiedPrefix== null && prefix==specifiedPrefix) { // looking for default namespace return namespace; } else if (prefix != null && prefix.equals(specifiedPrefix)) { // non default namespace return namespace; } } if (this.hasAttributes()) { NamedNodeMap map = this.getAttributes(); int length = map.getLength(); for (int i=0;inamespaceURI is the * default namespace or not. * @param namespaceURI The namespace URI to look for. * @return true if the specified namespaceURI * is the default namespace, false otherwise. * @since DOM Level 3 */ public boolean isDefaultNamespace(String namespaceURI){ /* // REVISIT: remove casts when DOM L3 becomes REC. short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); // REVISIT: is it possible that prefix is empty string? if (prefix == null || prefix.length() == 0) { if (namespaceURI == null) { return (namespace == namespaceURI); } return namespaceURI.equals(namespace); } if (this.hasAttributes()) { ElementImpl elem = (ElementImpl)this; NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns"); if (attr != null) { String value = attr.getNodeValue(); if (namespaceURI == null) { return (namespace == value); } return namespaceURI.equals(value); } } NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); } return false; } case Node.DOCUMENT_NODE:{ return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI); } case Node.ENTITY_NODE : case Node.NOTATION_NODE: case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE: // type is unknown return false; case Node.ATTRIBUTE_NODE:{ if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) { return ownerNode.isDefaultNamespace(namespaceURI); } return false; } default:{ NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); } return false; } } */ return false; } /** * DOM Level 3: * Look up the prefix associated to the given namespace URI, starting from this node. * * @param namespaceURI * @return the prefix for the namespace */ public String lookupPrefix(String namespaceURI){ // REVISIT: When Namespaces 1.1 comes out this may not be true // Prefix can't be bound to null namespace if (namespaceURI == null) { return null; } short type = this.getNodeType(); switch (type) { /* case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); // to flip out children return lookupNamespacePrefix(namespaceURI, (ElementImpl)this); } case Node.DOCUMENT_NODE:{ return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI); } */ case Node.ENTITY_NODE : case Node.NOTATION_NODE: case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE: // type is unknown return null; case Node.ATTRIBUTE_NODE:{ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) { return getOwnerElement().lookupPrefix(namespaceURI); } return null; } default:{ /* NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.lookupPrefix(namespaceURI); } */ return null; } } } /** * Returns whether this node is the same node as the given one. *
    This method provides a way to determine whether two * Node references returned by the implementation reference * the same object. When two Node references are references * to the same object, even if through a proxy, the references may be * used completely interchangably, such that all attributes have the * same values and calling the same DOM method on either reference * always has exactly the same effect. * @param other The node to test against. * @return Returns true if the nodes are the same, * false otherwise. * @since DOM Level 3 */ public boolean isSameNode(Node other) { // we do not use any wrapper so the answer is obvious return this == other; } /** * This attribute returns the text content of this node and its * descendants. When it is defined to be null, setting it has no effect. * When set, any possible children this node may have are removed and * replaced by a single Text node containing the string * this attribute is set to. On getting, no serialization is performed, * the returned string does not contain any markup. No whitespace * normalization is performed, the returned string does not contain the * element content whitespaces . Similarly, on setting, no parsing is * performed either, the input string is taken as pure textual content. *
    The string returned is made of the text content of this node * depending on its type, as defined below: * * * * * * * * * * * * * * * * * *
    Node typeContent
    * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent * attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes
    ATTRIBUTE_NODE, TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE * nodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE * null
    * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @exception DOMException * DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. * @since DOM Level 3 */ public void setTextContent(String textContent) throws DOMException { setNodeValue(textContent); } /** * This attribute returns the text content of this node and its * descendants. When it is defined to be null, setting it has no effect. * When set, any possible children this node may have are removed and * replaced by a single Text node containing the string * this attribute is set to. On getting, no serialization is performed, * the returned string does not contain any markup. No whitespace * normalization is performed, the returned string does not contain the * element content whitespaces . Similarly, on setting, no parsing is * performed either, the input string is taken as pure textual content. *
    The string returned is made of the text content of this node * depending on its type, as defined below: * * * * * * * * * * * * * * * * * *
    Node typeContent
    * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent * attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes
    ATTRIBUTE_NODE, TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE * nodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE * null
    * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @exception DOMException * DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. * @since DOM Level 3 */ public String getTextContent() throws DOMException { return getNodeValue(); // overriden in some subclasses } /** * Compares a node with this node with regard to their position in the * document. * @param other The node to compare against this node. * @return Returns how the given node is positioned relatively to this * node. * @since DOM Level 3 */ public short compareDocumentPosition(Node other) throws DOMException { return 0; } /** * The absolute base URI of this node or null if undefined. * This value is computed according to . However, when the * Document supports the feature "HTML" , the base URI is * computed using first the value of the href attribute of the HTML BASE * element if any, and the value of the documentURI * attribute from the Document interface otherwise. *
    When the node is an Element, a Document * or a a ProcessingInstruction, this attribute represents * the properties [base URI] defined in . When the node is a * Notation, an Entity, or an * EntityReference, this attribute represents the * properties [declaration base URI] in the . How will this be affected * by resolution of relative namespace URIs issue?It's not.Should this * only be on Document, Element, ProcessingInstruction, Entity, and * Notation nodes, according to the infoset? If not, what is it equal to * on other nodes? Null? An empty string? I think it should be the * parent's.No.Should this be read-only and computed or and actual * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and * teleconference 30 May 2001).If the base HTML element is not yet * attached to a document, does the insert change the Document.baseURI? * Yes. (F2F 26 Sep 2001) * @since DOM Level 3 */ public String getBaseURI() { return null; } /** * DOM Level 3 * Renaming node */ public Node renameNode(Node n, String namespaceURI, String name) throws DOMException{ return n; } /** * DOM Level 3 * Normalize document. */ public void normalizeDocument(){ } /** * The configuration used when Document.normalizeDocument is * invoked. * @since DOM Level 3 */ public DOMConfiguration getDomConfig(){ return null; } /** DOM Level 3 feature: documentURI */ protected String fDocumentURI; /** * DOM Level 3 */ public void setDocumentURI(String documentURI){ fDocumentURI= documentURI; } /** * DOM Level 3 * The location of the document or null if undefined. *
    Beware that when the Document supports the feature * "HTML" , the href attribute of the HTML BASE element takes precedence * over this attribute. * @since DOM Level 3 */ public String getDocumentURI(){ return fDocumentURI; } /** DOM Level 3 feature: Document actualEncoding */ protected String actualEncoding; /** * DOM Level 3 * An attribute specifying the actual encoding of this document. This is * null otherwise. *
    This attribute represents the property [character encoding scheme] * defined in . * @since DOM Level 3 */ public String getActualEncoding() { return actualEncoding; } /** * DOM Level 3 * An attribute specifying the actual encoding of this document. This is * null otherwise. *
    This attribute represents the property [character encoding scheme] * defined in . * @since DOM Level 3 */ public void setActualEncoding(String value) { actualEncoding = value; } /** * DOM Level 3 */ public Text replaceWholeText(String content) throws DOMException{ /* if (needsSyncData()) { synchronizeData(); } // make sure we can make the replacement if (!canModify(nextSibling)) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); } Node parent = this.getParentNode(); if (content == null || content.length() == 0) { // remove current node if (parent !=null) { // check if node in the tree parent.removeChild(this); return null; } } Text currentNode = null; if (isReadOnly()){ Text newNode = this.ownerDocument().createTextNode(content); if (parent !=null) { // check if node in the tree parent.insertBefore(newNode, this); parent.removeChild(this); currentNode = newNode; } else { return newNode; } } else { this.setData(content); currentNode = this; } Node sibling = currentNode.getNextSibling(); while ( sibling !=null) { parent.removeChild(sibling); sibling = currentNode.getNextSibling(); } return currentNode; */ return null; //Pending } /** * DOM Level 3 * Returns all text of Text nodes logically-adjacent text * nodes to this node, concatenated in document order. * @since DOM Level 3 */ public String getWholeText(){ /* if (needsSyncData()) { synchronizeData(); } if (nextSibling == null) { return data; } StringBuffer buffer = new StringBuffer(); if (data != null && data.length() != 0) { buffer.append(data); } getWholeText(nextSibling, buffer); return buffer.toString(); */ return null; // PENDING } /** * DOM Level 3 * Returns whether this text node contains whitespace in element content, * often abusively called "ignorable whitespace". */ public boolean isElementContentWhitespace(){ return false; } /** * NON-DOM: set the type of this attribute to be ID type. * * @param id */ public void setIdAttribute(boolean id){ //PENDING } /** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttribute(String name, boolean makeId) { //PENDING } /** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttributeNode(Attr at, boolean makeId) { //PENDING } /** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttributeNS(String namespaceURI, String localName, boolean makeId) { //PENDING } public TypeInfo getSchemaTypeInfo(){ return null; //PENDING } public boolean isId() { return false; //PENDING } private String xmlEncoding; public String getXmlEncoding( ) { return xmlEncoding; } public void setXmlEncoding( String xmlEncoding ) { this.xmlEncoding = xmlEncoding; } private boolean xmlStandalone; public boolean getXmlStandalone() { return xmlStandalone; } public void setXmlStandalone(boolean xmlStandalone) throws DOMException { this.xmlStandalone = xmlStandalone; } private String xmlVersion; public String getXmlVersion() { return xmlVersion; } public void setXmlVersion(String xmlVersion) throws DOMException { this.xmlVersion = xmlVersion; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java0000644000175000017500000004076310721374031026421 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IncrementalSAXSource_Xerces.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.apache.xerces.parsers.SAXParser; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /**

    IncrementalSAXSource_Xerces takes advantage of the fact that Xerces1 * incremental mode is already a coroutine of sorts, and just wraps our * IncrementalSAXSource API around it.

    * *

    Usage example: See main().

    * *

    Status: Passes simple main() unit-test. NEEDS JAVADOC.

    * */ public class IncrementalSAXSource_Xerces implements IncrementalSAXSource { // // Reflection. To allow this to compile with both Xerces1 and Xerces2, which // require very different methods and objects, we need to avoid static // references to those APIs. So until Xerces2 is pervasive and we're willing // to make it a prerequisite, we will rely upon relection. // Method fParseSomeSetup=null; // Xerces1 method Method fParseSome=null; // Xerces1 method Object fPullParserConfig=null; // Xerces2 pull control object Method fConfigSetInput=null; // Xerces2 method Method fConfigParse=null; // Xerces2 method Method fSetInputSource=null; // Xerces2 pull control method Constructor fConfigInputSourceCtor=null; // Xerces2 initialization method Method fConfigSetByteStream=null; // Xerces2 initialization method Method fConfigSetCharStream=null; // Xerces2 initialization method Method fConfigSetEncoding=null; // Xerces2 initialization method Method fReset=null; // Both Xerces1 and Xerces2, but diff. signatures // // Data // SAXParser fIncrementalParser; private boolean fParseInProgress=false; // // Constructors // /** Create a IncrementalSAXSource_Xerces, and create a SAXParser * to go with it. Xerces2 incremental parsing is only supported if * this constructor is used, due to limitations in the Xerces2 API (as of * Beta 3). If you don't like that restriction, tell the Xerces folks that * there should be a simpler way to request incremental SAX parsing. * */ public IncrementalSAXSource_Xerces() throws NoSuchMethodException { try { // Xerces-2 incremental parsing support (as of Beta 3) // ContentHandlers still get set on fIncrementalParser (to get // conversion from XNI events to SAX events), but // _control_ for incremental parsing must be exercised via the config. // // At this time there's no way to read the existing config, only // to assert a new one... and only when creating a brand-new parser. // // Reflection is used to allow us to continue to compile against // Xerces1. If/when we can abandon the older versions of the parser, // this will simplify significantly. // If we can't get the magic constructor, no need to look further. Class xniConfigClass=ObjectFactory.findProviderClass( "org.apache.xerces.xni.parser.XMLParserConfiguration", ObjectFactory.findClassLoader(), true); Class[] args1={xniConfigClass}; Constructor ctor=SAXParser.class.getConstructor(args1); // Build the parser configuration object. StandardParserConfiguration // happens to implement XMLPullParserConfiguration, which is the API // we're going to want to use. Class xniStdConfigClass=ObjectFactory.findProviderClass( "org.apache.xerces.parsers.StandardParserConfiguration", ObjectFactory.findClassLoader(), true); fPullParserConfig=xniStdConfigClass.newInstance(); Object[] args2={fPullParserConfig}; fIncrementalParser = (SAXParser)ctor.newInstance(args2); // Preload all the needed the configuration methods... I want to know they're // all here before we commit to trying to use them, just in case the // API changes again. Class fXniInputSourceClass=ObjectFactory.findProviderClass( "org.apache.xerces.xni.parser.XMLInputSource", ObjectFactory.findClassLoader(), true); Class[] args3={fXniInputSourceClass}; fConfigSetInput=xniStdConfigClass.getMethod("setInputSource",args3); Class[] args4={String.class,String.class,String.class}; fConfigInputSourceCtor=fXniInputSourceClass.getConstructor(args4); Class[] args5={java.io.InputStream.class}; fConfigSetByteStream=fXniInputSourceClass.getMethod("setByteStream",args5); Class[] args6={java.io.Reader.class}; fConfigSetCharStream=fXniInputSourceClass.getMethod("setCharacterStream",args6); Class[] args7={String.class}; fConfigSetEncoding=fXniInputSourceClass.getMethod("setEncoding",args7); Class[] argsb={Boolean.TYPE}; fConfigParse=xniStdConfigClass.getMethod("parse",argsb); Class[] noargs=new Class[0]; fReset=fIncrementalParser.getClass().getMethod("reset",noargs); } catch(Exception e) { // Fallback if this fails (implemented in createIncrementalSAXSource) is // to attempt Xerces-1 incremental setup. Can't do tail-call in // constructor, so create new, copy Xerces-1 initialization, // then throw it away... Ugh. IncrementalSAXSource_Xerces dummy=new IncrementalSAXSource_Xerces(new SAXParser()); this.fParseSomeSetup=dummy.fParseSomeSetup; this.fParseSome=dummy.fParseSome; this.fIncrementalParser=dummy.fIncrementalParser; } } /** Create a IncrementalSAXSource_Xerces wrapped around * an existing SAXParser. Currently this works only for recent * releases of Xerces-1. Xerces-2 incremental is currently possible * only if we are allowed to create the parser instance, due to * limitations in the API exposed by Xerces-2 Beta 3; see the * no-args constructor for that code. * * @exception if the SAXParser class doesn't support the Xerces * incremental parse operations. In that case, caller should * fall back upon the IncrementalSAXSource_Filter approach. * */ public IncrementalSAXSource_Xerces(SAXParser parser) throws NoSuchMethodException { // Reflection is used to allow us to compile against // Xerces2. If/when we can abandon the older versions of the parser, // this constructor will simply have to fail until/unless the // Xerces2 incremental support is made available on previously // constructed SAXParser instances. fIncrementalParser=parser; Class me=parser.getClass(); Class[] parms={InputSource.class}; fParseSomeSetup=me.getMethod("parseSomeSetup",parms); parms=new Class[0]; fParseSome=me.getMethod("parseSome",parms); // Fallback if this fails (implemented in createIncrementalSAXSource) is // to use IncrementalSAXSource_Filter rather than Xerces-specific code. } // // Factories // static public IncrementalSAXSource createIncrementalSAXSource() { try { return new IncrementalSAXSource_Xerces(); } catch(NoSuchMethodException e) { // Xerces version mismatch; neither Xerces1 nor Xerces2 succeeded. // Fall back on filtering solution. IncrementalSAXSource_Filter iss=new IncrementalSAXSource_Filter(); iss.setXMLReader(new SAXParser()); return iss; } } static public IncrementalSAXSource createIncrementalSAXSource(SAXParser parser) { try { return new IncrementalSAXSource_Xerces(parser); } catch(NoSuchMethodException e) { // Xerces version mismatch; neither Xerces1 nor Xerces2 succeeded. // Fall back on filtering solution. IncrementalSAXSource_Filter iss=new IncrementalSAXSource_Filter(); iss.setXMLReader(parser); return iss; } } // // Public methods // // Register handler directly with the incremental parser public void setContentHandler(org.xml.sax.ContentHandler handler) { // Typecast required in Xerces2; SAXParser doesn't inheret XMLReader // %OPT% Cast at asignment? ((XMLReader)fIncrementalParser).setContentHandler(handler); } // Register handler directly with the incremental parser public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler) { // Not supported by all SAX2 parsers but should work in Xerces: try { // Typecast required in Xerces2; SAXParser doesn't inheret XMLReader // %OPT% Cast at asignment? ((XMLReader)fIncrementalParser).setProperty("http://xml.org/sax/properties/lexical-handler", handler); } catch(org.xml.sax.SAXNotRecognizedException e) { // Nothing we can do about it } catch(org.xml.sax.SAXNotSupportedException e) { // Nothing we can do about it } } // Register handler directly with the incremental parser public void setDTDHandler(org.xml.sax.DTDHandler handler) { // Typecast required in Xerces2; SAXParser doesn't inheret XMLReader // %OPT% Cast at asignment? ((XMLReader)fIncrementalParser).setDTDHandler(handler); } //================================================================ /** startParse() is a simple API which tells the IncrementalSAXSource * to begin reading a document. * * @throws SAXException is parse thread is already in progress * or parsing can not be started. * */ public void startParse(InputSource source) throws SAXException { if (fIncrementalParser==null) throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_STARTPARSE_NEEDS_SAXPARSER, null)); //"startParse needs a non-null SAXParser."); if (fParseInProgress) throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_STARTPARSE_WHILE_PARSING, null)); //"startParse may not be called while parsing."); boolean ok=false; try { ok = parseSomeSetup(source); } catch(Exception ex) { throw new SAXException(ex); } if(!ok) throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COULD_NOT_INIT_PARSER, null)); //"could not initialize parser with"); } /** deliverMoreNodes() is a simple API which tells the coroutine * parser that we need more nodes. This is intended to be called * from one of our partner routines, and serves to encapsulate the * details of how incremental parsing has been achieved. * * @param parsemore If true, tells the incremental parser to generate * another chunk of output. If false, tells the parser that we're * satisfied and it can terminate parsing of this document. * @return Boolean.TRUE if the CoroutineParser believes more data may be available * for further parsing. Boolean.FALSE if parsing ran to completion. * Exception if the parser objected for some reason. * */ public Object deliverMoreNodes (boolean parsemore) { if(!parsemore) { fParseInProgress=false; return Boolean.FALSE; } Object arg; try { boolean keepgoing = parseSome(); arg = keepgoing ? Boolean.TRUE : Boolean.FALSE; } catch (SAXException ex) { arg = ex; } catch (IOException ex) { arg = ex; } catch (Exception ex) { arg = new SAXException(ex); } return arg; } // Private methods -- conveniences to hide the reflection details private boolean parseSomeSetup(InputSource source) throws SAXException, IOException, IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException { if(fConfigSetInput!=null) { // Obtain input from SAX inputSource object, construct XNI version of // that object. Logic adapted from Xerces2. Object[] parms1={source.getPublicId(),source.getSystemId(),null}; Object xmlsource=fConfigInputSourceCtor.newInstance(parms1); Object[] parmsa={source.getByteStream()}; fConfigSetByteStream.invoke(xmlsource,parmsa); parmsa[0]=source.getCharacterStream(); fConfigSetCharStream.invoke(xmlsource,parmsa); parmsa[0]=source.getEncoding(); fConfigSetEncoding.invoke(xmlsource,parmsa); // Bugzilla5272 patch suggested by Sandy Gao. // Has to be reflection to run with Xerces2 // after compilation against Xerces1. or vice // versa, due to return type mismatches. Object[] noparms=new Object[0]; fReset.invoke(fIncrementalParser,noparms); parmsa[0]=xmlsource; fConfigSetInput.invoke(fPullParserConfig,parmsa); // %REVIEW% Do first pull. Should we instead just return true? return parseSome(); } else { Object[] parm={source}; Object ret=fParseSomeSetup.invoke(fIncrementalParser,parm); return ((Boolean)ret).booleanValue(); } } // Would null work??? private static final Object[] noparms=new Object[0]; private static final Object[] parmsfalse={Boolean.FALSE}; private boolean parseSome() throws SAXException, IOException, IllegalAccessException, java.lang.reflect.InvocationTargetException { // Take next parsing step, return false iff parsing complete: if(fConfigSetInput!=null) { Object ret=(Boolean)(fConfigParse.invoke(fPullParserConfig,parmsfalse)); return ((Boolean)ret).booleanValue(); } else { Object ret=fParseSome.invoke(fIncrementalParser,noparms); return ((Boolean)ret).booleanValue(); } } //================================================================ /** Simple unit test. Attempt coroutine parsing of document indicated * by first argument (as a URI), report progress. */ public static void main(String args[]) { System.out.println("Starting..."); CoroutineManager co = new CoroutineManager(); int appCoroutineID = co.co_joinCoroutineSet(-1); if (appCoroutineID == -1) { System.out.println("ERROR: Couldn't allocate coroutine number.\n"); return; } IncrementalSAXSource parser= createIncrementalSAXSource(); // Use a serializer as our sample output org.apache.xml.serialize.XMLSerializer trace; trace=new org.apache.xml.serialize.XMLSerializer(System.out,null); parser.setContentHandler(trace); parser.setLexicalHandler(trace); // Tell coroutine to begin parsing, run while parsing is in progress for(int arg=0;argDTMNodeList gives us an implementation of the DOM's * NodeList interface wrapped around a DTM Iterator. The author * considers this something of an abominations, since NodeList was not * intended to be a general purpose "list of nodes" API and is * generally considered by the DOM WG to have be a mistake... but I'm * told that some of the XPath/XSLT folks say they must have this * solution. * * Please note that this is not necessarily equivlaent to a DOM * NodeList operating over the same document. In particular: *
      * *
    • If there are several Text nodes in logical succession (ie, * across CDATASection and EntityReference boundaries), we will return * only the first; the caller is responsible for stepping through * them. * (%REVIEW% Provide a convenience routine here to assist, pending * proposed DOM Level 3 getAdjacentText() operation?)
    • * *
    • Since the whole XPath/XSLT architecture assumes that the source * document is not altered while we're working with it, we do not * promise to implement the DOM NodeList's "live view" response to * document mutation.
    • * *
    * *

    State: In progress!!

    * */ public class DTMNodeList extends DTMNodeListBase { private DTMIterator m_iter; //================================================================ // Methods unique to this class private DTMNodeList() { } /** * Public constructor: Wrap a DTMNodeList around an existing * and preconfigured DTMIterator * * WARNING: THIS HAS THE SIDE EFFECT OF ISSUING setShouldCacheNodes(true) * AGAINST THE DTMIterator. * */ public DTMNodeList(DTMIterator dtmIterator) { if (dtmIterator != null) { int pos = dtmIterator.getCurrentPos(); try { m_iter=(DTMIterator)dtmIterator.cloneWithReset(); } catch(CloneNotSupportedException cnse) { m_iter = dtmIterator; } m_iter.setShouldCacheNodes(true); m_iter.runTo(-1); m_iter.setCurrentPos(pos); } } /** * Access the wrapped DTMIterator. I'm not sure whether anyone will * need this or not, but let's write it and think about it. * */ public DTMIterator getDTMIterator() { return m_iter; } //================================================================ // org.w3c.dom.NodeList API follows /** * Returns the indexth item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * @param index Index into the collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. */ public Node item(int index) { if (m_iter != null) { int handle=m_iter.item(index); if (handle == DTM.NULL) { return null; } return m_iter.getDTM(handle).getNode(handle); } else { return null; } } /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. */ public int getLength() { return (m_iter != null) ? m_iter.getLength() : 0; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/SecuritySupport12.java0000644000175000017500000001175510721374030024457 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/ExpandedNameTable.java0000644000175000017500000003047210721374030024406 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExpandedNameTable.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTM; /** * This is a default implementation of a table that manages mappings from * expanded names to expandedNameIDs. * * %OPT% The performance of the getExpandedTypeID() method is very important * to DTM building. To get the best performance out of this class, we implement * a simple hash algorithm directly into this class, instead of using the * inefficient java.util.Hashtable. The code for the get and put operations * are combined in getExpandedTypeID() method to share the same hash calculation * code. We only need to implement the rehash() interface which is used to * expand the hash table. */ public class ExpandedNameTable { /** Array of extended types for this document */ private ExtendedType[] m_extendedTypes; /** The initial size of the m_extendedTypes array */ private static int m_initialSize = 128; /** Next available extended type */ // %REVIEW% Since this is (should be) always equal // to the length of m_extendedTypes, do we need this? private int m_nextType; // These are all the types prerotated, for caller convenience. public static final int ELEMENT = ((int)DTM.ELEMENT_NODE) ; public static final int ATTRIBUTE = ((int)DTM.ATTRIBUTE_NODE) ; public static final int TEXT = ((int)DTM.TEXT_NODE) ; public static final int CDATA_SECTION = ((int)DTM.CDATA_SECTION_NODE) ; public static final int ENTITY_REFERENCE = ((int)DTM.ENTITY_REFERENCE_NODE) ; public static final int ENTITY = ((int)DTM.ENTITY_NODE) ; public static final int PROCESSING_INSTRUCTION = ((int)DTM.PROCESSING_INSTRUCTION_NODE) ; public static final int COMMENT = ((int)DTM.COMMENT_NODE) ; public static final int DOCUMENT = ((int)DTM.DOCUMENT_NODE) ; public static final int DOCUMENT_TYPE = ((int)DTM.DOCUMENT_TYPE_NODE) ; public static final int DOCUMENT_FRAGMENT =((int)DTM.DOCUMENT_FRAGMENT_NODE) ; public static final int NOTATION = ((int)DTM.NOTATION_NODE) ; public static final int NAMESPACE = ((int)DTM.NAMESPACE_NODE) ; /** Workspace for lookup. NOT THREAD SAFE! * */ ExtendedType hashET = new ExtendedType(-1, "", ""); /** The array to store the default extended types. */ private static ExtendedType[] m_defaultExtendedTypes; /** * The default load factor of the Hashtable. * This is used to calcualte the threshold. */ private static float m_loadFactor = 0.75f; /** * The initial capacity of the hash table. Use a bigger number * to avoid the cost of expanding the table. */ private static int m_initialCapacity = 203; /** * The capacity of the hash table, i.e. the size of the * internal HashEntry array. */ private int m_capacity; /** * The threshold of the hash table, which is equal to capacity * loadFactor. * If the number of entries in the hash table is bigger than the threshold, * the hash table needs to be expanded. */ private int m_threshold; /** * The internal array to store the hash entries. * Each array member is a slot for a hash bucket. */ private HashEntry[] m_table; /** * Init default values */ static { m_defaultExtendedTypes = new ExtendedType[DTM.NTYPES]; for (int i = 0; i < DTM.NTYPES; i++) { m_defaultExtendedTypes[i] = new ExtendedType(i, "", ""); } } /** * Create an expanded name table. */ public ExpandedNameTable() { m_capacity = m_initialCapacity; m_threshold = (int)(m_capacity * m_loadFactor); m_table = new HashEntry[m_capacity]; initExtendedTypes(); } /** * Initialize the vector of extended types with the * basic DOM node types. */ private void initExtendedTypes() { m_extendedTypes = new ExtendedType[m_initialSize]; for (int i = 0; i < DTM.NTYPES; i++) { m_extendedTypes[i] = m_defaultExtendedTypes[i]; m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null); } m_nextType = DTM.NTYPES; } /** * Given an expanded name represented by namespace, local name and node type, * return an ID. If the expanded-name does not exist in the internal tables, * the entry will be created, and the ID will be returned. Any additional * nodes that are created that have this expanded name will use this ID. * * @param namespace The namespace * @param localName The local name * @param type The node type * * @return the expanded-name id of the node. */ public int getExpandedTypeID(String namespace, String localName, int type) { return getExpandedTypeID(namespace, localName, type, false); } /** * Given an expanded name represented by namespace, local name and node type, * return an ID. If the expanded-name does not exist in the internal tables, * the entry will be created, and the ID will be returned. Any additional * nodes that are created that have this expanded name will use this ID. *

    * If searchOnly is true, we will return -1 if the name is not found in the * table, otherwise the name is added to the table and the expanded name id * of the new entry is returned. * * @param namespace The namespace * @param localName The local name * @param type The node type * @param searchOnly If it is true, we will only search for the expanded name. * -1 is return is the name is not found. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(String namespace, String localName, int type, boolean searchOnly) { if (null == namespace) namespace = ""; if (null == localName) localName = ""; // Calculate the hash code int hash = type + namespace.hashCode() + localName.hashCode(); // Redefine the hashET object to represent the new expanded name. hashET.redefine(type, namespace, localName, hash); // Calculate the index into the HashEntry table. int index = hash % m_capacity; if (index < 0) index = -index; // Look up the expanded name in the hash table. Return the id if // the expanded name is already in the hash table. for (HashEntry e = m_table[index]; e != null; e = e.next) { if (e.hash == hash && e.key.equals(hashET)) return e.value; } if (searchOnly) { return DTM.NULL; } // Expand the internal HashEntry array if necessary. if (m_nextType > m_threshold) { rehash(); index = hash % m_capacity; if (index < 0) index = -index; } // Create a new ExtendedType object ExtendedType newET = new ExtendedType(type, namespace, localName, hash); // Expand the m_extendedTypes array if necessary. if (m_extendedTypes.length == m_nextType) { ExtendedType[] newArray = new ExtendedType[m_extendedTypes.length * 2]; System.arraycopy(m_extendedTypes, 0, newArray, 0, m_extendedTypes.length); m_extendedTypes = newArray; } m_extendedTypes[m_nextType] = newET; // Create a new hash entry for the new ExtendedType and put it into // the table. HashEntry entry = new HashEntry(newET, m_nextType, hash, m_table[index]); m_table[index] = entry; return m_nextType++; } /** * Increases the capacity of and internally reorganizes the hashtable, * in order to accommodate and access its entries more efficiently. * This method is called when the number of keys in the hashtable exceeds * this hashtable's capacity and load factor. */ private void rehash() { int oldCapacity = m_capacity; HashEntry[] oldTable = m_table; int newCapacity = 2 * oldCapacity + 1; m_capacity = newCapacity; m_threshold = (int)(newCapacity * m_loadFactor); m_table = new HashEntry[newCapacity]; for (int i = oldCapacity-1; i >=0 ; i--) { for (HashEntry old = oldTable[i]; old != null; ) { HashEntry e = old; old = old.next; int newIndex = e.hash % newCapacity; if (newIndex < 0) newIndex = -newIndex; e.next = m_table[newIndex]; m_table[newIndex] = e; } } } /** * Given a type, return an expanded name ID.Any additional nodes that are * created that have this expanded name will use this ID. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(int type) { return type; } /** * Given an expanded-name ID, return the local name part. * * @param ExpandedNameID an ID that represents an expanded-name. * @return String Local name of this node, or null if the node has no name. */ public String getLocalName(int ExpandedNameID) { return m_extendedTypes[ExpandedNameID].getLocalName(); } /** * Given an expanded-name ID, return the local name ID. * * @param ExpandedNameID an ID that represents an expanded-name. * @return The id of this local name. */ public final int getLocalNameID(int ExpandedNameID) { // ExtendedType etype = m_extendedTypes[ExpandedNameID]; if (m_extendedTypes[ExpandedNameID].getLocalName().equals("")) return 0; else return ExpandedNameID; } /** * Given an expanded-name ID, return the namespace URI part. * * @param ExpandedNameID an ID that represents an expanded-name. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespace(int ExpandedNameID) { String namespace = m_extendedTypes[ExpandedNameID].getNamespace(); return (namespace.equals("") ? null : namespace); } /** * Given an expanded-name ID, return the namespace URI ID. * * @param ExpandedNameID an ID that represents an expanded-name. * @return The id of this namespace. */ public final int getNamespaceID(int ExpandedNameID) { //ExtendedType etype = m_extendedTypes[ExpandedNameID]; if (m_extendedTypes[ExpandedNameID].getNamespace().equals("")) return 0; else return ExpandedNameID; } /** * Given an expanded-name ID, return the local name ID. * * @param ExpandedNameID an ID that represents an expanded-name. * @return The id of this local name. */ public final short getType(int ExpandedNameID) { //ExtendedType etype = m_extendedTypes[ExpandedNameID]; return (short)m_extendedTypes[ExpandedNameID].getNodeType(); } /** * Return the size of the ExpandedNameTable * * @return The size of the ExpandedNameTable */ public int getSize() { return m_nextType; } /** * Return the array of extended types * * @return The array of extended types */ public ExtendedType[] getExtendedTypes() { return m_extendedTypes; } /** * Inner class which represents a hash table entry. * The field next points to the next entry which is hashed into * the same bucket in the case of "hash collision". */ private static final class HashEntry { ExtendedType key; int value; int hash; HashEntry next; protected HashEntry(ExtendedType key, int value, int hash, HashEntry next) { this.key = key; this.value = value; this.hash = hash; this.next = next; } } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/CoroutineParser.java0000644000175000017500000001402710721374030024227 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CoroutineParser.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; /**

    CoroutineParser is an API for parser threads that operate as * coroutines. See CoroutineSAXParser and CoroutineSAXParser_Xerces * for examples.

    * *

    <grumble> I'd like the interface to require a specific form * for either the base constructor or a static factory method. Java * doesn't allow us to specify either, so I'll just document them * here: * *

      *
    • public CoroutineParser(CoroutineManager co, int appCoroutine);
    • *
    • public CoroutineParser createCoroutineParser(CoroutineManager co, int appCoroutine);
    • *
    * * </grumble>

    * * @deprecated Since the ability to start a parse via the * coroutine protocol was not being used and was complicating design. * See {@link IncrementalSAXSource}. * */ public interface CoroutineParser { /** @return the coroutine ID number for this CoroutineParser object. * Note that this isn't useful unless you know which CoroutineManager * you're talking to. Also note that the do...() methods encapsulate * the common transactions with the CoroutineParser, so you shouldn't * need this in most cases. * */ public int getParserCoroutineID(); /** @return the CoroutineManager for this CoroutineParser object. * If you're using the do...() methods, applications should only * need to talk to the CoroutineManager once, to obtain the * application's Coroutine ID. * */ public CoroutineManager getCoroutineManager(); /** Register a SAX-style content handler for us to output to */ public void setContentHandler(ContentHandler handler); /** Register a SAX-style lexical handler for us to output to * Not all parsers support this... * * %REVIEW% Not called setLexicalHandler because Xalan uses that name * internally, which causes subclassing nuisances. */ public void setLexHandler(org.xml.sax.ext.LexicalHandler handler); /* The run() method is required in CoroutineParsers that run as * threads (of course)... but it isn't part of our API, and * shouldn't be declared here. * */ //================================================================ /** doParse() is a simple API which tells the coroutine parser * to begin reading from a file. This is intended to be called from one * of our partner coroutines, and serves both to encapsulate the * communication protocol and to avoid having to explicitly use the * CoroutineParser's coroutine ID number. * * %REVIEW% Can/should this unify with doMore? (if URI hasn't changed, * parse more from same file, else end and restart parsing...? * * @param source The InputSource to parse from. * @param appCoroutine The coroutine ID number of the coroutine invoking * this method, so it can be resumed after the parser has responded to the * request. * @return Boolean.TRUE if the CoroutineParser believes more data may be available * for further parsing. Boolean.FALSE if parsing ran to completion. * Exception if the parser objected for some reason. * */ public Object doParse(InputSource source, int appCoroutine); /** doMore() is a simple API which tells the coroutine parser * that we need more nodes. This is intended to be called from one * of our partner coroutines, and serves both to encapsulate the * communication protocol and to avoid having to explicitly use the * CoroutineParser's coroutine ID number. * * @param parsemore If true, tells the incremental parser to generate * another chunk of output. If false, tells the parser that we're * satisfied and it can terminate parsing of this document. * @param appCoroutine The coroutine ID number of the coroutine invoking * this method, so it can be resumed after the parser has responded to the * request. * @return Boolean.TRUE if the CoroutineParser believes more data may be available * for further parsing. Boolean.FALSE if parsing ran to completion. * Exception if the parser objected for some reason. * */ public Object doMore (boolean parsemore, int appCoroutine); /** doTerminate() is a simple API which tells the coroutine * parser to terminate itself. This is intended to be called from * one of our partner coroutines, and serves both to encapsulate the * communication protocol and to avoid having to explicitly use the * CoroutineParser's coroutine ID number. * * Returns only after the CoroutineParser has acknowledged the request. * * @param appCoroutine The coroutine ID number of the coroutine invoking * this method, so it can be resumed after the parser has responded to the * request. * */ public void doTerminate(int appCoroutine); /** * Initialize the coroutine parser. Same parameters could be passed * in a non-default constructor, or by using using context ClassLoader * and newInstance and then calling init() */ public void init( CoroutineManager co, int appCoroutineID, XMLReader parser ); } // class CoroutineParser libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMSafeStringPool.java0000644000175000017500000000745710721374031024361 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMSafeStringPool.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; /**

    Like DTMStringPool, but threadsafe. It's been proposed that DTMs * share their string pool(s); that raises threadsafety issues which * this addresses. Of course performance is inferior to that of the * bare-bones version.

    * *

    Status: Passed basic test in main().

    * */ public class DTMSafeStringPool extends DTMStringPool { public synchronized void removeAllElements() { super.removeAllElements(); } /** @return string whose value is uniquely identified by this integer index. * @throws java.lang.ArrayIndexOutOfBoundsException * if index doesn't map to a string. * */ public synchronized String indexToString(int i) throws java.lang.ArrayIndexOutOfBoundsException { return super.indexToString(i); } /** @return integer index uniquely identifying the value of this string. */ public synchronized int stringToIndex(String s) { return super.stringToIndex(s); } /** Command-line unit test driver. This test relies on the fact that * this version of the pool assigns indices consecutively, starting * from zero, as new unique strings are encountered. */ public static void main(String[] args) { String[] word={ "Zero","One","Two","Three","Four","Five", "Six","Seven","Eight","Nine","Ten", "Eleven","Twelve","Thirteen","Fourteen","Fifteen", "Sixteen","Seventeen","Eighteen","Nineteen","Twenty", "Twenty-One","Twenty-Two","Twenty-Three","Twenty-Four", "Twenty-Five","Twenty-Six","Twenty-Seven","Twenty-Eight", "Twenty-Nine","Thirty","Thirty-One","Thirty-Two", "Thirty-Three","Thirty-Four","Thirty-Five","Thirty-Six", "Thirty-Seven","Thirty-Eight","Thirty-Nine"}; DTMStringPool pool=new DTMSafeStringPool(); System.out.println("If no complaints are printed below, we passed initial test."); for(int pass=0;pass<=1;++pass) { int i; for(i=0;i /** * Current iteration location. Usually this is the last location * returned (starting point for the next() search); for single-node * iterators it may instead be initialized to point to that single node. */ protected int _currentNode; /** * Remembers the current node for the next call to gotoMark(). * * %REVIEW% Should this save _position too? */ public void setMark() { _markedNode = _currentNode; } /** * Restores the current node remembered by setMark(). * * %REVEIW% Should this restore _position too? */ public void gotoMark() { _currentNode = _markedNode; } } // end of InternalAxisIteratorBase /** * Iterator that returns all immediate children of a given node */ public final class ChildrenIterator extends InternalAxisIteratorBase { /** * Setting start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * If the iterator is not restartable, this has no effect. * %REVIEW% Should it return/throw something in that case, * or set current node to END, to indicate request-not-honored? * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : _firstch(makeNodeIdentity(node)); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END if no more * are available. */ public int next() { if (_currentNode != NULL) { int node = _currentNode; _currentNode = _nextsib(node); return returnNode(makeNodeHandle(node)); } return END; } } // end of ChildrenIterator /** * Iterator that returns the parent of a given node. Note that * this delivers only a single node; if you want all the ancestors, * see AncestorIterator. */ public final class ParentIterator extends InternalAxisIteratorBase { /** The extended type ID that was requested. */ private int _nodeType = -1; /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = getParent(node); return resetPosition(); } return this; } /** * Set the node type of the parent that we're looking for. * Note that this does _not_ mean "find the nearest ancestor of * this type", but "yield the parent if it is of this type". * * * @param type extended type ID. * * @return ParentIterator configured with the type filter set. */ public DTMAxisIterator setNodeType(final int type) { _nodeType = type; return this; } /** * Get the next node in the iteration. In this case, we return * only the immediate parent, _if_ it matches the requested nodeType. * * @return The next node handle in the iteration, or END. */ public int next() { int result = _currentNode; if (_nodeType >= DTM.NTYPES) { if (_nodeType != getExpandedTypeID(_currentNode)) { result = END; } } else if (_nodeType != NULL) { if (_nodeType != getNodeType(_currentNode)) { result = END; } } _currentNode = END; return returnNode(result); } } // end of ParentIterator /** * Iterator that returns children of a given type for a given node. * The functionality chould be achieved by putting a filter on top * of a basic child iterator, but a specialised iterator is used * for efficiency (both speed and size of translet). */ public final class TypedChildrenIterator extends InternalAxisIteratorBase { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedChildrenIterator * * * @param nodeType The extended type ID being requested. */ public TypedChildrenIterator(int nodeType) { _nodeType = nodeType; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : _firstch(makeNodeIdentity(_startNode)); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int eType; int node = _currentNode; int nodeType = _nodeType; if (nodeType >= DTM.NTYPES) { while (node != DTM.NULL && _exptype(node) != nodeType) { node = _nextsib(node); } } else { while (node != DTM.NULL) { eType = _exptype(node); if (eType < DTM.NTYPES) { if (eType == nodeType) { break; } } else if (m_expandedNameTable.getType(eType) == nodeType) { break; } node = _nextsib(node); } } if (node == DTM.NULL) { _currentNode = DTM.NULL; return DTM.NULL; } else { _currentNode = _nextsib(node); return returnNode(makeNodeHandle(node)); } } } // end of TypedChildrenIterator /** * Iterator that returns children within a given namespace for a * given node. The functionality chould be achieved by putting a * filter on top of a basic child iterator, but a specialised * iterator is used for efficiency (both speed and size of translet). */ public final class NamespaceChildrenIterator extends InternalAxisIteratorBase { /** The extended type ID being requested. */ private final int _nsType; /** * Constructor NamespaceChildrenIterator * * * @param type The extended type ID being requested. */ public NamespaceChildrenIterator(final int type) { _nsType = type; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : NOTPROCESSED; return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_currentNode != DTM.NULL) { for (int node = (NOTPROCESSED == _currentNode) ? _firstch(makeNodeIdentity(_startNode)) : _nextsib(_currentNode); node != END; node = _nextsib(node)) { if (m_expandedNameTable.getNamespaceID(_exptype(node)) == _nsType) { _currentNode = node; return returnNode(node); } } } return END; } } // end of NamespaceChildrenIterator /** * Iterator that returns the namespace nodes as defined by the XPath data model * for a given node. */ public class NamespaceIterator extends InternalAxisIteratorBase { /** * Constructor NamespaceAttributeIterator */ public NamespaceIterator() { super(); } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = getFirstNamespaceNode(node, true); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; if (DTM.NULL != node) _currentNode = getNextNamespaceNode(_startNode, node, true); return returnNode(node); } } // end of NamespaceIterator /** * Iterator that returns the namespace nodes as defined by the XPath data model * for a given node, filtered by extended type ID. */ public class TypedNamespaceIterator extends NamespaceIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedNamespaceIterator * * * @param nodeType The extended type ID being requested. */ public TypedNamespaceIterator(int nodeType) { super(); _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node; for (node = _currentNode; node != END; node = getNextNamespaceNode(_startNode, node, true)) { if (getExpandedTypeID(node) == _nodeType || getNodeType(node) == _nodeType || getNamespaceType(node) == _nodeType) { _currentNode = node; return returnNode(node); } } return (_currentNode =END); } } // end of TypedNamespaceIterator /** * Iterator that returns the the root node as defined by the XPath data model * for a given node. */ public class RootIterator extends InternalAxisIteratorBase { /** * Constructor RootIterator */ public RootIterator() { super(); } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = getDocumentRoot(node); _currentNode = NULL; return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if(_startNode == _currentNode) return NULL; _currentNode = _startNode; return returnNode(_startNode); } } // end of RootIterator /** * Iterator that returns the namespace nodes as defined by the XPath data model * for a given node, filtered by extended type ID. */ public class TypedRootIterator extends RootIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedRootIterator * * @param nodeType The extended type ID being requested. */ public TypedRootIterator(int nodeType) { super(); _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if(_startNode == _currentNode) return NULL; int nodeType = _nodeType; int node = _startNode; int expType = getExpandedTypeID(node); _currentNode = node; if (nodeType >= DTM.NTYPES) { if (nodeType == expType) { return returnNode(node); } } else { if (expType < DTM.NTYPES) { if (expType == nodeType) { return returnNode(node); } } else { if (m_expandedNameTable.getType(expType) == nodeType) { return returnNode(node); } } } return END; } } // end of TypedRootIterator /** * Iterator that returns attributes within a given namespace for a node. */ public final class NamespaceAttributeIterator extends InternalAxisIteratorBase { /** The extended type ID being requested. */ private final int _nsType; /** * Constructor NamespaceAttributeIterator * * * @param nsType The extended type ID being requested. */ public NamespaceAttributeIterator(int nsType) { super(); _nsType = nsType; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = getFirstNamespaceNode(node, false); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; if (DTM.NULL != node) _currentNode = getNextNamespaceNode(_startNode, node, false); return returnNode(node); } } // end of NamespaceAttributeIterator /** * Iterator that returns all siblings of a given node. */ public class FollowingSiblingIterator extends InternalAxisIteratorBase { /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = makeNodeIdentity(node); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { _currentNode = (_currentNode == DTM.NULL) ? DTM.NULL : _nextsib(_currentNode); return returnNode(makeNodeHandle(_currentNode)); } } // end of FollowingSiblingIterator /** * Iterator that returns all following siblings of a given node. */ public final class TypedFollowingSiblingIterator extends FollowingSiblingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedFollowingSiblingIterator * * * @param type The extended type ID being requested. */ public TypedFollowingSiblingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_currentNode == DTM.NULL) { return DTM.NULL; } int node = _currentNode; int eType; int nodeType = _nodeType; if (nodeType >= DTM.NTYPES) { do { node = _nextsib(node); } while (node != DTM.NULL && _exptype(node) != nodeType); } else { while ((node = _nextsib(node)) != DTM.NULL) { eType = _exptype(node); if (eType < DTM.NTYPES) { if (eType == nodeType) { break; } } else if (m_expandedNameTable.getType(eType) == nodeType) { break; } } } _currentNode = node; return (_currentNode == DTM.NULL) ? DTM.NULL : returnNode(makeNodeHandle(_currentNode)); } } // end of TypedFollowingSiblingIterator /** * Iterator that returns attribute nodes (of what nodes?) */ public final class AttributeIterator extends InternalAxisIteratorBase { // assumes caller will pass element nodes /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = getFirstAttributeIdentity(makeNodeIdentity(node)); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int node = _currentNode; if (node != NULL) { _currentNode = getNextAttributeIdentity(node); return returnNode(makeNodeHandle(node)); } return NULL; } } // end of AttributeIterator /** * Iterator that returns attribute nodes of a given type */ public final class TypedAttributeIterator extends InternalAxisIteratorBase { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedAttributeIterator * * * @param nodeType The extended type ID that is requested. */ public TypedAttributeIterator(int nodeType) { _nodeType = nodeType; } // assumes caller will pass element nodes /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = node; _currentNode = getTypedAttribute(node, _nodeType); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int node = _currentNode; // singleton iterator, since there can only be one attribute of // a given type. _currentNode = NULL; return returnNode(node); } } // end of TypedAttributeIterator /** * Iterator that returns preceding siblings of a given node */ public class PrecedingSiblingIterator extends InternalAxisIteratorBase { /** * The node identity of _startNode for this iterator */ protected int _startNodeID; /** * True if this iterator has a reversed axis. * * @return true. */ public boolean isReverse() { return true; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; node = _startNodeID = makeNodeIdentity(node); if(node == NULL) { _currentNode = node; return resetPosition(); } int type = m_expandedNameTable.getType(_exptype(node)); if(ExpandedNameTable.ATTRIBUTE == type || ExpandedNameTable.NAMESPACE == type ) { _currentNode = node; } else { // Be careful to handle the Document node properly _currentNode = _parent(node); if(NULL!=_currentNode) _currentNode = _firstch(_currentNode); else _currentNode = node; } return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_currentNode == _startNodeID || _currentNode == DTM.NULL) { return NULL; } else { final int node = _currentNode; _currentNode = _nextsib(node); return returnNode(makeNodeHandle(node)); } } } // end of PrecedingSiblingIterator /** * Iterator that returns preceding siblings of a given type for * a given node */ public final class TypedPrecedingSiblingIterator extends PrecedingSiblingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedPrecedingSiblingIterator * * * @param type The extended type ID being requested. */ public TypedPrecedingSiblingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; int expType; int nodeType = _nodeType; int startID = _startNodeID; if (nodeType >= DTM.NTYPES) { while (node != NULL && node != startID && _exptype(node) != nodeType) { node = _nextsib(node); } } else { while (node != NULL && node != startID) { expType = _exptype(node); if (expType < DTM.NTYPES) { if (expType == nodeType) { break; } } else { if (m_expandedNameTable.getType(expType) == nodeType) { break; } } node = _nextsib(node); } } if (node == DTM.NULL || node == _startNodeID) { _currentNode = NULL; return NULL; } else { _currentNode = _nextsib(node); return returnNode(makeNodeHandle(node)); } } } // end of TypedPrecedingSiblingIterator /** * Iterator that returns preceding nodes of a given node. * This includes the node set {root+1, start-1}, but excludes * all ancestors, attributes, and namespace nodes. */ public class PrecedingIterator extends InternalAxisIteratorBase { /** The max ancestors, but it can grow... */ private final int _maxAncestors = 8; /** * The stack of start node + ancestors up to the root of the tree, * which we must avoid. */ protected int[] _stack = new int[_maxAncestors]; /** (not sure yet... -sb) */ protected int _sp, _oldsp; protected int _markedsp, _markedNode, _markedDescendant; /* _currentNode precedes candidates. This is the identity, not the handle! */ /** * True if this iterator has a reversed axis. * * @return true since this iterator is a reversed axis. */ public boolean isReverse() { return true; } /** * Returns a deep copy of this iterator. The cloned iterator is not reset. * * @return a deep copy of this iterator. */ public DTMAxisIterator cloneIterator() { _isRestartable = false; try { final PrecedingIterator clone = (PrecedingIterator) super.clone(); final int[] stackCopy = new int[_stack.length]; System.arraycopy(_stack, 0, stackCopy, 0, _stack.length); clone._stack = stackCopy; // return clone.reset(); return clone; } catch (CloneNotSupportedException e) { throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported."); } } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { node = makeNodeIdentity(node); // iterator is not a clone int parent, index; if (_type(node) == DTM.ATTRIBUTE_NODE) node = _parent(node); _startNode = node; _stack[index = 0] = node; parent=node; while ((parent = _parent(parent)) != NULL) { if (++index == _stack.length) { final int[] stack = new int[index + 4]; System.arraycopy(_stack, 0, stack, 0, index); _stack = stack; } _stack[index] = parent; } if(index>0) --index; // Pop actual root node (if not start) back off the stack _currentNode=_stack[index]; // Last parent before root node _oldsp = _sp = index; return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { // Bugzilla 8324: We were forgetting to skip Attrs and NS nodes. // Also recoded the loop controls for clarity and to flatten out // the tail-recursion. for(++_currentNode; _sp>=0; ++_currentNode) { if(_currentNode < _stack[_sp]) { if(_type(_currentNode) != ATTRIBUTE_NODE && _type(_currentNode) != NAMESPACE_NODE) return returnNode(makeNodeHandle(_currentNode)); } else --_sp; } return NULL; } // redefine DTMAxisIteratorBase's reset /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { _sp = _oldsp; return resetPosition(); } public void setMark() { _markedsp = _sp; _markedNode = _currentNode; _markedDescendant = _stack[0]; } public void gotoMark() { _sp = _markedsp; _currentNode = _markedNode; } } // end of PrecedingIterator /** * Iterator that returns preceding nodes of agiven type for a * given node. This includes the node set {root+1, start-1}, but * excludes all ancestors. */ public final class TypedPrecedingIterator extends PrecedingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedPrecedingIterator * * * @param type The extended type ID being requested. */ public TypedPrecedingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; int nodeType = _nodeType; if (nodeType >= DTM.NTYPES) { while (true) { node = node + 1; if (_sp < 0) { node = NULL; break; } else if (node >= _stack[_sp]) { if (--_sp < 0) { node = NULL; break; } } else if (_exptype(node) == nodeType) { break; } } } else { int expType; while (true) { node = node + 1; if (_sp < 0) { node = NULL; break; } else if (node >= _stack[_sp]) { if (--_sp < 0) { node = NULL; break; } } else { expType = _exptype(node); if (expType < DTM.NTYPES) { if (expType == nodeType) { break; } } else { if (m_expandedNameTable.getType(expType) == nodeType) { break; } } } } } _currentNode = node; return (node == NULL) ? NULL : returnNode(makeNodeHandle(node)); } } // end of TypedPrecedingIterator /** * Iterator that returns following nodes of for a given node. */ public class FollowingIterator extends InternalAxisIteratorBase { DTMAxisTraverser m_traverser; // easier for now public FollowingIterator() { m_traverser = getAxisTraverser(Axis.FOLLOWING); } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; // ?? -sb // find rightmost descendant (or self) // int current; // while ((node = getLastChild(current = node)) != NULL){} // _currentNode = current; _currentNode = m_traverser.first(node); // _currentNode precedes possible following(node) nodes return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; _currentNode = m_traverser.next(_startNode, _currentNode); return returnNode(node); } } // end of FollowingIterator /** * Iterator that returns following nodes of a given type for a given node. */ public final class TypedFollowingIterator extends FollowingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedFollowingIterator * * * @param type The extended type ID being requested. */ public TypedFollowingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node; do{ node = _currentNode; _currentNode = m_traverser.next(_startNode, _currentNode); } while (node != DTM.NULL && (getExpandedTypeID(node) != _nodeType && getNodeType(node) != _nodeType)); return (node == DTM.NULL ? DTM.NULL :returnNode(node)); } } // end of TypedFollowingIterator /** * Iterator that returns the ancestors of a given node in document * order. (NOTE! This was changed from the XSLTC code!) */ public class AncestorIterator extends InternalAxisIteratorBase { org.apache.xml.utils.NodeVector m_ancestors = new org.apache.xml.utils.NodeVector(); int m_ancestorsPos; int m_markedPos; /** The real start node for this axes, since _startNode will be adjusted. */ int m_realStartNode; /** * Get start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @return The root node of the iteration. */ public int getStartNode() { return m_realStartNode; } /** * True if this iterator has a reversed axis. * * @return true since this iterator is a reversed axis. */ public final boolean isReverse() { return true; } /** * Returns a deep copy of this iterator. The cloned iterator is not reset. * * @return a deep copy of this iterator. */ public DTMAxisIterator cloneIterator() { _isRestartable = false; // must set to false for any clone try { final AncestorIterator clone = (AncestorIterator) super.clone(); clone._startNode = _startNode; // return clone.reset(); return clone; } catch (CloneNotSupportedException e) { throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported."); } } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); m_realStartNode = node; if (_isRestartable) { int nodeID = makeNodeIdentity(node); if (!_includeSelf && node != DTM.NULL) { nodeID = _parent(nodeID); node = makeNodeHandle(nodeID); } _startNode = node; while (nodeID != END) { m_ancestors.addElement(node); nodeID = _parent(nodeID); node = makeNodeHandle(nodeID); } m_ancestorsPos = m_ancestors.size()-1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; return resetPosition(); } return this; } /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { m_ancestorsPos = m_ancestors.size()-1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; return resetPosition(); } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int next = _currentNode; int pos = --m_ancestorsPos; _currentNode = (pos >= 0) ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; return returnNode(next); } public void setMark() { m_markedPos = m_ancestorsPos; } public void gotoMark() { m_ancestorsPos = m_markedPos; _currentNode = m_ancestorsPos>=0 ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; } } // end of AncestorIterator /** * Typed iterator that returns the ancestors of a given node. */ public final class TypedAncestorIterator extends AncestorIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedAncestorIterator * * * @param type The extended type ID being requested. */ public TypedAncestorIterator(int type) { _nodeType = type; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); m_realStartNode = node; if (_isRestartable) { int nodeID = makeNodeIdentity(node); int nodeType = _nodeType; if (!_includeSelf && node != DTM.NULL) { nodeID = _parent(nodeID); } _startNode = node; if (nodeType >= DTM.NTYPES) { while (nodeID != END) { int eType = _exptype(nodeID); if (eType == nodeType) { m_ancestors.addElement(makeNodeHandle(nodeID)); } nodeID = _parent(nodeID); } } else { while (nodeID != END) { int eType = _exptype(nodeID); if ((eType >= DTM.NTYPES && m_expandedNameTable.getType(eType) == nodeType) || (eType < DTM.NTYPES && eType == nodeType)) { m_ancestors.addElement(makeNodeHandle(nodeID)); } nodeID = _parent(nodeID); } } m_ancestorsPos = m_ancestors.size()-1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) : DTM.NULL; return resetPosition(); } return this; } } // end of TypedAncestorIterator /** * Iterator that returns the descendants of a given node. */ public class DescendantIterator extends InternalAxisIteratorBase { /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { node = makeNodeIdentity(node); _startNode = node; if (_includeSelf) node--; _currentNode = node; return resetPosition(); } return this; } /** * Tell if this node identity is a descendant. Assumes that * the node info for the element has already been obtained. * * This one-sided test works only if the parent has been * previously tested and is known to be a descendent. It fails if * the parent is the _startNode's next sibling, or indeed any node * that follows _startNode in document order. That may suffice * for this iterator, but it's not really an isDescendent() test. * %REVIEW% rename? * * @param identity The index number of the node in question. * @return true if the index is a descendant of _startNode. */ protected boolean isDescendant(int identity) { return (_parent(identity) >= _startNode) || (_startNode == identity); } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_startNode == NULL) { return NULL; } if (_includeSelf && (_currentNode + 1) == _startNode) return returnNode(makeNodeHandle(++_currentNode)); // | m_dtmIdent); int node = _currentNode; int type; do { node++; type = _type(node); if (NULL == type ||!isDescendant(node)) { _currentNode = NULL; return END; } } while(ATTRIBUTE_NODE == type || TEXT_NODE == type || NAMESPACE_NODE == type); _currentNode = node; return returnNode(makeNodeHandle(node)); // make handle. } /** * Reset. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(makeNodeHandle(_startNode)); _isRestartable = temp; return this; } } // end of DescendantIterator /** * Typed iterator that returns the descendants of a given node. */ public final class TypedDescendantIterator extends DescendantIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedDescendantIterator * * * @param nodeType Extended type ID being requested. */ public TypedDescendantIterator(int nodeType) { _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node; int type; if (_startNode == NULL) { return NULL; } node = _currentNode; do { node++; type = _type(node); if (NULL == type ||!isDescendant(node)) { _currentNode = NULL; return END; } } while (type != _nodeType && _exptype(node) != _nodeType); _currentNode = node; return returnNode(makeNodeHandle(node)); } } // end of TypedDescendantIterator /** * Iterator that returns the descendants of a given node. * I'm not exactly clear about this one... -sb */ public class NthDescendantIterator extends DescendantIterator { /** The current nth position. */ int _pos; /** * Constructor NthDescendantIterator * * * @param pos The nth position being requested. */ public NthDescendantIterator(int pos) { _pos = pos; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { // I'm not exactly clear yet what this is doing... -sb int node; while ((node = super.next()) != END) { node = makeNodeIdentity(node); int parent = _parent(node); int child = _firstch(parent); int pos = 0; do { int type = _type(child); if (ELEMENT_NODE == type) pos++; } while ((pos < _pos) && (child = _nextsib(child)) != END); if (node == child) return node; } return (END); } } // end of NthDescendantIterator /** * Class SingletonIterator. */ public class SingletonIterator extends InternalAxisIteratorBase { /** (not sure yet what this is. -sb) (sc & sb remove final to compile in JDK 1.1.8) */ private boolean _isConstant; /** * Constructor SingletonIterator * */ public SingletonIterator() { this(Integer.MIN_VALUE, false); } /** * Constructor SingletonIterator * * * @param node The node handle to return. */ public SingletonIterator(int node) { this(node, false); } /** * Constructor SingletonIterator * * * @param node the node handle to return. * @param constant (Not sure what this is yet. -sb) */ public SingletonIterator(int node, boolean constant) { _currentNode = _startNode = node; _isConstant = constant; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isConstant) { _currentNode = _startNode; return resetPosition(); } else if (_isRestartable) { _currentNode = _startNode = node; return resetPosition(); } return this; } /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { if (_isConstant) { _currentNode = _startNode; return resetPosition(); } else { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int result = _currentNode; _currentNode = END; return returnNode(result); } } // end of SingletonIterator /** * Iterator that returns a given node only if it is of a given type. */ public final class TypedSingletonIterator extends SingletonIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedSingletonIterator * * * @param nodeType The extended type ID being requested. */ public TypedSingletonIterator(int nodeType) { _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { //final int result = super.next(); final int result = _currentNode; int nodeType = _nodeType; _currentNode = END; if (nodeType >= DTM.NTYPES) { if (getExpandedTypeID(result) == nodeType) { return returnNode(result); } } else { if (getNodeType(result) == nodeType) { return returnNode(result); } } return NULL; } } // end of TypedSingletonIterator } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMManagerDefault.java0000644000175000017500000007365110721374032024341 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMManagerDefault.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMException; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.dtm.ref.dom2dtm.DOM2DTM; import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM; import org.apache.xml.dtm.ref.sax2dtm.SAX2RTFDTM; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.SystemIDResolver; import org.apache.xml.utils.XMLReaderManager; import org.apache.xml.utils.XMLStringFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; /** * The default implementation for the DTMManager. * * %REVIEW% There is currently a reentrancy issue, since the finalizer * for XRTreeFrag (which runs in the GC thread) wants to call * DTMManager.release(), and may do so at the same time that the main * transformation thread is accessing the manager. Our current solution is * to make most of the manager's methods synchronized. * Early tests suggest that doing so is not causing a significant * performance hit in Xalan. However, it should be noted that there * is a possible alternative solution: rewrite release() so it merely * posts a request for release onto a threadsafe queue, and explicitly * process that queue on an infrequent basis during main-thread * activity (eg, when getDTM() is invoked). The downside of that solution * would be a greater delay before the DTM's storage is actually released * for reuse. * */ public class DTMManagerDefault extends DTMManager { //static final boolean JKESS_XNI_EXPERIMENT=true; /** Set this to true if you want a dump of the DTM after creation. */ private static final boolean DUMPTREE = false; /** Set this to true if you want a basic diagnostics. */ private static final boolean DEBUG = false; /** * Map from DTM identifier numbers to DTM objects that this manager manages. * One DTM may have several prefix numbers, if extended node indexing * is in use; in that case, m_dtm_offsets[] will used to control which * prefix maps to which section of the DTM. * * This array grows as necessary; see addDTM(). * * This array grows as necessary; see addDTM(). Growth is uncommon... but * access needs to be blindingly fast since it's used in node addressing. */ protected DTM m_dtms[] = new DTM[256]; /** Map from DTM identifier numbers to offsets. For small DTMs with a * single identifier, this will always be 0. In overflow addressing, where * additional identifiers are allocated to access nodes beyond the range of * a single Node Handle, this table is used to map the handle's node field * into the actual node identifier. * * This array grows as necessary; see addDTM(). * * This array grows as necessary; see addDTM(). Growth is uncommon... but * access needs to be blindingly fast since it's used in node addressing. * (And at the moment, that includes accessing it from DTMDefaultBase, * which is why this is not Protected or Private.) */ int m_dtm_offsets[] = new int[256]; /** * The cache for XMLReader objects to be used if the user did not * supply an XMLReader for a SAXSource or supplied a StreamSource. */ protected XMLReaderManager m_readerManager = null; /** * The default implementation of ContentHandler, DTDHandler and ErrorHandler. */ protected DefaultHandler m_defaultHandler = new DefaultHandler(); /** * Add a DTM to the DTM table. This convenience call adds it as the * "base DTM ID", with offset 0. The other version of addDTM should * be used if you want to add "extended" DTM IDs with nonzero offsets. * * @param dtm Should be a valid reference to a DTM. * @param id Integer DTM ID to be bound to this DTM */ synchronized public void addDTM(DTM dtm, int id) { addDTM(dtm,id,0); } /** * Add a DTM to the DTM table. * * @param dtm Should be a valid reference to a DTM. * @param id Integer DTM ID to be bound to this DTM. * @param offset Integer addressing offset. The internal DTM Node ID is * obtained by adding this offset to the node-number field of the * public DTM Handle. For the first DTM ID accessing each DTM, this is 0; * for overflow addressing it will be a multiple of 1<=IDENT_MAX_DTMS) { // TODO: %REVIEW% Not really the right error message. throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!"); } // We used to just allocate the array size to IDENT_MAX_DTMS. // But we expect to increase that to 16 bits, and I'm not willing // to allocate that much space unless needed. We could use one of our // handy-dandy Fast*Vectors, but this will do for now. // %REVIEW% int oldlen=m_dtms.length; if(oldlen<=id) { // Various growth strategies are possible. I think we don't want // to over-allocate excessively, and I'm willing to reallocate // more often to get that. See also Fast*Vector classes. // // %REVIEW% Should throw a more diagnostic error if we go over the max... int newlen=Math.min((id+256),IDENT_MAX_DTMS); DTM new_m_dtms[] = new DTM[newlen]; System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen); m_dtms=new_m_dtms; int new_m_dtm_offsets[] = new int[newlen]; System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen); m_dtm_offsets=new_m_dtm_offsets; } m_dtms[id] = dtm; m_dtm_offsets[id]=offset; dtm.documentRegistration(); // The DTM should have been told who its manager was when we created it. // Do we need to allow for adopting DTMs _not_ created by this manager? } /** * Get the first free DTM ID available. %OPT% Linear search is inefficient! */ synchronized public int getFirstFreeDTMID() { int n = m_dtms.length; for (int i = 1; i < n; i++) { if(null == m_dtms[i]) { return i; } } return n; // count on addDTM() to throw exception if out of range } /** * The default table for exandedNameID lookups. */ private ExpandedNameTable m_expandedNameTable = new ExpandedNameTable(); /** * Constructor DTMManagerDefault * */ public DTMManagerDefault(){} /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * * A bit of magic in this implementation: If the source is null, unique is true, * and incremental and doIndexing are both false, we return an instance of * SAX2RTFDTM, which see. * * (I think more parameters will need to be added for error handling, and entity * resolution, and more explicit control of the RTF situation). * * @param source the specification of the source object. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * * @return a non-null DTM reference. */ synchronized public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing) { if(DEBUG && null != source) System.out.println("Starting "+ (unique ? "UNIQUE" : "shared")+ " source: "+source.getSystemId() ); XMLStringFactory xstringFactory = m_xsf; int dtmPos = getFirstFreeDTMID(); int documentID = dtmPos << IDENT_DTM_NODE_BITS; if ((null != source) && source instanceof DOMSource) { DOM2DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID, whiteSpaceFilter, xstringFactory, doIndexing); addDTM(dtm, dtmPos, 0); // if (DUMPTREE) // { // dtm.dumpDTM(); // } return dtm; } else { boolean isSAXSource = (null != source) ? (source instanceof SAXSource) : true; boolean isStreamSource = (null != source) ? (source instanceof StreamSource) : false; if (isSAXSource || isStreamSource) { XMLReader reader = null; SAX2DTM dtm; try { InputSource xmlSource; if (null == source) { xmlSource = null; } else { reader = getXMLReader(source); xmlSource = SAXSource.sourceToInputSource(source); String urlOfSource = xmlSource.getSystemId(); if (null != urlOfSource) { try { urlOfSource = SystemIDResolver.getAbsoluteURI(urlOfSource); } catch (Exception e) { // %REVIEW% Is there a better way to send a warning? System.err.println("Can not absolutize URL: " + urlOfSource); } xmlSource.setSystemId(urlOfSource); } } if (source==null && unique && !incremental && !doIndexing) { // Special case to support RTF construction into shared DTM. // It should actually still work for other uses, // but may be slightly deoptimized relative to the base // to allow it to deal with carrying multiple documents. // // %REVIEW% This is a sloppy way to request this mode; // we need to consider architectural improvements. dtm = new SAX2RTFDTM(this, source, documentID, whiteSpaceFilter, xstringFactory, doIndexing); } /************************************************************** // EXPERIMENTAL 3/22/02 else if(JKESS_XNI_EXPERIMENT && m_incremental) { dtm = new XNI2DTM(this, source, documentID, whiteSpaceFilter, xstringFactory, doIndexing); } **************************************************************/ // Create the basic SAX2DTM. else { dtm = new SAX2DTM(this, source, documentID, whiteSpaceFilter, xstringFactory, doIndexing); } // Go ahead and add the DTM to the lookup table. This needs to be // done before any parsing occurs. Note offset 0, since we've just // created a new DTM. addDTM(dtm, dtmPos, 0); boolean haveXercesParser = (null != reader) && (reader.getClass() .getName() .equals("org.apache.xerces.parsers.SAXParser") ); if (haveXercesParser) { incremental = true; // No matter what. %REVIEW% } // If the reader is null, but they still requested an incremental // build, then we still want to set up the IncrementalSAXSource stuff. if (m_incremental && incremental /* || ((null == reader) && incremental) */) { IncrementalSAXSource coParser=null; if (haveXercesParser) { // IncrementalSAXSource_Xerces to avoid threading. try { coParser =(IncrementalSAXSource) Class.forName("org.apache.xml.dtm.ref.IncrementalSAXSource_Xerces").newInstance(); } catch( Exception ex ) { ex.printStackTrace(); coParser=null; } } if (coParser==null ) { // Create a IncrementalSAXSource to run on the secondary thread. if (null == reader) { coParser = new IncrementalSAXSource_Filter(); } else { IncrementalSAXSource_Filter filter = new IncrementalSAXSource_Filter(); filter.setXMLReader(reader); coParser=filter; } } /************************************************************** // EXPERIMENTAL 3/22/02 if (JKESS_XNI_EXPERIMENT && m_incremental && dtm instanceof XNI2DTM && coParser instanceof IncrementalSAXSource_Xerces) { org.apache.xerces.xni.parser.XMLPullParserConfiguration xpc= ((IncrementalSAXSource_Xerces)coParser) .getXNIParserConfiguration(); if (xpc!=null) { // Bypass SAX; listen to the XNI stream ((XNI2DTM)dtm).setIncrementalXNISource(xpc); } else { // Listen to the SAX stream (will fail, diagnostically...) dtm.setIncrementalSAXSource(coParser); } } else ***************************************************************/ // Have the DTM set itself up as IncrementalSAXSource's listener. dtm.setIncrementalSAXSource(coParser); if (null == xmlSource) { // Then the user will construct it themselves. return dtm; } if (null == reader.getErrorHandler()) { reader.setErrorHandler(dtm); } reader.setDTDHandler(dtm); try { // Launch parsing coroutine. Launches a second thread, // if we're using IncrementalSAXSource.filter(). coParser.startParse(xmlSource); } catch (RuntimeException re) { dtm.clearCoRoutine(); throw re; } catch (Exception e) { dtm.clearCoRoutine(); throw new org.apache.xml.utils.WrappedRuntimeException(e); } } else { if (null == reader) { // Then the user will construct it themselves. return dtm; } // not incremental reader.setContentHandler(dtm); reader.setDTDHandler(dtm); if (null == reader.getErrorHandler()) { reader.setErrorHandler(dtm); } try { reader.setProperty( "http://xml.org/sax/properties/lexical-handler", dtm); } catch (SAXNotRecognizedException e){} catch (SAXNotSupportedException e){} try { reader.parse(xmlSource); } catch (RuntimeException re) { dtm.clearCoRoutine(); throw re; } catch (Exception e) { dtm.clearCoRoutine(); throw new org.apache.xml.utils.WrappedRuntimeException(e); } } if (DUMPTREE) { System.out.println("Dumping SAX2DOM"); dtm.dumpDTM(System.err); } return dtm; } finally { // Reset the ContentHandler, DTDHandler, ErrorHandler to the DefaultHandler // after creating the DTM. if (reader != null && !(m_incremental && incremental)) { reader.setContentHandler(m_defaultHandler); reader.setDTDHandler(m_defaultHandler); reader.setErrorHandler(m_defaultHandler); // Reset the LexicalHandler to null after creating the DTM. try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", null); } catch (Exception e) {} } releaseXMLReader(reader); } } else { // It should have been handled by a derived class or the caller // made a mistake. throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NOT_SUPPORTED, new Object[]{source})); //"Not supported: " + source); } } } /** * Given a W3C DOM node, try and return a DTM handle. * Note: calling this may be non-optimal, and there is no guarantee that * the node will be found in any particular DTM. * * @param node Non-null reference to a DOM node. * * @return a valid DTM handle. */ synchronized public int getDTMHandleFromNode(org.w3c.dom.Node node) { if(null == node) throw new IllegalArgumentException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NODE_NON_NULL, null)); //"node must be non-null for getDTMHandleFromNode!"); if (node instanceof org.apache.xml.dtm.ref.DTMNodeProxy) return ((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber(); else { // Find the DOM2DTMs wrapped around this Document (if any) // and check whether they contain the Node in question. // // NOTE that since a DOM2DTM may represent a subtree rather // than a full document, we have to be prepared to check more // than one -- and there is no guarantee that we will find // one that contains ancestors or siblings of the node we're // seeking. // // %REVIEW% We could search for the one which contains this // node at the deepest level, and thus covers the widest // subtree, but that's going to entail additional work // checking more DTMs... and getHandleOfNode is not a // cheap operation in most implementations. // // TODO: %REVIEW% If overflow addressing, we may recheck a DTM // already examined. Ouch. But with the increased number of DTMs, // scanning back to check this is painful. // POSSIBLE SOLUTIONS: // Generate a list of _unique_ DTM objects? // Have each DTM cache last DOM node search? int max = m_dtms.length; for(int i = 0; i < max; i++) { DTM thisDTM=m_dtms[i]; if((null != thisDTM) && thisDTM instanceof DOM2DTM) { int handle=((DOM2DTM)thisDTM).getHandleOfNode(node); if(handle!=DTM.NULL) return handle; } } // Not found; generate a new DTM. // // %REVIEW% Is this really desirable, or should we return null // and make folks explicitly instantiate from a DOMSource? The // latter is more work but gives the caller the opportunity to // explicitly add the DTM to a DTMManager... and thus to know when // it can be discarded again, which is something we need to pay much // more attention to. (Especially since only DTMs which are assigned // to a manager can use the overflow addressing scheme.) // // %BUG% If the source node was a DOM2DTM$defaultNamespaceDeclarationNode // and the DTM wasn't registered with this DTMManager, we will create // a new DTM and _still_ not be able to find the node (since it will // be resynthesized). Another reason to push hard on making all DTMs // be managed DTMs. // Since the real root of our tree may be a DocumentFragment, we need to // use getParent to find the root, instead of getOwnerDocument. Otherwise // DOM2DTM#getHandleOfNode will be very unhappy. Node root = node; Node p = (root.getNodeType() == Node.ATTRIBUTE_NODE) ? ((org.w3c.dom.Attr)root).getOwnerElement() : root.getParentNode(); for (; p != null; p = p.getParentNode()) { root = p; } DOM2DTM dtm = (DOM2DTM) getDTM(new javax.xml.transform.dom.DOMSource(root), false, null, true, true); int handle; if(node instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTMdefaultNamespaceDeclarationNode) { // Can't return the same node since it's unique to a specific DTM, // but can return the equivalent node -- find the corresponding // Document Element, then ask it for the xml: namespace decl. handle=dtm.getHandleOfNode(((org.w3c.dom.Attr)node).getOwnerElement()); handle=dtm.getAttributeNode(handle,node.getNamespaceURI(),node.getLocalName()); } else handle = ((DOM2DTM)dtm).getHandleOfNode(node); if(DTM.NULL == handle) throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COULD_NOT_RESOLVE_NODE, null)); //"Could not resolve the node to a handle!"); return handle; } } /** * This method returns the SAX2 parser to use with the InputSource * obtained from this URI. * It may return null if any SAX2-conformant XML parser can be used, * or if getInputSource() will also return null. The parser must * be free for use (i.e., not currently in use for another parse(). * After use of the parser is completed, the releaseXMLReader(XMLReader) * must be called. * * @param inputSource The value returned from the URIResolver. * @return a SAX2 XMLReader to use to resolve the inputSource argument. * * @return non-null XMLReader reference ready to parse. */ synchronized public XMLReader getXMLReader(Source inputSource) { try { XMLReader reader = (inputSource instanceof SAXSource) ? ((SAXSource) inputSource).getXMLReader() : null; // If user did not supply a reader, ask for one from the reader manager if (null == reader) { if (m_readerManager == null) { m_readerManager = XMLReaderManager.getInstance(); } reader = m_readerManager.getXMLReader(); } return reader; } catch (SAXException se) { throw new DTMException(se.getMessage(), se); } } /** * Indicates that the XMLReader object is no longer in use for the transform. * * Note that the getXMLReader method may return an XMLReader that was * specified on the SAXSource object by the application code. Such a * reader should still be passed to releaseXMLReader, but the reader manager * will only re-use XMLReaders that it created. * * @param reader The XMLReader to be released. */ synchronized public void releaseXMLReader(XMLReader reader) { if (m_readerManager != null) { m_readerManager.releaseXMLReader(reader); } } /** * Return the DTM object containing a representation of this node. * * @param nodeHandle DTM Handle indicating which node to retrieve * * @return a reference to the DTM object containing this node. */ synchronized public DTM getDTM(int nodeHandle) { try { // Performance critical function. return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS]; } catch(java.lang.ArrayIndexOutOfBoundsException e) { if(nodeHandle==DTM.NULL) return null; // Accept as a special case. else throw e; // Programming error; want to know about it. } } /** * Given a DTM, find the ID number in the DTM tables which addresses * the start of the document. If overflow addressing is in use, other * DTM IDs may also be assigned to this DTM. * * @param dtm The DTM which (hopefully) contains this node. * * @return The DTM ID (as the high bits of a NodeHandle, not as our * internal index), or -1 if the DTM doesn't belong to this manager. */ synchronized public int getDTMIdentity(DTM dtm) { // Shortcut using DTMDefaultBase's extension hooks // %REVIEW% Should the lookup be part of the basic DTM API? if(dtm instanceof DTMDefaultBase) { DTMDefaultBase dtmdb=(DTMDefaultBase)dtm; if(dtmdb.getManager()==this) return dtmdb.getDTMIDs().elementAt(0); else return -1; } int n = m_dtms.length; for (int i = 0; i < n; i++) { DTM tdtm = m_dtms[i]; if (tdtm == dtm && m_dtm_offsets[i]==0) return i << IDENT_DTM_NODE_BITS; } return -1; } /** * Release the DTMManager's reference(s) to a DTM, making it unmanaged. * This is typically done as part of returning the DTM to the heap after * we're done with it. * * @param dtm the DTM to be released. * * @param shouldHardDelete If false, this call is a suggestion rather than an * order, and we may not actually release the DTM. This is intended to * support intelligent caching of documents... which is not implemented * in this version of the DTM manager. * * @return true if the DTM was released, false if shouldHardDelete was set * and we decided not to. */ synchronized public boolean release(DTM dtm, boolean shouldHardDelete) { if(DEBUG) { System.out.println("Releasing "+ (shouldHardDelete ? "HARD" : "soft")+ " dtm="+ // Following shouldn't need a nodeHandle, but does... // and doesn't seem to report the intended value dtm.getDocumentBaseURI() ); } if (dtm instanceof SAX2DTM) { ((SAX2DTM) dtm).clearCoRoutine(); } // Multiple DTM IDs may be assigned to a single DTM. // The Right Answer is to ask which (if it supports // extension, the DTM will need a list anyway). The // Wrong Answer, applied if the DTM can't help us, // is to linearly search them all; this may be very // painful. // // %REVIEW% Should the lookup move up into the basic DTM API? if(dtm instanceof DTMDefaultBase) { org.apache.xml.utils.SuballocatedIntVector ids=((DTMDefaultBase)dtm).getDTMIDs(); for(int i=ids.size()-1;i>=0;--i) m_dtms[ids.elementAt(i)>>>DTMManager.IDENT_DTM_NODE_BITS]=null; } else { int i = getDTMIdentity(dtm); if (i >= 0) { m_dtms[i >>> DTMManager.IDENT_DTM_NODE_BITS] = null; } } dtm.documentRelease(); return true; } /** * Method createDocumentFragment * * * NEEDSDOC (createDocumentFragment) @return */ synchronized public DTM createDocumentFragment() { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Node df = doc.createDocumentFragment(); return getDTM(new DOMSource(df), true, null, false, false); } catch (Exception e) { throw new DTMException(e); } } /** * NEEDSDOC Method createDTMIterator * * * NEEDSDOC @param whatToShow * NEEDSDOC @param filter * NEEDSDOC @param entityReferenceExpansion * * NEEDSDOC (createDTMIterator) @return */ synchronized public DTMIterator createDTMIterator(int whatToShow, DTMFilter filter, boolean entityReferenceExpansion) { /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */ return null; } /** * NEEDSDOC Method createDTMIterator * * * NEEDSDOC @param xpathString * NEEDSDOC @param presolver * * NEEDSDOC (createDTMIterator) @return */ synchronized public DTMIterator createDTMIterator(String xpathString, PrefixResolver presolver) { /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */ return null; } /** * NEEDSDOC Method createDTMIterator * * * NEEDSDOC @param node * * NEEDSDOC (createDTMIterator) @return */ synchronized public DTMIterator createDTMIterator(int node) { /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */ return null; } /** * NEEDSDOC Method createDTMIterator * * * NEEDSDOC @param xpathCompiler * NEEDSDOC @param pos * * NEEDSDOC (createDTMIterator) @return */ synchronized public DTMIterator createDTMIterator(Object xpathCompiler, int pos) { /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */ return null; } /** * return the expanded name table. * * NEEDSDOC @param dtm * * NEEDSDOC ($objectName$) @return */ public ExpandedNameTable getExpandedNameTable(DTM dtm) { return m_expandedNameTable; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/IncrementalSAXSource.java0000644000175000017500000000713610721374031025105 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IncrementalSAXSource.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /**

    IncrementalSAXSource is an API that delivers a small number of * SAX events each time a request is made from a "controller" * coroutine. See IncrementalSAXFilter and IncrementalSAXFilter_Xerces * for examples. * * Note that interaction is via the deliverMoreNodes * method, and therefore coroutine support is not exposed * here.

    * */ public interface IncrementalSAXSource { // ------------------------------------------------------------------ // SAX Output API // ------------------------------------------------------------------ /** Register a SAX-style content handler for us to output to */ public void setContentHandler(ContentHandler handler); /** Register a SAX-style lexical handler for us to output to */ public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler); /** Register a SAX-style DTD handler for us to output to */ public void setDTDHandler(org.xml.sax.DTDHandler handler); // ------------------------------------------------------------------ // Command Input API // ------------------------------------------------------------------ /** deliverMoreNodes() is a simple API which tells the thread in which the * IncrementalSAXSource is running to deliver more events (true), * or stop delivering events and close out its input (false). * * This is intended to be called from one of our partner coroutines, * and serves to encapsulate the coroutine communication protocol. * * @param parsemore If true, tells the incremental SAX stream to deliver * another chunk of events. If false, finishes out the stream. * * @return Boolean.TRUE if the IncrementalSAXSource believes more data * may be available for further parsing. Boolean.FALSE if parsing * ran to completion, or was ended by deliverMoreNodes(false). * */ public Object deliverMoreNodes (boolean parsemore); // ------------------------------------------------------------------ // Parse Thread Convenience API // ------------------------------------------------------------------ /** Launch an XMLReader's parsing operation, feeding events to this * IncrementalSAXSource. In some implementations, this may launch a * thread which runs the previously supplied XMLReader's parse() operation. * In others, it may do other forms of initialization. * * @throws SAXException is parse thread is already in progress * or parsing can not be started. * */ public void startParse(InputSource source) throws SAXException; } // class IncrementalSAXSource libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/ChunkedIntArray.java0000644000175000017500000002412710721374031024141 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ChunkedIntArray.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; /** * ChunkedIntArray is an extensible array of blocks of integers. * (I'd consider Vector, but it's unable to handle integers except by * turning them into Objects.) *

    Making this a separate class means some call-and-return overhead. But * doing it all inline tends to be fragile and expensive in coder time, * not to mention driving up code size. If you want to inline it, feel free. * The Java text suggest that private and Final methods may be inlined, * and one can argue that this beast need not be made subclassable...

    * *

    %REVIEW% This has strong conceptual overlap with the IntVector class. * It would probably be a good thing to merge the two, when time permits.

    */ final class ChunkedIntArray { final int slotsize=4; // Locked, MUST be power of two in current code // Debugging tip: Cranking lowbits down to 4 or so is a good // way to pound on the array addressing code. static final int lowbits=10; // How many bits address within chunks static final int chunkalloc=1<slotsize) System.out.println("*****WARNING: ChunkedIntArray("+slotsize+") wasting "+(this.slotsize-slotsize)+" words per slot"); chunks.addElement(fastArray); } /** * Append a 4-integer record to the CIA, starting with record 1. (Since * arrays are initialized to all-0, 0 has been reserved as the "unknown" * value in DTM.) * @return the index at which this record was inserted. */ int appendSlot(int w0, int w1, int w2, int w3) { /* try { int newoffset = (lastUsed+1)*slotsize; fastArray[newoffset] = w0; fastArray[newoffset+1] = w1; fastArray[newoffset+2] = w2; fastArray[newoffset+3] = w3; return ++lastUsed; } catch(ArrayIndexOutOfBoundsException aioobe) */ { final int slotsize=4; int newoffset = (lastUsed+1)*slotsize; int chunkpos = newoffset >> lowbits; int slotpos = (newoffset & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); chunk[slotpos] = w0; chunk[slotpos+1] = w1; chunk[slotpos+2] = w2; chunk[slotpos+3] = w3; return ++lastUsed; } } /** * Retrieve an integer from the CIA by record number and column within * the record, both 0-based (though position 0 is reserved for special * purposes). * @param position int Record number * @param slotpos int Column number */ int readEntry(int position, int offset) throws ArrayIndexOutOfBoundsException { /* try { return fastArray[(position*slotsize)+offset]; } catch(ArrayIndexOutOfBoundsException aioobe) */ { // System.out.println("Using slow read (1)"); if (offset>=slotsize) throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot"); position*=slotsize; int chunkpos = position >> lowbits; int slotpos = position & lowmask; int[] chunk = chunks.elementAt(chunkpos); return chunk[slotpos + offset]; } } // Check that the node at index "position" is not an ancestor // of the node at index "startPos". IF IT IS, DO NOT ACCEPT IT AND // RETURN -1. If position is NOT an ancestor, return position. // Special case: The Document node (position==0) is acceptable. // // This test supports DTM.getNextPreceding. int specialFind(int startPos, int position) { // We have to look all the way up the ancestor chain // to make sure we don't have an ancestor. int ancestor = startPos; while(ancestor > 0) { // Get the node whose index == ancestor ancestor*=slotsize; int chunkpos = ancestor >> lowbits; int slotpos = ancestor & lowmask; int[] chunk = chunks.elementAt(chunkpos); // Get that node's parent (Note that this assumes w[1] // is the parent node index. That's really a DTM feature // rather than a ChunkedIntArray feature.) ancestor = chunk[slotpos + 1]; if(ancestor == position) break; } if (ancestor <= 0) { return position; } return -1; } /** * @return int index of highest-numbered record currently in use */ int slotsUsed() { return lastUsed; } /** Disard the highest-numbered record. This is used in the string-buffer CIA; when only a single characters() chunk has been recieved, its index is moved into the Text node rather than being referenced by indirection into the text accumulator. */ void discardLast() { --lastUsed; } /** * Overwrite the integer found at a specific record and column. * Used to back-patch existing records, most often changing their * "next sibling" reference from 0 (unknown) to something meaningful * @param position int Record number * @param offset int Column number * @param value int New contents */ void writeEntry(int position, int offset, int value) throws ArrayIndexOutOfBoundsException { /* try { fastArray[( position*slotsize)+offset] = value; } catch(ArrayIndexOutOfBoundsException aioobe) */ { if (offset >= slotsize) throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot"); position*=slotsize; int chunkpos = position >> lowbits; int slotpos = position & lowmask; int[] chunk = chunks.elementAt(chunkpos); chunk[slotpos + offset] = value; // ATOMIC! } } /** * Overwrite an entire (4-integer) record at the specified index. * Mostly used to create record 0, the Document node. * @param position integer Record number * @param w0 int * @param w1 int * @param w2 int * @param w3 int */ void writeSlot(int position, int w0, int w1, int w2, int w3) { position *= slotsize; int chunkpos = position >> lowbits; int slotpos = (position & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); chunk[slotpos] = w0; chunk[slotpos + 1] = w1; chunk[slotpos + 2] = w2; chunk[slotpos + 3] = w3; } /** * Retrieve the contents of a record into a user-supplied buffer array. * Used to reduce addressing overhead when code will access several * columns of the record. * @param position int Record number * @param buffer int[] Integer array provided by user, must be large enough * to hold a complete record. */ void readSlot(int position, int[] buffer) { /* try { System.arraycopy(fastArray, position*slotsize, buffer, 0, slotsize); } catch(ArrayIndexOutOfBoundsException aioobe) */ { // System.out.println("Using slow read (2): "+position); position *= slotsize; int chunkpos = position >> lowbits; int slotpos = (position & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); System.arraycopy(chunk,slotpos,buffer,0,slotsize); } } class ChunksVector { final int BLOCKSIZE = 64; int[] m_map[] = new int[BLOCKSIZE][]; int m_mapSize = BLOCKSIZE; int pos = 0; ChunksVector() { } final int size() { return pos; } void addElement(int[] value) { if(pos >= m_mapSize) { int orgMapSize = m_mapSize; while(pos >= m_mapSize) m_mapSize+=BLOCKSIZE; int[] newMap[] = new int[m_mapSize][]; System.arraycopy(m_map, 0, newMap, 0, orgMapSize); m_map = newMap; } // For now, just do a simple append. A sorted insert only // makes sense if we're doing an binary search or some such. m_map[pos] = value; pos++; } final int[] elementAt(int pos) { return m_map[pos]; } } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMStringPool.java0000644000175000017500000001467110721374033023560 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMStringPool.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.util.Vector; import org.apache.xml.utils.IntVector; /**

    DTMStringPool is an "interning" mechanism for strings. It will * create a stable 1:1 mapping between a set of string values and a set of * integer index values, so the integers can be used to reliably and * uniquely identify (and when necessary retrieve) the strings.

    * *

    Design Priorities: *

      *
    • String-to-index lookup speed is critical.
    • *
    • Index-to-String lookup speed is slightly less so.
    • *
    • Threadsafety is not guaranteed at this level. * Enforce that in the application if needed.
    • *
    • Storage efficiency is an issue but not a huge one. * It is expected that string pools won't exceed about 2000 entries.
    • *
    *

    * *

    Implementation detail: A standard Hashtable is relatively * inefficient when looking up primitive int values, especially when * we're already maintaining an int-to-string vector. So I'm * maintaining a simple hash chain within this class.

    * *

    NOTE: There is nothing in the code that has a real dependency upon * String. It would work with any object type that implements reliable * .hashCode() and .equals() operations. The API enforces Strings because * it's safer that way, but this could trivially be turned into a general * ObjectPool if one was needed.

    * *

    Status: Passed basic test in main().

    * */ public class DTMStringPool { Vector m_intToString; static final int HASHPRIME=101; int[] m_hashStart=new int[HASHPRIME]; IntVector m_hashChain; public static final int NULL=-1; /** * Create a DTMStringPool using the given chain size * * @param chainSize The size of the hash chain vector */ public DTMStringPool(int chainSize) { m_intToString=new Vector(); m_hashChain=new IntVector(chainSize); removeAllElements(); // -sb Add this to force empty strings to be index 0. stringToIndex(""); } public DTMStringPool() { this(512); } public void removeAllElements() { m_intToString.removeAllElements(); for(int i=0;i * ***** Note: this does _not_ current attempt to cache any of the data; * if you ask for attribute 27 and then 28, you'll have to rescan the first * 27. It should probably at least keep track of the last one retrieved, * and possibly buffer the whole array. *

    * ***** Also note that there's no fastpath for the by-name query; we search * linearly until we find it or fail to find it. Again, that could be * optimized at some cost in object creation/storage. * @xsl.usage internal */ public class DTMNamedNodeMap implements NamedNodeMap { /** The DTM for this node. */ DTM dtm; /** The DTM element handle. */ int element; /** The number of nodes in this map. */ short m_count = -1; /** * Create a getAttributes NamedNodeMap for a given DTM element node * * @param dtm The DTM Reference, must be non-null. * @param element The DTM element handle. */ public DTMNamedNodeMap(DTM dtm, int element) { this.dtm = dtm; this.element = element; } /** * Return the number of Attributes on this Element * * @return The number of nodes in this map. */ public int getLength() { if (m_count == -1) { short count = 0; for (int n = dtm.getFirstAttribute(element); n != -1; n = dtm.getNextAttribute(n)) { ++count; } m_count = count; } return (int) m_count; } /** * Retrieves a node specified by name. * @param name The nodeName of a node to retrieve. * @return A Node (of any type) with the specified * nodeName, or null if it does not identify * any node in this map. */ public Node getNamedItem(String name) { for (int n = dtm.getFirstAttribute(element); n != DTM.NULL; n = dtm.getNextAttribute(n)) { if (dtm.getNodeName(n).equals(name)) return dtm.getNode(n); } return null; } /** * Returns the indexth item in the map. If index * is greater than or equal to the number of nodes in this map, this * returns null. * @param i The index of the requested item. * @return The node at the indexth position in the map, or * null if that is not a valid index. */ public Node item(int i) { int count = 0; for (int n = dtm.getFirstAttribute(element); n != -1; n = dtm.getNextAttribute(n)) { if (count == i) return dtm.getNode(n); else ++count; } return null; } /** * Adds a node using its nodeName attribute. If a node with * that name is already present in this map, it is replaced by the new * one. *
    As the nodeName attribute is used to derive the name * which the node must be stored under, multiple nodes of certain types * (those that have a "special" string value) cannot be stored as the * names would clash. This is seen as preferable to allowing nodes to be * aliased. * @param newNode node to store in this map. The node will later be * accessible using the value of its nodeName attribute. * * @return If the new Node replaces an existing node the * replaced Node is returned, otherwise null * is returned. * @exception DOMException * WRONG_DOCUMENT_ERR: Raised if arg was created from a * different document than the one that created this map. *
    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. *
    INUSE_ATTRIBUTE_ERR: Raised if arg is an * Attr that is already an attribute of another * Element object. The DOM user must explicitly clone * Attr nodes to re-use them in other elements. */ public Node setNamedItem(Node newNode) { throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR); } /** * Removes a node specified by name. When this map contains the attributes * attached to an element, if the removed attribute is known to have a * default value, an attribute immediately appears containing the * default value as well as the corresponding namespace URI, local name, * and prefix when applicable. * @param name The nodeName of the node to remove. * * @return The node removed from this map if a node with such a name * exists. * @exception DOMException * NOT_FOUND_ERR: Raised if there is no node named name in * this map. *
    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. */ public Node removeNamedItem(String name) { throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR); } /** * Retrieves a node specified by local name and namespace URI. HTML-only * DOM implementations do not need to implement this method. * @param namespaceURI The namespace URI of the node to retrieve. * @param localName The local name of the node to retrieve. * * @return A Node (of any type) with the specified local * name and namespace URI, or null if they do not * identify any node in this map. * @since DOM Level 2 */ public Node getNamedItemNS(String namespaceURI, String localName) { Node retNode = null; for (int n = dtm.getFirstAttribute(element); n != DTM.NULL; n = dtm.getNextAttribute(n)) { if (localName.equals(dtm.getLocalName(n))) { String nsURI = dtm.getNamespaceURI(n); if ((namespaceURI == null && nsURI == null) || (namespaceURI != null && namespaceURI.equals(nsURI))) { retNode = dtm.getNode(n); break; } } } return retNode; } /** * Adds a node using its namespaceURI and * localName. If a node with that namespace URI and that * local name is already present in this map, it is replaced by the new * one. *
    HTML-only DOM implementations do not need to implement this method. * @param arg A node to store in this map. The node will later be * accessible using the value of its namespaceURI and * localName attributes. * * @return If the new Node replaces an existing node the * replaced Node is returned, otherwise null * is returned. * @exception DOMException * WRONG_DOCUMENT_ERR: Raised if arg was created from a * different document than the one that created this map. *
    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. *
    INUSE_ATTRIBUTE_ERR: Raised if arg is an * Attr that is already an attribute of another * Element object. The DOM user must explicitly clone * Attr nodes to re-use them in other elements. * @since DOM Level 2 */ public Node setNamedItemNS(Node arg) throws DOMException { throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR); } /** * Removes a node specified by local name and namespace URI. A removed * attribute may be known to have a default value when this map contains * the attributes attached to an element, as returned by the attributes * attribute of the Node interface. If so, an attribute * immediately appears containing the default value as well as the * corresponding namespace URI, local name, and prefix when applicable. *
    HTML-only DOM implementations do not need to implement this method. * * @param namespaceURI The namespace URI of the node to remove. * @param localName The local name of the node to remove. * * @return The node removed from this map if a node with such a local * name and namespace URI exists. * @exception DOMException * NOT_FOUND_ERR: Raised if there is no node with the specified * namespaceURI and localName in this map. *
    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. * @since DOM Level 2 */ public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR); } /** * Simple implementation of DOMException. * @xsl.usage internal */ public class DTMException extends org.w3c.dom.DOMException { static final long serialVersionUID = -8290238117162437678L; /** * Constructs a DOM/DTM exception. * * @param code * @param message */ public DTMException(short code, String message) { super(code, message); } /** * Constructor DTMException * * * @param code */ public DTMException(short code) { super(code, ""); } } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMDefaultBase.java0000644000175000017500000023043510721374030023632 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMDefaultBase.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.*; import org.apache.xml.utils.SuballocatedIntVector; import org.apache.xml.utils.BoolStack; import java.util.Vector; import javax.xml.transform.Source; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; import org.apache.xml.res.XMLMessages; import org.apache.xml.res.XMLErrorResources; import java.io.*; // for dumpDTM /** * The DTMDefaultBase class serves as a helper base for DTMs. * It sets up structures for navigation and type, while leaving data * management and construction to the derived classes. */ public abstract class DTMDefaultBase implements DTM { static final boolean JJK_DEBUG=false; // This constant is likely to be removed in the future. Use the // getDocument() method instead of ROOTNODE to get at the root // node of a DTM. /** The identity of the root node. */ public static final int ROOTNODE = 0; /** * The number of nodes, which is also used to determine the next * node index. */ protected int m_size = 0; /** The expanded names, one array element for each node. */ protected SuballocatedIntVector m_exptype; /** First child values, one array element for each node. */ protected SuballocatedIntVector m_firstch; /** Next sibling values, one array element for each node. */ protected SuballocatedIntVector m_nextsib; /** Previous sibling values, one array element for each node. */ protected SuballocatedIntVector m_prevsib; /** Previous sibling values, one array element for each node. */ protected SuballocatedIntVector m_parent; /** Vector of SuballocatedIntVectors of NS decl sets */ protected Vector m_namespaceDeclSets = null; /** SuballocatedIntVector of elements at which corresponding * namespaceDeclSets were defined */ protected SuballocatedIntVector m_namespaceDeclSetElements = null; /** * These hold indexes to elements based on namespace and local name. * The base lookup is the the namespace. The second lookup is the local * name, and the last array contains the the first free element * at the start, and the list of element handles following. */ protected int[][][] m_elemIndexes; /** The default block size of the node arrays */ public static final int DEFAULT_BLOCKSIZE = 512; // favor small docs. /** The number of blocks for the node arrays */ public static final int DEFAULT_NUMBLOCKS = 32; /** The number of blocks used for small documents & RTFs */ public static final int DEFAULT_NUMBLOCKS_SMALL = 4; /** The block size of the node arrays */ //protected final int m_blocksize; /** * The value to use when the information has not been built yet. */ protected static final int NOTPROCESSED = DTM.NULL - 1; /** * The DTM manager who "owns" this DTM. */ public DTMManager m_mgr; /** * m_mgr cast to DTMManagerDefault, or null if it isn't an instance * (Efficiency hook) */ protected DTMManagerDefault m_mgrDefault=null; /** The document identity number(s). If we have overflowed the addressing * range of the first that was assigned to us, we may add others. */ protected SuballocatedIntVector m_dtmIdent; /** The mask for the identity. %REVIEW% Should this really be set to the _DEFAULT? What if a particular DTM wanted to use another value? */ //protected final static int m_mask = DTMManager.IDENT_NODE_DEFAULT; /** The base URI for this document. */ protected String m_documentBaseURI; /** * The whitespace filter that enables elements to strip whitespace or not. */ protected DTMWSFilter m_wsfilter; /** Flag indicating whether to strip whitespace nodes */ protected boolean m_shouldStripWS = false; /** Stack of flags indicating whether to strip whitespace nodes */ protected BoolStack m_shouldStripWhitespaceStack; /** The XMLString factory for creating XMLStrings. */ protected XMLStringFactory m_xstrf; /** * The table for exandedNameID lookups. This may or may not be the same * table as is contained in the DTMManagerDefault. */ protected ExpandedNameTable m_expandedNameTable; /** true if indexing is turned on. */ protected boolean m_indexing; /** * Construct a DTMDefaultBase object using the default block size. * * @param mgr The DTMManager who owns this DTM. * @param source The object that is used to specify the construction source. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory The factory to use for creating XMLStrings. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. */ public DTMDefaultBase(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { this(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, DEFAULT_BLOCKSIZE, true, false); } /** * Construct a DTMDefaultBase object from a DOM node. * * @param mgr The DTMManager who owns this DTM. * @param source The object that is used to specify the construction source. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory The factory to use for creating XMLStrings. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param blocksize The block size of the DTM. * @param usePrevsib true if we want to build the previous sibling node array. * @param newNameTable true if we want to use a new ExpandedNameTable for this DTM. */ public DTMDefaultBase(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable) { // Use smaller sizes for the internal node arrays if the block size // is small. int numblocks; if (blocksize <= 64) { numblocks = DEFAULT_NUMBLOCKS_SMALL; m_dtmIdent= new SuballocatedIntVector(4, 1); } else { numblocks = DEFAULT_NUMBLOCKS; m_dtmIdent= new SuballocatedIntVector(32); } m_exptype = new SuballocatedIntVector(blocksize, numblocks); m_firstch = new SuballocatedIntVector(blocksize, numblocks); m_nextsib = new SuballocatedIntVector(blocksize, numblocks); m_parent = new SuballocatedIntVector(blocksize, numblocks); // Only create the m_prevsib array if the usePrevsib flag is true. // Some DTM implementations (e.g. SAXImpl) do not need this array. // We can save the time to build it in those cases. if (usePrevsib) m_prevsib = new SuballocatedIntVector(blocksize, numblocks); m_mgr = mgr; if(mgr instanceof DTMManagerDefault) m_mgrDefault=(DTMManagerDefault)mgr; m_documentBaseURI = (null != source) ? source.getSystemId() : null; m_dtmIdent.setElementAt(dtmIdentity,0); m_wsfilter = whiteSpaceFilter; m_xstrf = xstringfactory; m_indexing = doIndexing; if (doIndexing) { m_expandedNameTable = new ExpandedNameTable(); } else { // Note that this fails if we aren't talking to an instance of // DTMManagerDefault m_expandedNameTable = m_mgrDefault.getExpandedNameTable(this); } if (null != whiteSpaceFilter) { m_shouldStripWhitespaceStack = new BoolStack(); pushShouldStripWhitespace(false); } } /** * Ensure that the size of the element indexes can hold the information. * * @param namespaceID Namespace ID index. * @param LocalNameID Local name ID. */ protected void ensureSizeOfIndex(int namespaceID, int LocalNameID) { if (null == m_elemIndexes) { m_elemIndexes = new int[namespaceID + 20][][]; } else if (m_elemIndexes.length <= namespaceID) { int[][][] indexes = m_elemIndexes; m_elemIndexes = new int[namespaceID + 20][][]; System.arraycopy(indexes, 0, m_elemIndexes, 0, indexes.length); } int[][] localNameIndex = m_elemIndexes[namespaceID]; if (null == localNameIndex) { localNameIndex = new int[LocalNameID + 100][]; m_elemIndexes[namespaceID] = localNameIndex; } else if (localNameIndex.length <= LocalNameID) { int[][] indexes = localNameIndex; localNameIndex = new int[LocalNameID + 100][]; System.arraycopy(indexes, 0, localNameIndex, 0, indexes.length); m_elemIndexes[namespaceID] = localNameIndex; } int[] elemHandles = localNameIndex[LocalNameID]; if (null == elemHandles) { elemHandles = new int[128]; localNameIndex[LocalNameID] = elemHandles; elemHandles[0] = 1; } else if (elemHandles.length <= elemHandles[0] + 1) { int[] indexes = elemHandles; elemHandles = new int[elemHandles[0] + 1024]; System.arraycopy(indexes, 0, elemHandles, 0, indexes.length); localNameIndex[LocalNameID] = elemHandles; } } /** * Add a node to the element indexes. The node will not be added unless * it's an element. * * @param expandedTypeID The expanded type ID of the node. * @param identity The node identity index. */ protected void indexNode(int expandedTypeID, int identity) { ExpandedNameTable ent = m_expandedNameTable; short type = ent.getType(expandedTypeID); if (DTM.ELEMENT_NODE == type) { int namespaceID = ent.getNamespaceID(expandedTypeID); int localNameID = ent.getLocalNameID(expandedTypeID); ensureSizeOfIndex(namespaceID, localNameID); int[] index = m_elemIndexes[namespaceID][localNameID]; index[index[0]] = identity; index[0]++; } } /** * Find the first index that occurs in the list that is greater than or * equal to the given value. * * @param list A list of integers. * @param start The start index to begin the search. * @param len The number of items to search. * @param value Find the slot that has a value that is greater than or * identical to this argument. * * @return The index in the list of the slot that is higher or identical * to the identity argument, or -1 if no node is higher or equal. */ protected int findGTE(int[] list, int start, int len, int value) { int low = start; int high = start + (len - 1); int end = high; while (low <= high) { int mid = (low + high) / 2; int c = list[mid]; if (c > value) high = mid - 1; else if (c < value) low = mid + 1; else return mid; } return (low <= end && list[low] > value) ? low : -1; } /** * Find the first matching element from the index at or after the * given node. * * @param nsIndex The namespace index lookup. * @param lnIndex The local name index lookup. * @param firstPotential The first potential match that is worth looking at. * * @return The first node that is greater than or equal to the * firstPotential argument, or DTM.NOTPROCESSED if not found. */ int findElementFromIndex(int nsIndex, int lnIndex, int firstPotential) { int[][][] indexes = m_elemIndexes; if (null != indexes && nsIndex < indexes.length) { int[][] lnIndexs = indexes[nsIndex]; if (null != lnIndexs && lnIndex < lnIndexs.length) { int[] elems = lnIndexs[lnIndex]; if (null != elems) { int pos = findGTE(elems, 1, elems[0], firstPotential); if (pos > -1) { return elems[pos]; } } } } return NOTPROCESSED; } /** * Get the next node identity value in the list, and call the iterator * if it hasn't been added yet. * * @param identity The node identity (index). * @return identity+1, or DTM.NULL. */ protected abstract int getNextNodeIdentity(int identity); /** * This method should try and build one or more nodes in the table. * * @return The true if a next node is found or false if * there are no more nodes. */ protected abstract boolean nextNode(); /** * Get the number of nodes that have been added. * * @return the number of nodes that have been mapped. */ protected abstract int getNumberOfNodes(); /** Stateless axis traversers, lazely built. */ protected DTMAxisTraverser[] m_traversers; // /** // * Ensure that the size of the information arrays can hold another entry // * at the given index. // * // * @param index On exit from this function, the information arrays sizes must be // * at least index+1. // */ // protected void ensureSize(int index) // { // // We've cut over to Suballocated*Vector, which are self-sizing. // } /** * Get the simple type ID for the given node identity. * * @param identity The node identity. * * @return The simple type ID, or DTM.NULL. */ protected short _type(int identity) { int info = _exptype(identity); if (NULL != info) return m_expandedNameTable.getType(info); else return NULL; } /** * Get the expanded type ID for the given node identity. * * @param identity The node identity. * * @return The expanded type ID, or DTM.NULL. */ protected int _exptype(int identity) { if (identity == DTM.NULL) return NULL; // Reorganized test and loop into single flow // Tiny performance improvement, saves a few bytes of code, clearer. // %OPT% Other internal getters could be treated simliarly while (identity>=m_size) { if (!nextNode() && identity >= m_size) return NULL; } return m_exptype.elementAt(identity); } /** * Get the level in the tree for the given node identity. * * @param identity The node identity. * * @return The tree level, or DTM.NULL. */ protected int _level(int identity) { while (identity>=m_size) { boolean isMore = nextNode(); if (!isMore && identity >= m_size) return NULL; } int i=0; while(NULL != (identity=_parent(identity))) ++i; return i; } /** * Get the first child for the given node identity. * * @param identity The node identity. * * @return The first child identity, or DTM.NULL. */ protected int _firstch(int identity) { // Boiler-plate code for each of the _xxx functions, except for the array. int info = (identity >= m_size) ? NOTPROCESSED : m_firstch.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (info == NOTPROCESSED) { boolean isMore = nextNode(); if (identity >= m_size &&!isMore) return NULL; else { info = m_firstch.elementAt(identity); if(info == NOTPROCESSED && !isMore) return NULL; } } return info; } /** * Get the next sibling for the given node identity. * * @param identity The node identity. * * @return The next sibling identity, or DTM.NULL. */ protected int _nextsib(int identity) { // Boiler-plate code for each of the _xxx functions, except for the array. int info = (identity >= m_size) ? NOTPROCESSED : m_nextsib.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (info == NOTPROCESSED) { boolean isMore = nextNode(); if (identity >= m_size &&!isMore) return NULL; else { info = m_nextsib.elementAt(identity); if(info == NOTPROCESSED && !isMore) return NULL; } } return info; } /** * Get the previous sibling for the given node identity. * * @param identity The node identity. * * @return The previous sibling identity, or DTM.NULL. */ protected int _prevsib(int identity) { if (identity < m_size) return m_prevsib.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (identity >= m_size && !isMore) return NULL; else if (identity < m_size) return m_prevsib.elementAt(identity); } } /** * Get the parent for the given node identity. * * @param identity The node identity. * * @return The parent identity, or DTM.NULL. */ protected int _parent(int identity) { if (identity < m_size) return m_parent.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (identity >= m_size && !isMore) return NULL; else if (identity < m_size) return m_parent.elementAt(identity); } } /** * Diagnostics function to dump the DTM. */ public void dumpDTM(OutputStream os) { try { if(os==null) { File f = new File("DTMDump"+((Object)this).hashCode()+".txt"); System.err.println("Dumping... "+f.getAbsolutePath()); os=new FileOutputStream(f); } PrintStream ps = new PrintStream(os); while (nextNode()){} int nRecords = m_size; ps.println("Total nodes: " + nRecords); for (int index = 0; index < nRecords; ++index) { int i=makeNodeHandle(index); ps.println("=========== index=" + index + " handle=" + i + " ==========="); ps.println("NodeName: " + getNodeName(i)); ps.println("NodeNameX: " + getNodeNameX(i)); ps.println("LocalName: " + getLocalName(i)); ps.println("NamespaceURI: " + getNamespaceURI(i)); ps.println("Prefix: " + getPrefix(i)); int exTypeID = _exptype(index); ps.println("Expanded Type ID: " + Integer.toHexString(exTypeID)); int type = _type(index); String typestring; switch (type) { case DTM.ATTRIBUTE_NODE : typestring = "ATTRIBUTE_NODE"; break; case DTM.CDATA_SECTION_NODE : typestring = "CDATA_SECTION_NODE"; break; case DTM.COMMENT_NODE : typestring = "COMMENT_NODE"; break; case DTM.DOCUMENT_FRAGMENT_NODE : typestring = "DOCUMENT_FRAGMENT_NODE"; break; case DTM.DOCUMENT_NODE : typestring = "DOCUMENT_NODE"; break; case DTM.DOCUMENT_TYPE_NODE : typestring = "DOCUMENT_NODE"; break; case DTM.ELEMENT_NODE : typestring = "ELEMENT_NODE"; break; case DTM.ENTITY_NODE : typestring = "ENTITY_NODE"; break; case DTM.ENTITY_REFERENCE_NODE : typestring = "ENTITY_REFERENCE_NODE"; break; case DTM.NAMESPACE_NODE : typestring = "NAMESPACE_NODE"; break; case DTM.NOTATION_NODE : typestring = "NOTATION_NODE"; break; case DTM.NULL : typestring = "NULL"; break; case DTM.PROCESSING_INSTRUCTION_NODE : typestring = "PROCESSING_INSTRUCTION_NODE"; break; case DTM.TEXT_NODE : typestring = "TEXT_NODE"; break; default : typestring = "Unknown!"; break; } ps.println("Type: " + typestring); int firstChild = _firstch(index); if (DTM.NULL == firstChild) ps.println("First child: DTM.NULL"); else if (NOTPROCESSED == firstChild) ps.println("First child: NOTPROCESSED"); else ps.println("First child: " + firstChild); if (m_prevsib != null) { int prevSibling = _prevsib(index); if (DTM.NULL == prevSibling) ps.println("Prev sibling: DTM.NULL"); else if (NOTPROCESSED == prevSibling) ps.println("Prev sibling: NOTPROCESSED"); else ps.println("Prev sibling: " + prevSibling); } int nextSibling = _nextsib(index); if (DTM.NULL == nextSibling) ps.println("Next sibling: DTM.NULL"); else if (NOTPROCESSED == nextSibling) ps.println("Next sibling: NOTPROCESSED"); else ps.println("Next sibling: " + nextSibling); int parent = _parent(index); if (DTM.NULL == parent) ps.println("Parent: DTM.NULL"); else if (NOTPROCESSED == parent) ps.println("Parent: NOTPROCESSED"); else ps.println("Parent: " + parent); int level = _level(index); ps.println("Level: " + level); ps.println("Node Value: " + getNodeValue(i)); ps.println("String Value: " + getStringValue(i)); } } catch(IOException ioe) { ioe.printStackTrace(System.err); throw new RuntimeException(ioe.getMessage()); } } /** * Diagnostics function to dump a single node. * * %REVIEW% KNOWN GLITCH: If you pass it a node index rather than a * node handle, it works just fine... but the displayed identity * number before the colon is different, which complicates comparing * it with nodes printed the other way. We could always OR the DTM ID * into the value, to suppress that distinction... * * %REVIEW% This might want to be moved up to DTMDefaultBase, or possibly * DTM itself, since it's a useful diagnostic and uses only DTM's public * APIs. */ public String dumpNode(int nodeHandle) { if(nodeHandle==DTM.NULL) return "[null]"; String typestring; switch (getNodeType(nodeHandle)) { case DTM.ATTRIBUTE_NODE : typestring = "ATTR"; break; case DTM.CDATA_SECTION_NODE : typestring = "CDATA"; break; case DTM.COMMENT_NODE : typestring = "COMMENT"; break; case DTM.DOCUMENT_FRAGMENT_NODE : typestring = "DOC_FRAG"; break; case DTM.DOCUMENT_NODE : typestring = "DOC"; break; case DTM.DOCUMENT_TYPE_NODE : typestring = "DOC_TYPE"; break; case DTM.ELEMENT_NODE : typestring = "ELEMENT"; break; case DTM.ENTITY_NODE : typestring = "ENTITY"; break; case DTM.ENTITY_REFERENCE_NODE : typestring = "ENT_REF"; break; case DTM.NAMESPACE_NODE : typestring = "NAMESPACE"; break; case DTM.NOTATION_NODE : typestring = "NOTATION"; break; case DTM.NULL : typestring = "null"; break; case DTM.PROCESSING_INSTRUCTION_NODE : typestring = "PI"; break; case DTM.TEXT_NODE : typestring = "TEXT"; break; default : typestring = "Unknown!"; break; } StringBuffer sb=new StringBuffer(); sb.append("["+nodeHandle+": "+typestring+ "(0x"+Integer.toHexString(getExpandedTypeID(nodeHandle))+") "+ getNodeNameX(nodeHandle)+" {"+getNamespaceURI(nodeHandle)+"}"+ "=\""+ getNodeValue(nodeHandle)+"\"]"); return sb.toString(); } // ========= DTM Implementation Control Functions. ============== /** * Set an implementation dependent feature. *

    * %REVIEW% Do we really expect to set features on DTMs? * * @param featureId A feature URL. * @param state true if this feature should be on, false otherwise. */ public void setFeature(String featureId, boolean state){} // ========= Document Navigation Functions ========= /** * Given a node handle, test if it has child nodes. *

    %REVIEW% This is obviously useful at the DOM layer, where it * would permit testing this without having to create a proxy * node. It's less useful in the DTM API, where * (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and * almost as self-evident. But it's a convenience, and eases porting * of DOM code to DTM.

    * * @param nodeHandle int Handle of the node. * @return int true if the given node has child nodes. */ public boolean hasChildNodes(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int firstChild = _firstch(identity); return firstChild != DTM.NULL; } /** Given a node identity, return a node handle. If extended addressing * has been used (multiple DTM IDs), we need to map the high bits of the * identity into the proper DTM ID. * * This has been made FINAL to facilitate inlining, since we do not expect * any subclass of DTMDefaultBase to ever change the algorithm. (I don't * really like doing so, and would love to have an excuse not to...) * * %REVIEW% Is it worth trying to specialcase small documents? * %REVIEW% Should this be exposed at the package/public layers? * * @param nodeIdentity Internal offset to this node's records. * @return NodeHandle (external representation of node) * */ final public int makeNodeHandle(int nodeIdentity) { if(NULL==nodeIdentity) return NULL; if(JJK_DEBUG && nodeIdentity>DTMManager.IDENT_NODE_DEFAULT) System.err.println("GONK! (only useful in limited situations)"); return m_dtmIdent.elementAt(nodeIdentity >>> DTMManager.IDENT_DTM_NODE_BITS) + (nodeIdentity & DTMManager.IDENT_NODE_DEFAULT) ; } /** Given a node handle, return a node identity. If extended addressing * has been used (multiple DTM IDs), we need to map the high bits of the * identity into the proper DTM ID and thence find the proper offset * to add to the low bits of the identity * * This has been made FINAL to facilitate inlining, since we do not expect * any subclass of DTMDefaultBase to ever change the algorithm. (I don't * really like doing so, and would love to have an excuse not to...) * * %OPT% Performance is critical for this operation. * * %REVIEW% Should this be exposed at the package/public layers? * * @param nodeHandle (external representation of node) * @return nodeIdentity Internal offset to this node's records. * */ final public int makeNodeIdentity(int nodeHandle) { if(NULL==nodeHandle) return NULL; if(m_mgrDefault!=null) { // Optimization: use the DTMManagerDefault's fast DTMID-to-offsets // table. I'm not wild about this solution but this operation // needs need extreme speed. int whichDTMindex=nodeHandle>>>DTMManager.IDENT_DTM_NODE_BITS; // %REVIEW% Wish I didn't have to perform the pre-test, but // someone is apparently asking DTMs whether they contain nodes // which really don't belong to them. That's probably a bug // which should be fixed, but until it is: if(m_mgrDefault.m_dtms[whichDTMindex]!=this) return NULL; else return m_mgrDefault.m_dtm_offsets[whichDTMindex] | (nodeHandle & DTMManager.IDENT_NODE_DEFAULT); } int whichDTMid=m_dtmIdent.indexOf(nodeHandle & DTMManager.IDENT_DTM_DEFAULT); return (whichDTMid==NULL) ? NULL : (whichDTMid << DTMManager.IDENT_DTM_NODE_BITS) + (nodeHandle & DTMManager.IDENT_NODE_DEFAULT); } /** * Given a node handle, get the handle of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of first child, or DTM.NULL to indicate none exists. */ public int getFirstChild(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int firstChild = _firstch(identity); return makeNodeHandle(firstChild); } /** * Given a node handle, get the handle of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of first child, or DTM.NULL to indicate none exists. */ public int getTypedFirstChild(int nodeHandle, int nodeType) { int firstChild, eType; if (nodeType < DTM.NTYPES) { for (firstChild = _firstch(makeNodeIdentity(nodeHandle)); firstChild != DTM.NULL; firstChild = _nextsib(firstChild)) { eType = _exptype(firstChild); if (eType == nodeType || (eType >= DTM.NTYPES && m_expandedNameTable.getType(eType) == nodeType)) { return makeNodeHandle(firstChild); } } } else { for (firstChild = _firstch(makeNodeIdentity(nodeHandle)); firstChild != DTM.NULL; firstChild = _nextsib(firstChild)) { if (_exptype(firstChild) == nodeType) { return makeNodeHandle(firstChild); } } } return DTM.NULL; } /** * Given a node handle, advance to its last child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int Node-number of last child, * or DTM.NULL to indicate none exists. */ public int getLastChild(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int child = _firstch(identity); int lastChild = DTM.NULL; while (child != DTM.NULL) { lastChild = child; child = _nextsib(child); } return makeNodeHandle(lastChild); } /** * Retrieves an attribute node by by qualified name and namespace URI. * * @param nodeHandle int Handle of the node upon which to look up this attribute.. * @param namespaceURI The namespace URI of the attribute to * retrieve, or null. * @param name The local name of the attribute to * retrieve. * @return The attribute node handle with the specified name ( * nodeName) or DTM.NULL if there is no such * attribute. */ public abstract int getAttributeNode(int nodeHandle, String namespaceURI, String name); /** * Given a node handle, get the index of the node's first attribute. * * @param nodeHandle int Handle of the node. * @return Handle of first attribute, or DTM.NULL to indicate none exists. */ public int getFirstAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); return makeNodeHandle(getFirstAttributeIdentity(nodeID)); } /** * Given a node identity, get the index of the node's first attribute. * * @param identity int identity of the node. * @return Identity of first attribute, or DTM.NULL to indicate none exists. */ protected int getFirstAttributeIdentity(int identity) { int type = _type(identity); if (DTM.ELEMENT_NODE == type) { // Assume that attributes and namespaces immediately follow the element. while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { // Assume this can not be null. type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; } /** * Given a node handle and an expanded type ID, get the index of the node's * attribute of that type, if any. * * @param nodeHandle int Handle of the node. * @param attType int expanded type ID of the required attribute. * @return Handle of attribute of the required type, or DTM.NULL to indicate * none exists. */ protected int getTypedAttribute(int nodeHandle, int attType) { int type = getNodeType(nodeHandle); if (DTM.ELEMENT_NODE == type) { int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { if (_exptype(identity) == attType) return makeNodeHandle(identity); } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; } /** * Given a node handle, advance to its next sibling. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. */ public int getNextSibling(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return makeNodeHandle(_nextsib(makeNodeIdentity(nodeHandle))); } /** * Given a node handle, advance to its next sibling. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. */ public int getTypedNextSibling(int nodeHandle, int nodeType) { if (nodeHandle == DTM.NULL) return DTM.NULL; int node = makeNodeIdentity(nodeHandle); int eType; while ((node = _nextsib(node)) != DTM.NULL && ((eType = _exptype(node)) != nodeType && m_expandedNameTable.getType(eType)!= nodeType)); //_type(node) != nodeType)); return (node == DTM.NULL ? DTM.NULL : makeNodeHandle(node)); } /** * Given a node handle, find its preceeding sibling. * WARNING: DTM is asymmetric; this operation is resolved by search, and is * relatively expensive. * * @param nodeHandle the id of the node. * @return int Node-number of the previous sib, * or DTM.NULL to indicate none exists. */ public int getPreviousSibling(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; if (m_prevsib != null) return makeNodeHandle(_prevsib(makeNodeIdentity(nodeHandle))); else { // If the previous sibling array is not built, we get at // the previous sibling using the parent, firstch and // nextsib arrays. int nodeID = makeNodeIdentity(nodeHandle); int parent = _parent(nodeID); int node = _firstch(parent); int result = DTM.NULL; while (node != nodeID) { result = node; node = _nextsib(node); } return makeNodeHandle(result); } } /** * Given a node handle, advance to the next attribute. * If an attr, we advance to * the next attr on the same node. If not an attribute, we return NULL. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of the resolved attr, * or DTM.NULL to indicate none exists. */ public int getNextAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); if (_type(nodeID) == DTM.ATTRIBUTE_NODE) { return makeNodeHandle(getNextAttributeIdentity(nodeID)); } return DTM.NULL; } /** * Given a node identity for an attribute, advance to the next attribute. * * @param identity int identity of the attribute node. This * must be an attribute node. * * @return int DTM node-identity of the resolved attr, * or DTM.NULL to indicate none exists. * */ protected int getNextAttributeIdentity(int identity) { // Assume that attributes and namespace nodes immediately follow the element while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (type != DTM.NAMESPACE_NODE) { break; } } return DTM.NULL; } /** Lazily created namespace lists. */ private Vector m_namespaceLists = null; // on demand /** Build table of namespace declaration * locations during DTM construction. Table is a Vector of * SuballocatedIntVectors containing the namespace node HANDLES declared at * that ID, plus an SuballocatedIntVector of the element node INDEXES at which * these declarations appeared. * * NOTE: Since this occurs during model build, nodes will be encountered * in doucment order and thus the table will be ordered by element, * permitting binary-search as a possible retrieval optimization. * * %REVIEW% Directly managed arrays rather than vectors? * %REVIEW% Handles or IDs? Given usage, I think handles. * */ protected void declareNamespaceInContext(int elementNodeIndex,int namespaceNodeIndex) { SuballocatedIntVector nsList=null; if(m_namespaceDeclSets==null) { // First m_namespaceDeclSetElements=new SuballocatedIntVector(32); m_namespaceDeclSetElements.addElement(elementNodeIndex); m_namespaceDeclSets=new Vector(); nsList=new SuballocatedIntVector(32); m_namespaceDeclSets.addElement(nsList); } else { // Most recent. May be -1 (none) if DTM was pruned. // %OPT% Is there a lastElement() method? Should there be? int last=m_namespaceDeclSetElements.size()-1; if(last>=0 && elementNodeIndex==m_namespaceDeclSetElements.elementAt(last)) { nsList=(SuballocatedIntVector)m_namespaceDeclSets.elementAt(last); } } if(nsList==null) { m_namespaceDeclSetElements.addElement(elementNodeIndex); SuballocatedIntVector inherited = findNamespaceContext(_parent(elementNodeIndex)); if (inherited!=null) { // %OPT% Count-down might be faster, but debuggability may // be better this way, and if we ever decide we want to // keep this ordered by expanded-type... int isize=inherited.size(); // Base the size of a new namespace list on the // size of the inherited list - but within reason! nsList=new SuballocatedIntVector(Math.max(Math.min(isize+16,2048), 32)); for(int i=0;i=0;--i) { if(newEType==getExpandedTypeID(nsList.elementAt(i))) { nsList.setElementAt(makeNodeHandle(namespaceNodeIndex),i); return; } } nsList.addElement(makeNodeHandle(namespaceNodeIndex)); } /** Retrieve list of namespace declaration locations * active at this node. List is an SuballocatedIntVector whose * entries are the namespace node HANDLES declared at that ID. * * %REVIEW% Directly managed arrays rather than vectors? * %REVIEW% Handles or IDs? Given usage, I think handles. * */ protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex) { if (null!=m_namespaceDeclSetElements) { // %OPT% Is binary-search really saving us a lot versus linear? // (... It may be, in large docs with many NS decls.) int wouldBeAt=findInSortedSuballocatedIntVector(m_namespaceDeclSetElements, elementNodeIndex); if(wouldBeAt>=0) // Found it return (SuballocatedIntVector) m_namespaceDeclSets.elementAt(wouldBeAt); if(wouldBeAt == -1) // -1-wouldbeat == 0 return null; // Not after anything; definitely not found // Not found, but we know where it should have been. // Search back until we find an ancestor or run out. wouldBeAt=-1-wouldBeAt; // Decrement wouldBeAt to find last possible ancestor int candidate=m_namespaceDeclSetElements.elementAt(-- wouldBeAt); int ancestor=_parent(elementNodeIndex); // Special case: if the candidate is before the given node, and // is in the earliest possible position in the document, it // must have the namespace declarations we're interested in. if (wouldBeAt == 0 && candidate < ancestor) { int rootHandle = getDocumentRoot(makeNodeHandle(elementNodeIndex)); int rootID = makeNodeIdentity(rootHandle); int uppermostNSCandidateID; if (getNodeType(rootHandle) == DTM.DOCUMENT_NODE) { int ch = _firstch(rootID); uppermostNSCandidateID = (ch != DTM.NULL) ? ch : rootID; } else { uppermostNSCandidateID = rootID; } if (candidate == uppermostNSCandidateID) { return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt); } } while(wouldBeAt>=0 && ancestor>0) { if (candidate==ancestor) { // Found ancestor in list return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt); } else if (candidate 0){ // Too late in list candidate=m_namespaceDeclSetElements.elementAt(--wouldBeAt); } else break; } } return null; // No namespaces known at this node } /** * Subroutine: Locate the specified node within * m_namespaceDeclSetElements, or the last element which * preceeds it in document order * * %REVIEW% Inlne this into findNamespaceContext? Create SortedSuballocatedIntVector type? * * @return If positive or zero, the index of the found item. * If negative, index of the point at which it would have appeared, * encoded as -1-index and hence reconvertable by subtracting * it from -1. (Encoding because I don't want to recompare the strings * but don't want to burn bytes on a datatype to hold a flagged value.) */ protected int findInSortedSuballocatedIntVector(SuballocatedIntVector vector, int lookfor) { // Binary search int i = 0; if(vector != null) { int first = 0; int last = vector.size() - 1; while (first <= last) { i = (first + last) / 2; int test = lookfor-vector.elementAt(i); if(test == 0) { return i; // Name found } else if (test < 0) { last = i - 1; // looked too late } else { first = i + 1; // looked ot early } } if (first > i) { i = first; // Clean up at loop end } } return -1 - i; // not-found has to be encoded. } /** * Given a node handle, get the index of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again * * @param nodeHandle handle to node, which should probably be an element * node, but need not be. * * @param inScope true if all namespaces in scope should be returned, * false if only the namespace declarations should be * returned. * @return handle of first namespace, or DTM.NULL to indicate none exists. */ public int getFirstNamespaceNode(int nodeHandle, boolean inScope) { if(inScope) { int identity = makeNodeIdentity(nodeHandle); if (_type(identity) == DTM.ELEMENT_NODE) { SuballocatedIntVector nsContext=findNamespaceContext(identity); if(nsContext==null || nsContext.size()<1) return NULL; return nsContext.elementAt(0); } else return NULL; } else { // Assume that attributes and namespaces immediately // follow the element. // // %OPT% Would things be faster if all NS nodes were built // before all Attr nodes? Some costs at build time for 2nd // pass... int identity = makeNodeIdentity(nodeHandle); if (_type(identity) == DTM.ELEMENT_NODE) { while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.NAMESPACE_NODE) return makeNodeHandle(identity); else if (DTM.ATTRIBUTE_NODE != type) break; } return NULL; } else return NULL; } } /** * Given a namespace handle, advance to the next namespace. * * @param baseHandle handle to original node from where the first namespace * was relative to (needed to return nodes in document order). * @param nodeHandle A namespace handle for which we will find the next node. * @param inScope true if all namespaces that are in scope should be processed, * otherwise just process the nodes in the given element handle. * @return handle of next namespace, or DTM.NULL to indicate none exists. */ public int getNextNamespaceNode(int baseHandle, int nodeHandle, boolean inScope) { if(inScope) { //Since we've been given the base, try direct lookup //(could look from nodeHandle but this is at least one //comparison/get-parent faster) //SuballocatedIntVector nsContext=findNamespaceContext(nodeHandle & m_mask); SuballocatedIntVector nsContext=findNamespaceContext(makeNodeIdentity(baseHandle)); if(nsContext==null) return NULL; int i=1 + nsContext.indexOf(nodeHandle); if(i<=0 || i==nsContext.size()) return NULL; return nsContext.elementAt(i); } else { // Assume that attributes and namespace nodes immediately follow the element. int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.NAMESPACE_NODE) { return makeNodeHandle(identity); } else if (type != DTM.ATTRIBUTE_NODE) { break; } } } return DTM.NULL; } /** * Given a node handle, find its parent node. * * @param nodeHandle the id of the node. * @return int Node-number of parent, * or DTM.NULL to indicate none exists. */ public int getParent(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); if (identity > 0) return makeNodeHandle(_parent(identity)); else return DTM.NULL; } /** * Find the Document node handle for the document currently under construction. * PLEASE NOTE that most people should use getOwnerDocument(nodeHandle) instead; * this version of the operation is primarily intended for use during negotiation * with the DTM Manager. * * @return int Node handle of document, which should always be valid. */ public int getDocument() { return m_dtmIdent.elementAt(0); // makeNodeHandle(0) } /** * Given a node handle, find the owning document node. This has the exact * same semantics as the DOM Document method of the same name, in that if * the nodeHandle is a document node, it will return NULL. * *

    %REVIEW% Since this is DOM-specific, it may belong at the DOM * binding layer. Included here as a convenience function and to * aid porting of DOM code to DTM.

    * * @param nodeHandle the id of the node. * @return int Node handle of owning document, or -1 if the node was a Docment */ public int getOwnerDocument(int nodeHandle) { if (DTM.DOCUMENT_NODE == getNodeType(nodeHandle)) return DTM.NULL; return getDocumentRoot(nodeHandle); } /** * Given a node handle, find the owning document node. Unlike the DOM, * this considers the owningDocument of a Document to be itself. * * @param nodeHandle the id of the node. * @return int Node handle of owning document, or the nodeHandle if it is * a Document. */ public int getDocumentRoot(int nodeHandle) { return getManager().getDTM(nodeHandle).getDocument(); } /** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public abstract XMLString getStringValue(int nodeHandle); /** * Get number of character array chunks in * the string-value of a node. * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * Note that a single text node may have multiple text chunks. * * @param nodeHandle The node ID. * * @return number of character array chunks in * the string-value of a node. */ public int getStringValueChunkCount(int nodeHandle) { // %TBD% error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//("getStringValueChunkCount not yet supported!"); return 0; } /** * Get a character array chunk in the string-value of a node. * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * Note that a single text node may have multiple text chunks. * * @param nodeHandle The node ID. * @param chunkIndex Which chunk to get. * @param startAndLen An array of 2 where the start position and length of * the chunk will be returned. * * @return The character array reference where the chunk occurs. */ public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen) { // %TBD% error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"getStringValueChunk not yet supported!"); return null; } /** * Given a node handle, return an ID that represents the node's expanded name. * * @param nodeHandle The handle to the node in question. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(int nodeHandle) { // %REVIEW% This _should_ only be null if someone asked the wrong DTM about the node... // which one would hope would never happen... int id=makeNodeIdentity(nodeHandle); if(id==NULL) return NULL; return _exptype(id); } /** * Given an expanded name, return an ID. If the expanded-name does not * exist in the internal tables, the entry will be created, and the ID will * be returned. Any additional nodes that are created that have this * expanded name will use this ID. * * @param type The simple type, i.e. one of ELEMENT, ATTRIBUTE, etc. * * @param namespace The namespace URI, which may be null, may be an empty * string (which will be the same as null), or may be a * namespace URI. * @param localName The local name string, which must be a valid * NCName. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(String namespace, String localName, int type) { ExpandedNameTable ent = m_expandedNameTable; return ent.getExpandedTypeID(namespace, localName, type); } /** * Given an expanded-name ID, return the local name part. * * @param expandedNameID an ID that represents an expanded-name. * @return String Local name of this node. */ public String getLocalNameFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getLocalName(expandedNameID); } /** * Given an expanded-name ID, return the namespace URI part. * * @param expandedNameID an ID that represents an expanded-name. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceFromExpandedNameID(int expandedNameID) { return m_expandedNameTable.getNamespace(expandedNameID); } /** * Returns the namespace type of a specific node * @param nodeHandle the id of the node. * @return the ID of the namespace. */ public int getNamespaceType(final int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int expandedNameID = _exptype(identity); return m_expandedNameTable.getNamespaceID(expandedNameID); } /** * Given a node handle, return its DOM-style node name. This will * include names such as #text or #document. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. * %REVIEW% Document when empty string is possible... * %REVIEW-COMMENT% It should never be empty, should it? */ public abstract String getNodeName(int nodeHandle); /** * Given a node handle, return the XPath node name. This should be * the name as described by the XPath data model, NOT the DOM-style * name. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. */ public String getNodeNameX(int nodeHandle) { /** @todo: implement this org.apache.xml.dtm.DTMDefaultBase abstract method */ error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!"); return null; } /** * Given a node handle, return its XPath-style localname. * (As defined in Namespaces, this is the portion of the name after any * colon character). * * @param nodeHandle the id of the node. * @return String Local name of this node. */ public abstract String getLocalName(int nodeHandle); /** * Given a namespace handle, return the prefix that the namespace decl is * mapping. * Given a node handle, return the prefix used to map to the namespace. * *

    %REVIEW% Are you sure you want "" for no prefix?

    *

    %REVIEW-COMMENT% I think so... not totally sure. -sb

    * * @param nodeHandle the id of the node. * @return String prefix of this node's name, or "" if no explicit * namespace prefix was given. */ public abstract String getPrefix(int nodeHandle); /** * Given a node handle, return its DOM-style namespace URI * (As defined in Namespaces, this is the declared URI which this node's * prefix -- or default in lieu thereof -- was mapped to.) * *

    %REVIEW% Null or ""? -sb

    * * @param nodeHandle the id of the node. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public abstract String getNamespaceURI(int nodeHandle); /** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. *

    * * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public abstract String getNodeValue(int nodeHandle); /** * Given a node handle, return its DOM-style node type. *

    * %REVIEW% Generally, returning short is false economy. Return int? * %REVIEW% Make assumption that node has already arrived. Is OK? * * @param nodeHandle The node id. * @return int Node type, as per the DOM's Node._NODE constants. */ public short getNodeType(int nodeHandle) { if (nodeHandle == DTM.NULL) return DTM.NULL; return m_expandedNameTable.getType(_exptype(makeNodeIdentity(nodeHandle))); } /** * Get the depth level of this node in the tree (equals 1 for * a parentless node). * * @param nodeHandle The node id. * @return the number of ancestors, plus one * @xsl.usage internal */ public short getLevel(int nodeHandle) { // Apparently, the axis walker stuff requires levels to count from 1. int identity = makeNodeIdentity(nodeHandle); return (short) (_level(identity) + 1); } /** * Get the identity of this node in the tree * * @param nodeHandle The node handle. * @return the node identity * @xsl.usage internal */ public int getNodeIdent(int nodeHandle) { /*if (nodeHandle != DTM.NULL) return nodeHandle & m_mask; else return DTM.NULL;*/ return makeNodeIdentity(nodeHandle); } /** * Get the handle of this node in the tree * * @param nodeId The node identity. * @return the node handle * @xsl.usage internal */ public int getNodeHandle(int nodeId) { /*if (nodeId != DTM.NULL) return nodeId | m_dtmIdent; else return DTM.NULL;*/ return makeNodeHandle(nodeId); } // ============== Document query functions ============== /** * Tests whether DTM DOM implementation implements a specific feature and * that feature is supported by this node. * * @param feature The name of the feature to test. * @param version This is the version number of the feature to test. * If the version is not * specified, supporting any version of the feature will cause the * method to return true. * @return Returns true if the specified feature is * supported on this node, false otherwise. */ public boolean isSupported(String feature, String version) { // %TBD% return false; } /** * Return the base URI of the document entity. If it is not known * (because the document was parsed from a socket connection or from * standard input, for example), the value of this property is unknown. * * @return the document base URI String object or null if unknown. */ public String getDocumentBaseURI() { return m_documentBaseURI; } /** * Set the base URI of the document entity. * * @param baseURI the document base URI String object or null if unknown. */ public void setDocumentBaseURI(String baseURI) { m_documentBaseURI = baseURI; } /** * Return the system identifier of the document entity. If * it is not known, the value of this property is unknown. * * @param nodeHandle The node id, which can be any valid node handle. * @return the system identifier String object or null if unknown. */ public String getDocumentSystemIdentifier(int nodeHandle) { // %REVIEW% OK? -sb return m_documentBaseURI; } /** * Return the name of the character encoding scheme * in which the document entity is expressed. * * @param nodeHandle The node id, which can be any valid node handle. * @return the document encoding String object. * @xsl.usage internal */ public String getDocumentEncoding(int nodeHandle) { // %REVIEW% OK?? -sb return "UTF-8"; } /** * Return an indication of the standalone status of the document, * either "yes" or "no". This property is derived from the optional * standalone document declaration in the XML declaration at the * beginning of the document entity, and has no value if there is no * standalone document declaration. * * @param nodeHandle The node id, which can be any valid node handle. * @return the document standalone String object, either "yes", "no", or null. */ public String getDocumentStandalone(int nodeHandle) { return null; } /** * Return a string representing the XML version of the document. This * property is derived from the XML declaration optionally present at the * beginning of the document entity, and has no value if there is no XML * declaration. * * @param documentHandle The document handle * * @return the document version String object. */ public String getDocumentVersion(int documentHandle) { return null; } /** * Return an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @return true if all declarations were processed; * false otherwise. */ public boolean getDocumentAllDeclarationsProcessed() { // %REVIEW% OK? return true; } /** * A document type declaration information item has the following properties: * * 1. [system identifier] The system identifier of the external subset, if * it exists. Otherwise this property has no value. * * @return the system identifier String object, or null if there is none. */ public abstract String getDocumentTypeDeclarationSystemIdentifier(); /** * Return the public identifier of the external subset, * normalized as described in 4.2.2 External Entities [XML]. If there is * no external subset or if it has no public identifier, this property * has no value. * * @return the public identifier String object, or null if there is none. */ public abstract String getDocumentTypeDeclarationPublicIdentifier(); /** * Returns the Element whose ID is given by * elementId. If no such element exists, returns * DTM.NULL. Behavior is not defined if more than one element * has this ID. Attributes (including those * with the name "ID") are not of type ID unless so defined by DTD/Schema * information available to the DTM implementation. * Implementations that do not know whether attributes are of type ID or * not are expected to return DTM.NULL. * *

    %REVIEW% Presumably IDs are still scoped to a single document, * and this operation searches only within a single document, right? * Wouldn't want collisions between DTMs in the same process.

    * * @param elementId The unique id value for an element. * @return The handle of the matching element. */ public abstract int getElementById(String elementId); /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. *

    * XML processors may choose to use the System Identifier (if one * is provided) to resolve the entity, rather than the URI in the * Public Identifier. The details are dependent on the processor, and * we would have to support some form of plug-in resolver to handle * this properly. Currently, we simply return the System Identifier if * present, and hope that it a usable URI or that our caller can * map it to one. * TODO: Resolve Public Identifiers... or consider changing function name. *

    * If we find a relative URI * reference, XML expects it to be resolved in terms of the base URI * of the document. The DOM doesn't do that for us, and it isn't * entirely clear whether that should be done here; currently that's * pushed up to a higher level of our application. (Note that DOM Level * 1 didn't store the document's base URI.) * TODO: Consider resolving Relative URIs. *

    * (The DOM's statement that "An XML processor may choose to * completely expand entities before the structure model is passed * to the DOM" refers only to parsed entities, not unparsed, and hence * doesn't affect this function.) * * @param name A string containing the Entity Name of the unparsed * entity. * * @return String containing the URI of the Unparsed Entity, or an * empty string if no such entity exists. */ public abstract String getUnparsedEntityURI(String name); // ============== Boolean methods ================ /** * Return true if the xsl:strip-space or xsl:preserve-space was processed * during construction of the DTM document. * * @return true if this DTM supports prestripping. */ public boolean supportsPreStripping() { return true; } /** * Figure out whether nodeHandle2 should be considered as being later * in the document than nodeHandle1, in Document Order as defined * by the XPath model. This may not agree with the ordering defined * by other XML applications. *

    * There are some cases where ordering isn't defined, and neither are * the results of this function -- though we'll generally return false. * * @param nodeHandle1 Node handle to perform position comparison on. * @param nodeHandle2 Second Node handle to perform position comparison on . * * @return true if node1 comes before node2, otherwise return false. * You can think of this as * (node1.documentOrderPosition <= node2.documentOrderPosition). */ public boolean isNodeAfter(int nodeHandle1, int nodeHandle2) { // These return NULL if the node doesn't belong to this document. int index1 = makeNodeIdentity(nodeHandle1); int index2 = makeNodeIdentity(nodeHandle2); return index1!=NULL && index2!=NULL && index1 <= index2; } /** * 2. [element content whitespace] A boolean indicating whether the * character is white space appearing within element content (see [XML], * 2.10 "White Space Handling"). Note that validating XML processors are * required by XML 1.0 to provide this information. If there is no * declaration for the containing element, this property has no value for * white space characters. If no declaration has been read, but the [all * declarations processed] property of the document information item is * false (so there may be an unread declaration), then the value of this * property is unknown for white space characters. It is always false for * characters that are not white space. * * @param nodeHandle the node ID. * @return true if the character data is whitespace; * false otherwise. */ public boolean isCharacterElementContentWhitespace(int nodeHandle) { // %TBD% return false; } /** * 10. [all declarations processed] This property is not strictly speaking * part of the infoset of the document. Rather it is an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @param documentHandle A node handle that must identify a document. * @return true if all declarations were processed; * false otherwise. */ public boolean isDocumentAllDeclarationsProcessed(int documentHandle) { return true; } /** * 5. [specified] A flag indicating whether this attribute was actually * specified in the start-tag of its element, or was defaulted from the * DTD. * * @param attributeHandle The attribute handle in question. * * @return true if the attribute was specified; * false if it was defaulted. */ public abstract boolean isAttributeSpecified(int attributeHandle); // ========== Direct SAX Dispatch, for optimization purposes ======== /** * Directly call the * characters method on the passed ContentHandler for the * string-value of the given node (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * @param normalize true if the content should be normalized according to * the rules for the XPath * normalize-space * function. * * @throws org.xml.sax.SAXException */ public abstract void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException; /** * Directly create SAX parser events from a subtree. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public abstract void dispatchToEvents( int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException; /** * Return an DOM node for the given node. * * @param nodeHandle The node ID. * * @return A node representation of the DTM node. */ public org.w3c.dom.Node getNode(int nodeHandle) { return new DTMNodeProxy(this, nodeHandle); } // ==== Construction methods (may not be supported by some implementations!) ===== /** * Append a child to the end of the document. Please note that the node * is always cloned if it is owned by another document. * *

    %REVIEW% "End of the document" needs to be defined more clearly. * Does it become the last child of the Document? Of the root element?

    * * @param newChild Must be a valid new node handle. * @param clone true if the child should be cloned into the document. * @param cloneDepth if the clone argument is true, specifies that the * clone should include all it's children. */ public void appendChild(int newChild, boolean clone, boolean cloneDepth) { error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"appendChild not yet supported!"); } /** * Append a text node child that will be constructed from a string, * to the end of the document. * *

    %REVIEW% "End of the document" needs to be defined more clearly. * Does it become the last child of the Document? Of the root element?

    * * @param str Non-null reverence to a string. */ public void appendTextChild(String str) { error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"appendTextChild not yet supported!"); } /** * Simple error for asserts and the like. * * @param msg Error message to report. */ protected void error(String msg) { throw new DTMException(msg); } /** * Find out whether or not to strip whispace nodes. * * * @return whether or not to strip whispace nodes. */ protected boolean getShouldStripWhitespace() { return m_shouldStripWS; } /** * Set whether to strip whitespaces and push in current value of * m_shouldStripWS in m_shouldStripWhitespaceStack. * * @param shouldStrip Flag indicating whether to strip whitespace nodes */ protected void pushShouldStripWhitespace(boolean shouldStrip) { m_shouldStripWS = shouldStrip; if (null != m_shouldStripWhitespaceStack) m_shouldStripWhitespaceStack.push(shouldStrip); } /** * Set whether to strip whitespaces at this point by popping out * m_shouldStripWhitespaceStack. * */ protected void popShouldStripWhitespace() { if (null != m_shouldStripWhitespaceStack) m_shouldStripWS = m_shouldStripWhitespaceStack.popAndTop(); } /** * Set whether to strip whitespaces and set the top of the stack to * the current value of m_shouldStripWS. * * * @param shouldStrip Flag indicating whether to strip whitespace nodes */ protected void setShouldStripWhitespace(boolean shouldStrip) { m_shouldStripWS = shouldStrip; if (null != m_shouldStripWhitespaceStack) m_shouldStripWhitespaceStack.setTop(shouldStrip); } /** * A dummy routine to satisify the abstract interface. If the DTM * implememtation that extends the default base requires notification * of registration, they can override this method. */ public void documentRegistration() { } /** * A dummy routine to satisify the abstract interface. If the DTM * implememtation that extends the default base requires notification * when the document is being released, they can override this method */ public void documentRelease() { } /** * Migrate a DTM built with an old DTMManager to a new DTMManager. * After the migration, the new DTMManager will treat the DTM as * one that is built by itself. * This is used to support DTM sharing between multiple transformations. * @param mgr the DTMManager */ public void migrateTo(DTMManager mgr) { m_mgr = mgr; if(mgr instanceof DTMManagerDefault) m_mgrDefault=(DTMManagerDefault)mgr; } /** Query which DTMManager this DTM is currently being handled by. * * %REVEW% Should this become part of the base DTM API? * * @return a DTMManager, or null if this is a "stand-alone" DTM. */ public DTMManager getManager() { return m_mgr; } /** Query which DTMIDs this DTM is currently using within the DTMManager. * * %REVEW% Should this become part of the base DTM API? * * @return an IntVector, or null if this is a "stand-alone" DTM. */ public SuballocatedIntVector getDTMIDs() { if(m_mgr==null) return null; return m_dtmIdent; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMChildIterNodeList.java0000644000175000017500000001043310721374031024757 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMChildIterNodeList.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTM; import org.w3c.dom.Node; /** * DTMNodeList gives us an implementation of the DOM's * NodeList interface wrapped around a DTM Iterator. The author * considers this something of an abominations, since NodeList was not * intended to be a general purpose "list of nodes" API and is * generally considered by the DOM WG to have be a mistake... but I'm * told that some of the XPath/XSLT folks say they must have this * solution. * * Please note that this is not necessarily equivlaent to a DOM * NodeList operating over the same document. In particular: *
      * *
    • If there are several Text nodes in logical succession (ie, * across CDATASection and EntityReference boundaries), we will return * only the first; the caller is responsible for stepping through * them. * (%REVIEW% Provide a convenience routine here to assist, pending * proposed DOM Level 3 getAdjacentText() operation?)
    • * *
    • Since the whole XPath/XSLT architecture assumes that the source * document is not altered while we're working with it, we do not * promise to implement the DOM NodeList's "live view" response to * document mutation.
    • * *
    * *

    State: In progress!!

    * */ public class DTMChildIterNodeList extends DTMNodeListBase { private int m_firstChild; private DTM m_parentDTM; //================================================================ // Methods unique to this class private DTMChildIterNodeList() { } /** * Public constructor: Create a NodeList to support * DTMNodeProxy.getChildren(). * * Unfortunately AxisIterators and DTMIterators don't share an API, * so I can't use the existing Axis.CHILD iterator. Rather than * create Yet Another Class, let's set up a special case of this * one. * * @param parentDTM The DTM containing this node * @param parentHandle DTM node-handle integer * */ public DTMChildIterNodeList(DTM parentDTM,int parentHandle) { m_parentDTM=parentDTM; m_firstChild=parentDTM.getFirstChild(parentHandle); } //================================================================ // org.w3c.dom.NodeList API follows /** * Returns the indexth item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * @param index Index into the collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. */ public Node item(int index) { int handle=m_firstChild; while(--index>=0 && handle!=DTM.NULL) { handle=m_parentDTM.getNextSibling(handle); } if (handle == DTM.NULL) { return null; } return m_parentDTM.getNode(handle); } /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. */ public int getLength() { int count=0; for (int handle=m_firstChild; handle!=DTM.NULL; handle=m_parentDTM.getNextSibling(handle)) { ++count; } return count; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java0000644000175000017500000001740210721374032024663 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMAxisIteratorBase.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTMAxisIterator; /** * This class serves as a default base for implementations of mutable * DTMAxisIterators. */ public abstract class DTMAxisIteratorBase implements DTMAxisIterator { /** The position of the last node within the iteration, as defined by XPath. * Note that this is _not_ the node's handle within the DTM. Also, don't * confuse it with the current (most recently returned) position. */ protected int _last = -1; /** The position of the current node within the iteration, as defined by XPath. * Note that this is _not_ the node's handle within the DTM! */ protected int _position = 0; /** The position of the marked node within the iteration; * a saved itaration state that we may want to come back to. * Note that only one mark is maintained; there is no stack. */ protected int _markedNode; /** The handle to the start, or root, of the iteration. * Set this to END to construct an empty iterator. */ protected int _startNode = DTMAxisIterator.END; /** True if the start node should be considered part of the iteration. * False will cause it to be skipped. */ protected boolean _includeSelf = false; /** True if this iteration can be restarted. False otherwise (eg, if * we are iterating over a stream that can not be re-scanned, or if * the iterator was produced by cloning another iterator.) */ protected boolean _isRestartable = true; /** * Get start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @return The root node of the iteration. */ public int getStartNode() { return _startNode; } /** * @return A DTMAxisIterator which has been reset to the start node, * which may or may not be the same as this iterator. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; return this; } /** * Set the flag to include the start node in the iteration. * * * @return This default method returns just returns this DTMAxisIterator, * after setting the flag. * (Returning "this" permits C++-style chaining of * method calls into a single expression.) */ public DTMAxisIterator includeSelf() { _includeSelf = true; return this; } /** Returns the position of the last node within the iteration, as * defined by XPath. In a forward iterator, I believe this equals the number of nodes which this * iterator will yield. In a reverse iterator, I believe it should return * 1 (since the "last" is the first produced.) * * This may be an expensive operation when called the first time, since * it may have to iterate through a large part of the document to produce * its answer. * * @return The number of nodes in this iterator (forward) or 1 (reverse). */ public int getLast() { if (_last == -1) // Not previously established { // Note that we're doing both setMark() -- which saves _currentChild // -- and explicitly saving our position counter (number of nodes // yielded so far). // // %REVIEW% Should position also be saved by setMark()? // (It wasn't in the XSLTC version, but I don't understand why not.) final int temp = _position; // Save state setMark(); reset(); // Count the nodes found by this iterator do { _last++; } while (next() != END); gotoMark(); // Restore saved state _position = temp; } return _last; } /** * @return The position of the current node within the set, as defined by * XPath. Note that this is one-based, not zero-based. */ public int getPosition() { return _position == 0 ? 1 : _position; } /** * @return true if this iterator has a reversed axis, else false */ public boolean isReverse() { return false; } /** * Returns a deep copy of this iterator. Cloned iterators may not be * restartable. The iterator being cloned may or may not become * non-restartable as a side effect of this operation. * * @return a deep copy of this iterator. */ public DTMAxisIterator cloneIterator() { try { final DTMAxisIteratorBase clone = (DTMAxisIteratorBase) super.clone(); clone._isRestartable = false; // return clone.reset(); return clone; } catch (CloneNotSupportedException e) { throw new org.apache.xml.utils.WrappedRuntimeException(e); } } /** * Do any final cleanup that is required before returning the node that was * passed in, and then return it. The intended use is *
    * return returnNode(node); * * %REVIEW% If we're calling it purely for side effects, should we really * be bothering with a return value? Something like *
    * accept(node); return node; *
    * would probably optimize just about as well and avoid questions * about whether what's returned could ever be different from what's * passed in. * * @param node Node handle which iteration is about to yield. * * @return The node handle passed in. */ protected final int returnNode(final int node) { _position++; return node; } /** * Reset the position to zero. NOTE that this does not change the iteration * state, only the position number associated with that state. * * %REVIEW% Document when this would be used? * * @return This instance. */ protected final DTMAxisIterator resetPosition() { _position = 0; return this; } /** * Returns true if all the nodes in the iteration well be returned in document * order. * * @return true as a default. */ public boolean isDocOrdered() { return true; } /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis() { return -1; } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; } /** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { if (position > 0) { final int pos = isReverse() ? getLast() - position + 1 : position; int node; while ((node = next()) != DTMAxisIterator.END) { if (pos == getPosition()) { return node; } } } return END; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMDocumentImpl.java0000644000175000017500000027663410721374030024066 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMDocumentImpl.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import javax.xml.transform.SourceLocator; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.ext.LexicalHandler; /** * This is the implementation of the DTM document interface. It receives * requests from an XML content handler similar to that of an XML DOM or SAX parser * to store information from the xml document in an array based * dtm table structure. This informtion is used later for document navigation, * query, and SAX event dispatch functions. The DTM can also be used directly as a * document composition model for an application. The requests received are: *
      *
    • initiating DTM to set the doc handle
    • *
    • resetting DTM for data structure reuse
    • *
    • hinting the end of document to adjust the end of data structure pointers
    • *
    • createnodes (element, comment, text, attribute, ....)
    • *
    • hinting the end of an element to patch parent and siblings
    • *
    • setting application provided symbol name stringpool data structures
    • *
    *

    State: In progress!!

    * * %REVIEW% I _think_ the SAX convention is that "no namespace" is expressed * as "" rather than as null (which is the DOM's convention). What should * DTM expect? What should it do with the other? * *

    Origin: the implemention is a composite logic based on the DTM of XalanJ1 and * DocImpl, DocumentImpl, ElementImpl, TextImpl, etc. of XalanJ2

    */ public class DTMDocumentImpl implements DTM, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler { // Number of lower bits used to represent node index. protected static final byte DOCHANDLE_SHIFT = 22; // Masks the lower order of node handle. // Same as {@link DTMConstructor.IDENT_NODE_DEFAULT} protected static final int NODEHANDLE_MASK = (1 << (DOCHANDLE_SHIFT + 1)) - 1; // Masks the higher order Document handle // Same as {@link DTMConstructor.IDENT_DOC_DEFAULT} protected static final int DOCHANDLE_MASK = -1 - NODEHANDLE_MASK; int m_docHandle = NULL; // masked document handle for this dtm document int m_docElement = NULL; // nodeHandle to the root of the actual dtm doc content // Context for parse-and-append operations int currentParent = 0; // current parent - default is document root int previousSibling = 0; // previous sibling - no previous sibling protected int m_currentNode = -1; // current node // The tree under construction can itself be used as // the element stack, so m_elemStack isn't needed. //protected Stack m_elemStack = new Stack(); // element stack private boolean previousSiblingWasParent = false; // Local cache for record-at-a-time fetch int gotslot[] = new int[4]; // endDocument recieved? private boolean done = false; boolean m_isError = false; private final boolean DEBUG = false; /** The document base URI. */ protected String m_documentBaseURI; /** If we're building the model incrementally on demand, we need to * be able to tell the source when to send us more data. * * Note that if this has not been set, and you attempt to read ahead * of the current build point, we'll probably throw a null-pointer * exception. We could try to wait-and-retry instead, as a very poor * fallback, but that has all the known problems with multithreading * on multiprocessors and we Don't Want to Go There. * * @see setIncrementalSAXSource */ private IncrementalSAXSource m_incrSAXSource=null; // ========= DTM data structure declarations. ============== // nodes array: integer array blocks to hold the first level reference of the nodes, // each reference slot is addressed by a nodeHandle index value. // Assumes indices are not larger than {@link NODEHANDLE_MASK} // ({@link DOCHANDLE_SHIFT} bits). ChunkedIntArray nodes = new ChunkedIntArray(4); // text/comment table: string buffer to hold the text string values of the document, // each of which is addressed by the absolute offset and length in the buffer private FastStringBuffer m_char = new FastStringBuffer(); // Start of string currently being accumulated into m_char; // needed because the string may be appended in several chunks. private int m_char_current_start=0; // %TBD% INITIALIZATION/STARTUP ISSUES // -- Should we really be creating these, or should they be // passed in from outside? Scott want to be able to share // pools across multiple documents, so setting them here is // probably not the right default. private DTMStringPool m_localNames = new DTMStringPool(); private DTMStringPool m_nsNames = new DTMStringPool(); private DTMStringPool m_prefixNames = new DTMStringPool(); // %TBD% If we use the current ExpandedNameTable mapper, it // needs to be bound to the NS and local name pools. Which // means it needs to attach to them AFTER we've resolved their // startup. Or it needs to attach to this document and // retrieve them each time. Or this needs to be // an interface _implemented_ by this class... which might be simplest! private ExpandedNameTable m_expandedNames= new ExpandedNameTable(); private XMLStringFactory m_xsf; /** * Construct a DTM. * * @param documentNumber the ID number assigned to this document. * It will be shifted up into the high bits and returned as part of * all node ID numbers, so those IDs indicate which document they * came from as well as a location within the document. It is the * DTMManager's responsibility to assign a unique number to each * document. */ public DTMDocumentImpl(DTMManager mgr, int documentNumber, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory){ initDocument(documentNumber); // clear nodes and document handle m_xsf = xstringfactory; } /** Bind a IncrementalSAXSource to this DTM. If we discover we need nodes * that have not yet been built, we will ask this object to send us more * events, and it will manage interactions with its data sources. * * Note that we do not actually build the IncrementalSAXSource, since we don't * know what source it's reading from, what thread that source will run in, * or when it will run. * * @param source The IncrementalSAXSource that we want to recieve events from * on demand. */ public void setIncrementalSAXSource(IncrementalSAXSource source) { m_incrSAXSource=source; // Establish SAX-stream link so we can receive the requested data source.setContentHandler(this); source.setLexicalHandler(this); // Are the following really needed? IncrementalSAXSource doesn't yet // support them, and they're mostly no-ops here... //source.setErrorHandler(this); //source.setDTDHandler(this); //source.setDeclHandler(this); } /** * Wrapper for ChunkedIntArray.append, to automatically update the * previous sibling's "next" reference (if necessary) and periodically * wake a reader who may have encountered incomplete data and entered * a wait state. * @param w0 int As in ChunkedIntArray.append * @param w1 int As in ChunkedIntArray.append * @param w2 int As in ChunkedIntArray.append * @param w3 int As in ChunkedIntArray.append * @return int As in ChunkedIntArray.append * @see ChunkedIntArray.append */ private final int appendNode(int w0, int w1, int w2, int w3) { // A decent compiler may inline this. int slotnumber = nodes.appendSlot(w0, w1, w2, w3); if (DEBUG) System.out.println(slotnumber+": "+w0+" "+w1+" "+w2+" "+w3); if (previousSiblingWasParent) nodes.writeEntry(previousSibling,2,slotnumber); previousSiblingWasParent = false; // Set the default; endElement overrides return slotnumber; } // ========= DTM Implementation Control Functions. ============== /** * Set an implementation dependent feature. *

    * %REVIEW% Do we really expect to set features on DTMs? * * @param featureId A feature URL. * @param state true if this feature should be on, false otherwise. */ public void setFeature(String featureId, boolean state) {}; /** * Set a reference pointer to the element name symbol table. * %REVIEW% Should this really be Public? Changing it while * DTM is in use would be a disaster. * * @param poolRef DTMStringPool reference to an instance of table. */ public void setLocalNameTable(DTMStringPool poolRef) { m_localNames = poolRef; } /** * Get a reference pointer to the element name symbol table. * * @return DTMStringPool reference to an instance of table. */ public DTMStringPool getLocalNameTable() { return m_localNames; } /** * Set a reference pointer to the namespace URI symbol table. * %REVIEW% Should this really be Public? Changing it while * DTM is in use would be a disaster. * * @param poolRef DTMStringPool reference to an instance of table. */ public void setNsNameTable(DTMStringPool poolRef) { m_nsNames = poolRef; } /** * Get a reference pointer to the namespace URI symbol table. * * @return DTMStringPool reference to an instance of table. */ public DTMStringPool getNsNameTable() { return m_nsNames; } /** * Set a reference pointer to the prefix name symbol table. * %REVIEW% Should this really be Public? Changing it while * DTM is in use would be a disaster. * * @param poolRef DTMStringPool reference to an instance of table. */ public void setPrefixNameTable(DTMStringPool poolRef) { m_prefixNames = poolRef; } /** * Get a reference pointer to the prefix name symbol table. * * @return DTMStringPool reference to an instance of table. */ public DTMStringPool getPrefixNameTable() { return m_prefixNames; } /** * Set a reference pointer to the content-text repository * * @param buffer FastStringBuffer reference to an instance of * buffer */ void setContentBuffer(FastStringBuffer buffer) { m_char = buffer; } /** * Get a reference pointer to the content-text repository * * @return FastStringBuffer reference to an instance of buffer */ FastStringBuffer getContentBuffer() { return m_char; } /** getContentHandler returns "our SAX builder" -- the thing that * someone else should send SAX events to in order to extend this * DTM model. * * @return null if this model doesn't respond to SAX events, * "this" if the DTM object has a built-in SAX ContentHandler, * the IncrementalSAXSource if we're bound to one and should receive * the SAX stream via it for incremental build purposes... * */ public org.xml.sax.ContentHandler getContentHandler() { if (m_incrSAXSource instanceof IncrementalSAXSource_Filter) return (ContentHandler) m_incrSAXSource; else return this; } /** * Return this DTM's lexical handler. * * %REVIEW% Should this return null if constrution already done/begun? * * @return null if this model doesn't respond to lexical SAX events, * "this" if the DTM object has a built-in SAX ContentHandler, * the IncrementalSAXSource if we're bound to one and should receive * the SAX stream via it for incremental build purposes... */ public LexicalHandler getLexicalHandler() { if (m_incrSAXSource instanceof IncrementalSAXSource_Filter) return (LexicalHandler) m_incrSAXSource; else return this; } /** * Return this DTM's EntityResolver. * * @return null if this model doesn't respond to SAX entity ref events. */ public org.xml.sax.EntityResolver getEntityResolver() { return null; } /** * Return this DTM's DTDHandler. * * @return null if this model doesn't respond to SAX dtd events. */ public org.xml.sax.DTDHandler getDTDHandler() { return null; } /** * Return this DTM's ErrorHandler. * * @return null if this model doesn't respond to SAX error events. */ public org.xml.sax.ErrorHandler getErrorHandler() { return null; } /** * Return this DTM's DeclHandler. * * @return null if this model doesn't respond to SAX Decl events. */ public org.xml.sax.ext.DeclHandler getDeclHandler() { return null; } /** @return true iff we're building this model incrementally (eg * we're partnered with a IncrementalSAXSource) and thus require that the * transformation and the parse run simultaneously. Guidance to the * DTMManager. * */ public boolean needsTwoThreads() { return null!=m_incrSAXSource; } //================================================================ // ========= SAX2 ContentHandler methods ========= // Accept SAX events, use them to build/extend the DTM tree. // Replaces the deprecated DocumentHandler interface. public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException { // Actually creating the text node is handled by // processAccumulatedText(); here we just accumulate the // characters into the buffer. m_char.append(ch,start,length); } // Flush string accumulation into a text node private void processAccumulatedText() { int len=m_char.length(); if(len!=m_char_current_start) { // The FastStringBuffer has been previously agreed upon appendTextChild(m_char_current_start,len-m_char_current_start); m_char_current_start=len; } } public void endDocument() throws org.xml.sax.SAXException { // May need to tell the low-level builder code to pop up a level. // There _should't_ be any significant pending text at this point. appendEndDocument(); } public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException { processAccumulatedText(); // No args but we do need to tell the low-level builder code to // pop up a level. appendEndElement(); } public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException { // No-op } public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException { // %TBD% I believe ignorable text isn't part of the DTM model...? } public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException { processAccumulatedText(); // %TBD% Which pools do target and data go into? } public void setDocumentLocator(Locator locator) { // No-op for DTM } public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException { processAccumulatedText(); //%TBD% } public void startDocument() throws org.xml.sax.SAXException { appendStartDocument(); } public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws org.xml.sax.SAXException { processAccumulatedText(); // %TBD% Split prefix off qname String prefix=null; int colon=qName.indexOf(':'); if(colon>0) prefix=qName.substring(0,colon); // %TBD% Where do we pool expandedName, or is it just the union, or... /**/System.out.println("Prefix="+prefix+" index="+m_prefixNames.stringToIndex(prefix)); appendStartElement(m_nsNames.stringToIndex(namespaceURI), m_localNames.stringToIndex(localName), m_prefixNames.stringToIndex(prefix)); /////// %TBD% // %TBD% I'm assuming that DTM will require resequencing of // NS decls before other attrs, hence two passes are taken. // %TBD% Is there an easier way to test for NSDecl? int nAtts=(atts==null) ? 0 : atts.getLength(); // %TBD% Countdown is more efficient if nobody cares about sequence. for(int i=nAtts-1;i>=0;--i) { qName=atts.getQName(i); if(qName.startsWith("xmlns:") || "xmlns".equals(qName)) { prefix=null; colon=qName.indexOf(':'); if(colon>0) { prefix=qName.substring(0,colon); } else { // %REVEIW% Null or ""? prefix=null; // Default prefix } appendNSDeclaration( m_prefixNames.stringToIndex(prefix), m_nsNames.stringToIndex(atts.getValue(i)), atts.getType(i).equalsIgnoreCase("ID")); } } for(int i=nAtts-1;i>=0;--i) { qName=atts.getQName(i); if(!(qName.startsWith("xmlns:") || "xmlns".equals(qName))) { // %TBD% I hate having to extract the prefix into a new // string when we may never use it. Consider pooling whole // qNames, which are already strings? prefix=null; colon=qName.indexOf(':'); if(colon>0) { prefix=qName.substring(0,colon); localName=qName.substring(colon+1); } else { prefix=""; // Default prefix localName=qName; } m_char.append(atts.getValue(i)); // Single-string value int contentEnd=m_char.length(); if(!("xmlns".equals(prefix) || "xmlns".equals(qName))) appendAttribute(m_nsNames.stringToIndex(atts.getURI(i)), m_localNames.stringToIndex(localName), m_prefixNames.stringToIndex(prefix), atts.getType(i).equalsIgnoreCase("ID"), m_char_current_start, contentEnd-m_char_current_start); m_char_current_start=contentEnd; } } } public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException { // No-op in DTM, handled during element/attr processing? } // // LexicalHandler support. Not all SAX2 parsers support these events // but we may want to pass them through when they exist... // public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException { processAccumulatedText(); m_char.append(ch,start,length); // Single-string value appendComment(m_char_current_start,length); m_char_current_start+=length; } public void endCDATA() throws org.xml.sax.SAXException { // No-op in DTM } public void endDTD() throws org.xml.sax.SAXException { // No-op in DTM } public void endEntity(java.lang.String name) throws org.xml.sax.SAXException { // No-op in DTM } public void startCDATA() throws org.xml.sax.SAXException { // No-op in DTM } public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException { // No-op in DTM } public void startEntity(java.lang.String name) throws org.xml.sax.SAXException { // No-op in DTM } //================================================================ // ========= Document Handler Functions ========= // %REVIEW% jjk -- DocumentHandler is SAX Level 1, and deprecated.... // and this wasn't a fully compliant or declared implementation of that API // in any case. Phase out in favor of SAX2 ContentHandler/LexicalHandler /** * Reset a dtm document to its initial (empty) state. * * The DTMManager will invoke this method when the dtm is created. * * @param documentNumber the handle for the DTM document. */ final void initDocument(int documentNumber) { // save masked DTM document handle m_docHandle = documentNumber<The content handler will invoke this method only once, and it will // * be the last method invoked during the parse. The handler shall not // * not invoke this method until it has either abandoned parsing // * (because of an unrecoverable error) or reached the end of // * input.

    // */ // public void documentEnd() // { // done = true; // // %TBD% may need to notice the last slot number and slot count to avoid // // residual data from provious use of this DTM // } // /** // * Receive notification of the beginning of a document. // * // *

    The SAX parser will invoke this method only once, before any // * other methods in this interface.

    // */ // public void reset() // { // // %TBD% reset slot 0 to indicate ChunkedIntArray reuse or wait for // // the next initDocument(). // m_docElement = NULL; // reset nodeHandle to the root of the actual dtm doc content // initDocument(0); // } // /** // * Factory method; creates an Element node in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // *

    The XML content handler will invoke endElement() method after all // * of the element's content are processed in order to give DTM the indication // * to prepare and patch up parent and sibling node pointers.

    // * // *

    The following interface for createElement will use an index value corresponds // * to the symbol entry in the DTMDStringPool based symbol tables.

    // * // * @param nsIndex The namespace of the node // * @param nameIndex The element name. // * @see #endElement // * @see org.xml.sax.Attributes // * @return nodeHandle int of the element created // */ // public int createElement(int nsIndex, int nameIndex, Attributes atts) // { // // do document root node creation here on the first element, create nodes for // // this element and its attributes, store the element, namespace, and attritute // // name indexes to the nodes array, keep track of the current node and parent // // element used // // W0 High: Namespace Low: Node Type // int w0 = (nsIndex << 16) | ELEMENT_NODE; // // W1: Parent // int w1 = currentParent; // // W2: Next (initialized as 0) // int w2 = 0; // // W3: Tagname // int w3 = nameIndex; // //int ourslot = nodes.appendSlot(w0, w1, w2, w3); // int ourslot = appendNode(w0, w1, w2, w3); // currentParent = ourslot; // previousSibling = 0; // setAttributes(atts); // // set the root element pointer when creating the first element node // if (m_docElement == NULL) // m_docElement = ourslot; // return (m_docHandle | ourslot); // } // // Factory method to create an Element node not associated with a given name space // // using String value parameters passed in from a content handler or application // /** // * Factory method; creates an Element node not associated with a given name space in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // *

    The XML content handler or application will invoke endElement() method after all // * of the element's content are processed in order to give DTM the indication // * to prepare and patch up parent and sibling node pointers.

    // * // *

    The following parameters for createElement contains raw string values for name // * symbols used in an Element node.

    // * // * @param name String the element name, including the prefix if any. // * @param atts The attributes attached to the element, if any. // * @see #endElement // * @see org.xml.sax.Attributes // */ // public int createElement(String name, Attributes atts) // { // // This method wraps around the index valued interface of the createElement interface. // // The raw string values are stored into the current DTM name symbol tables. The method // // method will then use the index values returned to invoke the other createElement() // // onverted to index values modified to match a // // method. // int nsIndex = NULL; // int nameIndex = m_localNames.stringToIndex(name); // // note - there should be no prefix separator in the name because it is not associated // // with a name space // return createElement(nsIndex, nameIndex, atts); // } // // Factory method to create an Element node associated with a given name space // // using String value parameters passed in from a content handler or application // /** // * Factory method; creates an Element node associated with a given name space in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // *

    The XML content handler or application will invoke endElement() method after all // * of the element's content are processed in order to give DTM the indication // * to prepare and patch up parent and sibling node pointers.

    // * // *

    The following parameters for createElementNS contains raw string values for name // * symbols used in an Element node.

    // * // * @param ns String the namespace of the node // * @param name String the element name, including the prefix if any. // * @param atts The attributes attached to the element, if any. // * @see #endElement // * @see org.xml.sax.Attributes // */ // public int createElementNS(String ns, String name, Attributes atts) // { // // This method wraps around the index valued interface of the createElement interface. // // The raw string values are stored into the current DTM name symbol tables. The method // // method will then use the index values returned to invoke the other createElement() // // onverted to index values modified to match a // // method. // int nsIndex = m_nsNames.stringToIndex(ns); // int nameIndex = m_localNames.stringToIndex(name); // // The prefixIndex is not needed by the indexed interface of the createElement method // int prefixSep = name.indexOf(":"); // int prefixIndex = m_prefixNames.stringToIndex(name.substring(0, prefixSep)); // return createElement(nsIndex, nameIndex, atts); // } // /** // * Receive an indication for the end of an element. // * // *

    The XML content handler will invoke this method at the end of every // * element in the XML document to give hint its time to pop up the current // * element and parent and patch up parent and sibling pointers if necessary // * // *

    %tbd% The following interface may need to be modified to match a // * coordinated access to the DTMDStringPool based symbol tables.

    // * // * @param ns the namespace of the element // * @param name The element name // */ // public void endElement(String ns, String name) // { // // pop up the stacks // // // if (previousSiblingWasParent) // nodes.writeEntry(previousSibling, 2, NULL); // // Pop parentage // previousSibling = currentParent; // nodes.readSlot(currentParent, gotslot); // currentParent = gotslot[1] & 0xFFFF; // // The element just being finished will be // // the previous sibling for the next operation // previousSiblingWasParent = true; // // Pop a level of namespace table // // namespaceTable.removeLastElem(); // } // /** // * Creates attributes for the current node. // * // * @param atts Attributes to be created. // */ // void setAttributes(Attributes atts) { // int atLength = (null == atts) ? 0 : atts.getLength(); // for (int i=0; i < atLength; i++) { // String qname = atts.getQName(i); // createAttribute(atts.getQName(i), atts.getValue(i)); // } // } // /** // * Appends an attribute to the document. // * @param qname Qualified Name of the attribute // * @param value Value of the attribute // * @return Handle of node // */ // public int createAttribute(String qname, String value) { // int colonpos = qname.indexOf(":"); // String attName = qname.substring(colonpos+1); // int w0 = 0; // if (colonpos > 0) { // String prefix = qname.substring(0, colonpos); // if (prefix.equals("xml")) { // //w0 = ATTRIBUTE_NODE | // // (org.apache.xalan.templates.Constants.S_XMLNAMESPACEURI << 16); // } else { // //w0 = ATTRIBUTE_NODE | // } // } else { // w0 = ATTRIBUTE_NODE; // } // // W1: Parent // int w1 = currentParent; // // W2: Next (not yet resolved) // int w2 = 0; // // W3: Tag name // int w3 = m_localNames.stringToIndex(attName); // // Add node // int ourslot = appendNode(w0, w1, w2, w3); // previousSibling = ourslot; // Should attributes be previous siblings // // W0: Node Type // w0 = TEXT_NODE; // // W1: Parent // w1 = ourslot; // // W2: Start Position within buffer // w2 = m_char.length(); // m_char.append(value); // // W3: Length // w3 = m_char.length() - w2; // appendNode(w0, w1, w2, w3); // charStringStart=m_char.length(); // charStringLength = 0; // //previousSibling = ourslot; // // Attrs are Parents // previousSiblingWasParent = true; // return (m_docHandle | ourslot); // } // /** // * Factory method; creates a Text node in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // * @param text String The characters text string from the XML document. // * @return int DTM node-number of the text node created // */ // public int createTextNode(String text) // throws DTMException // { // // wraps around the index value based createTextNode method // return createTextNode(text.toCharArray(), 0, text.length()); // } // /** // * Factory method; creates a Text node in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // * %REVIEW% for text normalization issues, unless we are willing to // * insist that all adjacent text must be merged before this method // * is called. // * // * @param ch The characters from the XML document. // * @param start The start position in the array. // * @param length The number of characters to read from the array. // */ // public int createTextNode(char ch[], int start, int length) // throws DTMException // { // m_char.append(ch, start, length); // store the chunk to the text/comment string table // // create a Text Node // // %TBD% may be possible to combine with appendNode()to replace the next chunk of code // int w0 = TEXT_NODE; // // W1: Parent // int w1 = currentParent; // // W2: Start position within m_char // int w2 = charStringStart; // // W3: Length of the full string // int w3 = length; // int ourslot = appendNode(w0, w1, w2, w3); // previousSibling = ourslot; // charStringStart=m_char.length(); // charStringLength = 0; // return (m_docHandle | ourslot); // } // /** // * Factory method; creates a Comment node in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // * @param text String The characters text string from the XML document. // * @return int DTM node-number of the text node created // */ // public int createComment(String text) // throws DTMException // { // // wraps around the index value based createTextNode method // return createComment(text.toCharArray(), 0, text.length()); // } // /** // * Factory method; creates a Comment node in this document. // * // * The node created will be chained according to its natural order of request // * received. %TBD% It can be rechained later via the optional DTM writable interface. // * // * @param ch An array holding the characters in the comment. // * @param start The starting position in the array. // * @param length The number of characters to use from the array. // * @see DTMException // */ // public int createComment(char ch[], int start, int length) // throws DTMException // { // m_char.append(ch, start, length); // store the comment string to the text/comment string table // // create a Comment Node // // %TBD% may be possible to combine with appendNode()to replace the next chunk of code // int w0 = COMMENT_NODE; // // W1: Parent // int w1 = currentParent; // // W2: Start position within m_char // int w2 = charStringStart; // // W3: Length of the full string // int w3 = length; // int ourslot = appendNode(w0, w1, w2, w3); // previousSibling = ourslot; // charStringStart=m_char.length(); // charStringLength = 0; // return (m_docHandle | ourslot); // } // // Counters to keep track of the current text string being accumulated with respect // // to the text/comment string table: charStringStart should point to the starting // // offset of the string in the table and charStringLength the acccumulated length when // // appendAccumulatedText starts, and reset to the end of the table and 0 at the end // // of appendAccumulatedText for the next set of characters receives // int charStringStart=0,charStringLength=0; // ========= Document Navigation Functions ========= /** Given a node handle, test if it has child nodes. *

    %REVIEW% This is obviously useful at the DOM layer, where it * would permit testing this without having to create a proxy * node. It's less useful in the DTM API, where * (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and * almost as self-evident. But it's a convenience, and eases porting * of DOM code to DTM.

    * * @param nodeHandle int Handle of the node. * @return int true if the given node has child nodes. */ public boolean hasChildNodes(int nodeHandle) { return(getFirstChild(nodeHandle) != NULL); } /** * Given a node handle, get the handle of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of first child, or DTM.NULL to indicate none exists. */ public int getFirstChild(int nodeHandle) { // ###shs worry about tracing/debug later nodeHandle &= NODEHANDLE_MASK; // Read node into variable nodes.readSlot(nodeHandle, gotslot); // type is the last half of first slot short type = (short) (gotslot[0] & 0xFFFF); // Check to see if Element or Document node if ((type == ELEMENT_NODE) || (type == DOCUMENT_NODE) || (type == ENTITY_REFERENCE_NODE)) { // In case when Document root is given // if (nodeHandle == 0) nodeHandle = 1; // %TBD% Probably was a mistake. // If someone explicitly asks for first child // of Document, I would expect them to want // that and only that. int kid = nodeHandle + 1; nodes.readSlot(kid, gotslot); while (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) { // points to next sibling kid = gotslot[2]; // Return NULL if node has only attributes if (kid == NULL) return NULL; nodes.readSlot(kid, gotslot); } // If parent slot matches given parent, return kid if (gotslot[1] == nodeHandle) { int firstChild = kid | m_docHandle; return firstChild; } } // No child found return NULL; } /** * Given a node handle, advance to its last child. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param nodeHandle int Handle of the node. * @return int Node-number of last child, * or DTM.NULL to indicate none exists. */ public int getLastChild(int nodeHandle) { // ###shs put trace/debug later nodeHandle &= NODEHANDLE_MASK; // do not need to test node type since getFirstChild does that int lastChild = NULL; for (int nextkid = getFirstChild(nodeHandle); nextkid != NULL; nextkid = getNextSibling(nextkid)) { lastChild = nextkid; } return lastChild | m_docHandle; } /** * Retrieves an attribute node by by qualified name and namespace URI. * * @param nodeHandle int Handle of the node upon which to look up this attribute. * @param namespaceURI The namespace URI of the attribute to * retrieve, or null. * @param name The local name of the attribute to * retrieve. * @return The attribute node handle with the specified name ( * nodeName) or DTM.NULL if there is no such * attribute. */ public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { int nsIndex = m_nsNames.stringToIndex(namespaceURI), nameIndex = m_localNames.stringToIndex(name); nodeHandle &= NODEHANDLE_MASK; nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); // If nodeHandle points to element next slot would be first attribute if (type == ELEMENT_NODE) nodeHandle++; // Iterate through Attribute Nodes while (type == ATTRIBUTE_NODE) { if ((nsIndex == (gotslot[0] << 16)) && (gotslot[3] == nameIndex)) return nodeHandle | m_docHandle; // Goto next sibling nodeHandle = gotslot[2]; nodes.readSlot(nodeHandle, gotslot); } return NULL; } /** * Given a node handle, get the index of the node's first attribute. * * @param nodeHandle int Handle of the Element node. * @return Handle of first attribute, or DTM.NULL to indicate none exists. */ public int getFirstAttribute(int nodeHandle) { nodeHandle &= NODEHANDLE_MASK; // %REVIEW% jjk: Just a quick observation: If you're going to // call readEntry repeatedly on the same node, it may be // more efficiently to do a readSlot to get the data locally, // reducing the addressing and call-and-return overhead. // Should we check if handle is element (do we want sanity checks?) if (ELEMENT_NODE != (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) return NULL; // First Attribute (if any) should be at next position in table nodeHandle++; return(ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) ? nodeHandle | m_docHandle : NULL; } /** * Given a node handle, get the index of the node's first child. * If not yet resolved, waits for more nodes to be added to the document and * tries again * * @param nodeHandle handle to node, which should probably be an element * node, but need not be. * * @param inScope true if all namespaces in scope should be returned, * false if only the namespace declarations should be * returned. * @return handle of first namespace, or DTM.NULL to indicate none exists. */ public int getFirstNamespaceNode(int nodeHandle, boolean inScope) { return NULL; } /** * Given a node handle, advance to its next sibling. * * %TBD% This currently uses the DTM-internal definition of * sibling; eg, the last attr's next sib is the first * child. In the old DTM, the DOM proxy layer provided the * additional logic for the public view. If we're rewriting * for XPath emulation, that test must be done here. * * %TBD% CODE INTERACTION WITH INCREMENTAL PARSE - If not yet * resolved, should wait for more nodes to be added to the document * and tries again. * * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. * */ public int getNextSibling(int nodeHandle) { nodeHandle &= NODEHANDLE_MASK; // Document root has no next sibling if (nodeHandle == 0) return NULL; short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF); if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) || (type == ENTITY_REFERENCE_NODE)) { int nextSib = nodes.readEntry(nodeHandle, 2); if (nextSib == NULL) return NULL; if (nextSib != 0) return (m_docHandle | nextSib); // ###shs should cycle/wait if nextSib is 0? Working on threading next } // Next Sibling is in the next position if it shares the same parent int thisParent = nodes.readEntry(nodeHandle, 1); if (nodes.readEntry(++nodeHandle, 1) == thisParent) return (m_docHandle | nodeHandle); return NULL; } /** * Given a node handle, find its preceeding sibling. * WARNING: DTM is asymmetric; this operation is resolved by search, and is * relatively expensive. * * @param nodeHandle the id of the node. * @return int Node-number of the previous sib, * or DTM.NULL to indicate none exists. */ public int getPreviousSibling(int nodeHandle) { nodeHandle &= NODEHANDLE_MASK; // Document root has no previous sibling if (nodeHandle == 0) return NULL; int parent = nodes.readEntry(nodeHandle, 1); int kid = NULL; for (int nextkid = getFirstChild(parent); nextkid != nodeHandle; nextkid = getNextSibling(nextkid)) { kid = nextkid; } return kid | m_docHandle; } /** * Given a node handle, advance to the next attribute. If an * element, we advance to its first attribute; if an attr, we advance to * the next attr on the same node. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of the resolved attr, * or DTM.NULL to indicate none exists. */ public int getNextAttribute(int nodeHandle) { nodeHandle &= NODEHANDLE_MASK; nodes.readSlot(nodeHandle, gotslot); //%REVIEW% Why are we using short here? There's no storage //reduction for an automatic variable, especially one used //so briefly, and it typically costs more cycles to process //than an int would. short type = (short) (gotslot[0] & 0xFFFF); if (type == ELEMENT_NODE) { return getFirstAttribute(nodeHandle); } else if (type == ATTRIBUTE_NODE) { if (gotslot[2] != NULL) return (m_docHandle | gotslot[2]); } return NULL; } /** * Given a namespace handle, advance to the next namespace. * * %TBD% THIS METHOD DOES NOT MATCH THE CURRENT SIGNATURE IN * THE DTM INTERFACE. FIX IT, OR JUSTIFY CHANGING THE DTM * API. * * @param namespaceHandle handle to node which must be of type NAMESPACE_NODE. * @return handle of next namespace, or DTM.NULL to indicate none exists. */ public int getNextNamespaceNode(int baseHandle,int namespaceHandle, boolean inScope) { // ###shs need to work on namespace return NULL; } /** * Given a node handle, advance to its next descendant. * If not yet resolved, waits for more nodes to be added to the document and * tries again. * * @param subtreeRootHandle * @param nodeHandle int Handle of the node. * @return handle of next descendant, * or DTM.NULL to indicate none exists. */ public int getNextDescendant(int subtreeRootHandle, int nodeHandle) { subtreeRootHandle &= NODEHANDLE_MASK; nodeHandle &= NODEHANDLE_MASK; // Document root [Document Node? -- jjk] - no next-sib if (nodeHandle == 0) return NULL; while (!m_isError) { // Document done and node out of bounds if (done && (nodeHandle > nodes.slotsUsed())) break; if (nodeHandle > subtreeRootHandle) { nodes.readSlot(nodeHandle+1, gotslot); if (gotslot[2] != 0) { short type = (short) (gotslot[0] & 0xFFFF); if (type == ATTRIBUTE_NODE) { nodeHandle +=2; } else { int nextParentPos = gotslot[1]; if (nextParentPos >= subtreeRootHandle) return (m_docHandle | (nodeHandle+1)); else break; } } else if (!done) { // Add wait logic here } else break; } else { nodeHandle++; } } // Probably should throw error here like original instead of returning return NULL; } /** * Given a node handle, advance to the next node on the following axis. * * @param axisContextHandle the start of the axis that is being traversed. * @param nodeHandle * @return handle of next sibling, * or DTM.NULL to indicate none exists. */ public int getNextFollowing(int axisContextHandle, int nodeHandle) { //###shs still working on return NULL; } /** * Given a node handle, advance to the next node on the preceding axis. * * @param axisContextHandle the start of the axis that is being traversed. * @param nodeHandle the id of the node. * @return int Node-number of preceding sibling, * or DTM.NULL to indicate none exists. */ public int getNextPreceding(int axisContextHandle, int nodeHandle) { // ###shs copied from Xalan 1, what is this suppose to do? nodeHandle &= NODEHANDLE_MASK; while (nodeHandle > 1) { nodeHandle--; if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) continue; // if nodeHandle is _not_ an ancestor of // axisContextHandle, specialFind will return it. // If it _is_ an ancestor, specialFind will return -1 // %REVIEW% unconditional return defeats the // purpose of the while loop -- does this // logic make any sense? return (m_docHandle | nodes.specialFind(axisContextHandle, nodeHandle)); } return NULL; } /** * Given a node handle, find its parent node. * * @param nodeHandle the id of the node. * @return int Node-number of parent, * or DTM.NULL to indicate none exists. */ public int getParent(int nodeHandle) { // Should check to see within range? // Document Root should not have to be handled differently return (m_docHandle | nodes.readEntry(nodeHandle, 1)); } /** * Returns the root element of the document. * @return nodeHandle to the Document Root. */ public int getDocumentRoot() { return (m_docHandle | m_docElement); } /** * Given a node handle, find the owning document node. * * @return int Node handle of document, which should always be valid. */ public int getDocument() { return m_docHandle; } /** * Given a node handle, find the owning document node. This has the exact * same semantics as the DOM Document method of the same name, in that if * the nodeHandle is a document node, it will return NULL. * *

    %REVIEW% Since this is DOM-specific, it may belong at the DOM * binding layer. Included here as a convenience function and to * aid porting of DOM code to DTM.

    * * @param nodeHandle the id of the node. * @return int Node handle of owning document, or NULL if the nodeHandle is * a document. */ public int getOwnerDocument(int nodeHandle) { // Assumption that Document Node is always in 0 slot if ((nodeHandle & NODEHANDLE_MASK) == 0) return NULL; return (nodeHandle & DOCHANDLE_MASK); } /** * Given a node handle, find the owning document node. This has the DTM * semantics; a Document node is its own owner. * *

    %REVIEW% Since this is DOM-specific, it may belong at the DOM * binding layer. Included here as a convenience function and to * aid porting of DOM code to DTM.

    * * @param nodeHandle the id of the node. * @return int Node handle of owning document, or NULL if the nodeHandle is * a document. */ public int getDocumentRoot(int nodeHandle) { // Assumption that Document Node is always in 0 slot if ((nodeHandle & NODEHANDLE_MASK) == 0) return NULL; return (nodeHandle & DOCHANDLE_MASK); } /** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { // ###zaj - researching nodes.readSlot(nodeHandle, gotslot); int nodetype=gotslot[0] & 0xFF; String value=null; switch (nodetype) { case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: value= m_char.getString(gotslot[2], gotslot[3]); break; case PROCESSING_INSTRUCTION_NODE: case ATTRIBUTE_NODE: case ELEMENT_NODE: case ENTITY_REFERENCE_NODE: default: break; } return m_xsf.newstr( value ); } /** * Get number of character array chunks in * the string-value of a node. * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * Note that a single text node may have multiple text chunks. * * EXPLANATION: This method is an artifact of the fact that the * underlying m_chars object may not store characters in a * single contiguous array -- for example,the current * FastStringBuffer may split a single node's text across * multiple allocation units. This call tells us how many * separate accesses will be required to retrieve the entire * content. PLEASE NOTE that this may not be the same as the * number of SAX characters() events that caused the text node * to be built in the first place, since m_chars buffering may * be on different boundaries than the parser's buffers. * * @param nodeHandle The node ID. * * @return number of character array chunks in * the string-value of a node. * */ //###zaj - tbd public int getStringValueChunkCount(int nodeHandle) { //###zaj return value return 0; } /** * Get a character array chunk in the string-value of a node. * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * Note that a single text node may have multiple text chunks. * * EXPLANATION: This method is an artifact of the fact that * the underlying m_chars object may not store characters in a * single contiguous array -- for example,the current * FastStringBuffer may split a single node's text across * multiple allocation units. This call retrieves a single * contiguous portion of the text -- as much as m-chars was * able to store in a single allocation unit. PLEASE NOTE * that this may not be the same granularityas the SAX * characters() events that caused the text node to be built * in the first place, since m_chars buffering may be on * different boundaries than the parser's buffers. * * @param nodeHandle The node ID. * @param chunkIndex Which chunk to get. * @param startAndLen An array of 2 where the start position and length of * the chunk will be returned. * * @return The character array reference where the chunk occurs. */ //###zaj - tbd public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen) {return new char[0];} /** * Given a node handle, return an ID that represents the node's expanded name. * * @param nodeHandle The handle to the node in question. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); String qName = m_localNames.indexToString(gotslot[3]); // Remove prefix from qName // %TBD% jjk This is assuming the elementName is the qName. int colonpos = qName.indexOf(":"); String localName = qName.substring(colonpos+1); // Get NS String namespace = m_nsNames.indexToString(gotslot[0] << 16); // Create expanded name String expandedName = namespace + ":" + localName; int expandedNameID = m_nsNames.stringToIndex(expandedName); return expandedNameID; } /** * Given an expanded name, return an ID. If the expanded-name does not * exist in the internal tables, the entry will be created, and the ID will * be returned. Any additional nodes that are created that have this * expanded name will use this ID. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(String namespace, String localName, int type) { // Create expanded name // %TBD% jjk Expanded name is bitfield-encoded as // typeID[6]nsuriID[10]localID[16]. Switch to that form, and to // accessing the ns/local via their tables rather than confusing // nsnames and expandednames. String expandedName = namespace + ":" + localName; int expandedNameID = m_nsNames.stringToIndex(expandedName); return expandedNameID; } /** * Given an expanded-name ID, return the local name part. * * @param ExpandedNameID an ID that represents an expanded-name. * @return String Local name of this node. */ public String getLocalNameFromExpandedNameID(int ExpandedNameID) { // Get expanded name String expandedName = m_localNames.indexToString(ExpandedNameID); // Remove prefix from expanded name int colonpos = expandedName.indexOf(":"); String localName = expandedName.substring(colonpos+1); return localName; } /** * Given an expanded-name ID, return the namespace URI part. * * @param ExpandedNameID an ID that represents an expanded-name. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceFromExpandedNameID(int ExpandedNameID) { String expandedName = m_localNames.indexToString(ExpandedNameID); // Remove local name from expanded name int colonpos = expandedName.indexOf(":"); String nsName = expandedName.substring(0, colonpos); return nsName; } /** * fixednames */ private static final String[] fixednames= { null,null, // nothing, Element null,"#text", // Attr, Text "#cdata_section",null, // CDATA, EntityReference null,null, // Entity, PI "#comment","#document", // Comment, Document null,"#document-fragment", // Doctype, DocumentFragment null}; // Notation /** * Given a node handle, return its DOM-style node name. This will * include names such as #text or #document. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. * %REVIEW% Document when empty string is possible... */ public String getNodeName(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); String name = fixednames[type]; if (null == name) { int i=gotslot[3]; /**/System.out.println("got i="+i+" "+(i>>16)+"/"+(i&0xffff)); name=m_localNames.indexToString(i & 0xFFFF); String prefix=m_prefixNames.indexToString(i >>16); if(prefix!=null && prefix.length()>0) name=prefix+":"+name; } return name; } /** * Given a node handle, return the XPath node name. This should be * the name as described by the XPath data model, NOT the DOM-style * name. * * @param nodeHandle the id of the node. * @return String Name of this node. */ public String getNodeNameX(int nodeHandle) {return null;} /** * Given a node handle, return its DOM-style localname. * (As defined in Namespaces, this is the portion of the name after any * colon character) * * %REVIEW% What's the local name of something other than Element/Attr? * Should this be DOM-style (undefined unless namespaced), or other? * * @param nodeHandle the id of the node. * @return String Local name of this node. */ public String getLocalName(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); String name = ""; if ((type==ELEMENT_NODE) || (type==ATTRIBUTE_NODE)) { int i=gotslot[3]; name=m_localNames.indexToString(i & 0xFFFF); if(name==null) name=""; } return name; } /** * Given a namespace handle, return the prefix that the namespace decl is * mapping. * Given a node handle, return the prefix used to map to the namespace. * *

    %REVIEW% Are you sure you want "" for no prefix?

    * * %REVIEW% Should this be DOM-style (undefined unless namespaced), * or other? * * @param nodeHandle the id of the node. * @return String prefix of this node's name, or "" if no explicit * namespace prefix was given. */ public String getPrefix(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); String name = ""; if((type==ELEMENT_NODE) || (type==ATTRIBUTE_NODE)) { int i=gotslot[3]; name=m_prefixNames.indexToString(i >>16); if(name==null) name=""; } return name; } /** * Given a node handle, return its DOM-style namespace URI * (As defined in Namespaces, this is the declared URI which this node's * prefix -- or default in lieu thereof -- was mapped to.) * * @param nodeHandle the id of the node. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceURI(int nodeHandle) {return null;} /** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. *

    * * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public String getNodeValue(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); int nodetype=gotslot[0] & 0xFF; // ###zaj use mask to get node type String value=null; switch (nodetype) { // ###zaj todo - document nodetypes case ATTRIBUTE_NODE: nodes.readSlot(nodeHandle+1, gotslot); case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: value=m_char.getString(gotslot[2], gotslot[3]); //###zaj break; case PROCESSING_INSTRUCTION_NODE: case ELEMENT_NODE: case ENTITY_REFERENCE_NODE: default: break; } return value; } /** * Given a node handle, return its DOM-style node type. *

    * %REVIEW% Generally, returning short is false economy. Return int? * * @param nodeHandle The node id. * @return int Node type, as per the DOM's Node._NODE constants. */ public short getNodeType(int nodeHandle) { return(short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF); } /** * Get the depth level of this node in the tree (equals 1 for * a parentless node). * * @param nodeHandle The node id. * @return the number of ancestors, plus one * @xsl.usage internal */ public short getLevel(int nodeHandle) { short count = 0; while (nodeHandle != 0) { count++; nodeHandle = nodes.readEntry(nodeHandle, 1); } return count; } // ============== Document query functions ============== /** * Tests whether DTM DOM implementation implements a specific feature and * that feature is supported by this node. * * @param feature The name of the feature to test. * @param version This is the version number of the feature to test. * If the version is not * specified, supporting any version of the feature will cause the * method to return true. * @return Returns true if the specified feature is * supported on this node, false otherwise. */ public boolean isSupported(String feature, String version) {return false;} /** * Return the base URI of the document entity. If it is not known * (because the document was parsed from a socket connection or from * standard input, for example), the value of this property is unknown. * * @return the document base URI String object or null if unknown. */ public String getDocumentBaseURI() { return m_documentBaseURI; } /** * Set the base URI of the document entity. * * @param baseURI the document base URI String object or null if unknown. */ public void setDocumentBaseURI(String baseURI) { m_documentBaseURI = baseURI; } /** * Return the system identifier of the document entity. If * it is not known, the value of this property is unknown. * * @param nodeHandle The node id, which can be any valid node handle. * @return the system identifier String object or null if unknown. */ public String getDocumentSystemIdentifier(int nodeHandle) {return null;} /** * Return the name of the character encoding scheme * in which the document entity is expressed. * * @param nodeHandle The node id, which can be any valid node handle. * @return the document encoding String object. */ public String getDocumentEncoding(int nodeHandle) {return null;} /** * Return an indication of the standalone status of the document, * either "yes" or "no". This property is derived from the optional * standalone document declaration in the XML declaration at the * beginning of the document entity, and has no value if there is no * standalone document declaration. * * @param nodeHandle The node id, which can be any valid node handle. * @return the document standalone String object, either "yes", "no", or null. */ public String getDocumentStandalone(int nodeHandle) {return null;} /** * Return a string representing the XML version of the document. This * property is derived from the XML declaration optionally present at the * beginning of the document entity, and has no value if there is no XML * declaration. * * @param documentHandle the document handle * * @return the document version String object */ public String getDocumentVersion(int documentHandle) {return null;} /** * Return an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @return true if all declarations were processed {}; * false otherwise. */ public boolean getDocumentAllDeclarationsProcessed() {return false;} /** * A document type declaration information item has the following properties: * * 1. [system identifier] The system identifier of the external subset, if * it exists. Otherwise this property has no value. * * @return the system identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationSystemIdentifier() {return null;} /** * Return the public identifier of the external subset, * normalized as described in 4.2.2 External Entities [XML]. If there is * no external subset or if it has no public identifier, this property * has no value. * * @return the public identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationPublicIdentifier() {return null;} /** * Returns the Element whose ID is given by * elementId. If no such element exists, returns * DTM.NULL. Behavior is not defined if more than one element * has this ID. Attributes (including those * with the name "ID") are not of type ID unless so defined by DTD/Schema * information available to the DTM implementation. * Implementations that do not know whether attributes are of type ID or * not are expected to return DTM.NULL. * *

    %REVIEW% Presumably IDs are still scoped to a single document, * and this operation searches only within a single document, right? * Wouldn't want collisions between DTMs in the same process.

    * * @param elementId The unique id value for an element. * @return The handle of the matching element. */ public int getElementById(String elementId) {return 0;} /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. *

    * XML processors may choose to use the System Identifier (if one * is provided) to resolve the entity, rather than the URI in the * Public Identifier. The details are dependent on the processor, and * we would have to support some form of plug-in resolver to handle * this properly. Currently, we simply return the System Identifier if * present, and hope that it a usable URI or that our caller can * map it to one. * TODO: Resolve Public Identifiers... or consider changing function name. *

    * If we find a relative URI * reference, XML expects it to be resolved in terms of the base URI * of the document. The DOM doesn't do that for us, and it isn't * entirely clear whether that should be done here; currently that's * pushed up to a higher level of our application. (Note that DOM Level * 1 didn't store the document's base URI.) * TODO: Consider resolving Relative URIs. *

    * (The DOM's statement that "An XML processor may choose to * completely expand entities before the structure model is passed * to the DOM" refers only to parsed entities, not unparsed, and hence * doesn't affect this function.) * * @param name A string containing the Entity Name of the unparsed * entity. * * @return String containing the URI of the Unparsed Entity, or an * empty string if no such entity exists. */ public String getUnparsedEntityURI(String name) {return null;} // ============== Boolean methods ================ /** * Return true if the xsl:strip-space or xsl:preserve-space was processed * during construction of the DTM document. * *

    %REVEIW% Presumes a 1:1 mapping from DTM to Document, since * we aren't saying which Document to query...?

    */ public boolean supportsPreStripping() {return false;} /** * Figure out whether nodeHandle2 should be considered as being later * in the document than nodeHandle1, in Document Order as defined * by the XPath model. This may not agree with the ordering defined * by other XML applications. *

    * There are some cases where ordering isn't defined, and neither are * the results of this function -- though we'll generally return true. * * TODO: Make sure this does the right thing with attribute nodes!!! * * @param nodeHandle1 DOM Node to perform position comparison on. * @param nodeHandle2 DOM Node to perform position comparison on . * * @return false if node2 comes before node1, otherwise return true. * You can think of this as * (node1.documentOrderPosition <= node2.documentOrderPosition). */ public boolean isNodeAfter(int nodeHandle1, int nodeHandle2) {return false;} /** * 2. [element content whitespace] A boolean indicating whether the * character is white space appearing within element content (see [XML], * 2.10 "White Space Handling"). Note that validating XML processors are * required by XML 1.0 to provide this information. If there is no * declaration for the containing element, this property has no value for * white space characters. If no declaration has been read, but the [all * declarations processed] property of the document information item is * false (so there may be an unread declaration), then the value of this * property is unknown for white space characters. It is always false for * characters that are not white space. * * @param nodeHandle the node ID. * @return true if the character data is whitespace; * false otherwise. */ public boolean isCharacterElementContentWhitespace(int nodeHandle) {return false;} /** * 10. [all declarations processed] This property is not strictly speaking * part of the infoset of the document. Rather it is an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @param documentHandle A node handle that must identify a document. * @return true if all declarations were processed; * false otherwise. */ public boolean isDocumentAllDeclarationsProcessed(int documentHandle) {return false;} /** * 5. [specified] A flag indicating whether this attribute was actually * specified in the start-tag of its element, or was defaulted from the * DTD. * * @param attributeHandle the attribute handle * @return true if the attribute was specified; * false if it was defaulted. */ public boolean isAttributeSpecified(int attributeHandle) {return false;} // ========== Direct SAX Dispatch, for optimization purposes ======== /** * Directly call the * characters method on the passed ContentHandler for the * string-value of the given node (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException {} /** * Directly create SAX parser events from a subtree. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException {} /** * Return an DOM node for the given node. * * @param nodeHandle The node ID. * * @return A node representation of the DTM node. */ public org.w3c.dom.Node getNode(int nodeHandle) { return null; } // ==== Construction methods (may not be supported by some implementations!) ===== // %REVIEW% jjk: These probably aren't the right API. At the very least // they need to deal with current-insertion-location and end-element // issues. /** * Append a child to the end of the child list of the current node. Please note that the node * is always cloned if it is owned by another document. * *

    %REVIEW% "End of the document" needs to be defined more clearly. * Does it become the last child of the Document? Of the root element?

    * * @param newChild Must be a valid new node handle. * @param clone true if the child should be cloned into the document. * @param cloneDepth if the clone argument is true, specifies that the * clone should include all it's children. */ public void appendChild(int newChild, boolean clone, boolean cloneDepth) { boolean sameDoc = ((newChild & DOCHANDLE_MASK) == m_docHandle); if (clone || !sameDoc) { } else { } } /** * Append a text node child that will be constructed from a string, * to the end of the document. * *

    %REVIEW% "End of the document" needs to be defined more clearly. * Does it become the last child of the Document? Of the root element?

    * * @param str Non-null reference to a string. */ public void appendTextChild(String str) { // ###shs Think more about how this differs from createTextNode //%TBD% } //================================================================ // ==== BUILDER methods ==== // %TBD% jjk: SHOULD PROBABLY BE INLINED, unless we want to support // both SAX1 and SAX2 and share this logic between them. /** Append a text child at the current insertion point. Assumes that the * actual content of the text has previously been appended to the m_char * buffer (shared with the builder). * * @param m_char_current_start int Starting offset of node's content in m_char. * @param contentLength int Length of node's content in m_char. * */ void appendTextChild(int m_char_current_start,int contentLength) { // create a Text Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = TEXT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; } /** Append a comment child at the current insertion point. Assumes that the * actual content of the comment has previously been appended to the m_char * buffer (shared with the builder). * * @param m_char_current_start int Starting offset of node's content in m_char. * @param contentLength int Length of node's content in m_char. * */ void appendComment(int m_char_current_start,int contentLength) { // create a Comment Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = COMMENT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; } /** Append an Element child at the current insertion point. This * Element then _becomes_ the insertion point; subsequent appends * become its lastChild until an appendEndElement() call is made. * * Assumes that the symbols (local name, namespace URI and prefix) * have already been added to the pools * * Note that this _only_ handles the Element node itself. Attrs and * namespace nodes are unbundled in the ContentHandler layer * and appended separately. * * @param namespaceIndex: Index within the namespaceURI string pool * @param localNameIndex Index within the local name string pool * @param prefixIndex: Index within the prefix string pool * */ void appendStartElement(int namespaceIndex,int localNameIndex, int prefixIndex) { // do document root node creation here on the first element, create nodes for // this element and its attributes, store the element, namespace, and attritute // name indexes to the nodes array, keep track of the current node and parent // element used // W0 High: Namespace Low: Node Type int w0 = (namespaceIndex << 16) | ELEMENT_NODE; // W1: Parent int w1 = currentParent; // W2: Next (initialized as 0) int w2 = 0; // W3: Tagname high: prefix Low: local name int w3 = localNameIndex | prefixIndex<<16; /**/System.out.println("set w3="+w3+" "+(w3>>16)+"/"+(w3&0xffff)); //int ourslot = nodes.appendSlot(w0, w1, w2, w3); int ourslot = appendNode(w0, w1, w2, w3); currentParent = ourslot; previousSibling = 0; // set the root element pointer when creating the first element node if (m_docElement == NULL) m_docElement = ourslot; } /** Append a Namespace Declaration child at the current insertion point. * Assumes that the symbols (namespace URI and prefix) have already been * added to the pools * * @param prefixIndex: Index within the prefix string pool * @param namespaceIndex: Index within the namespaceURI string pool * @param isID: If someone really insists on writing a bad DTD, it is * theoretically possible for a namespace declaration to also be declared * as being a node ID. I don't really want to support that stupidity, * but I'm not sure we can refuse to accept it. * */ void appendNSDeclaration(int prefixIndex, int namespaceIndex, boolean isID) { // %REVIEW% I'm assigning this node the "namespace for namespaces" // which the DOM defined. It is expected that the Namespace spec will // adopt this as official. It isn't strictly needed since it's implied // by the nodetype, but for now... // %REVIEW% Prefix need not be recorded; it's implied too. But // recording it might simplify the design. // %TBD% isID is not currently honored. final int namespaceForNamespaces=m_nsNames.stringToIndex("http://www.w3.org/2000/xmlns/"); // W0 High: Namespace Low: Node Type int w0 = NAMESPACE_NODE | (m_nsNames.stringToIndex("http://www.w3.org/2000/xmlns/")<<16); // W1: Parent int w1 = currentParent; // W2: CURRENTLY UNUSED -- It's next-sib in attrs, but we have no kids. int w2 = 0; // W3: namespace name int w3 = namespaceIndex; // Add node int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; // Should attributes be previous siblings previousSiblingWasParent = false; return ;//(m_docHandle | ourslot); } /** Append an Attribute child at the current insertion * point. Assumes that the symbols (namespace URI, local name, and * prefix) have already been added to the pools, and that the content has * already been appended to m_char. Note that the attribute's content has * been flattened into a single string; DTM does _NOT_ attempt to model * the details of entity references within attribute values. * * @param namespaceIndex int Index within the namespaceURI string pool * @param localNameIndex int Index within the local name string pool * @param prefixIndex int Index within the prefix string pool * @param isID boolean True if this attribute was declared as an ID * (for use in supporting getElementByID). * @param m_char_current_start int Starting offset of node's content in m_char. * @param contentLength int Length of node's content in m_char. * */ void appendAttribute(int namespaceIndex, int localNameIndex, int prefixIndex, boolean isID, int m_char_current_start, int contentLength) { // %TBD% isID is not currently honored. // W0 High: Namespace Low: Node Type int w0 = ATTRIBUTE_NODE | namespaceIndex<<16; // W1: Parent int w1 = currentParent; // W2: Next (not yet resolved) int w2 = 0; // W3: Tagname high: prefix Low: local name int w3 = localNameIndex | prefixIndex<<16; /**/System.out.println("set w3="+w3+" "+(w3>>16)+"/"+(w3&0xffff)); // Add node int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; // Should attributes be previous siblings // Attribute's content is currently appended as a Text Node // W0: Node Type w0 = TEXT_NODE; // W1: Parent w1 = ourslot; // W2: Start Position within buffer w2 = m_char_current_start; // W3: Length w3 = contentLength; appendNode(w0, w1, w2, w3); // Attrs are Parents previousSiblingWasParent = true; return ;//(m_docHandle | ourslot); } /** * This returns a stateless "traverser", that can navigate over an * XPath axis, though not in document order. * * @param axis One of Axes.ANCESTORORSELF, etc. * * @return A DTMAxisIterator, or null if the given axis isn't supported. */ public DTMAxisTraverser getAxisTraverser(final int axis) { return null; } /** * This is a shortcut to the iterators that implement the * supported XPath axes (only namespace::) is not supported. * Returns a bare-bones iterator that must be initialized * with a start node (using iterator.setStartNode()). * * @param axis One of Axes.ANCESTORORSELF, etc. * * @return A DTMAxisIterator, or null if the given axis isn't supported. */ public DTMAxisIterator getAxisIterator(final int axis) { // %TBD% return null; } /** * Get an iterator that can navigate over an XPath Axis, predicated by * the extended type ID. * * * @param axis * @param type An extended type ID. * * @return A DTMAxisIterator, or null if the given axis isn't supported. */ public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) { // %TBD% return null; } /** Terminate the element currently acting as an insertion point. Subsequent * insertions will occur as the last child of this element's parent. * */ void appendEndElement() { // pop up the stacks if (previousSiblingWasParent) nodes.writeEntry(previousSibling, 2, NULL); // Pop parentage previousSibling = currentParent; nodes.readSlot(currentParent, gotslot); currentParent = gotslot[1] & 0xFFFF; // The element just being finished will be // the previous sibling for the next operation previousSiblingWasParent = true; // Pop a level of namespace table // namespaceTable.removeLastElem(); } /** Starting a new document. Perform any resets/initialization * not already handled. * */ void appendStartDocument() { // %TBD% reset slot 0 to indicate ChunkedIntArray reuse or wait for // the next initDocument(). m_docElement = NULL; // reset nodeHandle to the root of the actual dtm doc content initDocument(0); } /** All appends to this document have finished; do whatever final * cleanup is needed. * */ void appendEndDocument() { done = true; // %TBD% may need to notice the last slot number and slot count to avoid // residual data from provious use of this DTM } /** * For the moment all the run time properties are ignored by this * class. * * @param property a String value * @param value an Object value */ public void setProperty(String property, Object value) { } /** * Source information is not handled yet, so return * null here. * * @param node an int value * @return null */ public SourceLocator getSourceLocatorFor(int node) { return null; } /** * A dummy routine to satisify the abstract interface. If the DTM * implememtation that extends the default base requires notification * of registration, they can override this method. */ public void documentRegistration() { } /** * A dummy routine to satisify the abstract interface. If the DTM * implememtation that extends the default base requires notification * when the document is being released, they can override this method */ public void documentRelease() { } /** * Migrate a DTM built with an old DTMManager to a new DTMManager. * After the migration, the new DTMManager will treat the DTM as * one that is built by itself. * This is used to support DTM sharing between multiple transformations. * @param manager the DTMManager */ public void migrateTo(DTMManager manager) { } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMAxisIterNodeList.java0000644000175000017500000001173010721374031024641 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMAxisIterNodeList.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.utils.IntVector; import org.w3c.dom.Node; /** * DTMAxisNodeList gives us an implementation of the DOM's * NodeList interface wrapped around a DTM Iterator. The author * considers this something of an abominations, since NodeList was not * intended to be a general purpose "list of nodes" API and is * generally considered by the DOM WG to have be a mistake... but I'm * told that some of the XPath/XSLT folks say they must have this * solution. * * Please note that this is not necessarily equivlaent to a DOM * NodeList operating over the same document. In particular: *
      * *
    • If there are several Text nodes in logical succession (ie, * across CDATASection and EntityReference boundaries), we will return * only the first; the caller is responsible for stepping through * them. * (%REVIEW% Provide a convenience routine here to assist, pending * proposed DOM Level 3 getAdjacentText() operation?)
    • * *
    • Since the whole XPath/XSLT architecture assumes that the source * document is not altered while we're working with it, we do not * promise to implement the DOM NodeList's "live view" response to * document mutation.
    • * *
    * *

    State: In progress!!

    * */ public class DTMAxisIterNodeList extends DTMNodeListBase { private DTM m_dtm; private DTMAxisIterator m_iter; private IntVector m_cachedNodes; private int m_last = -1; //================================================================ // Methods unique to this class private DTMAxisIterNodeList() { } /** * Public constructor: Wrap a DTMNodeList around an existing * and preconfigured DTMAxisIterator */ public DTMAxisIterNodeList(DTM dtm, DTMAxisIterator dtmAxisIterator) { if (dtmAxisIterator == null) { m_last = 0; } else { m_cachedNodes = new IntVector(); m_dtm = dtm; } m_iter = dtmAxisIterator; } /** * Access the wrapped DTMIterator. I'm not sure whether anyone will * need this or not, but let's write it and think about it. * */ public DTMAxisIterator getDTMAxisIterator() { return m_iter; } //================================================================ // org.w3c.dom.NodeList API follows /** * Returns the indexth item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * @param index Index into the collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. */ public Node item(int index) { if (m_iter != null) { int node; int count = m_cachedNodes.size(); if (count > index) { node = m_cachedNodes.elementAt(index); return m_dtm.getNode(node); } else if (m_last == -1) { while (((node = m_iter.next()) != DTMAxisIterator.END) && count <= index) { m_cachedNodes.addElement(node); count++; } if (node == DTMAxisIterator.END) { m_last = count; } else { return m_dtm.getNode(node); } } } return null; } /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. */ public int getLength() { if (m_last == -1) { int node; while ((node = m_iter.next()) != DTMAxisIterator.END) { m_cachedNodes.addElement(node); } m_last = m_cachedNodes.size(); } return m_last; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java0000644000175000017500000015335010721374032025715 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMDefaultBaseTraversers.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.apache.xml.dtm.*; import javax.xml.transform.Source; import org.apache.xml.utils.XMLStringFactory; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xalan.xsltc.dom.NodeCounter; /** * This class implements the traversers for DTMDefaultBase. * * PLEASE NOTE that the public interface for all traversers should be * in terms of DTM Node Handles... but they may use the internal node * identity indices within their logic, for efficiency's sake. Be very * careful to avoid confusing these when maintaining this code. * */ public abstract class DTMDefaultBaseTraversers extends DTMDefaultBase { /** * Construct a DTMDefaultBaseTraversers object from a DOM node. * * @param mgr The DTMManager who owns this DTM. * @param source The object that is used to specify the construction source. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory The factory to use for creating XMLStrings. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. */ public DTMDefaultBaseTraversers(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing); } /** * Construct a DTMDefaultBaseTraversers object from a DOM node. * * @param mgr The DTMManager who owns this DTM. * @param source The object that is used to specify the construction source. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory The factory to use for creating XMLStrings. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param blocksize The block size of the DTM. * @param usePrevsib true if we want to build the previous sibling node array. * @param newNameTable true if we want to use a new ExpandedNameTable for this DTM. */ public DTMDefaultBaseTraversers(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable) { super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, blocksize, usePrevsib, newNameTable); } /** * This returns a stateless "traverser", that can navigate * over an XPath axis, though perhaps not in document order. * * @param axis One of Axes.ANCESTORORSELF, etc. * * @return A DTMAxisTraverser, or null if the given axis isn't supported. */ public DTMAxisTraverser getAxisTraverser(final int axis) { DTMAxisTraverser traverser; if (null == m_traversers) // Cache of stateless traversers for this DTM { m_traversers = new DTMAxisTraverser[Axis.getNamesLength()]; traverser = null; } else { traverser = m_traversers[axis]; // Share/reuse existing traverser if (traverser != null) return traverser; } switch (axis) // Generate new traverser { case Axis.ANCESTOR : traverser = new AncestorTraverser(); break; case Axis.ANCESTORORSELF : traverser = new AncestorOrSelfTraverser(); break; case Axis.ATTRIBUTE : traverser = new AttributeTraverser(); break; case Axis.CHILD : traverser = new ChildTraverser(); break; case Axis.DESCENDANT : traverser = new DescendantTraverser(); break; case Axis.DESCENDANTORSELF : traverser = new DescendantOrSelfTraverser(); break; case Axis.FOLLOWING : traverser = new FollowingTraverser(); break; case Axis.FOLLOWINGSIBLING : traverser = new FollowingSiblingTraverser(); break; case Axis.NAMESPACE : traverser = new NamespaceTraverser(); break; case Axis.NAMESPACEDECLS : traverser = new NamespaceDeclsTraverser(); break; case Axis.PARENT : traverser = new ParentTraverser(); break; case Axis.PRECEDING : traverser = new PrecedingTraverser(); break; case Axis.PRECEDINGSIBLING : traverser = new PrecedingSiblingTraverser(); break; case Axis.SELF : traverser = new SelfTraverser(); break; case Axis.ALL : traverser = new AllFromRootTraverser(); break; case Axis.ALLFROMNODE : traverser = new AllFromNodeTraverser(); break; case Axis.PRECEDINGANDANCESTOR : traverser = new PrecedingAndAncestorTraverser(); break; case Axis.DESCENDANTSFROMROOT : traverser = new DescendantFromRootTraverser(); break; case Axis.DESCENDANTSORSELFFROMROOT : traverser = new DescendantOrSelfFromRootTraverser(); break; case Axis.ROOT : traverser = new RootTraverser(); break; case Axis.FILTEREDLIST : return null; // Don't want to throw an exception for this one. default : throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_UNKNOWN_AXIS_TYPE, new Object[]{Integer.toString(axis)})); //"Unknown axis traversal type: "+axis); } if (null == traverser) throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_AXIS_TRAVERSER_NOT_SUPPORTED, new Object[]{Axis.getNames(axis)})); // "Axis traverser not supported: " // + Axis.names[axis]); m_traversers[axis] = traverser; return traverser; } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class AncestorTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node if this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return getParent(current); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { // Process using identities current = makeNodeIdentity(current); while (DTM.NULL != (current = m_parent.elementAt(current))) { if (m_exptype.elementAt(current) == expandedTypeID) return makeNodeHandle(current); } return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class AncestorOrSelfTraverser extends AncestorTraverser { /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. To see if * the self node should be processed, use this function. * * @param context The context node of this traversal. * * @return the first node in the traversal. */ public int first(int context) { return context; } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. To see if * the self node should be processed, use this function. If the context * node does not match the expanded type ID, this function will return * false. * * @param context The context node of this traversal. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { return (getExpandedTypeID(context) == expandedTypeID) ? context : next(context, context, expandedTypeID); } } /** * Implements traversal of the Attribute access */ private class AttributeTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return (context == current) ? getFirstAttribute(context) : getNextAttribute(current); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { current = (context == current) ? getFirstAttribute(context) : getNextAttribute(current); do { if (getExpandedTypeID(current) == expandedTypeID) return current; } while (DTM.NULL != (current = getNextAttribute(current))); return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class ChildTraverser extends DTMAxisTraverser { /** * Get the next indexed node that matches the expanded type ID. Before * calling this function, one should first call * {@link #isIndexed(int) isIndexed} to make sure that the index can * contain nodes that match the given expanded type ID. * * @param axisRoot The root identity of the axis. * @param nextPotential The node found must match or occur after this node. * @param expandedTypeID The expanded type ID for the request. * * @return The node ID or NULL if not found. */ protected int getNextIndexed(int axisRoot, int nextPotential, int expandedTypeID) { int nsIndex = m_expandedNameTable.getNamespaceID(expandedTypeID); int lnIndex = m_expandedNameTable.getLocalNameID(expandedTypeID); for (; ; ) { int nextID = findElementFromIndex(nsIndex, lnIndex, nextPotential); if (NOTPROCESSED != nextID) { int parentID = m_parent.elementAt(nextID); // Is it a child? if(parentID == axisRoot) return nextID; // If the parent occured before the subtree root, then // we know it is past the child axis. if(parentID < axisRoot) return NULL; // Otherwise, it could be a descendant below the subtree root // children, or it could be after the subtree root. So we have // to climb up until the parent is less than the subtree root, in // which case we return NULL, or until it is equal to the subtree // root, in which case we continue to look. do { parentID = m_parent.elementAt(parentID); if(parentID < axisRoot) return NULL; } while(parentID > axisRoot); // System.out.println("Found node via index: "+first); nextPotential = nextID+1; continue; } nextNode(); if(!(m_nextsib.elementAt(axisRoot) == NOTPROCESSED)) break; } return DTM.NULL; } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * that the traversal starts from. * @return the first node in the traversal. */ public int first(int context) { return getFirstChild(context); } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { if(true) { int identity = makeNodeIdentity(context); int firstMatch = getNextIndexed(identity, _firstch(identity), expandedTypeID); return makeNodeHandle(firstMatch); } else { // %REVIEW% Dead code. Eliminate? for (int current = _firstch(makeNodeIdentity(context)); DTM.NULL != current; current = _nextsib(current)) { if (m_exptype.elementAt(current) == expandedTypeID) return makeNodeHandle(current); } return NULL; } } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return getNextSibling(current); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { // Process in Identifier space for (current = _nextsib(makeNodeIdentity(current)); DTM.NULL != current; current = _nextsib(current)) { if (m_exptype.elementAt(current) == expandedTypeID) return makeNodeHandle(current); } return NULL; } } /** * Super class for derived classes that want a convenient way to access * the indexing mechanism. */ private abstract class IndexedDTMAxisTraverser extends DTMAxisTraverser { /** * Tell if the indexing is on and the given expanded type ID matches * what is in the indexes. Derived classes should call this before * calling {@link #getNextIndexed(int, int, int) getNextIndexed} method. * * @param expandedTypeID The expanded type ID being requested. * * @return true if it is OK to call the * {@link #getNextIndexed(int, int, int) getNextIndexed} method. */ protected final boolean isIndexed(int expandedTypeID) { return (m_indexing && ExpandedNameTable.ELEMENT == m_expandedNameTable.getType(expandedTypeID)); } /** * Tell if a node is outside the axis being traversed. This method must be * implemented by derived classes, and must be robust enough to handle any * node that occurs after the axis root. * * @param axisRoot The root identity of the axis. * @param identity The node in question. * * @return true if the given node falls outside the axis being traversed. */ protected abstract boolean isAfterAxis(int axisRoot, int identity); /** * Tell if the axis has been fully processed to tell if a the wait for * an arriving node should terminate. This method must be implemented * be a derived class. * * @param axisRoot The root identity of the axis. * * @return true if the axis has been fully processed. */ protected abstract boolean axisHasBeenProcessed(int axisRoot); /** * Get the next indexed node that matches the expanded type ID. Before * calling this function, one should first call * {@link #isIndexed(int) isIndexed} to make sure that the index can * contain nodes that match the given expanded type ID. * * @param axisRoot The root identity of the axis. * @param nextPotential The node found must match or occur after this node. * @param expandedTypeID The expanded type ID for the request. * * @return The node ID or NULL if not found. */ protected int getNextIndexed(int axisRoot, int nextPotential, int expandedTypeID) { int nsIndex = m_expandedNameTable.getNamespaceID(expandedTypeID); int lnIndex = m_expandedNameTable.getLocalNameID(expandedTypeID); while(true) { int next = findElementFromIndex(nsIndex, lnIndex, nextPotential); if (NOTPROCESSED != next) { if (isAfterAxis(axisRoot, next)) return NULL; // System.out.println("Found node via index: "+first); return next; } else if(axisHasBeenProcessed(axisRoot)) break; nextNode(); } return DTM.NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class DescendantTraverser extends IndexedDTMAxisTraverser { /** * Get the first potential identity that can be returned. This should * be overridded by classes that need to return the self node. * * @param identity The node identity of the root context of the traversal. * * @return The first potential node that can be in the traversal. */ protected int getFirstPotential(int identity) { return identity + 1; } /** * Tell if the axis has been fully processed to tell if a the wait for * an arriving node should terminate. * * @param axisRoot The root identity of the axis. * * @return true if the axis has been fully processed. */ protected boolean axisHasBeenProcessed(int axisRoot) { return !(m_nextsib.elementAt(axisRoot) == NOTPROCESSED); } /** * Get the subtree root identity from the handle that was passed in by * the caller. Derived classes may override this to change the root * context of the traversal. * * @param handle handle to the root context. * @return identity of the root of the subtree. */ protected int getSubtreeRoot(int handle) { return makeNodeIdentity(handle); } /** * Tell if this node identity is a descendant. Assumes that * the node info for the element has already been obtained. * * %REVIEW% This is really parentFollowsRootInDocumentOrder ... * which fails if the parent starts after the root ends. * May be sufficient for this class's logic, but misleadingly named! * * @param subtreeRootIdentity The root context of the subtree in question. * @param identity The index number of the node in question. * @return true if the index is a descendant of _startNode. */ protected boolean isDescendant(int subtreeRootIdentity, int identity) { return _parent(identity) >= subtreeRootIdentity; } /** * Tell if a node is outside the axis being traversed. This method must be * implemented by derived classes, and must be robust enough to handle any * node that occurs after the axis root. * * @param axisRoot The root identity of the axis. * @param identity The node in question. * * @return true if the given node falls outside the axis being traversed. */ protected boolean isAfterAxis(int axisRoot, int identity) { // %REVIEW% Is there *any* cheaper way to do this? // Yes. In ID space, compare to axisRoot's successor // (next-sib or ancestor's-next-sib). Probably shallower search. do { if(identity == axisRoot) return false; identity = m_parent.elementAt(identity); } while(identity >= axisRoot); return true; } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { if (isIndexed(expandedTypeID)) { int identity = getSubtreeRoot(context); int firstPotential = getFirstPotential(identity); return makeNodeHandle(getNextIndexed(identity, firstPotential, expandedTypeID)); } return next(context, context, expandedTypeID); } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { int subtreeRootIdent = getSubtreeRoot(context); for (current = makeNodeIdentity(current) + 1; ; current++) { int type = _type(current); // may call nextNode() if (!isDescendant(subtreeRootIdent, current)) return NULL; if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type) continue; return makeNodeHandle(current); // make handle. } } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { int subtreeRootIdent = getSubtreeRoot(context); current = makeNodeIdentity(current) + 1; if (isIndexed(expandedTypeID)) { return makeNodeHandle(getNextIndexed(subtreeRootIdent, current, expandedTypeID)); } for (; ; current++) { int exptype = _exptype(current); // may call nextNode() if (!isDescendant(subtreeRootIdent, current)) return NULL; if (exptype != expandedTypeID) continue; return makeNodeHandle(current); // make handle. } } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class DescendantOrSelfTraverser extends DescendantTraverser { /** * Get the first potential identity that can be returned, which is the * axis context, in this case. * * @param identity The node identity of the root context of the traversal. * * @return The axis context. */ protected int getFirstPotential(int identity) { return identity; } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. To see if * the self node should be processed, use this function. * * @param context The context node of this traversal. * * @return the first node in the traversal. */ public int first(int context) { return context; } } /** * Implements traversal of the entire subtree, including the root node. */ private class AllFromNodeTraverser extends DescendantOrSelfTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { int subtreeRootIdent = makeNodeIdentity(context); for (current = makeNodeIdentity(current) + 1; ; current++) { // Trickological code: _exptype() has the side-effect of // running nextNode until the specified node has been loaded, // and thus can be used to ensure that incremental construction of // the DTM has gotten this far. Using it just for that side-effect // is quite a kluge... _exptype(current); // make sure it's here. if (!isDescendant(subtreeRootIdent, current)) return NULL; return makeNodeHandle(current); // make handle. } } } /** * Implements traversal of the following access, in document order. */ private class FollowingTraverser extends DescendantTraverser { /** * Get the first of the following. * * @param context The context node of this traversal. This is the point * that the traversal starts from. * @return the first node in the traversal. */ public int first(int context) { // Compute in ID space context=makeNodeIdentity(context); int first; int type = _type(context); if ((DTM.ATTRIBUTE_NODE == type) || (DTM.NAMESPACE_NODE == type)) { context = _parent(context); first = _firstch(context); if (NULL != first) return makeNodeHandle(first); } do { first = _nextsib(context); if (NULL == first) context = _parent(context); } while (NULL == first && NULL != context); return makeNodeHandle(first); } /** * Get the first of the following. * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { // %REVIEW% This looks like it might want shift into identity space // to avoid repeated conversion in the individual functions int first; int type = getNodeType(context); if ((DTM.ATTRIBUTE_NODE == type) || (DTM.NAMESPACE_NODE == type)) { context = getParent(context); first = getFirstChild(context); if (NULL != first) { if (getExpandedTypeID(first) == expandedTypeID) return first; else return next(context, first, expandedTypeID); } } do { first = getNextSibling(context); if (NULL == first) context = getParent(context); else { if (getExpandedTypeID(first) == expandedTypeID) return first; else return next(context, first, expandedTypeID); } } while (NULL == first && NULL != context); return first; } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { // Compute in identity space current=makeNodeIdentity(current); while (true) { current++; // Only works on IDs, not handles. // %REVIEW% Are we using handles or indexes? int type = _type(current); // may call nextNode() if (NULL == type) return NULL; if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type) continue; return makeNodeHandle(current); // make handle. } } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { // Compute in ID space current=makeNodeIdentity(current); while (true) { current++; int etype = _exptype(current); // may call nextNode() if (NULL == etype) return NULL; if (etype != expandedTypeID) continue; return makeNodeHandle(current); // make handle. } } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class FollowingSiblingTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return getNextSibling(current); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { while (DTM.NULL != (current = getNextSibling(current))) { if (getExpandedTypeID(current) == expandedTypeID) return current; } return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class NamespaceDeclsTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return (context == current) ? getFirstNamespaceNode(context, false) : getNextNamespaceNode(context, current, false); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { current = (context == current) ? getFirstNamespaceNode(context, false) : getNextNamespaceNode(context, current, false); do { if (getExpandedTypeID(current) == expandedTypeID) return current; } while (DTM.NULL != (current = getNextNamespaceNode(context, current, false))); return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class NamespaceTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return (context == current) ? getFirstNamespaceNode(context, true) : getNextNamespaceNode(context, current, true); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { current = (context == current) ? getFirstNamespaceNode(context, true) : getNextNamespaceNode(context, current, true); do { if (getExpandedTypeID(current) == expandedTypeID) return current; } while (DTM.NULL != (current = getNextNamespaceNode(context, current, true))); return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class ParentTraverser extends DTMAxisTraverser { /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * that the traversal starts from. * @return the first node in the traversal. */ public int first(int context) { return getParent(context); } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int current, int expandedTypeID) { // Compute in ID space current = makeNodeIdentity(current); while (NULL != (current = m_parent.elementAt(current))) { if (m_exptype.elementAt(current) == expandedTypeID) return makeNodeHandle(current); } return NULL; } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return NULL; } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class PrecedingTraverser extends DTMAxisTraverser { /** * Tell if the current identity is an ancestor of the context identity. * This is an expensive operation, made worse by the stateless traversal. * But the preceding axis is used fairly infrequently. * * @param contextIdent The context node of the axis traversal. * @param currentIdent The node in question. * @return true if the currentIdent node is an ancestor of contextIdent. */ protected boolean isAncestor(int contextIdent, int currentIdent) { // %REVIEW% See comments in IsAfterAxis; using the "successor" of // contextIdent is probably more efficient. for (contextIdent = m_parent.elementAt(contextIdent); DTM.NULL != contextIdent; contextIdent = m_parent.elementAt(contextIdent)) { if (contextIdent == currentIdent) return true; } return false; } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { // compute in ID space int subtreeRootIdent = makeNodeIdentity(context); for (current = makeNodeIdentity(current) - 1; current >= 0; current--) { short type = _type(current); if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type || isAncestor(subtreeRootIdent, current)) continue; return makeNodeHandle(current); // make handle. } return NULL; } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { // Compute in ID space int subtreeRootIdent = makeNodeIdentity(context); for (current = makeNodeIdentity(current) - 1; current >= 0; current--) { int exptype = m_exptype.elementAt(current); if (exptype != expandedTypeID || isAncestor(subtreeRootIdent, current)) continue; return makeNodeHandle(current); // make handle. } return NULL; } } /** * Implements traversal of the Ancestor and the Preceding axis, * in reverse document order. */ private class PrecedingAndAncestorTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { // Compute in ID space int subtreeRootIdent = makeNodeIdentity(context ); for (current = makeNodeIdentity(current) - 1; current >= 0; current--) { short type = _type(current); if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type) continue; return makeNodeHandle(current); // make handle. } return NULL; } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { // Compute in ID space int subtreeRootIdent = makeNodeIdentity(context); for (current = makeNodeIdentity(current) - 1; current >= 0; current--) { int exptype = m_exptype.elementAt(current); if (exptype != expandedTypeID) continue; return makeNodeHandle(current); // make handle. } return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class PrecedingSiblingTraverser extends DTMAxisTraverser { /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { return getPreviousSibling(current); } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { while (DTM.NULL != (current = getPreviousSibling(current))) { if (getExpandedTypeID(current) == expandedTypeID) return current; } return NULL; } } /** * Implements traversal of the Self axis. */ private class SelfTraverser extends DTMAxisTraverser { /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. To see if * the self node should be processed, use this function. * * @param context The context node of this traversal. * * @return the first node in the traversal. */ public int first(int context) { return context; } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. To see if * the self node should be processed, use this function. If the context * node does not match the expanded type ID, this function will return * false. * * @param context The context node of this traversal. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { return (getExpandedTypeID(context) == expandedTypeID) ? context : NULL; } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return Always return NULL for this axis. */ public int next(int context, int current) { return NULL; } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { return NULL; } } /** * Implements traversal of the Ancestor access, in reverse document order. */ private class AllFromRootTraverser extends AllFromNodeTraverser { /** * Return the root. * * @param context The context node of this traversal. * * @return the first node in the traversal. */ public int first(int context) { return getDocumentRoot(context); } /** * Return the root if it matches the expanded type ID. * * @param context The context node of this traversal. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { return (getExpandedTypeID(getDocumentRoot(context)) == expandedTypeID) ? context : next(context, context, expandedTypeID); } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current) { // Compute in ID space int subtreeRootIdent = makeNodeIdentity(context); for (current = makeNodeIdentity(current) + 1; ; current++) { // Kluge test: Just make sure +1 yielded a real node int type = _type(current); // may call nextNode() if (type == NULL) return NULL; return makeNodeHandle(current); // make handle. } } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { // Compute in ID space int subtreeRootIdent = makeNodeIdentity(context); for (current = makeNodeIdentity(current) + 1; ; current++) { int exptype = _exptype(current); // may call nextNode() if (exptype == NULL) return NULL; if (exptype != expandedTypeID) continue; return makeNodeHandle(current); // make handle. } } } /** * Implements traversal of the Self axis. */ private class RootTraverser extends AllFromRootTraverser { /** * Return the root if it matches the expanded type ID, * else return null (nothing found) * * @param context The context node of this traversal. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { int root=getDocumentRoot(context); return (getExpandedTypeID(root) == expandedTypeID) ? root : NULL; } /** * Traverse to the next node after the current node. * * @param context The context node of this iteration. * @param current The current node of the iteration. * * @return Always return NULL for this axis. */ public int next(int context, int current) { return NULL; } /** * Traverse to the next node after the current node that is matched * by the expanded type ID. * * @param context The context node of this iteration. * @param current The current node of the iteration. * @param expandedTypeID The expanded type ID that must match. * * @return the next node in the iteration, or DTM.NULL. */ public int next(int context, int current, int expandedTypeID) { return NULL; } } /** * A non-xpath axis, returns all nodes that aren't namespaces or attributes, * from and including the root. */ private class DescendantOrSelfFromRootTraverser extends DescendantTraverser { /** * Get the first potential identity that can be returned, which is the axis * root context in this case. * * @param identity The node identity of the root context of the traversal. * * @return The identity argument. */ protected int getFirstPotential(int identity) { return identity; } /** * Get the first potential identity that can be returned. * @param handle handle to the root context. * @return identity of the root of the subtree. */ protected int getSubtreeRoot(int handle) { // %REVIEW% Shouldn't this always be 0? return makeNodeIdentity(getDocument()); } /** * Return the root. * * @param context The context node of this traversal. * * @return the first node in the traversal. */ public int first(int context) { return getDocumentRoot(context); } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { if (isIndexed(expandedTypeID)) { int identity = 0; int firstPotential = getFirstPotential(identity); return makeNodeHandle(getNextIndexed(identity, firstPotential, expandedTypeID)); } int root = first(context); return next(root, root, expandedTypeID); } } /** * A non-xpath axis, returns all nodes that aren't namespaces or attributes, * from but not including the root. */ private class DescendantFromRootTraverser extends DescendantTraverser { /** * Get the first potential identity that can be returned, which is the axis * root context in this case. * * @param identity The node identity of the root context of the traversal. * * @return The identity argument. */ protected int getFirstPotential(int identity) { return _firstch(0); } /** * Get the first potential identity that can be returned. * @param handle handle to the root context. * @return identity of the root of the subtree. */ protected int getSubtreeRoot(int handle) { return 0; } /** * Return the root. * * @param context The context node of this traversal. * * @return the first node in the traversal. */ public int first(int context) { return makeNodeHandle(_firstch(0)); } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

    This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param expandedTypeID The expanded type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int expandedTypeID) { if (isIndexed(expandedTypeID)) { int identity = 0; int firstPotential = getFirstPotential(identity); return makeNodeHandle(getNextIndexed(identity, firstPotential, expandedTypeID)); } int root = getDocumentRoot(context); return next(root, root, expandedTypeID); } } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/ExtendedType.java0000644000175000017500000001043610721374032023507 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtendedType.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; /** * The class ExtendedType represents an extended type object used by * ExpandedNameTable. */ public final class ExtendedType { private int nodetype; private String namespace; private String localName; private int hash; /** * Create an ExtendedType object from node type, namespace and local name. * The hash code is calculated from the node type, namespace and local name. * * @param nodetype Type of the node * @param namespace Namespace of the node * @param localName Local name of the node */ public ExtendedType (int nodetype, String namespace, String localName) { this.nodetype = nodetype; this.namespace = namespace; this.localName = localName; this.hash = nodetype + namespace.hashCode() + localName.hashCode(); } /** * Create an ExtendedType object from node type, namespace, local name * and a given hash code. * * @param nodetype Type of the node * @param namespace Namespace of the node * @param localName Local name of the node * @param hash The given hash code */ public ExtendedType (int nodetype, String namespace, String localName, int hash) { this.nodetype = nodetype; this.namespace = namespace; this.localName = localName; this.hash = hash; } /** * Redefine this ExtendedType object to represent a different extended type. * This is intended to be used ONLY on the hashET object. Using it elsewhere * will mess up existing hashtable entries! */ protected void redefine(int nodetype, String namespace, String localName) { this.nodetype = nodetype; this.namespace = namespace; this.localName = localName; this.hash = nodetype + namespace.hashCode() + localName.hashCode(); } /** * Redefine this ExtendedType object to represent a different extended type. * This is intended to be used ONLY on the hashET object. Using it elsewhere * will mess up existing hashtable entries! */ protected void redefine(int nodetype, String namespace, String localName, int hash) { this.nodetype = nodetype; this.namespace = namespace; this.localName = localName; this.hash = hash; } /** * Override the hashCode() method in the Object class */ public int hashCode() { return hash; } /** * Test if this ExtendedType object is equal to the given ExtendedType. * * @param other The other ExtendedType object to test for equality * @return true if the two ExtendedType objects are equal. */ public boolean equals(ExtendedType other) { try { return other.nodetype == this.nodetype && other.localName.equals(this.localName) && other.namespace.equals(this.namespace); } catch(NullPointerException e) { return false; } } /** * Return the node type */ public int getNodeType() { return nodetype; } /** * Return the local name */ public String getLocalName() { return localName; } /** * Return the namespace */ public String getNamespace() { return namespace; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/dom2dtm/0000755000175000017500000000000010736146354021616 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java0000644000175000017500000006741410721374033031670 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM2DTMdefaultNamespaceDeclarationNode.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref.dom2dtm; import org.apache.xml.dtm.DTMException; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import org.w3c.dom.UserDataHandler; import org.w3c.dom.DOMException; /** This is a kluge to let us shove a declaration for xml: into the * DOM2DTM model. Basically, it creates a proxy node in DOM space to * carry the additional information. This is _NOT_ a full DOM * implementation, and shouldn't be one since it sits alongside the * DOM rather than becoming part of the DOM model. * * (This used to be an internal class within DOM2DTM. Moved out because * I need to perform an instanceof operation on it to support a temporary * workaround in DTMManagerDefault.) * * %REVIEW% What if the DOM2DTM was built around a DocumentFragment and * there isn't a single root element? I think this fails that case... * * %REVIEW% An alternative solution would be to create the node _only_ * in DTM space, but given how DOM2DTM is currently written I think * this is simplest. * */ public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr,TypeInfo { final String NOT_SUPPORTED_ERR="Unsupported operation on pseudonode"; Element pseudoparent; String prefix,uri,nodename; int handle; DOM2DTMdefaultNamespaceDeclarationNode(Element pseudoparent,String prefix,String uri,int handle) { this.pseudoparent=pseudoparent; this.prefix=prefix; this.uri=uri; this.handle=handle; this.nodename="xmlns:"+prefix; } public String getNodeName() {return nodename;} public String getName() {return nodename;} public String getNamespaceURI() {return "http://www.w3.org/2000/xmlns/";} public String getPrefix() {return prefix;} public String getLocalName() {return prefix;} public String getNodeValue() {return uri;} public String getValue() {return uri;} public Element getOwnerElement() {return pseudoparent;} public boolean isSupported(String feature, String version) {return false;} public boolean hasChildNodes() {return false;} public boolean hasAttributes() {return false;} public Node getParentNode() {return null;} public Node getFirstChild() {return null;} public Node getLastChild() {return null;} public Node getPreviousSibling() {return null;} public Node getNextSibling() {return null;} public boolean getSpecified() {return false;} public void normalize() {return;} public NodeList getChildNodes() {return null;} public NamedNodeMap getAttributes() {return null;} public short getNodeType() {return Node.ATTRIBUTE_NODE;} public void setNodeValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);} public void setValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);} public void setPrefix(String value) {throw new DTMException(NOT_SUPPORTED_ERR);} public Node insertBefore(Node a, Node b) {throw new DTMException(NOT_SUPPORTED_ERR);} public Node replaceChild(Node a, Node b) {throw new DTMException(NOT_SUPPORTED_ERR);} public Node appendChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);} public Node removeChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);} public Document getOwnerDocument() {return pseudoparent.getOwnerDocument();} public Node cloneNode(boolean deep) {throw new DTMException(NOT_SUPPORTED_ERR);} /** Non-DOM method, part of the temporary kluge * %REVIEW% This would be a pruning problem, but since it will always be * added to the root element and we prune on elements, we shouldn't have * to worry. */ public int getHandleOfNode() { return handle; } //RAMESH: PENDING=> Add proper implementation for the below DOM L3 additions /** * @see org.w3c.dom.TypeInfo#getTypeName() */ public String getTypeName() {return null; } /** * @see org.w3c.dom.TypeInfo#getTypeNamespace() */ public String getTypeNamespace() { return null;} /** * @see or.gw3c.dom.TypeInfo#isDerivedFrom(String,String,int) */ public boolean isDerivedFrom( String ns, String localName, int derivationMethod ) { return false; } public TypeInfo getSchemaTypeInfo() { return this; } public boolean isId( ) { return false; } /** * Associate an object to a key on this node. The object can later be * retrieved from this node by calling getUserData with the * same key. * @param key The key to associate the object to. * @param data The object to associate to the given key, or * null to remove any existing association to that key. * @param handler The handler to associate to that key, or * null. * @return Returns the DOMObject previously associated to * the given key on this node, or null if there was none. * @since DOM Level 3 */ public Object setUserData(String key, Object data, UserDataHandler handler) { return getOwnerDocument().setUserData( key, data, handler); } /** * Retrieves the object associated to a key on a this node. The object * must first have been set to this node by calling * setUserData with the same key. * @param key The key the object is associated to. * @return Returns the DOMObject associated to the given key * on this node, or null if there was none. * @since DOM Level 3 */ public Object getUserData(String key) { return getOwnerDocument().getUserData( key); } /** * This method returns a specialized object which implements the * specialized APIs of the specified feature and version. The * specialized object may also be obtained by using binding-specific * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations. * @param feature The name of the feature requested (case-insensitive). * @param version This is the version number of the feature to test. If * the version is null or the empty string, supporting * any version of the feature will cause the method to return an * object that supports at least one version of the feature. * @return Returns an object which implements the specialized APIs of * the specified feature and version, if any, or null if * there is no object which implements interfaces associated with that * feature. If the DOMObject returned by this method * implements the Node interface, it must delegate to the * primary core Node and not return results inconsistent * with the primary core Node such as attributes, * childNodes, etc. * @since DOM Level 3 */ public Object getFeature(String feature, String version) { // we don't have any alternate node, either this node does the job // or we don't have anything that does return isSupported(feature, version) ? this : null; } /** * Tests whether two nodes are equal. *
    This method tests for equality of nodes, not sameness (i.e., * whether the two nodes are references to the same object) which can be * tested with Node.isSameNode. All nodes that are the same * will also be equal, though the reverse may not be true. *
    Two nodes are equal if and only if the following conditions are * satisfied: The two nodes are of the same type.The following string * attributes are equal: nodeName, localName, * namespaceURI, prefix, nodeValue * , baseURI. This is: they are both null, or * they have the same length and are character for character identical. * The attributes NamedNodeMaps are equal. * This is: they are both null, or they have the same * length and for each node that exists in one map there is a node that * exists in the other map and is equal, although not necessarily at the * same index.The childNodes NodeLists are * equal. This is: they are both null, or they have the * same length and contain equal nodes at the same index. This is true * for Attr nodes as for any other type of node. Note that * normalization can affect equality; to avoid this, nodes should be * normalized before being compared. *
    For two DocumentType nodes to be equal, the following * conditions must also be satisfied: The following string attributes * are equal: publicId, systemId, * internalSubset.The entities * NamedNodeMaps are equal.The notations * NamedNodeMaps are equal. *
    On the other hand, the following do not affect equality: the * ownerDocument attribute, the specified * attribute for Attr nodes, the * isWhitespaceInElementContent attribute for * Text nodes, as well as any user data or event listeners * registered on the nodes. * @param arg The node to compare equality with. * @param deep If true, recursively compare the subtrees; if * false, compare only the nodes themselves (and its * attributes, if it is an Element). * @return If the nodes, and possibly subtrees are equal, * true otherwise false. * @since DOM Level 3 */ public boolean isEqualNode(Node arg) { if (arg == this) { return true; } if (arg.getNodeType() != getNodeType()) { return false; } // in theory nodeName can't be null but better be careful // who knows what other implementations may be doing?... if (getNodeName() == null) { if (arg.getNodeName() != null) { return false; } } else if (!getNodeName().equals(arg.getNodeName())) { return false; } if (getLocalName() == null) { if (arg.getLocalName() != null) { return false; } } else if (!getLocalName().equals(arg.getLocalName())) { return false; } if (getNamespaceURI() == null) { if (arg.getNamespaceURI() != null) { return false; } } else if (!getNamespaceURI().equals(arg.getNamespaceURI())) { return false; } if (getPrefix() == null) { if (arg.getPrefix() != null) { return false; } } else if (!getPrefix().equals(arg.getPrefix())) { return false; } if (getNodeValue() == null) { if (arg.getNodeValue() != null) { return false; } } else if (!getNodeValue().equals(arg.getNodeValue())) { return false; } /* if (getBaseURI() == null) { if (((NodeImpl) arg).getBaseURI() != null) { return false; } } else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) { return false; } */ return true; } /** * DOM Level 3 - Experimental: * Look up the namespace URI associated to the given prefix, starting from this node. * Use lookupNamespaceURI(null) to lookup the default namespace * * @param namespaceURI * @return th URI for the namespace * @since DOM Level 3 */ public String lookupNamespaceURI(String specifiedPrefix) { short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE : { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (namespace !=null) { // REVISIT: is it possible that prefix is empty string? if (specifiedPrefix== null && prefix==specifiedPrefix) { // looking for default namespace return namespace; } else if (prefix != null && prefix.equals(specifiedPrefix)) { // non default namespace return namespace; } } if (this.hasAttributes()) { NamedNodeMap map = this.getAttributes(); int length = map.getLength(); for (int i=0;inamespaceURI is the * default namespace or not. * @param namespaceURI The namespace URI to look for. * @return true if the specified namespaceURI * is the default namespace, false otherwise. * @since DOM Level 3 */ public boolean isDefaultNamespace(String namespaceURI){ /* // REVISIT: remove casts when DOM L3 becomes REC. short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); // REVISIT: is it possible that prefix is empty string? if (prefix == null || prefix.length() == 0) { if (namespaceURI == null) { return (namespace == namespaceURI); } return namespaceURI.equals(namespace); } if (this.hasAttributes()) { ElementImpl elem = (ElementImpl)this; NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns"); if (attr != null) { String value = attr.getNodeValue(); if (namespaceURI == null) { return (namespace == value); } return namespaceURI.equals(value); } } NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); } return false; } case Node.DOCUMENT_NODE:{ return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI); } case Node.ENTITY_NODE : case Node.NOTATION_NODE: case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE: // type is unknown return false; case Node.ATTRIBUTE_NODE:{ if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) { return ownerNode.isDefaultNamespace(namespaceURI); } return false; } default:{ NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); } return false; } } */ return false; } /** * * DOM Level 3 - Experimental: * Look up the prefix associated to the given namespace URI, starting from this node. * * @param namespaceURI * @return the prefix for the namespace */ public String lookupPrefix(String namespaceURI){ // REVISIT: When Namespaces 1.1 comes out this may not be true // Prefix can't be bound to null namespace if (namespaceURI == null) { return null; } short type = this.getNodeType(); switch (type) { /* case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); // to flip out children return lookupNamespacePrefix(namespaceURI, (ElementImpl)this); } case Node.DOCUMENT_NODE:{ return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI); } */ case Node.ENTITY_NODE : case Node.NOTATION_NODE: case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE: // type is unknown return null; case Node.ATTRIBUTE_NODE:{ if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) { return getOwnerElement().lookupPrefix(namespaceURI); } return null; } default:{ /* NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.lookupPrefix(namespaceURI); } */ return null; } } } /** * Returns whether this node is the same node as the given one. *
    This method provides a way to determine whether two * Node references returned by the implementation reference * the same object. When two Node references are references * to the same object, even if through a proxy, the references may be * used completely interchangably, such that all attributes have the * same values and calling the same DOM method on either reference * always has exactly the same effect. * @param other The node to test against. * @return Returns true if the nodes are the same, * false otherwise. * @since DOM Level 3 */ public boolean isSameNode(Node other) { // we do not use any wrapper so the answer is obvious return this == other; } /** * This attribute returns the text content of this node and its * descendants. When it is defined to be null, setting it has no effect. * When set, any possible children this node may have are removed and * replaced by a single Text node containing the string * this attribute is set to. On getting, no serialization is performed, * the returned string does not contain any markup. No whitespace * normalization is performed, the returned string does not contain the * element content whitespaces . Similarly, on setting, no parsing is * performed either, the input string is taken as pure textual content. *
    The string returned is made of the text content of this node * depending on its type, as defined below: * * * * * * * * * * * * * * * * * *
    Node typeContent
    * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent * attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes
    ATTRIBUTE_NODE, TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE * nodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE * null
    * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @exception DOMException * DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. * @since DOM Level 3 */ public void setTextContent(String textContent) throws DOMException { setNodeValue(textContent); } /** * This attribute returns the text content of this node and its * descendants. When it is defined to be null, setting it has no effect. * When set, any possible children this node may have are removed and * replaced by a single Text node containing the string * this attribute is set to. On getting, no serialization is performed, * the returned string does not contain any markup. No whitespace * normalization is performed, the returned string does not contain the * element content whitespaces . Similarly, on setting, no parsing is * performed either, the input string is taken as pure textual content. *
    The string returned is made of the text content of this node * depending on its type, as defined below: * * * * * * * * * * * * * * * * * *
    Node typeContent
    * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent * attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes
    ATTRIBUTE_NODE, TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE * nodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE * null
    * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @exception DOMException * DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. * @since DOM Level 3 */ public String getTextContent() throws DOMException { return getNodeValue(); // overriden in some subclasses } /** * Compares a node with this node with regard to their position in the * document. * @param other The node to compare against this node. * @return Returns how the given node is positioned relatively to this * node. * @since DOM Level 3 */ public short compareDocumentPosition(Node other) throws DOMException { return 0; } /** * The absolute base URI of this node or null if undefined. * This value is computed according to . However, when the * Document supports the feature "HTML" , the base URI is * computed using first the value of the href attribute of the HTML BASE * element if any, and the value of the documentURI * attribute from the Document interface otherwise. *
    When the node is an Element, a Document * or a a ProcessingInstruction, this attribute represents * the properties [base URI] defined in . When the node is a * Notation, an Entity, or an * EntityReference, this attribute represents the * properties [declaration base URI] in the . How will this be affected * by resolution of relative namespace URIs issue?It's not.Should this * only be on Document, Element, ProcessingInstruction, Entity, and * Notation nodes, according to the infoset? If not, what is it equal to * on other nodes? Null? An empty string? I think it should be the * parent's.No.Should this be read-only and computed or and actual * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and * teleconference 30 May 2001).If the base HTML element is not yet * attached to a document, does the insert change the Document.baseURI? * Yes. (F2F 26 Sep 2001) * @since DOM Level 3 */ public String getBaseURI() { return null; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java0000644000175000017500000016422210721374031023523 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM2DTM.java 478671 2006-11-23 21:00:31Z minchau $ */ package org.apache.xml.dtm.ref.dom2dtm; import java.util.Vector; import javax.xml.transform.SourceLocator; import javax.xml.transform.dom.DOMSource; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.dtm.ref.DTMDefaultBaseIterators; import org.apache.xml.dtm.ref.DTMManagerDefault; import org.apache.xml.dtm.ref.ExpandedNameTable; import org.apache.xml.dtm.ref.IncrementalSAXSource; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.QName; import org.apache.xml.utils.StringBufferPool; import org.apache.xml.utils.TreeWalker; import org.apache.xml.utils.XMLCharacterRecognizer; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.Entity; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; /** The DOM2DTM class serves up a DOM's contents via the * DTM API. * * Note that it doesn't necessarily represent a full Document * tree. You can wrap a DOM2DTM around a specific node and its subtree * and the right things should happen. (I don't _think_ we currently * support DocumentFrgment nodes as roots, though that might be worth * considering.) * * Note too that we do not currently attempt to track document * mutation. If you alter the DOM after wrapping DOM2DTM around it, * all bets are off. * */ public class DOM2DTM extends DTMDefaultBaseIterators { static final boolean JJK_DEBUG=false; static final boolean JJK_NEWCODE=true; /** Manefest constant */ static final String NAMESPACE_DECL_NS="http://www.w3.org/XML/1998/namespace"; /** The current position in the DOM tree. Last node examined for * possible copying to DTM. */ transient private Node m_pos; /** The current position in the DTM tree. Who children get appended to. */ private int m_last_parent=0; /** The current position in the DTM tree. Who children reference as their * previous sib. */ private int m_last_kid=NULL; /** The top of the subtree. * %REVIEW%: 'may not be the same as m_context if "//foo" pattern.' * */ transient private Node m_root; /** True iff the first element has been processed. This is used to control synthesis of the implied xml: namespace declaration node. */ boolean m_processedFirstElement=false; /** true if ALL the nodes in the m_root subtree have been processed; * false if our incremental build has not yet finished scanning the * DOM tree. */ transient private boolean m_nodesAreProcessed; /** The node objects. The instance part of the handle indexes * directly into this vector. Each DTM node may actually be * composed of several DOM nodes (for example, if logically-adjacent * Text/CDATASection nodes in the DOM have been coalesced into a * single DTM Text node); this table points only to the first in * that sequence. */ protected Vector m_nodes = new Vector(); /** * Construct a DOM2DTM object from a DOM node. * * @param mgr The DTMManager who owns this DTM. * @param domSource the DOM source that this DTM will wrap. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory XMLString factory for creating character content. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. */ public DOM2DTM(DTMManager mgr, DOMSource domSource, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { super(mgr, domSource, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing); // Initialize DOM navigation m_pos=m_root = domSource.getNode(); // Initialize DTM navigation m_last_parent=m_last_kid=NULL; m_last_kid=addNode(m_root, m_last_parent,m_last_kid, NULL); // Apparently the domSource root may not actually be the // Document node. If it's an Element node, we need to immediately // add its attributes. Adapted from nextNode(). // %REVIEW% Move this logic into addNode and recurse? Cleaner! // // (If it's an EntityReference node, we're probably in // seriously bad trouble. For now // I'm just hoping nobody is ever quite that foolish... %REVIEW%) // // %ISSUE% What about inherited namespaces in this case? // Do we need to special-case initialize them into the DTM model? if(ELEMENT_NODE == m_root.getNodeType()) { NamedNodeMap attrs=m_root.getAttributes(); int attrsize=(attrs==null) ? 0 : attrs.getLength(); if(attrsize>0) { int attrIndex=NULL; // start with no previous sib for(int i=0;i>>DTMManager.IDENT_DTM_NODE_BITS)) { try { if(m_mgr==null) throw new ClassCastException(); // Handle as Extended Addressing DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr; int id=mgrD.getFirstFreeDTMID(); mgrD.addDTM(this,id,nodeIndex); m_dtmIdent.addElement(id<0) { for(int i=0;i= m_nodes.size()) { if (!nextNode()) identity = DTM.NULL; } return identity; } /** * Get the handle from a Node. *

    %OPT% This will be pretty slow.

    * *

    %OPT% An XPath-like search (walk up DOM to root, tracking path; * walk down DTM reconstructing path) might be considerably faster * on later nodes in large documents. That might also imply improving * this call to handle nodes which would be in this DTM but * have not yet been built, which might or might not be a Good Thing.

    * * %REVIEW% This relies on being able to test node-identity via * object-identity. DTM2DOM proxying is a great example of a case where * that doesn't work. DOM Level 3 will provide the isSameNode() method * to fix that, but until then this is going to be flaky. * * @param node A node, which may be null. * * @return The node handle or DTM.NULL. */ private int getHandleFromNode(Node node) { if (null != node) { int len = m_nodes.size(); boolean isMore; int i = 0; do { for (; i < len; i++) { if (m_nodes.elementAt(i) == node) return makeNodeHandle(i); } isMore = nextNode(); len = m_nodes.size(); } while(isMore || i < len); } return DTM.NULL; } /** Get the handle from a Node. This is a more robust version of * getHandleFromNode, intended to be usable by the public. * *

    %OPT% This will be pretty slow.

    * * %REVIEW% This relies on being able to test node-identity via * object-identity. DTM2DOM proxying is a great example of a case where * that doesn't work. DOM Level 3 will provide the isSameNode() method * to fix that, but until then this is going to be flaky. * * @param node A node, which may be null. * * @return The node handle or DTM.NULL. */ public int getHandleOfNode(Node node) { if (null != node) { // Is Node actually within the same document? If not, don't search! // This would be easier if m_root was always the Document node, but // we decided to allow wrapping a DTM around a subtree. if((m_root==node) || (m_root.getNodeType()==DOCUMENT_NODE && m_root==node.getOwnerDocument()) || (m_root.getNodeType()!=DOCUMENT_NODE && m_root.getOwnerDocument()==node.getOwnerDocument()) ) { // If node _is_ in m_root's tree, find its handle // // %OPT% This check may be improved significantly when DOM // Level 3 nodeKey and relative-order tests become // available! for(Node cursor=node; cursor!=null; cursor= (cursor.getNodeType()!=ATTRIBUTE_NODE) ? cursor.getParentNode() : ((org.w3c.dom.Attr)cursor).getOwnerElement()) { if(cursor==m_root) // We know this node; find its handle. return getHandleFromNode(node); } // for ancestors of node } // if node and m_root in same Document } // if node!=null return DTM.NULL; } /** * Retrieves an attribute node by by qualified name and namespace URI. * * @param nodeHandle int Handle of the node upon which to look up this attribute.. * @param namespaceURI The namespace URI of the attribute to * retrieve, or null. * @param name The local name of the attribute to * retrieve. * @return The attribute node handle with the specified name ( * nodeName) or DTM.NULL if there is no such * attribute. */ public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { // %OPT% This is probably slower than it needs to be. if (null == namespaceURI) namespaceURI = ""; int type = getNodeType(nodeHandle); if (DTM.ELEMENT_NODE == type) { // Assume that attributes immediately follow the element. int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { // Assume this can not be null. type = _type(identity); // %REVIEW% // Should namespace nodes be retrievable DOM-style as attrs? // If not we need a separate function... which may be desirable // architecturally, but which is ugly from a code point of view. // (If we REALLY insist on it, this code should become a subroutine // of both -- retrieve the node, then test if the type matches // what you're looking for.) if (type == DTM.ATTRIBUTE_NODE || type==DTM.NAMESPACE_NODE) { Node node = lookupNode(identity); String nodeuri = node.getNamespaceURI(); if (null == nodeuri) nodeuri = ""; String nodelocalname = node.getLocalName(); if (nodeuri.equals(namespaceURI) && name.equals(nodelocalname)) return makeNodeHandle(identity); } else // if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; } /** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { int type = getNodeType(nodeHandle); Node node = getNode(nodeHandle); // %TBD% If an element only has one text node, we should just use it // directly. if(DTM.ELEMENT_NODE == type || DTM.DOCUMENT_NODE == type || DTM.DOCUMENT_FRAGMENT_NODE == type) { FastStringBuffer buf = StringBufferPool.get(); String s; try { getNodeData(node, buf); s = (buf.length() > 0) ? buf.toString() : ""; } finally { StringBufferPool.free(buf); } return m_xstrf.newstr( s ); } else if(TEXT_NODE == type || CDATA_SECTION_NODE == type) { // If this is a DTM text node, it may be made of multiple DOM text // nodes -- including navigating into Entity References. DOM2DTM // records the first node in the sequence and requires that we // pick up the others when we retrieve the DTM node's value. // // %REVIEW% DOM Level 3 is expected to add a "whole text" // retrieval method which performs this function for us. FastStringBuffer buf = StringBufferPool.get(); while(node!=null) { buf.append(node.getNodeValue()); node=logicalNextDOMTextNode(node); } String s=(buf.length() > 0) ? buf.toString() : ""; StringBufferPool.free(buf); return m_xstrf.newstr( s ); } else return m_xstrf.newstr( node.getNodeValue() ); } /** * Determine if the string-value of a node is whitespace * * @param nodeHandle The node Handle. * * @return Return true if the given node is whitespace. */ public boolean isWhitespace(int nodeHandle) { int type = getNodeType(nodeHandle); Node node = getNode(nodeHandle); if(TEXT_NODE == type || CDATA_SECTION_NODE == type) { // If this is a DTM text node, it may be made of multiple DOM text // nodes -- including navigating into Entity References. DOM2DTM // records the first node in the sequence and requires that we // pick up the others when we retrieve the DTM node's value. // // %REVIEW% DOM Level 3 is expected to add a "whole text" // retrieval method which performs this function for us. FastStringBuffer buf = StringBufferPool.get(); while(node!=null) { buf.append(node.getNodeValue()); node=logicalNextDOMTextNode(node); } boolean b = buf.isWhitespace(0, buf.length()); StringBufferPool.free(buf); return b; } return false; } /** * Retrieve the text content of a DOM subtree, appending it into a * user-supplied FastStringBuffer object. Note that attributes are * not considered part of the content of an element. *

    * There are open questions regarding whitespace stripping. * Currently we make no special effort in that regard, since the standard * DOM doesn't yet provide DTD-based information to distinguish * whitespace-in-element-context from genuine #PCDATA. Note that we * should probably also consider xml:space if/when we address this. * DOM Level 3 may solve the problem for us. *

    * %REVIEW% Actually, since this method operates on the DOM side of the * fence rather than the DTM side, it SHOULDN'T do * any special handling. The DOM does what the DOM does; if you want * DTM-level abstractions, use DTM-level methods. * * @param node Node whose subtree is to be walked, gathering the * contents of all Text or CDATASection nodes. * @param buf FastStringBuffer into which the contents of the text * nodes are to be concatenated. */ protected static void getNodeData(Node node, FastStringBuffer buf) { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE : case Node.DOCUMENT_NODE : case Node.ELEMENT_NODE : { for (Node child = node.getFirstChild(); null != child; child = child.getNextSibling()) { getNodeData(child, buf); } } break; case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node buf.append(node.getNodeValue()); break; case Node.PROCESSING_INSTRUCTION_NODE : // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING); break; default : // ignore break; } } /** * Given a node handle, return its DOM-style node name. This will * include names such as #text or #document. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. * %REVIEW% Document when empty string is possible... * %REVIEW-COMMENT% It should never be empty, should it? */ public String getNodeName(int nodeHandle) { Node node = getNode(nodeHandle); // Assume non-null. return node.getNodeName(); } /** * Given a node handle, return the XPath node name. This should be * the name as described by the XPath data model, NOT the DOM-style * name. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. */ public String getNodeNameX(int nodeHandle) { String name; short type = getNodeType(nodeHandle); switch (type) { case DTM.NAMESPACE_NODE : { Node node = getNode(nodeHandle); // assume not null. name = node.getNodeName(); if(name.startsWith("xmlns:")) { name = QName.getLocalPart(name); } else if(name.equals("xmlns")) { name = ""; } } break; case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : case DTM.ENTITY_REFERENCE_NODE : case DTM.PROCESSING_INSTRUCTION_NODE : { Node node = getNode(nodeHandle); // assume not null. name = node.getNodeName(); } break; default : name = ""; } return name; } /** * Given a node handle, return its XPath-style localname. * (As defined in Namespaces, this is the portion of the name after any * colon character). * * @param nodeHandle the id of the node. * @return String Local name of this node. */ public String getLocalName(int nodeHandle) { if(JJK_NEWCODE) { int id=makeNodeIdentity(nodeHandle); if(NULL==id) return null; Node newnode=(Node)m_nodes.elementAt(id); String newname=newnode.getLocalName(); if (null == newname) { // XSLT treats PIs, and possibly other things, as having QNames. String qname = newnode.getNodeName(); if('#'==qname.charAt(0)) { // Match old default for this function // This conversion may or may not be necessary newname=""; } else { int index = qname.indexOf(':'); newname = (index < 0) ? qname : qname.substring(index + 1); } } return newname; } else { String name; short type = getNodeType(nodeHandle); switch (type) { case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : case DTM.ENTITY_REFERENCE_NODE : case DTM.NAMESPACE_NODE : case DTM.PROCESSING_INSTRUCTION_NODE : { Node node = getNode(nodeHandle); // assume not null. name = node.getLocalName(); if (null == name) { String qname = node.getNodeName(); int index = qname.indexOf(':'); name = (index < 0) ? qname : qname.substring(index + 1); } } break; default : name = ""; } return name; } } /** * Given a namespace handle, return the prefix that the namespace decl is * mapping. * Given a node handle, return the prefix used to map to the namespace. * *

    %REVIEW% Are you sure you want "" for no prefix?

    *

    %REVIEW-COMMENT% I think so... not totally sure. -sb

    * * @param nodeHandle the id of the node. * @return String prefix of this node's name, or "" if no explicit * namespace prefix was given. */ public String getPrefix(int nodeHandle) { String prefix; short type = getNodeType(nodeHandle); switch (type) { case DTM.NAMESPACE_NODE : { Node node = getNode(nodeHandle); // assume not null. String qname = node.getNodeName(); int index = qname.indexOf(':'); prefix = (index < 0) ? "" : qname.substring(index + 1); } break; case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : { Node node = getNode(nodeHandle); // assume not null. String qname = node.getNodeName(); int index = qname.indexOf(':'); prefix = (index < 0) ? "" : qname.substring(0, index); } break; default : prefix = ""; } return prefix; } /** * Given a node handle, return its DOM-style namespace URI * (As defined in Namespaces, this is the declared URI which this node's * prefix -- or default in lieu thereof -- was mapped to.) * *

    %REVIEW% Null or ""? -sb

    * * @param nodeHandle the id of the node. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceURI(int nodeHandle) { if(JJK_NEWCODE) { int id=makeNodeIdentity(nodeHandle); if(id==NULL) return null; Node node=(Node)m_nodes.elementAt(id); return node.getNamespaceURI(); } else { String nsuri; short type = getNodeType(nodeHandle); switch (type) { case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : case DTM.ENTITY_REFERENCE_NODE : case DTM.NAMESPACE_NODE : case DTM.PROCESSING_INSTRUCTION_NODE : { Node node = getNode(nodeHandle); // assume not null. nsuri = node.getNamespaceURI(); // %TBD% Handle DOM1? } break; default : nsuri = null; } return nsuri; } } /** Utility function: Given a DOM Text node, determine whether it is * logically followed by another Text or CDATASection node. This may * involve traversing into Entity References. * * %REVIEW% DOM Level 3 is expected to add functionality which may * allow us to retire this. */ private Node logicalNextDOMTextNode(Node n) { Node p=n.getNextSibling(); if(p==null) { // Walk out of any EntityReferenceNodes that ended with text for(n=n.getParentNode(); n!=null && ENTITY_REFERENCE_NODE == n.getNodeType(); n=n.getParentNode()) { p=n.getNextSibling(); if(p!=null) break; } } n=p; while(n!=null && ENTITY_REFERENCE_NODE == n.getNodeType()) { // Walk into any EntityReferenceNodes that start with text if(n.hasChildNodes()) n=n.getFirstChild(); else n=n.getNextSibling(); } if(n!=null) { // Found a logical next sibling. Is it text? int ntype=n.getNodeType(); if(TEXT_NODE != ntype && CDATA_SECTION_NODE != ntype) n=null; } return n; } /** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. *

    * * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public String getNodeValue(int nodeHandle) { // The _type(nodeHandle) call was taking the lion's share of our // time, and was wrong anyway since it wasn't coverting handle to // identity. Inlined it. int type = _exptype(makeNodeIdentity(nodeHandle)); type=(NULL != type) ? getNodeType(nodeHandle) : NULL; if(TEXT_NODE!=type && CDATA_SECTION_NODE!=type) return getNode(nodeHandle).getNodeValue(); // If this is a DTM text node, it may be made of multiple DOM text // nodes -- including navigating into Entity References. DOM2DTM // records the first node in the sequence and requires that we // pick up the others when we retrieve the DTM node's value. // // %REVIEW% DOM Level 3 is expected to add a "whole text" // retrieval method which performs this function for us. Node node = getNode(nodeHandle); Node n=logicalNextDOMTextNode(node); if(n==null) return node.getNodeValue(); FastStringBuffer buf = StringBufferPool.get(); buf.append(node.getNodeValue()); while(n!=null) { buf.append(n.getNodeValue()); n=logicalNextDOMTextNode(n); } String s = (buf.length() > 0) ? buf.toString() : ""; StringBufferPool.free(buf); return s; } /** * A document type declaration information item has the following properties: * * 1. [system identifier] The system identifier of the external subset, if * it exists. Otherwise this property has no value. * * @return the system identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationSystemIdentifier() { Document doc; if (m_root.getNodeType() == Node.DOCUMENT_NODE) doc = (Document) m_root; else doc = m_root.getOwnerDocument(); if (null != doc) { DocumentType dtd = doc.getDoctype(); if (null != dtd) { return dtd.getSystemId(); } } return null; } /** * Return the public identifier of the external subset, * normalized as described in 4.2.2 External Entities [XML]. If there is * no external subset or if it has no public identifier, this property * has no value. * * @return the public identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationPublicIdentifier() { Document doc; if (m_root.getNodeType() == Node.DOCUMENT_NODE) doc = (Document) m_root; else doc = m_root.getOwnerDocument(); if (null != doc) { DocumentType dtd = doc.getDoctype(); if (null != dtd) { return dtd.getPublicId(); } } return null; } /** * Returns the Element whose ID is given by * elementId. If no such element exists, returns * DTM.NULL. Behavior is not defined if more than one element * has this ID. Attributes (including those * with the name "ID") are not of type ID unless so defined by DTD/Schema * information available to the DTM implementation. * Implementations that do not know whether attributes are of type ID or * not are expected to return DTM.NULL. * *

    %REVIEW% Presumably IDs are still scoped to a single document, * and this operation searches only within a single document, right? * Wouldn't want collisions between DTMs in the same process.

    * * @param elementId The unique id value for an element. * @return The handle of the matching element. */ public int getElementById(String elementId) { Document doc = (m_root.getNodeType() == Node.DOCUMENT_NODE) ? (Document) m_root : m_root.getOwnerDocument(); if(null != doc) { Node elem = doc.getElementById(elementId); if(null != elem) { int elemHandle = getHandleFromNode(elem); if(DTM.NULL == elemHandle) { int identity = m_nodes.size()-1; while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { Node node = getNode(identity); if(node == elem) { elemHandle = getHandleFromNode(elem); break; } } } return elemHandle; } } return DTM.NULL; } /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. *

    * XML processors may choose to use the System Identifier (if one * is provided) to resolve the entity, rather than the URI in the * Public Identifier. The details are dependent on the processor, and * we would have to support some form of plug-in resolver to handle * this properly. Currently, we simply return the System Identifier if * present, and hope that it a usable URI or that our caller can * map it to one. * TODO: Resolve Public Identifiers... or consider changing function name. *

    * If we find a relative URI * reference, XML expects it to be resolved in terms of the base URI * of the document. The DOM doesn't do that for us, and it isn't * entirely clear whether that should be done here; currently that's * pushed up to a higher level of our application. (Note that DOM Level * 1 didn't store the document's base URI.) * TODO: Consider resolving Relative URIs. *

    * (The DOM's statement that "An XML processor may choose to * completely expand entities before the structure model is passed * to the DOM" refers only to parsed entities, not unparsed, and hence * doesn't affect this function.) * * @param name A string containing the Entity Name of the unparsed * entity. * * @return String containing the URI of the Unparsed Entity, or an * empty string if no such entity exists. */ public String getUnparsedEntityURI(String name) { String url = ""; Document doc = (m_root.getNodeType() == Node.DOCUMENT_NODE) ? (Document) m_root : m_root.getOwnerDocument(); if (null != doc) { DocumentType doctype = doc.getDoctype(); if (null != doctype) { NamedNodeMap entities = doctype.getEntities(); if(null == entities) return url; Entity entity = (Entity) entities.getNamedItem(name); if(null == entity) return url; String notationName = entity.getNotationName(); if (null != notationName) // then it's unparsed { // The draft says: "The XSLT processor may use the public // identifier to generate a URI for the entity instead of the URI // specified in the system identifier. If the XSLT processor does // not use the public identifier to generate the URI, it must use // the system identifier; if the system identifier is a relative // URI, it must be resolved into an absolute URI using the URI of // the resource containing the entity declaration as the base // URI [RFC2396]." // So I'm falling a bit short here. url = entity.getSystemId(); if (null == url) { url = entity.getPublicId(); } else { // This should be resolved to an absolute URL, but that's hard // to do from here. } } } } return url; } /** * 5. [specified] A flag indicating whether this attribute was actually * specified in the start-tag of its element, or was defaulted from the * DTD. * * @param attributeHandle the attribute handle * @return true if the attribute was specified; * false if it was defaulted. */ public boolean isAttributeSpecified(int attributeHandle) { int type = getNodeType(attributeHandle); if (DTM.ATTRIBUTE_NODE == type) { Attr attr = (Attr)getNode(attributeHandle); return attr.getSpecified(); } return false; } /** Bind an IncrementalSAXSource to this DTM. NOT RELEVANT for DOM2DTM, since * we're wrapped around an existing DOM. * * @param source The IncrementalSAXSource that we want to recieve events from * on demand. */ public void setIncrementalSAXSource(IncrementalSAXSource source) { } /** getContentHandler returns "our SAX builder" -- the thing that * someone else should send SAX events to in order to extend this * DTM model. * * @return null if this model doesn't respond to SAX events, * "this" if the DTM object has a built-in SAX ContentHandler, * the IncrmentalSAXSource if we're bound to one and should receive * the SAX stream via it for incremental build purposes... * */ public org.xml.sax.ContentHandler getContentHandler() { return null; } /** * Return this DTM's lexical handler. * * %REVIEW% Should this return null if constrution already done/begun? * * @return null if this model doesn't respond to lexical SAX events, * "this" if the DTM object has a built-in SAX ContentHandler, * the IncrementalSAXSource if we're bound to one and should receive * the SAX stream via it for incremental build purposes... */ public org.xml.sax.ext.LexicalHandler getLexicalHandler() { return null; } /** * Return this DTM's EntityResolver. * * @return null if this model doesn't respond to SAX entity ref events. */ public org.xml.sax.EntityResolver getEntityResolver() { return null; } /** * Return this DTM's DTDHandler. * * @return null if this model doesn't respond to SAX dtd events. */ public org.xml.sax.DTDHandler getDTDHandler() { return null; } /** * Return this DTM's ErrorHandler. * * @return null if this model doesn't respond to SAX error events. */ public org.xml.sax.ErrorHandler getErrorHandler() { return null; } /** * Return this DTM's DeclHandler. * * @return null if this model doesn't respond to SAX Decl events. */ public org.xml.sax.ext.DeclHandler getDeclHandler() { return null; } /** @return true iff we're building this model incrementally (eg * we're partnered with a IncrementalSAXSource) and thus require that the * transformation and the parse run simultaneously. Guidance to the * DTMManager. * */ public boolean needsTwoThreads() { return false; } // ========== Direct SAX Dispatch, for optimization purposes ======== /** * Returns whether the specified ch conforms to the XML 1.0 definition * of whitespace. Refer to * the definition of S for details. * @param ch Character to check as XML whitespace. * @return =true if ch is XML whitespace; otherwise =false. */ private static boolean isSpace(char ch) { return XMLCharacterRecognizer.isWhiteSpace(ch); // Take the easy way out for now. } /** * Directly call the * characters method on the passed ContentHandler for the * string-value of the given node (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException { if(normalize) { XMLString str = getStringValue(nodeHandle); str = str.fixWhiteSpace(true, true, false); str.dispatchCharactersEvents(ch); } else { int type = getNodeType(nodeHandle); Node node = getNode(nodeHandle); dispatchNodeData(node, ch, 0); // Text coalition -- a DTM text node may represent multiple // DOM nodes. if(TEXT_NODE == type || CDATA_SECTION_NODE == type) { while( null != (node=logicalNextDOMTextNode(node)) ) { dispatchNodeData(node, ch, 0); } } } } /** * Retrieve the text content of a DOM subtree, appending it into a * user-supplied FastStringBuffer object. Note that attributes are * not considered part of the content of an element. *

    * There are open questions regarding whitespace stripping. * Currently we make no special effort in that regard, since the standard * DOM doesn't yet provide DTD-based information to distinguish * whitespace-in-element-context from genuine #PCDATA. Note that we * should probably also consider xml:space if/when we address this. * DOM Level 3 may solve the problem for us. *

    * %REVIEW% Note that as a DOM-level operation, it can be argued that this * routine _shouldn't_ perform any processing beyond what the DOM already * does, and that whitespace stripping and so on belong at the DTM level. * If you want a stripped DOM view, wrap DTM2DOM around DOM2DTM. * * @param node Node whose subtree is to be walked, gathering the * contents of all Text or CDATASection nodes. */ protected static void dispatchNodeData(Node node, org.xml.sax.ContentHandler ch, int depth) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE : case Node.DOCUMENT_NODE : case Node.ELEMENT_NODE : { for (Node child = node.getFirstChild(); null != child; child = child.getNextSibling()) { dispatchNodeData(child, ch, depth+1); } } break; case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW% case Node.COMMENT_NODE : if(0 != depth) break; // NOTE: Because this operation works in the DOM space, it does _not_ attempt // to perform Text Coalition. That should only be done in DTM space. case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : case Node.ATTRIBUTE_NODE : String str = node.getNodeValue(); if(ch instanceof CharacterNodeHandler) { ((CharacterNodeHandler)ch).characters(node); } else { ch.characters(str.toCharArray(), 0, str.length()); } break; // /* case Node.PROCESSING_INSTRUCTION_NODE : // // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING); // break; */ default : // ignore break; } } TreeWalker m_walker = new TreeWalker(null); /** * Directly create SAX parser events from a subtree. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { TreeWalker treeWalker = m_walker; ContentHandler prevCH = treeWalker.getContentHandler(); if(null != prevCH) { treeWalker = new TreeWalker(null); } treeWalker.setContentHandler(ch); try { Node node = getNode(nodeHandle); treeWalker.traverseFragment(node); } finally { treeWalker.setContentHandler(null); } } public interface CharacterNodeHandler { public void characters(Node node) throws org.xml.sax.SAXException; } /** * For the moment all the run time properties are ignored by this * class. * * @param property a String value * @param value an Object value */ public void setProperty(String property, Object value) { } /** * No source information is available for DOM2DTM, so return * null here. * * @param node an int value * @return null */ public SourceLocator getSourceLocatorFor(int node) { return null; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/NodeLocator.java0000644000175000017500000000566510721374031023325 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeLocator.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import javax.xml.transform.SourceLocator; /** * NodeLocator maintains information on an XML source * node. * * @author Ovidiu Predescu * @since May 23, 2001 */ public class NodeLocator implements SourceLocator { protected String m_publicId; protected String m_systemId; protected int m_lineNumber; protected int m_columnNumber; /** * Creates a new NodeLocator instance. * * @param publicId a String value * @param systemId a String value * @param lineNumber an int value * @param columnNumber an int value */ public NodeLocator(String publicId, String systemId, int lineNumber, int columnNumber) { this.m_publicId = publicId; this.m_systemId = systemId; this.m_lineNumber = lineNumber; this.m_columnNumber = columnNumber; } /** * getPublicId returns the public ID of the node. * * @return a String value */ public String getPublicId() { return m_publicId; } /** * getSystemId returns the system ID of the node. * * @return a String value */ public String getSystemId() { return m_systemId; } /** * getLineNumber returns the line number of the node. * * @return an int value */ public int getLineNumber() { return m_lineNumber; } /** * getColumnNumber returns the column number of the * node. * * @return an int value */ public int getColumnNumber() { return m_columnNumber; } /** * toString returns a string representation of this * NodeLocator instance. * * @return a String value */ public String toString() { return "file '" + m_systemId + "', line #" + m_lineNumber + ", column #" + m_columnNumber; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java0000644000175000017500000006643710721374031026423 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IncrementalSAXSource_Filter.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import java.io.IOException; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xml.utils.ThreadControllerWrapper; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.ext.LexicalHandler; /**

    IncrementalSAXSource_Filter implements IncrementalSAXSource, using a * standard SAX2 event source as its input and parcelling out those * events gradually in reponse to deliverMoreNodes() requests. Output from the * filter will be passed along to a SAX handler registered as our * listener, but those callbacks will pass through a counting stage * which periodically yields control back to the controller coroutine. *

    * *

    %REVIEW%: This filter is not currenly intended to be reusable * for parsing additional streams/documents. We may want to consider * making it resettable at some point in the future. But it's a * small object, so that'd be mostly a convenience issue; the cost * of allocating each time is trivial compared to the cost of processing * any nontrival stream.

    * *

    For a brief usage example, see the unit-test main() method.

    * *

    This is a simplification of the old CoroutineSAXParser, focusing * specifically on filtering. The resulting controller protocol is _far_ * simpler and less error-prone; the only controller operation is deliverMoreNodes(), * and the only requirement is that deliverMoreNodes(false) be called if you want to * discard the rest of the stream and the previous deliverMoreNodes() didn't return * false. * */ public class IncrementalSAXSource_Filter implements IncrementalSAXSource, ContentHandler, DTDHandler, LexicalHandler, ErrorHandler, Runnable { boolean DEBUG=false; //Internal status report // // Data // private CoroutineManager fCoroutineManager = null; private int fControllerCoroutineID = -1; private int fSourceCoroutineID = -1; private ContentHandler clientContentHandler=null; // %REVIEW% support multiple? private LexicalHandler clientLexicalHandler=null; // %REVIEW% support multiple? private DTDHandler clientDTDHandler=null; // %REVIEW% support multiple? private ErrorHandler clientErrorHandler=null; // %REVIEW% support multiple? private int eventcounter; private int frequency=5; // Flag indicating that no more events should be delivered -- either // because input stream ran to completion (endDocument), or because // the user requested an early stop via deliverMoreNodes(false). private boolean fNoMoreEvents=false; // Support for startParse() private XMLReader fXMLReader=null; private InputSource fXMLReaderInputSource=null; // // Constructors // public IncrementalSAXSource_Filter() { this.init( new CoroutineManager(), -1, -1); } /** Create a IncrementalSAXSource_Filter which is not yet bound to a specific * SAX event source. * */ public IncrementalSAXSource_Filter(CoroutineManager co, int controllerCoroutineID) { this.init( co, controllerCoroutineID, -1 ); } // // Factories // static public IncrementalSAXSource createIncrementalSAXSource(CoroutineManager co, int controllerCoroutineID) { return new IncrementalSAXSource_Filter(co, controllerCoroutineID); } // // Public methods // public void init( CoroutineManager co, int controllerCoroutineID, int sourceCoroutineID) { if(co==null) co = new CoroutineManager(); fCoroutineManager = co; fControllerCoroutineID = co.co_joinCoroutineSet(controllerCoroutineID); fSourceCoroutineID = co.co_joinCoroutineSet(sourceCoroutineID); if (fControllerCoroutineID == -1 || fSourceCoroutineID == -1) throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COJOINROUTINESET_FAILED, null)); //"co_joinCoroutineSet() failed"); fNoMoreEvents=false; eventcounter=frequency; } /** Bind our input streams to an XMLReader. * * Just a convenience routine; obviously you can explicitly register * this as a listener with the same effect. * */ public void setXMLReader(XMLReader eventsource) { fXMLReader=eventsource; eventsource.setContentHandler(this); eventsource.setDTDHandler(this); eventsource.setErrorHandler(this); // to report fatal errors in filtering mode // Not supported by all SAX2 filters: try { eventsource. setProperty("http://xml.org/sax/properties/lexical-handler", this); } catch(SAXNotRecognizedException e) { // Nothing we can do about it } catch(SAXNotSupportedException e) { // Nothing we can do about it } // Should we also bind as other varieties of handler? // (DTDHandler and so on) } // Register a content handler for us to output to public void setContentHandler(ContentHandler handler) { clientContentHandler=handler; } // Register a DTD handler for us to output to public void setDTDHandler(DTDHandler handler) { clientDTDHandler=handler; } // Register a lexical handler for us to output to // Not all filters support this... // ??? Should we register directly on the filter? // NOTE NAME -- subclassing issue in the Xerces version public void setLexicalHandler(LexicalHandler handler) { clientLexicalHandler=handler; } // Register an error handler for us to output to // NOTE NAME -- subclassing issue in the Xerces version public void setErrHandler(ErrorHandler handler) { clientErrorHandler=handler; } // Set the number of events between resumes of our coroutine // Immediately resets number of events before _next_ resume as well. public void setReturnFrequency(int events) { if(events<1) events=1; frequency=eventcounter=events; } // // ContentHandler methods // These pass the data to our client ContentHandler... // but they also count the number of events passing through, // and resume our coroutine each time that counter hits zero and // is reset. // // Note that for everything except endDocument and fatalError, we do the count-and-yield // BEFORE passing the call along. I'm hoping that this will encourage JIT // compilers to realize that these are tail-calls, reducing the expense of // the additional layer of data flow. // // %REVIEW% Glenn suggests that pausing after endElement, endDocument, // and characters may be sufficient. I actually may not want to // stop after characters, since in our application these wind up being // concatenated before they're processed... but that risks huge blocks of // text causing greater than usual readahead. (Unlikely? Consider the // possibility of a large base-64 block in a SOAP stream.) // public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.characters(ch,start,length); } public void endDocument() throws org.xml.sax.SAXException { // EXCEPTION: In this case we need to run the event BEFORE we yield. if(clientContentHandler!=null) clientContentHandler.endDocument(); eventcounter=0; co_yield(false); } public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.endElement(namespaceURI,localName,qName); } public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.endPrefixMapping(prefix); } public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.ignorableWhitespace(ch,start,length); } public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.processingInstruction(target,data); } public void setDocumentLocator(Locator locator) { if(--eventcounter<=0) { // This can cause a hang. -sb // co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.setDocumentLocator(locator); } public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.skippedEntity(name); } public void startDocument() throws org.xml.sax.SAXException { co_entry_pause(); // Otherwise, begin normal event delivery if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.startDocument(); } public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.startElement(namespaceURI, localName, qName, atts); } public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException { if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } if(clientContentHandler!=null) clientContentHandler.startPrefixMapping(prefix,uri); } // // LexicalHandler support. Not all SAX2 filters support these events // but we may want to pass them through when they exist... // // %REVIEW% These do NOT currently affect the eventcounter; I'm asserting // that they're rare enough that it makes little or no sense to // pause after them. As such, it may make more sense for folks who // actually want to use them to register directly with the filter. // But I want 'em here for now, to remind us to recheck this assertion! // public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler.comment(ch,start,length); } public void endCDATA() throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler.endCDATA(); } public void endDTD() throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler.endDTD(); } public void endEntity(java.lang.String name) throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler.endEntity(name); } public void startCDATA() throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler.startCDATA(); } public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler. startDTD(name, publicId, systemId); } public void startEntity(java.lang.String name) throws org.xml.sax.SAXException { if(null!=clientLexicalHandler) clientLexicalHandler.startEntity(name); } // // DTDHandler support. public void notationDecl(String a, String b, String c) throws SAXException { if(null!=clientDTDHandler) clientDTDHandler.notationDecl(a,b,c); } public void unparsedEntityDecl(String a, String b, String c, String d) throws SAXException { if(null!=clientDTDHandler) clientDTDHandler.unparsedEntityDecl(a,b,c,d); } // // ErrorHandler support. // // PROBLEM: Xerces is apparently _not_ calling the ErrorHandler for // exceptions thrown by the ContentHandler, which prevents us from // handling this properly when running in filtering mode with Xerces // as our event source. It's unclear whether this is a Xerces bug // or a SAX design flaw. // // %REVIEW% Current solution: In filtering mode, it is REQUIRED that // event source make sure this method is invoked if the event stream // abends before endDocument is delivered. If that means explicitly calling // us in the exception handling code because it won't be delivered as part // of the normal SAX ErrorHandler stream, that's fine; Not Our Problem. // public void error(SAXParseException exception) throws SAXException { if(null!=clientErrorHandler) clientErrorHandler.error(exception); } public void fatalError(SAXParseException exception) throws SAXException { // EXCEPTION: In this case we need to run the event BEFORE we yield -- // just as with endDocument, this terminates the event stream. if(null!=clientErrorHandler) clientErrorHandler.error(exception); eventcounter=0; co_yield(false); } public void warning(SAXParseException exception) throws SAXException { if(null!=clientErrorHandler) clientErrorHandler.error(exception); } // // coroutine support // public int getSourceCoroutineID() { return fSourceCoroutineID; } public int getControllerCoroutineID() { return fControllerCoroutineID; } /** @return the CoroutineManager this CoroutineFilter object is bound to. * If you're using the do...() methods, applications should only * need to talk to the CoroutineManager once, to obtain the * application's Coroutine ID. * */ public CoroutineManager getCoroutineManager() { return fCoroutineManager; } /**

    In the SAX delegation code, I've inlined the count-down in * the hope of encouraging compilers to deliver better * performance. However, if we subclass (eg to directly connect the * output to a DTM builder), that would require calling super in * order to run that logic... which seems inelegant. Hence this * routine for the convenience of subclasses: every [frequency] * invocations, issue a co_yield.

    * * @param moreExepected Should always be true unless this is being called * at the end of endDocument() handling. * */ protected void count_and_yield(boolean moreExpected) throws SAXException { if(!moreExpected) eventcounter=0; if(--eventcounter<=0) { co_yield(true); eventcounter=frequency; } } /** * co_entry_pause is called in startDocument() before anything else * happens. It causes the filter to wait for a "go ahead" request * from the controller before delivering any events. Note that * the very first thing the controller tells us may be "I don't * need events after all"! */ private void co_entry_pause() throws SAXException { if(fCoroutineManager==null) { // Nobody called init()? Do it now... init(null,-1,-1); } try { Object arg=fCoroutineManager.co_entry_pause(fSourceCoroutineID); if(arg==Boolean.FALSE) co_yield(false); } catch(NoSuchMethodException e) { // Coroutine system says we haven't registered. That's an // application coding error, and is unrecoverable. if(DEBUG) e.printStackTrace(); throw new SAXException(e); } } /** * Co_Yield handles coroutine interactions while a parse is in progress. * * When moreRemains==true, we are pausing after delivering events, to * ask if more are needed. We will resume the controller thread with * co_resume(Boolean.TRUE, ...) * When control is passed back it may indicate * Boolean.TRUE indication to continue delivering events * Boolean.FALSE indication to discontinue events and shut down. * * When moreRemains==false, we shut down immediately without asking the * controller's permission. Normally this means end of document has been * reached. * * Shutting down a IncrementalSAXSource_Filter requires terminating the incoming * SAX event stream. If we are in control of that stream (if it came * from an XMLReader passed to our startReader() method), we can do so * very quickly by throwing a reserved exception to it. If the stream is * coming from another source, we can't do that because its caller may * not be prepared for this "normal abnormal exit", and instead we put * ourselves in a "spin" mode where events are discarded. */ private void co_yield(boolean moreRemains) throws SAXException { // Horrendous kluge to run filter to completion. See below. if(fNoMoreEvents) return; try // Coroutine manager might throw no-such. { Object arg=Boolean.FALSE; if(moreRemains) { // Yield control, resume parsing when done arg = fCoroutineManager.co_resume(Boolean.TRUE, fSourceCoroutineID, fControllerCoroutineID); } // If we're at end of document or were told to stop early if(arg==Boolean.FALSE) { fNoMoreEvents=true; if(fXMLReader!=null) // Running under startParseThread() throw new StopException(); // We'll co_exit from there. // Yield control. We do NOT expect anyone to ever ask us again. fCoroutineManager.co_exit_to(Boolean.FALSE, fSourceCoroutineID, fControllerCoroutineID); } } catch(NoSuchMethodException e) { // Shouldn't happen unless we've miscoded our coroutine logic // "Shut down the garbage smashers on the detention level!" fNoMoreEvents=true; fCoroutineManager.co_exit(fSourceCoroutineID); throw new SAXException(e); } } // // Convenience: Run an XMLReader in a thread // /** Launch a thread that will run an XMLReader's parse() operation within * a thread, feeding events to this IncrementalSAXSource_Filter. Mostly a convenience * routine, but has the advantage that -- since we invoked parse() -- * we can halt parsing quickly via a StopException rather than waiting * for the SAX stream to end by itself. * * @throws SAXException is parse thread is already in progress * or parsing can not be started. * */ public void startParse(InputSource source) throws SAXException { if(fNoMoreEvents) throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, null)); //"IncrmentalSAXSource_Filter not currently restartable."); if(fXMLReader==null) throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_XMLRDR_NOT_BEFORE_STARTPARSE, null)); //"XMLReader not before startParse request"); fXMLReaderInputSource=source; // Xalan thread pooling... // org.apache.xalan.transformer.TransformerImpl.runTransformThread(this); ThreadControllerWrapper.runThread(this, -1); } /* Thread logic to support startParseThread() */ public void run() { // Guard against direct invocation of start(). if(fXMLReader==null) return; if(DEBUG)System.out.println("IncrementalSAXSource_Filter parse thread launched"); // Initially assume we'll run successfully. Object arg=Boolean.FALSE; // For the duration of this operation, all coroutine handshaking // will occur in the co_yield method. That's the nice thing about // coroutines; they give us a way to hand off control from the // middle of a synchronous method. try { fXMLReader.parse(fXMLReaderInputSource); } catch(IOException ex) { arg=ex; } catch(StopException ex) { // Expected and harmless if(DEBUG)System.out.println("Active IncrementalSAXSource_Filter normal stop exception"); } catch (SAXException ex) { Exception inner=ex.getException(); if(inner instanceof StopException){ // Expected and harmless if(DEBUG)System.out.println("Active IncrementalSAXSource_Filter normal stop exception"); } else { // Unexpected malfunction if(DEBUG) { System.out.println("Active IncrementalSAXSource_Filter UNEXPECTED SAX exception: "+inner); inner.printStackTrace(); } arg=ex; } } // end parse // Mark as no longer running in thread. fXMLReader=null; try { // Mark as done and yield control to the controller coroutine fNoMoreEvents=true; fCoroutineManager.co_exit_to(arg, fSourceCoroutineID, fControllerCoroutineID); } catch(java.lang.NoSuchMethodException e) { // Shouldn't happen unless we've miscoded our coroutine logic // "CPO, shut down the garbage smashers on the detention level!" e.printStackTrace(System.err); fCoroutineManager.co_exit(fSourceCoroutineID); } } /** Used to quickly terminate parse when running under a startParse() thread. Only its type is important. */ class StopException extends RuntimeException { static final long serialVersionUID = -1129245796185754956L; } /** deliverMoreNodes() is a simple API which tells the coroutine * parser that we need more nodes. This is intended to be called * from one of our partner routines, and serves to encapsulate the * details of how incremental parsing has been achieved. * * @param parsemore If true, tells the incremental filter to generate * another chunk of output. If false, tells the filter that we're * satisfied and it can terminate parsing of this document. * * @return Boolean.TRUE if there may be more events available by invoking * deliverMoreNodes() again. Boolean.FALSE if parsing has run to completion (or been * terminated by deliverMoreNodes(false). Or an exception object if something * malfunctioned. %REVIEW% We _could_ actually throw the exception, but * that would require runinng deliverMoreNodes() in a try/catch... and for many * applications, exception will be simply be treated as "not TRUE" in * any case. * */ public Object deliverMoreNodes(boolean parsemore) { // If parsing is already done, we can immediately say so if(fNoMoreEvents) return Boolean.FALSE; try { Object result = fCoroutineManager.co_resume(parsemore?Boolean.TRUE:Boolean.FALSE, fControllerCoroutineID, fSourceCoroutineID); if(result==Boolean.FALSE) fCoroutineManager.co_exit(fControllerCoroutineID); return result; } // SHOULD NEVER OCCUR, since the coroutine number and coroutine manager // are those previously established for this IncrementalSAXSource_Filter... // So I'm just going to return it as a parsing exception, for now. catch(NoSuchMethodException e) { return e; } } //================================================================ /** Simple unit test. Attempt coroutine parsing of document indicated * by first argument (as a URI), report progress. */ /* public static void main(String args[]) { System.out.println("Starting..."); org.xml.sax.XMLReader theSAXParser= new org.apache.xerces.parsers.SAXParser(); for(int arg=0;arg * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

    * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468653 2006-10-28 07:07:05Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

      *
    1. query the system property using System.getProperty *
    2. read META-INF/services/factoryId file *
    3. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
      *
    1. query the system property using System.getProperty *
    2. read $java.home/lib/propertiesFilename file *
    3. read META-INF/services/factoryId file *
    4. use fallback classname *
    * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 7772782876036961354L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/CustomStringPool.java0000644000175000017500000001025510721374032024377 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CustomStringPool.java 475904 2006-11-16 20:09:39Z minchau $ */ package org.apache.xml.dtm.ref; import java.util.Hashtable; /**

    CustomStringPool is an example of appliction provided data structure * for a DTM implementation to hold symbol references, e.g. elelment names. * It will follow the DTMDStringPool interface and use two simple methods * indexToString(int i) and stringToIndex(Sring s) to map between a set of * string values and a set of integer index values. Therefore, an application * may improve DTM processing speed by substituting the DTM symbol resolution * tables with application specific quick symbol resolution tables.

    * * %REVIEW% The only difference between this an DTMStringPool seems to be that * it uses a java.lang.Hashtable full of Integers rather than implementing its * own hashing. Joe deliberately avoided that approach when writing * DTMStringPool, since it is both much more memory-hungry and probably slower * -- especially in JDK 1.1.x, where Hashtable is synchronized. We need to * either justify this implementation or discard it. * * %REVIEW% Xalan-J has dropped support for 1.1.x and we can now use * the colletion classes in 1.2, such as java.util.HashMap which is * similar to java.util.Hashtable but not synchronized. For performance reasons * one could change m_stringToInt to be a HashMap, but is it OK to do that? * Are such CustomStringPool objects already used in a thread-safe way? * *

    Status: In progress, under discussion.

    * */ public class CustomStringPool extends DTMStringPool { //final Vector m_intToString; //static final int HASHPRIME=101; //int[] m_hashStart=new int[HASHPRIME]; final Hashtable m_stringToInt = new Hashtable(); // can this be a HashMap instead? public static final int NULL=-1; public CustomStringPool() { super(); /*m_intToString=new Vector(); System.out.println("In constructor m_intToString is " + ((null == m_intToString) ? "null" : "not null"));*/ //m_stringToInt=new Hashtable(); //removeAllElements(); } public void removeAllElements() { m_intToString.removeAllElements(); if (m_stringToInt != null) m_stringToInt.clear(); } /** @return string whose value is uniquely identified by this integer index. * @throws java.lang.ArrayIndexOutOfBoundsException * if index doesn't map to a string. * */ public String indexToString(int i) throws java.lang.ArrayIndexOutOfBoundsException { return(String) m_intToString.elementAt(i); } /** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if (s==null) return NULL; Integer iobj=(Integer)m_stringToInt.get(s); if (iobj==null) { m_intToString.addElement(s); iobj=new Integer(m_intToString.size()); m_stringToInt.put(s,iobj); } return iobj.intValue(); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/sax2dtm/0000755000175000017500000000000010736146354021632 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java0000644000175000017500000023505610721374032023560 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAX2DTM.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref.sax2dtm; import java.util.Hashtable; import java.util.Vector; import javax.xml.transform.Source; import javax.xml.transform.SourceLocator; import org.apache.xml.dtm.*; import org.apache.xml.dtm.ref.*; import org.apache.xml.utils.StringVector; import org.apache.xml.utils.IntVector; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.IntStack; import org.apache.xml.utils.SuballocatedIntVector; import org.apache.xml.utils.SystemIDResolver; import org.apache.xml.utils.WrappedRuntimeException; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringFactory; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.xml.sax.*; import org.xml.sax.ext.*; /** * This class implements a DTM that tends to be optimized more for speed than * for compactness, that is constructed via SAX2 ContentHandler events. */ public class SAX2DTM extends DTMDefaultBaseIterators implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler, DeclHandler, LexicalHandler { /** Set true to monitor SAX events and similar diagnostic info. */ private static final boolean DEBUG = false; /** * If we're building the model incrementally on demand, we need to * be able to tell the source when to send us more data. * * Note that if this has not been set, and you attempt to read ahead * of the current build point, we'll probably throw a null-pointer * exception. We could try to wait-and-retry instead, as a very poor * fallback, but that has all the known problems with multithreading * on multiprocessors and we Don't Want to Go There. * * @see setIncrementalSAXSource */ private IncrementalSAXSource m_incrementalSAXSource = null; /** * All the character content, including attribute values, are stored in * this buffer. * * %REVIEW% Should this have an option of being shared across DTMs? * Sequentially only; not threadsafe... Currently, I think not. * * %REVIEW% Initial size was pushed way down to reduce weight of RTFs. * pending reduction in number of RTF DTMs. Now that we're sharing a DTM * between RTFs, and tail-pruning... consider going back to the larger/faster. * * Made protected rather than private so SAX2RTFDTM can access it. */ //private FastStringBuffer m_chars = new FastStringBuffer(13, 13); protected FastStringBuffer m_chars; /** This vector holds offset and length data. */ protected SuballocatedIntVector m_data; /** The parent stack, needed only for construction. * Made protected rather than private so SAX2RTFDTM can access it. */ transient protected IntStack m_parents; /** The current previous node, needed only for construction time. * Made protected rather than private so SAX2RTFDTM can access it. */ transient protected int m_previous = 0; /** Namespace support, only relevent at construction time. * Made protected rather than private so SAX2RTFDTM can access it. */ transient protected java.util.Vector m_prefixMappings = new java.util.Vector(); /** Namespace support, only relevent at construction time. * Made protected rather than private so SAX2RTFDTM can access it. */ transient protected IntStack m_contextIndexes; /** Type of next characters() event within text block in prgress. */ transient protected int m_textType = DTM.TEXT_NODE; /** * Type of coalesced text block. See logic in the characters() * method. */ transient protected int m_coalescedTextType = DTM.TEXT_NODE; /** The SAX Document locator */ transient protected Locator m_locator = null; /** The SAX Document system-id */ transient private String m_systemId = null; /** We are inside the DTD. This is used for ignoring comments. */ transient protected boolean m_insideDTD = false; /** Tree Walker for dispatchToEvents. */ protected DTMTreeWalker m_walker = new DTMTreeWalker(); /** pool of string values that come as strings. */ protected DTMStringPool m_valuesOrPrefixes; /** End document has been reached. * Made protected rather than private so SAX2RTFDTM can access it. */ protected boolean m_endDocumentOccured = false; /** Data or qualified name values, one array element for each node. */ protected SuballocatedIntVector m_dataOrQName; /** * This table holds the ID string to node associations, for * XML IDs. */ protected Hashtable m_idAttributes = new Hashtable(); /** * fixed dom-style names. */ private static final String[] m_fixednames = { null, null, // nothing, Element null, "#text", // Attr, Text "#cdata_section", null, // CDATA, EntityReference null, null, // Entity, PI "#comment", "#document", // Comment, Document null, "#document-fragment", // Doctype, DocumentFragment null }; // Notation /** * Vector of entities. Each record is composed of four Strings: * publicId, systemID, notationName, and name. */ private Vector m_entities = null; /** m_entities public ID offset. */ private static final int ENTITY_FIELD_PUBLICID = 0; /** m_entities system ID offset. */ private static final int ENTITY_FIELD_SYSTEMID = 1; /** m_entities notation name offset. */ private static final int ENTITY_FIELD_NOTATIONNAME = 2; /** m_entities name offset. */ private static final int ENTITY_FIELD_NAME = 3; /** Number of entries per record for m_entities. */ private static final int ENTITY_FIELDS_PER = 4; /** * The starting offset within m_chars for the text or * CDATA_SECTION node currently being acumulated, * or -1 if there is no text node in progress */ protected int m_textPendingStart = -1; /** * Describes whether information about document source location * should be maintained or not. * * Made protected for access by SAX2RTFDTM. */ protected boolean m_useSourceLocationProperty = false; /** Made protected for access by SAX2RTFDTM. */ protected StringVector m_sourceSystemId; /** Made protected for access by SAX2RTFDTM. */ protected IntVector m_sourceLine; /** Made protected for access by SAX2RTFDTM. */ protected IntVector m_sourceColumn; /** * Construct a SAX2DTM object using the default block size. * * @param mgr The DTMManager who owns this DTM. * @param source the JAXP 1.1 Source object for this DTM. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory XMLString factory for creating character content. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. */ public SAX2DTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { this(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, DEFAULT_BLOCKSIZE, true, false); } /** * Construct a SAX2DTM object ready to be constructed from SAX2 * ContentHandler events. * * @param mgr The DTMManager who owns this DTM. * @param source the JAXP 1.1 Source object for this DTM. * @param dtmIdentity The DTM identity ID for this DTM. * @param whiteSpaceFilter The white space filter for this DTM, which may * be null. * @param xstringfactory XMLString factory for creating character content. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param blocksize The block size of the DTM. * @param usePrevsib true if we want to build the previous sibling node array. * @param newNameTable true if we want to use a new ExpandedNameTable for this DTM. */ public SAX2DTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable) { super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, blocksize, usePrevsib, newNameTable); // %OPT% Use smaller sizes for all internal storage units when // the blocksize is small. This reduces the cost of creating an RTF. if (blocksize <= 64) { m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL); m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL); m_valuesOrPrefixes = new DTMStringPool(16); m_chars = new FastStringBuffer(7, 10); m_contextIndexes = new IntStack(4); m_parents = new IntStack(4); } else { m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS); m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS); m_valuesOrPrefixes = new DTMStringPool(); m_chars = new FastStringBuffer(10, 13); m_contextIndexes = new IntStack(); m_parents = new IntStack(); } // %REVIEW% Initial size pushed way down to reduce weight of RTFs // (I'm not entirely sure 0 would work, so I'm playing it safe for now.) //m_data = new SuballocatedIntVector(doIndexing ? (1024*2) : 512, 1024); //m_data = new SuballocatedIntVector(blocksize); m_data.addElement(0); // Need placeholder in case index into here must be <0. //m_dataOrQName = new SuballocatedIntVector(blocksize); // m_useSourceLocationProperty=org.apache.xalan.processor.TransformerFactoryImpl.m_source_location; m_useSourceLocationProperty = mgr.getSource_location(); m_sourceSystemId = (m_useSourceLocationProperty) ? new StringVector() : null; m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null; m_sourceColumn = (m_useSourceLocationProperty) ? new IntVector() : null; } /** * Set whether information about document source location * should be maintained or not. */ public void setUseSourceLocation(boolean useSourceLocation) { m_useSourceLocationProperty = useSourceLocation; } /** * Get the data or qualified name for the given node identity. * * @param identity The node identity. * * @return The data or qualified name, or DTM.NULL. */ protected int _dataOrQName(int identity) { if (identity < m_size) return m_dataOrQName.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (!isMore) return NULL; else if (identity < m_size) return m_dataOrQName.elementAt(identity); } } /** * Ask the CoRoutine parser to doTerminate and clear the reference. */ public void clearCoRoutine() { clearCoRoutine(true); } /** * Ask the CoRoutine parser to doTerminate and clear the reference. If * the CoRoutine parser has already been cleared, this will have no effect. * * @param callDoTerminate true of doTerminate should be called on the * coRoutine parser. */ public void clearCoRoutine(boolean callDoTerminate) { if (null != m_incrementalSAXSource) { if (callDoTerminate) m_incrementalSAXSource.deliverMoreNodes(false); m_incrementalSAXSource = null; } } /** * Bind a IncrementalSAXSource to this DTM. If we discover we need nodes * that have not yet been built, we will ask this object to send us more * events, and it will manage interactions with its data sources. * * Note that we do not actually build the IncrementalSAXSource, since we don't * know what source it's reading from, what thread that source will run in, * or when it will run. * * @param incrementalSAXSource The parser that we want to recieve events from * on demand. */ public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource) { // Establish coroutine link so we can request more data // // Note: It's possible that some versions of IncrementalSAXSource may // not actually use a CoroutineManager, and hence may not require // that we obtain an Application Coroutine ID. (This relies on the // coroutine transaction details having been encapsulated in the // IncrementalSAXSource.do...() methods.) m_incrementalSAXSource = incrementalSAXSource; // Establish SAX-stream link so we can receive the requested data incrementalSAXSource.setContentHandler(this); incrementalSAXSource.setLexicalHandler(this); incrementalSAXSource.setDTDHandler(this); // Are the following really needed? incrementalSAXSource doesn't yet // support them, and they're mostly no-ops here... //incrementalSAXSource.setErrorHandler(this); //incrementalSAXSource.setDeclHandler(this); } /** * getContentHandler returns "our SAX builder" -- the thing that * someone else should send SAX events to in order to extend this * DTM model. * * %REVIEW% Should this return null if constrution already done/begun? * * @return null if this model doesn't respond to SAX events, * "this" if the DTM object has a built-in SAX ContentHandler, * the IncrementalSAXSource if we're bound to one and should receive * the SAX stream via it for incremental build purposes... */ public ContentHandler getContentHandler() { if (m_incrementalSAXSource instanceof IncrementalSAXSource_Filter) return (ContentHandler) m_incrementalSAXSource; else return this; } /** * Return this DTM's lexical handler. * * %REVIEW% Should this return null if constrution already done/begun? * * @return null if this model doesn't respond to lexical SAX events, * "this" if the DTM object has a built-in SAX ContentHandler, * the IncrementalSAXSource if we're bound to one and should receive * the SAX stream via it for incremental build purposes... */ public LexicalHandler getLexicalHandler() { if (m_incrementalSAXSource instanceof IncrementalSAXSource_Filter) return (LexicalHandler) m_incrementalSAXSource; else return this; } /** * Return this DTM's EntityResolver. * * @return null if this model doesn't respond to SAX entity ref events. */ public EntityResolver getEntityResolver() { return this; } /** * Return this DTM's DTDHandler. * * @return null if this model doesn't respond to SAX dtd events. */ public DTDHandler getDTDHandler() { return this; } /** * Return this DTM's ErrorHandler. * * @return null if this model doesn't respond to SAX error events. */ public ErrorHandler getErrorHandler() { return this; } /** * Return this DTM's DeclHandler. * * @return null if this model doesn't respond to SAX Decl events. */ public DeclHandler getDeclHandler() { return this; } /** * @return true iff we're building this model incrementally (eg * we're partnered with a IncrementalSAXSource) and thus require that the * transformation and the parse run simultaneously. Guidance to the * DTMManager. */ public boolean needsTwoThreads() { return null != m_incrementalSAXSource; } /** * Directly call the * characters method on the passed ContentHandler for the * string-value of the given node (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * @param normalize true if the content should be normalized according to * the rules for the XPath * normalize-space * function. * * @throws SAXException */ public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize) throws SAXException { int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return; int type = _type(identity); if (isTextType(type)) { int dataIndex = m_dataOrQName.elementAt(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } else { int firstChild = _firstch(identity); if (DTM.NULL != firstChild) { int offset = -1; int length = 0; int startNode = identity; identity = firstChild; do { type = _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); if (-1 == offset) { offset = m_data.elementAt(dataIndex); } length += m_data.elementAt(dataIndex + 1); } identity = getNextNodeIdentity(identity); } while (DTM.NULL != identity && (_parent(identity) >= startNode)); if (length > 0) { if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } } else if(type != DTM.ELEMENT_NODE) { int dataIndex = _dataOrQName(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } String str = m_valuesOrPrefixes.indexToString(dataIndex); if(normalize) FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(), 0, str.length(), ch); else ch.characters(str.toCharArray(), 0, str.length()); } } } /** * Given a node handle, return its DOM-style node name. This will * include names such as #text or #document. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. * %REVIEW% Document when empty string is possible... * %REVIEW-COMMENT% It should never be empty, should it? */ public String getNodeName(int nodeHandle) { int expandedTypeID = getExpandedTypeID(nodeHandle); // If just testing nonzero, no need to shift... int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID); if (0 == namespaceID) { // Don't retrieve name until/unless needed // String name = m_expandedNameTable.getLocalName(expandedTypeID); int type = getNodeType(nodeHandle); if (type == DTM.NAMESPACE_NODE) { if (null == m_expandedNameTable.getLocalName(expandedTypeID)) return "xmlns"; else return "xmlns:" + m_expandedNameTable.getLocalName(expandedTypeID); } else if (0 == m_expandedNameTable.getLocalNameID(expandedTypeID)) { return m_fixednames[type]; } else return m_expandedNameTable.getLocalName(expandedTypeID); } else { int qnameIndex = m_dataOrQName.elementAt(makeNodeIdentity(nodeHandle)); if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } return m_valuesOrPrefixes.indexToString(qnameIndex); } } /** * Given a node handle, return the XPath node name. This should be * the name as described by the XPath data model, NOT the DOM-style * name. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. */ public String getNodeNameX(int nodeHandle) { int expandedTypeID = getExpandedTypeID(nodeHandle); int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID); if (0 == namespaceID) { String name = m_expandedNameTable.getLocalName(expandedTypeID); if (name == null) return ""; else return name; } else { int qnameIndex = m_dataOrQName.elementAt(makeNodeIdentity(nodeHandle)); if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } return m_valuesOrPrefixes.indexToString(qnameIndex); } } /** * 5. [specified] A flag indicating whether this attribute was actually * specified in the start-tag of its element, or was defaulted from the * DTD. * * @param attributeHandle Must be a valid handle to an attribute node. * @return true if the attribute was specified; * false if it was defaulted. */ public boolean isAttributeSpecified(int attributeHandle) { // I'm not sure if I want to do anything with this... return true; // ?? } /** * A document type declaration information item has the following properties: * * 1. [system identifier] The system identifier of the external subset, if * it exists. Otherwise this property has no value. * * @return the system identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationSystemIdentifier() { /** @todo: implement this org.apache.xml.dtm.DTMDefaultBase abstract method */ error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!"); return null; } /** * Get the next node identity value in the list, and call the iterator * if it hasn't been added yet. * * @param identity The node identity (index). * @return identity+1, or DTM.NULL. */ protected int getNextNodeIdentity(int identity) { identity += 1; while (identity >= m_size) { if (null == m_incrementalSAXSource) return DTM.NULL; nextNode(); } return identity; } /** * Directly create SAX parser events from a subtree. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { DTMTreeWalker treeWalker = m_walker; ContentHandler prevCH = treeWalker.getcontentHandler(); if (null != prevCH) { treeWalker = new DTMTreeWalker(); } treeWalker.setcontentHandler(ch); treeWalker.setDTM(this); try { treeWalker.traverse(nodeHandle); } finally { treeWalker.setcontentHandler(null); } } /** * Get the number of nodes that have been added. * * @return The number of that are currently in the tree. */ public int getNumberOfNodes() { return m_size; } /** * This method should try and build one or more nodes in the table. * * @return The true if a next node is found or false if * there are no more nodes. */ protected boolean nextNode() { if (null == m_incrementalSAXSource) return false; if (m_endDocumentOccured) { clearCoRoutine(); return false; } Object gotMore = m_incrementalSAXSource.deliverMoreNodes(true); // gotMore may be a Boolean (TRUE if still parsing, FALSE if // EOF) or an exception if IncrementalSAXSource malfunctioned // (code error rather than user error). // // %REVIEW% Currently the ErrorHandlers sketched herein are // no-ops, so I'm going to initially leave this also as a // no-op. if (!(gotMore instanceof Boolean)) { if(gotMore instanceof RuntimeException) { throw (RuntimeException)gotMore; } else if(gotMore instanceof Exception) { throw new WrappedRuntimeException((Exception)gotMore); } // for now... clearCoRoutine(); return false; // %TBD% } if (gotMore != Boolean.TRUE) { // EOF reached without satisfying the request clearCoRoutine(); // Drop connection, stop trying // %TBD% deregister as its listener? } return true; } /** * Bottleneck determination of text type. * * @param type oneof DTM.XXX_NODE. * * @return true if this is a text or cdata section. */ private final boolean isTextType(int type) { return (DTM.TEXT_NODE == type || DTM.CDATA_SECTION_NODE == type); } // /** // * Ensure that the size of the information arrays can hold another entry // * at the given index. // * // * @param on exit from this function, the information arrays sizes must be // * at least index+1. // * // * NEEDSDOC @param index // */ // protected void ensureSize(int index) // { // // dataOrQName is an SuballocatedIntVector and hence self-sizing. // // But DTMDefaultBase may need fixup. // super.ensureSize(index); // } /** * Construct the node map from the node. * * @param type raw type ID, one of DTM.XXX_NODE. * @param expandedTypeID The expended type ID. * @param parentIndex The current parent index. * @param previousSibling The previous sibling index. * @param dataOrPrefix index into m_data table, or string handle. * @param canHaveFirstChild true if the node can have a first child, false * if it is atomic. * * @return The index identity of the node that was added. */ protected int addNode(int type, int expandedTypeID, int parentIndex, int previousSibling, int dataOrPrefix, boolean canHaveFirstChild) { // Common to all nodes: int nodeIndex = m_size++; // Have we overflowed a DTM Identity's addressing range? if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS)) { addNewDTMID(nodeIndex); } m_firstch.addElement(canHaveFirstChild ? NOTPROCESSED : DTM.NULL); m_nextsib.addElement(NOTPROCESSED); m_parent.addElement(parentIndex); m_exptype.addElement(expandedTypeID); m_dataOrQName.addElement(dataOrPrefix); if (m_prevsib != null) { m_prevsib.addElement(previousSibling); } if (DTM.NULL != previousSibling) { m_nextsib.setElementAt(nodeIndex,previousSibling); } if (m_locator != null && m_useSourceLocationProperty) { setSourceLocation(); } // Note that nextSibling is not processed until charactersFlush() // is called, to handle successive characters() events. // Special handling by type: Declare namespaces, attach first child switch(type) { case DTM.NAMESPACE_NODE: declareNamespaceInContext(parentIndex,nodeIndex); break; case DTM.ATTRIBUTE_NODE: break; default: if (DTM.NULL == previousSibling && DTM.NULL != parentIndex) { m_firstch.setElementAt(nodeIndex,parentIndex); } break; } return nodeIndex; } /** * Get a new DTM ID beginning at the specified node index. * @param nodeIndex The node identity at which the new DTM ID will begin * addressing. */ protected void addNewDTMID(int nodeIndex) { try { if(m_mgr==null) throw new ClassCastException(); // Handle as Extended Addressing DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr; int id=mgrD.getFirstFreeDTMID(); mgrD.addDTM(this,id,nodeIndex); m_dtmIdent.addElement(id< %REVIEW% Are you sure you want "" for no prefix?

    *

    %REVIEW-COMMENT% I think so... not totally sure. -sb

    * * @param nodeHandle the id of the node. * @return String prefix of this node's name, or "" if no explicit * namespace prefix was given. */ public String getPrefix(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type = _type(identity); if (DTM.ELEMENT_NODE == type) { int prefixIndex = _dataOrQName(identity); if (0 == prefixIndex) return ""; else { String qname = m_valuesOrPrefixes.indexToString(prefixIndex); return getPrefix(qname, null); } } else if (DTM.ATTRIBUTE_NODE == type) { int prefixIndex = _dataOrQName(identity); if (prefixIndex < 0) { prefixIndex = m_data.elementAt(-prefixIndex); String qname = m_valuesOrPrefixes.indexToString(prefixIndex); return getPrefix(qname, null); } } return ""; } /** * Retrieves an attribute node by by qualified name and namespace URI. * * @param nodeHandle int Handle of the node upon which to look up this attribute.. * @param namespaceURI The namespace URI of the attribute to * retrieve, or null. * @param name The local name of the attribute to * retrieve. * @return The attribute node handle with the specified name ( * nodeName) or DTM.NULL if there is no such * attribute. */ public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { for (int attrH = getFirstAttribute(nodeHandle); DTM.NULL != attrH; attrH = getNextAttribute(attrH)) { String attrNS = getNamespaceURI(attrH); String attrName = getLocalName(attrH); boolean nsMatch = namespaceURI == attrNS || (namespaceURI != null && namespaceURI.equals(attrNS)); if (nsMatch && name.equals(attrName)) return attrH; } return DTM.NULL; } /** * Return the public identifier of the external subset, * normalized as described in 4.2.2 External Entities [XML]. If there is * no external subset or if it has no public identifier, this property * has no value. * * @return the public identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationPublicIdentifier() { /** @todo: implement this org.apache.xml.dtm.DTMDefaultBase abstract method */ error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!"); return null; } /** * Given a node handle, return its DOM-style namespace URI * (As defined in Namespaces, this is the declared URI which this node's * prefix -- or default in lieu thereof -- was mapped to.) * *

    %REVIEW% Null or ""? -sb

    * * @param nodeHandle the id of the node. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceURI(int nodeHandle) { return m_expandedNameTable.getNamespace(_exptype(makeNodeIdentity(nodeHandle))); } /** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type; if(identity==DTM.NULL) // Separate lines because I wanted to breakpoint it type = DTM.NULL; else type= _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); return m_xstrf.newstr(m_chars, offset, length); } else { int firstChild = _firstch(identity); if (DTM.NULL != firstChild) { int offset = -1; int length = 0; int startNode = identity; identity = firstChild; do { type = _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); if (-1 == offset) { offset = m_data.elementAt(dataIndex); } length += m_data.elementAt(dataIndex + 1); } identity = getNextNodeIdentity(identity); } while (DTM.NULL != identity && (_parent(identity) >= startNode)); if (length > 0) { return m_xstrf.newstr(m_chars, offset, length); } } else if(type != DTM.ELEMENT_NODE) { int dataIndex = _dataOrQName(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } return m_xstrf.newstr(m_valuesOrPrefixes.indexToString(dataIndex)); } } return m_xstrf.emptystr(); } /** * Determine if the string-value of a node is whitespace * * @param nodeHandle The node Handle. * * @return Return true if the given node is whitespace. */ public boolean isWhitespace(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type; if(identity==DTM.NULL) // Separate lines because I wanted to breakpoint it type = DTM.NULL; else type= _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); return m_chars.isWhitespace(offset, length); } return false; } /** * Returns the Element whose ID is given by * elementId. If no such element exists, returns * DTM.NULL. Behavior is not defined if more than one element * has this ID. Attributes (including those * with the name "ID") are not of type ID unless so defined by DTD/Schema * information available to the DTM implementation. * Implementations that do not know whether attributes are of type ID or * not are expected to return DTM.NULL. * *

    %REVIEW% Presumably IDs are still scoped to a single document, * and this operation searches only within a single document, right? * Wouldn't want collisions between DTMs in the same process.

    * * @param elementId The unique id value for an element. * @return The handle of the matching element. */ public int getElementById(String elementId) { Integer intObj; boolean isMore = true; do { intObj = (Integer) m_idAttributes.get(elementId); if (null != intObj) return makeNodeHandle(intObj.intValue()); if (!isMore || m_endDocumentOccured) break; isMore = nextNode(); } while (null == intObj); return DTM.NULL; } /** * Get a prefix either from the qname or from the uri mapping, or just make * one up! * * @param qname The qualified name, which may be null. * @param uri The namespace URI, which may be null. * * @return The prefix if there is one, or null. */ public String getPrefix(String qname, String uri) { String prefix; int uriIndex = -1; if (null != uri && uri.length() > 0) { do { uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex); } while ( (uriIndex & 0x01) == 0); if (uriIndex >= 0) { prefix = (String) m_prefixMappings.elementAt(uriIndex - 1); } else if (null != qname) { int indexOfNSSep = qname.indexOf(':'); if (qname.equals("xmlns")) prefix = ""; else if (qname.startsWith("xmlns:")) prefix = qname.substring(indexOfNSSep + 1); else prefix = (indexOfNSSep > 0) ? qname.substring(0, indexOfNSSep) : null; } else { prefix = null; } } else if (null != qname) { int indexOfNSSep = qname.indexOf(':'); if (indexOfNSSep > 0) { if (qname.startsWith("xmlns:")) prefix = qname.substring(indexOfNSSep + 1); else prefix = qname.substring(0, indexOfNSSep); } else { if (qname.equals("xmlns")) prefix = ""; else prefix = null; } } else { prefix = null; } return prefix; } /** * Get a prefix either from the uri mapping, or just make * one up! * * @param uri The namespace URI, which may be null. * * @return The prefix if there is one, or null. */ public int getIdForNamespace(String uri) { return m_valuesOrPrefixes.stringToIndex(uri); } /** * Get a prefix either from the qname or from the uri mapping, or just make * one up! * * @return The prefix if there is one, or null. */ public String getNamespaceURI(String prefix) { String uri = ""; int prefixIndex = m_contextIndexes.peek() - 1 ; if(null == prefix) prefix = ""; do { prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex); } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01); if (prefixIndex > -1) { uri = (String) m_prefixMappings.elementAt(prefixIndex + 1); } return uri; } /** * Set an ID string to node association in the ID table. * * @param id The ID string. * @param elem The associated element handle. */ public void setIDAttribute(String id, int elem) { m_idAttributes.put(id, new Integer(elem)); } /** * Check whether accumulated text should be stripped; if not, * append the appropriate flavor of text/cdata node. */ protected void charactersFlush() { if (m_textPendingStart >= 0) // -1 indicates no-text-in-progress { int length = m_chars.size() - m_textPendingStart; boolean doStrip = false; if (getShouldStripWhitespace()) { doStrip = m_chars.isWhitespace(m_textPendingStart, length); } if (doStrip) { m_chars.setLength(m_textPendingStart); // Discard accumulated text } else { // Guard against characters/ignorableWhitespace events that // contained no characters. They should not result in a node. if (length > 0) { int exName = m_expandedNameTable.getExpandedTypeID(DTM.TEXT_NODE); int dataIndex = m_data.size(); m_previous = addNode(m_coalescedTextType, exName, m_parents.peek(), m_previous, dataIndex, false); m_data.addElement(m_textPendingStart); m_data.addElement(length); } } // Reset for next text block m_textPendingStart = -1; m_textType = m_coalescedTextType = DTM.TEXT_NODE; } } //////////////////////////////////////////////////////////////////// // Implementation of the EntityResolver interface. //////////////////////////////////////////////////////////////////// /** * Resolve an external entity. * *

    Always return null, so that the parser will use the system * identifier provided in the XML document. This method implements * the SAX default behaviour: application writers can override it * in a subclass to do special translations such as catalog lookups * or URI redirection.

    * * @param publicId The public identifer, or null if none is * available. * @param systemId The system identifier provided in the XML * document. * @return The new input source, or null to require the * default behaviour. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.EntityResolver#resolveEntity * * @throws SAXException */ public InputSource resolveEntity(String publicId, String systemId) throws SAXException { return null; } //////////////////////////////////////////////////////////////////// // Implementation of DTDHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive notification of a notation declaration. * *

    By default, do nothing. Application writers may override this * method in a subclass if they wish to keep track of the notations * declared in a document.

    * * @param name The notation name. * @param publicId The notation public identifier, or null if not * available. * @param systemId The notation system identifier. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DTDHandler#notationDecl * * @throws SAXException */ public void notationDecl(String name, String publicId, String systemId) throws SAXException { // no op } /** * Receive notification of an unparsed entity declaration. * *

    By default, do nothing. Application writers may override this * method in a subclass to keep track of the unparsed entities * declared in a document.

    * * @param name The entity name. * @param publicId The entity public identifier, or null if not * available. * @param systemId The entity system identifier. * @param notationName The name of the associated notation. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DTDHandler#unparsedEntityDecl * * @throws SAXException */ public void unparsedEntityDecl( String name, String publicId, String systemId, String notationName) throws SAXException { if (null == m_entities) { m_entities = new Vector(); } try { systemId = SystemIDResolver.getAbsoluteURI(systemId, getDocumentBaseURI()); } catch (Exception e) { throw new org.xml.sax.SAXException(e); } // private static final int ENTITY_FIELD_PUBLICID = 0; m_entities.addElement(publicId); // private static final int ENTITY_FIELD_SYSTEMID = 1; m_entities.addElement(systemId); // private static final int ENTITY_FIELD_NOTATIONNAME = 2; m_entities.addElement(notationName); // private static final int ENTITY_FIELD_NAME = 3; m_entities.addElement(name); } //////////////////////////////////////////////////////////////////// // Implementation of ContentHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive a Locator object for document events. * *

    By default, do nothing. Application writers may override this * method in a subclass if they wish to store the locator for use * with other document events.

    * * @param locator A locator for all SAX document events. * @see org.xml.sax.ContentHandler#setDocumentLocator * @see org.xml.sax.Locator */ public void setDocumentLocator(Locator locator) { m_locator = locator; m_systemId = locator.getSystemId(); } /** * Receive notification of the beginning of the document. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument() throws SAXException { if (DEBUG) System.out.println("startDocument"); int doc = addNode(DTM.DOCUMENT_NODE, m_expandedNameTable.getExpandedTypeID(DTM.DOCUMENT_NODE), DTM.NULL, DTM.NULL, 0, true); m_parents.push(doc); m_previous = DTM.NULL; m_contextIndexes.push(m_prefixMappings.size()); // for the next element. } /** * Receive notification of the end of the document. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument() throws SAXException { if (DEBUG) System.out.println("endDocument"); charactersFlush(); m_nextsib.setElementAt(NULL,0); if (m_firstch.elementAt(0) == NOTPROCESSED) m_firstch.setElementAt(NULL,0); if (DTM.NULL != m_previous) m_nextsib.setElementAt(DTM.NULL,m_previous); m_parents = null; m_prefixMappings = null; m_contextIndexes = null; m_endDocumentOccured = true; // Bugzilla 4858: throw away m_locator. we cache m_systemId m_locator = null; } /** * Receive notification of the start of a Namespace mapping. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each Namespace prefix scope (such as storing the prefix mapping).

    * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI mapped to the prefix. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startPrefixMapping */ public void startPrefixMapping(String prefix, String uri) throws SAXException { if (DEBUG) System.out.println("startPrefixMapping: prefix: " + prefix + ", uri: " + uri); if(null == prefix) prefix = ""; m_prefixMappings.addElement(prefix); // JDK 1.1.x compat -sc m_prefixMappings.addElement(uri); // JDK 1.1.x compat -sc } /** * Receive notification of the end of a Namespace mapping. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each prefix mapping.

    * * @param prefix The Namespace prefix being declared. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping(String prefix) throws SAXException { if (DEBUG) System.out.println("endPrefixMapping: prefix: " + prefix); if(null == prefix) prefix = ""; int index = m_contextIndexes.peek() - 1; do { index = m_prefixMappings.indexOf(prefix, ++index); } while ( (index >= 0) && ((index & 0x01) == 0x01) ); if (index > -1) { m_prefixMappings.setElementAt("%@$#^@#", index); m_prefixMappings.setElementAt("%@$#^@#", index + 1); } // no op } /** * Check if a declaration has already been made for a given prefix. * * @param prefix non-null prefix string. * * @return true if the declaration has already been declared in the * current context. */ protected boolean declAlreadyDeclared(String prefix) { int startDecls = m_contextIndexes.peek(); java.util.Vector prefixMappings = m_prefixMappings; int nDecls = prefixMappings.size(); for (int i = startDecls; i < nDecls; i += 2) { String prefixDecl = (String) prefixMappings.elementAt(i); if (prefixDecl == null) continue; if (prefixDecl.equals(prefix)) return true; } return false; } boolean m_pastFirstElement=false; /** * Receive notification of the start of an element. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each element (such as allocating a new tree node or writing * output to a file).

    * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified name (with prefix), or the * empty string if qualified names are not available. * @param attributes The specified or defaulted attributes. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement */ public void startElement( String uri, String localName, String qName, Attributes attributes) throws SAXException { if (DEBUG) { System.out.println("startElement: uri: " + uri + ", localname: " + localName + ", qname: "+qName+", atts: " + attributes); boolean DEBUG_ATTRS=true; if(DEBUG_ATTRS & attributes!=null) { int n = attributes.getLength(); if(n==0) System.out.println("\tempty attribute list"); else for (int i = 0; i < n; i++) System.out.println("\t attr: uri: " + attributes.getURI(i) + ", localname: " + attributes.getLocalName(i) + ", qname: " + attributes.getQName(i) + ", type: " + attributes.getType(i) + ", value: " + attributes.getValue(i) ); } } charactersFlush(); int exName = m_expandedNameTable.getExpandedTypeID(uri, localName, DTM.ELEMENT_NODE); String prefix = getPrefix(qName, uri); int prefixIndex = (null != prefix) ? m_valuesOrPrefixes.stringToIndex(qName) : 0; int elemNode = addNode(DTM.ELEMENT_NODE, exName, m_parents.peek(), m_previous, prefixIndex, true); if(m_indexing) indexNode(exName, elemNode); m_parents.push(elemNode); int startDecls = m_contextIndexes.peek(); int nDecls = m_prefixMappings.size(); int prev = DTM.NULL; if(!m_pastFirstElement) { // SPECIAL CASE: Implied declaration at root element prefix="xml"; String declURL = "http://www.w3.org/XML/1998/namespace"; exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE); int val = m_valuesOrPrefixes.stringToIndex(declURL); prev = addNode(DTM.NAMESPACE_NODE, exName, elemNode, prev, val, false); m_pastFirstElement=true; } for (int i = startDecls; i < nDecls; i += 2) { prefix = (String) m_prefixMappings.elementAt(i); if (prefix == null) continue; String declURL = (String) m_prefixMappings.elementAt(i + 1); exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE); int val = m_valuesOrPrefixes.stringToIndex(declURL); prev = addNode(DTM.NAMESPACE_NODE, exName, elemNode, prev, val, false); } int n = attributes.getLength(); for (int i = 0; i < n; i++) { String attrUri = attributes.getURI(i); String attrQName = attributes.getQName(i); String valString = attributes.getValue(i); prefix = getPrefix(attrQName, attrUri); int nodeType; String attrLocalName = attributes.getLocalName(i); if ((null != attrQName) && (attrQName.equals("xmlns") || attrQName.startsWith("xmlns:"))) { if (declAlreadyDeclared(prefix)) continue; // go to the next attribute. nodeType = DTM.NAMESPACE_NODE; } else { nodeType = DTM.ATTRIBUTE_NODE; if (attributes.getType(i).equalsIgnoreCase("ID")) setIDAttribute(valString, elemNode); } // Bit of a hack... if somehow valString is null, stringToIndex will // return -1, which will make things very unhappy. if(null == valString) valString = ""; int val = m_valuesOrPrefixes.stringToIndex(valString); //String attrLocalName = attributes.getLocalName(i); if (null != prefix) { prefixIndex = m_valuesOrPrefixes.stringToIndex(attrQName); int dataIndex = m_data.size(); m_data.addElement(prefixIndex); m_data.addElement(val); val = -dataIndex; } exName = m_expandedNameTable.getExpandedTypeID(attrUri, attrLocalName, nodeType); prev = addNode(nodeType, exName, elemNode, prev, val, false); } if (DTM.NULL != prev) m_nextsib.setElementAt(DTM.NULL,prev); if (null != m_wsfilter) { short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(elemNode), this); boolean shouldStrip = (DTMWSFilter.INHERIT == wsv) ? getShouldStripWhitespace() : (DTMWSFilter.STRIP == wsv); pushShouldStripWhitespace(shouldStrip); } m_previous = DTM.NULL; m_contextIndexes.push(m_prefixMappings.size()); // for the children. } /** * Receive notification of the end of an element. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each element (such as finalising a tree node or writing * output to a file).

    * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified XML 1.0 name (with prefix), or the * empty string if qualified names are not available. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endElement */ public void endElement(String uri, String localName, String qName) throws SAXException { if (DEBUG) System.out.println("endElement: uri: " + uri + ", localname: " + localName + ", qname: "+qName); charactersFlush(); // If no one noticed, startPrefixMapping is a drag. // Pop the context for the last child (the one pushed by startElement) m_contextIndexes.quickPop(1); // Do it again for this one (the one pushed by the last endElement). int topContextIndex = m_contextIndexes.peek(); if (topContextIndex != m_prefixMappings.size()) { m_prefixMappings.setSize(topContextIndex); } int lastNode = m_previous; m_previous = m_parents.pop(); // If lastNode is still DTM.NULL, this element had no children if (DTM.NULL == lastNode) m_firstch.setElementAt(DTM.NULL,m_previous); else m_nextsib.setElementAt(DTM.NULL,lastNode); popShouldStripWhitespace(); } /** * Receive notification of character data inside an element. * *

    By default, do nothing. Application writers may override this * method to take specific actions for each chunk of character data * (such as adding the data to a node or buffer, or printing it to * a file).

    * * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#characters */ public void characters(char ch[], int start, int length) throws SAXException { if (m_textPendingStart == -1) // First one in this block { m_textPendingStart = m_chars.size(); m_coalescedTextType = m_textType; } // Type logic: If all adjacent text is CDATASections, the // concatentated text is treated as a single CDATASection (see // initialization above). If any were ordinary Text, the whole // thing is treated as Text. This may be worth %REVIEW%ing. else if (m_textType == DTM.TEXT_NODE) { m_coalescedTextType = DTM.TEXT_NODE; } m_chars.append(ch, start, length); } /** * Receive notification of ignorable whitespace in element content. * *

    By default, do nothing. Application writers may override this * method to take specific actions for each chunk of ignorable * whitespace (such as adding data to a node or buffer, or printing * it to a file).

    * * @param ch The whitespace characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#ignorableWhitespace */ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { // %OPT% We can probably take advantage of the fact that we know this // is whitespace. characters(ch, start, length); } /** * Receive notification of a processing instruction. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.

    * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction(String target, String data) throws SAXException { if (DEBUG) System.out.println("processingInstruction: target: " + target +", data: "+data); charactersFlush(); int exName = m_expandedNameTable.getExpandedTypeID(null, target, DTM.PROCESSING_INSTRUCTION_NODE); int dataIndex = m_valuesOrPrefixes.stringToIndex(data); m_previous = addNode(DTM.PROCESSING_INSTRUCTION_NODE, exName, m_parents.peek(), m_previous, dataIndex, false); } /** * Receive notification of a skipped entity. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.

    * * @param name The name of the skipped entity. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void skippedEntity(String name) throws SAXException { // %REVIEW% What should be done here? // no op } //////////////////////////////////////////////////////////////////// // Implementation of the ErrorHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive notification of a parser warning. * *

    The default implementation does nothing. Application writers * may override this method in a subclass to take specific actions * for each warning, such as inserting the message in a log file or * printing it to the console.

    * * @param e The warning information encoded as an exception. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ErrorHandler#warning * @see org.xml.sax.SAXParseException */ public void warning(SAXParseException e) throws SAXException { // %REVIEW% Is there anyway to get the JAXP error listener here? System.err.println(e.getMessage()); } /** * Receive notification of a recoverable parser error. * *

    The default implementation does nothing. Application writers * may override this method in a subclass to take specific actions * for each error, such as inserting the message in a log file or * printing it to the console.

    * * @param e The warning information encoded as an exception. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ErrorHandler#warning * @see org.xml.sax.SAXParseException */ public void error(SAXParseException e) throws SAXException { throw e; } /** * Report a fatal XML parsing error. * *

    The default implementation throws a SAXParseException. * Application writers may override this method in a subclass if * they need to take specific actions for each fatal error (such as * collecting all of the errors into a single report): in any case, * the application must stop all regular processing when this * method is invoked, since the document is no longer reliable, and * the parser may no longer report parsing events.

    * * @param e The error information encoded as an exception. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ErrorHandler#fatalError * @see org.xml.sax.SAXParseException */ public void fatalError(SAXParseException e) throws SAXException { throw e; } //////////////////////////////////////////////////////////////////// // Implementation of the DeclHandler interface. //////////////////////////////////////////////////////////////////// /** * Report an element type declaration. * *

    The content model will consist of the string "EMPTY", the * string "ANY", or a parenthesised group, optionally followed * by an occurrence indicator. The model will be normalized so * that all whitespace is removed,and will include the enclosing * parentheses.

    * * @param name The element type name. * @param model The content model as a normalized string. * @throws SAXException The application may raise an exception. */ public void elementDecl(String name, String model) throws SAXException { // no op } /** * Report an attribute type declaration. * *

    Only the effective (first) declaration for an attribute will * be reported. The type will be one of the strings "CDATA", * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", * "ENTITIES", or "NOTATION", or a parenthesized token group with * the separator "|" and all whitespace removed.

    * * @param eName The name of the associated element. * @param aName The name of the attribute. * @param type A string representing the attribute type. * @param valueDefault A string representing the attribute default * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if * none of these applies. * @param value A string representing the attribute's default value, * or null if there is none. * @throws SAXException The application may raise an exception. */ public void attributeDecl( String eName, String aName, String type, String valueDefault, String value) throws SAXException { // no op } /** * Report an internal entity declaration. * *

    Only the effective (first) declaration for each entity * will be reported.

    * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param value The replacement text of the entity. * @throws SAXException The application may raise an exception. * @see #externalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void internalEntityDecl(String name, String value) throws SAXException { // no op } /** * Report a parsed external entity declaration. * *

    Only the effective (first) declaration for each entity * will be reported.

    * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param publicId The declared public identifier of the entity, or * null if none was declared. * @param systemId The declared system identifier of the entity. * @throws SAXException The application may raise an exception. * @see #internalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void externalEntityDecl( String name, String publicId, String systemId) throws SAXException { // no op } //////////////////////////////////////////////////////////////////// // Implementation of the LexicalHandler interface. //////////////////////////////////////////////////////////////////// /** * Report the start of DTD declarations, if any. * *

    Any declarations are assumed to be in the internal subset * unless otherwise indicated by a {@link #startEntity startEntity} * event.

    * *

    Note that the start/endDTD events will appear within * the start/endDocument events from ContentHandler and * before the first startElement event.

    * * @param name The document type name. * @param publicId The declared public identifier for the * external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the * external DTD subset, or null if none was declared. * @throws SAXException The application may raise an * exception. * @see #endDTD * @see #startEntity */ public void startDTD(String name, String publicId, String systemId) throws SAXException { m_insideDTD = true; } /** * Report the end of DTD declarations. * * @throws SAXException The application may raise an exception. * @see #startDTD */ public void endDTD() throws SAXException { m_insideDTD = false; } /** * Report the beginning of an entity in content. * *

    NOTE: entity references in attribute * values -- and the start and end of the document entity -- * are never reported.

    * *

    The start and end of the external DTD subset are reported * using the pseudo-name "[dtd]". All other events must be * properly nested within start/end entity events.

    * *

    Note that skipped entities will be reported through the * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} * event, which is part of the ContentHandler interface.

    * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @throws SAXException The application may raise an exception. * @see #endEntity * @see org.xml.sax.ext.DeclHandler#internalEntityDecl * @see org.xml.sax.ext.DeclHandler#externalEntityDecl */ public void startEntity(String name) throws SAXException { // no op } /** * Report the end of an entity. * * @param name The name of the entity that is ending. * @throws SAXException The application may raise an exception. * @see #startEntity */ public void endEntity(String name) throws SAXException { // no op } /** * Report the start of a CDATA section. * *

    The contents of the CDATA section will be reported through * the regular {@link org.xml.sax.ContentHandler#characters * characters} event.

    * * @throws SAXException The application may raise an exception. * @see #endCDATA */ public void startCDATA() throws SAXException { m_textType = DTM.CDATA_SECTION_NODE; } /** * Report the end of a CDATA section. * * @throws SAXException The application may raise an exception. * @see #startCDATA */ public void endCDATA() throws SAXException { m_textType = DTM.TEXT_NODE; } /** * Report an XML comment anywhere in the document. * *

    This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read).

    * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws SAXException { if (m_insideDTD) // ignore comments if we're inside the DTD return; charactersFlush(); int exName = m_expandedNameTable.getExpandedTypeID(DTM.COMMENT_NODE); // For now, treat comments as strings... I guess we should do a // seperate FSB buffer instead. int dataIndex = m_valuesOrPrefixes.stringToIndex(new String(ch, start, length)); m_previous = addNode(DTM.COMMENT_NODE, exName, m_parents.peek(), m_previous, dataIndex, false); } /** * Set a run time property for this DTM instance. * * %REVIEW% Now that we no longer use this method to support * getSourceLocatorFor, can we remove it? * * @param property a String value * @param value an Object value */ public void setProperty(String property, Object value) { } /** Retrieve the SourceLocator associated with a specific node. * This is only meaningful if the XalanProperties.SOURCE_LOCATION flag was * set True using setProperty; if it was never set, or was set false, we * will return null. * * (We _could_ return a locator with the document's base URI and bogus * line/column information. Trying that; see the else clause.) * */ public SourceLocator getSourceLocatorFor(int node) { if (m_useSourceLocationProperty) { node = makeNodeIdentity(node); return new NodeLocator(null, m_sourceSystemId.elementAt(node), m_sourceLine.elementAt(node), m_sourceColumn.elementAt(node)); } else if(m_locator!=null) { return new NodeLocator(null,m_locator.getSystemId(),-1,-1); } else if(m_systemId!=null) { return new NodeLocator(null,m_systemId,-1,-1); } return null; } public String getFixedNames(int type){ return m_fixednames[type]; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java0000644000175000017500000003257010721374032024130 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAX2RTFDTM.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref.sax2dtm; import javax.xml.transform.Source; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.utils.IntStack; import org.apache.xml.utils.IntVector; import org.apache.xml.utils.StringVector; import org.apache.xml.utils.XMLStringFactory; import org.xml.sax.SAXException; /** * This is a subclass of SAX2DTM which has been modified to meet the needs of * Result Tree Frameworks (RTFs). The differences are: * * 1) Multiple XML trees may be appended to the single DTM. This means * that the root node of each document is _not_ node 0. Some code has * had to be deoptimized to support this mode of operation, and an * explicit mechanism for obtaining the Node Handle of the root node * has been provided. * * 2) A stack of these documents is maintained, allowing us to "tail-prune" the * most recently added trees off the end of the DTM as stylesheet elements * (and thus variable contexts) are exited. * * PLEASE NOTE that this class may be _heavily_ dependent upon the * internals of the SAX2DTM superclass, and must be maintained in * parallel with that code. Arguably, they should be conditionals * within a single class... but they have deen separated for * performance reasons. (In fact, one could even argue about which is * the superclass and which is the subclass; the current arrangement * is as much about preserving stability of existing code during * development as anything else.) * * %REVIEW% In fact, since the differences are so minor, I think it * may be possible/practical to fold them back into the base * SAX2DTM. Consider that as a future code-size optimization. * */ public class SAX2RTFDTM extends SAX2DTM { /** Set true to monitor SAX events and similar diagnostic info. */ private static final boolean DEBUG = false; /** Most recently started Document, or null if the DTM is empty. */ private int m_currentDocumentNode=NULL; /** Tail-pruning mark: Number of nodes in use */ IntStack mark_size=new IntStack(); /** Tail-pruning mark: Number of data items in use */ IntStack mark_data_size=new IntStack(); /** Tail-pruning mark: Number of size-of-data fields in use */ IntStack mark_char_size=new IntStack(); /** Tail-pruning mark: Number of dataOrQName slots in use */ IntStack mark_doq_size=new IntStack(); /** Tail-pruning mark: Number of namespace declaration sets in use * %REVIEW% I don't think number of NS sets is ever different from number * of NS elements. We can probabably reduce these to a single stack and save * some storage. * */ IntStack mark_nsdeclset_size=new IntStack(); /** Tail-pruning mark: Number of naespace declaration elements in use * %REVIEW% I don't think number of NS sets is ever different from number * of NS elements. We can probabably reduce these to a single stack and save * some storage. */ IntStack mark_nsdeclelem_size=new IntStack(); /** * Tail-pruning mark: initial number of nodes in use */ int m_emptyNodeCount; /** * Tail-pruning mark: initial number of namespace declaration sets */ int m_emptyNSDeclSetCount; /** * Tail-pruning mark: initial number of namespace declaration elements */ int m_emptyNSDeclSetElemsCount; /** * Tail-pruning mark: initial number of data items in use */ int m_emptyDataCount; /** * Tail-pruning mark: initial number of characters in use */ int m_emptyCharsCount; /** * Tail-pruning mark: default initial number of dataOrQName slots in use */ int m_emptyDataQNCount; public SAX2RTFDTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing); // NEVER track source locators for RTFs; they aren't meaningful. I think. // (If we did track them, we'd need to tail-prune these too.) //org.apache.xalan.processor.TransformerFactoryImpl.m_source_location; m_useSourceLocationProperty=false; m_sourceSystemId = (m_useSourceLocationProperty) ? new StringVector() : null; m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null; m_sourceColumn = (m_useSourceLocationProperty) ? new IntVector() : null; // Record initial sizes of fields that are pushed and restored // for RTF tail-pruning. More entries can be popped than pushed, so // we need this to mark the primordial state of the DTM. m_emptyNodeCount = m_size; m_emptyNSDeclSetCount = (m_namespaceDeclSets == null) ? 0 : m_namespaceDeclSets.size(); m_emptyNSDeclSetElemsCount = (m_namespaceDeclSetElements == null) ? 0 : m_namespaceDeclSetElements.size(); m_emptyDataCount = m_data.size(); m_emptyCharsCount = m_chars.size(); m_emptyDataQNCount = m_dataOrQName.size(); } /** * Given a DTM, find the owning document node. In the case of * SAX2RTFDTM, which may contain multiple documents, this returns * the most recently started document, or null if the DTM is * empty or no document is currently under construction. * * %REVIEW% Should we continue to report the most recent after * construction has ended? I think not, given that it may have been * tail-pruned. * * @return int Node handle of Document node, or null if this DTM does not * contain an "active" document. * */ public int getDocument() { return makeNodeHandle(m_currentDocumentNode); } /** * Given a node handle, find the owning document node, using DTM semantics * (Document owns itself) rather than DOM semantics (Document has no owner). * * (I'm counting on the fact that getOwnerDocument() is implemented on top * of this call, in the superclass, to avoid having to rewrite that one. * Be careful if that code changes!) * * @param nodeHandle the id of the node. * @return int Node handle of owning document */ public int getDocumentRoot(int nodeHandle) { for (int id=makeNodeIdentity(nodeHandle); id!=NULL; id=_parent(id)) { if (_type(id)==DTM.DOCUMENT_NODE) { return makeNodeHandle(id); } } return DTM.NULL; // Safety net; should never happen } /** * Given a node identifier, find the owning document node. Unlike the DOM, * this considers the owningDocument of a Document to be itself. Note that * in shared DTMs this may not be zero. * * @param nodeIdentifier the id of the starting node. * @return int Node identifier of the root of this DTM tree */ protected int _documentRoot(int nodeIdentifier) { if(nodeIdentifier==NULL) return NULL; for (int parent=_parent(nodeIdentifier); parent!=NULL; nodeIdentifier=parent,parent=_parent(nodeIdentifier)) ; return nodeIdentifier; } /** * Receive notification of the beginning of a new RTF document. * * %REVIEW% Y'know, this isn't all that much of a deoptimization. We * might want to consider folding the start/endDocument changes back * into the main SAX2DTM so we don't have to expose so many fields * (even as Protected) and carry the additional code. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startDocument * */ public void startDocument() throws SAXException { // Re-initialize the tree append process m_endDocumentOccured = false; m_prefixMappings = new java.util.Vector(); m_contextIndexes = new IntStack(); m_parents = new IntStack(); m_currentDocumentNode=m_size; super.startDocument(); } /** * Receive notification of the end of the document. * * %REVIEW% Y'know, this isn't all that much of a deoptimization. We * might want to consider folding the start/endDocument changes back * into the main SAX2DTM so we don't have to expose so many fields * (even as Protected). * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument * */ public void endDocument() throws SAXException { charactersFlush(); m_nextsib.setElementAt(NULL,m_currentDocumentNode); if (m_firstch.elementAt(m_currentDocumentNode) == NOTPROCESSED) m_firstch.setElementAt(NULL,m_currentDocumentNode); if (DTM.NULL != m_previous) m_nextsib.setElementAt(DTM.NULL,m_previous); m_parents = null; m_prefixMappings = null; m_contextIndexes = null; m_currentDocumentNode= NULL; // no longer open m_endDocumentOccured = true; } /** "Tail-pruning" support for RTFs. * * This function pushes information about the current size of the * DTM's data structures onto a stack, for use by popRewindMark() * (which see). * * %REVIEW% I have no idea how to rewind m_elemIndexes. However, * RTFs will not be indexed, so I can simply panic if that case * arises. Hey, it works... * */ public void pushRewindMark() { if(m_indexing || m_elemIndexes!=null) throw new java.lang.NullPointerException("Coding error; Don't try to mark/rewind an indexed DTM"); // Values from DTMDefaultBase // %REVIEW% Can the namespace stack sizes ever differ? If not, save space! mark_size.push(m_size); mark_nsdeclset_size.push((m_namespaceDeclSets==null) ? 0 : m_namespaceDeclSets.size()); mark_nsdeclelem_size.push((m_namespaceDeclSetElements==null) ? 0 : m_namespaceDeclSetElements.size()); // Values from SAX2DTM mark_data_size.push(m_data.size()); mark_char_size.push(m_chars.size()); mark_doq_size.push(m_dataOrQName.size()); } /** "Tail-pruning" support for RTFs. * * This function pops the information previously saved by * pushRewindMark (which see) and uses it to discard all nodes added * to the DTM after that time. We expect that this will allow us to * reuse storage more effectively. * * This is _not_ intended to be called while a document is still being * constructed -- only between endDocument and the next startDocument * * %REVIEW% WARNING: This is the first use of some of the truncation * methods. If Xalan blows up after this is called, that's a likely * place to check. * * %REVIEW% Our original design for DTMs permitted them to share * string pools. If there any risk that this might be happening, we * can _not_ rewind and recover the string storage. One solution * might to assert that DTMs used for RTFs Must Not take advantage * of that feature, but this seems excessively fragile. Another, much * less attractive, would be to just let them leak... Nah. * * @return true if and only if the pop completely emptied the * RTF. That response is used when determining how to unspool * RTF-started-while-RTF-open situations. * */ public boolean popRewindMark() { boolean top=mark_size.empty(); m_size=top ? m_emptyNodeCount : mark_size.pop(); m_exptype.setSize(m_size); m_firstch.setSize(m_size); m_nextsib.setSize(m_size); m_prevsib.setSize(m_size); m_parent.setSize(m_size); m_elemIndexes=null; int ds= top ? m_emptyNSDeclSetCount : mark_nsdeclset_size.pop(); if (m_namespaceDeclSets!=null) { m_namespaceDeclSets.setSize(ds); } int ds1= top ? m_emptyNSDeclSetElemsCount : mark_nsdeclelem_size.pop(); if (m_namespaceDeclSetElements!=null) { m_namespaceDeclSetElements.setSize(ds1); } // Values from SAX2DTM - m_data always has a reserved entry m_data.setSize(top ? m_emptyDataCount : mark_data_size.pop()); m_chars.setLength(top ? m_emptyCharsCount : mark_char_size.pop()); m_dataOrQName.setSize(top ? m_emptyDataQNCount : mark_doq_size.pop()); // Return true iff DTM now empty return m_size==0; } /** @return true if a DTM tree is currently under construction. * */ public boolean isTreeIncomplete() { return !m_endDocumentOccured; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java0000644000175000017500000027553210721374032023645 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAX2DTM2.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref.sax2dtm; import org.apache.xml.dtm.*; import org.apache.xml.dtm.ref.*; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringDefault; import org.apache.xml.utils.XMLStringFactory; import org.apache.xml.res.XMLMessages; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.serializer.SerializationHandler; import javax.xml.transform.Source; import java.util.Vector; import org.apache.xml.utils.SuballocatedIntVector; import org.xml.sax.*; /** * SAX2DTM2 is an optimized version of SAX2DTM which is used in non-incremental situation. * It is used as the super class of the XSLTC SAXImpl. Many of the interfaces in SAX2DTM * and DTMDefaultBase are overridden in SAX2DTM2 in order to allow fast, efficient * access to the DTM model. Some nested iterators in DTMDefaultBaseIterators * are also overridden in SAX2DTM2 for performance reasons. *

    * Performance is the biggest consideration in the design of SAX2DTM2. To make the code most * efficient, the incremental support is dropped in SAX2DTM2, which means that you should not * use it in incremental situation. To reduce the overhead of pulling data from the DTM model, * a few core interfaces in SAX2DTM2 have direct access to the internal arrays of the * SuballocatedIntVectors. *

    * The design of SAX2DTM2 may limit its extensibilty. If you have a reason to extend the * SAX2DTM model, please extend from SAX2DTM instead of this class. *

    * TODO: This class is currently only used by XSLTC. We need to investigate the possibility * of also using it in Xalan-J Interpretive. Xalan's performance is likely to get an instant * boost if we use SAX2DTM2 instead of SAX2DTM in non-incremental case. *

    * %MK% The code in this class is critical to the XSLTC_DTM performance. Be very careful * when making changes here! */ public class SAX2DTM2 extends SAX2DTM { /**************************************************************** * Optimized version of the nested iterators ****************************************************************/ /** * Iterator that returns all immediate children of a given node */ public final class ChildrenIterator extends InternalAxisIteratorBase { /** * Setting start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. *

    * If the iterator is not restartable, this has no effect. * %REVIEW% Should it return/throw something in that case, * or set current node to END, to indicate request-not-honored? * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : _firstch2(makeNodeIdentity(node)); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END if no more * are available. */ public int next() { if (_currentNode != NULL) { int node = _currentNode; _currentNode = _nextsib2(node); return returnNode(makeNodeHandle(node)); } return END; } } // end of ChildrenIterator /** * Iterator that returns the parent of a given node. Note that * this delivers only a single node; if you want all the ancestors, * see AncestorIterator. */ public final class ParentIterator extends InternalAxisIteratorBase { /** The extended type ID that was requested. */ private int _nodeType = DTM.NULL; /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; if (node != DTM.NULL) _currentNode = _parent2(makeNodeIdentity(node)); else _currentNode = DTM.NULL; return resetPosition(); } return this; } /** * Set the node type of the parent that we're looking for. * Note that this does _not_ mean "find the nearest ancestor of * this type", but "yield the parent if it is of this type". * * * @param type extended type ID. * * @return ParentIterator configured with the type filter set. */ public DTMAxisIterator setNodeType(final int type) { _nodeType = type; return this; } /** * Get the next node in the iteration. In this case, we return * only the immediate parent, _if_ it matches the requested nodeType. * * @return The next node handle in the iteration, or END. */ public int next() { int result = _currentNode; if (result == END) return DTM.NULL; // %OPT% The most common case is handled first. if (_nodeType == NULL) { _currentNode = END; return returnNode(makeNodeHandle(result)); } else if (_nodeType >= DTM.NTYPES) { if (_nodeType == _exptype2(result)) { _currentNode = END; return returnNode(makeNodeHandle(result)); } } else { if (_nodeType == _type2(result)) { _currentNode = END; return returnNode(makeNodeHandle(result)); } } return DTM.NULL; } } // end of ParentIterator /** * Iterator that returns children of a given type for a given node. * The functionality chould be achieved by putting a filter on top * of a basic child iterator, but a specialised iterator is used * for efficiency (both speed and size of translet). */ public final class TypedChildrenIterator extends InternalAxisIteratorBase { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedChildrenIterator * * * @param nodeType The extended type ID being requested. */ public TypedChildrenIterator(int nodeType) { _nodeType = nodeType; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : _firstch2(makeNodeIdentity(_startNode)); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; if (node == DTM.NULL) return DTM.NULL; final int nodeType = _nodeType; if (nodeType != DTM.ELEMENT_NODE) { while (node != DTM.NULL && _exptype2(node) != nodeType) { node = _nextsib2(node); } } // %OPT% If the nodeType is element (matching child::*), we only // need to compare the expType with DTM.NTYPES. A child node of // an element can be either an element, text, comment or // processing instruction node. Only element node has an extended // type greater than or equal to DTM.NTYPES. else { int eType; while (node != DTM.NULL) { eType = _exptype2(node); if (eType >= DTM.NTYPES) break; else node = _nextsib2(node); } } if (node == DTM.NULL) { _currentNode = DTM.NULL; return DTM.NULL; } else { _currentNode = _nextsib2(node); return returnNode(makeNodeHandle(node)); } } /** * Return the node at the given position. */ public int getNodeByPosition(int position) { if (position <= 0) return DTM.NULL; int node = _currentNode; int pos = 0; final int nodeType = _nodeType; if (nodeType != DTM.ELEMENT_NODE) { while (node != DTM.NULL) { if (_exptype2(node) == nodeType) { pos++; if (pos == position) return makeNodeHandle(node); } node = _nextsib2(node); } return NULL; } else { while (node != DTM.NULL) { if (_exptype2(node) >= DTM.NTYPES) { pos++; if (pos == position) return makeNodeHandle(node); } node = _nextsib2(node); } return NULL; } } } // end of TypedChildrenIterator /** * Iterator that returns the namespace nodes as defined by the XPath data model * for a given node, filtered by extended type ID. */ public class TypedRootIterator extends RootIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedRootIterator * * @param nodeType The extended type ID being requested. */ public TypedRootIterator(int nodeType) { super(); _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if(_startNode == _currentNode) return NULL; final int node = _startNode; int expType = _exptype2(makeNodeIdentity(node)); _currentNode = node; if (_nodeType >= DTM.NTYPES) { if (_nodeType == expType) { return returnNode(node); } } else { if (expType < DTM.NTYPES) { if (expType == _nodeType) { return returnNode(node); } } else { if (m_extendedTypes[expType].getNodeType() == _nodeType) { return returnNode(node); } } } return NULL; } } // end of TypedRootIterator /** * Iterator that returns all siblings of a given node. */ public class FollowingSiblingIterator extends InternalAxisIteratorBase { /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = makeNodeIdentity(node); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { _currentNode = (_currentNode == DTM.NULL) ? DTM.NULL : _nextsib2(_currentNode); return returnNode(makeNodeHandle(_currentNode)); } } // end of FollowingSiblingIterator /** * Iterator that returns all following siblings of a given node. */ public final class TypedFollowingSiblingIterator extends FollowingSiblingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedFollowingSiblingIterator * * * @param type The extended type ID being requested. */ public TypedFollowingSiblingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_currentNode == DTM.NULL) { return DTM.NULL; } int node = _currentNode; final int nodeType = _nodeType; if (nodeType != DTM.ELEMENT_NODE) { while ((node = _nextsib2(node)) != DTM.NULL && _exptype2(node) != nodeType) {} } else { while ((node = _nextsib2(node)) != DTM.NULL && _exptype2(node) < DTM.NTYPES) {} } _currentNode = node; return (node == DTM.NULL) ? DTM.NULL : returnNode(makeNodeHandle(node)); } } // end of TypedFollowingSiblingIterator /** * Iterator that returns attribute nodes (of what nodes?) */ public final class AttributeIterator extends InternalAxisIteratorBase { // assumes caller will pass element nodes /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = getFirstAttributeIdentity(makeNodeIdentity(node)); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int node = _currentNode; if (node != NULL) { _currentNode = getNextAttributeIdentity(node); return returnNode(makeNodeHandle(node)); } return NULL; } } // end of AttributeIterator /** * Iterator that returns attribute nodes of a given type */ public final class TypedAttributeIterator extends InternalAxisIteratorBase { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedAttributeIterator * * * @param nodeType The extended type ID that is requested. */ public TypedAttributeIterator(int nodeType) { _nodeType = nodeType; } // assumes caller will pass element nodes /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = node; _currentNode = getTypedAttribute(node, _nodeType); return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int node = _currentNode; // singleton iterator, since there can only be one attribute of // a given type. _currentNode = NULL; return returnNode(node); } } // end of TypedAttributeIterator /** * Iterator that returns preceding siblings of a given node */ public class PrecedingSiblingIterator extends InternalAxisIteratorBase { /** * The node identity of _startNode for this iterator */ protected int _startNodeID; /** * True if this iterator has a reversed axis. * * @return true. */ public boolean isReverse() { return true; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; node = _startNodeID = makeNodeIdentity(node); if(node == NULL) { _currentNode = node; return resetPosition(); } int type = _type2(node); if(ExpandedNameTable.ATTRIBUTE == type || ExpandedNameTable.NAMESPACE == type ) { _currentNode = node; } else { // Be careful to handle the Document node properly _currentNode = _parent2(node); if(NULL!=_currentNode) _currentNode = _firstch2(_currentNode); else _currentNode = node; } return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_currentNode == _startNodeID || _currentNode == DTM.NULL) { return NULL; } else { final int node = _currentNode; _currentNode = _nextsib2(node); return returnNode(makeNodeHandle(node)); } } } // end of PrecedingSiblingIterator /** * Iterator that returns preceding siblings of a given type for * a given node */ public final class TypedPrecedingSiblingIterator extends PrecedingSiblingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedPrecedingSiblingIterator * * * @param type The extended type ID being requested. */ public TypedPrecedingSiblingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; final int nodeType = _nodeType; final int startNodeID = _startNodeID; if (nodeType != DTM.ELEMENT_NODE) { while (node != NULL && node != startNodeID && _exptype2(node) != nodeType) { node = _nextsib2(node); } } else { while (node != NULL && node != startNodeID && _exptype2(node) < DTM.NTYPES) { node = _nextsib2(node); } } if (node == DTM.NULL || node == startNodeID) { _currentNode = NULL; return NULL; } else { _currentNode = _nextsib2(node); return returnNode(makeNodeHandle(node)); } } /** * Return the index of the last node in this iterator. */ public int getLast() { if (_last != -1) return _last; setMark(); int node = _currentNode; final int nodeType = _nodeType; final int startNodeID = _startNodeID; int last = 0; if (nodeType != DTM.ELEMENT_NODE) { while (node != NULL && node != startNodeID) { if (_exptype2(node) == nodeType) { last++; } node = _nextsib2(node); } } else { while (node != NULL && node != startNodeID) { if (_exptype2(node) >= DTM.NTYPES) { last++; } node = _nextsib2(node); } } gotoMark(); return (_last = last); } } // end of TypedPrecedingSiblingIterator /** * Iterator that returns preceding nodes of a given node. * This includes the node set {root+1, start-1}, but excludes * all ancestors, attributes, and namespace nodes. */ public class PrecedingIterator extends InternalAxisIteratorBase { /** The max ancestors, but it can grow... */ private final int _maxAncestors = 8; /** * The stack of start node + ancestors up to the root of the tree, * which we must avoid. */ protected int[] _stack = new int[_maxAncestors]; /** (not sure yet... -sb) */ protected int _sp, _oldsp; protected int _markedsp, _markedNode, _markedDescendant; /* _currentNode precedes candidates. This is the identity, not the handle! */ /** * True if this iterator has a reversed axis. * * @return true since this iterator is a reversed axis. */ public boolean isReverse() { return true; } /** * Returns a deep copy of this iterator. The cloned iterator is not reset. * * @return a deep copy of this iterator. */ public DTMAxisIterator cloneIterator() { _isRestartable = false; try { final PrecedingIterator clone = (PrecedingIterator) super.clone(); final int[] stackCopy = new int[_stack.length]; System.arraycopy(_stack, 0, stackCopy, 0, _stack.length); clone._stack = stackCopy; // return clone.reset(); return clone; } catch (CloneNotSupportedException e) { throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported."); } } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { node = makeNodeIdentity(node); // iterator is not a clone int parent, index; if (_type2(node) == DTM.ATTRIBUTE_NODE) node = _parent2(node); _startNode = node; _stack[index = 0] = node; parent=node; while ((parent = _parent2(parent)) != NULL) { if (++index == _stack.length) { final int[] stack = new int[index*2]; System.arraycopy(_stack, 0, stack, 0, index); _stack = stack; } _stack[index] = parent; } if(index>0) --index; // Pop actual root node (if not start) back off the stack _currentNode=_stack[index]; // Last parent before root node _oldsp = _sp = index; return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { // Bugzilla 8324: We were forgetting to skip Attrs and NS nodes. // Also recoded the loop controls for clarity and to flatten out // the tail-recursion. for(++_currentNode; _sp>=0; ++_currentNode) { if(_currentNode < _stack[_sp]) { int type = _type2(_currentNode); if(type != ATTRIBUTE_NODE && type != NAMESPACE_NODE) return returnNode(makeNodeHandle(_currentNode)); } else --_sp; } return NULL; } // redefine DTMAxisIteratorBase's reset /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { _sp = _oldsp; return resetPosition(); } public void setMark() { _markedsp = _sp; _markedNode = _currentNode; _markedDescendant = _stack[0]; } public void gotoMark() { _sp = _markedsp; _currentNode = _markedNode; } } // end of PrecedingIterator /** * Iterator that returns preceding nodes of agiven type for a * given node. This includes the node set {root+1, start-1}, but * excludes all ancestors. */ public final class TypedPrecedingIterator extends PrecedingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedPrecedingIterator * * * @param type The extended type ID being requested. */ public TypedPrecedingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; final int nodeType = _nodeType; if (nodeType >= DTM.NTYPES) { while (true) { node++; if (_sp < 0) { node = NULL; break; } else if (node >= _stack[_sp]) { if (--_sp < 0) { node = NULL; break; } } else if (_exptype2(node) == nodeType) { break; } } } else { int expType; while (true) { node++; if (_sp < 0) { node = NULL; break; } else if (node >= _stack[_sp]) { if (--_sp < 0) { node = NULL; break; } } else { expType = _exptype2(node); if (expType < DTM.NTYPES) { if (expType == nodeType) { break; } } else { if (m_extendedTypes[expType].getNodeType() == nodeType) { break; } } } } } _currentNode = node; return (node == NULL) ? NULL : returnNode(makeNodeHandle(node)); } } // end of TypedPrecedingIterator /** * Iterator that returns following nodes of for a given node. */ public class FollowingIterator extends InternalAxisIteratorBase { //DTMAxisTraverser m_traverser; // easier for now public FollowingIterator() { //m_traverser = getAxisTraverser(Axis.FOLLOWING); } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; //_currentNode = m_traverser.first(node); node = makeNodeIdentity(node); int first; int type = _type2(node); if ((DTM.ATTRIBUTE_NODE == type) || (DTM.NAMESPACE_NODE == type)) { node = _parent2(node); first = _firstch2(node); if (NULL != first) { _currentNode = makeNodeHandle(first); return resetPosition(); } } do { first = _nextsib2(node); if (NULL == first) node = _parent2(node); } while (NULL == first && NULL != node); _currentNode = makeNodeHandle(first); // _currentNode precedes possible following(node) nodes return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; //_currentNode = m_traverser.next(_startNode, _currentNode); int current = makeNodeIdentity(node); while (true) { current++; int type = _type2(current); if (NULL == type) { _currentNode = NULL; return returnNode(node); } if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type) continue; _currentNode = makeNodeHandle(current); return returnNode(node); } } } // end of FollowingIterator /** * Iterator that returns following nodes of a given type for a given node. */ public final class TypedFollowingIterator extends FollowingIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedFollowingIterator * * * @param type The extended type ID being requested. */ public TypedFollowingIterator(int type) { _nodeType = type; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int current; int node; int type; final int nodeType = _nodeType; int currentNodeID = makeNodeIdentity(_currentNode); if (nodeType >= DTM.NTYPES) { do { node = currentNodeID; current = node; do { current++; type = _type2(current); } while (type != NULL && (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type)); currentNodeID = (type != NULL) ? current : NULL; } while (node != DTM.NULL && _exptype2(node) != nodeType); } else { do { node = currentNodeID; current = node; do { current++; type = _type2(current); } while (type != NULL && (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type)); currentNodeID = (type != NULL) ? current : NULL; } while (node != DTM.NULL && (_exptype2(node) != nodeType && _type2(node) != nodeType)); } _currentNode = makeNodeHandle(currentNodeID); return (node == DTM.NULL ? DTM.NULL :returnNode(makeNodeHandle(node))); } } // end of TypedFollowingIterator /** * Iterator that returns the ancestors of a given node in document * order. (NOTE! This was changed from the XSLTC code!) */ public class AncestorIterator extends InternalAxisIteratorBase { // The initial size of the ancestor array private static final int m_blocksize = 32; // The array for ancestor nodes. This array will grow dynamically. int[] m_ancestors = new int[m_blocksize]; // Number of ancestor nodes in the array int m_size = 0; int m_ancestorsPos; int m_markedPos; /** The real start node for this axes, since _startNode will be adjusted. */ int m_realStartNode; /** * Get start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @return The root node of the iteration. */ public int getStartNode() { return m_realStartNode; } /** * True if this iterator has a reversed axis. * * @return true since this iterator is a reversed axis. */ public final boolean isReverse() { return true; } /** * Returns a deep copy of this iterator. The cloned iterator is not reset. * * @return a deep copy of this iterator. */ public DTMAxisIterator cloneIterator() { _isRestartable = false; // must set to false for any clone try { final AncestorIterator clone = (AncestorIterator) super.clone(); clone._startNode = _startNode; // return clone.reset(); return clone; } catch (CloneNotSupportedException e) { throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported."); } } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); m_realStartNode = node; if (_isRestartable) { int nodeID = makeNodeIdentity(node); m_size = 0; if (nodeID == DTM.NULL) { _currentNode = DTM.NULL; m_ancestorsPos = 0; return this; } // Start from the current node's parent if // _includeSelf is false. if (!_includeSelf) { nodeID = _parent2(nodeID); node = makeNodeHandle(nodeID); } _startNode = node; while (nodeID != END) { //m_ancestors.addElement(node); if (m_size >= m_ancestors.length) { int[] newAncestors = new int[m_size * 2]; System.arraycopy(m_ancestors, 0, newAncestors, 0, m_ancestors.length); m_ancestors = newAncestors; } m_ancestors[m_size++] = node; nodeID = _parent2(nodeID); node = makeNodeHandle(nodeID); } m_ancestorsPos = m_size - 1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors[m_ancestorsPos] : DTM.NULL; return resetPosition(); } return this; } /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { m_ancestorsPos = m_size - 1; _currentNode = (m_ancestorsPos >= 0) ? m_ancestors[m_ancestorsPos] : DTM.NULL; return resetPosition(); } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int next = _currentNode; int pos = --m_ancestorsPos; _currentNode = (pos >= 0) ? m_ancestors[m_ancestorsPos] : DTM.NULL; return returnNode(next); } public void setMark() { m_markedPos = m_ancestorsPos; } public void gotoMark() { m_ancestorsPos = m_markedPos; _currentNode = m_ancestorsPos>=0 ? m_ancestors[m_ancestorsPos] : DTM.NULL; } } // end of AncestorIterator /** * Typed iterator that returns the ancestors of a given node. */ public final class TypedAncestorIterator extends AncestorIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedAncestorIterator * * * @param type The extended type ID being requested. */ public TypedAncestorIterator(int type) { _nodeType = type; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); m_realStartNode = node; if (_isRestartable) { int nodeID = makeNodeIdentity(node); m_size = 0; if (nodeID == DTM.NULL) { _currentNode = DTM.NULL; m_ancestorsPos = 0; return this; } final int nodeType = _nodeType; if (!_includeSelf) { nodeID = _parent2(nodeID); node = makeNodeHandle(nodeID); } _startNode = node; if (nodeType >= DTM.NTYPES) { while (nodeID != END) { int eType = _exptype2(nodeID); if (eType == nodeType) { if (m_size >= m_ancestors.length) { int[] newAncestors = new int[m_size * 2]; System.arraycopy(m_ancestors, 0, newAncestors, 0, m_ancestors.length); m_ancestors = newAncestors; } m_ancestors[m_size++] = makeNodeHandle(nodeID); } nodeID = _parent2(nodeID); } } else { while (nodeID != END) { int eType = _exptype2(nodeID); if ((eType < DTM.NTYPES && eType == nodeType) || (eType >= DTM.NTYPES && m_extendedTypes[eType].getNodeType() == nodeType)) { if (m_size >= m_ancestors.length) { int[] newAncestors = new int[m_size * 2]; System.arraycopy(m_ancestors, 0, newAncestors, 0, m_ancestors.length); m_ancestors = newAncestors; } m_ancestors[m_size++] = makeNodeHandle(nodeID); } nodeID = _parent2(nodeID); } } m_ancestorsPos = m_size - 1; _currentNode = (m_ancestorsPos>=0) ? m_ancestors[m_ancestorsPos] : DTM.NULL; return resetPosition(); } return this; } /** * Return the node at the given position. */ public int getNodeByPosition(int position) { if (position > 0 && position <= m_size) { return m_ancestors[position-1]; } else return DTM.NULL; } /** * Returns the position of the last node within the iteration, as * defined by XPath. */ public int getLast() { return m_size; } } // end of TypedAncestorIterator /** * Iterator that returns the descendants of a given node. */ public class DescendantIterator extends InternalAxisIteratorBase { /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { node = makeNodeIdentity(node); _startNode = node; if (_includeSelf) node--; _currentNode = node; return resetPosition(); } return this; } /** * Tell if this node identity is a descendant. Assumes that * the node info for the element has already been obtained. * * This one-sided test works only if the parent has been * previously tested and is known to be a descendent. It fails if * the parent is the _startNode's next sibling, or indeed any node * that follows _startNode in document order. That may suffice * for this iterator, but it's not really an isDescendent() test. * %REVIEW% rename? * * @param identity The index number of the node in question. * @return true if the index is a descendant of _startNode. */ protected final boolean isDescendant(int identity) { return (_parent2(identity) >= _startNode) || (_startNode == identity); } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int startNode = _startNode; if (startNode == NULL) { return NULL; } if (_includeSelf && (_currentNode + 1) == startNode) return returnNode(makeNodeHandle(++_currentNode)); // | m_dtmIdent); int node = _currentNode; int type; // %OPT% If the startNode is the root node, do not need // to do the isDescendant() check. if (startNode == ROOTNODE) { int eType; do { node++; eType = _exptype2(node); if (NULL == eType) { _currentNode = NULL; return END; } } while (eType == TEXT_NODE || (type = m_extendedTypes[eType].getNodeType()) == ATTRIBUTE_NODE || type == NAMESPACE_NODE); } else { do { node++; type = _type2(node); if (NULL == type ||!isDescendant(node)) { _currentNode = NULL; return END; } } while(ATTRIBUTE_NODE == type || TEXT_NODE == type || NAMESPACE_NODE == type); } _currentNode = node; return returnNode(makeNodeHandle(node)); // make handle. } /** * Reset. * */ public DTMAxisIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(makeNodeHandle(_startNode)); _isRestartable = temp; return this; } } // end of DescendantIterator /** * Typed iterator that returns the descendants of a given node. */ public final class TypedDescendantIterator extends DescendantIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedDescendantIterator * * * @param nodeType Extended type ID being requested. */ public TypedDescendantIterator(int nodeType) { _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int startNode = _startNode; if (_startNode == NULL) { return NULL; } int node = _currentNode; int expType; final int nodeType = _nodeType; if (nodeType != DTM.ELEMENT_NODE) { do { node++; expType = _exptype2(node); if (NULL == expType || _parent2(node) < startNode && startNode != node) { _currentNode = NULL; return END; } } while (expType != nodeType); } // %OPT% If the start node is root (e.g. in the case of //node), // we can save the isDescendant() check, because all nodes are // descendants of root. else if (startNode == DTMDefaultBase.ROOTNODE) { do { node++; expType = _exptype2(node); if (NULL == expType) { _currentNode = NULL; return END; } } while (expType < DTM.NTYPES || m_extendedTypes[expType].getNodeType() != DTM.ELEMENT_NODE); } else { do { node++; expType = _exptype2(node); if (NULL == expType || _parent2(node) < startNode && startNode != node) { _currentNode = NULL; return END; } } while (expType < DTM.NTYPES || m_extendedTypes[expType].getNodeType() != DTM.ELEMENT_NODE); } _currentNode = node; return returnNode(makeNodeHandle(node)); } } // end of TypedDescendantIterator /** * Iterator that returns a given node only if it is of a given type. */ public final class TypedSingletonIterator extends SingletonIterator { /** The extended type ID that was requested. */ private final int _nodeType; /** * Constructor TypedSingletonIterator * * * @param nodeType The extended type ID being requested. */ public TypedSingletonIterator(int nodeType) { _nodeType = nodeType; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int result = _currentNode; if (result == END) return DTM.NULL; _currentNode = END; if (_nodeType >= DTM.NTYPES) { if (_exptype2(makeNodeIdentity(result)) == _nodeType) { return returnNode(result); } } else { if (_type2(makeNodeIdentity(result)) == _nodeType) { return returnNode(result); } } return NULL; } } // end of TypedSingletonIterator /******************************************************************* * End of nested iterators *******************************************************************/ // %OPT% Array references which are used to cache the map0 arrays in // SuballocatedIntVectors. Using the cached arrays reduces the level // of indirection and results in better performance than just calling // SuballocatedIntVector.elementAt(). private int[] m_exptype_map0; private int[] m_nextsib_map0; private int[] m_firstch_map0; private int[] m_parent_map0; // Double array references to the map arrays in SuballocatedIntVectors. private int[][] m_exptype_map; private int[][] m_nextsib_map; private int[][] m_firstch_map; private int[][] m_parent_map; // %OPT% Cache the array of extended types in this class protected ExtendedType[] m_extendedTypes; // A Vector which is used to store the values of attribute, namespace, // comment and PI nodes. // // %OPT% These values are unlikely to be equal. Storing // them in a plain Vector is more efficient than storing in the // DTMStringPool because we can save the cost for hash calculation. // // %REVISIT% Do we need a custom class (e.g. StringVector) here? protected Vector m_values; // The current index into the m_values Vector. private int m_valueIndex = 0; // The maximum value of the current node index. private int m_maxNodeIndex; // Cache the shift and mask values for the SuballocatedIntVectors. protected int m_SHIFT; protected int m_MASK; protected int m_blocksize; /** %OPT% If the offset and length of a Text node are within certain limits, * we store a bitwise encoded value into an int, using 10 bits (max. 1024) * for length and 21 bits for offset. We can save two SuballocatedIntVector * calls for each getStringValueX() and dispatchCharacterEvents() call by * doing this. */ // The number of bits for the length of a Text node. protected final static int TEXT_LENGTH_BITS = 10; // The number of bits for the offset of a Text node. protected final static int TEXT_OFFSET_BITS = 21; // The maximum length value protected final static int TEXT_LENGTH_MAX = (1<>>=1) != 0; ++shift); m_blocksize = 1<This one is less efficient than _exptype2. It is only used during * DTM building. _exptype2 is used after the document is fully built. */ public final int _exptype(int identity) { return m_exptype.elementAt(identity); } /************************************************************************ * DTM base accessor interfaces * * %OPT% The code in the following interfaces (e.g. _exptype2, etc.) are * very important to the DTM performance. To have the best performace, * these several interfaces have direct access to the internal arrays of * the SuballocatedIntVectors. The final modifier also has a noticeable * impact on performance. ***********************************************************************/ /** * The optimized version of DTMDefaultBase._exptype(). * * @param identity A node identity, which must not be equal to * DTM.NULL */ public final int _exptype2(int identity) { //return m_exptype.elementAt(identity); if (identity < m_blocksize) return m_exptype_map0[identity]; else return m_exptype_map[identity>>>m_SHIFT][identity&m_MASK]; } /** * The optimized version of DTMDefaultBase._nextsib(). * * @param identity A node identity, which must not be equal to * DTM.NULL */ public final int _nextsib2(int identity) { //return m_nextsib.elementAt(identity); if (identity < m_blocksize) return m_nextsib_map0[identity]; else return m_nextsib_map[identity>>>m_SHIFT][identity&m_MASK]; } /** * The optimized version of DTMDefaultBase._firstch(). * * @param identity A node identity, which must not be equal to * DTM.NULL */ public final int _firstch2(int identity) { //return m_firstch.elementAt(identity); if (identity < m_blocksize) return m_firstch_map0[identity]; else return m_firstch_map[identity>>>m_SHIFT][identity&m_MASK]; } /** * The optimized version of DTMDefaultBase._parent(). * * @param identity A node identity, which must not be equal to * DTM.NULL */ public final int _parent2(int identity) { //return m_parent.elementAt(identity); if (identity < m_blocksize) return m_parent_map0[identity]; else return m_parent_map[identity>>>m_SHIFT][identity&m_MASK]; } /** * The optimized version of DTMDefaultBase._type(). * * @param identity A node identity, which must not be equal to * DTM.NULL */ public final int _type2(int identity) { //int eType = _exptype2(identity); int eType; if (identity < m_blocksize) eType = m_exptype_map0[identity]; else eType = m_exptype_map[identity>>>m_SHIFT][identity&m_MASK]; if (NULL != eType) return m_extendedTypes[eType].getNodeType(); else return NULL; } /** * The optimized version of DTMDefaultBase.getExpandedTypeID(int). * *

    This one is only used by DOMAdapter.getExpandedTypeID(int), which * is mostly called from the compiled translets. */ public final int getExpandedTypeID2(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); //return (nodeID != NULL) ? _exptype2(nodeID) : NULL; if (nodeID != NULL) { if (nodeID < m_blocksize) return m_exptype_map0[nodeID]; else return m_exptype_map[nodeID>>>m_SHIFT][nodeID&m_MASK]; } else return NULL; } /************************************************************************* * END of DTM base accessor interfaces *************************************************************************/ /** * Return the node type from the expanded type */ public final int _exptype2Type(int exptype) { if (NULL != exptype) return m_extendedTypes[exptype].getNodeType(); else return NULL; } /** * Get a prefix either from the uri mapping, or just make * one up! * * @param uri The namespace URI, which may be null. * * @return The prefix if there is one, or null. */ public int getIdForNamespace(String uri) { int index = m_values.indexOf(uri); if (index < 0) { m_values.addElement(uri); return m_valueIndex++; } else return index; } /** * Override SAX2DTM.startElement() * *

    Receive notification of the start of an element. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each element (such as allocating a new tree node or writing * output to a file).

    * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified name (with prefix), or the * empty string if qualified names are not available. * @param attributes The specified or defaulted attributes. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement */ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { charactersFlush(); int exName = m_expandedNameTable.getExpandedTypeID(uri, localName, DTM.ELEMENT_NODE); int prefixIndex = (qName.length() != localName.length()) ? m_valuesOrPrefixes.stringToIndex(qName) : 0; int elemNode = addNode(DTM.ELEMENT_NODE, exName, m_parents.peek(), m_previous, prefixIndex, true); if(m_indexing) indexNode(exName, elemNode); m_parents.push(elemNode); int startDecls = m_contextIndexes.peek(); int nDecls = m_prefixMappings.size(); String prefix; if(!m_pastFirstElement) { // SPECIAL CASE: Implied declaration at root element prefix="xml"; String declURL = "http://www.w3.org/XML/1998/namespace"; exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE); m_values.addElement(declURL); int val = m_valueIndex++; addNode(DTM.NAMESPACE_NODE, exName, elemNode, DTM.NULL, val, false); m_pastFirstElement=true; } for (int i = startDecls; i < nDecls; i += 2) { prefix = (String) m_prefixMappings.elementAt(i); if (prefix == null) continue; String declURL = (String) m_prefixMappings.elementAt(i + 1); exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE); m_values.addElement(declURL); int val = m_valueIndex++; addNode(DTM.NAMESPACE_NODE, exName, elemNode, DTM.NULL, val, false); } int n = attributes.getLength(); for (int i = 0; i < n; i++) { String attrUri = attributes.getURI(i); String attrQName = attributes.getQName(i); String valString = attributes.getValue(i); int nodeType; String attrLocalName = attributes.getLocalName(i); if ((null != attrQName) && (attrQName.equals("xmlns") || attrQName.startsWith("xmlns:"))) { prefix = getPrefix(attrQName, attrUri); if (declAlreadyDeclared(prefix)) continue; // go to the next attribute. nodeType = DTM.NAMESPACE_NODE; } else { nodeType = DTM.ATTRIBUTE_NODE; if (m_buildIdIndex && attributes.getType(i).equalsIgnoreCase("ID")) setIDAttribute(valString, elemNode); } // Bit of a hack... if somehow valString is null, stringToIndex will // return -1, which will make things very unhappy. if(null == valString) valString = ""; m_values.addElement(valString); int val = m_valueIndex++; if (attrLocalName.length() != attrQName.length()) { prefixIndex = m_valuesOrPrefixes.stringToIndex(attrQName); int dataIndex = m_data.size(); m_data.addElement(prefixIndex); m_data.addElement(val); val = -dataIndex; } exName = m_expandedNameTable.getExpandedTypeID(attrUri, attrLocalName, nodeType); addNode(nodeType, exName, elemNode, DTM.NULL, val, false); } if (null != m_wsfilter) { short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(elemNode), this); boolean shouldStrip = (DTMWSFilter.INHERIT == wsv) ? getShouldStripWhitespace() : (DTMWSFilter.STRIP == wsv); pushShouldStripWhitespace(shouldStrip); } m_previous = DTM.NULL; m_contextIndexes.push(m_prefixMappings.size()); // for the children. } /** * Receive notification of the end of an element. * *

    By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each element (such as finalising a tree node or writing * output to a file).

    * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified XML 1.0 name (with prefix), or the * empty string if qualified names are not available. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endElement */ public void endElement(String uri, String localName, String qName) throws SAXException { charactersFlush(); // If no one noticed, startPrefixMapping is a drag. // Pop the context for the last child (the one pushed by startElement) m_contextIndexes.quickPop(1); // Do it again for this one (the one pushed by the last endElement). int topContextIndex = m_contextIndexes.peek(); if (topContextIndex != m_prefixMappings.size()) { m_prefixMappings.setSize(topContextIndex); } m_previous = m_parents.pop(); popShouldStripWhitespace(); } /** * Report an XML comment anywhere in the document. * *

    This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read).

    * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws SAXException { if (m_insideDTD) // ignore comments if we're inside the DTD return; charactersFlush(); // %OPT% Saving the comment string in a Vector has a lower cost than // saving it in DTMStringPool. m_values.addElement(new String(ch, start, length)); int dataIndex = m_valueIndex++; m_previous = addNode(DTM.COMMENT_NODE, DTM.COMMENT_NODE, m_parents.peek(), m_previous, dataIndex, false); } /** * Receive notification of the beginning of the document. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument() throws SAXException { int doc = addNode(DTM.DOCUMENT_NODE, DTM.DOCUMENT_NODE, DTM.NULL, DTM.NULL, 0, true); m_parents.push(doc); m_previous = DTM.NULL; m_contextIndexes.push(m_prefixMappings.size()); // for the next element. } /** * Receive notification of the end of the document. * * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument() throws SAXException { super.endDocument(); // Add a NULL entry to the end of the node arrays as // the end indication. m_exptype.addElement(NULL); m_parent.addElement(NULL); m_nextsib.addElement(NULL); m_firstch.addElement(NULL); // Set the cached references after the document is built. m_extendedTypes = m_expandedNameTable.getExtendedTypes(); m_exptype_map = m_exptype.getMap(); m_nextsib_map = m_nextsib.getMap(); m_firstch_map = m_firstch.getMap(); m_parent_map = m_parent.getMap(); } /** * Construct the node map from the node. * * @param type raw type ID, one of DTM.XXX_NODE. * @param expandedTypeID The expended type ID. * @param parentIndex The current parent index. * @param previousSibling The previous sibling index. * @param dataOrPrefix index into m_data table, or string handle. * @param canHaveFirstChild true if the node can have a first child, false * if it is atomic. * * @return The index identity of the node that was added. */ protected final int addNode(int type, int expandedTypeID, int parentIndex, int previousSibling, int dataOrPrefix, boolean canHaveFirstChild) { // Common to all nodes: int nodeIndex = m_size++; // Have we overflowed a DTM Identity's addressing range? //if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS)) if (nodeIndex == m_maxNodeIndex) { addNewDTMID(nodeIndex); m_maxNodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS); } m_firstch.addElement(DTM.NULL); m_nextsib.addElement(DTM.NULL); m_parent.addElement(parentIndex); m_exptype.addElement(expandedTypeID); m_dataOrQName.addElement(dataOrPrefix); if (m_prevsib != null) { m_prevsib.addElement(previousSibling); } if (m_locator != null && m_useSourceLocationProperty) { setSourceLocation(); } // Note that nextSibling is not processed until charactersFlush() // is called, to handle successive characters() events. // Special handling by type: Declare namespaces, attach first child switch(type) { case DTM.NAMESPACE_NODE: declareNamespaceInContext(parentIndex,nodeIndex); break; case DTM.ATTRIBUTE_NODE: break; default: if (DTM.NULL != previousSibling) { m_nextsib.setElementAt(nodeIndex,previousSibling); } else if (DTM.NULL != parentIndex) { m_firstch.setElementAt(nodeIndex,parentIndex); } break; } return nodeIndex; } /** * Check whether accumulated text should be stripped; if not, * append the appropriate flavor of text/cdata node. */ protected final void charactersFlush() { if (m_textPendingStart >= 0) // -1 indicates no-text-in-progress { int length = m_chars.size() - m_textPendingStart; boolean doStrip = false; if (getShouldStripWhitespace()) { doStrip = m_chars.isWhitespace(m_textPendingStart, length); } if (doStrip) { m_chars.setLength(m_textPendingStart); // Discard accumulated text } else { // Guard against characters/ignorableWhitespace events that // contained no characters. They should not result in a node. if (length > 0) { // If the offset and length do not exceed the given limits // (offset < 2^21 and length < 2^10), then save both the offset // and length in a bitwise encoded value. if (length <= TEXT_LENGTH_MAX && m_textPendingStart <= TEXT_OFFSET_MAX) { m_previous = addNode(m_coalescedTextType, DTM.TEXT_NODE, m_parents.peek(), m_previous, length + (m_textPendingStart << TEXT_LENGTH_BITS), false); } else { // Store offset and length in the m_data array if one exceeds // the given limits. Use a negative dataIndex as an indication. int dataIndex = m_data.size(); m_previous = addNode(m_coalescedTextType, DTM.TEXT_NODE, m_parents.peek(), m_previous, -dataIndex, false); m_data.addElement(m_textPendingStart); m_data.addElement(length); } } } // Reset for next text block m_textPendingStart = -1; m_textType = m_coalescedTextType = DTM.TEXT_NODE; } } /** * Override the processingInstruction() interface in SAX2DTM2. *

    * %OPT% This one is different from SAX2DTM.processingInstruction() * in that we do not use extended types for PI nodes. The name of * the PI is saved in the DTMStringPool. * * Receive notification of a processing instruction. * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction(String target, String data) throws SAXException { charactersFlush(); int dataIndex = m_data.size(); m_previous = addNode(DTM.PROCESSING_INSTRUCTION_NODE, DTM.PROCESSING_INSTRUCTION_NODE, m_parents.peek(), m_previous, -dataIndex, false); m_data.addElement(m_valuesOrPrefixes.stringToIndex(target)); m_values.addElement(data); m_data.addElement(m_valueIndex++); } /** * The optimized version of DTMDefaultBase.getFirstAttribute(). *

    * Given a node handle, get the index of the node's first attribute. * * @param nodeHandle int Handle of the node. * @return Handle of first attribute, or DTM.NULL to indicate none exists. */ public final int getFirstAttribute(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); if (nodeID == DTM.NULL) return DTM.NULL; int type = _type2(nodeID); if (DTM.ELEMENT_NODE == type) { // Assume that attributes and namespaces immediately follow the element. while (true) { nodeID++; // Assume this can not be null. type = _type2(nodeID); if (type == DTM.ATTRIBUTE_NODE) { return makeNodeHandle(nodeID); } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; } /** * The optimized version of DTMDefaultBase.getFirstAttributeIdentity(int). *

    * Given a node identity, get the index of the node's first attribute. * * @param identity int identity of the node. * @return Identity of first attribute, or DTM.NULL to indicate none exists. */ protected int getFirstAttributeIdentity(int identity) { if (identity == NULL) { return NULL; } int type = _type2(identity); if (DTM.ELEMENT_NODE == type) { // Assume that attributes and namespaces immediately follow the element. while (true) { identity++; // Assume this can not be null. type = _type2(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; } /** * The optimized version of DTMDefaultBase.getNextAttributeIdentity(int). *

    * Given a node identity for an attribute, advance to the next attribute. * * @param identity int identity of the attribute node. This * must be an attribute node. * * @return int DTM node-identity of the resolved attr, * or DTM.NULL to indicate none exists. * */ protected int getNextAttributeIdentity(int identity) { // Assume that attributes and namespace nodes immediately follow the element while (true) { identity++; int type = _type2(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (type != DTM.NAMESPACE_NODE) { break; } } return DTM.NULL; } /** * The optimized version of DTMDefaultBase.getTypedAttribute(int, int). *

    * Given a node handle and an expanded type ID, get the index of the node's * attribute of that type, if any. * * @param nodeHandle int Handle of the node. * @param attType int expanded type ID of the required attribute. * @return Handle of attribute of the required type, or DTM.NULL to indicate * none exists. */ protected final int getTypedAttribute(int nodeHandle, int attType) { int nodeID = makeNodeIdentity(nodeHandle); if (nodeID == DTM.NULL) return DTM.NULL; int type = _type2(nodeID); if (DTM.ELEMENT_NODE == type) { int expType; while (true) { nodeID++; expType = _exptype2(nodeID); if (expType != DTM.NULL) type = m_extendedTypes[expType].getNodeType(); else return DTM.NULL; if (type == DTM.ATTRIBUTE_NODE) { if (expType == attType) return makeNodeHandle(nodeID); } else if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; } /** * Override SAX2DTM.getLocalName() in SAX2DTM2. *

    Processing for PIs is different. * * Given a node handle, return its XPath- style localname. (As defined in * Namespaces, this is the portion of the name after any colon character). * * @param nodeHandle the id of the node. * @return String Local name of this node. */ public String getLocalName(int nodeHandle) { int expType = _exptype(makeNodeIdentity(nodeHandle)); if (expType == DTM.PROCESSING_INSTRUCTION_NODE) { int dataIndex = _dataOrQName(makeNodeIdentity(nodeHandle)); dataIndex = m_data.elementAt(-dataIndex); return m_valuesOrPrefixes.indexToString(dataIndex); } else return m_expandedNameTable.getLocalName(expType); } /** * The optimized version of SAX2DTM.getNodeNameX(). *

    * Given a node handle, return the XPath node name. This should be the name * as described by the XPath data model, NOT the DOM- style name. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. */ public final String getNodeNameX(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); int eType = _exptype2(nodeID); if (eType == DTM.PROCESSING_INSTRUCTION_NODE) { int dataIndex = _dataOrQName(nodeID); dataIndex = m_data.elementAt(-dataIndex); return m_valuesOrPrefixes.indexToString(dataIndex); } final ExtendedType extType = m_extendedTypes[eType]; if (extType.getNamespace().length() == 0) { return extType.getLocalName(); } else { int qnameIndex = m_dataOrQName.elementAt(nodeID); if (qnameIndex == 0) return extType.getLocalName(); if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } return m_valuesOrPrefixes.indexToString(qnameIndex); } } /** * The optimized version of SAX2DTM.getNodeName(). *

    * Given a node handle, return its DOM-style node name. This will include * names such as #text or #document. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. * %REVIEW% Document when empty string is possible... * %REVIEW-COMMENT% It should never be empty, should it? */ public String getNodeName(int nodeHandle) { int nodeID = makeNodeIdentity(nodeHandle); int eType = _exptype2(nodeID); final ExtendedType extType = m_extendedTypes[eType]; if (extType.getNamespace().length() == 0) { int type = extType.getNodeType(); String localName = extType.getLocalName(); if (type == DTM.NAMESPACE_NODE) { if (localName.length() == 0) return "xmlns"; else return "xmlns:" + localName; } else if (type == DTM.PROCESSING_INSTRUCTION_NODE) { int dataIndex = _dataOrQName(nodeID); dataIndex = m_data.elementAt(-dataIndex); return m_valuesOrPrefixes.indexToString(dataIndex); } else if (localName.length() == 0) { return getFixedNames(type); } else return localName; } else { int qnameIndex = m_dataOrQName.elementAt(nodeID); if (qnameIndex == 0) return extType.getLocalName(); if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } return m_valuesOrPrefixes.indexToString(qnameIndex); } } /** * Override SAX2DTM.getStringValue(int) *

    * This method is only used by Xalan-J Interpretive. It is not used by XSLTC. *

    * If the caller supplies an XMLStringFactory, the getStringValue() interface * in SAX2DTM will be called. Otherwise just calls getStringValueX() and * wraps the returned String in an XMLString. * * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return EMPTY_XML_STR; int type= _type2(identity); if (type == DTM.ELEMENT_NODE || type == DTM.DOCUMENT_NODE) { int startNode = identity; identity = _firstch2(identity); if (DTM.NULL != identity) { int offset = -1; int length = 0; do { type = _exptype2(identity); if (type == DTM.TEXT_NODE || type == DTM.CDATA_SECTION_NODE) { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex >= 0) { if (-1 == offset) { offset = dataIndex >>> TEXT_LENGTH_BITS; } length += dataIndex & TEXT_LENGTH_MAX; } else { if (-1 == offset) { offset = m_data.elementAt(-dataIndex); } length += m_data.elementAt(-dataIndex + 1); } } identity++; } while (_parent2(identity) >= startNode); if (length > 0) { if (m_xstrf != null) return m_xstrf.newstr(m_chars, offset, length); else return new XMLStringDefault(m_chars.getString(offset, length)); } else return EMPTY_XML_STR; } else return EMPTY_XML_STR; } else if (DTM.TEXT_NODE == type || DTM.CDATA_SECTION_NODE == type) { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex >= 0) { if (m_xstrf != null) return m_xstrf.newstr(m_chars, dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); else return new XMLStringDefault(m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX)); } else { if (m_xstrf != null) return m_xstrf.newstr(m_chars, m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1)); else return new XMLStringDefault(m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1))); } } else { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } if (m_xstrf != null) return m_xstrf.newstr((String)m_values.elementAt(dataIndex)); else return new XMLStringDefault((String)m_values.elementAt(dataIndex)); } } /** * The optimized version of SAX2DTM.getStringValue(int). *

    * %OPT% This is one of the most often used interfaces. Performance is * critical here. This one is different from SAX2DTM.getStringValue(int) in * that it returns a String instead of a XMLString. * * Get the string- value of a node as a String object (see http: //www. w3. * org/TR/xpath#data- model for the definition of a node's string- value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public final String getStringValueX(final int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return EMPTY_STR; int type= _type2(identity); if (type == DTM.ELEMENT_NODE || type == DTM.DOCUMENT_NODE) { int startNode = identity; identity = _firstch2(identity); if (DTM.NULL != identity) { int offset = -1; int length = 0; do { type = _exptype2(identity); if (type == DTM.TEXT_NODE || type == DTM.CDATA_SECTION_NODE) { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex >= 0) { if (-1 == offset) { offset = dataIndex >>> TEXT_LENGTH_BITS; } length += dataIndex & TEXT_LENGTH_MAX; } else { if (-1 == offset) { offset = m_data.elementAt(-dataIndex); } length += m_data.elementAt(-dataIndex + 1); } } identity++; } while (_parent2(identity) >= startNode); if (length > 0) { return m_chars.getString(offset, length); } else return EMPTY_STR; } else return EMPTY_STR; } else if (DTM.TEXT_NODE == type || DTM.CDATA_SECTION_NODE == type) { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex >= 0) { return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); } else { return m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1)); } } else { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } return (String)m_values.elementAt(dataIndex); } } /** * Returns the string value of the entire tree */ public String getStringValue() { int child = _firstch2(ROOTNODE); if (child == DTM.NULL) return EMPTY_STR; // optimization: only create StringBuffer if > 1 child if ((_exptype2(child) == DTM.TEXT_NODE) && (_nextsib2(child) == DTM.NULL)) { int dataIndex = m_dataOrQName.elementAt(child); if (dataIndex >= 0) return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); else return m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex + 1)); } else return getStringValueX(getDocument()); } /** * The optimized version of SAX2DTM.dispatchCharactersEvents(int, ContentHandler, boolean). *

    * Directly call the * characters method on the passed ContentHandler for the * string-value of the given node (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * @param normalize true if the content should be normalized according to * the rules for the XPath * normalize-space * function. * * @throws SAXException */ public final void dispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize) throws SAXException { int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return; int type = _type2(identity); if (type == DTM.ELEMENT_NODE || type == DTM.DOCUMENT_NODE) { int startNode = identity; identity = _firstch2(identity); if (DTM.NULL != identity) { int offset = -1; int length = 0; do { type = _exptype2(identity); if (type == DTM.TEXT_NODE || type == DTM.CDATA_SECTION_NODE) { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex >= 0) { if (-1 == offset) { offset = dataIndex >>> TEXT_LENGTH_BITS; } length += dataIndex & TEXT_LENGTH_MAX; } else { if (-1 == offset) { offset = m_data.elementAt(-dataIndex); } length += m_data.elementAt(-dataIndex + 1); } } identity++; } while (_parent2(identity) >= startNode); if (length > 0) { if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } } } else if (DTM.TEXT_NODE == type || DTM.CDATA_SECTION_NODE == type) { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex >= 0) { if (normalize) m_chars.sendNormalizedSAXcharacters(ch, dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); else m_chars.sendSAXcharacters(ch, dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); } else { if (normalize) m_chars.sendNormalizedSAXcharacters(ch, m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1)); else m_chars.sendSAXcharacters(ch, m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1)); } } else { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } String str = (String)m_values.elementAt(dataIndex); if(normalize) FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(), 0, str.length(), ch); else ch.characters(str.toCharArray(), 0, str.length()); } } /** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. *

    * * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public String getNodeValue(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type = _type2(identity); if (type == DTM.TEXT_NODE || type == DTM.CDATA_SECTION_NODE) { int dataIndex = _dataOrQName(identity); if (dataIndex > 0) { return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); } else { return m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1)); } } else if (DTM.ELEMENT_NODE == type || DTM.DOCUMENT_FRAGMENT_NODE == type || DTM.DOCUMENT_NODE == type) { return null; } else { int dataIndex = m_dataOrQName.elementAt(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } return (String)m_values.elementAt(dataIndex); } } /** * Copy the String value of a Text node to a SerializationHandler */ protected final void copyTextNode(final int nodeID, SerializationHandler handler) throws SAXException { if (nodeID != DTM.NULL) { int dataIndex = m_dataOrQName.elementAt(nodeID); if (dataIndex >= 0) { m_chars.sendSAXcharacters(handler, dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); } else { m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex+1)); } } } /** * Copy an Element node to a SerializationHandler. * * @param nodeID The node identity * @param exptype The expanded type of the Element node * @param handler The SerializationHandler * @return The qualified name of the Element node. */ protected final String copyElement(int nodeID, int exptype, SerializationHandler handler) throws SAXException { final ExtendedType extType = m_extendedTypes[exptype]; String uri = extType.getNamespace(); String name = extType.getLocalName(); if (uri.length() == 0) { handler.startElement(name); return name; } else { int qnameIndex = m_dataOrQName.elementAt(nodeID); if (qnameIndex == 0) { handler.startElement(name); handler.namespaceAfterStartElement(EMPTY_STR, uri); return name; } if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } String qName = m_valuesOrPrefixes.indexToString(qnameIndex); handler.startElement(qName); int prefixIndex = qName.indexOf(':'); String prefix; if (prefixIndex > 0) { prefix = qName.substring(0, prefixIndex); } else { prefix = null; } handler.namespaceAfterStartElement(prefix, uri); return qName; } } /** * Copy namespace nodes. * * @param nodeID The Element node identity * @param handler The SerializationHandler * @param inScope true if all namespaces in scope should be copied, * false if only the namespace declarations should be copied. */ protected final void copyNS(final int nodeID, SerializationHandler handler, boolean inScope) throws SAXException { // %OPT% Optimization for documents which does not have any explicit // namespace nodes. For these documents, there is an implicit // namespace node (xmlns:xml="http://www.w3.org/XML/1998/namespace") // declared on the root element node. In this case, there is no // need to do namespace copying. We can safely return without // doing anything. if (m_namespaceDeclSetElements != null && m_namespaceDeclSetElements.size() == 1 && m_namespaceDeclSets != null && ((SuballocatedIntVector)m_namespaceDeclSets.elementAt(0)) .size() == 1) return; SuballocatedIntVector nsContext = null; int nextNSNode; // Find the first namespace node if (inScope) { nsContext = findNamespaceContext(nodeID); if (nsContext == null || nsContext.size() < 1) return; else nextNSNode = makeNodeIdentity(nsContext.elementAt(0)); } else nextNSNode = getNextNamespaceNode2(nodeID); int nsIndex = 1; while (nextNSNode != DTM.NULL) { // Retrieve the name of the namespace node int eType = _exptype2(nextNSNode); String nodeName = m_extendedTypes[eType].getLocalName(); // Retrieve the node value of the namespace node int dataIndex = m_dataOrQName.elementAt(nextNSNode); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } String nodeValue = (String)m_values.elementAt(dataIndex); handler.namespaceAfterStartElement(nodeName, nodeValue); if (inScope) { if (nsIndex < nsContext.size()) { nextNSNode = makeNodeIdentity(nsContext.elementAt(nsIndex)); nsIndex++; } else return; } else nextNSNode = getNextNamespaceNode2(nextNSNode); } } /** * Return the next namespace node following the given base node. * * @baseID The node identity of the base node, which can be an * element, attribute or namespace node. * @return The namespace node immediately following the base node. */ protected final int getNextNamespaceNode2(int baseID) { int type; while ((type = _type2(++baseID)) == DTM.ATTRIBUTE_NODE); if (type == DTM.NAMESPACE_NODE) return baseID; else return NULL; } /** * Copy attribute nodes from an element . * * @param nodeID The Element node identity * @param handler The SerializationHandler */ protected final void copyAttributes(final int nodeID, SerializationHandler handler) throws SAXException{ for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){ int eType = _exptype2(current); copyAttribute(current, eType, handler); } } /** * Copy an Attribute node to a SerializationHandler * * @param nodeID The node identity * @param exptype The expanded type of the Element node * @param handler The SerializationHandler */ protected final void copyAttribute(int nodeID, int exptype, SerializationHandler handler) throws SAXException { /* final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); */ final ExtendedType extType = m_extendedTypes[exptype]; final String uri = extType.getNamespace(); final String localName = extType.getLocalName(); String prefix = null; String qname = null; int dataIndex = _dataOrQName(nodeID); int valueIndex = dataIndex; if (dataIndex <= 0) { int prefixIndex = m_data.elementAt(-dataIndex); valueIndex = m_data.elementAt(-dataIndex+1); qname = m_valuesOrPrefixes.indexToString(prefixIndex); int colonIndex = qname.indexOf(':'); if (colonIndex > 0) { prefix = qname.substring(0, colonIndex); } } if (uri.length() != 0) { handler.namespaceAfterStartElement(prefix, uri); } String nodeName = (prefix != null) ? qname : localName; String nodeValue = (String)m_values.elementAt(valueIndex); handler.addAttribute(nodeName, nodeValue); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ref/DTMNodeListBase.java0000644000175000017500000000603010721374033023762 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMNodeListBase.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm.ref; import org.w3c.dom.Node; /** * DTMNodeList gives us an implementation of the DOM's * NodeList interface wrapped around a DTM Iterator. The author * considers this something of an abominations, since NodeList was not * intended to be a general purpose "list of nodes" API and is * generally considered by the DOM WG to have be a mistake... but I'm * told that some of the XPath/XSLT folks say they must have this * solution. * * Please note that this is not necessarily equivlaent to a DOM * NodeList operating over the same document. In particular: *

      * *
    • If there are several Text nodes in logical succession (ie, * across CDATASection and EntityReference boundaries), we will return * only the first; the caller is responsible for stepping through * them. * (%REVIEW% Provide a convenience routine here to assist, pending * proposed DOM Level 3 getAdjacentText() operation?)
    • * *
    • Since the whole XPath/XSLT architecture assumes that the source * document is not altered while we're working with it, we do not * promise to implement the DOM NodeList's "live view" response to * document mutation.
    • * *
    * *

    State: In progress!!

    * */ public class DTMNodeListBase implements org.w3c.dom.NodeList { public DTMNodeListBase() { } //================================================================ // org.w3c.dom.NodeList API follows /** * Returns the indexth item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * @param index Index into the collection. * @return The node at the indexth position in the * NodeList, or null if that is not a valid * index. */ public Node item(int index) { return null; } /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. */ public int getLength() { return 0; } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMConfigurationException.java0000644000175000017500000000662610721374031025371 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMConfigurationException.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; import javax.xml.transform.SourceLocator; /** * Indicates a serious configuration error. */ public class DTMConfigurationException extends DTMException { static final long serialVersionUID = -4607874078818418046L; /** * Create a new DTMConfigurationException with no * detail mesage. */ public DTMConfigurationException() { super("Configuration Error"); } /** * Create a new DTMConfigurationException with * the String specified as an error message. * * @param msg The error message for the exception. */ public DTMConfigurationException(String msg) { super(msg); } /** * Create a new DTMConfigurationException with a * given Exception base cause of the error. * * @param e The exception to be encapsulated in a * DTMConfigurationException. */ public DTMConfigurationException(Throwable e) { super(e); } /** * Create a new DTMConfigurationException with the * given Exception base cause and detail message. * * @param msg The detail message. * @param e The exception to be wrapped in a DTMConfigurationException */ public DTMConfigurationException(String msg, Throwable e) { super(msg, e); } /** * Create a new DTMConfigurationException from a message and a Locator. * *

    This constructor is especially useful when an application is * creating its own exception from within a DocumentHandler * callback.

    * * @param message The error or warning message. * @param locator The locator object for the error or warning. */ public DTMConfigurationException(String message, SourceLocator locator) { super(message, locator); } /** * Wrap an existing exception in a DTMConfigurationException. * * @param message The error or warning message, or null to * use the message from the embedded exception. * @param locator The locator object for the error or warning. * @param e Any exception. */ public DTMConfigurationException(String message, SourceLocator locator, Throwable e) { super(message, locator, e); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMAxisIterator.java0000644000175000017500000000610010721374032023305 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMAxisIterator.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * This class iterates over a single XPath Axis, and returns node handles. */ public interface DTMAxisIterator extends Cloneable { /** Specifies the end of the iteration, and is the same as DTM.NULL. */ public static final int END = DTM.NULL; /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next(); /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset(); /** * @return the number of nodes in this iterator. This may be an expensive * operation when called the first time. */ public int getLast(); /** * @return The position of the current node in the set, as defined by XPath. */ public int getPosition(); /** * Remembers the current node for the next call to gotoMark(). */ public void setMark(); /** * Restores the current node remembered by setMark(). */ public void gotoMark(); /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node); /** * Get start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @return The root node of the iteration. */ public int getStartNode(); /** * @return true if this iterator has a reversed axis, else false. */ public boolean isReverse(); /** * @return a deep copy of this iterator. The clone should not be reset * from its current position. */ public DTMAxisIterator cloneIterator(); /** * Set if restartable. */ public void setRestartable(boolean isRestartable); /** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position); } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMFilter.java0000644000175000017500000001664010721374031022125 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMFilter.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * Simple filter for doing node tests. Note the semantics of this are * somewhat different that the DOM's NodeFilter. */ public interface DTMFilter { // Constants for whatToShow. These are used to set the node type that will // be traversed. These values may be ORed together before being passed to // the DTMIterator. /** * Show all Nodes. */ public static final int SHOW_ALL = 0xFFFFFFFF; /** * Show Element nodes. */ public static final int SHOW_ELEMENT = 0x00000001; /** * Show Attr nodes. This is meaningful only when creating an * iterator or tree-walker with an attribute node as its * root; in this case, it means that the attribute node * will appear in the first position of the iteration or traversal. * Since attributes are never children of other nodes, they do not * appear when traversing over the main document tree. */ public static final int SHOW_ATTRIBUTE = 0x00000002; /** * Show Text nodes. */ public static final int SHOW_TEXT = 0x00000004; /** * Show CDATASection nodes. */ public static final int SHOW_CDATA_SECTION = 0x00000008; /** * Show EntityReference nodes. Note that if Entity References * have been fully expanded while the tree was being constructed, these * nodes will not appear and this mask has no effect. */ public static final int SHOW_ENTITY_REFERENCE = 0x00000010; /** * Show Entity nodes. This is meaningful only when creating * an iterator or tree-walker with an Entity node as its * root; in this case, it means that the Entity * node will appear in the first position of the traversal. Since * entities are not part of the document tree, they do not appear when * traversing over the main document tree. */ public static final int SHOW_ENTITY = 0x00000020; /** * Show ProcessingInstruction nodes. */ public static final int SHOW_PROCESSING_INSTRUCTION = 0x00000040; /** * Show Comment nodes. */ public static final int SHOW_COMMENT = 0x00000080; /** * Show Document nodes. (Of course, as with Attributes * and such, this is meaningful only when the iteration root is the * Document itself, since Document has no parent.) */ public static final int SHOW_DOCUMENT = 0x00000100; /** * Show DocumentType nodes. */ public static final int SHOW_DOCUMENT_TYPE = 0x00000200; /** * Show DocumentFragment nodes. (Of course, as with * Attributes and such, this is meaningful only when the iteration * root is the Document itself, since DocumentFragment has no parent.) */ public static final int SHOW_DOCUMENT_FRAGMENT = 0x00000400; /** * Show Notation nodes. This is meaningful only when creating * an iterator or tree-walker with a Notation node as its * root; in this case, it means that the * Notation node will appear in the first position of the * traversal. Since notations are not part of the document tree, they do * not appear when traversing over the main document tree. */ public static final int SHOW_NOTATION = 0x00000800; /** * This bit instructs the iterator to show namespace nodes, which * are modeled by DTM but not by the DOM. Make sure this does not * conflict with {@link org.w3c.dom.traversal.NodeFilter}. *

    * %REVIEW% Might be safer to start from higher bits and work down, * to leave room for the DOM to expand its set of constants... Or, * possibly, to create a DTM-specific field for these additional bits. */ public static final int SHOW_NAMESPACE = 0x00001000; /** * Special bit for filters implementing match patterns starting with * a function. Make sure this does not conflict with * {@link org.w3c.dom.traversal.NodeFilter}. *

    * %REVIEW% Might be safer to start from higher bits and work down, * to leave room for the DOM to expand its set of constants... Or, * possibly, to create a DTM-specific field for these additional bits. */ public static final int SHOW_BYFUNCTION = 0x00010000; /** * Test whether a specified node is visible in the logical view of a * DTMIterator. Normally, this function * will be called by the implementation of DTMIterator; * it is not normally called directly from * user code. * * @param nodeHandle int Handle of the node. * @param whatToShow one of SHOW_XXX values. * @return one of FILTER_ACCEPT, FILTER_REJECT, or FILTER_SKIP. */ public short acceptNode(int nodeHandle, int whatToShow); /** * Test whether a specified node is visible in the logical view of a * DTMIterator. Normally, this function * will be called by the implementation of DTMIterator; * it is not normally called directly from * user code. *

    * TODO: Should this be setNameMatch(expandedName) followed by accept()? * Or will we really be testing a different name at every invocation? * *

    %REVIEW% Under what circumstances will this be used? The cases * I've considered are just as easy and just about as efficient if * the name test is performed in the DTMIterator... -- Joe

    * *

    %REVIEW% Should that 0xFFFF have a mnemonic assigned to it? * Also: This representation is assuming the expanded name is indeed * split into high/low 16-bit halfwords. If we ever change the * balance between namespace and localname bits (eg because we * decide there are many more localnames than namespaces, which is * fairly likely), this is going to break. It might be safer to * encapsulate the details with a makeExpandedName method and make * that responsible for setting up the wildcard version as well.

    * * @param nodeHandle int Handle of the node. * @param whatToShow one of SHOW_XXX values. * @param expandedName a value defining the exanded name as defined in * the DTM interface. Wild cards will be defined * by 0xFFFF in the namespace and/or localname * portion of the expandedName. * @return one of FILTER_ACCEPT, FILTER_REJECT, or FILTER_SKIP. */ public short acceptNode(int nodeHandle, int whatToShow, int expandedName); } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMDOMException.java0000644000175000017500000000307510721374032023175 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMDOMException.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * Simple implementation of DOMException. * * %REVIEW% Several classes were implementing this internally; * it makes more sense to have one shared version. * @xsl.usage internal */ public class DTMDOMException extends org.w3c.dom.DOMException { static final long serialVersionUID = 1895654266613192414L; /** * Constructs a DOM/DTM exception. * * @param code * @param message */ public DTMDOMException(short code, String message) { super(code, message); } /** * Constructor DTMDOMException * * * @param code */ public DTMDOMException(short code) { super(code, ""); } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMWSFilter.java0000644000175000017500000000353710721374033022402 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMWSFilter.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * This interface is meant to be implemented by a client of the DTM, and allows * stripping of whitespace nodes. */ public interface DTMWSFilter { /** * Do not strip whitespace child nodes of this element. */ public static final short NOTSTRIP = 1; /** * Strip whitespace child nodes of this element. */ public static final short STRIP = 2; /** * Inherit whitespace stripping behavior of the parent node. */ public static final short INHERIT = 3; /** * Test whether whitespace-only text nodes are visible in the logical * view of DTM. Normally, this function * will be called by the implementation of DTM; * it is not normally called directly from * user code. * * @param elementHandle int Handle of the element. * @return one of NOTSTRIP, STRIP, or INHERIT. */ public short getShouldStripSpace(int elementHandle, DTM dtm); } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMException.java0000644000175000017500000003034210721374033022633 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMException.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import javax.xml.transform.SourceLocator; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; /** * This class specifies an exceptional condition that occured * in the DTM module. */ public class DTMException extends RuntimeException { static final long serialVersionUID = -775576419181334734L; /** Field locator specifies where the error occured. * @serial */ SourceLocator locator; /** * Method getLocator retrieves an instance of a SourceLocator * object that specifies where an error occured. * * @return A SourceLocator object, or null if none was specified. */ public SourceLocator getLocator() { return locator; } /** * Method setLocator sets an instance of a SourceLocator * object that specifies where an error occured. * * @param location A SourceLocator object, or null to clear the location. */ public void setLocator(SourceLocator location) { locator = location; } /** Field containedException specifies a wrapped exception. May be null. * @serial */ Throwable containedException; /** * This method retrieves an exception that this exception wraps. * * @return An Throwable object, or null. * @see #getCause */ public Throwable getException() { return containedException; } /** * Returns the cause of this throwable or null if the * cause is nonexistent or unknown. (The cause is the throwable that * caused this throwable to get thrown.) */ public Throwable getCause() { return ((containedException == this) ? null : containedException); } /** * Initializes the cause of this throwable to the specified value. * (The cause is the throwable that caused this throwable to get thrown.) * *

    This method can be called at most once. It is generally called from * within the constructor, or immediately after creating the * throwable. If this throwable was created * with {@link #DTMException(Throwable)} or * {@link #DTMException(String,Throwable)}, this method cannot be called * even once. * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A null value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @return a reference to this Throwable instance. * @throws IllegalArgumentException if cause is this * throwable. (A throwable cannot * be its own cause.) * @throws IllegalStateException if this throwable was * created with {@link #DTMException(Throwable)} or * {@link #DTMException(String,Throwable)}, or this method has already * been called on this throwable. */ public synchronized Throwable initCause(Throwable cause) { if ((this.containedException == null) && (cause != null)) { throw new IllegalStateException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_OVERWRITE_CAUSE, null)); //"Can't overwrite cause"); } if (cause == this) { throw new IllegalArgumentException( XMLMessages.createXMLMessage(XMLErrorResources.ER_SELF_CAUSATION_NOT_PERMITTED, null)); //"Self-causation not permitted"); } this.containedException = cause; return this; } /** * Create a new DTMException. * * @param message The error or warning message. */ public DTMException(String message) { super(message); this.containedException = null; this.locator = null; } /** * Create a new DTMException wrapping an existing exception. * * @param e The exception to be wrapped. */ public DTMException(Throwable e) { super(e.getMessage()); this.containedException = e; this.locator = null; } /** * Wrap an existing exception in a DTMException. * *

    This is used for throwing processor exceptions before * the processing has started.

    * * @param message The error or warning message, or null to * use the message from the embedded exception. * @param e Any exception */ public DTMException(String message, Throwable e) { super(((message == null) || (message.length() == 0)) ? e.getMessage() : message); this.containedException = e; this.locator = null; } /** * Create a new DTMException from a message and a Locator. * *

    This constructor is especially useful when an application is * creating its own exception from within a DocumentHandler * callback.

    * * @param message The error or warning message. * @param locator The locator object for the error or warning. */ public DTMException(String message, SourceLocator locator) { super(message); this.containedException = null; this.locator = locator; } /** * Wrap an existing exception in a DTMException. * * @param message The error or warning message, or null to * use the message from the embedded exception. * @param locator The locator object for the error or warning. * @param e Any exception */ public DTMException(String message, SourceLocator locator, Throwable e) { super(message); this.containedException = e; this.locator = locator; } /** * Get the error message with location information * appended. */ public String getMessageAndLocation() { StringBuffer sbuffer = new StringBuffer(); String message = super.getMessage(); if (null != message) { sbuffer.append(message); } if (null != locator) { String systemID = locator.getSystemId(); int line = locator.getLineNumber(); int column = locator.getColumnNumber(); if (null != systemID) { sbuffer.append("; SystemID: "); sbuffer.append(systemID); } if (0 != line) { sbuffer.append("; Line#: "); sbuffer.append(line); } if (0 != column) { sbuffer.append("; Column#: "); sbuffer.append(column); } } return sbuffer.toString(); } /** * Get the location information as a string. * * @return A string with location info, or null * if there is no location information. */ public String getLocationAsString() { if (null != locator) { StringBuffer sbuffer = new StringBuffer(); String systemID = locator.getSystemId(); int line = locator.getLineNumber(); int column = locator.getColumnNumber(); if (null != systemID) { sbuffer.append("; SystemID: "); sbuffer.append(systemID); } if (0 != line) { sbuffer.append("; Line#: "); sbuffer.append(line); } if (0 != column) { sbuffer.append("; Column#: "); sbuffer.append(column); } return sbuffer.toString(); } else { return null; } } /** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. */ public void printStackTrace() { printStackTrace(new java.io.PrintWriter(System.err, true)); } /** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. * @param s The stream where the dump will be sent to. */ public void printStackTrace(java.io.PrintStream s) { printStackTrace(new java.io.PrintWriter(s)); } /** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. * @param s The writer where the dump will be sent to. */ public void printStackTrace(java.io.PrintWriter s) { if (s == null) { s = new java.io.PrintWriter(System.err, true); } try { String locInfo = getLocationAsString(); if (null != locInfo) { s.println(locInfo); } super.printStackTrace(s); } catch (Throwable e) {} boolean isJdk14OrHigher = false; try { Throwable.class.getMethod("getCause",null); isJdk14OrHigher = true; } catch (NoSuchMethodException nsme) { // do nothing } // The printStackTrace method of the Throwable class in jdk 1.4 // and higher will include the cause when printing the backtrace. // The following code is only required when using jdk 1.3 or lower if (!isJdk14OrHigher) { Throwable exception = getException(); for (int i = 0; (i < 10) && (null != exception); i++) { s.println("---------"); try { if (exception instanceof DTMException) { String locInfo = ((DTMException) exception) .getLocationAsString(); if (null != locInfo) { s.println(locInfo); } } exception.printStackTrace(s); } catch (Throwable e) { s.println("Could not print stack trace..."); } try { Method meth = ((Object) exception).getClass().getMethod("getException", null); if (null != meth) { Throwable prev = exception; exception = (Throwable) meth.invoke(exception, null); if (prev == exception) { break; } } else { exception = null; } } catch (InvocationTargetException ite) { exception = null; } catch (IllegalAccessException iae) { exception = null; } catch (NoSuchMethodException nsme) { exception = null; } } } } } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTM.java0000644000175000017500000010731010721374031020752 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTM.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; import javax.xml.transform.SourceLocator; import org.apache.xml.utils.XMLString; /** * DTM is an XML document model expressed as a table * rather than an object tree. It attempts to provide an interface to * a parse tree that has very little object creation. (DTM * implementations may also support incremental construction of the * model, but that's hidden from the DTM API.) * *

    Nodes in the DTM are identified by integer "handles". A handle must * be unique within a process, and carries both node identification and * document identification. It must be possible to compare two handles * (and thus their nodes) for identity with "==".

    * *

    Namespace URLs, local-names, and expanded-names can all be * represented by and tested as integer ID values. An expanded name * represents (and may or may not directly contain) a combination of * the URL ID, and the local-name ID. Note that the namespace URL id * can be 0, which should have the meaning that the namespace is null. * For consistancy, zero should not be used for a local-name index.

    * *

    Text content of a node is represented by an index and length, * permitting efficient storage such as a shared FastStringBuffer.

    * *

    The model of the tree, as well as the general navigation model, * is that of XPath 1.0, for the moment. The model will eventually be * adapted to match the XPath 2.0 data model, XML Schema, and * InfoSet.

    * *

    DTM does _not_ directly support the W3C's Document Object * Model. However, it attempts to come close enough that an * implementation of DTM can be created that wraps a DOM and vice * versa.

    * *

    Please Note: The DTM API is still * Subject To Change. This wouldn't affect most * users, but might require updating some extensions.

    * *

    The largest change being contemplated is a reconsideration of * the Node Handle representation. We are still not entirely sure * that an integer packed with two numeric subfields is really the * best solution. It has been suggested that we move up to a Long, to * permit more nodes per document without having to reduce the number * of slots in the DTMManager. There's even been a proposal that we * replace these integers with "cursor" objects containing the * internal node id and a pointer to the actual DTM object; this might * reduce the need to continuously consult the DTMManager to retrieve * the latter, and might provide a useful "hook" back into normal Java * heap management. But changing this datatype would have huge impact * on Xalan's internals -- especially given Java's lack of C-style * typedefs -- so we won't cut over unless we're convinced the new * solution really would be an improvement!

    * */ public interface DTM { /** * Null node handles are represented by this value. */ public static final int NULL = -1; // These nodeType mnemonics and values are deliberately the same as those // used by the DOM, for convenient mapping // // %REVIEW% Should we actually define these as initialized to, // eg. org.w3c.dom.Document.ELEMENT_NODE? /** * The node is a Root. */ public static final short ROOT_NODE = 0; /** * The node is an Element. */ public static final short ELEMENT_NODE = 1; /** * The node is an Attr. */ public static final short ATTRIBUTE_NODE = 2; /** * The node is a Text node. */ public static final short TEXT_NODE = 3; /** * The node is a CDATASection. */ public static final short CDATA_SECTION_NODE = 4; /** * The node is an EntityReference. */ public static final short ENTITY_REFERENCE_NODE = 5; /** * The node is an Entity. */ public static final short ENTITY_NODE = 6; /** * The node is a ProcessingInstruction. */ public static final short PROCESSING_INSTRUCTION_NODE = 7; /** * The node is a Comment. */ public static final short COMMENT_NODE = 8; /** * The node is a Document. */ public static final short DOCUMENT_NODE = 9; /** * The node is a DocumentType. */ public static final short DOCUMENT_TYPE_NODE = 10; /** * The node is a DocumentFragment. */ public static final short DOCUMENT_FRAGMENT_NODE = 11; /** * The node is a Notation. */ public static final short NOTATION_NODE = 12; /** * The node is a namespace node. Note that this is not * currently a node type defined by the DOM API. */ public static final short NAMESPACE_NODE = 13; /** * The number of valid nodetypes. */ public static final short NTYPES = 14; // ========= DTM Implementation Control Functions. ============== // %TBD% RETIRED -- do via setFeature if needed. Remove from impls. // public void setParseBlockSize(int blockSizeSuggestion); /** * Set an implementation dependent feature. *

    * %REVIEW% Do we really expect to set features on DTMs? * * @param featureId A feature URL. * @param state true if this feature should be on, false otherwise. */ public void setFeature(String featureId, boolean state); /** * Set a run time property for this DTM instance. * * @param property a String value * @param value an Object value */ public void setProperty(String property, Object value); // ========= Document Navigation Functions ========= /** * This returns a stateless "traverser", that can navigate over an * XPath axis, though not in document order. * * @param axis One of Axes.ANCESTORORSELF, etc. * * @return A DTMAxisIterator, or null if the givin axis isn't supported. */ public DTMAxisTraverser getAxisTraverser(final int axis); /** * This is a shortcut to the iterators that implement * XPath axes. * Returns a bare-bones iterator that must be initialized * with a start node (using iterator.setStartNode()). * * @param axis One of Axes.ANCESTORORSELF, etc. * * @return A DTMAxisIterator, or null if the givin axis isn't supported. */ public DTMAxisIterator getAxisIterator(final int axis); /** * Get an iterator that can navigate over an XPath Axis, predicated by * the extended type ID. * * @param axis * @param type An extended type ID. * * @return A DTMAxisIterator, or null if the givin axis isn't supported. */ public DTMAxisIterator getTypedAxisIterator(final int axis, final int type); /** * Given a node handle, test if it has child nodes. *

    %REVIEW% This is obviously useful at the DOM layer, where it * would permit testing this without having to create a proxy * node. It's less useful in the DTM API, where * (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and * almost as self-evident. But it's a convenience, and eases porting * of DOM code to DTM.

    * * @param nodeHandle int Handle of the node. * @return int true if the given node has child nodes. */ public boolean hasChildNodes(int nodeHandle); /** * Given a node handle, get the handle of the node's first child. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of first child, * or DTM.NULL to indicate none exists. */ public int getFirstChild(int nodeHandle); /** * Given a node handle, get the handle of the node's last child. * * @param nodeHandle int Handle of the node. * @return int Node-number of last child, * or DTM.NULL to indicate none exists. */ public int getLastChild(int nodeHandle); /** * Retrieves an attribute node by local name and namespace URI * * %TBD% Note that we currently have no way to support * the DOM's old getAttribute() call, which accesses only the qname. * * @param elementHandle Handle of the node upon which to look up this attribute. * @param namespaceURI The namespace URI of the attribute to * retrieve, or null. * @param name The local name of the attribute to * retrieve. * @return The attribute node handle with the specified name ( * nodeName) or DTM.NULL if there is no such * attribute. */ public int getAttributeNode(int elementHandle, String namespaceURI, String name); /** * Given a node handle, get the index of the node's first attribute. * * @param nodeHandle int Handle of the node. * @return Handle of first attribute, or DTM.NULL to indicate none exists. */ public int getFirstAttribute(int nodeHandle); /** * Given a node handle, get the index of the node's first namespace node. * * @param nodeHandle handle to node, which should probably be an element * node, but need not be. * * @param inScope true if all namespaces in scope should be * returned, false if only the node's own * namespace declarations should be returned. * @return handle of first namespace, * or DTM.NULL to indicate none exists. */ public int getFirstNamespaceNode(int nodeHandle, boolean inScope); /** * Given a node handle, advance to its next sibling. * @param nodeHandle int Handle of the node. * @return int Node-number of next sibling, * or DTM.NULL to indicate none exists. */ public int getNextSibling(int nodeHandle); /** * Given a node handle, find its preceeding sibling. * WARNING: DTM implementations may be asymmetric; in some, * this operation has been resolved by search, and is relatively expensive. * * @param nodeHandle the id of the node. * @return int Node-number of the previous sib, * or DTM.NULL to indicate none exists. */ public int getPreviousSibling(int nodeHandle); /** * Given a node handle, advance to the next attribute. If an * element, we advance to its first attribute; if an attr, we advance to * the next attr of the same element. * * @param nodeHandle int Handle of the node. * @return int DTM node-number of the resolved attr, * or DTM.NULL to indicate none exists. */ public int getNextAttribute(int nodeHandle); /** * Given a namespace handle, advance to the next namespace in the same scope * (local or local-plus-inherited, as selected by getFirstNamespaceNode) * * @param baseHandle handle to original node from where the first child * was relative to (needed to return nodes in document order). * @param namespaceHandle handle to node which must be of type * NAMESPACE_NODE. * NEEDSDOC @param inScope * @return handle of next namespace, * or DTM.NULL to indicate none exists. */ public int getNextNamespaceNode(int baseHandle, int namespaceHandle, boolean inScope); /** * Given a node handle, find its parent node. * * @param nodeHandle the id of the node. * @return int Node handle of parent, * or DTM.NULL to indicate none exists. */ public int getParent(int nodeHandle); /** * Given a DTM which contains only a single document, * find the Node Handle of the Document node. Note * that if the DTM is configured so it can contain multiple * documents, this call will return the Document currently * under construction -- but may return null if it's between * documents. Generally, you should use getOwnerDocument(nodeHandle) * or getDocumentRoot(nodeHandle) instead. * * @return int Node handle of document, or DTM.NULL if a shared DTM * can not tell us which Document is currently active. */ public int getDocument(); /** * Given a node handle, find the owning document node. This version mimics * the behavior of the DOM call by the same name. * * @param nodeHandle the id of the node. * @return int Node handle of owning document, or DTM.NULL if the node was * a Document. * @see #getDocumentRoot(int nodeHandle) */ public int getOwnerDocument(int nodeHandle); /** * Given a node handle, find the owning document node. * * @param nodeHandle the id of the node. * @return int Node handle of owning document, or the node itself if it was * a Document. (Note difference from DOM, where getOwnerDocument returns * null for the Document node.) * @see #getOwnerDocument(int nodeHandle) */ public int getDocumentRoot(int nodeHandle); /** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle); /** * Get number of character array chunks in * the string-value of a node. * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * Note that a single text node may have multiple text chunks. * * @param nodeHandle The node ID. * * @return number of character array chunks in * the string-value of a node. */ public int getStringValueChunkCount(int nodeHandle); /** * Get a character array chunk in the string-value of a node. * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * Note that a single text node may have multiple text chunks. * * @param nodeHandle The node ID. * @param chunkIndex Which chunk to get. * @param startAndLen A two-integer array which, upon return, WILL * BE FILLED with values representing the chunk's start position * within the returned character buffer and the length of the chunk. * @return The character array buffer within which the chunk occurs, * setting startAndLen's contents as a side-effect. */ public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen); /** * Given a node handle, return an ID that represents the node's expanded name. * * @param nodeHandle The handle to the node in question. * * @return the expanded-name id of the node. */ public int getExpandedTypeID(int nodeHandle); /** * Given an expanded name, return an ID. If the expanded-name does not * exist in the internal tables, the entry will be created, and the ID will * be returned. Any additional nodes that are created that have this * expanded name will use this ID. * * NEEDSDOC @param namespace * NEEDSDOC @param localName * NEEDSDOC @param type * * @return the expanded-name id of the node. */ public int getExpandedTypeID(String namespace, String localName, int type); /** * Given an expanded-name ID, return the local name part. * * @param ExpandedNameID an ID that represents an expanded-name. * @return String Local name of this node. */ public String getLocalNameFromExpandedNameID(int ExpandedNameID); /** * Given an expanded-name ID, return the namespace URI part. * * @param ExpandedNameID an ID that represents an expanded-name. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceFromExpandedNameID(int ExpandedNameID); /** * Given a node handle, return its DOM-style node name. This will * include names such as #text or #document. * * @param nodeHandle the id of the node. * @return String Name of this node, which may be an empty string. * %REVIEW% Document when empty string is possible... */ public String getNodeName(int nodeHandle); /** * Given a node handle, return the XPath node name. This should be * the name as described by the XPath data model, NOT the DOM-style * name. * * @param nodeHandle the id of the node. * @return String Name of this node. */ public String getNodeNameX(int nodeHandle); /** * Given a node handle, return its DOM-style localname. * (As defined in Namespaces, this is the portion of the name after the * prefix, if present, or the whole node name if no prefix exists) * * @param nodeHandle the id of the node. * @return String Local name of this node. */ public String getLocalName(int nodeHandle); /** * Given a namespace handle, return the prefix that the namespace decl is * mapping. * Given a node handle, return the prefix used to map to the namespace. * (As defined in Namespaces, this is the portion of the name before any * colon character). * *

    %REVIEW% Are you sure you want "" for no prefix?

    * * @param nodeHandle the id of the node. * @return String prefix of this node's name, or "" if no explicit * namespace prefix was given. */ public String getPrefix(int nodeHandle); /** * Given a node handle, return its DOM-style namespace URI * (As defined in Namespaces, this is the declared URI which this node's * prefix -- or default in lieu thereof -- was mapped to.) * @param nodeHandle the id of the node. * @return String URI value of this node's namespace, or null if no * namespace was resolved. */ public String getNamespaceURI(int nodeHandle); /** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. *

    * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public String getNodeValue(int nodeHandle); /** * Given a node handle, return its DOM-style node type. * *

    %REVIEW% Generally, returning short is false economy. Return int?

    * * @param nodeHandle The node id. * @return int Node type, as per the DOM's Node._NODE constants. */ public short getNodeType(int nodeHandle); /** * Get the depth level of this node in the tree (equals 1 for * a parentless node). * * @param nodeHandle The node id. * @return the number of ancestors, plus one * @xsl.usage internal */ public short getLevel(int nodeHandle); // ============== Document query functions ============== /** * Tests whether DTM DOM implementation implements a specific feature and * that feature is supported by this node. * @param feature The name of the feature to test. * @param version This is the version number of the feature to test. * If the version is not * specified, supporting any version of the feature will cause the * method to return true. * @return Returns true if the specified feature is * supported on this node, false otherwise. */ public boolean isSupported(String feature, String version); /** * Return the base URI of the document entity. If it is not known * (because the document was parsed from a socket connection or from * standard input, for example), the value of this property is unknown. * * @return the document base URI String object or null if unknown. */ public String getDocumentBaseURI(); /** * Set the base URI of the document entity. * * @param baseURI the document base URI String object or null if unknown. */ public void setDocumentBaseURI(String baseURI); /** * Return the system identifier of the document entity. If * it is not known, the value of this property is null. * * @param nodeHandle The node id, which can be any valid node handle. * @return the system identifier String object or null if unknown. */ public String getDocumentSystemIdentifier(int nodeHandle); /** * Return the name of the character encoding scheme * in which the document entity is expressed. * * @param nodeHandle The node id, which can be any valid node handle. * @return the document encoding String object. */ public String getDocumentEncoding(int nodeHandle); /** * Return an indication of the standalone status of the document, * either "yes" or "no". This property is derived from the optional * standalone document declaration in the XML declaration at the * beginning of the document entity, and has no value if there is no * standalone document declaration. * * @param nodeHandle The node id, which can be any valid node handle. * @return the document standalone String object, either "yes", "no", or null. */ public String getDocumentStandalone(int nodeHandle); /** * Return a string representing the XML version of the document. This * property is derived from the XML declaration optionally present at the * beginning of the document entity, and has no value if there is no XML * declaration. * * @param documentHandle the document handle * @return the document version String object */ public String getDocumentVersion(int documentHandle); /** * Return an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @return true if all declarations were processed; * false otherwise. */ public boolean getDocumentAllDeclarationsProcessed(); /** * A document type declaration information item has the following properties: * * 1. [system identifier] The system identifier of the external subset, if * it exists. Otherwise this property has no value. * * @return the system identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationSystemIdentifier(); /** * Return the public identifier of the external subset, * normalized as described in 4.2.2 External Entities [XML]. If there is * no external subset or if it has no public identifier, this property * has no value. * * @return the public identifier String object, or null if there is none. */ public String getDocumentTypeDeclarationPublicIdentifier(); /** * Returns the Element whose ID is given by * elementId. If no such element exists, returns * DTM.NULL. Behavior is not defined if more than one element * has this ID. Attributes (including those * with the name "ID") are not of type ID unless so defined by DTD/Schema * information available to the DTM implementation. * Implementations that do not know whether attributes are of type ID or * not are expected to return DTM.NULL. * *

    %REVIEW% Presumably IDs are still scoped to a single document, * and this operation searches only within a single document, right? * Wouldn't want collisions between DTMs in the same process.

    * * @param elementId The unique id value for an element. * @return The handle of the matching element. */ public int getElementById(String elementId); /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. *

    * XML processors may choose to use the System Identifier (if one * is provided) to resolve the entity, rather than the URI in the * Public Identifier. The details are dependent on the processor, and * we would have to support some form of plug-in resolver to handle * this properly. Currently, we simply return the System Identifier if * present, and hope that it a usable URI or that our caller can * map it to one. * %REVIEW% Resolve Public Identifiers... or consider changing function name. *

    * If we find a relative URI * reference, XML expects it to be resolved in terms of the base URI * of the document. The DOM doesn't do that for us, and it isn't * entirely clear whether that should be done here; currently that's * pushed up to a higher level of our application. (Note that DOM Level * 1 didn't store the document's base URI.) * %REVIEW% Consider resolving Relative URIs. *

    * (The DOM's statement that "An XML processor may choose to * completely expand entities before the structure model is passed * to the DOM" refers only to parsed entities, not unparsed, and hence * doesn't affect this function.) * * @param name A string containing the Entity Name of the unparsed * entity. * * @return String containing the URI of the Unparsed Entity, or an * empty string if no such entity exists. */ public String getUnparsedEntityURI(String name); // ============== Boolean methods ================ /** * Return true if the xsl:strip-space or xsl:preserve-space was processed * during construction of the document contained in this DTM. * * NEEDSDOC ($objectName$) @return */ public boolean supportsPreStripping(); /** * Figure out whether nodeHandle2 should be considered as being later * in the document than nodeHandle1, in Document Order as defined * by the XPath model. This may not agree with the ordering defined * by other XML applications. *

    * There are some cases where ordering isn't defined, and neither are * the results of this function -- though we'll generally return true. *

    * %REVIEW% Make sure this does the right thing with attribute nodes!!! *

    * %REVIEW% Consider renaming for clarity. Perhaps isDocumentOrder(a,b)? * * @param firstNodeHandle DOM Node to perform position comparison on. * @param secondNodeHandle DOM Node to perform position comparison on. * * @return false if secondNode comes before firstNode, otherwise return true. * You can think of this as * (firstNode.documentOrderPosition <= secondNode.documentOrderPosition). */ public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle); /** * 2. [element content whitespace] A boolean indicating whether a * text node represents white space appearing within element content * (see [XML], 2.10 "White Space Handling"). Note that validating * XML processors are required by XML 1.0 to provide this * information... but that DOM Level 2 did not support it, since it * depends on knowledge of the DTD which DOM2 could not guarantee * would be available. *

    * If there is no declaration for the containing element, an XML * processor must assume that the whitespace could be meaningful and * return false. If no declaration has been read, but the [all * declarations processed] property of the document information item * is false (so there may be an unread declaration), then the value * of this property is indeterminate for white space characters and * should probably be reported as false. It is always false for text * nodes that contain anything other than (or in addition to) white * space. *

    * Note too that it always returns false for non-Text nodes. *

    * %REVIEW% Joe wants to rename this isWhitespaceInElementContent() for clarity * * @param nodeHandle the node ID. * @return true if the node definitely represents whitespace in * element content; false otherwise. */ public boolean isCharacterElementContentWhitespace(int nodeHandle); /** * 10. [all declarations processed] This property is not strictly speaking * part of the infoset of the document. Rather it is an indication of * whether the processor has read the complete DTD. Its value is a * boolean. If it is false, then certain properties (indicated in their * descriptions below) may be unknown. If it is true, those properties * are never unknown. * * @param documentHandle A node handle that must identify a document. * @return true if all declarations were processed; * false otherwise. */ public boolean isDocumentAllDeclarationsProcessed(int documentHandle); /** * 5. [specified] A flag indicating whether this attribute was actually * specified in the start-tag of its element, or was defaulted from the * DTD (or schema). * * @param attributeHandle The attribute handle * @return true if the attribute was specified; * false if it was defaulted or the handle doesn't * refer to an attribute node. */ public boolean isAttributeSpecified(int attributeHandle); // ========== Direct SAX Dispatch, for optimization purposes ======== /** * Directly call the * characters method on the passed ContentHandler for the * string-value of the given node (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). Multiple calls to the * ContentHandler's characters methods may well occur for a single call to * this method. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * @param normalize true if the content should be normalized according to * the rules for the XPath * normalize-space * function. * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException; /** * Directly create SAX parser events representing the XML content of * a DTM subtree. This is a "serialize" operation. * * @param nodeHandle The node ID. * @param ch A non-null reference to a ContentHandler. * * @throws org.xml.sax.SAXException */ public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException; /** * Return an DOM node for the given node. * * @param nodeHandle The node ID. * * @return A node representation of the DTM node. */ public org.w3c.dom.Node getNode(int nodeHandle); // ==== Construction methods (may not be supported by some implementations!) ===== // %REVIEW% What response occurs if not supported? /** * @return true iff we're building this model incrementally (eg * we're partnered with a CoroutineParser) and thus require that the * transformation and the parse run simultaneously. Guidance to the * DTMManager. */ public boolean needsTwoThreads(); // %REVIEW% Do these appends make any sense, should we support a // wider set of methods (like the "append" methods in the // current DTMDocumentImpl draft), or should we just support SAX // listener interfaces? Should it be a separate interface to // make that distinction explicit? /** * Return this DTM's content handler, if it has one. * * @return null if this model doesn't respond to SAX events. */ public org.xml.sax.ContentHandler getContentHandler(); /** * Return this DTM's lexical handler, if it has one. * * %REVIEW% Should this return null if constrution already done/begun? * * @return null if this model doesn't respond to lexical SAX events. */ public org.xml.sax.ext.LexicalHandler getLexicalHandler(); /** * Return this DTM's EntityResolver, if it has one. * * @return null if this model doesn't respond to SAX entity ref events. */ public org.xml.sax.EntityResolver getEntityResolver(); /** * Return this DTM's DTDHandler, if it has one. * * @return null if this model doesn't respond to SAX dtd events. */ public org.xml.sax.DTDHandler getDTDHandler(); /** * Return this DTM's ErrorHandler, if it has one. * * @return null if this model doesn't respond to SAX error events. */ public org.xml.sax.ErrorHandler getErrorHandler(); /** * Return this DTM's DeclHandler, if it has one. * * @return null if this model doesn't respond to SAX Decl events. */ public org.xml.sax.ext.DeclHandler getDeclHandler(); /** * Append a child to "the end of the document". Please note that * the node is always cloned in a base DTM, since our basic behavior * is immutable so nodes can't be removed from their previous * location. * *

    %REVIEW% DTM maintains an insertion cursor which * performs a depth-first tree walk as nodes come in, and this operation * is really equivalent to: * insertionCursor.appendChild(document.importNode(newChild))) * where the insert point is the last element that was appended (or * the last one popped back to by an end-element operation).

    * * @param newChild Must be a valid new node handle. * @param clone true if the child should be cloned into the document. * @param cloneDepth if the clone argument is true, specifies that the * clone should include all it's children. */ public void appendChild(int newChild, boolean clone, boolean cloneDepth); /** * Append a text node child that will be constructed from a string, * to the end of the document. Behavior is otherwise like appendChild(). * * @param str Non-null reference to a string. */ public void appendTextChild(String str); /** * Get the location of a node in the source document. * * @param node an int value * @return a SourceLocator value or null if no location * is available */ public SourceLocator getSourceLocatorFor(int node); /** * As the DTM is registered with the DTMManager, this method * will be called. This will give the DTM implementation a * chance to initialize any subsystems that are required to * build the DTM */ public void documentRegistration(); /** * As documents are released from the DTMManager, the DTM implementation * will be notified of the event. This will allow the DTM implementation * to shutdown any subsystem activity that may of been assoiated with * the active DTM Implementation. */ public void documentRelease(); /** * Migrate a DTM built with an old DTMManager to a new DTMManager. * After the migration, the new DTMManager will treat the DTM as * one that is built by itself. * This is used to support DTM sharing between multiple transformations. * @param manager the DTMManager */ public void migrateTo(DTMManager manager); } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMIterator.java0000644000175000017500000003061010721374030022461 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMIterator.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * DTMIterators are used to step through a (possibly * filtered) set of nodes. Their API is modeled largely after the DOM * NodeIterator. * *

    A DTMIterator is a somewhat unusual type of iterator, in that it * can serve both single node iteration and random access.

    * *

    The DTMIterator's traversal semantics, i.e. how it walks the tree, * are specified when it is created, possibly and probably by an XPath * UnionExpr.

    * *

    A DTMIterator is meant to be created once as a master static object, and * then cloned many times for runtime use. Or the master object itself may * be used for simpler use cases.

    * *

    At this time, we do not expect DTMIterator to emulate * NodeIterator's "maintain relative position" semantics under * document mutation. It's likely to respond more like the * TreeWalker's "current node" semantics. However, since the base DTM * is immutable, this issue currently makes no practical * difference.

    * *

    State: In progress!!

    */ public interface DTMIterator { // Constants returned by acceptNode, borrowed from the DOM Traversal chapter // %REVIEW% Should we explicitly initialize them from, eg, // org.w3c.dom.traversal.NodeFilter.FILTER_ACCEPT? /** * Accept the node. */ public static final short FILTER_ACCEPT = 1; /** * Reject the node. Same behavior as FILTER_SKIP. (In the DOM these * differ when applied to a TreeWalker but have the same result when * applied to a NodeIterator). */ public static final short FILTER_REJECT = 2; /** * Skip this single node. */ public static final short FILTER_SKIP = 3; /** * Get an instance of a DTM that "owns" a node handle. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTM using just the iterator. * * @param nodeHandle the nodeHandle. * * @return a non-null DTM reference. */ public DTM getDTM(int nodeHandle); /** * Get an instance of the DTMManager. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTMManager using just the iterator. * * @return a non-null DTMManager reference. */ public DTMManager getDTMManager(); /** * The root node of the DTMIterator, as specified when it * was created. Note the root node is not the root node of the * document tree, but the context node from where the iteration * begins and ends. * * @return nodeHandle int Handle of the context node. */ public int getRoot(); /** * Reset the root node of the DTMIterator, overriding * the value specified when it was created. Note the root node is * not the root node of the document tree, but the context node from * where the iteration begins. * * @param nodeHandle int Handle of the context node. * @param environment The environment object. * The environment in which this iterator operates, which should provide: *
      *
    • a node (the context node... same value as "root" defined below)
    • *
    • a pair of non-zero positive integers (the context position and the context size)
    • *
    • a set of variable bindings
    • *
    • a function library
    • *
    • the set of namespace declarations in scope for the expression.
    • *
        * *

        At this time the exact implementation of this environment is application * dependent. Probably a proper interface will be created fairly soon.

        * */ public void setRoot(int nodeHandle, Object environment); /** * Reset the iterator to the start. After resetting, the next node returned * will be the root node -- or, if that's filtered out, the first node * within the root's subtree which is _not_ skipped by the filters. */ public void reset(); /** * This attribute determines which node types are presented via the * iterator. The available set of constants is defined above. * Nodes not accepted by * whatToShow will be skipped, but their children may still * be considered. * * @return one of the SHOW_XXX constants, or several ORed together. */ public int getWhatToShow(); /** *

        The value of this flag determines whether the children of entity * reference nodes are visible to the iterator. If false, they and * their descendants will be rejected. Note that this rejection takes * precedence over whatToShow and the filter.

        * *

        To produce a view of the document that has entity references * expanded and does not expose the entity reference node itself, use * the whatToShow flags to hide the entity reference node * and set expandEntityReferences to true when creating the * iterator. To produce a view of the document that has entity reference * nodes but no entity expansion, use the whatToShow flags * to show the entity reference node and set * expandEntityReferences to false.

        * *

        NOTE: In Xalan's use of DTM we will generally have fully expanded * entity references when the document tree was built, and thus this * flag will have no effect.

        * * @return true if entity references will be expanded. */ public boolean getExpandEntityReferences(); /** * Returns the next node in the set and advances the position of the * iterator in the set. After a DTMIterator has setRoot called, * the first call to nextNode() returns that root or (if it * is rejected by the filters) the first node within its subtree which is * not filtered out. * @return The next node handle in the set being iterated over, or * DTM.NULL if there are no more members in that set. */ public int nextNode(); /** * Returns the previous node in the set and moves the position of the * DTMIterator backwards in the set. * @return The previous node handle in the set being iterated over, * or DTM.NULL if there are no more members in that set. */ public int previousNode(); /** * Detaches the DTMIterator from the set which it iterated * over, releasing any computational resources and placing the iterator * in the INVALID state. After detach has been invoked, * calls to nextNode or previousNode will * raise a runtime exception. */ public void detach(); /** * Specify if it's OK for detach to release the iterator for reuse. * * @param allowRelease true if it is OK for detach to release this iterator * for pooling. */ public void allowDetachToRelease(boolean allowRelease); /** * Get the current node in the iterator. Note that this differs from * the DOM's NodeIterator, where the current position lies between two * nodes (as part of the maintain-relative-position semantic). * * @return The current node handle, or -1. */ public int getCurrentNode(); /** * Tells if this NodeSetDTM is "fresh", in other words, if * the first nextNode() that is called will return the * first node in the set. * * @return true if the iteration of this list has not yet begun. */ public boolean isFresh(); //========= Random Access ========== /** * If setShouldCacheNodes(true) is called, then nodes will * be cached, enabling random access, and giving the ability to do * sorts and the like. They are not cached by default. * * %REVIEW% Shouldn't the other random-access methods throw an exception * if they're called on a DTMIterator with this flag set false? * * @param b true if the nodes should be cached. */ public void setShouldCacheNodes(boolean b); /** * Tells if this iterator can have nodes added to it or set via * the setItem(int node, int index) method. * * @return True if the nodelist can be mutated. */ public boolean isMutable(); /** Get the current position within the cached list, which is one * less than the next nextNode() call will retrieve. i.e. if you * call getCurrentPos() and the return is 0, the next fetch will * take place at index 1. * * @return The position of the iteration. */ public int getCurrentPos(); /** * If an index is requested, NodeSetDTM will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end and * completely fill the cache. * * @param index The index to run to, or -1 if the iterator should be run * to the end. */ public void runTo(int index); /** * Set the current position in the node set. * * @param i Must be a valid index. */ public void setCurrentPos(int i); /** * Returns the node handle of an item in the collection. If * index is greater than or equal to the number of nodes in * the list, this returns null. * * @param index of the item. * @return The node handle at the indexth position in the * DTMIterator, or -1 if that is not a valid * index. */ public int item(int index); /** * Sets the node at the specified index of this vector to be the * specified node. The previous component at that position is discarded. * *

        The index must be a value greater than or equal to 0 and less * than the current size of the vector. * The iterator must be in cached mode.

        * *

        Meant to be used for sorted iterators.

        * * @param node Node to set * @param index Index of where to set the node */ public void setItem(int node, int index); /** * The number of nodes in the list. The range of valid child node indices * is 0 to length-1 inclusive. Note that this requires running * the iterator to completion, and presumably filling the cache. * * @return The number of nodes in the list. */ public int getLength(); //=========== Cloning operations. ============ /** * Get a cloned Iterator that is reset to the start of the iteration. * * @return A clone of this iteration that has been reset. * * @throws CloneNotSupportedException */ public DTMIterator cloneWithReset() throws CloneNotSupportedException; /** * Get a clone of this iterator, but don't reset the iteration in the * process, so that it may be used from the current position. * * @return A clone of this object. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException; /** * Returns true if all the nodes in the iteration well be returned in document * order. * * @return true if all the nodes in the iteration well be returned in document * order. */ public boolean isDocOrdered(); /** * Returns the axis being iterated, if it is known. * * @return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple * types. */ public int getAxis(); } libxalan2-java-2.7.1/src/org/apache/xml/dtm/DTMAxisTraverser.java0000644000175000017500000001116610721374032023501 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMAxisTraverser.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; /** * A class that implements traverses DTMAxisTraverser interface can traverse * a set of nodes, usually as defined by an XPath axis. It is different from * an iterator, because it does not need to hold state, and, in fact, must not * hold any iteration-based state. It is meant to be implemented as an inner * class of a DTM, and returned by the getAxisTraverser(final int axis) * function. * *

        A DTMAxisTraverser can probably not traverse a reverse axis in * document order.

        * *

        Typical usage:

        *
        
         * for(int nodeHandle=myTraverser.first(myContext);
         *     nodeHandle!=DTM.NULL;
         *     nodeHandle=myTraverser.next(myContext,nodeHandle))
         * { ... processing for node indicated by nodeHandle goes here ... }
         * 
        * * @author Scott Boag */ public abstract class DTMAxisTraverser { /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

        This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * that the traversal starts from. * @return the first node in the traversal. */ public int first(int context) { return next(context, context); } /** * By the nature of the stateless traversal, the context node can not be * returned or the iteration will go into an infinate loop. So to traverse * an axis, the first function must be used to get the first node. * *

        This method needs to be overloaded only by those axis that process * the self node. <\p> * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param extendedTypeID The extended type ID that must match. * * @return the first node in the traversal. */ public int first(int context, int extendedTypeID) { return next(context, context, extendedTypeID); } /** * Traverse to the next node after the current node. * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param current The current node of the traversal. This is the last known * location in the traversal, typically the node-handle returned by the * previous traversal step. For the first traversal step, context * should be set equal to current. Note that in order to test whether * context is in the set, you must use the first() method instead. * * @return the next node in the iteration, or DTM.NULL. * @see #first(int) */ public abstract int next(int context, int current); /** * Traverse to the next node after the current node that is matched * by the extended type ID. * * @param context The context node of this traversal. This is the point * of origin for the traversal -- its "root node" or starting point. * @param current The current node of the traversal. This is the last known * location in the traversal, typically the node-handle returned by the * previous traversal step. For the first traversal step, context * should be set equal to current. Note that in order to test whether * context is in the set, you must use the first() method instead. * @param extendedTypeID The extended type ID that must match. * * @return the next node in the iteration, or DTM.NULL. * @see #first(int,int) */ public abstract int next(int context, int current, int extendedTypeID); } libxalan2-java-2.7.1/src/org/apache/xml/dtm/ObjectFactory.java0000644000175000017500000006375410721374032023102 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.dtm; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468653 2006-10-28 07:07:05Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 5122054096615067992L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xml/res/0000755000175000017500000000000010736146354017501 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_sk.java0000644000175000017500000004411310721374031024376 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_sk.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_sk extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Funkcia nie je podporovan\u00e1!"}, { ER_CANNOT_OVERWRITE_CAUSE, "Nie je mo\u017en\u00e9 prep\u00edsa\u0165 pr\u00ed\u010dinu"}, { ER_NO_DEFAULT_IMPL, "Nebola n\u00e1jden\u00e1 \u017eiadna predvolen\u00e1 implement\u00e1cia "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) nie je moment\u00e1lne podporovan\u00fd"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Offset v\u00e4\u010d\u0161\u00ed, ne\u017e z\u00e1suvka"}, { ER_COROUTINE_NOT_AVAIL, "Ko-rutina nie je dostupn\u00e1, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager obdr\u017eal po\u017eiadavku co_exit()"}, { ER_COJOINROUTINESET_FAILED, "zlyhal co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "Chyba parametra korutiny ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nNEO\u010cAK\u00c1VAN\u00c9: Analyz\u00e1tor doTerminate odpoved\u00e1 {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "syntaktick\u00fd analyz\u00e1tor nem\u00f4\u017ee by\u0165 volan\u00fd po\u010das vykon\u00e1vania anal\u00fdzy"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Chyba: nap\u00edsan\u00fd iter\u00e1tor pre os {0} nie je implementovan\u00fd"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Chyba: iter\u00e1tor pre os {0} nie je implementovan\u00fd "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Klon iter\u00e1tora nie je podporovan\u00fd"}, { ER_UNKNOWN_AXIS_TYPE, "Nezn\u00e1my typ pret\u00ednania os\u00ed: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Pret\u00ednanie os\u00ed nie je podporovan\u00e9: {0}"}, { ER_NO_DTMIDS_AVAIL, "\u017diadne \u010fal\u0161ie DTM ID nie s\u00fa dostupn\u00e9"}, { ER_NOT_SUPPORTED, "Nie je podporovan\u00e9: {0}"}, { ER_NODE_NON_NULL, "Pre getDTMHandleFromNode mus\u00ed by\u0165 uzol nenulov\u00fd"}, { ER_COULD_NOT_RESOLVE_NODE, "Nebolo mo\u017en\u00e9 ur\u010di\u0165 uzol na spracovanie"}, { ER_STARTPARSE_WHILE_PARSING, "startParse nem\u00f4\u017ee by\u0165 volan\u00fd po\u010das vykon\u00e1vania anal\u00fdzy"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse potrebuje nenulov\u00fd SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "Nebolo mo\u017en\u00e9 inicializova\u0165 syntaktick\u00fd analyz\u00e1tor pomocou"}, { ER_EXCEPTION_CREATING_POOL, "v\u00fdnimka vytv\u00e1rania novej in\u0161tancie oblasti"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Cesta obsahuje neplatn\u00fa \u00fanikov\u00fa sekvenciu"}, { ER_SCHEME_REQUIRED, "Je po\u017eadovan\u00e1 sch\u00e9ma!"}, { ER_NO_SCHEME_IN_URI, "V URI sa nena\u0161la \u017eiadna sch\u00e9ma: {0}"}, { ER_NO_SCHEME_INURI, "V URI nebola n\u00e1jden\u00e1 \u017eiadna sch\u00e9ma"}, { ER_PATH_INVALID_CHAR, "Cesta obsahuje neplatn\u00fd znak: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Nie je mo\u017en\u00e9 stanovi\u0165 sch\u00e9mu z nulov\u00e9ho re\u0165azca"}, { ER_SCHEME_NOT_CONFORMANT, "Nezhodn\u00e1 sch\u00e9ma."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Hostite\u013e nie je spr\u00e1vne form\u00e1tovan\u00e1 adresa"}, { ER_PORT_WHEN_HOST_NULL, "Nem\u00f4\u017ee by\u0165 stanoven\u00fd port, ak je hostite\u013e nulov\u00fd"}, { ER_INVALID_PORT, "Neplatn\u00e9 \u010d\u00edslo portu"}, { ER_FRAG_FOR_GENERIC_URI, "Fragment m\u00f4\u017ee by\u0165 stanoven\u00fd len pre v\u0161eobecn\u00e9 URI"}, { ER_FRAG_WHEN_PATH_NULL, "Ak je cesta nulov\u00e1, nem\u00f4\u017ee by\u0165 stanoven\u00fd fragment"}, { ER_FRAG_INVALID_CHAR, "Fragment obsahuje neplatn\u00fd znak"}, { ER_PARSER_IN_USE, "Syntaktick\u00fd analyz\u00e1tor je u\u017e pou\u017e\u00edvan\u00fd"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Nie je mo\u017en\u00e9 zmeni\u0165 {0} {1} po\u010das vykon\u00e1vania anal\u00fdzy"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Samozapr\u00ed\u010dinenie nie je povolen\u00e9"}, { ER_NO_USERINFO_IF_NO_HOST, "Ak nebol zadan\u00fd hostite\u013e, mo\u017eno nebolo zadan\u00e9 userinfo"}, { ER_NO_PORT_IF_NO_HOST, "Ak nebol zadan\u00fd hostite\u013e, mo\u017eno nebol zadan\u00fd port"}, { ER_NO_QUERY_STRING_IN_PATH, "Re\u0165azec dotazu nem\u00f4\u017ee by\u0165 zadan\u00fd v ceste a re\u0165azci dotazu"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment nem\u00f4\u017ee by\u0165 zadan\u00fd v ceste, ani vo fragmente"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Nie je mo\u017en\u00e9 inicializova\u0165 URI s pr\u00e1zdnymi parametrami"}, { ER_METHOD_NOT_SUPPORTED, "Met\u00f3da e\u0161te nie je podporovan\u00e1 "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter nie je moment\u00e1lne re\u0161tartovate\u013en\u00fd"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader nepredch\u00e1dza po\u017eiadavke na startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Pret\u00ednanie os\u00ed nie je podporovan\u00e9: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler vytvoren\u00fd s nulov\u00fdm PrintWriter!"}, { ER_SYSTEMID_UNKNOWN, "Nezn\u00e1me SystemId"}, { ER_LOCATION_UNKNOWN, "Nezn\u00e1me miesto v\u00fdskytu chyby"}, { ER_PREFIX_MUST_RESOLVE, "Predpona sa mus\u00ed rozl\u00ed\u0161i\u0165 do n\u00e1zvov\u00e9ho priestoru: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() nie je podporovan\u00e9 XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Potomok atrib\u00fatu nem\u00e1 dokument vlastn\u00edka!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Potomok atrib\u00fatu nem\u00e1 s\u00fa\u010das\u0165 dokumentu vlastn\u00edka!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Upozornenie: nemo\u017eno vypusti\u0165 text pred elementom dokumentu! Ignorovanie..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Nie je mo\u017en\u00e9 ma\u0165 viac, ne\u017e jeden kore\u0148 DOM!"}, { ER_ARG_LOCALNAME_NULL, "Argument 'localName' je nulov\u00fd"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Lok\u00e1lny n\u00e1zov v QNAME by mal by\u0165 platn\u00fdm NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Predpona v QNAME by mala by\u0165 platn\u00fdm NCName"}, { ER_NAME_CANT_START_WITH_COLON, "N\u00e1zov sa nem\u00f4\u017ee za\u010d\u00edna\u0165 dvojbodkou."}, { "BAD_CODE", "Parameter na createMessage bol mimo ohrani\u010denia"}, { "FORMAT_FAILED", "V\u00fdnimka po\u010das volania messageFormat"}, { "line", "Riadok #"}, { "column","St\u013apec #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLMessages.java0000644000175000017500000001376710721374031022477 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLMessages.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * A utility class for issuing XML error messages. * @xsl.usage internal */ public class XMLMessages { /** The local object to use. */ protected Locale fLocale = Locale.getDefault(); /** The language specific resource object for XML messages. */ private static ListResourceBundle XMLBundle = null; /** The class name of the XML error message string table. */ private static final String XML_ERROR_RESOURCES = "org.apache.xml.res.XMLErrorResources"; /** String to use if a bad message code is used. */ protected static final String BAD_CODE = "BAD_CODE"; /** String to use if the message format operation failed. */ protected static final String FORMAT_FAILED = "FORMAT_FAILED"; /** * Set the Locale object to use. * * @param locale non-null reference to Locale object. */ public void setLocale(Locale locale) { fLocale = locale; } /** * Get the Locale object that is being used. * * @return non-null reference to Locale object. */ public Locale getLocale() { return fLocale; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createXMLMessage(String msgKey, Object args[]) { if (XMLBundle == null) XMLBundle = loadResourceBundle(XML_ERROR_RESOURCES); if (XMLBundle != null) { return createMsg(XMLBundle, msgKey, args); } else return "Could not load any resource bundles."; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param fResourceBundle The resource bundle to use. * @param msgKey The message key to use. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createMsg(ListResourceBundle fResourceBundle, String msgKey, Object args[]) //throws Exception { String fmsg = null; boolean throwex = false; String msg = null; if (msgKey != null) msg = fResourceBundle.getString(msgKey); if (msg == null) { msg = fResourceBundle.getString(BAD_CODE); throwex = true; } if (args != null) { try { // Do this to keep format from crying. // This is better than making a bunch of conditional // code all over the place. int n = args.length; for (int i = 0; i < n; i++) { if (null == args[i]) args[i] = ""; } fmsg = java.text.MessageFormat.format(msg, args); } catch (Exception e) { fmsg = fResourceBundle.getString(FORMAT_FAILED); fmsg += " " + msg; } } else fmsg = msg; if (throwex) { throw new RuntimeException(fmsg); } return fmsg; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className The class name of the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static ListResourceBundle loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); try { return (ListResourceBundle)ResourceBundle.getBundle(className, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (ListResourceBundle)ResourceBundle.getBundle( className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles." + className, className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which can be appended to a resource name */ protected static String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources.java0000644000175000017500000004137710721374031023712 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Function not supported!"}, { ER_CANNOT_OVERWRITE_CAUSE, "Cannot overwrite cause"}, { ER_NO_DEFAULT_IMPL, "No default implementation found "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) not currently supported"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Offset bigger than slot"}, { ER_COROUTINE_NOT_AVAIL, "Coroutine not available, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager received co_exit() request"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() failed"}, { ER_COROUTINE_PARAM, "Coroutine parameter error ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nUNEXPECTED: Parser doTerminate answers {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "parse may not be called while parsing"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Error: typed iterator for axis {0} not implemented"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Error: iterator for axis {0} not implemented "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Iterator clone not supported"}, { ER_UNKNOWN_AXIS_TYPE, "Unknown axis traversal type: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Axis traverser not supported: {0}"}, { ER_NO_DTMIDS_AVAIL, "No more DTM IDs are available"}, { ER_NOT_SUPPORTED, "Not supported: {0}"}, { ER_NODE_NON_NULL, "Node must be non-null for getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "Could not resolve the node to a handle"}, { ER_STARTPARSE_WHILE_PARSING, "startParse may not be called while parsing"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse needs a non-null SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "could not initialize parser with"}, { ER_EXCEPTION_CREATING_POOL, "exception creating new instance for pool"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Path contains invalid escape sequence"}, { ER_SCHEME_REQUIRED, "Scheme is required!"}, { ER_NO_SCHEME_IN_URI, "No scheme found in URI: {0}"}, { ER_NO_SCHEME_INURI, "No scheme found in URI"}, { ER_PATH_INVALID_CHAR, "Path contains invalid character: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Cannot set scheme from null string"}, { ER_SCHEME_NOT_CONFORMANT, "The scheme is not conformant."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Host is not a well formed address"}, { ER_PORT_WHEN_HOST_NULL, "Port cannot be set when host is null"}, { ER_INVALID_PORT, "Invalid port number"}, { ER_FRAG_FOR_GENERIC_URI, "Fragment can only be set for a generic URI"}, { ER_FRAG_WHEN_PATH_NULL, "Fragment cannot be set when path is null"}, { ER_FRAG_INVALID_CHAR, "Fragment contains invalid character"}, { ER_PARSER_IN_USE, "Parser is already in use"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Cannot change {0} {1} while parsing"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Self-causation not permitted"}, { ER_NO_USERINFO_IF_NO_HOST, "Userinfo may not be specified if host is not specified"}, { ER_NO_PORT_IF_NO_HOST, "Port may not be specified if host is not specified"}, { ER_NO_QUERY_STRING_IN_PATH, "Query string cannot be specified in path and query string"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment cannot be specified in both the path and fragment"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Cannot initialize URI with empty parameters"}, { ER_METHOD_NOT_SUPPORTED, "Method not yet supported "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter not currently restartable"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader not before startParse request"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Axis traverser not supported: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler created with null PrintWriter!"}, { ER_SYSTEMID_UNKNOWN, "SystemId Unknown"}, { ER_LOCATION_UNKNOWN, "Location of error unknown"}, { ER_PREFIX_MUST_RESOLVE, "Prefix must resolve to a namespace: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() not supported in XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Attribute child does not have an owner document!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Attribute child does not have an owner document element!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Warning: can't output text before document element! Ignoring..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Can't have more than one root on a DOM!"}, { ER_ARG_LOCALNAME_NULL, "Argument 'localName' is null"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Localname in QNAME should be a valid NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Prefix in QNAME should be a valid NCName"}, { ER_NAME_CANT_START_WITH_COLON, "Name cannot start with a colon"}, { "BAD_CODE", "Parameter to createMessage was out of bounds"}, { "FORMAT_FAILED", "Exception thrown during messageFormat call"}, { "line", "Line #"}, { "column","Column #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_es.java0000644000175000017500000004325610721374030024376 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_es.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_es extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\u00a1Funci\u00f3n no soportada!"}, { ER_CANNOT_OVERWRITE_CAUSE, "No se puede escribir encima de la causa"}, { ER_NO_DEFAULT_IMPL, "No se ha encontrado una implementaci\u00f3n predeterminada "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) no soportada actualmente"}, { ER_OFFSET_BIGGER_THAN_SLOT, "El desplazamiento es mayor que el espacio"}, { ER_COROUTINE_NOT_AVAIL, "Corrutina no disponible, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager ha recibido una petici\u00f3n co_exit()"}, { ER_COJOINROUTINESET_FAILED, "Anomal\u00eda de co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "Error del par\u00e1metro de corrutina ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nINESPERADO: Respuestas doTerminate del analizador {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "No se puede llamar a parse mientras se est\u00e1 analizando"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Error: El iterador escrito para el eje {0} no est\u00e1 implementado"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Error: El iterador para el eje {0} no est\u00e1 implementado "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "La r\u00e9plica del iterador no est\u00e1 soportada"}, { ER_UNKNOWN_AXIS_TYPE, "Tipo de cruce de eje desconocido: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Cruzador de eje no soportado: {0}"}, { ER_NO_DTMIDS_AVAIL, "No hay m\u00e1s ID de DTM disponibles"}, { ER_NOT_SUPPORTED, "No soportado: {0}"}, { ER_NODE_NON_NULL, "El nodo no debe ser nulo para getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "No se puede resolver el nodo como un manejador"}, { ER_STARTPARSE_WHILE_PARSING, "No se puede llamar a startParse mientras se est\u00e1 analizando"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse necesita un SAXParser no nulo"}, { ER_COULD_NOT_INIT_PARSER, "No se ha podido inicializar el analizador con"}, { ER_EXCEPTION_CREATING_POOL, "Se ha producido una excepci\u00f3n al crear la nueva instancia de la agrupaci\u00f3n"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "La v\u00eda de acceso contiene una secuencia de escape no v\u00e1lida"}, { ER_SCHEME_REQUIRED, "\u00a1Se necesita un esquema!"}, { ER_NO_SCHEME_IN_URI, "No se ha encontrado un esquema en el URI: {0}"}, { ER_NO_SCHEME_INURI, "No se ha encontrado un esquema en el URI"}, { ER_PATH_INVALID_CHAR, "La v\u00eda de acceso contiene un car\u00e1cter no v\u00e1lido: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "No se puede establecer un esquema de una serie nula"}, { ER_SCHEME_NOT_CONFORMANT, "El esquema no es compatible."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "El sistema principal no es una direcci\u00f3n bien formada"}, { ER_PORT_WHEN_HOST_NULL, "No se puede establecer el puerto si el sistema principal es nulo"}, { ER_INVALID_PORT, "N\u00famero de puerto no v\u00e1lido"}, { ER_FRAG_FOR_GENERIC_URI, "S\u00f3lo se puede establecer el fragmento para un URI gen\u00e9rico"}, { ER_FRAG_WHEN_PATH_NULL, "No se puede establecer el fragmento si la v\u00eda de acceso es nula"}, { ER_FRAG_INVALID_CHAR, "El fragmento contiene un car\u00e1cter no v\u00e1lido"}, { ER_PARSER_IN_USE, "El analizador ya est\u00e1 en uso"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "No se puede cambiar {0} {1} mientras se analiza"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Autocausalidad no permitida"}, { ER_NO_USERINFO_IF_NO_HOST, "No se puede especificar la informaci\u00f3n de usuario si no se ha especificado el sistema principal"}, { ER_NO_PORT_IF_NO_HOST, "No se puede especificar el puerto si no se ha especificado el sistema principal"}, { ER_NO_QUERY_STRING_IN_PATH, "No se puede especificar la serie de consulta en la v\u00eda de acceso y en la serie de consulta"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "No se puede especificar el fragmento en la v\u00eda de acceso y en el fragmento"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "No se puede inicializar el URI con par\u00e1metros vac\u00edos"}, { ER_METHOD_NOT_SUPPORTED, "El m\u00e9todo no est\u00e1 a\u00fan soportado "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter no es actualmente reiniciable"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader no debe ir antes que la petici\u00f3n startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Cruzador de eje no soportado: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "\u00a1Se ha creado ListingErrorHandler con PrintWriter nulo!"}, { ER_SYSTEMID_UNKNOWN, "SystemId desconocido"}, { ER_LOCATION_UNKNOWN, "Ubicaci\u00f3n del error desconocida"}, { ER_PREFIX_MUST_RESOLVE, "El prefijo debe resolverse como un espacio de nombres: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "\u00a1createDocument() no soportada en XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\u00a1El hijo atributo no tiene un documento propietario!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\u00a1El hijo atributo no tiene un elemento documento propietario!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "\u00a1Aviso: no puede haber salida de texto antes del elemento documento! Ignorando..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "\u00a1No puede haber m\u00e1s de una ra\u00edz en DOM!"}, { ER_ARG_LOCALNAME_NULL, "El argumento 'localName' es nulo"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Localname en QNAME debe ser un NCName v\u00e1lido"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "El prefijo en QNAME debe ser un NCName v\u00e1lido"}, { ER_NAME_CANT_START_WITH_COLON, "El nombre no puede empezar con dos puntos"}, { "BAD_CODE", "El par\u00e1metro para createMessage estaba fuera de los l\u00edmites"}, { "FORMAT_FAILED", "Se ha generado una excepci\u00f3n durante la llamada messageFormat"}, { "line", "L\u00ednea n\u00fam."}, { "column","Columna n\u00fam."} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("es", "ES")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_fr.java0000644000175000017500000004331610721374032024375 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_fr.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_fr extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Fonction non prise en charge !"}, { ER_CANNOT_OVERWRITE_CAUSE, "Impossible de remplacer la cause"}, { ER_NO_DEFAULT_IMPL, "Impossible de trouver une impl\u00e9mentation par d\u00e9faut "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) n''est pas pris en charge"}, { ER_OFFSET_BIGGER_THAN_SLOT, "D\u00e9calage plus important que l'emplacement"}, { ER_COROUTINE_NOT_AVAIL, "Coroutine non disponible, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager a re\u00e7u une demande de co_exit()"}, { ER_COJOINROUTINESET_FAILED, "Echec de co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "Erreur de param\u00e8tre de Coroutine ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nRESULTAT INATTENDU : L''analyseur doTerminate r\u00e9pond {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "parse ne peut \u00eatre appel\u00e9 lors de l'analyse"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Erreur : it\u00e9rateur typ\u00e9 de l''axe {0} non impl\u00e9ment\u00e9"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Erreur : it\u00e9rateur de l''axe {0} non impl\u00e9ment\u00e9 "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Clone de l'it\u00e9rateur non pris en charge"}, { ER_UNKNOWN_AXIS_TYPE, "Type transversal d''axe inconnu : {0}"}, { ER_AXIS_NOT_SUPPORTED, "Traverseur d''axe non pris en charge : {0}"}, { ER_NO_DTMIDS_AVAIL, "Aucun autre ID de DTM disponible"}, { ER_NOT_SUPPORTED, "Non pris en charge : {0}"}, { ER_NODE_NON_NULL, "Le noeud ne doit pas \u00eatre vide pour getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "Impossible de convertir le noeud en pointeur"}, { ER_STARTPARSE_WHILE_PARSING, "startParse ne peut \u00eatre appel\u00e9 pendant l'analyse"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse requiert un SAXParser non vide"}, { ER_COULD_NOT_INIT_PARSER, "impossible d'initialiser l'analyseur"}, { ER_EXCEPTION_CREATING_POOL, "exception durant la cr\u00e9ation d'une instance du pool"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Le chemin d'acc\u00e8s contient une s\u00e9quence d'\u00e9chappement non valide"}, { ER_SCHEME_REQUIRED, "Processus requis !"}, { ER_NO_SCHEME_IN_URI, "Processus introuvable dans l''URI : {0}"}, { ER_NO_SCHEME_INURI, "Processus introuvable dans l'URI"}, { ER_PATH_INVALID_CHAR, "Le chemin contient un caract\u00e8re non valide : {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Impossible de d\u00e9finir le processus \u00e0 partir de la cha\u00eene vide"}, { ER_SCHEME_NOT_CONFORMANT, "Le processus n'est pas conforme."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "L'h\u00f4te n'est pas une adresse bien form\u00e9e"}, { ER_PORT_WHEN_HOST_NULL, "Le port ne peut \u00eatre d\u00e9fini quand l'h\u00f4te est vide"}, { ER_INVALID_PORT, "Num\u00e9ro de port non valide"}, { ER_FRAG_FOR_GENERIC_URI, "Le fragment ne peut \u00eatre d\u00e9fini que pour un URI g\u00e9n\u00e9rique"}, { ER_FRAG_WHEN_PATH_NULL, "Le fragment ne peut \u00eatre d\u00e9fini quand le chemin d'acc\u00e8s est vide"}, { ER_FRAG_INVALID_CHAR, "Le fragment contient un caract\u00e8re non valide"}, { ER_PARSER_IN_USE, "L'analyseur est d\u00e9j\u00e0 utilis\u00e9"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Impossible de modifier {0} {1} durant l''analyse"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Auto-causalit\u00e9 interdite"}, { ER_NO_USERINFO_IF_NO_HOST, "Userinfo ne peut \u00eatre sp\u00e9cifi\u00e9 si l'h\u00f4te ne l'est pas"}, { ER_NO_PORT_IF_NO_HOST, "Le port peut ne pas \u00eatre sp\u00e9cifi\u00e9 si l'h\u00f4te n'est pas sp\u00e9cifi\u00e9"}, { ER_NO_QUERY_STRING_IN_PATH, "La cha\u00eene de requ\u00eate ne doit pas figurer dans un chemin et une cha\u00eene de requ\u00eate"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Le fragment ne doit pas \u00eatre indiqu\u00e9 \u00e0 la fois dans le chemin et dans le fragment"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Impossible d'initialiser l'URI avec des param\u00e8tres vides"}, { ER_METHOD_NOT_SUPPORTED, "Cette m\u00e9thode n'est pas encore prise en charge "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter ne peut red\u00e9marrer"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader ne figure pas avant la demande startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Traverseur d''axe non pris en charge : {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler cr\u00e9\u00e9 avec PrintWriter vide !"}, { ER_SYSTEMID_UNKNOWN, "ID syst\u00e8me inconnu"}, { ER_LOCATION_UNKNOWN, "Emplacement inconnu de l'erreur"}, { ER_PREFIX_MUST_RESOLVE, "Le pr\u00e9fixe doit se convertir en espace de noms : {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() non pris en charge dans XPathContext !"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "L'enfant de l'attribut ne poss\u00e8de pas de document propri\u00e9taire !"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Le contexte ne poss\u00e8de pas d'\u00e9l\u00e9ment de document propri\u00e9taire !"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Avertissement : impossible d'afficher du texte avant l'\u00e9l\u00e9ment de document ! Traitement ignor\u00e9..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Un DOM ne peut poss\u00e9der plusieurs racines !"}, { ER_ARG_LOCALNAME_NULL, "L'argument 'localName' est vide"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Dans QNAME, le nom local doit \u00eatre un nom NCName valide"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Dans QNAME, le pr\u00e9fixe doit \u00eatre un nom NCName valide"}, { ER_NAME_CANT_START_WITH_COLON, "Un nom ne peut commencer par le signe deux-points"}, { "BAD_CODE", "Le param\u00e8tre de createMessage se trouve hors limites"}, { "FORMAT_FAILED", "Exception soulev\u00e9e lors de l'appel de messageFormat"}, { "line", "Ligne #"}, { "column","Colonne #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_it.java0000644000175000017500000004263010721374031024377 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_it.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_it extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Funzione non supportata."}, { ER_CANNOT_OVERWRITE_CAUSE, "Impossibile sovrascrivere causa"}, { ER_NO_DEFAULT_IMPL, "Non \u00e8 stata trovata alcuna implementazione predefinita "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) correntemente non supportato"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Offset pi\u00f9 grande dello slot"}, { ER_COROUTINE_NOT_AVAIL, "Coroutine non disponibile, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager ha ricevuto la richiesta co_exit()"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() con esito negativo"}, { ER_COROUTINE_PARAM, "Errore parametro Coroutine {0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nNON PREVISTO: Risposte doTerminate del parser {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "impossibile richiamare l'analisi durante l'analisi"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Errore: iteratore immesso per l''''asse {0} non implementato"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Errore: iteratore per l''''asse {0} non implementato "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Clone iteratore non supportato"}, { ER_UNKNOWN_AXIS_TYPE, "Tipo trasversale di asse sconosciuto: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Trasversale dell''''asse non supportato: {0}"}, { ER_NO_DTMIDS_AVAIL, "Non vi sono ulteriori ID DTM disponibili"}, { ER_NOT_SUPPORTED, "Non supportato: {0}"}, { ER_NODE_NON_NULL, "Il nodo deve essere non nullo per getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "Impossibile risolvere il nodo in un handle"}, { ER_STARTPARSE_WHILE_PARSING, "Impossibile richiamare startParse durante l'analisi"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse richiede SAXParser non nullo"}, { ER_COULD_NOT_INIT_PARSER, "impossibile inizializzare il parser con"}, { ER_EXCEPTION_CREATING_POOL, "si \u00e8 verificata un'eccezione durante la creazione della nuova istanza per il pool"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Il percorso contiene sequenza di escape non valida"}, { ER_SCHEME_REQUIRED, "Lo schema \u00e8 obbligatorio."}, { ER_NO_SCHEME_IN_URI, "Nessuno schema trovato nell''''URI: {0}"}, { ER_NO_SCHEME_INURI, "Non \u00e8 stato trovato alcuno schema nell'URI"}, { ER_PATH_INVALID_CHAR, "Il percorso contiene un carattere non valido: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Impossibile impostare lo schema da una stringa nulla"}, { ER_SCHEME_NOT_CONFORMANT, "Lo schema non \u00e8 conforme."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Host non \u00e8 un'indirizzo corretto"}, { ER_PORT_WHEN_HOST_NULL, "La porta non pu\u00f2 essere impostata se l'host \u00e8 nullo"}, { ER_INVALID_PORT, "Numero di porta non valido"}, { ER_FRAG_FOR_GENERIC_URI, "Il frammento pu\u00f2 essere impostato solo per un URI generico"}, { ER_FRAG_WHEN_PATH_NULL, "Il frammento non pu\u00f2 essere impostato se il percorso \u00e8 nullo"}, { ER_FRAG_INVALID_CHAR, "Il frammento contiene un carattere non valido"}, { ER_PARSER_IN_USE, "Parser gi\u00e0 in utilizzo"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Impossibile modificare {0} {1} durante l''''analisi"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Self-causation non consentito"}, { ER_NO_USERINFO_IF_NO_HOST, "Userinfo non pu\u00f2 essere specificato se l'host non \u00e8 specificato"}, { ER_NO_PORT_IF_NO_HOST, "La porta non pu\u00f2 essere specificata se l'host non \u00e8 specificato"}, { ER_NO_QUERY_STRING_IN_PATH, "La stringa di interrogazione non pu\u00f2 essere specificata nella stringa di interrogazione e percorso."}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Il frammento non pu\u00f2 essere specificato sia nel percorso che nel frammento"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Impossibile inizializzare l'URI con i parametri vuoti"}, { ER_METHOD_NOT_SUPPORTED, "Metodo non ancora supportato "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter correntemente non riavviabile"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader non si trova prima della richiesta startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Trasversale dell''''asse non supportato: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler creato con PrintWriter nullo."}, { ER_SYSTEMID_UNKNOWN, "SystemId sconosciuto"}, { ER_LOCATION_UNKNOWN, "Posizione di errore sconosciuta"}, { ER_PREFIX_MUST_RESOLVE, "Il prefisso deve risolvere in uno namespace: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() non supportato in XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Il child dell'attributo non ha un documento proprietario."}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Il child dell'attributo non ha un elemento del documento proprietario."}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Attenzione: impossibile emettere testo prima dell'elemento del documento. Operazione ignorata..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Impossibile avere pi\u00f9 di una root in un DOM!"}, { ER_ARG_LOCALNAME_NULL, "Argomento 'localName' nullo"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Localname in QNAME deve essere un NCName valido"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Prefix in QNAME deve essere un NCName valido"}, { ER_NAME_CANT_START_WITH_COLON, "Il nome non pu\u00f2 iniziare con un carattere di due punti"}, { "BAD_CODE", "Il parametro per createMessage fuori limite"}, { "FORMAT_FAILED", "Rilevata eccezione durante la chiamata messageFormat"}, { "line", "Riga #"}, { "column","Colonna #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("it", "IT")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_ru.java0000644000175000017500000006511610721374031024415 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_ru.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_ru extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f!"}, { ER_CANNOT_OVERWRITE_CAUSE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443"}, { ER_NO_DEFAULT_IMPL, "\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f"}, { ER_OFFSET_BIGGER_THAN_SLOT, "\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430"}, { ER_COROUTINE_NOT_AVAIL, "Coroutine \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430, \u0418\u0414={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0437\u0430\u043f\u0440\u043e\u0441 co_exit()"}, { ER_COJOINROUTINESET_FAILED, "\u041e\u0448\u0438\u0431\u043a\u0430 co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 Coroutine ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\n\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: \u041e\u0442\u0432\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 doTerminate: {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u041e\u0448\u0438\u0431\u043a\u0430: \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043e\u0441\u0438 {0} \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u041e\u0448\u0438\u0431\u043a\u0430: \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u043e\u0441\u0438 {0} "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "\u041a\u043e\u043f\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f"}, { ER_UNKNOWN_AXIS_TYPE, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0442\u0438\u043f Traverser \u0434\u043b\u044f \u043e\u0441\u0438: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Traverser \u0434\u043b\u044f \u043e\u0441\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f: {0}"}, { ER_NO_DTMIDS_AVAIL, "\u041d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0418\u0414 DTM"}, { ER_NOT_SUPPORTED, "\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f: {0}"}, { ER_NODE_NON_NULL, "\u0414\u043b\u044f getDTMHandleFromNode \u0443\u0437\u0435\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_COULD_NOT_RESOLVE_NODE, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0437\u0435\u043b \u0432 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440"}, { ER_STARTPARSE_WHILE_PARSING, "\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c startParse \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "\u0414\u043b\u044f startParse \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0439 SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441"}, { ER_EXCEPTION_CREATING_POOL, "\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0443\u043b\u0430"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u0412 \u0438\u043c\u0435\u043d\u0438 \u043f\u0443\u0442\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430\u044f Esc-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c"}, { ER_SCHEME_REQUIRED, "\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0441\u0445\u0435\u043c\u0430!"}, { ER_NO_SCHEME_IN_URI, "\u0412 URI \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0441\u0445\u0435\u043c\u0430: {0}"}, { ER_NO_SCHEME_INURI, "\u0412 URI \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0441\u0445\u0435\u043c\u0430"}, { ER_PATH_INVALID_CHAR, "\u0412 \u0438\u043c\u0435\u043d\u0438 \u043f\u0443\u0442\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438"}, { ER_SCHEME_NOT_CONFORMANT, "\u0421\u0445\u0435\u043c\u0430 \u043d\u0435 \u043a\u043e\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0430."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430"}, { ER_PORT_WHEN_HOST_NULL, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0445\u043e\u0441\u0442\u0430"}, { ER_INVALID_PORT, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0440\u0442\u0430"}, { ER_FRAG_FOR_GENERIC_URI, "\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 URI"}, { ER_FRAG_WHEN_PATH_NULL, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u0443\u0442\u0438"}, { ER_FRAG_INVALID_CHAR, "\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b"}, { ER_PARSER_IN_USE, "\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c {0} {1} \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "\u0421\u0430\u043c\u043e\u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e"}, { ER_NO_USERINFO_IF_NO_HOST, "\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d \u0445\u043e\u0441\u0442"}, { ER_NO_PORT_IF_NO_HOST, "\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d \u0445\u043e\u0441\u0442"}, { ER_NO_QUERY_STRING_IN_PATH, "\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0443\u0442\u0438 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043f\u0443\u0442\u0438 \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c URI \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438"}, { ER_METHOD_NOT_SUPPORTED, "\u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a IncrementalSAXSource_Filter \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "\u041d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c XMLReader \u0434\u043e startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Traverser \u0434\u043b\u044f \u043e\u0441\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u043f\u0443\u0441\u0442\u044b\u043c PrintWriter!"}, { ER_SYSTEMID_UNKNOWN, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0418\u0414 \u0441\u0438\u0441\u0442\u0435\u043c\u044b"}, { ER_LOCATION_UNKNOWN, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430"}, { ER_PREFIX_MUST_RESOLVE, "\u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\u0423 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 child \u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\u0423 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 child \u043d\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442 \u043f\u0435\u0440\u0435\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430! \u041f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "\u0412 DOM \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442!"}, { ER_ARG_LOCALNAME_NULL, "\u041f\u0443\u0441\u0442\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 'localName'"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 QNAME \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "\u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u0432 QNAME \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c NCName"}, { ER_NAME_CANT_START_WITH_COLON, "\u0418\u043c\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f"}, { "BAD_CODE", "\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 createMessage \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430"}, { "FORMAT_FAILED", "\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 messageFormat"}, { "line", "\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 "}, { "column","\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 "} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_zh.java0000644000175000017500000004431710721374031024410 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_zh.java 338081 2004-12-15 17:35:58Z jycli $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_zh extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\u51fd\u6570\u4e0d\u53d7\u652f\u6301\uff01"}, { ER_CANNOT_OVERWRITE_CAUSE, "\u65e0\u6cd5\u8986\u76d6\u539f\u56e0"}, { ER_NO_DEFAULT_IMPL, "\u627e\u4e0d\u5230\u7f3a\u7701\u5b9e\u73b0"}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "\u5f53\u524d\u4e0d\u652f\u6301 ChunkedIntArray({0})"}, { ER_OFFSET_BIGGER_THAN_SLOT, "\u504f\u79fb\u5927\u4e8e\u69fd"}, { ER_COROUTINE_NOT_AVAIL, "\u534f\u540c\u7a0b\u5e8f\u4e0d\u53ef\u7528\uff0cid={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager \u63a5\u6536\u5230 co_exit() \u8bf7\u6c42"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() \u5931\u8d25"}, { ER_COROUTINE_PARAM, "\u534f\u540c\u7a0b\u5e8f\u53c2\u6570\u9519\u8bef\uff08{0}\uff09"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\n\u610f\u5916\uff1a\u89e3\u6790\u5668 doTerminate \u5e94\u7b54 {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "\u89e3\u6790\u65f6\u53ef\u80fd\u6ca1\u6709\u8c03\u7528 parse"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u9519\u8bef\uff1a\u6ca1\u6709\u5b9e\u73b0\u4e3a\u8f74 {0} \u8f93\u5165\u7684\u8fed\u4ee3\u5668"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u9519\u8bef\uff1a\u6ca1\u6709\u5b9e\u73b0\u8f74 {0} \u7684\u8fed\u4ee3\u5668"}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "\u4e0d\u652f\u6301\u8fed\u4ee3\u5668\u514b\u9686"}, { ER_UNKNOWN_AXIS_TYPE, "\u672a\u77e5\u7684\u8f74\u904d\u5386\u7c7b\u578b\uff1a{0}"}, { ER_AXIS_NOT_SUPPORTED, "\u4e0d\u652f\u6301\u8f74\u904d\u5386\u7a0b\u5e8f\uff1a{0}"}, { ER_NO_DTMIDS_AVAIL, "\u65e0\u66f4\u591a\u7684 DTM \u6807\u8bc6\u53ef\u7528"}, { ER_NOT_SUPPORTED, "\u4e0d\u652f\u6301\uff1a{0}"}, { ER_NODE_NON_NULL, "\u5bf9\u4e8e getDTMHandleFromNode\uff0c\u8282\u70b9\u5fc5\u987b\u662f\u975e\u7a7a\u7684"}, { ER_COULD_NOT_RESOLVE_NODE, "\u65e0\u6cd5\u5c06\u8282\u70b9\u89e3\u6790\u5230\u53e5\u67c4"}, { ER_STARTPARSE_WHILE_PARSING, "\u89e3\u6790\u65f6\u53ef\u80fd\u6ca1\u6709\u8c03\u7528 startParse"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse \u9700\u8981\u975e\u7a7a\u7684 SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "\u65e0\u6cd5\u7528\u4ee5\u4e0b\u5de5\u5177\u521d\u59cb\u5316\u89e3\u6790\u5668"}, { ER_EXCEPTION_CREATING_POOL, "\u4e3a\u6c60\u521b\u5efa\u65b0\u5b9e\u4f8b\u65f6\u53d1\u751f\u5f02\u5e38"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u8def\u5f84\u5305\u542b\u65e0\u6548\u7684\u8f6c\u4e49\u5e8f\u5217"}, { ER_SCHEME_REQUIRED, "\u6a21\u5f0f\u662f\u5fc5\u9700\u7684\uff01"}, { ER_NO_SCHEME_IN_URI, "URI {0} \u4e2d\u627e\u4e0d\u5230\u4efb\u4f55\u6a21\u5f0f"}, { ER_NO_SCHEME_INURI, "URI \u4e2d\u627e\u4e0d\u5230\u4efb\u4f55\u6a21\u5f0f"}, { ER_PATH_INVALID_CHAR, "\u8def\u5f84\u5305\u542b\u65e0\u6548\u7684\u5b57\u7b26\uff1a{0}"}, { ER_SCHEME_FROM_NULL_STRING, "\u65e0\u6cd5\u4ece\u7a7a\u5b57\u7b26\u4e32\u8bbe\u7f6e\u6a21\u5f0f"}, { ER_SCHEME_NOT_CONFORMANT, "\u6a21\u5f0f\u4e0d\u4e00\u81f4\u3002"}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "\u4e3b\u673a\u4e0d\u662f\u683c\u5f0f\u6b63\u786e\u7684\u5730\u5740"}, { ER_PORT_WHEN_HOST_NULL, "\u4e3b\u673a\u4e3a\u7a7a\u65f6\uff0c\u65e0\u6cd5\u8bbe\u7f6e\u7aef\u53e3"}, { ER_INVALID_PORT, "\u7aef\u53e3\u53f7\u65e0\u6548"}, { ER_FRAG_FOR_GENERIC_URI, "\u53ea\u80fd\u4e3a\u7c7b\u5c5e URI \u8bbe\u7f6e\u7247\u6bb5"}, { ER_FRAG_WHEN_PATH_NULL, "\u8def\u5f84\u4e3a\u7a7a\u65f6\uff0c\u65e0\u6cd5\u8bbe\u7f6e\u7247\u6bb5"}, { ER_FRAG_INVALID_CHAR, "\u7247\u6bb5\u5305\u542b\u65e0\u6548\u7684\u5b57\u7b26"}, { ER_PARSER_IN_USE, "\u89e3\u6790\u5668\u5df2\u5728\u4f7f\u7528"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "\u89e3\u6790\u65f6\u65e0\u6cd5\u66f4\u6539 {0} {1}"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "\u4e0d\u5141\u8bb8\u81ea\u89e6\u53d1"}, { ER_NO_USERINFO_IF_NO_HOST, "\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u4e3b\u673a\uff0c\u5219\u4e0d\u53ef\u4ee5\u6307\u5b9a\u7528\u6237\u4fe1\u606f"}, { ER_NO_PORT_IF_NO_HOST, "\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u4e3b\u673a\uff0c\u5219\u4e0d\u53ef\u4ee5\u6307\u5b9a\u7aef\u53e3"}, { ER_NO_QUERY_STRING_IN_PATH, "\u8def\u5f84\u548c\u67e5\u8be2\u5b57\u7b26\u4e32\u4e2d\u4e0d\u80fd\u6307\u5b9a\u67e5\u8be2\u5b57\u7b26\u4e32"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "\u8def\u5f84\u548c\u7247\u6bb5\u4e2d\u90fd\u4e0d\u80fd\u6307\u5b9a\u7247\u6bb5"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "\u4e0d\u80fd\u4ee5\u7a7a\u53c2\u6570\u521d\u59cb\u5316 URI"}, { ER_METHOD_NOT_SUPPORTED, "\u5c1a\u4e0d\u652f\u6301\u65b9\u6cd5"}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "\u5f53\u524d\u4e0d\u53ef\u91cd\u65b0\u542f\u52a8 IncrementalSAXSource_Filter"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader \u4e0d\u5728 startParse \u8bf7\u6c42\u4e4b\u524d"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "\u4e0d\u652f\u6301\u8f74\u904d\u5386\u7a0b\u5e8f\uff1a{0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "\u4ee5\u7a7a\u7684 PrintWriter \u521b\u5efa\u4e86 ListingErrorHandler\uff01"}, { ER_SYSTEMID_UNKNOWN, "SystemId \u672a\u77e5"}, { ER_LOCATION_UNKNOWN, "\u9519\u8bef\u4f4d\u7f6e\u672a\u77e5"}, { ER_PREFIX_MUST_RESOLVE, "\u524d\u7f00\u5fc5\u987b\u89e3\u6790\u4e3a\u540d\u79f0\u7a7a\u95f4\uff1a{0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "XPathContext \u4e2d\u4e0d\u652f\u6301 createDocument()\uff01"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\u5b50\u5c5e\u6027\u6ca1\u6709\u6240\u6709\u8005\u6587\u6863\uff01"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\u5b50\u5c5e\u6027\u6ca1\u6709\u6240\u6709\u8005\u6587\u6863\u5143\u7d20\uff01"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "\u8b66\u544a\uff1a\u65e0\u6cd5\u5728\u8bb0\u5f55\u5143\u7d20\u524d\u8f93\u51fa\u6587\u672c\uff01\u5ffd\u7565..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "DOM \u4e0a\u4e0d\u80fd\u6709\u591a\u4e2a\u6839\uff01"}, { ER_ARG_LOCALNAME_NULL, "\u81ea\u53d8\u91cf\u201clocalName\u201d\u4e3a\u7a7a"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "QNAME \u4e2d\u7684\u672c\u5730\u540d\u5e94\u5f53\u662f\u6709\u6548\u7684 NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "QNAME \u4e2d\u7684\u524d\u7f00\u5e94\u5f53\u662f\u6709\u6548\u7684 NCName"}, { ER_NAME_CANT_START_WITH_COLON, "\u540d\u79f0\u4e0d\u80fd\u4ee5\u5192\u53f7\u5f00\u5934"}, { "BAD_CODE", "createMessage \u7684\u53c2\u6570\u8d85\u51fa\u8303\u56f4"}, { "FORMAT_FAILED", "\u5728 messageFormat \u8c03\u7528\u8fc7\u7a0b\u4e2d\u629b\u51fa\u4e86\u5f02\u5e38"}, { "line", "\u884c\u53f7"}, { "column","\u5217\u53f7"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("zh", "CN")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_pt_BR.java0000644000175000017500000004314310721374032024772 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_pt_BR.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_pt_BR extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Fun\u00e7\u00e3o n\u00e3o suportada!"}, { ER_CANNOT_OVERWRITE_CAUSE, "Imposs\u00edvel sobrepor causa"}, { ER_NO_DEFAULT_IMPL, "Nenhuma implementa\u00e7\u00e3o padr\u00e3o encontrada"}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) n\u00e3o suportado atualmente"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Deslocamento maior que slot"}, { ER_COROUTINE_NOT_AVAIL, "Co-rotina n\u00e3o dispon\u00edvel, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager recebido para pedido co_exit()"}, { ER_COJOINROUTINESET_FAILED, "Falha de co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "Erro de par\u00e2metro coroutine ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nINESPERADO: doTerminate do analisador respondeu {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "parse n\u00e3o pode ser chamado durante an\u00e1lise"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Erro: digitado repetidor para eixo {0} n\u00e3o implementado"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Erro: repetidor para eixo {0} n\u00e3o implementado"}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Clone de repetidor n\u00e3o suportado"}, { ER_UNKNOWN_AXIS_TYPE, "Tipo de passagem de eixo desconhecida: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Atravessador de eixo n\u00e3o suportado: {0}"}, { ER_NO_DTMIDS_AVAIL, "N\u00e3o existem mais IDs de DTM dispon\u00edveis"}, { ER_NOT_SUPPORTED, "N\u00e3o suportado: {0}"}, { ER_NODE_NON_NULL, "O n\u00f3 n\u00e3o deve ser nulo para getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "N\u00e3o foi poss\u00edvel resolver o n\u00f3 para um identificador"}, { ER_STARTPARSE_WHILE_PARSING, "startParse n\u00e3o pode ser chamado durante an\u00e1lise"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse precisa de um SAXParser n\u00e3o-nulo"}, { ER_COULD_NOT_INIT_PARSER, "n\u00e3o foi poss\u00edvel inicializar analisador com"}, { ER_EXCEPTION_CREATING_POOL, "exce\u00e7\u00e3o ao criar nova inst\u00e2ncia para o conjunto"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "O caminho cont\u00e9m seq\u00fc\u00eancia de escape inv\u00e1lida"}, { ER_SCHEME_REQUIRED, "O esquema \u00e9 obrigat\u00f3rio!"}, { ER_NO_SCHEME_IN_URI, "Nenhum esquema encontrado no URI: {0}"}, { ER_NO_SCHEME_INURI, "Nenhum esquema encontrado no URI"}, { ER_PATH_INVALID_CHAR, "O caminho cont\u00e9m caractere inv\u00e1lido: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Imposs\u00edvel definir esquema a partir da cadeia nula"}, { ER_SCHEME_NOT_CONFORMANT, "O esquema n\u00e3o est\u00e1 em conformidade."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "O host n\u00e3o \u00e9 um endere\u00e7o formado corretamente"}, { ER_PORT_WHEN_HOST_NULL, "A porta n\u00e3o pode ser definida quando o host \u00e9 nulo"}, { ER_INVALID_PORT, "N\u00famero de porta inv\u00e1lido"}, { ER_FRAG_FOR_GENERIC_URI, "O fragmento s\u00f3 pode ser definido para um URI gen\u00e9rico"}, { ER_FRAG_WHEN_PATH_NULL, "O fragmento n\u00e3o pode ser definido quando o caminho \u00e9 nulo"}, { ER_FRAG_INVALID_CHAR, "O fragmento cont\u00e9m caractere inv\u00e1lido"}, { ER_PARSER_IN_USE, "O analisador j\u00e1 est\u00e1 sendo utilizado"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Imposs\u00edvel alterar {0} {1} durante an\u00e1lise"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Auto-causa\u00e7\u00e3o n\u00e3o permitida"}, { ER_NO_USERINFO_IF_NO_HOST, "Userinfo n\u00e3o pode ser especificado se host n\u00e3o for especificado"}, { ER_NO_PORT_IF_NO_HOST, "Port n\u00e3o pode ser especificado se host n\u00e3o for especificado"}, { ER_NO_QUERY_STRING_IN_PATH, "A cadeia de consulta n\u00e3o pode ser especificada na cadeia de consulta e caminho"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "O fragmento n\u00e3o pode ser especificado no caminho e fragmento"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Imposs\u00edvel inicializar URI com par\u00e2metros vazios"}, { ER_METHOD_NOT_SUPPORTED, "M\u00e9todo ainda n\u00e3o suportado"}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter atualmente n\u00e3o reinicializ\u00e1vel"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader n\u00e3o antes do pedido startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Atravessador de eixo n\u00e3o suportado: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler criado com nulo PrintWriter!"}, { ER_SYSTEMID_UNKNOWN, "SystemId Desconhecido"}, { ER_LOCATION_UNKNOWN, "Localiza\u00e7\u00e3o de erro desconhecido"}, { ER_PREFIX_MUST_RESOLVE, "O prefixo deve ser resolvido para um espa\u00e7o de nomes: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() n\u00e3o suportado em XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "O atributo child n\u00e3o possui um documento do propriet\u00e1rio!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "O atributo child n\u00e3o possui um elemento de documento do propriet\u00e1rio!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Aviso: imposs\u00edvel emitir texto antes do elemento document! Ignorando..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Imposs\u00edvel ter mais de uma raiz em um DOM!"}, { ER_ARG_LOCALNAME_NULL, "O argumento 'localName' \u00e9 nulo"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Localname em QNAME deve ser um NCName v\u00e1lido"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "O prefixo em QNAME deve ser um NCName v\u00e1lido"}, { ER_NAME_CANT_START_WITH_COLON, "O nome n\u00e3o pode come\u00e7ar com um caractere de dois pontos (:)"}, { "BAD_CODE", "O par\u00e2metro para createMessage estava fora dos limites"}, { "FORMAT_FAILED", "Exce\u00e7\u00e3o emitida durante chamada messageFormat"}, { "line", "Linha n\u00b0"}, { "column","Coluna n\u00b0"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("pt", "BR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_ca.java0000644000175000017500000004347210721374030024352 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_ca.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_ca extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Aquesta funci\u00f3 no t\u00e9 suport."}, { ER_CANNOT_OVERWRITE_CAUSE, "No es pot sobreescriure una causa"}, { ER_NO_DEFAULT_IMPL, "No s'ha trobat cap implementaci\u00f3 per defecte "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "Actualment no es d\u00f3na suport a ChunkedIntArray({0})"}, { ER_OFFSET_BIGGER_THAN_SLOT, "El despla\u00e7ament \u00e9s m\u00e9s gran que la ranura"}, { ER_COROUTINE_NOT_AVAIL, "Coroutine no est\u00e0 disponible, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager ha rebut una sol\u00b7licitud co_exit()"}, { ER_COJOINROUTINESET_FAILED, "S'ha produ\u00eft un error a co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "Error de par\u00e0metre coroutine ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nUNEXPECTED: doTerminate de l''analitzador respon {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "L'an\u00e0lisi no es pot cridar mentre s'est\u00e0 duent a terme"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Error: l''iterador de tipus de l''eix {0} no s''ha implementat"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Error: l''iterador de l''eix {0} no s''ha implementat "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "El clonatge de l'iterador no t\u00e9 suport"}, { ER_UNKNOWN_AXIS_TYPE, "Tipus de commutaci\u00f3 de l''eix desconeguda: {0}"}, { ER_AXIS_NOT_SUPPORTED, "La commutaci\u00f3 de l''eix no t\u00e9 suport: {0}"}, { ER_NO_DTMIDS_AVAIL, "No hi ha m\u00e9s ID de DTM disponibles"}, { ER_NOT_SUPPORTED, "No t\u00e9 suport: {0}"}, { ER_NODE_NON_NULL, "El node no ha de ser nul per a getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "No s'ha pogut resoldre el node en un manejador"}, { ER_STARTPARSE_WHILE_PARSING, "startParse no es pot cridar mentre s'est\u00e0 duent a terme l'an\u00e0lisi"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse necessita un SAXParser que no sigui nul"}, { ER_COULD_NOT_INIT_PARSER, "No s'ha pogut inicialitzar l'analitzador amb"}, { ER_EXCEPTION_CREATING_POOL, "S'ha produ\u00eft una excepci\u00f3 en crear una nova inst\u00e0ncia de l'agrupaci\u00f3"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "La via d'acc\u00e9s cont\u00e9 una seq\u00fc\u00e8ncia d'escapament no v\u00e0lida"}, { ER_SCHEME_REQUIRED, "Es necessita l'esquema"}, { ER_NO_SCHEME_IN_URI, "No s''ha trobat cap esquema a l''URI: {0}"}, { ER_NO_SCHEME_INURI, "No s'ha trobat cap esquema a l'URI"}, { ER_PATH_INVALID_CHAR, "La via d''acc\u00e9s cont\u00e9 un car\u00e0cter no v\u00e0lid {0}"}, { ER_SCHEME_FROM_NULL_STRING, "No es pot establir un esquema des d'una cadena nul\u00b7la"}, { ER_SCHEME_NOT_CONFORMANT, "L'esquema no t\u00e9 conformitat."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "El format de l'adre\u00e7a del sistema principal no \u00e9s el correcte"}, { ER_PORT_WHEN_HOST_NULL, "El port no es pot establir quan el sistema principal \u00e9s nul"}, { ER_INVALID_PORT, "N\u00famero de port no v\u00e0lid"}, { ER_FRAG_FOR_GENERIC_URI, "El fragment nom\u00e9s es pot establir per a un URI gen\u00e8ric"}, { ER_FRAG_WHEN_PATH_NULL, "El fragment no es pot establir si la via d'acc\u00e9s \u00e9s nul\u00b7la"}, { ER_FRAG_INVALID_CHAR, "El fragment cont\u00e9 un car\u00e0cter no v\u00e0lid"}, { ER_PARSER_IN_USE, "L'analitzador ja s'est\u00e0 utilitzant"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "No es pot modificar {0} {1} mentre es duu a terme l''an\u00e0lisi"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "La causalitat pr\u00f2pia no est\u00e0 permesa."}, { ER_NO_USERINFO_IF_NO_HOST, "No es pot especificar informaci\u00f3 de l'usuari si no s'especifica el sistema principal"}, { ER_NO_PORT_IF_NO_HOST, "No es pot especificar el port si no s'especifica el sistema principal"}, { ER_NO_QUERY_STRING_IN_PATH, "No es pot especificar una cadena de consulta en la via d'acc\u00e9s i la cadena de consulta"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "No es pot especificar un fragment tant en la via d'acc\u00e9s com en el fragment"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "No es pot inicialitzar l'URI amb par\u00e0metres buits"}, { ER_METHOD_NOT_SUPPORTED, "Aquest m\u00e8tode encara no t\u00e9 suport "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "Ara mateix no es pot reiniciar IncrementalSAXSource_Filter"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader no es pot produir abans de la sol\u00b7licitud d'startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "La commutaci\u00f3 de l''eix no t\u00e9 suport: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "S'ha creat ListingErrorHandler amb PrintWriter nul"}, { ER_SYSTEMID_UNKNOWN, "ID del sistema (SystemId) desconegut"}, { ER_LOCATION_UNKNOWN, "Ubicaci\u00f3 de l'error desconeguda"}, { ER_PREFIX_MUST_RESOLVE, "El prefix s''ha de resoldre en un espai de noms: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() no t\u00e9 suport a XPathContext"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "El subordinat de l'atribut no t\u00e9 un document de propietari."}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "El subordinat de l'atribut no t\u00e9 un element de document de propietari."}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Av\u00eds: no es pot produir text abans de l'element de document. Es passa per alt."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "No hi pot haver m\u00e9s d'una arrel en un DOM."}, { ER_ARG_LOCALNAME_NULL, "L'argument 'localName' \u00e9s nul."}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "El nom local de QNAME ha de ser un NCName v\u00e0lid."}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "El prefix de QNAME ha de ser un NCName v\u00e0lid."}, { ER_NAME_CANT_START_WITH_COLON, "El nom no pot comen\u00e7ar amb dos punts. "}, { "BAD_CODE", "El par\u00e0metre de createMessage estava fora dels l\u00edmits."}, { "FORMAT_FAILED", "S'ha generat una excepci\u00f3 durant la crida messageFormat."}, { "line", "L\u00ednia n\u00fam."}, { "column","Columna n\u00fam."} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("ca", "ES")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_pl.java0000644000175000017500000004356110721374033024404 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_pl.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_pl extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Nieobs\u0142ugiwana funkcja!"}, { ER_CANNOT_OVERWRITE_CAUSE, "Nie mo\u017cna nadpisa\u0107 przyczyny"}, { ER_NO_DEFAULT_IMPL, "Nie znaleziono domy\u015blnej implementacji"}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) nie jest obecnie obs\u0142ugiwane"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Przesuni\u0119cie wi\u0119ksze ni\u017c szczelina"}, { ER_COROUTINE_NOT_AVAIL, "Koprocedura niedost\u0119pna, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager otrzyma\u0142 \u017c\u0105danie co_exit()"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() nie powiod\u0142o si\u0119"}, { ER_COROUTINE_PARAM, "B\u0142\u0105d parametru koprocedury ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nNIEOCZEKIWANE: Analizator doTerminate odpowiada {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "Nie mo\u017cna wywo\u0142a\u0107 parse podczas analizowania"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "B\u0142\u0105d: Iterator okre\u015blonego typu dla osi {0} nie jest zaimplementowany"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "B\u0142\u0105d: Iterator dla osi {0} nie jest zaimplementowany"}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Kopia iteratora nie jest obs\u0142ugiwana"}, { ER_UNKNOWN_AXIS_TYPE, "Nieznany typ przej\u015bcia osi {0}"}, { ER_AXIS_NOT_SUPPORTED, "Nieobs\u0142ugiwane przej\u015bcie osi: {0}"}, { ER_NO_DTMIDS_AVAIL, "Nie ma wi\u0119cej dost\u0119pnych identyfikator\u00f3w DTM"}, { ER_NOT_SUPPORTED, "Nieobs\u0142ugiwane: {0}"}, { ER_NODE_NON_NULL, "W\u0119ze\u0142 musi by\u0107 niepusty dla getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "Nie mo\u017cna przet\u0142umaczy\u0107 w\u0119z\u0142a na uchwyt"}, { ER_STARTPARSE_WHILE_PARSING, "Nie mo\u017cna wywo\u0142a\u0107 startParse podczas analizowania"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse potrzebuje niepustego SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "nie mo\u017cna zainicjowa\u0107 analizatora"}, { ER_EXCEPTION_CREATING_POOL, "wyj\u0105tek podczas tworzenia nowej instancji dla puli"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u015acie\u017cka zawiera nieznan\u0105 sekwencj\u0119 o zmienionym znaczeniu"}, { ER_SCHEME_REQUIRED, "Schemat jest wymagany!"}, { ER_NO_SCHEME_IN_URI, "Nie znaleziono schematu w URI {0}"}, { ER_NO_SCHEME_INURI, "Nie znaleziono schematu w URI"}, { ER_PATH_INVALID_CHAR, "\u015acie\u017cka zawiera niepoprawny znak {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Nie mo\u017cna ustawi\u0107 schematu z pustego ci\u0105gu znak\u00f3w"}, { ER_SCHEME_NOT_CONFORMANT, "Schemat nie jest zgodny."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Host nie jest poprawnie skonstruowanym adresem"}, { ER_PORT_WHEN_HOST_NULL, "Nie mo\u017cna ustawi\u0107 portu, kiedy host jest pusty"}, { ER_INVALID_PORT, "Niepoprawny numer portu"}, { ER_FRAG_FOR_GENERIC_URI, "Fragment mo\u017cna ustawi\u0107 tylko dla og\u00f3lnego URI"}, { ER_FRAG_WHEN_PATH_NULL, "Nie mo\u017cna ustawi\u0107 fragmentu, kiedy \u015bcie\u017cka jest pusta"}, { ER_FRAG_INVALID_CHAR, "Fragment zawiera niepoprawny znak"}, { ER_PARSER_IN_USE, "Analizator jest ju\u017c u\u017cywany"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Nie mo\u017cna zmieni\u0107 {0} {1} podczas analizowania"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Bycie w\u0142asn\u0105 przyczyn\u0105 jest niedozwolone"}, { ER_NO_USERINFO_IF_NO_HOST, "Nie mo\u017cna poda\u0107 informacji o u\u017cytkowniku, je\u015bli nie podano hosta"}, { ER_NO_PORT_IF_NO_HOST, "Nie mo\u017cna poda\u0107 portu, je\u015bli nie podano hosta"}, { ER_NO_QUERY_STRING_IN_PATH, "Tekstu zapytania nie mo\u017cna poda\u0107 w tek\u015bcie \u015bcie\u017cki i zapytania"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Nie mo\u017cna poda\u0107 fragmentu jednocze\u015bnie w \u015bcie\u017cce i fragmencie"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Nie mo\u017cna zainicjowa\u0107 URI z pustymi parametrami"}, { ER_METHOD_NOT_SUPPORTED, "Metoda nie jest jeszcze obs\u0142ugiwana"}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter nie jest obecnie mo\u017cliwy do ponownego uruchomienia"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader nie mo\u017ce wyst\u0105pi\u0107 przed \u017c\u0105daniem startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Nieobs\u0142ugiwane przej\u015bcie osi: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "Utworzono ListingErrorHandler z pustym PrintWriter!"}, { ER_SYSTEMID_UNKNOWN, "Nieznany identyfikator systemu"}, { ER_LOCATION_UNKNOWN, "Po\u0142o\u017cenie b\u0142\u0119du jest nieznane"}, { ER_PREFIX_MUST_RESOLVE, "Przedrostek musi da\u0107 si\u0119 przet\u0142umaczy\u0107 na przestrze\u0144 nazw: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "Funkcja createDocument() nie jest obs\u0142ugiwana w XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Bezpo\u015bredni element potomny atrybutu nie ma dokumentu w\u0142a\u015bciciela!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Bezpo\u015bredni element potomny atrybutu nie ma elementu dokumentu w\u0142a\u015bciciela!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Ostrze\u017cenie: Nie mo\u017cna wyprowadzi\u0107 tekstu przed elementem dokumentu! Ignorowanie..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Nie mo\u017cna mie\u0107 wi\u0119cej ni\u017c jeden element g\u0142\u00f3wny w DOM!"}, { ER_ARG_LOCALNAME_NULL, "Argument 'localName' jest pusty"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Nazwa lokalna w QNAME powinna by\u0107 poprawn\u0105 nazw\u0105 NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Przedrostek w QNAME powinien by\u0107 poprawn\u0105 nazw\u0105 NCName"}, { ER_NAME_CANT_START_WITH_COLON, "Nazwa nie mo\u017ce rozpoczyna\u0107 si\u0119 od dwukropka"}, { "BAD_CODE", "Parametr createMessage by\u0142 spoza zakresu"}, { "FORMAT_FAILED", "Podczas wywo\u0142ania messageFormat zg\u0142oszony zosta\u0142 wyj\u0105tek"}, { "line", "Nr wiersza: "}, { "column","Nr kolumny: "} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("pl", "PL")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_tr.java0000644000175000017500000004411210721374032024406 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_tr.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_tr extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\u0130\u015flev desteklenmiyor!"}, { ER_CANNOT_OVERWRITE_CAUSE, "Nedenin \u00fczerine yaz\u0131lamaz"}, { ER_NO_DEFAULT_IMPL, "Varsay\u0131lan uygulama bulunamad\u0131 "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) \u015fu an desteklenmiyor"}, { ER_OFFSET_BIGGER_THAN_SLOT, "G\u00f6reli konum yuvadan b\u00fcy\u00fck"}, { ER_COROUTINE_NOT_AVAIL, "Coroutine kullan\u0131lam\u0131yor, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager co_exit() iste\u011fi ald\u0131"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() ba\u015far\u0131s\u0131z oldu"}, { ER_COROUTINE_PARAM, "Coroutine de\u011fi\u015ftirgesi hatas\u0131 ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nBEKLENMEYEN: Parser doTerminate yan\u0131t\u0131 {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "Ayr\u0131\u015ft\u0131rma s\u0131ras\u0131nda parse \u00e7a\u011fr\u0131lamaz"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Hata: {0} ekseni i\u00e7in tip atanm\u0131\u015f yineleyici ger\u00e7ekle\u015ftirilmedi"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Hata: {0} ekseni i\u00e7in yineleyici ger\u00e7ekle\u015ftirilmedi "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Yineleyici e\u015fkopyas\u0131 desteklenmiyor"}, { ER_UNKNOWN_AXIS_TYPE, "Bilinmeyen eksen dola\u015fma tipi: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Eksen dola\u015f\u0131c\u0131 desteklenmiyor: {0}"}, { ER_NO_DTMIDS_AVAIL, "Kullan\u0131labilecek ba\u015fka DTM tan\u0131t\u0131c\u0131s\u0131 yok"}, { ER_NOT_SUPPORTED, "Desteklenmiyor: {0}"}, { ER_NODE_NON_NULL, "getDTMHandleFromNode i\u00e7in d\u00fc\u011f\u00fcm bo\u015f de\u011ferli olmamal\u0131d\u0131r"}, { ER_COULD_NOT_RESOLVE_NODE, "D\u00fc\u011f\u00fcm tan\u0131t\u0131c\u0131 de\u011fere \u00e7\u00f6z\u00fclemedi"}, { ER_STARTPARSE_WHILE_PARSING, "Ayr\u0131\u015ft\u0131rma s\u0131ras\u0131nda startParse \u00e7a\u011fr\u0131lamaz"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse i\u00e7in bo\u015f de\u011ferli olmayan SAXParser gerekiyor"}, { ER_COULD_NOT_INIT_PARSER, "Ayr\u0131\u015ft\u0131r\u0131c\u0131 bununla kullan\u0131ma haz\u0131rlanamad\u0131"}, { ER_EXCEPTION_CREATING_POOL, "Havuz i\u00e7in yeni \u00f6rnek yarat\u0131l\u0131rken kural d\u0131\u015f\u0131 durum"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Yol ge\u00e7ersiz ka\u00e7\u0131\u015f dizisi i\u00e7eriyor"}, { ER_SCHEME_REQUIRED, "\u015eema gerekli!"}, { ER_NO_SCHEME_IN_URI, "URI i\u00e7inde \u015fema bulunamad\u0131: {0}"}, { ER_NO_SCHEME_INURI, "URI i\u00e7inde \u015fema bulunamad\u0131"}, { ER_PATH_INVALID_CHAR, "Yol ge\u00e7ersiz karakter i\u00e7eriyor: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Bo\u015f de\u011ferli dizgiden \u015fema tan\u0131mlanamaz"}, { ER_SCHEME_NOT_CONFORMANT, "\u015eema uyumlu de\u011fil."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Anasistem do\u011fru bi\u00e7imli bir adres de\u011fil"}, { ER_PORT_WHEN_HOST_NULL, "Anasistem bo\u015f de\u011ferliyken kap\u0131 tan\u0131mlanamaz"}, { ER_INVALID_PORT, "Kap\u0131 numaras\u0131 ge\u00e7ersiz"}, { ER_FRAG_FOR_GENERIC_URI, "Par\u00e7a yaln\u0131zca soysal URI i\u00e7in tan\u0131mlanabilir"}, { ER_FRAG_WHEN_PATH_NULL, "Yol bo\u015f de\u011ferliyken par\u00e7a tan\u0131mlanamaz"}, { ER_FRAG_INVALID_CHAR, "Par\u00e7a ge\u00e7ersiz karakter i\u00e7eriyor"}, { ER_PARSER_IN_USE, "Ayr\u0131\u015ft\u0131r\u0131c\u0131 kullan\u0131mda"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Ayr\u0131\u015ft\u0131rma s\u0131ras\u0131nda {0} {1} de\u011fi\u015ftirilemez"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "\u00d6znedenselli\u011fe izin verilmez"}, { ER_NO_USERINFO_IF_NO_HOST, "Anasistem belirtilmediyse kullan\u0131c\u0131 bilgisi belirtilemez"}, { ER_NO_PORT_IF_NO_HOST, "Anasistem belirtilmediyse kap\u0131 belirtilemez"}, { ER_NO_QUERY_STRING_IN_PATH, "Yol ve sorgu dizgisinde sorgu dizgisi belirtilemez"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Par\u00e7a hem yolda, hem de par\u00e7ada belirtilemez"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Bo\u015f de\u011fi\u015ftirgelerle URI kullan\u0131ma haz\u0131rlanamaz"}, { ER_METHOD_NOT_SUPPORTED, "Y\u00f6ntem hen\u00fcz desteklenmiyor "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter \u015fu an yeniden ba\u015flat\u0131labilir durumda de\u011fil"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader, startParse iste\u011finden \u00f6nce olmaz"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Eksen dola\u015f\u0131c\u0131 desteklenmiyor: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler bo\u015f de\u011ferli PrintWriter ile yarat\u0131ld\u0131!"}, { ER_SYSTEMID_UNKNOWN, "SystemId bilinmiyor"}, { ER_LOCATION_UNKNOWN, "Hata yeri bilinmiyor"}, { ER_PREFIX_MUST_RESOLVE, "\u00d6nek bir ad alan\u0131na \u00e7\u00f6z\u00fclmelidir: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "XPathContext i\u00e7inde createDocument() desteklenmiyor!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\u00d6zniteli\u011fin alt \u00f6\u011fesinin iye belgesi yok!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\u00d6zniteli\u011fin alt \u00f6\u011fesinin iye belge \u00f6\u011fesi yok!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Uyar\u0131: Belge \u00f6\u011fesinden \u00f6nce metin \u00e7\u0131k\u0131\u015f\u0131 olamaz! Yoksay\u0131l\u0131yor..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "DOM \u00fczerinde birden fazla k\u00f6k olamaz!"}, { ER_ARG_LOCALNAME_NULL, "'localName' ba\u011f\u0131ms\u0131z de\u011fi\u015ftirgesi bo\u015f de\u011ferli"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "QNAME i\u00e7indeki yerel ad (localname) ge\u00e7erli bir NCName olmal\u0131d\u0131r"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "QNAME i\u00e7indeki \u00f6nek ge\u00e7erli bir NCName olmal\u0131d\u0131r"}, { ER_NAME_CANT_START_WITH_COLON, "Ad iki nokta \u00fcst \u00fcste imiyle ba\u015flayamaz"}, { "BAD_CODE", "createMessage i\u00e7in kullan\u0131lan de\u011fi\u015ftirge s\u0131n\u0131rlar\u0131n d\u0131\u015f\u0131nda"}, { "FORMAT_FAILED", "messageFormat \u00e7a\u011fr\u0131s\u0131 s\u0131ras\u0131nda kural d\u0131\u015f\u0131 durum yay\u0131nland\u0131"}, { "line", "Sat\u0131r #"}, { "column","Kolon #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("tr", "TR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_de.java0000644000175000017500000004346210721374030024356 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_de.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_de extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Funktion wird nicht unterst\u00fctzt!"}, { ER_CANNOT_OVERWRITE_CAUSE, "cause kann nicht \u00fcberschrieben werden."}, { ER_NO_DEFAULT_IMPL, "Keine Standardimplementierung gefunden. "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) wird derzeit nicht unterst\u00fctzt."}, { ER_OFFSET_BIGGER_THAN_SLOT, "Offset ist gr\u00f6\u00dfer als der Bereich."}, { ER_COROUTINE_NOT_AVAIL, "Koroutine nicht verf\u00fcgbar, ID: {0}."}, { ER_COROUTINE_CO_EXIT, "CoroutineManager hat Anforderung co_exit() empfangen."}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() ist fehlgeschlagen."}, { ER_COROUTINE_PARAM, "Parameterfehler der Koroutine ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nUNERWARTET: Parser doTerminate antwortet {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "parse darf w\u00e4hrend der Syntaxanalyse nicht aufgerufen werden."}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Fehler: Iterator mit Typangabe f\u00fcr Achse {0} ist nicht implementiert."}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Fehler: Iterator f\u00fcr Achse {0} ist nicht implementiert. "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Iterator 'clone' wird nicht unterst\u00fctzt."}, { ER_UNKNOWN_AXIS_TYPE, "Unbekannter Achsentraversiertyp: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Achsentraversierer wird nicht unterst\u00fctzt: {0}"}, { ER_NO_DTMIDS_AVAIL, "Keine weiteren Dokumenttypmodell-IDs verf\u00fcgbar"}, { ER_NOT_SUPPORTED, "Nicht unterst\u00fctzt: {0}"}, { ER_NODE_NON_NULL, "Knoten muss ungleich Null sein f\u00fcr getDTMHandleFromNode."}, { ER_COULD_NOT_RESOLVE_NODE, "Der Knoten konnte nicht in eine Kennung aufgel\u00f6st werden."}, { ER_STARTPARSE_WHILE_PARSING, "startParse kann w\u00e4hrend der Syntaxanalyse nicht aufgerufen werden."}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse erfordert SAXParser ungleich Null."}, { ER_COULD_NOT_INIT_PARSER, "Konnte Parser nicht initialisieren mit"}, { ER_EXCEPTION_CREATING_POOL, "Ausnahmebedingung beim Erstellen einer neuen Instanz f\u00fcr Pool."}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Der Pfad enth\u00e4lt eine ung\u00fcltige Escapezeichenfolge."}, { ER_SCHEME_REQUIRED, "Schema ist erforderlich!"}, { ER_NO_SCHEME_IN_URI, "Kein Schema gefunden in URI: {0}."}, { ER_NO_SCHEME_INURI, "Kein Schema gefunden in URI"}, { ER_PATH_INVALID_CHAR, "Pfad enth\u00e4lt ung\u00fcltiges Zeichen: {0}."}, { ER_SCHEME_FROM_NULL_STRING, "Schema kann nicht von Nullzeichenfolge festgelegt werden."}, { ER_SCHEME_NOT_CONFORMANT, "Das Schema ist nicht angepasst."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Der Host ist keine syntaktisch korrekte Adresse."}, { ER_PORT_WHEN_HOST_NULL, "Der Port kann nicht festgelegt werden, wenn der Host gleich Null ist."}, { ER_INVALID_PORT, "Ung\u00fcltige Portnummer"}, { ER_FRAG_FOR_GENERIC_URI, "Fragment kann nur f\u00fcr eine generische URI (Uniform Resource Identifier) festgelegt werden."}, { ER_FRAG_WHEN_PATH_NULL, "Fragment kann nicht festgelegt werden, wenn der Pfad gleich Null ist."}, { ER_FRAG_INVALID_CHAR, "Fragment enth\u00e4lt ein ung\u00fcltiges Zeichen."}, { ER_PARSER_IN_USE, "Der Parser wird bereits verwendet."}, { ER_CANNOT_CHANGE_WHILE_PARSING, "{0} {1} kann w\u00e4hrend der Syntaxanalyse nicht ge\u00e4ndert werden."}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Selbstverursachung ist nicht zul\u00e4ssig."}, { ER_NO_USERINFO_IF_NO_HOST, "Benutzerinformationen k\u00f6nnen nicht angegeben werden, wenn der Host nicht angegeben wurde."}, { ER_NO_PORT_IF_NO_HOST, "Der Port kann nicht angegeben werden, wenn der Host nicht angegeben wurde."}, { ER_NO_QUERY_STRING_IN_PATH, "Abfragezeichenfolge kann nicht im Pfad und in der Abfragezeichenfolge angegeben werden."}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment kann nicht im Pfad und im Fragment angegeben werden."}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "URI (Uniform Resource Identifier) kann nicht mit leeren Parametern initialisiert werden."}, { ER_METHOD_NOT_SUPPORTED, "Die Methode wird noch nicht unterst\u00fctzt. "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter ist momentan nicht wieder anlauff\u00e4hig."}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader nicht vor Anforderung startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Achsentraversierer nicht unterst\u00fctzt: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler erstellt ohne Druckausgabeprogramm!"}, { ER_SYSTEMID_UNKNOWN, "System-ID unbekannt"}, { ER_LOCATION_UNKNOWN, "Position des Fehlers unbekannt"}, { ER_PREFIX_MUST_RESOLVE, "Das Pr\u00e4fix muss in einen Namensbereich aufgel\u00f6st werden: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() wird nicht in XPathContext unterst\u00fctzt!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Das Attribut child weist kein Eignerdokument auf!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Das Attribut child weist kein Eignerdokumentelement auf!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Warnung: Vor dem Dokumentelement kann kein Text ausgegeben werden! Wird ignoriert..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Mehr als ein Root f\u00fcr ein Dokumentobjektmodell ist nicht m\u00f6glich!"}, { ER_ARG_LOCALNAME_NULL, "Das Argument 'localName' ist Null."}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Der lokale Name (Localname) in QNAME muss ein g\u00fcltiger NCName sein."}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Das Pr\u00e4fix in QNAME muss ein g\u00fcltiger NCName sein."}, { ER_NAME_CANT_START_WITH_COLON, "Name darf nicht mit einem Doppelpunkt beginnen."}, { "BAD_CODE", "Der Parameter f\u00fcr createMessage lag au\u00dferhalb des g\u00fcltigen Bereichs"}, { "FORMAT_FAILED", "W\u00e4hrend des Aufrufs von messageFormat wurde eine Ausnahmebedingung ausgel\u00f6st"}, { "line", "Zeilennummer"}, { "column","Spaltennummer"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_ja.java0000644000175000017500000005233510721374031024360 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_ja.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_ja extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\u6a5f\u80fd\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_CANNOT_OVERWRITE_CAUSE, "cause \u3092\u4e0a\u66f8\u304d\u3067\u304d\u307e\u305b\u3093"}, { ER_NO_DEFAULT_IMPL, "\u30c7\u30d5\u30a9\u30eb\u30c8\u5b9f\u88c5\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093 "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "\u73fe\u5728 ChunkedIntArray({0}) \u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093"}, { ER_OFFSET_BIGGER_THAN_SLOT, "\u30aa\u30d5\u30bb\u30c3\u30c8\u304c\u30b9\u30ed\u30c3\u30c8\u3088\u308a\u5927\u3067\u3059"}, { ER_COROUTINE_NOT_AVAIL, "\u30b3\u30eb\u30fc\u30c1\u30f3\u304c\u4f7f\u7528\u53ef\u80fd\u3067\u3042\u308a\u307e\u305b\u3093\u3002id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager \u304c co_exit() \u8981\u6c42\u3092\u53d7\u3051\u53d6\u308a\u307e\u3057\u305f"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() \u304c\u5931\u6557\u3057\u307e\u3057\u305f"}, { ER_COROUTINE_PARAM, "\u30b3\u30eb\u30fc\u30c1\u30f3\u30fb\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u30fb\u30a8\u30e9\u30fc ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\n\u4e88\u60f3\u5916: \u30d1\u30fc\u30b5\u30fc doTerminate \u304c {0} \u3092\u5fdc\u7b54\u3057\u3066\u3044\u307e\u3059"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "parse \u306f\u69cb\u6587\u89e3\u6790\u4e2d\u306b\u547c\u3073\u51fa\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u30a8\u30e9\u30fc: \u8ef8 {0} \u306e\u578b\u4ed8\u304d\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc\u306f\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u305b\u3093"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u30a8\u30e9\u30fc: \u8ef8 {0} \u306e\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc\u306f\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u305b\u3093 "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc\u306e\u8907\u88fd\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093"}, { ER_UNKNOWN_AXIS_TYPE, "\u4e0d\u660e\u306e\u8ef8\u30c8\u30e9\u30d0\u30fc\u30b9\u30fb\u30bf\u30a4\u30d7: {0}"}, { ER_AXIS_NOT_SUPPORTED, "\u8ef8\u30c8\u30e9\u30d0\u30fc\u30b5\u30fc\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093: {0}"}, { ER_NO_DTMIDS_AVAIL, "\u4f7f\u7528\u53ef\u80fd\u306a DTM ID \u306f\u3053\u308c\u4ee5\u4e0a\u3042\u308a\u307e\u305b\u3093"}, { ER_NOT_SUPPORTED, "\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093: {0}"}, { ER_NODE_NON_NULL, "getDTMHandleFromNode \u306e\u30ce\u30fc\u30c9\u306f\u975e\u30cc\u30eb\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093"}, { ER_COULD_NOT_RESOLVE_NODE, "\u30ce\u30fc\u30c9\u3092\u30cf\u30f3\u30c9\u30eb\u306b\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f"}, { ER_STARTPARSE_WHILE_PARSING, "startParse \u306f\u69cb\u6587\u89e3\u6790\u4e2d\u306b\u547c\u3073\u51fa\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse \u306b\u306f\u30cc\u30eb\u4ee5\u5916\u306e SAXParser \u304c\u5fc5\u8981\u3067\u3059"}, { ER_COULD_NOT_INIT_PARSER, "\u30d1\u30fc\u30b5\u30fc\u3092\u6b21\u3067\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f:"}, { ER_EXCEPTION_CREATING_POOL, "\u30d7\u30fc\u30eb\u306e\u65b0\u898f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u4e2d\u306b\u4f8b\u5916"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u30d1\u30b9\u306b\u7121\u52b9\u306a\u30a8\u30b9\u30b1\u30fc\u30d7\u30fb\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059"}, { ER_SCHEME_REQUIRED, "\u30b9\u30ad\u30fc\u30e0\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NO_SCHEME_IN_URI, "\u30b9\u30ad\u30fc\u30e0\u306f URI {0} \u3067\u898b\u3064\u304b\u308a\u307e\u305b\u3093"}, { ER_NO_SCHEME_INURI, "\u30b9\u30ad\u30fc\u30e0\u306f URI \u3067\u898b\u3064\u304b\u308a\u307e\u305b\u3093"}, { ER_PATH_INVALID_CHAR, "\u30d1\u30b9\u306b\u7121\u52b9\u6587\u5b57: {0} \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059"}, { ER_SCHEME_FROM_NULL_STRING, "\u30cc\u30eb\u30fb\u30b9\u30c8\u30ea\u30f3\u30b0\u304b\u3089\u306f\u30b9\u30ad\u30fc\u30e0\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"}, { ER_SCHEME_NOT_CONFORMANT, "\u30b9\u30ad\u30fc\u30e0\u306f\u4e00\u81f4\u3057\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "\u30db\u30b9\u30c8\u306f\u3046\u307e\u304f\u69cb\u6210\u3055\u308c\u305f\u30a2\u30c9\u30ec\u30b9\u3067\u3042\u308a\u307e\u305b\u3093"}, { ER_PORT_WHEN_HOST_NULL, "\u30db\u30b9\u30c8\u304c\u30cc\u30eb\u3067\u3042\u308b\u3068\u30dd\u30fc\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"}, { ER_INVALID_PORT, "\u7121\u52b9\u306a\u30dd\u30fc\u30c8\u756a\u53f7"}, { ER_FRAG_FOR_GENERIC_URI, "\u7dcf\u79f0 URI \u306e\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3057\u304b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"}, { ER_FRAG_WHEN_PATH_NULL, "\u30d1\u30b9\u304c\u30cc\u30eb\u3067\u3042\u308b\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"}, { ER_FRAG_INVALID_CHAR, "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306b\u7121\u52b9\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059"}, { ER_PARSER_IN_USE, "\u30d1\u30fc\u30b5\u30fc\u306f\u3059\u3067\u306b\u4f7f\u7528\u4e2d\u3067\u3059"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "\u69cb\u6587\u89e3\u6790\u4e2d\u306b {0} {1} \u3092\u5909\u66f4\u3067\u304d\u307e\u305b\u3093"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "\u81ea\u5206\u81ea\u8eab\u3092\u539f\u56e0\u3068\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093"}, { ER_NO_USERINFO_IF_NO_HOST, "\u30db\u30b9\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f Userinfo \u3092\u6307\u5b9a\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093"}, { ER_NO_PORT_IF_NO_HOST, "\u30db\u30b9\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093"}, { ER_NO_QUERY_STRING_IN_PATH, "\u7167\u4f1a\u30b9\u30c8\u30ea\u30f3\u30b0\u306f\u30d1\u30b9\u304a\u3088\u3073\u7167\u4f1a\u30b9\u30c8\u30ea\u30f3\u30b0\u5185\u306b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306f\u30d1\u30b9\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306e\u4e21\u65b9\u306b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "URI \u306f\u7a7a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093"}, { ER_METHOD_NOT_SUPPORTED, "\u30e1\u30bd\u30c3\u30c9\u306f\u307e\u3060\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093 "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "\u73fe\u5728 IncrementalSAXSource_Filter \u306f\u518d\u59cb\u52d5\u53ef\u80fd\u3067\u3042\u308a\u307e\u305b\u3093"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader \u304c startParse \u8981\u6c42\u306e\u524d\u3067\u3042\u308a\u307e\u305b\u3093"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "\u8ef8\u30c8\u30e9\u30d0\u30fc\u30b5\u30fc\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler \u304c\u30cc\u30eb PrintWriter \u3067\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002"}, { ER_SYSTEMID_UNKNOWN, "SystemId \u306f\u4e0d\u660e"}, { ER_LOCATION_UNKNOWN, "\u30a8\u30e9\u30fc\u306e\u4f4d\u7f6e\u306f\u4e0d\u660e"}, { ER_PREFIX_MUST_RESOLVE, "\u63a5\u982d\u90e8\u306f\u540d\u524d\u7a7a\u9593\u306b\u89e3\u6c7a\u3055\u308c\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() \u306f XPathContext \u5185\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\u5c5e\u6027\u306e\u5b50\u306b\u6240\u6709\u8005\u6587\u66f8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\u5c5e\u6027\u306e\u5b50\u306b\u6240\u6709\u8005\u6587\u66f8\u8981\u7d20\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "\u8b66\u544a: \u6587\u66f8\u8981\u7d20\u306e\u524d\u306b\u30c6\u30ad\u30b9\u30c8\u3092\u51fa\u529b\u3067\u304d\u307e\u305b\u3093\u3002 \u7121\u8996\u3057\u3066\u3044\u307e\u3059..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "DOM \u3067\u306f\u8907\u6570\u306e\u30eb\u30fc\u30c8\u3092\u6301\u3064\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_ARG_LOCALNAME_NULL, "\u5f15\u6570 'localName' \u304c\u30cc\u30eb\u3067\u3059\u3002"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "QNAME \u5185\u306e\u30ed\u30fc\u30ab\u30eb\u540d\u306f\u6709\u52b9\u306a NCName \u3067\u3042\u308b\u306f\u305a\u3067\u3059"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "QNAME \u5185\u306e\u63a5\u982d\u90e8\u306f\u6709\u52b9\u306a NCName \u3067\u3042\u308b\u306f\u305a\u3067\u3059"}, { ER_NAME_CANT_START_WITH_COLON, "\u540d\u524d\u306f\u30b3\u30ed\u30f3\u3067\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093"}, { "BAD_CODE", "createMessage \u3078\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u304c\u7bc4\u56f2\u5916\u3067\u3057\u305f\u3002"}, { "FORMAT_FAILED", "messageFormat \u547c\u3073\u51fa\u3057\u4e2d\u306b\u4f8b\u5916\u304c\u30b9\u30ed\u30fc\u3055\u308c\u307e\u3057\u305f\u3002"}, { "line", "\u884c #"}, { "column","\u6841 #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_hu.java0000644000175000017500000004441710721374032024405 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_hu.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_hu extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "A f\u00fcggv\u00e9ny nem t\u00e1mogatott."}, { ER_CANNOT_OVERWRITE_CAUSE, "Nem lehet fel\u00fcl\u00edrni az okot"}, { ER_NO_DEFAULT_IMPL, "Nem tal\u00e1lhat\u00f3 alap\u00e9rtelmezett megval\u00f3s\u00edt\u00e1s "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "A ChunkedIntArray({0}) jelenleg nem t\u00e1mogatott"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Az eltol\u00e1s nagyobb mint a ny\u00edl\u00e1s"}, { ER_COROUTINE_NOT_AVAIL, "T\u00e1rs szubrutin nem \u00e9rhet\u0151 el, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager \u00e9rkezett a co_exit() k\u00e9r\u00e9sre"}, { ER_COJOINROUTINESET_FAILED, "A co_joinCoroutineSet() nem siker\u00fclt "}, { ER_COROUTINE_PARAM, "T\u00e1rs szubrutin param\u00e9terhiba ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nV\u00c1RATLAN: \u00c9rtelmez\u0151 doTerminate v\u00e1laszok {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "\u00e9rtelmez\u00e9s nem h\u00edvhat\u00f3 meg \u00e9rtelmez\u00e9s k\u00f6zben "}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Hiba: A tipiz\u00e1lt iter\u00e1tor a(z) {0} tengelyhez nincs megval\u00f3s\u00edtva"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Hiba: Az iter\u00e1tor a(z) {0} tengelyhez nincs megval\u00f3s\u00edtva "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Az iter\u00e1tor kl\u00f3noz\u00e1sa nem t\u00e1mogatott"}, { ER_UNKNOWN_AXIS_TYPE, "Ismeretlen tengely bej\u00e1r\u00e1si \u00fat t\u00edpus: {0}"}, { ER_AXIS_NOT_SUPPORTED, "A tengely bej\u00e1r\u00e1si \u00fat nem t\u00e1mogatott: {0}"}, { ER_NO_DTMIDS_AVAIL, "Nincs t\u00f6bb DTM azonos\u00edt\u00f3"}, { ER_NOT_SUPPORTED, "Nem t\u00e1mogatott: {0}"}, { ER_NODE_NON_NULL, "A csom\u00f3pont nem lehet null a getDTMHandleFromNode f\u00fcggv\u00e9nyhez"}, { ER_COULD_NOT_RESOLVE_NODE, "A csom\u00f3pontot nem lehet azonos\u00edt\u00f3ra feloldani"}, { ER_STARTPARSE_WHILE_PARSING, "A startParse f\u00fcggv\u00e9nyt nem h\u00edvhatja meg \u00e9rtelmez\u00e9s k\u00f6zben"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "A startParse f\u00fcggv\u00e9nyhez nemnull SAXParser sz\u00fcks\u00e9ges"}, { ER_COULD_NOT_INIT_PARSER, "Nem lehet inicializ\u00e1lni az \u00e9rtelmez\u0151t ezzel"}, { ER_EXCEPTION_CREATING_POOL, "kiv\u00e9tel egy \u00faj t\u00e1rol\u00f3p\u00e9ld\u00e1ny l\u00e9trehoz\u00e1sakor"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Az el\u00e9r\u00e9si \u00fat \u00e9rv\u00e9nytelen vez\u00e9rl\u0151 jelsorozatot tartalmaz"}, { ER_SCHEME_REQUIRED, "S\u00e9ma sz\u00fcks\u00e9ges."}, { ER_NO_SCHEME_IN_URI, "Nem tal\u00e1lhat\u00f3 s\u00e9ma az URI-ban: {0}"}, { ER_NO_SCHEME_INURI, "Nem tal\u00e1lhat\u00f3 s\u00e9ma az URI-ban"}, { ER_PATH_INVALID_CHAR, "Az el\u00e9r\u00e9si \u00fat \u00e9rv\u00e9nytelen karaktert tartalmaz: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Nem lehet be\u00e1ll\u00edtani a s\u00e9m\u00e1t null karaktersorozatb\u00f3l"}, { ER_SCHEME_NOT_CONFORMANT, "A s\u00e9ma nem megfelel\u0151."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "A hoszt nem j\u00f3l form\u00e1zott c\u00edm"}, { ER_PORT_WHEN_HOST_NULL, "A portot nem \u00e1ll\u00edthatja be, ha a hoszt null"}, { ER_INVALID_PORT, "\u00c9rv\u00e9nytelen portsz\u00e1m"}, { ER_FRAG_FOR_GENERIC_URI, "Csak \u00e1ltal\u00e1nos URI-hoz \u00e1ll\u00edthat be t\u00f6red\u00e9ket "}, { ER_FRAG_WHEN_PATH_NULL, "A t\u00f6red\u00e9ket nem \u00e1ll\u00edthatja be, ha az el\u00e9r\u00e9si \u00fat null"}, { ER_FRAG_INVALID_CHAR, "A t\u00f6red\u00e9k \u00e9rv\u00e9nytelen karaktert tartalmaz"}, { ER_PARSER_IN_USE, "Az \u00e9rtelmez\u0151 m\u00e1r haszn\u00e1latban van"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Nem v\u00e1ltoztathat\u00f3 meg a(z) {0} {1} \u00e9rtelmez\u00e9s k\u00f6zben"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Az \u00f6n-megokol\u00e1s nem megengedett"}, { ER_NO_USERINFO_IF_NO_HOST, "Nem adhatja meg a felhaszn\u00e1l\u00f3i inform\u00e1ci\u00f3kat, ha nincs megadva hoszt"}, { ER_NO_PORT_IF_NO_HOST, "Nem adhatja meg a portot, ha nincs megadva hoszt"}, { ER_NO_QUERY_STRING_IN_PATH, "Nem adhat meg lek\u00e9rdez\u00e9si karaktersorozatot az el\u00e9r\u00e9si \u00fatban \u00e9s a lek\u00e9rdez\u00e9si karaktersorozatban"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Nem adhat meg t\u00f6red\u00e9ket az el\u00e9r\u00e9si \u00fatban \u00e9s a t\u00f6red\u00e9kben is"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Az URI nem inicializ\u00e1lhat\u00f3 \u00fcres param\u00e9terekkel"}, { ER_METHOD_NOT_SUPPORTED, "A met\u00f3dus m\u00e9g nem t\u00e1mogatott "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "Az IncrementalSAXSource_Filter jelenleg nem \u00ednd\u00edthat\u00f3 \u00fajra"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "Az XMLReader nem a startParse k\u00e9r\u00e9s el\u0151tt van "}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "A tengely bej\u00e1r\u00e1si \u00fat nem t\u00e1mogatott: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "A ListingErrorHandler null PrintWriter \u00e9rt\u00e9kkel j\u00f6tt l\u00e9tre."}, { ER_SYSTEMID_UNKNOWN, "Ismeretlen SystemId"}, { ER_LOCATION_UNKNOWN, "A hiba helye ismeretlen"}, { ER_PREFIX_MUST_RESOLVE, "Az el\u0151tagnak egy n\u00e9vt\u00e9rre kell felold\u00f3dnia: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "A createDocument() nem t\u00e1mogatott az XPathContext-ben."}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Az attrib\u00fatum ut\u00f3dnak nincs tulajdonos dokumentuma."}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Az attrib\u00fatum ut\u00f3dnak nincs tulajdonos dokumentumeleme."}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Figyelmeztet\u00e9s: nem lehet sz\u00f6veget ki\u00edrni dokumentum elem el\u0151tt. Figyelmen k\u00edv\u00fcl marad..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Nem lehet egyn\u00e9l t\u00f6bb gy\u00f6k\u00e9r a DOM-ban"}, { ER_ARG_LOCALNAME_NULL, "A 'localName' argumentum null"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "A QNAME-beli helyi n\u00e9vnek egy \u00e9rv\u00e9nyes NCName-nek kell lennie"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "A QNAME-beli el\u0151tagnak \u00e9rv\u00e9nyes NCName-nek kell lennie"}, { ER_NAME_CANT_START_WITH_COLON, "A n\u00e9v nem kezd\u0151dhet kett\u0151sponttal"}, { "BAD_CODE", "A createMessage egyik param\u00e9tere nincs a megfelel\u0151 tartom\u00e1nyban"}, { "FORMAT_FAILED", "Kiv\u00e9tel t\u00f6rt\u00e9nt a messageFormat h\u00edv\u00e1sa k\u00f6zben"}, { "line", "Sor #"}, { "column","Oszlop #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("hu", "HU")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_cs.java0000644000175000017500000004365610721374032024402 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_cs.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_cs extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Nepodporovan\u00e1 funkce!"}, { ER_CANNOT_OVERWRITE_CAUSE, "P\u0159\u00ed\u010dinu nelze p\u0159epsat"}, { ER_NO_DEFAULT_IMPL, "Nebyla nalezena v\u00fdchoz\u00ed implementace. "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "Funkce ChunkedIntArray({0}) nen\u00ed aktu\u00e1ln\u011b podporov\u00e1na."}, { ER_OFFSET_BIGGER_THAN_SLOT, "Offset je v\u011bt\u0161\u00ed ne\u017e slot."}, { ER_COROUTINE_NOT_AVAIL, "Spole\u010dn\u00e1 rutina nen\u00ed k dispozici, id={0}"}, { ER_COROUTINE_CO_EXIT, "Funkce CoroutineManager obdr\u017eela po\u017eadavek co_exit()"}, { ER_COJOINROUTINESET_FAILED, "Selhala funkce co_joinCoroutineSet()"}, { ER_COROUTINE_PARAM, "Chyba parametru spole\u010dn\u00e9 rutiny ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nNeo\u010dek\u00e1van\u00e9: odpov\u011bdi funkce analyz\u00e1toru doTerminate {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "b\u011bhem anal\u00fdzy nelze volat analyz\u00e1tor"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Chyba: zadan\u00fd iter\u00e1tor osy {0} nen\u00ed implementov\u00e1n"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Chyba: zadan\u00fd iter\u00e1tor osy {0} nen\u00ed implementov\u00e1n "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Nepodporovan\u00fd klon iter\u00e1toru."}, { ER_UNKNOWN_AXIS_TYPE, "Nezn\u00e1m\u00fd typ osy pr\u016fchodu: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Nepodporovan\u00e1 osa pr\u016fchodu: {0}"}, { ER_NO_DTMIDS_AVAIL, "\u017d\u00e1dn\u00e1 dal\u0161\u00ed ID DTM nejsou k dispozici"}, { ER_NOT_SUPPORTED, "Nepodporov\u00e1no: {0}"}, { ER_NODE_NON_NULL, "Uzel pou\u017eit\u00fd ve funkci getDTMHandleFromNode mus\u00ed m\u00edt hodnotu not-null"}, { ER_COULD_NOT_RESOLVE_NODE, "Uzel nelze p\u0159elo\u017eit do manipul\u00e1toru"}, { ER_STARTPARSE_WHILE_PARSING, "B\u011bhem anal\u00fdzy nelze volat funkci startParse."}, { ER_STARTPARSE_NEEDS_SAXPARSER, "Funkce startParse vy\u017eaduje SAXParser s hodnotou not-null."}, { ER_COULD_NOT_INIT_PARSER, "nelze inicializovat analyz\u00e1tor s:"}, { ER_EXCEPTION_CREATING_POOL, "v\u00fdjimka p\u0159i vytv\u00e1\u0159en\u00ed nov\u00e9 instance spole\u010dn\u00e9 oblasti"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Cesta obsahuje neplatnou escape sekvenci"}, { ER_SCHEME_REQUIRED, "Je vy\u017eadov\u00e1no sch\u00e9ma!"}, { ER_NO_SCHEME_IN_URI, "V URI nebylo nalezeno \u017e\u00e1dn\u00e9 sch\u00e9ma: {0}"}, { ER_NO_SCHEME_INURI, "V URI nebylo nalezeno \u017e\u00e1dn\u00e9 sch\u00e9ma"}, { ER_PATH_INVALID_CHAR, "Cesta obsahuje neplatn\u00fd znak: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Nelze nastavit sch\u00e9ma \u0159et\u011bzce s hodnotou null."}, { ER_SCHEME_NOT_CONFORMANT, "Sch\u00e9ma nevyhovuje."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Adresa hostitele m\u00e1 nespr\u00e1vn\u00fd form\u00e1t."}, { ER_PORT_WHEN_HOST_NULL, "M\u00e1-li hostitel hodnotu null, nelze nastavit port."}, { ER_INVALID_PORT, "Neplatn\u00e9 \u010d\u00edslo portu."}, { ER_FRAG_FOR_GENERIC_URI, "Fragment lze nastavit jen u generick\u00e9ho URI."}, { ER_FRAG_WHEN_PATH_NULL, "M\u00e1-li cesta hodnotu null, nelze nastavit fragment."}, { ER_FRAG_INVALID_CHAR, "Fragment obsahuje neplatn\u00fd znak."}, { ER_PARSER_IN_USE, "Analyz\u00e1tor se ji\u017e pou\u017e\u00edv\u00e1."}, { ER_CANNOT_CHANGE_WHILE_PARSING, "B\u011bhem anal\u00fdzy nelze m\u011bnit {0} {1}."}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Zp\u016fsoben\u00ed sama sebe (self-causation) nen\u00ed povoleno"}, { ER_NO_USERINFO_IF_NO_HOST, "Nen\u00ed-li ur\u010den hostitel, nelze zadat \u00fadaje o u\u017eivateli."}, { ER_NO_PORT_IF_NO_HOST, "Nen\u00ed-li ur\u010den hostitel, nelze zadat port."}, { ER_NO_QUERY_STRING_IN_PATH, "V \u0159et\u011bzci cesty a dotazu nelze zadat \u0159et\u011bzec dotazu."}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment nelze ur\u010dit z\u00e1rove\u0148 v cest\u011b i ve fragmentu."}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "URI nelze inicializovat s pr\u00e1zdn\u00fdmi parametry."}, { ER_METHOD_NOT_SUPPORTED, "Prozat\u00edm nepodporovan\u00e1 metoda. "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "Filtr IncrementalSAXSource_Filter nelze aktu\u00e1ln\u011b znovu spustit."}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "P\u0159ed po\u017eadavkem startParse nen\u00ed XMLReader."}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Nepodporovan\u00e1 osa pr\u016fchodu: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "Prvek ListingErrorHandler byl vytvo\u0159en s funkc\u00ed PrintWriter s hodnotou null!"}, { ER_SYSTEMID_UNKNOWN, "Nezn\u00e1m\u00fd identifik\u00e1tor SystemId"}, { ER_LOCATION_UNKNOWN, "Chyba se vyskytla na nezn\u00e1m\u00e9m m\u00edst\u011b"}, { ER_PREFIX_MUST_RESOLVE, "P\u0159edponu mus\u00ed b\u00fdt mo\u017eno p\u0159elo\u017eit do oboru n\u00e1zv\u016f: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "Funkce XPathContext nepodporuje funkci createDocument()!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Potomek atributu nem\u00e1 dokument vlastn\u00edka!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Potomek atributu nem\u00e1 prvek dokumentu vlastn\u00edka!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Varov\u00e1n\u00ed: v\u00fdstup textu nem\u016f\u017ee p\u0159edch\u00e1zet prvku dokumentu! Ignorov\u00e1no..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "DOM nem\u016f\u017ee m\u00edt n\u011bkolik ko\u0159en\u016f!"}, { ER_ARG_LOCALNAME_NULL, "Argument 'localName' m\u00e1 hodnotu null"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Hodnota Localname ve funkci QNAME by m\u011bla b\u00fdt platn\u00fdm prvkem NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "P\u0159edpona ve funkci QNAME by m\u011bla b\u00fdt platn\u00fdm prvkem NCName"}, { ER_NAME_CANT_START_WITH_COLON, "N\u00e1zev nesm\u00ed za\u010d\u00ednat dvojte\u010dkou"}, { "BAD_CODE", "Parametr funkce createMessage je mimo limit"}, { "FORMAT_FAILED", "P\u0159i vol\u00e1n\u00ed funkce messageFormat do\u0161lo k v\u00fdjimce"}, { "line", "\u0158\u00e1dek #"}, { "column","Sloupec #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("cs", "CZ")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_zh_TW.java0000644000175000017500000004440710721374031025022 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_zh_TW.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_zh_TW extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\u51fd\u6578\u4e0d\u53d7\u652f\u63f4\uff01"}, { ER_CANNOT_OVERWRITE_CAUSE, "\u7121\u6cd5\u6539\u5beb\u539f\u56e0"}, { ER_NO_DEFAULT_IMPL, "\u627e\u4e0d\u5230\u9810\u8a2d\u5be6\u4f5c"}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) \u76ee\u524d\u4e0d\u53d7\u652f\u63f4"}, { ER_OFFSET_BIGGER_THAN_SLOT, "\u504f\u79fb\u6bd4\u69fd\u5927"}, { ER_COROUTINE_NOT_AVAIL, "\u6c92\u6709 Coroutine \u53ef\u7528\uff0cid={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager \u6536\u5230 co_exit() \u8981\u6c42"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() \u5931\u6548"}, { ER_COROUTINE_PARAM, "Coroutine \u53c3\u6578\u932f\u8aa4 ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\n\u975e\u9810\u671f\u7684\u7d50\u679c\uff1a\u5256\u6790\u5668 doTerminate \u56de\u7b54 {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "\u5728\u5256\u6790\u6642\u672a\u547c\u53eb parse"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u932f\u8aa4\uff1a\u91dd\u5c0d\u8ef8 {0} \u8f38\u5165\u7684\u91cd\u8907\u9805\u76ee\u6c92\u6709\u5be6\u4f5c"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "\u932f\u8aa4\uff1a\u8ef8 {0} \u7684\u91cd\u8907\u9805\u76ee\u6c92\u6709\u5be6\u4f5c"}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "\u91cd\u8907\u9805\u76ee\u8907\u88fd\u4e0d\u53d7\u652f\u63f4"}, { ER_UNKNOWN_AXIS_TYPE, "\u4e0d\u660e\u7684\u8ef8\u904d\u6b77\u985e\u578b\uff1a{0}"}, { ER_AXIS_NOT_SUPPORTED, "\u4e0d\u652f\u63f4\u8ef8\u904d\u6b77\uff1a{0}"}, { ER_NO_DTMIDS_AVAIL, "\u6c92\u6709\u53ef\u7528\u7684 DTM ID"}, { ER_NOT_SUPPORTED, "\u4e0d\u652f\u63f4\uff1a{0}"}, { ER_NODE_NON_NULL, "\u5c0d getDTMHandleFromNode \u800c\u8a00\uff0c\u7bc0\u9ede\u5fc5\u9808\u70ba\u975e\u7a7a\u503c"}, { ER_COULD_NOT_RESOLVE_NODE, "\u7121\u6cd5\u89e3\u6790\u7bc0\u9ede\u70ba\u63a7\u9ede"}, { ER_STARTPARSE_WHILE_PARSING, "\u5728\u5256\u6790\u6642\u672a\u547c\u53eb startParse"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse \u9700\u8981\u975e\u7a7a\u503c\u7684 SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "\u7121\u6cd5\u4f7f\u7528\u4ee5\u4e0b\u9805\u76ee\u8d77\u59cb\u8a2d\u5b9a\u5256\u6790\u5668"}, { ER_EXCEPTION_CREATING_POOL, "\u5efa\u7acb\u5132\u5b58\u6c60\u7684\u65b0\u5be6\u4f8b\u6642\u767c\u751f\u7570\u5e38"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\u8def\u5f91\u5305\u542b\u7121\u6548\u7684\u8df3\u812b\u5b57\u5143"}, { ER_SCHEME_REQUIRED, "\u7db1\u8981\u662f\u5fc5\u9700\u7684\uff01"}, { ER_NO_SCHEME_IN_URI, "\u5728 URI\uff1a{0} \u627e\u4e0d\u5230\u7db1\u8981"}, { ER_NO_SCHEME_INURI, "\u5728 URI \u627e\u4e0d\u5230\u7db1\u8981"}, { ER_PATH_INVALID_CHAR, "\u8def\u5f91\u5305\u542b\u7121\u6548\u7684\u5b57\u5143\uff1a{0}"}, { ER_SCHEME_FROM_NULL_STRING, "\u7121\u6cd5\u5f9e\u7a7a\u5b57\u4e32\u8a2d\u5b9a\u7db1\u8981"}, { ER_SCHEME_NOT_CONFORMANT, "\u7db1\u8981\u4e0d\u662f conformant\u3002"}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "\u4e3b\u6a5f\u6c92\u6709\u5b8c\u6574\u7684\u4f4d\u5740"}, { ER_PORT_WHEN_HOST_NULL, "\u4e3b\u6a5f\u70ba\u7a7a\u503c\u6642\uff0c\u7121\u6cd5\u8a2d\u5b9a\u57e0"}, { ER_INVALID_PORT, "\u7121\u6548\u7684\u57e0\u7de8\u865f"}, { ER_FRAG_FOR_GENERIC_URI, "\u53ea\u80fd\u5c0d\u901a\u7528\u7684 URI \u8a2d\u5b9a\u7247\u6bb5"}, { ER_FRAG_WHEN_PATH_NULL, "\u8def\u5f91\u70ba\u7a7a\u503c\u6642\uff0c\u7121\u6cd5\u8a2d\u5b9a\u7247\u6bb5"}, { ER_FRAG_INVALID_CHAR, "\u7247\u6bb5\u5305\u542b\u7121\u6548\u7684\u5b57\u5143"}, { ER_PARSER_IN_USE, "\u5256\u6790\u5668\u5df2\u5728\u4f7f\u7528\u4e2d"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "\u5256\u6790\u6642\u7121\u6cd5\u8b8a\u66f4 {0} {1}"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "\u4e0d\u5141\u8a31\u672c\u8eab\u7684\u56e0\u679c\u95dc\u4fc2"}, { ER_NO_USERINFO_IF_NO_HOST, "\u5982\u679c\u6c92\u6709\u6307\u5b9a\u4e3b\u6a5f\uff0c\u4e0d\u53ef\u6307\u5b9a Userinfo"}, { ER_NO_PORT_IF_NO_HOST, "\u5982\u679c\u6c92\u6709\u6307\u5b9a\u4e3b\u6a5f\uff0c\u4e0d\u53ef\u6307\u5b9a\u57e0"}, { ER_NO_QUERY_STRING_IN_PATH, "\u5728\u8def\u5f91\u53ca\u67e5\u8a62\u5b57\u4e32\u4e2d\u4e0d\u53ef\u6307\u5b9a\u67e5\u8a62\u5b57\u4e32"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "\u7247\u6bb5\u7121\u6cd5\u540c\u6642\u5728\u8def\u5f91\u548c\u7247\u6bb5\u4e2d\u6307\u5b9a"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "\u7121\u6cd5\u4ee5\u7a7a\u767d\u53c3\u6578\u8d77\u59cb\u8a2d\u5b9a URI"}, { ER_METHOD_NOT_SUPPORTED, "\u65b9\u6cd5\u4e0d\u53d7\u652f\u63f4"}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter \u76ee\u524d\u7121\u6cd5\u91cd\u65b0\u555f\u52d5"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader \u6c92\u6709\u5728 startParse \u8981\u6c42\u4e4b\u524d"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "\u4e0d\u652f\u63f4\u8ef8\u904d\u6b77\uff1a{0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "\u4ee5\u7a7a\u503c PrintWriter \u5efa\u7acb\u7684 ListingErrorHandler\uff01"}, { ER_SYSTEMID_UNKNOWN, "\u4e0d\u660e\u7684 SystemId"}, { ER_LOCATION_UNKNOWN, "\u932f\u8aa4\u4f4d\u7f6e\u4e0d\u660e"}, { ER_PREFIX_MUST_RESOLVE, "\u5b57\u9996\u5fc5\u9808\u89e3\u6790\u70ba\u540d\u7a31\u7a7a\u9593\uff1a{0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "\u5728 XPathContext \u4e2d\u4e0d\u652f\u63f4 createDocument()"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\u5c6c\u6027\u5b50\u9805\u5143\u4ef6\u6c92\u6709\u64c1\u6709\u8005\u6587\u4ef6\uff01"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\u5c6c\u6027\u5b50\u9805\u5143\u4ef6\u6c92\u6709\u64c1\u6709\u8005\u6587\u4ef6\u5143\u7d20\uff01"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "\u8b66\u544a\uff1a\u4e0d\u80fd\u8f38\u51fa\u6587\u4ef6\u5143\u7d20\u4e4b\u524d\u7684\u6587\u5b57\uff01\u5ffd\u7565..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "\u4e00\u500b DOM \u53ea\u80fd\u6709\u4e00\u500b\u6839\u76ee\u9304\uff01"}, { ER_ARG_LOCALNAME_NULL, "\u5f15\u6578 'localName' \u70ba\u7a7a\u503c"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "QNAME \u4e2d\u7684\u672c\u7aef\u540d\u7a31\u61c9\u8a72\u662f\u6709\u6548\u7684 NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "QNAME \u4e2d\u7684\u5b57\u9996\u61c9\u8a72\u662f\u6709\u6548\u7684 NCName"}, { ER_NAME_CANT_START_WITH_COLON, "\u540d\u7a31\u7684\u958b\u982d\u4e0d\u53ef\u70ba\u5192\u865f"}, { "BAD_CODE", "createMessage \u7684\u53c3\u6578\u8d85\u51fa\u754c\u9650"}, { "FORMAT_FAILED", "\u5728 messageFormat \u547c\u53eb\u671f\u9593\u64f2\u51fa\u7570\u5e38"}, { "line", "\u884c\u865f"}, { "column","\u6b04\u865f"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("zh", "TW")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_en.java0000644000175000017500000000214210721374032024360 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_en.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; /** * Default implementation of XPATHErrorResources. This is just * an empty class. * @xsl.usage advanced */ public class XMLErrorResources_en extends XMLErrorResources { } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_sl.java0000644000175000017500000004207710721374031024406 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_sl.java,v 1.9 2004/12/16 19:29:01 minchau Exp $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_sl extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "Funkcija ni podprta!"}, { ER_CANNOT_OVERWRITE_CAUSE, "Vzroka ni mogo\u010de prepisati"}, { ER_NO_DEFAULT_IMPL, "Privzete implementacije ni mogo\u010de najti "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) trenutno ni podprt"}, { ER_OFFSET_BIGGER_THAN_SLOT, "Odmik ve\u010dji od re\u017ee"}, { ER_COROUTINE_NOT_AVAIL, "Sorutina ni na voljo, id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager je prejel zahtevo co_exit()"}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() je spodletela"}, { ER_COROUTINE_PARAM, "Napaka parametra sorutine ({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nNEPRI\u010cAKOVANO: Odgovor raz\u010dlenjevalnika doTerminate je {0}"}, { ER_NO_PARSE_CALL_WHILE_PARSING, "med raz\u010dlenjevanjem klic raz\u010dlenitve ni mo\u017een"}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Napaka: dolo\u010den iterator za os {0} ni implementiran"}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Napaka: iterator za os {0} ni implementiran "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Klon iteratorja ni podprt"}, { ER_UNKNOWN_AXIS_TYPE, "Neznan pre\u010dni tip osi: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Pre\u010dnik osi ni podprt: {0}"}, { ER_NO_DTMIDS_AVAIL, "Na voljo ni ve\u010d DTM ID-jev"}, { ER_NOT_SUPPORTED, "Ni podprto: {0}"}, { ER_NODE_NON_NULL, "Vozli\u0161\u010de ne sme biti NULL za getDTMHandleFromNode"}, { ER_COULD_NOT_RESOLVE_NODE, "Ne morem razre\u0161iti vozli\u0161\u010da v obravnavo"}, { ER_STARTPARSE_WHILE_PARSING, "Med raz\u010dlenjevanjem klic startParse ni mogo\u010d"}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse potrebuje ne-NULL SAXParser"}, { ER_COULD_NOT_INIT_PARSER, "parserja ni mogo\u010de inicializirati z"}, { ER_EXCEPTION_CREATING_POOL, "izjema pri ustvarjanju novega primerka za zalogo"}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "Pot vsebuje neveljavno zaporedje za izhod"}, { ER_SCHEME_REQUIRED, "Zahtevana je shema!"}, { ER_NO_SCHEME_IN_URI, "Ne najdem sheme v URI: {0}"}, { ER_NO_SCHEME_INURI, "Ne najdem sheme v URI"}, { ER_PATH_INVALID_CHAR, "Pot vsebuje neveljaven znak: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "Ne morem nastaviti sheme iz niza NULL"}, { ER_SCHEME_NOT_CONFORMANT, "Shema ni skladna."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "Naslov gostitelja ni pravilno oblikovan"}, { ER_PORT_WHEN_HOST_NULL, "Ko je gostitelj NULL, nastavitev vrat ni mogo\u010da"}, { ER_INVALID_PORT, "Neveljavna \u0161tevilka vrat"}, { ER_FRAG_FOR_GENERIC_URI, "Fragment je lahko nastavljen samo za splo\u0161ni URI"}, { ER_FRAG_WHEN_PATH_NULL, "Ko je pot NULL, nastavitev fragmenta ni mogo\u010da"}, { ER_FRAG_INVALID_CHAR, "Fragment vsebuje neveljaven znak"}, { ER_PARSER_IN_USE, "Raz\u010dlenjevalnik je \u017ee v uporabi"}, { ER_CANNOT_CHANGE_WHILE_PARSING, "Med raz\u010dlenjevanjem ni mogo\u010de spremeniti {0} {1}"}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Samopovzro\u010ditev ni dovoljena"}, { ER_NO_USERINFO_IF_NO_HOST, "Informacije o uporabniku ne morejo biti navedene, \u010de ni naveden gostitelj"}, { ER_NO_PORT_IF_NO_HOST, "Vrata ne morejo biti navedena, \u010de ni naveden gostitelj"}, { ER_NO_QUERY_STRING_IN_PATH, "Poizvedbeni niz ne more biti naveden v nizu poti in poizvedbenem nizu"}, { ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment ne more biti hkrati naveden v poti in v fragmentu"}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Ne morem inicializirat URI-ja s praznimi parametri"}, { ER_METHOD_NOT_SUPPORTED, "Metoda ni ve\u010d podprta "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter v tem trenutku ni mogo\u010de ponovno zagnati"}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader ne pred zahtevo za startParse"}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Pre\u010dnik osi ni podprt: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler ustvarjen s PrintWriter NULL!"}, { ER_SYSTEMID_UNKNOWN, "Neznan sistemski ID"}, { ER_LOCATION_UNKNOWN, "Mesto napake neznano"}, { ER_PREFIX_MUST_RESOLVE, "Predpona se mora razre\u0161iti v imenski prostor: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() ni podprt v XPathContext!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Podrejeni predmet atributa nima lastni\u0161kega dokumenta!"}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Podrejeni predmet atributa nima elementa lastni\u0161kega dokumenta!"}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Opozorilo: besedila ne morem prikazati pred elementom dokumenta! Ignoriram..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Na DOM-u ne more biti ve\u010d kot en koren!"}, { ER_ARG_LOCALNAME_NULL, "Argument 'lokalno ime' je NULL"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "Lokalno ime v QNAME bi moralo biti veljavno NCIme"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "Predpona v QNAME bi morala biti valjavno NCIme"}, { ER_NAME_CANT_START_WITH_COLON, "Ime se ne more za\u010deti z dvopi\u010djem"}, { "BAD_CODE", "Parameter za ustvariSporo\u010dilo presega meje"}, { "FORMAT_FAILED", "Med klicem messageFormat naletel na izjemo"}, { "line", "Vrstica #"}, { "column","Stolpec #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("sl", "SL")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_sv.java0000644000175000017500000003713210721374030024413 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_sv.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_sv extends XMLErrorResources { /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 61; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 0; /** Maximum misc strings. */ public static final int MAX_OTHERS = 4; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, /** ER_FUNCTION_NOT_SUPPORTED */ //public static final int ER_FUNCTION_NOT_SUPPORTED = 80; { ER_FUNCTION_NOT_SUPPORTED, "Funktion inte underst\u00f6dd:"}, /** Can't overwrite cause */ //public static final int ER_CANNOT_OVERWRITE_CAUSE = 115; { ER_CANNOT_OVERWRITE_CAUSE, "Kan inte skriva \u00f6ver orsak"}, /** No default implementation found */ //public static final int ER_NO_DEFAULT_IMPL = 156; { ER_NO_DEFAULT_IMPL, "Standardimplementering saknas i:"}, /** ChunkedIntArray({0}) not currently supported */ //public static final int ER_CHUNKEDINTARRAY_NOT_SUPPORTED = 157; { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0}) underst\u00f6ds f\u00f6r n\u00e4rvarande inte"}, /** Offset bigger than slot */ //public static final int ER_OFFSET_BIGGER_THAN_SLOT = 158; { ER_OFFSET_BIGGER_THAN_SLOT, "Offset st\u00f6rre \u00e4n fack"}, /** Coroutine not available, id= */ //public static final int ER_COROUTINE_NOT_AVAIL = 159; { ER_COROUTINE_NOT_AVAIL, "Sidorutin inte tillg\u00e4nglig, id={0}"}, /** CoroutineManager recieved co_exit() request */ //public static final int ER_COROUTINE_CO_EXIT = 160; { ER_COROUTINE_CO_EXIT, "CoroutineManager mottog co_exit()-f\u00f6rfr\u00e5gan"}, /** co_joinCoroutineSet() failed */ //public static final int ER_COJOINROUTINESET_FAILED = 161; { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet() misslyckades"}, /** Coroutine parameter error () */ //public static final int ER_COROUTINE_PARAM = 162; { ER_COROUTINE_PARAM, "Sidorutin fick parameterfel ({0})"}, /** UNEXPECTED: Parser doTerminate answers */ //public static final int ER_PARSER_DOTERMINATE_ANSWERS = 163; { ER_PARSER_DOTERMINATE_ANSWERS, "\nOV\u00c4NTAT: Parser doTerminate-svar {0}"}, /** parse may not be called while parsing */ //public static final int ER_NO_PARSE_CALL_WHILE_PARSING = 164; { ER_NO_PARSE_CALL_WHILE_PARSING, "parse f\u00e5r inte anropas medan tolkning sker"}, /** Error: typed iterator for axis {0} not implemented */ //public static final int ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = 165; { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "Fel: typad upprepare f\u00f6r axel {0} inte implementerad"}, /** Error: iterator for axis {0} not implemented */ //public static final int ER_ITERATOR_AXIS_NOT_IMPLEMENTED = 166; { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "Fel: upprepare f\u00f6r axel {0} inte implementerad"}, /** Iterator clone not supported */ //public static final int ER_ITERATOR_CLONE_NOT_SUPPORTED = 167; { ER_ITERATOR_CLONE_NOT_SUPPORTED, "Uppreparklon underst\u00f6ds inte"}, /** Unknown axis traversal type */ //public static final int ER_UNKNOWN_AXIS_TYPE = 168; { ER_UNKNOWN_AXIS_TYPE, "Ok\u00e4nd axeltraverstyp: {0}"}, /** Axis traverser not supported */ //public static final int ER_AXIS_NOT_SUPPORTED = 169; { ER_AXIS_NOT_SUPPORTED, "Axeltravers underst\u00f6ds inte: {0}"}, /** No more DTM IDs are available */ //public static final int ER_NO_DTMIDS_AVAIL = 170; { ER_NO_DTMIDS_AVAIL, "Inga fler DTM-IDs \u00e4r tillg\u00e4ngliga"}, /** Not supported */ //public static final int ER_NOT_SUPPORTED = 171; { ER_NOT_SUPPORTED, "Underst\u00f6ds inte: {0}"}, /** node must be non-null for getDTMHandleFromNode */ //public static final int ER_NODE_NON_NULL = 172; { ER_NODE_NON_NULL, "Nod m\u00e5ste vara icke-null f\u00f6r getDTMHandleFromNode"}, /** Could not resolve the node to a handle */ //public static final int ER_COULD_NOT_RESOLVE_NODE = 173; { ER_COULD_NOT_RESOLVE_NODE, "Kunde inte l\u00f6sa nod till ett handtag"}, /** startParse may not be called while parsing */ //public static final int ER_STARTPARSE_WHILE_PARSING = 174; { ER_STARTPARSE_WHILE_PARSING, "startParse f\u00e5r inte anropas medan tolkning sker"}, /** startParse needs a non-null SAXParser */ //public static final int ER_STARTPARSE_NEEDS_SAXPARSER = 175; { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse beh\u00f6ver en SAXParser som \u00e4r icke-null"}, /** could not initialize parser with */ //public static final int ER_COULD_NOT_INIT_PARSER = 176; { ER_COULD_NOT_INIT_PARSER, "kunde inte initialisera tolk med"}, /** exception creating new instance for pool */ //public static final int ER_EXCEPTION_CREATING_POOL = 178; { ER_EXCEPTION_CREATING_POOL, "undantag skapar ny instans f\u00f6r pool"}, /** Path contains invalid escape sequence */ //public static final int ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = 179; { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "V\u00e4g inneh\u00e5ller ogiltig flyktsekvens"}, /** Scheme is required! */ //public static final int ER_SCHEME_REQUIRED = 180; { ER_SCHEME_REQUIRED, "Schema kr\u00e4vs!"}, /** No scheme found in URI */ //public static final int ER_NO_SCHEME_IN_URI = 181; { ER_NO_SCHEME_IN_URI, "Schema saknas i URI: {0}"}, /** No scheme found in URI */ //public static final int ER_NO_SCHEME_INURI = 182; { ER_NO_SCHEME_INURI, "Schema saknas i URI"}, /** Path contains invalid character: */ //public static final int ER_PATH_INVALID_CHAR = 183; { ER_PATH_INVALID_CHAR, "V\u00e4g inneh\u00e5ller ogiltigt tecken: {0}"}, /** Cannot set scheme from null string */ //public static final int ER_SCHEME_FROM_NULL_STRING = 184; { ER_SCHEME_FROM_NULL_STRING, "Kan inte s\u00e4tta schema fr\u00e5n null-str\u00e4ng"}, /** The scheme is not conformant. */ //public static final int ER_SCHEME_NOT_CONFORMANT = 185; { ER_SCHEME_NOT_CONFORMANT, "Schemat \u00e4r inte likformigt."}, /** Host is not a well formed address */ //public static final int ER_HOST_ADDRESS_NOT_WELLFORMED = 186; { ER_HOST_ADDRESS_NOT_WELLFORMED, "V\u00e4rd \u00e4r inte en v\u00e4lformulerad adress"}, /** Port cannot be set when host is null */ //public static final int ER_PORT_WHEN_HOST_NULL = 187; { ER_PORT_WHEN_HOST_NULL, "Port kan inte s\u00e4ttas n\u00e4r v\u00e4rd \u00e4r null"}, /** Invalid port number */ //public static final int ER_INVALID_PORT = 188; { ER_INVALID_PORT, "Ogiltigt portnummer"}, /** Fragment can only be set for a generic URI */ //public static final int ER_FRAG_FOR_GENERIC_URI = 189; { ER_FRAG_FOR_GENERIC_URI, "Fragment kan bara s\u00e4ttas f\u00f6r en allm\u00e4n URI"}, /** Fragment cannot be set when path is null */ //public static final int ER_FRAG_WHEN_PATH_NULL = 190; { ER_FRAG_WHEN_PATH_NULL, "Fragment kan inte s\u00e4ttas n\u00e4r v\u00e4g \u00e4r null"}, /** Fragment contains invalid character */ //public static final int ER_FRAG_INVALID_CHAR = 191; { ER_FRAG_INVALID_CHAR, "Fragment inneh\u00e5ller ogiltigt tecken"}, /** Parser is already in use */ //public static final int ER_PARSER_IN_USE = 192; { ER_PARSER_IN_USE, "Tolk anv\u00e4nds redan"}, /** Parser is already in use */ //public static final int ER_CANNOT_CHANGE_WHILE_PARSING = 193; { ER_CANNOT_CHANGE_WHILE_PARSING, "Kan inte \u00e4ndra {0} {1} medan tolkning sker"}, /** Self-causation not permitted */ //public static final int ER_SELF_CAUSATION_NOT_PERMITTED = 194; { ER_SELF_CAUSATION_NOT_PERMITTED, "Sj\u00e4lvorsakande inte till\u00e5ten"}, /** Userinfo may not be specified if host is not specified */ //public static final int ER_NO_USERINFO_IF_NO_HOST = 198; { ER_NO_USERINFO_IF_NO_HOST, "Userinfo f\u00e5r inte anges om v\u00e4rden inte \u00e4r angiven"}, /** Port may not be specified if host is not specified */ //public static final int ER_NO_PORT_IF_NO_HOST = 199; { ER_NO_PORT_IF_NO_HOST, "Port f\u00e5r inte anges om v\u00e4rden inte \u00e4r angiven"}, /** Query string cannot be specified in path and query string */ //public static final int ER_NO_QUERY_STRING_IN_PATH = 200; { ER_NO_QUERY_STRING_IN_PATH, "F\u00f6rfr\u00e5gan-str\u00e4ng kan inte anges i v\u00e4g och f\u00f6rfr\u00e5gan-str\u00e4ng"}, /** Fragment cannot be specified in both the path and fragment */ //public static final int ER_NO_FRAGMENT_STRING_IN_PATH = 201; { ER_NO_FRAGMENT_STRING_IN_PATH, "Fragment kan inte anges i b\u00e5de v\u00e4gen och fragmentet"}, /** Cannot initialize URI with empty parameters */ //public static final int ER_CANNOT_INIT_URI_EMPTY_PARMS = 202; { ER_CANNOT_INIT_URI_EMPTY_PARMS, "Kan inte initialisera URI med tomma parametrar"}, /** Method not yet supported */ //public static final int ER_METHOD_NOT_SUPPORTED = 210; { ER_METHOD_NOT_SUPPORTED, "Metod \u00e4nnu inte underst\u00f6dd "}, /** IncrementalSAXSource_Filter not currently restartable */ //public static final int ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = 214; { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "IncrementalSAXSource_Filter kan f\u00f6r n\u00e4rvarande inte startas om"}, /** IncrementalSAXSource_Filter not currently restartable */ //public static final int ER_XMLRDR_NOT_BEFORE_STARTPARSE = 215; { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "XMLReader inte innan startParse-beg\u00e4ran"}, // Axis traverser not supported: {0} //public static final int ER_AXIS_TRAVERSER_NOT_SUPPORTED = 235; { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Det g\u00e5r inte att v\u00e4nda axeln: {0}"}, // ListingErrorHandler created with null PrintWriter! //public static final int ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = 236; { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "ListingErrorHandler skapad med null PrintWriter!"}, //public static final int ER_SYSTEMID_UNKNOWN = 240; { ER_SYSTEMID_UNKNOWN, "SystemId ok\u00e4nt"}, // Location of error unknown //public static final int ER_LOCATION_UNKNOWN = 241; { ER_LOCATION_UNKNOWN, "Platsen f\u00f6r felet \u00e4r ok\u00e4nd"}, /** Field ER_PREFIX_MUST_RESOLVE */ //public static final int ER_PREFIX_MUST_RESOLVE = 52; { ER_PREFIX_MUST_RESOLVE, "Prefix must resolve to a namespace: {0}"}, /** Field ER_CREATEDOCUMENT_NOT_SUPPORTED */ //public static final int ER_CREATEDOCUMENT_NOT_SUPPORTED = 54; { ER_CREATEDOCUMENT_NOT_SUPPORTED, "createDocument() underst\u00f6ds inte av XPathContext!"}, /** Field ER_CHILD_HAS_NO_OWNER_DOCUMENT */ //public static final int ER_CHILD_HAS_NO_OWNER_DOCUMENT = 55; { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "Attributbarn saknar \u00e4gardokument!"}, /** Field ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT */ //public static final int ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = 56; { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "Attributbarn saknar \u00e4gardokumentelement!"}, /** Field ER_CANT_OUTPUT_TEXT_BEFORE_DOC */ //public static final int ER_CANT_OUTPUT_TEXT_BEFORE_DOC = 63; { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "Varning: kan inte skriva ut text innan dokumentelement! Ignorerar..."}, /** Field ER_CANT_HAVE_MORE_THAN_ONE_ROOT */ //public static final int ER_CANT_HAVE_MORE_THAN_ONE_ROOT = 64; { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "Kan inte ha mer \u00e4n en rot p\u00e5 en DOM!"}, /** Argument 'localName' is null */ //public static final int ER_ARG_LOCALNAME_NULL = 70; { ER_ARG_LOCALNAME_NULL, "Argument 'localName' \u00e4r null"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. /** localname in QNAME should be a valid NCName */ //public static final int ER_ARG_LOCALNAME_INVALID = 101; { ER_ARG_LOCALNAME_INVALID, "Localname i QNAME b\u00f6r vara ett giltigt NCName"}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. /** prefix in QNAME should be a valid NCName */ //public static final int ER_ARG_PREFIX_INVALID = 102; { ER_ARG_PREFIX_INVALID, "Prefixet i QNAME b\u00f6r vara ett giltigt NCName"}, { "BAD_CODE", "Parameter till createMessage ligger utanf\u00f6r till\u00e5tet intervall"}, { "FORMAT_FAILED", "Undantag utl\u00f6st vid messageFormat-anrop"}, { "line", "Rad #"}, { "column", "Kolumn #"} }; } } libxalan2-java-2.7.1/src/org/apache/xml/res/XMLErrorResources_ko.java0000644000175000017500000005046010721374031024374 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLErrorResources_ko.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xml.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And you need * to enter key, value pair as part of the contents * array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XMLErrorResources_ko extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Message keys */ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE"; public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL"; public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED"; public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT"; public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL"; public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT"; public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED"; public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM"; public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS"; public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING"; public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED"; public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED"; public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE"; public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED"; public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL"; public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE"; public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING"; public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER"; public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER"; public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL"; public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE"; public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED"; public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI"; public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI"; public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR"; public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING"; public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT"; public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED"; public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL"; public static final String ER_INVALID_PORT = "ER_INVALID_PORT"; public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI"; public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL"; public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR"; public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE"; public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING"; public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED"; public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST"; public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST"; public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH"; public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH"; public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS"; public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED"; public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE"; public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE"; public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED"; public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER"; public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN"; public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT"; public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT"; public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC"; public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT"; public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL"; public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID"; public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID"; public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** * Get the lookup table for error messages * * @return The association list. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_FUNCTION_NOT_SUPPORTED, "\ud568\uc218\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_OVERWRITE_CAUSE, "\uc6d0\uc778\uc744 \uacb9\uccd0\uc4f8 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_DEFAULT_IMPL, "\uae30\ubcf8 \uad6c\ud604\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. "}, { ER_CHUNKEDINTARRAY_NOT_SUPPORTED, "ChunkedIntArray({0})\uac00 \ud604\uc7ac \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_OFFSET_BIGGER_THAN_SLOT, "\uc624\ud504\uc14b\uc774 \uc2ac\ub86f\ubcf4\ub2e4 \ud07d\ub2c8\ub2e4."}, { ER_COROUTINE_NOT_AVAIL, "Coroutine\uc740 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. id={0}"}, { ER_COROUTINE_CO_EXIT, "CoroutineManager\uac00 co_exit() \uc694\uccad\uc744 \ubc1b\uc558\uc2b5\ub2c8\ub2e4."}, { ER_COJOINROUTINESET_FAILED, "co_joinCoroutineSet()\uac00 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_COROUTINE_PARAM, "Coroutine \ub9e4\uac1c\ubcc0\uc218 \uc624\ub958({0})"}, { ER_PARSER_DOTERMINATE_ANSWERS, "\nUNEXPECTED: \uad6c\ubd84 \ubd84\uc11d\uae30 doTerminate\uac00 {0}\uc5d0 \uc751\ub2f5\ud569\ub2c8\ub2e4."}, { ER_NO_PARSE_CALL_WHILE_PARSING, "\uad6c\ubb38 \ubd84\uc11d \uc911\uc5d0\ub294 parse\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, "\uc624\ub958: {0} \ucd95\uc5d0 \ub300\ud574 \uc720\ud615\ud654\ub41c \ubc18\ubcf5\uae30\ub97c \uad6c\ud604\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ITERATOR_AXIS_NOT_IMPLEMENTED, "\uc624\ub958: {0} \ucd95\uc5d0 \ub300\ud55c \ubc18\ubcf5\uae30\ub97c \uad6c\ud604\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. "}, { ER_ITERATOR_CLONE_NOT_SUPPORTED, "\ubc18\ubcf5\uae30 \ubcf5\uc81c\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_UNKNOWN_AXIS_TYPE, "\uc54c \uc218 \uc5c6\ub294 axis traversal \uc720\ud615: {0}"}, { ER_AXIS_NOT_SUPPORTED, "Axis traverser\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NO_DTMIDS_AVAIL, "\uc0ac\uc6a9 \uac00\ub2a5\ud55c \ucd94\uac00 DTM ID\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NOT_SUPPORTED, "\uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NODE_NON_NULL, "getDTMHandleFromNode\uc758 \ub178\ub4dc\ub294 \ub110(null) \uc774\uc678\uc758 \uac12\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_COULD_NOT_RESOLVE_NODE, "\ub178\ub4dc\ub97c \ud578\ub4e4\ub85c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_STARTPARSE_WHILE_PARSING, "\uad6c\ubb38 \ubd84\uc11d \uc911\uc5d0\ub294 startParse\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_STARTPARSE_NEEDS_SAXPARSER, "startParse\ub294 \ub110(null)\uc774 \uc544\ub2cc SAXParser\ub97c \ud544\uc694\ub85c \ud569\ub2c8\ub2e4."}, { ER_COULD_NOT_INIT_PARSER, "\uad6c\ubb38 \ubd84\uc11d\uae30\ub97c \ucd08\uae30\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_EXCEPTION_CREATING_POOL, "\ud480\uc758 \uc0c8 \uc778\uc2a4\ud134\uc2a4 \uc791\uc131 \uc911 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE, "\uacbd\ub85c\uc5d0 \uc798\ubabb\ub41c \uc774\uc2a4\ucf00\uc774\ud504 \uc21c\uc11c\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_SCHEME_REQUIRED, "\uc2a4\ud0a4\ub9c8\uac00 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_NO_SCHEME_IN_URI, "URI\uc5d0 \uc2a4\ud0a4\ub9c8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NO_SCHEME_INURI, "URI\uc5d0 \uc2a4\ud0a4\ub9c8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_PATH_INVALID_CHAR, "\uacbd\ub85c\uc5d0 \uc798\ubabb\ub41c \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4: {0}"}, { ER_SCHEME_FROM_NULL_STRING, "\ub110(null) \ubb38\uc790\uc5f4\uc5d0\uc11c \uc2a4\ud0a4\ub9c8\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SCHEME_NOT_CONFORMANT, "\uc2a4\ud0a4\ub9c8\uac00 \uc77c\uce58\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_HOST_ADDRESS_NOT_WELLFORMED, "\ud638\uc2a4\ud2b8\uac00 \uc644\uc804\ud55c \uc8fc\uc18c\uac00 \uc544\ub2d9\ub2c8\ub2e4."}, { ER_PORT_WHEN_HOST_NULL, "\ud638\uc2a4\ud2b8\uac00 \ub110(null)\uc774\uba74 \ud3ec\ud2b8\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_INVALID_PORT, "\uc798\ubabb\ub41c \ud3ec\ud2b8 \ubc88\ud638"}, { ER_FRAG_FOR_GENERIC_URI, "\uc77c\ubc18 URI\uc5d0 \ub300\ud574\uc11c\ub9cc \ub2e8\ud3b8\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_FRAG_WHEN_PATH_NULL, "\uacbd\ub85c\uac00 \ub110(null)\uc774\uba74 \ub2e8\ud3b8\uc744 \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_FRAG_INVALID_CHAR, "\ub2e8\ud3b8\uc5d0 \uc798\ubabb\ub41c \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_PARSER_IN_USE, "\uad6c\ubb38 \ubd84\uc11d\uae30\uac00 \uc774\ubbf8 \uc0ac\uc6a9 \uc911\uc785\ub2c8\ub2e4."}, { ER_CANNOT_CHANGE_WHILE_PARSING, "\uad6c\ubb38 \ubd84\uc11d \uc911\uc5d0\ub294 {0} {1}\uc744(\ub97c) \ubcc0\uacbd\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SELF_CAUSATION_NOT_PERMITTED, "Self-causation\uc774 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_NO_USERINFO_IF_NO_HOST, "\ud638\uc2a4\ud2b8\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 Userinfo\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_PORT_IF_NO_HOST, "\ud638\uc2a4\ud2b8\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 \ud3ec\ud2b8\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_QUERY_STRING_IN_PATH, "\uacbd\ub85c \ubc0f \uc870\ud68c \ubb38\uc790\uc5f4\uc5d0 \uc870\ud68c \ubb38\uc790\uc5f4\uc744 \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_FRAGMENT_STRING_IN_PATH, "\uacbd\ub85c \ubc0f \ub2e8\ud3b8 \ub458 \ub2e4\uc5d0 \ub2e8\ud3b8\uc744 \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_INIT_URI_EMPTY_PARMS, "\ube48 \ub9e4\uac1c\ubcc0\uc218\ub85c URI\ub97c \ucd08\uae30\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_METHOD_NOT_SUPPORTED, "\uc544\uc9c1 \uba54\uc18c\ub4dc\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4. "}, { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, "\ud604\uc7ac IncrementalSAXSource_Filter\ub97c \ub2e4\uc2dc \uc2dc\uc791\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_XMLRDR_NOT_BEFORE_STARTPARSE, "startParse \uc694\uccad \uc804\uc5d0 XMLReader\ub97c \uc2dc\uc791\ud588\uc2b5\ub2c8\ub2e4."}, { ER_AXIS_TRAVERSER_NOT_SUPPORTED, "Axis traverser\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER, "\ub110(null) PrintWriter\ub85c ListingErrorHandler\ub97c \uc791\uc131\ud588\uc2b5\ub2c8\ub2e4."}, { ER_SYSTEMID_UNKNOWN, "SystemId\ub97c \uc54c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_LOCATION_UNKNOWN, "\uc624\ub958 \uc704\uce58 \uc54c \uc218 \uc5c6\uc74c"}, { ER_PREFIX_MUST_RESOLVE, "\uc811\ub450\ubd80\ub294 \uc774\ub984 \uacf5\uac04\uc73c\ub85c \ubd84\uc11d\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4: {0}"}, { ER_CREATEDOCUMENT_NOT_SUPPORTED, "XPathContext\uc5d0\uc11c createDocument()\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT, "\ud558\uc704 \uc18d\uc131\uc5d0 \uc18c\uc720\uc790 \ubb38\uc11c\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, "\ud558\uc704 \uc18d\uc131\uc5d0 \uc18c\uc720\uc790 \ubb38\uc11c \uc694\uc18c\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANT_OUTPUT_TEXT_BEFORE_DOC, "\uacbd\uace0: \ubb38\uc11c \uc694\uc18c \uc55e\uc5d0 \ud14d\uc2a4\ud2b8\ub97c \ucd9c\ub825\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ubb34\uc2dc \uc911..."}, { ER_CANT_HAVE_MORE_THAN_ONE_ROOT, "DOM\uc5d0 \ub458 \uc774\uc0c1\uc758 \ub8e8\ud2b8\uac00 \uc788\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ARG_LOCALNAME_NULL, "'localName' \uc778\uc218\uac00 \ub110(null)\uc785\ub2c8\ub2e4."}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The localname is the portion after the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_LOCALNAME_INVALID, "QNAME\uc758 \ub85c\uceec \uc774\ub984\uc740 \uc720\ud6a8\ud55c NCName\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, // Note to translators: A QNAME has the syntactic form [NCName:]NCName // The prefix is the portion before the optional colon; the message indicates // that there is a problem with that part of the QNAME. { ER_ARG_PREFIX_INVALID, "QNAME\uc758 \uc811\ub450\ubd80\ub294 \uc720\ud6a8\ud55c NCName\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_NAME_CANT_START_WITH_COLON, "\uc774\ub984\uc740 \ucf5c\ub860\uc73c\ub85c \uc2dc\uc791\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. "}, { "BAD_CODE", "createMessage\uc5d0 \ub300\ud55c \ub9e4\uac1c\ubcc0\uc218\uac00 \ubc94\uc704\ub97c \ubc97\uc5b4\ub0ac\uc2b5\ub2c8\ub2e4."}, { "FORMAT_FAILED", "messageFormat \ud638\ucd9c \uc911 \uc608\uc678\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, { "line", "\ud589 #"}, { "column","\uc5f4 #"} }; } /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XMLErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("ko", "KR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/0000755000175000017500000000000010736146354017213 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/serialize/0000755000175000017500000000000010736146354021202 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/serialize/SerializerFactory.java0000644000175000017500000001147110721374033025501 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerFactory.java 468642 2006-10-28 06:55:10Z minchau $ */ package org.apache.xalan.serialize; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; /** * Factory for creating serializers. * @deprecated The new class to use is * org.apache.xml.serializer.SerializerFactory */ public abstract class SerializerFactory { private SerializerFactory() { } /** * Returns a serializer for the specified output method. Returns * null if no implementation exists that supports the specified * output method. For a list of the default output methods see * {@link org.apache.xml.serializer.Method}. * * @param format The output format * @return A suitable serializer, or null * @throws IllegalArgumentException (apparently -sc) if method is * null or an appropriate serializer can't be found * @throws WrappedRuntimeException (apparently -sc) if an * exception is thrown while trying to find serializer * @deprecated Use org.apache.xml.serializer.SerializerFactory */ public static Serializer getSerializer(Properties format) { org.apache.xml.serializer.Serializer ser; ser = org.apache.xml.serializer.SerializerFactory.getSerializer(format); SerializerFactory.SerializerWrapper si = new SerializerWrapper(ser); return si; } /** * This class just exists to wrap a new Serializer in the new package by * an old one. * @deprecated */ private static class SerializerWrapper implements Serializer { private final org.apache.xml.serializer.Serializer m_serializer; private DOMSerializer m_old_DOMSerializer; SerializerWrapper(org.apache.xml.serializer.Serializer ser) { m_serializer = ser; } public void setOutputStream(OutputStream output) { m_serializer.setOutputStream(output); } public OutputStream getOutputStream() { return m_serializer.getOutputStream(); } public void setWriter(Writer writer) { m_serializer.setWriter(writer); } public Writer getWriter() { return m_serializer.getWriter(); } public void setOutputFormat(Properties format) { m_serializer.setOutputFormat(format); } public Properties getOutputFormat() { return m_serializer.getOutputFormat(); } public ContentHandler asContentHandler() throws IOException { return m_serializer.asContentHandler(); } /** * @return an old style DOMSerializer that wraps a new one. * @see org.apache.xalan.serialize.Serializer#asDOMSerializer() */ public DOMSerializer asDOMSerializer() throws IOException { if (m_old_DOMSerializer == null) { m_old_DOMSerializer = new DOMSerializerWrapper(m_serializer.asDOMSerializer()); } return m_old_DOMSerializer; } /** * @see org.apache.xalan.serialize.Serializer#reset() */ public boolean reset() { return m_serializer.reset(); } } /** * This class just wraps a new DOMSerializer with an old style one for * migration purposes. * */ private static class DOMSerializerWrapper implements DOMSerializer { private final org.apache.xml.serializer.DOMSerializer m_dom; DOMSerializerWrapper(org.apache.xml.serializer.DOMSerializer domser) { m_dom = domser; } public void serialize(Node node) throws IOException { m_dom.serialize(node); } } } libxalan2-java-2.7.1/src/org/apache/xalan/serialize/SerializerUtils.java0000644000175000017500000002134010721374030025163 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerUtils.java 468642 2006-10-28 06:55:10Z minchau $ */ package org.apache.xalan.serialize; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.serializer.NamespaceMappings; import org.apache.xml.serializer.SerializationHandler; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.xml.sax.SAXException; /** * Class that contains only static methods that are used to "serialize", * these methods are used by Xalan and are not in org.apache.xml.serializer * because they have dependancies on the packages org.apache.xpath or org. * apache.xml.dtm or org.apache.xalan.transformer. The package org.apache.xml. * serializer should not depend on Xalan or XSLTC. * @xsl.usage internal */ public class SerializerUtils { /** * Copy an DOM attribute to the created output element, executing * attribute templates as need be, and processing the xsl:use * attribute. * * @param handler SerializationHandler to which the attributes are added. * @param attr Attribute node to add to SerializationHandler. * * @throws TransformerException */ public static void addAttribute(SerializationHandler handler, int attr) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(attr); if (SerializerUtils.isDefinedNSDecl(handler, attr, dtm)) return; String ns = dtm.getNamespaceURI(attr); if (ns == null) ns = ""; // %OPT% ...can I just store the node handle? try { handler.addAttribute( ns, dtm.getLocalName(attr), dtm.getNodeName(attr), "CDATA", dtm.getNodeValue(attr), false); } catch (SAXException e) { // do something? } } // end copyAttributeToTarget method /** * Copy DOM attributes to the result element. * * @param src Source node with the attributes * * @throws TransformerException */ public static void addAttributes(SerializationHandler handler, int src) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(src); for (int node = dtm.getFirstAttribute(src); DTM.NULL != node; node = dtm.getNextAttribute(node)) { addAttribute(handler, node); } } /** * Given a result tree fragment, walk the tree and * output it to the SerializationHandler. * * @param obj Result tree fragment object * @param support XPath context for the result tree fragment * * @throws org.xml.sax.SAXException */ public static void outputResultTreeFragment( SerializationHandler handler, XObject obj, XPathContext support) throws org.xml.sax.SAXException { int doc = obj.rtf(); DTM dtm = support.getDTM(doc); if (null != dtm) { for (int n = dtm.getFirstChild(doc); DTM.NULL != n; n = dtm.getNextSibling(n)) { handler.flushPending(); // I think. . . . This used to have a (true) arg // to flush prefixes, will that cause problems ??? if (dtm.getNodeType(n) == DTM.ELEMENT_NODE && dtm.getNamespaceURI(n) == null) handler.startPrefixMapping("", ""); dtm.dispatchToEvents(n, handler); } } } /** * Copy xmlns: attributes in if not already in scope. * * As a quick hack to support ClonerToResultTree, this can also be used * to copy an individual namespace node. * * @param src Source Node * NEEDSDOC @param type * NEEDSDOC @param dtm * * @throws TransformerException */ public static void processNSDecls( SerializationHandler handler, int src, int type, DTM dtm) throws TransformerException { try { if (type == DTM.ELEMENT_NODE) { for (int namespace = dtm.getFirstNamespaceNode(src, true); DTM.NULL != namespace; namespace = dtm.getNextNamespaceNode(src, namespace, true)) { // String prefix = dtm.getPrefix(namespace); String prefix = dtm.getNodeNameX(namespace); String desturi = handler.getNamespaceURIFromPrefix(prefix); // String desturi = getURI(prefix); String srcURI = dtm.getNodeValue(namespace); if (!srcURI.equalsIgnoreCase(desturi)) { handler.startPrefixMapping(prefix, srcURI, false); } } } else if (type == DTM.NAMESPACE_NODE) { String prefix = dtm.getNodeNameX(src); // Brian M. - some changes here to get desturi String desturi = handler.getNamespaceURIFromPrefix(prefix); String srcURI = dtm.getNodeValue(src); if (!srcURI.equalsIgnoreCase(desturi)) { handler.startPrefixMapping(prefix, srcURI, false); } } } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } } /** * Returns whether a namespace is defined * * * @param attr Namespace attribute node * @param dtm The DTM that owns attr. * * @return True if the namespace is already defined in * list of namespaces */ public static boolean isDefinedNSDecl( SerializationHandler serializer, int attr, DTM dtm) { if (DTM.NAMESPACE_NODE == dtm.getNodeType(attr)) { // String prefix = dtm.getPrefix(attr); String prefix = dtm.getNodeNameX(attr); String uri = serializer.getNamespaceURIFromPrefix(prefix); // String uri = getURI(prefix); if ((null != uri) && uri.equals(dtm.getStringValue(attr))) return true; } return false; } /** * This function checks to make sure a given prefix is really * declared. It might not be, because it may be an excluded prefix. * If it's not, it still needs to be declared at this point. * TODO: This needs to be done at an earlier stage in the game... -sb * * NEEDSDOC @param dtm * NEEDSDOC @param namespace * * @throws org.xml.sax.SAXException */ public static void ensureNamespaceDeclDeclared( SerializationHandler handler, DTM dtm, int namespace) throws org.xml.sax.SAXException { String uri = dtm.getNodeValue(namespace); String prefix = dtm.getNodeNameX(namespace); if ((uri != null && uri.length() > 0) && (null != prefix)) { String foundURI; NamespaceMappings ns = handler.getNamespaceMappings(); if (ns != null) { foundURI = ns.lookupNamespace(prefix); if ((null == foundURI) || !foundURI.equals(uri)) { handler.startPrefixMapping(prefix, uri, false); } } } } } libxalan2-java-2.7.1/src/org/apache/xalan/serialize/DOMSerializer.java0000644000175000017500000000210710721374030024502 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMSerializer.java 468642 2006-10-28 06:55:10Z minchau $ */ package org.apache.xalan.serialize; /** * @deprecated Use org.apache.xml.serializer.DOMSerializer */ public interface DOMSerializer extends org.apache.xml.serializer.DOMSerializer { } libxalan2-java-2.7.1/src/org/apache/xalan/serialize/Serializer.java0000644000175000017500000001174110721374032024150 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Serializer.java 468642 2006-10-28 06:55:10Z minchau $ */ package org.apache.xalan.serialize; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import org.xml.sax.ContentHandler; /** * The Serializer interface is implemented by Serializers to publish methods * to get and set streams and writers, to set the output properties, and * get the Serializer as a ContentHandler or DOMSerializer. * @deprecated Use org.apache.xml.serializer.Serializer */ public interface Serializer { /** * Specifies an output stream to which the document should be * serialized. This method should not be called while the * serializer is in the process of serializing a document. *

        * The encoding specified in the output {@link Properties} is used, or * if no encoding was specified, the default for the selected * output method. * * @param output The output stream * * @deprecated Use org.apache.xml.serializer.Serializer */ public void setOutputStream(OutputStream output); /** * Get the output stream where the events will be serialized to. * * @return reference to the result stream, or null of only a writer was * set. * @deprecated Use org.apache.xml.serializer.Serializer */ public OutputStream getOutputStream(); /** * Specifies a writer to which the document should be serialized. * This method should not be called while the serializer is in * the process of serializing a document. *

        * The encoding specified for the output {@link Properties} must be * identical to the output format used with the writer. * * @param writer The output writer stream * * @deprecated Use org.apache.xml.serializer.Serializer */ public void setWriter(Writer writer); /** * Get the character stream where the events will be serialized to. * * @return Reference to the result Writer, or null. * @deprecated Use org.apache.xml.serializer.Serializer */ public Writer getWriter(); /** * Specifies an output format for this serializer. It the * serializer has already been associated with an output format, * it will switch to the new format. This method should not be * called while the serializer is in the process of serializing * a document. * * @param format The output format to use * * @deprecated Use org.apache.xml.serializer.Serializer */ public void setOutputFormat(Properties format); /** * Returns the output format for this serializer. * * @return The output format in use * @deprecated Use org.apache.xml.serializer.Serializer */ public Properties getOutputFormat(); /** * Return a {@link ContentHandler} interface into this serializer. * If the serializer does not support the {@link ContentHandler} * interface, it should return null. * * @return A {@link ContentHandler} interface into this serializer, * or null if the serializer is not SAX 2 capable * @throws IOException An I/O exception occured * @deprecated Use org.apache.xml.serializer.Serializer */ public ContentHandler asContentHandler() throws IOException; /** * Return a {@link DOMSerializer} interface into this serializer. * If the serializer does not support the {@link DOMSerializer} * interface, it should return null. * * @return A {@link DOMSerializer} interface into this serializer, * or null if the serializer is not DOM capable * @throws IOException An I/O exception occured * @deprecated Use org.apache.xml.serializer.Serializer */ public DOMSerializer asDOMSerializer() throws IOException; /** * Resets the serializer. If this method returns true, the * serializer may be used for subsequent serialization of new * documents. It is possible to change the output format and * output stream prior to serializing, or to use the existing * output format and output stream. * * @return True if serializer has been reset and can be reused * * @deprecated Use org.apache.xml.serializer.Serializer */ public boolean reset(); } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/0000755000175000017500000000000010736146354021555 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/transformer/KeyTable.java0000644000175000017500000002040110721374030024101 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyTable.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Hashtable; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.KeyDeclaration; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.QName; import org.apache.xml.utils.WrappedRuntimeException; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; /** * Table of element keys, keyed by document node. An instance of this * class is keyed by a Document node that should be matched with the * root of the current context. * @xsl.usage advanced */ public class KeyTable { /** * The document key. This table should only be used with contexts * whose Document roots match this key. */ private int m_docKey; /** * Vector of KeyDeclaration instances holding the key declarations. */ private Vector m_keyDeclarations; /** * Hold a cache of key() function result for each ref. * Key is XMLString, the ref value * Value is XNodeSet, the key() function result for the given ref value. */ private Hashtable m_refsTable = null; /** * Get the document root matching this key. * * @return the document root matching this key */ public int getDocKey() { return m_docKey; } /** * The main iterator that will walk through the source * tree for this key. */ private XNodeSet m_keyNodes; KeyIterator getKeyIterator() { return (KeyIterator)(m_keyNodes.getContainedIter()); } /** * Build a keys table. * @param doc The owner document key. * @param nscontext The stylesheet's namespace context. * @param name The key name * @param keyDeclarations The stylesheet's xsl:key declarations. * * @throws javax.xml.transform.TransformerException */ public KeyTable( int doc, PrefixResolver nscontext, QName name, Vector keyDeclarations, XPathContext xctxt) throws javax.xml.transform.TransformerException { m_docKey = doc; m_keyDeclarations = keyDeclarations; KeyIterator ki = new KeyIterator(name, keyDeclarations); m_keyNodes = new XNodeSet(ki); m_keyNodes.allowDetachToRelease(false); m_keyNodes.setRoot(doc, xctxt); } /** * Given a valid element key, return the corresponding node list. * * @param name The name of the key, which must match the 'name' attribute on xsl:key. * @param ref The value that must match the value found by the 'match' attribute on xsl:key. * @return a set of nodes referenced by the key named name and the reference ref. If no node is referenced by this key, an empty node set is returned. */ public XNodeSet getNodeSetDTMByKey(QName name, XMLString ref) { XNodeSet refNodes = (XNodeSet) getRefsTable().get(ref); // clone wiht reset the node set try { if (refNodes != null) { refNodes = (XNodeSet) refNodes.cloneWithReset(); } } catch (CloneNotSupportedException e) { refNodes = null; } if (refNodes == null) { // create an empty XNodeSet KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter(); XPathContext xctxt = ki.getXPathContext(); refNodes = new XNodeSet(xctxt.getDTMManager()) { public void setRoot(int nodeHandle, Object environment) { // Root cannot be set on non-iterated node sets. Ignore it. } }; refNodes.reset(); } return refNodes; } /** * Get Key Name for this KeyTable * * @return Key name */ public QName getKeyTableName() { return getKeyIterator().getName(); } /** * @return key declarations for the key associated to this KeyTable */ private Vector getKeyDeclarations() { int nDeclarations = m_keyDeclarations.size(); Vector keyDecls = new Vector(nDeclarations); // Walk through each of the declarations made with xsl:key for (int i = 0; i < nDeclarations; i++) { KeyDeclaration kd = (KeyDeclaration) m_keyDeclarations.elementAt(i); // Add the declaration if the name on this key declaration // matches the name on the iterator for this walker. if (kd.getName().equals(getKeyTableName())) { keyDecls.add(kd); } } return keyDecls; } /** * @return lazy initialized refs table associating evaluation of key function * with a XNodeSet */ private Hashtable getRefsTable() { if (m_refsTable == null) { // initial capacity set to a prime number to improve hash performance m_refsTable = new Hashtable(89); KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter(); XPathContext xctxt = ki.getXPathContext(); Vector keyDecls = getKeyDeclarations(); int nKeyDecls = keyDecls.size(); int currentNode; m_keyNodes.reset(); while (DTM.NULL != (currentNode = m_keyNodes.nextNode())) { try { for (int keyDeclIdx = 0; keyDeclIdx < nKeyDecls; keyDeclIdx++) { KeyDeclaration keyDeclaration = (KeyDeclaration) keyDecls.elementAt(keyDeclIdx); XObject xuse = keyDeclaration.getUse().execute(xctxt, currentNode, ki.getPrefixResolver()); if (xuse.getType() != xuse.CLASS_NODESET) { XMLString exprResult = xuse.xstr(); addValueInRefsTable(xctxt, exprResult, currentNode); } else { DTMIterator i = ((XNodeSet)xuse).iterRaw(); int currentNodeInUseClause; while (DTM.NULL != (currentNodeInUseClause = i.nextNode())) { DTM dtm = xctxt.getDTM(currentNodeInUseClause); XMLString exprResult = dtm.getStringValue(currentNodeInUseClause); addValueInRefsTable(xctxt, exprResult, currentNode); } } } } catch (TransformerException te) { throw new WrappedRuntimeException(te); } } } return m_refsTable; } /** * Add an association between a ref and a node in the m_refsTable. * Requires that m_refsTable != null * @param xctxt XPath context * @param ref the value of the use clause of the current key for the given node * @param node the node to reference */ private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) { XNodeSet nodes = (XNodeSet) m_refsTable.get(ref); if (nodes == null) { nodes = new XNodeSet(node, xctxt.getDTMManager()); nodes.nextNode(); m_refsTable.put(ref, nodes); } else { // Nodes are passed to this method in document order. Since we need to // suppress duplicates, we only need to check against the last entry // in each nodeset. We use nodes.nextNode after each entry so we can // easily compare node against the current node. if (nodes.getCurrentNode() != node) { nodes.mutableNodeset().addNode(node); nodes.nextNode(); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/Counter.java0000644000175000017500000001035110721374032024025 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Counter.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemNumber; import org.apache.xml.dtm.DTM; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPathContext; /** * A class that does incremental counting for support of xsl:number. * This class stores a cache of counted nodes (m_countNodes). * It tries to cache the counted nodes in document order... * the node count is based on its position in the cache list * @xsl.usage internal */ public class Counter { /** * Set the maximum ammount the m_countNodes list can * grow to. */ static final int MAXCOUNTNODES = 500; /** * The start count from where m_countNodes counts * from. In other words, the count of a given node * in the m_countNodes vector is node position + * m_countNodesStartCount. */ int m_countNodesStartCount = 0; /** * A vector of all nodes counted so far. */ NodeSetDTM m_countNodes; /** * The node from where the counting starts. This is needed to * find a counter if the node being counted is not immediatly * found in the m_countNodes vector. */ int m_fromNode = DTM.NULL; /** * The owning xsl:number element. */ ElemNumber m_numberElem; /** * Value to store result of last getCount call, for benifit * of returning val from CountersTable.getCounterByCounted, * who calls getCount. */ int m_countResult; /** * Construct a counter object. * * @param numberElem The owning xsl:number element. * @param countNodes A vector of all nodes counted so far. * * @throws TransformerException */ Counter(ElemNumber numberElem, NodeSetDTM countNodes) throws TransformerException { m_countNodes = countNodes; m_numberElem = numberElem; } /** * Construct a counter object. * * @param numberElem The owning xsl:number element. * * @throws TransformerException * Counter(ElemNumber numberElem) throws TransformerException { m_numberElem = numberElem; }*/ /** * Try and find a node that was previously counted. If found, * return a positive integer that corresponds to the count. * * @param support The XPath context to use * @param node The node to be counted. * * @return The count of the node, or -1 if not found. */ int getPreviouslyCounted(XPathContext support, int node) { int n = m_countNodes.size(); m_countResult = 0; for (int i = n - 1; i >= 0; i--) { int countedNode = m_countNodes.elementAt(i); if (node == countedNode) { // Since the list is in backwards order, the count is // how many are in the rest of the list. m_countResult = i + 1 + m_countNodesStartCount; break; } DTM dtm = support.getDTM(countedNode); // Try to see if the given node falls after the counted node... // if it does, don't keep searching backwards. if (dtm.isNodeAfter(countedNode, node)) break; } return m_countResult; } /** * Get the last node in the list. * * @return the last node in the list. */ int getLast() { int size = m_countNodes.size(); return (size > 0) ? m_countNodes.elementAt(size - 1) : DTM.NULL; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/XSLInfiniteLoopException.java0000644000175000017500000000256610721374033027265 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLInfiniteLoopException.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; /** * Class used to create an Infinite Loop Exception * @xsl.usage internal */ class XSLInfiniteLoopException { /** * Constructor XSLInfiniteLoopException * */ XSLInfiniteLoopException() { super(); } /** * Get Message associated with the exception * * * @return Message associated with the exception */ public String getMessage() { return "Processing Terminated."; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/CountersTable.java0000644000175000017500000001434310721374031025164 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CountersTable.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Hashtable; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemNumber; import org.apache.xml.dtm.DTM; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPathContext; /** * This is a table of counters, keyed by ElemNumber objects, each * of which has a list of Counter objects. This really isn't a true * table, it is more like a list of lists (there must be a technical * term for that...). * @xsl.usage internal */ public class CountersTable extends Hashtable { static final long serialVersionUID = 2159100770924179875L; /** * Construct a CountersTable. */ public CountersTable(){} /** * Get the list of counters that corresponds to * the given ElemNumber object. * * @param numberElem the given xsl:number element. * * @return the list of counters that corresponds to * the given ElemNumber object. */ Vector getCounters(ElemNumber numberElem) { Vector counters = (Vector) this.get(numberElem); return (null == counters) ? putElemNumber(numberElem) : counters; } /** * Put a counter into the table and create an empty * vector as it's value. * * @param numberElem the given xsl:number element. * * @return an empty vector to be used to store counts * for this number element. */ Vector putElemNumber(ElemNumber numberElem) { Vector counters = new Vector(); this.put(numberElem, counters); return counters; } /** * Place to collect new counters. */ transient private NodeSetDTM m_newFound; /** * Add a list of counted nodes that were built in backwards document * order, or a list of counted nodes that are in forwards document * order. * * @param flist Vector of nodes built in forwards document order * @param blist Vector of nodes built in backwards document order */ void appendBtoFList(NodeSetDTM flist, NodeSetDTM blist) { int n = blist.size(); for (int i = (n - 1); i >= 0; i--) { flist.addElement(blist.item(i)); } } // For diagnostics /** Number of counters created so far */ transient int m_countersMade = 0; /** * Count forward until the given node is found, or until * we have looked to the given amount. * * @param support The XPath context to use * @param numberElem The given xsl:number element. * @param node The node to count. * * @return The node count, or 0 if not found. * * @throws TransformerException */ public int countNode(XPathContext support, ElemNumber numberElem, int node) throws TransformerException { int count = 0; Vector counters = getCounters(numberElem); int nCounters = counters.size(); // XPath countMatchPattern = numberElem.getCountMatchPattern(support, node); // XPath fromMatchPattern = numberElem.m_fromMatchPattern; int target = numberElem.getTargetNode(support, node); if (DTM.NULL != target) { for (int i = 0; i < nCounters; i++) { Counter counter = (Counter) counters.elementAt(i); count = counter.getPreviouslyCounted(support, target); if (count > 0) return count; } // In the loop below, we collect the nodes in backwards doc order, so // we don't have to do inserts, but then we store the nodes in forwards // document order, so we don't have to insert nodes into that list, // so that's what the appendBtoFList stuff is all about. In cases // of forward counting by one, this will mean a single node copy from // the backwards list (m_newFound) to the forwards list (counter.m_countNodes). count = 0; if (m_newFound == null) m_newFound = new NodeSetDTM(support.getDTMManager()); for (; DTM.NULL != target; target = numberElem.getPreviousNode(support, target)) { // First time in, we should not have to check for previous counts, // since the original target node was already checked in the // block above. if (0 != count) { for (int i = 0; i < nCounters; i++) { Counter counter = (Counter) counters.elementAt(i); int cacheLen = counter.m_countNodes.size(); if ((cacheLen > 0) && (counter.m_countNodes.elementAt(cacheLen - 1) == target)) { count += (cacheLen + counter.m_countNodesStartCount); if (cacheLen > 0) appendBtoFList(counter.m_countNodes, m_newFound); m_newFound.removeAllElements(); return count; } } } m_newFound.addElement(target); count++; } // If we got to this point, then we didn't find a counter, so make // one and add it to the list. Counter counter = new Counter(numberElem, new NodeSetDTM(support.getDTMManager())); m_countersMade++; // for diagnostics appendBtoFList(counter.m_countNodes, m_newFound); m_newFound.removeAllElements(); counters.addElement(counter); } return count; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformerHandlerImpl.java0000644000175000017500000010121610721374031027030 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerHandlerImpl.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.io.IOException; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.sax.TransformerHandler; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.IncrementalSAXSource_Filter; import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM; import org.apache.xpath.XPathContext; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.apache.xml.serializer.SerializationHandler; /** * A TransformerHandler * listens for SAX ContentHandler parse events and transforms * them to a Result. */ public class TransformerHandlerImpl implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler, LexicalHandler, TransformerHandler, DeclHandler { /** * The flag for the setting of the optimize feature; */ private final boolean m_optimizer; /** * The flag for the setting of the incremental feature; */ private final boolean m_incremental; /** * The flag for the setting of the source_location feature; */ private final boolean m_source_location; private boolean m_insideParse = false; //////////////////////////////////////////////////////////////////// // Constructors. //////////////////////////////////////////////////////////////////// /** * Construct a TransformerHandlerImpl. * * @param transformer Non-null reference to the Xalan transformer impl. * @param doFragment True if the result should be a document fragement. * @param baseSystemID The system ID to use as the base for relative URLs. */ public TransformerHandlerImpl(TransformerImpl transformer, boolean doFragment, String baseSystemID) { super(); m_transformer = transformer; m_baseSystemID = baseSystemID; XPathContext xctxt = transformer.getXPathContext(); DTM dtm = xctxt.getDTM(null, true, transformer, true, true); m_dtm = dtm; dtm.setDocumentBaseURI(baseSystemID); m_contentHandler = dtm.getContentHandler(); m_dtdHandler = dtm.getDTDHandler(); m_entityResolver = dtm.getEntityResolver(); m_errorHandler = dtm.getErrorHandler(); m_lexicalHandler = dtm.getLexicalHandler(); m_incremental = transformer.getIncremental(); m_optimizer = transformer.getOptimize(); m_source_location = transformer.getSource_location(); } /** * Do what needs to be done to shut down the CoRoutine management. */ protected void clearCoRoutine() { clearCoRoutine(null); } /** * Do what needs to be done to shut down the CoRoutine management. */ protected void clearCoRoutine(SAXException ex) { if(null != ex) m_transformer.setExceptionThrown(ex); if(m_dtm instanceof SAX2DTM) { if(DEBUG) System.err.println("In clearCoRoutine..."); try { SAX2DTM sax2dtm = ((SAX2DTM)m_dtm); if(null != m_contentHandler && m_contentHandler instanceof IncrementalSAXSource_Filter) { IncrementalSAXSource_Filter sp = (IncrementalSAXSource_Filter)m_contentHandler; // This should now be all that's needed. sp.deliverMoreNodes(false); } sax2dtm.clearCoRoutine(true); m_contentHandler = null; m_dtdHandler = null; m_entityResolver = null; m_errorHandler = null; m_lexicalHandler = null; } catch(Throwable throwable) { throwable.printStackTrace(); } if(DEBUG) System.err.println("...exiting clearCoRoutine"); } } //////////////////////////////////////////////////////////////////// // Implementation of javax.xml.transform.sax.TransformerHandler. //////////////////////////////////////////////////////////////////// /** * Enables the user of the TransformerHandler to set the * to set the Result for the transformation. * * @param result A Result instance, should not be null. * * @throws IllegalArgumentException if result is invalid for some reason. */ public void setResult(Result result) throws IllegalArgumentException { if (null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null"); try { // ContentHandler handler = // m_transformer.createResultContentHandler(result); // m_transformer.setContentHandler(handler); SerializationHandler xoh = m_transformer.createSerializationHandler(result); m_transformer.setSerializationHandler(xoh); } catch (javax.xml.transform.TransformerException te) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set"); } m_result = result; } /** * Set the base ID (URI or system ID) from where relative * URLs will be resolved. * @param systemID Base URI for the source tree. */ public void setSystemId(String systemID) { m_baseSystemID = systemID; m_dtm.setDocumentBaseURI(systemID); } /** * Get the base ID (URI or system ID) from where relative * URLs will be resolved. * @return The systemID that was set with {@link #setSystemId}. */ public String getSystemId() { return m_baseSystemID; } /** * Get the Transformer associated with this handler, which * is needed in order to set parameters and output properties. * * @return The Transformer associated with this handler */ public Transformer getTransformer() { return m_transformer; } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.EntityResolver. //////////////////////////////////////////////////////////////////// /** * Filter an external entity resolution. * * @param publicId The entity's public identifier, or null. * @param systemId The entity's system identifier. * @return A new InputSource or null for the default. * * @throws IOException * @throws SAXException The client may throw * an exception during processing. * @throws java.io.IOException The client may throw an * I/O-related exception while obtaining the * new InputSource. * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (m_entityResolver != null) { return m_entityResolver.resolveEntity(publicId, systemId); } else { return null; } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.DTDHandler. //////////////////////////////////////////////////////////////////// /** * Filter a notation declaration event. * * @param name The notation name. * @param publicId The notation's public identifier, or null. * @param systemId The notation's system identifier, or null. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.DTDHandler#notationDecl */ public void notationDecl(String name, String publicId, String systemId) throws SAXException { if (m_dtdHandler != null) { m_dtdHandler.notationDecl(name, publicId, systemId); } } /** * Filter an unparsed entity declaration event. * * @param name The entity name. * @param publicId The entity's public identifier, or null. * @param systemId The entity's system identifier, or null. * @param notationName The name of the associated notation. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void unparsedEntityDecl( String name, String publicId, String systemId, String notationName) throws SAXException { if (m_dtdHandler != null) { m_dtdHandler.unparsedEntityDecl(name, publicId, systemId, notationName); } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.ContentHandler. //////////////////////////////////////////////////////////////////// /** * Filter a new document locator event. * * @param locator The document locator. * @see org.xml.sax.ContentHandler#setDocumentLocator */ public void setDocumentLocator(Locator locator) { if (DEBUG) System.out.println("TransformerHandlerImpl#setDocumentLocator: " + locator.getSystemId()); this.m_locator = locator; if(null == m_baseSystemID) { setSystemId(locator.getSystemId()); } if (m_contentHandler != null) { m_contentHandler.setDocumentLocator(locator); } } /** * Filter a start document event. * * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument() throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startDocument"); m_insideParse = true; // Thread listener = new Thread(m_transformer); if (m_contentHandler != null) { //m_transformer.setTransformThread(listener); if(m_incremental) { m_transformer.setSourceTreeDocForThread(m_dtm.getDocument()); int cpriority = Thread.currentThread().getPriority(); // runTransformThread is equivalent with the 2.0.1 code, // except that the Thread may come from a pool. m_transformer.runTransformThread( cpriority ); } // This is now done _last_, because IncrementalSAXSource_Filter // will immediately go into a "wait until events are requested" // pause. I believe that will close our timing window. // %REVIEW% m_contentHandler.startDocument(); } //listener.setDaemon(false); //listener.start(); } /** * Filter an end document event. * * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument() throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#endDocument"); m_insideParse = false; if (m_contentHandler != null) { m_contentHandler.endDocument(); } if(m_incremental) { m_transformer.waitTransformThread(); } else { m_transformer.setSourceTreeDocForThread(m_dtm.getDocument()); m_transformer.run(); } /* Thread transformThread = m_transformer.getTransformThread(); if (null != transformThread) { try { // This should wait until the transformThread is considered not alive. transformThread.join(); if (!m_transformer.hasTransformThreadErrorCatcher()) { Exception e = m_transformer.getExceptionThrown(); if (null != e) throw new org.xml.sax.SAXException(e); } m_transformer.setTransformThread(null); } catch (InterruptedException ie){} }*/ } /** * Filter a start Namespace prefix mapping event. * * @param prefix The Namespace prefix. * @param uri The Namespace URI. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#startPrefixMapping */ public void startPrefixMapping(String prefix, String uri) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startPrefixMapping: " + prefix + ", " + uri); if (m_contentHandler != null) { m_contentHandler.startPrefixMapping(prefix, uri); } } /** * Filter an end Namespace prefix mapping event. * * @param prefix The Namespace prefix. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping(String prefix) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#endPrefixMapping: " + prefix); if (m_contentHandler != null) { m_contentHandler.endPrefixMapping(prefix); } } /** * Filter a start element event. * * @param uri The element's Namespace URI, or the empty string. * @param localName The element's local name, or the empty string. * @param qName The element's qualified (prefixed) name, or the empty * string. * @param atts The element's attributes. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#startElement */ public void startElement( String uri, String localName, String qName, Attributes atts) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startElement: " + qName); if (m_contentHandler != null) { m_contentHandler.startElement(uri, localName, qName, atts); } } /** * Filter an end element event. * * @param uri The element's Namespace URI, or the empty string. * @param localName The element's local name, or the empty string. * @param qName The element's qualified (prefixed) name, or the empty * string. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#endElement */ public void endElement(String uri, String localName, String qName) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#endElement: " + qName); if (m_contentHandler != null) { m_contentHandler.endElement(uri, localName, qName); } } /** * Filter a character data event. * * @param ch An array of characters. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#characters */ public void characters(char ch[], int start, int length) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#characters: " + start + ", " + length); if (m_contentHandler != null) { m_contentHandler.characters(ch, start, length); } } /** * Filter an ignorable whitespace event. * * @param ch An array of characters. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#ignorableWhitespace */ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#ignorableWhitespace: " + start + ", " + length); if (m_contentHandler != null) { m_contentHandler.ignorableWhitespace(ch, start, length); } } /** * Filter a processing instruction event. * * @param target The processing instruction target. * @param data The text following the target. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction(String target, String data) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#processingInstruction: " + target + ", " + data); if (m_contentHandler != null) { m_contentHandler.processingInstruction(target, data); } } /** * Filter a skipped entity event. * * @param name The name of the skipped entity. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#skippedEntity */ public void skippedEntity(String name) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#skippedEntity: " + name); if (m_contentHandler != null) { m_contentHandler.skippedEntity(name); } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.ErrorHandler. //////////////////////////////////////////////////////////////////// /** * Filter a warning event. * * @param e The nwarning as an exception. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ErrorHandler#warning */ public void warning(SAXParseException e) throws SAXException { // This is not great, but we really would rather have the error // handler be the error listener if it is a error handler. Coroutine's fatalError // can't really be configured, so I think this is the best thing right now // for error reporting. Possibly another JAXP 1.1 hole. -sb javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener(); if(errorListener instanceof ErrorHandler) { ((ErrorHandler)errorListener).warning(e); } else { try { errorListener.warning(new javax.xml.transform.TransformerException(e)); } catch(javax.xml.transform.TransformerException te) { throw e; } } } /** * Filter an error event. * * @param e The error as an exception. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ErrorHandler#error */ public void error(SAXParseException e) throws SAXException { // %REVIEW% I don't think this should be called. -sb // clearCoRoutine(e); // This is not great, but we really would rather have the error // handler be the error listener if it is a error handler. Coroutine's fatalError // can't really be configured, so I think this is the best thing right now // for error reporting. Possibly another JAXP 1.1 hole. -sb javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener(); if(errorListener instanceof ErrorHandler) { ((ErrorHandler)errorListener).error(e); if(null != m_errorHandler) m_errorHandler.error(e); // may not be called. } else { try { errorListener.error(new javax.xml.transform.TransformerException(e)); if(null != m_errorHandler) m_errorHandler.error(e); // may not be called. } catch(javax.xml.transform.TransformerException te) { throw e; } } } /** * Filter a fatal error event. * * @param e The error as an exception. * @throws SAXException The client may throw * an exception during processing. * @see org.xml.sax.ErrorHandler#fatalError */ public void fatalError(SAXParseException e) throws SAXException { if(null != m_errorHandler) { try { m_errorHandler.fatalError(e); } catch(SAXParseException se) { // ignore } // clearCoRoutine(e); } // This is not great, but we really would rather have the error // handler be the error listener if it is a error handler. Coroutine's fatalError // can't really be configured, so I think this is the best thing right now // for error reporting. Possibly another JAXP 1.1 hole. -sb javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener(); if(errorListener instanceof ErrorHandler) { ((ErrorHandler)errorListener).fatalError(e); if(null != m_errorHandler) m_errorHandler.fatalError(e); // may not be called. } else { try { errorListener.fatalError(new javax.xml.transform.TransformerException(e)); if(null != m_errorHandler) m_errorHandler.fatalError(e); // may not be called. } catch(javax.xml.transform.TransformerException te) { throw e; } } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.ext.LexicalHandler. //////////////////////////////////////////////////////////////////// /** * Report the start of DTD declarations, if any. * *

        Any declarations are assumed to be in the internal subset * unless otherwise indicated by a {@link #startEntity startEntity} * event.

        * *

        Note that the start/endDTD events will appear within * the start/endDocument events from ContentHandler and * before the first startElement event.

        * * @param name The document type name. * @param publicId The declared public identifier for the * external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the * external DTD subset, or null if none was declared. * @throws SAXException The application may raise an * exception. * @see #endDTD * @see #startEntity */ public void startDTD(String name, String publicId, String systemId) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startDTD: " + name + ", " + publicId + ", " + systemId); if (null != m_lexicalHandler) { m_lexicalHandler.startDTD(name, publicId, systemId); } } /** * Report the end of DTD declarations. * * @throws SAXException The application may raise an exception. * @see #startDTD */ public void endDTD() throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#endDTD"); if (null != m_lexicalHandler) { m_lexicalHandler.endDTD(); } } /** * Report the beginning of an entity in content. * *

        NOTE: entity references in attribute * values -- and the start and end of the document entity -- * are never reported.

        * *

        The start and end of the external DTD subset are reported * using the pseudo-name "[dtd]". All other events must be * properly nested within start/end entity events.

        * *

        Note that skipped entities will be reported through the * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} * event, which is part of the ContentHandler interface.

        * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @throws SAXException The application may raise an exception. * @see #endEntity * @see org.xml.sax.ext.DeclHandler#internalEntityDecl * @see org.xml.sax.ext.DeclHandler#externalEntityDecl */ public void startEntity(String name) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startEntity: " + name); if (null != m_lexicalHandler) { m_lexicalHandler.startEntity(name); } } /** * Report the end of an entity. * * @param name The name of the entity that is ending. * @throws SAXException The application may raise an exception. * @see #startEntity */ public void endEntity(String name) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#endEntity: " + name); if (null != m_lexicalHandler) { m_lexicalHandler.endEntity(name); } } /** * Report the start of a CDATA section. * *

        The contents of the CDATA section will be reported through * the regular {@link org.xml.sax.ContentHandler#characters * characters} event.

        * * @throws SAXException The application may raise an exception. * @see #endCDATA */ public void startCDATA() throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#startCDATA"); if (null != m_lexicalHandler) { m_lexicalHandler.startCDATA(); } } /** * Report the end of a CDATA section. * * @throws SAXException The application may raise an exception. * @see #startCDATA */ public void endCDATA() throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#endCDATA"); if (null != m_lexicalHandler) { m_lexicalHandler.endCDATA(); } } /** * Report an XML comment anywhere in the document. * *

        This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read).

        * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#comment: " + start + ", " + length); if (null != m_lexicalHandler) { m_lexicalHandler.comment(ch, start, length); } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.ext.DeclHandler. //////////////////////////////////////////////////////////////////// /** * Report an element type declaration. * *

        The content model will consist of the string "EMPTY", the * string "ANY", or a parenthesised group, optionally followed * by an occurrence indicator. The model will be normalized so * that all whitespace is removed,and will include the enclosing * parentheses.

        * * @param name The element type name. * @param model The content model as a normalized string. * @throws SAXException The application may raise an exception. */ public void elementDecl(String name, String model) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#elementDecl: " + name + ", " + model); if (null != m_declHandler) { m_declHandler.elementDecl(name, model); } } /** * Report an attribute type declaration. * *

        Only the effective (first) declaration for an attribute will * be reported. The type will be one of the strings "CDATA", * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", * "ENTITIES", or "NOTATION", or a parenthesized token group with * the separator "|" and all whitespace removed.

        * * @param eName The name of the associated element. * @param aName The name of the attribute. * @param type A string representing the attribute type. * @param valueDefault A string representing the attribute default * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if * none of these applies. * @param value A string representing the attribute's default value, * or null if there is none. * @throws SAXException The application may raise an exception. */ public void attributeDecl( String eName, String aName, String type, String valueDefault, String value) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#attributeDecl: " + eName + ", " + aName + ", etc..."); if (null != m_declHandler) { m_declHandler.attributeDecl(eName, aName, type, valueDefault, value); } } /** * Report an internal entity declaration. * *

        Only the effective (first) declaration for each entity * will be reported.

        * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param value The replacement text of the entity. * @throws SAXException The application may raise an exception. * @see #externalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void internalEntityDecl(String name, String value) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#internalEntityDecl: " + name + ", " + value); if (null != m_declHandler) { m_declHandler.internalEntityDecl(name, value); } } /** * Report a parsed external entity declaration. * *

        Only the effective (first) declaration for each entity * will be reported.

        * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param publicId The declared public identifier of the entity, or * null if none was declared. * @param systemId The declared system identifier of the entity. * @throws SAXException The application may raise an exception. * @see #internalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void externalEntityDecl( String name, String publicId, String systemId) throws SAXException { if (DEBUG) System.out.println("TransformerHandlerImpl#externalEntityDecl: " + name + ", " + publicId + ", " + systemId); if (null != m_declHandler) { m_declHandler.externalEntityDecl(name, publicId, systemId); } } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// /** Set to true for diagnostics output. */ private static boolean DEBUG = false; /** * The transformer this will use to transform a * source tree into a result tree. */ private TransformerImpl m_transformer; /** The system ID to use as a base for relative URLs. */ private String m_baseSystemID; /** The result for the transformation. */ private Result m_result = null; /** The locator for this TransformerHandler. */ private Locator m_locator = null; /** The entity resolver to aggregate to. */ private EntityResolver m_entityResolver = null; /** The DTD handler to aggregate to. */ private DTDHandler m_dtdHandler = null; /** The content handler to aggregate to. */ private ContentHandler m_contentHandler = null; /** The error handler to aggregate to. */ private ErrorHandler m_errorHandler = null; /** The lexical handler to aggregate to. */ private LexicalHandler m_lexicalHandler = null; /** The decl handler to aggregate to. */ private DeclHandler m_declHandler = null; /** The Document Table Instance we are transforming. */ DTM m_dtm; } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/ClonerToResultTree.java0000644000175000017500000001660010721374032026155 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ClonerToResultTree.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import javax.xml.transform.TransformerException; import org.apache.xalan.serialize.SerializerUtils; import org.apache.xml.dtm.DTM; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.XMLString; /** * Class used to clone a node, possibly including its children to * a result tree. * @xsl.usage internal */ public class ClonerToResultTree { // /** // * Clone an element with or without children. // * TODO: Fix or figure out node clone failure! // * the error condition is severe enough to halt processing. // * // * @param node The node to clone // * @param shouldCloneAttributes Flag indicating whether to // * clone children attributes // * // * @throws TransformerException // */ // public void cloneToResultTree(int node, boolean shouldCloneAttributes) // throws TransformerException // { // // try // { // XPathContext xctxt = m_transformer.getXPathContext(); // DTM dtm = xctxt.getDTM(node); // // int type = dtm.getNodeType(node); // switch (type) // { // case DTM.TEXT_NODE : // dtm.dispatchCharactersEvents(node, m_rth, false); // break; // case DTM.DOCUMENT_FRAGMENT_NODE : // case DTM.DOCUMENT_NODE : // // // Can't clone a document, but refrain from throwing an error // // so that copy-of will work // break; // case DTM.ELEMENT_NODE : // { // Attributes atts; // // if (shouldCloneAttributes) // { // m_rth.addAttributes(node); // m_rth.processNSDecls(node, type, dtm); // } // // String ns = dtm.getNamespaceURI(node); // String localName = dtm.getLocalName(node); // // m_rth.startElement(ns, localName, dtm.getNodeNameX(node), null); // } // break; // case DTM.CDATA_SECTION_NODE : // m_rth.startCDATA(); // dtm.dispatchCharactersEvents(node, m_rth, false); // m_rth.endCDATA(); // break; // case DTM.ATTRIBUTE_NODE : // m_rth.addAttribute(node); // break; // case DTM.COMMENT_NODE : // XMLString xstr = dtm.getStringValue (node); // xstr.dispatchAsComment(m_rth); // break; // case DTM.ENTITY_REFERENCE_NODE : // m_rth.entityReference(dtm.getNodeNameX(node)); // break; // case DTM.PROCESSING_INSTRUCTION_NODE : // { // // %REVIEW% Is the node name the same as the "target"? // m_rth.processingInstruction(dtm.getNodeNameX(node), // dtm.getNodeValue(node)); // } // break; // default : // //"Can not create item in result tree: "+node.getNodeName()); // m_transformer.getMsgMgr().error(null, // XSLTErrorResources.ER_CANT_CREATE_ITEM, // new Object[]{ dtm.getNodeName(node) }); // } // } // catch(org.xml.sax.SAXException se) // { // throw new TransformerException(se); // } // } // end cloneToResultTree function /** * Clone an element with or without children. * TODO: Fix or figure out node clone failure! * the error condition is severe enough to halt processing. * * @param node The node to clone * @param shouldCloneAttributes Flag indicating whether to * clone children attributes * * @throws TransformerException */ public static void cloneToResultTree(int node, int nodeType, DTM dtm, SerializationHandler rth, boolean shouldCloneAttributes) throws TransformerException { try { switch (nodeType) { case DTM.TEXT_NODE : dtm.dispatchCharactersEvents(node, rth, false); break; case DTM.DOCUMENT_FRAGMENT_NODE : case DTM.DOCUMENT_NODE : // Can't clone a document, but refrain from throwing an error // so that copy-of will work break; case DTM.ELEMENT_NODE : { // Note: SAX apparently expects "no namespace" to be // represented as "" rather than null. String ns = dtm.getNamespaceURI(node); if (ns==null) ns=""; String localName = dtm.getLocalName(node); // rth.startElement(ns, localName, dtm.getNodeNameX(node), null); // don't call a real SAX startElement (as commented out above), // call a SAX-like startElement, to be able to add attributes after this call rth.startElement(ns, localName, dtm.getNodeNameX(node)); // If outputting attrs as separate events, they must // _follow_ the startElement event. (Think of the // xsl:attribute directive.) if (shouldCloneAttributes) { SerializerUtils.addAttributes(rth, node); SerializerUtils.processNSDecls(rth, node, nodeType, dtm); } } break; case DTM.CDATA_SECTION_NODE : rth.startCDATA(); dtm.dispatchCharactersEvents(node, rth, false); rth.endCDATA(); break; case DTM.ATTRIBUTE_NODE : SerializerUtils.addAttribute(rth, node); break; case DTM.NAMESPACE_NODE: // %REVIEW% Normally, these should have been handled with element. // It's possible that someone may write a stylesheet that tries to // clone them explicitly. If so, we need the equivalent of // rth.addAttribute(). SerializerUtils.processNSDecls(rth,node,DTM.NAMESPACE_NODE,dtm); break; case DTM.COMMENT_NODE : XMLString xstr = dtm.getStringValue (node); xstr.dispatchAsComment(rth); break; case DTM.ENTITY_REFERENCE_NODE : rth.entityReference(dtm.getNodeNameX(node)); break; case DTM.PROCESSING_INSTRUCTION_NODE : { // %REVIEW% Is the node name the same as the "target"? rth.processingInstruction(dtm.getNodeNameX(node), dtm.getNodeValue(node)); } break; default : //"Can not create item in result tree: "+node.getNodeName()); throw new TransformerException( "Can't clone node: "+dtm.getNodeName(node)); } } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } } // end cloneToResultTree function } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformSnapshotImpl.java0000644000175000017500000002024510721374030026724 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformSnapshotImpl.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Enumeration; import java.util.Stack; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.BoolStack; import org.apache.xml.utils.IntStack; import org.apache.xml.utils.NamespaceSupport2; import org.apache.xml.utils.NodeVector; import org.apache.xml.utils.ObjectStack; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.xml.sax.helpers.NamespaceSupport; import org.apache.xml.serializer.NamespaceMappings; import org.apache.xml.serializer.SerializationHandler; /** * This class holds a "snapshot" of it's current transformer state, * which can later be restored. * * This only saves state which can change over the course of the side-effect-free * (i.e. no extensions that call setURIResolver, etc.). * * @deprecated It doesn't look like this code, which is for tooling, has * functioned propery for a while, so it doesn't look like it is being used. */ class TransformSnapshotImpl implements TransformSnapshot { /** * The stack of Variable stack frames. */ private VariableStack m_variableStacks; /** * The stack of current node objects. * Not to be confused with the current node list. */ private IntStack m_currentNodes; /** A stack of the current sub-expression nodes. */ private IntStack m_currentExpressionNodes; /** * The current context node lists stack. */ private Stack m_contextNodeLists; /** * The current context node list. */ private DTMIterator m_contextNodeList; /** * Stack of AxesIterators. */ private Stack m_axesIteratorStack; /** * Is > 0 when we're processing a for-each. */ private BoolStack m_currentTemplateRuleIsNull; /** * A node vector used as a stack to track the current * ElemTemplateElement. Needed for the * org.apache.xalan.transformer.TransformState interface, * so a tool can discover the calling template. */ private ObjectStack m_currentTemplateElements; /** * A node vector used as a stack to track the current * ElemTemplate that was matched, as well as the node that * was matched. Needed for the * org.apache.xalan.transformer.TransformState interface, * so a tool can discover the matched template, and matched * node. */ private Stack m_currentMatchTemplates; /** * A node vector used as a stack to track the current * ElemTemplate that was matched, as well as the node that * was matched. Needed for the * org.apache.xalan.transformer.TransformState interface, * so a tool can discover the matched template, and matched * node. */ private NodeVector m_currentMatchNodes; /** * The table of counters for xsl:number support. * @see ElemNumber */ private CountersTable m_countersTable; /** * Stack for the purposes of flagging infinite recursion with * attribute sets. */ private Stack m_attrSetStack; /** Indicate whether a namespace context was pushed */ boolean m_nsContextPushed; /** * Use the SAX2 helper class to track result namespaces. */ private NamespaceMappings m_nsSupport; /** The number of events queued */ // int m_eventCount; /** * Constructor TransformSnapshotImpl * Take a snapshot of the currently executing context. * * @param transformer Non null transformer instance * @deprecated It doesn't look like this code, which is for tooling, has * functioned propery for a while, so it doesn't look like it is being used. */ TransformSnapshotImpl(TransformerImpl transformer) { try { // Are all these clones deep enough? SerializationHandler rtf = transformer.getResultTreeHandler(); { // save serializer fields m_nsSupport = (NamespaceMappings)rtf.getNamespaceMappings().clone(); // Do other fields need to be saved/restored? } XPathContext xpc = transformer.getXPathContext(); m_variableStacks = (VariableStack) xpc.getVarStack().clone(); m_currentNodes = (IntStack) xpc.getCurrentNodeStack().clone(); m_currentExpressionNodes = (IntStack) xpc.getCurrentExpressionNodeStack().clone(); m_contextNodeLists = (Stack) xpc.getContextNodeListsStack().clone(); if (!m_contextNodeLists.empty()) m_contextNodeList = (DTMIterator) xpc.getContextNodeList().clone(); m_axesIteratorStack = (Stack) xpc.getAxesIteratorStackStacks().clone(); m_currentTemplateRuleIsNull = (BoolStack) transformer.m_currentTemplateRuleIsNull.clone(); m_currentTemplateElements = (ObjectStack) transformer.m_currentTemplateElements.clone(); m_currentMatchTemplates = (Stack) transformer.m_currentMatchTemplates.clone(); m_currentMatchNodes = (NodeVector) transformer.m_currentMatchedNodes.clone(); m_countersTable = (CountersTable) transformer.getCountersTable().clone(); if (transformer.m_attrSetStack != null) m_attrSetStack = (Stack) transformer.m_attrSetStack.clone(); } catch (CloneNotSupportedException cnse) { throw new org.apache.xml.utils.WrappedRuntimeException(cnse); } } /** * This will reset the stylesheet to a given execution context * based on some previously taken snapshot where we can then start execution * * @param transformer Non null transformer instance * * @deprecated It doesn't look like this code, which is for tooling, has * functioned propery for a while, so it doesn't look like it is being used. */ void apply(TransformerImpl transformer) { try { // Are all these clones deep enough? SerializationHandler rtf = transformer.getResultTreeHandler(); if (rtf != null) { // restore serializer fields rtf.setNamespaceMappings((NamespaceMappings)m_nsSupport.clone()); } XPathContext xpc = transformer.getXPathContext(); xpc.setVarStack((VariableStack) m_variableStacks.clone()); xpc.setCurrentNodeStack((IntStack) m_currentNodes.clone()); xpc.setCurrentExpressionNodeStack( (IntStack) m_currentExpressionNodes.clone()); xpc.setContextNodeListsStack((Stack) m_contextNodeLists.clone()); if (m_contextNodeList != null) xpc.pushContextNodeList((DTMIterator) m_contextNodeList.clone()); xpc.setAxesIteratorStackStacks((Stack) m_axesIteratorStack.clone()); transformer.m_currentTemplateRuleIsNull = (BoolStack) m_currentTemplateRuleIsNull.clone(); transformer.m_currentTemplateElements = (ObjectStack) m_currentTemplateElements.clone(); transformer.m_currentMatchTemplates = (Stack) m_currentMatchTemplates.clone(); transformer.m_currentMatchedNodes = (NodeVector) m_currentMatchNodes.clone(); transformer.m_countersTable = (CountersTable) m_countersTable.clone(); if (m_attrSetStack != null) transformer.m_attrSetStack = (Stack) m_attrSetStack.clone(); } catch (CloneNotSupportedException cnse) { throw new org.apache.xml.utils.WrappedRuntimeException(cnse); } } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformerImpl.java0000644000175000017500000033260410721374033025543 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerImpl.java 475979 2006-11-16 23:32:48Z minchau $ */ package org.apache.xalan.transformer; import java.io.IOException; import java.io.StringWriter; import java.util.Enumeration; import java.util.Properties; import java.util.Stack; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.SourceLocator; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.extensions.ExtensionsTable; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.serializer.Method; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xalan.templates.AVT; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemAttributeSet; import org.apache.xalan.templates.ElemForEach; import org.apache.xalan.templates.ElemSort; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemTextLiteral; import org.apache.xalan.templates.ElemVariable; import org.apache.xalan.templates.OutputProperties; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.StylesheetComposed; import org.apache.xalan.templates.StylesheetRoot; import org.apache.xalan.templates.XUnresolvedVariable; import org.apache.xalan.trace.GenerateEvent; import org.apache.xalan.trace.TraceManager; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.serializer.ToSAXHandler; import org.apache.xml.serializer.ToTextStream; import org.apache.xml.serializer.ToXMLSAXHandler; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.BoolStack; import org.apache.xml.utils.DOMBuilder; import org.apache.xml.utils.NodeVector; import org.apache.xml.utils.ObjectPool; import org.apache.xml.utils.ObjectStack; import org.apache.xml.utils.QName; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xml.utils.ThreadControllerWrapper; import org.apache.xpath.Arg; import org.apache.xpath.ExtensionsProvider; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.objects.XObject; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; /** * This class implements the * {@link javax.xml.transform.Transformer} interface, and is the core * representation of the transformation execution.

        * @xsl.usage advanced */ public class TransformerImpl extends Transformer implements Runnable, DTMWSFilter, ExtensionsProvider, org.apache.xml.serializer.SerializerTrace { // Synch object to gaurd against setting values from the TrAX interface // or reentry while the transform is going on. /** NEEDSDOC Field m_reentryGuard */ private Boolean m_reentryGuard = new Boolean(true); /** * This is null unless we own the stream. */ private java.io.FileOutputStream m_outputStream = null; /** * True if the parser events should be on the main thread, * false if not. Experemental. Can not be set right now. */ private boolean m_parserEventsOnMain = true; /** The thread that the transformer is running on. */ private Thread m_transformThread; /** The base URL of the source tree. */ private String m_urlOfSource = null; /** The Result object at the start of the transform, if any. */ private Result m_outputTarget = null; /** * The output format object set by the user. May be null. */ private OutputProperties m_outputFormat; /** * The content handler for the source input tree. */ ContentHandler m_inputContentHandler; /** * The content handler for the result tree. */ private ContentHandler m_outputContentHandler = null; // /* // * Use member variable to store param variables as they're // * being created, use member variable so we don't // * have to create a new vector every time. // */ // private Vector m_newVars = new Vector(); /** The JAXP Document Builder, mainly to create Result Tree Fragments. */ DocumentBuilder m_docBuilder = null; /** * A pool of ResultTreeHandlers, for serialization of a subtree to text. * Please note that each of these also holds onto a Text Serializer. */ private ObjectPool m_textResultHandlerObjectPool = new ObjectPool(ToTextStream.class); /** * Related to m_textResultHandlerObjectPool, this is a pool of * StringWriters, which are passed to the Text Serializers. * (I'm not sure if this is really needed any more. -sb) */ private ObjectPool m_stringWriterObjectPool = new ObjectPool(StringWriter.class); /** * A static text format object, which can be used over and * over to create the text serializers. */ private OutputProperties m_textformat = new OutputProperties(Method.TEXT); // Commenteded out in response to problem reported by // Nicola Brown // /** // * Flag to let us know if an exception should be reported inside the // * postExceptionFromThread method. This is needed if the transform is // * being generated from SAX events, and thus there is no central place // * to report the exception from. (An exception is usually picked up in // * the main thread from the transform thread in {@link #transform(Source source)} // * from {@link #getExceptionThrown()}. ) // */ // private boolean m_reportInPostExceptionFromThread = false; /** * A node vector used as a stack to track the current * ElemTemplateElement. Needed for the * org.apache.xalan.transformer.TransformState interface, * so a tool can discover the calling template. Note the use of an array * for this limits the recursion depth to 4K. */ ObjectStack m_currentTemplateElements = new ObjectStack(XPathContext.RECURSIONLIMIT); /** The top of the currentTemplateElements stack. */ //int m_currentTemplateElementsTop = 0; /** * A node vector used as a stack to track the current * ElemTemplate that was matched. * Needed for the * org.apache.xalan.transformer.TransformState interface, * so a tool can discover the matched template */ Stack m_currentMatchTemplates = new Stack(); /** * A node vector used as a stack to track the current * node that was matched. * Needed for the * org.apache.xalan.transformer.TransformState interface, * so a tool can discover the matched * node. */ NodeVector m_currentMatchedNodes = new NodeVector(); /** * The root of a linked set of stylesheets. */ private StylesheetRoot m_stylesheetRoot = null; /** * If this is set to true, do not warn about pattern * match conflicts. */ private boolean m_quietConflictWarnings = true; /** * The liason to the XML parser, so the XSL processor * can handle included files, and the like, and do the * initial parse of the XSL document. */ private XPathContext m_xcontext; /** * Object to guard agains infinite recursion when * doing queries. */ private StackGuard m_stackGuard; /** * Output handler to bottleneck SAX events. */ private SerializationHandler m_serializationHandler; /** The key manager, which manages xsl:keys. */ private KeyManager m_keyManager = new KeyManager(); /** * Stack for the purposes of flagging infinite recursion with * attribute sets. */ Stack m_attrSetStack = null; /** * The table of counters for xsl:number support. * @see ElemNumber */ CountersTable m_countersTable = null; /** * Is > 0 when we're processing a for-each. */ BoolStack m_currentTemplateRuleIsNull = new BoolStack(); /** * Keeps track of the result delivered by any EXSLT func:result * instruction that has been executed for the currently active EXSLT * func:function */ ObjectStack m_currentFuncResult = new ObjectStack(); /** * The message manager, which manages error messages, warning * messages, and other types of message events. */ private MsgMgr m_msgMgr; /** * The flag for the setting of the optimize feature; * This flag should have the same value as the FEATURE_OPTIMIZE feature * which is set by the TransformerFactory.setAttribut() method before a * Transformer is created */ private boolean m_optimizer = true; /** * The flag for the setting of the incremental feature; * This flag should have the same value as the FEATURE_INCREMENTAL feature * which is set by the TransformerFactory.setAttribut() method before a * Transformer is created */ private boolean m_incremental = false; /** * The flag for the setting of the source_location feature; * This flag should have the same value as the FEATURE_SOURCE_LOCATION feature * which is set by the TransformerFactory.setAttribut() method before a * Transformer is created */ private boolean m_source_location = false; /** * This is a compile-time flag to turn off calling * of trace listeners. Set this to false for optimization purposes. */ private boolean m_debug = false; /** * The SAX error handler, where errors and warnings are sent. */ private ErrorListener m_errorHandler = new org.apache.xml.utils.DefaultErrorHandler(false); /** * The trace manager. */ private TraceManager m_traceManager = new TraceManager(this); /** * If the transform thread throws an exception, the exception needs to * be stashed away so that the main thread can pass it on to the * client. */ private Exception m_exceptionThrown = null; /** * The InputSource for the source tree, which is needed if the * parse thread is not the main thread, in order for the parse * thread's run method to get to the input source. * (Delete this if reversing threads is outlawed. -sb) */ private Source m_xmlSource; /** * This is needed for support of setSourceTreeDocForThread(Node doc), * which must be called in order for the transform thread's run * method to obtain the root of the source tree to be transformed. */ private int m_doc; /** * If the the transform is on the secondary thread, we * need to know when it is done, so we can return. */ private boolean m_isTransformDone = false; /** Flag to to tell if the tranformer needs to be reset. */ private boolean m_hasBeenReset = false; /** NEEDSDOC Field m_shouldReset */ private boolean m_shouldReset = true; /** * NEEDSDOC Method setShouldReset * * * NEEDSDOC @param shouldReset */ public void setShouldReset(boolean shouldReset) { m_shouldReset = shouldReset; } /** * A stack of current template modes. */ private Stack m_modes = new Stack(); //========================================================== // SECTION: Constructor //========================================================== /** * Construct a TransformerImpl. * * @param stylesheet The root of the stylesheet tree. */ public TransformerImpl(StylesheetRoot stylesheet) // throws javax.xml.transform.TransformerException { m_optimizer = stylesheet.getOptimizer(); m_incremental = stylesheet.getIncremental(); m_source_location = stylesheet.getSource_location(); setStylesheet(stylesheet); XPathContext xPath = new XPathContext(this); xPath.setIncremental(m_incremental); xPath.getDTMManager().setIncremental(m_incremental); xPath.setSource_location(m_source_location); xPath.getDTMManager().setSource_location(m_source_location); if (stylesheet.isSecureProcessing()) xPath.setSecureProcessing(true); setXPathContext(xPath); getXPathContext().setNamespaceContext(stylesheet); m_stackGuard = new StackGuard(this); } // ================ ExtensionsTable =================== /** * The table of ExtensionHandlers. */ private ExtensionsTable m_extensionsTable = null; /** * Get the extensions table object. * * @return The extensions table. */ public ExtensionsTable getExtensionsTable() { return m_extensionsTable; } /** * If the stylesheet contains extensions, set the extensions table object. * * * @param sroot The stylesheet. * @throws javax.xml.transform.TransformerException */ void setExtensionsTable(StylesheetRoot sroot) throws javax.xml.transform.TransformerException { try { if (sroot.getExtensions() != null) m_extensionsTable = new ExtensionsTable(sroot); } catch (javax.xml.transform.TransformerException te) {te.printStackTrace();} } //== Implementation of the XPath ExtensionsProvider interface. public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { return getExtensionsTable().functionAvailable(ns, funcName); } public boolean elementAvailable(String ns, String elemName) throws javax.xml.transform.TransformerException { return getExtensionsTable().elementAvailable(ns, elemName); } public Object extFunction(String ns, String funcName, Vector argVec, Object methodKey) throws javax.xml.transform.TransformerException {//System.out.println("TransImpl.extFunction() " + ns + " " + funcName +" " + getExtensionsTable()); return getExtensionsTable().extFunction(ns, funcName, argVec, methodKey, getXPathContext().getExpressionContext()); } public Object extFunction(FuncExtFunction extFunction, Vector argVec) throws javax.xml.transform.TransformerException { return getExtensionsTable().extFunction(extFunction, argVec, getXPathContext().getExpressionContext()); } //========================= /** * Reset the state. This needs to be called after a process() call * is invoked, if the processor is to be used again. */ public void reset() { if (!m_hasBeenReset && m_shouldReset) { m_hasBeenReset = true; if (this.m_outputStream != null) { try { m_outputStream.close(); } catch (java.io.IOException ioe){} } m_outputStream = null; // I need to look more carefully at which of these really // needs to be reset. m_countersTable = null; m_xcontext.reset(); m_xcontext.getVarStack().reset(); resetUserParameters(); m_currentTemplateElements.removeAllElements(); m_currentMatchTemplates.removeAllElements(); m_currentMatchedNodes.removeAllElements(); m_serializationHandler = null; m_outputTarget = null; m_keyManager = new KeyManager(); m_attrSetStack = null; m_countersTable = null; m_currentTemplateRuleIsNull = new BoolStack(); m_xmlSource = null; m_doc = DTM.NULL; m_isTransformDone = false; m_transformThread = null; // m_inputContentHandler = null; // For now, reset the document cache each time. m_xcontext.getSourceTreeManager().reset(); } // m_reportInPostExceptionFromThread = false; } /** * getProperty returns the current setting of the * property described by the property argument. * * %REVIEW% Obsolete now that source_location is handled in the TransformerFactory? * * @param property a String value * @return a boolean value */ public boolean getProperty(String property) { return false; } /** * Set a runtime property for this TransformerImpl. * * %REVIEW% Obsolete now that source_location is handled in the TransformerFactory? * * @param property a String value * @param value an Object value */ public void setProperty(String property, Object value) { } // ========= Transformer Interface Implementation ========== /** * Get true if the parser events should be on the main thread, * false if not. Experimental. Can not be set right now. * * @return true if the parser events should be on the main thread, * false if not. * @xsl.usage experimental */ public boolean isParserEventsOnMain() { return m_parserEventsOnMain; } /** * Get the thread that the transform process is on. * * @return The thread that the transform process is on, or null. * @xsl.usage internal */ public Thread getTransformThread() { return m_transformThread; } /** * Get the thread that the transform process is on. * * @param t The transform thread, may be null. * @xsl.usage internal */ public void setTransformThread(Thread t) { m_transformThread = t; } /** NEEDSDOC Field m_hasTransformThreadErrorCatcher */ private boolean m_hasTransformThreadErrorCatcher = false; /** * Return true if the transform was initiated from the transform method, * otherwise it was probably done from a pure parse events. * * NEEDSDOC ($objectName$) @return */ public boolean hasTransformThreadErrorCatcher() { return m_hasTransformThreadErrorCatcher; } /** * Process the source tree to SAX parse events. * @param source The input for the source tree. * * @throws TransformerException */ public void transform(Source source) throws TransformerException { transform(source, true); } /** * Process the source tree to SAX parse events. * @param source The input for the source tree. * @param shouldRelease Flag indicating whether to release DTMManager. * * @throws TransformerException */ public void transform(Source source, boolean shouldRelease) throws TransformerException { try { // Patch for bugzilla #13863. If we don't reset the namespaceContext // then we will get a NullPointerException if transformer is reused // (for stylesheets that use xsl:key). Not sure if this should go // here or in reset(). -is if(getXPathContext().getNamespaceContext() == null){ getXPathContext().setNamespaceContext(getStylesheet()); } String base = source.getSystemId(); // If no systemID of the source, use the base of the stylesheet. if(null == base) { base = m_stylesheetRoot.getBaseIdentifier(); } // As a last resort, use the current user dir. if(null == base) { String currentDir = ""; try { currentDir = System.getProperty("user.dir"); } catch (SecurityException se) {}// user.dir not accessible from applet if (currentDir.startsWith(java.io.File.separator)) base = "file://" + currentDir; else base = "file:///" + currentDir; base = base + java.io.File.separatorChar + source.getClass().getName(); } setBaseURLOfSource(base); DTMManager mgr = m_xcontext.getDTMManager(); /* * According to JAXP1.2, new SAXSource()/StreamSource() * should create an empty input tree, with a default root node. * new DOMSource()creates an empty document using DocumentBuilder. * newDocument(); Use DocumentBuilder.newDocument() for all 3 situations, * since there is no clear spec. how to create an empty tree when * both SAXSource() and StreamSource() are used. */ if ((source instanceof StreamSource && source.getSystemId()==null && ((StreamSource)source).getInputStream()==null && ((StreamSource)source).getReader()==null)|| (source instanceof SAXSource && ((SAXSource)source).getInputSource()==null && ((SAXSource)source).getXMLReader()==null )|| (source instanceof DOMSource && ((DOMSource)source).getNode()==null)){ try { DocumentBuilderFactory builderF = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderF.newDocumentBuilder(); String systemID = source.getSystemId(); source = new DOMSource(builder.newDocument()); // Copy system ID from original, empty Source to new Source if (systemID != null) { source.setSystemId(systemID); } } catch (ParserConfigurationException e) { fatalError(e); } } DTM dtm = mgr.getDTM(source, false, this, true, true); dtm.setDocumentBaseURI(base); boolean hardDelete = true; // %REVIEW% I have to think about this. -sb try { // NOTE: This will work because this is _NOT_ a shared DTM, and thus has // only a single Document node. If it could ever be an RTF or other // shared DTM, look at dtm.getDocumentRoot(nodeHandle). this.transformNode(dtm.getDocument()); } finally { if (shouldRelease) mgr.release(dtm, hardDelete); } // Kick off the parse. When the ContentHandler gets // the startDocument event, it will call transformNode( node ). // reader.parse( xmlSource ); // This has to be done to catch exceptions thrown from // the transform thread spawned by the STree handler. Exception e = getExceptionThrown(); if (null != e) { if (e instanceof javax.xml.transform.TransformerException) { throw (javax.xml.transform.TransformerException) e; } else if (e instanceof org.apache.xml.utils.WrappedRuntimeException) { fatalError( ((org.apache.xml.utils.WrappedRuntimeException) e).getException()); } else { throw new javax.xml.transform.TransformerException(e); } } else if (null != m_serializationHandler) { m_serializationHandler.endDocument(); } } catch (org.apache.xml.utils.WrappedRuntimeException wre) { Throwable throwable = wre.getException(); while (throwable instanceof org.apache.xml.utils.WrappedRuntimeException) { throwable = ((org.apache.xml.utils.WrappedRuntimeException) throwable).getException(); } fatalError(throwable); } // Patch attributed to David Eisenberg catch (org.xml.sax.SAXParseException spe) { fatalError(spe); } catch (org.xml.sax.SAXException se) { m_errorHandler.fatalError(new TransformerException(se)); } finally { m_hasTransformThreadErrorCatcher = false; // This looks to be redundent to the one done in TransformNode. reset(); } } private void fatalError(Throwable throwable) throws TransformerException { if (throwable instanceof org.xml.sax.SAXParseException) m_errorHandler.fatalError(new TransformerException(throwable.getMessage(),new SAXSourceLocator((org.xml.sax.SAXParseException)throwable))); else m_errorHandler.fatalError(new TransformerException(throwable)); } /** * Get the base URL of the source. * * @return The base URL of the source tree, or null. */ public String getBaseURLOfSource() { return m_urlOfSource; } /** * Get the base URL of the source. * * * NEEDSDOC @param base * @return The base URL of the source tree, or null. */ public void setBaseURLOfSource(String base) { m_urlOfSource = base; } /** * Get the original output target. * * @return The Result object used to kick of the transform or null. */ public Result getOutputTarget() { return m_outputTarget; } /** * Set the original output target. This is useful when using a SAX transform and * supplying a ContentHandler or when the URI of the output target should * not be the same as the systemID of the original output target. * * * NEEDSDOC @param outputTarget */ public void setOutputTarget(Result outputTarget) { m_outputTarget = outputTarget; } /** * Get an output property that is in effect for the * transformation. The property specified may be a property * that was set with setOutputProperty, or it may be a * property specified in the stylesheet. * * NEEDSDOC @param qnameString * * @return The string value of the output property, or null * if no property was found. * * @throws IllegalArgumentException If the property is not supported. * * @see javax.xml.transform.OutputKeys */ public String getOutputProperty(String qnameString) throws IllegalArgumentException { String value = null; OutputProperties props = getOutputFormat(); value = props.getProperty(qnameString); if (null == value) { if (!OutputProperties.isLegalPropertyKey(qnameString)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{qnameString})); //"output property not recognized: " //+ qnameString); } return value; } /** * Get the value of a property, without using the default properties. This * can be used to test if a property has been explicitly set by the stylesheet * or user. * * NEEDSDOC @param qnameString * * @return The value of the property, or null if not found. * * @throws IllegalArgumentException If the property is not supported, * and is not namespaced. */ public String getOutputPropertyNoDefault(String qnameString) throws IllegalArgumentException { String value = null; OutputProperties props = getOutputFormat(); value = (String) props.getProperties().get(qnameString); if (null == value) { if (!OutputProperties.isLegalPropertyKey(qnameString)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{qnameString})); //"output property not recognized: " // + qnameString); } return value; } /** * This method is used to set or override the value * of the effective xsl:output attribute values * specified in the stylesheet. *

        * The recognized standard output properties are: *

          *
        • cdata-section-elements *
        • doctype-system *
        • doctype-public *
        • indent *
        • media-type *
        • method *
        • omit-xml-declaration *
        • standalone *
        • version *
        *

        * For example: *

           *   tran.setOutputProperty("standalone", "yes");
           * 
        *

        * In the case of the cdata-section-elements property, * the value should be a whitespace separated list of * element names. The element name is the local name * of the element, if it is in no namespace, or, the URI * in braces followed immediately by the local name * if the element is in that namespace. For example: *

           * tran.setOutputProperty(
           *   "cdata-section-elements", 
           *   "elem1 {http://example.uri}elem2 elem3");
           * 
        *

        * The recognized Xalan extension elements are: *

          *
        • content-handler *
        • entities *
        • indent-amount *
        • line-separator *
        • omit-meta-tag *
        • use-url-escaping *
        *

        * These must be in the extension namespace of * "http://xml.apache.org/xalan". This is accomplished * by putting the namespace URI in braces before the * property name, for example: *

           *   tran.setOutputProperty(
           *     "{http://xml.apache.org/xalan}line-separator" ,
           *     "\n");
           * 
        * * @param name The property name. * @param value The requested value for the property. * @throws IllegalArgumentException if the property name is not legal. */ public void setOutputProperty(String name, String value) throws IllegalArgumentException { synchronized (m_reentryGuard) { // Get the output format that was set by the user, otherwise get the // output format from the stylesheet. if (null == m_outputFormat) { m_outputFormat = (OutputProperties) getStylesheet().getOutputComposed().clone(); } if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " //+ name); m_outputFormat.setProperty(name, value); } } /** * Set the output properties for the transformation. These * properties will override properties set in the templates * with xsl:output. * *

        If argument to this function is null, any properties * previously set will be removed.

        * * @param oformat A set of output properties that will be * used to override any of the same properties in effect * for the transformation. * * @see javax.xml.transform.OutputKeys * @see java.util.Properties * * @throws IllegalArgumentException if any of the argument keys are not * recognized and are not namespace qualified. */ public void setOutputProperties(Properties oformat) throws IllegalArgumentException { synchronized (m_reentryGuard) { if (null != oformat) { // See if an *explicit* method was set. String method = (String) oformat.get(OutputKeys.METHOD); if (null != method) m_outputFormat = new OutputProperties(method); else if(m_outputFormat==null) m_outputFormat = new OutputProperties(); m_outputFormat.copyFrom(oformat); // copyFrom does not set properties that have been already set, so // this must be called after, which is a bit in the reverse from // what one might think. m_outputFormat.copyFrom(m_stylesheetRoot.getOutputProperties()); } else { // if oformat is null JAXP says that any props previously set are removed // and we are to revert back to those in the templates object (i.e. Stylesheet). m_outputFormat = null; } } } /** * Get a copy of the output properties for the transformation. These * properties will override properties set in the templates * with xsl:output. * *

        Note that mutation of the Properties object returned will not * effect the properties that the transformation contains.

        * * @return A copy of the set of output properties in effect * for the next transformation. * * NEEDSDOC ($objectName$) @return */ public Properties getOutputProperties() { return (Properties) getOutputFormat().getProperties().clone(); } /** * Create a result ContentHandler from a Result object, based * on the current OutputProperties. * * @param outputTarget Where the transform result should go, * should not be null. * * @return A valid ContentHandler that will create the * result tree when it is fed SAX events. * * @throws TransformerException */ public SerializationHandler createSerializationHandler(Result outputTarget) throws TransformerException { SerializationHandler xoh = createSerializationHandler(outputTarget, getOutputFormat()); return xoh; } /** * Create a ContentHandler from a Result object and an OutputProperties. * * @param outputTarget Where the transform result should go, * should not be null. * @param format The OutputProperties object that will contain * instructions on how to serialize the output. * * @return A valid ContentHandler that will create the * result tree when it is fed SAX events. * * @throws TransformerException */ public SerializationHandler createSerializationHandler( Result outputTarget, OutputProperties format) throws TransformerException { SerializationHandler xoh; // If the Result object contains a Node, then create // a ContentHandler that will add nodes to the input node. org.w3c.dom.Node outputNode = null; if (outputTarget instanceof DOMResult) { outputNode = ((DOMResult) outputTarget).getNode(); org.w3c.dom.Node nextSibling = ((DOMResult)outputTarget).getNextSibling(); org.w3c.dom.Document doc; short type; if (null != outputNode) { type = outputNode.getNodeType(); doc = (org.w3c.dom.Node.DOCUMENT_NODE == type) ? (org.w3c.dom.Document) outputNode : outputNode.getOwnerDocument(); } else { boolean isSecureProcessing = m_stylesheetRoot.isSecureProcessing(); doc = org.apache.xml.utils.DOMHelper.createDocument(isSecureProcessing); outputNode = doc; type = outputNode.getNodeType(); ((DOMResult) outputTarget).setNode(outputNode); } DOMBuilder handler = (org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE == type) ? new DOMBuilder(doc, (org.w3c.dom.DocumentFragment) outputNode) : new DOMBuilder(doc, outputNode); if (nextSibling != null) handler.setNextSibling(nextSibling); String encoding = format.getProperty(OutputKeys.ENCODING); xoh = new ToXMLSAXHandler(handler, (LexicalHandler)handler, encoding); } else if (outputTarget instanceof SAXResult) { ContentHandler handler = ((SAXResult) outputTarget).getHandler(); if (null == handler) throw new IllegalArgumentException( "handler can not be null for a SAXResult"); LexicalHandler lexHandler; if (handler instanceof LexicalHandler) lexHandler = (LexicalHandler) handler; else lexHandler = null; String encoding = format.getProperty(OutputKeys.ENCODING); String method = format.getProperty(OutputKeys.METHOD); ToXMLSAXHandler toXMLSAXHandler = new ToXMLSAXHandler(handler, lexHandler, encoding); toXMLSAXHandler.setShouldOutputNSAttr(false); xoh = toXMLSAXHandler; String publicID = format.getProperty(OutputKeys.DOCTYPE_PUBLIC); String systemID = format.getProperty(OutputKeys.DOCTYPE_SYSTEM); if (systemID != null) xoh.setDoctypeSystem(systemID); if (publicID != null) xoh.setDoctypePublic(publicID); if (handler instanceof TransformerClient) { XalanTransformState state = new XalanTransformState(); ((TransformerClient)handler).setTransformState(state); ((ToSAXHandler)xoh).setTransformState(state); } } // Otherwise, create a ContentHandler that will serialize the // result tree to either a stream or a writer. else if (outputTarget instanceof StreamResult) { StreamResult sresult = (StreamResult) outputTarget; try { SerializationHandler serializer = (SerializationHandler) SerializerFactory.getSerializer(format.getProperties()); if (null != sresult.getWriter()) serializer.setWriter(sresult.getWriter()); else if (null != sresult.getOutputStream()) serializer.setOutputStream(sresult.getOutputStream()); else if (null != sresult.getSystemId()) { String fileURL = sresult.getSystemId(); if (fileURL.startsWith("file:///")) { if (fileURL.substring(8).indexOf(":") >0) fileURL = fileURL.substring(8); else fileURL = fileURL.substring(7); } else if (fileURL.startsWith("file:/")) { if (fileURL.substring(6).indexOf(":") >0) fileURL = fileURL.substring(6); else fileURL = fileURL.substring(5); } m_outputStream = new java.io.FileOutputStream(fileURL); serializer.setOutputStream(m_outputStream); xoh = serializer; } else throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_OUTPUT_SPECIFIED, null)); //"No output specified!"); // handler = serializer.asContentHandler(); // this.setSerializer(serializer); xoh = serializer; } // catch (UnsupportedEncodingException uee) // { // throw new TransformerException(uee); // } catch (IOException ioe) { throw new TransformerException(ioe); } } else { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, new Object[]{outputTarget.getClass().getName()})); //"Can't transform to a Result of type " //+ outputTarget.getClass().getName() //+ "!"); } // before we forget, lets make the created handler hold a reference // to the current TransformImpl object xoh.setTransformer(this); SourceLocator srcLocator = getStylesheet(); xoh.setSourceLocator(srcLocator); return xoh; } /** * Process the source tree to the output result. * @param xmlSource The input for the source tree. * @param outputTarget The output source target. * * @throws TransformerException */ public void transform(Source xmlSource, Result outputTarget) throws TransformerException { transform(xmlSource, outputTarget, true); } /** * Process the source tree to the output result. * @param xmlSource The input for the source tree. * @param outputTarget The output source target. * @param shouldRelease Flag indicating whether to release DTMManager. * * @throws TransformerException */ public void transform(Source xmlSource, Result outputTarget, boolean shouldRelease) throws TransformerException { synchronized (m_reentryGuard) { SerializationHandler xoh = createSerializationHandler(outputTarget); this.setSerializationHandler(xoh); m_outputTarget = outputTarget; transform(xmlSource, shouldRelease); } } /** * Process the source node to the output result, if the * processor supports the "http://xml.org/trax/features/dom/input" * feature. * %REVIEW% Do we need a Node version of this? * @param node The input source node, which can be any valid DTM node. * @param outputTarget The output source target. * * @throws TransformerException */ public void transformNode(int node, Result outputTarget) throws TransformerException { SerializationHandler xoh = createSerializationHandler(outputTarget); this.setSerializationHandler(xoh); m_outputTarget = outputTarget; transformNode(node); } /** * Process the source node to the output result, if the * processor supports the "http://xml.org/trax/features/dom/input" * feature. * %REVIEW% Do we need a Node version of this? * @param node The input source node, which can be any valid DTM node. * * @throws TransformerException */ public void transformNode(int node) throws TransformerException { //dml setExtensionsTable(getStylesheet()); // Make sure we're not writing to the same output content handler. synchronized (m_serializationHandler) { m_hasBeenReset = false; XPathContext xctxt = getXPathContext(); DTM dtm = xctxt.getDTM(node); try { pushGlobalVars(node); // ========== // Give the top-level templates a chance to pass information into // the context (this is mainly for setting up tables for extensions). StylesheetRoot stylesheet = this.getStylesheet(); int n = stylesheet.getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = stylesheet.getGlobalImport(i); int includedCount = imported.getIncludeCountComposed(); for (int j = -1; j < includedCount; j++) { Stylesheet included = imported.getIncludeComposed(j); included.runtimeInit(this); for (ElemTemplateElement child = included.getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { child.runtimeInit(this); } } } // =========== // System.out.println("Calling applyTemplateToNode - "+Thread.currentThread().getName()); DTMIterator dtmIter = new org.apache.xpath.axes.SelfIteratorNoPredicate(); dtmIter.setRoot(node, xctxt); xctxt.pushContextNodeList(dtmIter); try { this.applyTemplateToNode(null, null, node); } finally { xctxt.popContextNodeList(); } // m_stylesheetRoot.getStartRule().execute(this); // System.out.println("Done with applyTemplateToNode - "+Thread.currentThread().getName()); if (null != m_serializationHandler) { m_serializationHandler.endDocument(); } } catch (Exception se) { // System.out.println(Thread.currentThread().getName()+" threw an exception! " // +se.getMessage()); // If an exception was thrown, we need to make sure that any waiting // handlers can terminate, which I guess is best done by sending // an endDocument. // SAXSourceLocator while(se instanceof org.apache.xml.utils.WrappedRuntimeException) { Exception e = ((org.apache.xml.utils.WrappedRuntimeException)se).getException(); if(null != e) se = e; } if (null != m_serializationHandler) { try { if(se instanceof org.xml.sax.SAXParseException) m_serializationHandler.fatalError((org.xml.sax.SAXParseException)se); else if(se instanceof TransformerException) { TransformerException te = ((TransformerException)se); SAXSourceLocator sl = new SAXSourceLocator( te.getLocator() ); m_serializationHandler.fatalError(new org.xml.sax.SAXParseException(te.getMessage(), sl, te)); } else { m_serializationHandler.fatalError(new org.xml.sax.SAXParseException(se.getMessage(), new SAXSourceLocator(), se)); } } catch (Exception e){} } if(se instanceof TransformerException) { m_errorHandler.fatalError((TransformerException)se); } else if(se instanceof org.xml.sax.SAXParseException) { m_errorHandler.fatalError(new TransformerException(se.getMessage(), new SAXSourceLocator((org.xml.sax.SAXParseException)se), se)); } else { m_errorHandler.fatalError(new TransformerException(se)); } } finally { this.reset(); } } } /** * Get a SAX2 ContentHandler for the input. * * @return A valid ContentHandler, which should never be null, as * long as getFeature("http://xml.org/trax/features/sax/input") * returns true. */ public ContentHandler getInputContentHandler() { return getInputContentHandler(false); } /** * Get a SAX2 ContentHandler for the input. * * @param doDocFrag true if a DocumentFragment should be created as * the root, rather than a Document. * * @return A valid ContentHandler, which should never be null, as * long as getFeature("http://xml.org/trax/features/sax/input") * returns true. */ public ContentHandler getInputContentHandler(boolean doDocFrag) { if (null == m_inputContentHandler) { // if(null == m_urlOfSource && null != m_stylesheetRoot) // m_urlOfSource = m_stylesheetRoot.getBaseIdentifier(); m_inputContentHandler = new TransformerHandlerImpl(this, doDocFrag, m_urlOfSource); } return m_inputContentHandler; } /** * Get a SAX2 DeclHandler for the input. * @return A valid DeclHandler, which should never be null, as * long as getFeature("http://xml.org/trax/features/sax/input") * returns true. */ public DeclHandler getInputDeclHandler() { if (m_inputContentHandler instanceof DeclHandler) return (DeclHandler) m_inputContentHandler; else return null; } /** * Get a SAX2 LexicalHandler for the input. * @return A valid LexicalHandler, which should never be null, as * long as getFeature("http://xml.org/trax/features/sax/input") * returns true. */ public LexicalHandler getInputLexicalHandler() { if (m_inputContentHandler instanceof LexicalHandler) return (LexicalHandler) m_inputContentHandler; else return null; } /** * Set the output properties for the transformation. These * properties will override properties set in the templates * with xsl:output. * * @param oformat A valid OutputProperties object (which will * not be mutated), or null. */ public void setOutputFormat(OutputProperties oformat) { m_outputFormat = oformat; } /** * Get the output properties used for the transformation. * * @return the output format that was set by the user, * otherwise the output format from the stylesheet. */ public OutputProperties getOutputFormat() { // Get the output format that was set by the user, otherwise get the // output format from the stylesheet. OutputProperties format = (null == m_outputFormat) ? getStylesheet().getOutputComposed() : m_outputFormat; return format; } /** * Set a parameter for the templates. * * @param name The name of the parameter. * @param namespace The namespace of the parameter. * @param value The value object. This can be any valid Java object * -- it's up to the processor to provide the proper * coersion to the object, or simply pass it on for use * in extensions. */ public void setParameter(String name, String namespace, Object value) { VariableStack varstack = getXPathContext().getVarStack(); QName qname = new QName(namespace, name); XObject xobject = XObject.create(value, getXPathContext()); StylesheetRoot sroot = m_stylesheetRoot; Vector vars = sroot.getVariablesAndParamsComposed(); int i = vars.size(); while (--i >= 0) { ElemVariable variable = (ElemVariable)vars.elementAt(i); if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && variable.getName().equals(qname)) { varstack.setGlobalVariable(i, xobject); } } } /** NEEDSDOC Field m_userParams */ Vector m_userParams; /** * Set a parameter for the transformation. * * @param name The name of the parameter, * which may have a namespace URI. * @param value The value object. This can be any valid Java object * -- it's up to the processor to provide the proper * coersion to the object, or simply pass it on for use * in extensions. */ public void setParameter(String name, Object value) { if (value == null) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_SET_PARAM_VALUE, new Object[]{name})); } StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); try { // The first string might be the namespace, or it might be // the local name, if the namespace is null. String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == m_userParams) m_userParams = new Vector(); if (null == s2) { replaceOrPushUserParam(new QName(s1), XObject.create(value, getXPathContext())); setParameter(s1, null, value); } else { replaceOrPushUserParam(new QName(s1, s2), XObject.create(value, getXPathContext())); setParameter(s2, s1, value); } } catch (java.util.NoSuchElementException nsee) { // Should throw some sort of an error. } } /** * NEEDSDOC Method replaceOrPushUserParam * * * NEEDSDOC @param qname * NEEDSDOC @param xval */ private void replaceOrPushUserParam(QName qname, XObject xval) { int n = m_userParams.size(); for (int i = n - 1; i >= 0; i--) { Arg arg = (Arg) m_userParams.elementAt(i); if (arg.getQName().equals(qname)) { m_userParams.setElementAt(new Arg(qname, xval, true), i); return; } } m_userParams.addElement(new Arg(qname, xval, true)); } /** * Get a parameter that was explicitly set with setParameter * or setParameters. * * * NEEDSDOC @param name * @return A parameter that has been set with setParameter * or setParameters, * *not* all the xsl:params on the stylesheet (which require * a transformation Source to be evaluated). */ public Object getParameter(String name) { try { // VariableStack varstack = getXPathContext().getVarStack(); // The first string might be the namespace, or it might be // the local name, if the namespace is null. QName qname = QName.getQNameFromString(name); if (null == m_userParams) return null; int n = m_userParams.size(); for (int i = n - 1; i >= 0; i--) { Arg arg = (Arg) m_userParams.elementAt(i); if (arg.getQName().equals(qname)) { return arg.getVal().object(); } } return null; } catch (java.util.NoSuchElementException nsee) { // Should throw some sort of an error. return null; } } /** * Reset parameters that the user specified for the transformation. * Called during transformer.reset() after we have cleared the * variable stack. We need to make sure that user params are * reset so that the transformer object can be reused. */ private void resetUserParameters() { try { if (null == m_userParams) return; int n = m_userParams.size(); for (int i = n - 1; i >= 0; i--) { Arg arg = (Arg) m_userParams.elementAt(i); QName name = arg.getQName(); // The first string might be the namespace, or it might be // the local name, if the namespace is null. String s1 = name.getNamespace(); String s2 = name.getLocalPart(); setParameter(s2, s1, arg.getVal().object()); } } catch (java.util.NoSuchElementException nsee) { // Should throw some sort of an error. } } /** * Set a bag of parameters for the transformation. Note that * these will not be additive, they will replace the existing * set of parameters. * * NEEDSDOC @param params */ public void setParameters(Properties params) { clearParameters(); Enumeration names = params.propertyNames(); while (names.hasMoreElements()) { String name = params.getProperty((String) names.nextElement()); StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); try { // The first string might be the namespace, or it might be // the local name, if the namespace is null. String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) setParameter(s1, null, params.getProperty(name)); else setParameter(s2, s1, params.getProperty(name)); } catch (java.util.NoSuchElementException nsee) { // Should throw some sort of an error. } } } /** * Reset the parameters to a null list. */ public void clearParameters() { synchronized (m_reentryGuard) { VariableStack varstack = new VariableStack(); m_xcontext.setVarStack(varstack); m_userParams = null; } } /** * Internal -- push the global variables from the Stylesheet onto * the context's runtime variable stack. *

        If we encounter a variable * that is already defined in the variable stack, we ignore it. This * is because the second variable definition will be at a lower import * precedence. Presumably, global"variables at the same import precedence * with the same name will have been caught during the recompose process. *

        However, if we encounter a parameter that is already defined in the * variable stack, we need to see if this is a parameter whose value was * supplied by a setParameter call. If so, we need to "receive" the one * already in the stack, ignoring this one. If it is just an earlier * xsl:param or xsl:variable definition, we ignore it using the same * reasoning as explained above for the variable. * * @param contextNode The root of the source tree, can't be null. * * @throws TransformerException */ protected void pushGlobalVars(int contextNode) throws TransformerException { XPathContext xctxt = m_xcontext; VariableStack vs = xctxt.getVarStack(); StylesheetRoot sr = getStylesheet(); Vector vars = sr.getVariablesAndParamsComposed(); int i = vars.size(); vs.link(i); while (--i >= 0) { ElemVariable v = (ElemVariable) vars.elementAt(i); // XObject xobj = v.getValue(this, contextNode); XObject xobj = new XUnresolvedVariable(v, contextNode, this, vs.getStackFrame(), 0, true); if(null == vs.elementAt(i)) vs.setGlobalVariable(i, xobj); } } /** * Set an object that will be used to resolve URIs used in * document(), etc. * @param resolver An object that implements the URIResolver interface, * or null. */ public void setURIResolver(URIResolver resolver) { synchronized (m_reentryGuard) { m_xcontext.getSourceTreeManager().setURIResolver(resolver); } } /** * Get an object that will be used to resolve URIs used in * document(), etc. * * @return An object that implements the URIResolver interface, * or null. */ public URIResolver getURIResolver() { return m_xcontext.getSourceTreeManager().getURIResolver(); } // ======== End Transformer Implementation ======== /** * Set the content event handler. * * NEEDSDOC @param handler * @throws java.lang.NullPointerException If the handler * is null. * @see org.xml.sax.XMLReader#setContentHandler */ public void setContentHandler(ContentHandler handler) { if (handler == null) { throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_CONTENT_HANDLER, null)); //"Null content handler"); } else { m_outputContentHandler = handler; if (null == m_serializationHandler) { ToXMLSAXHandler h = new ToXMLSAXHandler(); h.setContentHandler(handler); h.setTransformer(this); m_serializationHandler = h; } else m_serializationHandler.setContentHandler(handler); } } /** * Get the content event handler. * * @return The current content handler, or null if none was set. * @see org.xml.sax.XMLReader#getContentHandler */ public ContentHandler getContentHandler() { return m_outputContentHandler; } /** * Given a stylesheet element, create a result tree fragment from it's * contents. The fragment will be built within the shared RTF DTM system * used as a variable stack. * @param templateParent The template element that holds the fragment. * @return the NodeHandle for the root node of the resulting RTF. * * @throws TransformerException * @xsl.usage advanced */ public int transformToRTF(ElemTemplateElement templateParent) throws TransformerException { // Retrieve a DTM to contain the RTF. At this writing, this may be a // multi-document DTM (SAX2RTFDTM). DTM dtmFrag = m_xcontext.getRTFDTM(); return transformToRTF(templateParent,dtmFrag); } /** * Given a stylesheet element, create a result tree fragment from it's * contents. The fragment will also use the shared DTM system, but will * obtain its space from the global variable pool rather than the dynamic * variable stack. This allows late binding of XUnresolvedVariables without * the risk that their content will be discarded when the variable stack * is popped. * * @param templateParent The template element that holds the fragment. * @return the NodeHandle for the root node of the resulting RTF. * * @throws TransformerException * @xsl.usage advanced */ public int transformToGlobalRTF(ElemTemplateElement templateParent) throws TransformerException { // Retrieve a DTM to contain the RTF. At this writing, this may be a // multi-document DTM (SAX2RTFDTM). DTM dtmFrag = m_xcontext.getGlobalRTFDTM(); return transformToRTF(templateParent,dtmFrag); } /** * Given a stylesheet element, create a result tree fragment from it's * contents. * @param templateParent The template element that holds the fragment. * @param dtmFrag The DTM to write the RTF into * @return the NodeHandle for the root node of the resulting RTF. * * @throws TransformerException * @xsl.usage advanced */ private int transformToRTF(ElemTemplateElement templateParent,DTM dtmFrag) throws TransformerException { XPathContext xctxt = m_xcontext; ContentHandler rtfHandler = dtmFrag.getContentHandler(); // Obtain the ResultTreeFrag's root node. // NOTE: In SAX2RTFDTM, this value isn't available until after // the startDocument has been issued, so assignment has been moved // down a bit in the code. int resultFragment; // not yet reliably = dtmFrag.getDocument(); // Save the current result tree handler. SerializationHandler savedRTreeHandler = this.m_serializationHandler; // And make a new handler for the RTF. ToSAXHandler h = new ToXMLSAXHandler(); h.setContentHandler(rtfHandler); h.setTransformer(this); // Replace the old handler (which was already saved) m_serializationHandler = h; // use local variable for the current handler SerializationHandler rth = m_serializationHandler; try { rth.startDocument(); // startDocument is "bottlenecked" in RTH. We need it acted upon immediately, // to set the DTM's state as in-progress, so that if the xsl:variable's body causes // further RTF activity we can keep that from bashing this DTM. rth.flushPending(); try { // Do the transformation of the child elements. executeChildTemplates(templateParent, true); // Make sure everything is flushed! rth.flushPending(); // Get the document ID. May not exist until the RTH has not only // received, but flushed, the startDocument, and may be invalid // again after the document has been closed (still debating that) // ... so waiting until just before the end seems simplest/safest. resultFragment = dtmFrag.getDocument(); } finally { rth.endDocument(); } } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } finally { // Restore the previous result tree handler. this.m_serializationHandler = savedRTreeHandler; } return resultFragment; } /** * Get the StringWriter pool, so that StringWriter * objects may be reused. * * @return The string writer pool, not null. * @xsl.usage internal */ public ObjectPool getStringWriterPool() { return m_stringWriterObjectPool; } /** * Take the contents of a template element, process it, and * convert it to a string. * * @param elem The parent element whose children will be output * as a string. * * @return The stringized result of executing the elements children. * * @throws TransformerException * @xsl.usage advanced */ public String transformToString(ElemTemplateElement elem) throws TransformerException { ElemTemplateElement firstChild = elem.getFirstChildElem(); if(null == firstChild) return ""; if(elem.hasTextLitOnly() && m_optimizer) { return ((ElemTextLiteral)firstChild).getNodeValue(); } // Save the current result tree handler. SerializationHandler savedRTreeHandler = this.m_serializationHandler; // Create a Serializer object that will handle the SAX events // and build the ResultTreeFrag nodes. StringWriter sw = (StringWriter) m_stringWriterObjectPool.getInstance(); m_serializationHandler = (ToTextStream) m_textResultHandlerObjectPool.getInstance(); if (null == m_serializationHandler) { // if we didn't get one from the pool, go make a new one Serializer serializer = org.apache.xml.serializer.SerializerFactory.getSerializer( m_textformat.getProperties()); m_serializationHandler = (SerializationHandler) serializer; } m_serializationHandler.setTransformer(this); m_serializationHandler.setWriter(sw); String result; try { /* Don't call startDocument, the SerializationHandler will * generate its own internal startDocument call anyways */ // this.m_serializationHandler.startDocument(); // Do the transformation of the child elements. executeChildTemplates(elem, true); this.m_serializationHandler.endDocument(); result = sw.toString(); } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } finally { sw.getBuffer().setLength(0); try { sw.close(); } catch (Exception ioe){} m_stringWriterObjectPool.freeInstance(sw); m_serializationHandler.reset(); m_textResultHandlerObjectPool.freeInstance(m_serializationHandler); // Restore the previous result tree handler. m_serializationHandler = savedRTreeHandler; } return result; } /** * Given an element and mode, find the corresponding * template and process the contents. * * @param xslInstruction The calling element. * @param template The template to use if xsl:for-each, current template for apply-imports, or null. * @param child The source context node. * @throws TransformerException * @return true if applied a template, false if not. * @xsl.usage advanced */ public boolean applyTemplateToNode(ElemTemplateElement xslInstruction, // xsl:apply-templates or xsl:for-each ElemTemplate template, int child) throws TransformerException { DTM dtm = m_xcontext.getDTM(child); short nodeType = dtm.getNodeType(child); boolean isDefaultTextRule = false; boolean isApplyImports = false; isApplyImports = ((xslInstruction == null) ? false : xslInstruction.getXSLToken() == Constants.ELEMNAME_APPLY_IMPORTS); if (null == template || isApplyImports) { int maxImportLevel, endImportLevel=0; if (isApplyImports) { maxImportLevel = template.getStylesheetComposed().getImportCountComposed() - 1; endImportLevel = template.getStylesheetComposed().getEndImportCountComposed(); } else { maxImportLevel = -1; } // If we're trying an xsl:apply-imports at the top level (ie there are no // imported stylesheets), we need to indicate that there is no matching template. // The above logic will calculate a maxImportLevel of -1 which indicates // that we should find any template. This is because a value of -1 for // maxImportLevel has a special meaning. But we don't want that. // We want to match -no- templates. See bugzilla bug 1170. if (isApplyImports && (maxImportLevel == -1)) { template = null; } else { // Find the XSL template that is the best match for the // element. XPathContext xctxt = m_xcontext; try { xctxt.pushNamespaceContext(xslInstruction); QName mode = this.getMode(); if (isApplyImports) template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode, maxImportLevel, endImportLevel, m_quietConflictWarnings, dtm); else template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode, m_quietConflictWarnings, dtm); } finally { xctxt.popNamespaceContext(); } } // If that didn't locate a node, fall back to a default template rule. // See http://www.w3.org/TR/xslt#built-in-rule. if (null == template) { switch (nodeType) { case DTM.DOCUMENT_FRAGMENT_NODE : case DTM.ELEMENT_NODE : template = m_stylesheetRoot.getDefaultRule(); break; case DTM.CDATA_SECTION_NODE : case DTM.TEXT_NODE : case DTM.ATTRIBUTE_NODE : template = m_stylesheetRoot.getDefaultTextRule(); isDefaultTextRule = true; break; case DTM.DOCUMENT_NODE : template = m_stylesheetRoot.getDefaultRootRule(); break; default : // No default rules for processing instructions and the like. return false; } } } // If we are processing the default text rule, then just clone // the value directly to the result tree. try { pushElemTemplateElement(template); m_xcontext.pushCurrentNode(child); pushPairCurrentMatched(template, child); // Fix copy copy29 test. if (!isApplyImports) { DTMIterator cnl = new org.apache.xpath.NodeSetDTM(child, m_xcontext.getDTMManager()); m_xcontext.pushContextNodeList(cnl); } if (isDefaultTextRule) { switch (nodeType) { case DTM.CDATA_SECTION_NODE : case DTM.TEXT_NODE : ClonerToResultTree.cloneToResultTree(child, nodeType, dtm, getResultTreeHandler(), false); break; case DTM.ATTRIBUTE_NODE : dtm.dispatchCharactersEvents(child, getResultTreeHandler(), false); break; } } else { // Fire a trace event for the template. if (m_debug) getTraceManager().fireTraceEvent(template); // And execute the child templates. // 9/11/00: If template has been compiled, hand off to it // since much (most? all?) of the processing has been inlined. // (It would be nice if there was a single entry point that // worked for both... but the interpretive system works by // having the Tranformer execute the children, while the // compiled obviously has to run its own code. It's // also unclear that "execute" is really the right name for // that entry point.) m_xcontext.setSAXLocator(template); // m_xcontext.getVarStack().link(); m_xcontext.getVarStack().link(template.m_frameSize); executeChildTemplates(template, true); if (m_debug) getTraceManager().fireTraceEndEvent(template); } } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } finally { if (!isDefaultTextRule) m_xcontext.getVarStack().unlink(); m_xcontext.popCurrentNode(); if (!isApplyImports) { m_xcontext.popContextNodeList(); } popCurrentMatched(); popElemTemplateElement(); } return true; } /** * Execute each of the children of a template element. This method * is only for extension use. * * @param elem The ElemTemplateElement that contains the children * that should execute. * NEEDSDOC @param context * @param mode The current mode. * @param handler The ContentHandler to where the result events * should be fed. * * @throws TransformerException * @xsl.usage advanced */ public void executeChildTemplates( ElemTemplateElement elem, org.w3c.dom.Node context, QName mode, ContentHandler handler) throws TransformerException { XPathContext xctxt = m_xcontext; try { if(null != mode) pushMode(mode); xctxt.pushCurrentNode(xctxt.getDTMHandleFromNode(context)); executeChildTemplates(elem, handler); } finally { xctxt.popCurrentNode(); // I'm not sure where or why this was here. It is clearly in // error though, without a corresponding pushMode(). if (null != mode) popMode(); } } /** * Execute each of the children of a template element. * * @param elem The ElemTemplateElement that contains the children * that should execute. * @param shouldAddAttrs true if xsl:attributes should be executed. * * @throws TransformerException * @xsl.usage advanced */ public void executeChildTemplates( ElemTemplateElement elem, boolean shouldAddAttrs) throws TransformerException { // Does this element have any children? ElemTemplateElement t = elem.getFirstChildElem(); if (null == t) return; if(elem.hasTextLitOnly() && m_optimizer) { char[] chars = ((ElemTextLiteral)t).getChars(); try { // Have to push stuff on for tooling... this.pushElemTemplateElement(t); m_serializationHandler.characters(chars, 0, chars.length); } catch(SAXException se) { throw new TransformerException(se); } finally { this.popElemTemplateElement(); } return; } // // Check for infinite loops if we have to. // boolean check = (m_stackGuard.m_recursionLimit > -1); // // if (check) // getStackGuard().push(elem, xctxt.getCurrentNode()); XPathContext xctxt = m_xcontext; xctxt.pushSAXLocatorNull(); int currentTemplateElementsTop = m_currentTemplateElements.size(); m_currentTemplateElements.push(null); try { // Loop through the children of the template, calling execute on // each of them. for (; t != null; t = t.getNextSiblingElem()) { if (!shouldAddAttrs && t.getXSLToken() == Constants.ELEMNAME_ATTRIBUTE) continue; xctxt.setSAXLocator(t); m_currentTemplateElements.setElementAt(t,currentTemplateElementsTop); t.execute(this); } } catch(RuntimeException re) { TransformerException te = new TransformerException(re); te.setLocator(t); throw te; } finally { m_currentTemplateElements.pop(); xctxt.popSAXLocator(); } // Check for infinite loops if we have to // if (check) // getStackGuard().pop(); } /** * Execute each of the children of a template element. * * @param elem The ElemTemplateElement that contains the children * that should execute. * @param handler The ContentHandler to where the result events * should be fed. * * @throws TransformerException * @xsl.usage advanced */ public void executeChildTemplates( ElemTemplateElement elem, ContentHandler handler) throws TransformerException { SerializationHandler xoh = this.getSerializationHandler(); // These may well not be the same! In this case when calling // the Redirect extension, it has already set the ContentHandler // in the Transformer. SerializationHandler savedHandler = xoh; try { xoh.flushPending(); // %REVIEW% Make sure current node is being pushed. LexicalHandler lex = null; if (handler instanceof LexicalHandler) { lex = (LexicalHandler) handler; } m_serializationHandler = new ToXMLSAXHandler(handler, lex, savedHandler.getEncoding()); m_serializationHandler.setTransformer(this); executeChildTemplates(elem, true); } catch (TransformerException e) { throw e; } catch (SAXException se) { throw new TransformerException(se); } finally { m_serializationHandler = savedHandler; } } /** * Get the keys for the xsl:sort elements. * Note: Should this go into ElemForEach? * * @param foreach Valid ElemForEach element, not null. * @param sourceNodeContext The current node context in the source tree, * needed to evaluate the Attribute Value Templates. * * @return A Vector of NodeSortKeys, or null. * * @throws TransformerException * @xsl.usage advanced */ public Vector processSortKeys(ElemForEach foreach, int sourceNodeContext) throws TransformerException { Vector keys = null; XPathContext xctxt = m_xcontext; int nElems = foreach.getSortElemCount(); if (nElems > 0) keys = new Vector(); // March backwards, collecting the sort keys. for (int i = 0; i < nElems; i++) { ElemSort sort = foreach.getSortElem(i); if (m_debug) getTraceManager().fireTraceEvent(sort); String langString = (null != sort.getLang()) ? sort.getLang().evaluate(xctxt, sourceNodeContext, foreach) : null; String dataTypeString = sort.getDataType().evaluate(xctxt, sourceNodeContext, foreach); if (dataTypeString.indexOf(":") >= 0) System.out.println( "TODO: Need to write the hooks for QNAME sort data type"); else if (!(dataTypeString.equalsIgnoreCase(Constants.ATTRVAL_DATATYPE_TEXT)) &&!(dataTypeString.equalsIgnoreCase( Constants.ATTRVAL_DATATYPE_NUMBER))) foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_DATATYPE, dataTypeString }); boolean treatAsNumbers = ((null != dataTypeString) && dataTypeString.equals( Constants.ATTRVAL_DATATYPE_NUMBER)) ? true : false; String orderString = sort.getOrder().evaluate(xctxt, sourceNodeContext, foreach); if (!(orderString.equalsIgnoreCase(Constants.ATTRVAL_ORDER_ASCENDING)) &&!(orderString.equalsIgnoreCase( Constants.ATTRVAL_ORDER_DESCENDING))) foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_ORDER, orderString }); boolean descending = ((null != orderString) && orderString.equals( Constants.ATTRVAL_ORDER_DESCENDING)) ? true : false; AVT caseOrder = sort.getCaseOrder(); boolean caseOrderUpper; if (null != caseOrder) { String caseOrderString = caseOrder.evaluate(xctxt, sourceNodeContext, foreach); if (!(caseOrderString.equalsIgnoreCase(Constants.ATTRVAL_CASEORDER_UPPER)) &&!(caseOrderString.equalsIgnoreCase( Constants.ATTRVAL_CASEORDER_LOWER))) foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_CASEORDER, caseOrderString }); caseOrderUpper = ((null != caseOrderString) && caseOrderString.equals( Constants.ATTRVAL_CASEORDER_UPPER)) ? true : false; } else { caseOrderUpper = false; } keys.addElement(new NodeSortKey(this, sort.getSelect(), treatAsNumbers, descending, langString, caseOrderUpper, foreach)); if (m_debug) getTraceManager().fireTraceEndEvent(sort); } return keys; } //========================================================== // SECTION: TransformState implementation //========================================================== /** * Get the stack of ElemTemplateElements. * * @return A copy of stack that contains the xsl element instructions, * the earliest called in index zero, and the latest called in index size()-1. */ public Vector getElementCallstack() { Vector elems = new Vector(); int nStackSize = m_currentTemplateElements.size(); for(int i = 0; i < nStackSize; i++) { ElemTemplateElement elem = (ElemTemplateElement) m_currentTemplateElements.elementAt(i); if(null != elem) { elems.addElement(elem); } } return elems; } /** * Get the count of how many elements are * active. * @return The number of active elements on * the currentTemplateElements stack. */ public int getCurrentTemplateElementsCount() { return m_currentTemplateElements.size(); } /** * Get the count of how many elements are * active. * @return The number of active elements on * the currentTemplateElements stack. */ public ObjectStack getCurrentTemplateElements() { return m_currentTemplateElements; } /** * Push the current template element. * * @param elem The current ElemTemplateElement (may be null, and then * set via setCurrentElement). */ public void pushElemTemplateElement(ElemTemplateElement elem) { m_currentTemplateElements.push(elem); } /** * Pop the current template element. */ public void popElemTemplateElement() { m_currentTemplateElements.pop(); } /** * Set the top of the current template elements * stack. * * @param e The current ElemTemplateElement about to * be executed. */ public void setCurrentElement(ElemTemplateElement e) { m_currentTemplateElements.setTop(e); } /** * Retrieves the current ElemTemplateElement that is * being executed. * * @return The current ElemTemplateElement that is executing, * should not normally be null. */ public ElemTemplateElement getCurrentElement() { return (m_currentTemplateElements.size() > 0) ? (ElemTemplateElement) m_currentTemplateElements.peek() : null; } /** * This method retrieves the current context node * in the source tree. * * @return The current context node (should never be null?). */ public int getCurrentNode() { return m_xcontext.getCurrentNode(); } /** * Get the call stack of xsl:template elements. * * @return A copy of stack that contains the xsl:template * (ElemTemplate) instructions, the earliest called in index * zero, and the latest called in index size()-1. */ public Vector getTemplateCallstack() { Vector elems = new Vector(); int nStackSize = m_currentTemplateElements.size(); for(int i = 0; i < nStackSize; i++) { ElemTemplateElement elem = (ElemTemplateElement) m_currentTemplateElements.elementAt(i); if(null != elem && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE)) { elems.addElement(elem); } } return elems; } /** * This method retrieves the xsl:template * that is in effect, which may be a matched template * or a named template. * *

        Please note that the ElemTemplate returned may * be a default template, and thus may not have a template * defined in the stylesheet.

        * * @return The current xsl:template, should not be null. */ public ElemTemplate getCurrentTemplate() { ElemTemplateElement elem = getCurrentElement(); while ((null != elem) && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE)) { elem = elem.getParentElem(); } return (ElemTemplate) elem; } /** * Push both the current xsl:template or xsl:for-each onto the * stack, along with the child node that was matched. * (Note: should this only be used for xsl:templates?? -sb) * * @param template xsl:template or xsl:for-each. * @param child The child that was matched. */ public void pushPairCurrentMatched(ElemTemplateElement template, int child) { m_currentMatchTemplates.push(template); m_currentMatchedNodes.push(child); } /** * Pop the elements that were pushed via pushPairCurrentMatched. */ public void popCurrentMatched() { m_currentMatchTemplates.pop(); m_currentMatchedNodes.pop(); } /** * This method retrieves the xsl:template * that was matched. Note that this may not be * the same thing as the current template (which * may be from getCurrentElement()), since a named * template may be in effect. * * @return The pushed template that was pushed via pushPairCurrentMatched. */ public ElemTemplate getMatchedTemplate() { return (ElemTemplate) m_currentMatchTemplates.peek(); } /** * Retrieves the node in the source tree that matched * the template obtained via getMatchedTemplate(). * * @return The matched node that corresponds to the * match attribute of the current xsl:template. */ public int getMatchedNode() { return m_currentMatchedNodes.peepTail(); } /** * Get the current context node list. * * @return A reset clone of the context node list. */ public DTMIterator getContextNodeList() { try { DTMIterator cnl = m_xcontext.getContextNodeList(); return (cnl == null) ? null : (DTMIterator) cnl.cloneWithReset(); } catch (CloneNotSupportedException cnse) { // should never happen. return null; } } /** * Get the TrAX Transformer object in effect. * * @return This object. */ public Transformer getTransformer() { return this; } //========================================================== // SECTION: Accessor Functions //========================================================== /** * Set the stylesheet for this processor. If this is set, then the * process calls that take only the input .xml will use * this instead of looking for a stylesheet PI. Also, * setting the stylesheet is needed if you are going * to use the processor as a SAX ContentHandler. * * @param stylesheetRoot A non-null StylesheetRoot object, * or null if you wish to clear the stylesheet reference. */ public void setStylesheet(StylesheetRoot stylesheetRoot) { m_stylesheetRoot = stylesheetRoot; } /** * Get the current stylesheet for this processor. * * @return The stylesheet that is associated with this * transformer. */ public final StylesheetRoot getStylesheet() { return m_stylesheetRoot; } /** * Get quietConflictWarnings property. If the quietConflictWarnings * property is set to true, warnings about pattern conflicts won't be * printed to the diagnostics stream. * * @return True if this transformer should not report * template match conflicts. */ public boolean getQuietConflictWarnings() { return m_quietConflictWarnings; } /** * If the quietConflictWarnings property is set to * true, warnings about pattern conflicts won't be * printed to the diagnostics stream. * False by default. * (Currently setting this property will have no effect.) * * @param b true if conflict warnings should be suppressed. */ public void setQuietConflictWarnings(boolean b) { m_quietConflictWarnings = b; } /** * Set the execution context for XPath. * * @param xcontext A non-null reference to the XPathContext * associated with this transformer. * @xsl.usage internal */ public void setXPathContext(XPathContext xcontext) { m_xcontext = xcontext; } /** * Get the XPath context associated with this transformer. * * @return The XPathContext reference, never null. */ public final XPathContext getXPathContext() { return m_xcontext; } /** * Get the object used to guard the stack from * recursion. * * @return The StackGuard object, which should never be null. * @xsl.usage internal */ public StackGuard getStackGuard() { return m_stackGuard; } /** * Get the recursion limit. * Used for infinite loop check. If the value is -1, do not * check for infinite loops. Anyone who wants to enable that * check should change the value of this variable to be the * level of recursion that they want to check. Be careful setting * this variable, if the number is too low, it may report an * infinite loop situation, when there is none. * Post version 1.0.0, we'll make this a runtime feature. * * @return The limit on recursion, or -1 if no check is to be made. */ public int getRecursionLimit() { return m_stackGuard.getRecursionLimit(); } /** * Set the recursion limit. * Used for infinite loop check. If the value is -1, do not * check for infinite loops. Anyone who wants to enable that * check should change the value of this variable to be the * level of recursion that they want to check. Be careful setting * this variable, if the number is too low, it may report an * infinite loop situation, when there is none. * Post version 1.0.0, we'll make this a runtime feature. * * @param limit A number that represents the limit of recursion, * or -1 if no checking is to be done. */ public void setRecursionLimit(int limit) { m_stackGuard.setRecursionLimit(limit); } /** * Get the SerializationHandler object. * * @return The current SerializationHandler, which may not * be the main result tree manager. */ public SerializationHandler getResultTreeHandler() { return m_serializationHandler; } /** * Get the SerializationHandler object. * * @return The current SerializationHandler, which may not * be the main result tree manager. */ public SerializationHandler getSerializationHandler() { return m_serializationHandler; } /** * Get the KeyManager object. * * @return A reference to the KeyManager object, which should * never be null. */ public KeyManager getKeyManager() { return m_keyManager; } /** * Check to see if this is a recursive attribute definition. * * @param attrSet A non-null ElemAttributeSet reference. * * @return true if the attribute set is recursive. */ public boolean isRecursiveAttrSet(ElemAttributeSet attrSet) { if (null == m_attrSetStack) { m_attrSetStack = new Stack(); } if (!m_attrSetStack.empty()) { int loc = m_attrSetStack.search(attrSet); if (loc > -1) { return true; } } return false; } /** * Push an executing attribute set, so we can check for * recursive attribute definitions. * * @param attrSet A non-null ElemAttributeSet reference. */ public void pushElemAttributeSet(ElemAttributeSet attrSet) { m_attrSetStack.push(attrSet); } /** * Pop the current executing attribute set. */ public void popElemAttributeSet() { m_attrSetStack.pop(); } /** * Get the table of counters, for optimized xsl:number support. * * @return The CountersTable, never null. */ public CountersTable getCountersTable() { if (null == m_countersTable) m_countersTable = new CountersTable(); return m_countersTable; } /** * Tell if the current template rule is null, i.e. if we are * directly within an apply-templates. Used for xsl:apply-imports. * * @return True if the current template rule is null. */ public boolean currentTemplateRuleIsNull() { return ((!m_currentTemplateRuleIsNull.isEmpty()) && (m_currentTemplateRuleIsNull.peek() == true)); } /** * Push true if the current template rule is null, false * otherwise. * * @param b True if the we are executing an xsl:for-each * (or xsl:call-template?). */ public void pushCurrentTemplateRuleIsNull(boolean b) { m_currentTemplateRuleIsNull.push(b); } /** * Push true if the current template rule is null, false * otherwise. */ public void popCurrentTemplateRuleIsNull() { m_currentTemplateRuleIsNull.pop(); } /** * Push a funcion result for the currently active EXSLT * func:function. * * @param val the result of executing an EXSLT * func:result instruction for the current * func:function. */ public void pushCurrentFuncResult(Object val) { m_currentFuncResult.push(val); } /** * Pops the result of the currently active EXSLT func:function. * * @return the value of the func:function */ public Object popCurrentFuncResult() { return m_currentFuncResult.pop(); } /** * Determines whether an EXSLT func:result instruction has been * executed for the currently active EXSLT func:function. * * @return true if and only if a func:result * instruction has been executed */ public boolean currentFuncResultSeen() { return !m_currentFuncResult.empty() && m_currentFuncResult.peek() != null; } /** * Return the message manager. * * @return The message manager, never null. */ public MsgMgr getMsgMgr() { if (null == m_msgMgr) m_msgMgr = new MsgMgr(this); return m_msgMgr; } /** * Set the error event listener. * * @param listener The new error listener. * @throws IllegalArgumentException if */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { synchronized (m_reentryGuard) { if (listener == null) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler"); m_errorHandler = listener; } } /** * Get the current error event handler. * * @return The current error handler, which should never be null. */ public ErrorListener getErrorListener() { return m_errorHandler; } /** * Get an instance of the trace manager for this transformation. * This object can be used to set trace listeners on various * events during the transformation. * * @return A reference to the TraceManager, never null. */ public TraceManager getTraceManager() { return m_traceManager; } /** * Look up the value of a feature. * *

        The feature name is any fully-qualified URI. It is * possible for an TransformerFactory to recognize a feature name but * to be unable to return its value; this is especially true * in the case of an adapter for a SAX1 Parser, which has * no way of knowing whether the underlying parser is * validating, for example.

        * *

        Open issues:

        *
        *

        Should getFeature be changed to hasFeature?

        *
        Keith Visco writes: Should getFeature be changed to hasFeature? * It returns a boolean which indicated whether the "state" * of feature is "true or false". I assume this means whether * or not a feature is supported? I know SAX is using "getFeature", * but to me "hasFeature" is cleaner.
        *
        * * @param name The feature name, which is a fully-qualified * URI. * @return The current state of the feature (true or false). * @throws org.xml.sax.SAXNotRecognizedException When the * TransformerFactory does not recognize the feature name. * @throws org.xml.sax.SAXNotSupportedException When the * TransformerFactory recognizes the feature name but * cannot determine its value at this time. * * @throws SAXNotRecognizedException * @throws SAXNotSupportedException */ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if ("http://xml.org/trax/features/sax/input".equals(name)) return true; else if ("http://xml.org/trax/features/dom/input".equals(name)) return true; throw new SAXNotRecognizedException(name); } // %TODO% Doc /** * NEEDSDOC Method getMode * * * NEEDSDOC (getMode) @return */ public QName getMode() { return m_modes.isEmpty() ? null : (QName) m_modes.peek(); } // %TODO% Doc /** * NEEDSDOC Method pushMode * * * NEEDSDOC @param mode */ public void pushMode(QName mode) { m_modes.push(mode); } // %TODO% Doc /** * NEEDSDOC Method popMode * */ public void popMode() { m_modes.pop(); } /** * Called by SourceTreeHandler to start the transformation * in a separate thread * * NEEDSDOC @param priority */ public void runTransformThread(int priority) { // used in SourceTreeHandler Thread t = ThreadControllerWrapper.runThread(this, priority); this.setTransformThread(t); } /** * Called by this.transform() if isParserEventsOnMain()==false. * Similar with runTransformThread(), but no priority is set * and setTransformThread is not set. */ public void runTransformThread() { ThreadControllerWrapper.runThread(this, -1); } /** * Called by CoRoutineSAXParser. Launches the CoroutineSAXParser * in a thread, and prepares it to invoke the parser from that thread * upon request. * */ public static void runTransformThread(Runnable runnable) { ThreadControllerWrapper.runThread(runnable, -1); } /** * Used by SourceTreeHandler to wait until the transform * completes * * @throws SAXException */ public void waitTransformThread() throws SAXException { // This is called to make sure the task is done. // It is possible that the thread has been reused - // but for a different transformation. ( what if we // recycle the transformer ? Not a problem since this is // still in use. ) Thread transformThread = this.getTransformThread(); if (null != transformThread) { try { ThreadControllerWrapper.waitThread(transformThread, this); if (!this.hasTransformThreadErrorCatcher()) { Exception e = this.getExceptionThrown(); if (null != e) { e.printStackTrace(); throw new org.xml.sax.SAXException(e); } } this.setTransformThread(null); } catch (InterruptedException ie){} } } /** * Get the exception thrown by the secondary thread (normally * the transform thread). * * @return The thrown exception, or null if no exception was * thrown. */ public Exception getExceptionThrown() { return m_exceptionThrown; } /** * Set the exception thrown by the secondary thread (normally * the transform thread). * * @param e The thrown exception, or null if no exception was * thrown. */ public void setExceptionThrown(Exception e) { m_exceptionThrown = e; } /** * This is just a way to set the document for run(). * * @param doc A non-null reference to the root of the * tree to be transformed. */ public void setSourceTreeDocForThread(int doc) { m_doc = doc; } /** * Set the input source for the source tree, which is needed if the * parse thread is not the main thread, in order for the parse * thread's run method to get to the input source. * * @param source The input source for the source tree. */ public void setXMLSource(Source source) { m_xmlSource = source; } /** * Tell if the transform method is completed. * * @return True if transformNode has completed, or * an exception was thrown. */ public boolean isTransformDone() { synchronized (this) { return m_isTransformDone; } } /** * Set if the transform method is completed. * * @param done True if transformNode has completed, or * an exception was thrown. */ public void setIsTransformDone(boolean done) { synchronized (this) { m_isTransformDone = done; } } /** * From a secondary thread, post the exception, so that * it can be picked up from the main thread. * * @param e The exception that was thrown. */ void postExceptionFromThread(Exception e) { // Commented out in response to problem reported by Nicola Brown // if(m_reportInPostExceptionFromThread) // { // // Consider re-throwing the exception if this flag is set. // e.printStackTrace(); // } // %REVIEW Need DTM equivelent? // if (m_inputContentHandler instanceof SourceTreeHandler) // { // SourceTreeHandler sth = (SourceTreeHandler) m_inputContentHandler; // // sth.setExceptionThrown(e); // } // ContentHandler ch = getContentHandler(); // if(ch instanceof SourceTreeHandler) // { // SourceTreeHandler sth = (SourceTreeHandler) ch; // ((TransformerImpl)(sth.getTransformer())).postExceptionFromThread(e); // } m_isTransformDone = true; m_exceptionThrown = e; ; // should have already been reported via the error handler? synchronized (this) { // See message from me on 3/27/2001 to Patrick Moore. // String msg = e.getMessage(); // System.out.println(e.getMessage()); // Is this really needed? -sb notifyAll(); // if (null == msg) // { // // // m_throwNewError = false; // e.printStackTrace(); // } // throw new org.apache.xml.utils.WrappedRuntimeException(e); } } /** * Run the transform thread. */ public void run() { m_hasBeenReset = false; try { // int n = ((SourceTreeHandler)getInputContentHandler()).getDTMRoot(); // transformNode(n); try { m_isTransformDone = false; // Should no longer be needed... // if(m_inputContentHandler instanceof TransformerHandlerImpl) // { // TransformerHandlerImpl thi = (TransformerHandlerImpl)m_inputContentHandler; // thi.waitForInitialEvents(); // } transformNode(m_doc); } catch (Exception e) { // e.printStackTrace(); // Strange that the other catch won't catch this... if (null != m_transformThread) postExceptionFromThread(e); // Assume we're on the main thread else throw new RuntimeException(e.getMessage()); } finally { m_isTransformDone = true; if (m_inputContentHandler instanceof TransformerHandlerImpl) { ((TransformerHandlerImpl) m_inputContentHandler).clearCoRoutine(); } // synchronized (this) // { // notifyAll(); // } } } catch (Exception e) { // e.printStackTrace(); if (null != m_transformThread) postExceptionFromThread(e); else throw new RuntimeException(e.getMessage()); // Assume we're on the main thread. } } // Fragment re-execution interfaces for a tool. /** * This will get a snapshot of the current executing context * * * @return TransformSnapshot object, snapshot of executing context * @deprecated This is an internal tooling API that nobody seems to be using */ public TransformSnapshot getSnapshot() { return new TransformSnapshotImpl(this); } /** * This will execute the following XSLT instructions * from the snapshot point, after the stylesheet execution * context has been reset from the snapshot point. * * @param ts The snapshot of where to start execution * * @throws TransformerException * @deprecated This is an internal tooling API that nobody seems to be using */ public void executeFromSnapshot(TransformSnapshot ts) throws TransformerException { ElemTemplateElement template = getMatchedTemplate(); int child = getMatchedNode(); pushElemTemplateElement(template); //needed?? m_xcontext.pushCurrentNode(child); //needed?? this.executeChildTemplates(template, true); // getResultTreeHandler()); } /** * This will reset the stylesheet execution context * from the snapshot point. * * @param ts The snapshot of where to start execution * @deprecated This is an internal tooling API that nobody seems to be using */ public void resetToStylesheet(TransformSnapshot ts) { ((TransformSnapshotImpl) ts).apply(this); } /** * NEEDSDOC Method stopTransformation * */ public void stopTransformation(){} /** * Test whether whitespace-only text nodes are visible in the logical * view of DTM. Normally, this function * will be called by the implementation of DTM; * it is not normally called directly from * user code. * * @param elementHandle int Handle of the element. * @return one of NOTSTRIP, STRIP, or INHERIT. */ public short getShouldStripSpace(int elementHandle, DTM dtm) { try { org.apache.xalan.templates.WhiteSpaceInfo info = m_stylesheetRoot.getWhiteSpaceInfo(m_xcontext, elementHandle, dtm); if (null == info) { return DTMWSFilter.INHERIT; } else { // System.out.println("getShouldStripSpace: "+info.getShouldStripSpace()); return info.getShouldStripSpace() ? DTMWSFilter.STRIP : DTMWSFilter.NOTSTRIP; } } catch (TransformerException se) { return DTMWSFilter.INHERIT; } } /** * Initializer method. * * @param transformer non-null transformer instance * @param realHandler Content Handler instance */ public void init(ToXMLSAXHandler h,Transformer transformer, ContentHandler realHandler) { h.setTransformer(transformer); h.setContentHandler(realHandler); } public void setSerializationHandler(SerializationHandler xoh) { m_serializationHandler = xoh; } /** * Fire off characters, cdate events. * @see org.apache.xml.serializer.SerializerTrace#fireGenerateEvent(int, char[], int, int) */ public void fireGenerateEvent( int eventType, char[] ch, int start, int length) { GenerateEvent ge = new GenerateEvent(this, eventType, ch, start, length); m_traceManager.fireGenerateEvent(ge); } /** * Fire off startElement, endElement events. * @see org.apache.xml.serializer.SerializerTrace#fireGenerateEvent(int, String, Attributes) */ public void fireGenerateEvent( int eventType, String name, Attributes atts) { GenerateEvent ge = new GenerateEvent(this, eventType, name, atts); m_traceManager.fireGenerateEvent(ge); } /** * Fire off processingInstruction events. * @see org.apache.xml.serializer.SerializerTrace#fireGenerateEvent(int, String, String) */ public void fireGenerateEvent(int eventType, String name, String data) { GenerateEvent ge = new GenerateEvent(this, eventType, name,data); m_traceManager.fireGenerateEvent(ge); } /** * Fire off comment and entity ref events. * @see org.apache.xml.serializer.SerializerTrace#fireGenerateEvent(int, String) */ public void fireGenerateEvent(int eventType, String data) { GenerateEvent ge = new GenerateEvent(this, eventType, data); m_traceManager.fireGenerateEvent(ge); } /** * Fire off startDocument, endDocument events. * @see org.apache.xml.serializer.SerializerTrace#fireGenerateEvent(int) */ public void fireGenerateEvent(int eventType) { GenerateEvent ge = new GenerateEvent(this, eventType); m_traceManager.fireGenerateEvent(ge); } /** * @see org.apache.xml.serializer.SerializerTrace#hasTraceListeners() */ public boolean hasTraceListeners() { return m_traceManager.hasTraceListeners(); } public boolean getDebug() { return m_debug; } public void setDebug(boolean b) { m_debug = b; } /** * @return Incremental flag */ public boolean getIncremental() { return m_incremental; } /** * @return Optimization flag */ public boolean getOptimize() { return m_optimizer; } /** * @return Source location flag */ public boolean getSource_location() { return m_source_location; } } // end TransformerImpl class libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TrAXFilter.java0000644000175000017500000001703010721374031024372 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TrAXFilter.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.transform.ErrorListener; import javax.xml.transform.Templates; import javax.xml.transform.TransformerConfigurationException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; import org.xml.sax.helpers.XMLReaderFactory; public class TrAXFilter extends XMLFilterImpl { private Templates m_templates; private TransformerImpl m_transformer; /** * Construct an empty XML filter, with no parent. * *

        This filter will have no parent: you must assign a parent * before you start a parse or do any configuration with * setFeature or setProperty.

        * * @see org.xml.sax.XMLReader#setFeature * @see org.xml.sax.XMLReader#setProperty */ public TrAXFilter (Templates templates) throws TransformerConfigurationException { m_templates = templates; m_transformer = (TransformerImpl)templates.newTransformer(); } /** * Return the Transformer object used for this XML filter. */ public TransformerImpl getTransformer() { return m_transformer; } /** Set the parent reader. * *

        This is the {@link org.xml.sax.XMLReader XMLReader} from which * this filter will obtain its events and to which it will pass its * configuration requests. The parent may itself be another filter.

        * *

        If there is no parent reader set, any attempt to parse * or to set or get a feature or property will fail.

        * * @param parent The parent XML reader. * @throws java.lang.NullPointerException If the parent is null. */ public void setParent (XMLReader parent) { super.setParent(parent); if(null != parent.getContentHandler()) this.setContentHandler(parent.getContentHandler()); // Not really sure if we should do this here, but // it seems safer in case someone calls parse() on // the parent. setupParse (); } /** * Parse a document. * * @param input The input source for the document entity. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @throws java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource) */ public void parse (InputSource input) throws org.xml.sax.SAXException, IOException { if(null == getParent()) { XMLReader reader=null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); if (m_transformer.getStylesheet().isSecureProcessing()) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException se) {} } javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } catch (AbstractMethodError ame){} XMLReader parent; if( reader==null ) parent= XMLReaderFactory.createXMLReader(); else parent=reader; try { parent.setFeature("http://xml.org/sax/features/namespace-prefixes", true); } catch (org.xml.sax.SAXException se){} // setParent calls setupParse... setParent(parent); } else { // Make sure everything is set up. setupParse (); } if(null == m_transformer.getContentHandler()) { throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_CALL_PARSE, null)); //"parse can not be called if the ContentHandler has not been set!"); } getParent().parse(input); Exception e = m_transformer.getExceptionThrown(); if(null != e) { if(e instanceof org.xml.sax.SAXException) throw (org.xml.sax.SAXException)e; else throw new org.xml.sax.SAXException(e); } } /** * Parse a document. * * @param systemId The system identifier as a fully-qualified URI. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @throws java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see org.xml.sax.XMLReader#parse(java.lang.String) */ public void parse (String systemId) throws org.xml.sax.SAXException, IOException { parse(new InputSource(systemId)); } /** * Set up before a parse. * *

        Before every parse, check whether the parent is * non-null, and re-register the filter for all of the * events.

        */ private void setupParse () { XMLReader p = getParent(); if (p == null) { throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_PARENT_FOR_FILTER, null)); //"No parent for filter"); } ContentHandler ch = m_transformer.getInputContentHandler(); // if(ch instanceof SourceTreeHandler) // ((SourceTreeHandler)ch).setUseMultiThreading(true); p.setContentHandler(ch); p.setEntityResolver(this); p.setDTDHandler(this); p.setErrorHandler(this); } /** * Set the content event handler. * * @param handler The new content handler. * @throws java.lang.NullPointerException If the handler * is null. * @see org.xml.sax.XMLReader#setContentHandler */ public void setContentHandler (ContentHandler handler) { m_transformer.setContentHandler(handler); // super.setContentHandler(m_transformer.getResultTreeHandler()); } public void setErrorListener (ErrorListener handler) { m_transformer.setErrorListener(handler); } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/ResultNameSpace.java0000644000175000017500000000326110721374030025441 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ResultNameSpace.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; /** * A representation of a result namespace. One of these will * be pushed on the result tree namespace stack for each * result tree element. * @xsl.usage internal */ public class ResultNameSpace { /** Pointer to next ResultNameSpace */ public ResultNameSpace m_next = null; /** Prefix of namespace */ public String m_prefix; /** Namespace URI */ public String m_uri; // if null, then Element namespace is empty. /** * Construct a namespace for placement on the * result tree namespace stack. * * @param prefix of result namespace * @param uri URI of result namespace */ public ResultNameSpace(String prefix, String uri) { m_prefix = prefix; m_uri = uri; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformerIdentityImpl.java0000644000175000017500000014275210721374030027255 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerIdentityImpl.java 575747 2007-09-14 16:28:37Z kcormier $ */ package org.apache.xalan.transformer; import java.io.IOException; import java.util.Hashtable; import java.util.Properties; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamResult; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.OutputProperties; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xml.serializer.Method; import org.apache.xml.utils.DOMBuilder; import org.apache.xml.utils.XMLReaderManager; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; /** * This class implements an identity transformer for * {@link javax.xml.transform.sax.SAXTransformerFactory#newTransformerHandler()} * and {@link javax.xml.transform.TransformerFactory#newTransformer()}. It * simply feeds SAX events directly to a serializer ContentHandler, if the * result is a stream. If the result is a DOM, it will send the events to * {@link org.apache.xml.utils.DOMBuilder}. If the result is another * content handler, it will simply pass the events on. */ public class TransformerIdentityImpl extends Transformer implements TransformerHandler, DeclHandler { /** * Constructor TransformerIdentityImpl creates an identity transform. * */ public TransformerIdentityImpl(boolean isSecureProcessing) { m_outputFormat = new OutputProperties(Method.XML); m_isSecureProcessing = isSecureProcessing; } /** * Constructor TransformerIdentityImpl creates an identity transform. * */ public TransformerIdentityImpl() { this(false); } /** * Enables the user of the TransformerHandler to set the * to set the Result for the transformation. * * @param result A Result instance, should not be null. * * @throws IllegalArgumentException if result is invalid for some reason. */ public void setResult(Result result) throws IllegalArgumentException { if(null == result) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null"); m_result = result; } /** * Set the base ID (URI or system ID) from where relative * URLs will be resolved. * @param systemID Base URI for the source tree. */ public void setSystemId(String systemID) { m_systemID = systemID; } /** * Get the base ID (URI or system ID) from where relative * URLs will be resolved. * @return The systemID that was set with {@link #setSystemId}. */ public String getSystemId() { return m_systemID; } /** * Get the Transformer associated with this handler, which * is needed in order to set parameters and output properties. * * @return non-null reference to the transformer. */ public Transformer getTransformer() { return this; } /** * Reset the status of the transformer. */ public void reset() { m_flushedStartDoc = false; m_foundFirstElement = false; m_outputStream = null; clearParameters(); m_result = null; m_resultContentHandler = null; m_resultDeclHandler = null; m_resultDTDHandler = null; m_resultLexicalHandler = null; m_serializer = null; m_systemID = null; m_URIResolver = null; m_outputFormat = new OutputProperties(Method.XML); } /** * Create a result ContentHandler from a Result object, based * on the current OutputProperties. * * @param outputTarget Where the transform result should go, * should not be null. * * @return A valid ContentHandler that will create the * result tree when it is fed SAX events. * * @throws TransformerException */ private void createResultContentHandler(Result outputTarget) throws TransformerException { if (outputTarget instanceof SAXResult) { SAXResult saxResult = (SAXResult) outputTarget; m_resultContentHandler = saxResult.getHandler(); m_resultLexicalHandler = saxResult.getLexicalHandler(); if (m_resultContentHandler instanceof Serializer) { // Dubious but needed, I think. m_serializer = (Serializer) m_resultContentHandler; } } else if (outputTarget instanceof DOMResult) { DOMResult domResult = (DOMResult) outputTarget; Node outputNode = domResult.getNode(); Node nextSibling = domResult.getNextSibling(); Document doc; short type; if (null != outputNode) { type = outputNode.getNodeType(); doc = (Node.DOCUMENT_NODE == type) ? (Document) outputNode : outputNode.getOwnerDocument(); } else { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); if (m_isSecureProcessing) { try { dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (ParserConfigurationException pce) {} } DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.newDocument(); } catch (ParserConfigurationException pce) { throw new TransformerException(pce); } outputNode = doc; type = outputNode.getNodeType(); ((DOMResult) outputTarget).setNode(outputNode); } DOMBuilder domBuilder = (Node.DOCUMENT_FRAGMENT_NODE == type) ? new DOMBuilder(doc, (DocumentFragment) outputNode) : new DOMBuilder(doc, outputNode); if (nextSibling != null) domBuilder.setNextSibling(nextSibling); m_resultContentHandler = domBuilder; m_resultLexicalHandler = domBuilder; } else if (outputTarget instanceof StreamResult) { StreamResult sresult = (StreamResult) outputTarget; try { Serializer serializer = SerializerFactory.getSerializer(m_outputFormat.getProperties()); m_serializer = serializer; if (null != sresult.getWriter()) serializer.setWriter(sresult.getWriter()); else if (null != sresult.getOutputStream()) serializer.setOutputStream(sresult.getOutputStream()); else if (null != sresult.getSystemId()) { String fileURL = sresult.getSystemId(); if (fileURL.startsWith("file:///")) { if (fileURL.substring(8).indexOf(":") >0) { fileURL = fileURL.substring(8); } else { fileURL = fileURL.substring(7); } } else if (fileURL.startsWith("file:/")) { if (fileURL.substring(6).indexOf(":") >0) { fileURL = fileURL.substring(6); } else { fileURL = fileURL.substring(5); } } m_outputStream = new java.io.FileOutputStream(fileURL); serializer.setOutputStream(m_outputStream); } else throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_OUTPUT_SPECIFIED, null)); //"No output specified!"); m_resultContentHandler = serializer.asContentHandler(); } catch (IOException ioe) { throw new TransformerException(ioe); } } else { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, new Object[]{outputTarget.getClass().getName()})); //"Can't transform to a Result of type " // + outputTarget.getClass().getName() // + "!"); } if (m_resultContentHandler instanceof DTDHandler) m_resultDTDHandler = (DTDHandler) m_resultContentHandler; if (m_resultContentHandler instanceof DeclHandler) m_resultDeclHandler = (DeclHandler) m_resultContentHandler; if (m_resultContentHandler instanceof LexicalHandler) m_resultLexicalHandler = (LexicalHandler) m_resultContentHandler; } /** * Process the source tree to the output result. * @param source The input for the source tree. * * @param outputTarget The output target. * * @throws TransformerException If an unrecoverable error occurs * during the course of the transformation. */ public void transform(Source source, Result outputTarget) throws TransformerException { createResultContentHandler(outputTarget); /* * According to JAXP1.2, new SAXSource()/StreamSource() * should create an empty input tree, with a default root node. * new DOMSource()creates an empty document using DocumentBuilder. * newDocument(); Use DocumentBuilder.newDocument() for all 3 situations, * since there is no clear spec. how to create an empty tree when * both SAXSource() and StreamSource() are used. */ if ((source instanceof StreamSource && source.getSystemId()==null && ((StreamSource)source).getInputStream()==null && ((StreamSource)source).getReader()==null)|| (source instanceof SAXSource && ((SAXSource)source).getInputSource()==null && ((SAXSource)source).getXMLReader()==null )|| (source instanceof DOMSource && ((DOMSource)source).getNode()==null)){ try { DocumentBuilderFactory builderF = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderF.newDocumentBuilder(); String systemID = source.getSystemId(); source = new DOMSource(builder.newDocument()); // Copy system ID from original, empty Source to new Source if (systemID != null) { source.setSystemId(systemID); } } catch (ParserConfigurationException e){ throw new TransformerException(e.getMessage()); } } try { if (source instanceof DOMSource) { DOMSource dsource = (DOMSource) source; m_systemID = dsource.getSystemId(); Node dNode = dsource.getNode(); if (null != dNode) { try { if(dNode.getNodeType() == Node.ATTRIBUTE_NODE) this.startDocument(); try { if(dNode.getNodeType() == Node.ATTRIBUTE_NODE) { String data = dNode.getNodeValue(); char[] chars = data.toCharArray(); characters(chars, 0, chars.length); } else { org.apache.xml.serializer.TreeWalker walker; walker = new org.apache.xml.serializer.TreeWalker(this, m_systemID); walker.traverse(dNode); } } finally { if(dNode.getNodeType() == Node.ATTRIBUTE_NODE) this.endDocument(); } } catch (SAXException se) { throw new TransformerException(se); } return; } else { String messageStr = XSLMessages.createMessage( XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null); throw new IllegalArgumentException(messageStr); } } InputSource xmlSource = SAXSource.sourceToInputSource(source); if (null == xmlSource) { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_TRANSFORM_SOURCE_TYPE, new Object[]{source.getClass().getName()})); //"Can't transform a Source of type " //+ source.getClass().getName() + "!"); } if (null != xmlSource.getSystemId()) m_systemID = xmlSource.getSystemId(); XMLReader reader = null; boolean managedReader = false; try { if (source instanceof SAXSource) { reader = ((SAXSource) source).getXMLReader(); } if (null == reader) { try { reader = XMLReaderManager.getInstance().getXMLReader(); managedReader = true; } catch (SAXException se) { throw new TransformerException(se); } } else { try { reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); } catch (org.xml.sax.SAXException se) { // We don't care. } } // Get the input content handler, which will handle the // parse events and create the source tree. ContentHandler inputHandler = this; reader.setContentHandler(inputHandler); if (inputHandler instanceof org.xml.sax.DTDHandler) reader.setDTDHandler((org.xml.sax.DTDHandler) inputHandler); try { if (inputHandler instanceof org.xml.sax.ext.LexicalHandler) reader.setProperty("http://xml.org/sax/properties/lexical-handler", inputHandler); if (inputHandler instanceof org.xml.sax.ext.DeclHandler) reader.setProperty( "http://xml.org/sax/properties/declaration-handler", inputHandler); } catch (org.xml.sax.SAXException se){} try { if (inputHandler instanceof org.xml.sax.ext.LexicalHandler) reader.setProperty("http://xml.org/sax/handlers/LexicalHandler", inputHandler); if (inputHandler instanceof org.xml.sax.ext.DeclHandler) reader.setProperty("http://xml.org/sax/handlers/DeclHandler", inputHandler); } catch (org.xml.sax.SAXNotRecognizedException snre){} reader.parse(xmlSource); } catch (org.apache.xml.utils.WrappedRuntimeException wre) { Throwable throwable = wre.getException(); while (throwable instanceof org.apache.xml.utils.WrappedRuntimeException) { throwable = ((org.apache.xml.utils.WrappedRuntimeException) throwable).getException(); } throw new TransformerException(wre.getException()); } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } catch (IOException ioe) { throw new TransformerException(ioe); } finally { if (managedReader) { XMLReaderManager.getInstance().releaseXMLReader(reader); } } } finally { if(null != m_outputStream) { try { m_outputStream.close(); } catch(IOException ioe){} m_outputStream = null; } } } /** * Add a parameter for the transformation. * *

        Pass a qualified name as a two-part string, the namespace URI * enclosed in curly braces ({}), followed by the local name. If the * name has a null URL, the String only contain the local name. An * application can safely check for a non-null URI by testing to see if the first * character of the name is a '{' character.

        *

        For example, if a URI and local name were obtained from an element * defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that * no prefix is used.

        * * @param name The name of the parameter, which may begin with a namespace URI * in curly braces ({}). * @param value The value object. This can be any valid Java object. It is * up to the processor to provide the proper object coersion or to simply * pass the object on for use in an extension. */ public void setParameter(String name, Object value) { if (value == null) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_SET_PARAM_VALUE, new Object[]{name})); } if (null == m_params) { m_params = new Hashtable(); } m_params.put(name, value); } /** * Get a parameter that was explicitly set with setParameter * or setParameters. * *

        This method does not return a default parameter value, which * cannot be determined until the node context is evaluated during * the transformation process. * * * @param name Name of the parameter. * @return A parameter that has been set with setParameter. */ public Object getParameter(String name) { if (null == m_params) return null; return m_params.get(name); } /** * Clear all parameters set with setParameter. */ public void clearParameters() { if (null == m_params) return; m_params.clear(); } /** * Set an object that will be used to resolve URIs used in * document(). * *

        If the resolver argument is null, the URIResolver value will * be cleared, and the default behavior will be used.

        * * @param resolver An object that implements the URIResolver interface, * or null. */ public void setURIResolver(URIResolver resolver) { m_URIResolver = resolver; } /** * Get an object that will be used to resolve URIs used in * document(), etc. * * @return An object that implements the URIResolver interface, * or null. */ public URIResolver getURIResolver() { return m_URIResolver; } /** * Set the output properties for the transformation. These * properties will override properties set in the Templates * with xsl:output. * *

        If argument to this function is null, any properties * previously set are removed, and the value will revert to the value * defined in the templates object.

        * *

        Pass a qualified property key name as a two-part string, the namespace URI * enclosed in curly braces ({}), followed by the local name. If the * name has a null URL, the String only contain the local name. An * application can safely check for a non-null URI by testing to see if the first * character of the name is a '{' character.

        *

        For example, if a URI and local name were obtained from an element * defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that * no prefix is used.

        * * @param oformat A set of output properties that will be * used to override any of the same properties in affect * for the transformation. * * @see javax.xml.transform.OutputKeys * @see java.util.Properties * * @throws IllegalArgumentException if any of the argument keys are not * recognized and are not namespace qualified. */ public void setOutputProperties(Properties oformat) throws IllegalArgumentException { if (null != oformat) { // See if an *explicit* method was set. String method = (String) oformat.get(OutputKeys.METHOD); if (null != method) m_outputFormat = new OutputProperties(method); else m_outputFormat = new OutputProperties(); m_outputFormat.copyFrom(oformat); } else { // if oformat is null JAXP says that any props previously set are removed // and we are to revert back to those in the templates object (i.e. Stylesheet). m_outputFormat = null; } } /** * Get a copy of the output properties for the transformation. * *

        The properties returned should contain properties set by the user, * and properties set by the stylesheet, and these properties * are "defaulted" by default properties specified by section 16 of the * XSL Transformations (XSLT) W3C Recommendation. The properties that * were specifically set by the user or the stylesheet should be in the base * Properties list, while the XSLT default properties that were not * specifically set should be the default Properties list. Thus, * getOutputProperties().getProperty(String key) will obtain any * property in that was set by {@link #setOutputProperty}, * {@link #setOutputProperties}, in the stylesheet, or the default * properties, while * getOutputProperties().get(String key) will only retrieve properties * that were explicitly set by {@link #setOutputProperty}, * {@link #setOutputProperties}, or in the stylesheet.

        * *

        Note that mutation of the Properties object returned will not * effect the properties that the transformation contains.

        * *

        If any of the argument keys are not recognized and are not * namespace qualified, the property will be ignored. In other words the * behaviour is not orthogonal with setOutputProperties.

        * * @return A copy of the set of output properties in effect * for the next transformation. * * @see javax.xml.transform.OutputKeys * @see java.util.Properties */ public Properties getOutputProperties() { return (Properties) m_outputFormat.getProperties().clone(); } /** * Set an output property that will be in effect for the * transformation. * *

        Pass a qualified property name as a two-part string, the namespace URI * enclosed in curly braces ({}), followed by the local name. If the * name has a null URL, the String only contain the local name. An * application can safely check for a non-null URI by testing to see if the first * character of the name is a '{' character.

        *

        For example, if a URI and local name were obtained from an element * defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that * no prefix is used.

        * *

        The Properties object that was passed to {@link #setOutputProperties} won't * be effected by calling this method.

        * * @param name A non-null String that specifies an output * property name, which may be namespace qualified. * @param value The non-null string value of the output property. * * @throws IllegalArgumentException If the property is not supported, and is * not qualified with a namespace. * * @see javax.xml.transform.OutputKeys */ public void setOutputProperty(String name, String value) throws IllegalArgumentException { if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " //+ name); m_outputFormat.setProperty(name, value); } /** * Get an output property that is in effect for the * transformation. The property specified may be a property * that was set with setOutputProperty, or it may be a * property specified in the stylesheet. * * @param name A non-null String that specifies an output * property name, which may be namespace qualified. * * @return The string value of the output property, or null * if no property was found. * * @throws IllegalArgumentException If the property is not supported. * * @see javax.xml.transform.OutputKeys */ public String getOutputProperty(String name) throws IllegalArgumentException { String value = null; OutputProperties props = m_outputFormat; value = props.getProperty(name); if (null == value) { if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " // + name); } return value; } /** * Set the error event listener in effect for the transformation. * * @param listener The new error listener. * @throws IllegalArgumentException if listener is null. */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { if (listener == null) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_ERROR_HANDLER, null)); else m_errorListener = listener; } /** * Get the error event handler in effect for the transformation. * * @return The current error handler, which should never be null. */ public ErrorListener getErrorListener() { return m_errorListener; } //////////////////////////////////////////////////////////////////// // Default implementation of DTDHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive notification of a notation declaration. * *

        By default, do nothing. Application writers may override this * method in a subclass if they wish to keep track of the notations * declared in a document.

        * * @param name The notation name. * @param publicId The notation public identifier, or null if not * available. * @param systemId The notation system identifier. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DTDHandler#notationDecl * * @throws SAXException */ public void notationDecl(String name, String publicId, String systemId) throws SAXException { if (null != m_resultDTDHandler) m_resultDTDHandler.notationDecl(name, publicId, systemId); } /** * Receive notification of an unparsed entity declaration. * *

        By default, do nothing. Application writers may override this * method in a subclass to keep track of the unparsed entities * declared in a document.

        * * @param name The entity name. * @param publicId The entity public identifier, or null if not * available. * @param systemId The entity system identifier. * @param notationName The name of the associated notation. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DTDHandler#unparsedEntityDecl * * @throws SAXException */ public void unparsedEntityDecl( String name, String publicId, String systemId, String notationName) throws SAXException { if (null != m_resultDTDHandler) m_resultDTDHandler.unparsedEntityDecl(name, publicId, systemId, notationName); } //////////////////////////////////////////////////////////////////// // Default implementation of ContentHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive a Locator object for document events. * *

        By default, do nothing. Application writers may override this * method in a subclass if they wish to store the locator for use * with other document events.

        * * @param locator A locator for all SAX document events. * @see org.xml.sax.ContentHandler#setDocumentLocator * @see org.xml.sax.Locator */ public void setDocumentLocator(Locator locator) { try { if (null == m_resultContentHandler) createResultContentHandler(m_result); } catch (TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } m_resultContentHandler.setDocumentLocator(locator); } /** * Receive notification of the beginning of the document. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the beginning * of a document (such as allocating the root node of a tree or * creating an output file).

        * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startDocument * * @throws SAXException */ public void startDocument() throws SAXException { try { if (null == m_resultContentHandler) createResultContentHandler(m_result); } catch (TransformerException te) { throw new SAXException(te.getMessage(), te); } // Reset for multiple transforms with this transformer. m_flushedStartDoc = false; m_foundFirstElement = false; } boolean m_flushedStartDoc = false; protected final void flushStartDoc() throws SAXException { if(!m_flushedStartDoc) { if (m_resultContentHandler == null) { try { createResultContentHandler(m_result); } catch(TransformerException te) { throw new SAXException(te); } } m_resultContentHandler.startDocument(); m_flushedStartDoc = true; } } /** * Receive notification of the end of the document. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end * of a document (such as finalising a tree or closing an output * file).

        * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument * * @throws SAXException */ public void endDocument() throws SAXException { flushStartDoc(); m_resultContentHandler.endDocument(); } /** * Receive notification of the start of a Namespace mapping. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each Namespace prefix scope (such as storing the prefix mapping).

        * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI mapped to the prefix. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startPrefixMapping * * @throws SAXException */ public void startPrefixMapping(String prefix, String uri) throws SAXException { flushStartDoc(); m_resultContentHandler.startPrefixMapping(prefix, uri); } /** * Receive notification of the end of a Namespace mapping. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each prefix mapping.

        * * @param prefix The Namespace prefix being declared. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endPrefixMapping * * @throws SAXException */ public void endPrefixMapping(String prefix) throws SAXException { flushStartDoc(); m_resultContentHandler.endPrefixMapping(prefix); } /** * Receive notification of the start of an element. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each element (such as allocating a new tree node or writing * output to a file).

        * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified name (with prefix), or the * empty string if qualified names are not available. * @param attributes The specified or defaulted attributes. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement * * @throws SAXException */ public void startElement( String uri, String localName, String qName, Attributes attributes) throws SAXException { if (!m_foundFirstElement && null != m_serializer) { m_foundFirstElement = true; Serializer newSerializer; try { newSerializer = SerializerSwitcher.switchSerializerIfHTML(uri, localName, m_outputFormat.getProperties(), m_serializer); } catch (TransformerException te) { throw new SAXException(te); } if (newSerializer != m_serializer) { try { m_resultContentHandler = newSerializer.asContentHandler(); } catch (IOException ioe) // why? { throw new SAXException(ioe); } if (m_resultContentHandler instanceof DTDHandler) m_resultDTDHandler = (DTDHandler) m_resultContentHandler; if (m_resultContentHandler instanceof LexicalHandler) m_resultLexicalHandler = (LexicalHandler) m_resultContentHandler; m_serializer = newSerializer; } } flushStartDoc(); m_resultContentHandler.startElement(uri, localName, qName, attributes); } /** * Receive notification of the end of an element. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the end of * each element (such as finalising a tree node or writing * output to a file).

        * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param qName The qualified name (with prefix), or the * empty string if qualified names are not available. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endElement * * @throws SAXException */ public void endElement(String uri, String localName, String qName) throws SAXException { m_resultContentHandler.endElement(uri, localName, qName); } /** * Receive notification of character data inside an element. * *

        By default, do nothing. Application writers may override this * method to take specific actions for each chunk of character data * (such as adding the data to a node or buffer, or printing it to * a file).

        * * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#characters * * @throws SAXException */ public void characters(char ch[], int start, int length) throws SAXException { flushStartDoc(); m_resultContentHandler.characters(ch, start, length); } /** * Receive notification of ignorable whitespace in element content. * *

        By default, do nothing. Application writers may override this * method to take specific actions for each chunk of ignorable * whitespace (such as adding data to a node or buffer, or printing * it to a file).

        * * @param ch The whitespace characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#ignorableWhitespace * * @throws SAXException */ public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { m_resultContentHandler.ignorableWhitespace(ch, start, length); } /** * Receive notification of a processing instruction. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.

        * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction * * @throws SAXException */ public void processingInstruction(String target, String data) throws SAXException { flushStartDoc(); m_resultContentHandler.processingInstruction(target, data); } /** * Receive notification of a skipped entity. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.

        * * @param name The name of the skipped entity. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction * * @throws SAXException */ public void skippedEntity(String name) throws SAXException { flushStartDoc(); m_resultContentHandler.skippedEntity(name); } /** * Report the start of DTD declarations, if any. * *

        Any declarations are assumed to be in the internal subset * unless otherwise indicated by a {@link #startEntity startEntity} * event.

        * *

        Note that the start/endDTD events will appear within * the start/endDocument events from ContentHandler and * before the first startElement event.

        * * @param name The document type name. * @param publicId The declared public identifier for the * external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the * external DTD subset, or null if none was declared. * @throws SAXException The application may raise an * exception. * @see #endDTD * @see #startEntity */ public void startDTD(String name, String publicId, String systemId) throws SAXException { flushStartDoc(); if (null != m_resultLexicalHandler) m_resultLexicalHandler.startDTD(name, publicId, systemId); } /** * Report the end of DTD declarations. * * @throws SAXException The application may raise an exception. * @see #startDTD */ public void endDTD() throws SAXException { if (null != m_resultLexicalHandler) m_resultLexicalHandler.endDTD(); } /** * Report the beginning of an entity in content. * *

        NOTE: entity references in attribute * values -- and the start and end of the document entity -- * are never reported.

        * *

        The start and end of the external DTD subset are reported * using the pseudo-name "[dtd]". All other events must be * properly nested within start/end entity events.

        * *

        Note that skipped entities will be reported through the * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} * event, which is part of the ContentHandler interface.

        * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @throws SAXException The application may raise an exception. * @see #endEntity * @see org.xml.sax.ext.DeclHandler#internalEntityDecl * @see org.xml.sax.ext.DeclHandler#externalEntityDecl */ public void startEntity(String name) throws SAXException { if (null != m_resultLexicalHandler) m_resultLexicalHandler.startEntity(name); } /** * Report the end of an entity. * * @param name The name of the entity that is ending. * @throws SAXException The application may raise an exception. * @see #startEntity */ public void endEntity(String name) throws SAXException { if (null != m_resultLexicalHandler) m_resultLexicalHandler.endEntity(name); } /** * Report the start of a CDATA section. * *

        The contents of the CDATA section will be reported through * the regular {@link org.xml.sax.ContentHandler#characters * characters} event.

        * * @throws SAXException The application may raise an exception. * @see #endCDATA */ public void startCDATA() throws SAXException { if (null != m_resultLexicalHandler) m_resultLexicalHandler.startCDATA(); } /** * Report the end of a CDATA section. * * @throws SAXException The application may raise an exception. * @see #startCDATA */ public void endCDATA() throws SAXException { if (null != m_resultLexicalHandler) m_resultLexicalHandler.endCDATA(); } /** * Report an XML comment anywhere in the document. * *

        This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read).

        * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws SAXException { flushStartDoc(); if (null != m_resultLexicalHandler) m_resultLexicalHandler.comment(ch, start, length); } // Implement DeclHandler /** * Report an element type declaration. * *

        The content model will consist of the string "EMPTY", the * string "ANY", or a parenthesised group, optionally followed * by an occurrence indicator. The model will be normalized so * that all whitespace is removed,and will include the enclosing * parentheses.

        * * @param name The element type name. * @param model The content model as a normalized string. * @exception SAXException The application may raise an exception. */ public void elementDecl (String name, String model) throws SAXException { if (null != m_resultDeclHandler) m_resultDeclHandler.elementDecl(name, model); } /** * Report an attribute type declaration. * *

        Only the effective (first) declaration for an attribute will * be reported. The type will be one of the strings "CDATA", * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", * "ENTITIES", or "NOTATION", or a parenthesized token group with * the separator "|" and all whitespace removed.

        * * @param eName The name of the associated element. * @param aName The name of the attribute. * @param type A string representing the attribute type. * @param valueDefault A string representing the attribute default * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if * none of these applies. * @param value A string representing the attribute's default value, * or null if there is none. * @exception SAXException The application may raise an exception. */ public void attributeDecl (String eName, String aName, String type, String valueDefault, String value) throws SAXException { if (null != m_resultDeclHandler) m_resultDeclHandler.attributeDecl(eName, aName, type, valueDefault, value); } /** * Report an internal entity declaration. * *

        Only the effective (first) declaration for each entity * will be reported.

        * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param value The replacement text of the entity. * @exception SAXException The application may raise an exception. * @see #externalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void internalEntityDecl (String name, String value) throws SAXException { if (null != m_resultDeclHandler) m_resultDeclHandler.internalEntityDecl(name, value); } /** * Report a parsed external entity declaration. * *

        Only the effective (first) declaration for each entity * will be reported.

        * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%'. * @param publicId The declared public identifier of the entity, or * null if none was declared. * @param systemId The declared system identifier of the entity. * @exception SAXException The application may raise an exception. * @see #internalEntityDecl * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void externalEntityDecl (String name, String publicId, String systemId) throws SAXException { if (null != m_resultDeclHandler) m_resultDeclHandler.externalEntityDecl(name, publicId, systemId); } /** * This is null unless we own the stream. */ private java.io.FileOutputStream m_outputStream = null; /** The content handler where result events will be sent. */ private ContentHandler m_resultContentHandler; /** The lexical handler where result events will be sent. */ private LexicalHandler m_resultLexicalHandler; /** The DTD handler where result events will be sent. */ private DTDHandler m_resultDTDHandler; /** The Decl handler where result events will be sent. */ private DeclHandler m_resultDeclHandler; /** The Serializer, which may or may not be null. */ private Serializer m_serializer; /** The Result object. */ private Result m_result; /** * The system ID, which is unused, but must be returned to fullfill the * TransformerHandler interface. */ private String m_systemID; /** * The parameters, which is unused, but must be returned to fullfill the * Transformer interface. */ private Hashtable m_params; /** The error listener for TrAX errors and warnings. */ private ErrorListener m_errorListener = new org.apache.xml.utils.DefaultErrorHandler(false); /** * The URIResolver, which is unused, but must be returned to fullfill the * TransformerHandler interface. */ URIResolver m_URIResolver; /** The output properties. */ private OutputProperties m_outputFormat; /** Flag to set if we've found the first element, so we can tell if we have * to check to see if we should create an HTML serializer. */ boolean m_foundFirstElement; /** * State of the secure processing feature. */ private boolean m_isSecureProcessing = false; } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformState.java0000644000175000017500000001022010721374033025356 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformState.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import javax.xml.transform.Transformer; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xml.serializer.TransformStateSetter; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeIterator; /** * This interface is meant to be used by a consumer of * SAX2 events produced by Xalan, and enables the consumer * to get information about the state of the transform. It * is primarily intended as a tooling interface. A content * handler can get a reference to a TransformState by implementing * the TransformerClient interface. Xalan will check for * that interface before it calls startDocument, and, if it * is implemented, pass in a TransformState reference to the * setTransformState method. * *

        Note that the current stylesheet and root stylesheet can * be retrieved from the ElemTemplateElement obtained from * either getCurrentElement() or getCurrentTemplate().

        * * This interface contains only getter methods, any setters are in the interface * TransformStateSetter which this interface extends. * * @see org.apache.xml.serializer.TransformStateSetter */ public interface TransformState extends TransformStateSetter { /** * Retrieves the stylesheet element that produced * the SAX event. * *

        Please note that the ElemTemplateElement returned may * be in a default template, and thus may not be * defined in the stylesheet.

        * * @return the stylesheet element that produced the SAX event. */ ElemTemplateElement getCurrentElement(); /** * This method retrieves the current context node * in the source tree. * * @return the current context node in the source tree. */ Node getCurrentNode(); /** * This method retrieves the xsl:template * that is in effect, which may be a matched template * or a named template. * *

        Please note that the ElemTemplate returned may * be a default template, and thus may not have a template * defined in the stylesheet.

        * * @return the xsl:template that is in effect */ ElemTemplate getCurrentTemplate(); /** * This method retrieves the xsl:template * that was matched. Note that this may not be * the same thing as the current template (which * may be from getCurrentElement()), since a named * template may be in effect. * *

        Please note that the ElemTemplate returned may * be a default template, and thus may not have a template * defined in the stylesheet.

        * * @return the xsl:template that was matched. */ ElemTemplate getMatchedTemplate(); /** * Retrieves the node in the source tree that matched * the template obtained via getMatchedTemplate(). * * @return the node in the source tree that matched * the template obtained via getMatchedTemplate(). */ Node getMatchedNode(); /** * Get the current context node list. * * @return the current context node list. */ NodeIterator getContextNodeList(); /** * Get the TrAX Transformer object in effect. * * @return the TrAX Transformer object in effect. */ Transformer getTransformer(); } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/XalanTransformState.java0000644000175000017500000001201110721374033026342 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XalanTransformState.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import javax.xml.transform.Transformer; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeIterator; /** * Before the serializer merge, the TransformState interface was * implemented by ResultTreeHandler. */ public class XalanTransformState implements TransformState { Node m_node = null; ElemTemplateElement m_currentElement = null; ElemTemplate m_currentTemplate = null; ElemTemplate m_matchedTemplate = null; int m_currentNodeHandle = DTM.NULL; Node m_currentNode = null; int m_matchedNode = DTM.NULL; DTMIterator m_contextNodeList = null; boolean m_elemPending = false; TransformerImpl m_transformer = null; /** * @see org.apache.xml.serializer.TransformStateSetter#setCurrentNode(Node) */ public void setCurrentNode(Node n) { m_node = n; } /** * @see org.apache.xml.serializer.TransformStateSetter#resetState(Transformer) */ public void resetState(Transformer transformer) { if ((transformer != null) && (transformer instanceof TransformerImpl)) { m_transformer = (TransformerImpl)transformer; m_currentElement = m_transformer.getCurrentElement(); m_currentTemplate = m_transformer.getCurrentTemplate(); m_matchedTemplate = m_transformer.getMatchedTemplate(); int currentNodeHandle = m_transformer.getCurrentNode(); DTM dtm = m_transformer.getXPathContext().getDTM(currentNodeHandle); m_currentNode = dtm.getNode(currentNodeHandle); m_matchedNode = m_transformer.getMatchedNode(); m_contextNodeList = m_transformer.getContextNodeList(); } } /** * @see org.apache.xalan.transformer.TransformState#getCurrentElement() */ public ElemTemplateElement getCurrentElement() { if (m_elemPending) return m_currentElement; else return m_transformer.getCurrentElement(); } /** * @see org.apache.xalan.transformer.TransformState#getCurrentNode() */ public Node getCurrentNode() { if (m_currentNode != null) { return m_currentNode; } else { DTM dtm = m_transformer.getXPathContext().getDTM(m_transformer.getCurrentNode()); return dtm.getNode(m_transformer.getCurrentNode()); } } /** * @see org.apache.xalan.transformer.TransformState#getCurrentTemplate() */ public ElemTemplate getCurrentTemplate() { if (m_elemPending) return m_currentTemplate; else return m_transformer.getCurrentTemplate(); } /** * @see org.apache.xalan.transformer.TransformState#getMatchedTemplate() */ public ElemTemplate getMatchedTemplate() { if (m_elemPending) return m_matchedTemplate; else return m_transformer.getMatchedTemplate(); } /** * @see org.apache.xalan.transformer.TransformState#getMatchedNode() */ public Node getMatchedNode() { if (m_elemPending) { DTM dtm = m_transformer.getXPathContext().getDTM(m_matchedNode); return dtm.getNode(m_matchedNode); } else { DTM dtm = m_transformer.getXPathContext().getDTM(m_transformer.getMatchedNode()); return dtm.getNode(m_transformer.getMatchedNode()); } } /** * @see org.apache.xalan.transformer.TransformState#getContextNodeList() */ public NodeIterator getContextNodeList() { if (m_elemPending) { return new org.apache.xml.dtm.ref.DTMNodeIterator(m_contextNodeList); } else { return new org.apache.xml.dtm.ref.DTMNodeIterator(m_transformer.getContextNodeList()); } } /** * @see org.apache.xalan.transformer.TransformState#getTransformer() */ public Transformer getTransformer() { return m_transformer; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/StackGuard.java0000644000175000017500000001343210721374031024440 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StackGuard.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xml.utils.ObjectStack; /** * Class to guard against recursion getting too deep. */ public class StackGuard { /** * Used for infinite loop check. If the value is -1, do not * check for infinite loops. Anyone who wants to enable that * check should change the value of this variable to be the * level of recursion that they want to check. Be careful setting * this variable, if the number is too low, it may report an * infinite loop situation, when there is none. * Post version 1.0.0, we'll make this a runtime feature. */ private int m_recursionLimit = -1; TransformerImpl m_transformer; /** * Get the recursion limit. * Used for infinite loop check. If the value is -1, do not * check for infinite loops. Anyone who wants to enable that * check should change the value of this variable to be the * level of recursion that they want to check. Be careful setting * this variable, if the number is too low, it may report an * infinite loop situation, when there is none. * Post version 1.0.0, we'll make this a runtime feature. * * @return The recursion limit. */ public int getRecursionLimit() { return m_recursionLimit; } /** * Set the recursion limit. * Used for infinite loop check. If the value is -1, do not * check for infinite loops. Anyone who wants to enable that * check should change the value of this variable to be the * level of recursion that they want to check. Be careful setting * this variable, if the number is too low, it may report an * infinite loop situation, when there is none. * Post version 1.0.0, we'll make this a runtime feature. * * @param limit The recursion limit. */ public void setRecursionLimit(int limit) { m_recursionLimit = limit; } /** * Constructor StackGuard * */ public StackGuard(TransformerImpl transformerImpl) { m_transformer = transformerImpl; } /** * Overide equal method for StackGuard objects * */ public int countLikeTemplates(ElemTemplate templ, int pos) { ObjectStack elems = m_transformer.getCurrentTemplateElements(); int count = 1; for (int i = pos-1; i >= 0; i--) { if((ElemTemplateElement)elems.elementAt(i) == templ) count++; } return count; } /** * Get the next named or match template down from and including * the given position. * @param pos the current index position in the stack. * @return null if no matched or named template found, otherwise * the next named or matched template at or below the position. */ private ElemTemplate getNextMatchOrNamedTemplate(int pos) { ObjectStack elems = m_transformer.getCurrentTemplateElements(); for (int i = pos; i >= 0; i--) { ElemTemplateElement elem = (ElemTemplateElement) elems.elementAt(i); if(null != elem) { if(elem.getXSLToken() == Constants.ELEMNAME_TEMPLATE) { return (ElemTemplate)elem; } } } return null; } /** * Check if we are in an infinite loop * * @throws TransformerException */ public void checkForInfinateLoop() throws TransformerException { int nTemplates = m_transformer.getCurrentTemplateElementsCount(); if(nTemplates < m_recursionLimit) return; if(m_recursionLimit <= 0) return; // Safety check. // loop from the top index down to the recursion limit (I don't think // there's any need to go below that). for (int i = (nTemplates - 1); i >= m_recursionLimit; i--) { ElemTemplate template = getNextMatchOrNamedTemplate(i); if(null == template) break; int loopCount = countLikeTemplates(template, i); if (loopCount >= m_recursionLimit) { // throw new TransformerException("Template nesting too deep. nesting = "+loopCount+ // ", template "+((null == template.getName()) ? "name = " : "match = ")+ // ((null != template.getName()) ? template.getName().toString() // : template.getMatch().getPatternString())); String idIs = XSLMessages.createMessage(((null != template.getName()) ? "nameIs" : "matchPatternIs"), null); Object[] msgArgs = new Object[]{ new Integer(loopCount), idIs, ((null != template.getName()) ? template.getName().toString() : template.getMatch().getPatternString()) }; String msg = XSLMessages.createMessage("recursionTooDeep", msgArgs); throw new TransformerException(msg); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/NodeSortKey.java0000644000175000017500000001054210721374033024617 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSortKey.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.text.Collator; import java.util.Locale; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xpath.XPath; /** * Data structure for use by the NodeSorter class. * @xsl.usage internal */ class NodeSortKey { /** Select pattern for this sort key */ XPath m_selectPat; /** Flag indicating whether to treat thee result as a number */ boolean m_treatAsNumbers; /** Flag indicating whether to sort in descending order */ boolean m_descending; /** Flag indicating by case */ boolean m_caseOrderUpper; /** Collator instance */ Collator m_col; /** Locale we're in */ Locale m_locale; /** Prefix resolver to use */ org.apache.xml.utils.PrefixResolver m_namespaceContext; /** Transformer instance */ TransformerImpl m_processor; // needed for error reporting. /** * Constructor NodeSortKey * * * @param transformer non null transformer instance * @param selectPat Select pattern for this key * @param treatAsNumbers Flag indicating whether the result will be a number * @param descending Flag indicating whether to sort in descending order * @param langValue Lang value to use to get locale * @param caseOrderUpper Flag indicating whether case is relevant * @param namespaceContext Prefix resolver * * @throws javax.xml.transform.TransformerException */ NodeSortKey( TransformerImpl transformer, XPath selectPat, boolean treatAsNumbers, boolean descending, String langValue, boolean caseOrderUpper, org.apache.xml.utils.PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { m_processor = transformer; m_namespaceContext = namespaceContext; m_selectPat = selectPat; m_treatAsNumbers = treatAsNumbers; m_descending = descending; m_caseOrderUpper = caseOrderUpper; if (null != langValue && m_treatAsNumbers == false) { // See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2851 // The constructor of Locale is defined as // public Locale(String language, String country) // with // language - lowercase two-letter ISO-639 code // country - uppercase two-letter ISO-3166 code // a) language must be provided as a lower-case ISO-code // instead of an upper-case code // b) country must be provided as an ISO-code // instead of a full localized country name (e.g. "France") m_locale = new Locale(langValue.toLowerCase(), Locale.getDefault().getCountry()); // (old, before bug report 2851). // m_locale = new Locale(langValue.toUpperCase(), // Locale.getDefault().getDisplayCountry()); if (null == m_locale) { // m_processor.warn("Could not find locale for 1) ? m_startElement : null; // } /** * To re-initialize the document and element events * */ protected void reInitEvents() { } /** * Push document event and re-initialize events * */ public void reset() { pushDocumentEvent(); reInitEvents(); } /** * Push the document event. This never gets popped. */ void pushDocumentEvent() { // m_startDoc.setPending(true); // initQSE(m_startDoc); m_docPending = true; m_eventCount++; } /** * Pop element event * */ void popEvent() { m_elemIsPending = false; m_attributes.clear(); m_nsDeclsHaveBeenAdded = false; m_name = null; m_url = null; m_localName = null; m_namespaces = null; m_eventCount--; } /** Instance of a serializer */ private org.apache.xml.serializer.Serializer m_serializer; /** * This is only for use of object pooling, so that * it can be reset. * * @param s non-null instance of a serializer */ void setSerializer(org.apache.xml.serializer.Serializer s) { m_serializer = s; } /** * This is only for use of object pooling, so the that * it can be reset. * * @return The serializer */ org.apache.xml.serializer.Serializer getSerializer() { return m_serializer; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/KeyRefIterator.java0000644000175000017500000001256210721374030025311 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyRefIterator.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Vector; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.KeyDeclaration; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.QName; import org.apache.xml.utils.XMLString; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; /** * This class filters nodes from a key iterator, according to * whether or not the use value matches the ref value. * @xsl.usage internal */ public class KeyRefIterator extends org.apache.xpath.axes.ChildTestIterator { static final long serialVersionUID = 3837456451659435102L; /** * Constructor KeyRefIterator * * * @param ref Key value to match * @param ki The main key iterator used to walk the source tree */ public KeyRefIterator(QName name, XMLString ref, Vector keyDecls, DTMIterator ki) { super(null); m_name = name; m_ref = ref; m_keyDeclarations = keyDecls; m_keysNodes = ki; setWhatToShow(org.apache.xml.dtm.DTMFilter.SHOW_ALL); } DTMIterator m_keysNodes; /** * Get the next node via getNextXXX. Bottlenecked for derived class override. * @return The next node on the axis, or DTM.NULL. */ protected int getNextNode() { int next; while(DTM.NULL != (next = m_keysNodes.nextNode())) { if(DTMIterator.FILTER_ACCEPT == filterNode(next)) break; } m_lastFetched = next; return next; } /** * Test whether a specified node is visible in the logical view of a * TreeWalker or NodeIterator. This function will be called by the * implementation of TreeWalker and NodeIterator; it is not intended to * be called directly from user code. * * @param testNode The node to check to see if it passes the filter or not. * * @return a constant to determine whether the node is accepted, * rejected, or skipped, as defined above . */ public short filterNode(int testNode) { boolean foundKey = false; Vector keys = m_keyDeclarations; QName name = m_name; KeyIterator ki = (KeyIterator)(((XNodeSet)m_keysNodes).getContainedIter()); org.apache.xpath.XPathContext xctxt = ki.getXPathContext(); if(null == xctxt) assertion(false, "xctxt can not be null here!"); try { XMLString lookupKey = m_ref; // System.out.println("lookupKey: "+lookupKey); int nDeclarations = keys.size(); // Walk through each of the declarations made with xsl:key for (int i = 0; i < nDeclarations; i++) { KeyDeclaration kd = (KeyDeclaration) keys.elementAt(i); // Only continue if the name on this key declaration // matches the name on the iterator for this walker. if (!kd.getName().equals(name)) continue; foundKey = true; // xctxt.setNamespaceContext(ki.getPrefixResolver()); // Query from the node, according the the select pattern in the // use attribute in xsl:key. XObject xuse = kd.getUse().execute(xctxt, testNode, ki.getPrefixResolver()); if (xuse.getType() != xuse.CLASS_NODESET) { XMLString exprResult = xuse.xstr(); if (lookupKey.equals(exprResult)) return DTMIterator.FILTER_ACCEPT; } else { DTMIterator nl = ((XNodeSet)xuse).iterRaw(); int useNode; while (DTM.NULL != (useNode = nl.nextNode())) { DTM dtm = getDTM(useNode); XMLString exprResult = dtm.getStringValue(useNode); if ((null != exprResult) && lookupKey.equals(exprResult)) return DTMIterator.FILTER_ACCEPT; } } } // end for(int i = 0; i < nDeclarations; i++) } catch (javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } if (!foundKey) throw new RuntimeException( XSLMessages.createMessage( XSLTErrorResources.ER_NO_XSLKEY_DECLARATION, new Object[] { name.getLocalName()})); return DTMIterator.FILTER_REJECT; } protected XMLString m_ref; protected QName m_name; /** Vector of Key declarations in the stylesheet. * @serial */ protected Vector m_keyDeclarations; } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/NumeratorFormatter.java0000644000175000017500000002465410721374033026262 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NumeratorFormatter.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Locale; import java.util.NoSuchElementException; import org.w3c.dom.Element; /** * Converts enumerated numbers into strings, using the XSL conversion attributes. * Having this in a class helps avoid being forced to extract the attributes repeatedly. * @xsl.usage internal */ class NumeratorFormatter { /** The owning xsl:number element. */ protected Element m_xslNumberElement; /** An instance of a Tokenizer */ NumberFormatStringTokenizer m_formatTokenizer; /** Locale we need to format in */ Locale m_locale; /** An instance of a NumberFormat */ java.text.NumberFormat m_formatter; /** An instance of a transformer */ TransformerImpl m_processor; /** * Table to help in converting decimals to roman numerals. * @see org.apache.xalan.transformer.DecimalToRoman */ private final static DecimalToRoman m_romanConvertTable[] = { new DecimalToRoman(1000, "M", 900, "CM"), new DecimalToRoman(500, "D", 400, "CD"), new DecimalToRoman(100L, "C", 90L, "XC"), new DecimalToRoman(50L, "L", 40L, "XL"), new DecimalToRoman(10L, "X", 9L, "IX"), new DecimalToRoman(5L, "V", 4L, "IV"), new DecimalToRoman(1L, "I", 1L, "I") }; /** * Chars for converting integers into alpha counts. * @see TransformerImpl#int2alphaCount */ private final static char[] m_alphaCountTable = { 'Z', // z for zero 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y' }; /** * Construct a NumeratorFormatter using an element * that contains XSL number conversion attributes - * format, letter-value, xml:lang, digit-group-sep, * n-digits-per-group, and sequence-src. * * @param xslNumberElement The given xsl:number element * @param processor a non-null transformer instance */ NumeratorFormatter(Element xslNumberElement, TransformerImpl processor) { m_xslNumberElement = xslNumberElement; m_processor = processor; } // end NumeratorFormatter(Element) constructor /** * Convert a long integer into alphabetic counting, in other words * count using the sequence A B C ... Z AA AB AC.... etc. * * @param val Value to convert -- must be greater than zero. * @param table a table containing one character for each digit in the radix * @return String representing alpha count of number. * @see org.apache.xalan.transformer.DecimalToRoman * * Note that the radix of the conversion is inferred from the size * of the table. */ protected String int2alphaCount(int val, char[] table) { int radix = table.length; // Create a buffer to hold the result // TODO: size of the table can be detereined by computing // logs of the radix. For now, we fake it. char buf[] = new char[100]; // next character to set in the buffer int charPos = buf.length - 1; // work backward through buf[] // index in table of the last character that we stored int lookupIndex = 1; // start off with anything other than zero to make correction work // Correction number // // Correction can take on exactly two values: // // 0 if the next character is to be emitted is usual // // radix - 1 // if the next char to be emitted should be one less than // you would expect // // For example, consider radix 10, where 1="A" and 10="J" // // In this scheme, we count: A, B, C ... H, I, J (not A0 and certainly // not AJ), A1 // // So, how do we keep from emitting AJ for 10? After correctly emitting the // J, lookupIndex is zero. We now compute a correction number of 9 (radix-1). // In the following line, we'll compute (val+correction) % radix, which is, // (val+9)/10. By this time, val is 1, so we compute (1+9) % 10, which // is 10 % 10 or zero. So, we'll prepare to emit "JJ", but then we'll // later suppress the leading J as representing zero (in the mod system, // it can represent either 10 or zero). In summary, the correction value of // "radix-1" acts like "-1" when run through the mod operator, but with the // desireable characteristic that it never produces a negative number. int correction = 0; // TODO: throw error on out of range input do { // most of the correction calculation is explained above, the reason for the // term after the "|| " is that it correctly propagates carries across // multiple columns. correction = ((lookupIndex == 0) || (correction != 0 && lookupIndex == radix - 1)) ? (radix - 1) : 0; // index in "table" of the next char to emit lookupIndex = (val + correction) % radix; // shift input by one "column" val = (val / radix); // if the next value we'd put out would be a leading zero, we're done. if (lookupIndex == 0 && val == 0) break; // put out the next character of output buf[charPos--] = table[lookupIndex]; } while (val > 0); return new String(buf, charPos + 1, (buf.length - charPos - 1)); } /** * Convert a long integer into roman numerals. * @param val Value to convert. * @param prefixesAreOK true_ to enable prefix notation (e.g. 4 = "IV"), * false_ to disable prefix notation (e.g. 4 = "IIII"). * @return Roman numeral string. * @see DecimalToRoman * @see m_romanConvertTable */ String long2roman(long val, boolean prefixesAreOK) { if (val <= 0) { return "#E(" + val + ")"; } String roman = ""; int place = 0; if (val <= 3999L) { do { while (val >= m_romanConvertTable[place].m_postValue) { roman += m_romanConvertTable[place].m_postLetter; val -= m_romanConvertTable[place].m_postValue; } if (prefixesAreOK) { if (val >= m_romanConvertTable[place].m_preValue) { roman += m_romanConvertTable[place].m_preLetter; val -= m_romanConvertTable[place].m_preValue; } } place++; } while (val > 0); } else { roman = "#error"; } return roman; } // end long2roman /** * This class returns tokens using non-alphanumberic * characters as delimiters. */ class NumberFormatStringTokenizer { /** Field holding the current position in the string */ private int currentPosition; /** The total length of the string */ private int maxPosition; /** The string to tokenize */ private String str; /** * Construct a NumberFormatStringTokenizer. * * @param str The string to tokenize */ NumberFormatStringTokenizer(String str) { this.str = str; maxPosition = str.length(); } /** * Reset tokenizer so that nextToken() starts from the beginning. * */ void reset() { currentPosition = 0; } /** * Returns the next token from this string tokenizer. * * @return the next token from this string tokenizer. * @throws NoSuchElementException if there are no more tokens in this * tokenizer's string. */ String nextToken() { if (currentPosition >= maxPosition) { throw new NoSuchElementException(); } int start = currentPosition; while ((currentPosition < maxPosition) && Character.isLetterOrDigit(str.charAt(currentPosition))) { currentPosition++; } if ((start == currentPosition) && (!Character.isLetterOrDigit(str.charAt(currentPosition)))) { currentPosition++; } return str.substring(start, currentPosition); } /** * Tells if nextToken will throw an exception * if it is called. * * @return true if nextToken can be called * without throwing an exception. */ boolean hasMoreTokens() { return (currentPosition >= maxPosition) ? false : true; } /** * Calculates the number of times that this tokenizer's * nextToken method can be called before it generates an * exception. * * @return the number of tokens remaining in the string using the current * delimiter set. * @see java.util.StringTokenizer#nextToken() */ int countTokens() { int count = 0; int currpos = currentPosition; while (currpos < maxPosition) { int start = currpos; while ((currpos < maxPosition) && Character.isLetterOrDigit(str.charAt(currpos))) { currpos++; } if ((start == currpos) && (Character.isLetterOrDigit(str.charAt(currpos)) == false)) { currpos++; } count++; } return count; } } // end NumberFormatStringTokenizer } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/package.html0000644000175000017500000000400310721374033024022 0ustar mkochmkoch Xalan Transformer Package.

        In charge of run-time transformations and the production of result trees.

        {@link org.apache.xalan.transformer.TransformerImpl} implements the {@link javax.xml.transform.Transformer} interface, and is the core representation of the transformation execution.

        For each node in the XML source, TransformerImpl uses the StylesheetRoot and underlying XSLT schema to determine which template to apply: one of the templates in the StylesheetRoot, a default template rule as specified in the XSLT spec, or none.

        The Transformer works with {@link org.apache.xml.serializer.SerializationHandler} to forward the SAX-like events produced by the transformation to the appropriate output ContentHandler.

        To the degree possible, the parsing of the XML source and application of the Templates object to that source are performed concurrently in separate threads. When necessary, the Transformer waits for the parse events that must be in place before a given template may be applied.

        libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformSnapshot.java0000644000175000017500000000241410721374032026102 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformSnapshot.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; /** * This is an opaque interface that allows the transformer to return a * "snapshot" of it's current state, which can later be restored. * * @deprecated It doesn't look like this code, which is for tooling, has * functioned propery for a while, so it doesn't look like it is being used. */ public interface TransformSnapshot { } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/DecimalToRoman.java0000644000175000017500000000406210721374031025245 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DecimalToRoman.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; /** * Structure to help in converting integers to roman numerals * @xsl.usage internal */ public class DecimalToRoman { /** * Constructor DecimalToRoman * * * @param postValue Minimum value for a given range of * roman numbers * @param postLetter Correspoding letter (roman) to postValue * @param preValue Value of last prefixed number within * that same range (i.e. IV if postval is 5 (V)) * @param preLetter Correspoding letter(roman) to preValue */ public DecimalToRoman(long postValue, String postLetter, long preValue, String preLetter) { this.m_postValue = postValue; this.m_postLetter = postLetter; this.m_preValue = preValue; this.m_preLetter = preLetter; } /** Minimum value for a given range of roman numbers */ public long m_postValue; /** Correspoding letter (roman) to m_postValue */ public String m_postLetter; /** Value of last prefixed number within that same range */ public long m_preValue; /** Correspoding letter (roman) to m_preValue */ public String m_preLetter; } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/SerializerSwitcher.java0000644000175000017500000001525410721374032026237 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SerializerSwitcher.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.io.OutputStream; import java.io.Writer; import java.util.Properties; import javax.xml.transform.OutputKeys; import javax.xml.transform.TransformerException; import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; import org.apache.xml.serializer.Method; import org.apache.xalan.templates.OutputProperties; import org.xml.sax.ContentHandler; /** * This is a helper class that decides if Xalan needs to switch * serializers, based on the first output element. */ public class SerializerSwitcher { /** * Switch to HTML serializer if element is HTML * * * @param transformer Non-null transformer instance * @param ns Namespace URI of the element * @param localName Local part of name of element * * @throws TransformerException */ public static void switchSerializerIfHTML( TransformerImpl transformer, String ns, String localName) throws TransformerException { if (null == transformer) return; if (((null == ns) || (ns.length() == 0)) && localName.equalsIgnoreCase("html")) { // System.out.println("transformer.getOutputPropertyNoDefault(OutputKeys.METHOD): "+ // transformer.getOutputPropertyNoDefault(OutputKeys.METHOD)); // Access at level of hashtable to see if the method has been set. if (null != transformer.getOutputPropertyNoDefault(OutputKeys.METHOD)) return; // Getting the output properties this way won't cause a clone of // the properties. Properties prevProperties = transformer.getOutputFormat().getProperties(); // We have to make sure we get an output properties with the proper // defaults for the HTML method. The easiest way to do this is to // have the OutputProperties class do it. OutputProperties htmlOutputProperties = new OutputProperties(Method.HTML); htmlOutputProperties.copyFrom(prevProperties, true); Properties htmlProperties = htmlOutputProperties.getProperties(); try { // Serializer oldSerializer = transformer.getSerializer(); Serializer oldSerializer = null; if (null != oldSerializer) { Serializer serializer = SerializerFactory.getSerializer(htmlProperties); Writer writer = oldSerializer.getWriter(); if (null != writer) serializer.setWriter(writer); else { OutputStream os = oldSerializer.getOutputStream(); if (null != os) serializer.setOutputStream(os); } // transformer.setSerializer(serializer); ContentHandler ch = serializer.asContentHandler(); transformer.setContentHandler(ch); } } catch (java.io.IOException e) { throw new TransformerException(e); } } } /** * Get the value of a property, without using the default properties. This * can be used to test if a property has been explicitly set by the stylesheet * or user. * * @param name The property name, which is a fully-qualified URI. * * @return The value of the property, or null if not found. * * @throws IllegalArgumentException If the property is not supported, * and is not namespaced. */ private static String getOutputPropertyNoDefault(String qnameString, Properties props) throws IllegalArgumentException { String value = (String)props.get(qnameString); return value; } /** * Switch to HTML serializer if element is HTML * * * @param ns Namespace URI of the element * @param localName Local part of name of element * * @throws TransformerException * @return new contentHandler. */ public static Serializer switchSerializerIfHTML( String ns, String localName, Properties props, Serializer oldSerializer) throws TransformerException { Serializer newSerializer = oldSerializer; if (((null == ns) || (ns.length() == 0)) && localName.equalsIgnoreCase("html")) { // System.out.println("transformer.getOutputPropertyNoDefault(OutputKeys.METHOD): "+ // transformer.getOutputPropertyNoDefault(OutputKeys.METHOD)); // Access at level of hashtable to see if the method has been set. if (null != getOutputPropertyNoDefault(OutputKeys.METHOD, props)) return newSerializer; // Getting the output properties this way won't cause a clone of // the properties. Properties prevProperties = props; // We have to make sure we get an output properties with the proper // defaults for the HTML method. The easiest way to do this is to // have the OutputProperties class do it. OutputProperties htmlOutputProperties = new OutputProperties(Method.HTML); htmlOutputProperties.copyFrom(prevProperties, true); Properties htmlProperties = htmlOutputProperties.getProperties(); // try { if (null != oldSerializer) { Serializer serializer = SerializerFactory.getSerializer(htmlProperties); Writer writer = oldSerializer.getWriter(); if (null != writer) serializer.setWriter(writer); else { OutputStream os = serializer.getOutputStream(); if (null != os) serializer.setOutputStream(os); } newSerializer = serializer; } } // catch (java.io.IOException e) // { // throw new TransformerException(e); // } } return newSerializer; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/MsgMgr.java0000644000175000017500000002425010721374032023605 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MsgMgr.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.w3c.dom.Node; /** * This class will manage error messages, warning messages, and other types of * message events. */ public class MsgMgr { /** * Create a message manager object. * * @param transformer non transformer instance */ public MsgMgr(TransformerImpl transformer) { m_transformer = transformer; } /** Transformer instance */ private TransformerImpl m_transformer; /** * Warn the user of a problem. * This is public for access by extensions. * * @param msg The message text to issue * @param terminate Flag indicating whether to terminate this process * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException */ public void message(SourceLocator srcLctr, String msg, boolean terminate) throws TransformerException { ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) { errHandler.warning(new TransformerException(msg, srcLctr)); } else { if (terminate) throw new TransformerException(msg, srcLctr); else System.out.println(msg); } } /** * Warn the user of a problem. * * @param msg Message text to issue * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void warn(SourceLocator srcLctr, String msg) throws TransformerException { warn(srcLctr, null, null, msg, null); } /** * Warn the user of a problem. * * @param msg Message text to issue * @param args Arguments to pass to the message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void warn(SourceLocator srcLctr, String msg, Object[] args) throws TransformerException { warn(srcLctr, null, null, msg, args); } /** * Warn the user of a problem. * * * @param styleNode Stylesheet node * @param sourceNode Source tree node * @param msg Message text to issue * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void warn(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg) throws TransformerException { warn(srcLctr, styleNode, sourceNode, msg, null); } /** * Warn the user of a problem. * * @param styleNode Stylesheet node * @param sourceNode Source tree node * @param msg Message text to issue * @param args Arguments to pass to the message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void warn(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg, Object args[]) throws TransformerException { String formattedMsg = XSLMessages.createWarning(msg, args); ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) errHandler.warning(new TransformerException(formattedMsg, srcLctr)); else System.out.println(formattedMsg); } /* This method is not properly i18nized. We need to use the following method * Tell the user of an error, and probably throw an * exception. * * @param msg Message text to issue * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * public void error(SourceLocator srcLctr, String msg) throws TransformerException { // Locator locator = m_stylesheetLocatorStack.isEmpty() // ? null : // ((Locator)m_stylesheetLocatorStack.peek()); // Locator locator = null; ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) errHandler.fatalError(new TransformerException(msg, srcLctr)); else throw new TransformerException(msg, srcLctr); } * @xsl.usage internal */ /** * Tell the user of an error, and probably throw an * exception. * * @param msg Message text to issue * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void error(SourceLocator srcLctr, String msg) throws TransformerException { error(srcLctr, null, null, msg, null); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg Message text to issue * @param args Arguments to be passed to the message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void error(SourceLocator srcLctr, String msg, Object[] args) throws TransformerException { error(srcLctr, null, null, msg, args); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg Message text to issue * @param e Exception to throw * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void error(SourceLocator srcLctr, String msg, Exception e) throws TransformerException { error(srcLctr, msg, null, e); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg Message text to issue * @param args Arguments to use in message * @param e Exception to throw * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void error(SourceLocator srcLctr, String msg, Object args[], Exception e) throws TransformerException { //msg = (null == msg) ? XSLTErrorResources.ER_PROCESSOR_ERROR : msg; String formattedMsg = XSLMessages.createMessage(msg, args); // Locator locator = m_stylesheetLocatorStack.isEmpty() // ? null : // ((Locator)m_stylesheetLocatorStack.peek()); // Locator locator = null; ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) errHandler.fatalError(new TransformerException(formattedMsg, srcLctr)); else throw new TransformerException(formattedMsg, srcLctr); } /** * Tell the user of an error, and probably throw an * exception. * * @param styleNode Stylesheet node * @param sourceNode Source tree node * @param msg Message text to issue * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void error(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg) throws TransformerException { error(srcLctr, styleNode, sourceNode, msg, null); } /** * Tell the user of an error, and probably throw an * exception. * * @param styleNode Stylesheet node * @param sourceNode Source tree node * @param msg Message text to issue * @param args Arguments to use in message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException * @xsl.usage internal */ public void error(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg, Object args[]) throws TransformerException { String formattedMsg = XSLMessages.createMessage(msg, args); // Locator locator = m_stylesheetLocatorStack.isEmpty() // ? null : // ((Locator)m_stylesheetLocatorStack.peek()); // Locator locator = null; ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) errHandler.fatalError(new TransformerException(formattedMsg, srcLctr)); else throw new TransformerException(formattedMsg, srcLctr); } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TreeWalker2Result.java0000644000175000017500000001103410721374031025732 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TreeWalker2Result.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import org.apache.xalan.serialize.SerializerUtils; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.ref.DTMTreeWalker; import org.apache.xml.serializer.SerializationHandler; import org.apache.xpath.XPathContext; /** * Handle a walk of a tree, but screen out attributes for * the result tree. * @xsl.usage internal */ public class TreeWalker2Result extends DTMTreeWalker { /** The transformer instance */ TransformerImpl m_transformer; /** The result tree handler */ SerializationHandler m_handler; /** Node where to start the tree walk */ int m_startNode; /** * Constructor. * * @param transformer Non-null transformer instance * @param handler The Result tree handler to use */ public TreeWalker2Result(TransformerImpl transformer, SerializationHandler handler) { super(handler, null); m_transformer = transformer; m_handler = handler; } /** * Perform a pre-order traversal non-recursive style. * * @param pos Start node for traversal * * @throws TransformerException */ public void traverse(int pos) throws org.xml.sax.SAXException { m_dtm = m_transformer.getXPathContext().getDTM(pos); m_startNode = pos; super.traverse(pos); } /** * End processing of given node * * * @param node Node we just finished processing * * @throws org.xml.sax.SAXException */ protected void endNode(int node) throws org.xml.sax.SAXException { super.endNode(node); if(DTM.ELEMENT_NODE == m_dtm.getNodeType(node)) { m_transformer.getXPathContext().popCurrentNode(); } } /** * Start traversal of the tree at the given node * * * @param node Starting node for traversal * * @throws TransformerException */ protected void startNode(int node) throws org.xml.sax.SAXException { XPathContext xcntxt = m_transformer.getXPathContext(); try { if (DTM.ELEMENT_NODE == m_dtm.getNodeType(node)) { xcntxt.pushCurrentNode(node); if(m_startNode != node) { super.startNode(node); } else { String elemName = m_dtm.getNodeName(node); String localName = m_dtm.getLocalName(node); String namespace = m_dtm.getNamespaceURI(node); //xcntxt.pushCurrentNode(node); // SAX-like call to allow adding attributes afterwards m_handler.startElement(namespace, localName, elemName); boolean hasNSDecls = false; DTM dtm = m_dtm; for (int ns = dtm.getFirstNamespaceNode(node, true); DTM.NULL != ns; ns = dtm.getNextNamespaceNode(node, ns, true)) { SerializerUtils.ensureNamespaceDeclDeclared(m_handler,dtm, ns); } for (int attr = dtm.getFirstAttribute(node); DTM.NULL != attr; attr = dtm.getNextAttribute(attr)) { SerializerUtils.addAttribute(m_handler, attr); } } } else { xcntxt.pushCurrentNode(node); super.startNode(node); xcntxt.popCurrentNode(); } } catch(javax.xml.transform.TransformerException te) { throw new org.xml.sax.SAXException(te); } } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/XalanProperties.java0000644000175000017500000000237010721374030025526 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XalanProperties.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; /** * XalanProperties defines the features understood by * Xalan. * * @author Ovidiu Predescu * @since May 23, 2001 */ public class XalanProperties { public final static String SOURCE_LOCATION = "http://xml.apache.org/xalan/properties/source-location"; } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/TransformerClient.java0000644000175000017500000000316610721374031026054 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerClient.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; /** * A content handler can get a reference * to a TransformState by implementing * the TransformerClient interface. Xalan will check for * that interface before it calls startDocument, and, if it * is implemented, pass in a TransformState reference to the * setTransformState method. */ public interface TransformerClient { /** * Pass in a reference to a TransformState object, which * can be used during SAX ContentHandler events to obtain * information about he state of the transformation. This * method will be called before each startDocument event. * * @param ts A reference to a TransformState object */ void setTransformState(TransformState ts); } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/NodeSorter.java0000644000175000017500000003745410721374031024506 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSorter.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.text.CollationKey; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; /** * This class can sort vectors of DOM nodes according to a select pattern. * @xsl.usage internal */ public class NodeSorter { /** Current XPath context */ XPathContext m_execContext; /** Vector of NodeSortKeys */ Vector m_keys; // vector of NodeSortKeys // /** // * TODO: Adjust this for locale. // */ // NumberFormat m_formatter = NumberFormat.getNumberInstance(); /** * Construct a NodeSorter, passing in the XSL TransformerFactory * so it can know how to get the node data according to * the proper whitespace rules. * * @param p Xpath context to use */ public NodeSorter(XPathContext p) { m_execContext = p; } /** * Given a vector of nodes, sort each node according to * the criteria in the keys. * @param v an vector of Nodes. * @param keys a vector of NodeSortKeys. * @param support XPath context to use * * @throws javax.xml.transform.TransformerException */ public void sort(DTMIterator v, Vector keys, XPathContext support) throws javax.xml.transform.TransformerException { m_keys = keys; // QuickSort2(v, 0, v.size() - 1 ); int n = v.getLength(); // %OPT% Change mergesort to just take a DTMIterator? // We would also have to adapt DTMIterator to have the function // of NodeCompareElem. // Create a vector of node compare elements // based on the input vector of nodes Vector nodes = new Vector(); for (int i = 0; i < n; i++) { NodeCompareElem elem = new NodeCompareElem(v.item(i)); nodes.addElement(elem); } Vector scratchVector = new Vector(); mergesort(nodes, scratchVector, 0, n - 1, support); // return sorted vector of nodes for (int i = 0; i < n; i++) { v.setItem(((NodeCompareElem) nodes.elementAt(i)).m_node, i); } v.setCurrentPos(0); // old code... //NodeVector scratchVector = new NodeVector(n); //mergesort(v, scratchVector, 0, n - 1, support); } /** * Return the results of a compare of two nodes. * TODO: Optimize compare -- cache the getStringExpr results, key by m_selectPat + hash of node. * * @param n1 First node to use in compare * @param n2 Second node to use in compare * @param kIndex Index of NodeSortKey to use for sort * @param support XPath context to use * * @return The results of the compare of the two nodes. * * @throws TransformerException */ int compare( NodeCompareElem n1, NodeCompareElem n2, int kIndex, XPathContext support) throws TransformerException { int result = 0; NodeSortKey k = (NodeSortKey) m_keys.elementAt(kIndex); if (k.m_treatAsNumbers) { double n1Num, n2Num; if (kIndex == 0) { n1Num = ((Double) n1.m_key1Value).doubleValue(); n2Num = ((Double) n2.m_key1Value).doubleValue(); } else if (kIndex == 1) { n1Num = ((Double) n1.m_key2Value).doubleValue(); n2Num = ((Double) n2.m_key2Value).doubleValue(); } /* Leave this in case we decide to use an array later if (kIndex < maxkey) { double n1Num = (double)n1.m_keyValue[kIndex]; double n2Num = (double)n2.m_keyValue[kIndex]; }*/ else { // Get values dynamically XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node, k.m_namespaceContext); XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node, k.m_namespaceContext); n1Num = r1.num(); // Can't use NaN for compare. They are never equal. Use zero instead. // That way we can keep elements in document order. //n1Num = Double.isNaN(d) ? 0.0 : d; n2Num = r2.num(); //n2Num = Double.isNaN(d) ? 0.0 : d; } if ((n1Num == n2Num) && ((kIndex + 1) < m_keys.size())) { result = compare(n1, n2, kIndex + 1, support); } else { double diff; if (Double.isNaN(n1Num)) { if (Double.isNaN(n2Num)) diff = 0.0; else diff = -1; } else if (Double.isNaN(n2Num)) diff = 1; else diff = n1Num - n2Num; // process order parameter result = (int) ((diff < 0.0) ? (k.m_descending ? 1 : -1) : (diff > 0.0) ? (k.m_descending ? -1 : 1) : 0); } } // end treat as numbers else { CollationKey n1String, n2String; if (kIndex == 0) { n1String = (CollationKey) n1.m_key1Value; n2String = (CollationKey) n2.m_key1Value; } else if (kIndex == 1) { n1String = (CollationKey) n1.m_key2Value; n2String = (CollationKey) n2.m_key2Value; } /* Leave this in case we decide to use an array later if (kIndex < maxkey) { String n1String = (String)n1.m_keyValue[kIndex]; String n2String = (String)n2.m_keyValue[kIndex]; }*/ else { // Get values dynamically XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node, k.m_namespaceContext); XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node, k.m_namespaceContext); n1String = k.m_col.getCollationKey(r1.str()); n2String = k.m_col.getCollationKey(r2.str()); } // Use collation keys for faster compare, but note that whitespaces // etc... are treated differently from if we were comparing Strings. result = n1String.compareTo(n2String); //Process caseOrder parameter if (k.m_caseOrderUpper) { String tempN1 = n1String.getSourceString().toLowerCase(); String tempN2 = n2String.getSourceString().toLowerCase(); if (tempN1.equals(tempN2)) { //java defaults to upper case is greater. result = result == 0 ? 0 : -result; } } //Process order parameter if (k.m_descending) { result = -result; } } //end else if (0 == result) { if ((kIndex + 1) < m_keys.size()) { result = compare(n1, n2, kIndex + 1, support); } } if (0 == result) { // I shouldn't have to do this except that there seems to // be a glitch in the mergesort // if(r1.getType() == r1.CLASS_NODESET) // { DTM dtm = support.getDTM(n1.m_node); // %OPT% result = dtm.isNodeAfter(n1.m_node, n2.m_node) ? -1 : 1; // } } return result; } /** * This implements a standard Mergesort, as described in * Robert Sedgewick's Algorithms book. This is a better * sort for our purpose than the Quicksort because it * maintains the original document order of the input if * the order isn't changed by the sort. * * @param a First vector of nodes to compare * @param b Second vector of nodes to compare * @param l Left boundary of partition * @param r Right boundary of partition * @param support XPath context to use * * @throws TransformerException */ void mergesort(Vector a, Vector b, int l, int r, XPathContext support) throws TransformerException { if ((r - l) > 0) { int m = (r + l) / 2; mergesort(a, b, l, m, support); mergesort(a, b, m + 1, r, support); int i, j, k; for (i = m; i >= l; i--) { // b[i] = a[i]; // Use insert if we need to increment vector size. if (i >= b.size()) b.insertElementAt(a.elementAt(i), i); else b.setElementAt(a.elementAt(i), i); } i = l; for (j = (m + 1); j <= r; j++) { // b[r+m+1-j] = a[j]; if (r + m + 1 - j >= b.size()) b.insertElementAt(a.elementAt(j), r + m + 1 - j); else b.setElementAt(a.elementAt(j), r + m + 1 - j); } j = r; int compVal; for (k = l; k <= r; k++) { // if(b[i] < b[j]) if (i == j) compVal = -1; else compVal = compare((NodeCompareElem) b.elementAt(i), (NodeCompareElem) b.elementAt(j), 0, support); if (compVal < 0) { // a[k]=b[i]; a.setElementAt(b.elementAt(i), k); i++; } else if (compVal > 0) { // a[k]=b[j]; a.setElementAt(b.elementAt(j), k); j--; } } } } /** * This is a generic version of C.A.R Hoare's Quick Sort * algorithm. This will handle arrays that are already * sorted, and arrays with duplicate keys.
        * * If you think of a one dimensional array as going from * the lowest index on the left to the highest index on the right * then the parameters to this function are lowest index or * left and highest index or right. The first time you call * this function it will be with the parameters 0, a.length - 1. * * @param v a vector of integers * @param lo0 left boundary of array partition * @param hi0 right boundary of array partition * */ /* private void QuickSort2(Vector v, int lo0, int hi0, XPathContext support) throws javax.xml.transform.TransformerException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException { int lo = lo0; int hi = hi0; if ( hi0 > lo0) { // Arbitrarily establishing partition element as the midpoint of // the array. Node midNode = (Node)v.elementAt( ( lo0 + hi0 ) / 2 ); // loop through the array until indices cross while( lo <= hi ) { // find the first element that is greater than or equal to // the partition element starting from the left Index. while( (lo < hi0) && (compare((Node)v.elementAt(lo), midNode, 0, support) < 0) ) { ++lo; } // end while // find an element that is smaller than or equal to // the partition element starting from the right Index. while( (hi > lo0) && (compare((Node)v.elementAt(hi), midNode, 0, support) > 0) ) { --hi; } // if the indexes have not crossed, swap if( lo <= hi ) { swap(v, lo, hi); ++lo; --hi; } } // If the right index has not reached the left side of array // must now sort the left partition. if( lo0 < hi ) { QuickSort2( v, lo0, hi, support ); } // If the left index has not reached the right side of array // must now sort the right partition. if( lo < hi0 ) { QuickSort2( v, lo, hi0, support ); } } } // end QuickSort2 */ // /** // * Simple function to swap two elements in // * a vector. // * // * @param v Vector of nodes to swap // * @param i Index of first node to swap // * @param i Index of second node to swap // */ // private void swap(Vector v, int i, int j) // { // // int node = (Node) v.elementAt(i); // // v.setElementAt(v.elementAt(j), i); // v.setElementAt(node, j); // } /** * This class holds the value(s) from executing the given * node against the sort key(s). * @xsl.usage internal */ class NodeCompareElem { /** Current node */ int m_node; /** This maxkey value was chosen arbitrarily. We are assuming that the // maxkey + 1 keys will only hit fairly rarely and therefore, we // will get the node values for those keys dynamically. */ int maxkey = 2; // Keep this in case we decide to use an array. Right now // using two variables is cheaper. //Object[] m_KeyValue = new Object[2]; /** Value from first sort key */ Object m_key1Value; /** Value from second sort key */ Object m_key2Value; /** * Constructor NodeCompareElem * * * @param node Current node * * @throws javax.xml.transform.TransformerException */ NodeCompareElem(int node) throws javax.xml.transform.TransformerException { m_node = node; if (!m_keys.isEmpty()) { NodeSortKey k1 = (NodeSortKey) m_keys.elementAt(0); XObject r = k1.m_selectPat.execute(m_execContext, node, k1.m_namespaceContext); double d; if (k1.m_treatAsNumbers) { d = r.num(); // Can't use NaN for compare. They are never equal. Use zero instead. m_key1Value = new Double(d); } else { m_key1Value = k1.m_col.getCollationKey(r.str()); } if (r.getType() == XObject.CLASS_NODESET) { // %REVIEW% DTMIterator ni = ((XNodeSet)r).iterRaw(); int current = ni.getCurrentNode(); if(DTM.NULL == current) current = ni.nextNode(); // if (ni instanceof ContextNodeList) // %REVIEW% // tryNextKey = (DTM.NULL != current); // else abdicate... should never happen, but... -sb } if (m_keys.size() > 1) { NodeSortKey k2 = (NodeSortKey) m_keys.elementAt(1); XObject r2 = k2.m_selectPat.execute(m_execContext, node, k2.m_namespaceContext); if (k2.m_treatAsNumbers) { d = r2.num(); m_key2Value = new Double(d); } else { m_key2Value = k2.m_col.getCollationKey(r2.str()); } } /* Leave this in case we decide to use an array later while (kIndex <= m_keys.size() && kIndex < maxkey) { NodeSortKey k = (NodeSortKey)m_keys.elementAt(kIndex); XObject r = k.m_selectPat.execute(m_execContext, node, k.m_namespaceContext); if(k.m_treatAsNumbers) m_KeyValue[kIndex] = r.num(); else m_KeyValue[kIndex] = r.str(); } */ } // end if not empty } } // end NodeCompareElem class } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/KeyManager.java0000644000175000017500000000650710721374031024440 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyManager.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Vector; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.QName; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XNodeSet; /** * This class manages the key tables. */ public class KeyManager { /** * Table of tables of element keys. * @see org.apache.xalan.transformer.KeyTable */ private transient Vector m_key_tables = null; /** * Given a valid element key, return the corresponding node list. * * @param xctxt The XPath runtime state * @param doc The document node * @param name The key element name * @param ref The key value we're looking for * @param nscontext The prefix resolver for the execution context * * @return A nodelist of nodes mathing the given key * * @throws javax.xml.transform.TransformerException */ public XNodeSet getNodeSetDTMByKey( XPathContext xctxt, int doc, QName name, XMLString ref, PrefixResolver nscontext) throws javax.xml.transform.TransformerException { XNodeSet nl = null; ElemTemplateElement template = (ElemTemplateElement) nscontext; // yuck -sb if ((null != template) && null != template.getStylesheetRoot().getKeysComposed()) { boolean foundDoc = false; if (null == m_key_tables) { m_key_tables = new Vector(4); } else { int nKeyTables = m_key_tables.size(); for (int i = 0; i < nKeyTables; i++) { KeyTable kt = (KeyTable) m_key_tables.elementAt(i); if (kt.getKeyTableName().equals(name) && doc == kt.getDocKey()) { nl = kt.getNodeSetDTMByKey(name, ref); if (nl != null) { foundDoc = true; break; } } } } if ((null == nl) &&!foundDoc /* && m_needToBuildKeysTable */) { KeyTable kt = new KeyTable(doc, nscontext, name, template.getStylesheetRoot().getKeysComposed(), xctxt); m_key_tables.addElement(kt); if (doc == kt.getDocKey()) { foundDoc = true; nl = kt.getNodeSetDTMByKey(name, ref); } } } return nl; } } libxalan2-java-2.7.1/src/org/apache/xalan/transformer/KeyIterator.java0000644000175000017500000001106510721374031024652 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyIterator.java 468645 2006-10-28 06:57:24Z minchau $ */ package org.apache.xalan.transformer; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.KeyDeclaration; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; import org.apache.xpath.axes.OneStepIteratorForward; /** * This class implements an optimized iterator for * "key()" patterns, matching each node to the * match attribute in one or more xsl:key declarations. * @xsl.usage internal */ public class KeyIterator extends OneStepIteratorForward { static final long serialVersionUID = -1349109910100249661L; /** Key name. * @serial */ private QName m_name; /** * Get the key name from a key declaration this iterator will process * * * @return Key name */ public QName getName() { return m_name; } /** Vector of Key declarations in the stylesheet. * @serial */ private Vector m_keyDeclarations; /** * Get the key declarations from the stylesheet * * * @return Vector containing the key declarations from the stylesheet */ public Vector getKeyDeclarations() { return m_keyDeclarations; } /** * Create a KeyIterator object. * * @throws javax.xml.transform.TransformerException */ KeyIterator(QName name, Vector keyDeclarations) { super(Axis.ALL); m_keyDeclarations = keyDeclarations; // m_prefixResolver = nscontext; m_name = name; } /** * Test whether a specified node is visible in the logical view of a * TreeWalker or NodeIterator. This function will be called by the * implementation of TreeWalker and NodeIterator; it is not intended to * be called directly from user code. * * @param testNode The node to check to see if it passes the filter or not. * * @return a constant to determine whether the node is accepted, * rejected, or skipped, as defined above . */ public short acceptNode(int testNode) { boolean foundKey = false; KeyIterator ki = (KeyIterator) m_lpi; org.apache.xpath.XPathContext xctxt = ki.getXPathContext(); Vector keys = ki.getKeyDeclarations(); QName name = ki.getName(); try { // System.out.println("lookupKey: "+lookupKey); int nDeclarations = keys.size(); // Walk through each of the declarations made with xsl:key for (int i = 0; i < nDeclarations; i++) { KeyDeclaration kd = (KeyDeclaration) keys.elementAt(i); // Only continue if the name on this key declaration // matches the name on the iterator for this walker. if (!kd.getName().equals(name)) continue; foundKey = true; // xctxt.setNamespaceContext(ki.getPrefixResolver()); // See if our node matches the given key declaration according to // the match attribute on xsl:key. XPath matchExpr = kd.getMatch(); double score = matchExpr.getMatchScore(xctxt, testNode); if (score == kd.getMatch().MATCH_SCORE_NONE) continue; return DTMIterator.FILTER_ACCEPT; } // end for(int i = 0; i < nDeclarations; i++) } catch (TransformerException se) { // TODO: What to do? } if (!foundKey) throw new RuntimeException( XSLMessages.createMessage( XSLTErrorResources.ER_NO_XSLKEY_DECLARATION, new Object[] { name.getLocalName()})); return DTMIterator.FILTER_REJECT; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/0000755000175000017500000000000010736146354021211 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/templates/AVTPartXPath.java0000644000175000017500000001203110721374031024264 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AVTPartXPath.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xml.utils.FastStringBuffer; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.XPathFactory; import org.apache.xpath.compiler.XPathParser; import org.apache.xpath.objects.XObject; /** * Simple string part of a complex AVT. * @xsl.usage internal */ public class AVTPartXPath extends AVTPart { static final long serialVersionUID = -4460373807550527675L; /** * The XPath object contained in this part. * @serial */ private XPath m_xpath; /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_xpath.fixupVariables(vars, globalsSize); } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return m_xpath.getExpression().canTraverseOutsideSubtree(); } /** * Construct a simple AVT part. * * @param xpath Xpath section of AVT */ public AVTPartXPath(XPath xpath) { m_xpath = xpath; } /** * Construct a simple AVT part. * * @param val A pure string section of an AVT. * @param nsNode An object which can be used to determine the * Namespace Name (URI) for any Namespace prefix used in the XPath. * Usually this is based on the context where the XPath was specified, * such as a node within a Stylesheet. * @param xpathProcessor XPath parser * @param factory XPath factory * @param liaison An XPathContext object, providing infomation specific * to this invocation and this thread. Maintains SAX output state, * variables, error handler and so on, so the transformation/XPath * object itself can be simultaneously invoked from multiple threads. * * @throws javax.xml.transform.TransformerException * TODO: Fix or remove this unused c'tor. */ public AVTPartXPath( String val, org.apache.xml.utils.PrefixResolver nsNode, XPathParser xpathProcessor, XPathFactory factory, XPathContext liaison) throws javax.xml.transform.TransformerException { m_xpath = new XPath(val, null, nsNode, XPath.SELECT, liaison.getErrorListener()); } /** * Get the AVT part as the original string. * * @return the AVT part as the original string. */ public String getSimpleString() { return "{" + m_xpath.getPatternString() + "}"; } /** * Write the value into the buffer. * * @param xctxt An XPathContext object, providing infomation specific * to this invocation and this thread. Maintains SAX state, variables, * error handler and so on, so the transformation/XPath object itself * can be simultaneously invoked from multiple threads. * @param buf Buffer to write into. * @param context The current source tree context. * @param nsNode The current namespace context (stylesheet tree context). * * @throws javax.xml.transform.TransformerException */ public void evaluate( XPathContext xctxt, FastStringBuffer buf, int context, org.apache.xml.utils.PrefixResolver nsNode) throws javax.xml.transform.TransformerException { XObject xobj = m_xpath.execute(xctxt, context, nsNode); if (null != xobj) { xobj.appendToFsb(buf); } } /** * @see XSLTVisitable#callVisitors(XSLTVisitor) */ public void callVisitors(XSLTVisitor visitor) { m_xpath.getExpression().callVisitors(m_xpath, visitor); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemMessage.java0000644000175000017500000001001310721374032024224 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemMessage.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; /** * Implement xsl:message. *
         * 
         * 
         * 
        * @see message in XSLT Specification * @xsl.usage advanced */ public class ElemMessage extends ElemTemplateElement { static final long serialVersionUID = 1530472462155060023L; /** * If the terminate attribute has the value yes, then the * XSLT transformer should terminate processing after sending * the message. The default value is no. * @serial */ private boolean m_terminate = Constants.ATTRVAL_NO; // default value /** * Set the "terminate" attribute. * If the terminate attribute has the value yes, then the * XSLT transformer should terminate processing after sending * the message. The default value is no. * * @param v Value to set for "terminate" attribute. */ public void setTerminate(boolean v) { m_terminate = v; } /** * Get the "terminate" attribute. * If the terminate attribute has the value yes, then the * XSLT transformer should terminate processing after sending * the message. The default value is no. * * @return value of "terminate" attribute. */ public boolean getTerminate() { return m_terminate; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_MESSAGE; } /** * Return the node name. * * @return name of the element */ public String getNodeName() { return Constants.ELEMNAME_MESSAGE_STRING; } /** * Send a message to diagnostics. * The xsl:message instruction sends a message in a way that * is dependent on the XSLT transformer. The content of the xsl:message * instruction is a template. The xsl:message is instantiated by * instantiating the content to create an XML fragment. This XML * fragment is the content of the message. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); String data = transformer.transformToString(this); transformer.getMsgMgr().message(this, data, m_terminate); if(m_terminate) transformer.getErrorListener().fatalError(new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_STYLESHEET_DIRECTED_TERMINATION, null))); //"Stylesheet directed termination")); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/FuncDocument.java0000644000175000017500000004023110721374030024432 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncDocument.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.XMLString; import org.apache.xpath.Expression; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.SourceTreeManager; import org.apache.xpath.XPathContext; import org.apache.xpath.functions.Function2Args; import org.apache.xpath.functions.WrongNumberArgsException; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; /** * Execute the Doc() function. * * When the document function has exactly one argument and the argument * is a node-set, then the result is the union, for each node in the * argument node-set, of the result of calling the document function with * the first argument being the string-value of the node, and the second * argument being a node-set with the node as its only member. When the * document function has two arguments and the first argument is a node-set, * then the result is the union, for each node in the argument node-set, * of the result of calling the document function with the first argument * being the string-value of the node, and with the second argument being * the second argument passed to the document function. * @xsl.usage advanced */ public class FuncDocument extends Function2Args { static final long serialVersionUID = 2483304325971281424L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int docContext = dtm.getDocumentRoot(context); XObject arg = (XObject) this.getArg0().execute(xctxt); String base = ""; Expression arg1Expr = this.getArg1(); if (null != arg1Expr) { // The URI reference may be relative. The base URI (see [3.2 Base URI]) // of the node in the second argument node-set that is first in document // order is used as the base URI for resolving the // relative URI into an absolute URI. XObject arg2 = arg1Expr.execute(xctxt); if (XObject.CLASS_NODESET == arg2.getType()) { int baseNode = arg2.iter().nextNode(); if (baseNode == DTM.NULL) { // See http://www.w3.org/1999/11/REC-xslt-19991116-errata#E14. // If the second argument is an empty nodeset, this is an error. // The processor can recover by returning an empty nodeset. warn(xctxt, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null); XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); return nodes; } else{ DTM baseDTM = xctxt.getDTM(baseNode); base = baseDTM.getDocumentBaseURI(); } // %REVIEW% This doesn't seem to be a problem with the conformance // suite, but maybe it's just not doing a good test? // int baseDoc = baseDTM.getDocument(); // // if (baseDoc == DTM.NULL /* || baseDoc instanceof Stylesheet -->What to do?? */) // { // // // base = ((Stylesheet)baseDoc).getBaseIdentifier(); // base = xctxt.getNamespaceContext().getBaseIdentifier(); // } // else // base = xctxt.getSourceTreeManager().findURIFromDoc(baseDoc); } else { //Can not convert other type to a node-set!; arg2.iter(); } } else { // If the second argument is omitted, then it defaults to // the node in the stylesheet that contains the expression that // includes the call to the document function. Note that a // zero-length URI reference is a reference to the document // relative to which the URI reference is being resolved; thus // document("") refers to the root node of the stylesheet; // the tree representation of the stylesheet is exactly // the same as if the XML document containing the stylesheet // was the initial source document. assertion(null != xctxt.getNamespaceContext(), "Namespace context can not be null!"); base = xctxt.getNamespaceContext().getBaseIdentifier(); } XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM mnl = nodes.mutableNodeset(); DTMIterator iterator = (XObject.CLASS_NODESET == arg.getType()) ? arg.iter() : null; int pos = DTM.NULL; while ((null == iterator) || (DTM.NULL != (pos = iterator.nextNode()))) { XMLString ref = (null != iterator) ? xctxt.getDTM(pos).getStringValue(pos) : arg.xstr(); // The first and only argument was a nodeset, the base in that // case is the base URI of the node from the first argument nodeset. // Remember, when the document function has exactly one argument and // the argument is a node-set, then the result is the union, for each // node in the argument node-set, of the result of calling the document // function with the first argument being the string-value of the node, // and the second argument being a node-set with the node as its only // member. if (null == arg1Expr && DTM.NULL != pos) { DTM baseDTM = xctxt.getDTM(pos); base = baseDTM.getDocumentBaseURI(); } if (null == ref) continue; if (DTM.NULL == docContext) { error(xctxt, XSLTErrorResources.ER_NO_CONTEXT_OWNERDOC, null); //"context does not have an owner document!"); } // From http://www.ics.uci.edu/pub/ietf/uri/rfc1630.txt // A partial form can be distinguished from an absolute form in that the // latter must have a colon and that colon must occur before any slash // characters. Systems not requiring partial forms should not use any // unencoded slashes in their naming schemes. If they do, absolute URIs // will still work, but confusion may result. int indexOfColon = ref.indexOf(':'); int indexOfSlash = ref.indexOf('/'); if ((indexOfColon != -1) && (indexOfSlash != -1) && (indexOfColon < indexOfSlash)) { // The url (or filename, for that matter) is absolute. base = null; } int newDoc = getDoc(xctxt, context, ref.toString(), base); // nodes.mutableNodeset().addNode(newDoc); if (DTM.NULL != newDoc) { // TODO: mnl.addNodeInDocOrder(newDoc, true, xctxt); ?? if (!mnl.contains(newDoc)) { mnl.addElement(newDoc); } } if (null == iterator || newDoc == DTM.NULL) break; } return nodes; } /** * Get the document from the given URI and base * * @param xctxt The XPath runtime state. * @param context The current context node * @param uri Relative(?) URI of the document * @param base Base to resolve relative URI from. * * @return The document Node pointing to the document at the given URI * or null * * @throws javax.xml.transform.TransformerException */ int getDoc(XPathContext xctxt, int context, String uri, String base) throws javax.xml.transform.TransformerException { // System.out.println("base: "+base+", uri: "+uri); SourceTreeManager treeMgr = xctxt.getSourceTreeManager(); Source source; int newDoc; try { source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator()); newDoc = treeMgr.getNode(source); } catch (IOException ioe) { throw new TransformerException(ioe.getMessage(), (SourceLocator)xctxt.getSAXLocator(), ioe); } catch(TransformerException te) { throw new TransformerException(te); } if (DTM.NULL != newDoc) return newDoc; // If the uri length is zero, get the uri of the stylesheet. if (uri.length() == 0) { // Hmmm... this seems pretty bogus to me... -sb uri = xctxt.getNamespaceContext().getBaseIdentifier(); try { source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator()); } catch (IOException ioe) { throw new TransformerException(ioe.getMessage(), (SourceLocator)xctxt.getSAXLocator(), ioe); } } String diagnosticsString = null; try { if ((null != uri) && (uri.length() > 0)) { newDoc = treeMgr.getSourceTree(source, xctxt.getSAXLocator(), xctxt); // System.out.println("newDoc: "+((Document)newDoc).getDocumentElement().getNodeName()); } else warn(xctxt, XSLTErrorResources.WG_CANNOT_MAKE_URL_FROM, new Object[]{ ((base == null) ? "" : base) + uri }); //"Can not make URL from: "+((base == null) ? "" : base )+uri); } catch (Throwable throwable) { // throwable.printStackTrace(); newDoc = DTM.NULL; // path.warn(XSLTErrorResources.WG_ENCODING_NOT_SUPPORTED_USING_JAVA, new Object[]{((base == null) ? "" : base )+uri}); //"Can not load requested doc: "+((base == null) ? "" : base )+uri); while (throwable instanceof org.apache.xml.utils.WrappedRuntimeException) { throwable = ((org.apache.xml.utils.WrappedRuntimeException) throwable).getException(); } if ((throwable instanceof NullPointerException) || (throwable instanceof ClassCastException)) { throw new org.apache.xml.utils.WrappedRuntimeException( (Exception) throwable); } StringWriter sw = new StringWriter(); PrintWriter diagnosticsWriter = new PrintWriter(sw); if (throwable instanceof TransformerException) { TransformerException spe = (TransformerException) throwable; { Throwable e = spe; while (null != e) { if (null != e.getMessage()) { diagnosticsWriter.println(" (" + e.getClass().getName() + "): " + e.getMessage()); } if (e instanceof TransformerException) { TransformerException spe2 = (TransformerException) e; SourceLocator locator = spe2.getLocator(); if ((null != locator) && (null != locator.getSystemId())) diagnosticsWriter.println(" ID: " + locator.getSystemId() + " Line #" + locator.getLineNumber() + " Column #" + locator.getColumnNumber()); e = spe2.getException(); if (e instanceof org.apache.xml.utils.WrappedRuntimeException) e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException(); } else e = null; } } } else { diagnosticsWriter.println(" (" + throwable.getClass().getName() + "): " + throwable.getMessage()); } diagnosticsString = throwable.getMessage(); //sw.toString(); } if (DTM.NULL == newDoc) { // System.out.println("what?: "+base+", uri: "+uri); if (null != diagnosticsString) { warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC, new Object[]{ diagnosticsString }); //"Can not load requested doc: "+((base == null) ? "" : base )+uri); } else warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC, new Object[]{ uri == null ? ((base == null) ? "" : base) + uri : uri.toString() }); //"Can not load requested doc: "+((base == null) ? "" : base )+uri); } else { // %REVIEW% // TBD: What to do about XLocator? // xctxt.getSourceTreeManager().associateXLocatorToNode(newDoc, url, null); } return newDoc; } /** * Tell the user of an error, and probably throw an * exception. * * @param xctxt The XPath runtime state. * @param msg The error message key * @param args Arguments to be used in the error message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException */ public void error(XPathContext xctxt, String msg, Object args[]) throws javax.xml.transform.TransformerException { String formattedMsg = XSLMessages.createMessage(msg, args); ErrorListener errHandler = xctxt.getErrorListener(); TransformerException spe = new TransformerException(formattedMsg, (SourceLocator)xctxt.getSAXLocator()); if (null != errHandler) errHandler.error(spe); else System.out.println(formattedMsg); } /** * Warn the user of a problem. * * @param xctxt The XPath runtime state. * @param msg Warning message key * @param args Arguments to be used in the warning message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException */ public void warn(XPathContext xctxt, String msg, Object args[]) throws javax.xml.transform.TransformerException { String formattedMsg = XSLMessages.createWarning(msg, args); ErrorListener errHandler = xctxt.getErrorListener(); TransformerException spe = new TransformerException(formattedMsg, (SourceLocator)xctxt.getSAXLocator()); if (null != errHandler) errHandler.warning(spe); else System.out.println(formattedMsg); } /** * Overide the superclass method to allow one or two arguments. * * * @param argNum Number of arguments passed in to this function * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if ((argNum < 1) || (argNum > 2)) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createMessage(XSLTErrorResources.ER_ONE_OR_TWO, null)); //"1 or 2"); } /** * Tell if the expression is a nodeset expression. * @return true if the expression can be represented as a nodeset. */ public boolean isNodesetExpr() { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemChoose.java0000644000175000017500000001323110721374033024066 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemChoose.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * Implement xsl:choose. *
         * 
         * 
         * 
        * @see XXX in XSLT Specification * @xsl.usage advanced */ public class ElemChoose extends ElemTemplateElement { static final long serialVersionUID = -3070117361903102033L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_CHOOSE; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_CHOOSE_STRING; } /** * Constructor ElemChoose * */ public ElemChoose(){} /** * Execute the xsl:choose transformation. * * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); boolean found = false; for (ElemTemplateElement childElem = getFirstChildElem(); childElem != null; childElem = childElem.getNextSiblingElem()) { int type = childElem.getXSLToken(); if (Constants.ELEMNAME_WHEN == type) { found = true; ElemWhen when = (ElemWhen) childElem; // must be xsl:when XPathContext xctxt = transformer.getXPathContext(); int sourceNode = xctxt.getCurrentNode(); // System.err.println("\""+when.getTest().getPatternString()+"\""); // if(when.getTest().getPatternString().equals("COLLECTION/icuser/ictimezone/LITERAL='GMT +13:00 Pacific/Tongatapu'")) // System.err.println("Found COLLECTION/icuser/ictimezone/LITERAL"); if (transformer.getDebug()) { XObject test = when.getTest().execute(xctxt, sourceNode, when); if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEvent(sourceNode, when, "test", when.getTest(), test); if (test.bool()) { transformer.getTraceManager().fireTraceEvent(when); transformer.executeChildTemplates(when, true); transformer.getTraceManager().fireTraceEndEvent(when); return; } } else if (when.getTest().bool(xctxt, sourceNode, when)) { transformer.executeChildTemplates(when, true); return; } } else if (Constants.ELEMNAME_OTHERWISE == type) { found = true; if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(childElem); // xsl:otherwise transformer.executeChildTemplates(childElem, true); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(childElem); return; } } if (!found) transformer.getMsgMgr().error( this, XSLTErrorResources.ER_CHOOSE_REQUIRES_WHEN); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Add a child to the child list. * * @param newChild Child to add to this node's child list * * @return The child that was just added to the child list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { case Constants.ELEMNAME_WHEN : case Constants.ELEMNAME_OTHERWISE : // TODO: Positional checking break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } /** * Tell if this element can accept variable declarations. * @return true if the element can accept and process variable declarations. */ public boolean canAcceptVariables() { return false; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemPI.java0000644000175000017500000001553410721374030023163 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemPI.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.XML11Char; import org.apache.xpath.XPathContext; /** * Implement xsl:processing-instruction. *
         * 
         * 
         * 
        * @see section-Creating-Processing-Instructions in XSLT Specification * @xsl.usage advanced */ public class ElemPI extends ElemTemplateElement { static final long serialVersionUID = 5621976448020889825L; /** * The xsl:processing-instruction element has a required name * attribute that specifies the name of the processing instruction node. * The value of the name attribute is interpreted as an * attribute value template. * @serial */ private AVT m_name_atv = null; /** * Set the "name" attribute. * DJD * * @param v Value for the name attribute */ public void setName(AVT v) { m_name_atv = v; } /** * Get the "name" attribute. * DJD * * @return The value of the "name" attribute */ public AVT getName() { return m_name_atv; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if(null != m_name_atv) m_name_atv.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for the element */ public int getXSLToken() { return Constants.ELEMNAME_PI; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_PI_STRING; } /** * Create a processing instruction in the result tree. * The content of the xsl:processing-instruction element is a * template for the string-value of the processing instruction node. * @see section-Creating-Processing-Instructions in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); XPathContext xctxt = transformer.getXPathContext(); int sourceNode = xctxt.getCurrentNode(); String piName = m_name_atv == null ? null : m_name_atv.evaluate(xctxt, sourceNode, this); // Ignore processing instruction if name is null if (piName == null) return; if (piName.equalsIgnoreCase("xml")) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, new Object[]{ Constants.ATTRNAME_NAME, piName }); return; } // Only check if an avt was used (ie. this wasn't checked at compose time.) // Ignore processing instruction, if invalid else if ((!m_name_atv.isSimple()) && (!XML11Char.isXML11ValidNCName(piName))) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, new Object[]{ Constants.ATTRNAME_NAME, piName }); return; } // Note the content model is: // String data = transformer.transformToString(this); try { transformer.getResultTreeHandler().processingInstruction(piName, data); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Add a child to the child list. * * @param newChild Child to add to child list * * @return The child just added to the child list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { // char-instructions case Constants.ELEMNAME_TEXTLITERALRESULT : case Constants.ELEMNAME_APPLY_TEMPLATES : case Constants.ELEMNAME_APPLY_IMPORTS : case Constants.ELEMNAME_CALLTEMPLATE : case Constants.ELEMNAME_FOREACH : case Constants.ELEMNAME_VALUEOF : case Constants.ELEMNAME_COPY_OF : case Constants.ELEMNAME_NUMBER : case Constants.ELEMNAME_CHOOSE : case Constants.ELEMNAME_IF : case Constants.ELEMNAME_TEXT : case Constants.ELEMNAME_COPY : case Constants.ELEMNAME_VARIABLE : case Constants.ELEMNAME_MESSAGE : // instructions // case Constants.ELEMNAME_PI: // case Constants.ELEMNAME_COMMENT: // case Constants.ELEMNAME_ELEMENT: // case Constants.ELEMNAME_ATTRIBUTE: break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/AVT.java0000644000175000017500000004135410721374032022503 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AVT.java 469221 2006-10-30 18:26:44Z minchau $ */ package org.apache.xalan.templates; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.processor.StylesheetHandler; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.StringBufferPool; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; /** * Class to hold an Attribute Value Template. * @xsl.usage advanced */ public class AVT implements java.io.Serializable, XSLTVisitable { static final long serialVersionUID = 5167607155517042691L; /** *We are not going to use the object pool if USE_OBJECT_POOL == false. */ private final static boolean USE_OBJECT_POOL = false; /** * INIT_BUFFER_CHUNK_BITS is used to set initial size of * of the char m_array in FastStringBuffer if USE_OBJECT_POOL == false. * size = 2^ INIT_BUFFER_CHUNK_BITS, INIT_BUFFER_CHUNK_BITS = 7 * corresponds size = 256. */ private final static int INIT_BUFFER_CHUNK_BITS = 8; /** * If the AVT is not complex, just hold the simple string. * @serial */ private String m_simpleString = null; /** * If the AVT is complex, hold a Vector of AVTParts. * @serial */ private Vector m_parts = null; /** * The name of the attribute. * @serial */ private String m_rawName; /** * Get the raw name of the attribute, with the prefix unprocessed. * * @return non-null reference to prefixed name. */ public String getRawName() { return m_rawName; } /** * Get the raw name of the attribute, with the prefix unprocessed. * * @param rawName non-null reference to prefixed name. */ public void setRawName(String rawName) { m_rawName = rawName; } /** * The name of the attribute. * @serial */ private String m_name; /** * Get the local name of the attribute. * * @return non-null reference to name string. */ public String getName() { return m_name; } /** * Set the local name of the attribute. * * @param name non-null reference to name string. */ public void setName(String name) { m_name = name; } /** * The namespace URI of the owning attribute. * @serial */ private String m_uri; /** * Get the namespace URI of the attribute. * * @return non-null reference to URI, "" if null namespace. */ public String getURI() { return m_uri; } /** * Get the namespace URI of the attribute. * * @param uri non-null reference to URI, "" if null namespace. */ public void setURI(String uri) { m_uri = uri; } /** * Construct an AVT by parsing the string, and either * constructing a vector of AVTParts, or simply hold * on to the string if the AVT is simple. * * @param handler non-null reference to StylesheetHandler that is constructing. * @param uri non-null reference to URI, "" if null namespace. * @param name non-null reference to name string. * @param rawName prefixed name. * @param stringedValue non-null raw string value. * * @throws javax.xml.transform.TransformerException */ public AVT(StylesheetHandler handler, String uri, String name, String rawName, String stringedValue, ElemTemplateElement owner) throws javax.xml.transform.TransformerException { m_uri = uri; m_name = name; m_rawName = rawName; StringTokenizer tokenizer = new StringTokenizer(stringedValue, "{}\"\'", true); int nTokens = tokenizer.countTokens(); if (nTokens < 2) { m_simpleString = stringedValue; // then do the simple thing } else { FastStringBuffer buffer = null; FastStringBuffer exprBuffer = null; if(USE_OBJECT_POOL){ buffer = StringBufferPool.get(); exprBuffer = StringBufferPool.get(); }else{ buffer = new FastStringBuffer(6); exprBuffer = new FastStringBuffer(6); } try { m_parts = new Vector(nTokens + 1); String t = null; // base token String lookahead = null; // next token String error = null; // if non-null, break from loop while (tokenizer.hasMoreTokens()) { if (lookahead != null) { t = lookahead; lookahead = null; } else t = tokenizer.nextToken(); if (t.length() == 1) { switch (t.charAt(0)) { case ('\"') : case ('\'') : { // just keep on going, since we're not in an attribute template buffer.append(t); break; } case ('{') : { try { // Attribute Value Template start lookahead = tokenizer.nextToken(); if (lookahead.equals("{")) { // Double curlys mean escape to show curly buffer.append(lookahead); lookahead = null; break; // from switch } /* else if(lookahead.equals("\"") || lookahead.equals("\'")) { // Error. Expressions can not begin with quotes. error = "Expressions can not begin with quotes."; break; // from switch } */ else { if (buffer.length() > 0) { m_parts.addElement(new AVTPartSimple(buffer.toString())); buffer.setLength(0); } exprBuffer.setLength(0); while (null != lookahead) { if (lookahead.length() == 1) { switch (lookahead.charAt(0)) { case '\'' : case '\"' : { // String start exprBuffer.append(lookahead); String quote = lookahead; // Consume stuff 'till next quote lookahead = tokenizer.nextToken(); while (!lookahead.equals(quote)) { exprBuffer.append(lookahead); lookahead = tokenizer.nextToken(); } exprBuffer.append(lookahead); lookahead = tokenizer.nextToken(); break; } case '{' : { // What's another curly doing here? error = XSLMessages.createMessage( XSLTErrorResources.ER_NO_CURLYBRACE, null); //"Error: Can not have \"{\" within expression."; lookahead = null; // breaks out of inner while loop break; } case '}' : { // Proper close of attribute template. // Evaluate the expression. buffer.setLength(0); XPath xpath = handler.createXPath(exprBuffer.toString(), owner); m_parts.addElement(new AVTPartXPath(xpath)); lookahead = null; // breaks out of inner while loop break; } default : { // part of the template stuff, just add it. exprBuffer.append(lookahead); lookahead = tokenizer.nextToken(); } } // end inner switch } // end if lookahead length == 1 else { // part of the template stuff, just add it. exprBuffer.append(lookahead); lookahead = tokenizer.nextToken(); } } // end while(!lookahead.equals("}")) if (error != null) { break; // from inner while loop } } break; } catch (java.util.NoSuchElementException ex) { error = XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ name, stringedValue }); break; } } case ('}') : { lookahead = tokenizer.nextToken(); if (lookahead.equals("}")) { // Double curlys mean escape to show curly buffer.append(lookahead); lookahead = null; // swallow } else { // Illegal, I think... try { handler.warn(XSLTErrorResources.WG_FOUND_CURLYBRACE, null); //"Found \"}\" but no attribute template open!"); } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } buffer.append("}"); // leave the lookahead to be processed by the next round. } break; } default : { // Anything else just add to string. buffer.append(t); } } // end switch t } // end if length == 1 else { // Anything else just add to string. buffer.append(t); } if (null != error) { try { handler.warn(XSLTErrorResources.WG_ATTR_TEMPLATE, new Object[]{ error }); //"Attr Template, "+error); } catch (org.xml.sax.SAXException se) { throw new TransformerException(se); } break; } } // end while(tokenizer.hasMoreTokens()) if (buffer.length() > 0) { m_parts.addElement(new AVTPartSimple(buffer.toString())); buffer.setLength(0); } } finally { if(USE_OBJECT_POOL){ StringBufferPool.free(buffer); StringBufferPool.free(exprBuffer); }else{ buffer = null; exprBuffer = null; }; } } // end else nTokens > 1 if (null == m_parts && (null == m_simpleString)) { // Error? m_simpleString = ""; } } /** * Get the AVT as the original string. * * @return The AVT as the original string */ public String getSimpleString() { if (null != m_simpleString){ return m_simpleString; } else if (null != m_parts){ final FastStringBuffer buf = getBuffer(); String out = null; int n = m_parts.size(); try{ for (int i = 0; i < n; i++){ AVTPart part = (AVTPart) m_parts.elementAt(i); buf.append(part.getSimpleString()); } out = buf.toString(); }finally{ if(USE_OBJECT_POOL){ StringBufferPool.free(buf); }else{ buf.setLength(0); }; } return out; }else{ return ""; } } /** * Evaluate the AVT and return a String. * * @param xctxt Te XPathContext to use to evaluate this. * @param context The current source tree context. * @param nsNode The current namespace context (stylesheet tree context). * * @return The AVT evaluated as a string * * @throws javax.xml.transform.TransformerException */ public String evaluate( XPathContext xctxt, int context, org.apache.xml.utils.PrefixResolver nsNode) throws javax.xml.transform.TransformerException { if (null != m_simpleString){ return m_simpleString; }else if (null != m_parts){ final FastStringBuffer buf =getBuffer(); String out = null; int n = m_parts.size(); try{ for (int i = 0; i < n; i++){ AVTPart part = (AVTPart) m_parts.elementAt(i); part.evaluate(xctxt, buf, context, nsNode); } out = buf.toString(); }finally{ if(USE_OBJECT_POOL){ StringBufferPool.free(buf); }else{ buf.setLength(0); } } return out; }else{ return ""; } } /** * Test whether the AVT is insensitive to the context in which * it is being evaluated. This is intended to facilitate * compilation of templates, by allowing simple AVTs to be * converted back into strings. * * Currently the only case we recognize is simple strings. * ADDED 9/5/2000 to support compilation experiment * * @return True if the m_simpleString member of this AVT is not null */ public boolean isContextInsensitive() { return null != m_simpleString; } /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { if (null != m_parts) { int n = m_parts.size(); for (int i = 0; i < n; i++) { AVTPart part = (AVTPart) m_parts.elementAt(i); if (part.canTraverseOutsideSubtree()) return true; } } return false; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { if (null != m_parts) { int n = m_parts.size(); for (int i = 0; i < n; i++) { AVTPart part = (AVTPart) m_parts.elementAt(i); part.fixupVariables(vars, globalsSize); } } } /** * @see XSLTVisitable#callVisitors(XSLTVisitor) */ public void callVisitors(XSLTVisitor visitor) { if(visitor.visitAVT(this) && (null != m_parts)) { int n = m_parts.size(); for (int i = 0; i < n; i++) { AVTPart part = (AVTPart) m_parts.elementAt(i); part.callVisitors(visitor); } } } /** * Returns true if this AVT is simple */ public boolean isSimple() { return m_simpleString != null; } private final FastStringBuffer getBuffer(){ if(USE_OBJECT_POOL){ return StringBufferPool.get(); }else{ return new FastStringBuffer(INIT_BUFFER_CHUNK_BITS); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java0000644000175000017500000001476310721374032030035 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TemplateSubPatternAssociation.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.io.Serializable; import javax.xml.transform.TransformerException; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.patterns.StepPattern; /** * A class to contain a match pattern and it's corresponding template. * This class also defines a node in a match pattern linked list. */ class TemplateSubPatternAssociation implements Serializable, Cloneable { static final long serialVersionUID = -8902606755229903350L; /** Step pattern */ StepPattern m_stepPattern; /** Template pattern */ private String m_pattern; /** The template element */ private ElemTemplate m_template; /** Next pattern */ private TemplateSubPatternAssociation m_next = null; /** Flag indicating whether this is wild card pattern */ private boolean m_wild; /** Target string for this match pattern */ private String m_targetString; /** * Construct a match pattern from a pattern and template. * @param template The node that contains the template for this pattern. * @param pattern An executable XSLT StepPattern. * @param pat For now a Nodelist that contains old-style element patterns. */ TemplateSubPatternAssociation(ElemTemplate template, StepPattern pattern, String pat) { m_pattern = pat; m_template = template; m_stepPattern = pattern; m_targetString = m_stepPattern.getTargetString(); m_wild = m_targetString.equals("*"); } /** * Clone this object. * * @return The cloned object. * * @throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { TemplateSubPatternAssociation tspa = (TemplateSubPatternAssociation) super.clone(); tspa.m_next = null; return tspa; } /** * Get the target string of the pattern. For instance, if the pattern is * "foo/baz/boo[@daba]", this string will be "boo". * * @return The "target" string. */ public final String getTargetString() { return m_targetString; } /** * Set Target String for this template pattern * * * @param key Target string to set */ public void setTargetString(String key) { m_targetString = key; } /** * Tell if two modes match according to the rules of XSLT. * * @param m1 mode to match * * @return True if the given mode matches this template's mode */ boolean matchMode(QName m1) { return matchModes(m1, m_template.getMode()); } /** * Tell if two modes match according to the rules of XSLT. * * @param m1 First mode to match * @param m2 Second mode to match * * @return True if the two given modes match */ private boolean matchModes(QName m1, QName m2) { return (((null == m1) && (null == m2)) || ((null != m1) && (null != m2) && m1.equals(m2))); } /** * Return the mode associated with the template. * * * @param xctxt XPath context to use with this template * @param targetNode Target node * @param mode reference, which may be null, to the current mode. * @return The mode associated with the template. * * @throws TransformerException */ public boolean matches(XPathContext xctxt, int targetNode, QName mode) throws TransformerException { double score = m_stepPattern.getMatchScore(xctxt, targetNode); return (XPath.MATCH_SCORE_NONE != score) && matchModes(mode, m_template.getMode()); } /** * Tell if the pattern for this association is a wildcard. * * @return true if this pattern is considered to be a wild match. */ public final boolean isWild() { return m_wild; } /** * Get associated XSLT StepPattern. * * @return An executable StepPattern object, never null. * */ public final StepPattern getStepPattern() { return m_stepPattern; } /** * Get the pattern string for diagnostic purposes. * * @return The pattern string for diagnostic purposes. * */ public final String getPattern() { return m_pattern; } /** * Return the position of the template in document * order in the stylesheet. * * @return The position of the template in the overall template order. */ public int getDocOrderPos() { return m_template.getUid(); } /** * Return the import level associated with the stylesheet into which * this template is composed. * * @return The import level of this template. */ public final int getImportLevel() { return m_template.getStylesheetComposed().getImportCountComposed(); } /** * Get the assocated xsl:template. * * @return An ElemTemplate, never null. * */ public final ElemTemplate getTemplate() { return m_template; } /** * Get the next association. * * @return A valid TemplateSubPatternAssociation, or null. */ public final TemplateSubPatternAssociation getNext() { return m_next; } /** * Set the next element on this association * list, which should be equal or less in priority to * this association, and, if equal priority, should occur * before this template in document order. * * @param mp The next association to score if this one fails. * */ public void setNext(TemplateSubPatternAssociation mp) { m_next = mp; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemEmpty.java0000644000175000017500000000236710721374032023753 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemEmpty.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * Simple empty elem to push on the stack when nothing * else got pushed, so that pop() works correctly. * @xsl.usage internal */ public class ElemEmpty extends ElemTemplateElement { static final long serialVersionUID = 7544753713671472252L; /** * Constructor ElemEmpty * */ public ElemEmpty(){} } libxalan2-java-2.7.1/src/org/apache/xalan/templates/XUnresolvedVariableSimple.java0000644000175000017500000000474410721374031027150 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XUnresolvedVariableSimple.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xpath.Expression; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * This is the same as XUnresolvedVariable, but it assumes that the * context is already set up. For use with psuedo variables. * Also, it holds an Expression object, instead of an ElemVariable. * It must only hold static context, since a single copy will be * held in the template. */ public class XUnresolvedVariableSimple extends XObject { static final long serialVersionUID = -1224413807443958985L; public XUnresolvedVariableSimple(ElemVariable obj) { super(obj); } /** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return This object. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { Expression expr = ((ElemVariable)m_obj).getSelect().getExpression(); XObject xobj = expr.execute(xctxt); xobj.allowDetachToRelease(false); return xobj; } /** * Tell what kind of class this is. * * @return CLASS_UNRESOLVEDVARIABLE */ public int getType() { return CLASS_UNRESOLVEDVARIABLE; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return An informational string. */ public String getTypeString() { return "XUnresolvedVariableSimple (" + object().getClass().getName() + ")"; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/OutputProperties.java0000644000175000017500000005540610721374030025427 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OutputProperties.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Enumeration; import java.util.Properties; import java.util.Vector; import javax.xml.transform.OutputKeys; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.OutputPropertyUtils; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.QName; /** * This class provides information from xsl:output elements. It is mainly * a wrapper for {@link java.util.Properties}, but can not extend that class * because it must be part of the {@link org.apache.xalan.templates.ElemTemplateElement} * heararchy. *

        An OutputProperties list can contain another OutputProperties list as * its "defaults"; this second property list is searched if the property key * is not found in the original property list.

        * @see XSLT DTD * @see xsl:output in XSLT Specification * */ public class OutputProperties extends ElemTemplateElement implements Cloneable { static final long serialVersionUID = -6975274363881785488L; /** * Creates an empty OutputProperties with no default values. */ public OutputProperties() { this(org.apache.xml.serializer.Method.XML); } /** * Creates an empty OutputProperties with the specified defaults. * * @param defaults the defaults. */ public OutputProperties(Properties defaults) { m_properties = new Properties(defaults); } /** * Creates an empty OutputProperties with the defaults specified by * a property file. The method argument is used to construct a string of * the form output_[method].properties (for instance, output_html.properties). * The output_xml.properties file is always used as the base. *

        At the moment, anything other than 'text', 'xml', and 'html', will * use the output_xml.properties file.

        * * @param method non-null reference to method name. */ public OutputProperties(String method) { m_properties = new Properties( OutputPropertiesFactory.getDefaultMethodProperties(method)); } /** * Clone this OutputProperties, including a clone of the wrapped Properties * reference. * * @return A new OutputProperties reference, mutation of which should not * effect this object. */ public Object clone() { try { OutputProperties cloned = (OutputProperties) super.clone(); cloned.m_properties = (Properties) cloned.m_properties.clone(); return cloned; } catch (CloneNotSupportedException e) { return null; } } /** * Set an output property. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setProperty(QName key, String value) { setProperty(key.toNamespacedString(), value); } /** * Set an output property. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setProperty(String key, String value) { if(key.equals(OutputKeys.METHOD)) { setMethodDefaults(value); } if (key.startsWith(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL)) key = OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL + key.substring(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN); m_properties.put(key, value); } /** * Searches for the property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @return the value in this property list with the specified key value. */ public String getProperty(QName key) { return m_properties.getProperty(key.toNamespacedString()); } /** * Searches for the property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @return the value in this property list with the specified key value. */ public String getProperty(String key) { if (key.startsWith(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL)) key = OutputPropertiesFactory.S_BUILTIN_EXTENSIONS_UNIVERSAL + key.substring(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN); return m_properties.getProperty(key); } /** * Set an output property. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setBooleanProperty(QName key, boolean value) { m_properties.put(key.toNamespacedString(), value ? "yes" : "no"); } /** * Set an output property. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setBooleanProperty(String key, boolean value) { m_properties.put(key, value ? "yes" : "no"); } /** * Searches for the boolean property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * false if the property is not found, or if the value is other * than "yes". * * @param key the property key. * @return the value in this property list as a boolean value, or false * if null or not "yes". */ public boolean getBooleanProperty(QName key) { return getBooleanProperty(key.toNamespacedString()); } /** * Searches for the boolean property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * false if the property is not found, or if the value is other * than "yes". * * @param key the property key. * @return the value in this property list as a boolean value, or false * if null or not "yes". */ public boolean getBooleanProperty(String key) { return OutputPropertyUtils.getBooleanProperty(key, m_properties); } /** * Set an output property. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setIntProperty(QName key, int value) { setIntProperty(key.toNamespacedString(), value); } /** * Set an output property. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setIntProperty(String key, int value) { m_properties.put(key, Integer.toString(value)); } /** * Searches for the int property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * false if the property is not found, or if the value is other * than "yes". * * @param key the property key. * @return the value in this property list as a int value, or false * if null or not a number. */ public int getIntProperty(QName key) { return getIntProperty(key.toNamespacedString()); } /** * Searches for the int property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * false if the property is not found, or if the value is other * than "yes". * * @param key the property key. * @return the value in this property list as a int value, or false * if null or not a number. */ public int getIntProperty(String key) { return OutputPropertyUtils.getIntProperty(key, m_properties); } /** * Set an output property with a QName value. The QName will be turned * into a string with the namespace in curly brackets. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setQNameProperty(QName key, QName value) { setQNameProperty(key.toNamespacedString(), value); } /** * Reset the default properties based on the method. * * @param method the method value. * @see javax.xml.transform.OutputKeys */ public void setMethodDefaults(String method) { String defaultMethod = m_properties.getProperty(OutputKeys.METHOD); if((null == defaultMethod) || !defaultMethod.equals(method) // bjm - add the next condition as a hack // but it is because both output_xml.properties and // output_unknown.properties have the same method=xml // for their default. Otherwise we end up with // a ToUnknownStream wraping a ToXMLStream even // when the users says method="xml" // || defaultMethod.equals("xml") ) { Properties savedProps = m_properties; Properties newDefaults = OutputPropertiesFactory.getDefaultMethodProperties(method); m_properties = new Properties(newDefaults); copyFrom(savedProps, false); } } /** * Set an output property with a QName value. The QName will be turned * into a string with the namespace in curly brackets. * * @param key the key to be placed into the property list. * @param value the value corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setQNameProperty(String key, QName value) { setProperty(key, value.toNamespacedString()); } /** * Searches for the qname property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @return the value in this property list as a QName value, or false * if null or not "yes". */ public QName getQNameProperty(QName key) { return getQNameProperty(key.toNamespacedString()); } /** * Searches for the qname property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @return the value in this property list as a QName value, or false * if null or not "yes". */ public QName getQNameProperty(String key) { return getQNameProperty(key, m_properties); } /** * Searches for the qname property with the specified key in the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @param props the list of properties to search in. * @return the value in this property list as a QName value, or false * if null or not "yes". */ public static QName getQNameProperty(String key, Properties props) { String s = props.getProperty(key); if (null != s) return QName.getQNameFromString(s); else return null; } /** * Set an output property with a QName list value. The QNames will be turned * into strings with the namespace in curly brackets. * * @param key the key to be placed into the property list. * @param v non-null list of QNames corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setQNameProperties(QName key, Vector v) { setQNameProperties(key.toNamespacedString(), v); } /** * Set an output property with a QName list value. The QNames will be turned * into strings with the namespace in curly brackets. * * @param key the key to be placed into the property list. * @param v non-null list of QNames corresponding to key. * @see javax.xml.transform.OutputKeys */ public void setQNameProperties(String key, Vector v) { int s = v.size(); // Just an initial guess at reasonable tuning parameters FastStringBuffer fsb = new FastStringBuffer(9,9); for (int i = 0; i < s; i++) { QName qname = (QName) v.elementAt(i); fsb.append(qname.toNamespacedString()); // Don't append space after last value if (i < s-1) fsb.append(' '); } m_properties.put(key, fsb.toString()); } /** * Searches for the list of qname properties with the specified key in * the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @return the value in this property list as a vector of QNames, or false * if null or not "yes". */ public Vector getQNameProperties(QName key) { return getQNameProperties(key.toNamespacedString()); } /** * Searches for the list of qname properties with the specified key in * the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @return the value in this property list as a vector of QNames, or false * if null or not "yes". */ public Vector getQNameProperties(String key) { return getQNameProperties(key, m_properties); } /** * Searches for the list of qname properties with the specified key in * the property list. * If the key is not found in this property list, the default property list, * and its defaults, recursively, are then checked. The method returns * null if the property is not found. * * @param key the property key. * @param props the list of properties to search in. * @return the value in this property list as a vector of QNames, or false * if null or not "yes". */ public static Vector getQNameProperties(String key, Properties props) { String s = props.getProperty(key); if (null != s) { Vector v = new Vector(); int l = s.length(); boolean inCurly = false; FastStringBuffer buf = new FastStringBuffer(); // parse through string, breaking on whitespaces. I do this instead // of a tokenizer so I can track whitespace inside of curly brackets, // which theoretically shouldn't happen if they contain legal URLs. for (int i = 0; i < l; i++) { char c = s.charAt(i); if (Character.isWhitespace(c)) { if (!inCurly) { if (buf.length() > 0) { QName qname = QName.getQNameFromString(buf.toString()); v.addElement(qname); buf.reset(); } continue; } } else if ('{' == c) inCurly = true; else if ('}' == c) inCurly = false; buf.append(c); } if (buf.length() > 0) { QName qname = QName.getQNameFromString(buf.toString()); v.addElement(qname); buf.reset(); } return v; } else return null; } /** * This function is called to recompose all of the output format extended elements. * * @param root non-null reference to the stylesheet root object. */ public void recompose(StylesheetRoot root) throws TransformerException { root.recomposeOutput(this); } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); } /** * Get the Properties object that this class wraps. * * @return non-null reference to Properties object. */ public Properties getProperties() { return m_properties; } /** * Copy the keys and values from the source to this object. This will * not copy the default values. This is meant to be used by going from * a higher precedence object to a lower precedence object, so that if a * key already exists, this method will not reset it. * * @param src non-null reference to the source properties. */ public void copyFrom(Properties src) { copyFrom(src, true); } /** * Copy the keys and values from the source to this object. This will * not copy the default values. This is meant to be used by going from * a higher precedence object to a lower precedence object, so that if a * key already exists, this method will not reset it. * * @param src non-null reference to the source properties. * @param shouldResetDefaults true if the defaults should be reset based on * the method property. */ public void copyFrom(Properties src, boolean shouldResetDefaults) { Enumeration keys = src.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (!isLegalPropertyKey(key)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{key})); //"output property not recognized: " Object oldValue = m_properties.get(key); if (null == oldValue) { String val = (String) src.get(key); if(shouldResetDefaults && key.equals(OutputKeys.METHOD)) { setMethodDefaults(val); } m_properties.put(key, val); } else if (key.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) { m_properties.put(key, (String) oldValue + " " + (String) src.get(key)); } } } /** * Copy the keys and values from the source to this object. This will * not copy the default values. This is meant to be used by going from * a higher precedence object to a lower precedence object, so that if a * key already exists, this method will not reset it. * * @param opsrc non-null reference to an OutputProperties. */ public void copyFrom(OutputProperties opsrc) throws TransformerException { // Bugzilla 6157: recover from xsl:output statements // checkDuplicates(opsrc); copyFrom(opsrc.getProperties()); } /** * Report if the key given as an argument is a legal xsl:output key. * * @param key non-null reference to key name. * * @return true if key is legal. */ public static boolean isLegalPropertyKey(String key) { return (key.equals(OutputKeys.CDATA_SECTION_ELEMENTS) || key.equals(OutputKeys.DOCTYPE_PUBLIC) || key.equals(OutputKeys.DOCTYPE_SYSTEM) || key.equals(OutputKeys.ENCODING) || key.equals(OutputKeys.INDENT) || key.equals(OutputKeys.MEDIA_TYPE) || key.equals(OutputKeys.METHOD) || key.equals(OutputKeys.OMIT_XML_DECLARATION) || key.equals(OutputKeys.STANDALONE) || key.equals(OutputKeys.VERSION) || (key.length() > 0) && (key.charAt(0) == '{') && (key.lastIndexOf('{') == 0) && (key.indexOf('}') > 0) && (key.lastIndexOf('}') == key.indexOf('}'))); } /** The output properties. * @serial */ private Properties m_properties = null; /** * Creates an empty OutputProperties with the defaults specified by * a property file. The method argument is used to construct a string of * the form output_[method].properties (for instance, output_html.properties). * The output_xml.properties file is always used as the base. *

        At the moment, anything other than 'text', 'xml', and 'html', will * use the output_xml.properties file.

        * * @param method non-null reference to method name. * * @return Properties object that holds the defaults for the given method. * * @deprecated Use org.apache.xml.serializer.OuputPropertiesFactory. * getDefaultMethodProperties directly. */ static public Properties getDefaultMethodProperties(String method) { return org.apache.xml.serializer.OutputPropertiesFactory.getDefaultMethodProperties(method); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemParam.java0000644000175000017500000000753710721374033023722 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemParam.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.VariableStack; import org.apache.xpath.objects.XObject; /** * Implement xsl:param. *
         * 
         * 
         * 
        * @see variables in XSLT Specification * @xsl.usage advanced */ public class ElemParam extends ElemVariable { static final long serialVersionUID = -1131781475589006431L; int m_qnameID; /** * Constructor ElemParam * */ public ElemParam(){} /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID of the element */ public int getXSLToken() { return Constants.ELEMNAME_PARAMVARIABLE; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_PARAMVARIABLE_STRING; } /** * Copy constructor. * * @param param Element from an xsl:param * * @throws TransformerException */ public ElemParam(ElemParam param) throws TransformerException { super(param); } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); m_qnameID = sroot.getComposeState().getQNameID(m_qname); int parentToken = m_parentNode.getXSLToken(); if (parentToken == Constants.ELEMNAME_TEMPLATE || parentToken == Constants.EXSLT_ELEMNAME_FUNCTION) ((ElemTemplate)m_parentNode).m_inArgsSize++; } /** * Execute a variable declaration and push it onto the variable stack. * @see variables in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); VariableStack vars = transformer.getXPathContext().getVarStack(); if(!vars.isLocalSet(m_index)) { int sourceNode = transformer.getXPathContext().getCurrentNode(); XObject var = getValue(transformer, sourceNode); // transformer.getXPathContext().getVarStack().pushVariable(m_qname, var); transformer.getXPathContext().getVarStack().setLocalVariable(m_index, var); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/XSLTVisitor.java0000644000175000017500000000673410721374030024224 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTVisitor.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xpath.XPathVisitor; /** * A derivation from this class can be passed to a class that implements * the XSLTVisitable interface, to have the appropriate method called * for each component of an XSLT stylesheet. Aside from possible other uses, * the main intention is to provide a reasonable means to perform expression * rewriting. */ public class XSLTVisitor extends XPathVisitor { /** * Visit an XSLT instruction. Any element that isn't called by one * of the other visit methods, will be called by this method. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitInstruction(ElemTemplateElement elem) { return true; } /** * Visit an XSLT stylesheet instruction. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitStylesheet(ElemTemplateElement elem) { return true; } /** * Visit an XSLT top-level instruction. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitTopLevelInstruction(ElemTemplateElement elem) { return true; } /** * Visit an XSLT top-level instruction. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitTopLevelVariableOrParamDecl(ElemTemplateElement elem) { return true; } /** * Visit an XSLT variable or parameter declaration. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitVariableOrParamDecl(ElemVariable elem) { return true; } /** * Visit a LiteralResultElement. * * @param elem The literal result object. * @return true if the sub expressions should be traversed. */ public boolean visitLiteralResultElement(ElemLiteralResult elem) { return true; } /** * Visit an Attribute Value Template (at the top level). * * @param elem The attribute value template object. * @return true if the sub expressions should be traversed. */ public boolean visitAVT(AVT elem) { return true; } /** * Visit an extension element. * @param elem The extension object. * @return true if the sub expressions should be traversed. */ public boolean visitExtensionElement(ElemExtensionCall elem) { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/WhiteSpaceInfo.java0000644000175000017500000000470310721374031024715 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WhiteSpaceInfo.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xpath.XPath; /** * This is used as a special "fake" template that can be * handled by the TemplateList to do pattern matching * on nodes. */ public class WhiteSpaceInfo extends ElemTemplate { static final long serialVersionUID = 6389208261999943836L; /** Flag indicating whether whitespaces should be stripped. * @serial */ private boolean m_shouldStripSpace; /** * Return true if this element specifies that the node that * matches the match pattern should be stripped, otherwise * the space should be preserved. * * @return value of m_shouldStripSpace flag */ public boolean getShouldStripSpace() { return m_shouldStripSpace; } /** * Constructor WhiteSpaceInfo * @param thisSheet The current stylesheet */ public WhiteSpaceInfo(Stylesheet thisSheet) { setStylesheet(thisSheet); } /** * Constructor WhiteSpaceInfo * * * @param matchPattern Match pattern * @param shouldStripSpace Flag indicating whether or not * to strip whitespaces * @param thisSheet The current stylesheet */ public WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace, Stylesheet thisSheet) { m_shouldStripSpace = shouldStripSpace; setMatch(matchPattern); setStylesheet(thisSheet); } /** * This function is called to recompose() all of the WhiteSpaceInfo elements. */ public void recompose(StylesheetRoot root) { root.recomposeWhiteSpaceInfo(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/AVTPartSimple.java0000644000175000017500000000617110721374030024500 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AVTPartSimple.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xml.utils.FastStringBuffer; import org.apache.xpath.XPathContext; /** * Simple string part of a complex AVT. * @xsl.usage internal */ public class AVTPartSimple extends AVTPart { static final long serialVersionUID = -3744957690598727913L; /** * Simple string value; * @serial */ private String m_val; /** * Construct a simple AVT part. * @param val A pure string section of an AVT. */ public AVTPartSimple(String val) { m_val = val; } /** * Get the AVT part as the original string. * * @return the AVT part as the original string. */ public String getSimpleString() { return m_val; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { // no-op } /** * Write the value into the buffer. * * @param xctxt An XPathContext object, providing infomation specific * to this invocation and this thread. Maintains SAX state, variables, * error handler and so on, so the transformation/XPath object itself * can be simultaneously invoked from multiple threads. * @param buf Buffer to write into. * @param context The current source tree context. * @param nsNode The current namespace context (stylesheet tree context). */ public void evaluate(XPathContext xctxt, FastStringBuffer buf, int context, org.apache.xml.utils.PrefixResolver nsNode) { buf.append(m_val); } /** * @see XSLTVisitable#callVisitors(XSLTVisitor) */ public void callVisitors(XSLTVisitor visitor) { // Don't do anything for the subpart for right now. } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemExsltFunction.java0000644000175000017500000001212510721374031025452 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemExsltFunction.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.extensions.ExtensionNamespaceSupport; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Implement func:function. * @xsl.usage advanced */ public class ElemExsltFunction extends ElemTemplate { static final long serialVersionUID = 272154954793534771L; /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.EXSLT_ELEMNAME_FUNCTION; } /** * Return the node name, defined in the * Constants class. * @see org.apache.xalan.templates.Constants * @return The node name * */ public String getNodeName() { return Constants.EXSLT_ELEMNAME_FUNCTION_STRING; } public void execute(TransformerImpl transformer, XObject[] args) throws TransformerException { XPathContext xctxt = transformer.getXPathContext(); VariableStack vars = xctxt.getVarStack(); // Increment the frame bottom of the variable stack by the // frame size int thisFrame = vars.getStackFrame(); int nextFrame = vars.link(m_frameSize); if (m_inArgsSize < args.length) { throw new TransformerException ("function called with too many args"); } // Set parameters, // have to clear the section of the stack frame that has params. if (m_inArgsSize > 0) { vars.clearLocalSlots(0, m_inArgsSize); if (args.length > 0) { vars.setStackFrame(thisFrame); NodeList children = this.getChildNodes(); for (int i = 0; i < args.length; i ++) { Node child = children.item(i); if (children.item(i) instanceof ElemParam) { ElemParam param = (ElemParam)children.item(i); vars.setLocalVariable(param.getIndex(), args[i], nextFrame); } } vars.setStackFrame(nextFrame); } } // Removed ElemTemplate 'push' and 'pop' of RTFContext, in order to avoid losing the RTF context // before a value can be returned. ElemExsltFunction operates in the scope of the template that called // the function. // xctxt.pushRTFContext(); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); vars.setStackFrame(nextFrame); transformer.executeChildTemplates(this, true); // Reset the stack frame after the function call vars.unlink(thisFrame); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); // Following ElemTemplate 'pop' removed -- see above. // xctxt.popRTFContext(); } /** * Called after everything else has been * recomposed, and allows the function to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); // Register the function namespace (if not already registered). String namespace = getName().getNamespace(); String handlerClass = sroot.getExtensionHandlerClass(); Object[] args ={namespace, sroot}; ExtensionNamespaceSupport extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args); sroot.getExtensionNamespacesManager().registerExtension(extNsSpt); // Make sure there is a handler for the EXSLT functions namespace // -- for isElementAvailable(). if (!(namespace.equals(Constants.S_EXSLT_FUNCTIONS_URL))) { namespace = Constants.S_EXSLT_FUNCTIONS_URL; args = new Object[]{namespace, sroot}; extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args); sroot.getExtensionNamespacesManager().registerExtension(extNsSpt); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemCopyOf.java0000644000175000017500000001672410721374032024056 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemCopyOf.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xalan.transformer.TreeWalker2Result; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.ref.DTMTreeWalker; import org.apache.xalan.serialize.SerializerUtils; import org.apache.xml.serializer.SerializationHandler; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * Implement xsl:copy-of. *
         * 
         * 
         * 
        * @see copy-of in XSLT Specification * @xsl.usage advanced */ public class ElemCopyOf extends ElemTemplateElement { static final long serialVersionUID = -7433828829497411127L; /** * The required select attribute contains an expression. * @serial */ public XPath m_selectExpression = null; /** * Set the "select" attribute. * The required select attribute contains an expression. * * @param expr Expression for select attribute */ public void setSelect(XPath expr) { m_selectExpression = expr; } /** * Get the "select" attribute. * The required select attribute contains an expression. * * @return Expression for select attribute */ public XPath getSelect() { return m_selectExpression; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); m_selectExpression.fixupVariables(cstate.getVariableNames(), cstate.getGlobalsSize()); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_COPY_OF; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_COPY_OF_STRING; } /** * The xsl:copy-of element can be used to insert a result tree * fragment into the result tree, without first converting it to * a string as xsl:value-of does (see [7.6.1 Generating Text with * xsl:value-of]). * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); try { XPathContext xctxt = transformer.getXPathContext(); int sourceNode = xctxt.getCurrentNode(); XObject value = m_selectExpression.execute(xctxt, sourceNode, this); if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEvent(sourceNode, this, "select", m_selectExpression, value); SerializationHandler handler = transformer.getSerializationHandler(); if (null != value) { int type = value.getType(); String s; switch (type) { case XObject.CLASS_BOOLEAN : case XObject.CLASS_NUMBER : case XObject.CLASS_STRING : s = value.str(); handler.characters(s.toCharArray(), 0, s.length()); break; case XObject.CLASS_NODESET : // System.out.println(value); DTMIterator nl = value.iter(); // Copy the tree. DTMTreeWalker tw = new TreeWalker2Result(transformer, handler); int pos; while (DTM.NULL != (pos = nl.nextNode())) { DTM dtm = xctxt.getDTMManager().getDTM(pos); short t = dtm.getNodeType(pos); // If we just copy the whole document, a startDoc and endDoc get // generated, so we need to only walk the child nodes. if (t == DTM.DOCUMENT_NODE) { for (int child = dtm.getFirstChild(pos); child != DTM.NULL; child = dtm.getNextSibling(child)) { tw.traverse(child); } } else if (t == DTM.ATTRIBUTE_NODE) { SerializerUtils.addAttribute(handler, pos); } else { tw.traverse(pos); } } // nl.detach(); break; case XObject.CLASS_RTREEFRAG : SerializerUtils.outputResultTreeFragment( handler, value, transformer.getXPathContext()); break; default : s = value.str(); handler.characters(s.toCharArray(), 0, s.length()); break; } } // I don't think we want this. -sb // if (transformer.getDebug()) // transformer.getTraceManager().fireSelectedEvent(sourceNode, this, // "endSelect", m_selectExpression, value); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } /** * Add a child to the child list. * * @param newChild Child to add to this node's child list * * @return Child just added to child list */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); return null; } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) m_selectExpression.getExpression().callVisitors(m_selectExpression, visitor); super.callChildVisitors(visitor, callAttrs); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemUse.java0000644000175000017500000001633710721374033023414 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemUse.java 476466 2006-11-18 08:22:31Z minchau $ */ package org.apache.xalan.templates; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; /** * Implement xsl:use. * This acts as a superclass for ElemCopy, ElemAttributeSet, * ElemElement, and ElemLiteralResult, on order to implement * shared behavior the use-attribute-sets attribute. * @see attribute-sets in XSLT Specification * @xsl.usage advanced */ public class ElemUse extends ElemTemplateElement { static final long serialVersionUID = 5830057200289299736L; /** * The value of the "use-attribute-sets" attribute. * @serial */ private QName m_attributeSetsNames[] = null; /** * Set the "use-attribute-sets" attribute. * Attribute sets are used by specifying a use-attribute-sets * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or * xsl:attribute-set elements. The value of the use-attribute-sets * attribute is a whitespace-separated list of names of attribute * sets. Each name is specified as a QName, which is expanded as * described in [2.4 Qualified Names]. * * @param v The value to set for the "use-attribute-sets" attribute. */ public void setUseAttributeSets(Vector v) { int n = v.size(); m_attributeSetsNames = new QName[n]; for (int i = 0; i < n; i++) { m_attributeSetsNames[i] = (QName) v.elementAt(i); } } /** * Set the "use-attribute-sets" attribute. * Attribute sets are used by specifying a use-attribute-sets * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or * xsl:attribute-set elements. The value of the use-attribute-sets * attribute is a whitespace-separated list of names of attribute * sets. Each name is specified as a QName, which is expanded as * described in [2.4 Qualified Names]. * * @param v The value to set for the "use-attribute-sets" attribute. */ public void setUseAttributeSets(QName[] v) { m_attributeSetsNames = v; } /** * Get the "use-attribute-sets" attribute. * Attribute sets are used by specifying a use-attribute-sets * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or * xsl:attribute-set elements, or a xsl:use-attribute-sets attribute on * Literal Result Elements. * The value of the use-attribute-sets * attribute is a whitespace-separated list of names of attribute * sets. Each name is specified as a QName, which is expanded as * described in [2.4 Qualified Names]. * * @return The value of the "use-attribute-sets" attribute. */ public QName[] getUseAttributeSets() { return m_attributeSetsNames; } /** * Add the attributes from the named attribute sets to the attribute list. * TODO: Error handling for: "It is an error if there are two attribute sets * with the same expanded-name and with equal import precedence and that both * contain the same attribute unless there is a definition of the attribute * set with higher import precedence that also contains the attribute." * * @param transformer non-null reference to the the current transform-time state. * @param stylesheet The owning root stylesheet * * @throws TransformerException */ public void applyAttrSets( TransformerImpl transformer, StylesheetRoot stylesheet) throws TransformerException { applyAttrSets(transformer, stylesheet, m_attributeSetsNames); } /** * Add the attributes from the named attribute sets to the attribute list. * TODO: Error handling for: "It is an error if there are two attribute sets * with the same expanded-name and with equal import precedence and that both * contain the same attribute unless there is a definition of the attribute * set with higher import precedence that also contains the attribute." * * @param transformer non-null reference to the the current transform-time state. * @param stylesheet The owning root stylesheet * @param attributeSetsNames List of attribute sets names to apply * * @throws TransformerException */ private void applyAttrSets( TransformerImpl transformer, StylesheetRoot stylesheet, QName attributeSetsNames[]) throws TransformerException { if (null != attributeSetsNames) { int nNames = attributeSetsNames.length; for (int i = 0; i < nNames; i++) { QName qname = attributeSetsNames[i]; java.util.List attrSets = stylesheet.getAttributeSetComposed(qname); if (null != attrSets) { int nSets = attrSets.size(); // Highest priority attribute set will be at the top, // so process it last. for (int k = nSets-1; k >= 0 ; k--) { ElemAttributeSet attrSet = (ElemAttributeSet) attrSets.get(k); attrSet.execute(transformer); } } else { throw new TransformerException( XSLMessages.createMessage(XSLTErrorResources.ER_NO_ATTRIB_SET, new Object[] {qname}),this); } } } } /** * Copy attributes specified by use-attribute-sets to the result tree. * Specifying a use-attribute-sets attribute is equivalent to adding * xsl:attribute elements for each of the attributes in each of the * named attribute sets to the beginning of the content of the element * with the use-attribute-sets attribute, in the same order in which * the names of the attribute sets are specified in the use-attribute-sets * attribute. It is an error if use of use-attribute-sets attributes * on xsl:attribute-set elements causes an attribute set to directly * or indirectly use itself. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (null != m_attributeSetsNames) { applyAttrSets(transformer, getStylesheetRoot(), m_attributeSetsNames); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/XMLNSDecl.java0000644000175000017500000000473710721374030023544 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XMLNSDecl.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * Represents an xmlns declaration */ public class XMLNSDecl implements java.io.Serializable // 20001009 jkess { static final long serialVersionUID = 6710237366877605097L; /** * Constructor XMLNSDecl * * @param prefix non-null reference to prefix, using "" for default namespace. * @param uri non-null reference to namespace URI. * @param isExcluded true if this namespace declaration should normally be excluded. */ public XMLNSDecl(String prefix, String uri, boolean isExcluded) { m_prefix = prefix; m_uri = uri; m_isExcluded = isExcluded; } /** non-null reference to prefix, using "" for default namespace. * @serial */ private String m_prefix; /** * Return the prefix. * @return The prefix that is associated with this URI, or null * if the XMLNSDecl is declaring the default namespace. */ public String getPrefix() { return m_prefix; } /** non-null reference to namespace URI. * @serial */ private String m_uri; /** * Return the URI. * @return The URI that is associated with this declaration. */ public String getURI() { return m_uri; } /** true if this namespace declaration should normally be excluded. * @serial */ private boolean m_isExcluded; /** * Tell if this declaration should be excluded from the * result namespace. * * @return true if this namespace declaration should normally be excluded. */ public boolean getIsExcluded() { return m_isExcluded; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemCopy.java0000644000175000017500000001175510721374033023571 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemCopy.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.ClonerToResultTree; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xalan.serialize.SerializerUtils; import org.apache.xml.serializer.SerializationHandler; import org.apache.xpath.XPathContext; /** * Implement xsl:copy. *
         * 
         * 
         * 
        * @see copying in XSLT Specification * @xsl.usage advanced */ public class ElemCopy extends ElemUse { static final long serialVersionUID = 5478580783896941384L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_COPY; } /** * Return the node name. * * @return This element's name */ public String getNodeName() { return Constants.ELEMNAME_COPY_STRING; } /** * The xsl:copy element provides an easy way of copying the current node. * Executing this function creates a copy of the current node into the * result tree. *

        The namespace nodes of the current node are automatically * copied as well, but the attributes and children of the node are not * automatically copied. The content of the xsl:copy element is a * template for the attributes and children of the created node; * the content is instantiated only for nodes of types that can have * attributes or children (i.e. root nodes and element nodes).

        *

        The root node is treated specially because the root node of the * result tree is created implicitly. When the current node is the * root node, xsl:copy will not create a root node, but will just use * the content template.

        * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { XPathContext xctxt = transformer.getXPathContext(); try { int sourceNode = xctxt.getCurrentNode(); xctxt.pushCurrentNode(sourceNode); DTM dtm = xctxt.getDTM(sourceNode); short nodeType = dtm.getNodeType(sourceNode); if ((DTM.DOCUMENT_NODE != nodeType) && (DTM.DOCUMENT_FRAGMENT_NODE != nodeType)) { SerializationHandler rthandler = transformer.getSerializationHandler(); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); // TODO: Process the use-attribute-sets stuff ClonerToResultTree.cloneToResultTree(sourceNode, nodeType, dtm, rthandler, false); if (DTM.ELEMENT_NODE == nodeType) { super.execute(transformer); SerializerUtils.processNSDecls(rthandler, sourceNode, nodeType, dtm); transformer.executeChildTemplates(this, true); String ns = dtm.getNamespaceURI(sourceNode); String localName = dtm.getLocalName(sourceNode); transformer.getResultTreeHandler().endElement(ns, localName, dtm.getNodeName(sourceNode)); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } else { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); super.execute(transformer); transformer.executeChildTemplates(this, true); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } finally { xctxt.popCurrentNode(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/StylesheetRoot.java0000644000175000017500000012566610721374031025056 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StylesheetRoot.java 476466 2006-11-18 08:22:31Z minchau $ */ package org.apache.xalan.templates; import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Properties; import java.util.Vector; import javax.xml.transform.ErrorListener; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import org.apache.xalan.extensions.ExtensionNamespacesManager; import org.apache.xalan.processor.XSLTSchema; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.ref.ExpandedNameTable; import org.apache.xml.utils.IntStack; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; /** * This class represents the root object of the stylesheet tree. * @xsl.usage general */ public class StylesheetRoot extends StylesheetComposed implements java.io.Serializable, Templates { static final long serialVersionUID = 3875353123529147855L; /** * The flag for the setting of the optimize feature; */ private boolean m_optimizer = true; /** * The flag for the setting of the incremental feature; */ private boolean m_incremental = false; /** * The flag for the setting of the source_location feature; */ private boolean m_source_location = false; /** * State of the secure processing feature. */ private boolean m_isSecureProcessing = false; /** * Uses an XSL stylesheet document. * @throws TransformerConfigurationException if the baseIdentifier can not be resolved to a URL. */ public StylesheetRoot(ErrorListener errorListener) throws TransformerConfigurationException { super(null); setStylesheetRoot(this); try { m_selectDefault = new XPath("node()", this, this, XPath.SELECT, errorListener); initDefaultRule(errorListener); } catch (TransformerException se) { throw new TransformerConfigurationException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_INIT_DEFAULT_TEMPLATES, null), se); //"Can't init default templates!", se); } } /** * The schema used when creating this StylesheetRoot * @serial */ private HashMap m_availElems; /** * Creates a StylesheetRoot and retains a pointer to the schema used to create this * StylesheetRoot. The schema may be needed later for an element-available() function call. * * @param schema The schema used to create this stylesheet * @throws TransformerConfigurationException if the baseIdentifier can not be resolved to a URL. */ public StylesheetRoot(XSLTSchema schema, ErrorListener listener) throws TransformerConfigurationException { this(listener); m_availElems = schema.getElemsAvailable(); } /** * Tell if this is the root of the stylesheet tree. * * @return True since this is the root of the stylesheet tree. */ public boolean isRoot() { return true; } /** * Set the state of the secure processing feature. */ public void setSecureProcessing(boolean flag) { m_isSecureProcessing = flag; } /** * Return the state of the secure processing feature. */ public boolean isSecureProcessing() { return m_isSecureProcessing; } /** * Get the hashtable of available elements. * * @return table of available elements, keyed by qualified names, and with * values of the same qualified names. */ public HashMap getAvailableElements() { return m_availElems; } private transient ExtensionNamespacesManager m_extNsMgr = null; /** * Only instantiate an ExtensionNamespacesManager if one is called for * (i.e., if the stylesheet contains extension functions and/or elements). */ public ExtensionNamespacesManager getExtensionNamespacesManager() { if (m_extNsMgr == null) m_extNsMgr = new ExtensionNamespacesManager(); return m_extNsMgr; } /** * Get the vector of extension namespaces. Used to provide * the extensions table access to a list of extension * namespaces encountered during composition of a stylesheet. */ public Vector getExtensions() { return m_extNsMgr != null ? m_extNsMgr.getExtensions() : null; } /* public void runtimeInit(TransformerImpl transformer) throws TransformerException { System.out.println("StylesheetRoot.runtimeInit()"); // try{throw new Exception("StylesheetRoot.runtimeInit()");} catch(Exception e){e.printStackTrace();} } */ //============== Templates Interface ================ /** * Create a new transformation context for this Templates object. * * @return A Transformer instance, never null. */ public Transformer newTransformer() { return new TransformerImpl(this); } public Properties getDefaultOutputProps() { return m_outputProperties.getProperties(); } /** * Get the static properties for xsl:output. The object returned will * be a clone of the internal values, and thus it can be mutated * without mutating the Templates object, and then handed in to * the process method. * *

        For XSLT, Attribute Value Templates attribute values will * be returned unexpanded (since there is no context at this point).

        * * @return A Properties object, not null. */ public Properties getOutputProperties() { return (Properties)getDefaultOutputProps().clone(); } //============== End Templates Interface ================ /** * Recompose the values of all "composed" properties, meaning * properties that need to be combined or calculated from * the combination of imported and included stylesheets. This * method determines the proper import precedence of all imported * stylesheets. It then iterates through all of the elements and * properties in the proper order and triggers the individual recompose * methods. * * @throws TransformerException */ public void recompose() throws TransformerException { // Now we make a Vector that is going to hold all of the recomposable elements Vector recomposableElements = new Vector(); // First, we build the global import tree. if (null == m_globalImportList) { Vector importList = new Vector(); addImports(this, true, importList); // Now we create an array and reverse the order of the importList vector. // We built the importList vector backwards so that we could use addElement // to append to the end of the vector instead of constantly pushing new // stylesheets onto the front of the vector and having to shift the rest // of the vector each time. m_globalImportList = new StylesheetComposed[importList.size()]; for (int i = 0, j= importList.size() -1; i < importList.size(); i++) { m_globalImportList[j] = (StylesheetComposed) importList.elementAt(i); // Build the global include list for this stylesheet. // This needs to be done ahead of the recomposeImports // because we need the info from the composed includes. m_globalImportList[j].recomposeIncludes(m_globalImportList[j]); // Calculate the number of this import. m_globalImportList[j--].recomposeImports(); } } // Next, we walk the import tree and add all of the recomposable elements to the vector. int n = getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = getGlobalImport(i); imported.recompose(recomposableElements); } // We sort the elements into ascending order. QuickSort2(recomposableElements, 0, recomposableElements.size() - 1); // We set up the global variables that will hold the recomposed information. m_outputProperties = new OutputProperties(org.apache.xml.serializer.Method.UNKNOWN); // m_outputProperties = new OutputProperties(Method.XML); m_attrSets = new HashMap(); m_decimalFormatSymbols = new Hashtable(); m_keyDecls = new Vector(); m_namespaceAliasComposed = new Hashtable(); m_templateList = new TemplateList(); m_variables = new Vector(); // Now we sequence through the sorted elements, // calling the recompose() function on each one. This will call back into the // appropriate routine here to actually do the recomposition. // Note that we're going backwards, encountering the highest precedence items first. for (int i = recomposableElements.size() - 1; i >= 0; i--) ((ElemTemplateElement) recomposableElements.elementAt(i)).recompose(this); /* * Backing out REE again, as it seems to cause some new failures * which need to be investigated. -is */ // This has to be done before the initialization of the compose state, because // eleminateRedundentGlobals will add variables to the m_variables vector, which // it then copied in the ComposeState constructor. // if(true && org.apache.xalan.processor.TransformerFactoryImpl.m_optimize) // { // RedundentExprEliminator ree = new RedundentExprEliminator(); // callVisitors(ree); // ree.eleminateRedundentGlobals(this); // } initComposeState(); // Need final composition of TemplateList. This adds the wild cards onto the chains. m_templateList.compose(this); // Need to clear check for properties at the same import level. m_outputProperties.compose(this); m_outputProperties.endCompose(this); // Now call the compose() method on every element to give it a chance to adjust // based on composed values. n = getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = this.getGlobalImport(i); int includedCount = imported.getIncludeCountComposed(); for (int j = -1; j < includedCount; j++) { Stylesheet included = imported.getIncludeComposed(j); composeTemplates(included); } } // Attempt to register any remaining unregistered extension namespaces. if (m_extNsMgr != null) m_extNsMgr.registerUnregisteredNamespaces(); clearComposeState(); } /** * Call the compose function for each ElemTemplateElement. * * @param templ non-null reference to template element that will have * the composed method called on it, and will have it's children's composed * methods called. */ void composeTemplates(ElemTemplateElement templ) throws TransformerException { templ.compose(this); for (ElemTemplateElement child = templ.getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { composeTemplates(child); } templ.endCompose(this); } /** * The combined list of imports. The stylesheet with the highest * import precedence will be at element 0. The one with the lowest * import precedence will be at element length - 1. * @serial */ private StylesheetComposed[] m_globalImportList; /** * Add the imports in the given sheet to the working importList vector. * The will be added from highest import precedence to * least import precedence. This is a post-order traversal of the * import tree as described in the * XSLT Recommendation. *

        For example, suppose

        *

        stylesheet A imports stylesheets B and C in that order;

        *

        stylesheet B imports stylesheet D;

        *

        stylesheet C imports stylesheet E.

        *

        Then the order of import precedence (highest first) is * A, C, E, B, D.

        * * @param stylesheet Stylesheet to examine for imports. * @param addToList true if this template should be added to the import list * @param importList The working import list. Templates are added here in the reverse * order of priority. When we're all done, we'll reverse this to the correct * priority in an array. */ protected void addImports(Stylesheet stylesheet, boolean addToList, Vector importList) { // Get the direct imports of this sheet. int n = stylesheet.getImportCount(); if (n > 0) { for (int i = 0; i < n; i++) { Stylesheet imported = stylesheet.getImport(i); addImports(imported, true, importList); } } n = stylesheet.getIncludeCount(); if (n > 0) { for (int i = 0; i < n; i++) { Stylesheet included = stylesheet.getInclude(i); addImports(included, false, importList); } } if (addToList) importList.addElement(stylesheet); } /** * Get a stylesheet from the global import list. * TODO: JKESS PROPOSES SPECIAL-CASE FOR NO IMPORT LIST, TO MATCH COUNT. * * @param i Index of stylesheet to get from global import list * * @return The stylesheet at the given index */ public StylesheetComposed getGlobalImport(int i) { return m_globalImportList[i]; } /** * Get the total number of imports in the global import list. * * @return The total number of imported stylesheets, including * the root stylesheet, thus the number will always be 1 or * greater. * TODO: JKESS PROPOSES SPECIAL-CASE FOR NO IMPORT LIST, TO MATCH DESCRIPTION. */ public int getGlobalImportCount() { return (m_globalImportList!=null) ? m_globalImportList.length : 1; } /** * Given a stylesheet, return the number of the stylesheet * in the global import list. * @param sheet The stylesheet which will be located in the * global import list. * @return The index into the global import list of the given stylesheet, * or -1 if it is not found (which should never happen). */ public int getImportNumber(StylesheetComposed sheet) { if (this == sheet) return 0; int n = getGlobalImportCount(); for (int i = 0; i < n; i++) { if (sheet == getGlobalImport(i)) return i; } return -1; } /** * This will be set up with the default values, and then the values * will be set as stylesheets are encountered. * @serial */ private OutputProperties m_outputProperties; /** * Recompose the output format object from the included elements. * * @param oprops non-null reference to xsl:output properties representation. */ void recomposeOutput(OutputProperties oprops) throws TransformerException { m_outputProperties.copyFrom(oprops); } /** * Get the combined "xsl:output" property with the properties * combined from the included stylesheets. If a xsl:output * is not declared in this stylesheet or an included stylesheet, * look in the imports. * Please note that this returns a reference to the OutputProperties * object, not a cloned object, like getOutputProperties does. * @see output in XSLT Specification * * @return non-null reference to composed output properties object. */ public OutputProperties getOutputComposed() { // System.out.println("getOutputComposed.getIndent: "+m_outputProperties.getIndent()); // System.out.println("getOutputComposed.getIndenting: "+m_outputProperties.getIndenting()); return m_outputProperties; } /** Flag indicating whether an output method has been set by the user. * @serial */ private boolean m_outputMethodSet = false; /** * Find out if an output method has been set by the user. * * @return Value indicating whether an output method has been set by the user * @xsl.usage internal */ public boolean isOutputMethodSet() { return m_outputMethodSet; } /** * Composed set of all included and imported attribute set properties. * Each entry is a vector of ElemAttributeSet objects. * @serial */ private HashMap m_attrSets; /** * Recompose the attribute-set declarations. * * @param attrSet An attribute-set to add to the hashtable of attribute sets. */ void recomposeAttributeSets(ElemAttributeSet attrSet) { ArrayList attrSetList = (ArrayList) m_attrSets.get(attrSet.getName()); if (null == attrSetList) { attrSetList = new ArrayList(); m_attrSets.put(attrSet.getName(), attrSetList); } attrSetList.add(attrSet); } /** * Get a list "xsl:attribute-set" properties that match the qname. * @see attribute-sets in XSLT Specification * * @param name Qualified name of attribute set properties to get * * @return A vector of attribute sets matching the given name * * @throws ArrayIndexOutOfBoundsException */ public ArrayList getAttributeSetComposed(QName name) throws ArrayIndexOutOfBoundsException { return (ArrayList) m_attrSets.get(name); } /** * Table of DecimalFormatSymbols, keyed by QName. * @serial */ private Hashtable m_decimalFormatSymbols; /** * Recompose the decimal-format declarations. * * @param dfp A DecimalFormatProperties to add to the hashtable of decimal formats. */ void recomposeDecimalFormats(DecimalFormatProperties dfp) { DecimalFormatSymbols oldDfs = (DecimalFormatSymbols) m_decimalFormatSymbols.get(dfp.getName()); if (null == oldDfs) { m_decimalFormatSymbols.put(dfp.getName(), dfp.getDecimalFormatSymbols()); } else if (!dfp.getDecimalFormatSymbols().equals(oldDfs)) { String themsg; if (dfp.getName().equals(new QName(""))) { // "Only one default xsl:decimal-format declaration is allowed." themsg = XSLMessages.createWarning( XSLTErrorResources.WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED, new Object[0]); } else { // "xsl:decimal-format names must be unique. Name {0} has been duplicated." themsg = XSLMessages.createWarning( XSLTErrorResources.WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE, new Object[] {dfp.getName()}); } error(themsg); // Should we throw TransformerException instead? } } /** * Given a valid element decimal-format name, return the * decimalFormatSymbols with that name. *

        It is an error to declare either the default decimal-format or * a decimal-format with a given name more than once (even with * different import precedence), unless it is declared every * time with the same value for all attributes (taking into * account any default values).

        *

        Which means, as far as I can tell, the decimal-format * properties are not additive.

        * * @param name Qualified name of the decimal format to find * @return DecimalFormatSymbols object matching the given name or * null if name is not found. */ public DecimalFormatSymbols getDecimalFormatComposed(QName name) { return (DecimalFormatSymbols) m_decimalFormatSymbols.get(name); } /** * A list of all key declarations visible from this stylesheet and all * lesser stylesheets. * @serial */ private Vector m_keyDecls; /** * Recompose the key declarations. * * @param keyDecl A KeyDeclaration to be added to the vector of key declarations. */ void recomposeKeys(KeyDeclaration keyDecl) { m_keyDecls.addElement(keyDecl); } /** * Get the composed "xsl:key" properties. * @see key in XSLT Specification * * @return A vector of the composed "xsl:key" properties. */ public Vector getKeysComposed() { return m_keyDecls; } /** * Composed set of all namespace aliases. * @serial */ private Hashtable m_namespaceAliasComposed; /** * Recompose the namespace-alias declarations. * * @param nsAlias A NamespaceAlias object to add to the hashtable of namespace aliases. */ void recomposeNamespaceAliases(NamespaceAlias nsAlias) { m_namespaceAliasComposed.put(nsAlias.getStylesheetNamespace(), nsAlias); } /** * Get the "xsl:namespace-alias" property. * Return the NamespaceAlias for a given namespace uri. * @see literal-result-element in XSLT Specification * * @param uri non-null reference to namespace that is to be aliased. * * @return NamespaceAlias that matches uri, or null if no match. */ public NamespaceAlias getNamespaceAliasComposed(String uri) { return (NamespaceAlias) ((null == m_namespaceAliasComposed) ? null : m_namespaceAliasComposed.get(uri)); } /** * The "xsl:template" properties. * @serial */ private TemplateList m_templateList; /** * Recompose the template declarations. * * @param template An ElemTemplate object to add to the template list. */ void recomposeTemplates(ElemTemplate template) { m_templateList.setTemplate(template); } /** * Accessor method to retrieve the TemplateList associated with * this StylesheetRoot. * * @return The composed TemplateList. */ public final TemplateList getTemplateListComposed() { return m_templateList; } /** * Mutator method to set the TemplateList associated with this * StylesheetRoot. This method should only be used by the compiler. Normally, * the template list is built during the recompose process and should not be * altered by the user. * @param templateList The new TemplateList for this StylesheetRoot. */ public final void setTemplateListComposed(TemplateList templateList) { m_templateList = templateList; } /** * Get an "xsl:template" property by node match. This looks in the imports as * well as this stylesheet. * @see section-Defining-Template-Rules in XSLT Specification * * @param xctxt non-null reference to XPath runtime execution context. * @param targetNode non-null reference of node that the template must match. * @param mode qualified name of the node, or null. * @param quietConflictWarnings true if conflict warnings should not be reported. * * @return reference to ElemTemplate that is the best match for targetNode, or * null if no match could be made. * * @throws TransformerException */ public ElemTemplate getTemplateComposed(XPathContext xctxt, int targetNode, QName mode, boolean quietConflictWarnings, DTM dtm) throws TransformerException { return m_templateList.getTemplate(xctxt, targetNode, mode, quietConflictWarnings, dtm); } /** * Get an "xsl:template" property by node match. This looks in the imports as * well as this stylesheet. * @see section-Defining-Template-Rules in XSLT Specification * * @param xctxt non-null reference to XPath runtime execution context. * @param targetNode non-null reference of node that the template must match. * @param mode qualified name of the node, or null. * @param maxImportLevel The maximum importCountComposed that we should consider or -1 * if we should consider all import levels. This is used by apply-imports to * access templates that have been overridden. * @param endImportLevel The count of composed imports * @param quietConflictWarnings true if conflict warnings should not be reported. * * @return reference to ElemTemplate that is the best match for targetNode, or * null if no match could be made. * * @throws TransformerException */ public ElemTemplate getTemplateComposed(XPathContext xctxt, int targetNode, QName mode, int maxImportLevel, int endImportLevel, boolean quietConflictWarnings, DTM dtm) throws TransformerException { return m_templateList.getTemplate(xctxt, targetNode, mode, maxImportLevel, endImportLevel, quietConflictWarnings, dtm); } /** * Get an "xsl:template" property. This looks in the imports as * well as this stylesheet. * @see section-Defining-Template-Rules in XSLT Specification * * @param qname non-null reference to qualified name of template. * * @return reference to named template, or null if not found. */ public ElemTemplate getTemplateComposed(QName qname) { return m_templateList.getTemplate(qname); } /** * Composed set of all variables and params. * @serial */ private Vector m_variables; /** * Recompose the top level variable and parameter declarations. * * @param elemVar A top level variable or parameter to be added to the Vector. */ void recomposeVariables(ElemVariable elemVar) { // Don't overide higher priority variable if (getVariableOrParamComposed(elemVar.getName()) == null) { elemVar.setIsTopLevel(true); // Mark as a top-level variable or param elemVar.setIndex(m_variables.size()); m_variables.addElement(elemVar); } } /** * Get an "xsl:variable" property. * @see top-level-variables in XSLT Specification * * @param qname Qualified name of variable or param * * @return The ElemVariable with the given qualified name */ public ElemVariable getVariableOrParamComposed(QName qname) { if (null != m_variables) { int n = m_variables.size(); for (int i = 0; i < n; i++) { ElemVariable var = (ElemVariable)m_variables.elementAt(i); if(var.getName().equals(qname)) return var; } } return null; } /** * Get all global "xsl:variable" properties in scope for this stylesheet. * @see top-level-variables in XSLT Specification * * @return Vector of all variables and params in scope */ public Vector getVariablesAndParamsComposed() { return m_variables; } /** * A list of properties that specify how to do space * stripping. This uses the same exact mechanism as Templates. * @serial */ private TemplateList m_whiteSpaceInfoList; /** * Recompose the strip-space and preserve-space declarations. * * @param wsi A WhiteSpaceInfo element to add to the list of WhiteSpaceInfo elements. */ void recomposeWhiteSpaceInfo(WhiteSpaceInfo wsi) { if (null == m_whiteSpaceInfoList) m_whiteSpaceInfoList = new TemplateList(); m_whiteSpaceInfoList.setTemplate(wsi); } /** * Check to see if the caller should bother with check for * whitespace nodes. * * @return Whether the caller should bother with check for * whitespace nodes. */ public boolean shouldCheckWhitespace() { return null != m_whiteSpaceInfoList; } /** * Get information about whether or not an element should strip whitespace. * @see strip in XSLT Specification * * @param support The XPath runtime state. * @param targetElement Element to check * * @return WhiteSpaceInfo for the given element * * @throws TransformerException */ public WhiteSpaceInfo getWhiteSpaceInfo( XPathContext support, int targetElement, DTM dtm) throws TransformerException { if (null != m_whiteSpaceInfoList) return (WhiteSpaceInfo) m_whiteSpaceInfoList.getTemplate(support, targetElement, null, false, dtm); else return null; } /** * Get information about whether or not an element should strip whitespace. * @see strip in XSLT Specification * * @param support The XPath runtime state. * @param targetElement Element to check * * @return true if the whitespace should be stripped. * * @throws TransformerException */ public boolean shouldStripWhiteSpace( XPathContext support, int targetElement) throws TransformerException { if (null != m_whiteSpaceInfoList) { while(DTM.NULL != targetElement) { DTM dtm = support.getDTM(targetElement); WhiteSpaceInfo info = (WhiteSpaceInfo) m_whiteSpaceInfoList.getTemplate(support, targetElement, null, false, dtm); if(null != info) return info.getShouldStripSpace(); int parent = dtm.getParent(targetElement); if(DTM.NULL != parent && DTM.ELEMENT_NODE == dtm.getNodeType(parent)) targetElement = parent; else targetElement = DTM.NULL; } } return false; } /** * Get information about whether or not whitespace can be stripped. * @see strip in XSLT Specification * * @return true if the whitespace can be stripped. */ public boolean canStripWhiteSpace() { return (null != m_whiteSpaceInfoList); } /** * The default template to use for text nodes if we don't find * anything else. This is initialized in initDefaultRule(). * @serial * @xsl.usage advanced */ private ElemTemplate m_defaultTextRule; /** * Get the default template for text. * * @return the default template for text. * @xsl.usage advanced */ public final ElemTemplate getDefaultTextRule() { return m_defaultTextRule; } /** * The default template to use if we don't find anything * else. This is initialized in initDefaultRule(). * @serial * @xsl.usage advanced */ private ElemTemplate m_defaultRule; /** * Get the default template for elements. * * @return the default template for elements. * @xsl.usage advanced */ public final ElemTemplate getDefaultRule() { return m_defaultRule; } /** * The default template to use for the root if we don't find * anything else. This is initialized in initDefaultRule(). * We kind of need this because the defaultRule isn't good * enough because it doesn't supply a document context. * For now, I default the root document element to "HTML". * Don't know if this is really a good idea or not. * I suspect it is not. * @serial * @xsl.usage advanced */ private ElemTemplate m_defaultRootRule; /** * Get the default template for a root node. * * @return The default template for a root node. * @xsl.usage advanced */ public final ElemTemplate getDefaultRootRule() { return m_defaultRootRule; } /** * The start rule to kick off the transformation. * @serial * @xsl.usage advanced */ private ElemTemplate m_startRule; /** * Get the default template for a root node. * * @return The default template for a root node. * @xsl.usage advanced */ public final ElemTemplate getStartRule() { return m_startRule; } /** * Used for default selection. * @serial */ XPath m_selectDefault; /** * Create the default rule if needed. * * @throws TransformerException */ private void initDefaultRule(ErrorListener errorListener) throws TransformerException { // Then manufacture a default m_defaultRule = new ElemTemplate(); m_defaultRule.setStylesheet(this); XPath defMatch = new XPath("*", this, this, XPath.MATCH, errorListener); m_defaultRule.setMatch(defMatch); ElemApplyTemplates childrenElement = new ElemApplyTemplates(); childrenElement.setIsDefaultTemplate(true); childrenElement.setSelect(m_selectDefault); m_defaultRule.appendChild(childrenElement); m_startRule = m_defaultRule; // ----------------------------- m_defaultTextRule = new ElemTemplate(); m_defaultTextRule.setStylesheet(this); defMatch = new XPath("text() | @*", this, this, XPath.MATCH, errorListener); m_defaultTextRule.setMatch(defMatch); ElemValueOf elemValueOf = new ElemValueOf(); m_defaultTextRule.appendChild(elemValueOf); XPath selectPattern = new XPath(".", this, this, XPath.SELECT, errorListener); elemValueOf.setSelect(selectPattern); //-------------------------------- m_defaultRootRule = new ElemTemplate(); m_defaultRootRule.setStylesheet(this); defMatch = new XPath("/", this, this, XPath.MATCH, errorListener); m_defaultRootRule.setMatch(defMatch); childrenElement = new ElemApplyTemplates(); childrenElement.setIsDefaultTemplate(true); m_defaultRootRule.appendChild(childrenElement); childrenElement.setSelect(m_selectDefault); } /** * This is a generic version of C.A.R Hoare's Quick Sort * algorithm. This will handle arrays that are already * sorted, and arrays with duplicate keys. It was lifted from * the NodeSorter class but should probably be eliminated and replaced * with a call to Collections.sort when we migrate to Java2.
        * * If you think of a one dimensional array as going from * the lowest index on the left to the highest index on the right * then the parameters to this function are lowest index or * left and highest index or right. The first time you call * this function it will be with the parameters 0, a.length - 1. * * @param v a vector of ElemTemplateElement elements * @param lo0 left boundary of partition * @param hi0 right boundary of partition * */ private void QuickSort2(Vector v, int lo0, int hi0) { int lo = lo0; int hi = hi0; if ( hi0 > lo0) { // Arbitrarily establishing partition element as the midpoint of // the array. ElemTemplateElement midNode = (ElemTemplateElement) v.elementAt( ( lo0 + hi0 ) / 2 ); // loop through the array until indices cross while( lo <= hi ) { // find the first element that is greater than or equal to // the partition element starting from the left Index. while( (lo < hi0) && (((ElemTemplateElement) v.elementAt(lo)).compareTo(midNode) < 0) ) { ++lo; } // end while // find an element that is smaller than or equal to // the partition element starting from the right Index. while( (hi > lo0) && (((ElemTemplateElement) v.elementAt(hi)).compareTo(midNode) > 0) ) { --hi; } // if the indexes have not crossed, swap if( lo <= hi ) { ElemTemplateElement node = (ElemTemplateElement) v.elementAt(lo); v.setElementAt(v.elementAt(hi), lo); v.setElementAt(node, hi); ++lo; --hi; } } // If the right index has not reached the left side of array // must now sort the left partition. if( lo0 < hi ) { QuickSort2( v, lo0, hi ); } // If the left index has not reached the right side of array // must now sort the right partition. if( lo < hi0 ) { QuickSort2( v, lo, hi0 ); } } } // end QuickSort2 */ private transient ComposeState m_composeState; /** * Initialize a new ComposeState. */ void initComposeState() { m_composeState = new ComposeState(); } /** * Return class to track state global state during the compose() operation. * @return ComposeState reference, or null if endCompose has been called. */ ComposeState getComposeState() { return m_composeState; } /** * Clear the compose state. */ private void clearComposeState() { m_composeState = null; } private String m_extensionHandlerClass = "org.apache.xalan.extensions.ExtensionHandlerExsltFunction"; /** * This internal method allows the setting of the java class * to handle the extension function (if other than the default one). * * @xsl.usage internal */ public String setExtensionHandlerClass(String handlerClassName) { String oldvalue = m_extensionHandlerClass; m_extensionHandlerClass = handlerClassName; return oldvalue; } /** * * @xsl.usage internal */ public String getExtensionHandlerClass() { return m_extensionHandlerClass; } /** * Class to track state global state during the compose() operation. */ class ComposeState { ComposeState() { int size = m_variables.size(); for (int i = 0; i < size; i++) { ElemVariable ev = (ElemVariable)m_variables.elementAt(i); m_variableNames.addElement(ev.getName()); } } private ExpandedNameTable m_ent = new ExpandedNameTable(); /** * Given a qualified name, return an integer ID that can be * quickly compared. * * @param qname a qualified name object, must not be null. * * @return the expanded-name id of the qualified name. */ public int getQNameID(QName qname) { return m_ent.getExpandedTypeID(qname.getNamespace(), qname.getLocalName(), // The type doesn't matter for our // purposes. org.apache.xml.dtm.DTM.ELEMENT_NODE); } /** * A Vector of the current params and QNames within the current template. * Set by ElemTemplate and used by ProcessorVariable. */ private java.util.Vector m_variableNames = new java.util.Vector(); /** * Add the name of a qualified name within the template. The position in * the vector is its ID. * @param qname A qualified name of a param or variable, should be non-null. * @return the index where the variable was added. */ int addVariableName(final org.apache.xml.utils.QName qname) { int pos = m_variableNames.size(); m_variableNames.addElement(qname); int frameSize = m_variableNames.size() - getGlobalsSize(); if(frameSize > m_maxStackFrameSize) m_maxStackFrameSize++; return pos; } void resetStackFrameSize() { m_maxStackFrameSize = 0; } int getFrameSize() { return m_maxStackFrameSize; } /** * Get the current size of the stack frame. Use this to record the position * in a template element at startElement, so that it can be popped * at endElement. */ int getCurrentStackFrameSize() { return m_variableNames.size(); } /** * Set the current size of the stack frame. */ void setCurrentStackFrameSize(int sz) { m_variableNames.setSize(sz); } int getGlobalsSize() { return m_variables.size(); } IntStack m_marks = new IntStack(); void pushStackMark() { m_marks.push(getCurrentStackFrameSize()); } void popStackMark() { int mark = m_marks.pop(); setCurrentStackFrameSize(mark); } /** * Get the Vector of the current params and QNames to be collected * within the current template. * @return A reference to the vector of variable names. The reference * returned is owned by this class, and so should not really be mutated, or * stored anywhere. */ java.util.Vector getVariableNames() { return m_variableNames; } private int m_maxStackFrameSize; } /** * @return Optimization flag */ public boolean getOptimizer() { return m_optimizer; } /** * @param b Optimization flag */ public void setOptimizer(boolean b) { m_optimizer = b; } /** * @return Incremental flag */ public boolean getIncremental() { return m_incremental; } /** * @return source location flag */ public boolean getSource_location() { return m_source_location; } /** * @param b Incremental flag */ public void setIncremental(boolean b) { m_incremental = b; } /** * @param b Source location flag */ public void setSource_location(boolean b) { m_source_location = b; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemVariablePsuedo.java0000644000175000017500000000461510721374031025557 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemVariablePsuedo.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPath; public class ElemVariablePsuedo extends ElemVariable { static final long serialVersionUID = 692295692732588486L; XUnresolvedVariableSimple m_lazyVar; /** * Set the "select" attribute. * If the variable-binding element has a select attribute, * then the value of the attribute must be an expression and * the value of the variable is the object that results from * evaluating the expression. In this case, the content * of the variable must be empty. * * @param v Value to set for the "select" attribute. */ public void setSelect(XPath v) { super.setSelect(v); m_lazyVar = new XUnresolvedVariableSimple(this); } /** * Execute a variable declaration and push it onto the variable stack. * @see variables in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { // if (TransformerImpl.S_DEBUG) // transformer.getTraceManager().fireTraceEvent(this); // transformer.getXPathContext().getVarStack().pushVariable(m_qname, var); transformer.getXPathContext().getVarStack().setLocalVariable(m_index, m_lazyVar); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/FuncKey.java0000644000175000017500000001126210721374033023411 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncKey.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Hashtable; import org.apache.xalan.transformer.KeyManager; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.QName; import org.apache.xml.utils.XMLString; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.UnionPathIterator; import org.apache.xpath.functions.Function2Args; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XObject; /** * Execute the Key() function. * @xsl.usage advanced */ public class FuncKey extends Function2Args { static final long serialVersionUID = 9089293100115347340L; /** Dummy value to be used in usedrefs hashtable */ static private Boolean ISTRUE = new Boolean(true); /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { // TransformerImpl transformer = (TransformerImpl)xctxt; TransformerImpl transformer = (TransformerImpl) xctxt.getOwnerObject(); XNodeSet nodes = null; int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int docContext = dtm.getDocumentRoot(context); if (DTM.NULL == docContext) { // path.error(context, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC); //"context does not have an owner document!"); } String xkeyname = getArg0().execute(xctxt).str(); QName keyname = new QName(xkeyname, xctxt.getNamespaceContext()); XObject arg = getArg1().execute(xctxt); boolean argIsNodeSetDTM = (XObject.CLASS_NODESET == arg.getType()); KeyManager kmgr = transformer.getKeyManager(); // Don't bother with nodeset logic if the thing is only one node. if(argIsNodeSetDTM) { XNodeSet ns = (XNodeSet)arg; ns.setShouldCacheNodes(true); int len = ns.getLength(); if(len <= 1) argIsNodeSetDTM = false; } if (argIsNodeSetDTM) { Hashtable usedrefs = null; DTMIterator ni = arg.iter(); int pos; UnionPathIterator upi = new UnionPathIterator(); upi.exprSetParent(this); while (DTM.NULL != (pos = ni.nextNode())) { dtm = xctxt.getDTM(pos); XMLString ref = dtm.getStringValue(pos); if (null == ref) continue; if (null == usedrefs) usedrefs = new Hashtable(); if (usedrefs.get(ref) != null) { continue; // We already have 'em. } else { // ISTRUE being used as a dummy value. usedrefs.put(ref, ISTRUE); } XNodeSet nl = kmgr.getNodeSetDTMByKey(xctxt, docContext, keyname, ref, xctxt.getNamespaceContext()); nl.setRoot(xctxt.getCurrentNode(), xctxt); // try // { upi.addIterator(nl); // } // catch(CloneNotSupportedException cnse) // { // // will never happen. // } //mnodeset.addNodesInDocOrder(nl, xctxt); needed?? } int current = xctxt.getCurrentNode(); upi.setRoot(current, xctxt); nodes = new XNodeSet(upi); } else { XMLString ref = arg.xstr(); nodes = kmgr.getNodeSetDTMByKey(xctxt, docContext, keyname, ref, xctxt.getNamespaceContext()); nodes.setRoot(xctxt.getCurrentNode(), xctxt); } return nodes; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemText.java0000644000175000017500000001230510721374032023572 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemText.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xalan.res.XSLTErrorResources; /** * Implement xsl:template. * This primarily acts as a marker on the element * stack to signal that whitespace should be preserved. *
         * 
         * 
         * 
        * @see section-Creating-Text in XSLT Specification * @xsl.usage advanced */ public class ElemText extends ElemTemplateElement { static final long serialVersionUID = 1383140876182316711L; /** * Tells if this element should disable escaping. * @serial */ private boolean m_disableOutputEscaping = false; /** * Set the "disable-output-escaping" attribute. * Normally, the xml output method escapes & and < (and * possibly other characters) when outputting text nodes. * This ensures that the output is well-formed XML. However, * it is sometimes convenient to be able to produce output * that is almost, but not quite well-formed XML; for * example, the output may include ill-formed sections * which are intended to be transformed into well-formed * XML by a subsequent non-XML aware process. For this reason, * XSLT provides a mechanism for disabling output escaping. * An xsl:value-of or xsl:text element may have a * disable-output-escaping attribute; the allowed values * are yes or no; the default is no; if the value is yes, * then a text node generated by instantiating the xsl:value-of * or xsl:text element should be output without any escaping. * @see disable-output-escaping in XSLT Specification * * @param v Boolean flag indicating whether this element should disable escaping */ public void setDisableOutputEscaping(boolean v) { m_disableOutputEscaping = v; } /** * Get the "disable-output-escaping" attribute. * Normally, the xml output method escapes & and < (and * possibly other characters) when outputting text nodes. * This ensures that the output is well-formed XML. However, * it is sometimes convenient to be able to produce output * that is almost, but not quite well-formed XML; for * example, the output may include ill-formed sections * which are intended to be transformed into well-formed * XML by a subsequent non-XML aware process. For this reason, * XSLT provides a mechanism for disabling output escaping. * An xsl:value-of or xsl:text element may have a * disable-output-escaping attribute; the allowed values * are yes or no; the default is no; if the value is yes, * then a text node generated by instantiating the xsl:value-of * or xsl:text element should be output without any escaping. * @see disable-output-escaping in XSLT Specification * * @return Boolean flag indicating whether this element should disable escaping */ public boolean getDisableOutputEscaping() { return m_disableOutputEscaping; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_TEXT; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_TEXT_STRING; } /** * Add a child to the child list. * * @param newChild Child to add to children list * * @return Child added to children list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { case Constants.ELEMNAME_TEXTLITERALRESULT : break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/XSLTVisitable.java0000644000175000017500000000274710721374032024511 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTVisitable.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * A class that implements this interface will call a XSLTVisitor * for itself and members within it's heararchy. If the XSLTVistor's * method returns false, the sub-member heararchy will not be * traversed. */ public interface XSLTVisitable { /** * This will traverse the heararchy, calling the visitor for * each member. If the called visitor method returns * false, the subtree should not be called. * * @param visitor The visitor whose appropriate method will be called. */ public void callVisitors(XSLTVisitor visitor); } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemExtensionDecl.java0000644000175000017500000002617710721374031025425 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemExtensionDecl.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.extensions.ExtensionNamespaceSupport; import org.apache.xalan.extensions.ExtensionNamespacesManager; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.StringVector; /** * Implement the declaration of an extension element * @xsl.usage internal */ public class ElemExtensionDecl extends ElemTemplateElement { static final long serialVersionUID = -4692738885172766789L; /** * Constructor ElemExtensionDecl * */ public ElemExtensionDecl() { // System.out.println("ElemExtensionDecl ctor"); } /** Prefix string for this extension element. * @serial */ private String m_prefix = null; /** * Set the prefix for this extension element * * * @param v Prefix to set for this extension element */ public void setPrefix(String v) { m_prefix = v; } /** * Get the prefix for this extension element * * * @return Prefix for this extension element */ public String getPrefix() { return m_prefix; } /** StringVector holding the names of functions defined in this extension. * @serial */ private StringVector m_functions = new StringVector(); /** * Set the names of functions defined in this extension * * * @param v StringVector holding the names of functions defined in this extension */ public void setFunctions(StringVector v) { m_functions = v; } /** * Get the names of functions defined in this extension * * * @return StringVector holding the names of functions defined in this extension */ public StringVector getFunctions() { return m_functions; } /** * Get a function at a given index in this extension element * * * @param i Index of function to get * * @return Name of Function at given index * * @throws ArrayIndexOutOfBoundsException */ public String getFunction(int i) throws ArrayIndexOutOfBoundsException { if (null == m_functions) throw new ArrayIndexOutOfBoundsException(); return (String) m_functions.elementAt(i); } /** * Get count of functions defined in this extension element * * * @return count of functions defined in this extension element */ public int getFunctionCount() { return (null != m_functions) ? m_functions.size() : 0; } /** StringVector of elements defined in this extension. * @serial */ private StringVector m_elements = null; /** * Set StringVector of elements for this extension * * * @param v StringVector of elements to set */ public void setElements(StringVector v) { m_elements = v; } /** * Get StringVector of elements defined for this extension * * * @return StringVector of elements defined for this extension */ public StringVector getElements() { return m_elements; } /** * Get the element at the given index * * * @param i Index of element to get * * @return The element at the given index * * @throws ArrayIndexOutOfBoundsException */ public String getElement(int i) throws ArrayIndexOutOfBoundsException { if (null == m_elements) throw new ArrayIndexOutOfBoundsException(); return (String) m_elements.elementAt(i); } /** * Return the count of elements defined for this extension element * * * @return the count of elements defined for this extension element */ public int getElementCount() { return (null != m_elements) ? m_elements.size() : 0; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_EXTENSIONDECL; } public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); String prefix = getPrefix(); String declNamespace = getNamespaceForPrefix(prefix); String lang = null; String srcURL = null; String scriptSrc = null; if (null == declNamespace) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_NAMESPACE_DECL, new Object[]{prefix})); //"Prefix " + prefix does not have a corresponding namespace declaration"); for (ElemTemplateElement child = getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { if (Constants.ELEMNAME_EXTENSIONSCRIPT == child.getXSLToken()) { ElemExtensionScript sdecl = (ElemExtensionScript) child; lang = sdecl.getLang(); srcURL = sdecl.getSrc(); ElemTemplateElement childOfSDecl = sdecl.getFirstChildElem(); if (null != childOfSDecl) { if (Constants.ELEMNAME_TEXTLITERALRESULT == childOfSDecl.getXSLToken()) { ElemTextLiteral tl = (ElemTextLiteral) childOfSDecl; char[] chars = tl.getChars(); scriptSrc = new String(chars); if (scriptSrc.trim().length() == 0) scriptSrc = null; } } } } if (null == lang) lang = "javaclass"; if (lang.equals("javaclass") && (scriptSrc != null)) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ELEM_CONTENT_NOT_ALLOWED, new Object[]{scriptSrc})); //"Element content not allowed for lang=javaclass " + scriptSrc); // Register the extension namespace if it has not already been registered. ExtensionNamespaceSupport extNsSpt = null; ExtensionNamespacesManager extNsMgr = sroot.getExtensionNamespacesManager(); if (extNsMgr.namespaceIndex(declNamespace, extNsMgr.getExtensions()) == -1) { if (lang.equals("javaclass")) { if (null == srcURL) { extNsSpt = extNsMgr.defineJavaNamespace(declNamespace); } else if (extNsMgr.namespaceIndex(srcURL, extNsMgr.getExtensions()) == -1) { extNsSpt = extNsMgr.defineJavaNamespace(declNamespace, srcURL); } } else // not java { String handler = "org.apache.xalan.extensions.ExtensionHandlerGeneral"; Object [] args = {declNamespace, this.m_elements, this.m_functions, lang, srcURL, scriptSrc, getSystemId()}; extNsSpt = new ExtensionNamespaceSupport(declNamespace, handler, args); } } if (extNsSpt != null) extNsMgr.registerExtension(extNsSpt); } /** * This function will be called on top-level elements * only, just before the transform begins. * * @param transformer The XSLT TransformerFactory. * * @throws TransformerException */ public void runtimeInit(TransformerImpl transformer) throws TransformerException { /* //System.out.println("ElemExtensionDecl.runtimeInit()"); String lang = null; String srcURL = null; String scriptSrc = null; String prefix = getPrefix(); String declNamespace = getNamespaceForPrefix(prefix); if (null == declNamespace) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_NAMESPACE_DECL, new Object[]{prefix})); //"Prefix " + prefix does not have a corresponding namespace declaration"); for (ElemTemplateElement child = getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { if (Constants.ELEMNAME_EXTENSIONSCRIPT == child.getXSLToken()) { ElemExtensionScript sdecl = (ElemExtensionScript) child; lang = sdecl.getLang(); srcURL = sdecl.getSrc(); ElemTemplateElement childOfSDecl = sdecl.getFirstChildElem(); if (null != childOfSDecl) { if (Constants.ELEMNAME_TEXTLITERALRESULT == childOfSDecl.getXSLToken()) { ElemTextLiteral tl = (ElemTextLiteral) childOfSDecl; char[] chars = tl.getChars(); scriptSrc = new String(chars); if (scriptSrc.trim().length() == 0) scriptSrc = null; } } } } if (null == lang) lang = "javaclass"; if (lang.equals("javaclass") && (scriptSrc != null)) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ELEM_CONTENT_NOT_ALLOWED, new Object[]{scriptSrc})); //"Element content not allowed for lang=javaclass " + scriptSrc); // Instantiate a handler for this extension namespace. ExtensionsTable etable = transformer.getExtensionsTable(); ExtensionHandler nsh = etable.get(declNamespace); // If we have no prior ExtensionHandler for this namespace, we need to // create one. // If the script element is for javaclass, this is our special compiled java. // Element content is not supported for this so we throw an exception if // it is provided. Otherwise, we look up the srcURL to see if we already have // an ExtensionHandler. if (null == nsh) { if (lang.equals("javaclass")) { if (null == srcURL) { nsh = etable.makeJavaNamespace(declNamespace); } else { nsh = etable.get(srcURL); if (null == nsh) { nsh = etable.makeJavaNamespace(srcURL); } } } else // not java { nsh = new ExtensionHandlerGeneral(declNamespace, this.m_elements, this.m_functions, lang, srcURL, scriptSrc, getSystemId()); // System.out.println("Adding NS Handler: declNamespace = "+ // declNamespace+", lang = "+lang+", srcURL = "+ // srcURL+", scriptSrc="+scriptSrc); } etable.addExtensionNamespace(declNamespace, nsh); }*/ } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemNumber.java0000644000175000017500000021467710721374032024116 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemNumber.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; import java.util.NoSuchElementException; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.CountersTable; import org.apache.xalan.transformer.DecimalToRoman; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.NodeVector; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.StringBufferPool; import org.apache.xml.utils.res.XResourceBundle; import org.apache.xml.utils.res.CharArrayWrapper; import org.apache.xml.utils.res.IntArrayWrapper; import org.apache.xml.utils.res.LongArrayWrapper; import org.apache.xml.utils.res.StringArrayWrapper; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; import org.xml.sax.SAXException; // import org.apache.xalan.dtm.*; /** * Implement xsl:number. *
         * 
         * 
         * 
        * @see number in XSLT Specification * @xsl.usage advanced */ public class ElemNumber extends ElemTemplateElement { static final long serialVersionUID = 8118472298274407610L; /** * Chars for converting integers into alpha counts. * @see TransformerImpl#int2alphaCount */ private CharArrayWrapper m_alphaCountTable = null; private class MyPrefixResolver implements PrefixResolver { DTM dtm; int handle; boolean handleNullPrefix; /** * Constructor for MyPrefixResolver. * @param xpathExpressionContext */ public MyPrefixResolver(Node xpathExpressionContext, DTM dtm, int handle, boolean handleNullPrefix) { this.dtm = dtm; this.handle = handle; this.handleNullPrefix = handleNullPrefix; } /** * @see PrefixResolver#getNamespaceForPrefix(String, Node) */ public String getNamespaceForPrefix(String prefix) { return dtm.getNamespaceURI(handle); } /** * @see PrefixResolver#getNamespaceForPrefix(String, Node) * this shouldn't get called. */ public String getNamespaceForPrefix(String prefix, Node context) { return getNamespaceForPrefix(prefix); } /** * @see PrefixResolver#getBaseIdentifier() */ public String getBaseIdentifier() { return ElemNumber.this.getBaseIdentifier(); } /** * @see PrefixResolver#handlesNullPrefixes() */ public boolean handlesNullPrefixes() { return handleNullPrefix; } } /** * Only nodes are counted that match this pattern. * @serial */ private XPath m_countMatchPattern = null; /** * Set the "count" attribute. * The count attribute is a pattern that specifies what nodes * should be counted at those levels. If count attribute is not * specified, then it defaults to the pattern that matches any * node with the same node type as the current node and, if the * current node has an expanded-name, with the same expanded-name * as the current node. * * @param v Value to set for "count" attribute. */ public void setCount(XPath v) { m_countMatchPattern = v; } /** * Get the "count" attribute. * The count attribute is a pattern that specifies what nodes * should be counted at those levels. If count attribute is not * specified, then it defaults to the pattern that matches any * node with the same node type as the current node and, if the * current node has an expanded-name, with the same expanded-name * as the current node. * * @return Value of "count" attribute. */ public XPath getCount() { return m_countMatchPattern; } /** * Specifies where to count from. * For level="single" or level="multiple": * Only ancestors that are searched are * those that are descendants of the nearest ancestor that matches * the from pattern. * For level="any: * Only nodes after the first node before the * current node that match the from pattern are considered. * @serial */ private XPath m_fromMatchPattern = null; /** * Set the "from" attribute. Specifies where to count from. * For level="single" or level="multiple": * Only ancestors that are searched are * those that are descendants of the nearest ancestor that matches * the from pattern. * For level="any: * Only nodes after the first node before the * current node that match the from pattern are considered. * * @param v Value to set for "from" attribute. */ public void setFrom(XPath v) { m_fromMatchPattern = v; } /** * Get the "from" attribute. * For level="single" or level="multiple": * Only ancestors that are searched are * those that are descendants of the nearest ancestor that matches * the from pattern. * For level="any: * Only nodes after the first node before the * current node that match the from pattern are considered. * * @return Value of "from" attribute. */ public XPath getFrom() { return m_fromMatchPattern; } /** * When level="single", it goes up to the first node in the ancestor-or-self axis * that matches the count pattern, and constructs a list of length one containing * one plus the number of preceding siblings of that ancestor that match the count * pattern. If there is no such ancestor, it constructs an empty list. If the from * attribute is specified, then the only ancestors that are searched are those * that are descendants of the nearest ancestor that matches the from pattern. * Preceding siblings has the same meaning here as with the preceding-sibling axis. * * When level="multiple", it constructs a list of all ancestors of the current node * in document order followed by the element itself; it then selects from the list * those nodes that match the count pattern; it then maps each node in the list to * one plus the number of preceding siblings of that node that match the count pattern. * If the from attribute is specified, then the only ancestors that are searched are * those that are descendants of the nearest ancestor that matches the from pattern. * Preceding siblings has the same meaning here as with the preceding-sibling axis. * * When level="any", it constructs a list of length one containing the number of * nodes that match the count pattern and belong to the set containing the current * node and all nodes at any level of the document that are before the current node * in document order, excluding any namespace and attribute nodes (in other words * the union of the members of the preceding and ancestor-or-self axes). If the * from attribute is specified, then only nodes after the first node before the * current node that match the from pattern are considered. * @serial */ private int m_level = Constants.NUMBERLEVEL_SINGLE; /** * Set the "level" attribute. * The level attribute specifies what levels of the source tree should * be considered; it has the values single, multiple or any. The default * is single. * * @param v Value to set for "level" attribute. */ public void setLevel(int v) { m_level = v; } /** * Get the "level" attribute. * The level attribute specifies what levels of the source tree should * be considered; it has the values single, multiple or any. The default * is single. * * @return Value of "level" attribute. */ public int getLevel() { return m_level; } /** * The value attribute contains an expression. The expression is evaluated * and the resulting object is converted to a number as if by a call to the * number function. * @serial */ private XPath m_valueExpr = null; /** * Set the "value" attribute. * The value attribute contains an expression. The expression is evaluated * and the resulting object is converted to a number as if by a call to the * number function. * * @param v Value to set for "value" attribute. */ public void setValue(XPath v) { m_valueExpr = v; } /** * Get the "value" attribute. * The value attribute contains an expression. The expression is evaluated * and the resulting object is converted to a number as if by a call to the * number function. * * @return Value of "value" attribute. */ public XPath getValue() { return m_valueExpr; } /** * The "format" attribute is used to control conversion of a list of * numbers into a string. * @see convert in XSLT Specification * @serial */ private AVT m_format_avt = null; /** * Set the "format" attribute. * The "format" attribute is used to control conversion of a list of * numbers into a string. * @see convert in XSLT Specification * * @param v Value to set for "format" attribute. */ public void setFormat(AVT v) { m_format_avt = v; } /** * Get the "format" attribute. * The "format" attribute is used to control conversion of a list of * numbers into a string. * @see convert in XSLT Specification * * @return Value of "format" attribute. */ public AVT getFormat() { return m_format_avt; } /** * When numbering with an alphabetic sequence, the lang attribute * specifies which language's alphabet is to be used. * @serial */ private AVT m_lang_avt = null; /** * Set the "lang" attribute. * When numbering with an alphabetic sequence, the lang attribute * specifies which language's alphabet is to be used; it has the same * range of values as xml:lang [XML]; if no lang value is specified, * the language should be determined from the system environment. * Implementers should document for which languages they support numbering. * @see convert in XSLT Specification * * @param v Value to set for "lang" attribute. */ public void setLang(AVT v) { m_lang_avt = v; } /** * Get the "lang" attribute. * When numbering with an alphabetic sequence, the lang attribute * specifies which language's alphabet is to be used; it has the same * range of values as xml:lang [XML]; if no lang value is specified, * the language should be determined from the system environment. * Implementers should document for which languages they support numbering. * @see convert in XSLT Specification * * @return Value ofr "lang" attribute. */ public AVT getLang() { return m_lang_avt; } /** * The letter-value attribute disambiguates between numbering * sequences that use letters. * @serial */ private AVT m_lettervalue_avt = null; /** * Set the "letter-value" attribute. * The letter-value attribute disambiguates between numbering sequences * that use letters. * @see convert in XSLT Specification * * @param v Value to set for "letter-value" attribute. */ public void setLetterValue(AVT v) { m_lettervalue_avt = v; } /** * Get the "letter-value" attribute. * The letter-value attribute disambiguates between numbering sequences * that use letters. * @see convert in XSLT Specification * * @return Value to set for "letter-value" attribute. */ public AVT getLetterValue() { return m_lettervalue_avt; } /** * The grouping-separator attribute gives the separator * used as a grouping (e.g. thousands) separator in decimal * numbering sequences. * @serial */ private AVT m_groupingSeparator_avt = null; /** * Set the "grouping-separator" attribute. * The grouping-separator attribute gives the separator * used as a grouping (e.g. thousands) separator in decimal * numbering sequences. * @see convert in XSLT Specification * * @param v Value to set for "grouping-separator" attribute. */ public void setGroupingSeparator(AVT v) { m_groupingSeparator_avt = v; } /** * Get the "grouping-separator" attribute. * The grouping-separator attribute gives the separator * used as a grouping (e.g. thousands) separator in decimal * numbering sequences. * @see convert in XSLT Specification * * @return Value of "grouping-separator" attribute. */ public AVT getGroupingSeparator() { return m_groupingSeparator_avt; } /** * The optional grouping-size specifies the size (normally 3) of the grouping. * @serial */ private AVT m_groupingSize_avt = null; /** * Set the "grouping-size" attribute. * The optional grouping-size specifies the size (normally 3) of the grouping. * @see convert in XSLT Specification * * @param v Value to set for "grouping-size" attribute. */ public void setGroupingSize(AVT v) { m_groupingSize_avt = v; } /** * Get the "grouping-size" attribute. * The optional grouping-size specifies the size (normally 3) of the grouping. * @see convert in XSLT Specification * * @return Value of "grouping-size" attribute. */ public AVT getGroupingSize() { return m_groupingSize_avt; } /** * Shouldn't this be in the transformer? Big worries about threads... */ // private XResourceBundle thisBundle; /** * Table to help in converting decimals to roman numerals. * @see org.apache.xalan.transformer.DecimalToRoman */ private final static DecimalToRoman m_romanConvertTable[] = { new DecimalToRoman(1000, "M", 900, "CM"), new DecimalToRoman(500, "D", 400, "CD"), new DecimalToRoman(100L, "C", 90L, "XC"), new DecimalToRoman(50L, "L", 40L, "XL"), new DecimalToRoman(10L, "X", 9L, "IX"), new DecimalToRoman(5L, "V", 4L, "IV"), new DecimalToRoman(1L, "I", 1L, "I") }; /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if(null != m_countMatchPattern) m_countMatchPattern.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_format_avt) m_format_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_fromMatchPattern) m_fromMatchPattern.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_groupingSeparator_avt) m_groupingSeparator_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_groupingSize_avt) m_groupingSize_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_lang_avt) m_lang_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_lettervalue_avt) m_lettervalue_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_valueExpr) m_valueExpr.fixupVariables(vnames, cstate.getGlobalsSize()); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_NUMBER; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_NUMBER_STRING; } /** * Execute an xsl:number instruction. The xsl:number element is * used to insert a formatted number into the result tree. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); int sourceNode = transformer.getXPathContext().getCurrentNode(); String countString = getCountString(transformer, sourceNode); try { transformer.getResultTreeHandler().characters(countString.toCharArray(), 0, countString.length()); } catch(SAXException se) { throw new TransformerException(se); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } /** * Add a child to the child list. * * @param newChild Child to add to child list * * @return Child just added to child list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); return null; } /** * Given a 'from' pattern (ala xsl:number), a match pattern * and a context, find the first ancestor that matches the * pattern (including the context handed in). * * @param xctxt The XPath runtime state for this. * @param fromMatchPattern The ancestor must match this pattern. * @param countMatchPattern The ancestor must also match this pattern. * @param context The node that "." expresses. * @param namespaceContext The context in which namespaces in the * queries are supposed to be expanded. * * @return the first ancestor that matches the given pattern * * @throws javax.xml.transform.TransformerException */ int findAncestor( XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, int context, ElemNumber namespaceContext) throws javax.xml.transform.TransformerException { DTM dtm = xctxt.getDTM(context); while (DTM.NULL != context) { if (null != fromMatchPattern) { if (fromMatchPattern.getMatchScore(xctxt, context) != XPath.MATCH_SCORE_NONE) { //context = null; break; } } if (null != countMatchPattern) { if (countMatchPattern.getMatchScore(xctxt, context) != XPath.MATCH_SCORE_NONE) { break; } } context = dtm.getParent(context); } return context; } /** * Given a 'from' pattern (ala xsl:number), a match pattern * and a context, find the first ancestor that matches the * pattern (including the context handed in). * @param xctxt The XPath runtime state for this. * @param fromMatchPattern The ancestor must match this pattern. * @param countMatchPattern The ancestor must also match this pattern. * @param context The node that "." expresses. * @param namespaceContext The context in which namespaces in the * queries are supposed to be expanded. * * @return the first preceding, ancestor or self node that * matches the given pattern * * @throws javax.xml.transform.TransformerException */ private int findPrecedingOrAncestorOrSelf( XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, int context, ElemNumber namespaceContext) throws javax.xml.transform.TransformerException { DTM dtm = xctxt.getDTM(context); while (DTM.NULL != context) { if (null != fromMatchPattern) { if (fromMatchPattern.getMatchScore(xctxt, context) != XPath.MATCH_SCORE_NONE) { context = DTM.NULL; break; } } if (null != countMatchPattern) { if (countMatchPattern.getMatchScore(xctxt, context) != XPath.MATCH_SCORE_NONE) { break; } } int prevSibling = dtm.getPreviousSibling(context); if (DTM.NULL == prevSibling) { context = dtm.getParent(context); } else { // Now go down the chain of children of this sibling context = dtm.getLastChild(prevSibling); if (context == DTM.NULL) context = prevSibling; } } return context; } /** * Get the count match pattern, or a default value. * * @param support The XPath runtime state for this. * @param contextNode The node that "." expresses. * * @return the count match pattern, or a default value. * * @throws javax.xml.transform.TransformerException */ XPath getCountMatchPattern(XPathContext support, int contextNode) throws javax.xml.transform.TransformerException { XPath countMatchPattern = m_countMatchPattern; DTM dtm = support.getDTM(contextNode); if (null == countMatchPattern) { switch (dtm.getNodeType(contextNode)) { case DTM.ELEMENT_NODE : MyPrefixResolver resolver; if (dtm.getNamespaceURI(contextNode) == null) { resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, false); } else { resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, true); } countMatchPattern = new XPath(dtm.getNodeName(contextNode), this, resolver, XPath.MATCH, support.getErrorListener()); break; case DTM.ATTRIBUTE_NODE : // countMatchPattern = m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this); countMatchPattern = new XPath("@" + dtm.getNodeName(contextNode), this, this, XPath.MATCH, support.getErrorListener()); break; case DTM.CDATA_SECTION_NODE : case DTM.TEXT_NODE : // countMatchPattern = m_stylesheet.createMatchPattern("text()", this); countMatchPattern = new XPath("text()", this, this, XPath.MATCH, support.getErrorListener()); break; case DTM.COMMENT_NODE : // countMatchPattern = m_stylesheet.createMatchPattern("comment()", this); countMatchPattern = new XPath("comment()", this, this, XPath.MATCH, support.getErrorListener()); break; case DTM.DOCUMENT_NODE : // countMatchPattern = m_stylesheet.createMatchPattern("/", this); countMatchPattern = new XPath("/", this, this, XPath.MATCH, support.getErrorListener()); break; case DTM.PROCESSING_INSTRUCTION_NODE : // countMatchPattern = m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this); countMatchPattern = new XPath("pi(" + dtm.getNodeName(contextNode) + ")", this, this, XPath.MATCH, support.getErrorListener()); break; default : countMatchPattern = null; } } return countMatchPattern; } /** * Given an XML source node, get the count according to the * parameters set up by the xsl:number attributes. * @param transformer non-null reference to the the current transform-time state. * @param sourceNode The source node being counted. * * @return The count of nodes * * @throws TransformerException */ String getCountString(TransformerImpl transformer, int sourceNode) throws TransformerException { long[] list = null; XPathContext xctxt = transformer.getXPathContext(); CountersTable ctable = transformer.getCountersTable(); if (null != m_valueExpr) { XObject countObj = m_valueExpr.execute(xctxt, sourceNode, this); //According to Errata E24 double d_count = java.lang.Math.floor(countObj.num()+ 0.5); if (Double.isNaN(d_count)) return "NaN"; else if (d_count < 0 && Double.isInfinite(d_count)) return "-Infinity"; else if (Double.isInfinite(d_count)) return "Infinity"; else if (d_count == 0) return "0"; else{ long count = (long)d_count; list = new long[1]; list[0] = count; } } else { if (Constants.NUMBERLEVEL_ANY == m_level) { list = new long[1]; list[0] = ctable.countNode(xctxt, this, sourceNode); } else { NodeVector ancestors = getMatchingAncestors(xctxt, sourceNode, Constants.NUMBERLEVEL_SINGLE == m_level); int lastIndex = ancestors.size() - 1; if (lastIndex >= 0) { list = new long[lastIndex + 1]; for (int i = lastIndex; i >= 0; i--) { int target = ancestors.elementAt(i); list[lastIndex - i] = ctable.countNode(xctxt, this, target); } } } } return (null != list) ? formatNumberList(transformer, list, sourceNode) : ""; } /** * Get the previous node to be counted. * * @param xctxt The XPath runtime state for this. * @param pos The current node * * @return the previous node to be counted. * * @throws TransformerException */ public int getPreviousNode(XPathContext xctxt, int pos) throws TransformerException { XPath countMatchPattern = getCountMatchPattern(xctxt, pos); DTM dtm = xctxt.getDTM(pos); if (Constants.NUMBERLEVEL_ANY == m_level) { XPath fromMatchPattern = m_fromMatchPattern; // Do a backwards document-order walk 'till a node is found that matches // the 'from' pattern, or a node is found that matches the 'count' pattern, // or the top of the tree is found. while (DTM.NULL != pos) { // Get the previous sibling, if there is no previous sibling, // then count the parent, but if there is a previous sibling, // dive down to the lowest right-hand (last) child of that sibling. int next = dtm.getPreviousSibling(pos); if (DTM.NULL == next) { next = dtm.getParent(pos); if ((DTM.NULL != next) && ((((null != fromMatchPattern) && (fromMatchPattern.getMatchScore( xctxt, next) != XPath.MATCH_SCORE_NONE))) || (dtm.getNodeType(next) == DTM.DOCUMENT_NODE))) { pos = DTM.NULL; // return null from function. break; // from while loop } } else { // dive down to the lowest right child. int child = next; while (DTM.NULL != child) { child = dtm.getLastChild(next); if (DTM.NULL != child) next = child; } } pos = next; if ((DTM.NULL != pos) && ((null == countMatchPattern) || (countMatchPattern.getMatchScore(xctxt, pos) != XPath.MATCH_SCORE_NONE))) { break; } } } else // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE { while (DTM.NULL != pos) { pos = dtm.getPreviousSibling(pos); if ((DTM.NULL != pos) && ((null == countMatchPattern) || (countMatchPattern.getMatchScore(xctxt, pos) != XPath.MATCH_SCORE_NONE))) { break; } } } return pos; } /** * Get the target node that will be counted.. * * @param xctxt The XPath runtime state for this. * @param sourceNode non-null reference to the current source node. * * @return the target node that will be counted * * @throws TransformerException */ public int getTargetNode(XPathContext xctxt, int sourceNode) throws TransformerException { int target = DTM.NULL; XPath countMatchPattern = getCountMatchPattern(xctxt, sourceNode); if (Constants.NUMBERLEVEL_ANY == m_level) { target = findPrecedingOrAncestorOrSelf(xctxt, m_fromMatchPattern, countMatchPattern, sourceNode, this); } else { target = findAncestor(xctxt, m_fromMatchPattern, countMatchPattern, sourceNode, this); } return target; } /** * Get the ancestors, up to the root, that match the * pattern. * * @param xctxt The XPath runtime state for this. * @param node Count this node and it's ancestors. * @param stopAtFirstFound Flag indicating to stop after the * first node is found (difference between level = single * or multiple) * @return The number of ancestors that match the pattern. * * @throws javax.xml.transform.TransformerException */ NodeVector getMatchingAncestors( XPathContext xctxt, int node, boolean stopAtFirstFound) throws javax.xml.transform.TransformerException { NodeSetDTM ancestors = new NodeSetDTM(xctxt.getDTMManager()); XPath countMatchPattern = getCountMatchPattern(xctxt, node); DTM dtm = xctxt.getDTM(node); while (DTM.NULL != node) { if ((null != m_fromMatchPattern) && (m_fromMatchPattern.getMatchScore(xctxt, node) != XPath.MATCH_SCORE_NONE)) { // The following if statement gives level="single" different // behavior from level="multiple", which seems incorrect according // to the XSLT spec. For now we are leaving this in to replicate // the same behavior in XT, but, for all intents and purposes we // think this is a bug, or there is something about level="single" // that we still don't understand. if (!stopAtFirstFound) break; } if (null == countMatchPattern) System.out.println( "Programmers error! countMatchPattern should never be null!"); if (countMatchPattern.getMatchScore(xctxt, node) != XPath.MATCH_SCORE_NONE) { ancestors.addElement(node); if (stopAtFirstFound) break; } node = dtm.getParent(node); } return ancestors; } // end getMatchingAncestors method /** * Get the locale we should be using. * * @param transformer non-null reference to the the current transform-time state. * @param contextNode The node that "." expresses. * * @return The locale to use. May be specified by "lang" attribute, * but if not, use default locale on the system. * * @throws TransformerException */ Locale getLocale(TransformerImpl transformer, int contextNode) throws TransformerException { Locale locale = null; if (null != m_lang_avt) { XPathContext xctxt = transformer.getXPathContext(); String langValue = m_lang_avt.evaluate(xctxt, contextNode, this); if (null != langValue) { // Not really sure what to do about the country code, so I use the // default from the system. // TODO: fix xml:lang handling. locale = new Locale(langValue.toUpperCase(), ""); //Locale.getDefault().getDisplayCountry()); if (null == locale) { transformer.getMsgMgr().warn(this, null, xctxt.getDTM(contextNode).getNode(contextNode), XSLTErrorResources.WG_LOCALE_NOT_FOUND, new Object[]{ langValue }); //"Warning: Could not find locale for xml:lang="+langValue); locale = Locale.getDefault(); } } } else { locale = Locale.getDefault(); } return locale; } /** * Get the number formatter to be used the format the numbers * * @param transformer non-null reference to the the current transform-time state. * @param contextNode The node that "." expresses. * * ($objectName$) @return The number formatter to be used * * @throws TransformerException */ private DecimalFormat getNumberFormatter( TransformerImpl transformer, int contextNode) throws TransformerException { // Patch from Steven Serocki // Maybe we really want to do the clone in getLocale() and return // a clone of the default Locale?? Locale locale = (Locale)getLocale(transformer, contextNode).clone(); // Helper to format local specific numbers to strings. DecimalFormat formatter = null; //synchronized (locale) //{ // formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale); //} String digitGroupSepValue = (null != m_groupingSeparator_avt) ? m_groupingSeparator_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; // Validate grouping separator if an AVT was used; otherwise this was // validated statically in XSLTAttributeDef.java. if ((digitGroupSepValue != null) && (!m_groupingSeparator_avt.isSimple()) && (digitGroupSepValue.length() != 1)) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_NAME, m_groupingSeparator_avt.getName()}); } String nDigitsPerGroupValue = (null != m_groupingSize_avt) ? m_groupingSize_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; // TODO: Handle digit-group attributes if ((null != digitGroupSepValue) && (null != nDigitsPerGroupValue) && // Ignore if separation value is empty string (digitGroupSepValue.length() > 0)) { try { formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale); formatter.setGroupingSize( Integer.valueOf(nDigitsPerGroupValue).intValue()); DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); symbols.setGroupingSeparator(digitGroupSepValue.charAt(0)); formatter.setDecimalFormatSymbols(symbols); formatter.setGroupingUsed(true); } catch (NumberFormatException ex) { formatter.setGroupingUsed(false); } } return formatter; } /** * Format a vector of numbers into a formatted string. * * @param transformer non-null reference to the the current transform-time state. * @param list Array of one or more long integer numbers. * @param contextNode The node that "." expresses. * @return String that represents list according to * %conversion-atts; attributes. * TODO: Optimize formatNumberList so that it caches the last count and * reuses that info for the next count. * * @throws TransformerException */ String formatNumberList( TransformerImpl transformer, long[] list, int contextNode) throws TransformerException { String numStr; FastStringBuffer formattedNumber = StringBufferPool.get(); try { int nNumbers = list.length, numberWidth = 1; char numberType = '1'; String formatToken, lastSepString = null, formatTokenString = null; // If a seperator hasn't been specified, then use "." // as a default separator. // For instance: [2][1][5] with a format value of "1 " // should format to "2.1.5 " (I think). // Otherwise, use the seperator specified in the format string. // For instance: [2][1][5] with a format value of "01-001. " // should format to "02-001-005 ". String lastSep = "."; boolean isFirstToken = true; // true if first token String formatValue = (null != m_format_avt) ? m_format_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; if (null == formatValue) formatValue = "1"; NumberFormatStringTokenizer formatTokenizer = new NumberFormatStringTokenizer(formatValue); // int sepCount = 0; // keep track of seperators // Loop through all the numbers in the list. for (int i = 0; i < nNumbers; i++) { // Loop to the next digit, letter, or separator. if (formatTokenizer.hasMoreTokens()) { formatToken = formatTokenizer.nextToken(); // If the first character of this token is a character or digit, then // it is a number format directive. if (Character.isLetterOrDigit( formatToken.charAt(formatToken.length() - 1))) { numberWidth = formatToken.length(); numberType = formatToken.charAt(numberWidth - 1); } // If there is a number format directive ahead, // then append the formatToken. else if (formatTokenizer.isLetterOrDigitAhead()) { formatTokenString = formatToken; // Append the formatToken string... // For instance [2][1][5] with a format value of "1--1. " // should format to "2--1--5. " (I guess). while (formatTokenizer.nextIsSep()) { formatToken = formatTokenizer.nextToken(); formatTokenString += formatToken; } // Record this separator, so it can be used as the // next separator, if the next is the last. // For instance: [2][1][5] with a format value of "1-1 " // should format to "2-1-5 ". if (!isFirstToken) lastSep = formatTokenString; // Since we know the next is a number or digit, we get it now. formatToken = formatTokenizer.nextToken(); numberWidth = formatToken.length(); numberType = formatToken.charAt(numberWidth - 1); } else // only separators left { // Set up the string for the trailing characters after // the last number is formatted (i.e. after the loop). lastSepString = formatToken; // And append any remaining characters to the lastSepString. while (formatTokenizer.hasMoreTokens()) { formatToken = formatTokenizer.nextToken(); lastSepString += formatToken; } } // else } // end if(formatTokenizer.hasMoreTokens()) // if this is the first token and there was a prefix // append the prefix else, append the separator // For instance, [2][1][5] with a format value of "(1-1.) " // should format to "(2-1-5.) " (I guess). if (null != formatTokenString && isFirstToken) { formattedNumber.append(formatTokenString); } else if (null != lastSep &&!isFirstToken) formattedNumber.append(lastSep); getFormattedNumber(transformer, contextNode, numberType, numberWidth, list[i], formattedNumber); isFirstToken = false; // After the first pass, this should be false } // end for loop // Check to see if we finished up the format string... // Skip past all remaining letters or digits while (formatTokenizer.isLetterOrDigitAhead()) { formatTokenizer.nextToken(); } if (lastSepString != null) formattedNumber.append(lastSepString); while (formatTokenizer.hasMoreTokens()) { formatToken = formatTokenizer.nextToken(); formattedNumber.append(formatToken); } numStr = formattedNumber.toString(); } finally { StringBufferPool.free(formattedNumber); } return numStr; } // end formatNumberList method /* * Get Formatted number */ /** * Format the given number and store it in the given buffer * * * @param transformer non-null reference to the the current transform-time state. * @param contextNode The node that "." expresses. * @param numberType Type to format to * @param numberWidth Maximum length of formatted number * @param listElement Number to format * @param formattedNumber Buffer to store formatted number * * @throws javax.xml.transform.TransformerException */ private void getFormattedNumber( TransformerImpl transformer, int contextNode, char numberType, int numberWidth, long listElement, FastStringBuffer formattedNumber) throws javax.xml.transform.TransformerException { String letterVal = (m_lettervalue_avt != null) ? m_lettervalue_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; /** * Wrapper of Chars for converting integers into alpha counts. */ CharArrayWrapper alphaCountTable = null; XResourceBundle thisBundle = null; switch (numberType) { case 'A' : if (null == m_alphaCountTable){ thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, getLocale(transformer, contextNode)); m_alphaCountTable = (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET); } int2alphaCount(listElement, m_alphaCountTable, formattedNumber); break; case 'a' : if (null == m_alphaCountTable){ thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, getLocale(transformer, contextNode)); m_alphaCountTable = (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET); } FastStringBuffer stringBuf = StringBufferPool.get(); try { int2alphaCount(listElement, m_alphaCountTable, stringBuf); formattedNumber.append( stringBuf.toString().toLowerCase( getLocale(transformer, contextNode))); } finally { StringBufferPool.free(stringBuf); } break; case 'I' : formattedNumber.append(long2roman(listElement, true)); break; case 'i' : formattedNumber.append( long2roman(listElement, true).toLowerCase( getLocale(transformer, contextNode))); break; case 0x3042 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("ja", "JP", "HA")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) formattedNumber.append( int2singlealphaCount( listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET))); break; } case 0x3044 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("ja", "JP", "HI")); if ((letterVal != null) && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) formattedNumber.append( int2singlealphaCount( listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET))); break; } case 0x30A2 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("ja", "JP", "A")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) formattedNumber.append( int2singlealphaCount( listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET))); break; } case 0x30A4 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("ja", "JP", "I")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) formattedNumber.append( int2singlealphaCount( listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET))); break; } case 0x4E00 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("zh", "CN")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) { formattedNumber.append(tradAlphaCount(listElement, thisBundle)); } else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } case 0x58F9 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("zh", "TW")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } case 0x0E51 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("th", "")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } case 0x05D0 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("he", "")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } case 0x10D0 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("ka", "")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } case 0x03B1 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("el", "")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } case 0x0430 : { thisBundle = (XResourceBundle) XResourceBundle.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.LANG_BUNDLE_NAME, new Locale("cy", "")); if (letterVal != null && letterVal.equals(Constants.ATTRVAL_TRADITIONAL)) formattedNumber.append(tradAlphaCount(listElement, thisBundle)); else //if (m_lettervalue_avt != null && m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC)) int2alphaCount(listElement, (CharArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_ALPHABET), formattedNumber); break; } default : // "1" DecimalFormat formatter = getNumberFormatter(transformer, contextNode); String padString = formatter == null ? String.valueOf(0) : formatter.format(0); String numString = formatter == null ? String.valueOf(listElement) : formatter.format(listElement); int nPadding = numberWidth - numString.length(); for (int k = 0; k < nPadding; k++) { formattedNumber.append(padString); } formattedNumber.append(numString); } } /** * Get a string value for zero, which is not really defined by the 1.0 spec, * thought I think it might be cleared up by the erreta. */ String getZeroString() { return ""+0; } /** * Convert a long integer into alphabetic counting, in other words * count using the sequence A B C ... Z. * * @param val Value to convert -- must be greater than zero. * @param table a table containing one character for each digit in the radix * @return String representing alpha count of number. * @see TransformerImpl#DecimalToRoman * * Note that the radix of the conversion is inferred from the size * of the table. */ protected String int2singlealphaCount(long val, CharArrayWrapper table) { int radix = table.getLength(); // TODO: throw error on out of range input if (val > radix) { return getZeroString(); } else return (new Character(table.getChar((int)val - 1))).toString(); // index into table is off one, starts at 0 } /** * Convert a long integer into alphabetic counting, in other words * count using the sequence A B C ... Z AA AB AC.... etc. * * @param val Value to convert -- must be greater than zero. * @param table a table containing one character for each digit in the radix * @param aTable Array of alpha characters representing numbers * @param stringBuf Buffer where to save the string representing alpha count of number. * * @see TransformerImpl#DecimalToRoman * * Note that the radix of the conversion is inferred from the size * of the table. */ protected void int2alphaCount(long val, CharArrayWrapper aTable, FastStringBuffer stringBuf) { int radix = aTable.getLength(); char[] table = new char[radix]; // start table at 1, add last char at index 0. Reason explained above and below. int i; for (i = 0; i < radix - 1; i++) { table[i + 1] = aTable.getChar(i); } table[0] = aTable.getChar(i); // Create a buffer to hold the result // TODO: size of the table can be detereined by computing // logs of the radix. For now, we fake it. char buf[] = new char[100]; //some languages go left to right(ie. english), right to left (ie. Hebrew), //top to bottom (ie.Japanese), etc... Handle them differently //String orientation = thisBundle.getString(org.apache.xml.utils.res.XResourceBundle.LANG_ORIENTATION); // next character to set in the buffer int charPos; charPos = buf.length - 1; // work backward through buf[] // index in table of the last character that we stored int lookupIndex = 1; // start off with anything other than zero to make correction work // Correction number // // Correction can take on exactly two values: // // 0 if the next character is to be emitted is usual // // radix - 1 // if the next char to be emitted should be one less than // you would expect // // For example, consider radix 10, where 1="A" and 10="J" // // In this scheme, we count: A, B, C ... H, I, J (not A0 and certainly // not AJ), A1 // // So, how do we keep from emitting AJ for 10? After correctly emitting the // J, lookupIndex is zero. We now compute a correction number of 9 (radix-1). // In the following line, we'll compute (val+correction) % radix, which is, // (val+9)/10. By this time, val is 1, so we compute (1+9) % 10, which // is 10 % 10 or zero. So, we'll prepare to emit "JJ", but then we'll // later suppress the leading J as representing zero (in the mod system, // it can represent either 10 or zero). In summary, the correction value of // "radix-1" acts like "-1" when run through the mod operator, but with the // desireable characteristic that it never produces a negative number. long correction = 0; // TODO: throw error on out of range input do { // most of the correction calculation is explained above, the reason for the // term after the "|| " is that it correctly propagates carries across // multiple columns. correction = ((lookupIndex == 0) || (correction != 0 && lookupIndex == radix - 1)) ? (radix - 1) : 0; // index in "table" of the next char to emit lookupIndex = (int)(val + correction) % radix; // shift input by one "column" val = (val / radix); // if the next value we'd put out would be a leading zero, we're done. if (lookupIndex == 0 && val == 0) break; // put out the next character of output buf[charPos--] = table[lookupIndex]; // left to right or top to bottom } while (val > 0); stringBuf.append(buf, charPos + 1, (buf.length - charPos - 1)); } /** * Convert a long integer into traditional alphabetic counting, in other words * count using the traditional numbering. * * @param val Value to convert -- must be greater than zero. * @param thisBundle Resource bundle to use * * @return String representing alpha count of number. * @see XSLProcessor#DecimalToRoman * * Note that the radix of the conversion is inferred from the size * of the table. */ protected String tradAlphaCount(long val, XResourceBundle thisBundle) { // if this number is larger than the largest number we can represent, error! if (val > Long.MAX_VALUE) { this.error(XSLTErrorResources.ER_NUMBER_TOO_BIG); return XSLTErrorResources.ERROR_STRING; } char[] table = null; // index in table of the last character that we stored int lookupIndex = 1; // start off with anything other than zero to make correction work // Create a buffer to hold the result // TODO: size of the table can be detereined by computing // logs of the radix. For now, we fake it. char buf[] = new char[100]; //some languages go left to right(ie. english), right to left (ie. Hebrew), //top to bottom (ie.Japanese), etc... Handle them differently //String orientation = thisBundle.getString(org.apache.xml.utils.res.XResourceBundle.LANG_ORIENTATION); // next character to set in the buffer int charPos; charPos = 0; //start at 0 // array of number groups: ie.1000, 100, 10, 1 IntArrayWrapper groups = (IntArrayWrapper) thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_NUMBERGROUPS); // array of tables of hundreds, tens, digits... StringArrayWrapper tables = (StringArrayWrapper) (thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_NUM_TABLES)); //some languages have additive alphabetical notation, //some multiplicative-additive, etc... Handle them differently. String numbering = thisBundle.getString(org.apache.xml.utils.res.XResourceBundle.LANG_NUMBERING); // do multiplicative part first if (numbering.equals(org.apache.xml.utils.res.XResourceBundle.LANG_MULT_ADD)) { String mult_order = thisBundle.getString(org.apache.xml.utils.res.XResourceBundle.MULT_ORDER); LongArrayWrapper multiplier = (LongArrayWrapper) (thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_MULTIPLIER)); CharArrayWrapper zeroChar = (CharArrayWrapper) thisBundle.getObject("zero"); int i = 0; // skip to correct multiplier while (i < multiplier.getLength() && val < multiplier.getLong(i)) { i++; } do { if (i >= multiplier.getLength()) break; //number is smaller than multipliers // some languages (ie chinese) put a zero character (and only one) when // the multiplier is multiplied by zero. (ie, 1001 is 1X1000 + 0X100 + 0X10 + 1) // 0X100 is replaced by the zero character, we don't need one for 0X10 if (val < multiplier.getLong(i)) { if (zeroChar.getLength() == 0) { i++; } else { if (buf[charPos - 1] != zeroChar.getChar(0)) buf[charPos++] = zeroChar.getChar(0); i++; } } else if (val >= multiplier.getLong(i)) { long mult = val / multiplier.getLong(i); val = val % multiplier.getLong(i); // save this. int k = 0; while (k < groups.getLength()) { lookupIndex = 1; // initialize for each table if (mult / groups.getInt(k) <= 0) // look for right table k++; else { // get the table CharArrayWrapper THEletters = (CharArrayWrapper) thisBundle.getObject(tables.getString(k)); table = new char[THEletters.getLength() + 1]; int j; for (j = 0; j < THEletters.getLength(); j++) { table[j + 1] = THEletters.getChar(j); } table[0] = THEletters.getChar(j - 1); // don't need this // index in "table" of the next char to emit lookupIndex = (int)mult / groups.getInt(k); //this should not happen if (lookupIndex == 0 && mult == 0) break; char multiplierChar = ((CharArrayWrapper) (thisBundle.getObject( org.apache.xml.utils.res.XResourceBundle.LANG_MULTIPLIER_CHAR))).getChar(i); // put out the next character of output if (lookupIndex < table.length) { if (mult_order.equals(org.apache.xml.utils.res.XResourceBundle.MULT_PRECEDES)) { buf[charPos++] = multiplierChar; buf[charPos++] = table[lookupIndex]; } else { // don't put out 1 (ie 1X10 is just 10) if (lookupIndex == 1 && i == multiplier.getLength() - 1){} else buf[charPos++] = table[lookupIndex]; buf[charPos++] = multiplierChar; } break; // all done! } else return XSLTErrorResources.ERROR_STRING; } //end else } // end while i++; } // end else if } // end do while while (i < multiplier.getLength()); } // Now do additive part... int count = 0; String tableName; // do this for each table of hundreds, tens, digits... while (count < groups.getLength()) { if (val / groups.getInt(count) <= 0) // look for correct table count++; else { CharArrayWrapper theletters = (CharArrayWrapper) thisBundle.getObject(tables.getString(count)); table = new char[theletters.getLength() + 1]; int j; // need to start filling the table up at index 1 for (j = 0; j < theletters.getLength(); j++) { table[j + 1] = theletters.getChar(j); } table[0] = theletters.getChar(j - 1); // don't need this // index in "table" of the next char to emit lookupIndex = (int)val / groups.getInt(count); // shift input by one "column" val = val % groups.getInt(count); // this should not happen if (lookupIndex == 0 && val == 0) break; if (lookupIndex < table.length) { // put out the next character of output buf[charPos++] = table[lookupIndex]; // left to right or top to bottom } else return XSLTErrorResources.ERROR_STRING; count++; } } // end while // String s = new String(buf, 0, charPos); return new String(buf, 0, charPos); } /** * Convert a long integer into roman numerals. * @param val Value to convert. * @param prefixesAreOK true_ to enable prefix notation (e.g. 4 = "IV"), * false_ to disable prefix notation (e.g. 4 = "IIII"). * @return Roman numeral string. * @see DecimalToRoman * @see m_romanConvertTable */ protected String long2roman(long val, boolean prefixesAreOK) { if (val <= 0) { return getZeroString(); } String roman = ""; int place = 0; if (val <= 3999L) { do { while (val >= m_romanConvertTable[place].m_postValue) { roman += m_romanConvertTable[place].m_postLetter; val -= m_romanConvertTable[place].m_postValue; } if (prefixesAreOK) { if (val >= m_romanConvertTable[place].m_preValue) { roman += m_romanConvertTable[place].m_preLetter; val -= m_romanConvertTable[place].m_preValue; } } place++; } while (val > 0); } else { roman = XSLTErrorResources.ERROR_STRING; } return roman; } // end long2roman /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ public void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) { if(null != m_countMatchPattern) m_countMatchPattern.getExpression().callVisitors(m_countMatchPattern, visitor); if(null != m_fromMatchPattern) m_fromMatchPattern.getExpression().callVisitors(m_fromMatchPattern, visitor); if(null != m_valueExpr) m_valueExpr.getExpression().callVisitors(m_valueExpr, visitor); if(null != m_format_avt) m_format_avt.callVisitors(visitor); if(null != m_groupingSeparator_avt) m_groupingSeparator_avt.callVisitors(visitor); if(null != m_groupingSize_avt) m_groupingSize_avt.callVisitors(visitor); if(null != m_lang_avt) m_lang_avt.callVisitors(visitor); if(null != m_lettervalue_avt) m_lettervalue_avt.callVisitors(visitor); } super.callChildVisitors(visitor, callAttrs); } /** * This class returns tokens using non-alphanumberic * characters as delimiters. */ class NumberFormatStringTokenizer { /** Current position in the format string */ private int currentPosition; /** Index of last character in the format string */ private int maxPosition; /** Format string to be tokenized */ private String str; /** * Construct a NumberFormatStringTokenizer. * * @param str Format string to be tokenized */ public NumberFormatStringTokenizer(String str) { this.str = str; maxPosition = str.length(); } /** * Reset tokenizer so that nextToken() starts from the beginning. */ public void reset() { currentPosition = 0; } /** * Returns the next token from this string tokenizer. * * @return the next token from this string tokenizer. * @throws NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextToken() { if (currentPosition >= maxPosition) { throw new NoSuchElementException(); } int start = currentPosition; while ((currentPosition < maxPosition) && Character.isLetterOrDigit(str.charAt(currentPosition))) { currentPosition++; } if ((start == currentPosition) && (!Character.isLetterOrDigit(str.charAt(currentPosition)))) { currentPosition++; } return str.substring(start, currentPosition); } /** * Tells if there is a digit or a letter character ahead. * * @return true if there is a number or character ahead. */ public boolean isLetterOrDigitAhead() { int pos = currentPosition; while (pos < maxPosition) { if (Character.isLetterOrDigit(str.charAt(pos))) return true; pos++; } return false; } /** * Tells if there is a digit or a letter character ahead. * * @return true if there is a number or character ahead. */ public boolean nextIsSep() { if (Character.isLetterOrDigit(str.charAt(currentPosition))) return false; else return true; } /** * Tells if nextToken will throw an exception * if it is called. * * @return true if nextToken can be called * without throwing an exception. */ public boolean hasMoreTokens() { return (currentPosition >= maxPosition) ? false : true; } /** * Calculates the number of times that this tokenizer's * nextToken method can be called before it generates an * exception. * * @return the number of tokens remaining in the string using the current * delimiter set. * @see java.util.StringTokenizer#nextToken() */ public int countTokens() { int count = 0; int currpos = currentPosition; while (currpos < maxPosition) { int start = currpos; while ((currpos < maxPosition) && Character.isLetterOrDigit(str.charAt(currpos))) { currpos++; } if ((start == currpos) && (Character.isLetterOrDigit(str.charAt(currpos)) == false)) { currpos++; } count++; } return count; } } // end NumberFormatStringTokenizer } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemExtensionCall.java0000644000175000017500000002224210721374031025416 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemExtensionCall.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.extensions.ExtensionHandler; import org.apache.xalan.extensions.ExtensionsTable; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPathContext; import org.xml.sax.SAXException; /** * Implement an extension element. * @see extension-element in XSLT Specification * @xsl.usage advanced */ public class ElemExtensionCall extends ElemLiteralResult { static final long serialVersionUID = 3171339708500216920L; /** The Namespace URI for this extension call element. * @serial */ String m_extns; /** Language used by extension. * @serial */ String m_lang; /** URL pointing to extension. * @serial */ String m_srcURL; /** Source for script. * @serial */ String m_scriptSrc; /** Declaration for Extension element. * @serial */ ElemExtensionDecl m_decl = null; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * *@return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_EXTENSIONCALL; } /** * Return the node name. * * @return The element's name */ // public String getNodeName() // { // TODO: Need prefix. // return localPart; // } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); m_extns = this.getNamespace(); m_decl = getElemExtensionDecl(sroot, m_extns); // Register the extension namespace if the extension does not have // an ElemExtensionDecl ("component"). if (m_decl == null) sroot.getExtensionNamespacesManager().registerExtension(m_extns); } /** * Return the ElemExtensionDecl for this extension element * * * @param stylesheet Stylesheet root associated with this extension element * @param namespace Namespace associated with this extension element * * @return the ElemExtensionDecl for this extension element. */ private ElemExtensionDecl getElemExtensionDecl(StylesheetRoot stylesheet, String namespace) { ElemExtensionDecl decl = null; int n = stylesheet.getGlobalImportCount(); for (int i = 0; i < n; i++) { Stylesheet imported = stylesheet.getGlobalImport(i); for (ElemTemplateElement child = imported.getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { if (Constants.ELEMNAME_EXTENSIONDECL == child.getXSLToken()) { decl = (ElemExtensionDecl) child; String prefix = decl.getPrefix(); String declNamespace = child.getNamespaceForPrefix(prefix); if (namespace.equals(declNamespace)) { return decl; } } } } return null; } /** * Execute the fallbacks when an extension is not available. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ private void executeFallbacks( TransformerImpl transformer) throws TransformerException { for (ElemTemplateElement child = m_firstChild; child != null; child = child.m_nextSibling) { if (child.getXSLToken() == Constants.ELEMNAME_FALLBACK) { try { transformer.pushElemTemplateElement(child); ((ElemFallback) child).executeFallback(transformer); } finally { transformer.popElemTemplateElement(); } } } } /** * Return true if this extension element has a child element. * * @return true if this extension element has a child element. */ private boolean hasFallbackChildren() { for (ElemTemplateElement child = m_firstChild; child != null; child = child.m_nextSibling) { if (child.getXSLToken() == Constants.ELEMNAME_FALLBACK) return true; } return false; } /** * Execute an extension. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { if (transformer.getStylesheet().isSecureProcessing()) throw new TransformerException( XSLMessages.createMessage( XSLTErrorResources.ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, new Object[] {getRawName()})); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); try { transformer.getResultTreeHandler().flushPending(); ExtensionsTable etable = transformer.getExtensionsTable(); ExtensionHandler nsh = etable.get(m_extns); if (null == nsh) { if (hasFallbackChildren()) { executeFallbacks(transformer); } else { TransformerException te = new TransformerException(XSLMessages.createMessage( XSLTErrorResources.ER_CALL_TO_EXT_FAILED, new Object[]{getNodeName()})); transformer.getErrorListener().fatalError(te); } return; } try { nsh.processElement(this.getLocalName(), this, transformer, getStylesheet(), this); } catch (Exception e) { if (hasFallbackChildren()) executeFallbacks(transformer); else { if(e instanceof TransformerException) { TransformerException te = (TransformerException)e; if(null == te.getLocator()) te.setLocator(this); transformer.getErrorListener().fatalError(te); } else if (e instanceof RuntimeException) { transformer.getErrorListener().fatalError(new TransformerException(e)); } else { transformer.getErrorListener().warning(new TransformerException(e)); } } } } catch(TransformerException e) { transformer.getErrorListener().fatalError(e); } catch(SAXException se) { throw new TransformerException(se); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Return the value of the attribute interpreted as an Attribute * Value Template (in other words, you can use curly expressions * such as href="http://{website}". * * @param rawName Raw name of the attribute to get * @param sourceNode non-null reference to the current source node. * @param transformer non-null reference to the the current transform-time state. * * @return the value of the attribute * * @throws TransformerException */ public String getAttribute( String rawName, org.w3c.dom.Node sourceNode, TransformerImpl transformer) throws TransformerException { AVT avt = getLiteralResultAttribute(rawName); if ((null != avt) && avt.getRawName().equals(rawName)) { XPathContext xctxt = transformer.getXPathContext(); return avt.evaluate(xctxt, xctxt.getDTMHandleFromNode(sourceNode), this); } return null; } /** * Accept a visitor and call the appropriate method * for this class. * * @param visitor The visitor whose appropriate method will be called. * @return true if the children of the object should be visited. */ protected boolean accept(XSLTVisitor visitor) { return visitor.visitExtensionElement(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemValueOf.java0000644000175000017500000002470410721374031024214 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemValueOf.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.serializer.SerializationHandler; import org.apache.xpath.Expression; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.xml.sax.SAXException; /** * Implement xsl:value-of. *
         * 
         * 
         * 
        * @see value-of in XSLT Specification * @xsl.usage advanced */ public class ElemValueOf extends ElemTemplateElement { static final long serialVersionUID = 3490728458007586786L; /** * The select expression to be executed. * @serial */ private XPath m_selectExpression = null; /** * True if the pattern is a simple ".". * @serial */ private boolean m_isDot = false; /** * Set the "select" attribute. * The required select attribute is an expression; this expression * is evaluated and the resulting object is converted to a * string as if by a call to the string function. * * @param v The value to set for the "select" attribute. */ public void setSelect(XPath v) { if (null != v) { String s = v.getPatternString(); m_isDot = (null != s) && s.equals("."); } m_selectExpression = v; } /** * Get the "select" attribute. * The required select attribute is an expression; this expression * is evaluated and the resulting object is converted to a * string as if by a call to the string function. * * @return The value of the "select" attribute. */ public XPath getSelect() { return m_selectExpression; } /** * Tells if this element should disable escaping. * @serial */ private boolean m_disableOutputEscaping = false; /** * Set the "disable-output-escaping" attribute. * Normally, the xml output method escapes & and < (and * possibly other characters) when outputting text nodes. * This ensures that the output is well-formed XML. However, * it is sometimes convenient to be able to produce output * that is almost, but not quite well-formed XML; for * example, the output may include ill-formed sections * which are intended to be transformed into well-formed * XML by a subsequent non-XML aware process. For this reason, * XSLT provides a mechanism for disabling output escaping. * An xsl:value-of or xsl:text element may have a * disable-output-escaping attribute; the allowed values * are yes or no; the default is no; if the value is yes, * then a text node generated by instantiating the xsl:value-of * or xsl:text element should be output without any escaping. * @see disable-output-escaping in XSLT Specification * * @param v The value to set for the "disable-output-escaping" attribute. */ public void setDisableOutputEscaping(boolean v) { m_disableOutputEscaping = v; } /** * Get the "disable-output-escaping" attribute. * Normally, the xml output method escapes & and < (and * possibly other characters) when outputting text nodes. * This ensures that the output is well-formed XML. However, * it is sometimes convenient to be able to produce output * that is almost, but not quite well-formed XML; for * example, the output may include ill-formed sections * which are intended to be transformed into well-formed * XML by a subsequent non-XML aware process. For this reason, * XSLT provides a mechanism for disabling output escaping. * An xsl:value-of or xsl:text element may have a * disable-output-escaping attribute; the allowed values * are yes or no; the default is no; if the value is yes, * then a text node generated by instantiating the xsl:value-of * or xsl:text element should be output without any escaping. * @see disable-output-escaping in XSLT Specification * * @return The value of the "disable-output-escaping" attribute. */ public boolean getDisableOutputEscaping() { return m_disableOutputEscaping; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_VALUEOF; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. * * NEEDSDOC @param sroot * * @throws TransformerException */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if (null != m_selectExpression) m_selectExpression.fixupVariables( vnames, sroot.getComposeState().getGlobalsSize()); } /** * Return the node name. * * @return The node name */ public String getNodeName() { return Constants.ELEMNAME_VALUEOF_STRING; } /** * Execute the string expression and copy the text to the * result tree. * The required select attribute is an expression; this expression * is evaluated and the resulting object is converted to a string * as if by a call to the string function. The string specifies * the string-value of the created text node. If the string is * empty, no text node will be created. The created text node will * be merged with any adjacent text nodes. * @see value-of in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { XPathContext xctxt = transformer.getXPathContext(); SerializationHandler rth = transformer.getResultTreeHandler(); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); try { // Optimize for "." if (false && m_isDot && !transformer.getDebug()) { int child = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(child); xctxt.pushCurrentNode(child); if (m_disableOutputEscaping) rth.processingInstruction( javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); try { dtm.dispatchCharactersEvents(child, rth, false); } finally { if (m_disableOutputEscaping) rth.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); xctxt.popCurrentNode(); } } else { xctxt.pushNamespaceContext(this); int current = xctxt.getCurrentNode(); xctxt.pushCurrentNodeAndExpression(current, current); if (m_disableOutputEscaping) rth.processingInstruction( javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); try { Expression expr = m_selectExpression.getExpression(); if (transformer.getDebug()) { XObject obj = expr.execute(xctxt); transformer.getTraceManager().fireSelectedEvent(current, this, "select", m_selectExpression, obj); obj.dispatchCharactersEvents(rth); } else { expr.executeCharsToContentHandler(xctxt, rth); } } finally { if (m_disableOutputEscaping) rth.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); xctxt.popNamespaceContext(); xctxt.popCurrentNodeAndExpression(); } } } catch (SAXException se) { throw new TransformerException(se); } catch (RuntimeException re) { TransformerException te = new TransformerException(re); te.setLocator(this); throw te; } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } /** * Add a child to the child list. * * @param newChild Child to add to children list * * @return Child just added to children list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); return null; } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) m_selectExpression.getExpression().callVisitors(m_selectExpression, visitor); super.callChildVisitors(visitor, callAttrs); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/VarNameCollector.java0000644000175000017500000000446110721374032025247 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VarNameCollector.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Vector; import org.apache.xml.utils.QName; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.operations.Variable; /** * This class visits variable refs in an XPath and collects their QNames. */ public class VarNameCollector extends XPathVisitor { Vector m_refs = new Vector(); /** * Reset the list for a fresh visitation and collection. */ public void reset() { m_refs.removeAllElements(); //.clear(); } /** * Get the number of variable references that were collected. * @return the size of the list. */ public int getVarCount() { return m_refs.size(); } /** * Tell if the given qualified name occurs in * the list of qualified names collected. * * @param refName Must be a valid qualified name. * @return true if the list contains the qualified name. */ boolean doesOccur(QName refName) { return m_refs.contains(refName); } /** * Visit a variable reference. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param var The variable reference object. * @return true if the sub expressions should be traversed. */ public boolean visitVariableRef(ExpressionOwner owner, Variable var) { m_refs.addElement(var.getQName()); return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/Stylesheet.java0000644000175000017500000012101510721374030024171 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Stylesheet.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Hashtable; import java.util.Stack; import java.util.Vector; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.QName; import org.apache.xml.utils.StringVector; import org.apache.xml.utils.SystemIDResolver; /** * Represents a stylesheet element. *

        All properties in this class have a fixed form of bean-style property * accessors for all properties that represent XSL attributes or elements. * These properties have setter method names accessed generically by the * processor, and so these names must be fixed according to the system * defined in the getSetterMethodName * function.

        *

         * 
         *
         * 
         *
         * 
         * 
         *
         * 
         * 
         *
         * 

        * @see section-Stylesheet-Structure in XSLT Specification */ public class Stylesheet extends ElemTemplateElement implements java.io.Serializable /* , Document */ { static final long serialVersionUID = 2085337282743043776L; /** * Constructor for a Stylesheet. * @param parent The including or importing stylesheet. */ public Stylesheet(Stylesheet parent) { if (null != parent) { m_stylesheetParent = parent; m_stylesheetRoot = parent.getStylesheetRoot(); } } /** * Get the owning stylesheet. This looks up the * inheritance chain until it calls getStylesheet * on a Stylesheet object, which will return itself. * * @return The owning stylesheet, itself. */ public Stylesheet getStylesheet() { return this; } /** * Tell if this can be cast to a StylesheetComposed, meaning, you * can ask questions from getXXXComposed functions. * * @return False if this is not a StylesheetComposed */ public boolean isAggregatedType() { return false; } /** * Tell if this is the root of the stylesheet tree. * * @return False is this is not the root of the stylesheet tree. */ public boolean isRoot() { return false; } /** * Extension to be used when serializing to disk. */ public static final String STYLESHEET_EXT = ".lxc"; /** * Read the stylesheet from a serialization stream. * * @param stream Input stream to read from * * @throws IOException * @throws TransformerException */ private void readObject(ObjectInputStream stream) throws IOException, TransformerException { // System.out.println("Reading Stylesheet"); try { stream.defaultReadObject(); } catch (ClassNotFoundException cnfe) { throw new TransformerException(cnfe); } // System.out.println("Done reading Stylesheet"); } /** * Write out the given output stream * * * @param stream The output stream to write out * * @throws IOException */ private void writeObject(ObjectOutputStream stream) throws IOException { // System.out.println("Writing Stylesheet"); stream.defaultWriteObject(); // System.out.println("Done writing Stylesheet"); } //============== XSLT Properties ================= /** * The "xmlns:xsl" property. * @serial */ private String m_XmlnsXsl; /** * Set the "xmlns:xsl" property. * @see xslt-namespace in XSLT Specification * * @param v The value to be set for the "xmlns:xsl" property. */ public void setXmlnsXsl(String v) { m_XmlnsXsl = v; } /** * Get the "xmlns:xsl" property. * @see xslt-namespace in XSLT Specification * * @return The value of the "xmlns:xsl" property. */ public String getXmlnsXsl() { return m_XmlnsXsl; } /** * The "extension-element-prefixes" property, actually contains URIs. * @serial */ private StringVector m_ExtensionElementURIs; /** * Set the "extension-element-prefixes" property. * @see extension-element in XSLT Specification * * @param v The value to be set for the "extension-element-prefixes" * property: a vector of extension element URIs. */ public void setExtensionElementPrefixes(StringVector v) { m_ExtensionElementURIs = v; } /** * Get and "extension-element-prefix" property. * @see extension-element in XSLT Specification * * @param i Index of extension element URI in list * * @return The extension element URI at the given index * * @throws ArrayIndexOutOfBoundsException */ public String getExtensionElementPrefix(int i) throws ArrayIndexOutOfBoundsException { if (null == m_ExtensionElementURIs) throw new ArrayIndexOutOfBoundsException(); return m_ExtensionElementURIs.elementAt(i); } /** * Get the number of "extension-element-prefixes" Strings. * @see extension-element in XSLT Specification * * @return Number of URIs in the list */ public int getExtensionElementPrefixCount() { return (null != m_ExtensionElementURIs) ? m_ExtensionElementURIs.size() : 0; } /** * Find out if this contains a given "extension-element-prefix" property. * @see extension-element in XSLT Specification * * @param uri URI of extension element to look for * * @return True if the given URI was found in the list */ public boolean containsExtensionElementURI(String uri) { if (null == m_ExtensionElementURIs) return false; return m_ExtensionElementURIs.contains(uri); } /** * The "exclude-result-prefixes" property. * @serial */ private StringVector m_ExcludeResultPrefixs; /** * Set the "exclude-result-prefixes" property. * The designation of a namespace as an excluded namespace is * effective within the subtree of the stylesheet rooted at * the element bearing the exclude-result-prefixes or * xsl:exclude-result-prefixes attribute; a subtree rooted * at an xsl:stylesheet element does not include any stylesheets * imported or included by children of that xsl:stylesheet element. * @see literal-result-element in XSLT Specification * * @param v A StringVector of prefixes to exclude */ public void setExcludeResultPrefixes(StringVector v) { m_ExcludeResultPrefixs = v; } /** * Get an "exclude-result-prefix" property. * The designation of a namespace as an excluded namespace is * effective within the subtree of the stylesheet rooted at * the element bearing the exclude-result-prefixes or * xsl:exclude-result-prefixes attribute; a subtree rooted * at an xsl:stylesheet element does not include any stylesheets * imported or included by children of that xsl:stylesheet element. * @see literal-result-element in XSLT Specification * * @param i Index of prefix to get in list * * @return Prefix to be excluded at the given index * * @throws ArrayIndexOutOfBoundsException */ public String getExcludeResultPrefix(int i) throws ArrayIndexOutOfBoundsException { if (null == m_ExcludeResultPrefixs) throw new ArrayIndexOutOfBoundsException(); return m_ExcludeResultPrefixs.elementAt(i); } /** * Get the number of "exclude-result-prefixes" Strings. * @see literal-result-element in XSLT Specification * * @return The number of prefix strings to be excluded. */ public int getExcludeResultPrefixCount() { return (null != m_ExcludeResultPrefixs) ? m_ExcludeResultPrefixs.size() : 0; } /** * Get whether or not the passed prefix is contained flagged by * the "exclude-result-prefixes" property. * @see literal-result-element in XSLT Specification * * @param prefix non-null reference to prefix that might be excluded. * @param uri reference to namespace that prefix maps to * * @return true if the prefix should normally be excluded.> */ public boolean containsExcludeResultPrefix(String prefix, String uri) { if (null == m_ExcludeResultPrefixs || uri == null ) return false; // This loop is ok here because this code only runs during // stylesheet compile time. for (int i =0; i< m_ExcludeResultPrefixs.size(); i++) { if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i)))) return true; } return false; /* if (prefix.length() == 0) prefix = Constants.ATTRVAL_DEFAULT_PREFIX; return m_ExcludeResultPrefixs.contains(prefix); */ } /** * The "id" property. * @serial */ private String m_Id; /** * Set the "id" property. * @see section-Embedding-Stylesheets in XSLT Specification * * @param v Value for the "id" property. */ public void setId(String v) { m_Id = v; } /** * Get the "id" property. * @see section-Embedding-Stylesheets in XSLT Specification * * @return The value of the "id" property. */ public String getId() { return m_Id; } /** * The "version" property. * @serial */ private String m_Version; /** * Whether or not the stylesheet is in "Forward Compatibility Mode" * @serial */ private boolean m_isCompatibleMode = false; /** * Set the "version" property. * @see forwards in XSLT Specification * * @param v Value for the "version" property. */ public void setVersion(String v) { m_Version = v; m_isCompatibleMode = (Double.valueOf(v).doubleValue() > Constants.XSLTVERSUPPORTED); } /** * Get whether or not the stylesheet is in "Forward Compatibility Mode" * * @return true if in forward compatible mode, false otherwise */ public boolean getCompatibleMode() { return m_isCompatibleMode; } /** * Get the "version" property. * @see forwards in XSLT Specification * * @return The value of the "version" property. */ public String getVersion() { return m_Version; } /** * The "xsl:import" list. * @serial */ private Vector m_imports; /** * Add a stylesheet to the "import" list. * @see import in XSLT Specification * * @param v Stylesheet to add to the import list */ public void setImport(StylesheetComposed v) { if (null == m_imports) m_imports = new Vector(); // I'm going to insert the elements in backwards order, // so I can walk them 0 to n. m_imports.addElement(v); } /** * Get a stylesheet from the "import" list. * @see import in XSLT Specification * * @param i Index of the stylesheet to get * * @return The stylesheet at the given index * * @throws ArrayIndexOutOfBoundsException */ public StylesheetComposed getImport(int i) throws ArrayIndexOutOfBoundsException { if (null == m_imports) throw new ArrayIndexOutOfBoundsException(); return (StylesheetComposed) m_imports.elementAt(i); } /** * Get the number of imported stylesheets. * @see import in XSLT Specification * * @return the number of imported stylesheets. */ public int getImportCount() { return (null != m_imports) ? m_imports.size() : 0; } /** * The "xsl:include" properties. * @serial */ private Vector m_includes; /** * Add a stylesheet to the "include" list. * @see include in XSLT Specification * * @param v Stylesheet to add to the "include" list */ public void setInclude(Stylesheet v) { if (null == m_includes) m_includes = new Vector(); m_includes.addElement(v); } /** * Get the stylesheet at the given in index in "include" list * @see include in XSLT Specification * * @param i Index of stylesheet to get * * @return Stylesheet at the given index * * @throws ArrayIndexOutOfBoundsException */ public Stylesheet getInclude(int i) throws ArrayIndexOutOfBoundsException { if (null == m_includes) throw new ArrayIndexOutOfBoundsException(); return (Stylesheet) m_includes.elementAt(i); } /** * Get the number of included stylesheets. * @see import in XSLT Specification * * @return the number of included stylesheets. */ public int getIncludeCount() { return (null != m_includes) ? m_includes.size() : 0; } /** * Table of tables of element decimal-format. * @see DecimalFormatProperties * @serial */ Stack m_DecimalFormatDeclarations; /** * Process the xsl:decimal-format element. * * @param edf Decimal-format element to push into stack */ public void setDecimalFormat(DecimalFormatProperties edf) { if (null == m_DecimalFormatDeclarations) m_DecimalFormatDeclarations = new Stack(); // Elements are pushed in by order of importance // so that when recomposed, they get overiden properly. m_DecimalFormatDeclarations.push(edf); } /** * Get an "xsl:decimal-format" property. * * @see DecimalFormatProperties * @see format-number in XSLT Specification * * @param name The qualified name of the decimal format property. * @return null if not found, otherwise a DecimalFormatProperties * object, from which you can get a DecimalFormatSymbols object. */ public DecimalFormatProperties getDecimalFormat(QName name) { if (null == m_DecimalFormatDeclarations) return null; int n = getDecimalFormatCount(); for (int i = (n - 1); i >= 0; i++) { DecimalFormatProperties dfp = getDecimalFormat(i); if (dfp.getName().equals(name)) return dfp; } return null; } /** * Get an "xsl:decimal-format" property. * @see format-number in XSLT Specification * @see DecimalFormatProperties * * @param i Index of decimal-format property in stack * * @return The decimal-format property at the given index * * @throws ArrayIndexOutOfBoundsException */ public DecimalFormatProperties getDecimalFormat(int i) throws ArrayIndexOutOfBoundsException { if (null == m_DecimalFormatDeclarations) throw new ArrayIndexOutOfBoundsException(); return (DecimalFormatProperties) m_DecimalFormatDeclarations.elementAt(i); } /** * Get the number of xsl:decimal-format declarations. * @see DecimalFormatProperties * * @return the number of xsl:decimal-format declarations. */ public int getDecimalFormatCount() { return (null != m_DecimalFormatDeclarations) ? m_DecimalFormatDeclarations.size() : 0; } /** * The "xsl:strip-space" properties, * A lookup table of all space stripping elements. * @serial */ private Vector m_whitespaceStrippingElements; /** * Set the "xsl:strip-space" properties. * @see strip in XSLT Specification * * @param wsi WhiteSpaceInfo element to add to list */ public void setStripSpaces(WhiteSpaceInfo wsi) { if (null == m_whitespaceStrippingElements) { m_whitespaceStrippingElements = new Vector(); } m_whitespaceStrippingElements.addElement(wsi); } /** * Get an "xsl:strip-space" property. * @see strip in XSLT Specification * * @param i Index of WhiteSpaceInfo to get * * @return WhiteSpaceInfo at given index * * @throws ArrayIndexOutOfBoundsException */ public WhiteSpaceInfo getStripSpace(int i) throws ArrayIndexOutOfBoundsException { if (null == m_whitespaceStrippingElements) throw new ArrayIndexOutOfBoundsException(); return (WhiteSpaceInfo) m_whitespaceStrippingElements.elementAt(i); } /** * Get the number of "xsl:strip-space" properties. * @see strip in XSLT Specification * * @return the number of "xsl:strip-space" properties. */ public int getStripSpaceCount() { return (null != m_whitespaceStrippingElements) ? m_whitespaceStrippingElements.size() : 0; } /** * The "xsl:preserve-space" property, * A lookup table of all space preserving elements. * @serial */ private Vector m_whitespacePreservingElements; /** * Set the "xsl:preserve-space" property. * @see strip in XSLT Specification * * @param wsi WhiteSpaceInfo element to add to list */ public void setPreserveSpaces(WhiteSpaceInfo wsi) { if (null == m_whitespacePreservingElements) { m_whitespacePreservingElements = new Vector(); } m_whitespacePreservingElements.addElement(wsi); } /** * Get a "xsl:preserve-space" property. * @see strip in XSLT Specification * * @param i Index of WhiteSpaceInfo to get * * @return WhiteSpaceInfo at the given index * * @throws ArrayIndexOutOfBoundsException */ public WhiteSpaceInfo getPreserveSpace(int i) throws ArrayIndexOutOfBoundsException { if (null == m_whitespacePreservingElements) throw new ArrayIndexOutOfBoundsException(); return (WhiteSpaceInfo) m_whitespacePreservingElements.elementAt(i); } /** * Get the number of "xsl:preserve-space" properties. * @see strip in XSLT Specification * * @return the number of "xsl:preserve-space" properties. */ public int getPreserveSpaceCount() { return (null != m_whitespacePreservingElements) ? m_whitespacePreservingElements.size() : 0; } /** * The "xsl:output" properties. This is a vector of OutputProperties objects. * @serial */ private Vector m_output; /** * Set the "xsl:output" property. * @see output in XSLT Specification * * @param v non-null reference to the OutputProperties object to be * added to the collection. */ public void setOutput(OutputProperties v) { if (null == m_output) { m_output = new Vector(); } m_output.addElement(v); } /** * Get an "xsl:output" property. * @see output in XSLT Specification * * @param i Index of OutputFormatExtended to get * * @return non-null reference to an OutputProperties object. * * @throws ArrayIndexOutOfBoundsException */ public OutputProperties getOutput(int i) throws ArrayIndexOutOfBoundsException { if (null == m_output) throw new ArrayIndexOutOfBoundsException(); return (OutputProperties) m_output.elementAt(i); } /** * Get the number of "xsl:output" properties. * @see output in XSLT Specification * * @return The number of OutputProperties objects contained in this stylesheet. */ public int getOutputCount() { return (null != m_output) ? m_output.size() : 0; } /** * The "xsl:key" property. * @serial */ private Vector m_keyDeclarations; /** * Set the "xsl:key" property. * @see key in XSLT Specification * * @param v KeyDeclaration element to add to the list of key declarations */ public void setKey(KeyDeclaration v) { if (null == m_keyDeclarations) m_keyDeclarations = new Vector(); m_keyDeclarations.addElement(v); } /** * Get an "xsl:key" property. * @see key in XSLT Specification * * @param i Index of KeyDeclaration element to get * * @return KeyDeclaration element at given index in list * * @throws ArrayIndexOutOfBoundsException */ public KeyDeclaration getKey(int i) throws ArrayIndexOutOfBoundsException { if (null == m_keyDeclarations) throw new ArrayIndexOutOfBoundsException(); return (KeyDeclaration) m_keyDeclarations.elementAt(i); } /** * Get the number of "xsl:key" properties. * @see key in XSLT Specification * * @return the number of "xsl:key" properties. */ public int getKeyCount() { return (null != m_keyDeclarations) ? m_keyDeclarations.size() : 0; } /** * The "xsl:attribute-set" property. * @serial */ private Vector m_attributeSets; /** * Set the "xsl:attribute-set" property. * @see attribute-sets in XSLT Specification * * @param attrSet ElemAttributeSet to add to the list of attribute sets */ public void setAttributeSet(ElemAttributeSet attrSet) { if (null == m_attributeSets) { m_attributeSets = new Vector(); } m_attributeSets.addElement(attrSet); } /** * Get an "xsl:attribute-set" property. * @see attribute-sets in XSLT Specification * * @param i Index of ElemAttributeSet to get in list * * @return ElemAttributeSet at the given index * * @throws ArrayIndexOutOfBoundsException */ public ElemAttributeSet getAttributeSet(int i) throws ArrayIndexOutOfBoundsException { if (null == m_attributeSets) throw new ArrayIndexOutOfBoundsException(); return (ElemAttributeSet) m_attributeSets.elementAt(i); } /** * Get the number of "xsl:attribute-set" properties. * @see attribute-sets in XSLT Specification * * @return the number of "xsl:attribute-set" properties. */ public int getAttributeSetCount() { return (null != m_attributeSets) ? m_attributeSets.size() : 0; } /** * The "xsl:variable" and "xsl:param" properties. * @serial */ private Vector m_topLevelVariables; /** * Set the "xsl:variable" property. * @see top-level-variables in XSLT Specification * * @param v ElemVariable object to add to list of top level variables */ public void setVariable(ElemVariable v) { if (null == m_topLevelVariables) m_topLevelVariables = new Vector(); m_topLevelVariables.addElement(v); } /** * Get an "xsl:variable" or "xsl:param" property. * @see top-level-variables in XSLT Specification * * @param qname non-null reference to the qualified name of the variable. * * @return The ElemVariable with the given name in the list or null */ public ElemVariable getVariableOrParam(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = (ElemVariable) getVariableOrParam(i); if (var.getName().equals(qname)) return var; } } return null; } /** * Get an "xsl:variable" property. * @see top-level-variables in XSLT Specification * * @param qname Qualified name of the xsl:variable to get * * @return reference to the variable named by qname, or null if not found. */ public ElemVariable getVariable(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = getVariableOrParam(i); if((var.getXSLToken() == Constants.ELEMNAME_VARIABLE) && (var.getName().equals(qname))) return var; } } return null; } /** * Get an "xsl:variable" property. * @see top-level-variables in XSLT Specification * * @param i Index of variable to get in the list * * @return ElemVariable at the given index in the list * * @throws ArrayIndexOutOfBoundsException */ public ElemVariable getVariableOrParam(int i) throws ArrayIndexOutOfBoundsException { if (null == m_topLevelVariables) throw new ArrayIndexOutOfBoundsException(); return (ElemVariable) m_topLevelVariables.elementAt(i); } /** * Get the number of "xsl:variable" properties. * @see top-level-variables in XSLT Specification * * @return the number of "xsl:variable" properties. */ public int getVariableOrParamCount() { return (null != m_topLevelVariables) ? m_topLevelVariables.size() : 0; } /** * Set an "xsl:param" property. * @see top-level-variables in XSLT Specification * * @param v A non-null ElemParam reference. */ public void setParam(ElemParam v) { setVariable(v); } /** * Get an "xsl:param" property. * @see top-level-variables in XSLT Specification * * @param qname non-null reference to qualified name of the parameter. * * @return ElemParam with the given name in the list or null */ public ElemParam getParam(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = getVariableOrParam(i); if((var.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE) && (var.getName().equals(qname))) return (ElemParam)var; } } return null; } /** * The "xsl:template" properties. * @serial */ private Vector m_templates; /** * Set an "xsl:template" property. * @see section-Defining-Template-Rules in XSLT Specification * * @param v ElemTemplate to add to list of templates */ public void setTemplate(ElemTemplate v) { if (null == m_templates) m_templates = new Vector(); m_templates.addElement(v); v.setStylesheet(this); } /** * Get an "xsl:template" property. * @see section-Defining-Template-Rules in XSLT Specification * * @param i Index of ElemTemplate in the list to get * * @return ElemTemplate at the given index in the list * * @throws TransformerException */ public ElemTemplate getTemplate(int i) throws TransformerException { if (null == m_templates) throw new ArrayIndexOutOfBoundsException(); return (ElemTemplate) m_templates.elementAt(i); } /** * Get the number of "xsl:template" properties. * @see section-Defining-Template-Rules in XSLT Specification * * @return the number of "xsl:template" properties. */ public int getTemplateCount() { return (null != m_templates) ? m_templates.size() : 0; } /** * The "xsl:namespace-alias" properties. * @serial */ private Vector m_prefix_aliases; /** * Set the "xsl:namespace-alias" property. * @see literal-result-element in XSLT Specification * * @param na NamespaceAlias elemeent to add to the list */ public void setNamespaceAlias(NamespaceAlias na) { if (m_prefix_aliases == null) m_prefix_aliases = new Vector(); m_prefix_aliases.addElement(na); } /** * Get an "xsl:namespace-alias" property. * @see literal-result-element in XSLT Specification * * @param i Index of NamespaceAlias element to get from the list * * @return NamespaceAlias element at the given index in the list * * @throws ArrayIndexOutOfBoundsException */ public NamespaceAlias getNamespaceAlias(int i) throws ArrayIndexOutOfBoundsException { if (null == m_prefix_aliases) throw new ArrayIndexOutOfBoundsException(); return (NamespaceAlias) m_prefix_aliases.elementAt(i); } /** * Get the number of "xsl:namespace-alias" properties. * @see top-level-variables in XSLT Specification * * @return the number of "xsl:namespace-alias" properties. */ public int getNamespaceAliasCount() { return (null != m_prefix_aliases) ? m_prefix_aliases.size() : 0; } /** * The "non-xsl-top-level" properties. * @serial */ private Hashtable m_NonXslTopLevel; /** * Set found a non-xslt element. * @see stylesheet-element in XSLT Specification * * @param name Qualified name of the element * @param obj The element object */ public void setNonXslTopLevel(QName name, Object obj) { if (null == m_NonXslTopLevel) m_NonXslTopLevel = new Hashtable(); m_NonXslTopLevel.put(name, obj); } /** * Get a non-xslt element. * @see stylesheet-element in XSLT Specification * * @param name Qualified name of the element to get * * @return The object associate with the given name */ public Object getNonXslTopLevel(QName name) { return (null != m_NonXslTopLevel) ? m_NonXslTopLevel.get(name) : null; } // =========== End top-level XSLT properties =========== /** * The base URL of the XSL document. * @serial */ private String m_href = null; /** The doctype-public element. * @serial */ private String m_publicId; /** The doctype-system element. * @serial */ private String m_systemId; /** * Get the base identifier with which this stylesheet is associated. * * @return the base identifier with which this stylesheet is associated. */ public String getHref() { return m_href; } /** * Set the base identifier with which this stylesheet is associated. * * @param baseIdent the base identifier with which this stylesheet is associated. */ public void setHref(String baseIdent) { m_href = baseIdent; } /** * Set the location information for this element. * * @param locator SourceLocator object with location information */ public void setLocaterInfo(SourceLocator locator) { if (null != locator) { m_publicId = locator.getPublicId(); m_systemId = locator.getSystemId(); if (null != m_systemId) { try { m_href = SystemIDResolver.getAbsoluteURI(m_systemId, null); } catch (TransformerException se) { // Ignore this for right now } } super.setLocaterInfo(locator); } } /** * The root of the stylesheet, where all the tables common * to all stylesheets are kept. * @serial */ private StylesheetRoot m_stylesheetRoot; /** * Get the root of the stylesheet, where all the tables common * to all stylesheets are kept. * * @return the root of the stylesheet */ public StylesheetRoot getStylesheetRoot() { return m_stylesheetRoot; } /** * Set the root of the stylesheet, where all the tables common * to all stylesheets are kept. * * @param v the root of the stylesheet */ public void setStylesheetRoot(StylesheetRoot v) { m_stylesheetRoot = v; } /** * The parent of the stylesheet. This will be null if this * is the root stylesheet. * @serial */ private Stylesheet m_stylesheetParent; /** * Get the parent of the stylesheet. This will be null if this * is the root stylesheet. * * @return the parent of the stylesheet. */ public Stylesheet getStylesheetParent() { return m_stylesheetParent; } /** * Set the parent of the stylesheet. This should be null if this * is the root stylesheet. * * @param v the parent of the stylesheet. */ public void setStylesheetParent(Stylesheet v) { m_stylesheetParent = v; } /** * Get the owning aggregated stylesheet, or this * stylesheet if it is aggregated. * * @return the owning aggregated stylesheet or itself */ public StylesheetComposed getStylesheetComposed() { Stylesheet sheet = this; while (!sheet.isAggregatedType()) { sheet = sheet.getStylesheetParent(); } return (StylesheetComposed) sheet; } /** * Get the type of the node. We'll pretend we're a Document. * * @return the type of the node: document node. */ public short getNodeType() { return DTM.DOCUMENT_NODE; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_STYLESHEET; } /** * Return the node name. * * @return The node name */ public String getNodeName() { return Constants.ELEMNAME_STYLESHEET_STRING; } /** * Replace an "xsl:template" property. * This is a hook for CompilingStylesheetHandler, to allow * us to access a template, compile it, instantiate it, * and replace the original with the compiled instance. * ADDED 9/5/2000 to support compilation experiment * * @param v Compiled template to replace with * @param i Index of template to be replaced * * @throws TransformerException */ public void replaceTemplate(ElemTemplate v, int i) throws TransformerException { if (null == m_templates) throw new ArrayIndexOutOfBoundsException(); replaceChild(v, (ElemTemplateElement)m_templates.elementAt(i)); m_templates.setElementAt(v, i); v.setStylesheet(this); } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { int s = getImportCount(); for (int j = 0; j < s; j++) { getImport(j).callVisitors(visitor); } s = getIncludeCount(); for (int j = 0; j < s; j++) { getInclude(j).callVisitors(visitor); } s = getOutputCount(); for (int j = 0; j < s; j++) { visitor.visitTopLevelInstruction(getOutput(j)); } // Next, add in the attribute-set elements s = getAttributeSetCount(); for (int j = 0; j < s; j++) { ElemAttributeSet attrSet = getAttributeSet(j); if (visitor.visitTopLevelInstruction(attrSet)) { attrSet.callChildVisitors(visitor); } } // Now the decimal-formats s = getDecimalFormatCount(); for (int j = 0; j < s; j++) { visitor.visitTopLevelInstruction(getDecimalFormat(j)); } // Now the keys s = getKeyCount(); for (int j = 0; j < s; j++) { visitor.visitTopLevelInstruction(getKey(j)); } // And the namespace aliases s = getNamespaceAliasCount(); for (int j = 0; j < s; j++) { visitor.visitTopLevelInstruction(getNamespaceAlias(j)); } // Next comes the templates s = getTemplateCount(); for (int j = 0; j < s; j++) { try { ElemTemplate template = getTemplate(j); if (visitor.visitTopLevelInstruction(template)) { template.callChildVisitors(visitor); } } catch (TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } } // Then, the variables s = getVariableOrParamCount(); for (int j = 0; j < s; j++) { ElemVariable var = getVariableOrParam(j); if (visitor.visitTopLevelVariableOrParamDecl(var)) { var.callChildVisitors(visitor); } } // And lastly the whitespace preserving and stripping elements s = getStripSpaceCount(); for (int j = 0; j < s; j++) { visitor.visitTopLevelInstruction(getStripSpace(j)); } s = getPreserveSpaceCount(); for (int j = 0; j < s; j++) { visitor.visitTopLevelInstruction(getPreserveSpace(j)); } if(null != m_NonXslTopLevel) { java.util.Enumeration elements = m_NonXslTopLevel.elements(); while(elements.hasMoreElements()) { ElemTemplateElement elem = (ElemTemplateElement)elements.nextElement(); if (visitor.visitTopLevelInstruction(elem)) { elem.callChildVisitors(visitor); } } } } /** * Accept a visitor and call the appropriate method * for this class. * * @param visitor The visitor whose appropriate method will be called. * @return true if the children of the object should be visited. */ protected boolean accept(XSLTVisitor visitor) { return visitor.visitStylesheet(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/KeyDeclaration.java0000644000175000017500000001320410721374032024740 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyDeclaration.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; /** * Holds the attribute declarations for the xsl:keys element. * A stylesheet declares a set of keys for each document using * the xsl:key element. When this set of keys contains a member * with node x, name y and value z, we say that node x has a key * with name y and value z. * @see key in XSLT Specification * @xsl.usage internal */ public class KeyDeclaration extends ElemTemplateElement { static final long serialVersionUID = 7724030248631137918L; /** * Constructs a new element representing the xsl:key. The parameters * are needed to prioritize this key element as part of the recomposing * process. For this element, they are not automatically created * because the element is never added on to the stylesheet parent. */ public KeyDeclaration(Stylesheet parentNode, int docOrderNumber) { m_parentNode = parentNode; setUid(docOrderNumber); } /** * The "name" property. * @serial */ private QName m_name; /** * Set the "name" attribute. * The name attribute specifies the name of the key. The value * of the name attribute is a QName, which is expanded as * described in [2.4 Qualified Names]. * * @param name Value to set for the "name" attribute. */ public void setName(QName name) { m_name = name; } /** * Get the "name" attribute. * The name attribute specifies the name of the key. The value * of the name attribute is a QName, which is expanded as * described in [2.4 Qualified Names]. * * @return Value of the "name" attribute. */ public QName getName() { return m_name; } /** * Return the node name. * * @return the element's name */ public String getNodeName() { return Constants.ELEMNAME_KEY_STRING; } /** * The "match" attribute. * @serial */ private XPath m_matchPattern = null; /** * Set the "match" attribute. * The match attribute is a Pattern; an xsl:key element gives * information about the keys of any node that matches the * pattern specified in the match attribute. * @see patterns in XSLT Specification * * @param v Value to set for the "match" attribute. */ public void setMatch(XPath v) { m_matchPattern = v; } /** * Get the "match" attribute. * The match attribute is a Pattern; an xsl:key element gives * information about the keys of any node that matches the * pattern specified in the match attribute. * @see patterns in XSLT Specification * * @return Value of the "match" attribute. */ public XPath getMatch() { return m_matchPattern; } /** * The "use" attribute. * @serial */ private XPath m_use; /** * Set the "use" attribute. * The use attribute is an expression specifying the values * of the key; the expression is evaluated once for each node * that matches the pattern. * * @param v Value to set for the "use" attribute. */ public void setUse(XPath v) { m_use = v; } /** * Get the "use" attribute. * The use attribute is an expression specifying the values * of the key; the expression is evaluated once for each node * that matches the pattern. * * @return Value of the "use" attribute. */ public XPath getUse() { return m_use; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_KEY; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws javax.xml.transform.TransformerException { super.compose(sroot); java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if(null != m_matchPattern) m_matchPattern.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); if(null != m_use) m_use.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); } /** * This function is called during recomposition to * control how this element is composed. * @param root The root stylesheet for this transformation. */ public void recompose(StylesheetRoot root) { root.recomposeKeys(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemElement.java0000644000175000017500000002755010721374032024247 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemElement.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.QName; import org.apache.xml.utils.XML11Char; import org.apache.xpath.XPathContext; import org.xml.sax.SAXException; /** * Implement xsl:element *
         * 
         * 
         * 
        * @see XXX in XSLT Specification * @xsl.usage advanced */ public class ElemElement extends ElemUse { static final long serialVersionUID = -324619535592435183L; /** * The name attribute is interpreted as an attribute value template. * It is an error if the string that results from instantiating the * attribute value template is not a QName. * @serial */ protected AVT m_name_avt = null; /** * Set the "name" attribute. * The name attribute is interpreted as an attribute value template. * It is an error if the string that results from instantiating the * attribute value template is not a QName. * * @param v Name attribute to set for this element */ public void setName(AVT v) { m_name_avt = v; } /** * Get the "name" attribute. * The name attribute is interpreted as an attribute value template. * It is an error if the string that results from instantiating the * attribute value template is not a QName. * * @return Name attribute for this element */ public AVT getName() { return m_name_avt; } /** * If the namespace attribute is present, then it also is interpreted * as an attribute value template. The string that results from * instantiating the attribute value template should be a URI reference. * It is not an error if the string is not a syntactically legal URI reference. * @serial */ protected AVT m_namespace_avt = null; /** * Set the "namespace" attribute. * If the namespace attribute is present, then it also is interpreted * as an attribute value template. The string that results from * instantiating the attribute value template should be a URI reference. * It is not an error if the string is not a syntactically legal URI reference. * * @param v NameSpace attribute to set for this element */ public void setNamespace(AVT v) { m_namespace_avt = v; } /** * Get the "namespace" attribute. * If the namespace attribute is present, then it also is interpreted * as an attribute value template. The string that results from * instantiating the attribute value template should be a URI reference. * It is not an error if the string is not a syntactically legal URI reference. * * @return Namespace attribute for this element */ public AVT getNamespace() { return m_namespace_avt; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if(null != m_name_avt) m_name_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_namespace_avt) m_namespace_avt.fixupVariables(vnames, cstate.getGlobalsSize()); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_ELEMENT; } /** * Return the node name. * * @return This element's name */ public String getNodeName() { return Constants.ELEMNAME_ELEMENT_STRING; } /** * Resolve the namespace into a prefix. Meant to be * overidded by elemAttribute if this class is derived. * * @param rhandler The current result tree handler. * @param prefix The probable prefix if already known. * @param nodeNamespace The namespace. * * @return The prefix to be used. */ protected String resolvePrefix(SerializationHandler rhandler, String prefix, String nodeNamespace) throws TransformerException { // if (null != prefix && prefix.length() == 0) // { // String foundPrefix = rhandler.getPrefix(nodeNamespace); // // // System.out.println("nsPrefix: "+nsPrefix); // if (null == foundPrefix) // foundPrefix = ""; // } return prefix; } /** * Create an element in the result tree. * The xsl:element element allows an element to be created with a * computed name. The expanded-name of the element to be created * is specified by a required name attribute and an optional namespace * attribute. The content of the xsl:element element is a template * for the attributes and children of the created element. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); SerializationHandler rhandler = transformer.getSerializationHandler(); XPathContext xctxt = transformer.getXPathContext(); int sourceNode = xctxt.getCurrentNode(); String nodeName = m_name_avt == null ? null : m_name_avt.evaluate(xctxt, sourceNode, this); String prefix = null; String nodeNamespace = ""; // Only validate if an AVT was used. if ((nodeName != null) && (!m_name_avt.isSimple()) && (!XML11Char.isXML11ValidQName(nodeName))) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_NAME, nodeName }); nodeName = null; } else if (nodeName != null) { prefix = QName.getPrefixPart(nodeName); if (null != m_namespace_avt) { nodeNamespace = m_namespace_avt.evaluate(xctxt, sourceNode, this); if (null == nodeNamespace || (prefix != null && prefix.length()>0 && nodeNamespace.length()== 0) ) transformer.getMsgMgr().error( this, XSLTErrorResources.ER_NULL_URI_NAMESPACE); else { // Determine the actual prefix that we will use for this nodeNamespace prefix = resolvePrefix(rhandler, prefix, nodeNamespace); if (null == prefix) prefix = ""; if (prefix.length() > 0) nodeName = (prefix + ":" + QName.getLocalPart(nodeName)); else nodeName = QName.getLocalPart(nodeName); } } // No namespace attribute was supplied. Use the namespace declarations // currently in effect for the xsl:element element. else { try { // Maybe temporary, until I get this worked out. test: axes59 nodeNamespace = getNamespaceForPrefix(prefix); // If we get back a null nodeNamespace, that means that this prefix could // not be found in the table. This is okay only for a default namespace // that has never been declared. if ( (null == nodeNamespace) && (prefix.length() == 0) ) nodeNamespace = ""; else if (null == nodeNamespace) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX, new Object[]{ prefix }); nodeName = null; } } catch (Exception ex) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX, new Object[]{ prefix }); nodeName = null; } } } constructNode(nodeName, prefix, nodeNamespace, transformer); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Construct a node in the result tree. This method is overloaded by * xsl:attribute. At this class level, this method creates an element. * If the node is null, we instantiate only the content of the node in accordance * with section 7.1.2 of the XSLT 1.0 Recommendation. * * @param nodeName The name of the node, which may be null. If null, * only the non-attribute children of this node will be processed. * @param prefix The prefix for the namespace, which may be null. * If not null, this prefix will be mapped and unmapped. * @param nodeNamespace The namespace of the node, which may be not be null. * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ void constructNode( String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer) throws TransformerException { boolean shouldAddAttrs; try { SerializationHandler rhandler = transformer.getResultTreeHandler(); if (null == nodeName) { shouldAddAttrs = false; } else { if (null != prefix) { rhandler.startPrefixMapping(prefix, nodeNamespace, true); } rhandler.startElement(nodeNamespace, QName.getLocalPart(nodeName), nodeName); super.execute(transformer); shouldAddAttrs = true; } transformer.executeChildTemplates(this, shouldAddAttrs); // Now end the element if name was valid if (null != nodeName) { rhandler.endElement(nodeNamespace, QName.getLocalPart(nodeName), nodeName); if (null != prefix) { rhandler.endPrefixMapping(prefix); } } } catch (SAXException se) { throw new TransformerException(se); } } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) { if(null != m_name_avt) m_name_avt.callVisitors(visitor); if(null != m_namespace_avt) m_namespace_avt.callVisitors(visitor); } super.callChildVisitors(visitor, callAttrs); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemFallback.java0000644000175000017500000000712210721374031024345 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemFallback.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; /** * Implement xsl:fallback. *
         * 
         * 
         * 
        * @see fallback in XSLT Specification * @xsl.usage advanced */ public class ElemFallback extends ElemTemplateElement { static final long serialVersionUID = 1782962139867340703L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_FALLBACK; } /** * Return the node name. * * @return The Element's name */ public String getNodeName() { return Constants.ELEMNAME_FALLBACK_STRING; } /** * This is the normal call when xsl:fallback is instantiated. * In accordance with the XSLT 1.0 Recommendation, chapter 15, * "Normally, instantiating an xsl:fallback element does nothing." * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { } /** * Execute the fallback elements. This must be explicitly called to * instantiate the content of an xsl:fallback element. * When an XSLT transformer performs fallback for an instruction * element, if the instruction element has one or more xsl:fallback * children, then the content of each of the xsl:fallback children * must be instantiated in sequence; otherwise, an error must * be signaled. The content of an xsl:fallback element is a template. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void executeFallback( TransformerImpl transformer) throws TransformerException { int parentElemType = m_parentNode.getXSLToken(); if (Constants.ELEMNAME_EXTENSIONCALL == parentElemType || Constants.ELEMNAME_UNDEFINED == parentElemType) { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); transformer.executeChildTemplates(this, true); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } else { // Should never happen System.out.println( "Error! parent of xsl:fallback must be an extension or unknown element!"); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemAttribute.java0000644000175000017500000002171510721374033024617 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemAttribute.java 469304 2006-10-30 22:29:47Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.serializer.NamespaceMappings; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.QName; import org.apache.xml.utils.XML11Char; import org.xml.sax.SAXException; /** * Implement xsl:attribute. *
         * &!ELEMENT xsl:attribute %char-template;>
         * &!ATTLIST xsl:attribute
         *   name %avt; #REQUIRED
         *   namespace %avt; #IMPLIED
         *   %space-att;
         * &
         * 
        * @see creating-attributes in XSLT Specification * @xsl.usage advanced */ public class ElemAttribute extends ElemElement { static final long serialVersionUID = 8817220961566919187L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_ATTRIBUTE; } /** * Return the node name. * * @return The element name */ public String getNodeName() { return Constants.ELEMNAME_ATTRIBUTE_STRING; } /** * Create an attribute in the result tree. * @see creating-attributes in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ // public void execute( // TransformerImpl transformer) // throws TransformerException // { //SerializationHandler rhandler = transformer.getSerializationHandler(); // If they are trying to add an attribute when there isn't an // element pending, it is an error. // I don't think we need this check here because it is checked in // ResultTreeHandler.addAttribute. (is) // if (!rhandler.isElementPending()) // { // // Make sure the trace event is sent. // if (TransformerImpl.S_DEBUG) // transformer.getTraceManager().fireTraceEvent(this); // // XPathContext xctxt = transformer.getXPathContext(); // int sourceNode = xctxt.getCurrentNode(); // String attrName = m_name_avt.evaluate(xctxt, sourceNode, this); // transformer.getMsgMgr().warn(this, // XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_POSITION, // new Object[]{ attrName }); // // if (TransformerImpl.S_DEBUG) // transformer.getTraceManager().fireTraceEndEvent(this); // return; // // // warn(templateChild, sourceNode, "Trying to add attribute after element child has been added, ignoring..."); // } // super.execute(transformer); // } /** * Resolve the namespace into a prefix. At this level, if no prefix exists, * then return a manufactured prefix. * * @param rhandler The current result tree handler. * @param prefix The probable prefix if already known. * @param nodeNamespace The namespace, which should not be null. * * @return The prefix to be used. */ protected String resolvePrefix(SerializationHandler rhandler, String prefix, String nodeNamespace) throws TransformerException { if (null != prefix && (prefix.length() == 0 || prefix.equals("xmlns"))) { // Since we can't use default namespace, in this case we try and // see if a prefix has already been defined or this namespace. prefix = rhandler.getPrefix(nodeNamespace); // System.out.println("nsPrefix: "+nsPrefix); if (null == prefix || prefix.length() == 0 || prefix.equals("xmlns")) { if(nodeNamespace.length() > 0) { NamespaceMappings prefixMapping = rhandler.getNamespaceMappings(); prefix = prefixMapping.generateNextPrefix(); } else prefix = ""; } } return prefix; } /** * Validate that the node name is good. * * @param nodeName Name of the node being constructed, which may be null. * * @return true if the node name is valid, false otherwise. */ protected boolean validateNodeName(String nodeName) { if(null == nodeName) return false; if(nodeName.equals("xmlns")) return false; return XML11Char.isXML11ValidQName(nodeName); } /** * Construct a node in the result tree. This method is overloaded by * xsl:attribute. At this class level, this method creates an element. * * @param nodeName The name of the node, which may be null. * @param prefix The prefix for the namespace, which may be null. * @param nodeNamespace The namespace of the node, which may be null. * @param transformer non-null reference to the the current transform-time state. * @param sourceNode non-null reference to the current source node. * @param mode reference, which may be null, to the current mode. * * @throws TransformerException */ void constructNode( String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer) throws TransformerException { if(null != nodeName && nodeName.length() > 0) { SerializationHandler rhandler = transformer.getSerializationHandler(); // Evaluate the value of this attribute String val = transformer.transformToString(this); try { // Let the result tree handler add the attribute and its String value. String localName = QName.getLocalPart(nodeName); if(prefix != null && prefix.length() > 0){ rhandler.addAttribute(nodeNamespace, localName, nodeName, "CDATA", val, true); }else{ rhandler.addAttribute("", localName, nodeName, "CDATA", val, true); } } catch (SAXException e) { } } } /** * Add a child to the child list. * * * * @param newChild Child to append to the list of this node's children * * @return The node we just appended to the children list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { // char-instructions case Constants.ELEMNAME_TEXTLITERALRESULT : case Constants.ELEMNAME_APPLY_TEMPLATES : case Constants.ELEMNAME_APPLY_IMPORTS : case Constants.ELEMNAME_CALLTEMPLATE : case Constants.ELEMNAME_FOREACH : case Constants.ELEMNAME_VALUEOF : case Constants.ELEMNAME_COPY_OF : case Constants.ELEMNAME_NUMBER : case Constants.ELEMNAME_CHOOSE : case Constants.ELEMNAME_IF : case Constants.ELEMNAME_TEXT : case Constants.ELEMNAME_COPY : case Constants.ELEMNAME_VARIABLE : case Constants.ELEMNAME_MESSAGE : // instructions // case Constants.ELEMNAME_PI: // case Constants.ELEMNAME_COMMENT: // case Constants.ELEMNAME_ELEMENT: // case Constants.ELEMNAME_ATTRIBUTE: break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } /** * @see ElemElement#setName(AVT) */ public void setName(AVT v) { if (v.isSimple()) { if (v.getSimpleString().equals("xmlns")) { throw new IllegalArgumentException(); } } super.setName(v); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/Constants.java0000644000175000017500000004471510721374032024031 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Constants.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * Primary constants used in the TransformerImpl classes. * @xsl.usage advanced */ public class Constants extends org.apache.xml.utils.Constants { /** * IDs for XSL element types. These are associated * with the string literals in the TransformerImpl class. * Don't change the numbers. NOTE THAT THESE ARE NOT IN * ALPHABETICAL ORDER! * (It's a pity Java doesn't have a real Enumerated Mnemonic * datatype... or a C-like preprocessor in lieu thereof which * could be used to generate and maintain synch between these lists.) */ public static final int ELEMNAME_UNDEFINED = -1, ELEMNAME_WITHPARAM = 2, ELEMNAME_ADDATTRIBUTE = 4, ELEMNAME_ANCHOR = 22, // ELEMNAME_ANCHOR_PATTERN = 23, ELEMNAME_APPLY_TEMPLATES = 50, ELEMNAME_USE = 34, ELEMNAME_CHILDREN = 6, ELEMNAME_CHOOSE = 37, ELEMNAME_COMMENT = 59, // my own ELEMNAME_CONSTRUCT = 7, // my own ELEMNAME_CONTENTS = 8, ELEMNAME_COPY = 9, ELEMNAME_COPY_OF = 74, ELEMNAME_DECIMALFORMAT = 83, ELEMNAME_DEFINEATTRIBUTESET = 40, // ELEMNAME_DEFINECONSTANT = 29, // ELEMNAME_DEFINEMACRO = 10, ELEMNAME_DEFINESCRIPT = 11, ELEMNAME_DISPLAYIF = 12, // my own ELEMNAME_EMPTY = 14, ELEMNAME_EVAL = 15, ELEMNAME_EXPECTEDCHILDREN = 16, ELEMNAME_EXTENSION = 54, ELEMNAME_EXTENSIONHANDLER = 63, ELEMNAME_FOREACH = 28, ELEMNAME_KEY = 31, ELEMNAME_IF = 36, ELEMNAME_IMPORT = 26, ELEMNAME_INCLUDE = 27, ELEMNAME_CALLTEMPLATE = 17, ELEMNAME_PARAMVARIABLE = 41, ELEMNAME_NUMBER = 35, ELEMNAME_NSALIAS = 84, ELEMNAME_OTHERWISE = 39, ELEMNAME_PI = 58, ELEMNAME_PRESERVESPACE = 33, ELEMNAME_REMOVEATTRIBUTE = 5, ELEMNAME_TEMPLATE = 19, ELEMNAME_SORT = 64, ELEMNAME_STRIPSPACE = 32, ELEMNAME_STYLESHEET = 25, ELEMNAME_TEXT = 42, ELEMNAME_VALUEOF = 30, ELEMNAME_WHEN = 38, // Pattern by example support ELEMNAME_ROOT = 44, ELEMNAME_ANY = 45, ELEMNAME_ELEMENT = 46, ELEMNAME_TARGETELEMENT = 47, ELEMNAME_ATTRIBUTE = 48, ELEMNAME_TARGETATTRIBUTE = 49, ELEMNAME_URL = 52, // my own ELEMNAME_CALL = 55, // my own // ELEMNAME_WITHPARAM = 56, ELEMNAME_FALLBACK = 57, // my own ELEMNAME_TARGETPI = 60, // my own ELEMNAME_TARGETCOMMENT = 61, // my own ELEMNAME_TARGETTEXT = 62, // my own ELEMNAME_CSSSTYLECONVERSION = 65, // my own ELEMNAME_COUNTER = 66, ELEMNAME_COUNTERS = 67, ELEMNAME_COUNTERINCREMENT = 68, ELEMNAME_COUNTERRESET = 69, ELEMNAME_COUNTERSCOPE = 71, ELEMNAME_APPLY_IMPORTS = 72, ELEMNAME_VARIABLE = 73, ELEMNAME_MESSAGE = 75, ELEMNAME_LOCALE = 76, ELEMNAME_LITERALRESULT = 77, ELEMNAME_TEXTLITERALRESULT = 78, ELEMNAME_EXTENSIONCALL = 79, ELEMNAME_EXTENSIONDECL = 85, ELEMNAME_EXTENSIONSCRIPT = 86, ELEMNAME_OUTPUT = 80, ELEMNAME_COMPONENT = 81, ELEMNAME_SCRIPT = 82; // Next free number: 90 (88 and 89 used for EXSLT elements); /** * Literals for XSL element names. Note that there are more * names than IDs, because some names map to the same ID. */ public static final String ELEMNAME_ANCHOR_STRING = "anchor", ELEMNAME_ANY_STRING = "any", // pattern-by-example support ELEMNAME_APPLY_IMPORTS_STRING = "apply-imports", ELEMNAME_APPLY_TEMPLATES_STRING = "apply-templates", ELEMNAME_ARG_STRING = "arg", ELEMNAME_ATTRIBUTESET_STRING = "attribute-set", ELEMNAME_ATTRIBUTE_STRING = "attribute", // pattern-by-example support ELEMNAME_CALLTEMPLATEARG_STRING = "invoke-arg", ELEMNAME_CALLTEMPLATE_STRING = "call-template", ELEMNAME_CALL_STRING = "call", ELEMNAME_CHILDREN_STRING = "children", ELEMNAME_CHOOSE_STRING = "choose", ELEMNAME_COMMENT_STRING = "comment", ELEMNAME_COMPONENT_STRING = "component", ELEMNAME_CONSTRUCT_STRING = "construct", // my own ELEMNAME_CONTENTS_STRING = "contents", ELEMNAME_COPY_OF_STRING ="copy-of", ELEMNAME_COPY_STRING = "copy", ELEMNAME_COUNTERINCREMENT_STRING = "counter-increment", ELEMNAME_COUNTERRESET_STRING = "counter-reset", ELEMNAME_COUNTERSCOPE_STRING = "counter-scope", ELEMNAME_COUNTERS_STRING = "counters", ELEMNAME_COUNTER_STRING = "counter", ELEMNAME_CSSSTYLECONVERSION_STRING = "css-style-conversion", ELEMNAME_DECIMALFORMAT_STRING = "decimal-format", ELEMNAME_DISPLAYIF_STRING = "display-if", // my own ELEMNAME_ELEMENT_STRING = "element", // pattern-by-example support ELEMNAME_EMPTY_STRING = "empty", ELEMNAME_EVAL_STRING = "eval", ELEMNAME_EXPECTEDCHILDREN_STRING = "expectedchildren", ELEMNAME_EXTENSIONHANDLER_STRING = "code-dispatcher", ELEMNAME_EXTENSION_STRING = "functions", ELEMNAME_FALLBACK_STRING = "fallback", ELEMNAME_FOREACH_STRING = "for-each", ELEMNAME_IF_STRING = "if", ELEMNAME_IMPORT_STRING = "import", ELEMNAME_INCLUDE_STRING = "include", ELEMNAME_KEY_STRING = "key", ELEMNAME_LOCALE_STRING = "locale", ELEMNAME_MESSAGE_STRING = "message", ELEMNAME_NSALIAS_STRING = "namespace-alias", ELEMNAME_NUMBER_STRING = "number", ELEMNAME_OTHERWISE_STRING = "otherwise", ELEMNAME_OUTPUT_STRING = "output", ELEMNAME_PARAMVARIABLE_STRING = "param", ELEMNAME_PI_OLD_STRING = "pi", ELEMNAME_PI_STRING = "processing-instruction", ELEMNAME_PRESERVESPACE_STRING = "preserve-space", ELEMNAME_ROOT_STRING = "root", // pattern-by-example support ELEMNAME_SCRIPT_STRING = "script", ELEMNAME_SORT_STRING = "sort", ELEMNAME_STRIPSPACE_STRING = "strip-space", ELEMNAME_STYLESHEET_STRING = "stylesheet", ELEMNAME_TARGETATTRIBUTE_STRING = "target-attribute", // pattern-by-example support ELEMNAME_TARGETCOMMENT_STRING = "target-comment", ELEMNAME_TARGETELEMENT_STRING = "target-element", // pattern-by-example support ELEMNAME_TARGETPI_STRING = "target-pi", ELEMNAME_TARGETTEXT_STRING = "target-text", ELEMNAME_TEMPLATE_STRING = "template", ELEMNAME_TEXT_STRING = "text", ELEMNAME_TRANSFORM_STRING = "transform", ELEMNAME_URL_STRING = "uri", // pattern-by-example support ELEMNAME_USE_STRING = "use", ELEMNAME_VALUEOF_STRING = "value-of", ELEMNAME_VARIABLE_STRING = "variable", ELEMNAME_WHEN_STRING = "when", ELEMNAME_WITHPARAM_STRING = "with-param"; /** * Literals for EXSLT function elements. */ public static final String EXSLT_ELEMNAME_FUNCTION_STRING = "function", EXSLT_ELEMNAME_FUNCRESULT_STRING = "result"; public static final int EXSLT_ELEMNAME_FUNCTION = 88, EXSLT_ELEMNAME_FUNCRESULT = 89; /** * Literals for XSL attribute names. Note that there may be more * names than IDs, because some names may map to the same ID. */ public static final String ATTRNAME_AMOUNT = "amount", ATTRNAME_ANCESTOR = "ancestor", ATTRNAME_ARCHIVE = "archive", ATTRNAME_ATTRIBUTE = "attribute", ATTRNAME_ATTRIBUTE_SET = "attribute-set", ATTRNAME_CASEORDER = "case-order", ATTRNAME_CLASS = "class", ATTRNAME_CLASSID = "classid", ATTRNAME_CODEBASE = "codebase", ATTRNAME_CODETYPE = "type", ATTRNAME_CONDITION = "condition", ATTRNAME_COPYTYPE = "copy-type", ATTRNAME_COUNT = "count", ATTRNAME_DATATYPE = "data-type", ATTRNAME_DECIMALSEPARATOR = "decimal-separator", ATTRNAME_DEFAULT = "default", ATTRNAME_DEFAULTSPACE = "default-space", ATTRNAME_DEPTH = "with-children", ATTRNAME_DIGIT = "digit", ATTRNAME_DIGITGROUPSEP = "digit-group-sep", ATTRNAME_DISABLE_OUTPUT_ESCAPING = "disable-output-escaping", ATTRNAME_ELEMENT = "element", ATTRNAME_ELEMENTS = "elements", ATTRNAME_EXCLUDE_RESULT_PREFIXES ="exclude-result-prefixes", ATTRNAME_EXPR = "expr", ATTRNAME_EXTENSIONELEMENTPREFIXES = "extension-element-prefixes", ATTRNAME_FORMAT = "format", ATTRNAME_FROM = "from", ATTRNAME_GROUPINGSEPARATOR = "grouping-separator", ATTRNAME_GROUPINGSIZE = "grouping-size", ATTRNAME_HREF = "href", ATTRNAME_ID = "id", ATTRNAME_IMPORTANCE = "importance", ATTRNAME_INDENTRESULT = "indent-result", ATTRNAME_INFINITY = "infinity", ATTRNAME_LANG = "lang", ATTRNAME_LETTERVALUE = "letter-value", ATTRNAME_LEVEL = "level", ATTRNAME_MATCH = "match", ATTRNAME_METHOD = "calls", ATTRNAME_MINUSSIGN = "minus-sign", ATTRNAME_MODE = "mode", ATTRNAME_NAME = "name", ATTRNAME_NAMESPACE = "namespace", ATTRNAME_NAN = "NaN", ATTRNAME_NDIGITSPERGROUP = "n-digits-per-group", ATTRNAME_NS = "ns", ATTRNAME_ONLY = "only", ATTRNAME_ORDER = "order", ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = "cdata-section-elements", ATTRNAME_OUTPUT_DOCTYPE_PUBLIC = "doctype-public", ATTRNAME_OUTPUT_DOCTYPE_SYSTEM = "doctype-system", ATTRNAME_OUTPUT_ENCODING = "encoding", ATTRNAME_OUTPUT_INDENT = "indent", ATTRNAME_OUTPUT_MEDIATYPE = "media-type", ATTRNAME_OUTPUT_METHOD = "method", // qname, ATTRNAME_OUTPUT_OMITXMLDECL = "omit-xml-declaration", ATTRNAME_OUTPUT_STANDALONE = "standalone", ATTRNAME_OUTPUT_VERSION = "version", ATTRNAME_PATTERNSEPARATOR = "pattern-separator", ATTRNAME_PERCENT = "percent", ATTRNAME_PERMILLE = "per-mille", ATTRNAME_PRIORITY = "priority", ATTRNAME_REFID = "refID", ATTRNAME_RESULTNS = "result-ns", ATTRNAME_RESULT_PREFIX = "result-prefix", ATTRNAME_SELECT = "select", ATTRNAME_SEQUENCESRC = "sequence-src", ATTRNAME_STYLE = "style", ATTRNAME_STYLESHEET_PREFIX = "stylesheet-prefix", ATTRNAME_TERMINATE = "terminate", ATTRNAME_TEST = "test", ATTRNAME_TOSTRING = "to-string", ATTRNAME_TYPE = "type", ATTRNAME_USE = "use", ATTRNAME_USEATTRIBUTESETS = "use-attribute-sets", ATTRNAME_VALUE = "value", ATTRNAME_VERSION = "version", ATTRNAME_XMLNS = "xmlns:", // namespace declaration prefix -- NOT an attribute by itself ATTRNAME_XMLNSDEF = "xmlns", // default namespace ATTRNAME_XMLSPACE = "xml:space", ATTRNAME_ZERODIGIT = "zero-digit"; /** IDs for XSL attribute types. These are associated * with the string literals in the TransformerImpl class. * Don't change the numbers. NOTE THAT THESE ARE NOT IN * ALPHABETICAL ORDER! */ public static final int TATTRNAME_OUTPUT_METHOD = 1, TATTRNAME_AMOUNT = 2, TATTRNAME_ANCESTOR = 3, TATTRNAME_ARCHIVE = 4, TATTRNAME_ATTRIBUTE = 5, TATTRNAME_ATTRIBUTE_SET = 6, TATTRNAME_CASEORDER = 7, TATTRNAME_CLASS = 8, TATTRNAME_CLASSID = 9, TATTRNAME_CODEBASE = 10, TATTRNAME_CODETYPE = 11, TATTRNAME_CONDITION = 12, TATTRNAME_COPYTYPE = 13, TATTRNAME_COUNT = 14, TATTRNAME_DATATYPE = 15, TATTRNAME_DEFAULT = 16, TATTRNAME_DEFAULTSPACE = 17, TATTRNAME_DEPTH = 18, TATTRNAME_DIGITGROUPSEP = 19, TATTRNAME_DISABLE_OUTPUT_ESCAPING = 20, TATTRNAME_ELEMENT = 21, TATTRNAME_ELEMENTS = 22, TATTRNAME_EXPR = 23, TATTRNAME_EXTENSIONELEMENTPREFIXES = 24, TATTRNAME_FORMAT = 25, TATTRNAME_FROM = 26, TATTRNAME_GROUPINGSEPARATOR = 27, TATTRNAME_GROUPINGSIZE = 28, TATTRNAME_HREF = 29, TATTRNAME_ID = 30, TATTRNAME_IMPORTANCE = 31, TATTRNAME_INDENTRESULT = 32, TATTRNAME_LANG = 33, TATTRNAME_LETTERVALUE = 34, TATTRNAME_LEVEL = 35, TATTRNAME_MATCH = 36, TATTRNAME_METHOD = 37, TATTRNAME_MODE = 38, TATTRNAME_NAME = 39, TATTRNAME_NAMESPACE = 40, TATTRNAME_NDIGITSPERGROUP = 41, TATTRNAME_NS = 42, TATTRNAME_ONLY = 43, TATTRNAME_ORDER = 44, TATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = 45, TATTRNAME_OUTPUT_DOCTYPE_PUBLIC = 46, TATTRNAME_OUTPUT_DOCTYPE_SYSTEM = 47, TATTRNAME_OUTPUT_ENCODING = 48, TATTRNAME_OUTPUT_INDENT = 49, TATTRNAME_OUTPUT_MEDIATYPE = 50, TATTRNAME_OUTPUT_STANDALONE = 51, TATTRNAME_OUTPUT_VERSION = 52, TATTRNAME_OUTPUT_OMITXMLDECL = 53, TATTRNAME_PRIORITY = 54, TATTRNAME_REFID = 55, TATTRNAME_RESULTNS = 56, TATTRNAME_SELECT = 57, TATTRNAME_SEQUENCESRC = 58, TATTRNAME_STYLE = 59, TATTRNAME_TEST = 60, TATTRNAME_TOSTRING = 61, TATTRNAME_TYPE = 62, TATTRNAME_USE = 63, TATTRNAME_USEATTRIBUTESETS = 64, TATTRNAME_VALUE = 65, TATTRNAME_XMLNSDEF = 66, TATTRNAME_XMLNS = 67, TATTRNAME_XMLSPACE = 68, TATTRNAME_EXCLUDE_RESULT_PREFIXES = 69; /** Mnemonics for the possible values of the xsl:output element's * method= attribute: *
          *
        • ATTRVAL_OUTPUT_METHOD_XML = Use an XML formatter to * produce the output document (basic XSLT operation).
        • *
        • ATTRVAL_OUTPUT_METHOD_HTML: Use an HTML formatter to * produce the output document. When generating HTML documents, * this may yield better results; it does things like escaping * characters in href attributes.
        • * ATTRVAL_OUTPUT_METHOD_TEXT: Use a Text formatter to * produce the output document. Generally the right choice if your * stylesheet wants to take over _all_ the details of formatting, * most often when producing something that isn't an XML or HTML * document. *
        * */ public static final String ATTRVAL_OUTPUT_METHOD_HTML = "html", ATTRVAL_OUTPUT_METHOD_XML = "xml", ATTRVAL_OUTPUT_METHOD_TEXT = "text"; /* For space-att*/ public static final int ATTRVAL_PRESERVE = 1, ATTRVAL_STRIP = 2; /** For indent-result */ public static final boolean ATTRVAL_YES = true, ATTRVAL_NO = false; /** For letter-value attribute (part of conversion attributes). */ public static final String ATTRVAL_ALPHABETIC = "alphabetic", ATTRVAL_OTHER = "other", ATTRVAL_TRADITIONAL = "traditional"; /** For level attribute in xsl:number. */ public static final String ATTRVAL_SINGLE = "single", ATTRVAL_MULTI = "multiple", ATTRVAL_ANY = "any"; /** For Stylesheet-prefix and result-prefix in xsl:namespace-alias */ public static final String ATTRVAL_DEFAULT_PREFIX = "#default"; /** Integer equivalents for above */ public static final int NUMBERLETTER_ALPHABETIC = 1, NUMBERLETTER_TRADITIONAL = 2; /** Integer equivelents for above */ public static final int NUMBERLEVEL_SINGLE = 1, NUMBERLEVEL_MULTI = 2, NUMBERLEVEL_ANY = 3, MAX_MULTI_COUNTING_DEPTH = 32; /** some stuff for my patterns-by-example */ public static final String ATTRVAL_THIS = ".", ATTRVAL_PARENT = "..", ATTRVAL_ANCESTOR = "ancestor", ATTRVAL_ID = "id"; /** Stuff for sorting */ public static final String ATTRVAL_DATATYPE_TEXT = "text", ATTRVAL_DATATYPE_NUMBER = "number", ATTRVAL_ORDER_ASCENDING = "ascending", ATTRVAL_ORDER_DESCENDING = "descending", ATTRVAL_CASEORDER_UPPER = "upper-first", ATTRVAL_CASEORDER_LOWER = "lower-first"; /** Integer equivelents for DATATYPE attribute */ public static final int SORTDATATYPE_TEXT = 1, SORTDATATYPE_NUMBER = 2; /** Integer equivelents for ORDER attribute */ public static final int SORTORDER_ASCENDING = 1, SORTORDER_DESCENDING = 2; /** Integer equivelents for CASE-ORDER attribute */ public static final int SORTCASEORDER_UPPERFIRST = 1, SORTCASEORDER_LOWERFIRST = 2; /** some stuff for Decimal-format */ public static final String ATTRVAL_INFINITY = "Infinity", ATTRVAL_NAN = "NaN", DEFAULT_DECIMAL_FORMAT = "#default"; /** temp dummy */ public static final String ATTRNAME_XXXX = "XXXX"; } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemOtherwise.java0000644000175000017500000000336010721374032024620 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemOtherwise.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * Implement xsl:otherwise. *
         * 
         * 
         * 
        * @see XXX in XSLT Specification * @xsl.usage advanced */ public class ElemOtherwise extends ElemTemplateElement { static final long serialVersionUID = 1863944560970181395L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_OTHERWISE; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_OTHERWISE_STRING; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/NamespaceAlias.java0000644000175000017500000000725510721374031024720 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NamespaceAlias.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * Object to hold an xsl:namespace element. * A stylesheet can use the xsl:namespace-alias element to declare * that one namespace URI is an alias for another namespace URI. * @see literal-result-element in XSLT Specification */ public class NamespaceAlias extends ElemTemplateElement { static final long serialVersionUID = 456173966637810718L; /** * Constructor NamespaceAlias * * @param docOrderNumber The document order number * */ public NamespaceAlias(int docOrderNumber) { super(); m_docOrderNumber = docOrderNumber; } /** * The "stylesheet-prefix" attribute. * @serial */ private String m_StylesheetPrefix; /** * Set the "stylesheet-prefix" attribute. * * @param v non-null prefix value. */ public void setStylesheetPrefix(String v) { m_StylesheetPrefix = v; } /** * Get the "stylesheet-prefix" attribute. * * @return non-null prefix value. */ public String getStylesheetPrefix() { return m_StylesheetPrefix; } /** * The namespace in the stylesheet space. * @serial */ private String m_StylesheetNamespace; /** * Set the value for the stylesheet namespace. * * @param v non-null prefix value. */ public void setStylesheetNamespace(String v) { m_StylesheetNamespace = v; } /** * Get the value for the stylesheet namespace. * * @return non-null prefix value. */ public String getStylesheetNamespace() { return m_StylesheetNamespace; } /** * The "result-prefix" attribute. * @serial */ private String m_ResultPrefix; /** * Set the "result-prefix" attribute. * * @param v non-null prefix value. */ public void setResultPrefix(String v) { m_ResultPrefix = v; } /** * Get the "result-prefix" attribute. * * @return non-null prefix value. */ public String getResultPrefix() { return m_ResultPrefix; } /** * The result namespace. * @serial */ private String m_ResultNamespace; /** * Set the result namespace. * * @param v non-null namespace value */ public void setResultNamespace(String v) { m_ResultNamespace = v; } /** * Get the result namespace value. * * @return non-null namespace value. */ public String getResultNamespace() { return m_ResultNamespace; } /** * This function is called to recompose() all of the namespace alias properties elements. * * @param root The owning root stylesheet */ public void recompose(StylesheetRoot root) { root.recomposeNamespaceAliases(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemUnknown.java0000644000175000017500000000703510721374031024310 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemUnknown.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPathContext; /** * Implement an unknown element * @xsl.usage advanced */ public class ElemUnknown extends ElemLiteralResult { static final long serialVersionUID = -4573981712648730168L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * *@return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_UNDEFINED; } /** * Execute the fallbacks when an extension is not available. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ private void executeFallbacks( TransformerImpl transformer) throws TransformerException { for (ElemTemplateElement child = m_firstChild; child != null; child = child.m_nextSibling) { if (child.getXSLToken() == Constants.ELEMNAME_FALLBACK) { try { transformer.pushElemTemplateElement(child); ((ElemFallback) child).executeFallback(transformer); } finally { transformer.popElemTemplateElement(); } } } } /** * Return true if this extension element has a child element. * * @return true if this extension element has a child element. */ private boolean hasFallbackChildren() { for (ElemTemplateElement child = m_firstChild; child != null; child = child.m_nextSibling) { if (child.getXSLToken() == Constants.ELEMNAME_FALLBACK) return true; } return false; } /** * Execute an unknown element. * Execute fallback if fallback child exists or do nothing * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); try { if (hasFallbackChildren()) { executeFallbacks(transformer); } else { // do nothing } } catch (TransformerException e) { transformer.getErrorListener().fatalError(e); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemExtensionScript.java0000644000175000017500000000460410721374033026013 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemExtensionScript.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; /** * Implement Script extension element * @xsl.usage internal */ public class ElemExtensionScript extends ElemTemplateElement { static final long serialVersionUID = -6995978265966057744L; /** * Constructor ElemExtensionScript * */ public ElemExtensionScript() { // System.out.println("ElemExtensionScript ctor"); } /** Language used in extension. * @serial */ private String m_lang = null; /** * Set language used by extension * * * @param v Language used by extension */ public void setLang(String v) { m_lang = v; } /** * Get language used by extension * * * @return Language used by extension */ public String getLang() { return m_lang; } /** Extension handler. * @serial */ private String m_src = null; /** * Set Extension handler name for this extension * * * @param v Extension handler name to set */ public void setSrc(String v) { m_src = v; } /** * Get Extension handler name for this extension * * * @return Extension handler name */ public String getSrc() { return m_src; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_EXTENSIONSCRIPT; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemSort.java0000644000175000017500000002671610721374031023607 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemSort.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xpath.XPath; import org.w3c.dom.DOMException; import org.w3c.dom.Node; /** * Implement xsl:sort. *
         * 
         * 
         * 
         * 
        * @see sorting in XSLT Specification * @xsl.usage advanced */ public class ElemSort extends ElemTemplateElement { static final long serialVersionUID = -4991510257335851938L; /** * xsl:sort has a select attribute whose value is an expression. * @serial */ private XPath m_selectExpression = null; /** * Set the "select" attribute. * xsl:sort has a select attribute whose value is an expression. * For each node to be processed, the expression is evaluated * with that node as the current node and with the complete * list of nodes being processed in unsorted order as the current * node list. The resulting object is converted to a string as if * by a call to the string function; this string is used as the * sort key for that node. The default value of the select attribute * is ., which will cause the string-value of the current node to * be used as the sort key. * * @param v Value to set for the "select" attribute */ public void setSelect(XPath v) { if (v.getPatternString().indexOf("{") < 0) m_selectExpression = v; else error(XSLTErrorResources.ER_NO_CURLYBRACE, null); } /** * Get the "select" attribute. * xsl:sort has a select attribute whose value is an expression. * For each node to be processed, the expression is evaluated * with that node as the current node and with the complete * list of nodes being processed in unsorted order as the current * node list. The resulting object is converted to a string as if * by a call to the string function; this string is used as the * sort key for that node. The default value of the select attribute * is ., which will cause the string-value of the current node to * be used as the sort key. * * @return The value of the "select" attribute */ public XPath getSelect() { return m_selectExpression; } /** * lang specifies the language of the sort keys. * @serial */ private AVT m_lang_avt = null; /** * Set the "lang" attribute. * lang specifies the language of the sort keys; it has the same * range of values as xml:lang [XML]; if no lang value is * specified, the language should be determined from the system environment. * * @param v The value to set for the "lang" attribute */ public void setLang(AVT v) { m_lang_avt = v; } /** * Get the "lang" attribute. * lang specifies the language of the sort keys; it has the same * range of values as xml:lang [XML]; if no lang value is * specified, the language should be determined from the system environment. * * @return The value of the "lang" attribute */ public AVT getLang() { return m_lang_avt; } /** * data-type specifies the data type of the * strings to be sorted. * @serial */ private AVT m_dataType_avt = null; /** * Set the "data-type" attribute. * data-type specifies the data type of the * strings; the following values are allowed: *
          *
        • * text specifies that the sort keys should be * sorted lexicographically in the culturally correct manner for the * language specified by lang. *
        • *
        • * number specifies that the sort keys should be * converted to numbers and then sorted according to the numeric value; * the sort key is converted to a number as if by a call to the * number function; the lang * attribute is ignored. *
        • *
        • * A QName with a prefix * is expanded into an expanded-name as described * in [2.4 Qualified Names]; the expanded-name identifies the data-type; * the behavior in this case is not specified by this document. *
        • *
        *

        The default value is text.

        *
        * NOTE: The XSL Working Group plans that future versions of XSLT will * leverage XML Schemas to define further values for this * attribute.
        * * @param v Value to set for the "data-type" attribute */ public void setDataType(AVT v) { m_dataType_avt = v; } /** * Get the "data-type" attribute. * data-type specifies the data type of the * strings; the following values are allowed: *
          *
        • * text specifies that the sort keys should be * sorted lexicographically in the culturally correct manner for the * language specified by lang. *
        • *
        • * number specifies that the sort keys should be * converted to numbers and then sorted according to the numeric value; * the sort key is converted to a number as if by a call to the * number function; the lang * attribute is ignored. *
        • *
        • * A QName with a prefix * is expanded into an expanded-name as described * in [2.4 Qualified Names]; the expanded-name identifies the data-type; * the behavior in this case is not specified by this document. *
        • *
        *

        The default value is text.

        *
        * NOTE: The XSL Working Group plans that future versions of XSLT will * leverage XML Schemas to define further values for this * attribute.
        * * @return The value of the "data-type" attribute */ public AVT getDataType() { return m_dataType_avt; } /** * order specifies whether the strings should be sorted in ascending * or descending order. * @serial */ private AVT m_order_avt = null; /** * Set the "order" attribute. * order specifies whether the strings should be sorted in ascending * or descending order; ascending specifies ascending order; descending * specifies descending order; the default is ascending. * * @param v The value to set for the "order" attribute */ public void setOrder(AVT v) { m_order_avt = v; } /** * Get the "order" attribute. * order specifies whether the strings should be sorted in ascending * or descending order; ascending specifies ascending order; descending * specifies descending order; the default is ascending. * * @return The value of the "order" attribute */ public AVT getOrder() { return m_order_avt; } /** * case-order has the value upper-first or lower-first. * The default value is language dependent. * @serial */ private AVT m_caseorder_avt = null; /** * Set the "case-order" attribute. * case-order has the value upper-first or lower-first; this applies * when data-type="text", and specifies that upper-case letters should * sort before lower-case letters or vice-versa respectively. * For example, if lang="en", then A a B b are sorted with * case-order="upper-first" and a A b B are sorted with case-order="lower-first". * The default value is language dependent. * * @param v The value to set for the "case-order" attribute * * @serial */ public void setCaseOrder(AVT v) { m_caseorder_avt = v; } /** * Get the "case-order" attribute. * case-order has the value upper-first or lower-first; this applies * when data-type="text", and specifies that upper-case letters should * sort before lower-case letters or vice-versa respectively. * For example, if lang="en", then A a B b are sorted with * case-order="upper-first" and a A b B are sorted with case-order="lower-first". * The default value is language dependent. * * @return The value of the "case-order" attribute */ public AVT getCaseOrder() { return m_caseorder_avt; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID of the element */ public int getXSLToken() { return Constants.ELEMNAME_SORT; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_SORT_STRING; } /** * Add a child to the child list. * * @param newChild Child to add to the child list * * @return Child just added to the child list * * @throws DOMException */ public Node appendChild(Node newChild) throws DOMException { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); return null; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws javax.xml.transform.TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if(null != m_caseorder_avt) m_caseorder_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_dataType_avt) m_dataType_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_lang_avt) m_lang_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_order_avt) m_order_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_selectExpression) m_selectExpression.fixupVariables(vnames, cstate.getGlobalsSize()); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemExsltFuncResult.java0000644000175000017500000000653710721374030025770 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemExsltFuncResult.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * Handles the EXSLT result element within an EXSLT function element. */ public class ElemExsltFuncResult extends ElemVariable { static final long serialVersionUID = -3478311949388304563L; /* * To keep the binary compatibility put those three private global * variables back, although they are never used in this verison */ // A flag indicating whether the return result is set private boolean m_isResultSet = false; // The return result private XObject m_result = null; // The frame size of the current caller private int m_callerFrameSize = 0; /** * Generate the EXSLT function return value, and assign it to the variable * index slot assigned for it in ElemExsltFunction compose(). * */ public void execute(TransformerImpl transformer) throws TransformerException { XPathContext context = transformer.getXPathContext(); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); // Verify that result has not already been set by another result // element. Recursion is allowed: intermediate results are cleared // in the owner ElemExsltFunction execute(). if (transformer.currentFuncResultSeen()) { throw new TransformerException("An EXSLT function cannot set more than one result!"); } int sourceNode = context.getCurrentNode(); // Set the return value; XObject var = getValue(transformer, sourceNode); transformer.popCurrentFuncResult(); transformer.pushCurrentFuncResult(var); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.EXSLT_ELEMNAME_FUNCRESULT; } /** * Return the node name, defined in the * Constants class. * @see org.apache.xalan.templates.Constants * @return The node name * */ public String getNodeName() { return Constants.EXSLT_ELEMNAME_FUNCRESULT_STRING; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemCallTemplate.java0000644000175000017500000002623010721374031025216 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemCallTemplate.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * Implement xsl:call-template. *
         * &!ELEMENT xsl:call-template (xsl:with-param)*>
         * &!ATTLIST xsl:call-template
         *   name %qname; #REQUIRED
         * &
         * 
        * @see named-templates in XSLT Specification * @xsl.usage advanced */ public class ElemCallTemplate extends ElemForEach { static final long serialVersionUID = 5009634612916030591L; /** * An xsl:call-template element invokes a template by name; * it has a required name attribute that identifies the template to be invoked. * @serial */ public QName m_templateName = null; /** * Set the "name" attribute. * An xsl:call-template element invokes a template by name; * it has a required name attribute that identifies the template to be invoked. * * @param name Name attribute to set */ public void setName(QName name) { m_templateName = name; } /** * Get the "name" attribute. * An xsl:call-template element invokes a template by name; * it has a required name attribute that identifies the template to be invoked. * * @return Name attribute of this element */ public QName getName() { return m_templateName; } /** * The template which is named by QName. * @serial */ private ElemTemplate m_template = null; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_CALLTEMPLATE; } /** * Return the node name. * * @return The name of this element */ public String getNodeName() { return Constants.ELEMNAME_CALLTEMPLATE_STRING; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); // Call compose on each param no matter if this is apply-templates // or call templates. int length = getParamElemCount(); for (int i = 0; i < length; i++) { ElemWithParam ewp = getParamElem(i); ewp.compose(sroot); } if ((null != m_templateName) && (null == m_template)) { m_template = this.getStylesheetRoot().getTemplateComposed(m_templateName); if (null == m_template) { String themsg = XSLMessages.createMessage( XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR, new Object[] { m_templateName }); throw new TransformerException(themsg, this); //"Could not find template named: '"+templateName+"'"); } length = getParamElemCount(); for (int i = 0; i < length; i++) { ElemWithParam ewp = getParamElem(i); ewp.m_index = -1; // Find the position of the param in the template being called, // and set the index of the param slot. int etePos = 0; for (ElemTemplateElement ete = m_template.getFirstChildElem(); null != ete; ete = ete.getNextSiblingElem()) { if(ete.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE) { ElemParam ep = (ElemParam)ete; if(ep.getName().equals(ewp.getName())) { ewp.m_index = etePos; } } else break; etePos++; } } } } /** * This after the template's children have been composed. */ public void endCompose(StylesheetRoot sroot) throws TransformerException { int length = getParamElemCount(); for (int i = 0; i < length; i++) { ElemWithParam ewp = getParamElem(i); ewp.endCompose(sroot); } super.endCompose(sroot); } /** * Invoke a named template. * @see named-templates in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); if (null != m_template) { XPathContext xctxt = transformer.getXPathContext(); VariableStack vars = xctxt.getVarStack(); int thisframe = vars.getStackFrame(); int nextFrame = vars.link(m_template.m_frameSize); // We have to clear the section of the stack frame that has params // so that the default param evaluation will work correctly. if(m_template.m_inArgsSize > 0) { vars.clearLocalSlots(0, m_template.m_inArgsSize); if(null != m_paramElems) { int currentNode = xctxt.getCurrentNode(); vars.setStackFrame(thisframe); int size = m_paramElems.length; for (int i = 0; i < size; i++) { ElemWithParam ewp = m_paramElems[i]; if(ewp.m_index >= 0) { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(ewp); XObject obj = ewp.getValue(transformer, currentNode); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(ewp); // Note here that the index for ElemWithParam must have been // statically made relative to the xsl:template being called, // NOT this xsl:template. vars.setLocalVariable(ewp.m_index, obj, nextFrame); } } vars.setStackFrame(nextFrame); } } SourceLocator savedLocator = xctxt.getSAXLocator(); try { xctxt.setSAXLocator(m_template); // template.executeChildTemplates(transformer, sourceNode, mode, true); transformer.pushElemTemplateElement(m_template); m_template.execute(transformer); } finally { transformer.popElemTemplateElement(); xctxt.setSAXLocator(savedLocator); // When we entered this function, the current // frame buffer (cfb) index in the variable stack may // have been manually set. If we just call // unlink(), however, it will restore the cfb to the // previous link index from the link stack, rather than // the manually set cfb. So, // the only safe solution is to restore it back // to the same position it was on entry, since we're // really not working in a stack context here. (Bug4218) vars.unlink(thisframe); } } else { transformer.getMsgMgr().error(this, XSLTErrorResources.ER_TEMPLATE_NOT_FOUND, new Object[]{ m_templateName }); //"Could not find template named: '"+templateName+"'"); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** Vector of xsl:param elements associated with this element. * @serial */ protected ElemWithParam[] m_paramElems = null; /** * Get the count xsl:param elements associated with this element. * @return The number of xsl:param elements. */ public int getParamElemCount() { return (m_paramElems == null) ? 0 : m_paramElems.length; } /** * Get a xsl:param element associated with this element. * * @param i Index of element to find * * @return xsl:param element at given index */ public ElemWithParam getParamElem(int i) { return m_paramElems[i]; } /** * Set a xsl:param element associated with this element. * * @param ParamElem xsl:param element to set. */ public void setParamElem(ElemWithParam ParamElem) { if (null == m_paramElems) { m_paramElems = new ElemWithParam[1]; m_paramElems[0] = ParamElem; } else { // Expensive 1 at a time growth, but this is done at build time, so // I think it's OK. int length = m_paramElems.length; ElemWithParam[] ewp = new ElemWithParam[length + 1]; System.arraycopy(m_paramElems, 0, ewp, 0, length); m_paramElems = ewp; ewp[length] = ParamElem; } } /** * Add a child to the child list. * * * * @param newChild Child to add to this node's children list * * @return The child that was just added the children list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); if (Constants.ELEMNAME_WITHPARAM == type) { setParamElem((ElemWithParam) newChild); } // You still have to append, because this element can // contain a for-each, and other elements. return super.appendChild(newChild); } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ public void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { // if (null != m_paramElems) // { // int size = m_paramElems.length; // // for (int i = 0; i < size; i++) // { // ElemWithParam ewp = m_paramElems[i]; // ewp.callVisitors(visitor); // } // } super.callChildVisitors(visitor, callAttrs); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemApplyTemplates.java0000644000175000017500000003552510721374033025624 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemApplyTemplates.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.StackGuard; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.IntStack; import org.apache.xml.utils.QName; import org.apache.xpath.VariableStack; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.xml.sax.SAXException; /** * Implement xsl:apply-templates. *
         * &!ELEMENT xsl:apply-templates (xsl:sort|xsl:with-param)*>
         * &!ATTLIST xsl:apply-templates
         *   select %expr; "node()"
         *   mode %qname; #IMPLIED
         * &
         * 
        * @see section-Applying-Template-Rules in XSLT Specification * @xsl.usage advanced */ public class ElemApplyTemplates extends ElemCallTemplate { static final long serialVersionUID = 2903125371542621004L; /** * mode %qname; #IMPLIED * @serial */ private QName m_mode = null; /** * Set the mode attribute for this element. * * @param mode reference, which may be null, to the current mode. */ public void setMode(QName mode) { m_mode = mode; } /** * Get the mode attribute for this element. * * @return The mode attribute for this element */ public QName getMode() { return m_mode; } /** * Tells if this belongs to a default template, * in which case it will act different with * regard to processing modes. * @see built-in-rule in XSLT Specification * @serial */ private boolean m_isDefaultTemplate = false; // /** // * List of namespace/localname IDs, for identification of xsl:with-param to // * xsl:params. Initialized in the compose() method. // */ // private int[] m_paramIDs; /** * Set if this belongs to a default template, * in which case it will act different with * regard to processing modes. * @see built-in-rule in XSLT Specification * * @param b boolean value to set. */ public void setIsDefaultTemplate(boolean b) { m_isDefaultTemplate = b; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return Token ID for this element types */ public int getXSLToken() { return Constants.ELEMNAME_APPLY_TEMPLATES; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); } /** * Return the node name. * * @return Element name */ public String getNodeName() { return Constants.ELEMNAME_APPLY_TEMPLATES_STRING; } /** * Apply the context node to the matching templates. * @see section-Applying-Template-Rules in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { transformer.pushCurrentTemplateRuleIsNull(false); boolean pushMode = false; try { // %REVIEW% Do we need this check?? // if (null != sourceNode) // { // boolean needToTurnOffInfiniteLoopCheck = false; QName mode = transformer.getMode(); if (!m_isDefaultTemplate) { if (((null == mode) && (null != m_mode)) || ((null != mode) &&!mode.equals(m_mode))) { pushMode = true; transformer.pushMode(m_mode); } } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); transformSelectedNodes(transformer); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); if (pushMode) transformer.popMode(); transformer.popCurrentTemplateRuleIsNull(); } } /** * Perform a query if needed, and call transformNode for each child. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException Thrown in a variety of circumstances. * @xsl.usage advanced */ public void transformSelectedNodes(TransformerImpl transformer) throws TransformerException { final XPathContext xctxt = transformer.getXPathContext(); final int sourceNode = xctxt.getCurrentNode(); DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt, sourceNode); VariableStack vars = xctxt.getVarStack(); int nParams = getParamElemCount(); int thisframe = vars.getStackFrame(); StackGuard guard = transformer.getStackGuard(); boolean check = (guard.getRecursionLimit() > -1) ? true : false; boolean pushContextNodeListFlag = false; try { xctxt.pushCurrentNode(DTM.NULL); xctxt.pushCurrentExpressionNode(DTM.NULL); xctxt.pushSAXLocatorNull(); transformer.pushElemTemplateElement(null); final Vector keys = (m_sortElems == null) ? null : transformer.processSortKeys(this, sourceNode); // Sort if we need to. if (null != keys) sourceNodes = sortNodes(xctxt, keys, sourceNodes); if (transformer.getDebug()) { transformer.getTraceManager().fireSelectedEvent(sourceNode, this, "select", new XPath(m_selectExpression), new org.apache.xpath.objects.XNodeSet(sourceNodes)); } final SerializationHandler rth = transformer.getSerializationHandler(); // ContentHandler chandler = rth.getContentHandler(); final StylesheetRoot sroot = transformer.getStylesheet(); final TemplateList tl = sroot.getTemplateListComposed(); final boolean quiet = transformer.getQuietConflictWarnings(); // Should be able to get this from the iterator but there must be a bug. DTM dtm = xctxt.getDTM(sourceNode); int argsFrame = -1; if(nParams > 0) { // This code will create a section on the stack that is all the // evaluated arguments. These will be copied into the real params // section of each called template. argsFrame = vars.link(nParams); vars.setStackFrame(thisframe); for (int i = 0; i < nParams; i++) { ElemWithParam ewp = m_paramElems[i]; if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(ewp); XObject obj = ewp.getValue(transformer, sourceNode); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(ewp); vars.setLocalVariable(i, obj, argsFrame); } vars.setStackFrame(argsFrame); } xctxt.pushContextNodeList(sourceNodes); pushContextNodeListFlag = true; IntStack currentNodes = xctxt.getCurrentNodeStack(); IntStack currentExpressionNodes = xctxt.getCurrentExpressionNodeStack(); // pushParams(transformer, xctxt); int child; while (DTM.NULL != (child = sourceNodes.nextNode())) { currentNodes.setTop(child); currentExpressionNodes.setTop(child); if(xctxt.getDTM(child) != dtm) { dtm = xctxt.getDTM(child); } final int exNodeType = dtm.getExpandedTypeID(child); final int nodeType = dtm.getNodeType(child); final QName mode = transformer.getMode(); ElemTemplate template = tl.getTemplateFast(xctxt, child, exNodeType, mode, -1, quiet, dtm); // If that didn't locate a node, fall back to a default template rule. // See http://www.w3.org/TR/xslt#built-in-rule. if (null == template) { switch (nodeType) { case DTM.DOCUMENT_FRAGMENT_NODE : case DTM.ELEMENT_NODE : template = sroot.getDefaultRule(); // %OPT% direct faster? break; case DTM.ATTRIBUTE_NODE : case DTM.CDATA_SECTION_NODE : case DTM.TEXT_NODE : // if(rth.m_elemIsPending || rth.m_docPending) // rth.flushPending(true); transformer.pushPairCurrentMatched(sroot.getDefaultTextRule(), child); transformer.setCurrentElement(sroot.getDefaultTextRule()); // dtm.dispatchCharactersEvents(child, chandler, false); dtm.dispatchCharactersEvents(child, rth, false); transformer.popCurrentMatched(); continue; case DTM.DOCUMENT_NODE : template = sroot.getDefaultRootRule(); break; default : // No default rules for processing instructions and the like. continue; } } else { transformer.setCurrentElement(template); } transformer.pushPairCurrentMatched(template, child); if (check) guard.checkForInfinateLoop(); int currentFrameBottom; // See comment with unlink, below if(template.m_frameSize > 0) { xctxt.pushRTFContext(); currentFrameBottom = vars.getStackFrame(); // See comment with unlink, below vars.link(template.m_frameSize); // You can't do the check for nParams here, otherwise the // xsl:params might not be nulled. if(/* nParams > 0 && */ template.m_inArgsSize > 0) { int paramIndex = 0; for (ElemTemplateElement elem = template.getFirstChildElem(); null != elem; elem = elem.getNextSiblingElem()) { if(Constants.ELEMNAME_PARAMVARIABLE == elem.getXSLToken()) { ElemParam ep = (ElemParam)elem; int i; for (i = 0; i < nParams; i++) { ElemWithParam ewp = m_paramElems[i]; if(ewp.m_qnameID == ep.m_qnameID) { XObject obj = vars.getLocalVariable(i, argsFrame); vars.setLocalVariable(paramIndex, obj); break; } } if(i == nParams) vars.setLocalVariable(paramIndex, null); } else break; paramIndex++; } } } else currentFrameBottom = 0; // Fire a trace event for the template. if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(template); // And execute the child templates. // Loop through the children of the template, calling execute on // each of them. for (ElemTemplateElement t = template.m_firstChild; t != null; t = t.m_nextSibling) { xctxt.setSAXLocator(t); try { transformer.pushElemTemplateElement(t); t.execute(transformer); } finally { transformer.popElemTemplateElement(); } } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(template); if(template.m_frameSize > 0) { // See Frank Weiss bug around 03/19/2002 (no Bugzilla report yet). // While unlink will restore to the proper place, the real position // may have been changed for xsl:with-param, so that variables // can be accessed. // of right now. // More: // When we entered this function, the current // frame buffer (cfb) index in the variable stack may // have been manually set. If we just call // unlink(), however, it will restore the cfb to the // previous link index from the link stack, rather than // the manually set cfb. So, // the only safe solution is to restore it back // to the same position it was on entry, since we're // really not working in a stack context here. (Bug4218) vars.unlink(currentFrameBottom); xctxt.popRTFContext(); } transformer.popCurrentMatched(); } // end while (DTM.NULL != (child = sourceNodes.nextNode())) } catch (SAXException se) { transformer.getErrorListener().fatalError(new TransformerException(se)); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEndEvent(sourceNode, this, "select", new XPath(m_selectExpression), new org.apache.xpath.objects.XNodeSet(sourceNodes)); // Unlink to the original stack frame if(nParams > 0) vars.unlink(thisframe); xctxt.popSAXLocator(); if (pushContextNodeListFlag) xctxt.popContextNodeList(); transformer.popElemTemplateElement(); xctxt.popCurrentExpressionNode(); xctxt.popCurrentNode(); sourceNodes.detach(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemWithParam.java0000644000175000017500000001661510721374033024553 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemWithParam.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XRTreeFrag; import org.apache.xpath.objects.XString; /** * Implement xsl:with-param. xsl:with-param is allowed within * both xsl:call-template and xsl:apply-templates. *
         * 
         * 
         * 
        * @see element-with-param in XSLT Specification * @xsl.usage advanced */ public class ElemWithParam extends ElemTemplateElement { static final long serialVersionUID = -1070355175864326257L; /** * This is the index to the stack frame being called, not the * stack frame that contains this element. */ int m_index; /** * The "select" attribute, which specifies the value of the * argument, if element content is not specified. * @serial */ private XPath m_selectPattern = null; /** * Set the "select" attribute. * The "select" attribute specifies the value of the * argument, if element content is not specified. * * @param v Value to set for the "select" attribute. */ public void setSelect(XPath v) { m_selectPattern = v; } /** * Get the "select" attribute. * The "select" attribute specifies the value of the * argument, if element content is not specified. * * @return Value of the "select" attribute. */ public XPath getSelect() { return m_selectPattern; } /** * The required name attribute specifies the name of the * parameter (the variable the value of whose binding is * to be replaced). The value of the name attribute is a QName, * which is expanded as described in [2.4 Qualified Names]. * @serial */ private QName m_qname = null; int m_qnameID; /** * Set the "name" attribute. * DJD * * @param v Value to set for the "name" attribute. */ public void setName(QName v) { m_qname = v; } /** * Get the "name" attribute. * DJD * * @return Value of the "name" attribute. */ public QName getName() { return m_qname; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_WITHPARAM; } /** * Return the node name. * * @return the node name. */ public String getNodeName() { return Constants.ELEMNAME_WITHPARAM_STRING; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { // See if we can reduce an RTF to a select with a string expression. if(null == m_selectPattern && sroot.getOptimizer()) { XPath newSelect = ElemVariable.rewriteChildToExpression(this); if(null != newSelect) m_selectPattern = newSelect; } m_qnameID = sroot.getComposeState().getQNameID(m_qname); super.compose(sroot); java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if(null != m_selectPattern) m_selectPattern.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); // m_index must be resolved by ElemApplyTemplates and ElemCallTemplate! } /** * Set the parent as an ElemTemplateElement. * * @param p This node's parent as an ElemTemplateElement */ public void setParentElem(ElemTemplateElement p) { super.setParentElem(p); p.m_hasVariableDecl = true; } /** * Get the XObject representation of the variable. * * @param transformer non-null reference to the the current transform-time state. * @param sourceNode non-null reference to the current source node. * * @return the XObject representation of the variable. * * @throws TransformerException */ public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException { XObject var; XPathContext xctxt = transformer.getXPathContext(); xctxt.pushCurrentNode(sourceNode); try { if (null != m_selectPattern) { var = m_selectPattern.execute(xctxt, sourceNode, this); var.allowDetachToRelease(false); if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEvent(sourceNode, this, "select", m_selectPattern, var); } else if (null == getFirstChildElem()) { var = XString.EMPTYSTRING; } else { // Use result tree fragment int df = transformer.transformToRTF(this); var = new XRTreeFrag(df, xctxt, this); } } finally { xctxt.popCurrentNode(); } return var; } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs && (null != m_selectPattern)) m_selectPattern.getExpression().callVisitors(m_selectPattern, visitor); super.callChildVisitors(visitor, callAttrs); } /** * Add a child to the child list. If the select attribute * is present, an error will be raised. * * @param elem New element to append to this element's children list * * @return null if the select attribute was present, otherwise the * child just added to the child list */ public ElemTemplateElement appendChild(ElemTemplateElement elem) { // cannot have content and select if (m_selectPattern != null) { error(XSLTErrorResources.ER_CANT_HAVE_CONTENT_AND_SELECT, new Object[]{"xsl:" + this.getNodeName()}); return null; } return super.appendChild(elem); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemIf.java0000644000175000017500000001216710721374030023210 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemIf.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * Implement xsl:if. *
         * 
         * 
         * 
        * @see XXX in XSLT Specification * @xsl.usage advanced */ public class ElemIf extends ElemTemplateElement { static final long serialVersionUID = 2158774632427453022L; /** * The xsl:if element must have a test attribute, which specifies an expression. * @serial */ private XPath m_test = null; /** * Set the "test" attribute. * The xsl:if element must have a test attribute, which specifies an expression. * * @param v test attribute to set */ public void setTest(XPath v) { m_test = v; } /** * Get the "test" attribute. * The xsl:if element must have a test attribute, which specifies an expression. * * @return the "test" attribute for this element. */ public XPath getTest() { return m_test; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. * * @param sroot The root stylesheet. * * @throws TransformerException */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if (null != m_test) m_test.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_IF; } /** * Return the node name. * * @return the element's name */ public String getNodeName() { return Constants.ELEMNAME_IF_STRING; } /** * Conditionally execute a sub-template. * The expression is evaluated and the resulting object is converted * to a boolean as if by a call to the boolean function. If the result * is true, then the content template is instantiated; otherwise, nothing * is created. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { XPathContext xctxt = transformer.getXPathContext(); int sourceNode = xctxt.getCurrentNode(); if (transformer.getDebug()) { XObject test = m_test.execute(xctxt, sourceNode, this); if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEvent(sourceNode, this, "test", m_test, test); // xsl:for-each now fires one trace event + one for every // iteration; changing xsl:if to fire one regardless of true/false if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); if (test.bool()) { transformer.executeChildTemplates(this, true); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); // I don't think we want this. -sb // if (transformer.getDebug()) // transformer.getTraceManager().fireSelectedEvent(sourceNode, this, // "endTest", m_test, test); } else if (m_test.bool(xctxt, sourceNode, this)) { transformer.executeChildTemplates(this, true); } } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) m_test.getExpression().callVisitors(m_test, visitor); super.callChildVisitors(visitor, callAttrs); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemWhen.java0000644000175000017500000000662610721374032023560 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemWhen.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xpath.XPath; /** * Implement xsl:when. *
         * 
         * 
         * 
        * @see XXX in XSLT Specification * @xsl.usage advanced */ public class ElemWhen extends ElemTemplateElement { static final long serialVersionUID = 5984065730262071360L; /** * Each xsl:when element has a single attribute, test, * which specifies an expression. * @serial */ private XPath m_test; /** * Set the "test" attribute. * Each xsl:when element has a single attribute, test, * which specifies an expression. * * @param v Value to set for the "test" attribute. */ public void setTest(XPath v) { m_test = v; } /** * Get the "test" attribute. * Each xsl:when element has a single attribute, test, * which specifies an expression. * * @return Value of the "test" attribute. */ public XPath getTest() { return m_test; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_WHEN; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws javax.xml.transform.TransformerException { super.compose(sroot); java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if(null != m_test) m_test.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); } /** * Return the node name. * * @return The node name */ public String getNodeName() { return Constants.ELEMNAME_WHEN_STRING; } /** * Constructor ElemWhen * */ public ElemWhen(){} /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) m_test.getExpression().callVisitors(m_test, visitor); super.callChildVisitors(visitor, callAttrs); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/package.html0000644000175000017500000000433510721374030023463 0ustar mkochmkoch Xalan Templates Package.

        Implements the {@link javax.xml.transform.Templates} interface, and defines a set of classes that represent an XSLT stylesheet.

        {@link org.apache.xalan.templates.StylesheetRoot} implements the {@link javax.xml.transform.Templates} interface, and extends {@link org.apache.xalan.templates.StylesheetComposed}, which is a {@link org.apache.xalan.templates.Stylesheet} composed of itself and its included Stylesheet objects. A StylesheetRoot also contains a global list of all imported StylesheetComposed objects. The role of these objects is to hold immutable stylesheet data, not to perform procedural tasks associated with the construction of the data (the org.apache.xalan.processor package) or with the transformation (the org.apache.xalan.transformer package).

        {@link org.apache.xalan.templates.ElemTemplateElement} is the superclass of all XSLT instruction elements, including Stylesheet. The xFunc classes extend members of the org.apache.xpath package and implement XSLT functions. Unlike the Stylesheet "container" objects, the instruction element and function classes do contain procedural execute() methods that are called during the transformation.

        libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemTextLiteral.java0000644000175000017500000001631410721374033025114 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemTextLiteral.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.serializer.SerializationHandler; import org.xml.sax.SAXException; /** * Implement a text literal. * @see section-Creating-Text in XSLT Specification * @xsl.usage advanced */ public class ElemTextLiteral extends ElemTemplateElement { static final long serialVersionUID = -7872620006767660088L; /** * Tell if space should be preserved. * @serial */ private boolean m_preserveSpace; /** * Set whether or not space should be preserved. * * @param v Boolean flag indicating whether * or not space should be preserved */ public void setPreserveSpace(boolean v) { m_preserveSpace = v; } /** * Get whether or not space should be preserved. * * @return Boolean flag indicating whether * or not space should be preserved */ public boolean getPreserveSpace() { return m_preserveSpace; } /** * The character array. * @serial */ private char m_ch[]; /** * The character array as a string. * @serial */ private String m_str; /** * Set the characters that will be output to the result tree.. * * @param v Array of characters that will be output to the result tree */ public void setChars(char[] v) { m_ch = v; } /** * Get the characters that will be output to the result tree.. * * @return Array of characters that will be output to the result tree */ public char[] getChars() { return m_ch; } /** * Get the value of the node as a string. * * @return null */ public synchronized String getNodeValue() { if(null == m_str) { m_str = new String(m_ch); } return m_str; } /** * Tells if this element should disable escaping. * @serial */ private boolean m_disableOutputEscaping = false; /** * Set the "disable-output-escaping" attribute. * Normally, the xml output method escapes & and < (and * possibly other characters) when outputting text nodes. * This ensures that the output is well-formed XML. However, * it is sometimes convenient to be able to produce output * that is almost, but not quite well-formed XML; for * example, the output may include ill-formed sections * which are intended to be transformed into well-formed * XML by a subsequent non-XML aware process. For this reason, * XSLT provides a mechanism for disabling output escaping. * An xsl:value-of or xsl:text element may have a * disable-output-escaping attribute; the allowed values * are yes or no; the default is no; if the value is yes, * then a text node generated by instantiating the xsl:value-of * or xsl:text element should be output without any escaping. * @see disable-output-escaping in XSLT Specification * * @param v Boolean value for "disable-output-escaping" attribute. */ public void setDisableOutputEscaping(boolean v) { m_disableOutputEscaping = v; } /** * Get the "disable-output-escaping" attribute. * Normally, the xml output method escapes & and < (and * possibly other characters) when outputting text nodes. * This ensures that the output is well-formed XML. However, * it is sometimes convenient to be able to produce output * that is almost, but not quite well-formed XML; for * example, the output may include ill-formed sections * which are intended to be transformed into well-formed * XML by a subsequent non-XML aware process. For this reason, * XSLT provides a mechanism for disabling output escaping. * An xsl:value-of or xsl:text element may have a * disable-output-escaping attribute; the allowed values * are yes or no; the default is no; if the value is yes, * then a text node generated by instantiating the xsl:value-of * or xsl:text element should be output without any escaping. * @see disable-output-escaping in XSLT Specification * * @return Boolean value of "disable-output-escaping" attribute. */ public boolean getDisableOutputEscaping() { return m_disableOutputEscaping; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_TEXTLITERALRESULT; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return "#Text"; } /** * Copy the text literal to the result tree. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { try { SerializationHandler rth = transformer.getResultTreeHandler(); if (transformer.getDebug()) { // flush any pending cached processing before the trace event. rth.flushPending(); transformer.getTraceManager().fireTraceEvent(this); } if (m_disableOutputEscaping) { rth.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); } rth.characters(m_ch, 0, m_ch.length); if (m_disableOutputEscaping) { rth.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } } catch(SAXException se) { throw new TransformerException(se); } finally { if (transformer.getDebug()) { try { // flush any pending cached processing before sending the trace event transformer.getResultTreeHandler().flushPending(); transformer.getTraceManager().fireTraceEndEvent(this); } catch (SAXException se) { throw new TransformerException(se); } } } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemTemplateElement.java0000644000175000017500000013241210721374032025735 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemTemplateElement.java 475981 2006-11-16 23:35:53Z minchau $ */ package org.apache.xalan.templates; import java.io.Serializable; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.UnImplNode; import org.apache.xpath.ExpressionNode; import org.apache.xpath.WhitespaceStrippingElementMatcher; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.helpers.NamespaceSupport; /** * An instance of this class represents an element inside * an xsl:template class. It has a single "execute" method * which is expected to perform the given action on the * result tree. * This class acts like a Element node, and implements the * Element interface, but is not a full implementation * of that interface... it only implements enough for * basic traversal of the tree. * * @see Stylesheet * @xsl.usage advanced */ public class ElemTemplateElement extends UnImplNode implements PrefixResolver, Serializable, ExpressionNode, WhitespaceStrippingElementMatcher, XSLTVisitable { static final long serialVersionUID = 4440018597841834447L; /** * Construct a template element instance. * */ public ElemTemplateElement(){} /** * Tell if this template is a compiled template. * * @return Boolean flag indicating whether this is a compiled template */ public boolean isCompiledTemplate() { return false; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_UNDEFINED; } /** * Return the node name. * * @return An invalid node name */ public String getNodeName() { return "Unknown XSLT Element"; } /** * For now, just return the result of getNodeName(), which * the local name. * * @return The result of getNodeName(). */ public String getLocalName() { return getNodeName(); } /** * This function will be called on top-level elements * only, just before the transform begins. * * @param transformer The XSLT TransformerFactory. * * @throws TransformerException */ public void runtimeInit(TransformerImpl transformer) throws TransformerException{} /** * Execute the element's primary function. Subclasses of this * function may recursivly execute down the element tree. * * @param transformer The XSLT TransformerFactory. * * @throws TransformerException if any checked exception occurs. */ public void execute( TransformerImpl transformer) throws TransformerException{} /** * Get the owning "composed" stylesheet. This looks up the * inheritance chain until it calls getStylesheetComposed * on a Stylesheet object, which will Get the owning * aggregated stylesheet, or that stylesheet if it is aggregated. * * @return the owning "composed" stylesheet. */ public StylesheetComposed getStylesheetComposed() { return m_parentNode.getStylesheetComposed(); } /** * Get the owning stylesheet. This looks up the * inheritance chain until it calls getStylesheet * on a Stylesheet object, which will return itself. * * @return the owning stylesheet */ public Stylesheet getStylesheet() { return (null==m_parentNode) ? null : m_parentNode.getStylesheet(); } /** * Get the owning root stylesheet. This looks up the * inheritance chain until it calls StylesheetRoot * on a Stylesheet object, which will return a reference * to the root stylesheet. * * @return the owning root stylesheet */ public StylesheetRoot getStylesheetRoot() { return m_parentNode.getStylesheetRoot(); } /** * This function is called during recomposition to * control how this element is composed. */ public void recompose(StylesheetRoot root) throws TransformerException { } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { resolvePrefixTables(); ElemTemplateElement t = getFirstChildElem(); m_hasTextLitOnly = ((t != null) && (t.getXSLToken() == Constants.ELEMNAME_TEXTLITERALRESULT) && (t.getNextSiblingElem() == null)); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); cstate.pushStackMark(); } /** * This after the template's children have been composed. */ public void endCompose(StylesheetRoot sroot) throws TransformerException { StylesheetRoot.ComposeState cstate = sroot.getComposeState(); cstate.popStackMark(); } /** * Throw a template element runtime error. (Note: should we throw a TransformerException instead?) * * @param msg key of the error that occured. * @param args Arguments to be used in the message */ public void error(String msg, Object[] args) { String themsg = XSLMessages.createMessage(msg, args); throw new RuntimeException(XSLMessages.createMessage( XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR, new Object[]{ themsg })); } /* * Throw an error. * * @param msg Message key for the error * */ public void error(String msg) { error(msg, null); } // Implemented DOM Element methods. /** * Add a child to the child list. * NOTE: This presumes the child did not previously have a parent. * Making that assumption makes this a less expensive operation -- but * requires that if you *do* want to reparent a node, you use removeChild() * first to remove it from its previous context. Failing to do so will * damage the tree. * * @param newChild Child to be added to child list * * @return Child just added to the child list * @throws DOMException */ public Node appendChild(Node newChild) throws DOMException { if (null == newChild) { error(XSLTErrorResources.ER_NULL_CHILD, null); //"Trying to add a null child!"); } ElemTemplateElement elem = (ElemTemplateElement) newChild; if (null == m_firstChild) { m_firstChild = elem; } else { ElemTemplateElement last = (ElemTemplateElement) getLastChild(); last.m_nextSibling = elem; } elem.m_parentNode = this; return newChild; } /** * Add a child to the child list. * NOTE: This presumes the child did not previously have a parent. * Making that assumption makes this a less expensive operation -- but * requires that if you *do* want to reparent a node, you use removeChild() * first to remove it from its previous context. Failing to do so will * damage the tree. * * @param elem Child to be added to child list * * @return Child just added to the child list */ public ElemTemplateElement appendChild(ElemTemplateElement elem) { if (null == elem) { error(XSLTErrorResources.ER_NULL_CHILD, null); //"Trying to add a null child!"); } if (null == m_firstChild) { m_firstChild = elem; } else { ElemTemplateElement last = getLastChildElem(); last.m_nextSibling = elem; } elem.setParentElem(this); return elem; } /** * Tell if there are child nodes. * * @return True if there are child nodes */ public boolean hasChildNodes() { return (null != m_firstChild); } /** * Get the type of the node. * * @return Constant for this node type */ public short getNodeType() { return org.w3c.dom.Node.ELEMENT_NODE; } /** * Return the nodelist (same reference). * * @return The nodelist containing the child nodes (this) */ public NodeList getChildNodes() { return this; } /** * Remove a child. * ADDED 9/8/200 to support compilation. * TODO: ***** Alternative is "removeMe() from my parent if any" * ... which is less well checked, but more convenient in some cases. * Given that we assume only experts are calling this class, it might * be preferable. It's less DOMish, though. * * @param childETE The child to remove. This operation is a no-op * if oldChild is not a child of this node. * * @return the removed child, or null if the specified * node was not a child of this element. */ public ElemTemplateElement removeChild(ElemTemplateElement childETE) { if (childETE == null || childETE.m_parentNode != this) return null; // Pointers to the child if (childETE == m_firstChild) m_firstChild = childETE.m_nextSibling; else { ElemTemplateElement prev = childETE.getPreviousSiblingElem(); prev.m_nextSibling = childETE.m_nextSibling; } // Pointers from the child childETE.m_parentNode = null; childETE.m_nextSibling = null; return childETE; } /** * Replace the old child with a new child. * * @param newChild New child to replace with * @param oldChild Old child to be replaced * * @return The new child * * @throws DOMException */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if (oldChild == null || oldChild.getParentNode() != this) return null; ElemTemplateElement newChildElem = ((ElemTemplateElement) newChild); ElemTemplateElement oldChildElem = ((ElemTemplateElement) oldChild); // Fix up previous sibling. ElemTemplateElement prev = (ElemTemplateElement) oldChildElem.getPreviousSibling(); if (null != prev) prev.m_nextSibling = newChildElem; // Fix up parent (this) if (m_firstChild == oldChildElem) m_firstChild = newChildElem; newChildElem.m_parentNode = this; oldChildElem.m_parentNode = null; newChildElem.m_nextSibling = oldChildElem.m_nextSibling; oldChildElem.m_nextSibling = null; // newChildElem.m_stylesheet = oldChildElem.m_stylesheet; // oldChildElem.m_stylesheet = null; return newChildElem; } /** * Unimplemented. See org.w3c.dom.Node * * @param newChild New child node to insert * @param refChild Insert in front of this child * * @return null * * @throws DOMException */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { if(null == refChild) { appendChild(newChild); return newChild; } if(newChild == refChild) { // hmm... return newChild; } Node node = m_firstChild; Node prev = null; boolean foundit = false; while (null != node) { // If the newChild is already in the tree, it is first removed. if(newChild == node) { if(null != prev) ((ElemTemplateElement)prev).m_nextSibling = (ElemTemplateElement)node.getNextSibling(); else m_firstChild = (ElemTemplateElement)node.getNextSibling(); node = node.getNextSibling(); continue; // prev remains the same. } if(refChild == node) { if(null != prev) { ((ElemTemplateElement)prev).m_nextSibling = (ElemTemplateElement)newChild; } else { m_firstChild = (ElemTemplateElement)newChild; } ((ElemTemplateElement)newChild).m_nextSibling = (ElemTemplateElement)refChild; ((ElemTemplateElement)newChild).setParentElem(this); prev = newChild; node = node.getNextSibling(); foundit = true; continue; } prev = node; node = node.getNextSibling(); } if(!foundit) throw new DOMException(DOMException.NOT_FOUND_ERR, "refChild was not found in insertBefore method!"); else return newChild; } /** * Replace the old child with a new child. * * @param newChildElem New child to replace with * @param oldChildElem Old child to be replaced * * @return The new child * * @throws DOMException */ public ElemTemplateElement replaceChild(ElemTemplateElement newChildElem, ElemTemplateElement oldChildElem) { if (oldChildElem == null || oldChildElem.getParentElem() != this) return null; // Fix up previous sibling. ElemTemplateElement prev = oldChildElem.getPreviousSiblingElem(); if (null != prev) prev.m_nextSibling = newChildElem; // Fix up parent (this) if (m_firstChild == oldChildElem) m_firstChild = newChildElem; newChildElem.m_parentNode = this; oldChildElem.m_parentNode = null; newChildElem.m_nextSibling = oldChildElem.m_nextSibling; oldChildElem.m_nextSibling = null; // newChildElem.m_stylesheet = oldChildElem.m_stylesheet; // oldChildElem.m_stylesheet = null; return newChildElem; } /** * NodeList method: Count the immediate children of this node * * @return The count of children of this node */ public int getLength() { // It is assumed that the getChildNodes call synchronized // the children. Therefore, we can access the first child // reference directly. int count = 0; for (ElemTemplateElement node = m_firstChild; node != null; node = node.m_nextSibling) { count++; } return count; } // getLength():int /** * NodeList method: Return the Nth immediate child of this node, or * null if the index is out of bounds. * * @param index Index of child to find * @return org.w3c.dom.Node: the child node at given index */ public Node item(int index) { // It is assumed that the getChildNodes call synchronized // the children. Therefore, we can access the first child // reference directly. ElemTemplateElement node = m_firstChild; for (int i = 0; i < index && node != null; i++) { node = node.m_nextSibling; } return node; } // item(int):Node /** * Get the stylesheet owner. * * @return The stylesheet owner */ public Document getOwnerDocument() { return getStylesheet(); } /** * Get the owning xsl:template element. * * @return The owning xsl:template element, this element if it is a xsl:template, or null if not found. */ public ElemTemplate getOwnerXSLTemplate() { ElemTemplateElement el = this; int type = el.getXSLToken(); while((null != el) && (type != Constants.ELEMNAME_TEMPLATE)) { el = el.getParentElem(); if(null != el) type = el.getXSLToken(); } return (ElemTemplate)el; } /** * Return the element name. * * @return The element name */ public String getTagName() { return getNodeName(); } /** * Tell if this element only has one text child, for optimization purposes. * @return true of this element only has one text literal child. */ public boolean hasTextLitOnly() { return m_hasTextLitOnly; } /** * Return the base identifier. * * @return The base identifier */ public String getBaseIdentifier() { // Should this always be absolute? return this.getSystemId(); } /** line number where the current document event ends. * @serial */ private int m_lineNumber; /** line number where the current document event ends. * @serial */ private int m_endLineNumber; /** * Return the line number where the current document event ends. * Note that this is the line position of the first character * after the text associated with the document event. * @return The line number, or -1 if none is available. * @see #getColumnNumber */ public int getEndLineNumber() { return m_endLineNumber; } /** * Return the line number where the current document event ends. * Note that this is the line position of the first character * after the text associated with the document event. * @return The line number, or -1 if none is available. * @see #getColumnNumber */ public int getLineNumber() { return m_lineNumber; } /** the column number where the current document event ends. * @serial */ private int m_columnNumber; /** the column number where the current document event ends. * @serial */ private int m_endColumnNumber; /** * Return the column number where the current document event ends. * Note that this is the column number of the first * character after the text associated with the document * event. The first column in a line is position 1. * @return The column number, or -1 if none is available. * @see #getLineNumber */ public int getEndColumnNumber() { return m_endColumnNumber; } /** * Return the column number where the current document event ends. * Note that this is the column number of the first * character after the text associated with the document * event. The first column in a line is position 1. * @return The column number, or -1 if none is available. * @see #getLineNumber */ public int getColumnNumber() { return m_columnNumber; } /** * Return the public identifier for the current document event. *

        This will be the public identifier * @return A string containing the public identifier, or * null if none is available. * @see #getSystemId */ public String getPublicId() { return (null != m_parentNode) ? m_parentNode.getPublicId() : null; } /** * Return the system identifier for the current document event. * *

        If the system identifier is a URL, the parser must resolve it * fully before passing it to the application.

        * * @return A string containing the system identifier, or null * if none is available. * @see #getPublicId */ public String getSystemId() { Stylesheet sheet=getStylesheet(); return (sheet==null) ? null : sheet.getHref(); } /** * Set the location information for this element. * * @param locator Source Locator with location information for this element */ public void setLocaterInfo(SourceLocator locator) { m_lineNumber = locator.getLineNumber(); m_columnNumber = locator.getColumnNumber(); } /** * Set the end location information for this element. * * @param locator Source Locator with location information for this element */ public void setEndLocaterInfo(SourceLocator locator) { m_endLineNumber = locator.getLineNumber(); m_endColumnNumber = locator.getColumnNumber(); } /** * Tell if this element has the default space handling * turned off or on according to the xml:space attribute. * @serial */ private boolean m_defaultSpace = true; /** * Tell if this element only has one text child, for optimization purposes. * @serial */ private boolean m_hasTextLitOnly = false; /** * Tell if this element only has one text child, for optimization purposes. * @serial */ protected boolean m_hasVariableDecl = false; public boolean hasVariableDecl() { return m_hasVariableDecl; } /** * Set the "xml:space" attribute. * A text node is preserved if an ancestor element of the text node * has an xml:space attribute with a value of preserve, and * no closer ancestor element has xml:space with a value of default. * @see strip in XSLT Specification * @see section-Creating-Text in XSLT Specification * * @param v Enumerated value, either Constants.ATTRVAL_PRESERVE * or Constants.ATTRVAL_STRIP. */ public void setXmlSpace(int v) { m_defaultSpace = ((Constants.ATTRVAL_STRIP == v) ? true : false); } /** * Get the "xml:space" attribute. * A text node is preserved if an ancestor element of the text node * has an xml:space attribute with a value of preserve, and * no closer ancestor element has xml:space with a value of default. * @see strip in XSLT Specification * @see section-Creating-Text in XSLT Specification * * @return The value of the xml:space attribute */ public boolean getXmlSpace() { return m_defaultSpace; } /** * The list of namespace declarations for this element only. * @serial */ private List m_declaredPrefixes; /** * Return a table that contains all prefixes available * within this element context. * * @return Vector containing the prefixes available within this * element context */ public List getDeclaredPrefixes() { return m_declaredPrefixes; } /** * From the SAX2 helper class, set the namespace table for * this element. Take care to call resolveInheritedNamespaceDecls. * after all namespace declarations have been added. * * @param nsSupport non-null reference to NamespaceSupport from * the ContentHandler. * * @throws TransformerException */ public void setPrefixes(NamespaceSupport nsSupport) throws TransformerException { setPrefixes(nsSupport, false); } /** * Copy the namespace declarations from the NamespaceSupport object. * Take care to call resolveInheritedNamespaceDecls. * after all namespace declarations have been added. * * @param nsSupport non-null reference to NamespaceSupport from * the ContentHandler. * @param excludeXSLDecl true if XSLT namespaces should be ignored. * * @throws TransformerException */ public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl) throws TransformerException { Enumeration decls = nsSupport.getDeclaredPrefixes(); while (decls.hasMoreElements()) { String prefix = (String) decls.nextElement(); if (null == m_declaredPrefixes) m_declaredPrefixes = new ArrayList(); String uri = nsSupport.getURI(prefix); if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL)) continue; // System.out.println("setPrefixes - "+prefix+", "+uri); XMLNSDecl decl = new XMLNSDecl(prefix, uri, false); m_declaredPrefixes.add(decl); } } /** * Fullfill the PrefixResolver interface. Calling this for this class * will throw an error. * * @param prefix The prefix to look up, which may be an empty string ("") * for the default Namespace. * @param context The node context from which to look up the URI. * * @return null if the error listener does not choose to throw an exception. */ public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null); return null; } /** * Given a namespace, get the corrisponding prefix. * 9/15/00: This had been iteratively examining the m_declaredPrefixes * field for this node and its parents. That makes life difficult for * the compilation experiment, which doesn't have a static vector of * local declarations. Replaced a recursive solution, which permits * easier subclassing/overriding. * * @param prefix non-null reference to prefix string, which should map * to a namespace URL. * * @return The namespace URL that the prefix maps to, or null if no * mapping can be found. */ public String getNamespaceForPrefix(String prefix) { // if (null != prefix && prefix.equals("xmlns")) // { // return Constants.S_XMLNAMESPACEURI; // } List nsDecls = m_declaredPrefixes; if (null != nsDecls) { int n = nsDecls.size(); if(prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX)) { prefix = ""; } for (int i = 0; i < n; i++) { XMLNSDecl decl = (XMLNSDecl) nsDecls.get(i); if (prefix.equals(decl.getPrefix())) return decl.getURI(); } } // Not found; ask our ancestors if (null != m_parentNode) return m_parentNode.getNamespaceForPrefix(prefix); // JJK: No ancestors; try implicit // %REVIEW% Are there literals somewhere that we should use instead? // %REVIEW% Is this really the best place to patch? if("xml".equals(prefix)) return "http://www.w3.org/XML/1998/namespace"; // No parent, so no definition return null; } /** * The table of {@link XMLNSDecl}s for this element * and all parent elements, screened for excluded prefixes. * @serial */ private List m_prefixTable; /** * Return a table that contains all prefixes available * within this element context. * * @return reference to vector of {@link XMLNSDecl}s, which may be null. */ List getPrefixTable() { return m_prefixTable; } void setPrefixTable(List list) { m_prefixTable = list; } /** * Get whether or not the passed URL is contained flagged by * the "extension-element-prefixes" property. This method is overridden * by {@link ElemLiteralResult#containsExcludeResultPrefix}. * @see extension-element in XSLT Specification * * @param prefix non-null reference to prefix that might be excluded. * * @return true if the prefix should normally be excluded. */ public boolean containsExcludeResultPrefix(String prefix, String uri) { ElemTemplateElement parent = this.getParentElem(); if(null != parent) return parent.containsExcludeResultPrefix(prefix, uri); return false; } /** * Tell if the result namespace decl should be excluded. Should be called before * namespace aliasing (I think). * * @param prefix non-null reference to prefix. * @param uri reference to namespace that prefix maps to, which is protected * for null, but should really never be passed as null. * * @return true if the given namespace should be excluded. * * @throws TransformerException */ private boolean excludeResultNSDecl(String prefix, String uri) throws TransformerException { if (uri != null) { if (uri.equals(Constants.S_XSLNAMESPACEURL) || getStylesheet().containsExtensionElementURI(uri)) return true; if (containsExcludeResultPrefix(prefix, uri)) return true; } return false; } /** * Combine the parent's namespaces with this namespace * for fast processing, taking care to reference the * parent's namespace if this namespace adds nothing new. * (Recursive method, walking the elements depth-first, * processing parents before children). * Note that this method builds m_prefixTable with aliased * namespaces, *not* the original namespaces. * * @throws TransformerException */ public void resolvePrefixTables() throws TransformerException { // Always start with a fresh prefix table! setPrefixTable(null); // If we have declared declarations, then we look for // a parent that has namespace decls, and add them // to this element's decls. Otherwise we just point // to the parent that has decls. if (null != this.m_declaredPrefixes) { StylesheetRoot stylesheet = this.getStylesheetRoot(); // Add this element's declared prefixes to the // prefix table. int n = m_declaredPrefixes.size(); for (int i = 0; i < n; i++) { XMLNSDecl decl = (XMLNSDecl) m_declaredPrefixes.get(i); String prefix = decl.getPrefix(); String uri = decl.getURI(); if(null == uri) uri = ""; boolean shouldExclude = excludeResultNSDecl(prefix, uri); // Create a new prefix table if one has not already been created. if (null == m_prefixTable) setPrefixTable(new ArrayList()); NamespaceAlias nsAlias = stylesheet.getNamespaceAliasComposed(uri); if(null != nsAlias) { // Should I leave the non-aliased element in the table as // an excluded element? // The exclusion should apply to the non-aliased prefix, so // we don't calculate it here. -sb // Use stylesheet prefix, as per xsl WG decl = new XMLNSDecl(nsAlias.getStylesheetPrefix(), nsAlias.getResultNamespace(), shouldExclude); } else decl = new XMLNSDecl(prefix, uri, shouldExclude); m_prefixTable.add(decl); } } ElemTemplateElement parent = this.getParentNodeElem(); if (null != parent) { // The prefix table of the parent should never be null! List prefixes = parent.m_prefixTable; if (null == m_prefixTable && !needToCheckExclude()) { // Nothing to combine, so just use parent's table! setPrefixTable(parent.m_prefixTable); } else { // Add the prefixes from the parent's prefix table. int n = prefixes.size(); for (int i = 0; i < n; i++) { XMLNSDecl decl = (XMLNSDecl) prefixes.get(i); boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(), decl.getURI()); if (shouldExclude != decl.getIsExcluded()) { decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(), shouldExclude); } //m_prefixTable.addElement(decl); addOrReplaceDecls(decl); } } } else if (null == m_prefixTable) { // Must be stylesheet element without any result prefixes! setPrefixTable(new ArrayList()); } } /** * Add or replace this namespace declaration in list * of namespaces in scope for this element. * * @param newDecl namespace declaration to add to list */ void addOrReplaceDecls(XMLNSDecl newDecl) { int n = m_prefixTable.size(); for (int i = n - 1; i >= 0; i--) { XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i); if (decl.getPrefix().equals(newDecl.getPrefix())) { return; } } m_prefixTable.add(newDecl); } /** * Return whether we need to check namespace prefixes * against and exclude result prefixes list. */ boolean needToCheckExclude() { return false; } /** * Send startPrefixMapping events to the result tree handler * for all declared prefix mappings in the stylesheet. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ void executeNSDecls(TransformerImpl transformer) throws TransformerException { executeNSDecls(transformer, null); } /** * Send startPrefixMapping events to the result tree handler * for all declared prefix mappings in the stylesheet. * * @param transformer non-null reference to the the current transform-time state. * @param ignorePrefix string prefix to not startPrefixMapping * * @throws TransformerException */ void executeNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException { try { if (null != m_prefixTable) { SerializationHandler rhandler = transformer.getResultTreeHandler(); int n = m_prefixTable.size(); for (int i = n - 1; i >= 0; i--) { XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i); if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix))) { rhandler.startPrefixMapping(decl.getPrefix(), decl.getURI(), true); } } } } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } } /** * Send endPrefixMapping events to the result tree handler * for all declared prefix mappings in the stylesheet. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ void unexecuteNSDecls(TransformerImpl transformer) throws TransformerException { unexecuteNSDecls(transformer, null); } /** * Send endPrefixMapping events to the result tree handler * for all declared prefix mappings in the stylesheet. * * @param transformer non-null reference to the the current transform-time state. * @param ignorePrefix string prefix to not endPrefixMapping * * @throws TransformerException */ void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException { try { if (null != m_prefixTable) { SerializationHandler rhandler = transformer.getResultTreeHandler(); int n = m_prefixTable.size(); for (int i = 0; i < n; i++) { XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i); if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix))) { rhandler.endPrefixMapping(decl.getPrefix()); } } } } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } } /** The *relative* document order number of this element. * @serial */ protected int m_docOrderNumber = -1; /** * Set the UID (document order index). * * @param i Index of this child. */ public void setUid(int i) { m_docOrderNumber = i; } /** * Get the UID (document order index). * * @return Index of this child */ public int getUid() { return m_docOrderNumber; } /** * Parent node. * @serial */ protected ElemTemplateElement m_parentNode; /** * Get the parent as a Node. * * @return This node's parent node */ public Node getParentNode() { return m_parentNode; } /** * Get the parent as an ElemTemplateElement. * * @return This node's parent as an ElemTemplateElement */ public ElemTemplateElement getParentElem() { return m_parentNode; } /** * Set the parent as an ElemTemplateElement. * * @param p This node's parent as an ElemTemplateElement */ public void setParentElem(ElemTemplateElement p) { m_parentNode = p; } /** * Next sibling. * @serial */ ElemTemplateElement m_nextSibling; /** * Get the next sibling (as a Node) or return null. * * @return this node's next sibling or null */ public Node getNextSibling() { return m_nextSibling; } /** * Get the previous sibling (as a Node) or return null. * Note that this may be expensive if the parent has many kids; * we accept that price in exchange for avoiding the prev pointer * TODO: If we were sure parents and sibs are always ElemTemplateElements, * we could hit the fields directly rather than thru accessors. * * @return This node's previous sibling or null */ public Node getPreviousSibling() { Node walker = getParentNode(), prev = null; if (walker != null) for (walker = walker.getFirstChild(); walker != null; prev = walker, walker = walker.getNextSibling()) { if (walker == this) return prev; } return null; } /** * Get the previous sibling (as a Node) or return null. * Note that this may be expensive if the parent has many kids; * we accept that price in exchange for avoiding the prev pointer * TODO: If we were sure parents and sibs are always ElemTemplateElements, * we could hit the fields directly rather than thru accessors. * * @return This node's previous sibling or null */ public ElemTemplateElement getPreviousSiblingElem() { ElemTemplateElement walker = getParentNodeElem(); ElemTemplateElement prev = null; if (walker != null) for (walker = walker.getFirstChildElem(); walker != null; prev = walker, walker = walker.getNextSiblingElem()) { if (walker == this) return prev; } return null; } /** * Get the next sibling (as a ElemTemplateElement) or return null. * * @return This node's next sibling (as a ElemTemplateElement) or null */ public ElemTemplateElement getNextSiblingElem() { return m_nextSibling; } /** * Get the parent element. * * @return This node's next parent (as a ElemTemplateElement) or null */ public ElemTemplateElement getParentNodeElem() { return m_parentNode; } /** * First child. * @serial */ ElemTemplateElement m_firstChild; /** * Get the first child as a Node. * * @return This node's first child or null */ public Node getFirstChild() { return m_firstChild; } /** * Get the first child as a ElemTemplateElement. * * @return This node's first child (as a ElemTemplateElement) or null */ public ElemTemplateElement getFirstChildElem() { return m_firstChild; } /** * Get the last child. * * @return This node's last child */ public Node getLastChild() { ElemTemplateElement lastChild = null; for (ElemTemplateElement node = m_firstChild; node != null; node = node.m_nextSibling) { lastChild = node; } return lastChild; } /** * Get the last child. * * @return This node's last child */ public ElemTemplateElement getLastChildElem() { ElemTemplateElement lastChild = null; for (ElemTemplateElement node = m_firstChild; node != null; node = node.m_nextSibling) { lastChild = node; } return lastChild; } /** DOM backpointer that this element originated from. */ transient private org.w3c.dom.Node m_DOMBackPointer; /** * If this stylesheet was created from a DOM, get the * DOM backpointer that this element originated from. * For tooling use. * * @return DOM backpointer that this element originated from or null. */ public org.w3c.dom.Node getDOMBackPointer() { return m_DOMBackPointer; } /** * If this stylesheet was created from a DOM, set the * DOM backpointer that this element originated from. * For tooling use. * * @param n DOM backpointer that this element originated from. */ public void setDOMBackPointer(org.w3c.dom.Node n) { m_DOMBackPointer = n; } /** * Compares this object with the specified object for precedence order. * The order is determined by the getImportCountComposed() of the containing * composed stylesheet and the getUid() of this element. * Returns a negative integer, zero, or a positive integer as this * object is less than, equal to, or greater than the specified object. * * @param o The object to be compared to this object * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. * @throws ClassCastException if the specified object's * type prevents it from being compared to this Object. */ public int compareTo(Object o) throws ClassCastException { ElemTemplateElement ro = (ElemTemplateElement) o; int roPrecedence = ro.getStylesheetComposed().getImportCountComposed(); int myPrecedence = this.getStylesheetComposed().getImportCountComposed(); if (myPrecedence < roPrecedence) return -1; else if (myPrecedence > roPrecedence) return 1; else return this.getUid() - ro.getUid(); } /** * Get information about whether or not an element should strip whitespace. * @see strip in XSLT Specification * * @param support The XPath runtime state. * @param targetElement Element to check * * @return true if the whitespace should be stripped. * * @throws TransformerException */ public boolean shouldStripWhiteSpace( org.apache.xpath.XPathContext support, org.w3c.dom.Element targetElement) throws TransformerException { StylesheetRoot sroot = this.getStylesheetRoot(); return (null != sroot) ? sroot.shouldStripWhiteSpace(support, targetElement) :false; } /** * Get information about whether or not whitespace can be stripped. * @see strip in XSLT Specification * * @return true if the whitespace can be stripped. */ public boolean canStripWhiteSpace() { StylesheetRoot sroot = this.getStylesheetRoot(); return (null != sroot) ? sroot.canStripWhiteSpace() : false; } /** * Tell if this element can accept variable declarations. * @return true if the element can accept and process variable declarations. */ public boolean canAcceptVariables() { return true; } //=============== ExpressionNode methods ================ /** * Set the parent of this node. * @param n Must be a ElemTemplateElement. */ public void exprSetParent(ExpressionNode n) { // This obviously requires that only a ElemTemplateElement can // parent a node of this type. setParentElem((ElemTemplateElement)n); } /** * Get the ExpressionNode parent of this node. */ public ExpressionNode exprGetParent() { return getParentElem(); } /** * This method tells the node to add its argument to the node's * list of children. * @param n Must be a ElemTemplateElement. */ public void exprAddChild(ExpressionNode n, int i) { appendChild((ElemTemplateElement)n); } /** This method returns a child node. The children are numbered from zero, left to right. */ public ExpressionNode exprGetChild(int i) { return (ExpressionNode)item(i); } /** Return the number of children the node has. */ public int exprGetNumChildren() { return getLength(); } /** * Accept a visitor and call the appropriate method * for this class. * * @param visitor The visitor whose appropriate method will be called. * @return true if the children of the object should be visited. */ protected boolean accept(XSLTVisitor visitor) { return visitor.visitInstruction(this); } /** * @see XSLTVisitable#callVisitors(XSLTVisitor) */ public void callVisitors(XSLTVisitor visitor) { if(accept(visitor)) { callChildVisitors(visitor); } } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttributes) { for (ElemTemplateElement node = m_firstChild; node != null; node = node.m_nextSibling) { node.callVisitors(visitor); } } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor) { callChildVisitors(visitor, true); } /** * @see PrefixResolver#handlesNullPrefixes() */ public boolean handlesNullPrefixes() { return false; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/StylesheetComposed.java0000644000175000017500000002566710721374032025705 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StylesheetComposed.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Vector; import javax.xml.transform.TransformerException; /** * Represents a stylesheet that has methods that resolve includes and * imports. It has methods on it that * return "composed" properties, which mean that: *
          *
        1. Properties that are aggregates, like OutputProperties, will * be composed of properties declared in this stylsheet and all * included stylesheets.
        2. *
        3. Properties that aren't found, will be searched for first in * the includes, and, if none are located, will be searched for in * the imports.
        4. *
        5. Properties in that are not atomic on a stylesheet will * have the form getXXXComposed. Some properties, like version and id, * are not inherited, and so won't have getXXXComposed methods.
        6. *
        *

        In some cases getXXXComposed methods may calculate the composed * values dynamically, while in other cases they may store the composed * values.

        */ public class StylesheetComposed extends Stylesheet { static final long serialVersionUID = -3444072247410233923L; /** * Uses an XSL stylesheet document. * @param parent The including or importing stylesheet. */ public StylesheetComposed(Stylesheet parent) { super(parent); } /** * Tell if this can be cast to a StylesheetComposed, meaning, you * can ask questions from getXXXComposed functions. * * @return True since this is a StylesheetComposed */ public boolean isAggregatedType() { return true; } /** * Adds all recomposable values for this precedence level into the recomposableElements Vector * that was passed in as the first parameter. All elements added to the * recomposableElements vector should extend ElemTemplateElement. * @param recomposableElements a Vector of ElemTemplateElement objects that we will add all of * our recomposable objects to. */ public void recompose(Vector recomposableElements) throws TransformerException { //recomposeImports(); // Calculate the number of this import. //recomposeIncludes(this); // Build the global include list for this stylesheet. // Now add in all of the recomposable elements at this precedence level int n = getIncludeCountComposed(); for (int i = -1; i < n; i++) { Stylesheet included = getIncludeComposed(i); // Add in the output elements int s = included.getOutputCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getOutput(j)); } // Next, add in the attribute-set elements s = included.getAttributeSetCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getAttributeSet(j)); } // Now the decimal-formats s = included.getDecimalFormatCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getDecimalFormat(j)); } // Now the keys s = included.getKeyCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getKey(j)); } // And the namespace aliases s = included.getNamespaceAliasCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getNamespaceAlias(j)); } // Next comes the templates s = included.getTemplateCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getTemplate(j)); } // Then, the variables s = included.getVariableOrParamCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getVariableOrParam(j)); } // And lastly the whitespace preserving and stripping elements s = included.getStripSpaceCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getStripSpace(j)); } s = included.getPreserveSpaceCount(); for (int j = 0; j < s; j++) { recomposableElements.addElement(included.getPreserveSpace(j)); } } } /** Order in import chain. * @serial */ private int m_importNumber = -1; /** The precedence of this stylesheet in the global import list. * The lowest precedence stylesheet is 0. A higher * number has a higher precedence. * @serial */ private int m_importCountComposed; /* The count of imports composed for this stylesheet */ private int m_endImportCountComposed; /** * Recalculate the precedence of this stylesheet in the global * import list. The lowest precedence stylesheet is 0. A higher * number has a higher precedence. */ void recomposeImports() { m_importNumber = getStylesheetRoot().getImportNumber(this); StylesheetRoot root = getStylesheetRoot(); int globalImportCount = root.getGlobalImportCount(); m_importCountComposed = (globalImportCount - m_importNumber) - 1; // Now get the count of composed imports from this stylesheet's imports int count = getImportCount(); if ( count > 0) { m_endImportCountComposed += count; while (count > 0) m_endImportCountComposed += this.getImport(--count).getEndImportCountComposed(); } // Now get the count of composed imports from this stylesheet's // composed includes. count = getIncludeCountComposed(); while (count>0) { int imports = getIncludeComposed(--count).getImportCount(); m_endImportCountComposed += imports; while (imports > 0) m_endImportCountComposed +=getIncludeComposed(count).getImport(--imports).getEndImportCountComposed(); } } /** * Get a stylesheet from the "import" list. * @see import in XSLT Specification * * @param i Index of stylesheet in import list * * @return The stylesheet at the given index * * @throws ArrayIndexOutOfBoundsException */ public StylesheetComposed getImportComposed(int i) throws ArrayIndexOutOfBoundsException { StylesheetRoot root = getStylesheetRoot(); // Get the stylesheet that is offset past this stylesheet. // Thus, if the index of this stylesheet is 3, an argument // to getImportComposed of 0 will return the 4th stylesheet // in the global import list. return root.getGlobalImport(1 + m_importNumber + i); } /** * Get the precedence of this stylesheet in the global import list. * The lowest precedence is 0. A higher number has a higher precedence. * @see import in XSLT Specification * * @return the precedence of this stylesheet in the global import list. */ public int getImportCountComposed() { return m_importCountComposed; } /** * Get the number of import in this stylesheet's composed list. * * @return the number of imports in this stylesheet's composed list. */ public int getEndImportCountComposed() { return m_endImportCountComposed; } /** * The combined list of includes. * @serial */ private transient Vector m_includesComposed; /** * Recompose the value of the composed include list. Builds a composite * list of all stylesheets included by this stylesheet to any depth. * * @param including Stylesheet to recompose */ void recomposeIncludes(Stylesheet including) { int n = including.getIncludeCount(); if (n > 0) { if (null == m_includesComposed) m_includesComposed = new Vector(); for (int i = 0; i < n; i++) { Stylesheet included = including.getInclude(i); m_includesComposed.addElement(included); recomposeIncludes(included); } } } /** * Get an "xsl:include" property. * @see include in XSLT Specification * * @param i Index of stylesheet in "include" list * * @return The stylesheet at the given index in the "include" list * * @throws ArrayIndexOutOfBoundsException */ public Stylesheet getIncludeComposed(int i) throws ArrayIndexOutOfBoundsException { if (-1 == i) return this; if (null == m_includesComposed) throw new ArrayIndexOutOfBoundsException(); return (Stylesheet) m_includesComposed.elementAt(i); } /** * Get the number of included stylesheets. * @see import in XSLT Specification * * @return the number of included stylesheets. */ public int getIncludeCountComposed() { return (null != m_includesComposed) ? m_includesComposed.size() : 0; } /** * For compilation support, we need the option of overwriting * (rather than appending to) previous composition. * We could phase out the old API in favor of this one, but I'm * holding off until we've made up our minds about compilation. * ADDED 9/5/2000 to support compilation experiment. * NOTE: GLP 29-Nov-00 I've left this method in so that CompilingStylesheetHandler will compile. However, * I'm not sure why it's needed or what it does and I've commented out the body. * * @see section-Defining-Template-Rules in XSLT Specification * @param flushFirst Flag indicating the option of overwriting * (rather than appending to) previous composition. * * @throws TransformerException */ public void recomposeTemplates(boolean flushFirst) throws TransformerException { /*************************************** KEEP METHOD IN FOR COMPILATION if (flushFirst) m_templateList = new TemplateList(this); recomposeTemplates(); *****************************************/ } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/AbsPathChecker.java0000644000175000017500000000544110721374032024655 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AbsPathChecker.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.axes.LocPathIterator; import org.apache.xpath.functions.FuncCurrent; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.functions.Function; import org.apache.xpath.operations.Variable; /** * This class runs over a path expression that is assumed to be absolute, and * checks for variables and the like that may make it context dependent. */ public class AbsPathChecker extends XPathVisitor { private boolean m_isAbs = true; /** * Process the LocPathIterator to see if it contains variables * or functions that may make it context dependent. * @param path LocPathIterator that is assumed to be absolute, but needs checking. * @return true if the path is confirmed to be absolute, false if it * may contain context dependencies. */ public boolean checkAbsolute(LocPathIterator path) { m_isAbs = true; path.callVisitors(null, this); return m_isAbs; } /** * Visit a function. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param func The function reference object. * @return true if the sub expressions should be traversed. */ public boolean visitFunction(ExpressionOwner owner, Function func) { if((func instanceof FuncCurrent) || (func instanceof FuncExtFunction)) m_isAbs = false; return true; } /** * Visit a variable reference. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param var The variable reference object. * @return true if the sub expressions should be traversed. */ public boolean visitVariableRef(ExpressionOwner owner, Variable var) { m_isAbs = false; return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemVariable.java0000644000175000017500000003744410721374033024407 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemVariable.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XRTreeFrag; import org.apache.xpath.objects.XRTreeFragSelectWrapper; import org.apache.xpath.objects.XString; import org.apache.xalan.res.XSLTErrorResources; /** * Implement xsl:variable. *
         * 
         * 
         * 
        * @see variables in XSLT Specification * @xsl.usage advanced */ public class ElemVariable extends ElemTemplateElement { static final long serialVersionUID = 9111131075322790061L; /** * Constructor ElemVariable * */ public ElemVariable(){} /** * This is the index into the stack frame. */ protected int m_index; /** * The stack frame size for this variable if it is a global variable * that declares an RTF, which is equal to the maximum number * of variables that can be declared in the variable at one time. */ int m_frameSize = -1; /** * Sets the relative position of this variable within the stack frame (if local) * or the global area (if global). Note that this should be called only for * global variables since the local position is computed in the compose() method. */ public void setIndex(int index) { m_index = index; } /** * If this element is not at the top-level, get the relative position of the * variable into the stack frame. If this variable is at the top-level, get * the relative position within the global area. */ public int getIndex() { return m_index; } /** * The value of the "select" attribute. * @serial */ private XPath m_selectPattern; /** * Set the "select" attribute. * If the variable-binding element has a select attribute, * then the value of the attribute must be an expression and * the value of the variable is the object that results from * evaluating the expression. In this case, the content * of the variable must be empty. * * @param v Value to set for the "select" attribute. */ public void setSelect(XPath v) { m_selectPattern = v; } /** * Get the "select" attribute. * If the variable-binding element has a select attribute, * then the value of the attribute must be an expression and * the value of the variable is the object that results from * evaluating the expression. In this case, the content * of the variable must be empty. * * @return Value of the "select" attribute. */ public XPath getSelect() { return m_selectPattern; } /** * The value of the "name" attribute. * @serial */ protected QName m_qname; /** * Set the "name" attribute. * Both xsl:variable and xsl:param have a required name * attribute, which specifies the name of the variable. The * value of the name attribute is a QName, which is expanded * as described in [2.4 Qualified Names]. * @see qname in XSLT Specification * * @param v Value to set for the "name" attribute. */ public void setName(QName v) { m_qname = v; } /** * Get the "name" attribute. * Both xsl:variable and xsl:param have a required name * attribute, which specifies the name of the variable. The * value of the name attribute is a QName, which is expanded * as described in [2.4 Qualified Names]. * @see qname in XSLT Specification * * @return Value of the "name" attribute. */ public QName getName() { return m_qname; } /** * Tells if this is a top-level variable or param, or not. * @serial */ private boolean m_isTopLevel = false; /** * Set if this is a top-level variable or param, or not. * @see top-level-variables in XSLT Specification * * @param v Boolean indicating whether this is a top-level variable * or param, or not. */ public void setIsTopLevel(boolean v) { m_isTopLevel = v; } /** * Get if this is a top-level variable or param, or not. * @see top-level-variables in XSLT Specification * * @return Boolean indicating whether this is a top-level variable * or param, or not. */ public boolean getIsTopLevel() { return m_isTopLevel; } /** * Get an integer representation of the element type. * * @return An integer representation of the element, defined in the * Constants class. * @see org.apache.xalan.templates.Constants */ public int getXSLToken() { return Constants.ELEMNAME_VARIABLE; } /** * Return the node name. * * @return The node name */ public String getNodeName() { return Constants.ELEMNAME_VARIABLE_STRING; } /** * Copy constructor. * * @param param An element created from an xsl:variable * * @throws TransformerException */ public ElemVariable(ElemVariable param) throws TransformerException { m_selectPattern = param.m_selectPattern; m_qname = param.m_qname; m_isTopLevel = param.m_isTopLevel; // m_value = param.m_value; // m_varContext = param.m_varContext; } /** * Execute a variable declaration and push it onto the variable stack. * @see variables in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); int sourceNode = transformer.getXPathContext().getCurrentNode(); XObject var = getValue(transformer, sourceNode); // transformer.getXPathContext().getVarStack().pushVariable(m_qname, var); transformer.getXPathContext().getVarStack().setLocalVariable(m_index, var); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Get the XObject representation of the variable. * * @param transformer non-null reference to the the current transform-time state. * @param sourceNode non-null reference to the current source node. * * @return the XObject representation of the variable. * * @throws TransformerException */ public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException { XObject var; XPathContext xctxt = transformer.getXPathContext(); xctxt.pushCurrentNode(sourceNode); try { if (null != m_selectPattern) { var = m_selectPattern.execute(xctxt, sourceNode, this); var.allowDetachToRelease(false); if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEvent(sourceNode, this, "select", m_selectPattern, var); } else if (null == getFirstChildElem()) { var = XString.EMPTYSTRING; } else { // Use result tree fragment. // Global variables may be deferred (see XUnresolvedVariable) and hence // need to be assigned to a different set of DTMs than local variables // so they aren't popped off the stack on return from a template. int df; // Bugzilla 7118: A variable set via an RTF may create local // variables during that computation. To keep them from overwriting // variables at this level, push a new variable stack. ////// PROBLEM: This is provoking a variable-used-before-set ////// problem in parameters. Needs more study. try { //////////xctxt.getVarStack().link(0); if(m_parentNode instanceof Stylesheet) // Global variable df = transformer.transformToGlobalRTF(this); else df = transformer.transformToRTF(this); } finally{ //////////////xctxt.getVarStack().unlink(); } var = new XRTreeFrag(df, xctxt, this); } } finally { xctxt.popCurrentNode(); } return var; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { // See if we can reduce an RTF to a select with a string expression. if(null == m_selectPattern && sroot.getOptimizer()) { XPath newSelect = rewriteChildToExpression(this); if(null != newSelect) m_selectPattern = newSelect; } StylesheetRoot.ComposeState cstate = sroot.getComposeState(); // This should be done before addVariableName, so we don't have visibility // to the variable now being defined. java.util.Vector vnames = cstate.getVariableNames(); if(null != m_selectPattern) m_selectPattern.fixupVariables(vnames, cstate.getGlobalsSize()); // Only add the variable if this is not a global. If it is a global, // it was already added by stylesheet root. if(!(m_parentNode instanceof Stylesheet) && m_qname != null) { m_index = cstate.addVariableName(m_qname) - cstate.getGlobalsSize(); } else if (m_parentNode instanceof Stylesheet) { // If this is a global, then we need to treat it as if it's a xsl:template, // and count the number of variables it contains. So we set the count to // zero here. cstate.resetStackFrameSize(); } // This has to be done after the addVariableName, so that the variable // pushed won't be immediately popped again in endCompose. super.compose(sroot); } /** * This after the template's children have been composed. We have to get * the count of how many variables have been declared, so we can do a link * and unlink. */ public void endCompose(StylesheetRoot sroot) throws TransformerException { super.endCompose(sroot); if(m_parentNode instanceof Stylesheet) { StylesheetRoot.ComposeState cstate = sroot.getComposeState(); m_frameSize = cstate.getFrameSize(); cstate.resetStackFrameSize(); } } // /** // * This after the template's children have been composed. // */ // public void endCompose() throws TransformerException // { // super.endCompose(); // } /** * If the children of a variable is a single xsl:value-of or text literal, * it is cheaper to evaluate this as an expression, so try and adapt the * child an an expression. * * @param varElem Should be a ElemParam, ElemVariable, or ElemWithParam. * * @return An XPath if rewrite is possible, else null. * * @throws TransformerException */ static XPath rewriteChildToExpression(ElemTemplateElement varElem) throws TransformerException { ElemTemplateElement t = varElem.getFirstChildElem(); // Down the line this can be done with multiple string objects using // the concat function. if (null != t && null == t.getNextSiblingElem()) { int etype = t.getXSLToken(); if (Constants.ELEMNAME_VALUEOF == etype) { ElemValueOf valueof = (ElemValueOf) t; // %TBD% I'm worried about extended attributes here. if (valueof.getDisableOutputEscaping() == false && valueof.getDOMBackPointer() == null) { varElem.m_firstChild = null; return new XPath(new XRTreeFragSelectWrapper(valueof.getSelect().getExpression())); } } else if (Constants.ELEMNAME_TEXTLITERALRESULT == etype) { ElemTextLiteral lit = (ElemTextLiteral) t; if (lit.getDisableOutputEscaping() == false && lit.getDOMBackPointer() == null) { String str = lit.getNodeValue(); XString xstr = new XString(str); varElem.m_firstChild = null; return new XPath(new XRTreeFragSelectWrapper(xstr)); } } } return null; } /** * This function is called during recomposition to * control how this element is composed. * @param root The root stylesheet for this transformation. */ public void recompose(StylesheetRoot root) { root.recomposeVariables(this); } /** * Set the parent as an ElemTemplateElement. * * @param p This node's parent as an ElemTemplateElement */ public void setParentElem(ElemTemplateElement p) { super.setParentElem(p); p.m_hasVariableDecl = true; } /** * Accept a visitor and call the appropriate method * for this class. * * @param visitor The visitor whose appropriate method will be called. * @return true if the children of the object should be visited. */ protected boolean accept(XSLTVisitor visitor) { return visitor.visitVariableOrParamDecl(this); } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(null != m_selectPattern) m_selectPattern.getExpression().callVisitors(m_selectPattern, visitor); super.callChildVisitors(visitor, callAttrs); } /** * Tell if this is a psuedo variable reference, declared by Xalan instead * of by the user. */ public boolean isPsuedoVar() { java.lang.String ns = m_qname.getNamespaceURI(); if((null != ns) && ns.equals(RedundentExprEliminator.PSUEDOVARNAMESPACE)) { if(m_qname.getLocalName().startsWith("#")) return true; } return false; } /** * Add a child to the child list. If the select attribute * is present, an error will be raised. * * @param elem New element to append to this element's children list * * @return null if the select attribute was present, otherwise the * child just added to the child list */ public ElemTemplateElement appendChild(ElemTemplateElement elem) { // cannot have content and select if (m_selectPattern != null) { error(XSLTErrorResources.ER_CANT_HAVE_CONTENT_AND_SELECT, new Object[]{"xsl:" + this.getNodeName()}); return null; } return super.appendChild(elem); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemApplyImport.java0000644000175000017500000000727410721374031025136 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemApplyImport.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; /** * Implement xsl:apply-imports. *
         * 
         * 
        * @see apply-imports in XSLT Specification * @xsl.usage advanced */ public class ElemApplyImport extends ElemTemplateElement { static final long serialVersionUID = 3764728663373024038L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return Token ID for xsl:apply-imports element types */ public int getXSLToken() { return Constants.ELEMNAME_APPLY_IMPORTS; } /** * Return the node name. * * @return Element name */ public String getNodeName() { return Constants.ELEMNAME_APPLY_IMPORTS_STRING; } /** * Execute the xsl:apply-imports transformation. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.currentTemplateRuleIsNull()) { transformer.getMsgMgr().error(this, XSLTErrorResources.ER_NO_APPLY_IMPORT_IN_FOR_EACH); //"xsl:apply-imports not allowed in a xsl:for-each"); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); int sourceNode = transformer.getXPathContext().getCurrentNode(); if (DTM.NULL != sourceNode) { // supply the current templated (matched, not named) ElemTemplate matchTemplate = transformer.getMatchedTemplate(); transformer.applyTemplateToNode(this, matchTemplate, sourceNode); } else // if(null == sourceNode) { transformer.getMsgMgr().error(this, XSLTErrorResources.ER_NULL_SOURCENODE_APPLYIMPORTS); //"sourceNode is null in xsl:apply-imports!"); } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Add a child to the child list. * * * @param newChild New element to append to this element's children list * * @return null, xsl:apply-Imports cannot have children */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); return null; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/TemplateList.java0000644000175000017500000006743710721374032024472 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TemplateList.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.dtm.DTM; import org.apache.xml.utils.QName; import org.apache.xpath.Expression; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.compiler.PsuedoNames; import org.apache.xpath.patterns.NodeTest; import org.apache.xpath.patterns.StepPattern; import org.apache.xpath.patterns.UnionPattern; /** * Encapsulates a template list, and helps locate individual templates. * @xsl.usage advanced */ public class TemplateList implements java.io.Serializable { static final long serialVersionUID = 5803675288911728791L; /** * Construct a TemplateList object. Needs to be public so it can * be invoked from the CompilingStylesheetHandler. */ public TemplateList() { super(); } /** * Add a template to the table of named templates and/or the table of templates * with match patterns. This routine should * be called in decreasing order of precedence but it checks nonetheless. * * @param template */ public void setTemplate(ElemTemplate template) { XPath matchXPath = template.getMatch(); if (null == template.getName() && null == matchXPath) { template.error(XSLTErrorResources.ER_NEED_NAME_OR_MATCH_ATTRIB, new Object[]{ "xsl:template" }); } if (null != template.getName()) { ElemTemplate existingTemplate = (ElemTemplate) m_namedTemplates.get(template.getName()); if (null == existingTemplate) { m_namedTemplates.put(template.getName(), template); } else { int existingPrecedence = existingTemplate.getStylesheetComposed().getImportCountComposed(); int newPrecedence = template.getStylesheetComposed().getImportCountComposed(); if (newPrecedence > existingPrecedence) { // This should never happen m_namedTemplates.put(template.getName(), template); } else if (newPrecedence == existingPrecedence) template.error(XSLTErrorResources.ER_DUPLICATE_NAMED_TEMPLATE, new Object[]{ template.getName() }); } } if (null != matchXPath) { Expression matchExpr = matchXPath.getExpression(); if (matchExpr instanceof StepPattern) { insertPatternInTable((StepPattern) matchExpr, template); } else if (matchExpr instanceof UnionPattern) { UnionPattern upat = (UnionPattern) matchExpr; StepPattern[] pats = upat.getPatterns(); int n = pats.length; for (int i = 0; i < n; i++) { insertPatternInTable(pats[i], template); } } else { // TODO: assert error } } } /** Flag to indicate whether in DEBUG mode */ final static boolean DEBUG = false; /** * Dump all patterns and elements that match those patterns * */ void dumpAssociationTables() { Enumeration associations = m_patternTable.elements(); while (associations.hasMoreElements()) { TemplateSubPatternAssociation head = (TemplateSubPatternAssociation) associations.nextElement(); while (null != head) { System.out.print("(" + head.getTargetString() + ", " + head.getPattern() + ")"); head = head.getNext(); } System.out.println("\n....."); } TemplateSubPatternAssociation head = m_wildCardPatterns; System.out.print("wild card list: "); while (null != head) { System.out.print("(" + head.getTargetString() + ", " + head.getPattern() + ")"); head = head.getNext(); } System.out.println("\n....."); } /** * After all templates have been added, this function * should be called. */ public void compose(StylesheetRoot sroot) { if (DEBUG) { System.out.println("Before wildcard insert..."); dumpAssociationTables(); } if (null != m_wildCardPatterns) { Enumeration associations = m_patternTable.elements(); while (associations.hasMoreElements()) { TemplateSubPatternAssociation head = (TemplateSubPatternAssociation) associations.nextElement(); TemplateSubPatternAssociation wild = m_wildCardPatterns; while (null != wild) { try { head = insertAssociationIntoList( head, (TemplateSubPatternAssociation) wild.clone(), true); } catch (CloneNotSupportedException cnse){} wild = wild.getNext(); } } } if (DEBUG) { System.out.println("After wildcard insert..."); dumpAssociationTables(); } } /** * Insert the given TemplateSubPatternAssociation into the the linked * list. Sort by import precedence, then priority, then by document order. * * @param head The first TemplateSubPatternAssociation in the linked list. * @param item The item that we want to insert into the proper place. * @param isWildCardInsert true if we are inserting a wild card * template onto this list. * @return the new head of the list. */ private TemplateSubPatternAssociation insertAssociationIntoList(TemplateSubPatternAssociation head, TemplateSubPatternAssociation item, boolean isWildCardInsert) { // Sort first by import level (higher level is at front), // then by priority (highest priority is at front), // then by document order (later in document is at front). double priority = getPriorityOrScore(item); double workPriority; int importLevel = item.getImportLevel(); int docOrder = item.getDocOrderPos(); TemplateSubPatternAssociation insertPoint = head; TemplateSubPatternAssociation next; boolean insertBefore; // true means insert before insertPoint; otherwise after // This can only be true if insertPoint is pointing to // the first or last template. // Spin down so that insertPoint points to: // (a) the template immediately _before_ the first template on the chain with // a precedence that is either (i) less than ours or (ii) the same as ours but // the template document position is less than ours // -or- // (b) the last template on the chain if no such template described in (a) exists. // If we are pointing to the first template or the last template (that is, case b), // we need to determine whether to insert before or after the template. Otherwise, // we always insert after the insertPoint. while (true) { next = insertPoint.getNext(); if (null == next) break; else { workPriority = getPriorityOrScore(next); if (importLevel > next.getImportLevel()) break; else if (importLevel < next.getImportLevel()) insertPoint = next; else if (priority > workPriority) // import precedence is equal break; else if (priority < workPriority) insertPoint = next; else if (docOrder >= next.getDocOrderPos()) // priorities, import are equal break; else insertPoint = next; } } if ( (null == next) || (insertPoint == head) ) // insert point is first or last { workPriority = getPriorityOrScore(insertPoint); if (importLevel > insertPoint.getImportLevel()) insertBefore = true; else if (importLevel < insertPoint.getImportLevel()) insertBefore = false; else if (priority > workPriority) insertBefore = true; else if (priority < workPriority) insertBefore = false; else if (docOrder >= insertPoint.getDocOrderPos()) insertBefore = true; else insertBefore = false; } else insertBefore = false; // System.out.println("appending: "+target+" to "+matchPat.getPattern()); if (isWildCardInsert) { if (insertBefore) { item.setNext(insertPoint); String key = insertPoint.getTargetString(); item.setTargetString(key); putHead(key, item); return item; } else { item.setNext(next); insertPoint.setNext(item); return head; } } else { if (insertBefore) { item.setNext(insertPoint); if (insertPoint.isWild() || item.isWild()) m_wildCardPatterns = item; else putHead(item.getTargetString(), item); return item; } else { item.setNext(next); insertPoint.setNext(item); return head; } } } /** * Add a template to the template list. * * @param pattern * @param template */ private void insertPatternInTable(StepPattern pattern, ElemTemplate template) { String target = pattern.getTargetString(); if (null != target) { String pstring = template.getMatch().getPatternString(); TemplateSubPatternAssociation association = new TemplateSubPatternAssociation(template, pattern, pstring); // See if there's already one there boolean isWildCard = association.isWild(); TemplateSubPatternAssociation head = isWildCard ? m_wildCardPatterns : getHead(target); if (null == head) { if (isWildCard) m_wildCardPatterns = association; else putHead(target, association); } else { insertAssociationIntoList(head, association, false); } } } /** * Given a match pattern and template association, return the * score of that match. This score or priority can always be * statically calculated. * * @param matchPat The match pattern to template association. * * @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, * {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or * {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}, or * the value defined by the priority attribute of the template. * */ private double getPriorityOrScore(TemplateSubPatternAssociation matchPat) { double priority = matchPat.getTemplate().getPriority(); if (priority == XPath.MATCH_SCORE_NONE) { Expression ex = matchPat.getStepPattern(); if (ex instanceof NodeTest) { return ((NodeTest) ex).getDefaultScore(); } } return priority; } /** * Locate a named template. * * @param qname Qualified name of the template. * * @return Template argument with the requested name, or null if not found. */ public ElemTemplate getTemplate(QName qname) { return (ElemTemplate) m_namedTemplates.get(qname); } /** * Get the head of the most likely list of associations to check, based on * the name and type of the targetNode argument. * * @param xctxt The XPath runtime context. * @param targetNode The target node that will be checked for a match. * @param dtm The dtm owner for the target node. * * @return The head of a linked list that contains all possible match pattern to * template associations. */ public TemplateSubPatternAssociation getHead(XPathContext xctxt, int targetNode, DTM dtm) { short targetNodeType = dtm.getNodeType(targetNode); TemplateSubPatternAssociation head; switch (targetNodeType) { case DTM.ELEMENT_NODE : case DTM.ATTRIBUTE_NODE : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getLocalName(targetNode)); break; case DTM.TEXT_NODE : case DTM.CDATA_SECTION_NODE : head = m_textPatterns; break; case DTM.ENTITY_REFERENCE_NODE : case DTM.ENTITY_NODE : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getNodeName(targetNode)); // %REVIEW% I think this is right break; case DTM.PROCESSING_INSTRUCTION_NODE : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getLocalName(targetNode)); break; case DTM.COMMENT_NODE : head = m_commentPatterns; break; case DTM.DOCUMENT_NODE : case DTM.DOCUMENT_FRAGMENT_NODE : head = m_docPatterns; break; case DTM.NOTATION_NODE : default : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getNodeName(targetNode)); // %REVIEW% I think this is right } return (null == head) ? m_wildCardPatterns : head; } /** * Given a target element, find the template that best * matches in the given XSL document, according * to the rules specified in the xsl draft. This variation of getTemplate * assumes the current node and current expression node have already been * pushed. * * @param xctxt * @param targetNode * @param mode A string indicating the display mode. * @param maxImportLevel The maximum importCountComposed that we should consider or -1 * if we should consider all import levels. This is used by apply-imports to * access templates that have been overridden. * @param quietConflictWarnings * @return Rule that best matches targetElem. * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException */ public ElemTemplate getTemplateFast(XPathContext xctxt, int targetNode, int expTypeID, QName mode, int maxImportLevel, boolean quietConflictWarnings, DTM dtm) throws TransformerException { TemplateSubPatternAssociation head; switch (dtm.getNodeType(targetNode)) { case DTM.ELEMENT_NODE : case DTM.ATTRIBUTE_NODE : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getLocalNameFromExpandedNameID(expTypeID)); break; case DTM.TEXT_NODE : case DTM.CDATA_SECTION_NODE : head = m_textPatterns; break; case DTM.ENTITY_REFERENCE_NODE : case DTM.ENTITY_NODE : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getNodeName(targetNode)); // %REVIEW% I think this is right break; case DTM.PROCESSING_INSTRUCTION_NODE : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getLocalName(targetNode)); break; case DTM.COMMENT_NODE : head = m_commentPatterns; break; case DTM.DOCUMENT_NODE : case DTM.DOCUMENT_FRAGMENT_NODE : head = m_docPatterns; break; case DTM.NOTATION_NODE : default : head = (TemplateSubPatternAssociation) m_patternTable.get( dtm.getNodeName(targetNode)); // %REVIEW% I think this is right } if(null == head) { head = m_wildCardPatterns; if(null == head) return null; } // XSLT functions, such as xsl:key, need to be able to get to // current ElemTemplateElement via a cast to the prefix resolver. // Setting this fixes bug idkey03. xctxt.pushNamespaceContextNull(); try { do { if ( (maxImportLevel > -1) && (head.getImportLevel() > maxImportLevel) ) { continue; } ElemTemplate template = head.getTemplate(); xctxt.setNamespaceContext(template); if ((head.m_stepPattern.execute(xctxt, targetNode, dtm, expTypeID) != NodeTest.SCORE_NONE) && head.matchMode(mode)) { if (quietConflictWarnings) checkConflicts(head, xctxt, targetNode, mode); return template; } } while (null != (head = head.getNext())); } finally { xctxt.popNamespaceContext(); } return null; } // end findTemplate /** * Given a target element, find the template that best * matches in the given XSL document, according * to the rules specified in the xsl draft. * * @param xctxt * @param targetNode * @param mode A string indicating the display mode. * @param quietConflictWarnings * @return Rule that best matches targetElem. * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException */ public ElemTemplate getTemplate(XPathContext xctxt, int targetNode, QName mode, boolean quietConflictWarnings, DTM dtm) throws TransformerException { TemplateSubPatternAssociation head = getHead(xctxt, targetNode, dtm); if (null != head) { // XSLT functions, such as xsl:key, need to be able to get to // current ElemTemplateElement via a cast to the prefix resolver. // Setting this fixes bug idkey03. xctxt.pushNamespaceContextNull(); xctxt.pushCurrentNodeAndExpression(targetNode, targetNode); try { do { ElemTemplate template = head.getTemplate(); xctxt.setNamespaceContext(template); if ((head.m_stepPattern.execute(xctxt, targetNode) != NodeTest.SCORE_NONE) && head.matchMode(mode)) { if (quietConflictWarnings) checkConflicts(head, xctxt, targetNode, mode); return template; } } while (null != (head = head.getNext())); } finally { xctxt.popCurrentNodeAndExpression(); xctxt.popNamespaceContext(); } } return null; } // end findTemplate /** * Given a target element, find the template that best * matches in the given XSL document, according * to the rules specified in the xsl draft. * * @param xctxt * @param targetNode * @param mode A string indicating the display mode. * @param maxImportLevel The maximum importCountComposed that we should consider or -1 * if we should consider all import levels. This is used by apply-imports to * access templates that have been overridden. * @param endImportLevel The count of composed imports * @param quietConflictWarnings * @return Rule that best matches targetElem. * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws TransformerException */ public ElemTemplate getTemplate(XPathContext xctxt, int targetNode, QName mode, int maxImportLevel, int endImportLevel, boolean quietConflictWarnings, DTM dtm) throws TransformerException { TemplateSubPatternAssociation head = getHead(xctxt, targetNode, dtm); if (null != head) { // XSLT functions, such as xsl:key, need to be able to get to // current ElemTemplateElement via a cast to the prefix resolver. // Setting this fixes bug idkey03. xctxt.pushNamespaceContextNull(); xctxt.pushCurrentNodeAndExpression(targetNode, targetNode); try { do { if ( (maxImportLevel > -1) && (head.getImportLevel() > maxImportLevel)) { continue; } if (head.getImportLevel()<= maxImportLevel - endImportLevel) return null; ElemTemplate template = head.getTemplate(); xctxt.setNamespaceContext(template); if ((head.m_stepPattern.execute(xctxt, targetNode) != NodeTest.SCORE_NONE) && head.matchMode(mode)) { if (quietConflictWarnings) checkConflicts(head, xctxt, targetNode, mode); return template; } } while (null != (head = head.getNext())); } finally { xctxt.popCurrentNodeAndExpression(); xctxt.popNamespaceContext(); } } return null; } // end findTemplate /** * Get a TemplateWalker for use by a compiler. See the documentation for * the TreeWalker inner class for further details. */ public TemplateWalker getWalker() { return new TemplateWalker(); } /** * Check for match conflicts, and warn the stylesheet author. * * @param head Template pattern * @param xctxt Current XPath context * @param targetNode Node matching the pattern * @param mode reference, which may be null, to the current mode. */ private void checkConflicts(TemplateSubPatternAssociation head, XPathContext xctxt, int targetNode, QName mode) { // TODO: Check for conflicts. } /** * Add object to vector if not already there. * * @param obj * @param v */ private void addObjectIfNotFound(Object obj, Vector v) { int n = v.size(); boolean addIt = true; for (int i = 0; i < n; i++) { if (v.elementAt(i) == obj) { addIt = false; break; } } if (addIt) { v.addElement(obj); } } /** * Keyed on string macro names, and holding values * that are macro elements in the XSL DOM tree. * Initialized in initMacroLookupTable, and used in * findNamedTemplate. * @serial */ private Hashtable m_namedTemplates = new Hashtable(89); /** * This table is keyed on the target elements * of patterns, and contains linked lists of * the actual patterns that match the target element * to some degree of specifity. * @serial */ private Hashtable m_patternTable = new Hashtable(89); /** Wildcard patterns. * @serial */ private TemplateSubPatternAssociation m_wildCardPatterns = null; /** Text Patterns. * @serial */ private TemplateSubPatternAssociation m_textPatterns = null; /** Root document Patterns. * @serial */ private TemplateSubPatternAssociation m_docPatterns = null; /** Comment Patterns. * @serial */ private TemplateSubPatternAssociation m_commentPatterns = null; /** * Get table of named Templates. * These are keyed on template names, and holding values * that are template elements. * * @return A Hashtable dictionary that contains {@link java.lang.String}s * as the keys, and {@link org.apache.xalan.templates.ElemTemplate}s as the * values. */ private Hashtable getNamedTemplates() { return m_namedTemplates; } /** * Set table of named Templates. * These are keyed on string macro names, and holding values * that are template elements in the XSL DOM tree. * * @param v Hashtable dictionary that contains {@link java.lang.String}s * as the keys, and {@link org.apache.xalan.templates.ElemTemplate}s as the * values. */ private void setNamedTemplates(Hashtable v) { m_namedTemplates = v; } /** * Get the head of the assocation list that is keyed by target. * * @param key The name of a node. * * @return The head of a linked list that contains all possible match pattern to * template associations for the given key. */ private TemplateSubPatternAssociation getHead(String key) { return (TemplateSubPatternAssociation) m_patternTable.get(key); } /** * Get the head of the assocation list that is keyed by target. * * @param key * @param assoc */ private void putHead(String key, TemplateSubPatternAssociation assoc) { if (key.equals(PsuedoNames.PSEUDONAME_TEXT)) m_textPatterns = assoc; else if (key.equals(PsuedoNames.PSEUDONAME_ROOT)) m_docPatterns = assoc; else if (key.equals(PsuedoNames.PSEUDONAME_COMMENT)) m_commentPatterns = assoc; m_patternTable.put(key, assoc); } /** * An inner class used by a compiler to iterate over all of the ElemTemplates * stored in this TemplateList. The compiler can replace returned templates * with their compiled equivalent. */ public class TemplateWalker { private Enumeration hashIterator; private boolean inPatterns; private TemplateSubPatternAssociation curPattern; private Hashtable m_compilerCache = new Hashtable(); private TemplateWalker() { hashIterator = m_patternTable.elements(); inPatterns = true; curPattern = null; } public ElemTemplate next() { ElemTemplate retValue = null; ElemTemplate ct; while (true) { if (inPatterns) { if (null != curPattern) curPattern = curPattern.getNext(); if (null != curPattern) retValue = curPattern.getTemplate(); else { if (hashIterator.hasMoreElements()) { curPattern = (TemplateSubPatternAssociation) hashIterator.nextElement(); retValue = curPattern.getTemplate(); } else { inPatterns = false; hashIterator = m_namedTemplates.elements(); } } } if (!inPatterns) { if (hashIterator.hasMoreElements()) retValue = (ElemTemplate) hashIterator.nextElement(); else return null; } ct = (ElemTemplate) m_compilerCache.get(new Integer(retValue.getUid())); if (null == ct) { m_compilerCache.put(new Integer(retValue.getUid()), retValue); return retValue; } } } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemComment.java0000644000175000017500000001051310721374033024250 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemComment.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; /** * Implement xsl:comment. *
         * 
         * 
         * 
        * @see section-Creating-Comments in XSLT Specification * @xsl.usage advanced */ public class ElemComment extends ElemTemplateElement { static final long serialVersionUID = -8813199122875770142L; /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_COMMENT; } /** * Return the node name. * * @return This element's name */ public String getNodeName() { return Constants.ELEMNAME_COMMENT_STRING; } /** * Execute the xsl:comment transformation * * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); try { // Note the content model is: // String data = transformer.transformToString(this); transformer.getResultTreeHandler().comment(data); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } } /** * Add a child to the child list. * * @param newChild Child to add to this node's child list * * @return Child that was just added to child list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { // char-instructions case Constants.ELEMNAME_TEXTLITERALRESULT : case Constants.ELEMNAME_APPLY_TEMPLATES : case Constants.ELEMNAME_APPLY_IMPORTS : case Constants.ELEMNAME_CALLTEMPLATE : case Constants.ELEMNAME_FOREACH : case Constants.ELEMNAME_VALUEOF : case Constants.ELEMNAME_COPY_OF : case Constants.ELEMNAME_NUMBER : case Constants.ELEMNAME_CHOOSE : case Constants.ELEMNAME_IF : case Constants.ELEMNAME_TEXT : case Constants.ELEMNAME_COPY : case Constants.ELEMNAME_VARIABLE : case Constants.ELEMNAME_MESSAGE : // instructions // case Constants.ELEMNAME_PI: // case Constants.ELEMNAME_COMMENT: // case Constants.ELEMNAME_ELEMENT: // case Constants.ELEMNAME_ATTRIBUTE: break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemTemplate.java0000644000175000017500000003021210721374033024417 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemTemplate.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; /** * Implement xsl:template. *
         * 
         *
         * 
         * 
        * @see section-Defining-Template-Rules in XSLT Specification * @xsl.usage advanced */ public class ElemTemplate extends ElemTemplateElement { static final long serialVersionUID = -5283056789965384058L; /** The public identifier for the current document event. * @serial */ private String m_publicId; /** The system identifier for the current document event. * @serial */ private String m_systemId; /** * Return the public identifier for the current document event. *

        This will be the public identifier * @return A string containing the public identifier, or * null if none is available. * @see #getSystemId */ public String getPublicId() { return m_publicId; } /** * Return the system identifier for the current document event. * *

        If the system identifier is a URL, the parser must resolve it * fully before passing it to the application.

        * * @return A string containing the system identifier, or null * if none is available. * @see #getPublicId */ public String getSystemId() { return m_systemId; } /** * Set the location information for this element. * * @param locator SourceLocator holding location information */ public void setLocaterInfo(SourceLocator locator) { m_publicId = locator.getPublicId(); m_systemId = locator.getSystemId(); super.setLocaterInfo(locator); } /** * The owning stylesheet. * (Should this only be put on the template element, to * conserve space?) * @serial */ private Stylesheet m_stylesheet; /** * Get the stylesheet composed (resolves includes and * imports and has methods on it that return "composed" properties. * * @return The stylesheet composed. */ public StylesheetComposed getStylesheetComposed() { return m_stylesheet.getStylesheetComposed(); } /** * Get the owning stylesheet. * * @return The owning stylesheet. */ public Stylesheet getStylesheet() { return m_stylesheet; } /** * Set the owning stylesheet. * * @param sheet The owning stylesheet for this element */ public void setStylesheet(Stylesheet sheet) { m_stylesheet = sheet; } /** * Get the root stylesheet. * * @return The root stylesheet for this element */ public StylesheetRoot getStylesheetRoot() { return m_stylesheet.getStylesheetRoot(); } /** * The match attribute is a Pattern that identifies the source * node or nodes to which the rule applies. * @serial */ private XPath m_matchPattern = null; /** * Set the "match" attribute. * The match attribute is a Pattern that identifies the source * node or nodes to which the rule applies. The match attribute * is required unless the xsl:template element has a name * attribute (see [6 Named Templates]). It is an error for the * value of the match attribute to contain a VariableReference. * @see patterns in XSLT Specification * * @param v Value to set for the "match" attribute */ public void setMatch(XPath v) { m_matchPattern = v; } /** * Get the "match" attribute. * The match attribute is a Pattern that identifies the source * node or nodes to which the rule applies. The match attribute * is required unless the xsl:template element has a name * attribute (see [6 Named Templates]). It is an error for the * value of the match attribute to contain a VariableReference. * @see patterns in XSLT Specification * * @return Value of the "match" attribute */ public XPath getMatch() { return m_matchPattern; } /** * An xsl:template element with a name attribute specifies a named template. * @serial */ private QName m_name = null; /** * Set the "name" attribute. * An xsl:template element with a name attribute specifies a named template. * If an xsl:template element has a name attribute, it may, but need not, * also have a match attribute. * @see named-templates in XSLT Specification * * @param v Value to set the "name" attribute */ public void setName(QName v) { m_name = v; } /** * Get the "name" attribute. * An xsl:template element with a name attribute specifies a named template. * If an xsl:template element has a name attribute, it may, but need not, * also have a match attribute. * @see named-templates in XSLT Specification * * @return Value of the "name" attribute */ public QName getName() { return m_name; } /** * Modes allow an element to be processed multiple times, * each time producing a different result. * @serial */ private QName m_mode; /** * Set the "mode" attribute. * Modes allow an element to be processed multiple times, * each time producing a different result. If xsl:template * does not have a match attribute, it must not have a mode attribute. * @see modes in XSLT Specification * * @param v Value to set the "mode" attribute */ public void setMode(QName v) { m_mode = v; } /** * Get the "mode" attribute. * Modes allow an element to be processed multiple times, * each time producing a different result. If xsl:template * does not have a match attribute, it must not have a mode attribute. * @see modes in XSLT Specification * * @return Value of the "mode" attribute */ public QName getMode() { return m_mode; } /** * The priority of a template rule is specified by the priority * attribute on the template rule. * @serial */ private double m_priority = XPath.MATCH_SCORE_NONE; /** * Set the "priority" attribute. * The priority of a template rule is specified by the priority * attribute on the template rule. The value of this must be a * real number (positive or negative), matching the production * Number with an optional leading minus sign (-). * @see conflict in XSLT Specification * * @param v The value to set for the "priority" attribute */ public void setPriority(double v) { m_priority = v; } /** * Get the "priority" attribute. * The priority of a template rule is specified by the priority * attribute on the template rule. The value of this must be a * real number (positive or negative), matching the production * Number with an optional leading minus sign (-). * @see conflict in XSLT Specification * * @return The value of the "priority" attribute */ public double getPriority() { return m_priority; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for the element */ public int getXSLToken() { return Constants.ELEMNAME_TEMPLATE; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_TEMPLATE_STRING; } /** * The stack frame size for this template, which is equal to the maximum number * of params and variables that can be declared in the template at one time. */ public int m_frameSize; /** * The size of the portion of the stack frame that can hold parameter * arguments. */ int m_inArgsSize; /** * List of namespace/local-name pairs, DTM style, that are unique * qname identifiers for the arguments. The position of a given qname * in the list is the argument ID, and thus the position in the stack * frame. */ private int[] m_argsQNameIDs; /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if(null != m_matchPattern) m_matchPattern.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize()); cstate.resetStackFrameSize(); m_inArgsSize = 0; } /** * This after the template's children have been composed. */ public void endCompose(StylesheetRoot sroot) throws TransformerException { StylesheetRoot.ComposeState cstate = sroot.getComposeState(); super.endCompose(sroot); m_frameSize = cstate.getFrameSize(); cstate.resetStackFrameSize(); } /** * Copy the template contents into the result tree. * The content of the xsl:template element is the template * that is instantiated when the template rule is applied. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { XPathContext xctxt = transformer.getXPathContext(); transformer.getStackGuard().checkForInfinateLoop(); xctxt.pushRTFContext(); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); // %REVIEW% commenting out of the code below. // if (null != sourceNode) // { transformer.executeChildTemplates(this, true); // } // else // if(null == sourceNode) // { // transformer.getMsgMgr().error(this, // this, sourceNode, // XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES); // // //"sourceNode is null in handleApplyTemplatesInstruction!"); // } if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); xctxt.popRTFContext(); } /** * This function is called during recomposition to * control how this element is composed. * @param root The root stylesheet for this transformation. */ public void recompose(StylesheetRoot root) { root.recomposeTemplates(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemAttributeSet.java0000644000175000017500000001163710721374031025273 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemAttributeSet.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; /** * Implement xsl:attribute-set. *
         * &!ELEMENT xsl:attribute-set (xsl:attribute)*>
         * &!ATTLIST xsl:attribute-set
         *   name %qname; #REQUIRED
         *   use-attribute-sets %qnames; #IMPLIED
         * &
         * 
        * @see attribute-sets in XSLT Specification * @xsl.usage advanced */ public class ElemAttributeSet extends ElemUse { static final long serialVersionUID = -426740318278164496L; /** * The name attribute specifies the name of the attribute set. * @serial */ public QName m_qname = null; /** * Set the "name" attribute. * The name attribute specifies the name of the attribute set. * * @param name Name attribute to set */ public void setName(QName name) { m_qname = name; } /** * Get the "name" attribute. * The name attribute specifies the name of the attribute set. * * @return The name attribute of the attribute set */ public QName getName() { return m_qname; } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return Token ID of the element */ public int getXSLToken() { return Constants.ELEMNAME_DEFINEATTRIBUTESET; } /** * Return the node name. * * @return The name of this element */ public String getNodeName() { return Constants.ELEMNAME_ATTRIBUTESET_STRING; } /** * Apply a set of attributes to the element. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); if (transformer.isRecursiveAttrSet(this)) { throw new TransformerException( XSLMessages.createMessage( XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF, new Object[]{ m_qname.getLocalPart() })); //"xsl:attribute-set '"+m_qname.m_localpart+ } transformer.pushElemAttributeSet(this); super.execute(transformer); ElemAttribute attr = (ElemAttribute) getFirstChildElem(); while (null != attr) { attr.execute(transformer); attr = (ElemAttribute) attr.getNextSiblingElem(); } transformer.popElemAttributeSet(); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); } /** * Add a child to the child list. * * * * @param newChild Child to be added to this node's list of children * * @return The child that was just added to the list of children * * @throws DOMException */ public ElemTemplateElement appendChildElem(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { case Constants.ELEMNAME_ATTRIBUTE : break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } /** * This function is called during recomposition to * control how this element is composed. * @param root The root stylesheet for this transformation. */ public void recompose(StylesheetRoot root) { root.recomposeAttributeSets(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/RedundentExprEliminator.java0000644000175000017500000013334610721374031026666 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RedundentExprEliminator.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Vector; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.utils.QName; import org.apache.xml.utils.WrappedRuntimeException; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionNode; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPath; import org.apache.xpath.axes.AxesWalker; import org.apache.xpath.axes.FilterExprIteratorSimple; import org.apache.xpath.axes.FilterExprWalker; import org.apache.xpath.axes.LocPathIterator; import org.apache.xpath.axes.SelfIteratorNoPredicate; import org.apache.xpath.axes.WalkerFactory; import org.apache.xpath.axes.WalkingIterator; import org.apache.xpath.operations.Variable; import org.apache.xpath.operations.VariableSafeAbsRef; /** * This class eleminates redundent XPaths from a given subtree, * and also collects all absolute paths within the subtree. First * it must be called as a visitor to the subtree, and then * eleminateRedundent must be called. */ public class RedundentExprEliminator extends XSLTVisitor { Vector m_paths; Vector m_absPaths; boolean m_isSameContext; AbsPathChecker m_absPathChecker = new AbsPathChecker(); private static int m_uniquePseudoVarID = 1; static final String PSUEDOVARNAMESPACE = Constants.S_VENDORURL+"/xalan/psuedovar"; public static final boolean DEBUG = false; public static final boolean DIAGNOSE_NUM_PATHS_REDUCED = false; public static final boolean DIAGNOSE_MULTISTEPLIST = false; /** * So we can reuse it over and over again. */ VarNameCollector m_varNameCollector = new VarNameCollector(); /** * Construct a RedundentExprEliminator. */ public RedundentExprEliminator() { m_isSameContext = true; m_absPaths = new Vector(); m_paths = null; } /** * Method to be called after the all expressions within an * node context have been visited. It eliminates redundent * expressions by creating a variable in the psuedoVarRecipient * for each redundent expression, and then rewriting the redundent * expression to be a variable reference. * * @param psuedoVarRecipient The recipient of the psuedo vars. The * variables will be inserted as first children of the element, before * any existing variables. */ public void eleminateRedundentLocals(ElemTemplateElement psuedoVarRecipient) { eleminateRedundent(psuedoVarRecipient, m_paths); } /** * Method to be called after the all global expressions within a stylesheet * have been collected. It eliminates redundent * expressions by creating a variable in the psuedoVarRecipient * for each redundent expression, and then rewriting the redundent * expression to be a variable reference. * */ public void eleminateRedundentGlobals(StylesheetRoot stylesheet) { eleminateRedundent(stylesheet, m_absPaths); } /** * Method to be called after the all expressions within an * node context have been visited. It eliminates redundent * expressions by creating a variable in the psuedoVarRecipient * for each redundent expression, and then rewriting the redundent * expression to be a variable reference. * * @param psuedoVarRecipient The owner of the subtree from where the * paths were collected. * @param paths A vector of paths that hold ExpressionOwner objects, * which must yield LocationPathIterators. */ protected void eleminateRedundent(ElemTemplateElement psuedoVarRecipient, Vector paths) { int n = paths.size(); int numPathsEliminated = 0; int numUniquePathsEliminated = 0; for (int i = 0; i < n; i++) { ExpressionOwner owner = (ExpressionOwner) paths.elementAt(i); if (null != owner) { int found = findAndEliminateRedundant(i + 1, i, owner, psuedoVarRecipient, paths); if (found > 0) numUniquePathsEliminated++; numPathsEliminated += found; } } eleminateSharedPartialPaths(psuedoVarRecipient, paths); if(DIAGNOSE_NUM_PATHS_REDUCED) diagnoseNumPaths(paths, numPathsEliminated, numUniquePathsEliminated); } /** * Eliminate the shared partial paths in the expression list. * * @param psuedoVarRecipient The recipient of the psuedo vars. * * @param paths A vector of paths that hold ExpressionOwner objects, * which must yield LocationPathIterators. */ protected void eleminateSharedPartialPaths(ElemTemplateElement psuedoVarRecipient, Vector paths) { MultistepExprHolder list = createMultistepExprList(paths); if(null != list) { if(DIAGNOSE_MULTISTEPLIST) list.diagnose(); boolean isGlobal = (paths == m_absPaths); // Iterate over the list, starting with the most number of paths, // trying to find the longest matches first. int longestStepsCount = list.m_stepCount; for (int i = longestStepsCount-1; i >= 1; i--) { MultistepExprHolder next = list; while(null != next) { if(next.m_stepCount < i) break; list = matchAndEliminatePartialPaths(next, list, isGlobal, i, psuedoVarRecipient); next = next.m_next; } } } } /** * For a given path, see if there are any partitial matches in the list, * and, if there are, replace those partial paths with psuedo variable refs, * and create the psuedo variable decl. * * @return The head of the list, which may have changed. */ protected MultistepExprHolder matchAndEliminatePartialPaths(MultistepExprHolder testee, MultistepExprHolder head, boolean isGlobal, int lengthToTest, ElemTemplateElement varScope) { if(null == testee.m_exprOwner) return head; // Start with the longest possible match, and move down. WalkingIterator iter1 = (WalkingIterator) testee.m_exprOwner.getExpression(); if(partialIsVariable(testee, lengthToTest)) return head; MultistepExprHolder matchedPaths = null; MultistepExprHolder matchedPathsTail = null; MultistepExprHolder meh = head; while( null != meh) { if ((meh != testee) && (null != meh.m_exprOwner)) { WalkingIterator iter2 = (WalkingIterator) meh.m_exprOwner.getExpression(); if (stepsEqual(iter1, iter2, lengthToTest)) { if (null == matchedPaths) { try { matchedPaths = (MultistepExprHolder)testee.clone(); testee.m_exprOwner = null; // So it won't be processed again. } catch(CloneNotSupportedException cnse){} matchedPathsTail = matchedPaths; matchedPathsTail.m_next = null; } try { matchedPathsTail.m_next = (MultistepExprHolder)meh.clone(); meh.m_exprOwner = null; // So it won't be processed again. } catch(CloneNotSupportedException cnse){} matchedPathsTail = matchedPathsTail.m_next; matchedPathsTail.m_next = null; } } meh = meh.m_next; } int matchCount = 0; if(null != matchedPaths) { ElemTemplateElement root = isGlobal ? varScope : findCommonAncestor(matchedPaths); WalkingIterator sharedIter = (WalkingIterator)matchedPaths.m_exprOwner.getExpression(); WalkingIterator newIter = createIteratorFromSteps(sharedIter, lengthToTest); ElemVariable var = createPseudoVarDecl(root, newIter, isGlobal); if(DIAGNOSE_MULTISTEPLIST) System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : "")); while(null != matchedPaths) { ExpressionOwner owner = matchedPaths.m_exprOwner; WalkingIterator iter = (WalkingIterator)owner.getExpression(); if(DIAGNOSE_MULTISTEPLIST) diagnoseLineNumber(iter); LocPathIterator newIter2 = changePartToRef(var.getName(), iter, lengthToTest, isGlobal); owner.setExpression(newIter2); matchedPaths = matchedPaths.m_next; } } if(DIAGNOSE_MULTISTEPLIST) diagnoseMultistepList(matchCount, lengthToTest, isGlobal); return head; } /** * Check if results of partial reduction will just be a variable, in * which case, skip it. */ boolean partialIsVariable(MultistepExprHolder testee, int lengthToTest) { if(1 == lengthToTest) { WalkingIterator wi = (WalkingIterator)testee.m_exprOwner.getExpression(); if(wi.getFirstWalker() instanceof FilterExprWalker) return true; } return false; } /** * Tell what line number belongs to a given expression. */ protected void diagnoseLineNumber(Expression expr) { ElemTemplateElement e = getElemFromExpression(expr); System.err.println(" " + e.getSystemId() + " Line " + e.getLineNumber()); } /** * Given a linked list of expressions, find the common ancestor that is * suitable for holding a psuedo variable for shared access. */ protected ElemTemplateElement findCommonAncestor(MultistepExprHolder head) { // Not sure this algorithm is the best, but will do for the moment. int numExprs = head.getLength(); // The following could be made cheaper by pre-allocating large arrays, // but then we would have to assume a max number of reductions, // which I am not inclined to do right now. ElemTemplateElement[] elems = new ElemTemplateElement[numExprs]; int[] ancestorCounts = new int[numExprs]; // Loop through, getting the parent elements, and counting the // ancestors. MultistepExprHolder next = head; int shortestAncestorCount = 10000; for(int i = 0; i < numExprs; i++) { ElemTemplateElement elem = getElemFromExpression(next.m_exprOwner.getExpression()); elems[i] = elem; int numAncestors = countAncestors(elem); ancestorCounts[i] = numAncestors; if(numAncestors < shortestAncestorCount) { shortestAncestorCount = numAncestors; } next = next.m_next; } // Now loop through and "correct" the elements that have more ancestors. for(int i = 0; i < numExprs; i++) { if(ancestorCounts[i] > shortestAncestorCount) { int numStepCorrection = ancestorCounts[i] - shortestAncestorCount; for(int j = 0; j < numStepCorrection; j++) { elems[i] = elems[i].getParentElem(); } } } // Now everyone has an equal number of ancestors. Walk up from here // equally until all are equal. ElemTemplateElement first = null; while(shortestAncestorCount-- >= 0) { boolean areEqual = true; first = elems[0]; for(int i = 1; i < numExprs; i++) { if(first != elems[i]) { areEqual = false; break; } } // This second check is to make sure we have a common ancestor that is not the same // as the expression owner... i.e. the var decl has to go above the expression owner. if(areEqual && isNotSameAsOwner(head, first) && first.canAcceptVariables()) { if(DIAGNOSE_MULTISTEPLIST) { System.err.print(first.getClass().getName()); System.err.println(" at " + first.getSystemId() + " Line " + first.getLineNumber()); } return first; } for(int i = 0; i < numExprs; i++) { elems[i] = elems[i].getParentElem(); } } assertion(false, "Could not find common ancestor!!!"); return null; } /** * Find out if the given ElemTemplateElement is not the same as one of * the ElemTemplateElement owners of the expressions. * * @param head Head of linked list of expression owners. * @param ete The ElemTemplateElement that is a candidate for a psuedo * variable parent. * @return true if the given ElemTemplateElement is not the same as one of * the ElemTemplateElement owners of the expressions. This is to make sure * we find an ElemTemplateElement that is in a viable position to hold * psuedo variables that are visible to the references. */ protected boolean isNotSameAsOwner(MultistepExprHolder head, ElemTemplateElement ete) { MultistepExprHolder next = head; while(null != next) { ElemTemplateElement elemOwner = getElemFromExpression(next.m_exprOwner.getExpression()); if(elemOwner == ete) return false; next = next.m_next; } return true; } /** * Count the number of ancestors that a ElemTemplateElement has. * * @param elem An representation of an element in an XSLT stylesheet. * @return The number of ancestors of elem (including the element itself). */ protected int countAncestors(ElemTemplateElement elem) { int count = 0; while(null != elem) { count++; elem = elem.getParentElem(); } return count; } /** * Print out diagnostics about partial multistep evaluation. */ protected void diagnoseMultistepList( int matchCount, int lengthToTest, boolean isGlobal) { if (matchCount > 0) { System.err.print( "Found multistep matches: " + matchCount + ", " + lengthToTest + " length"); if (isGlobal) System.err.println(" (global)"); else System.err.println(); } } /** * Change a given number of steps to a single variable reference. * * @param uniquePseudoVarName The name of the variable reference. * @param wi The walking iterator that is to be changed. * @param numSteps The number of steps to be changed. * @param isGlobal true if this will be a global reference. */ protected LocPathIterator changePartToRef(final QName uniquePseudoVarName, WalkingIterator wi, final int numSteps, final boolean isGlobal) { Variable var = new Variable(); var.setQName(uniquePseudoVarName); var.setIsGlobal(isGlobal); if(isGlobal) { ElemTemplateElement elem = getElemFromExpression(wi); StylesheetRoot root = elem.getStylesheetRoot(); Vector vars = root.getVariablesAndParamsComposed(); var.setIndex(vars.size()-1); } // Walk to the first walker after the one's we are replacing. AxesWalker walker = wi.getFirstWalker(); for(int i = 0; i < numSteps; i++) { assertion(null != walker, "Walker should not be null!"); walker = walker.getNextWalker(); } if(null != walker) { FilterExprWalker few = new FilterExprWalker(wi); few.setInnerExpression(var); few.exprSetParent(wi); few.setNextWalker(walker); walker.setPrevWalker(few); wi.setFirstWalker(few); return wi; } else { FilterExprIteratorSimple feis = new FilterExprIteratorSimple(var); feis.exprSetParent(wi.exprGetParent()); return feis; } } /** * Create a new WalkingIterator from the steps in another WalkingIterator. * * @param wi The iterator from where the steps will be taken. * @param numSteps The number of steps from the first to copy into the new * iterator. * @return The new iterator. */ protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) { WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver()); try { AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone(); newIter.setFirstWalker(walker); walker.setLocPathIterator(newIter); for(int i = 1; i < numSteps; i++) { AxesWalker next = (AxesWalker)walker.getNextWalker().clone(); walker.setNextWalker(next); next.setLocPathIterator(newIter); walker = next; } walker.setNextWalker(null); } catch(CloneNotSupportedException cnse) { throw new WrappedRuntimeException(cnse); } return newIter; } /** * Compare a given number of steps between two iterators, to see if they are equal. * * @param iter1 The first iterator to compare. * @param iter2 The second iterator to compare. * @param numSteps The number of steps to compare. * @return true If the given number of steps are equal. * */ protected boolean stepsEqual(WalkingIterator iter1, WalkingIterator iter2, int numSteps) { AxesWalker aw1 = iter1.getFirstWalker(); AxesWalker aw2 = iter2.getFirstWalker(); for(int i = 0; (i < numSteps); i++) { if((null == aw1) || (null == aw2)) return false; if(!aw1.deepEquals(aw2)) return false; aw1 = aw1.getNextWalker(); aw2 = aw2.getNextWalker(); } assertion((null != aw1) || (null != aw2), "Total match is incorrect!"); return true; } /** * For the reduction of location path parts, create a list of all * the multistep paths with more than one step, sorted by the * number of steps, with the most steps occuring earlier in the list. * If the list is only one member, don't bother returning it. * * @param paths Vector of ExpressionOwner objects, which may contain null entries. * The ExpressionOwner objects must own LocPathIterator objects. * @return null if no multipart paths are found or the list is only of length 1, * otherwise the first MultistepExprHolder in a linked list of these objects. */ protected MultistepExprHolder createMultistepExprList(Vector paths) { MultistepExprHolder first = null; int n = paths.size(); for(int i = 0; i < n; i++) { ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i); if(null == eo) continue; // Assuming location path iterators should be OK. LocPathIterator lpi = (LocPathIterator)eo.getExpression(); int numPaths = countSteps(lpi); if(numPaths > 1) { if(null == first) first = new MultistepExprHolder(eo, numPaths, null); else first = first.addInSortedOrder(eo, numPaths); } } if((null == first) || (first.getLength() <= 1)) return null; else return first; } /** * Look through the vector from start point, looking for redundant occurances. * When one or more are found, create a psuedo variable declaration, insert * it into the stylesheet, and replace the occurance with a reference to * the psuedo variable. When a redundent variable is found, it's slot in * the vector will be replaced by null. * * @param start The position to start looking in the vector. * @param firstOccuranceIndex The position of firstOccuranceOwner. * @param firstOccuranceOwner The owner of the expression we are looking for. * @param psuedoVarRecipient Where to put the psuedo variables. * * @return The number of expression occurances that were modified. */ protected int findAndEliminateRedundant(int start, int firstOccuranceIndex, ExpressionOwner firstOccuranceOwner, ElemTemplateElement psuedoVarRecipient, Vector paths) throws org.w3c.dom.DOMException { MultistepExprHolder head = null; MultistepExprHolder tail = null; int numPathsFound = 0; int n = paths.size(); Expression expr1 = firstOccuranceOwner.getExpression(); if(DEBUG) assertIsLocPathIterator(expr1, firstOccuranceOwner); boolean isGlobal = (paths == m_absPaths); LocPathIterator lpi = (LocPathIterator)expr1; int stepCount = countSteps(lpi); for(int j = start; j < n; j++) { ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j); if(null != owner2) { Expression expr2 = owner2.getExpression(); boolean isEqual = expr2.deepEquals(lpi); if(isEqual) { LocPathIterator lpi2 = (LocPathIterator)expr2; if(null == head) { head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null); tail = head; numPathsFound++; } tail.m_next = new MultistepExprHolder(owner2, stepCount, null); tail = tail.m_next; // Null out the occurance, so we don't have to test it again. paths.setElementAt(null, j); // foundFirst = true; numPathsFound++; } } } // Change all globals in xsl:templates, etc, to global vars no matter what. if((0 == numPathsFound) && isGlobal) { head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null); numPathsFound++; } if(null != head) { ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head); LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression(); ElemVariable var = createPseudoVarDecl(root, sharedIter, isGlobal); if(DIAGNOSE_MULTISTEPLIST) System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : "")); QName uniquePseudoVarName = var.getName(); while(null != head) { ExpressionOwner owner = head.m_exprOwner; if(DIAGNOSE_MULTISTEPLIST) diagnoseLineNumber(owner.getExpression()); changeToVarRef(uniquePseudoVarName, owner, paths, root); head = head.m_next; } // Replace the first occurance with the variable's XPath, so // that further reduction may take place if needed. paths.setElementAt(var.getSelect(), firstOccuranceIndex); } return numPathsFound; } /** * To be removed. */ protected int oldFindAndEliminateRedundant(int start, int firstOccuranceIndex, ExpressionOwner firstOccuranceOwner, ElemTemplateElement psuedoVarRecipient, Vector paths) throws org.w3c.dom.DOMException { QName uniquePseudoVarName = null; boolean foundFirst = false; int numPathsFound = 0; int n = paths.size(); Expression expr1 = firstOccuranceOwner.getExpression(); if(DEBUG) assertIsLocPathIterator(expr1, firstOccuranceOwner); boolean isGlobal = (paths == m_absPaths); LocPathIterator lpi = (LocPathIterator)expr1; for(int j = start; j < n; j++) { ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j); if(null != owner2) { Expression expr2 = owner2.getExpression(); boolean isEqual = expr2.deepEquals(lpi); if(isEqual) { LocPathIterator lpi2 = (LocPathIterator)expr2; if(!foundFirst) { foundFirst = true; // Insert variable decl into psuedoVarRecipient // We want to insert this into the first legitimate // position for a variable. ElemVariable var = createPseudoVarDecl(psuedoVarRecipient, lpi, isGlobal); if(null == var) return 0; uniquePseudoVarName = var.getName(); changeToVarRef(uniquePseudoVarName, firstOccuranceOwner, paths, psuedoVarRecipient); // Replace the first occurance with the variable's XPath, so // that further reduction may take place if needed. paths.setElementAt(var.getSelect(), firstOccuranceIndex); numPathsFound++; } changeToVarRef(uniquePseudoVarName, owner2, paths, psuedoVarRecipient); // Null out the occurance, so we don't have to test it again. paths.setElementAt(null, j); // foundFirst = true; numPathsFound++; } } } // Change all globals in xsl:templates, etc, to global vars no matter what. if((0 == numPathsFound) && (paths == m_absPaths)) { ElemVariable var = createPseudoVarDecl(psuedoVarRecipient, lpi, true); if(null == var) return 0; uniquePseudoVarName = var.getName(); changeToVarRef(uniquePseudoVarName, firstOccuranceOwner, paths, psuedoVarRecipient); paths.setElementAt(var.getSelect(), firstOccuranceIndex); numPathsFound++; } return numPathsFound; } /** * Count the steps in a given location path. * * @param lpi The location path iterator that owns the steps. * @return The number of steps in the given location path. */ protected int countSteps(LocPathIterator lpi) { if(lpi instanceof WalkingIterator) { WalkingIterator wi = (WalkingIterator)lpi; AxesWalker aw = wi.getFirstWalker(); int count = 0; while(null != aw) { count++; aw = aw.getNextWalker(); } return count; } else return 1; } /** * Change the expression owned by the owner argument to a variable reference * of the given name. * * Warning: For global vars, this function relies on the variable declaration * to which it refers having been added just prior to this function being called, * so that the reference index can be determined from the size of the global variables * list minus one. * * @param varName The name of the variable which will be referenced. * @param owner The owner of the expression which will be replaced by a variable ref. * @param paths The paths list that the iterator came from, mainly to determine * if this is a local or global reduction. * @param psuedoVarRecipient The element within whose scope the variable is * being inserted, possibly a StylesheetRoot. */ protected void changeToVarRef(QName varName, ExpressionOwner owner, Vector paths, ElemTemplateElement psuedoVarRecipient) { Variable varRef = (paths == m_absPaths) ? new VariableSafeAbsRef() : new Variable(); varRef.setQName(varName); if(paths == m_absPaths) { StylesheetRoot root = (StylesheetRoot)psuedoVarRecipient; Vector globalVars = root.getVariablesAndParamsComposed(); // Assume this operation is occuring just after the decl has // been added. varRef.setIndex(globalVars.size()-1); varRef.setIsGlobal(true); } owner.setExpression(varRef); } private synchronized static int getPseudoVarID(){ return m_uniquePseudoVarID++; } /** * Create a psuedo variable reference that will represent the * shared redundent XPath, and add it to the stylesheet. * * @param psuedoVarRecipient The broadest scope of where the variable * should be inserted, usually an xsl:template or xsl:for-each. * @param lpi The LocationPathIterator that the variable should represent. * @param isGlobal true if the paths are global. * @return The new psuedo var element. */ protected ElemVariable createPseudoVarDecl( ElemTemplateElement psuedoVarRecipient, LocPathIterator lpi, boolean isGlobal) throws org.w3c.dom.DOMException { QName uniquePseudoVarName = new QName (PSUEDOVARNAMESPACE, "#"+getPseudoVarID()); if(isGlobal) { return createGlobalPseudoVarDecl(uniquePseudoVarName, (StylesheetRoot)psuedoVarRecipient, lpi); } else return createLocalPseudoVarDecl(uniquePseudoVarName, psuedoVarRecipient, lpi); } /** * Create a psuedo variable reference that will represent the * shared redundent XPath, for a local reduction. * * @param uniquePseudoVarName The name of the new variable. * @param stylesheetRoot The broadest scope of where the variable * should be inserted, which must be a StylesheetRoot element in this case. * @param lpi The LocationPathIterator that the variable should represent. * @return null if the decl was not created, otherwise the new Pseudo var * element. */ protected ElemVariable createGlobalPseudoVarDecl(QName uniquePseudoVarName, StylesheetRoot stylesheetRoot, LocPathIterator lpi) throws org.w3c.dom.DOMException { ElemVariable psuedoVar = new ElemVariable(); psuedoVar.setIsTopLevel(true); XPath xpath = new XPath(lpi); psuedoVar.setSelect(xpath); psuedoVar.setName(uniquePseudoVarName); Vector globalVars = stylesheetRoot.getVariablesAndParamsComposed(); psuedoVar.setIndex(globalVars.size()); globalVars.addElement(psuedoVar); return psuedoVar; } /** * Create a psuedo variable reference that will represent the * shared redundent XPath, for a local reduction. * * @param uniquePseudoVarName The name of the new variable. * @param psuedoVarRecipient The broadest scope of where the variable * should be inserted, usually an xsl:template or xsl:for-each. * @param lpi The LocationPathIterator that the variable should represent. * @return null if the decl was not created, otherwise the new Pseudo var * element. */ protected ElemVariable createLocalPseudoVarDecl(QName uniquePseudoVarName, ElemTemplateElement psuedoVarRecipient, LocPathIterator lpi) throws org.w3c.dom.DOMException { ElemVariable psuedoVar = new ElemVariablePsuedo(); XPath xpath = new XPath(lpi); psuedoVar.setSelect(xpath); psuedoVar.setName(uniquePseudoVarName); ElemVariable var = addVarDeclToElem(psuedoVarRecipient, lpi, psuedoVar); lpi.exprSetParent(var); return var; } /** * Add the given variable to the psuedoVarRecipient. */ protected ElemVariable addVarDeclToElem( ElemTemplateElement psuedoVarRecipient, LocPathIterator lpi, ElemVariable psuedoVar) throws org.w3c.dom.DOMException { // Create psuedo variable element ElemTemplateElement ete = psuedoVarRecipient.getFirstChildElem(); lpi.callVisitors(null, m_varNameCollector); // If the location path contains variables, we have to insert the // psuedo variable after the reference. (Otherwise, we want to // insert it as close as possible to the top, so we'll be sure // it is in scope for any other vars. if (m_varNameCollector.getVarCount() > 0) { ElemTemplateElement baseElem = getElemFromExpression(lpi); ElemVariable varElem = getPrevVariableElem(baseElem); while (null != varElem) { if (m_varNameCollector.doesOccur(varElem.getName())) { psuedoVarRecipient = varElem.getParentElem(); ete = varElem.getNextSiblingElem(); break; } varElem = getPrevVariableElem(varElem); } } if ((null != ete) && (Constants.ELEMNAME_PARAMVARIABLE == ete.getXSLToken())) { // Can't stick something in front of a param, so abandon! (see variable13.xsl) if(isParam(lpi)) return null; while (null != ete) { ete = ete.getNextSiblingElem(); if ((null != ete) && Constants.ELEMNAME_PARAMVARIABLE != ete.getXSLToken()) break; } } psuedoVarRecipient.insertBefore(psuedoVar, ete); m_varNameCollector.reset(); return psuedoVar; } /** * Tell if the expr param is contained within an xsl:param. */ protected boolean isParam(ExpressionNode expr) { while(null != expr) { if(expr instanceof ElemTemplateElement) break; expr = expr.exprGetParent(); } if(null != expr) { ElemTemplateElement ete = (ElemTemplateElement)expr; while(null != ete) { int type = ete.getXSLToken(); switch(type) { case Constants.ELEMNAME_PARAMVARIABLE: return true; case Constants.ELEMNAME_TEMPLATE: case Constants.ELEMNAME_STYLESHEET: return false; } ete = ete.getParentElem(); } } return false; } /** * Find the previous occurance of a xsl:variable. Stop * the search when a xsl:for-each, xsl:template, or xsl:stylesheet is * encountered. * * @param elem Should be non-null template element. * @return The first previous occurance of an xsl:variable or xsl:param, * or null if none is found. */ protected ElemVariable getPrevVariableElem(ElemTemplateElement elem) { // This could be somewhat optimized. since getPreviousSiblingElem is a // fairly expensive operation. while(null != (elem = getPrevElementWithinContext(elem))) { int type = elem.getXSLToken(); if((Constants.ELEMNAME_VARIABLE == type) || (Constants.ELEMNAME_PARAMVARIABLE == type)) { return (ElemVariable)elem; } } return null; } /** * Get the previous sibling or parent of the given template, stopping at * xsl:for-each, xsl:template, or xsl:stylesheet. * * @param elem Should be non-null template element. * @return previous sibling or parent, or null if previous is xsl:for-each, * xsl:template, or xsl:stylesheet. */ protected ElemTemplateElement getPrevElementWithinContext(ElemTemplateElement elem) { ElemTemplateElement prev = elem.getPreviousSiblingElem(); if(null == prev) prev = elem.getParentElem(); if(null != prev) { int type = prev.getXSLToken(); if((Constants.ELEMNAME_FOREACH == type) || (Constants.ELEMNAME_TEMPLATE == type) || (Constants.ELEMNAME_STYLESHEET == type)) { prev = null; } } return prev; } /** * From an XPath expression component, get the ElemTemplateElement * owner. * * @param expr Should be static expression with proper parentage. * @return Valid ElemTemplateElement, or throw a runtime exception * if it is not found. */ protected ElemTemplateElement getElemFromExpression(Expression expr) { ExpressionNode parent = expr.exprGetParent(); while(null != parent) { if(parent instanceof ElemTemplateElement) return (ElemTemplateElement)parent; parent = parent.exprGetParent(); } throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_NO_TEMPLATE_PARENT, null)); // "Programmer's error! expr has no ElemTemplateElement parent!"); } /** * Tell if the given LocPathIterator is relative to an absolute path, i.e. * in not dependent on the context. * * @return true if the LocPathIterator is not dependent on the context node. */ public boolean isAbsolute(LocPathIterator path) { int analysis = path.getAnalysisBits(); boolean isAbs = (WalkerFactory.isSet(analysis, WalkerFactory.BIT_ROOT) || WalkerFactory.isSet(analysis, WalkerFactory.BIT_ANY_DESCENDANT_FROM_ROOT)); if(isAbs) { isAbs = m_absPathChecker.checkAbsolute(path); } return isAbs; } /** * Visit a LocationPath. * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param path The LocationPath object. * @return true if the sub expressions should be traversed. */ public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path) { // Don't optimize "." or single step variable paths. // Both of these cases could use some further optimization by themselves. if(path instanceof SelfIteratorNoPredicate) { return true; } else if(path instanceof WalkingIterator) { WalkingIterator wi = (WalkingIterator)path; AxesWalker aw = wi.getFirstWalker(); if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker())) { FilterExprWalker few = (FilterExprWalker)aw; Expression exp = few.getInnerExpression(); if(exp instanceof Variable) return true; } } if (isAbsolute(path) && (null != m_absPaths)) { if(DEBUG) validateNewAddition(m_absPaths, owner, path); m_absPaths.addElement(owner); } else if (m_isSameContext && (null != m_paths)) { if(DEBUG) validateNewAddition(m_paths, owner, path); m_paths.addElement(owner); } return true; } /** * Visit a predicate within a location path. Note that there isn't a * proper unique component for predicates, and that the expression will * be called also for whatever type Expression is. * * @param owner The owner of the expression, to which the expression can * be reset if rewriting takes place. * @param pred The predicate object. * @return true if the sub expressions should be traversed. */ public boolean visitPredicate(ExpressionOwner owner, Expression pred) { boolean savedIsSame = m_isSameContext; m_isSameContext = false; // Any further down, just collect the absolute paths. pred.callVisitors(owner, this); m_isSameContext = savedIsSame; // We've already gone down the subtree, so don't go have the caller // go any further. return false; } /** * Visit an XSLT top-level instruction. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitTopLevelInstruction(ElemTemplateElement elem) { int type = elem.getXSLToken(); switch(type) { case Constants.ELEMNAME_TEMPLATE : return visitInstruction(elem); default: return true; } } /** * Visit an XSLT instruction. Any element that isn't called by one * of the other visit methods, will be called by this method. * * @param elem The xsl instruction element object. * @return true if the sub expressions should be traversed. */ public boolean visitInstruction(ElemTemplateElement elem) { int type = elem.getXSLToken(); switch (type) { case Constants.ELEMNAME_CALLTEMPLATE : case Constants.ELEMNAME_TEMPLATE : case Constants.ELEMNAME_FOREACH : { // Just get the select value. if(type == Constants.ELEMNAME_FOREACH) { ElemForEach efe = (ElemForEach) elem; Expression select = efe.getSelect(); select.callVisitors(efe, this); } Vector savedPaths = m_paths; m_paths = new Vector(); // Visit children. Call the superclass callChildVisitors, because // we don't want to visit the xsl:for-each select attribute, or, for // that matter, the xsl:template's match attribute. elem.callChildVisitors(this, false); eleminateRedundentLocals(elem); m_paths = savedPaths; // select.callVisitors(efe, this); return false; } case Constants.ELEMNAME_NUMBER : case Constants.ELEMNAME_SORT : // Just collect absolute paths until and unless we can fully // analyze these cases. boolean savedIsSame = m_isSameContext; m_isSameContext = false; elem.callChildVisitors(this); m_isSameContext = savedIsSame; return false; default : return true; } } // ==== DIAGNOSTIC AND DEBUG FUNCTIONS ==== /** * Print out to std err the number of paths reduced. */ protected void diagnoseNumPaths(Vector paths, int numPathsEliminated, int numUniquePathsEliminated) { if (numPathsEliminated > 0) { if(paths == m_paths) { System.err.println("Eliminated " + numPathsEliminated + " total paths!"); System.err.println( "Consolodated " + numUniquePathsEliminated + " redundent paths!"); } else { System.err.println("Eliminated " + numPathsEliminated + " total global paths!"); System.err.println( "Consolodated " + numUniquePathsEliminated + " redundent global paths!"); } } } /** * Assert that the expression is a LocPathIterator, and, if * not, try to give some diagnostic info. */ private final void assertIsLocPathIterator(Expression expr1, ExpressionOwner eo) throws RuntimeException { if(!(expr1 instanceof LocPathIterator)) { String errMsg; if(expr1 instanceof Variable) { errMsg = "Programmer's assertion: expr1 not an iterator: "+ ((Variable)expr1).getQName(); } else { errMsg = "Programmer's assertion: expr1 not an iterator: "+ expr1.getClass().getName(); } throw new RuntimeException(errMsg + ", "+ eo.getClass().getName()+" "+ expr1.exprGetParent()); } } /** * Validate some assumptions about the new LocPathIterator and it's * owner and the state of the list. */ private static void validateNewAddition(Vector paths, ExpressionOwner owner, LocPathIterator path) throws RuntimeException { assertion(owner.getExpression() == path, "owner.getExpression() != path!!!"); int n = paths.size(); // There should never be any duplicates in the list! for(int i = 0; i < n; i++) { ExpressionOwner ew = (ExpressionOwner)paths.elementAt(i); assertion(ew != owner, "duplicate owner on the list!!!"); assertion(ew.getExpression() != path, "duplicate expression on the list!!!"); } } /** * Simple assertion. */ protected static void assertion(boolean b, String msg) { if(!b) { throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, new Object[]{msg})); // "Programmer's assertion in RundundentExprEliminator: "+msg); } } /** * Since we want to sort multistep expressions by length, use * a linked list with elements of type MultistepExprHolder. */ class MultistepExprHolder implements Cloneable { ExpressionOwner m_exprOwner; // Will change to null once we have processed this item. final int m_stepCount; MultistepExprHolder m_next; /** * Clone this object. */ public Object clone() throws CloneNotSupportedException { return super.clone(); } /** * Create a MultistepExprHolder. * * @param exprOwner the owner of the expression we are holding. * It must hold a LocationPathIterator. * @param stepCount The number of steps in the location path. */ MultistepExprHolder(ExpressionOwner exprOwner, int stepCount, MultistepExprHolder next) { m_exprOwner = exprOwner; assertion(null != m_exprOwner, "exprOwner can not be null!"); m_stepCount = stepCount; m_next = next; } /** * Add a new MultistepExprHolder in sorted order in the list. * * @param exprOwner the owner of the expression we are holding. * It must hold a LocationPathIterator. * @param stepCount The number of steps in the location path. * @return The new head of the linked list. */ MultistepExprHolder addInSortedOrder(ExpressionOwner exprOwner, int stepCount) { MultistepExprHolder first = this; MultistepExprHolder next = this; MultistepExprHolder prev = null; while(null != next) { if(stepCount >= next.m_stepCount) { MultistepExprHolder newholder = new MultistepExprHolder(exprOwner, stepCount, next); if(null == prev) first = newholder; else prev.m_next = newholder; return first; } prev = next; next = next.m_next; } prev.m_next = new MultistepExprHolder(exprOwner, stepCount, null); return first; } /** * Remove the given element from the list. 'this' should * be the head of the list. If the item to be removed is not * found, an assertion will be made. * * @param itemToRemove The item to remove from the list. * @return The head of the list, which may have changed if itemToRemove * is the same as this element. Null if the item to remove is the * only item in the list. */ MultistepExprHolder unlink(MultistepExprHolder itemToRemove) { MultistepExprHolder first = this; MultistepExprHolder next = this; MultistepExprHolder prev = null; while(null != next) { if(next == itemToRemove) { if(null == prev) first = next.m_next; else prev.m_next = next.m_next; next.m_next = null; return first; } prev = next; next = next.m_next; } assertion(false, "unlink failed!!!"); return null; } /** * Get the number of linked list items. */ int getLength() { int count = 0; MultistepExprHolder next = this; while(null != next) { count++; next = next.m_next; } return count; } /** * Print diagnostics out for the multistep list. */ protected void diagnose() { System.err.print("Found multistep iterators: " + this.getLength() + " "); MultistepExprHolder next = this; while (null != next) { System.err.print("" + next.m_stepCount); next = next.m_next; if (null != next) System.err.print(", "); } System.err.println(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemLiteralResult.java0000644000175000017500000013171110721374033025445 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemLiteralResult.java 476350 2006-11-17 22:53:23Z minchau $ */ package org.apache.xalan.templates; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.StringVector; import org.apache.xpath.XPathContext; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import org.w3c.dom.UserDataHandler; import org.xml.sax.SAXException; /** * Implement a Literal Result Element. * @see literal-result-element in XSLT Specification * @xsl.usage advanced */ public class ElemLiteralResult extends ElemUse { static final long serialVersionUID = -8703409074421657260L; /** The return value as Empty String. */ private static final String EMPTYSTRING = ""; /** * Tells if this element represents a root element * that is also the stylesheet element. * TODO: This should be a derived class. * @serial */ private boolean isLiteralResultAsStylesheet = false; /** * Set whether this element represents a root element * that is also the stylesheet element. * * * @param b boolean flag indicating whether this element * represents a root element that is also the stylesheet element. */ public void setIsLiteralResultAsStylesheet(boolean b) { isLiteralResultAsStylesheet = b; } /** * Return whether this element represents a root element * that is also the stylesheet element. * * * @return boolean flag indicating whether this element * represents a root element that is also the stylesheet element. */ public boolean getIsLiteralResultAsStylesheet() { return isLiteralResultAsStylesheet; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if (null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.fixupVariables(vnames, cstate.getGlobalsSize()); } } } /** * The created element node will have the attribute nodes * that were present on the element node in the stylesheet tree, * other than attributes with names in the XSLT namespace. * @serial */ private List m_avts = null; /** List of attributes with the XSLT namespace. * @serial */ private List m_xslAttr = null; /** * Set a literal result attribute (AVTs only). * * @param avt literal result attribute to add (AVT only) */ public void addLiteralResultAttribute(AVT avt) { if (null == m_avts) m_avts = new ArrayList(); m_avts.add(avt); } /** * Set a literal result attribute (used for xsl attributes). * * @param att literal result attribute to add */ public void addLiteralResultAttribute(String att) { if (null == m_xslAttr) m_xslAttr = new ArrayList(); m_xslAttr.add(att); } /** * Set the "xml:space" attribute. * A text node is preserved if an ancestor element of the text node * has an xml:space attribute with a value of preserve, and * no closer ancestor element has xml:space with a value of default. * @see strip in XSLT Specification * @see section-Creating-Text in XSLT Specification * * @param avt Enumerated value, either Constants.ATTRVAL_PRESERVE * or Constants.ATTRVAL_STRIP. */ public void setXmlSpace(AVT avt) { // This function is a bit-o-hack, I guess... addLiteralResultAttribute(avt); String val = avt.getSimpleString(); if(val.equals("default")) { super.setXmlSpace(Constants.ATTRVAL_STRIP); } else if(val.equals("preserve")) { super.setXmlSpace(Constants.ATTRVAL_PRESERVE); } // else maybe it's a real AVT, so we can't resolve it at this time. } /** * Get a literal result attribute by name. * * @param namespaceURI Namespace URI of attribute node to get * @param localName Local part of qualified name of attribute node to get * * @return literal result attribute (AVT) */ public AVT getLiteralResultAttributeNS(String namespaceURI, String localName) { if (null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); if (avt.getName().equals(localName) && avt.getURI().equals(namespaceURI)) { return avt; } } // end for } return null; } /** * Return the raw value of the attribute. * * @param namespaceURI Namespace URI of attribute node to get * @param localName Local part of qualified name of attribute node to get * * @return The Attr value as a string, or the empty string if that attribute * does not have a specified or default value */ public String getAttributeNS(String namespaceURI, String localName) { AVT avt = getLiteralResultAttributeNS(namespaceURI, localName); if ((null != avt)) { return avt.getSimpleString(); } return EMPTYSTRING; } /** * Get a literal result attribute by name. The name is namespaceURI:localname * if namespace is not null. * * @param name Name of literal result attribute to get * * @return literal result attribute (AVT) */ public AVT getLiteralResultAttribute(String name) { if (null != m_avts) { int nAttrs = m_avts.size(); String namespace = null; for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); namespace = avt.getURI(); if ((namespace != null && (!namespace.equals("")) && (namespace +":"+avt.getName()).equals(name))|| ((namespace == null || namespace.equals(""))&& avt.getRawName().equals(name))) { return avt; } } // end for } return null; } /** * Return the raw value of the attribute. * * @param namespaceURI:localName or localName if the namespaceURI is null of * the attribute to get * * @return The Attr value as a string, or the empty string if that attribute * does not have a specified or default value */ public String getAttribute(String rawName) { AVT avt = getLiteralResultAttribute(rawName); if ((null != avt)) { return avt.getSimpleString(); } return EMPTYSTRING; } /** * Get whether or not the passed URL is flagged by * the "extension-element-prefixes" or "exclude-result-prefixes" * properties. * @see extension-element in XSLT Specification * * @param prefix non-null reference to prefix that might be excluded.(not currently used) * @param uri reference to namespace that prefix maps to * * @return true if the prefix should normally be excluded. */ public boolean containsExcludeResultPrefix(String prefix, String uri) { if (uri == null || (null == m_excludeResultPrefixes && null == m_ExtensionElementURIs) ) return super.containsExcludeResultPrefix(prefix, uri); if (prefix.length() == 0) prefix = Constants.ATTRVAL_DEFAULT_PREFIX; // This loop is ok here because this code only runs during // stylesheet compile time. if(m_excludeResultPrefixes!=null) for (int i =0; i< m_excludeResultPrefixes.size(); i++) { if (uri.equals(getNamespaceForPrefix(m_excludeResultPrefixes.elementAt(i)))) return true; } // JJK Bugzilla 1133: Also check locally-scoped extensions if(m_ExtensionElementURIs!=null && m_ExtensionElementURIs.contains(uri)) return true; return super.containsExcludeResultPrefix(prefix, uri); } /** * Augment resolvePrefixTables, resolving the namespace aliases once * the superclass has resolved the tables. * * @throws TransformerException */ public void resolvePrefixTables() throws TransformerException { super.resolvePrefixTables(); StylesheetRoot stylesheet = getStylesheetRoot(); if ((null != m_namespace) && (m_namespace.length() > 0)) { NamespaceAlias nsa = stylesheet.getNamespaceAliasComposed(m_namespace); if (null != nsa) { m_namespace = nsa.getResultNamespace(); // String resultPrefix = nsa.getResultPrefix(); String resultPrefix = nsa.getStylesheetPrefix(); // As per xsl WG, Mike Kay if ((null != resultPrefix) && (resultPrefix.length() > 0)) m_rawName = resultPrefix + ":" + m_localName; else m_rawName = m_localName; } } if (null != m_avts) { int n = m_avts.size(); for (int i = 0; i < n; i++) { AVT avt = (AVT) m_avts.get(i); // Should this stuff be a method on AVT? String ns = avt.getURI(); if ((null != ns) && (ns.length() > 0)) { NamespaceAlias nsa = stylesheet.getNamespaceAliasComposed(m_namespace); // %REVIEW% ns? if (null != nsa) { String namespace = nsa.getResultNamespace(); // String resultPrefix = nsa.getResultPrefix(); String resultPrefix = nsa.getStylesheetPrefix(); // As per XSL WG String rawName = avt.getName(); if ((null != resultPrefix) && (resultPrefix.length() > 0)) rawName = resultPrefix + ":" + rawName; avt.setURI(namespace); avt.setRawName(rawName); } } } } } /** * Return whether we need to check namespace prefixes * against the exclude result prefixes or extensions lists. * Note that this will create a new prefix table if one * has not been created already. * * NEEDSDOC ($objectName$) @return */ boolean needToCheckExclude() { if (null == m_excludeResultPrefixes && null == getPrefixTable() && m_ExtensionElementURIs==null // JJK Bugzilla 1133 ) return false; else { // Create a new prefix table if one has not already been created. if (null == getPrefixTable()) setPrefixTable(new java.util.ArrayList()); return true; } } /** * The namespace of the element to be created. * @serial */ private String m_namespace; /** * Set the namespace URI of the result element to be created. * Note that after resolvePrefixTables has been called, this will * return the aliased result namespace, not the original stylesheet * namespace. * * @param ns The Namespace URI, or the empty string if the * element has no Namespace URI. */ public void setNamespace(String ns) { if(null == ns) // defensive, shouldn't have to do this. ns = ""; m_namespace = ns; } /** * Get the original namespace of the Literal Result Element. * * %REVIEW% Why isn't this overriding the getNamespaceURI method * rather than introducing a new one? * * @return The Namespace URI, or the empty string if the * element has no Namespace URI. */ public String getNamespace() { return m_namespace; } /** * The local name of the element to be created. * @serial */ private String m_localName; /** * Set the local name of the LRE. * * @param localName The local name (without prefix) of the result element * to be created. */ public void setLocalName(String localName) { m_localName = localName; } /** * Get the local name of the Literal Result Element. * Note that after resolvePrefixTables has been called, this will * return the aliased name prefix, not the original stylesheet * namespace prefix. * * @return The local name (without prefix) of the result element * to be created. */ public String getLocalName() { return m_localName; } /** * The raw name of the element to be created. * @serial */ private String m_rawName; /** * Set the raw name of the LRE. * * @param rawName The qualified name (with prefix), or the * empty string if qualified names are not available. */ public void setRawName(String rawName) { m_rawName = rawName; } /** * Get the raw name of the Literal Result Element. * * @return The qualified name (with prefix), or the * empty string if qualified names are not available. */ public String getRawName() { return m_rawName; } /** * Get the prefix part of the raw name of the Literal Result Element. * * @return The prefix, or the empty string if noprefix was provided. */ public String getPrefix() { int len=m_rawName.length()-m_localName.length()-1; return (len>0) ? m_rawName.substring(0,len) : ""; } /** * The "extension-element-prefixes" property, actually contains URIs. * @serial */ private StringVector m_ExtensionElementURIs; /** * Set the "extension-element-prefixes" property. * @see extension-element in XSLT Specification * * @param v Vector of URIs (not prefixes) to set as the "extension-element-prefixes" property */ public void setExtensionElementPrefixes(StringVector v) { m_ExtensionElementURIs = v; } /** * @see org.w3c.dom.Node * * @return NamedNodeMap */ public NamedNodeMap getAttributes() { return new LiteralElementAttributes(); } public class LiteralElementAttributes implements NamedNodeMap{ private int m_count = -1; /** * Construct a NameNodeMap. * */ public LiteralElementAttributes(){ } /** * Return the number of Attributes on this Element * * @return The number of nodes in this map. The range of valid child * node indices is 0 to length-1 inclusive */ public int getLength() { if (m_count == -1) { if (null != m_avts) m_count = m_avts.size(); else m_count = 0; } return m_count; } /** * Retrieves a node specified by name. * @param name The nodeName of a node to retrieve. * @return A Node (of any type) with the specified * nodeName, or null if it does not * identify any node in this map. */ public Node getNamedItem(String name) { if (getLength() == 0) return null; String uri = null; String localName = name; int index = name.indexOf(":"); if (-1 != index){ uri = name.substring(0, index); localName = name.substring(index+1); } Node retNode = null; Iterator eum = m_avts.iterator(); while (eum.hasNext()){ AVT avt = (AVT) eum.next(); if (localName.equals(avt.getName())) { String nsURI = avt.getURI(); if ((uri == null && nsURI == null) || (uri != null && uri.equals(nsURI))) { retNode = new Attribute(avt, ElemLiteralResult.this); break; } } } return retNode; } /** * Retrieves a node specified by local name and namespace URI. * @param namespaceURI Namespace URI of attribute node to get * @param localName Local part of qualified name of attribute node to * get * @return A Node (of any type) with the specified * nodeName, or null if it does not * identify any node in this map. */ public Node getNamedItemNS(String namespaceURI, String localName) { if (getLength() == 0) return null; Node retNode = null; Iterator eum = m_avts.iterator(); while (eum.hasNext()) { AVT avt = (AVT) eum.next(); if (localName.equals(avt.getName())) { String nsURI = avt.getURI(); if ((namespaceURI == null && nsURI == null) || (namespaceURI != null && namespaceURI.equals(nsURI))) { retNode = new Attribute(avt, ElemLiteralResult.this); break; } } } return retNode; } /** * Returns the indexth item in the map. If index * is greater than or equal to the number of nodes in this * map, this returns null. * @param i The index of the requested item. * @return The node at the indexth position in the map, * or null if that is not a valid index. */ public Node item(int i) { if (getLength() == 0 || i >= m_avts.size()) return null; else return new Attribute(((AVT)m_avts.get(i)), ElemLiteralResult.this); } /** * @see org.w3c.dom.NamedNodeMap * * @param name of the node to remove * * @return The node removed from this map if a node with such * a name exists. * * @throws DOMException */ public Node removeNamedItem(String name) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * @see org.w3c.dom.NamedNodeMap * * @param namespaceURI Namespace URI of the node to remove * @param localName Local part of qualified name of the node to remove * * @return The node removed from this map if a node with such a local * name and namespace URI exists * * @throws DOMException */ public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * Unimplemented. See org.w3c.dom.NamedNodeMap * * @param A node to store in this map * * @return If the new Node replaces an existing node the replaced * Node is returned, otherwise null is returned * * @throws DOMException */ public Node setNamedItem(Node arg) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * Unimplemented. See org.w3c.dom.NamedNodeMap * * @param A node to store in this map * * @return If the new Node replaces an existing node the replaced * Node is returned, otherwise null is returned * * @throws DOMException */ public Node setNamedItemNS(Node arg) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } } public class Attribute implements Attr{ private AVT m_attribute; private Element m_owner = null; /** * Construct a Attr. * */ public Attribute(AVT avt, Element elem){ m_attribute = avt; m_owner = elem; } /** * @see org.w3c.dom.Node * * @param newChild New node to append to the list of this node's * children * * * @throws DOMException */ public Node appendChild(Node newChild) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * @see org.w3c.dom.Node * * @param deep Flag indicating whether to clone deep * (clone member variables) * * @return Returns a duplicate of this node */ public Node cloneNode(boolean deep) { return new Attribute(m_attribute, m_owner); } /** * @see org.w3c.dom.Node * * @return null */ public NamedNodeMap getAttributes() { return null; } /** * @see org.w3c.dom.Node * * @return a NodeList containing no nodes. */ public NodeList getChildNodes() { return new NodeList(){ public int getLength(){ return 0; } public Node item(int index){ return null; } }; } /** * @see org.w3c.dom.Node * * @return null */ public Node getFirstChild() { return null; } /** * @see org.w3c.dom.Node * * @return null */ public Node getLastChild() { return null; } /** * @see org.w3c.dom.Node * * @return the local part of the qualified name of this node */ public String getLocalName() { return m_attribute.getName(); } /** * @see org.w3c.dom.Node * * @return The namespace URI of this node, or null if it is * unspecified */ public String getNamespaceURI() { String uri = m_attribute.getURI(); return (uri.equals(""))?null:uri; } /** * @see org.w3c.dom.Node * * @return null */ public Node getNextSibling() { return null; } /** * @see org.w3c.dom.Node * * @return The name of the attribute */ public String getNodeName() { String uri = m_attribute.getURI(); String localName = getLocalName(); return (uri.equals(""))?localName:uri+":"+localName; } /** * @see org.w3c.dom.Node * * @return The node is an Attr */ public short getNodeType() { return ATTRIBUTE_NODE; } /** * @see org.w3c.dom.Node * * @return The value of the attribute * * @throws DOMException */ public String getNodeValue() throws DOMException { return m_attribute.getSimpleString(); } /** * @see org.w3c.dom.Node * * @return null */ public Document getOwnerDocument() { return m_owner.getOwnerDocument(); } /** * @see org.w3c.dom.Node * * @return the containing element node */ public Node getParentNode() { return m_owner; } /** * @see org.w3c.dom.Node * * @return The namespace prefix of this node, or null if it is * unspecified */ public String getPrefix() { String uri = m_attribute.getURI(); String rawName = m_attribute.getRawName(); return (uri.equals(""))? null:rawName.substring(0, rawName.indexOf(":")); } /** * @see org.w3c.dom.Node * * @return null */ public Node getPreviousSibling() { return null; } /** * @see org.w3c.dom.Node * * @return false */ public boolean hasAttributes() { return false; } /** * @see org.w3c.dom.Node * * @return false */ public boolean hasChildNodes() { return false; } /** * @see org.w3c.dom.Node * * @param newChild New child node to insert * @param refChild Insert in front of this child * * @return null * * @throws DOMException */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * @see org.w3c.dom.Node * * @return Returns false * @since DOM Level 2 */ public boolean isSupported(String feature, String version) { return false; } /** @see org.w3c.dom.Node */ public void normalize(){} /** * @see org.w3c.dom.Node * * @param oldChild Child to be removed * * @return null * * @throws DOMException */ public Node removeChild(Node oldChild) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * @see org.w3c.dom.Node * * @param newChild Replace existing child with this one * @param oldChild Existing child to be replaced * * @return null * * @throws DOMException */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); return null; } /** * @see org.w3c.dom.Node * * @param nodeValue Value to set this node to * * @throws DOMException */ public void setNodeValue(String nodeValue) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); } /** * @see org.w3c.dom.Node * * @param prefix Prefix to set for this node * * @throws DOMException */ public void setPrefix(String prefix) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); } /** * * @return The name of this attribute */ public String getName(){ return m_attribute.getName(); } /** * * @return The value of this attribute returned as string */ public String getValue(){ return m_attribute.getSimpleString(); } /** * * @return The Element node this attribute is attached to * or null if this attribute is not in use */ public Element getOwnerElement(){ return m_owner; } /** * * @return true */ public boolean getSpecified(){ return true; } /** * @see org.w3c.dom.Attr * * @param value Value to set this node to * * @throws DOMException */ public void setValue(String value) throws DOMException { throwDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, XSLTErrorResources.NO_MODIFICATION_ALLOWED_ERR); } public TypeInfo getSchemaTypeInfo() { return null; } public boolean isId( ) { return false; } public Object setUserData(String key, Object data, UserDataHandler handler) { return getOwnerDocument().setUserData( key, data, handler); } public Object getUserData(String key) { return getOwnerDocument().getUserData( key); } public Object getFeature(String feature, String version) { return isSupported(feature, version) ? this : null; } public boolean isEqualNode(Node arg) { return arg == this; } public String lookupNamespaceURI(String specifiedPrefix) { return null; } public boolean isDefaultNamespace(String namespaceURI) { return false; } public String lookupPrefix(String namespaceURI) { return null; } public boolean isSameNode(Node other) { // we do not use any wrapper so the answer is obvious return this == other; } public void setTextContent(String textContent) throws DOMException { setNodeValue(textContent); } public String getTextContent() throws DOMException { return getNodeValue(); // overriden in some subclasses } public short compareDocumentPosition(Node other) throws DOMException { return 0; } public String getBaseURI() { return null; } } /** * Get an "extension-element-prefix" property. * @see extension-element in XSLT Specification * * @param i Index of URI ("extension-element-prefix" property) to get * * @return URI at given index ("extension-element-prefix" property) * * @throws ArrayIndexOutOfBoundsException */ public String getExtensionElementPrefix(int i) throws ArrayIndexOutOfBoundsException { if (null == m_ExtensionElementURIs) throw new ArrayIndexOutOfBoundsException(); return m_ExtensionElementURIs.elementAt(i); } /** * Get the number of "extension-element-prefixes" Strings. * @see extension-element in XSLT Specification * * @return the number of "extension-element-prefixes" Strings */ public int getExtensionElementPrefixCount() { return (null != m_ExtensionElementURIs) ? m_ExtensionElementURIs.size() : 0; } /** * Find out if the given "extension-element-prefix" property is defined. * @see extension-element in XSLT Specification * * @param uri The URI to find * * @return True if the given URI is found */ public boolean containsExtensionElementURI(String uri) { if (null == m_ExtensionElementURIs) return false; return m_ExtensionElementURIs.contains(uri); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_LITERALRESULT; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { // TODO: Need prefix. return m_rawName; } /** * The XSLT version as specified by this element. * @serial */ private String m_version; /** * Set the "version" property. * @see forwards in XSLT Specification * * @param v Version property value to set */ public void setVersion(String v) { m_version = v; } /** * Get the "version" property. * @see forwards in XSLT Specification * * @return Version property value */ public String getVersion() { return m_version; } /** * The "exclude-result-prefixes" property. * @serial */ private StringVector m_excludeResultPrefixes; /** * Set the "exclude-result-prefixes" property. * The designation of a namespace as an excluded namespace is * effective within the subtree of the stylesheet rooted at * the element bearing the exclude-result-prefixes or * xsl:exclude-result-prefixes attribute; a subtree rooted * at an xsl:stylesheet element does not include any stylesheets * imported or included by children of that xsl:stylesheet element. * @see literal-result-element in XSLT Specification * * @param v vector of prefixes that are resolvable to strings. */ public void setExcludeResultPrefixes(StringVector v) { m_excludeResultPrefixes = v; } /** * Tell if the result namespace decl should be excluded. Should be called before * namespace aliasing (I think). * * @param prefix Prefix of namespace to check * @param uri URI of namespace to check * * @return True if the given namespace should be excluded * * @throws TransformerException */ private boolean excludeResultNSDecl(String prefix, String uri) throws TransformerException { if (null != m_excludeResultPrefixes) { return containsExcludeResultPrefix(prefix, uri); } return false; } /** * Copy a Literal Result Element into the Result tree, copy the * non-excluded namespace attributes, copy the attributes not * of the XSLT namespace, and execute the children of the LRE. * @see literal-result-element in XSLT Specification * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { SerializationHandler rhandler = transformer.getSerializationHandler(); try { if (transformer.getDebug()) { // flush any buffered pending processing before // the trace event. rhandler.flushPending(); transformer.getTraceManager().fireTraceEvent(this); } // JJK Bugzilla 3464, test namespace85 -- make sure LRE's // namespace is asserted even if default, since xsl:element // may have changed the context. rhandler.startPrefixMapping(getPrefix(), getNamespace()); // Add namespace declarations. executeNSDecls(transformer); rhandler.startElement(getNamespace(), getLocalName(), getRawName()); } catch (SAXException se) { throw new TransformerException(se); } /* * If we make it to here we have done a successful startElement() * we will do an endElement() call for balance, no matter what happens * in the middle. */ // tException remembers if we had an exception "in the middle" TransformerException tException = null; try { // Process any possible attributes from xsl:use-attribute-sets first super.execute(transformer); //xsl:version, excludeResultPrefixes??? // Process the list of avts next if (null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); XPathContext xctxt = transformer.getXPathContext(); int sourceNode = xctxt.getCurrentNode(); String stringedValue = avt.evaluate(xctxt, sourceNode, this); if (null != stringedValue) { // Important Note: I'm not going to check for excluded namespace // prefixes here. It seems like it's too expensive, and I'm not // even sure this is right. But I could be wrong, so this needs // to be tested against other implementations. rhandler.addAttribute( avt.getURI(), avt.getName(), avt.getRawName(), "CDATA", stringedValue, false); } } // end for } // Now process all the elements in this subtree // TODO: Process m_extensionElementPrefixes && m_attributeSetsNames transformer.executeChildTemplates(this, true); } catch (TransformerException te) { // thrown in finally to prevent original exception consumed by subsequent exceptions tException = te; } catch (SAXException se) { tException = new TransformerException(se); } try { /* we need to do this endElement() to balance the * successful startElement() call even if * there was an exception in the middle. * Otherwise an exception in the middle could cause a system to hang. */ if (transformer.getDebug()) { // flush any buffered pending processing before // the trace event. //rhandler.flushPending(); transformer.getTraceManager().fireTraceEndEvent(this); } rhandler.endElement(getNamespace(), getLocalName(), getRawName()); } catch (SAXException se) { /* we did call endElement(). If thee was an exception * in the middle throw that one, otherwise if there * was an exception from endElement() throw that one. */ if (tException != null) throw tException; else throw new TransformerException(se); } /* If an exception was thrown in the middle but not with startElement() or * or endElement() then its time to let it percolate. */ if (tException != null) throw tException; unexecuteNSDecls(transformer); // JJK Bugzilla 3464, test namespace85 -- balance explicit start. try { rhandler.endPrefixMapping(getPrefix()); } catch (SAXException se) { throw new TransformerException(se); } } /** * Compiling templates requires that we be able to list the AVTs * ADDED 9/5/2000 to support compilation experiment * * @return an Enumeration of the literal result attributes associated * with this element. */ public Iterator enumerateLiteralResultAttributes() { return (null == m_avts) ? null : m_avts.iterator(); } /** * Accept a visitor and call the appropriate method * for this class. * * @param visitor The visitor whose appropriate method will be called. * @return true if the children of the object should be visited. */ protected boolean accept(XSLTVisitor visitor) { return visitor.visitLiteralResultElement(this); } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if (callAttrs && null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.callVisitors(visitor); } } super.callChildVisitors(visitor, callAttrs); } /** * Throw a DOMException * * @param msg key of the error that occured. */ public void throwDOMException(short code, String msg) { String themsg = XSLMessages.createMessage(msg, null); throw new DOMException(code, themsg); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/AVTPart.java0000644000175000017500000000615010721374031023324 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AVTPart.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xml.utils.FastStringBuffer; import org.apache.xpath.XPathContext; /** * Class to hold a part, either a string or XPath, * of an Attribute Value Template. * @xsl.usage internal */ public abstract class AVTPart implements java.io.Serializable, XSLTVisitable { static final long serialVersionUID = -1747749903613916025L; /** * Construct a part. */ public AVTPart(){} /** * Get the AVT part as the original string. * * @return the AVT part as the original string. */ public abstract String getSimpleString(); /** * Write the evaluated value into the given * string buffer. * * @param xctxt The XPath context to use to evaluate this AVT. * @param buf Buffer to write into. * @param context The current source tree context. * @param nsNode The current namespace context (stylesheet tree context). * * @throws javax.xml.transform.TransformerException */ public abstract void evaluate( XPathContext xctxt, FastStringBuffer buf, int context, org.apache.xml.utils.PrefixResolver nsNode) throws javax.xml.transform.TransformerException; /** * Set the XPath support. * * @param support XPathContext to set. */ public void setXPathSupport(XPathContext support){} /** * Tell if this expression or it's subexpressions can traverse outside * the current subtree. * * @return true if traversal outside the context node's subtree can occur. */ public boolean canTraverseOutsideSubtree() { return false; } /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public abstract void fixupVariables(java.util.Vector vars, int globalsSize); } libxalan2-java-2.7.1/src/org/apache/xalan/templates/XUnresolvedVariable.java0000644000175000017500000001420410721374032025767 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XUnresolvedVariable.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.VariableStack; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XObject; /** * An instance of this class holds unto a variable until * it is executed. It is used at this time for global * variables which must (we think) forward reference. */ public class XUnresolvedVariable extends XObject { static final long serialVersionUID = -256779804767950188L; /** The node context for execution. */ transient private int m_context; /** The transformer context for execution. */ transient private TransformerImpl m_transformer; /** An index to the point in the variable stack where we should * begin variable searches for evaluation of expressions. * This is -1 if m_isTopLevel is false. **/ transient private int m_varStackPos = -1; /** An index into the variable stack where the variable context * ends, i.e. at the point we should terminate the search. **/ transient private int m_varStackContext; /** true if this variable or parameter is a global. * @serial */ private boolean m_isGlobal; /** true if this variable or parameter is not currently being evaluated. */ transient private boolean m_doneEval = true; /** * Create an XUnresolvedVariable, that may be executed at a later time. * This is primarily used so that forward referencing works with * global variables. An XUnresolvedVariable is initially pushed * into the global variable stack, and then replaced with the real * thing when it is accessed. * * @param obj Must be a non-null reference to an ElemVariable. * @param sourceNode The node context for execution. * @param transformer The transformer execution context. * @param varStackPos An index to the point in the variable stack where we should * begin variable searches for evaluation of expressions. * @param varStackContext An index into the variable stack where the variable context * ends, i.e. at the point we should terminate the search. * @param isGlobal true if this is a global variable. */ public XUnresolvedVariable(ElemVariable obj, int sourceNode, TransformerImpl transformer, int varStackPos, int varStackContext, boolean isGlobal) { super(obj); m_context = sourceNode; m_transformer = transformer; // For globals, this value will have to be updated once we // have determined how many global variables have been pushed. m_varStackPos = varStackPos; // For globals, this should zero. m_varStackContext = varStackContext; m_isGlobal = isGlobal; } /** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return This object. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { if (!m_doneEval) { this.m_transformer.getMsgMgr().error (xctxt.getSAXLocator(), XSLTErrorResources.ER_REFERENCING_ITSELF, new Object[]{((ElemVariable)this.object()).getName().getLocalName()}); } VariableStack vars = xctxt.getVarStack(); // These three statements need to be combined into one operation. int currentFrame = vars.getStackFrame(); //// vars.setStackFrame(m_varStackPos); ElemVariable velem = (ElemVariable)m_obj; try { m_doneEval = false; if(-1 != velem.m_frameSize) vars.link(velem.m_frameSize); XObject var = velem.getValue(m_transformer, m_context); m_doneEval = true; return var; } finally { // These two statements need to be combined into one operation. // vars.setStackFrame(currentFrame); if(-1 != velem.m_frameSize) vars.unlink(currentFrame); } } /** * Set an index to the point in the variable stack where we should * begin variable searches for evaluation of expressions. * This is -1 if m_isTopLevel is false. * * @param top A valid value that specifies where in the variable * stack the search should begin. */ public void setVarStackPos(int top) { m_varStackPos = top; } /** * Set an index into the variable stack where the variable context * ends, i.e. at the point we should terminate the search. * * @param bottom The point at which the search should terminate, normally * zero for global variables. */ public void setVarStackContext(int bottom) { m_varStackContext = bottom; } /** * Tell what kind of class this is. * * @return CLASS_UNRESOLVEDVARIABLE */ public int getType() { return CLASS_UNRESOLVEDVARIABLE; } /** * Given a request type, return the equivalent string. * For diagnostic purposes. * * @return An informational string. */ public String getTypeString() { return "XUnresolvedVariable (" + object().getClass().getName() + ")"; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/DecimalFormatProperties.java0000644000175000017500000002622610721374031026635 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DecimalFormatProperties.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.text.DecimalFormatSymbols; import org.apache.xml.utils.QName; /** * Implement xsl:decimal-format. *
         * 
         * 
         * 
        * @see format-number in XSLT Specification * @xsl.usage advanced */ public class DecimalFormatProperties extends ElemTemplateElement { static final long serialVersionUID = -6559409339256269446L; /** An instance of DecimalFormatSymbols for this element. * @serial */ DecimalFormatSymbols m_dfs; /** * Constructor DecimalFormatProperties * */ public DecimalFormatProperties(int docOrderNumber) { m_dfs = new java.text.DecimalFormatSymbols(); // Set default values, they can be overiden if necessary. m_dfs.setInfinity(Constants.ATTRVAL_INFINITY); m_dfs.setNaN(Constants.ATTRVAL_NAN); m_docOrderNumber = docOrderNumber; } /** * Return the decimal format Symbols for this element. *

        The xsl:decimal-format element declares a decimal-format, * which controls the interpretation of a format pattern used by * the format-number function. If there is a name attribute, then * the element declares a named decimal-format; otherwise, it * declares the default decimal-format. The value of the name * attribute is a QName, which is expanded as described in [2.4 Qualified Names]. * It is an error to declare either the default decimal-format or a * decimal-format with a given name more than once (even with different * import precedence), unless it is declared every time with the same * value for all attributes (taking into account any default values).

        *

        The other attributes on xsl:decimal-format correspond to the * methods on the JDK 1.1 DecimalFormatSymbols class. For each get/set * method pair there is an attribute defined for the xsl:decimal-format * element.

        * * @return the decimal format Symbols for this element. */ public DecimalFormatSymbols getDecimalFormatSymbols() { return m_dfs; } /** * If there is a name attribute, then the element declares a named * decimal-format; otherwise, it declares the default decimal-format. * @serial */ private QName m_qname = null; /** * Set the "name" attribute. * If there is a name attribute, then the element declares a named * decimal-format; otherwise, it declares the default decimal-format. * * @param qname The name to set as the "name" attribute. */ public void setName(QName qname) { m_qname = qname; } /** * Get the "name" attribute. * If there is a name attribute, then the element declares a named * decimal-format; otherwise, it declares the default decimal-format. * * @return the value of the "name" attribute. */ public QName getName() { if (m_qname == null) return new QName(""); else return m_qname; } /** * Set the "decimal-separator" attribute. * decimal-separator specifies the character used for the decimal sign; * the default value is the period character (.). * * @param ds Character to set as decimal separator */ public void setDecimalSeparator(char ds) { m_dfs.setDecimalSeparator(ds); } /** * Get the "decimal-separator" attribute. * decimal-separator specifies the character used for the decimal sign; * the default value is the period character (.). * * @return the character to use as decimal separator */ public char getDecimalSeparator() { return m_dfs.getDecimalSeparator(); } /** * Set the "grouping-separator" attribute. * grouping-separator specifies the character used as a grouping * (e.g. thousands) separator; the default value is the comma character (,). * * @param gs Character to use a grouping separator */ public void setGroupingSeparator(char gs) { m_dfs.setGroupingSeparator(gs); } /** * Get the "grouping-separator" attribute. * grouping-separator specifies the character used as a grouping * (e.g. thousands) separator; the default value is the comma character (,). * * @return Character to use a grouping separator */ public char getGroupingSeparator() { return m_dfs.getGroupingSeparator(); } /** * Set the "infinity" attribute. * infinity specifies the string used to represent infinity; * the default value is the string Infinity. * * @param inf String to use as the "infinity" attribute. */ public void setInfinity(String inf) { m_dfs.setInfinity(inf); } /** * Get the "infinity" attribute. * infinity specifies the string used to represent infinity; * the default value is the string Infinity. * * @return String to use as the "infinity" attribute. */ public String getInfinity() { return m_dfs.getInfinity(); } /** * Set the "minus-sign" attribute. * minus-sign specifies the character used as the default minus sign; the * default value is the hyphen-minus character (-, #x2D). * * @param v Character to use as minus sign */ public void setMinusSign(char v) { m_dfs.setMinusSign(v); } /** * Get the "minus-sign" attribute. * minus-sign specifies the character used as the default minus sign; the * default value is the hyphen-minus character (-, #x2D). * * @return Character to use as minus sign */ public char getMinusSign() { return m_dfs.getMinusSign(); } /** * Set the "NaN" attribute. * NaN specifies the string used to represent the NaN value; * the default value is the string NaN. * * @param v String to use as the "NaN" attribute. */ public void setNaN(String v) { m_dfs.setNaN(v); } /** * Get the "NaN" attribute. * NaN specifies the string used to represent the NaN value; * the default value is the string NaN. * * @return String to use as the "NaN" attribute. */ public String getNaN() { return m_dfs.getNaN(); } /** * Return the node name. * * @return the element's name */ public String getNodeName() { return Constants.ELEMNAME_DECIMALFORMAT_STRING; } /** * Set the "percent" attribute. * percent specifies the character used as a percent sign; the default * value is the percent character (%). * * @param v Character to use as percent */ public void setPercent(char v) { m_dfs.setPercent(v); } /** * Get the "percent" attribute. * percent specifies the character used as a percent sign; the default * value is the percent character (%). * * @return Character to use as percent */ public char getPercent() { return m_dfs.getPercent(); } /** * Set the "per-mille" attribute. * per-mille specifies the character used as a per mille sign; the default * value is the Unicode per-mille character (#x2030). * * @param v Character to use as per-mille */ public void setPerMille(char v) { m_dfs.setPerMill(v); } /** * Get the "per-mille" attribute. * per-mille specifies the character used as a per mille sign; the default * value is the Unicode per-mille character (#x2030). * * @return Character to use as per-mille */ public char getPerMille() { return m_dfs.getPerMill(); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_DECIMALFORMAT; } /** * Set the "zero-digit" attribute. * zero-digit specifies the character used as the digit zero; the default * value is the digit zero (0). * * @param v Character to use as the digit zero */ public void setZeroDigit(char v) { m_dfs.setZeroDigit(v); } /** * Get the "zero-digit" attribute. * zero-digit specifies the character used as the digit zero; the default * value is the digit zero (0). * * @return Character to use as the digit zero */ public char getZeroDigit() { return m_dfs.getZeroDigit(); } /** * Set the "digit" attribute. * digit specifies the character used for a digit in the format pattern; * the default value is the number sign character (#). * * @param v Character to use for a digit in format pattern */ public void setDigit(char v) { m_dfs.setDigit(v); } /** * Get the "digit" attribute. * digit specifies the character used for a digit in the format pattern; * the default value is the number sign character (#). * * @return Character to use for a digit in format pattern */ public char getDigit() { return m_dfs.getDigit(); } /** * Set the "pattern-separator" attribute. * pattern-separator specifies the character used to separate positive * and negative sub patterns in a pattern; the default value is the * semi-colon character (;). * * @param v Character to use as a pattern separator */ public void setPatternSeparator(char v) { m_dfs.setPatternSeparator(v); } /** * Get the "pattern-separator" attribute. * pattern-separator specifies the character used to separate positive * and negative sub patterns in a pattern; the default value is the * semi-colon character (;). * * @return Character to use as a pattern separator */ public char getPatternSeparator() { return m_dfs.getPatternSeparator(); } /** * This function is called to recompose() all of the decimal format properties elements. * * @param root Stylesheet root */ public void recompose(StylesheetRoot root) { root.recomposeDecimalFormats(this); } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/ElemForEach.java0000644000175000017500000003662010721374032024163 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElemForEach.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.NodeSorter; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.utils.IntStack; import org.apache.xpath.Expression; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import java.io.ObjectInputStream; import java.io.IOException; /** * Implement xsl:for-each. *
         * 
         *
         * 
         * 
        * @see for-each in XSLT Specification * @xsl.usage advanced */ public class ElemForEach extends ElemTemplateElement implements ExpressionOwner { static final long serialVersionUID = 6018140636363583690L; /** Set true to request some basic status reports */ static final boolean DEBUG = false; /** * This is set by an "xalan-doc-cache-off" pi, or the old "xalan:doc-cache-off" pi. * The old form of the PI only works for XML parsers that are not namespace aware. * It tells the engine that * documents created in the location paths executed by this element * will not be reparsed. It's set by StylesheetHandler during * construction. Note that this feature applies _only_ to xsl:for-each * elements in its current incarnation; a more general cache management * solution is desperately needed. */ public boolean m_doc_cache_off=false; /** * Construct a element representing xsl:for-each. */ public ElemForEach(){} /** * The "select" expression. * @serial */ protected Expression m_selectExpression = null; /** * Used to fix bug#16889 * Store XPath away for later processing. */ protected XPath m_xpath = null; /** * Set the "select" attribute. * * @param xpath The XPath expression for the "select" attribute. */ public void setSelect(XPath xpath) { m_selectExpression = xpath.getExpression(); // The following line is part of the codes added to fix bug#16889 // Store xpath which will be needed when firing Selected Event m_xpath = xpath; } /** * Get the "select" attribute. * * @return The XPath expression for the "select" attribute. */ public Expression getSelect() { return m_selectExpression; } /** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. * * NEEDSDOC @param sroot * * @throws TransformerException */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); int length = getSortElemCount(); for (int i = 0; i < length; i++) { getSortElem(i).compose(sroot); } java.util.Vector vnames = sroot.getComposeState().getVariableNames(); if (null != m_selectExpression) m_selectExpression.fixupVariables( vnames, sroot.getComposeState().getGlobalsSize()); else { m_selectExpression = getStylesheetRoot().m_selectDefault.getExpression(); } } /** * This after the template's children have been composed. */ public void endCompose(StylesheetRoot sroot) throws TransformerException { int length = getSortElemCount(); for (int i = 0; i < length; i++) { getSortElem(i).endCompose(sroot); } super.endCompose(sroot); } // /** // * This function is called after everything else has been // * recomposed, and allows the template to set remaining // * values that may be based on some other property that // * depends on recomposition. // * // * @throws TransformerException // */ // public void compose() throws TransformerException // { // // if (null == m_selectExpression) // { // m_selectExpression = // getStylesheetRoot().m_selectDefault.getExpression(); // } // } /** * Vector containing the xsl:sort elements associated with this element. * @serial */ protected Vector m_sortElems = null; /** * Get the count xsl:sort elements associated with this element. * @return The number of xsl:sort elements. */ public int getSortElemCount() { return (m_sortElems == null) ? 0 : m_sortElems.size(); } /** * Get a xsl:sort element associated with this element. * * @param i Index of xsl:sort element to get * * @return xsl:sort element at given index */ public ElemSort getSortElem(int i) { return (ElemSort) m_sortElems.elementAt(i); } /** * Set a xsl:sort element associated with this element. * * @param sortElem xsl:sort element to set */ public void setSortElem(ElemSort sortElem) { if (null == m_sortElems) m_sortElems = new Vector(); m_sortElems.addElement(sortElem); } /** * Get an int constant identifying the type of element. * @see org.apache.xalan.templates.Constants * * @return The token ID for this element */ public int getXSLToken() { return Constants.ELEMNAME_FOREACH; } /** * Return the node name. * * @return The element's name */ public String getNodeName() { return Constants.ELEMNAME_FOREACH_STRING; } /** * Execute the xsl:for-each transformation * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute(TransformerImpl transformer) throws TransformerException { transformer.pushCurrentTemplateRuleIsNull(true); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this);//trigger for-each element event try { transformSelectedNodes(transformer); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); transformer.popCurrentTemplateRuleIsNull(); } } /** * Get template element associated with this * * * @return template element associated with this (itself) */ protected ElemTemplateElement getTemplateMatch() { return this; } /** * Sort given nodes * * * @param xctxt The XPath runtime state for the sort. * @param keys Vector of sort keyx * @param sourceNodes Iterator of nodes to sort * * @return iterator of sorted nodes * * @throws TransformerException */ public DTMIterator sortNodes( XPathContext xctxt, Vector keys, DTMIterator sourceNodes) throws TransformerException { NodeSorter sorter = new NodeSorter(xctxt); sourceNodes.setShouldCacheNodes(true); sourceNodes.runTo(-1); xctxt.pushContextNodeList(sourceNodes); try { sorter.sort(sourceNodes, keys, xctxt); sourceNodes.setCurrentPos(0); } finally { xctxt.popContextNodeList(); } return sourceNodes; } /** * Perform a query if needed, and call transformNode for each child. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException Thrown in a variety of circumstances. * @xsl.usage advanced */ public void transformSelectedNodes(TransformerImpl transformer) throws TransformerException { final XPathContext xctxt = transformer.getXPathContext(); final int sourceNode = xctxt.getCurrentNode(); DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt, sourceNode); try { final Vector keys = (m_sortElems == null) ? null : transformer.processSortKeys(this, sourceNode); // Sort if we need to. if (null != keys) sourceNodes = sortNodes(xctxt, keys, sourceNodes); if (transformer.getDebug()) { // The original code, which is broken for bug#16889, // which fails to get the original select expression in the select event. /* transformer.getTraceManager().fireSelectedEvent( * sourceNode, * this, * "select", * new XPath(m_selectExpression), * new org.apache.xpath.objects.XNodeSet(sourceNodes)); */ // The following code fixes bug#16889 // Solution: Store away XPath in setSelect(Xath), and use it here. // Pass m_xath, which the current node is associated with, onto the TraceManager. Expression expr = m_xpath.getExpression(); org.apache.xpath.objects.XObject xObject = expr.execute(xctxt); int current = xctxt.getCurrentNode(); transformer.getTraceManager().fireSelectedEvent( current, this, "select", m_xpath, xObject); } xctxt.pushCurrentNode(DTM.NULL); IntStack currentNodes = xctxt.getCurrentNodeStack(); xctxt.pushCurrentExpressionNode(DTM.NULL); IntStack currentExpressionNodes = xctxt.getCurrentExpressionNodeStack(); xctxt.pushSAXLocatorNull(); xctxt.pushContextNodeList(sourceNodes); transformer.pushElemTemplateElement(null); // pushParams(transformer, xctxt); // Should be able to get this from the iterator but there must be a bug. DTM dtm = xctxt.getDTM(sourceNode); int docID = sourceNode & DTMManager.IDENT_DTM_DEFAULT; int child; while (DTM.NULL != (child = sourceNodes.nextNode())) { currentNodes.setTop(child); currentExpressionNodes.setTop(child); if ((child & DTMManager.IDENT_DTM_DEFAULT) != docID) { dtm = xctxt.getDTM(child); docID = child & DTMManager.IDENT_DTM_DEFAULT; } //final int exNodeType = dtm.getExpandedTypeID(child); final int nodeType = dtm.getNodeType(child); // Fire a trace event for the template. if (transformer.getDebug()) { transformer.getTraceManager().fireTraceEvent(this); } // And execute the child templates. // Loop through the children of the template, calling execute on // each of them. for (ElemTemplateElement t = this.m_firstChild; t != null; t = t.m_nextSibling) { xctxt.setSAXLocator(t); transformer.setCurrentElement(t); t.execute(transformer); } if (transformer.getDebug()) { // We need to make sure an old current element is not // on the stack. See TransformerImpl#getElementCallstack. transformer.setCurrentElement(null); transformer.getTraceManager().fireTraceEndEvent(this); } // KLUGE: Implement // ASSUMPTION: This will be set only when the XPath was indeed // a call to the Document() function. Calling it in other // situations is likely to fry Xalan. // // %REVIEW% We need a MUCH cleaner solution -- one that will // handle cleaning up after document() and getDTM() in other // contexts. The whole SourceTreeManager mechanism should probably // be moved into DTMManager rather than being explicitly invoked in // FuncDocument and here. if(m_doc_cache_off) { if(DEBUG) System.out.println("JJK***** CACHE RELEASE *****\n"+ "\tdtm="+dtm.getDocumentBaseURI()); // NOTE: This will work because this is _NOT_ a shared DTM, and thus has // only a single Document node. If it could ever be an RTF or other // shared DTM, this would require substantial rework. xctxt.getSourceTreeManager().removeDocumentFromCache(dtm.getDocument()); xctxt.release(dtm,false); } } } finally { if (transformer.getDebug()) transformer.getTraceManager().fireSelectedEndEvent(sourceNode, this, "select", new XPath(m_selectExpression), new org.apache.xpath.objects.XNodeSet(sourceNodes)); xctxt.popSAXLocator(); xctxt.popContextNodeList(); transformer.popElemTemplateElement(); xctxt.popCurrentExpressionNode(); xctxt.popCurrentNode(); sourceNodes.detach(); } } /** * Add a child to the child list. * * * * @param newChild Child to add to child list * * @return Child just added to child list */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); if (Constants.ELEMNAME_SORT == type) { setSortElem((ElemSort) newChild); return newChild; } else return super.appendChild(newChild); } /** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ public void callChildVisitors(XSLTVisitor visitor, boolean callAttributes) { if(callAttributes && (null != m_selectExpression)) m_selectExpression.callVisitors(this, visitor); int length = getSortElemCount(); for (int i = 0; i < length; i++) { getSortElem(i).callVisitors(visitor); } super.callChildVisitors(visitor, callAttributes); } /** * @see ExpressionOwner#getExpression() */ public Expression getExpression() { return m_selectExpression; } /** * @see ExpressionOwner#setExpression(Expression) */ public void setExpression(Expression exp) { exp.exprSetParent(this); m_selectExpression = exp; } /* * to keep the binary compatibility, assign a default value for newly added * globel varialbe m_xpath during deserialization of an object which was * serialized using an older version */ private void readObject(ObjectInputStream os) throws IOException, ClassNotFoundException { os.defaultReadObject(); m_xpath = null; } } libxalan2-java-2.7.1/src/org/apache/xalan/templates/FuncFormatNumb.java0000644000175000017500000001412710721374030024733 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FuncFormatNumb.java 468643 2006-10-28 06:56:03Z minchau $ */ package org.apache.xalan.templates; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.utils.QName; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xpath.Expression; import org.apache.xpath.XPathContext; import org.apache.xpath.functions.Function3Args; import org.apache.xpath.functions.WrongNumberArgsException; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute the FormatNumber() function. * @xsl.usage advanced */ public class FuncFormatNumb extends Function3Args { static final long serialVersionUID = -8869935264870858636L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { // A bit of an ugly hack to get our context. ElemTemplateElement templElem = (ElemTemplateElement) xctxt.getNamespaceContext(); StylesheetRoot ss = templElem.getStylesheetRoot(); java.text.DecimalFormat formatter = null; java.text.DecimalFormatSymbols dfs = null; double num = getArg0().execute(xctxt).num(); String patternStr = getArg1().execute(xctxt).str(); // TODO: what should be the behavior here?? if (patternStr.indexOf(0x00A4) > 0) ss.error(XSLTErrorResources.ER_CURRENCY_SIGN_ILLEGAL); // currency sign not allowed // this third argument is not a locale name. It is the name of a // decimal-format declared in the stylesheet!(xsl:decimal-format try { Expression arg2Expr = getArg2(); if (null != arg2Expr) { String dfName = arg2Expr.execute(xctxt).str(); QName qname = new QName(dfName, xctxt.getNamespaceContext()); dfs = ss.getDecimalFormatComposed(qname); if (null == dfs) { warn(xctxt, XSLTErrorResources.WG_NO_DECIMALFORMAT_DECLARATION, new Object[]{ dfName }); //"not found!!! //formatter = new java.text.DecimalFormat(patternStr); } else { //formatter = new java.text.DecimalFormat(patternStr, dfs); formatter = new java.text.DecimalFormat(); formatter.setDecimalFormatSymbols(dfs); formatter.applyLocalizedPattern(patternStr); } } //else if (null == formatter) { // look for a possible default decimal-format dfs = ss.getDecimalFormatComposed(new QName("")); if (dfs != null) { formatter = new java.text.DecimalFormat(); formatter.setDecimalFormatSymbols(dfs); formatter.applyLocalizedPattern(patternStr); } else { dfs = new java.text.DecimalFormatSymbols(java.util.Locale.US); dfs.setInfinity(Constants.ATTRVAL_INFINITY); dfs.setNaN(Constants.ATTRVAL_NAN); formatter = new java.text.DecimalFormat(); formatter.setDecimalFormatSymbols(dfs); if (null != patternStr) formatter.applyLocalizedPattern(patternStr); } } return new XString(formatter.format(num)); } catch (Exception iae) { templElem.error(XSLTErrorResources.ER_MALFORMED_FORMAT_STRING, new Object[]{ patternStr }); return XString.EMPTYSTRING; //throw new XSLProcessorException(iae); } } /** * Warn the user of a problem. * * @param xctxt The XPath runtime state. * @param msg Warning message key * @param args Arguments to be used in warning message * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide * the error condition is severe enough to halt processing. * * @throws javax.xml.transform.TransformerException */ public void warn(XPathContext xctxt, String msg, Object args[]) throws javax.xml.transform.TransformerException { String formattedMsg = XSLMessages.createWarning(msg, args); ErrorListener errHandler = xctxt.getErrorListener(); errHandler.warning(new TransformerException(formattedMsg, (SAXSourceLocator)xctxt.getSAXLocator())); } /** * Overide the superclass method to allow one or two arguments. * * * @param argNum Number of arguments passed in * * @throws WrongNumberArgsException */ public void checkNumberArgs(int argNum) throws WrongNumberArgsException { if ((argNum > 3) || (argNum < 2)) reportWrongNumberArgs(); } /** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createMessage(XSLTErrorResources.ER_TWO_OR_THREE, null)); //"2 or 3"); } } libxalan2-java-2.7.1/src/org/apache/xalan/Version.java0000644000175000017500000001146310721374033021477 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xalan; /** * Administrative class to keep track of the version number of * the Xalan release. *

        This class implements the upcoming standard of having * org.apache.project-name.Version.getVersion() be a standard way * to get version information. This class will replace the older * org.apache.xalan.processor.Version class.

        *

        See also: org/apache/xalan/res/XSLTInfo.properties for * information about the version of the XSLT spec we support.

        * @xsl.usage general */ public class Version { /** * Get the basic version string for the current Xalan release. * Version String formatted like * "Xalan Java v.r[.dd| Dnn]". * * Futurework: have this read version info from jar manifest. * * @return String denoting our current version */ public static String getVersion() { return getProduct()+" "+getImplementationLanguage()+" " +getMajorVersionNum()+"."+getReleaseVersionNum()+"." +( (getDevelopmentVersionNum() > 0) ? ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum())); } /** * Print the processor version to the command line. * * @param argv command line arguments, unused. */ public static void main(String argv[]) { System.out.println(getVersion()); } /** * Name of product: Xalan. */ public static String getProduct() { return "Xalan"; } /** * Implementation Language: Java. */ public static String getImplementationLanguage() { return "Java"; } /** * Major version number. * Version number. This changes only when there is a * significant, externally apparent enhancement from * the previous release. 'n' represents the n'th * version. * * Clients should carefully consider the implications * of new versions as external interfaces and behaviour * may have changed. */ public static int getMajorVersionNum() { return 2; } /** * Release Number. * Release number. This changes when: * - a new set of functionality is to be added, eg, * implementation of a new W3C specification. * - API or behaviour change. * - its designated as a reference release. */ public static int getReleaseVersionNum() { return 7; } /** * Maintenance Drop Number. * Optional identifier used to designate maintenance * drop applied to a specific release and contains * fixes for defects reported. It maintains compatibility * with the release and contains no API changes. * When missing, it designates the final and complete * development drop for a release. */ public static int getMaintenanceVersionNum() { return 1; } /** * Development Drop Number. * Optional identifier designates development drop of * a specific release. D01 is the first development drop * of a new release. * * Development drops are works in progress towards a * compeleted, final release. A specific development drop * may not completely implement all aspects of a new * feature, which may take several development drops to * complete. At the point of the final drop for the * release, the D suffix will be omitted. * * Each 'D' drops can contain functional enhancements as * well as defect fixes. 'D' drops may not be as stable as * the final releases. */ public static int getDevelopmentVersionNum() { try { if ((new String("")).length() == 0) return 0; else return Integer.parseInt(""); } catch (NumberFormatException nfe) { return 0; } } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/0000755000175000017500000000000010736146354017761 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/0000755000175000017500000000000010736146354020560 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/SecuritySupport.java0000644000175000017500000000745210721374030024623 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/PooledConnection.java0000644000175000017500000000423610721374032024660 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PooledConnection.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.sql.Connection; import java.sql.SQLException; /** */ public class PooledConnection { // Real JDBC Connection /** */ private Connection connection = null; // boolean flag used to determine if connection is in use /** */ private boolean inuse = false; // Constructor that takes the passed in JDBC Connection // and stores it in the connection attribute. /** * @param value */ public PooledConnection( Connection value ) { if ( value != null ) { connection = value; } } /** * Returns a reference to the JDBC Connection * @return Connection */ public Connection getConnection( ) { // get the JDBC Connection return connection; } /** * Set the status of the PooledConnection. * * @param value * */ public void setInUse( boolean value ) { inuse = value; } /** * Returns the current status of the PooledConnection. * */ public boolean inUse( ) { return inuse; } /** * Close the real JDBC Connection * */ public void close( ) { try { connection.close(); } catch (SQLException sqle) { System.err.println(sqle.getMessage()); } } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/SecuritySupport12.java0000644000175000017500000001175710721374030024771 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/SQLQueryParser.java0000644000175000017500000003101710721374032024255 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SQLQueryParser.java 468638 2006-10-28 06:52:06Z minchau $ */ /** * This is used by the SQLDocumentHandler for processing JDBC queries. * This prepares JDBC PreparedStatement or CallableStatements and the * input/output of parameters from/to variables. * */ package org.apache.xalan.lib.sql; import java.util.*; import java.sql.*; import org.apache.xpath.objects.*; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xml.utils.QName; import javax.xml.transform.TransformerException; public class SQLQueryParser { /** * If the parser used inline parser to pull out variables then * this will be true. The default is not to use the Inline Parser. */ private boolean m_InlineVariables = false; /** * */ private boolean m_IsCallable = false; /** * */ private String m_OrigQuery = null; /** * */ private StringBuffer m_ParsedQuery = null; /** * */ private Vector m_Parameters = null; /** * */ private boolean m_hasOutput = false; /** * */ private boolean m_HasParameters; public static final int NO_OVERRIDE = 0; public static final int NO_INLINE_PARSER = 1; public static final int INLINE_PARSER = 2; /** * The SQLStatement Parser will be created as a psuedo SINGLETON per * XConnection. Since we are only caching the Query and its parsed results * we may be able to use this as a real SINGLETON. It all depends on how * Statement Caching will play out. */ public SQLQueryParser() { init(); } /** * Constructor, used to create a new parser entry */ private SQLQueryParser(String query) { m_OrigQuery = query; } /** * On a per Xconnection basis, we will create a SQLStatemenetParser, from * this parser, individual parsers will be created. The Init method is defined * to initialize all the internal structures that maintains the pool of parsers. */ private void init() { // Do nothing for now. } /** * Produce an SQL Statement Parser based on the incomming query. * * For now we will just create a new object, in the future we may have this * interface cache the queries so that we can take advantage of a preparsed * String. * * If the Inline Parser is not enabled in the Options, no action will be * taken on the parser. This option can be set by the Stylesheet. If the * option is not set or cleared, a default value will be set determined * by the way variables were passed into the system. */ public SQLQueryParser parse(XConnection xconn, String query, int override) { SQLQueryParser parser = new SQLQueryParser(query); // Try to implement caching here, if we found a parser in the cache // then just return the instance otherwise parser.parse(xconn, override); return parser; } /** * Produce an SQL Statement Parser based on the incomming query. * * For now we will just create a new object, in the future we may have this * interface cache the queries so that we can take advantage of a preparsed * String. * * If the Inline Parser is not enabled in the Options, no action will be * taken on the parser. This option can be set by the Stylesheet. If the * option is not set or cleared, a default value will be set determined * by the way variables were passed into the system. */ private void parse(XConnection xconn, int override) { // Grab the Feature here. We could maintain it from the Parent Parser // but that may cause problems if a single XConnection wants to maintain // both Inline Variable Statemens along with NON inline variable statements. m_InlineVariables = "true".equals(xconn.getFeature("inline-variables")); if (override == NO_INLINE_PARSER) m_InlineVariables = false; else if (override == INLINE_PARSER) m_InlineVariables = true; if (m_InlineVariables) inlineParser(); } /** * If a SQL Statement does not have any parameters, then it can be executed * directly. Most SQL Servers use this as a performance advantage since no * parameters need to be parsed then bound. */ public boolean hasParameters() { return m_HasParameters; } /** * If the Inline Parser is used, the parser will note if this stastement is * a plain SQL Statement or a Called Procedure. Called Procudures generally * have output parameters and require special handling. * * Called Procudures that are not processed with the Inline Parser will * still be executed but under the context of a PreparedStatement and * not a CallableStatement. Called Procudures that have output parameters * MUST be handled with the Inline Parser. */ public boolean isCallable() { return m_IsCallable; } /** * */ public Vector getParameters() { return m_Parameters; } /** * The XConnection will use this method to store the Parameters * that were supplied by the style sheet in the case where the * inline parser was not used */ public void setParameters(Vector p) { m_HasParameters = true; m_Parameters = p; } /** * Return a copy of the parsed SQL query that will be set to the * Database system to execute. If the inline parser was not used, * then the original query will be returned. */ public String getSQLQuery() { if (m_InlineVariables) return m_ParsedQuery.toString(); else return m_OrigQuery; } /** * The SQL Statement Parser, when an Inline Parser is used, tracks the XSL * variables used to populate a statement. The data use to popoulate a * can also be provided. If the data is provided, it will overide the * populastion using XSL variables. When the Inline PArser is not used, then * the Data will always be provided. * */ public void populateStatement(PreparedStatement stmt, ExpressionContext ctx) { // Set input parameters from variables. // for ( int indx = returnParm ? 1 : 0 ; indx < m_Parameters.size() ; indx++ ) for ( int indx = 0 ; indx < m_Parameters.size() ; indx++ ) { QueryParameter parm = (QueryParameter) m_Parameters.elementAt(indx); try { if (m_InlineVariables) { XObject value = (XObject)ctx.getVariableOrParam(new QName(parm.getName())); if (value != null) { stmt.setObject( indx + 1, value.object(), parm.getType(), 4); // Currently defaulting scale to 4 - should read this! } else { stmt.setNull(indx + 1, parm.getType()); } } else { String value = parm.getValue(); if (value != null) { stmt.setObject( indx + 1, value, parm.getType(), 4); // Currently defaulting scale to 4 - should read this! } else { stmt.setNull(indx + 1, parm.getType()); } } } catch (Exception tx) { // if ( ! parm.isOutput() ) throw new SQLException(tx.toString()); } } } public void registerOutputParameters(CallableStatement cstmt) throws SQLException { // Register output parameters if call. if ( m_IsCallable && m_hasOutput ) { for ( int indx = 0 ; indx < m_Parameters.size() ; indx++ ) { QueryParameter parm = (QueryParameter) m_Parameters.elementAt(indx); if ( parm.isOutput() ) { //System.out.println("chrysalisSQLStatement() Registering output parameter for parm " + indx); cstmt.registerOutParameter(indx + 1, parm.getType()); } } } } /** * */ protected void inlineParser() { QueryParameter curParm = null; int state = 0; StringBuffer tok = new StringBuffer(); boolean firstword = true; if (m_Parameters == null) m_Parameters = new Vector(); if (m_ParsedQuery == null) m_ParsedQuery = new StringBuffer(); for ( int idx = 0 ; idx < m_OrigQuery.length() ; idx++ ) { char ch = m_OrigQuery.charAt(idx); switch ( state ) { case 0: // Normal if ( ch == '\'' ) state = 1; else if ( ch == '?' ) state = 4; else if ( firstword && (Character.isLetterOrDigit(ch) || ch == '#') ) { tok.append(ch); state = 3; } m_ParsedQuery.append(ch); break; case 1: // In String if ( ch == '\'' ) state = 0; else if ( ch == '\\' ) state = 2; m_ParsedQuery.append(ch); break; case 2: // In escape state = 1; m_ParsedQuery.append(ch); break; case 3: // First word if ( Character.isLetterOrDigit(ch) || ch == '#' || ch == '_' ) tok.append(ch); else { if ( tok.toString().equalsIgnoreCase("call") ) { m_IsCallable = true; if ( curParm != null ) { // returnParm = true; curParm.setIsOutput(true); // hasOutput = true; } } firstword = false; tok = new StringBuffer(); if ( ch == '\'' ) state = 1; else if ( ch == '?' ) state = 4; else state = 0; } m_ParsedQuery.append(ch); break; case 4: // Get variable definition if ( ch == '[' ) state = 5; break; case 5: // Read variable type. if ( !Character.isWhitespace(ch) && ch != '=' ) { tok.append(Character.toUpperCase(ch)); } else if ( tok.length() > 0 ) { // OK we have at least one parameter. m_HasParameters = true; curParm = new QueryParameter(); curParm.setTypeName(tok.toString()); // curParm.type = map_type(curParm.typeName); m_Parameters.addElement(curParm); tok = new StringBuffer(); if ( ch == '=' ) state = 7; else state = 6; } break; case 6: // Look for '=' if ( ch == '=' ) state = 7; break; case 7: // Read variable name. if ( !Character.isWhitespace(ch) && ch != ']' ) tok.append(ch); else if ( tok.length() > 0 ) { curParm.setName(tok.toString()); tok = new StringBuffer(); if ( ch == ']' ) { //param_output.addElement(new Boolean(false)); state = 0; } else state = 8; } break; case 8: // Look for "OUTput. if ( !Character.isWhitespace(ch) && ch != ']' ) { tok.append(ch); } else if ( tok.length() > 0 ) { tok.setLength(3); if ( tok.toString().equalsIgnoreCase("OUT") ) { curParm.setIsOutput(true); m_hasOutput = true; } tok = new StringBuffer(); if ( ch == ']' ) { state = 0; } } break; } } // Prepare statement or call. if ( m_IsCallable ) { m_ParsedQuery.insert(0, '{'); m_ParsedQuery.append('}'); } } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/DefaultConnectionPool.java0000644000175000017500000003346110721374033025657 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DefaultConnectionPool.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Enumeration; import java.util.Iterator; import java.util.Properties; import java.util.Vector; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; /** * For internal connectiones, i.e. Connection information supplies in the * Stylesheet. The Default Connection Pool will be used. */ public class DefaultConnectionPool implements ConnectionPool { /** * A placeholder thast will keep the driver loaded * between calls. */ private Driver m_Driver = null; /** */ private static final boolean DEBUG = false; /** * The basic information to make a JDBC Connection */ private String m_driver = new String(""); /** */ private String m_url = new String(""); /** * The mimimum size of the connection pool, if the * number of available connections falls below this * mark, min connections will be allocated. The Connection * Pool will always be somewhere between MinSize and MinSize*2 */ private int m_PoolMinSize = 1; /** * Always implement the properties mechinism, if the Password * or Username is set seperatly then we will add them to the * property manually. */ private Properties m_ConnectionProtocol = new Properties(); /** * Storage for the PooledConnections */ private Vector m_pool = new Vector(); /** * Are we active ?? */ private boolean m_IsActive = false; /** */ public DefaultConnectionPool( ) {} /** * Return our current Active state * */ public boolean isEnabled( ) { return m_IsActive; } /** * Set the driver call to be used to create connections * @param d * */ public void setDriver( String d ) { m_driver = d; } /** * Set the url used to connect to the database * @param url * */ public void setURL( String url ) { m_url = url; } /** * Go through the connection pool and release any connections * that are not InUse; * */ public void freeUnused( ) { // Iterate over the entire pool closing the // JDBC Connections. Iterator i = m_pool.iterator(); while(i.hasNext()) { PooledConnection pcon = (PooledConnection) i.next(); // If the PooledConnection is not in use, close it if ( pcon.inUse() == false ) { if (DEBUG) { System.err.println("Closing JDBC Connection "); } pcon.close(); i.remove(); } } } /** * Is our ConnectionPool have any connections that are still in Use ?? * */ public boolean hasActiveConnections( ) { return (m_pool.size() > 0); } /** * Set the password in the property set. * @param p * */ public void setPassword( String p ) { m_ConnectionProtocol.put("password", p); } /** * Set the user name in the property set * @param u * */ public void setUser( String u ) { m_ConnectionProtocol.put("user", u); } /** * The Protocol string is used to pass in other connection * properties. A properties file is a general purpose container * * @param p * */ public void setProtocol( Properties p ) { Enumeration e = p.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); m_ConnectionProtocol.put(key, p.getProperty(key)); } } /** * Override the current number of connections to keep in the pool. This * setting will only have effect on a new pool or when a new connection * is requested and there is less connections that this setting. * @param n * */ public void setMinConnections( int n ) { m_PoolMinSize = n; } /** * Try to aquire a new connection, if it succeeds then return * true, else return false. * Note: This method will cause the connection pool to be built. * */ public boolean testConnection( ) { try { if (DEBUG) { System.out.println("Testing Connection"); } Connection conn = getConnection(); if (DEBUG) { DatabaseMetaData dma = conn.getMetaData(); System.out.println("\nConnected to " + dma.getURL()); System.out.println("Driver " + dma.getDriverName()); System.out.println("Version " + dma.getDriverVersion()); System.out.println(""); } if (conn == null) return false; releaseConnection(conn); if (DEBUG) { System.out.println("Testing Connection, SUCCESS"); } return true; } catch(Exception e) { if (DEBUG) { System.out.println("Testing Connection, FAILED"); e.printStackTrace(); } return false; } } // Find an available connection /** * @return Connection * @throws SQLException * @throws IllegalArgumentException */ public synchronized Connection getConnection( )throws IllegalArgumentException, SQLException { PooledConnection pcon = null; // We will fill up the pool any time it is less than the // Minimum. THis could be cause by the enableing and disabling // or the pool. // if ( m_pool.size() < m_PoolMinSize ) { initializePool(); } // find a connection not in use for ( int x = 0; x < m_pool.size(); x++ ) { pcon = (PooledConnection) m_pool.elementAt(x); // Check to see if the Connection is in use if ( pcon.inUse() == false ) { // Mark it as in use pcon.setInUse(true); // return the JDBC Connection stored in the // PooledConnection object return pcon.getConnection(); } } // Could not find a free connection, // create and add a new one // Create a new JDBC Connection Connection con = createConnection(); // Create a new PooledConnection, passing it the JDBC // Connection pcon = new PooledConnection(con); // Mark the connection as in use pcon.setInUse(true); // Add the new PooledConnection object to the pool m_pool.addElement(pcon); // return the new Connection return pcon.getConnection(); } /** * @param con * * @throws SQLException */ public synchronized void releaseConnection( Connection con )throws SQLException { // find the PooledConnection Object for ( int x = 0; x < m_pool.size(); x++ ) { PooledConnection pcon = (PooledConnection) m_pool.elementAt(x); // Check for correct Connection if ( pcon.getConnection() == con ) { if (DEBUG) { System.out.println("Releasing Connection " + x); } if (! isEnabled()) { con.close(); m_pool.removeElementAt(x); if (DEBUG) { System.out.println("-->Inactive Pool, Closing connection"); } } else { // Set it's inuse attribute to false, which // releases it for use pcon.setInUse(false); } break; } } } /** * @param con * * @throws SQLException */ public synchronized void releaseConnectionOnError( Connection con )throws SQLException { // find the PooledConnection Object for ( int x = 0; x < m_pool.size(); x++ ) { PooledConnection pcon = (PooledConnection) m_pool.elementAt(x); // Check for correct Connection if ( pcon.getConnection() == con ) { if (DEBUG) { System.out.println("Releasing Connection On Error" + x); } con.close(); m_pool.removeElementAt(x); if (DEBUG) { System.out.println("-->Inactive Pool, Closing connection"); } break; } } } /** * * @throws SQLException */ private Connection createConnection( )throws SQLException { Connection con = null; // Create a Connection directly from the Driver that was loaded // with the context class loader. This is to support JDK1.4 con = m_Driver.connect(m_url, m_ConnectionProtocol ); return con; } // Initialize the pool /** * * @throws IllegalArgumentException * @throws SQLException */ public synchronized void initializePool( )throws IllegalArgumentException, SQLException { // Check our initial values if ( m_driver == null ) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_DRIVER_NAME_SPECIFIED, null)); // "No Driver Name Specified!"); } if ( m_url == null ) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_URL_SPECIFIED, null)); // "No URL Specified!"); } if ( m_PoolMinSize < 1 ) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_POOLSIZE_LESS_THAN_ONE, null)); // "Pool size is less than 1!"); } // Create the Connections // Load the Driver class file try { // We have also had problems with drivers unloading // load an instance that will get freed with the class. m_Driver = (Driver) ObjectFactory.newInstance( m_driver, ObjectFactory.findClassLoader(), true); // Register the Driver that was loaded with the Context Classloader // but we will ask for connections directly from the Driver // instance DriverManager.registerDriver(m_Driver); } catch(ObjectFactory.ConfigurationError e) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_DRIVER_NAME, null)); // "Invalid Driver Name Specified!"); } catch(Exception e) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_DRIVER_NAME, null)); } // IF we are not active, don't actuall build a pool yet // Just set up the driver and periphal items. if ( !m_IsActive) return; // Create Connections based on the size member do { Connection con = createConnection(); if ( con != null ) { // Create a PooledConnection to encapsulate the // real JDBC Connection PooledConnection pcon = new PooledConnection(con); // Add the Connection the pool. addConnection(pcon); if (DEBUG) System.out.println("Adding DB Connection to the Pool"); } } while (m_pool.size() < m_PoolMinSize); } // Adds the PooledConnection to the pool /** * @param value * */ private void addConnection( PooledConnection value ) { // Add the PooledConnection Object to the vector m_pool.addElement(value); } /** * * @throws Throwable */ protected void finalize( )throws Throwable { if (DEBUG) { System.out.println("In Default Connection Pool, Finalize"); } // Iterate over the entire pool closing the // JDBC Connections. for ( int x = 0; x < m_pool.size(); x++ ) { if (DEBUG) { System.out.println("Closing JDBC Connection " + x); } PooledConnection pcon = (PooledConnection) m_pool.elementAt(x); // If the PooledConnection is not in use, close it if ( pcon.inUse() == false ) { pcon.close(); } else { if (DEBUG) { System.out.println("--> Force close"); } // If it still in use, sleep for 30 seconds and // force close. try { java.lang.Thread.sleep(30000); pcon.close(); } catch (InterruptedException ie) { if (DEBUG) System.err.println(ie.getMessage()); } } } if (DEBUG) { System.out.println("Exit Default Connection Pool, Finalize"); } super.finalize(); } /** * The Pool can be Enabled and Disabled. Disabling the pool * closes all the outstanding Unused connections and any new * connections will be closed upon release. * * @param flag Control the Connection Pool. * If it is enabled then Connections will actuall be held * around. If disabled then all unused connections will be instantly * closed and as connections are released they are closed and removed * from the pool. * * */ public void setPoolEnabled( boolean flag ) { m_IsActive = flag; if ( ! flag ) freeUnused(); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/ConnectionPool.java0000644000175000017500000001077410721374031024352 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ConnectionPool.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; /** * An interface used to build wrapper classes around existing * Connection Pool libraries. * Title: ConnectionPool

        * @author John Gentilin * @version 1.0 */ public interface ConnectionPool { /** * Determine if a Connection Pool has been disabled. If a Connection pool * is disabled, then it will only manage connections that are in use. * */ public boolean isEnabled( ); /** * The Driver and URL are the only required parmeters. * @param d * */ public void setDriver( String d ); /** * @param url * */ public void setURL( String url ); /** * Start downsizeing the pool, this usally happens right after the * pool has been marked as Inactive and we are removing connections * that are not currently inuse. * */ public void freeUnused( ); /** * Provide an indicator to the PoolManager when the Pool can be removed * from the Pool Table. * */ public boolean hasActiveConnections( ); /** * The rest of the protocol parameters can eiter be passed in as * just Username and Password or as a property collection. If the * property collection is used, then the sperate username and password * may be ignored, it is up to the wrapper implementation to handle * the situation. If the connection information changes while after the * pool has been established, the wrapper implementation should ignore * the change and throw an error. * @param p * */ public void setPassword( String p ); /** * @param u * */ public void setUser( String u ); /** * Set tne minimum number of connections that are to be maintained in the * pool. * @param n * */ public void setMinConnections( int n ); /** * Test to see if the connection info is valid to make a real connection * to the database. This method may cause the pool to be crated and filled * with min connections. * */ public boolean testConnection( ); /** * Retrive a database connection from the pool * * @throws SQLException */ public Connection getConnection( )throws SQLException; /** * Return a connection to the pool, the connection may be closed if the * pool is inactive or has exceeded the max number of free connections * @param con * * @throws SQLException */ public void releaseConnection( Connection con )throws SQLException; /** * Provide a mechinism to return a connection to the pool on Error. * A good default behaviour is to close this connection and build * a new one to replace it. Some JDBC impl's won't allow you to * reuse a connection after an error occurs. * @param con * * @throws SQLException */ public void releaseConnectionOnError( Connection con )throws SQLException; /** * The Pool can be Enabled and Disabled. Disabling the pool * closes all the outstanding Unused connections and any new * connections will be closed upon release. * @param flag Control the Connection Pool. If it is enabled * then Connections will actuall be held around. If disabled * then all unused connections will be instantly closed and as * connections are released they are closed and removed from the pool. * */ public void setPoolEnabled( final boolean flag ); /** * Used to pass in extra configuration options during the * database connect phase. */ public void setProtocol(Properties p); } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/QueryParameter.java0000644000175000017500000001672510721374032024372 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: QueryParameter.java 468638 2006-10-28 06:52:06Z minchau $ */ /* This class holds a parameter definition for a JDBC PreparedStatement or CallableStatement. */ package org.apache.xalan.lib.sql; import java.util.Hashtable; import java.sql.PreparedStatement; import java.sql.CallableStatement; import java.sql.Statement; public class QueryParameter { private int m_type; private String m_name; private String m_value; private boolean m_output; private String m_typeName; private static Hashtable m_Typetable = null; public QueryParameter() { m_type = -1; m_name = null; m_value = null; m_output = false; m_typeName = null; } /** * @param v The parameter value. * @param t The type of the parameter. */ public QueryParameter( String v, String t ) { m_name = null; m_value = v; m_output = false; setTypeName(t); } public QueryParameter( String name, String value, String type, boolean out_flag ) { m_name = name; m_value = value; m_output = out_flag; setTypeName(type); } /** * */ public String getValue( ) { return m_value; } /** * @param newValue * */ public void setValue( String newValue ) { m_value = newValue; } /** Used to set the parameter type when the type information is provided in the query. * @param newType The parameter type. * */ public void setTypeName( String newType ) { m_type = map_type(newType); m_typeName = newType; } /** * */ public String getTypeName( ) { return m_typeName; } /** * */ public int getType( ) { return m_type; } /** * */ public String getName() { return m_name; } /** * Set Name, this should really be covered in the constructor but the * QueryParser has a State issue where the name is discoverd after the * Parameter object needs to be created */ public void setName(String n) { m_name = n; } /** * */ public boolean isOutput() { return m_output; } /** * Set Name, this should really be covered in the constructor but the * QueryParser has a State issue where the name is discoverd after the * Parameter object needs to be created */ public void setIsOutput(boolean flag) { m_output = flag; } private static int map_type(String typename) { if ( m_Typetable == null ) { // Load up the type mapping table. m_Typetable = new Hashtable(); m_Typetable.put("BIGINT", new Integer(java.sql.Types.BIGINT)); m_Typetable.put("BINARY", new Integer(java.sql.Types.BINARY)); m_Typetable.put("BIT", new Integer(java.sql.Types.BIT)); m_Typetable.put("CHAR", new Integer(java.sql.Types.CHAR)); m_Typetable.put("DATE", new Integer(java.sql.Types.DATE)); m_Typetable.put("DECIMAL", new Integer(java.sql.Types.DECIMAL)); m_Typetable.put("DOUBLE", new Integer(java.sql.Types.DOUBLE)); m_Typetable.put("FLOAT", new Integer(java.sql.Types.FLOAT)); m_Typetable.put("INTEGER", new Integer(java.sql.Types.INTEGER)); m_Typetable.put("LONGVARBINARY", new Integer(java.sql.Types.LONGVARBINARY)); m_Typetable.put("LONGVARCHAR", new Integer(java.sql.Types.LONGVARCHAR)); m_Typetable.put("NULL", new Integer(java.sql.Types.NULL)); m_Typetable.put("NUMERIC", new Integer(java.sql.Types.NUMERIC)); m_Typetable.put("OTHER", new Integer(java.sql.Types.OTHER)); m_Typetable.put("REAL", new Integer(java.sql.Types.REAL)); m_Typetable.put("SMALLINT", new Integer(java.sql.Types.SMALLINT)); m_Typetable.put("TIME", new Integer(java.sql.Types.TIME)); m_Typetable.put("TIMESTAMP", new Integer(java.sql.Types.TIMESTAMP)); m_Typetable.put("TINYINT", new Integer(java.sql.Types.TINYINT)); m_Typetable.put("VARBINARY", new Integer(java.sql.Types.VARBINARY)); m_Typetable.put("VARCHAR", new Integer(java.sql.Types.VARCHAR)); // Aliases from Xalan SQL extension. m_Typetable.put("STRING", new Integer(java.sql.Types.VARCHAR)); m_Typetable.put("BIGDECIMAL", new Integer(java.sql.Types.NUMERIC)); m_Typetable.put("BOOLEAN", new Integer(java.sql.Types.BIT)); m_Typetable.put("BYTES", new Integer(java.sql.Types.LONGVARBINARY)); m_Typetable.put("LONG", new Integer(java.sql.Types.BIGINT)); m_Typetable.put("SHORT", new Integer(java.sql.Types.SMALLINT)); } Integer type = (Integer) m_Typetable.get(typename.toUpperCase()); int rtype; if ( type == null ) rtype = java.sql.Types.OTHER; else rtype = type.intValue(); return(rtype); } /** * This code was in the XConnection, it is included for reference but it * should not be used. * * @TODO Remove this code as soon as it is determined that its Use Case is * resolved elsewhere. */ /** * Set the parameter for a Prepared Statement * @param pos * @param stmt * @param p * * @throws SQLException */ /* private void setParameter( int pos, PreparedStatement stmt, QueryParameter p )throws SQLException { String type = p.getType(); if (type.equalsIgnoreCase("string")) { stmt.setString(pos, p.getValue()); } if (type.equalsIgnoreCase("bigdecimal")) { stmt.setBigDecimal(pos, new BigDecimal(p.getValue())); } if (type.equalsIgnoreCase("boolean")) { Integer i = new Integer( p.getValue() ); boolean b = ((i.intValue() != 0) ? false : true); stmt.setBoolean(pos, b); } if (type.equalsIgnoreCase("bytes")) { stmt.setBytes(pos, p.getValue().getBytes()); } if (type.equalsIgnoreCase("date")) { stmt.setDate(pos, Date.valueOf(p.getValue())); } if (type.equalsIgnoreCase("double")) { Double d = new Double(p.getValue()); stmt.setDouble(pos, d.doubleValue() ); } if (type.equalsIgnoreCase("float")) { Float f = new Float(p.getValue()); stmt.setFloat(pos, f.floatValue()); } if (type.equalsIgnoreCase("long")) { Long l = new Long(p.getValue()); stmt.setLong(pos, l.longValue()); } if (type.equalsIgnoreCase("short")) { Short s = new Short(p.getValue()); stmt.setShort(pos, s.shortValue()); } if (type.equalsIgnoreCase("time")) { stmt.setTime(pos, Time.valueOf(p.getValue()) ); } if (type.equalsIgnoreCase("timestamp")) { stmt.setTimestamp(pos, Timestamp.valueOf(p.getValue()) ); } } */ } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/SQLErrorDocument.java0000644000175000017500000001450010721374030024557 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SQLErrorDocument.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.sql.SQLException; import java.sql.SQLWarning; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMManager; /** * * A base class that will convert an exception into an XML stream * that can be returned in place of the standard result. The XML * format returned is a follows. * * * The Message for a generic error * * SQL Message from the Exception thrown * SQL Error Code * * * */ /** * The SQL Document is the main controlling class the executesa SQL Query */ public class SQLErrorDocument extends DTMDocument { /** */ private static final String S_EXT_ERROR = "ext-error"; /** */ private static final String S_SQL_ERROR = "sql-error"; /** */ private static final String S_MESSAGE = "message"; /** */ private static final String S_CODE = "code"; /** */ private static final String S_STATE = "state"; /** */ private static final String S_SQL_WARNING = "sql-warning"; /** */ private int m_ErrorExt_TypeID = DTM.NULL; /** */ private int m_Message_TypeID = DTM.NULL; /** */ private int m_Code_TypeID = DTM.NULL; /** */ private int m_State_TypeID = DTM.NULL; /** */ private int m_SQLWarning_TypeID = DTM.NULL; /** */ private int m_SQLError_TypeID = DTM.NULL; /** */ private int m_rootID = DTM.NULL; /** */ private int m_extErrorID = DTM.NULL; /** */ private int m_MainMessageID = DTM.NULL; /** * Build up an SQLErrorDocument that includes the basic error information * along with the Extended SQL Error information. * @param mgr * @param ident * @param error */ public SQLErrorDocument( DTMManager mgr, int ident, SQLException error ) { super(mgr, ident); createExpandedNameTable(); buildBasicStructure(error); int sqlError = addElement(2, m_SQLError_TypeID, m_extErrorID, m_MainMessageID); int element = DTM.NULL; element = addElementWithData( new Integer(error.getErrorCode()), 3, m_Code_TypeID, sqlError, element); element = addElementWithData( error.getLocalizedMessage(), 3, m_Message_TypeID, sqlError, element); // this.dumpDTM(); } /** * Build up an Error Exception with just the Standard Error Information * @param mgr * @param ident * @param error */ public SQLErrorDocument( DTMManager mgr, int ident, Exception error ) { super(mgr, ident); createExpandedNameTable(); buildBasicStructure(error); } /** * Build up an Error Exception with just the Standard Error Information * @param mgr * @param ident * @param error */ public SQLErrorDocument(DTMManager mgr, int ident, Exception error, SQLWarning warning, boolean full) { super(mgr, ident); createExpandedNameTable(); buildBasicStructure(error); SQLException se = null; int prev = m_MainMessageID; boolean inWarnings = false; if ( error != null && error instanceof SQLException ) se = (SQLException)error; else if ( full && warning != null ) { se = warning; inWarnings = true; } while ( se != null ) { int sqlError = addElement(2, inWarnings ? m_SQLWarning_TypeID : m_SQLError_TypeID, m_extErrorID, prev); prev = sqlError; int element = DTM.NULL; element = addElementWithData( new Integer(se.getErrorCode()), 3, m_Code_TypeID, sqlError, element); element = addElementWithData( se.getLocalizedMessage(), 3, m_Message_TypeID, sqlError, element); if ( full ) { String state = se.getSQLState(); if ( state != null && state.length() > 0 ) element = addElementWithData( state, 3, m_State_TypeID, sqlError, element); if ( inWarnings ) se = ((SQLWarning)se).getNextWarning(); else se = se.getNextException(); } else se = null; } } /** * Build up the basic structure that is common for each error. * @param e * @return */ private void buildBasicStructure( Exception e ) { m_rootID = addElement(0, m_Document_TypeID, DTM.NULL, DTM.NULL); m_extErrorID = addElement(1, m_ErrorExt_TypeID, m_rootID, DTM.NULL); m_MainMessageID = addElementWithData (e != null ? e.getLocalizedMessage() : "SQLWarning", 2, m_Message_TypeID, m_extErrorID, DTM.NULL); } /** * Populate the Expanded Name Table with the Node that we will use. * Keep a reference of each of the types for access speed. * @return */ protected void createExpandedNameTable( ) { super.createExpandedNameTable(); m_ErrorExt_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_EXT_ERROR, DTM.ELEMENT_NODE); m_SQLError_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_SQL_ERROR, DTM.ELEMENT_NODE); m_Message_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_MESSAGE, DTM.ELEMENT_NODE); m_Code_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_CODE, DTM.ELEMENT_NODE); m_State_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_STATE, DTM.ELEMENT_NODE); m_SQLWarning_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_SQL_WARNING, DTM.ELEMENT_NODE); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/DTMDocument.java0000644000175000017500000011632210721374033023542 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DTMDocument.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import javax.xml.transform.SourceLocator; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.DTMDefaultBaseIterators; import org.apache.xml.utils.FastStringBuffer; import org.apache.xml.utils.StringBufferPool; import org.apache.xml.utils.SuballocatedIntVector; import org.apache.xml.utils.XMLString; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; /** * The SQL Document is the main controlling class the executesa SQL Query */ public class DTMDocument extends DTMDefaultBaseIterators { /** */ public interface CharacterNodeHandler { /** * @param node * * @throws org.xml.sax.SAXException */ public void characters( Node node )throws org.xml.sax.SAXException ; } /** */ private boolean DEBUG = false; /** */ protected static final String S_NAMESPACE = "http://xml.apache.org/xalan/SQLExtension"; /** */ protected static final String S_ATTRIB_NOT_SUPPORTED = "Not Supported"; /** */ protected static final String S_ISTRUE = "true"; /** */ protected static final String S_ISFALSE = "false"; /** */ protected static final String S_DOCUMENT = "#root"; /** */ protected static final String S_TEXT_NODE = "#text"; /** */ protected static final String S_ELEMENT_NODE = "#element"; /** */ protected int m_Document_TypeID = 0; /** */ protected int m_TextNode_TypeID = 0; /** * Store the SQL Data in this growable array */ protected ObjectArray m_ObjectArray = new ObjectArray(); /** * For each element node, there can be zero or more attributes. If Attributes * are assigned, the first attribute for that element will be use here. * Subsequent elements will use the m_nextsib, m_prevsib array. The sibling * arrays are not meeant to hold indexes to attribute information but as * long as there is not direct connection back into the main DTM tree * we should be OK. */ protected SuballocatedIntVector m_attribute; /** * The Document Index will most likely be 0, but we will reference it * by variable in case that paradigm falls through. */ protected int m_DocumentIdx; /** * @param mgr * @param ident */ public DTMDocument( DTMManager mgr, int ident ) { super(mgr, null, ident, null, mgr.getXMLStringFactory(), true); m_attribute = new SuballocatedIntVector(DEFAULT_BLOCKSIZE); } /** * A common routine that allocates an Object from the Object Array. * One of the common bugs in this code was to allocate an Object and * not incerment m_size, using this method will assure that function. * @param o * */ private int allocateNodeObject( Object o ) { // Need to keep this counter going even if we don't use it. m_size++; return m_ObjectArray.append(o); } /** * @param o * @param level * @param extendedType * @param parent * @param prevsib * */ protected int addElementWithData( Object o, int level, int extendedType, int parent, int prevsib ) { int elementIdx = addElement(level,extendedType,parent,prevsib); int data = allocateNodeObject(o); m_firstch.setElementAt(data,elementIdx); m_exptype.setElementAt(m_TextNode_TypeID, data); // m_level.setElementAt((byte)(level), data); m_parent.setElementAt(elementIdx, data); m_prevsib.setElementAt(DTM.NULL, data); m_nextsib.setElementAt(DTM.NULL, data); m_attribute.setElementAt(DTM.NULL, data); m_firstch.setElementAt(DTM.NULL, data); return elementIdx; } /** * @param level * @param extendedType * @param parent * @param prevsib * */ protected int addElement( int level, int extendedType, int parent, int prevsib ) { int node = DTM.NULL; try { // Add the Node and adjust its Extended Type node = allocateNodeObject(S_ELEMENT_NODE); m_exptype.setElementAt(extendedType, node); m_nextsib.setElementAt(DTM.NULL, node); m_prevsib.setElementAt(prevsib, node); m_parent.setElementAt(parent, node); m_firstch.setElementAt(DTM.NULL, node); // m_level.setElementAt((byte)level, node); m_attribute.setElementAt(DTM.NULL, node); if (prevsib != DTM.NULL) { // If the previous sibling is already assigned, then we are // inserting a value into the chain. if (m_nextsib.elementAt(prevsib) != DTM.NULL) m_nextsib.setElementAt(m_nextsib.elementAt(prevsib), node); // Tell the proevious sibling that they have a new bother/sister. m_nextsib.setElementAt(node, prevsib); } // So if we have a valid parent and the new node ended up being first // in the list, i.e. no prevsib, then set the new node up as the // first child of the parent. Since we chained the node in the list, // there should be no reason to worry about the current first child // of the parent node. if ((parent != DTM.NULL) && (m_prevsib.elementAt(node) == DTM.NULL)) { m_firstch.setElementAt(node, parent); } } catch(Exception e) { error("Error in addElement: "+e.getMessage()); } return node; } /** * Link an attribute to a node, if the node already has one or more * attributes assigned, then just link this one to the attribute list. * The first attribute is attached to the Parent Node (pnode) through the * m_attribute array, subsequent attributes are linked through the * m_prevsib, m_nextsib arrays. * @param o * @param extendedType * @param pnode * */ protected int addAttributeToNode( Object o, int extendedType, int pnode ) { int attrib = DTM.NULL; //int prevsib = DTM.NULL; int lastattrib = DTM.NULL; // int value = DTM.NULL; try { // Add the Node and adjust its Extended Type attrib = allocateNodeObject(o); m_attribute.setElementAt(DTM.NULL, attrib); m_exptype.setElementAt(extendedType, attrib); // m_level.setElementAt((byte)0, attrib); // Clear the sibling references m_nextsib.setElementAt(DTM.NULL, attrib); m_prevsib.setElementAt(DTM.NULL,attrib); // Set the parent, although the was we are using attributes // in the SQL extension this reference will more than likly // be wrong m_parent.setElementAt(pnode, attrib); m_firstch.setElementAt(DTM.NULL, attrib); if (m_attribute.elementAt(pnode) != DTM.NULL) { // OK, we already have an attribute assigned to this // Node, Insert us into the head of the list. lastattrib = m_attribute.elementAt(pnode); m_nextsib.setElementAt(lastattrib, attrib); m_prevsib.setElementAt(attrib, lastattrib); } // Okay set the new attribute up as the first attribute // for the node. m_attribute.setElementAt(attrib, pnode); } catch(Exception e) { error("Error in addAttributeToNode: "+e.getMessage()); } return attrib; } /** * Allow two nodes to share the same set of attributes. There may be some * problems because the parent of any attribute will be the original node * they were assigned to. Need to see how the attribute walker works, then * we should be able to fake it out. * @param toNode * @param fromNode * */ protected void cloneAttributeFromNode( int toNode, int fromNode ) { try { if (m_attribute.elementAt(toNode) != DTM.NULL) { error("Cloneing Attributes, where from Node already had addtibures assigned"); } m_attribute.setElementAt(m_attribute.elementAt(fromNode), toNode); } catch(Exception e) { error("Cloning attributes"); } } /** * @param parm1 * */ public int getFirstAttribute( int parm1 ) { if (DEBUG) System.out.println("getFirstAttribute("+ parm1+")"); int nodeIdx = makeNodeIdentity(parm1); if (nodeIdx != DTM.NULL) { int attribIdx = m_attribute.elementAt(nodeIdx); return makeNodeHandle(attribIdx); } else return DTM.NULL; } /** * @param parm1 * */ public String getNodeValue( int parm1 ) { if (DEBUG) System.out.println("getNodeValue(" + parm1 + ")"); try { Object o = m_ObjectArray.getAt(makeNodeIdentity(parm1)); if (o != null && o != S_ELEMENT_NODE) { return o.toString(); } else { return ""; } } catch(Exception e) { error("Getting String Value"); return null; } } /** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { int nodeIdx = makeNodeIdentity(nodeHandle); if (DEBUG) System.out.println("getStringValue(" + nodeIdx + ")"); Object o = m_ObjectArray.getAt(nodeIdx); if ( o == S_ELEMENT_NODE ) { FastStringBuffer buf = StringBufferPool.get(); String s; try { getNodeData(nodeIdx, buf); s = (buf.length() > 0) ? buf.toString() : ""; } finally { StringBufferPool.free(buf); } return m_xstrf.newstr( s ); } else if( o != null ) { return m_xstrf.newstr(o.toString()); } else return(m_xstrf.emptystr()); } /** * Retrieve the text content of a DOM subtree, appending it into a * user-supplied FastStringBuffer object. Note that attributes are * not considered part of the content of an element. *

        * There are open questions regarding whitespace stripping. * Currently we make no special effort in that regard, since the standard * DOM doesn't yet provide DTD-based information to distinguish * whitespace-in-element-context from genuine #PCDATA. Note that we * should probably also consider xml:space if/when we address this. * DOM Level 3 may solve the problem for us. *

        * %REVIEW% Actually, since this method operates on the DOM side of the * fence rather than the DTM side, it SHOULDN'T do * any special handling. The DOM does what the DOM does; if you want * DTM-level abstractions, use DTM-level methods. * * @param nodeIdx Index of node whose subtree is to be walked, gathering the * contents of all Text or CDATASection nodes. * @param buf FastStringBuffer into which the contents of the text * nodes are to be concatenated. */ protected void getNodeData(int nodeIdx, FastStringBuffer buf) { for ( int child = _firstch(nodeIdx) ; child != DTM.NULL ; child = _nextsib(child) ) { Object o = m_ObjectArray.getAt(child); if ( o == S_ELEMENT_NODE ) getNodeData(child, buf); else if ( o != null ) buf.append(o.toString()); } } /** * @param parm1 * */ public int getNextAttribute( int parm1 ) { int nodeIdx = makeNodeIdentity(parm1); if (DEBUG) System.out.println("getNextAttribute(" + nodeIdx + ")"); if (nodeIdx != DTM.NULL) return makeNodeHandle(m_nextsib.elementAt(nodeIdx)); else return DTM.NULL; } /** * */ protected int getNumberOfNodes( ) { if (DEBUG) System.out.println("getNumberOfNodes()"); return m_size; } /** * */ protected boolean nextNode( ) { if (DEBUG) System.out.println("nextNode()"); return false; } /** * The Expanded Name table holds all of our Node names. The Base class * will add the common element types, need to call this function from * the derived class. * */ protected void createExpandedNameTable( ) { m_Document_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_DOCUMENT, DTM.DOCUMENT_NODE); m_TextNode_TypeID = m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_TEXT_NODE, DTM.TEXT_NODE); } /** * */ public void dumpDTM( ) { try { // File f = new File("DTMDump"+((Object)this).hashCode()+".txt"); File f = new File("DTMDump.txt"); System.err.println("Dumping... "+f.getAbsolutePath()); PrintStream ps = new PrintStream(new FileOutputStream(f)); while (nextNode()){} int nRecords = m_size; ps.println("Total nodes: " + nRecords); for (int i = 0; i < nRecords; i++) { ps.println("=========== " + i + " ==========="); ps.println("NodeName: " + getNodeName(makeNodeHandle(i))); ps.println("NodeNameX: " + getNodeNameX(makeNodeHandle(i))); ps.println("LocalName: " + getLocalName(makeNodeHandle(i))); ps.println("NamespaceURI: " + getNamespaceURI(makeNodeHandle(i))); ps.println("Prefix: " + getPrefix(makeNodeHandle(i))); int exTypeID = getExpandedTypeID(makeNodeHandle(i)); ps.println("Expanded Type ID: " + Integer.toHexString(exTypeID)); int type = getNodeType(makeNodeHandle(i)); String typestring; switch (type) { case DTM.ATTRIBUTE_NODE : typestring = "ATTRIBUTE_NODE"; break; case DTM.CDATA_SECTION_NODE : typestring = "CDATA_SECTION_NODE"; break; case DTM.COMMENT_NODE : typestring = "COMMENT_NODE"; break; case DTM.DOCUMENT_FRAGMENT_NODE : typestring = "DOCUMENT_FRAGMENT_NODE"; break; case DTM.DOCUMENT_NODE : typestring = "DOCUMENT_NODE"; break; case DTM.DOCUMENT_TYPE_NODE : typestring = "DOCUMENT_NODE"; break; case DTM.ELEMENT_NODE : typestring = "ELEMENT_NODE"; break; case DTM.ENTITY_NODE : typestring = "ENTITY_NODE"; break; case DTM.ENTITY_REFERENCE_NODE : typestring = "ENTITY_REFERENCE_NODE"; break; case DTM.NAMESPACE_NODE : typestring = "NAMESPACE_NODE"; break; case DTM.NOTATION_NODE : typestring = "NOTATION_NODE"; break; case DTM.NULL : typestring = "NULL"; break; case DTM.PROCESSING_INSTRUCTION_NODE : typestring = "PROCESSING_INSTRUCTION_NODE"; break; case DTM.TEXT_NODE : typestring = "TEXT_NODE"; break; default : typestring = "Unknown!"; break; } ps.println("Type: " + typestring); int firstChild = _firstch(i); if (DTM.NULL == firstChild) ps.println("First child: DTM.NULL"); else if (NOTPROCESSED == firstChild) ps.println("First child: NOTPROCESSED"); else ps.println("First child: " + firstChild); int prevSibling = _prevsib(i); if (DTM.NULL == prevSibling) ps.println("Prev sibling: DTM.NULL"); else if (NOTPROCESSED == prevSibling) ps.println("Prev sibling: NOTPROCESSED"); else ps.println("Prev sibling: " + prevSibling); int nextSibling = _nextsib(i); if (DTM.NULL == nextSibling) ps.println("Next sibling: DTM.NULL"); else if (NOTPROCESSED == nextSibling) ps.println("Next sibling: NOTPROCESSED"); else ps.println("Next sibling: " + nextSibling); int parent = _parent(i); if (DTM.NULL == parent) ps.println("Parent: DTM.NULL"); else if (NOTPROCESSED == parent) ps.println("Parent: NOTPROCESSED"); else ps.println("Parent: " + parent); int level = _level(i); ps.println("Level: " + level); ps.println("Node Value: " + getNodeValue(i)); ps.println("String Value: " + getStringValue(i)); ps.println("First Attribute Node: " + m_attribute.elementAt(i)); } } catch(IOException ioe) { ioe.printStackTrace(System.err); throw new RuntimeException(ioe.getMessage()); } } /** * Retrieve the text content of a DOM subtree, appending it into a * user-supplied FastStringBuffer object. Note that attributes are * not considered part of the content of an element. *

        * There are open questions regarding whitespace stripping. * Currently we make no special effort in that regard, since the standard * DOM doesn't yet provide DTD-based information to distinguish * whitespace-in-element-context from genuine #PCDATA. Note that we * should probably also consider xml:space if/when we address this. * DOM Level 3 may solve the problem for us. *

        * %REVIEW% Note that as a DOM-level operation, it can be argued that this * routine _shouldn't_ perform any processing beyond what the DOM already * does, and that whitespace stripping and so on belong at the DTM level. * If you want a stripped DOM view, wrap DTM2DOM around DOM2DTM. * @param node Node whose subtree is to be walked, gathering the * contents of all Text or CDATASection nodes. * @param ch * @param depth * * @throws org.xml.sax.SAXException */ protected static void dispatchNodeData( Node node, ContentHandler ch, int depth )throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE : case Node.DOCUMENT_NODE : case Node.ELEMENT_NODE : { for (Node child = node.getFirstChild(); null != child; child = child.getNextSibling()) { dispatchNodeData(child, ch, depth+1); } } break; case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW% case Node.COMMENT_NODE : if(0 != depth) break; // NOTE: Because this operation works in the DOM space, it does _not_ attempt // to perform Text Coalition. That should only be done in DTM space. case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : case Node.ATTRIBUTE_NODE : String str = node.getNodeValue(); if(ch instanceof CharacterNodeHandler) { ((CharacterNodeHandler)ch).characters(node); } else { ch.characters(str.toCharArray(), 0, str.length()); } break; // /* case Node.PROCESSING_INSTRUCTION_NODE : // // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING); // break; */ default : // ignore break; } } /*********************************************************************/ /*********************************************************************/ /******************* End of Functions we Wrote ***********************/ /*********************************************************************/ /*********************************************************************/ /** * For the moment all the run time properties are ignored by this * class. * @param property a String value * @param value an Object value * */ public void setProperty( String property, Object value ) { } /** * No source information is available for DOM2DTM, so return * null here. * @param node an int value * @return null */ public SourceLocator getSourceLocatorFor( int node ) { return null; } /** * @param parm1 * */ protected int getNextNodeIdentity( int parm1 ) { if (DEBUG) System.out.println("getNextNodeIdenty(" + parm1 + ")"); return DTM.NULL; } /** * @param parm1 * @param parm2 * @param parm3 * */ public int getAttributeNode( int parm1, String parm2, String parm3 ) { if (DEBUG) { System.out.println( "getAttributeNode(" + parm1 + "," + parm2 + "," + parm3 + ")"); } return DTM.NULL; } /** * @param parm1 * */ public String getLocalName( int parm1 ) { // int exID = this.getExpandedTypeID( makeNodeIdentity(parm1) ); int exID = getExpandedTypeID(parm1); if (DEBUG) { DEBUG = false; System.out.print("getLocalName(" + parm1 + ") -> "); System.out.println("..." + getLocalNameFromExpandedNameID(exID) ); DEBUG = true; } return getLocalNameFromExpandedNameID(exID); } /** * @param parm1 * */ public String getNodeName( int parm1 ) { // int exID = getExpandedTypeID( makeNodeIdentity(parm1) ); int exID = getExpandedTypeID( parm1 ); if (DEBUG) { DEBUG = false; System.out.print("getLocalName(" + parm1 + ") -> "); System.out.println("..." + getLocalNameFromExpandedNameID(exID) ); DEBUG = true; } return getLocalNameFromExpandedNameID(exID); } /** * @param parm1 * */ public boolean isAttributeSpecified( int parm1 ) { if (DEBUG) System.out.println("isAttributeSpecified(" + parm1 + ")"); return false; } /** * @param parm1 * */ public String getUnparsedEntityURI( String parm1 ) { if (DEBUG) System.out.println("getUnparsedEntityURI(" + parm1 + ")"); return ""; } /** * */ public DTDHandler getDTDHandler( ) { if (DEBUG) System.out.println("getDTDHandler()"); return null; } /** * @param parm1 * */ public String getPrefix( int parm1 ) { if (DEBUG) System.out.println("getPrefix(" + parm1 + ")"); return ""; } /** * */ public EntityResolver getEntityResolver( ) { if (DEBUG) System.out.println("getEntityResolver()"); return null; } /** * */ public String getDocumentTypeDeclarationPublicIdentifier( ) { if (DEBUG) System.out.println("get_DTD_PubId()"); return ""; } /** * */ public LexicalHandler getLexicalHandler( ) { if (DEBUG) System.out.println("getLexicalHandler()"); return null; } /** * */ public boolean needsTwoThreads( ) { if (DEBUG) System.out.println("needsTwoThreads()"); return false; } /** * */ public ContentHandler getContentHandler( ) { if (DEBUG) System.out.println("getContentHandler()"); return null; } /** * @param parm1 * @param parm2 * * @throws org.xml.sax.SAXException */ public void dispatchToEvents( int parm1, ContentHandler parm2 )throws org.xml.sax.SAXException { if (DEBUG) { System.out.println( "dispathcToEvents(" + parm1 + "," + parm2 + ")"); } return; } /** * @param parm1 * */ public String getNamespaceURI( int parm1 ) { if (DEBUG) System.out.println("getNamespaceURI(" +parm1+")"); return ""; } /** * @param nodeHandle * @param ch * @param normalize * * @throws org.xml.sax.SAXException */ public void dispatchCharactersEvents( int nodeHandle, ContentHandler ch, boolean normalize )throws org.xml.sax.SAXException { if (DEBUG) { System.out.println("dispatchCharacterEvents(" + nodeHandle + "," + ch + "," + normalize + ")"); } if(normalize) { XMLString str = getStringValue(nodeHandle); str = str.fixWhiteSpace(true, true, false); str.dispatchCharactersEvents(ch); } else { Node node = getNode(nodeHandle); dispatchNodeData(node, ch, 0); } } /** * Event overriding for Debug * */ public boolean supportsPreStripping( ) { if (DEBUG) System.out.println("supportsPreStripping()"); return super.supportsPreStripping(); } /** * @param parm1 * */ protected int _exptype( int parm1 ) { if (DEBUG) System.out.println("_exptype(" + parm1 + ")"); return super._exptype( parm1); } /** * @param parm1 * */ protected SuballocatedIntVector findNamespaceContext( int parm1 ) { if (DEBUG) System.out.println("SuballocatedIntVector(" + parm1 + ")"); return super.findNamespaceContext( parm1); } /** * @param parm1 * */ protected int _prevsib( int parm1 ) { if (DEBUG) System.out.println("_prevsib(" + parm1+ ")"); return super._prevsib( parm1); } /** * @param parm1 * */ protected short _type( int parm1 ) { if (DEBUG) System.out.println("_type(" + parm1 + ")"); return super._type( parm1); } /** * @param parm1 * */ public Node getNode( int parm1 ) { if (DEBUG) System.out.println("getNode(" + parm1 + ")"); return super.getNode( parm1); } /** * @param parm1 * */ public int getPreviousSibling( int parm1 ) { if (DEBUG) System.out.println("getPrevSib(" + parm1 + ")"); return super.getPreviousSibling( parm1); } /** * @param parm1 * */ public String getDocumentStandalone( int parm1 ) { if (DEBUG) System.out.println("getDOcStandAlone(" + parm1 + ")"); return super.getDocumentStandalone( parm1); } /** * @param parm1 * */ public String getNodeNameX( int parm1 ) { if (DEBUG) System.out.println("getNodeNameX(" + parm1 + ")"); //return super.getNodeNameX( parm1); return getNodeName(parm1); } /** * @param parm1 * @param parm2 * */ public void setFeature( String parm1, boolean parm2 ) { if (DEBUG) { System.out.println( "setFeature(" + parm1 + "," + parm2 + ")"); } super.setFeature( parm1, parm2); } /** * @param parm1 * */ protected int _parent( int parm1 ) { if (DEBUG) System.out.println("_parent(" + parm1 + ")"); return super._parent( parm1); } /** * @param parm1 * @param parm2 * */ protected void indexNode( int parm1, int parm2 ) { if (DEBUG) System.out.println("indexNode("+parm1+","+parm2+")"); super.indexNode( parm1, parm2); } /** * */ protected boolean getShouldStripWhitespace( ) { if (DEBUG) System.out.println("getShouldStripWS()"); return super.getShouldStripWhitespace(); } /** * */ protected void popShouldStripWhitespace( ) { if (DEBUG) System.out.println("popShouldStripWS()"); super.popShouldStripWhitespace(); } /** * @param parm1 * @param parm2 * */ public boolean isNodeAfter( int parm1, int parm2 ) { if (DEBUG) System.out.println("isNodeAfter(" + parm1 + "," + parm2 + ")"); return super.isNodeAfter( parm1, parm2); } /** * @param parm1 * */ public int getNamespaceType( int parm1 ) { if (DEBUG) System.out.println("getNamespaceType(" + parm1 + ")"); return super.getNamespaceType( parm1); } /** * @param parm1 * */ protected int _level( int parm1 ) { if (DEBUG) System.out.println("_level(" + parm1 + ")"); return super._level( parm1); } /** * @param parm1 * */ protected void pushShouldStripWhitespace( boolean parm1 ) { if (DEBUG) System.out.println("push_ShouldStripWS(" + parm1 + ")"); super.pushShouldStripWhitespace( parm1); } /** * @param parm1 * */ public String getDocumentVersion( int parm1 ) { if (DEBUG) System.out.println("getDocVer("+parm1+")"); return super.getDocumentVersion( parm1); } /** * @param parm1 * @param parm2 * */ public boolean isSupported( String parm1, String parm2 ) { if (DEBUG) System.out.println("isSupported("+parm1+","+parm2+")"); return super.isSupported( parm1, parm2); } /** * @param parm1 * */ protected void setShouldStripWhitespace( boolean parm1 ) { if (DEBUG) System.out.println("set_ShouldStripWS("+parm1+")"); super.setShouldStripWhitespace( parm1); } /** * @param parm1 * @param parm2 * */ protected void ensureSizeOfIndex( int parm1, int parm2 ) { if (DEBUG) System.out.println("ensureSizeOfIndex("+parm1+","+parm2+")"); super.ensureSizeOfIndex( parm1, parm2); } /** * @param parm1 * */ protected void ensureSize( int parm1 ) { if (DEBUG) System.out.println("ensureSize("+parm1+")"); // IntVectors in DTMDefaultBase are now self-sizing, and ensureSize() // is being dropped. //super.ensureSize( parm1); } /** * @param parm1 * */ public String getDocumentEncoding( int parm1 ) { if (DEBUG) System.out.println("getDocumentEncoding("+parm1+")"); return super.getDocumentEncoding( parm1); } /** * @param parm1 * @param parm2 * @param parm3 * */ public void appendChild( int parm1, boolean parm2, boolean parm3 ) { if (DEBUG) { System.out.println( "appendChild(" + parm1 + "," + parm2 + "," + parm3 + ")"); } super.appendChild( parm1, parm2, parm3); } /** * @param parm1 * */ public short getLevel( int parm1 ) { if (DEBUG) System.out.println("getLevel("+parm1+")"); return super.getLevel( parm1); } /** * */ public String getDocumentBaseURI( ) { if (DEBUG) System.out.println("getDocBaseURI()"); return super.getDocumentBaseURI(); } /** * @param parm1 * @param parm2 * @param parm3 * */ public int getNextNamespaceNode( int parm1, int parm2, boolean parm3 ) { if (DEBUG) { System.out.println( "getNextNamesapceNode(" + parm1 + "," + parm2 + "," + parm3 + ")"); } return super.getNextNamespaceNode( parm1, parm2, parm3); } /** * @param parm1 * */ public void appendTextChild( String parm1 ) { if (DEBUG) System.out.println("appendTextChild(" + parm1 + ")"); super.appendTextChild( parm1); } /** * @param parm1 * @param parm2 * @param parm3 * @param parm4 * */ protected int findGTE( int[] parm1, int parm2, int parm3, int parm4 ) { if (DEBUG) { System.out.println( "findGTE("+ parm1 + "," + parm2 + "," + parm3 + ")"); } return super.findGTE( parm1, parm2, parm3, parm4); } /** * @param parm1 * @param parm2 * */ public int getFirstNamespaceNode( int parm1, boolean parm2 ) { if (DEBUG) System.out.println("getFirstNamespaceNode()"); return super.getFirstNamespaceNode( parm1, parm2); } /** * @param parm1 * */ public int getStringValueChunkCount( int parm1 ) { if (DEBUG) System.out.println("getStringChunkCount(" + parm1 + ")"); return super.getStringValueChunkCount( parm1); } /** * @param parm1 * */ public int getLastChild( int parm1 ) { if (DEBUG) System.out.println("getLastChild(" + parm1 + ")"); return super.getLastChild( parm1); } /** * @param parm1 * */ public boolean hasChildNodes( int parm1 ) { if (DEBUG) System.out.println("hasChildNodes(" + parm1 + ")"); return super.hasChildNodes( parm1); } /** * @param parm1 * */ public short getNodeType( int parm1 ) { if (DEBUG) { DEBUG=false; System.out.print("getNodeType(" + parm1 + ") "); int exID = getExpandedTypeID(parm1); String name = getLocalNameFromExpandedNameID(exID); System.out.println( ".. Node name [" + name + "]" + "[" + getNodeType( parm1) + "]"); DEBUG=true; } return super.getNodeType( parm1); } /** * @param parm1 * */ public boolean isCharacterElementContentWhitespace( int parm1 ) { if (DEBUG) System.out.println("isCharacterElementContentWhitespace(" + parm1 +")"); return super.isCharacterElementContentWhitespace( parm1); } /** * @param parm1 * */ public int getFirstChild( int parm1 ) { if (DEBUG) System.out.println("getFirstChild(" + parm1 + ")"); return super.getFirstChild( parm1); } /** * @param parm1 * */ public String getDocumentSystemIdentifier( int parm1 ) { if (DEBUG) System.out.println("getDocSysID(" + parm1 + ")"); return super.getDocumentSystemIdentifier( parm1); } /** * @param parm1 * @param parm2 * */ protected void declareNamespaceInContext( int parm1, int parm2 ) { if (DEBUG) System.out.println("declareNamespaceContext("+parm1+","+parm2+")"); super.declareNamespaceInContext( parm1, parm2); } /** * @param parm1 * */ public String getNamespaceFromExpandedNameID( int parm1 ) { if (DEBUG) { DEBUG = false; System.out.print("getNamespaceFromExpandedNameID("+parm1+")"); System.out.println("..." + super.getNamespaceFromExpandedNameID( parm1) ); DEBUG = true; } return super.getNamespaceFromExpandedNameID( parm1); } /** * @param parm1 * */ public String getLocalNameFromExpandedNameID( int parm1 ) { if (DEBUG) { DEBUG = false; System.out.print("getLocalNameFromExpandedNameID("+parm1+")"); System.out.println("..." + super.getLocalNameFromExpandedNameID( parm1)); DEBUG = true; } return super.getLocalNameFromExpandedNameID( parm1); } /** * @param parm1 * */ public int getExpandedTypeID( int parm1 ) { if (DEBUG) System.out.println("getExpandedTypeID("+parm1+")"); return super.getExpandedTypeID( parm1); } /** * */ public int getDocument( ) { if (DEBUG) System.out.println("getDocument()"); return super.getDocument(); } /** * @param parm1 * @param parm2 * */ protected int findInSortedSuballocatedIntVector( SuballocatedIntVector parm1, int parm2 ) { if (DEBUG) { System.out.println( "findInSortedSubAlloctedVector(" + parm1 + "," + parm2 + ")"); } return super.findInSortedSuballocatedIntVector( parm1, parm2); } /** * @param parm1 * */ public boolean isDocumentAllDeclarationsProcessed( int parm1 ) { if (DEBUG) System.out.println("isDocumentAllDeclProc("+parm1+")"); return super.isDocumentAllDeclarationsProcessed( parm1); } /** * @param parm1 * */ protected void error( String parm1 ) { if (DEBUG) System.out.println("error("+parm1+")"); super.error( parm1); } /** * @param parm1 * */ protected int _firstch( int parm1 ) { if (DEBUG) System.out.println("_firstch("+parm1+")"); return super._firstch( parm1); } /** * @param parm1 * */ public int getOwnerDocument( int parm1 ) { if (DEBUG) System.out.println("getOwnerDoc("+parm1+")"); return super.getOwnerDocument( parm1); } /** * @param parm1 * */ protected int _nextsib( int parm1 ) { if (DEBUG) System.out.println("_nextSib("+parm1+")"); return super._nextsib( parm1); } /** * @param parm1 * */ public int getNextSibling( int parm1 ) { if (DEBUG) System.out.println("getNextSibling("+parm1+")"); return super.getNextSibling( parm1); } /** * */ public boolean getDocumentAllDeclarationsProcessed( ) { if (DEBUG) System.out.println("getDocAllDeclProc()"); return super.getDocumentAllDeclarationsProcessed(); } /** * @param parm1 * */ public int getParent( int parm1 ) { if (DEBUG) System.out.println("getParent("+parm1+")"); return super.getParent( parm1); } /** * @param parm1 * @param parm2 * @param parm3 * */ public int getExpandedTypeID( String parm1, String parm2, int parm3 ) { if (DEBUG) System.out.println("getExpandedTypeID()"); return super.getExpandedTypeID( parm1, parm2, parm3); } /** * @param parm1 * */ public void setDocumentBaseURI( String parm1 ) { if (DEBUG) System.out.println("setDocBaseURI()"); super.setDocumentBaseURI( parm1); } /** * @param parm1 * @param parm2 * @param parm3 * */ public char[] getStringValueChunk( int parm1, int parm2, int[] parm3 ) { if (DEBUG) { System.out.println("getStringChunkValue(" + parm1 + "," + parm2 + ")"); } return super.getStringValueChunk( parm1, parm2, parm3); } /** * @param parm1 * */ public DTMAxisTraverser getAxisTraverser( int parm1 ) { if (DEBUG) System.out.println("getAxixTraverser("+parm1+")"); return super.getAxisTraverser( parm1); } /** * @param parm1 * @param parm2 * */ public DTMAxisIterator getTypedAxisIterator( int parm1, int parm2 ) { if (DEBUG) System.out.println("getTypedAxisIterator("+parm1+","+parm2+")"); return super.getTypedAxisIterator( parm1, parm2); } /** * @param parm1 * */ public DTMAxisIterator getAxisIterator( int parm1 ) { if (DEBUG) System.out.println("getAxisIterator("+parm1+")"); return super.getAxisIterator( parm1); } /** * @param parm1 * */ public int getElementById( String parm1 ) { if (DEBUG) System.out.println("getElementByID("+parm1+")"); return DTM.NULL; } /** * */ public DeclHandler getDeclHandler( ) { if (DEBUG) System.out.println("getDeclHandler()"); return null; } /** * */ public ErrorHandler getErrorHandler( ) { if (DEBUG) System.out.println("getErrorHandler()"); return null; } /** * */ public String getDocumentTypeDeclarationSystemIdentifier( ) { if (DEBUG) System.out.println("get_DTD-SID()"); return null; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/SQLDocument.java0000644000175000017500000007463210721374031023562 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SQLDocument.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.util.Vector; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xpath.XPathContext; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTM; import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.*; import org.apache.xml.dtm.ref.*; /** * The SQL Document is the main controlling class the executesa SQL Query */ public class SQLDocument extends DTMDocument { /** */ private boolean DEBUG = false; /** */ private static final String S_NAMESPACE = "http://xml.apache.org/xalan/SQLExtension"; /** */ private static final String S_SQL = "sql"; /** */ private static final String S_ROW_SET = "row-set"; /** */ private static final String S_METADATA = "metadata"; /** */ private static final String S_COLUMN_HEADER = "column-header"; /** */ private static final String S_ROW = "row"; /** */ private static final String S_COL = "col"; /** */ private static final String S_OUT_PARAMETERS = "out-parameters"; /** */ private static final String S_CATALOGUE_NAME = "catalogue-name"; /** */ private static final String S_DISPLAY_SIZE = "column-display-size"; /** */ private static final String S_COLUMN_LABEL = "column-label"; /** */ private static final String S_COLUMN_NAME = "column-name"; /** */ private static final String S_COLUMN_TYPE = "column-type"; /** */ private static final String S_COLUMN_TYPENAME = "column-typename"; /** */ private static final String S_PRECISION = "precision"; /** */ private static final String S_SCALE = "scale"; /** */ private static final String S_SCHEMA_NAME = "schema-name"; /** */ private static final String S_TABLE_NAME = "table-name"; /** */ private static final String S_CASESENSITIVE = "case-sensitive"; /** */ private static final String S_DEFINITELYWRITABLE = "definitely-writable"; /** */ private static final String S_ISNULLABLE = "nullable"; /** */ private static final String S_ISSIGNED = "signed"; /** */ private static final String S_ISWRITEABLE = "writable"; /** */ private static final String S_ISSEARCHABLE = "searchable"; /** */ private int m_SQL_TypeID = 0; /** */ private int m_MetaData_TypeID = 0; /** */ private int m_ColumnHeader_TypeID = 0; /** */ private int m_RowSet_TypeID = 0; /** */ private int m_Row_TypeID = 0; /** */ private int m_Col_TypeID = 0; /** */ private int m_OutParameter_TypeID = 0; /** */ private int m_ColAttrib_CATALOGUE_NAME_TypeID = 0; /** */ private int m_ColAttrib_DISPLAY_SIZE_TypeID = 0; /** */ private int m_ColAttrib_COLUMN_LABEL_TypeID = 0; /** */ private int m_ColAttrib_COLUMN_NAME_TypeID = 0; /** */ private int m_ColAttrib_COLUMN_TYPE_TypeID = 0; /** */ private int m_ColAttrib_COLUMN_TYPENAME_TypeID = 0; /** */ private int m_ColAttrib_PRECISION_TypeID = 0; /** */ private int m_ColAttrib_SCALE_TypeID = 0; /** */ private int m_ColAttrib_SCHEMA_NAME_TypeID = 0; /** */ private int m_ColAttrib_TABLE_NAME_TypeID = 0; /** */ private int m_ColAttrib_CASESENSITIVE_TypeID = 0; /** */ private int m_ColAttrib_DEFINITELYWRITEABLE_TypeID = 0; /** */ private int m_ColAttrib_ISNULLABLE_TypeID = 0; /** */ private int m_ColAttrib_ISSIGNED_TypeID = 0; /** */ private int m_ColAttrib_ISWRITEABLE_TypeID = 0; /** */ private int m_ColAttrib_ISSEARCHABLE_TypeID = 0; /** * The Statement used to extract the data from the database connection. */ private Statement m_Statement = null; /** * Expression COntext used to creat this document * may be used to grab variables from the XSL processor */ private ExpressionContext m_ExpressionContext = null; /** * The Connection Pool where we has derived all of our connections * for this document */ private ConnectionPool m_ConnectionPool = null; /** * The current ResultSet. */ private ResultSet m_ResultSet = null; /** * The parameter definitions if this is a callable * statement with output parameters. */ private SQLQueryParser m_QueryParser = null; /** * As the column header array is built, keep the node index * for each Column. * The primary use of this is to locate the first attribute for * each column in each row as we add records. */ private int[] m_ColHeadersIdx; /** * An indicator on how many columns are in this query */ private int m_ColCount; /** * The Index of the MetaData Node. Currently the MetaData Node contains the * */ private int m_MetaDataIdx = DTM.NULL; /** * The index of the Row Set node. This is the sibling directly after * the last Column Header. */ private int m_RowSetIdx = DTM.NULL; /** */ private int m_SQLIdx = DTM.NULL; /** * Demark the first row element where we started adding rows into the * Document. */ private int m_FirstRowIdx = DTM.NULL; /** * Keep track of the Last row inserted into the DTM from the ResultSet. * This will be used as the index of the parent Row Element when adding * a row. */ private int m_LastRowIdx = DTM.NULL; /** * Streaming Mode Control, In Streaming mode we reduce the memory * footprint since we only use a single row instance. */ private boolean m_StreamingMode = true; /** * Multiple Result sets mode (metadata inside rowset). */ private boolean m_MultipleResults = false; /** * Flag to detect if an error occured during an operation * Defines how errors are handled and how the SQL Connection * is closed. */ private boolean m_HasErrors = false; /** * Is statement caching enabled. */ private boolean m_IsStatementCachingEnabled = false; /** * XConnection this document came from. */ private XConnection m_XConnection = null; /** * @param mgr * @param ident * @throws SQLException */ // public cSQLDocument(DTMManager mgr, int ident, Statement stmt, // ResultSet singleResult, Vector paramdefs, boolean streamingMode, // boolean multipleResults, boolean statementCachingEnabled) throws SQLException public SQLDocument(DTMManager mgr, int ident) { super(mgr, ident); } /** * This static method simplifies the creation of an SQL Document and allows * us to embedd the complexity of creating / handling the dtmIdent inside * the document. This type of method may better placed inside the DTMDocument * code */ public static SQLDocument getNewDocument(ExpressionContext exprContext) { DTMManager mgr = ((XPathContext.XPathExpressionContext)exprContext).getDTMManager(); DTMManagerDefault mgrDefault = (DTMManagerDefault) mgr; int dtmIdent = mgrDefault.getFirstFreeDTMID(); SQLDocument doc = new SQLDocument(mgr, dtmIdent << DTMManager.IDENT_DTM_NODE_BITS); // Register the document mgrDefault.addDTM(doc, dtmIdent); doc.setExpressionContext(exprContext); return doc; } /** * When building the SQL Document, we need to store the Expression * Context that was used to create the document. This will be se to * reference items int he XSLT process such as any variables that were * present. */ protected void setExpressionContext(ExpressionContext expr) { m_ExpressionContext = expr; } /** * Return the context used to build this document */ public ExpressionContext getExpressionContext() { return m_ExpressionContext; } public void execute(XConnection xconn, SQLQueryParser query) throws SQLException { try { m_StreamingMode = "true".equals(xconn.getFeature("streaming")); m_MultipleResults = "true".equals(xconn.getFeature("multiple-results")); m_IsStatementCachingEnabled = "true".equals(xconn.getFeature("cache-statements")); m_XConnection = xconn; m_QueryParser = query; executeSQLStatement(); createExpandedNameTable(); // Start the document here m_DocumentIdx = addElement(0, m_Document_TypeID, DTM.NULL, DTM.NULL); m_SQLIdx = addElement(1, m_SQL_TypeID, m_DocumentIdx, DTM.NULL); if ( ! m_MultipleResults ) extractSQLMetaData(m_ResultSet.getMetaData()); // Only grab the first row, subsequent rows will be // fetched on demand. // We need to do this here so at least on row is set up // to measure when we are actually reading rows. // We won't grab the first record in case the skip function // is applied prior to looking at the first record. // JCG Changed 9/15/04 // addRowToDTMFromResultSet(); } catch(SQLException e) { m_HasErrors = true; throw e; } } private void executeSQLStatement() throws SQLException { m_ConnectionPool = m_XConnection.getConnectionPool(); Connection conn = m_ConnectionPool.getConnection(); if (! m_QueryParser.hasParameters() ) { m_Statement = conn.createStatement(); m_ResultSet = m_Statement.executeQuery(m_QueryParser.getSQLQuery()); } else if (m_QueryParser.isCallable()) { CallableStatement cstmt = conn.prepareCall(m_QueryParser.getSQLQuery()); m_QueryParser.registerOutputParameters(cstmt); m_QueryParser.populateStatement(cstmt, m_ExpressionContext); m_Statement = cstmt; if (! cstmt.execute()) throw new SQLException("Error in Callable Statement"); m_ResultSet = m_Statement.getResultSet(); } else { PreparedStatement stmt = conn.prepareStatement(m_QueryParser.getSQLQuery()); m_QueryParser.populateStatement(stmt, m_ExpressionContext); m_Statement = stmt; m_ResultSet = stmt.executeQuery(); } } /** * Push the record set forward value rows. Used to help in * SQL pagination. * * @param value */ public void skip( int value ) { try { if (m_ResultSet != null) m_ResultSet.relative(value); } catch(Exception origEx) { // For now let's assume that the relative method is not supported. // So let's do it manually. try { for (int x=0; x= 0 ) ; m_ResultSet = m_Statement.getResultSet(); } else m_ResultSet = null; if ( m_ResultSet != null ) { m_FirstRowIdx = DTM.NULL; addRowToDTMFromResultSet(); } else { Vector parameters = m_QueryParser.getParameters(); // Get output parameters. if ( parameters != null ) { int outParamIdx = addElement(1, m_OutParameter_TypeID, m_SQLIdx, m_RowSetIdx); int lastColID = DTM.NULL; for ( int indx = 0 ; indx < parameters.size() ; indx++ ) { QueryParameter parm = (QueryParameter)parameters.elementAt(indx); if ( parm.isOutput() ) { Object rawobj = ((CallableStatement)m_Statement).getObject(indx + 1); lastColID = addElementWithData(rawobj, 2, m_Col_TypeID, outParamIdx, lastColID); addAttributeToNode(parm.getName(), m_ColAttrib_COLUMN_NAME_TypeID, lastColID); addAttributeToNode(parm.getName(), m_ColAttrib_COLUMN_LABEL_TypeID, lastColID); addAttributeToNode(new Integer(parm.getType()), m_ColAttrib_COLUMN_TYPE_TypeID, lastColID); addAttributeToNode(parm.getTypeName(), m_ColAttrib_COLUMN_TYPENAME_TypeID, lastColID); } } } SQLWarning warn = checkWarnings(); if ( warn != null ) m_XConnection.setError(null, null, warn); } return false; } // If this is the first time here, start the new level if (m_FirstRowIdx == DTM.NULL) { m_FirstRowIdx = addElement(2, m_Row_TypeID, m_RowSetIdx, m_MultipleResults ? m_MetaDataIdx : DTM.NULL); m_LastRowIdx = m_FirstRowIdx; if (m_StreamingMode) { // Let's tie the rows together until the end. m_nextsib.setElementAt(m_LastRowIdx, m_LastRowIdx); } } else { // // If we are in Streaming mode, then only use a single row instance if (! m_StreamingMode) { m_LastRowIdx = addElement(2, m_Row_TypeID, m_RowSetIdx, m_LastRowIdx); } } // If we are not in streaming mode, this will always be DTM.NULL // If we are in streaming mode, it will only be DTM.NULL the first time int colID = _firstch(m_LastRowIdx); // Keep Track of who our parent was when adding new col objects. int pcolID = DTM.NULL; // Columns in JDBC Start at 1 and go to the Extent for (int i=1; i<= m_ColCount; i++) { // Just grab the Column Object Type, we will convert it to a string // later. Object o = m_ResultSet.getObject(i); // Create a new column object if one does not exist. // In Streaming mode, this mechinism will reuse the column // data the second and subsequent row accesses. if (colID == DTM.NULL) { pcolID = addElementWithData(o,3,m_Col_TypeID, m_LastRowIdx, pcolID); cloneAttributeFromNode(pcolID, m_ColHeadersIdx[i-1]); } else { // We must be in streaming mode, so let's just replace the data // If the firstch was not set then we have a major error int dataIdent = _firstch(colID); if (dataIdent == DTM.NULL) { error("Streaming Mode, Data Error"); } else { m_ObjectArray.setAt(dataIdent, o); } } // If // In streaming mode, this will be !DTM.NULL // So if the elements were already established then we // should be able to walk them in order. if (colID != DTM.NULL) { colID = _nextsib(colID); } } // For Col Loop } catch(Exception e) { if (DEBUG) { System.out.println( "SQL Error Fetching next row [" + e.getLocalizedMessage() + "]"); } m_XConnection.setError(e, this, checkWarnings()); m_HasErrors = true; } // Only do a single row... return true; } /** * Used by the XConnection to determine if the Document should * handle the document differently. */ public boolean hasErrors() { return m_HasErrors; } /** * Close down any resources used by this document. If an SQL Error occure * while the document was being accessed, the SQL Connection used to create * this document will be released to the Connection Pool on error. This allows * the COnnection Pool to give special attention to any connection that may * be in a errored state. * */ public void close(boolean flushConnPool ) { try { SQLWarning warn = checkWarnings(); if ( warn != null ) m_XConnection.setError(null, null, warn); } catch(Exception e) {} try { if (null != m_ResultSet) { m_ResultSet.close(); m_ResultSet = null; } } catch(Exception e) {} Connection conn = null; try { if (null != m_Statement) { conn = m_Statement.getConnection(); m_Statement.close(); m_Statement = null; } } catch(Exception e) {} try { if (conn != null) { if (m_HasErrors) m_ConnectionPool.releaseConnectionOnError(conn); else m_ConnectionPool.releaseConnection(conn); // if (flushConnPool) m_ConnectionPool.freeUnused(); } } catch(Exception e) {} getManager().release(this, true); } /** * @return */ protected boolean nextNode( ) { if (DEBUG) System.out.println("nextNode()"); try { return false; // return m_ResultSet.isAfterLast(); } catch(Exception e) { return false; } } /** * @param identity * @return */ protected int _nextsib( int identity ) { // If we are asking for the next row and we have not // been there yet then let's see if we can get another // row from the ResultSet. // if ( m_ResultSet != null ) { int id = _exptype(identity); // We need to prime the pump since we don't do it in execute any more. if (m_FirstRowIdx == DTM.NULL) { addRowToDTMFromResultSet(); } if ( ( id == m_Row_TypeID) && (identity >= m_LastRowIdx) ) { if (DEBUG) System.out.println("reading from the ResultSet"); addRowToDTMFromResultSet(); } else if ( m_MultipleResults && identity == m_RowSetIdx ) { if (DEBUG) System.out.println("reading for next ResultSet"); int startIdx = m_RowSetIdx; while ( startIdx == m_RowSetIdx && m_ResultSet != null ) addRowToDTMFromResultSet(); } } return super._nextsib(identity); } public void documentRegistration() { if (DEBUG) System.out.println("Document Registration"); } public void documentRelease() { if (DEBUG) System.out.println("Document Release"); } public SQLWarning checkWarnings() { SQLWarning warn = null; if ( m_Statement != null ) { try { warn = m_Statement.getWarnings(); m_Statement.clearWarnings(); } catch (SQLException se) {} } return(warn); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/package.html0000644000175000017500000001143410721374030023030 0ustar mkochmkoch Xalan SQL Extension

        Provides extension functions for connecting to a JDBC data source, executing a query, and working incrementally through a "streamable" result set. Streaming (reuse of a single row node to traverse the result set) is the default mode of operation. If you want unlimited access to the entire result set, you can cache the query result set (1 row node for each row in the result set).

        If you use streaming mode (the default), you can only access row elements one at a time moving forward through the result set. The use of XPath expressions in your stylesheet, for example, that attempt to return nodes from the result set in any other manner may produce unpredictable results.

        XConnection provides three extension functions that you can use in your stylesheet.

        1. new() -- Use one of the XConnection constructors to connect to a data source, and return an XConnection object.

        2. query() -- Use the XConnection object query() method to return a "streamable" result set in the form of a row-set node. Work your way through the row-set one row at a time. The same row element is used over and over again, so you can begin "transforming" the row-set before the entire result set has been returned.

        3. close() -- Use the XConnection object close() method to terminate the connection.

        The query() extension function returns a Document node that contains (as needed) an array of column-header elements, a single row element that is used repeatedly, and an array of col elements. Each column-header element (one per column in the row-set) contains an attribute (ColumnAttribute) for each of the column descriptors in the ResultSetMetaData object. Each col element contains a text node with a textual representation of the value for that column in the current row.

        Example

        This example displays the result set from a table in a sample InstantDB database.

        <?xml version="1.0"?>
        <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        version="1.0"
                        xmlns:sql="org.apache.xalan.lib.sql.XConnection"
                        extension-element-prefixes="sql">
          <xsl:output method="html" indent="yes"/>
          <xsl:param name="query" select="'SELECT * FROM import1'"/>
         
          <xsl:template match="/">
            <!-- 1. Make the connection -->
            <xsl:variable name="products"
                          select="sql:new('org.enhydra.instantdb.jdbc.idbDriver',
                                        'jdbc:idb:D:\instantdb\Examples\sample.prp')"/>
            <HTML>
              <HEAD>
              </HEAD>
              <BODY>
                <TABLE border="1">
                <!--2. Execute the query -->
                <xsl:variable name="table" select='sql:query($products, $query)'/>
                  <TR>
                  <!-- Get column-label attribute from each column-header-->
                  <xsl:for-each select="$table/sql/metadata/column-header">
                    <TH><xsl:value-of select="@column-label"/></TH>
                  </xsl:for-each>
                  </TR>
                  <xsl:apply-templates select="$table/sql/row-set/row"/>
                  <xsl:text>&#10;</xsl:text>
                </TABLE>
              </BODY>
            </HTML> 
            <!-- 3. Close the connection -->
            <xsl:value-of select="sql:close($products)"/>
          </xsl:template>
        
          <xsl:template match="row">
                <TR>
                  <xsl:apply-templates select="col"/>
                </TR>
          </xsl:template>
        
          <xsl:template match="col">
            <TD>
              <!-- Here is the column data -->
              <xsl:value-of select="text()"/>
            </TD>
          </xsl:template>
        
        </xsl:stylesheet>
        
        libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/XConnection.java0000644000175000017500000011661110721374033023647 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XConnection.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.sql.Connection; import java.sql.SQLException; import java.sql.SQLWarning; import java.util.Properties; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.DTMManagerDefault; import org.apache.xml.dtm.ref.DTMNodeIterator; import org.apache.xml.dtm.ref.DTMNodeProxy; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBooleanStatic; import org.apache.xpath.objects.XNodeSet; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * An XSLT extension that allows a stylesheet to * access JDBC data. * * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:sql="http://xml.apache.org/xalan/sql"
         * 
        * * From the stylesheet perspective, * XConnection provides 3 extension functions: new(), * query(), and close(). * Use new() to call one of XConnection constructors, which * establishes a JDBC driver connection to a data source and * returns an XConnection object. * Then use the XConnection object query() method to return a * result set in the form of a row-set element. * When you have finished working with the row-set, call the * XConnection object close() method to terminate the connection. */ public class XConnection { /** * Flag for DEBUG mode */ private static final boolean DEBUG = false; /** * The Current Connection Pool in Use. An XConnection can only * represent one query at a time, prior to doing some type of query. */ private ConnectionPool m_ConnectionPool = null; /** * The DBMS Connection used to produce this SQL Document. * Will be used to clear free up the database resources on * close. */ private Connection m_Connection = null; /** * If a default Connection Pool is used. i.e. A connection Pool * that is created internally, then do we actually allow pools * to be created. Due to the archititure of the Xalan Extensions, * there is no notification of when the Extension is being unloaded and * as such, there is a good chance that JDBC COnnections are not closed. * A finalized is provided to try and catch this situation but since * support of finalizers is inconsistant across JVM's this may cause * a problem. The robustness of the JDBC Driver is also at issue here. * if a controlled shutdown is provided by the driver then default * conntectiom pools are OK. */ private boolean m_DefaultPoolingEnabled = false; /** * As we do queries, we will produce SQL Documents. Any ony may produce * one or more SQL Documents so that the current connection information * may be easilly reused. This collection will hold a collection of all * the documents created. As Documents are closed, they will be removed * from the collection and told to free all the used resources. */ private Vector m_OpenSQLDocuments = new Vector(); /** * Let's keep a copy of the ConnectionPoolMgr in * alive here so we are keeping the static pool alive * We will also use this Pool Manager to register our default pools. */ private ConnectionPoolManager m_PoolMgr = new ConnectionPoolManager(); /** * For PreparedStatements, we need a place to * to store the parameters in a vector. */ private Vector m_ParameterList = new Vector(); /** * Allow the SQL Extensions to return null on error. The Error information will * be stored in a seperate Error Document that can easily be retrived using the * getError() method. * %REVIEW% This functionality will probably be buried inside the SQLDocument. */ private Exception m_Error = null; /** * When the Stylesheet wants to review the errors from a paticular * document, it asks the XConnection. We need to track what document * in the list of managed documents caused the last error. As SetError * is called, it will record the document that had the error. */ private SQLDocument m_LastSQLDocumentWithError = null; /** * If true then full information should be returned about errors and warnings * in getError(). This includes chained errors and warnings. * If false (the default) then getError() returns just the first SQLException. */ private boolean m_FullErrors = false; /** * One a per XConnection basis there is a master QueryParser that is responsible * for generating Query Parsers. This will allow us to cache previous instances * so the inline parser execution time is minimized. */ private SQLQueryParser m_QueryParser = new SQLQueryParser(); /** */ private boolean m_IsDefaultPool = false; /** * This flag will be used to indicate to the SQLDocument to use * Streaming mode. Streeaming Mode will reduce the memory footprint * to a fixed amount but will not let you traverse the tree more than * once since the Row data will be reused for every Row in the Query. */ private boolean m_IsStreamingEnabled = true; /** * */ private boolean m_InlineVariables = false; /** * This flag will be used to indicate if multiple result sets are * supported from the database. If they are, then the metadata element is * moved to insude the row-set element and multiple row-set elements may * be included under the sql root element. */ private boolean m_IsMultipleResultsEnabled = false; /** * This flag will be used to indicate if database preparedstatements * should be cached. This also controls if the Java statement object * should be cached. */ private boolean m_IsStatementCachingEnabled = false; /** */ public XConnection( ) { } /** * Constructs a new XConnection and attempts to connect to a datasource as * defined in the * connect(ExpressionContext exprContext, String connPoolName) * method. * org.apache.xalan.lib.sql.ConnectionPool or a JNDI datasource. * * @param exprContext Context automatically passed from the XSLT sheet. * @param name The name of the ConnectionPool or the JNDI DataSource path. * */ public XConnection( ExpressionContext exprContext, String connPoolName ) { connect(exprContext, connPoolName); } /** * @param exprContext * @param driver * @param dbURL */ public XConnection( ExpressionContext exprContext, String driver, String dbURL ) { connect(exprContext, driver, dbURL); } /** * @param exprContext * @param list */ public XConnection( ExpressionContext exprContext, NodeList list ) { connect(exprContext, list); } /** * @param exprContext * @param driver * @param dbURL * @param user * @param password */ public XConnection( ExpressionContext exprContext, String driver, String dbURL, String user, String password ) { connect(exprContext, driver, dbURL, user, password); } /** * @param exprContext * @param driver * @param dbURL * @param protocolElem */ public XConnection( ExpressionContext exprContext, String driver, String dbURL, Element protocolElem ) { connect(exprContext, driver, dbURL, protocolElem); } /** * Returns an XConnection from either a user created * org.apache.xalan.lib.sql.ConnectionPool or a JNDI datasource. * * This method first tries to resolve the passed name against * ConnectionPools registered with * ConnectionPoolManager. * If that fails, it attempts to find the name as a JNDI DataSource path. * * @param exprContext Context automatically passed from the XSLT sheet. * @param name The name of the ConnectionPool or the JNDI DataSource path. * */ public XBooleanStatic connect( ExpressionContext exprContext, String name ) { try { m_ConnectionPool = m_PoolMgr.getPool(name); if (m_ConnectionPool == null) { //Try to create a jndi source with the passed name ConnectionPool pool = new JNDIConnectionPool(name); if (pool.testConnection()) { //JNDIConnectionPool seems good, so register it with the pool manager. //Once registered, it will show up like other named ConnectionPool's, //so the m_PoolMgr.getPool(name) method (above) will find it. m_PoolMgr.registerPool(name, pool); m_ConnectionPool = pool; m_IsDefaultPool = false; return new XBooleanStatic(true); } else { throw new IllegalArgumentException( "Invalid ConnectionPool name or JNDI Datasource path: " + name); } } else { m_IsDefaultPool = false; return new XBooleanStatic(true); } } catch (Exception e) { setError(e, exprContext); return new XBooleanStatic(false); } } /** * Create an XConnection object with just a driver and database URL. * @param exprContext * @param driver JDBC driver of the form foo.bar.Driver. * @param dbURL database URL of the form jdbc:subprotocol:subname. * */ public XBooleanStatic connect( ExpressionContext exprContext, String driver, String dbURL ) { try { init(driver, dbURL, new Properties()); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } } /** * @param exprContext * @param protocolElem * */ public XBooleanStatic connect( ExpressionContext exprContext, Element protocolElem ) { try { initFromElement(protocolElem); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } } /** * @param exprContext * @param list * */ public XBooleanStatic connect( ExpressionContext exprContext, NodeList list ) { try { initFromElement( (Element) list.item(0) ); return new XBooleanStatic(true); } catch(SQLException e) { setError(e, exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } } /** * Create an XConnection object with user ID and password. * @param exprContext * @param driver JDBC driver of the form foo.bar.Driver. * @param dbURL database URL of the form jdbc:subprotocol:subname. * @param user user ID. * @param password connection password. * */ public XBooleanStatic connect( ExpressionContext exprContext, String driver, String dbURL, String user, String password ) { try { Properties prop = new Properties(); prop.put("user", user); prop.put("password", password); init(driver, dbURL, prop); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } } /** * Create an XConnection object with a connection protocol * @param exprContext * @param driver JDBC driver of the form foo.bar.Driver. * @param dbURL database URL of the form jdbc:subprotocol:subname. * @param protocolElem list of string tag/value connection arguments, * normally including at least "user" and "password". * */ public XBooleanStatic connect( ExpressionContext exprContext, String driver, String dbURL, Element protocolElem ) { try { Properties prop = new Properties(); NamedNodeMap atts = protocolElem.getAttributes(); for (int i = 0; i < atts.getLength(); i++) { prop.put(atts.item(i).getNodeName(), atts.item(i).getNodeValue()); } init(driver, dbURL, prop); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e, exprContext); return new XBooleanStatic(false); } } /** * Allow the database connection information to be sepcified in * the XML tree. The connection information could also be * externally originated and passed in as an XSL Parameter. * The required XML Format is as follows. * A document fragment is needed to specify the connection information * the top tag name is not specific for this code, we are only interested * in the tags inside. * * Specify the driver name for this connection pool * drivername * Specify the URL for the driver in this connection pool * url * Specify the password for this connection pool * password * Specify the username for this connection pool * username * You can add extra protocol items including the User Name & Password * with the protocol tag. For each extra protocol item, add a new element * where the name of the item is specified as the name attribute and * and its value as the elements value. * value * * @param e * * @throws SQLException */ private void initFromElement( Element e )throws SQLException { Properties prop = new Properties(); String driver = ""; String dbURL = ""; Node n = e.getFirstChild(); if (null == n) return; // really need to throw an error do { String nName = n.getNodeName(); if (nName.equalsIgnoreCase("dbdriver")) { driver = ""; Node n1 = n.getFirstChild(); if (null != n1) { driver = n1.getNodeValue(); } } if (nName.equalsIgnoreCase("dburl")) { dbURL = ""; Node n1 = n.getFirstChild(); if (null != n1) { dbURL = n1.getNodeValue(); } } if (nName.equalsIgnoreCase("password")) { String s = ""; Node n1 = n.getFirstChild(); if (null != n1) { s = n1.getNodeValue(); } prop.put("password", s); } if (nName.equalsIgnoreCase("user")) { String s = ""; Node n1 = n.getFirstChild(); if (null != n1) { s = n1.getNodeValue(); } prop.put("user", s); } if (nName.equalsIgnoreCase("protocol")) { String Name = ""; NamedNodeMap attrs = n.getAttributes(); Node n1 = attrs.getNamedItem("name"); if (null != n1) { String s = ""; Name = n1.getNodeValue(); Node n2 = n.getFirstChild(); if (null != n2) s = n2.getNodeValue(); prop.put(Name, s); } } } while ( (n = n.getNextSibling()) != null); init(driver, dbURL, prop); } /** * Initilize is being called because we did not have an * existing Connection Pool, so let's see if we created one * already or lets create one ourselves. * @param driver * @param dbURL * @param prop * * @throws SQLException */ private void init( String driver, String dbURL, Properties prop )throws SQLException { Connection con = null; if (DEBUG) System.out.println("XConnection, Connection Init"); String user = prop.getProperty("user"); if (user == null) user = ""; String passwd = prop.getProperty("password"); if (passwd == null) passwd = ""; String poolName = driver + dbURL + user + passwd; ConnectionPool cpool = m_PoolMgr.getPool(poolName); if (cpool == null) { if (DEBUG) { System.out.println("XConnection, Creating Connection"); System.out.println(" Driver :" + driver); System.out.println(" URL :" + dbURL); System.out.println(" user :" + user); System.out.println(" passwd :" + passwd); } DefaultConnectionPool defpool = new DefaultConnectionPool(); if ((DEBUG) && (defpool == null)) System.out.println("Failed to Create a Default Connection Pool"); defpool.setDriver(driver); defpool.setURL(dbURL); defpool.setProtocol(prop); // Only enable pooling in the default pool if we are explicatly // told too. if (m_DefaultPoolingEnabled) defpool.setPoolEnabled(true); m_PoolMgr.registerPool(poolName, defpool); m_ConnectionPool = defpool; } else { m_ConnectionPool = cpool; } m_IsDefaultPool = true; // // Let's test to see if we really can connect // Just remember to give it back after the test. // try { con = m_ConnectionPool.getConnection(); } catch(SQLException e) { if (con != null) { m_ConnectionPool.releaseConnectionOnError(con); con = null; } throw e; } finally { if ( con != null ) m_ConnectionPool.releaseConnection(con); } } /** * Allow the SQL Document to retrive a connection to be used * to build the SQL Statement. */ public ConnectionPool getConnectionPool() { return m_ConnectionPool; } /** * Execute a query statement by instantiating an * @param exprContext * @param queryString the SQL query. * @return XStatement implements NodeIterator. * @throws SQLException * @link org.apache.xalan.lib.sql.XStatement XStatement} * object. The XStatement executes the query, and uses the result set * to create a * @link org.apache.xalan.lib.sql.RowSet RowSet}, * a row-set element. */ public DTM query( ExpressionContext exprContext, String queryString ) { SQLDocument doc = null; try { if (DEBUG) System.out.println("pquery()"); // Build an Error Document, NOT Connected. if ( null == m_ConnectionPool ) return null; SQLQueryParser query = m_QueryParser.parse (this, queryString, SQLQueryParser.NO_INLINE_PARSER); doc = SQLDocument.getNewDocument(exprContext); doc.execute(this, query); // also keep a local reference m_OpenSQLDocuments.addElement(doc); } catch (Exception e) { // OK We had an error building the document, let try and grab the // error information and clean up our connections. if (DEBUG) System.out.println("exception in query()"); if (doc != null) { if (doc.hasErrors()) { setError(e, doc, doc.checkWarnings()); } doc.close(m_IsDefaultPool); doc = null; } } finally { if (DEBUG) System.out.println("leaving query()"); } // Doc will be null if there was an error return doc; } /** * Execute a parameterized query statement by instantiating an * @param exprContext * @param queryString the SQL query. * @return XStatement implements NodeIterator. * @throws SQLException * @link org.apache.xalan.lib.sql.XStatement XStatement} * object. The XStatement executes the query, and uses the result set * to create a * @link org.apache.xalan.lib.sql.RowSet RowSet}, * a row-set element. */ public DTM pquery( ExpressionContext exprContext, String queryString ) { return(pquery(exprContext, queryString, null)); } /** * Execute a parameterized query statement by instantiating an * @param exprContext * @param queryString the SQL query. * @param typeInfo * @return XStatement implements NodeIterator. * @throws SQLException * @link org.apache.xalan.lib.sql.XStatement XStatement} * object. The XStatement executes the query, and uses the result set * to create a * @link org.apache.xalan.lib.sql.RowSet RowSet}, * a row-set element. * This method allows for the user to pass in a comma seperated * String that represents a list of parameter types. If supplied * the parameter types will be used to overload the current types * in the current parameter list. */ public DTM pquery( ExpressionContext exprContext, String queryString, String typeInfo) { SQLDocument doc = null; try { if (DEBUG) System.out.println("pquery()"); // Build an Error Document, NOT Connected. if ( null == m_ConnectionPool ) return null; SQLQueryParser query = m_QueryParser.parse (this, queryString, SQLQueryParser.NO_OVERRIDE); // If we are not using the inline parser, then let add the data // to the parser so it can populate the SQL Statement. if ( !m_InlineVariables ) { addTypeToData(typeInfo); query.setParameters(m_ParameterList); } doc = SQLDocument.getNewDocument(exprContext); doc.execute(this, query); // also keep a local reference m_OpenSQLDocuments.addElement(doc); } catch (Exception e) { // OK We had an error building the document, let try and grab the // error information and clean up our connections. if (DEBUG) System.out.println("exception in query()"); if (doc != null) { if (doc.hasErrors()) { setError(e, doc, doc.checkWarnings()); } // If we are using the Default Connection Pool, then // force the connection pool to flush unused connections. doc.close(m_IsDefaultPool); doc = null; } } finally { if (DEBUG) System.out.println("leaving query()"); } // Doc will be null if there was an error return doc; } /** * The purpose of this routine is to force the DB cursor to skip forward * N records. You should call this function after [p]query to help with * pagination. i.e. Perfrom your select, then skip forward past the records * you read previously. * * @param exprContext * @param o * @param value */ public void skipRec( ExpressionContext exprContext, Object o, int value ) { SQLDocument sqldoc = null; DTMNodeIterator nodei = null; sqldoc = locateSQLDocument( exprContext, o); if (sqldoc != null) sqldoc.skip(value); } private void addTypeToData(String typeInfo) { int indx; if ( typeInfo != null && m_ParameterList != null ) { // Parse up the parameter types that were defined // with the query StringTokenizer plist = new StringTokenizer(typeInfo); // Override the existing type that is stored in the // parameter list. If there are more types than parameters // ignore for now, a more meaningfull error should occur // when the actual query is executed. indx = 0; while (plist.hasMoreTokens()) { String value = plist.nextToken(); QueryParameter qp = (QueryParameter) m_ParameterList.elementAt(indx); if ( null != qp ) { qp.setTypeName(value); } indx++; } } } /** * Add an untyped value to the parameter list. * @param value * */ public void addParameter( String value ) { addParameterWithType(value, null); } /** * Add a typed parameter to the parameter list. * @param value * @param Type * */ public void addParameterWithType( String value, String Type ) { m_ParameterList.addElement( new QueryParameter(value, Type) ); } /** * Add a single parameter to the parameter list * formatted as an Element * @param e * */ public void addParameterFromElement( Element e ) { NamedNodeMap attrs = e.getAttributes(); Node Type = attrs.getNamedItem("type"); Node n1 = e.getFirstChild(); if (null != n1) { String value = n1.getNodeValue(); if (value == null) value = ""; m_ParameterList.addElement( new QueryParameter(value, Type.getNodeValue()) ); } } /** * Add a section of parameters to the Parameter List * Do each element from the list * @param nl * */ public void addParameterFromElement( NodeList nl ) { // // Each child of the NodeList represents a node // match from the select= statment. Process each // of them as a seperate list. // The XML Format is as follows // // // value // value // value // // // The XSL to process this is formatted as follows // // value //value //value // // The name of the Node is not important just is value // and if it contains a type attribute Node n = elem.getFirstChild(); if (null == n) return; do { if (n.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attrs = n.getAttributes(); Node Type = attrs.getNamedItem("type"); String TypeStr; if (Type == null) TypeStr = "string"; else TypeStr = Type.getNodeValue(); Node n1 = n.getFirstChild(); if (null != n1) { String value = n1.getNodeValue(); if (value == null) value = ""; m_ParameterList.addElement( new QueryParameter(value, TypeStr) ); } } } while ( (n = n.getNextSibling()) != null); } /** * */ public void clearParameters( ) { m_ParameterList.removeAllElements(); } /** * There is a problem with some JDBC drivers when a Connection * is open and the JVM shutsdown. If there is a problem, there * is no way to control the currently open connections in the * pool. So for the default connection pool, the actuall pooling * mechinsm is disabled by default. The Stylesheet designer can * re-enabled pooling to take advantage of connection pools. * The connection pool can even be disabled which will close all * outstanding connections. * * @deprecated Use setFeature("default-pool-enabled", "true"); */ public void enableDefaultConnectionPool( ) { if (DEBUG) System.out.println("Enabling Default Connection Pool"); m_DefaultPoolingEnabled = true; if (m_ConnectionPool == null) return; if (m_IsDefaultPool) return; m_ConnectionPool.setPoolEnabled(true); } /** * See enableDefaultConnectionPool * * @deprecated Use setFeature("default-pool-enabled", "false"); */ public void disableDefaultConnectionPool( ) { if (DEBUG) System.out.println("Disabling Default Connection Pool"); m_DefaultPoolingEnabled = false; if (m_ConnectionPool == null) return; if (!m_IsDefaultPool) return; m_ConnectionPool.setPoolEnabled(false); } /** * Control how the SQL Document uses memory. In Streaming Mode, * memory consumption is greatly reduces so you can have queries * of unlimited size but it will not let you traverse the data * more than once. * * @deprecated Use setFeature("streaming", "true"); */ public void enableStreamingMode( ) { if (DEBUG) System.out.println("Enabling Streaming Mode"); m_IsStreamingEnabled = true; } /** * Control how the SQL Document uses memory. In Streaming Mode, * memory consumption is greatly reduces so you can have queries * of unlimited size but it will not let you traverse the data * more than once. * * @deprecated Use setFeature("streaming", "false"); */ public void disableStreamingMode( ) { if (DEBUG) System.out.println("Disable Streaming Mode"); m_IsStreamingEnabled = false; } /** * Provide access to the last error that occued. This error * may be over written when the next operation occurs. * */ public DTM getError( ) { if ( m_FullErrors ) { for ( int idx = 0 ; idx < m_OpenSQLDocuments.size() ; idx++ ) { SQLDocument doc = (SQLDocument)m_OpenSQLDocuments.elementAt(idx); SQLWarning warn = doc.checkWarnings(); if ( warn != null ) setError(null, doc, warn); } } return(buildErrorDocument()); } /** * Close the connection to the data source. * * @throws SQLException */ public void close( )throws SQLException { if (DEBUG) System.out.println("Entering XConnection.close()"); // // This function is included just for Legacy support // If it is really called then we must me using a single // document interface, so close all open documents. while(m_OpenSQLDocuments.size() != 0) { SQLDocument d = (SQLDocument) m_OpenSQLDocuments.elementAt(0); try { // If we are using the Default Connection Pool, then // force the connection pool to flush unused connections. d.close(m_IsDefaultPool); } catch (Exception se ) {} m_OpenSQLDocuments.removeElementAt(0); } if ( null != m_Connection ) { m_ConnectionPool.releaseConnection(m_Connection); m_Connection = null; } if (DEBUG) System.out.println("Exiting XConnection.close"); } /** * Close the connection to the data source. Only close the connections * for a single document. * * @throws SQLException */ public void close(ExpressionContext exprContext, Object doc) throws SQLException { if (DEBUG) System.out.println("Entering XConnection.close(" + doc + ")"); SQLDocument sqlDoc = locateSQLDocument(exprContext, doc); if (sqlDoc != null) { // If we are using the Default Connection Pool, then // force the connection pool to flush unused connections. sqlDoc.close(m_IsDefaultPool); m_OpenSQLDocuments.remove(sqlDoc); } } /** * When an SQL Document is returned as a DTM object, the XSL variable is actually * assigned as a DTMIterator. This is a helper function that will allow you to get * a reference to the original SQLDocument from the iterator. * * Original code submitted by * Moraine Didier mailto://didier.moraine@winterthur.be * @param doc * @return */ private SQLDocument locateSQLDocument(ExpressionContext exprContext, Object doc) { try { if (doc instanceof DTMNodeIterator) { DTMNodeIterator dtmIter = (DTMNodeIterator)doc; try { DTMNodeProxy root = (DTMNodeProxy)dtmIter.getRoot(); return (SQLDocument) root.getDTM(); } catch (Exception e) { XNodeSet xNS = (XNodeSet)dtmIter.getDTMIterator(); DTMIterator iter = (DTMIterator)xNS.getContainedIter(); DTM dtm = iter.getDTM(xNS.nextNode()); return (SQLDocument)dtm; } } /* XNodeSet xNS = (XNodeSet)dtmIter.getDTMIterator(); OneStepIterator iter = (OneStepIterator)xNS.getContainedIter(); DTMManager aDTMManager = (DTMManager)iter.getDTMManager(); return (SQLDocument)aDTMManager.getDTM(xNS.nextNode()); */ setError(new Exception("SQL Extension:close - Can Not Identify SQLDocument"), exprContext); return null; } catch(Exception e) { setError(e, exprContext); return null; } } /** * @param exprContext * @param excp * */ private SQLErrorDocument buildErrorDocument() { SQLErrorDocument eDoc = null; if ( m_LastSQLDocumentWithError != null) { // @todo // Do we need to do something with this ?? // m_Error != null || (m_FullErrors && m_Warning != null) ) ExpressionContext ctx = m_LastSQLDocumentWithError.getExpressionContext(); SQLWarning warn = m_LastSQLDocumentWithError.checkWarnings(); try { DTMManager mgr = ((XPathContext.XPathExpressionContext)ctx).getDTMManager(); DTMManagerDefault mgrDefault = (DTMManagerDefault) mgr; int dtmIdent = mgrDefault.getFirstFreeDTMID(); eDoc = new SQLErrorDocument( mgr, dtmIdent<= m_minArraySize) { m_Arrays.addElement(m_currentArray); m_nextSlot = 0; m_currentArray = new _ObjectArray(m_minArraySize); } m_currentArray.objects[m_nextSlot] = o; int pos = (m_Arrays.size() * m_minArraySize) + m_nextSlot; m_nextSlot++; return pos; } /** */ class _ObjectArray { /** */ public Object[] objects; /** * @param size */ public _ObjectArray( int size ) { objects = new Object[size]; } } /** * @param args * */ public static void main( String[] args ) { String[] word={ "Zero","One","Two","Three","Four","Five", "Six","Seven","Eight","Nine","Ten", "Eleven","Twelve","Thirteen","Fourteen","Fifteen", "Sixteen","Seventeen","Eighteen","Nineteen","Twenty", "Twenty-One","Twenty-Two","Twenty-Three","Twenty-Four", "Twenty-Five","Twenty-Six","Twenty-Seven","Twenty-Eight", "Twenty-Nine","Thirty","Thirty-One","Thirty-Two", "Thirty-Three","Thirty-Four","Thirty-Five","Thirty-Six", "Thirty-Seven","Thirty-Eight","Thirty-Nine"}; ObjectArray m_ObjectArray = new ObjectArray(); // Add them in, using the default block size for (int x =0; x< word.length; x++) { System.out.print(" - " + m_ObjectArray.append(word[x])); } System.out.println("\n"); // Now let's read them out sequentally for (int x =0; x< word.length; x++) { String s = (String) m_ObjectArray.getAt(x); System.out.println(s); } // Some Random Access System.out.println((String) m_ObjectArray.getAt(5)); System.out.println((String) m_ObjectArray.getAt(10)); System.out.println((String) m_ObjectArray.getAt(20)); System.out.println((String) m_ObjectArray.getAt(2)); System.out.println((String) m_ObjectArray.getAt(15)); System.out.println((String) m_ObjectArray.getAt(30)); System.out.println((String) m_ObjectArray.getAt(6)); System.out.println((String) m_ObjectArray.getAt(8)); // Out of bounds System.out.println((String) m_ObjectArray.getAt(40)); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/JNDIConnectionPool.java0000644000175000017500000002134110721374031025007 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xalan.lib.sql; import java.lang.reflect.Method; import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; import javax.naming.InitialContext; import javax.naming.NamingException; /** * A Connection Pool that wraps a JDBC datasource to provide connections. * * An instance of this class is created by XConnection when it * attempts to resolves a ConnectionPool name as a JNDI data source. * * Most methods in this implementation do nothing since configuration is handled * by the underlying JDBC datasource. Users should always call * XConnection.close() from their stylsheet to explicitely close * their connection. However, since there is no way to enforce this * (Yikes!), it is recommended that a relatively short datasource timeout * be used to prevent dangling connections. */ public class JNDIConnectionPool implements ConnectionPool { /** * Reference to the datasource */ protected Object jdbcSource = null; /** * To maintain Java 1.3 compatibility, we need to work with the * DataSource class through Reflection. The getConnection method * is one of the methods used, and there are two different flavors. * */ private Method getConnectionWithArgs = null; private Method getConnection = null; /** * The unique jndi path for this datasource. */ protected String jndiPath = null; /** * User name for protected datasources. */ protected String user = null; /** * Password for protected datasources. */ protected String pwd = null; /** * Use of the default constructor requires the jndi path to be set via * setJndiPath(). */ public JNDIConnectionPool() { } /** * Creates a connection pool with a specified JNDI path. * @param jndiDatasourcePath Complete path to the JNDI datasource */ public JNDIConnectionPool(String jndiDatasourcePath) { jndiPath = jndiDatasourcePath.trim(); } /** * Sets the path for the jndi datasource * @param jndiPath */ public void setJndiPath(String jndiPath) { this.jndiPath = jndiPath; } /** * Returns the path for the jndi datasource * @param jndiPath */ public String getJndiPath() { return jndiPath; } /** * Always returns true. * This method was intended to indicate if the pool was enabled, however, in * this implementation that is not relavant. * @return */ public boolean isEnabled() { return true; } /** * Not implemented and will throw an Error if called. * * Connection configuration is handled by the underlying JNDI DataSource. * @param d */ public void setDriver(String d) { throw new Error( "This method is not supported. " + "All connection information is handled by the JDBC datasource provider"); } /** * Not implemented and will throw an Error if called. * * Connection configuration is handled by the underlying JNDI DataSource. * @param d */ public void setURL(String url) { throw new Error( "This method is not supported. " + "All connection information is handled by the JDBC datasource provider"); } /** * Intended to release unused connections from the pool. * Does nothing in this implementation. */ public void freeUnused() { //Do nothing - not an error to call this method } /** * Always returns false, indicating that this wrapper has no idea of what * connections the underlying JNDI source is maintaining. * @return */ public boolean hasActiveConnections() { return false; } /** * Sets the password for the connection. * If the jndi datasource does not require a password (which is typical), * this can be left null. * @param p the password */ public void setPassword(String p) { if (p != null) p = p.trim(); if (p != null && p.length() == 0) p = null; pwd = p; } /** * Sets the user name for the connection. * If the jndi datasource does not require a user name (which is typical), * this can be left null. * @param u the user name */ public void setUser(String u) { if (u != null) u = u.trim(); if (u != null && u.length() == 0) u = null; user = u; } /** * Returns a connection from the JDNI DataSource found at the JNDI Datasource * path. * * @return * @throws SQLException */ public Connection getConnection() throws SQLException { if (jdbcSource == null) { try { findDatasource(); } catch (NamingException ne) { throw new SQLException( "Could not create jndi context for " + jndiPath + " - " + ne.getLocalizedMessage()); } } try { if (user != null || pwd != null) { Object arglist[] = { user, pwd }; return (Connection) getConnectionWithArgs.invoke(jdbcSource, arglist); } else { Object arglist[] = {}; return (Connection) getConnection.invoke(jdbcSource, arglist); } } catch (Exception e) { throw new SQLException( "Could not create jndi connection for " + jndiPath + " - " + e.getLocalizedMessage()); } } /** * Internal method used to look up the datasource. * @throws NamingException */ protected void findDatasource() throws NamingException { try { InitialContext context = new InitialContext(); jdbcSource = context.lookup(jndiPath); Class withArgs[] = { String.class, String.class }; getConnectionWithArgs = jdbcSource.getClass().getDeclaredMethod("getConnection", withArgs); Class noArgs[] = { }; getConnection = jdbcSource.getClass().getDeclaredMethod("getConnection", noArgs); } catch (NamingException e) { throw e; } catch (NoSuchMethodException e) { // For simpleification, we will just throw a NamingException. We will only // use the message part of the exception anyway. throw new NamingException("Unable to resolve JNDI DataSource - " + e); } } public void releaseConnection(Connection con) throws SQLException { con.close(); } public void releaseConnectionOnError(Connection con) throws SQLException { con.close(); } /** * Releases the reference to the jndi datasource. * The original intention of this method was to actually turn the pool *off*. * Since we are not managing the pool, we simply release our reference to * the datasource. Future calls to the getConnection will simply recreate * the datasource. * @param flag If false, the reference to the datasource is released. */ public void setPoolEnabled(boolean flag) { if (! flag) jdbcSource = null; } /** * Ignored in this implementation b/c the pooling is determined by the jndi dataosource. * @param p */ public void setProtocol(Properties p) { /* ignore - properties are determined by datasource */ } /** * Ignored in this implementation b/c the pooling is determined by the jndi dataosource. * @param n */ public void setMinConnections(int n) { /* ignore - pooling is determined by datasource */ } /** * A simple test to see if the jndi datasource exists. * * Note that this test does not ensure that the datasource will return valid * connections. */ public boolean testConnection() { if (jdbcSource == null) { try { findDatasource(); } catch (NamingException ne) { return false; } } return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/ObjectFactory.java0000644000175000017500000006376210721374030024163 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468638 2006-10-28 06:52:06Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 3273432303767233578L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/lib/sql/ConnectionPoolManager.java0000644000175000017500000000665710721374032025653 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ConnectionPoolManager.java 468638 2006-10-28 06:52:06Z minchau $ */ package org.apache.xalan.lib.sql; import java.util.Hashtable; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; /** */ public class ConnectionPoolManager { /** */ private static Hashtable m_poolTable = null; /** */ public ConnectionPoolManager( ) { init(); } /** * Initialize the internal structures of the Pool Manager * */ private synchronized void init( ) { /** * Only do this process once * Initialize the pool table */ if (m_poolTable == null) m_poolTable = new Hashtable(); } /** * Register a nuew connection pool to the global pool table. * If a pool by that name currently exists, then throw an * IllegalArgumentException stating that the pool already * exist. * @param name * @param pool * * @link org.apache.xalan.lib.sql.ConnectionPool} * * @throws IllegalArgumentException, throw this exception * if a pool with the same name currently exists. */ public synchronized void registerPool( String name, ConnectionPool pool ) { if ( m_poolTable.containsKey(name) ) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_POOL_EXISTS, null)); //"Pool already exists"); } m_poolTable.put(name, pool); } /** * Remove a pool from the global table. If the pool still has * active connections, then only mark this pool as inactive and * leave it around until all the existing connections are closed. * @param name * */ public synchronized void removePool( String name ) { ConnectionPool pool = getPool(name); if (null != pool) { // // Disable future use of this pool under the Xalan // extension only. This flag should only exist in the // wrapper and not in the actual pool implementation. pool.setPoolEnabled(false); // // Remove the pool from the Hashtable if we don'd have // any active connections. // if ( ! pool.hasActiveConnections() ) m_poolTable.remove(name); } } /** * Return the connection pool referenced by the name * @param name * * @return ConnectionPool a reference to the ConnectionPool * object stored in the Pool Table. If the named pool does not exist, return * null */ public synchronized ConnectionPool getPool( String name ) { return (ConnectionPool) m_poolTable.get(name); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/Extensions.java0000644000175000017500000003516010721374032022756 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Extensions.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.util.Hashtable; import java.util.StringTokenizer; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xalan.xslt.EnvironmentCheck; import org.apache.xpath.NodeSet; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.w3c.dom.traversal.NodeIterator; import org.xml.sax.SAXNotSupportedException; /** * This class contains many of the Xalan-supplied extensions. * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:xalan="http://xml.apache.org/xalan"
         * 
        * @xsl.usage general */ public class Extensions { /** * Constructor Extensions * */ private Extensions(){} // Make sure class cannot be instantiated /** * This method is an extension that implements as a Xalan extension * the node-set function also found in xt and saxon. * If the argument is a Result Tree Fragment, then nodeset * returns a node-set consisting of a single root node as described in * section 11.1 of the XSLT 1.0 Recommendation. If the argument is a * node-set, nodeset returns a node-set. If the argument * is a string, number, or boolean, then nodeset returns * a node-set consisting of a single root node with a single text node * child that is the result of calling the XPath string() function on the * passed parameter. If the argument is anything else, then a node-set * is returned consisting of a single root node with a single text node * child that is the result of calling the java toString() * method on the passed argument. * Most of the * actual work here is done in MethodResolver and * XRTreeFrag. * @param myProcessor Context passed by the extension processor * @param rtf Argument in the stylesheet to the nodeset extension function * * NEEDSDOC ($objectName$) @return */ public static NodeSet nodeset(ExpressionContext myProcessor, Object rtf) { String textNodeValue; if (rtf instanceof NodeIterator) { return new NodeSet((NodeIterator) rtf); } else { if (rtf instanceof String) { textNodeValue = (String) rtf; } else if (rtf instanceof Boolean) { textNodeValue = new XBoolean(((Boolean) rtf).booleanValue()).str(); } else if (rtf instanceof Double) { textNodeValue = new XNumber(((Double) rtf).doubleValue()).str(); } else { textNodeValue = rtf.toString(); } // This no longer will work right since the DTM. // Document myDoc = myProcessor.getContextNode().getOwnerDocument(); try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document myDoc = db.newDocument(); Text textNode = myDoc.createTextNode(textNodeValue); DocumentFragment docFrag = myDoc.createDocumentFragment(); docFrag.appendChild(textNode); return new NodeSet(docFrag); } catch(ParserConfigurationException pce) { throw new org.apache.xml.utils.WrappedRuntimeException(pce); } } } /** * Returns the intersection of two node-sets. * * @param nl1 NodeList for first node-set * @param nl2 NodeList for second node-set * @return a NodeList containing the nodes in nl1 that are also in nl2 * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT sets extension * (http://exslt.org/sets). */ public static NodeList intersection(NodeList nl1, NodeList nl2) { return ExsltSets.intersection(nl1, nl2); } /** * Returns the difference between two node-sets. * * @param nl1 NodeList for first node-set * @param nl2 NodeList for second node-set * @return a NodeList containing the nodes in nl1 that are not in nl2 * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT sets extension * (http://exslt.org/sets). */ public static NodeList difference(NodeList nl1, NodeList nl2) { return ExsltSets.difference(nl1, nl2); } /** * Returns node-set containing distinct string values. * * @param nl NodeList for node-set * @return a NodeList with nodes from nl containing distinct string values. * In other words, if more than one node in nl contains the same string value, * only include the first such node found. * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT sets extension * (http://exslt.org/sets). */ public static NodeList distinct(NodeList nl) { return ExsltSets.distinct(nl); } /** * Returns true if both node-sets contain the same set of nodes. * * @param nl1 NodeList for first node-set * @param nl2 NodeList for second node-set * @return true if nl1 and nl2 contain exactly the same set of nodes. */ public static boolean hasSameNodes(NodeList nl1, NodeList nl2) { NodeSet ns1 = new NodeSet(nl1); NodeSet ns2 = new NodeSet(nl2); if (ns1.getLength() != ns2.getLength()) return false; for (int i = 0; i < ns1.getLength(); i++) { Node n = ns1.elementAt(i); if (!ns2.contains(n)) return false; } return true; } /** * Returns the result of evaluating the argument as a string containing * an XPath expression. Used where the XPath expression is not known until * run-time. The expression is evaluated as if the run-time value of the * argument appeared in place of the evaluate function call at compile time. * * @param myContext an ExpressionContext passed in by the * extension mechanism. This must be an XPathContext. * @param xpathExpr The XPath expression to be evaluated. * @return the XObject resulting from evaluating the XPath * * @throws SAXNotSupportedException * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT dynamic extension * (http://exslt.org/dynamic). */ public static XObject evaluate(ExpressionContext myContext, String xpathExpr) throws SAXNotSupportedException { return ExsltDynamic.evaluate(myContext, xpathExpr); } /** * Returns a NodeSet containing one text node for each token in the first argument. * Delimiters are specified in the second argument. * Tokens are determined by a call to StringTokenizer. * If the first argument is an empty string or contains only delimiters, the result * will be an empty NodeSet. * * Contributed to XalanJ1 by Benoit Cerrina. * * @param toTokenize The string to be split into text tokens. * @param delims The delimiters to use. * @return a NodeSet as described above. */ public static NodeList tokenize(String toTokenize, String delims) { Document doc = DocumentHolder.m_doc; StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims); NodeSet resultSet = new NodeSet(); synchronized (doc) { while (lTokenizer.hasMoreTokens()) { resultSet.addNode(doc.createTextNode(lTokenizer.nextToken())); } } return resultSet; } /** * Returns a NodeSet containing one text node for each token in the first argument. * Delimiters are whitespace. That is, the delimiters that are used are tab ( ), * linefeed ( ), return ( ), and space ( ). * Tokens are determined by a call to StringTokenizer. * If the first argument is an empty string or contains only delimiters, the result * will be an empty NodeSet. * * Contributed to XalanJ1 by Benoit Cerrina. * * @param toTokenize The string to be split into text tokens. * @return a NodeSet as described above. */ public static NodeList tokenize(String toTokenize) { return tokenize(toTokenize, " \t\n\r"); } /** * Return a Node of basic debugging information from the * EnvironmentCheck utility about the Java environment. * *

        Simply calls the {@link org.apache.xalan.xslt.EnvironmentCheck} * utility to grab info about the Java environment and CLASSPATH, * etc., and then returns the resulting Node. Stylesheets can * then maniuplate this data or simply xsl:copy-of the Node. Note * that we first attempt to load the more advanced * org.apache.env.Which utility by reflection; only if that fails * to we still use the internal version. Which is available from * http://xml.apache.org/commons/.

        * *

        We throw a WrappedRuntimeException in the unlikely case * that reading information from the environment throws us an * exception. (Is this really the best thing to do?)

        * * @param myContext an ExpressionContext passed in by the * extension mechanism. This must be an XPathContext. * @return a Node as described above. */ public static Node checkEnvironment(ExpressionContext myContext) { Document factoryDocument; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); factoryDocument = db.newDocument(); } catch(ParserConfigurationException pce) { throw new org.apache.xml.utils.WrappedRuntimeException(pce); } Node resultNode = null; try { // First use reflection to try to load Which, which is a // better version of EnvironmentCheck resultNode = checkEnvironmentUsingWhich(myContext, factoryDocument); if (null != resultNode) return resultNode; // If reflection failed, fallback to our internal EnvironmentCheck EnvironmentCheck envChecker = new EnvironmentCheck(); Hashtable h = envChecker.getEnvironmentHash(); resultNode = factoryDocument.createElement("checkEnvironmentExtension"); envChecker.appendEnvironmentReport(resultNode, factoryDocument, h); envChecker = null; } catch(Exception e) { throw new org.apache.xml.utils.WrappedRuntimeException(e); } return resultNode; } /** * Private worker method to attempt to use org.apache.env.Which. * * @param myContext an ExpressionContext passed in by the * extension mechanism. This must be an XPathContext. * @param factoryDocument providing createElement services, etc. * @return a Node with environment info; null if any error */ private static Node checkEnvironmentUsingWhich(ExpressionContext myContext, Document factoryDocument) { final String WHICH_CLASSNAME = "org.apache.env.Which"; final String WHICH_METHODNAME = "which"; final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class, java.lang.String.class, java.lang.String.class }; try { // Use reflection to try to find xml-commons utility 'Which' Class clazz = ObjectFactory.findProviderClass( WHICH_CLASSNAME, ObjectFactory.findClassLoader(), true); if (null == clazz) return null; // Fully qualify names since this is the only method they're used in java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS); Hashtable report = new Hashtable(); // Call the method with our Hashtable, common options, and ignore return value Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" }; Object returnValue = method.invoke(null, methodArgs); // Create a parent to hold the report and append hash to it Node resultNode = factoryDocument.createElement("checkEnvironmentExtension"); org.apache.xml.utils.Hashtree2Node.appendHashToNode(report, "whichReport", resultNode, factoryDocument); return resultNode; } catch (Throwable t) { // Simply return null; no need to report error return null; } } /** * This class is not loaded until first referenced (see Java Language * Specification by Gosling/Joy/Steele, section 12.4.1) * * The static members are created when this class is first referenced, as a * lazy initialization not needing checking against null or any * synchronization. * */ private static class DocumentHolder { // Reuse the Document object to reduce memory usage. private static final Document m_doc; static { try { m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch(ParserConfigurationException pce) { throw new org.apache.xml.utils.WrappedRuntimeException(pce); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/SecuritySupport.java0000644000175000017500000000744610721374031024030 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltCommon.java0000644000175000017500000001007310721374031023062 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltCommon.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.ref.DTMNodeIterator; import org.apache.xpath.NodeSet; /** * This class contains EXSLT common extension functions. * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:exslt="http://exslt.org/common"
         * 
        * * The documentation for each function has been copied from the relevant * EXSLT Implementer page. * * @see EXSLT * @xsl.usage general */ public class ExsltCommon { /** * The exsl:object-type function returns a string giving the type of the object passed * as the argument. The possible object types are: 'string', 'number', 'boolean', * 'node-set', 'RTF', or 'external'. * * Most XSLT object types can be coerced to each other without error. However, there are * certain coercions that raise errors, most importantly treating anything other than a * node set as a node set. Authors of utilities such as named templates or user-defined * extension functions may wish to give some flexibility in the parameter and argument values * that are accepted by the utility; the exsl:object-type function enables them to do so. * * The Xalan extensions MethodResolver converts 'object-type' to 'objectType'. * * @param obj The object to be typed. * @return objectType 'string', 'number', 'boolean', 'node-set', 'RTF', or 'external'. * * @see EXSLT */ public static String objectType (Object obj) { if (obj instanceof String) return "string"; else if (obj instanceof Boolean) return "boolean"; else if (obj instanceof Number) return "number"; else if (obj instanceof DTMNodeIterator) { DTMIterator dtmI = ((DTMNodeIterator)obj).getDTMIterator(); if (dtmI instanceof org.apache.xpath.axes.RTFIterator) return "RTF"; else return "node-set"; } else return "unknown"; } /** * The exsl:node-set function converts a result tree fragment (which is what you get * when you use the content of xsl:variable rather than its select attribute to give * a variable value) into a node set. This enables you to process the XML that you create * within a variable, and therefore do multi-step processing. * * You can also use this function to turn a string into a text node, which is helpful * if you want to pass a string to a function that only accepts a node set. * * The Xalan extensions MethodResolver converts 'node-set' to 'nodeSet'. * * @param myProcessor is passed in by the Xalan extension processor * @param rtf The result tree fragment to be converted to a node-set. * * @return node-set with the contents of the result tree fragment. * * Note: Already implemented in the xalan namespace as nodeset. * * @see EXSLT */ public static NodeSet nodeSet(ExpressionContext myProcessor, Object rtf) { return Extensions.nodeset(myProcessor, rtf); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltStrings.java0000644000175000017500000002666310721374033023301 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltStrings.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.util.StringTokenizer; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import org.apache.xpath.NodeSet; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; /** * This class contains EXSLT strings extension functions. * * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:str="http://exslt.org/strings"
         * 
        * The documentation for each function has been copied from the relevant * EXSLT Implementer page. * * @see EXSLT * @xsl.usage general */ public class ExsltStrings extends ExsltBase { /** * The str:align function aligns a string within another string. *

        * The first argument gives the target string to be aligned. The second argument gives * the padding string within which it is to be aligned. *

        * If the target string is shorter than the padding string then a range of characters * in the padding string are repaced with those in the target string. Which characters * are replaced depends on the value of the third argument, which gives the type of * alignment. It can be one of 'left', 'right' or 'center'. If no third argument is * given or if it is not one of these values, then it defaults to left alignment. *

        * With left alignment, the range of characters replaced by the target string begins * with the first character in the padding string. With right alignment, the range of * characters replaced by the target string ends with the last character in the padding * string. With center alignment, the range of characters replaced by the target string * is in the middle of the padding string, such that either the number of unreplaced * characters on either side of the range is the same or there is one less on the left * than there is on the right. *

        * If the target string is longer than the padding string, then it is truncated to be * the same length as the padding string and returned. * * @param targetStr The target string * @param paddingStr The padding string * @param type The type of alignment * * @return The string after alignment */ public static String align(String targetStr, String paddingStr, String type) { if (targetStr.length() >= paddingStr.length()) return targetStr.substring(0, paddingStr.length()); if (type.equals("right")) { return paddingStr.substring(0, paddingStr.length() - targetStr.length()) + targetStr; } else if (type.equals("center")) { int startIndex = (paddingStr.length() - targetStr.length()) / 2; return paddingStr.substring(0, startIndex) + targetStr + paddingStr.substring(startIndex + targetStr.length()); } // Default is left else { return targetStr + paddingStr.substring(targetStr.length()); } } /** * See above */ public static String align(String targetStr, String paddingStr) { return align(targetStr, paddingStr, "left"); } /** * The str:concat function takes a node set and returns the concatenation of the * string values of the nodes in that node set. If the node set is empty, it returns * an empty string. * * @param nl A node set * @return The concatenation of the string values of the nodes in that node set */ public static String concat(NodeList nl) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); String value = toString(node); if (value != null && value.length() > 0) sb.append(value); } return sb.toString(); } /** * The str:padding function creates a padding string of a certain length. * The first argument gives the length of the padding string to be created. * The second argument gives a string to be used to create the padding. This * string is repeated as many times as is necessary to create a string of the * length specified by the first argument; if the string is more than a character * long, it may have to be truncated to produce the required length. If no second * argument is specified, it defaults to a space (' '). If the second argument is * an empty string, str:padding returns an empty string. * * @param length The length of the padding string to be created * @param pattern The string to be used as pattern * * @return A padding string of the given length */ public static String padding(double length, String pattern) { if (pattern == null || pattern.length() == 0) return ""; StringBuffer sb = new StringBuffer(); int len = (int)length; int numAdded = 0; int index = 0; while (numAdded < len) { if (index == pattern.length()) index = 0; sb.append(pattern.charAt(index)); index++; numAdded++; } return sb.toString(); } /** * See above */ public static String padding(double length) { return padding(length, " "); } /** * The str:split function splits up a string and returns a node set of token * elements, each containing one token from the string. *

        * The first argument is the string to be split. The second argument is a pattern * string. The string given by the first argument is split at any occurrence of * this pattern. For example: *

           * str:split('a, simple, list', ', ') gives the node set consisting of: 
           *
           * a
           * simple
           * list
           * 
        * If the second argument is omitted, the default is the string ' ' (i.e. a space). * * @param str The string to be split * @param pattern The pattern * * @return A node set of split tokens */ public static NodeList split(String str, String pattern) { NodeSet resultSet = new NodeSet(); resultSet.setShouldCacheNodes(true); boolean done = false; int fromIndex = 0; int matchIndex = 0; String token = null; while (!done && fromIndex < str.length()) { matchIndex = str.indexOf(pattern, fromIndex); if (matchIndex >= 0) { token = str.substring(fromIndex, matchIndex); fromIndex = matchIndex + pattern.length(); } else { done = true; token = str.substring(fromIndex); } Document doc = DocumentHolder.m_doc; synchronized (doc) { Element element = doc.createElement("token"); Text text = doc.createTextNode(token); element.appendChild(text); resultSet.addNode(element); } } return resultSet; } /** * See above */ public static NodeList split(String str) { return split(str, " "); } /** * The str:tokenize function splits up a string and returns a node set of token * elements, each containing one token from the string. *

        * The first argument is the string to be tokenized. The second argument is a * string consisting of a number of characters. Each character in this string is * taken as a delimiting character. The string given by the first argument is split * at any occurrence of any of these characters. For example: *

           * str:tokenize('2001-06-03T11:40:23', '-T:') gives the node set consisting of: 
           *
           * 2001
           * 06
           * 03
           * 11
           * 40
           * 23
           * 
        * If the second argument is omitted, the default is the string ' ' * (i.e. whitespace characters). *

        * If the second argument is an empty string, the function returns a set of token * elements, each of which holds a single character. *

        * Note: This one is different from the tokenize extension function in the Xalan * namespace. The one in Xalan returns a set of Text nodes, while this one wraps * the Text nodes inside the token Element nodes. * * @param toTokenize The string to be tokenized * @param delims The delimiter string * * @return A node set of split token elements */ public static NodeList tokenize(String toTokenize, String delims) { NodeSet resultSet = new NodeSet(); if (delims != null && delims.length() > 0) { StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims); Document doc = DocumentHolder.m_doc; synchronized (doc) { while (lTokenizer.hasMoreTokens()) { Element element = doc.createElement("token"); element.appendChild(doc.createTextNode(lTokenizer.nextToken())); resultSet.addNode(element); } } } // If the delimiter is an empty string, create one token Element for // every single character. else { Document doc = DocumentHolder.m_doc; synchronized (doc) { for (int i = 0; i < toTokenize.length(); i++) { Element element = doc.createElement("token"); element.appendChild(doc.createTextNode(toTokenize.substring(i, i+1))); resultSet.addNode(element); } } } return resultSet; } /** * See above */ public static NodeList tokenize(String toTokenize) { return tokenize(toTokenize, " \t\n\r"); } /** * This class is not loaded until first referenced (see Java Language * Specification by Gosling/Joy/Steele, section 12.4.1) * * The static members are created when this class is first referenced, as a * lazy initialization not needing checking against null or any * synchronization. * */ private static class DocumentHolder { // Reuse the Document object to reduce memory usage. private static final Document m_doc; static { try { m_doc =DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch(ParserConfigurationException pce) { throw new org.apache.xml.utils.WrappedRuntimeException(pce); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/SecuritySupport12.java0000644000175000017500000001175310721374031024167 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltBase.java0000644000175000017500000000450610721374033022512 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltBase.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import org.apache.xml.dtm.ref.DTMNodeProxy; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * The base class for some EXSLT extension classes. * It contains common utility methods to be used by the sub-classes. */ public abstract class ExsltBase { /** * Return the string value of a Node * * @param n The Node. * @return The string value of the Node */ protected static String toString(Node n) { if (n instanceof DTMNodeProxy) return ((DTMNodeProxy)n).getStringValue(); else { String value = n.getNodeValue(); if (value == null) { NodeList nodelist = n.getChildNodes(); StringBuffer buf = new StringBuffer(); for (int i = 0; i < nodelist.getLength(); i++) { Node childNode = nodelist.item(i); buf.append(toString(childNode)); } return buf.toString(); } else return value; } } /** * Convert the string value of a Node to a number. * Return NaN if the string is not a valid number. * * @param n The Node. * @return The number value of the Node */ protected static double toNumber(Node n) { double d = 0.0; String str = toString(n); try { d = Double.valueOf(str).doubleValue(); } catch (NumberFormatException e) { d= Double.NaN; } return d; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltDatetime.java0000644000175000017500000012630410721374031023373 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltDatetime.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; /** * This class contains EXSLT dates and times extension functions. * It is accessed by specifying a namespace URI as follows: *

         *    xmlns:datetime="http://exslt.org/dates-and-times"
         * 
        * * The documentation for each function has been copied from the relevant * EXSLT Implementer page. * * @see EXSLT * @xsl.usage general */ public class ExsltDatetime { // Datetime formats (era and zone handled separately). static final String dt = "yyyy-MM-dd'T'HH:mm:ss"; static final String d = "yyyy-MM-dd"; static final String gym = "yyyy-MM"; static final String gy = "yyyy"; static final String gmd = "--MM-dd"; static final String gm = "--MM--"; static final String gd = "---dd"; static final String t = "HH:mm:ss"; static final String EMPTY_STR = ""; /** * The date:date-time function returns the current date and time as a date/time string. * The date/time string that's returned must be a string in the format defined as the * lexical representation of xs:dateTime in * [3.2.7 dateTime] of * [XML Schema Part 2: Datatypes]. * The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult * [XML Schema Part 2: Datatypes] and * [ISO 8601] for details. * The date/time string format must include a time zone, either a Z to indicate Coordinated * Universal Time or a + or - followed by the difference between the difference from UTC * represented as hh:mm. */ public static String dateTime() { Calendar cal = Calendar.getInstance(); Date datetime = cal.getTime(); // Format for date and time. SimpleDateFormat dateFormat = new SimpleDateFormat(dt); StringBuffer buff = new StringBuffer(dateFormat.format(datetime)); // Must also include offset from UTF. // Get the offset (in milliseconds). int offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); // If there is no offset, we have "Coordinated // Universal Time." if (offset == 0) buff.append("Z"); else { // Convert milliseconds to hours and minutes int hrs = offset/(60*60*1000); // In a few cases, the time zone may be +/-hh:30. int min = offset%(60*60*1000); char posneg = hrs < 0? '-': '+'; buff.append(posneg + formatDigits(hrs) + ':' + formatDigits(min)); } return buff.toString(); } /** * Represent the hours and minutes with two-digit strings. * @param q hrs or minutes. * @return two-digit String representation of hrs or minutes. */ private static String formatDigits(int q) { String dd = String.valueOf(Math.abs(q)); return dd.length() == 1 ? '0' + dd : dd; } /** * The date:date function returns the date specified in the date/time string given * as the argument. If no argument is given, then the current local date/time, as * returned by date:date-time is used as a default argument. * The date/time string that's returned must be a string in the format defined as the * lexical representation of xs:dateTime in * [3.2.7 dateTime] of * [XML Schema Part 2: Datatypes]. * If the argument is not in either of these formats, date:date returns an empty string (''). * The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult * [XML Schema Part 2: Datatypes] and * [ISO 8601] for details. * The date is returned as a string with a lexical representation as defined for xs:date in * [3.2.9 date] of [XML Schema Part 2: Datatypes]. The date format is basically CCYY-MM-DD, * although implementers should consult [XML Schema Part 2: Datatypes] and [ISO 8601] for details. * If no argument is given or the argument date/time specifies a time zone, then the date string * format must include a time zone, either a Z to indicate Coordinated Universal Time or a + or - * followed by the difference between the difference from UTC represented as hh:mm. If an argument * is specified and it does not specify a time zone, then the date string format must not include * a time zone. */ public static String date(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String leader = edz[0]; String datetime = edz[1]; String zone = edz[2]; if (datetime == null || zone == null) return EMPTY_STR; String[] formatsIn = {dt, d}; String formatOut = d; Date date = testFormats(datetime, formatsIn); if (date == null) return EMPTY_STR; SimpleDateFormat dateFormat = new SimpleDateFormat(formatOut); dateFormat.setLenient(false); String dateOut = dateFormat.format(date); if (dateOut.length() == 0) return EMPTY_STR; else return (leader + dateOut + zone); } /** * See above. */ public static String date() { String datetime = dateTime(); String date = datetime.substring(0, datetime.indexOf("T")); String zone = datetime.substring(getZoneStart(datetime)); return (date + zone); } /** * The date:time function returns the time specified in the date/time string given * as the argument. If no argument is given, then the current local date/time, as * returned by date:date-time is used as a default argument. * The date/time string that's returned must be a string in the format defined as the * lexical representation of xs:dateTime in * [3.2.7 dateTime] of * [XML Schema Part 2: Datatypes]. * If the argument string is not in this format, date:time returns an empty string (''). * The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult * [XML Schema Part 2: Datatypes] and * [ISO 8601] for details. * The date is returned as a string with a lexical representation as defined for xs:time in * [3.2.8 time] of [XML Schema Part 2: Datatypes]. * The time format is basically hh:mm:ss, although implementers should consult [XML Schema Part 2: * Datatypes] and [ISO 8601] for details. * If no argument is given or the argument date/time specifies a time zone, then the time string * format must include a time zone, either a Z to indicate Coordinated Universal Time or a + or - * followed by the difference between the difference from UTC represented as hh:mm. If an argument * is specified and it does not specify a time zone, then the time string format must not include * a time zone. */ public static String time(String timeIn) throws ParseException { String[] edz = getEraDatetimeZone(timeIn); String time = edz[1]; String zone = edz[2]; if (time == null || zone == null) return EMPTY_STR; String[] formatsIn = {dt, d, t}; String formatOut = t; Date date = testFormats(time, formatsIn); if (date == null) return EMPTY_STR; SimpleDateFormat dateFormat = new SimpleDateFormat(formatOut); String out = dateFormat.format(date); return (out + zone); } /** * See above. */ public static String time() { String datetime = dateTime(); String time = datetime.substring(datetime.indexOf("T")+1); // The datetime() function returns the zone on the datetime string. If we // append it, we get the zone substring duplicated. // Fix for JIRA 2013 // String zone = datetime.substring(getZoneStart(datetime)); // return (time + zone); return (time); } /** * The date:year function returns the year of a date as a number. If no * argument is given, then the current local date/time, as returned by * date:date-time is used as a default argument. * The date/time string specified as the first argument must be a right-truncated * string in the format defined as the lexical representation of xs:dateTime in one * of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gYearMonth (CCYY-MM) * xs:gYear (CCYY) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double year(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); boolean ad = edz[0].length() == 0; // AD (Common Era -- empty leader) String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d, gym, gy}; double yr = getNumber(datetime, formats, Calendar.YEAR); if (ad || yr == Double.NaN) return yr; else return -yr; } /** * See above. */ public static double year() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.YEAR); } /** * The date:month-in-year function returns the month of a date as a number. If no argument * is given, then the current local date/time, as returned by date:date-time is used * as a default argument. * The date/time string specified as the first argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime in one of * the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gYearMonth (CCYY-MM) * xs:gMonth (--MM--) * xs:gMonthDay (--MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double monthInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d, gym, gm, gmd}; return getNumber(datetime, formats, Calendar.MONTH) + 1; } /** * See above. */ public static double monthInYear() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.MONTH) + 1; } /** * The date:week-in-year function returns the week of the year as a number. If no argument * is given, then the current local date/time, as returned by date:date-time is used as the * default argument. For the purposes of numbering, counting follows ISO 8601: week 1 in a year * is the week containing the first Thursday of the year, with new weeks beginning on a Monday. * The date/time string specified as the argument is a right-truncated string in the format * defined as the lexical representation of xs:dateTime in one of the formats defined in * [XML Schema Part 2: Datatypes]. The * permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double weekInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.WEEK_OF_YEAR); } /** * See above. */ public static double weekInYear() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.WEEK_OF_YEAR); } /** * The date:day-in-year function returns the day of a date in a year * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_YEAR); } /** * See above. */ public static double dayInYear() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.DAY_OF_YEAR); } /** * The date:day-in-month function returns the day of a date as a number. * If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gMonthDay (--MM-DD) * xs:gDay (---DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayInMonth(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; String[] formats = {dt, d, gmd, gd}; double day = getNumber(datetime, formats, Calendar.DAY_OF_MONTH); return day; } /** * See above. */ public static double dayInMonth() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.DAY_OF_MONTH); } /** * The date:day-of-week-in-month function returns the day-of-the-week * in a month of a date as a number (e.g. 3 for the 3rd Tuesday in May). * If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated string * in the format defined as the lexical representation of xs:dateTime in one * of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayOfWeekInMonth(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_WEEK_IN_MONTH); } /** * See above. */ public static double dayOfWeekInMonth() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.DAY_OF_WEEK_IN_MONTH); } /** * The date:day-in-week function returns the day of the week given in a * date as a number. If no argument is given, then the current local date/time, * as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated string * in the format defined as the lexical representation of xs:dateTime in one * of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. The numbering of days of the week starts at 1 for Sunday, 2 for Monday and so on up to 7 for Saturday. */ public static double dayInWeek(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_WEEK); } /** * See above. */ public static double dayInWeek() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.DAY_OF_WEEK); } /** * The date:hour-in-day function returns the hour of the day as a number. * If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double hourInDay(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, t}; return getNumber(datetime, formats, Calendar.HOUR_OF_DAY); } /** * See above. */ public static double hourInDay() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.HOUR_OF_DAY); } /** * The date:minute-in-hour function returns the minute of the hour * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double minuteInHour(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt,t}; return getNumber(datetime, formats, Calendar.MINUTE); } /** * See above. */ public static double minuteInHour() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.MINUTE); } /** * The date:second-in-minute function returns the second of the minute * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double secondInMinute(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, t}; return getNumber(datetime, formats, Calendar.SECOND); } /** * See above. */ public static double secondInMinute() { Calendar cal = Calendar.getInstance(); return cal.get(Calendar.SECOND); } /** * The date:leap-year function returns true if the year given in a date * is a leap year. If no argument is given, then the current local * date/time, as returned by date:date-time is used as a default argument. * The date/time string specified as the first argument must be a * right-truncated string in the format defined as the lexical representation * of xs:dateTime in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gYearMonth (CCYY-MM) * xs:gYear (CCYY) * If the date/time string is not in one of these formats, then NaN is returned. */ public static XObject leapYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return new XNumber(Double.NaN); String[] formats = {dt, d, gym, gy}; double dbl = getNumber(datetime, formats, Calendar.YEAR); if (dbl == Double.NaN) return new XNumber(Double.NaN); int yr = (int)dbl; return new XBoolean(yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)); } /** * See above. */ public static boolean leapYear() { Calendar cal = Calendar.getInstance(); int yr = (int)cal.get(Calendar.YEAR); return (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)); } /** * The date:month-name function returns the full name of the month of a date. * If no argument is given, then the current local date/time, as returned by * date:date-time is used the default argument. * The date/time string specified as the argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime in * one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gYearMonth (CCYY-MM) * xs:gMonth (--MM--) * If the date/time string is not in one of these formats, then an empty string ('') * is returned. * The result is an English month name: one of 'January', 'February', 'March', * 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November' * or 'December'. */ public static String monthName(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return EMPTY_STR; String[] formatsIn = {dt, d, gym, gm}; String formatOut = "MMMM"; return getNameOrAbbrev(datetimeIn, formatsIn, formatOut); } /** * See above. */ public static String monthName() { String format = "MMMM"; return getNameOrAbbrev(format); } /** * The date:month-abbreviation function returns the abbreviation of the month of * a date. If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime in * one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gYearMonth (CCYY-MM) * xs:gMonth (--MM--) * If the date/time string is not in one of these formats, then an empty string ('') * is returned. * The result is a three-letter English month abbreviation: one of 'Jan', 'Feb', 'Mar', * 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov' or 'Dec'. * An implementation of this extension function in the EXSLT date namespace must conform * to the behaviour described in this document. */ public static String monthAbbreviation(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return EMPTY_STR; String[] formatsIn = {dt, d, gym, gm}; String formatOut = "MMM"; return getNameOrAbbrev(datetimeIn, formatsIn, formatOut); } /** * See above. */ public static String monthAbbreviation() { String format = "MMM"; return getNameOrAbbrev(format); } /** * The date:day-name function returns the full name of the day of the week * of a date. If no argument is given, then the current local date/time, * as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then the empty string ('') * is returned. * The result is an English day name: one of 'Sunday', 'Monday', 'Tuesday', 'Wednesday', * 'Thursday' or 'Friday'. * An implementation of this extension function in the EXSLT date namespace must conform * to the behaviour described in this document. */ public static String dayName(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return EMPTY_STR; String[] formatsIn = {dt, d}; String formatOut = "EEEE"; return getNameOrAbbrev(datetimeIn, formatsIn, formatOut); } /** * See above. */ public static String dayName() { String format = "EEEE"; return getNameOrAbbrev(format); } /** * The date:day-abbreviation function returns the abbreviation of the day * of the week of a date. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then the empty string * ('') is returned. * The result is a three-letter English day abbreviation: one of 'Sun', 'Mon', 'Tue', * 'Wed', 'Thu' or 'Fri'. * An implementation of this extension function in the EXSLT date namespace must conform * to the behaviour described in this document. */ public static String dayAbbreviation(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return EMPTY_STR; String[] formatsIn = {dt, d}; String formatOut = "EEE"; return getNameOrAbbrev(datetimeIn, formatsIn, formatOut); } /** * See above. */ public static String dayAbbreviation() { String format = "EEE"; return getNameOrAbbrev(format); } /** * Returns an array with the 3 components that a datetime input string * may contain: - (for BC era), datetime, and zone. If the zone is not * valid, return null for that component. */ private static String[] getEraDatetimeZone(String in) { String leader = ""; String datetime = in; String zone = ""; if (in.charAt(0)=='-' && !in.startsWith("--")) { leader = "-"; // '+' is implicit , not allowed datetime = in.substring(1); } int z = getZoneStart(datetime); if (z > 0) { zone = datetime.substring(z); datetime = datetime.substring(0, z); } else if (z == -2) zone = null; //System.out.println("'" + leader + "' " + datetime + " " + zone); return new String[]{leader, datetime, zone}; } /** * Get the start of zone information if the input ends * with 'Z' or +/-hh:mm. If a zone string is not * found, return -1; if the zone string is invalid, * return -2. */ private static int getZoneStart (String datetime) { if (datetime.indexOf("Z") == datetime.length()-1) return datetime.length()-1; else if (datetime.length() >=6 && datetime.charAt(datetime.length()-3) == ':' && (datetime.charAt(datetime.length()-6) == '+' || datetime.charAt(datetime.length()-6) == '-')) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm"); dateFormat.setLenient(false); Date d = dateFormat.parse(datetime.substring(datetime.length() -5)); return datetime.length()-6; } catch (ParseException pe) { System.out.println("ParseException " + pe.getErrorOffset()); return -2; // Invalid. } } return -1; // No zone information. } /** * Attempt to parse an input string with the allowed formats, returning * null if none of the formats work. */ private static Date testFormats (String in, String[] formats) throws ParseException { for (int i = 0; i * The first argument to date:format-date specifies the date/time to be * formatted. It must be right or left-truncated date/time strings in one of * the formats defined in * [XML Schema Part 2: Datatypes]. * The permitted formats are as follows: *
          *
        • xs:dateTime (CCYY-MM-DDThh:mm:ss) *
        • xs:date (CCYY-MM-DD) *
        • xs:time (hh:mm:ss) *
        • xs:gYearMonth (CCYY-MM) *
        • xs:gYear (CCYY) *
        • xs:gMonthDay (--MM-DD) *
        • xs:gMonth (--MM--) *
        • xs:gDay (---DD) *
        * The second argument is a string that gives the format pattern used to * format the date. The format pattern must be in the syntax specified by * the JDK 1.1 SimpleDateFormat class. The format pattern string is * interpreted as described for the JDK 1.1 SimpleDateFormat class. *

        * If the date/time format is right-truncated (i.e. in a format other than * xs:time, or xs:dateTime) then any missing components are assumed to be as * follows: if no month is specified, it is given a month of 01; if no day * is specified, it is given a day of 01; if no time is specified, it is * given a time of 00:00:00. *

        * If the date/time format is left-truncated (i.e. xs:time, xs:gMonthDay, * xs:gMonth or xs:gDay) and the format pattern has a token that uses a * component that is missing from the date/time format used, then that token * is replaced with an empty string ('') within the result. * * The author is Helg Bredow (helg.bredow@kalido.com) */ public static String formatDate(String dateTime, String pattern) { final String yearSymbols = "Gy"; final String monthSymbols = "M"; final String daySymbols = "dDEFwW"; TimeZone timeZone; String zone; // Get the timezone information if it was supplied and modify the // dateTime so that SimpleDateFormat will understand it. if (dateTime.endsWith("Z") || dateTime.endsWith("z")) { timeZone = TimeZone.getTimeZone("GMT"); dateTime = dateTime.substring(0, dateTime.length()-1) + "GMT"; zone = "z"; } else if ((dateTime.length() >= 6) && (dateTime.charAt(dateTime.length()-3) == ':') && ((dateTime.charAt(dateTime.length()-6) == '+') || (dateTime.charAt(dateTime.length()-6) == '-'))) { String offset = dateTime.substring(dateTime.length()-6); if ("+00:00".equals(offset) || "-00:00".equals(offset)) { timeZone = TimeZone.getTimeZone("GMT"); } else { timeZone = TimeZone.getTimeZone("GMT" + offset); } zone = "z"; // Need to adjust it since SimpleDateFormat requires GMT+hh:mm but // we have +hh:mm. dateTime = dateTime.substring(0, dateTime.length()-6) + "GMT" + offset; } else { // Assume local time. timeZone = TimeZone.getDefault(); zone = ""; // Leave off the timezone since SimpleDateFormat will assume local // time if time zone is not included. } String[] formats = {dt + zone, d, gym, gy}; // Try the time format first. We need to do this to prevent // SimpleDateFormat from interpreting a time as a year. i.e we just need // to check if it's a time before we check it's a year. try { SimpleDateFormat inFormat = new SimpleDateFormat(t + zone); inFormat.setLenient(false); Date d= inFormat.parse(dateTime); SimpleDateFormat outFormat = new SimpleDateFormat(strip (yearSymbols + monthSymbols + daySymbols, pattern)); outFormat.setTimeZone(timeZone); return outFormat.format(d); } catch (ParseException pe) { } // Try the right truncated formats. for (int i = 0; i < formats.length; i++) { try { SimpleDateFormat inFormat = new SimpleDateFormat(formats[i]); inFormat.setLenient(false); Date d = inFormat.parse(dateTime); SimpleDateFormat outFormat = new SimpleDateFormat(pattern); outFormat.setTimeZone(timeZone); return outFormat.format(d); } catch (ParseException pe) { } } // Now try the left truncated ones. The Java format() function doesn't // return the correct strings in this case. We strip any pattern // symbols that shouldn't be output so that they are not defaulted to // inappropriate values in the output. try { SimpleDateFormat inFormat = new SimpleDateFormat(gmd); inFormat.setLenient(false); Date d = inFormat.parse(dateTime); SimpleDateFormat outFormat = new SimpleDateFormat(strip(yearSymbols, pattern)); outFormat.setTimeZone(timeZone); return outFormat.format(d); } catch (ParseException pe) { } try { SimpleDateFormat inFormat = new SimpleDateFormat(gm); inFormat.setLenient(false); Date d = inFormat.parse(dateTime); SimpleDateFormat outFormat = new SimpleDateFormat(strip(yearSymbols, pattern)); outFormat.setTimeZone(timeZone); return outFormat.format(d); } catch (ParseException pe) { } try { SimpleDateFormat inFormat = new SimpleDateFormat(gd); inFormat.setLenient(false); Date d = inFormat.parse(dateTime); SimpleDateFormat outFormat = new SimpleDateFormat(strip(yearSymbols + monthSymbols, pattern)); outFormat.setTimeZone(timeZone); return outFormat.format(d); } catch (ParseException pe) { } return EMPTY_STR; } /** * Strips occurrences of the given character from a date format pattern. * @param symbols list of symbols to strip. * @param pattern * @return */ private static String strip(String symbols, String pattern) { int quoteSemaphore = 0; int i = 0; StringBuffer result = new StringBuffer(pattern.length()); while (i < pattern.length()) { char ch = pattern.charAt(i); if (ch == '\'') { // Assume it's an openening quote so simply copy the quoted // text to the result. There is nothing to strip here. int endQuote = pattern.indexOf('\'', i + 1); if (endQuote == -1) { endQuote = pattern.length(); } result.append(pattern.substring(i, endQuote)); i = endQuote++; } else if (symbols.indexOf(ch) > -1) { // The char needs to be stripped. i++; } else { result.append(ch); i++; } } return result.toString(); } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltMath.java0000644000175000017500000002734310721374033022535 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltMath.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import org.apache.xpath.NodeSet; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * This class contains EXSLT math extension functions. * It is accessed by specifying a namespace URI as follows: *

         *    xmlns:math="http://exslt.org/math"
         * 
        * * The documentation for each function has been copied from the relevant * EXSLT Implementer page. * * @see EXSLT * @xsl.usage general */ public class ExsltMath extends ExsltBase { // Constants private static String PI = "3.1415926535897932384626433832795028841971693993751"; private static String E = "2.71828182845904523536028747135266249775724709369996"; private static String SQRRT2 = "1.41421356237309504880168872420969807856967187537694"; private static String LN2 = "0.69314718055994530941723212145817656807550013436025"; private static String LN10 = "2.302585092994046"; private static String LOG2E = "1.4426950408889633"; private static String SQRT1_2 = "0.7071067811865476"; /** * The math:max function returns the maximum value of the nodes passed as the argument. * The maximum value is defined as follows. The node set passed as an argument is sorted * in descending order as it would be by xsl:sort with a data type of number. The maximum * is the result of converting the string value of the first node in this sorted list to * a number using the number function. *

        * If the node set is empty, or if the result of converting the string values of any of the * nodes to a number is NaN, then NaN is returned. * * @param nl The NodeList for the node-set to be evaluated. * * @return the maximum value found, NaN if any node cannot be converted to a number. * * @see EXSLT */ public static double max (NodeList nl) { if (nl == null || nl.getLength() == 0) return Double.NaN; double m = - Double.MAX_VALUE; for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); double d = toNumber(n); if (Double.isNaN(d)) return Double.NaN; else if (d > m) m = d; } return m; } /** * The math:min function returns the minimum value of the nodes passed as the argument. * The minimum value is defined as follows. The node set passed as an argument is sorted * in ascending order as it would be by xsl:sort with a data type of number. The minimum * is the result of converting the string value of the first node in this sorted list to * a number using the number function. *

        * If the node set is empty, or if the result of converting the string values of any of * the nodes to a number is NaN, then NaN is returned. * * @param nl The NodeList for the node-set to be evaluated. * * @return the minimum value found, NaN if any node cannot be converted to a number. * * @see EXSLT */ public static double min (NodeList nl) { if (nl == null || nl.getLength() == 0) return Double.NaN; double m = Double.MAX_VALUE; for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); double d = toNumber(n); if (Double.isNaN(d)) return Double.NaN; else if (d < m) m = d; } return m; } /** * The math:highest function returns the nodes in the node set whose value is the maximum * value for the node set. The maximum value for the node set is the same as the value as * calculated by math:max. A node has this maximum value if the result of converting its * string value to a number as if by the number function is equal to the maximum value, * where the equality comparison is defined as a numerical comparison using the = operator. *

        * If any of the nodes in the node set has a non-numeric value, the math:max function will * return NaN. The definition numeric comparisons entails that NaN != NaN. Therefore if any * of the nodes in the node set has a non-numeric value, math:highest will return an empty * node set. * * @param nl The NodeList for the node-set to be evaluated. * * @return node-set with nodes containing the maximum value found, an empty node-set * if any node cannot be converted to a number. */ public static NodeList highest (NodeList nl) { double maxValue = max(nl); NodeSet highNodes = new NodeSet(); highNodes.setShouldCacheNodes(true); if (Double.isNaN(maxValue)) return highNodes; // empty Nodeset for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); double d = toNumber(n); if (d == maxValue) highNodes.addElement(n); } return highNodes; } /** * The math:lowest function returns the nodes in the node set whose value is the minimum value * for the node set. The minimum value for the node set is the same as the value as calculated * by math:min. A node has this minimum value if the result of converting its string value to * a number as if by the number function is equal to the minimum value, where the equality * comparison is defined as a numerical comparison using the = operator. *

        * If any of the nodes in the node set has a non-numeric value, the math:min function will return * NaN. The definition numeric comparisons entails that NaN != NaN. Therefore if any of the nodes * in the node set has a non-numeric value, math:lowest will return an empty node set. * * @param nl The NodeList for the node-set to be evaluated. * * @return node-set with nodes containing the minimum value found, an empty node-set * if any node cannot be converted to a number. * */ public static NodeList lowest (NodeList nl) { double minValue = min(nl); NodeSet lowNodes = new NodeSet(); lowNodes.setShouldCacheNodes(true); if (Double.isNaN(minValue)) return lowNodes; // empty Nodeset for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); double d = toNumber(n); if (d == minValue) lowNodes.addElement(n); } return lowNodes; } /** * The math:abs function returns the absolute value of a number. * * @param num A number * @return The absolute value of the number */ public static double abs(double num) { return Math.abs(num); } /** * The math:acos function returns the arccosine value of a number. * * @param num A number * @return The arccosine value of the number */ public static double acos(double num) { return Math.acos(num); } /** * The math:asin function returns the arcsine value of a number. * * @param num A number * @return The arcsine value of the number */ public static double asin(double num) { return Math.asin(num); } /** * The math:atan function returns the arctangent value of a number. * * @param num A number * @return The arctangent value of the number */ public static double atan(double num) { return Math.atan(num); } /** * The math:atan2 function returns the angle ( in radians ) from the X axis to a point (y,x). * * @param num1 The X axis value * @param num2 The Y axis value * @return The angle (in radians) from the X axis to a point (y,x) */ public static double atan2(double num1, double num2) { return Math.atan2(num1, num2); } /** * The math:cos function returns cosine of the passed argument. * * @param num A number * @return The cosine value of the number */ public static double cos(double num) { return Math.cos(num); } /** * The math:exp function returns e (the base of natural logarithms) raised to a power. * * @param num A number * @return The value of e raised to the given power */ public static double exp(double num) { return Math.exp(num); } /** * The math:log function returns the natural logarithm of a number. * * @param num A number * @return The natural logarithm of the number */ public static double log(double num) { return Math.log(num); } /** * The math:power function returns the value of a base expression taken to a specified power. * * @param num1 The base * @param num2 The power * @return The value of the base expression taken to the specified power */ public static double power(double num1, double num2) { return Math.pow(num1, num2); } /** * The math:random function returns a random number from 0 to 1. * * @return A random double from 0 to 1 */ public static double random() { return Math.random(); } /** * The math:sin function returns the sine of the number. * * @param num A number * @return The sine value of the number */ public static double sin(double num) { return Math.sin(num); } /** * The math:sqrt function returns the square root of a number. * * @param num A number * @return The square root of the number */ public static double sqrt(double num) { return Math.sqrt(num); } /** * The math:tan function returns the tangent of the number passed as an argument. * * @param num A number * @return The tangent value of the number */ public static double tan(double num) { return Math.tan(num); } /** * The math:constant function returns the specified constant to a set precision. * The possible constants are: *

           *  PI
           *  E
           *  SQRRT2
           *  LN2
           *  LN10
           *  LOG2E
           *  SQRT1_2
           * 
        * @param name The name of the constant * @param precision The precision * @return The value of the specified constant to the given precision */ public static double constant(String name, double precision) { String value = null; if (name.equals("PI")) value = PI; else if (name.equals("E")) value = E; else if (name.equals("SQRRT2")) value = SQRRT2; else if (name.equals("LN2")) value = LN2; else if (name.equals("LN10")) value = LN10; else if (name.equals("LOG2E")) value = LOG2E; else if (name.equals("SQRT1_2")) value = SQRT1_2; if (value != null) { int bits = new Double(precision).intValue(); if (bits <= value.length()) value = value.substring(0, bits); return new Double(value).doubleValue(); } else return Double.NaN; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/Redirect.java0000644000175000017500000004302710721374031022360 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Redirect.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.Hashtable; import javax.xml.transform.Result; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamResult; import org.apache.xalan.extensions.XSLProcessorContext; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.ElemExtensionCall; import org.apache.xalan.templates.OutputProperties; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPath; import org.apache.xpath.objects.XObject; import org.apache.xml.serializer.SerializationHandler; import org.xml.sax.ContentHandler; /** * Implements three extension elements to allow an XSLT transformation to * redirect its output to multiple output files. * * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:redirect="http://xml.apache.org/xalan/redirect"
         * 
        * *

        You can either just use redirect:write, in which case the file will be * opened and immediately closed after the write, or you can bracket the * write calls by redirect:open and redirect:close, in which case the * file will be kept open for multiple writes until the close call is * encountered. Calls can be nested. * *

        Calls can take a 'file' attribute * and/or a 'select' attribute in order to get the filename. If a select * attribute is encountered, it will evaluate that expression for a string * that indicates the filename. If the string evaluates to empty, it will * attempt to use the 'file' attribute as a default. Filenames can be relative * or absolute. If they are relative, the base directory will be the same as * the base directory for the output document. This is obtained by calling * getOutputTarget() on the TransformerImpl. You can set this base directory * by calling TransformerImpl.setOutputTarget() or it is automatically set * when using the two argument form of transform() or transformNode(). * *

        Calls to redirect:write and redirect:open also take an optional * attribute append="true|yes", which will attempt to simply append * to an existing file instead of always opening a new file. The * default behavior of always overwriting the file still happens * if you do not specify append. *

        Note: this may give unexpected results when using xml * or html output methods, since this is not coordinated * with the serializers - hence, you may get extra xml decls in * the middle of your file after appending to it. * *

        Example:

        *
         * <?xml version="1.0"?>
         * <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
         *                 version="1.0"
         *                 xmlns:redirect="http://xml.apache.org/xalan/redirect"
         *                 extension-element-prefixes="redirect">
         *
         *   <xsl:template match="/">
         *     <out>
         *       default output.
         *     </out>
         *     <redirect:open file="doc3.out"/>
         *     <redirect:write file="doc3.out">
         *       <out>
         *         <redirect:write file="doc1.out">
         *           <out>
         *             doc1 output.
         *             <redirect:write file="doc3.out">
         *               Some text to doc3
         *             </redirect:write>
         *           </out>
         *         </redirect:write>
         *         <redirect:write file="doc2.out">
         *           <out>
         *             doc2 output.
         *             <redirect:write file="doc3.out">
         *               Some more text to doc3
         *               <redirect:write select="doc/foo">
         *                 text for doc4
         *               </redirect:write>
         *             </redirect:write>
         *           </out>
         *         </redirect:write>
         *       </out>
         *     </redirect:write>
         *     <redirect:close file="doc3.out"/>
         *   </xsl:template>
         *
         * </xsl:stylesheet>
         * 
        * * @author Scott Boag * @version 1.0 * @see Example with Redirect extension */ public class Redirect { /** * List of formatter listeners indexed by filename. */ protected Hashtable m_formatterListeners = new Hashtable (); /** * List of output streams indexed by filename. */ protected Hashtable m_outputStreams = new Hashtable (); /** * Default append mode for bare open calls. * False for backwards compatibility (I think). */ public static final boolean DEFAULT_APPEND_OPEN = false; /** * Default append mode for bare write calls. * False for backwards compatibility. */ public static final boolean DEFAULT_APPEND_WRITE = false; /** * Open the given file and put it in the XML, HTML, or Text formatter listener's table. */ public void open(XSLProcessorContext context, ElemExtensionCall elem) throws java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerException { String fileName = getFilename(context, elem); Object flistener = m_formatterListeners.get(fileName); if(null == flistener) { String mkdirsExpr = elem.getAttribute ("mkdirs", context.getContextNode(), context.getTransformer()); boolean mkdirs = (mkdirsExpr != null) ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true; // Whether to append to existing files or not, String appendExpr = elem.getAttribute("append", context.getContextNode(), context.getTransformer()); boolean append = (appendExpr != null) ? (appendExpr.equals("true") || appendExpr.equals("yes")) : DEFAULT_APPEND_OPEN; Object ignored = makeFormatterListener(context, elem, fileName, true, mkdirs, append); } } /** * Write the evalutation of the element children to the given file. Then close the file * unless it was opened with the open extension element and is in the formatter listener's table. */ public void write(XSLProcessorContext context, ElemExtensionCall elem) throws java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerException { String fileName = getFilename(context, elem); Object flObject = m_formatterListeners.get(fileName); ContentHandler formatter; boolean inTable = false; if(null == flObject) { String mkdirsExpr = ((ElemExtensionCall)elem).getAttribute ("mkdirs", context.getContextNode(), context.getTransformer()); boolean mkdirs = (mkdirsExpr != null) ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true; // Whether to append to existing files or not, String appendExpr = elem.getAttribute("append", context.getContextNode(), context.getTransformer()); boolean append = (appendExpr != null) ? (appendExpr.equals("true") || appendExpr.equals("yes")) : DEFAULT_APPEND_WRITE; formatter = makeFormatterListener(context, elem, fileName, true, mkdirs, append); } else { inTable = true; formatter = (ContentHandler)flObject; } TransformerImpl transf = context.getTransformer(); startRedirection(transf, formatter); // for tracing only transf.executeChildTemplates(elem, context.getContextNode(), context.getMode(), formatter); endRedirection(transf); // for tracing only if(!inTable) { OutputStream ostream = (OutputStream)m_outputStreams.get(fileName); if(null != ostream) { try { formatter.endDocument(); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } ostream.close(); m_outputStreams.remove(fileName); m_formatterListeners.remove(fileName); } } } /** * Close the given file and remove it from the formatter listener's table. */ public void close(XSLProcessorContext context, ElemExtensionCall elem) throws java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerException { String fileName = getFilename(context, elem); Object formatterObj = m_formatterListeners.get(fileName); if(null != formatterObj) { ContentHandler fl = (ContentHandler)formatterObj; try { fl.endDocument(); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } OutputStream ostream = (OutputStream)m_outputStreams.get(fileName); if(null != ostream) { ostream.close(); m_outputStreams.remove(fileName); } m_formatterListeners.remove(fileName); } } /** * Get the filename from the 'select' or the 'file' attribute. */ private String getFilename(XSLProcessorContext context, ElemExtensionCall elem) throws java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerException { String fileName; String fileNameExpr = ((ElemExtensionCall)elem).getAttribute ("select", context.getContextNode(), context.getTransformer()); if(null != fileNameExpr) { org.apache.xpath.XPathContext xctxt = context.getTransformer().getXPathContext(); XPath myxpath = new XPath(fileNameExpr, elem, xctxt.getNamespaceContext(), XPath.SELECT); XObject xobj = myxpath.execute(xctxt, context.getContextNode(), elem); fileName = xobj.str(); if((null == fileName) || (fileName.length() == 0)) { fileName = elem.getAttribute ("file", context.getContextNode(), context.getTransformer()); } } else { fileName = elem.getAttribute ("file", context.getContextNode(), context.getTransformer()); } if(null == fileName) { context.getTransformer().getMsgMgr().error(elem, elem, context.getContextNode(), XSLTErrorResources.ER_REDIRECT_COULDNT_GET_FILENAME); //"Redirect extension: Could not get filename - file or select attribute must return vald string."); } return fileName; } // yuck. // Note: this is not the best way to do this, and may not even // be fully correct! Patches (with test cases) welcomed. -sc private String urlToFileName(String base) { if(null != base) { if(base.startsWith("file:////")) { base = base.substring(7); } else if(base.startsWith("file:///")) { base = base.substring(6); } else if(base.startsWith("file://")) { base = base.substring(5); // absolute? } else if(base.startsWith("file:/")) { base = base.substring(5); } else if(base.startsWith("file:")) { base = base.substring(4); } } return base; } /** * Create a new ContentHandler, based on attributes of the current ContentHandler. */ private ContentHandler makeFormatterListener(XSLProcessorContext context, ElemExtensionCall elem, String fileName, boolean shouldPutInTable, boolean mkdirs, boolean append) throws java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerException { File file = new File(fileName); TransformerImpl transformer = context.getTransformer(); String base; // Base URI to use for relative paths if(!file.isAbsolute()) { // This code is attributed to Jon Grov . A relative file name // is relative to the Result used to kick off the transform. If no such // Result was supplied, the filename is relative to the source document. // When transforming with a SAXResult or DOMResult, call // TransformerImpl.setOutputTarget() to set the desired Result base. // String base = urlToFileName(elem.getStylesheet().getSystemId()); Result outputTarget = transformer.getOutputTarget(); if ( (null != outputTarget) && ((base = outputTarget.getSystemId()) != null) ) { base = urlToFileName(base); } else { base = urlToFileName(transformer.getBaseURLOfSource()); } if(null != base) { File baseFile = new File(base); file = new File(baseFile.getParent(), fileName); } // System.out.println("file is: "+file.toString()); } if(mkdirs) { String dirStr = file.getParent(); if((null != dirStr) && (dirStr.length() > 0)) { File dir = new File(dirStr); dir.mkdirs(); } } // This should be worked on so that the output format can be // defined by a first child of the redirect element. OutputProperties format = transformer.getOutputFormat(); // FileOutputStream ostream = new FileOutputStream(file); // Patch from above line to below by // Note that in JDK 1.2.2 at least, FileOutputStream(File) // is implemented as a call to // FileOutputStream(File.getPath, append), thus this should be // the equivalent instead of getAbsolutePath() FileOutputStream ostream = new FileOutputStream(file.getPath(), append); try { SerializationHandler flistener = createSerializationHandler(transformer, ostream, file, format); try { flistener.startDocument(); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } if(shouldPutInTable) { m_outputStreams.put(fileName, ostream); m_formatterListeners.put(fileName, flistener); } return flistener; } catch(TransformerException te) { throw new javax.xml.transform.TransformerException(te); } } /** * A class that extends this class can over-ride this public method and recieve * a callback that redirection is about to start * @param transf The transformer. * @param formatter The handler that receives the redirected output */ public void startRedirection(TransformerImpl transf, ContentHandler formatter) { // A class that extends this class could provide a method body } /** * A class that extends this class can over-ride this public method and receive * a callback that redirection to the ContentHandler specified in the startRedirection() * call has ended * @param transf The transformer. */ public void endRedirection(TransformerImpl transf) { // A class that extends this class could provide a method body } /** * A class that extends this one could over-ride this public method and receive * a callback for the creation of the serializer used in the redirection. * @param transformer The transformer * @param ostream The output stream that the serializer wraps * @param file The file associated with the ostream * @param format The format parameter used to create the serializer * @return the serializer that the redirection will go to. * * @throws java.io.IOException * @throws TransformerException */ public SerializationHandler createSerializationHandler( TransformerImpl transformer, FileOutputStream ostream, File file, OutputProperties format) throws java.io.IOException, TransformerException { SerializationHandler serializer = transformer.createSerializationHandler( new StreamResult(ostream), format); return serializer; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/NodeInfo.java0000644000175000017500000002104710721374031022316 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeInfo.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import javax.xml.transform.SourceLocator; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xml.dtm.ref.DTMNodeProxy; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * NodeInfo defines a set of XSLT extension functions to be * used from stylesheets. * * @author Ovidiu Predescu * @since May 24, 2001 */ public class NodeInfo { /** * systemId returns the system id of the current * context node. * * @param context an ExpressionContext value * @return a String value */ public static String systemId(ExpressionContext context) { Node contextNode = context.getContextNode(); int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getSystemId(); else return null; } /** * systemId returns the system id of the node passed as * argument. If a node set is passed as argument, the system id of * the first node in the set is returned. * * @param nodeList a NodeList value * @return a String value */ public static String systemId(NodeList nodeList) { if (nodeList == null || nodeList.getLength() == 0) return null; Node node = nodeList.item(0); int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)node).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getSystemId(); else return null; } /** * publicId returns the public identifier of the current * context node. * * Xalan does not currently record this value, and will return null. * * @param context an ExpressionContext value * @return a String value */ public static String publicId(ExpressionContext context) { Node contextNode = context.getContextNode(); int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getPublicId(); else return null; } /** * publicId returns the public identifier of the node passed as * argument. If a node set is passed as argument, the public identifier of * the first node in the set is returned. * * Xalan does not currently record this value, and will return null. * * @param nodeList a NodeList value * @return a String value */ public static String publicId(NodeList nodeList) { if (nodeList == null || nodeList.getLength() == 0) return null; Node node = nodeList.item(0); int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)node).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getPublicId(); else return null; } /** * lineNumber returns the line number of the current * context node. * * NOTE: Xalan does not normally record location information for each node. * To obtain it, you must set the custom TrAX attribute * "http://xml.apache.org/xalan/features/source_location" * true in the TransformerFactory before generating the Transformer and executing * the stylesheet. Storage cost per node will be noticably increased in this mode. * * @param context an ExpressionContext value * @return an int value. This may be -1 to indicate that the * line number is not known. */ public static int lineNumber(ExpressionContext context) { Node contextNode = context.getContextNode(); int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getLineNumber(); else return -1; } /** * lineNumber returns the line number of the node * passed as argument. If a node set is passed as argument, the line * number of the first node in the set is returned. * * NOTE: Xalan does not normally record location information for each node. * To obtain it, you must set the custom TrAX attribute * "http://xml.apache.org/xalan/features/source_location" * true in the TransformerFactory before generating the Transformer and executing * the stylesheet. Storage cost per node will be noticably increased in this mode. * * @param nodeList a NodeList value * @return an int value. This may be -1 to indicate that the * line number is not known. */ public static int lineNumber(NodeList nodeList) { if (nodeList == null || nodeList.getLength() == 0) return -1; Node node = nodeList.item(0); int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)node).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getLineNumber(); else return -1; } /** * columnNumber returns the column number of the * current context node. * * NOTE: Xalan does not normally record location information for each node. * To obtain it, you must set the custom TrAX attribute * "http://xml.apache.org/xalan/features/source_location" * true in the TransformerFactory before generating the Transformer and executing * the stylesheet. Storage cost per node will be noticably increased in this mode. * * @param context an ExpressionContext value * @return an int value. This may be -1 to indicate that the * column number is not known. */ public static int columnNumber(ExpressionContext context) { Node contextNode = context.getContextNode(); int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getColumnNumber(); else return -1; } /** * columnNumber returns the column number of the node * passed as argument. If a node set is passed as argument, the line * number of the first node in the set is returned. * * NOTE: Xalan does not normally record location information for each node. * To obtain it, you must set the custom TrAX attribute * "http://xml.apache.org/xalan/features/source_location" * true in the TransformerFactory before generating the Transformer and executing * the stylesheet. Storage cost per node will be noticably increased in this mode. * * @param nodeList a NodeList value * @return an int value. This may be -1 to indicate that the * column number is not known. */ public static int columnNumber(NodeList nodeList) { if (nodeList == null || nodeList.getLength() == 0) return -1; Node node = nodeList.item(0); int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber(); SourceLocator locator = ((DTMNodeProxy)node).getDTM() .getSourceLocatorFor(nodeHandler); if (locator != null) return locator.getColumnNumber(); else return -1; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/package.html0000644000175000017500000000214510721374030022230 0ustar mkochmkoch Xalan and EXSLT Extensions.

        Extension elements and functions shipped with Xalan-Java, including EXSLT functions.

        We are adding extensions to this package.

        libxalan2-java-2.7.1/src/org/apache/xalan/lib/PipeDocument.java0000644000175000017500000002304510721374033023213 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PipeDocument.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import java.util.Vector; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.extensions.XSLProcessorContext; import org.apache.xalan.templates.AVT; import org.apache.xalan.templates.ElemExtensionCall; import org.apache.xalan.templates.ElemLiteralResult; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.SystemIDResolver; import org.apache.xpath.XPathContext; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** */ // Imported Serializer classes import org.apache.xml.serializer.Serializer; import org.apache.xml.serializer.SerializerFactory; /** * PipeDocument is a Xalan extension element to set stylesheet params and pipes an XML * document through a series of 1 or more stylesheets. * PipeDocument is invoked from a stylesheet as the {@link #pipeDocument pipeDocument extension element}. * * It is accessed by specifying a namespace URI as follows: *

         *    xmlns:pipe="http://xml.apache.org/xalan/PipeDocument"
         * 
        * * @author Donald Leslie */ public class PipeDocument { /** * Extension element for piping an XML document through a series of 1 or more transformations. * *
        Common usage pattern: A stylesheet transforms a listing of documents to be
         * transformed into a TOC. For each document in the listing calls the pipeDocument
         * extension element to pipe that document through a series of 1 or more stylesheets 
         * to the desired output document.
         * 
         * Syntax:
         * <xsl:stylesheet version="1.0"
         *                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         *                xmlns:pipe="http://xml.apache.org/xalan/PipeDocument"
         *                extension-element-prefixes="pipe">
         * ...
         * <pipe:pipeDocument   source="source.xml" target="target.xml">
         *   <stylesheet href="ss1.xsl">
         *     <param name="param1" value="value1"/>
         *   </stylesheet>
         *   <stylesheet href="ss2.xsl">
         *     <param name="param1" value="value1"/>
         *     <param name="param2" value="value2"/>
         *   </stylesheet>
         *   <stylesheet href="ss1.xsl"/>     
         * </pipe:pipeDocument>
         * 
         * Notes:
        *
          *
        • The base URI for the source attribute is the XML "listing" document.
        • *
        • The target attribute is taken as is (base is the current user directory).
        • *
        • The stylsheet containg the extension element is the base URI for the * stylesheet hrefs.
        • *
        */ public void pipeDocument(XSLProcessorContext context, ElemExtensionCall elem) throws TransformerException, TransformerConfigurationException, SAXException, IOException, FileNotFoundException { SAXTransformerFactory saxTFactory = (SAXTransformerFactory) TransformerFactory.newInstance(); // XML doc to transform. String source = elem.getAttribute("source", context.getContextNode(), context.getTransformer()); TransformerImpl transImpl = context.getTransformer(); //Base URI for input doc, so base for relative URI to XML doc to transform. String baseURLOfSource = transImpl.getBaseURLOfSource(); // Absolute URI for XML doc to transform. String absSourceURL = SystemIDResolver.getAbsoluteURI(source, baseURLOfSource); // Transformation target String target = elem.getAttribute("target", context.getContextNode(), context.getTransformer()); XPathContext xctxt = context.getTransformer().getXPathContext(); int xt = xctxt.getDTMHandleFromNode(context.getContextNode()); // Get System Id for stylesheet; to be used to resolve URIs to other stylesheets. String sysId = elem.getSystemId(); NodeList ssNodes = null; NodeList paramNodes = null; Node ssNode = null; Node paramNode = null; if (elem.hasChildNodes()) { ssNodes = elem.getChildNodes(); // Vector to contain TransformerHandler for each stylesheet. Vector vTHandler = new Vector(ssNodes.getLength()); // The child nodes of an extension element node are instances of // ElemLiteralResult, which requires does not fully support the standard // Node interface. Accordingly, some special handling is required (see below) // to get attribute values. for (int i = 0; i < ssNodes.getLength(); i++) { ssNode = ssNodes.item(i); if (ssNode.getNodeType() == Node.ELEMENT_NODE && ((Element)ssNode).getTagName().equals("stylesheet") && ssNode instanceof ElemLiteralResult) { AVT avt = ((ElemLiteralResult)ssNode).getLiteralResultAttribute("href"); String href = avt.evaluate(xctxt,xt, elem); String absURI = SystemIDResolver.getAbsoluteURI(href, sysId); Templates tmpl = saxTFactory.newTemplates(new StreamSource(absURI)); TransformerHandler tHandler = saxTFactory.newTransformerHandler(tmpl); Transformer trans = tHandler.getTransformer(); // AddTransformerHandler to vector vTHandler.addElement(tHandler); paramNodes = ssNode.getChildNodes(); for (int j = 0; j < paramNodes.getLength(); j++) { paramNode = paramNodes.item(j); if (paramNode.getNodeType() == Node.ELEMENT_NODE && ((Element)paramNode).getTagName().equals("param") && paramNode instanceof ElemLiteralResult) { avt = ((ElemLiteralResult)paramNode).getLiteralResultAttribute("name"); String pName = avt.evaluate(xctxt,xt, elem); avt = ((ElemLiteralResult)paramNode).getLiteralResultAttribute("value"); String pValue = avt.evaluate(xctxt,xt, elem); trans.setParameter(pName, pValue); } } } } usePipe(vTHandler, absSourceURL, target); } } /** * Uses a Vector of TransformerHandlers to pipe XML input document through * a series of 1 or more transformations. Called by {@link #pipeDocument}. * * @param vTHandler Vector of Transformation Handlers (1 per stylesheet). * @param source absolute URI to XML input * @param target absolute path to transformation output. */ public void usePipe(Vector vTHandler, String source, String target) throws TransformerException, TransformerConfigurationException, FileNotFoundException, IOException, SAXException, SAXNotRecognizedException { XMLReader reader = XMLReaderFactory.createXMLReader(); TransformerHandler tHFirst = (TransformerHandler)vTHandler.firstElement(); reader.setContentHandler(tHFirst); reader.setProperty("http://xml.org/sax/properties/lexical-handler", tHFirst); for (int i = 1; i < vTHandler.size(); i++) { TransformerHandler tHFrom = (TransformerHandler)vTHandler.elementAt(i-1); TransformerHandler tHTo = (TransformerHandler)vTHandler.elementAt(i); tHFrom.setResult(new SAXResult(tHTo)); } TransformerHandler tHLast = (TransformerHandler)vTHandler.lastElement(); Transformer trans = tHLast.getTransformer(); Properties outputProps = trans.getOutputProperties(); Serializer serializer = SerializerFactory.getSerializer(outputProps); FileOutputStream out = new FileOutputStream(target); try { serializer.setOutputStream(out); tHLast.setResult(new SAXResult(serializer.asContentHandler())); reader.parse(source); } finally { // Always clean up the FileOutputStream, // even if an exception was thrown in the try block if (out != null) out.close(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ObjectFactory.java0000644000175000017500000006375710721374033023373 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468639 2006-10-28 06:52:33Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -7640369932165775029L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltSets.java0000644000175000017500000001762510721374033022564 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltSets.java 469688 2006-10-31 22:39:43Z minchau $ */ package org.apache.xalan.lib; import java.util.HashMap; import java.util.Map; import org.apache.xml.utils.DOMHelper; import org.apache.xpath.NodeSet; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * This class contains EXSLT set extension functions. * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:set="http://exslt.org/sets"
         * 
        * * The documentation for each function has been copied from the relevant * EXSLT Implementer page. * * @see EXSLT * @xsl.usage general */ public class ExsltSets extends ExsltBase { /** * The set:leading function returns the nodes in the node set passed as the first argument that * precede, in document order, the first node in the node set passed as the second argument. If * the first node in the second node set is not contained in the first node set, then an empty * node set is returned. If the second node set is empty, then the first node set is returned. * * @param nl1 NodeList for first node-set. * @param nl2 NodeList for second node-set. * @return a NodeList containing the nodes in nl1 that precede in document order the first * node in nl2; an empty node-set if the first node in nl2 is not in nl1; all of nl1 if nl2 * is empty. * * @see EXSLT */ public static NodeList leading (NodeList nl1, NodeList nl2) { if (nl2.getLength() == 0) return nl1; NodeSet ns1 = new NodeSet(nl1); NodeSet leadNodes = new NodeSet(); Node endNode = nl2.item(0); if (!ns1.contains(endNode)) return leadNodes; // empty NodeSet for (int i = 0; i < nl1.getLength(); i++) { Node testNode = nl1.item(i); if (DOMHelper.isNodeAfter(testNode, endNode) && !DOMHelper.isNodeTheSame(testNode, endNode)) leadNodes.addElement(testNode); } return leadNodes; } /** * The set:trailing function returns the nodes in the node set passed as the first argument that * follow, in document order, the first node in the node set passed as the second argument. If * the first node in the second node set is not contained in the first node set, then an empty * node set is returned. If the second node set is empty, then the first node set is returned. * * @param nl1 NodeList for first node-set. * @param nl2 NodeList for second node-set. * @return a NodeList containing the nodes in nl1 that follow in document order the first * node in nl2; an empty node-set if the first node in nl2 is not in nl1; all of nl1 if nl2 * is empty. * * @see EXSLT */ public static NodeList trailing (NodeList nl1, NodeList nl2) { if (nl2.getLength() == 0) return nl1; NodeSet ns1 = new NodeSet(nl1); NodeSet trailNodes = new NodeSet(); Node startNode = nl2.item(0); if (!ns1.contains(startNode)) return trailNodes; // empty NodeSet for (int i = 0; i < nl1.getLength(); i++) { Node testNode = nl1.item(i); if (DOMHelper.isNodeAfter(startNode, testNode) && !DOMHelper.isNodeTheSame(startNode, testNode)) trailNodes.addElement(testNode); } return trailNodes; } /** * The set:intersection function returns a node set comprising the nodes that are within * both the node sets passed as arguments to it. * * @param nl1 NodeList for first node-set. * @param nl2 NodeList for second node-set. * @return a NodeList containing the nodes in nl1 that are also * in nl2. * * @see EXSLT */ public static NodeList intersection(NodeList nl1, NodeList nl2) { NodeSet ns1 = new NodeSet(nl1); NodeSet ns2 = new NodeSet(nl2); NodeSet inter = new NodeSet(); inter.setShouldCacheNodes(true); for (int i = 0; i < ns1.getLength(); i++) { Node n = ns1.elementAt(i); if (ns2.contains(n)) inter.addElement(n); } return inter; } /** * The set:difference function returns the difference between two node sets - those nodes that * are in the node set passed as the first argument that are not in the node set passed as the * second argument. * * @param nl1 NodeList for first node-set. * @param nl2 NodeList for second node-set. * @return a NodeList containing the nodes in nl1 that are not in nl2. * * @see EXSLT */ public static NodeList difference(NodeList nl1, NodeList nl2) { NodeSet ns1 = new NodeSet(nl1); NodeSet ns2 = new NodeSet(nl2); NodeSet diff = new NodeSet(); diff.setShouldCacheNodes(true); for (int i = 0; i < ns1.getLength(); i++) { Node n = ns1.elementAt(i); if (!ns2.contains(n)) diff.addElement(n); } return diff; } /** * The set:distinct function returns a subset of the nodes contained in the node-set NS passed * as the first argument. Specifically, it selects a node N if there is no node in NS that has * the same string value as N, and that precedes N in document order. * * @param nl NodeList for the node-set. * @return a NodeList with nodes from nl containing distinct string values. * In other words, if more than one node in nl contains the same string value, * only include the first such node found. * * @see EXSLT */ public static NodeList distinct(NodeList nl) { NodeSet dist = new NodeSet(); dist.setShouldCacheNodes(true); Map stringTable = new HashMap(); for (int i = 0; i < nl.getLength(); i++) { Node currNode = nl.item(i); String key = toString(currNode); if (key == null) dist.addElement(currNode); else if (!stringTable.containsKey(key)) { stringTable.put(key, currNode); dist.addElement(currNode); } } return dist; } /** * The set:has-same-node function returns true if the node set passed as the first argument shares * any nodes with the node set passed as the second argument. If there are no nodes that are in both * node sets, then it returns false. * * The Xalan extensions MethodResolver converts 'has-same-node' to 'hasSameNode'. * * Note: Not to be confused with hasSameNodes in the Xalan namespace, which returns true if * the two node sets contain the exactly the same nodes (perhaps in a different order), * otherwise false. * * @see EXSLT */ public static boolean hasSameNode(NodeList nl1, NodeList nl2) { NodeSet ns1 = new NodeSet(nl1); NodeSet ns2 = new NodeSet(nl2); for (int i = 0; i < ns1.getLength(); i++) { if (ns2.contains(ns1.elementAt(i))) return true; } return false; } } libxalan2-java-2.7.1/src/org/apache/xalan/lib/ExsltDynamic.java0000644000175000017500000006027510721374032023230 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExsltDynamic.java 468639 2006-10-28 06:52:33Z minchau $ */ package org.apache.xalan.lib; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.TransformerException; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xpath.NodeSet; import org.apache.xpath.NodeSetDTM; import org.apache.xpath.XPath; import org.apache.xpath.XPathContext; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.SAXNotSupportedException; /** * This class contains EXSLT dynamic extension functions. * * It is accessed by specifying a namespace URI as follows: *
         *    xmlns:dyn="http://exslt.org/dynamic"
         * 
        * The documentation for each function has been copied from the relevant * EXSLT Implementer page. * * @see EXSLT * @xsl.usage general */ public class ExsltDynamic extends ExsltBase { public static final String EXSL_URI = "http://exslt.org/common"; /** * The dyn:max function calculates the maximum value for the nodes passed as * the first argument, where the value of each node is calculated dynamically * using an XPath expression passed as a string as the second argument. *

        * The expressions are evaluated relative to the nodes passed as the first argument. * In other words, the value for each node is calculated by evaluating the XPath * expression with all context information being the same as that for the call to * the dyn:max function itself, except for the following: *

        *

          *
        • the context node is the node whose value is being calculated.
        • *
        • the context position is the position of the node within the node set passed as * the first argument to the dyn:max function, arranged in document order.
        • *
        • the context size is the number of nodes passed as the first argument to the * dyn:max function.
        • *
        *

        * The dyn:max function returns the maximum of these values, calculated in exactly * the same way as for math:max. *

        * If the expression string passed as the second argument is an invalid XPath * expression (including an empty string), this function returns NaN. *

        * This function must take a second argument. To calculate the maximum of a set of * nodes based on their string values, you should use the math:max function. * * @param myContext The ExpressionContext passed by the extension processor * @param nl The node set * @param expr The expression string * * @return The maximum evaluation value */ public static double max(ExpressionContext myContext, NodeList nl, String expr) throws SAXNotSupportedException { XPathContext xctxt = null; if (myContext instanceof XPathContext.XPathExpressionContext) xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); if (expr == null || expr.length() == 0) return Double.NaN; NodeSetDTM contextNodes = new NodeSetDTM(nl, xctxt); xctxt.pushContextNodeList(contextNodes); double maxValue = - Double.MAX_VALUE; for (int i = 0; i < contextNodes.getLength(); i++) { int contextNode = contextNodes.item(i); xctxt.pushCurrentNode(contextNode); double result = 0; try { XPath dynamicXPath = new XPath(expr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num(); } catch (TransformerException e) { xctxt.popCurrentNode(); xctxt.popContextNodeList(); return Double.NaN; } xctxt.popCurrentNode(); if (result > maxValue) maxValue = result; } xctxt.popContextNodeList(); return maxValue; } /** * The dyn:min function calculates the minimum value for the nodes passed as the * first argument, where the value of each node is calculated dynamically using * an XPath expression passed as a string as the second argument. *

        * The expressions are evaluated relative to the nodes passed as the first argument. * In other words, the value for each node is calculated by evaluating the XPath * expression with all context information being the same as that for the call to * the dyn:min function itself, except for the following: *

        *

          *
        • the context node is the node whose value is being calculated.
        • *
        • the context position is the position of the node within the node set passed * as the first argument to the dyn:min function, arranged in document order.
        • *
        • the context size is the number of nodes passed as the first argument to the * dyn:min function.
        • *
        *

        * The dyn:min function returns the minimum of these values, calculated in exactly * the same way as for math:min. *

        * If the expression string passed as the second argument is an invalid XPath expression * (including an empty string), this function returns NaN. *

        * This function must take a second argument. To calculate the minimum of a set of * nodes based on their string values, you should use the math:min function. * * @param myContext The ExpressionContext passed by the extension processor * @param nl The node set * @param expr The expression string * * @return The minimum evaluation value */ public static double min(ExpressionContext myContext, NodeList nl, String expr) throws SAXNotSupportedException { XPathContext xctxt = null; if (myContext instanceof XPathContext.XPathExpressionContext) xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); if (expr == null || expr.length() == 0) return Double.NaN; NodeSetDTM contextNodes = new NodeSetDTM(nl, xctxt); xctxt.pushContextNodeList(contextNodes); double minValue = Double.MAX_VALUE; for (int i = 0; i < nl.getLength(); i++) { int contextNode = contextNodes.item(i); xctxt.pushCurrentNode(contextNode); double result = 0; try { XPath dynamicXPath = new XPath(expr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num(); } catch (TransformerException e) { xctxt.popCurrentNode(); xctxt.popContextNodeList(); return Double.NaN; } xctxt.popCurrentNode(); if (result < minValue) minValue = result; } xctxt.popContextNodeList(); return minValue; } /** * The dyn:sum function calculates the sum for the nodes passed as the first argument, * where the value of each node is calculated dynamically using an XPath expression * passed as a string as the second argument. *

        * The expressions are evaluated relative to the nodes passed as the first argument. * In other words, the value for each node is calculated by evaluating the XPath * expression with all context information being the same as that for the call to * the dyn:sum function itself, except for the following: *

        *

          *
        • the context node is the node whose value is being calculated.
        • *
        • the context position is the position of the node within the node set passed as * the first argument to the dyn:sum function, arranged in document order.
        • *
        • the context size is the number of nodes passed as the first argument to the * dyn:sum function.
        • *
        *

        * The dyn:sum function returns the sumimum of these values, calculated in exactly * the same way as for sum. *

        * If the expression string passed as the second argument is an invalid XPath * expression (including an empty string), this function returns NaN. *

        * This function must take a second argument. To calculate the sumimum of a set of * nodes based on their string values, you should use the sum function. * * @param myContext The ExpressionContext passed by the extension processor * @param nl The node set * @param expr The expression string * * @return The sum of the evaluation value on each node */ public static double sum(ExpressionContext myContext, NodeList nl, String expr) throws SAXNotSupportedException { XPathContext xctxt = null; if (myContext instanceof XPathContext.XPathExpressionContext) xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); if (expr == null || expr.length() == 0) return Double.NaN; NodeSetDTM contextNodes = new NodeSetDTM(nl, xctxt); xctxt.pushContextNodeList(contextNodes); double sum = 0; for (int i = 0; i < nl.getLength(); i++) { int contextNode = contextNodes.item(i); xctxt.pushCurrentNode(contextNode); double result = 0; try { XPath dynamicXPath = new XPath(expr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num(); } catch (TransformerException e) { xctxt.popCurrentNode(); xctxt.popContextNodeList(); return Double.NaN; } xctxt.popCurrentNode(); sum = sum + result; } xctxt.popContextNodeList(); return sum; } /** * The dyn:map function evaluates the expression passed as the second argument for * each of the nodes passed as the first argument, and returns a node set of those values. *

        * The expressions are evaluated relative to the nodes passed as the first argument. * In other words, the value for each node is calculated by evaluating the XPath * expression with all context information being the same as that for the call to * the dyn:map function itself, except for the following: *

        *

          *
        • The context node is the node whose value is being calculated.
        • *
        • the context position is the position of the node within the node set passed * as the first argument to the dyn:map function, arranged in document order.
        • *
        • the context size is the number of nodes passed as the first argument to the * dyn:map function.
        • *
        *

        * If the expression string passed as the second argument is an invalid XPath * expression (including an empty string), this function returns an empty node set. *

        * If the XPath expression evaluates as a node set, the dyn:map function returns * the union of the node sets returned by evaluating the expression for each of the * nodes in the first argument. Note that this may mean that the node set resulting * from the call to the dyn:map function contains a different number of nodes from * the number in the node set passed as the first argument to the function. *

        * If the XPath expression evaluates as a number, the dyn:map function returns a * node set containing one exsl:number element (namespace http://exslt.org/common) * for each node in the node set passed as the first argument to the dyn:map function, * in document order. The string value of each exsl:number element is the same as * the result of converting the number resulting from evaluating the expression to * a string as with the number function, with the exception that Infinity results * in an exsl:number holding the highest number the implementation can store, and * -Infinity results in an exsl:number holding the lowest number the implementation * can store. *

        * If the XPath expression evaluates as a boolean, the dyn:map function returns a * node set containing one exsl:boolean element (namespace http://exslt.org/common) * for each node in the node set passed as the first argument to the dyn:map function, * in document order. The string value of each exsl:boolean element is 'true' if the * expression evaluates as true for the node, and '' if the expression evaluates as * false. *

        * Otherwise, the dyn:map function returns a node set containing one exsl:string * element (namespace http://exslt.org/common) for each node in the node set passed * as the first argument to the dyn:map function, in document order. The string * value of each exsl:string element is the same as the result of converting the * result of evaluating the expression for the relevant node to a string as with * the string function. * * @param myContext The ExpressionContext passed by the extension processor * @param nl The node set * @param expr The expression string * * @return The node set after evaluation */ public static NodeList map(ExpressionContext myContext, NodeList nl, String expr) throws SAXNotSupportedException { XPathContext xctxt = null; Document lDoc = null; if (myContext instanceof XPathContext.XPathExpressionContext) xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); if (expr == null || expr.length() == 0) return new NodeSet(); NodeSetDTM contextNodes = new NodeSetDTM(nl, xctxt); xctxt.pushContextNodeList(contextNodes); NodeSet resultSet = new NodeSet(); resultSet.setShouldCacheNodes(true); for (int i = 0; i < nl.getLength(); i++) { int contextNode = contextNodes.item(i); xctxt.pushCurrentNode(contextNode); XObject object = null; try { XPath dynamicXPath = new XPath(expr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); object = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()); if (object instanceof XNodeSet) { NodeList nodelist = null; nodelist = ((XNodeSet)object).nodelist(); for (int k = 0; k < nodelist.getLength(); k++) { Node n = nodelist.item(k); if (!resultSet.contains(n)) resultSet.addNode(n); } } else { if (lDoc == null) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); lDoc = db.newDocument(); } Element element = null; if (object instanceof XNumber) element = lDoc.createElementNS(EXSL_URI, "exsl:number"); else if (object instanceof XBoolean) element = lDoc.createElementNS(EXSL_URI, "exsl:boolean"); else element = lDoc.createElementNS(EXSL_URI, "exsl:string"); Text textNode = lDoc.createTextNode(object.str()); element.appendChild(textNode); resultSet.addNode(element); } } catch (Exception e) { xctxt.popCurrentNode(); xctxt.popContextNodeList(); return new NodeSet(); } xctxt.popCurrentNode(); } xctxt.popContextNodeList(); return resultSet; } /** * The dyn:evaluate function evaluates a string as an XPath expression and returns * the resulting value, which might be a boolean, number, string, node set, result * tree fragment or external object. The sole argument is the string to be evaluated. *

        * If the expression string passed as the second argument is an invalid XPath * expression (including an empty string), this function returns an empty node set. *

        * You should only use this function if the expression must be constructed dynamically, * otherwise it is much more efficient to use the expression literally. * * @param myContext The ExpressionContext passed by the extension processor * @param xpathExpr The XPath expression string * * @return The evaluation result */ public static XObject evaluate(ExpressionContext myContext, String xpathExpr) throws SAXNotSupportedException { if (myContext instanceof XPathContext.XPathExpressionContext) { XPathContext xctxt = null; try { xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); XPath dynamicXPath = new XPath(xpathExpr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); return dynamicXPath.execute(xctxt, myContext.getContextNode(), xctxt.getNamespaceContext()); } catch (TransformerException e) { return new XNodeSet(xctxt.getDTMManager()); } } else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); //"Invalid context passed to evaluate " } /** * The dyn:closure function creates a node set resulting from transitive closure of * evaluating the expression passed as the second argument on each of the nodes passed * as the first argument, then on the node set resulting from that and so on until no * more nodes are found. For example: *

           *  dyn:closure(., '*')
           * 
        * returns all the descendant elements of the node (its element children, their * children, their children's children and so on). *

        * The expression is thus evaluated several times, each with a different node set * acting as the context of the expression. The first time the expression is * evaluated, the context node set is the first argument passed to the dyn:closure * function. In other words, the node set for each node is calculated by evaluating * the XPath expression with all context information being the same as that for * the call to the dyn:closure function itself, except for the following: *

        *

          *
        • the context node is the node whose value is being calculated.
        • *
        • the context position is the position of the node within the node set passed * as the first argument to the dyn:closure function, arranged in document order.
        • *
        • the context size is the number of nodes passed as the first argument to the * dyn:closure function.
        • *
        • the current node is the node whose value is being calculated.
        • *
        *

        * The result for a particular iteration is the union of the node sets resulting * from evaluting the expression for each of the nodes in the source node set for * that iteration. This result is then used as the source node set for the next * iteration, and so on. The result of the function as a whole is the union of * the node sets generated by each iteration. *

        * If the expression string passed as the second argument is an invalid XPath * expression (including an empty string) or an expression that does not return a * node set, this function returns an empty node set. * * @param myContext The ExpressionContext passed by the extension processor * @param nl The node set * @param expr The expression string * * @return The node set after evaluation */ public static NodeList closure(ExpressionContext myContext, NodeList nl, String expr) throws SAXNotSupportedException { XPathContext xctxt = null; if (myContext instanceof XPathContext.XPathExpressionContext) xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); if (expr == null || expr.length() == 0) return new NodeSet(); NodeSet closureSet = new NodeSet(); closureSet.setShouldCacheNodes(true); NodeList iterationList = nl; do { NodeSet iterationSet = new NodeSet(); NodeSetDTM contextNodes = new NodeSetDTM(iterationList, xctxt); xctxt.pushContextNodeList(contextNodes); for (int i = 0; i < iterationList.getLength(); i++) { int contextNode = contextNodes.item(i); xctxt.pushCurrentNode(contextNode); XObject object = null; try { XPath dynamicXPath = new XPath(expr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); object = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()); if (object instanceof XNodeSet) { NodeList nodelist = null; nodelist = ((XNodeSet)object).nodelist(); for (int k = 0; k < nodelist.getLength(); k++) { Node n = nodelist.item(k); if (!iterationSet.contains(n)) iterationSet.addNode(n); } } else { xctxt.popCurrentNode(); xctxt.popContextNodeList(); return new NodeSet(); } } catch (TransformerException e) { xctxt.popCurrentNode(); xctxt.popContextNodeList(); return new NodeSet(); } xctxt.popCurrentNode(); } xctxt.popContextNodeList(); iterationList = iterationSet; for (int i = 0; i < iterationList.getLength(); i++) { Node n = iterationList.item(i); if (!closureSet.contains(n)) closureSet.addNode(n); } } while(iterationList.getLength() > 0); return closureSet; } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/0000755000175000017500000000000010736146354020311 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/trace/TraceListenerEx.java0000644000175000017500000000256610721374031024213 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TraceListenerEx.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; /** * Extends TraceListener but adds a SelectEnd event. * @xsl.usage advanced */ public interface TraceListenerEx extends TraceListener { /** * Method that is called after an xsl:apply-templates or xsl:for-each * selection occurs. * * @param ev the generate event. * * @throws javax.xml.transform.TransformerException */ public void selectEnd(EndSelectionEvent ev) throws javax.xml.transform.TransformerException; } libxalan2-java-2.7.1/src/org/apache/xalan/trace/SelectionEvent.java0000644000175000017500000000543310721374031024075 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SelectionEvent.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPath; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; /** * Event triggered by selection of a node in the style stree. * @xsl.usage advanced */ public class SelectionEvent implements java.util.EventListener { /** * The node in the style tree where the event occurs. */ public final ElemTemplateElement m_styleNode; /** * The XSLT processor instance. */ public final TransformerImpl m_processor; /** * The current context node. */ public final Node m_sourceNode; /** * The attribute name from which the selection is made. */ public final String m_attributeName; /** * The XPath that executed the selection. */ public final XPath m_xpath; /** * The result of the selection. */ public final XObject m_selection; /** * Create an event originating at the given node of the style tree. * * @param processor The XSLT TransformerFactory. * @param sourceNode The current context node. * @param styleNode node in the style tree reference for the event. * Should not be null. That is not enforced. * @param attributeName The attribute name from which the selection is made. * @param xpath The XPath that executed the selection. * @param selection The result of the selection. */ public SelectionEvent(TransformerImpl processor, Node sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection) { this.m_processor = processor; this.m_sourceNode = sourceNode; this.m_styleNode = styleNode; this.m_attributeName = attributeName; this.m_xpath = xpath; this.m_selection = selection; } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/TraceManager.java0000644000175000017500000002652010721374032023500 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TraceManager.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import java.lang.reflect.Method; import java.util.TooManyListenersException; import java.util.Vector; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPath; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; /** * This class manages trace listeners, and acts as an * interface for the tracing functionality in Xalan. */ public class TraceManager { /** A transformer instance */ private TransformerImpl m_transformer; /** * Constructor for the trace manager. * * @param transformer a non-null instance of a transformer */ public TraceManager(TransformerImpl transformer) { m_transformer = transformer; } /** * List of listeners who are interested in tracing what's * being generated. */ private Vector m_traceListeners = null; /** * Add a trace listener for the purposes of debugging and diagnosis. * @param tl Trace listener to be added. * * @throws TooManyListenersException */ public void addTraceListener(TraceListener tl) throws TooManyListenersException { m_transformer.setDebug(true); if (null == m_traceListeners) m_traceListeners = new Vector(); m_traceListeners.addElement(tl); } /** * Remove a trace listener. * @param tl Trace listener to be removed. */ public void removeTraceListener(TraceListener tl) { if (null != m_traceListeners) { m_traceListeners.removeElement(tl); // The following line added to fix the bug#5140: hasTraceListeners() returns true // after adding and removing a listener. // Check: if m_traceListeners is empty, then set it to NULL. if (0 == m_traceListeners.size()) m_traceListeners = null; } } /** * Fire a generate event. * * @param te Generate Event to fire */ public void fireGenerateEvent(GenerateEvent te) { if (null != m_traceListeners) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); tl.generated(te); } } } /** * Tell if trace listeners are present. * * @return True if there are trace listeners */ public boolean hasTraceListeners() { return (null != m_traceListeners); } /** * Fire a trace event. * * @param styleNode Stylesheet template node */ public void fireTraceEvent(ElemTemplateElement styleNode) { if (hasTraceListeners()) { int sourceNode = m_transformer.getXPathContext().getCurrentNode(); Node source = getDOMNodeFromDTM(sourceNode); fireTraceEvent(new TracerEvent(m_transformer, source, m_transformer.getMode(), /*sourceNode, mode,*/ styleNode)); } } /** * Fire a end trace event, after all children of an element have been * executed. * * @param styleNode Stylesheet template node */ public void fireTraceEndEvent(ElemTemplateElement styleNode) { if (hasTraceListeners()) { int sourceNode = m_transformer.getXPathContext().getCurrentNode(); Node source = getDOMNodeFromDTM(sourceNode); fireTraceEndEvent(new TracerEvent(m_transformer, source, m_transformer.getMode(), /*sourceNode, mode,*/ styleNode)); } } /** * Fire a trace event. * * @param te Trace event to fire */ public void fireTraceEndEvent(TracerEvent te) { if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); if(tl instanceof TraceListenerEx2) { ((TraceListenerEx2)tl).traceEnd(te); } } } } /** * Fire a trace event. * * @param te Trace event to fire */ public void fireTraceEvent(TracerEvent te) { if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); tl.trace(te); } } } /** * Fire a selection event. * * @param sourceNode Current source node * @param styleNode node in the style tree reference for the event. * @param attributeName The attribute name from which the selection is made. * @param xpath The XPath that executed the selection. * @param selection The result of the selection. * * @throws javax.xml.transform.TransformerException */ public void fireSelectedEvent( int sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection) throws javax.xml.transform.TransformerException { if (hasTraceListeners()) { Node source = getDOMNodeFromDTM(sourceNode); fireSelectedEvent(new SelectionEvent(m_transformer, source, styleNode, attributeName, xpath, selection)); } } /** * Fire a selection event. * * @param sourceNode Current source node * @param styleNode node in the style tree reference for the event. * @param attributeName The attribute name from which the selection is made. * @param xpath The XPath that executed the selection. * @param selection The result of the selection. * * @throws javax.xml.transform.TransformerException */ public void fireSelectedEndEvent( int sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection) throws javax.xml.transform.TransformerException { if (hasTraceListeners()) { Node source = getDOMNodeFromDTM(sourceNode); fireSelectedEndEvent(new EndSelectionEvent(m_transformer, source, styleNode, attributeName, xpath, selection)); } } /** * Fire a selection event. * * @param se Selection event to fire * * @throws javax.xml.transform.TransformerException */ public void fireSelectedEndEvent(EndSelectionEvent se) throws javax.xml.transform.TransformerException { if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); if(tl instanceof TraceListenerEx) ((TraceListenerEx)tl).selectEnd(se); } } } /** * Fire a selection event. * * @param se Selection event to fire * * @throws javax.xml.transform.TransformerException */ public void fireSelectedEvent(SelectionEvent se) throws javax.xml.transform.TransformerException { if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); tl.selected(se); } } } /** * Fire an end extension event. * * @see java.lang.reflect.Method#invoke * * @param method The java method about to be executed * @param instance The instance the method will be executed on * @param arguments Parameters passed to the method. */ public void fireExtensionEndEvent(Method method, Object instance, Object[] arguments) { ExtensionEvent ee = new ExtensionEvent(m_transformer, method, instance, arguments); if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); if(tl instanceof TraceListenerEx3) { ((TraceListenerEx3)tl).extensionEnd(ee); } } } } /** * Fire an end extension event. * * @see java.lang.reflect.Method#invoke * * @param method The java method about to be executed * @param instance The instance the method will be executed on * @param arguments Parameters passed to the method. */ public void fireExtensionEvent(Method method, Object instance, Object[] arguments) { ExtensionEvent ee = new ExtensionEvent(m_transformer, method, instance, arguments); if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); if(tl instanceof TraceListenerEx3) { ((TraceListenerEx3)tl).extension(ee); } } } } /** * Fire an end extension event. * * @see java.lang.reflect.Method#invoke * * @param ee the ExtensionEvent to fire */ public void fireExtensionEndEvent(ExtensionEvent ee) { if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); if(tl instanceof TraceListenerEx3) { ((TraceListenerEx3)tl).extensionEnd(ee); } } } } /** * Fire an end extension event. * * @see java.lang.reflect.Method#invoke * * @param ee the ExtensionEvent to fire */ public void fireExtensionEvent(ExtensionEvent ee) { if (hasTraceListeners()) { int nListeners = m_traceListeners.size(); for (int i = 0; i < nListeners; i++) { TraceListener tl = (TraceListener) m_traceListeners.elementAt(i); if(tl instanceof TraceListenerEx3) { ((TraceListenerEx3)tl).extension(ee); } } } } /** * Get the DOM Node of the current XPath context, which is possibly null. * @param sourceNode the handle on the node used by a DTM. */ private Node getDOMNodeFromDTM(int sourceNode) { org.apache.xml.dtm.DTM dtm = m_transformer.getXPathContext().getDTM(sourceNode); final Node source = (dtm == null) ? null : dtm.getNode(sourceNode); return source; } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/TraceListenerEx2.java0000644000175000017500000000245310721374033024272 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TraceListenerEx2.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; /** * Extends TraceListenerEx but adds a EndTrace event. * @xsl.usage advanced */ public interface TraceListenerEx2 extends TraceListenerEx { /** * Method that is called when the end of a trace event occurs. * The method is blocking. It must return before processing continues. * * @param ev the trace event. */ public void traceEnd(TracerEvent ev); } libxalan2-java-2.7.1/src/org/apache/xalan/trace/TraceListenerEx3.java0000644000175000017500000000305510721374030024267 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TraceListenerEx3.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; /** * Extends TraceListenerEx2 but adds extensions trace events. * @xsl.usage advanced */ public interface TraceListenerEx3 extends TraceListenerEx2 { /** * Method that is called when an extension event occurs. * The method is blocking. It must return before processing continues. * * @param ee the extension event. */ public void extension(ExtensionEvent ee); /** * Method that is called when the end of an extension event occurs. * The method is blocking. It must return before processing continues. * * @param ee the extension event. */ public void extensionEnd(ExtensionEvent ee); } libxalan2-java-2.7.1/src/org/apache/xalan/trace/GenerateEvent.java0000644000175000017500000001140410721374033023677 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: GenerateEvent.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import org.apache.xalan.transformer.TransformerImpl; import org.xml.sax.Attributes; /** * Event generated by the XSL processor after it generates a new node in the result tree. * This event responds to and is modeled on the SAX events that are sent to the * formatter listener FormatterToXXX)classes. * * @see org.apache.xml.utils.DOMBuilder * @see org.apache.xml.serializer.ToHTMLStream * @see org.apache.xml.serializer.ToTextStream * @see org.apache.xml.serializer.ToXMLStream * * @xsl.usage advanced */ public class GenerateEvent implements java.util.EventListener { /** * The XSLT Transformer, which either directly or indirectly contains most needed information. * * @see org.apache.xalan.transformer.TransformerImpl */ public TransformerImpl m_processor; /** * The type of SAX event that was generated, as enumerated in the EVENTTYPE_XXX constants below. */ public int m_eventtype; /** * Character data from a character or cdata event. */ public char m_characters[]; /** * The start position of the current data in m_characters. */ public int m_start; /** * The length of the current data in m_characters. */ public int m_length; /** * The name of the element or PI. */ public String m_name; /** * The string data in the element (comments and PIs). */ public String m_data; /** * The current attribute list. */ public Attributes m_atts; /** * Constructor for startDocument, endDocument events. * * @param processor The XSLT TransformerFactory instance. * @param eventType One of the EVENTTYPE_XXX constants. */ public GenerateEvent(TransformerImpl processor, int eventType) { m_processor = processor; m_eventtype = eventType; } /** * Constructor for startElement, endElement events. * * @param processor The XSLT TransformerFactory Instance. * @param eventType One of the EVENTTYPE_XXX constants. * @param name The name of the element. * @param atts The SAX attribute list. */ public GenerateEvent(TransformerImpl processor, int eventType, String name, Attributes atts) { m_name = name; m_atts = atts; m_processor = processor; m_eventtype = eventType; } /** * Constructor for characters, cdate events. * * @param processor The XSLT TransformerFactory instance. * @param eventType One of the EVENTTYPE_XXX constants. * @param ch The char array from the SAX event. * @param start The start offset to be used in the char array. * @param length The end offset to be used in the chara array. */ public GenerateEvent(TransformerImpl processor, int eventType, char ch[], int start, int length) { m_characters = ch; m_start = start; m_length = length; m_processor = processor; m_eventtype = eventType; } /** * Constructor for processingInstruction events. * * @param processor The instance of the XSLT processor. * @param eventType One of the EVENTTYPE_XXX constants. * @param name The name of the processing instruction. * @param data The processing instruction data. */ public GenerateEvent(TransformerImpl processor, int eventType, String name, String data) { m_name = name; m_data = data; m_processor = processor; m_eventtype = eventType; } /** * Constructor for comment and entity ref events. * * @param processor The XSLT processor instance. * @param eventType One of the EVENTTYPE_XXX constants. * @param data The comment or entity ref data. */ public GenerateEvent(TransformerImpl processor, int eventType, String data) { m_data = data; m_processor = processor; m_eventtype = eventType; } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/ExtensionEvent.java0000644000175000017500000000421110721374031024115 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionEvent.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.apache.xalan.transformer.TransformerImpl; /** * An event representing an extension call. */ public class ExtensionEvent { public static final int DEFAULT_CONSTRUCTOR = 0; public static final int METHOD = 1; public static final int CONSTRUCTOR = 2; public final int m_callType; public final TransformerImpl m_transformer; public final Object m_method; public final Object m_instance; public final Object[] m_arguments; public ExtensionEvent(TransformerImpl transformer, Method method, Object instance, Object[] arguments) { m_transformer = transformer; m_method = method; m_instance = instance; m_arguments = arguments; m_callType = METHOD; } public ExtensionEvent(TransformerImpl transformer, Constructor constructor, Object[] arguments) { m_transformer = transformer; m_instance = null; m_arguments = arguments; m_method = constructor; m_callType = CONSTRUCTOR; } public ExtensionEvent(TransformerImpl transformer, Class clazz) { m_transformer = transformer; m_instance = null; m_arguments = null; m_method = clazz; m_callType = DEFAULT_CONSTRUCTOR; } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/TraceListener.java0000644000175000017500000000404110721374030023703 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TraceListener.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; /** * Interface the XSL processor calls when it matches a source node, selects a set of source nodes, * or generates a result node. * If you want an object instance to be called when a trace event occurs, use the TransformerImpl setTraceListener method. * @see org.apache.xalan.trace.TracerEvent * @see org.apache.xalan.trace.TraceManager#addTraceListener * @xsl.usage advanced */ public interface TraceListener extends java.util.EventListener { /** * Method that is called when a trace event occurs. * The method is blocking. It must return before processing continues. * * @param ev the trace event. */ public void trace(TracerEvent ev); /** * Method that is called just after the formatter listener is called. * * @param ev the generate event. * * @throws javax.xml.transform.TransformerException */ public void selected(SelectionEvent ev) throws javax.xml.transform.TransformerException; /** * Method that is called just after the formatter listener is called. * * @param ev the generate event. */ public void generated(GenerateEvent ev); } libxalan2-java-2.7.1/src/org/apache/xalan/trace/EndSelectionEvent.java0000644000175000017500000000410310721374030024514 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EndSelectionEvent.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.XPath; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; /** * Event triggered by completion of a xsl:for-each selection or a * xsl:apply-templates selection. * @xsl.usage advanced */ public class EndSelectionEvent extends SelectionEvent { /** * Create an EndSelectionEvent. * * @param processor The XSLT TransformerFactory. * @param sourceNode The current context node. * @param styleNode node in the style tree reference for the event. * Should not be null. That is not enforced. * @param attributeName The attribute name from which the selection is made. * @param xpath The XPath that executed the selection. * @param selection The result of the selection. */ public EndSelectionEvent(TransformerImpl processor, Node sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection) { super(processor, sourceNode, styleNode, attributeName, xpath, selection); } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/TracerEvent.java0000644000175000017500000001011210721374033023360 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TracerEvent.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Parent class of events generated for tracing the * progress of the XSL processor. * @xsl.usage advanced */ public class TracerEvent implements java.util.EventListener { /** * The node in the style tree where the event occurs. */ public final ElemTemplateElement m_styleNode; /** * The XSLT processor instance. */ public final TransformerImpl m_processor; /** * The current context node. */ public final Node m_sourceNode; /** * The current mode. */ public final QName m_mode; /** * Create an event originating at the given node of the style tree. * @param processor The XSLT TransformerFactory. * @param sourceNode The current context node. * @param mode The current mode. * @param styleNode The stylesheet element that is executing. */ public TracerEvent(TransformerImpl processor, Node sourceNode, QName mode, ElemTemplateElement styleNode) { this.m_processor = processor; this.m_sourceNode = sourceNode; this.m_mode = mode; this.m_styleNode = styleNode; } /** * Returns a string representation of the node. * The string returned for elements will contain the element name * and any attributes enclosed in angle brackets. * The string returned for attributes will be of form, "name=value." * * @param n any DOM node. Must not be null. * * @return a string representation of the given node. */ public static String printNode(Node n) { String r = n.hashCode() + " "; if (n instanceof Element) { r += "<" + n.getNodeName(); Node c = n.getFirstChild(); while (null != c) { if (c instanceof Attr) { r += printNode(c) + " "; } c = c.getNextSibling(); } r += ">"; } else { if (n instanceof Attr) { r += n.getNodeName() + "=" + n.getNodeValue(); } else { r += n.getNodeName(); } } return r; } /** * Returns a string representation of the node list. * The string will contain the list of nodes inside square braces. * Elements will contain the element name * and any attributes enclosed in angle brackets. * Attributes will be of form, "name=value." * * @param l any DOM node list. Must not be null. * * @return a string representation of the given node list. */ public static String printNodeList(NodeList l) { String r = l.hashCode() + "["; int len = l.getLength() - 1; int i = 0; while (i < len) { Node n = l.item(i); if (null != n) { r += printNode(n) + ", "; } ++i; } if (i == len) { Node n = l.item(len); if (null != n) { r += printNode(n); } } return r + "]"; } } libxalan2-java-2.7.1/src/org/apache/xalan/trace/package.html0000644000175000017500000000203410721374030022555 0ustar mkochmkoch Xalan Trace (debugger) Package.

        Implementation of Xalan Trace events, for use by a debugger.

        libxalan2-java-2.7.1/src/org/apache/xalan/trace/PrintTraceListener.java0000644000175000017500000003107310721374030024725 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PrintTraceListener.java 468644 2006-10-28 06:56:42Z minchau $ */ package org.apache.xalan.trace; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import javax.xml.transform.SourceLocator; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemTextLiteral; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.ref.DTMNodeProxy; import org.apache.xml.serializer.SerializerTrace; import org.w3c.dom.Node; /** * Implementation of the TraceListener interface that * prints each event to standard out as it occurs. * * @see org.apache.xalan.trace.TracerEvent * @xsl.usage advanced */ public class PrintTraceListener implements TraceListenerEx3 { /** * Construct a trace listener. * * @param pw PrintWriter to use for tracing events */ public PrintTraceListener(java.io.PrintWriter pw) { m_pw = pw; } /** * The print writer where the events should be written. */ java.io.PrintWriter m_pw; /** * This needs to be set to true if the listener is to print an event whenever a template is invoked. */ public boolean m_traceTemplates = false; /** * Set to true if the listener is to print events that occur as each node is 'executed' in the stylesheet. */ public boolean m_traceElements = false; /** * Set to true if the listener is to print information after each result-tree generation event. */ public boolean m_traceGeneration = false; /** * Set to true if the listener is to print information after each selection event. */ public boolean m_traceSelection = false; /** * Set to true if the listener is to print information after each extension event. */ public boolean m_traceExtension = false; /** * Print information about a TracerEvent. * * @param ev the trace event. */ public void _trace(TracerEvent ev) { switch (ev.m_styleNode.getXSLToken()) { case Constants.ELEMNAME_TEXTLITERALRESULT : if (m_traceElements) { m_pw.print(ev.m_styleNode.getSystemId()+ " Line #" + ev.m_styleNode.getLineNumber() + ", " + "Column #" + ev.m_styleNode.getColumnNumber() + " -- " + ev.m_styleNode.getNodeName() + ": "); ElemTextLiteral etl = (ElemTextLiteral) ev.m_styleNode; String chars = new String(etl.getChars(), 0, etl.getChars().length); m_pw.println(" " + chars.trim()); } break; case Constants.ELEMNAME_TEMPLATE : if (m_traceTemplates || m_traceElements) { ElemTemplate et = (ElemTemplate) ev.m_styleNode; m_pw.print(et.getSystemId()+ " Line #" + et.getLineNumber() + ", " + "Column #" + et.getColumnNumber() + ": " + et.getNodeName() + " "); if (null != et.getMatch()) { m_pw.print("match='" + et.getMatch().getPatternString() + "' "); } if (null != et.getName()) { m_pw.print("name='" + et.getName() + "' "); } m_pw.println(); } break; default : if (m_traceElements) { m_pw.println(ev.m_styleNode.getSystemId()+ " Line #" + ev.m_styleNode.getLineNumber() + ", " + "Column #" + ev.m_styleNode.getColumnNumber() + ": " + ev.m_styleNode.getNodeName()); } } } int m_indent = 0; /** * Print information about a TracerEvent. * * @param ev the trace event. */ public void trace(TracerEvent ev) { // m_traceElements = true; // m_traceTemplates = true; // // for(int i = 0; i < m_indent; i++) // m_pw.print(" "); // m_indent = m_indent+2; // m_pw.print("trace: "); _trace(ev); } /** * Method that is called when the end of a trace event occurs. * The method is blocking. It must return before processing continues. * * @param ev the trace event. */ public void traceEnd(TracerEvent ev) { // m_traceElements = true; // m_traceTemplates = true; // // m_indent = m_indent-2; // for(int i = 0; i < m_indent; i++) // m_pw.print(" "); // m_pw.print("etrac: "); // _trace(ev); } /** * Method that is called just after a select attribute has been evaluated. * * @param ev the generate event. * * @throws javax.xml.transform.TransformerException */ public void selected(SelectionEvent ev) throws javax.xml.transform.TransformerException { if (m_traceSelection) { ElemTemplateElement ete = (ElemTemplateElement) ev.m_styleNode; Node sourceNode = ev.m_sourceNode; SourceLocator locator = null; if (sourceNode instanceof DTMNodeProxy) { int nodeHandler = ((DTMNodeProxy) sourceNode).getDTMNodeNumber(); locator = ((DTMNodeProxy) sourceNode).getDTM().getSourceLocatorFor( nodeHandler); } if (locator != null) m_pw.println( "Selected source node '" + sourceNode.getNodeName() + "', at " + locator); else m_pw.println( "Selected source node '" + sourceNode.getNodeName() + "'"); if (ev.m_styleNode.getLineNumber() == 0) { // You may not have line numbers if the selection is occuring from a // default template. ElemTemplateElement parent = (ElemTemplateElement) ete.getParentElem(); if (parent == ete.getStylesheetRoot().getDefaultRootRule()) { m_pw.print("(default root rule) "); } else if ( parent == ete.getStylesheetRoot().getDefaultTextRule()) { m_pw.print("(default text rule) "); } else if (parent == ete.getStylesheetRoot().getDefaultRule()) { m_pw.print("(default rule) "); } m_pw.print( ete.getNodeName() + ", " + ev.m_attributeName + "='" + ev.m_xpath.getPatternString() + "': "); } else { m_pw.print( ev.m_styleNode.getSystemId() + " Line #" + ev.m_styleNode.getLineNumber() + ", " + "Column #" + ev.m_styleNode.getColumnNumber() + ": " + ete.getNodeName() + ", " + ev.m_attributeName + "='" + ev.m_xpath.getPatternString() + "': "); } if (ev.m_selection.getType() == ev.m_selection.CLASS_NODESET) { m_pw.println(); org.apache.xml.dtm.DTMIterator nl = ev.m_selection.iter(); // The following lines are added to fix bug#16222. // The main cause is that the following loop change the state of iterator, which is shared // with the transformer. The fix is that we record the initial state before looping, then // restore the state when we finish it, which is done in the following lines added. int currentPos = DTM.NULL; currentPos = nl.getCurrentPos(); nl.setShouldCacheNodes(true); // This MUST be done before we clone the iterator! org.apache.xml.dtm.DTMIterator clone = null; // End of block try { clone = nl.cloneWithReset(); } catch (CloneNotSupportedException cnse) { m_pw.println( " [Can't trace nodelist because it it threw a CloneNotSupportedException]"); return; } int pos = clone.nextNode(); if (DTM.NULL == pos) { m_pw.println(" [empty node list]"); } else { while (DTM.NULL != pos) { // m_pw.println(" " + ev.m_processor.getXPathContext().getDTM(pos).getNode(pos)); DTM dtm = ev.m_processor.getXPathContext().getDTM(pos); m_pw.print(" "); m_pw.print(Integer.toHexString(pos)); m_pw.print(": "); m_pw.println(dtm.getNodeName(pos)); pos = clone.nextNode(); } } // Restore the initial state of the iterator, part of fix for bug#16222. nl.runTo(-1); nl.setCurrentPos(currentPos); // End of fix for bug#16222 } else { m_pw.println(ev.m_selection.str()); } } } /** * Method that is called after an xsl:apply-templates or xsl:for-each * selection occurs. * * @param ev the generate event. * * @throws javax.xml.transform.TransformerException */ public void selectEnd(EndSelectionEvent ev) throws javax.xml.transform.TransformerException { // Nothing for right now. } /** * Print information about a Generate event. * * @param ev the trace event. */ public void generated(GenerateEvent ev) { if (m_traceGeneration) { switch (ev.m_eventtype) { case SerializerTrace.EVENTTYPE_STARTDOCUMENT : m_pw.println("STARTDOCUMENT"); break; case SerializerTrace.EVENTTYPE_ENDDOCUMENT : m_pw.println("ENDDOCUMENT"); break; case SerializerTrace.EVENTTYPE_STARTELEMENT : m_pw.println("STARTELEMENT: " + ev.m_name); break; case SerializerTrace.EVENTTYPE_ENDELEMENT : m_pw.println("ENDELEMENT: " + ev.m_name); break; case SerializerTrace.EVENTTYPE_CHARACTERS : { String chars = new String(ev.m_characters, ev.m_start, ev.m_length); m_pw.println("CHARACTERS: " + chars); } break; case SerializerTrace.EVENTTYPE_CDATA : { String chars = new String(ev.m_characters, ev.m_start, ev.m_length); m_pw.println("CDATA: " + chars); } break; case SerializerTrace.EVENTTYPE_COMMENT : m_pw.println("COMMENT: " + ev.m_data); break; case SerializerTrace.EVENTTYPE_PI : m_pw.println("PI: " + ev.m_name + ", " + ev.m_data); break; case SerializerTrace.EVENTTYPE_ENTITYREF : m_pw.println("ENTITYREF: " + ev.m_name); break; case SerializerTrace.EVENTTYPE_IGNORABLEWHITESPACE : m_pw.println("IGNORABLEWHITESPACE"); break; } } } /** * Print information about an extension event. * * @param ev the extension event to print information about */ public void extension(ExtensionEvent ev) { if (m_traceExtension) { switch (ev.m_callType) { case ExtensionEvent.DEFAULT_CONSTRUCTOR: m_pw.println("EXTENSION: " + ((Class)ev.m_method).getName() + "#"); break; case ExtensionEvent.METHOD: m_pw.println("EXTENSION: " + ((Method)ev.m_method).getDeclaringClass().getName() + "#" + ((Method)ev.m_method).getName()); break; case ExtensionEvent.CONSTRUCTOR: m_pw.println("EXTENSION: " + ((Constructor)ev.m_method).getDeclaringClass().getName() + "#"); break; } } } /** * Print information about an extension event. * * @param ev the extension event to print information about */ public void extensionEnd(ExtensionEvent ev) { // do nothing } } libxalan2-java-2.7.1/src/org/apache/xalan/Version.src0000644000175000017500000001160710721374032021344 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xalan; /** * Administrative class to keep track of the version number of * the Xalan release. *

        This class implements the upcoming standard of having * org.apache.project-name.Version.getVersion() be a standard way * to get version information. This class will replace the older * org.apache.xalan.processor.Version class.

        *

        See also: org/apache/xalan/res/XSLTInfo.properties for * information about the version of the XSLT spec we support.

        * @xsl.usage general */ public class Version { /** * Get the basic version string for the current Xalan release. * Version String formatted like * "Xalan Java v.r[.dd| Dnn]". * * Futurework: have this read version info from jar manifest. * * @return String denoting our current version */ public static String getVersion() { return getProduct()+" "+getImplementationLanguage()+" " +getMajorVersionNum()+"."+getReleaseVersionNum()+"." +( (getDevelopmentVersionNum() > 0) ? ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum())); } /** * Print the processor version to the command line. * * @param argv command line arguments, unused. */ public static void main(String argv[]) { System.out.println(getVersion()); } /** * Name of product: Xalan. */ public static String getProduct() { return "Xalan"; } /** * Implementation Language: Java. */ public static String getImplementationLanguage() { return "Java"; } /** * Major version number. * Version number. This changes only when there is a * significant, externally apparent enhancement from * the previous release. 'n' represents the n'th * version. * * Clients should carefully consider the implications * of new versions as external interfaces and behaviour * may have changed. */ public static int getMajorVersionNum() { return @version.VERSION@; } /** * Release Number. * Release number. This changes when: * - a new set of functionality is to be added, eg, * implementation of a new W3C specification. * - API or behaviour change. * - its designated as a reference release. */ public static int getReleaseVersionNum() { return @version.RELEASE@; } /** * Maintenance Drop Number. * Optional identifier used to designate maintenance * drop applied to a specific release and contains * fixes for defects reported. It maintains compatibility * with the release and contains no API changes. * When missing, it designates the final and complete * development drop for a release. */ public static int getMaintenanceVersionNum() { return @version.MINOR@; } /** * Development Drop Number. * Optional identifier designates development drop of * a specific release. D01 is the first development drop * of a new release. * * Development drops are works in progress towards a * compeleted, final release. A specific development drop * may not completely implement all aspects of a new * feature, which may take several development drops to * complete. At the point of the final drop for the * release, the D suffix will be omitted. * * Each 'D' drops can contain functional enhancements as * well as defect fixes. 'D' drops may not be as stable as * the final releases. */ public static int getDevelopmentVersionNum() { try { if ((new String("@version.DEVELOPER@")).length() == 0) return 0; else return Integer.parseInt("@version.DEVELOPER@"); } catch (NumberFormatException nfe) { return 0; } } } libxalan2-java-2.7.1/src/org/apache/xalan/client/0000755000175000017500000000000010736146354020471 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/client/package.html0000644000175000017500000000176510721374032022751 0ustar mkochmkoch Xalan Client Package.

        Implementation of Xalan applet.

        libxalan2-java-2.7.1/src/org/apache/xalan/client/XSLTProcessorApplet.java0000644000175000017500000005277610721374033025204 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTProcessorApplet.java 469316 2006-10-30 23:32:59Z minchau $ */ package org.apache.xalan.client; import java.applet.Applet; import java.awt.Graphics; import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; import java.util.Hashtable; import java.util.Enumeration; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; /** * Provides applet host for the XSLT processor. To perform transformations on an HTML client: *

          *
        1. Use an <applet> tag to embed this applet in the HTML client.
        2. *
        3. Use the DocumentURL and StyleURL PARAM tags or the {@link #setDocumentURL} and * {@link #setStyleURL} methods to specify the XML source document and XSL stylesheet.
        4. *
        5. Call the {@link #getHtmlText} method (or one of the transformToHtml() methods) * to perform the transformation and return the result as a String.
        6. *
        * * This class extends Applet which ultimately causes this class to implement Serializable. * This is a serious restriction on this class. All fields that are not transient and not * static are written-out/read-in during serialization. So even private fields essentially * become part of the API. Developers need to take care when modifying fields. * @xsl.usage general */ public class XSLTProcessorApplet extends Applet { /** * The stylesheet processor. * This field is now transient because a * javax.xml.transform.TransformerFactory from JAXP * makes no claims to be serializable. */ transient TransformerFactory m_tfactory = null; /** * @serial */ private String m_styleURL; /** * @serial */ private String m_documentURL; // Parameter names. To change a name of a parameter, you need only make // a single change. Simply modify the value of the parameter string below. //-------------------------------------------------------------------------- /** * @serial */ private final String PARAM_styleURL = "styleURL"; /** * @serial */ private final String PARAM_documentURL = "documentURL"; // We'll keep the DOM trees around, so tell which trees // are cached. /** * @serial */ private String m_styleURLOfCached = null; /** * @serial */ private String m_documentURLOfCached = null; /** * Save this for use on the worker thread; may not be necessary. * @serial */ private URL m_codeBase = null; /** * @serial */ private String m_treeURL = null; /** * DocumentBase URL * @serial */ private URL m_documentBase = null; /** * Thread stuff for the trusted worker thread. */ transient private Thread m_callThread = null; /** */ transient private TrustedAgent m_trustedAgent = null; /** * Thread for running TrustedAgent. */ transient private Thread m_trustedWorker = null; /** * Where the worker thread puts the HTML text. */ transient private String m_htmlText = null; /** * Where the worker thread puts the document/stylesheet text. */ transient private String m_sourceText = null; /** * Stylesheet attribute name and value that the caller can set. */ transient private String m_nameOfIDAttrOfElemToModify = null; /** */ transient private String m_elemIdToModify = null; /** */ transient private String m_attrNameToSet = null; /** */ transient private String m_attrValueToSet = null; /** * The XSLTProcessorApplet constructor takes no arguments. */ public XSLTProcessorApplet(){} /** * Get basic information about the applet * @return A String with the applet name and author. */ public String getAppletInfo() { return "Name: XSLTProcessorApplet\r\n" + "Author: Scott Boag"; } /** * Get descriptions of the applet parameters. * @return A two-dimensional array of Strings with Name, Type, and Description * for each parameter. */ public String[][] getParameterInfo() { String[][] info = { { PARAM_styleURL, "String", "URL to an XSL stylesheet" }, { PARAM_documentURL, "String", "URL to an XML document" }, }; return info; } /** * Standard applet initialization. */ public void init() { // PARAMETER SUPPORT // The following code retrieves the value of each parameter // specified with the tag and stores it in a member // variable. //---------------------------------------------------------------------- String param; // styleURL: Parameter description //---------------------------------------------------------------------- param = getParameter(PARAM_styleURL); // stylesheet parameters m_parameters = new Hashtable(); if (param != null) setStyleURL(param); // documentURL: Parameter description //---------------------------------------------------------------------- param = getParameter(PARAM_documentURL); if (param != null) setDocumentURL(param); m_codeBase = this.getCodeBase(); m_documentBase = this.getDocumentBase(); // If you use a ResourceWizard-generated "control creator" class to // arrange controls in your applet, you may want to call its // CreateControls() method from within this method. Remove the following // call to resize() before adding the call to CreateControls(); // CreateControls() does its own resizing. //---------------------------------------------------------------------- resize(320, 240); } /** * Automatically called when the HTML client containing the applet loads. * This method starts execution of the applet thread. */ public void start() { m_trustedAgent = new TrustedAgent(); Thread currentThread = Thread.currentThread(); m_trustedWorker = new Thread(currentThread.getThreadGroup(), m_trustedAgent); m_trustedWorker.start(); try { m_tfactory = TransformerFactory.newInstance(); this.showStatus("Causing Transformer and Parser to Load and JIT..."); // Prime the pump so that subsequent transforms are faster. StringReader xmlbuf = new StringReader(""); StringReader xslbuf = new StringReader( ""); PrintWriter pw = new PrintWriter(new StringWriter()); synchronized (m_tfactory) { Templates templates = m_tfactory.newTemplates(new StreamSource(xslbuf)); Transformer transformer = templates.newTransformer(); transformer.transform(new StreamSource(xmlbuf), new StreamResult(pw)); } System.out.println("Primed the pump!"); this.showStatus("Ready to go!"); } catch (Exception e) { this.showStatus("Could not prime the pump!"); System.out.println("Could not prime the pump!"); e.printStackTrace(); } } /** * Do not call; this applet contains no UI or visual components. * */ public void paint(Graphics g){} /** * Automatically called when the HTML page containing the applet is no longer * on the screen. Stops execution of the applet thread. */ public void stop() { if (null != m_trustedWorker) { m_trustedWorker.stop(); // m_trustedWorker.destroy(); m_trustedWorker = null; } m_styleURLOfCached = null; m_documentURLOfCached = null; } /** * Cleanup; called when applet is terminated and unloaded. */ public void destroy() { if (null != m_trustedWorker) { m_trustedWorker.stop(); // m_trustedWorker.destroy(); m_trustedWorker = null; } m_styleURLOfCached = null; m_documentURLOfCached = null; } /** * Set the URL to the XSL stylesheet that will be used * to transform the input XML. No processing is done yet. * @param urlString valid URL string for XSL stylesheet. */ public void setStyleURL(String urlString) { m_styleURL = urlString; } /** * Set the URL to the XML document that will be transformed * with the XSL stylesheet. No processing is done yet. * @param urlString valid URL string for XML document. */ public void setDocumentURL(String urlString) { m_documentURL = urlString; } /** * The processor keeps a cache of the source and * style trees, so call this method if they have changed * or you want to do garbage collection. */ public void freeCache() { m_styleURLOfCached = null; m_documentURLOfCached = null; } /** * Set an attribute in the stylesheet, which gives the ability * to have some dynamic selection control. * @param nameOfIDAttrOfElemToModify The name of an attribute to search for a unique id. * @param elemId The unique ID to look for. * @param attrName Once the element is found, the name of the attribute to set. * @param value The value to set the attribute to. */ public void setStyleSheetAttribute(String nameOfIDAttrOfElemToModify, String elemId, String attrName, String value) { m_nameOfIDAttrOfElemToModify = nameOfIDAttrOfElemToModify; m_elemIdToModify = elemId; m_attrNameToSet = attrName; m_attrValueToSet = value; } /** * Stylesheet parameter key/value pair stored in a hashtable */ transient Hashtable m_parameters; /** * Submit a stylesheet parameter. * * @param key stylesheet parameter key * @param expr the parameter expression to be submitted. * @see javax.xml.transform.Transformer#setParameter(String,Object) */ public void setStylesheetParam(String key, String expr) { m_parameters.put(key, expr); } /** * Given a String containing markup, escape the markup so it * can be displayed in the browser. * * @param s String to escape * * The escaped string. */ public String escapeString(String s) { StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i++) { char ch = s.charAt(i); if ('<' == ch) { sb.append("<"); } else if ('>' == ch) { sb.append(">"); } else if ('&' == ch) { sb.append("&"); } else if (0xd800 <= ch && ch < 0xdc00) { // UTF-16 surrogate int next; if (i + 1 >= length) { throw new RuntimeException( XSLMessages.createMessage( XSLTErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[]{ Integer.toHexString(ch) })); //"Invalid UTF-16 surrogate detected: " //+Integer.toHexString(ch)+ " ?"); } else { next = s.charAt(++i); if (!(0xdc00 <= next && next < 0xe000)) throw new RuntimeException( XSLMessages.createMessage( XSLTErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[]{ Integer.toHexString(ch) + " " + Integer.toHexString(next) })); //"Invalid UTF-16 surrogate detected: " //+Integer.toHexString(ch)+" "+Integer.toHexString(next)); next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000; } sb.append("&#x"); sb.append(Integer.toHexString(next)); sb.append(";"); } else { sb.append(ch); } } return sb.toString(); } /** * Assuming the stylesheet URL and the input XML URL have been set, * perform the transformation and return the result as a String. * * @return A string that contains the contents pointed to by the URL. * */ public String getHtmlText() { m_trustedAgent.m_getData = true; m_callThread = Thread.currentThread(); try { synchronized (m_callThread) { m_callThread.wait(); } } catch (InterruptedException ie) { System.out.println(ie.getMessage()); } return m_htmlText; } /** * Get an XML document (or stylesheet) * * @param treeURL valid URL string for the document. * * @return document * * @throws IOException */ public String getTreeAsText(String treeURL) throws IOException { m_treeURL = treeURL; m_trustedAgent.m_getData = true; m_trustedAgent.m_getSource = true; m_callThread = Thread.currentThread(); try { synchronized (m_callThread) { m_callThread.wait(); } } catch (InterruptedException ie) { System.out.println(ie.getMessage()); } return m_sourceText; } /** * Use a Transformer to copy the source document * to a StreamResult. * * @return the document as a string */ private String getSource() throws TransformerException { StringWriter osw = new StringWriter(); PrintWriter pw = new PrintWriter(osw, false); String text = ""; try { URL docURL = new URL(m_documentBase, m_treeURL); synchronized (m_tfactory) { Transformer transformer = m_tfactory.newTransformer(); StreamSource source = new StreamSource(docURL.toString()); StreamResult result = new StreamResult(pw); transformer.transform(source, result); text = osw.toString(); } } catch (MalformedURLException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } catch (Exception any_error) { any_error.printStackTrace(); } return text; } /** * Get the XML source Tree as a text string suitable * for display in a browser. Note that this is for display of the * XML itself, not for rendering of HTML by the browser. * * @return XML source document as a string. * @throws Exception thrown if tree can not be converted. */ public String getSourceTreeAsText() throws Exception { return getTreeAsText(m_documentURL); } /** * Get the XSL style Tree as a text string suitable * for display in a browser. Note that this is for display of the * XML itself, not for rendering of HTML by the browser. * * @return The XSL stylesheet as a string. * @throws Exception thrown if tree can not be converted. */ public String getStyleTreeAsText() throws Exception { return getTreeAsText(m_styleURL); } /** * Get the HTML result Tree as a text string suitable * for display in a browser. Note that this is for display of the * XML itself, not for rendering of HTML by the browser. * * @return Transformation result as unmarked text. * @throws Exception thrown if tree can not be converted. */ public String getResultTreeAsText() throws Exception { return escapeString(getHtmlText()); } /** * Process a document and a stylesheet and return * the transformation result. If one of these is null, the * existing value (of a previous transformation) is not affected. * * @param doc URL string to XML document * @param style URL string to XSL stylesheet * * @return HTML transformation result */ public String transformToHtml(String doc, String style) { if (null != doc) { m_documentURL = doc; } if (null != style) { m_styleURL = style; } return getHtmlText(); } /** * Process a document and a stylesheet and return * the transformation result. Use the xsl:stylesheet PI to find the * document, if one exists. * * @param doc URL string to XML document containing an xsl:stylesheet PI. * * @return HTML transformation result */ public String transformToHtml(String doc) { if (null != doc) { m_documentURL = doc; } m_styleURL = null; return getHtmlText(); } /** * Process the transformation. * * @return The transformation result as a string. * * @throws TransformerException */ private String processTransformation() throws TransformerException { String htmlData = null; this.showStatus("Waiting for Transformer and Parser to finish loading and JITing..."); synchronized (m_tfactory) { URL documentURL = null; URL styleURL = null; StringWriter osw = new StringWriter(); PrintWriter pw = new PrintWriter(osw, false); StreamResult result = new StreamResult(pw); this.showStatus("Begin Transformation..."); try { documentURL = new URL(m_codeBase, m_documentURL); StreamSource xmlSource = new StreamSource(documentURL.toString()); styleURL = new URL(m_codeBase, m_styleURL); StreamSource xslSource = new StreamSource(styleURL.toString()); Transformer transformer = m_tfactory.newTransformer(xslSource); Enumeration m_keys = m_parameters.keys(); while (m_keys.hasMoreElements()){ Object key = m_keys.nextElement(); Object expression = m_parameters.get(key); transformer.setParameter((String) key, expression); } transformer.transform(xmlSource, result); } catch (TransformerConfigurationException tfe) { tfe.printStackTrace(); throw new RuntimeException(tfe.getMessage()); } catch (MalformedURLException e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } this.showStatus("Transformation Done!"); htmlData = osw.toString(); } return htmlData; } /** * This class maintains a worker thread that that is * trusted and can do things like access data. You need * this because the thread that is called by the browser * is not trusted and can't access data from the URLs. */ class TrustedAgent implements Runnable { /** * Specifies whether the worker thread should perform a transformation. */ public boolean m_getData = false; /** * Specifies whether the worker thread should get an XML document or XSL stylesheet. */ public boolean m_getSource = false; /** * The real work is done from here. * */ public void run() { while (true) { Thread.yield(); if (m_getData) // Perform a transformation or get a document. { try { m_getData = false; m_htmlText = null; m_sourceText = null; if (m_getSource) // Get a document. { m_getSource = false; m_sourceText = getSource(); } else // Perform a transformation. m_htmlText = processTransformation(); } catch (Exception e) { e.printStackTrace(); } finally { synchronized (m_callThread) { m_callThread.notify(); } } } else { try { Thread.sleep(50); } catch (InterruptedException ie) { ie.printStackTrace(); } } } } } // For compatiblity with old serialized objects // We will change non-serialized fields and change methods // and not have this break us. private static final long serialVersionUID=4618876841979251422L; // For compatibility when de-serializing old objects private void readObject(java.io.ObjectInputStream inStream) throws IOException, ClassNotFoundException { inStream.defaultReadObject(); // Needed assignment of non-serialized fields // A TransformerFactory is not guaranteed to be serializable, // so we create one here m_tfactory = TransformerFactory.newInstance(); } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/0000755000175000017500000000000010736146354021412 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/extensions/XPathFunctionImpl.java0000644000175000017500000000507110721374031025621 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xalan.extensions; import java.util.List; import java.util.Vector; import javax.xml.transform.TransformerException; import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionException; /** * A sample implementation of XPathFunction, with support for * EXSLT extension functions and Java extension functions. */ public class XPathFunctionImpl implements XPathFunction { private ExtensionHandler m_handler; private String m_funcName; /** * Construct an instance of XPathFunctionImpl from the * ExtensionHandler and function name. */ public XPathFunctionImpl(ExtensionHandler handler, String funcName) { m_handler = handler; m_funcName = funcName; } /** * @see javax.xml.xpath.XPathFunction#evaluate(java.util.List) */ public Object evaluate(List args) throws XPathFunctionException { Vector argsVec = listToVector(args); try { // The method key and ExpressionContext are set to null. return m_handler.callFunction(m_funcName, argsVec, null, null); } catch (TransformerException e) { throw new XPathFunctionException(e); } } /** * Convert a java.util.List to a java.util.Vector. * No conversion is done if the List is already a Vector. */ private static Vector listToVector(List args) { if (args == null) return null; else if (args instanceof Vector) return (Vector)args; else { Vector result = new Vector(); result.addAll(args); return result; } } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/SecuritySupport.java0000644000175000017500000000745510721374033025463 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/MethodResolver.java0000644000175000017500000010720310721374030025206 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MethodResolver.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.ref.DTMNodeIterator; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XRTreeFrag; import org.apache.xpath.objects.XString; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.traversal.NodeIterator; /** * Utility class to help resolve method overloading with Xalan XSLT * argument types. */ public class MethodResolver { /** * Specifies a search for static methods only. */ public static final int STATIC_ONLY = 1; /** * Specifies a search for instance methods only. */ public static final int INSTANCE_ONLY = 2; /** * Specifies a search for both static and instance methods. */ public static final int STATIC_AND_INSTANCE = 3; /** * Specifies a Dynamic method search. If the method being * evaluated is a static method, all arguments are used. * Otherwise, it is an instance method and only arguments * beginning with the second argument are used. */ public static final int DYNAMIC = 4; /** * Given a class, figure out the resolution of * the Java Constructor from the XSLT argument types, and perform the * conversion of the arguments. * @param classObj the Class of the object to be constructed. * @param argsIn An array of XSLT/XPath arguments. * @param argsOut An array of the exact size as argsIn, which will be * populated with converted arguments if a suitable method is found. * @return A constructor that will work with the argsOut array. * @throws TransformerException may be thrown for Xalan conversion * exceptions. */ public static Constructor getConstructor(Class classObj, Object[] argsIn, Object[][] argsOut, ExpressionContext exprContext) throws NoSuchMethodException, SecurityException, TransformerException { Constructor bestConstructor = null; Class[] bestParamTypes = null; Constructor[] constructors = classObj.getConstructors(); int nMethods = constructors.length; int bestScore = Integer.MAX_VALUE; int bestScoreCount = 0; for(int i = 0; i < nMethods; i++) { Constructor ctor = constructors[i]; Class[] paramTypes = ctor.getParameterTypes(); int numberMethodParams = paramTypes.length; int paramStart = 0; boolean isFirstExpressionContext = false; int scoreStart; // System.out.println("numberMethodParams: "+numberMethodParams); // System.out.println("argsIn.length: "+argsIn.length); // System.out.println("exprContext: "+exprContext); if(numberMethodParams == (argsIn.length+1)) { Class javaClass = paramTypes[0]; // System.out.println("first javaClass: "+javaClass.getName()); if(ExpressionContext.class.isAssignableFrom(javaClass)) { isFirstExpressionContext = true; scoreStart = 0; paramStart++; // System.out.println("Incrementing paramStart: "+paramStart); } else continue; } else scoreStart = 1000; if(argsIn.length == (numberMethodParams - paramStart)) { // then we have our candidate. int score = scoreMatch(paramTypes, paramStart, argsIn, scoreStart); // System.out.println("score: "+score); if(-1 == score) continue; if(score < bestScore) { // System.out.println("Assigning best ctor: "+ctor); bestConstructor = ctor; bestParamTypes = paramTypes; bestScore = score; bestScoreCount = 1; } else if (score == bestScore) bestScoreCount++; } } if(null == bestConstructor) { throw new NoSuchMethodException(errString("function", "constructor", classObj, "", 0, argsIn)); } /*** This is commented out until we can do a better object -> object scoring else if (bestScoreCount > 1) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_CONSTRUCTOR, new Object[]{classObj.getName()})); //"More than one best match for constructor for " + classObj.getName()); ***/ else convertParams(argsIn, argsOut, bestParamTypes, exprContext); return bestConstructor; } /** * Given the name of a method, figure out the resolution of * the Java Method from the XSLT argument types, and perform the * conversion of the arguments. * @param classObj The Class of the object that should have the method. * @param name The name of the method to be invoked. * @param argsIn An array of XSLT/XPath arguments. * @param argsOut An array of the exact size as argsIn, which will be * populated with converted arguments if a suitable method is found. * @return A method that will work with the argsOut array. * @throws TransformerException may be thrown for Xalan conversion * exceptions. */ public static Method getMethod(Class classObj, String name, Object[] argsIn, Object[][] argsOut, ExpressionContext exprContext, int searchMethod) throws NoSuchMethodException, SecurityException, TransformerException { // System.out.println("---> Looking for method: "+name); // System.out.println("---> classObj: "+classObj); if (name.indexOf("-")>0) name = replaceDash(name); Method bestMethod = null; Class[] bestParamTypes = null; Method[] methods = classObj.getMethods(); int nMethods = methods.length; int bestScore = Integer.MAX_VALUE; int bestScoreCount = 0; boolean isStatic; for(int i = 0; i < nMethods; i++) { Method method = methods[i]; // System.out.println("looking at method: "+method); int xsltParamStart = 0; if(method.getName().equals(name)) { isStatic = Modifier.isStatic(method.getModifiers()); switch(searchMethod) { case STATIC_ONLY: if (!isStatic) { continue; } break; case INSTANCE_ONLY: if (isStatic) { continue; } break; case STATIC_AND_INSTANCE: break; case DYNAMIC: if (!isStatic) xsltParamStart = 1; } int javaParamStart = 0; Class[] paramTypes = method.getParameterTypes(); int numberMethodParams = paramTypes.length; boolean isFirstExpressionContext = false; int scoreStart; // System.out.println("numberMethodParams: "+numberMethodParams); // System.out.println("argsIn.length: "+argsIn.length); // System.out.println("exprContext: "+exprContext); int argsLen = (null != argsIn) ? argsIn.length : 0; if(numberMethodParams == (argsLen-xsltParamStart+1)) { Class javaClass = paramTypes[0]; if(ExpressionContext.class.isAssignableFrom(javaClass)) { isFirstExpressionContext = true; scoreStart = 0; javaParamStart++; } else { continue; } } else scoreStart = 1000; if((argsLen - xsltParamStart) == (numberMethodParams - javaParamStart)) { // then we have our candidate. int score = scoreMatch(paramTypes, javaParamStart, argsIn, scoreStart); // System.out.println("score: "+score); if(-1 == score) continue; if(score < bestScore) { // System.out.println("Assigning best method: "+method); bestMethod = method; bestParamTypes = paramTypes; bestScore = score; bestScoreCount = 1; } else if (score == bestScore) bestScoreCount++; } } } if (null == bestMethod) { throw new NoSuchMethodException(errString("function", "method", classObj, name, searchMethod, argsIn)); } /*** This is commented out until we can do a better object -> object scoring else if (bestScoreCount > 1) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_METHOD, new Object[]{name})); //"More than one best match for method " + name); ***/ else convertParams(argsIn, argsOut, bestParamTypes, exprContext); return bestMethod; } /** * To support EXSLT extensions, convert names with dash to allowable Java names: * e.g., convert abc-xyz to abcXyz. * Note: dashes only appear in middle of an EXSLT function or element name. */ private static String replaceDash(String name) { char dash = '-'; StringBuffer buff = new StringBuffer(""); for (int i=0; i 0 && name.charAt(i-1) == dash) buff.append(Character.toUpperCase(name.charAt(i))); else buff.append(name.charAt(i)); } return buff.toString(); } /** * Given the name of a method, figure out the resolution of * the Java Method * @param classObj The Class of the object that should have the method. * @param name The name of the method to be invoked. * @return A method that will work to be called as an element. * @throws TransformerException may be thrown for Xalan conversion * exceptions. */ public static Method getElementMethod(Class classObj, String name) throws NoSuchMethodException, SecurityException, TransformerException { // System.out.println("---> Looking for element method: "+name); // System.out.println("---> classObj: "+classObj); Method bestMethod = null; Method[] methods = classObj.getMethods(); int nMethods = methods.length; int bestScoreCount = 0; for(int i = 0; i < nMethods; i++) { Method method = methods[i]; // System.out.println("looking at method: "+method); if(method.getName().equals(name)) { Class[] paramTypes = method.getParameterTypes(); if ( (paramTypes.length == 2) && paramTypes[1].isAssignableFrom(org.apache.xalan.templates.ElemExtensionCall.class) && paramTypes[0].isAssignableFrom(org.apache.xalan.extensions.XSLProcessorContext.class) ) { if ( ++bestScoreCount == 1 ) bestMethod = method; else break; } } } if (null == bestMethod) { throw new NoSuchMethodException(errString("element", "method", classObj, name, 0, null)); } else if (bestScoreCount > 1) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_ELEMENT, new Object[]{name})); //"More than one best match for element method " + name); return bestMethod; } /** * Convert a set of parameters based on a set of paramTypes. * @param argsIn An array of XSLT/XPath arguments. * @param argsOut An array of the exact size as argsIn, which will be * populated with converted arguments. * @param paramTypes An array of class objects, of the exact same * size as argsIn and argsOut. * @throws TransformerException may be thrown for Xalan conversion * exceptions. */ public static void convertParams(Object[] argsIn, Object[][] argsOut, Class[] paramTypes, ExpressionContext exprContext) throws javax.xml.transform.TransformerException { // System.out.println("In convertParams"); if (paramTypes == null) argsOut[0] = null; else { int nParams = paramTypes.length; argsOut[0] = new Object[nParams]; int paramIndex = 0; if((nParams > 0) && ExpressionContext.class.isAssignableFrom(paramTypes[0])) { argsOut[0][0] = exprContext; // System.out.println("Incrementing paramIndex in convertParams: "+paramIndex); paramIndex++; } if (argsIn != null) { for(int i = argsIn.length - nParams + paramIndex ; paramIndex < nParams; i++, paramIndex++) { // System.out.println("paramTypes[i]: "+paramTypes[i]); argsOut[0][paramIndex] = convert(argsIn[i], paramTypes[paramIndex]); } } } } /** * Simple class to hold information about allowed conversions * and their relative scores, for use by the table below. */ static class ConversionInfo { ConversionInfo(Class cl, int score) { m_class = cl; m_score = score; } Class m_class; // Java class to convert to. int m_score; // Match score, closer to zero is more matched. } private static final int SCOREBASE=1; /** * Specification of conversions from XSLT type CLASS_UNKNOWN * (i.e. some unknown Java object) to allowed Java types. */ private final static ConversionInfo[] m_javaObjConversions = { new ConversionInfo(Double.TYPE, 11), new ConversionInfo(Float.TYPE, 12), new ConversionInfo(Long.TYPE, 13), new ConversionInfo(Integer.TYPE, 14), new ConversionInfo(Short.TYPE, 15), new ConversionInfo(Character.TYPE, 16), new ConversionInfo(Byte.TYPE, 17), new ConversionInfo(java.lang.String.class, 18) }; /** * Specification of conversions from XSLT type CLASS_BOOLEAN * to allowed Java types. */ private final static ConversionInfo[] m_booleanConversions = { new ConversionInfo(Boolean.TYPE, 0), new ConversionInfo(java.lang.Boolean.class, 1), new ConversionInfo(java.lang.Object.class, 2), new ConversionInfo(java.lang.String.class, 3) }; /** * Specification of conversions from XSLT type CLASS_NUMBER * to allowed Java types. */ private final static ConversionInfo[] m_numberConversions = { new ConversionInfo(Double.TYPE, 0), new ConversionInfo(java.lang.Double.class, 1), new ConversionInfo(Float.TYPE, 3), new ConversionInfo(Long.TYPE, 4), new ConversionInfo(Integer.TYPE, 5), new ConversionInfo(Short.TYPE, 6), new ConversionInfo(Character.TYPE, 7), new ConversionInfo(Byte.TYPE, 8), new ConversionInfo(Boolean.TYPE, 9), new ConversionInfo(java.lang.String.class, 10), new ConversionInfo(java.lang.Object.class, 11) }; /** * Specification of conversions from XSLT type CLASS_STRING * to allowed Java types. */ private final static ConversionInfo[] m_stringConversions = { new ConversionInfo(java.lang.String.class, 0), new ConversionInfo(java.lang.Object.class, 1), new ConversionInfo(Character.TYPE, 2), new ConversionInfo(Double.TYPE, 3), new ConversionInfo(Float.TYPE, 3), new ConversionInfo(Long.TYPE, 3), new ConversionInfo(Integer.TYPE, 3), new ConversionInfo(Short.TYPE, 3), new ConversionInfo(Byte.TYPE, 3), new ConversionInfo(Boolean.TYPE, 4) }; /** * Specification of conversions from XSLT type CLASS_RTREEFRAG * to allowed Java types. */ private final static ConversionInfo[] m_rtfConversions = { new ConversionInfo(org.w3c.dom.traversal.NodeIterator.class, 0), new ConversionInfo(org.w3c.dom.NodeList.class, 1), new ConversionInfo(org.w3c.dom.Node.class, 2), new ConversionInfo(java.lang.String.class, 3), new ConversionInfo(java.lang.Object.class, 5), new ConversionInfo(Character.TYPE, 6), new ConversionInfo(Double.TYPE, 7), new ConversionInfo(Float.TYPE, 7), new ConversionInfo(Long.TYPE, 7), new ConversionInfo(Integer.TYPE, 7), new ConversionInfo(Short.TYPE, 7), new ConversionInfo(Byte.TYPE, 7), new ConversionInfo(Boolean.TYPE, 8) }; /** * Specification of conversions from XSLT type CLASS_NODESET * to allowed Java types. (This is the same as for CLASS_RTREEFRAG) */ private final static ConversionInfo[] m_nodesetConversions = { new ConversionInfo(org.w3c.dom.traversal.NodeIterator.class, 0), new ConversionInfo(org.w3c.dom.NodeList.class, 1), new ConversionInfo(org.w3c.dom.Node.class, 2), new ConversionInfo(java.lang.String.class, 3), new ConversionInfo(java.lang.Object.class, 5), new ConversionInfo(Character.TYPE, 6), new ConversionInfo(Double.TYPE, 7), new ConversionInfo(Float.TYPE, 7), new ConversionInfo(Long.TYPE, 7), new ConversionInfo(Integer.TYPE, 7), new ConversionInfo(Short.TYPE, 7), new ConversionInfo(Byte.TYPE, 7), new ConversionInfo(Boolean.TYPE, 8) }; /** * Order is significant in the list below, based on * XObject.CLASS_XXX values. */ private final static ConversionInfo[][] m_conversions = { m_javaObjConversions, // CLASS_UNKNOWN = 0; m_booleanConversions, // CLASS_BOOLEAN = 1; m_numberConversions, // CLASS_NUMBER = 2; m_stringConversions, // CLASS_STRING = 3; m_nodesetConversions, // CLASS_NODESET = 4; m_rtfConversions // CLASS_RTREEFRAG = 5; }; /** * Score the conversion of a set of XSLT arguments to a * given set of Java parameters. * If any invocations of this function for a method with * the same name return the same positive value, then a conflict * has occured, and an error should be signaled. * @param javaParamTypes Must be filled with valid class names, and * of the same length as xsltArgs. * @param xsltArgs Must be filled with valid object instances, and * of the same length as javeParamTypes. * @return -1 for no allowed conversion, or a positive score * that is closer to zero for more preferred, or further from * zero for less preferred. */ public static int scoreMatch(Class[] javaParamTypes, int javaParamsStart, Object[] xsltArgs, int score) { if ((xsltArgs == null) || (javaParamTypes == null)) return score; int nParams = xsltArgs.length; for(int i = nParams - javaParamTypes.length + javaParamsStart, javaParamTypesIndex = javaParamsStart; i < nParams; i++, javaParamTypesIndex++) { Object xsltObj = xsltArgs[i]; int xsltClassType = (xsltObj instanceof XObject) ? ((XObject)xsltObj).getType() : XObject.CLASS_UNKNOWN; Class javaClass = javaParamTypes[javaParamTypesIndex]; // System.out.println("Checking xslt: "+xsltObj.getClass().getName()+ // " against java: "+javaClass.getName()); if(xsltClassType == XObject.CLASS_NULL) { // In Xalan I have objects of CLASS_NULL, though I'm not // sure they're used any more. For now, do something funky. if(!javaClass.isPrimitive()) { // Then assume that a null can be used, but give it a low score. score += 10; continue; } else return -1; // no match. } ConversionInfo[] convInfo = m_conversions[xsltClassType]; int nConversions = convInfo.length; int k; for(k = 0; k < nConversions; k++) { ConversionInfo cinfo = convInfo[k]; if(javaClass.isAssignableFrom(cinfo.m_class)) { score += cinfo.m_score; break; // from k loop } } if (k == nConversions) { // If we get here, we haven't made a match on this parameter using // the ConversionInfo array. We now try to handle the object -> object // mapping which we can't handle through the array mechanism. To do this, // we must determine the class of the argument passed from the stylesheet. // If we were passed a subclass of XObject, representing one of the actual // XSLT types, and we are here, we reject this extension method as a candidate // because a match should have been made using the ConversionInfo array. If we // were passed an XObject that encapsulates a non-XSLT type or we // were passed a non-XSLT type directly, we continue. // The current implementation (contributed by Kelly Campbell ) // checks to see if we were passed an XObject from the XSLT stylesheet. If not, // we use the class of the object that was passed and make sure that it will // map to the class type of the parameter in the extension function. // If we were passed an XObject, we attempt to get the class of the actual // object encapsulated inside the XObject. If the encapsulated object is null, // we judge this method as a match but give it a low score. // If the encapsulated object is not null, we use its type to determine // whether this java method is a valid match for this extension function call. // This approach eliminates the NullPointerException in the earlier implementation // that resulted from passing an XObject encapsulating the null java object. // TODO: This needs to be improved to assign relative scores to subclasses, // etc. if (XObject.CLASS_UNKNOWN == xsltClassType) { Class realClass = null; if (xsltObj instanceof XObject) { Object realObj = ((XObject) xsltObj).object(); if (null != realObj) { realClass = realObj.getClass(); } else { // do the same as if we were passed XObject.CLASS_NULL score += 10; continue; } } else { realClass = xsltObj.getClass(); } if (javaClass.isAssignableFrom(realClass)) { score += 0; // TODO: To be assigned based on subclass "distance" } else return -1; } else return -1; } } return score; } /** * Convert the given XSLT object to an object of * the given class. * @param xsltObj The XSLT object that needs conversion. * @param javaClass The type of object to convert to. * @returns An object suitable for passing to the Method.invoke * function in the args array, which may be null in some cases. * @throws TransformerException may be thrown for Xalan conversion * exceptions. */ static Object convert(Object xsltObj, Class javaClass) throws javax.xml.transform.TransformerException { if(xsltObj instanceof XObject) { XObject xobj = ((XObject)xsltObj); int xsltClassType = xobj.getType(); switch(xsltClassType) { case XObject.CLASS_NULL: return null; case XObject.CLASS_BOOLEAN: { if(javaClass == java.lang.String.class) return xobj.str(); else return new Boolean(xobj.bool()); } // break; Unreachable case XObject.CLASS_NUMBER: { if(javaClass == java.lang.String.class) return xobj.str(); else if(javaClass == Boolean.TYPE) return new Boolean(xobj.bool()); else { return convertDoubleToNumber(xobj.num(), javaClass); } } // break; Unreachable case XObject.CLASS_STRING: { if((javaClass == java.lang.String.class) || (javaClass == java.lang.Object.class)) return xobj.str(); else if(javaClass == Character.TYPE) { String str = xobj.str(); if(str.length() > 0) return new Character(str.charAt(0)); else return null; // ?? } else if(javaClass == Boolean.TYPE) return new Boolean(xobj.bool()); else { return convertDoubleToNumber(xobj.num(), javaClass); } } // break; Unreachable case XObject.CLASS_RTREEFRAG: { // GLP: I don't see the reason for the isAssignableFrom call // instead of an == test as is used everywhere else. // Besides, if the javaClass is a subclass of NodeIterator // the condition will be true and we'll create a NodeIterator // which may not match the javaClass, causing a RuntimeException. // if((NodeIterator.class.isAssignableFrom(javaClass)) || if ( (javaClass == NodeIterator.class) || (javaClass == java.lang.Object.class) ) { DTMIterator dtmIter = ((XRTreeFrag) xobj).asNodeIterator(); return new DTMNodeIterator(dtmIter); } else if (javaClass == NodeList.class) { return ((XRTreeFrag) xobj).convertToNodeset(); } // Same comment as above // else if(Node.class.isAssignableFrom(javaClass)) else if(javaClass == Node.class) { DTMIterator iter = ((XRTreeFrag) xobj).asNodeIterator(); int rootHandle = iter.nextNode(); DTM dtm = iter.getDTM(rootHandle); return dtm.getNode(dtm.getFirstChild(rootHandle)); } else if(javaClass == java.lang.String.class) { return xobj.str(); } else if(javaClass == Boolean.TYPE) { return new Boolean(xobj.bool()); } else if(javaClass.isPrimitive()) { return convertDoubleToNumber(xobj.num(), javaClass); } else { DTMIterator iter = ((XRTreeFrag) xobj).asNodeIterator(); int rootHandle = iter.nextNode(); DTM dtm = iter.getDTM(rootHandle); Node child = dtm.getNode(dtm.getFirstChild(rootHandle)); if(javaClass.isAssignableFrom(child.getClass())) return child; else return null; } } // break; Unreachable case XObject.CLASS_NODESET: { // GLP: I don't see the reason for the isAssignableFrom call // instead of an == test as is used everywhere else. // Besides, if the javaClass is a subclass of NodeIterator // the condition will be true and we'll create a NodeIterator // which may not match the javaClass, causing a RuntimeException. // if((NodeIterator.class.isAssignableFrom(javaClass)) || if ( (javaClass == NodeIterator.class) || (javaClass == java.lang.Object.class) ) { return xobj.nodeset(); } // Same comment as above // else if(NodeList.class.isAssignableFrom(javaClass)) else if(javaClass == NodeList.class) { return xobj.nodelist(); } // Same comment as above // else if(Node.class.isAssignableFrom(javaClass)) else if(javaClass == Node.class) { // Xalan ensures that iter() always returns an // iterator positioned at the beginning. DTMIterator ni = xobj.iter(); int handle = ni.nextNode(); if (handle != DTM.NULL) return ni.getDTM(handle).getNode(handle); // may be null. else return null; } else if(javaClass == java.lang.String.class) { return xobj.str(); } else if(javaClass == Boolean.TYPE) { return new Boolean(xobj.bool()); } else if(javaClass.isPrimitive()) { return convertDoubleToNumber(xobj.num(), javaClass); } else { DTMIterator iter = xobj.iter(); int childHandle = iter.nextNode(); DTM dtm = iter.getDTM(childHandle); Node child = dtm.getNode(childHandle); if(javaClass.isAssignableFrom(child.getClass())) return child; else return null; } } // break; Unreachable // No default:, fall-through on purpose } // end switch xsltObj = xobj.object(); } // end if if(xsltObj instanceof XObject) // At this point, we have a raw java object, not an XObject. if (null != xsltObj) { if(javaClass == java.lang.String.class) { return xsltObj.toString(); } else if(javaClass.isPrimitive()) { // Assume a number conversion XString xstr = new XString(xsltObj.toString()); double num = xstr.num(); return convertDoubleToNumber(num, javaClass); } else if(javaClass == java.lang.Class.class) { return xsltObj.getClass(); } else { // Just pass the object directly, and hope for the best. return xsltObj; } } else { // Just pass the object directly, and hope for the best. return xsltObj; } } /** * Do a standard conversion of a double to the specified type. * @param num The number to be converted. * @param javaClass The class type to be converted to. * @return An object specified by javaClass, or a Double instance. */ static Object convertDoubleToNumber(double num, Class javaClass) { // In the code below, I don't check for NaN, etc., instead // using the standard Java conversion, as I think we should // specify. See issue-runtime-errors. if((javaClass == Double.TYPE) || (javaClass == java.lang.Double.class)) return new Double(num); else if(javaClass == Float.TYPE) return new Float(num); else if(javaClass == Long.TYPE) { // Use standard Java Narrowing Primitive Conversion // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672 return new Long((long)num); } else if(javaClass == Integer.TYPE) { // Use standard Java Narrowing Primitive Conversion // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672 return new Integer((int)num); } else if(javaClass == Short.TYPE) { // Use standard Java Narrowing Primitive Conversion // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672 return new Short((short)num); } else if(javaClass == Character.TYPE) { // Use standard Java Narrowing Primitive Conversion // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672 return new Character((char)num); } else if(javaClass == Byte.TYPE) { // Use standard Java Narrowing Primitive Conversion // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672 return new Byte((byte)num); } else // Some other type of object { return new Double(num); } } /** * Format the message for the NoSuchMethodException containing * all the information about the method we're looking for. */ private static String errString(String callType, // "function" or "element" String searchType, // "method" or "constructor" Class classObj, String funcName, int searchMethod, Object[] xsltArgs) { String resultString = "For extension " + callType + ", could not find " + searchType + " "; switch (searchMethod) { case STATIC_ONLY: return resultString + "static " + classObj.getName() + "." + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ")."; case INSTANCE_ONLY: return resultString + classObj.getName() + "." + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ")."; case STATIC_AND_INSTANCE: return resultString + classObj.getName() + "." + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").\n" + "Checked both static and instance methods."; case DYNAMIC: return resultString + "static " + classObj.getName() + "." + funcName + "([ExpressionContext, ]" + errArgs(xsltArgs, 0) + ") nor\n" + classObj + "." + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 1) + ")."; default: if (callType.equals("function")) // must be a constructor { return resultString + classObj.getName() + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ")."; } else // must be an element call { return resultString + classObj.getName() + "." + funcName + "(org.apache.xalan.extensions.XSLProcessorContext, " + "org.apache.xalan.templates.ElemExtensionCall)."; } } } private static String errArgs(Object[] xsltArgs, int startingArg) { StringBuffer returnArgs = new StringBuffer(); for (int i = startingArg; i < xsltArgs.length; i++) { if (i != startingArg) returnArgs.append(", "); if (xsltArgs[i] instanceof XObject) returnArgs.append(((XObject) xsltArgs[i]).getTypeString()); else returnArgs.append(xsltArgs[i].getClass().getName()); } return returnArgs.toString(); } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/SecuritySupport12.java0000644000175000017500000001176210721374031025620 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionHandlerJava.java0000644000175000017500000000737310721374030026327 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionHandlerJava.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.util.Hashtable; /** * Abstract base class handling the java language extensions for XPath. * This base class provides cache management shared by all of the * various java extension handlers. * * @xsl.usage internal */ public abstract class ExtensionHandlerJava extends ExtensionHandler { /** Extension class name */ protected String m_className = ""; /** Table of cached methods */ private Hashtable m_cachedMethods = new Hashtable(); /** * Construct a new extension handler given all the information * needed. * * @param namespaceUri the extension namespace URI that I'm implementing * @param funcNames string containing list of functions of extension NS * @param lang language of code implementing the extension * @param srcURL value of src attribute (if any) - treated as a URL * or a classname depending on the value of lang. If * srcURL is not null, then scriptSrc is ignored. * @param scriptSrc the actual script code (if any) * @param scriptLang the scripting language * @param className the extension class name */ protected ExtensionHandlerJava(String namespaceUri, String scriptLang, String className) { super(namespaceUri, scriptLang); m_className = className; } /** * Look up the entry in the method cache. * @param methodKey A key that uniquely identifies this invocation in * the stylesheet. * @param objType A Class object or instance object representing the type * @param methodArgs An array of the XObject arguments to be used for * function mangling. * * @return The given method from the method cache */ public Object getFromCache(Object methodKey, Object objType, Object[] methodArgs) { // Eventually, we want to insert code to mangle the methodKey with methodArgs return m_cachedMethods.get(methodKey); } /** * Add a new entry into the method cache. * @param methodKey A key that uniquely identifies this invocation in * the stylesheet. * @param objType A Class object or instance object representing the type * @param methodArgs An array of the XObject arguments to be used for * function mangling. * @param methodObj A Class object or instance object representing the method * * @return The cached method object */ public Object putToCache(Object methodKey, Object objType, Object[] methodArgs, Object methodObj) { // Eventually, we want to insert code to mangle the methodKey with methodArgs return m_cachedMethods.put(methodKey, methodObj); } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionHandler.java0000644000175000017500000001260010721374031025513 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionHandler.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.io.IOException; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.functions.FuncExtFunction; /** * Abstract base class for handling an extension namespace for XPath. * Provides functions to test a function's existence and call a function. * Also provides functions for calling an element and testing for * an element's existence. * * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com) * @xsl.usage internal */ public abstract class ExtensionHandler { /** uri of the extension namespace */ protected String m_namespaceUri; /** scripting language of implementation */ protected String m_scriptLang; /** * This method loads a class using the context class loader if we're * running under Java2 or higher. * * @param className Name of the class to load */ static Class getClassForName(String className) throws ClassNotFoundException { // Hack for backwards compatibility with XalanJ1 stylesheets if(className.equals("org.apache.xalan.xslt.extensions.Redirect")) { className = "org.apache.xalan.lib.Redirect"; } return ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); } /** * Construct a new extension namespace handler given all the information * needed. * * @param namespaceUri the extension namespace URI that I'm implementing * @param scriptLang language of code implementing the extension */ protected ExtensionHandler(String namespaceUri, String scriptLang) { m_namespaceUri = namespaceUri; m_scriptLang = scriptLang; } /** * Tests whether a certain function name is known within this namespace. * @param function name of the function being tested * @return true if its known, false if not. */ public abstract boolean isFunctionAvailable(String function); /** * Tests whether a certain element name is known within this namespace. * @param element Name of element to check * @return true if its known, false if not. */ public abstract boolean isElementAvailable(String element); /** * Process a call to a function. * * @param funcName Function name. * @param args The arguments of the function call. * @param methodKey A key that uniquely identifies this class and method call. * @param exprContext The context in which this expression is being executed. * * @return the return value of the function evaluation. * * @throws TransformerException if parsing trouble */ public abstract Object callFunction( String funcName, Vector args, Object methodKey, ExpressionContext exprContext) throws TransformerException; /** * Process a call to a function. * * @param extFunction The XPath extension function. * @param args The arguments of the function call. * @param exprContext The context in which this expression is being executed. * * @return the return value of the function evaluation. * * @throws TransformerException if parsing trouble */ public abstract Object callFunction( FuncExtFunction extFunction, Vector args, ExpressionContext exprContext) throws TransformerException; /** * Process a call to this extension namespace via an element. As a side * effect, the results are sent to the TransformerImpl's result tree. * * @param localPart Element name's local part. * @param element The extension element being processed. * @param transformer Handle to TransformerImpl. * @param stylesheetTree The compiled stylesheet tree. * @param methodKey A key that uniquely identifies this class and method call. * * @throws XSLProcessorException thrown if something goes wrong * while running the extension handler. * @throws MalformedURLException if loading trouble * @throws FileNotFoundException if loading trouble * @throws IOException if loading trouble * @throws TransformerException if parsing trouble */ public abstract void processElement( String localPart, ElemTemplateElement element, TransformerImpl transformer, Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException; } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExpressionVisitor.java0000644000175000017500000000570310721374032025767 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExpressionVisitor.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import org.apache.xalan.templates.StylesheetRoot; import org.apache.xpath.ExpressionOwner; import org.apache.xpath.XPathVisitor; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.functions.FuncExtFunctionAvailable; import org.apache.xpath.functions.Function; /** * When {@link org.apache.xalan.processor.StylesheetHandler} creates * an {@link org.apache.xpath.XPath}, the ExpressionVisitor * visits the XPath expression. For any extension functions it * encounters, it instructs StylesheetRoot to register the * extension namespace. * * This mechanism is required to locate extension functions * that may be embedded within an expression. */ public class ExpressionVisitor extends XPathVisitor { private StylesheetRoot m_sroot; /** * The constructor sets the StylesheetRoot variable which * is used to register extension namespaces. * @param sroot the StylesheetRoot that is being constructed. */ public ExpressionVisitor (StylesheetRoot sroot) { m_sroot = sroot; } /** * If the function is an extension function, register the namespace. * * @param owner The current XPath object that owns the expression. * @param func The function currently being visited. * * @return true to continue the visit in the subtree, if any. */ public boolean visitFunction(ExpressionOwner owner, Function func) { if (func instanceof FuncExtFunction) { String namespace = ((FuncExtFunction)func).getNamespace(); m_sroot.getExtensionNamespacesManager().registerExtension(namespace); } else if (func instanceof FuncExtFunctionAvailable) { String arg = ((FuncExtFunctionAvailable)func).getArg0().toString(); if (arg.indexOf(":") > 0) { String prefix = arg.substring(0,arg.indexOf(":")); String namespace = this.m_sroot.getNamespaceForPrefix(prefix); m_sroot.getExtensionNamespacesManager().registerExtension(namespace); } } return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java0000644000175000017500000003142310721374032027016 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionHandlerGeneral.java 469672 2006-10-31 21:56:19Z minchau $ */ package org.apache.xalan.extensions; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import java.net.URL; import java.net.URLConnection; import java.util.Hashtable; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.ref.DTMNodeList; import org.apache.xml.utils.StringVector; import org.apache.xml.utils.SystemIDResolver; import org.apache.xpath.XPathProcessorException; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.objects.XObject; /** * Class handling an extension namespace for XPath. Provides functions * to test a function's existence and call a function * * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com) * @xsl.usage internal */ public class ExtensionHandlerGeneral extends ExtensionHandler { /** script source to run (if any) */ private String m_scriptSrc; /** URL of source of script (if any) */ private String m_scriptSrcURL; /** functions of namespace */ private Hashtable m_functions = new Hashtable(); /** elements of namespace */ private Hashtable m_elements = new Hashtable(); // BSF objects used to invoke BSF by reflection. Do not import the BSF classes // since we don't want a compile dependency on BSF. /** BSF manager used to run scripts */ private Object m_engine; /** Engine call to invoke scripts */ private Method m_engineCall = null; // static fields /** BSFManager package name */ private static String BSF_MANAGER ; /** Default BSFManager name */ private static final String DEFAULT_BSF_MANAGER = "org.apache.bsf.BSFManager"; /** Property name to load the BSFManager class */ private static final String propName = "org.apache.xalan.extensions.bsf.BSFManager"; /** Integer Zero */ private static final Integer ZEROINT = new Integer(0); static{ BSF_MANAGER = ObjectFactory.lookUpFactoryClassName(propName, null, null); if (BSF_MANAGER == null){ BSF_MANAGER = DEFAULT_BSF_MANAGER; } } /** * Construct a new extension namespace handler given all the information * needed. * * @param namespaceUri the extension namespace URI that I'm implementing * @param elemNames Vector of element names * @param funcNames string containing list of functions of extension NS * @param scriptLang Scripting language of implementation * @param scriptSrcURL URL of source script * @param scriptSrc the actual script code (if any) * @param systemId * * @throws TransformerException */ public ExtensionHandlerGeneral( String namespaceUri, StringVector elemNames, StringVector funcNames, String scriptLang, String scriptSrcURL, String scriptSrc, String systemId) throws TransformerException { super(namespaceUri, scriptLang); if (elemNames != null) { Object junk = new Object(); int n = elemNames.size(); for (int i = 0; i < n; i++) { String tok = elemNames.elementAt(i); m_elements.put(tok, junk); // just stick it in there basically } } if (funcNames != null) { Object junk = new Object(); int n = funcNames.size(); for (int i = 0; i < n; i++) { String tok = funcNames.elementAt(i); m_functions.put(tok, junk); // just stick it in there basically } } m_scriptSrcURL = scriptSrcURL; m_scriptSrc = scriptSrc; if (m_scriptSrcURL != null) { URL url = null; try{ url = new URL(m_scriptSrcURL); } catch (java.net.MalformedURLException mue) { int indexOfColon = m_scriptSrcURL.indexOf(':'); int indexOfSlash = m_scriptSrcURL.indexOf('/'); if ((indexOfColon != -1) && (indexOfSlash != -1) && (indexOfColon < indexOfSlash)) { // The url is absolute. url = null; throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), mue); //"src attribute not yet supported for " //+ scriptLang); } else { try{ url = new URL(new URL(SystemIDResolver.getAbsoluteURI(systemId)), m_scriptSrcURL); } catch (java.net.MalformedURLException mue2) { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), mue2); //"src attribute not yet supported for " //+ scriptLang); } } } if (url != null) { try { URLConnection uc = url.openConnection(); InputStream is = uc.getInputStream(); byte []bArray = new byte[uc.getContentLength()]; is.read(bArray); m_scriptSrc = new String(bArray); } catch (IOException ioe) { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), ioe); //"src attribute not yet supported for " //+ scriptLang); } } } Object manager = null; try { manager = ObjectFactory.newInstance( BSF_MANAGER, ObjectFactory.findClassLoader(), true); } catch (ObjectFactory.ConfigurationError e) { e.printStackTrace(); } if (manager == null) { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_INIT_BSFMGR, null)); //"Could not initialize BSF manager"); } try { Method loadScriptingEngine = manager.getClass() .getMethod("loadScriptingEngine", new Class[]{ String.class }); m_engine = loadScriptingEngine.invoke(manager, new Object[]{ scriptLang }); Method engineExec = m_engine.getClass().getMethod("exec", new Class[]{ String.class, Integer.TYPE, Integer.TYPE, Object.class }); // "Compile" the program engineExec.invoke(m_engine, new Object[]{ "XalanScript", ZEROINT, ZEROINT, m_scriptSrc }); } catch (Exception e) { e.printStackTrace(); throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_CMPL_EXTENSN, null), e); //"Could not compile extension", e); } } /** * Tests whether a certain function name is known within this namespace. * @param function name of the function being tested * @return true if its known, false if not. */ public boolean isFunctionAvailable(String function) { return (m_functions.get(function) != null); } /** * Tests whether a certain element name is known within this namespace. * @param element name of the element being tested * @return true if its known, false if not. */ public boolean isElementAvailable(String element) { return (m_elements.get(element) != null); } /** * Process a call to a function. * * @param funcName Function name. * @param args The arguments of the function call. * @param methodKey A key that uniquely identifies this class and method call. * @param exprContext The context in which this expression is being executed. * * @return the return value of the function evaluation. * * @throws TransformerException if parsing trouble */ public Object callFunction( String funcName, Vector args, Object methodKey, ExpressionContext exprContext) throws TransformerException { Object[] argArray; try { argArray = new Object[args.size()]; for (int i = 0; i < argArray.length; i++) { Object o = args.get(i); argArray[i] = (o instanceof XObject) ? ((XObject) o).object() : o; o = argArray[i]; if(null != o && o instanceof DTMIterator) { argArray[i] = new DTMNodeList((DTMIterator)o); } } if (m_engineCall == null) { m_engineCall = m_engine.getClass().getMethod("call", new Class[]{ Object.class, String.class, Object[].class }); } return m_engineCall.invoke(m_engine, new Object[]{ null, funcName, argArray }); } catch (Exception e) { e.printStackTrace(); String msg = e.getMessage(); if (null != msg) { if (msg.startsWith("Stopping after fatal error:")) { msg = msg.substring("Stopping after fatal error:".length()); } // System.out.println("Call to extension function failed: "+msg); throw new TransformerException(e); } else { // Should probably make a TRaX Extension Exception. throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_CREATE_EXTENSN, new Object[]{funcName, e })); //"Could not create extension: " + funcName //+ " because of: " + e); } } } /** * Process a call to an XPath extension function * * @param extFunction The XPath extension function * @param args The arguments of the function call. * @param exprContext The context in which this expression is being executed. * @return the return value of the function evaluation. * @throws TransformerException */ public Object callFunction(FuncExtFunction extFunction, Vector args, ExpressionContext exprContext) throws TransformerException { return callFunction(extFunction.getFunctionName(), args, extFunction.getMethodKey(), exprContext); } /** * Process a call to this extension namespace via an element. As a side * effect, the results are sent to the TransformerImpl's result tree. * * @param localPart Element name's local part. * @param element The extension element being processed. * @param transformer Handle to TransformerImpl. * @param stylesheetTree The compiled stylesheet tree. * @param methodKey A key that uniquely identifies this class and method call. * * @throws XSLProcessorException thrown if something goes wrong * while running the extension handler. * @throws MalformedURLException if loading trouble * @throws FileNotFoundException if loading trouble * @throws IOException if loading trouble * @throws TransformerException if parsing trouble */ public void processElement( String localPart, ElemTemplateElement element, TransformerImpl transformer, Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException { Object result = null; XSLProcessorContext xpc = new XSLProcessorContext(transformer, stylesheetTree); try { Vector argv = new Vector(2); argv.add(xpc); argv.add(element); result = callFunction(localPart, argv, methodKey, transformer.getXPathContext().getExpressionContext()); } catch (XPathProcessorException e) { // e.printStackTrace (); throw new TransformerException(e.getMessage(), e); } if (result != null) { xpc.outputToResultTree(stylesheetTree, result); } } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java0000644000175000017500000004651510721374031027317 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionHandlerJavaClass.java 469672 2006-10-31 21:56:19Z minchau $ */ package org.apache.xalan.extensions; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.trace.ExtensionEvent; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.objects.XObject; /** * Represents an extension namespace for XPath that handles java classes. * It is recommended that the class URI be of the form: *
         *   xalan://fully.qualified.class.name
         * 
        * However, we do not enforce this. If the class name contains a * a /, we only use the part to the right of the rightmost slash. * In addition, we ignore any "class:" prefix. * Provides functions to test a function's existence and call a function. * Also provides functions to test an element's existence and call an * element. * * @author Gary L Peskin * @xsl.usage internal */ public class ExtensionHandlerJavaClass extends ExtensionHandlerJava { private Class m_classObj = null; /** * Provides a default Instance for use by elements that need to call * an instance method. */ private Object m_defaultInstance = null; /** * Construct a new extension namespace handler given all the information * needed. * @param namespaceUri the extension namespace URI that I'm implementing * @param scriptLang language of code implementing the extension * @param className the fully qualified class name of the class */ public ExtensionHandlerJavaClass(String namespaceUri, String scriptLang, String className) { super(namespaceUri, scriptLang, className); try { m_classObj = getClassForName(className); } catch (ClassNotFoundException e) { // For now, just let this go. We'll catch it when we try to invoke a method. } } /** * Tests whether a certain function name is known within this namespace. * Simply looks for a method with the appropriate name. There is * no information regarding the arguments to the function call or * whether the method implementing the function is a static method or * an instance method. * @param function name of the function being tested * @return true if its known, false if not. */ public boolean isFunctionAvailable(String function) { Method[] methods = m_classObj.getMethods(); int nMethods = methods.length; for (int i = 0; i < nMethods; i++) { if (methods[i].getName().equals(function)) return true; } return false; } /** * Tests whether a certain element name is known within this namespace. * Looks for a method with the appropriate name and signature. * This method examines both static and instance methods. * @param element name of the element being tested * @return true if its known, false if not. */ public boolean isElementAvailable(String element) { Method[] methods = m_classObj.getMethods(); int nMethods = methods.length; for (int i = 0; i < nMethods; i++) { if (methods[i].getName().equals(element)) { Class[] paramTypes = methods[i].getParameterTypes(); if ( (paramTypes.length == 2) && paramTypes[0].isAssignableFrom( org.apache.xalan.extensions.XSLProcessorContext.class) && paramTypes[1].isAssignableFrom( org.apache.xalan.templates.ElemExtensionCall.class) ) { return true; } } } return false; } /** * Process a call to a function in the java class represented by * this ExtensionHandlerJavaClass. * There are three possible types of calls: *
           *   Constructor:
           *     classns:new(arg1, arg2, ...)
           *
           *   Static method:
           *     classns:method(arg1, arg2, ...)
           *
           *   Instance method:
           *     classns:method(obj, arg1, arg2, ...)
           * 
        * We use the following rules to determine the type of call made: *
          *
        1. If the function name is "new", call the best constructor for * class represented by the namespace URI
        2. *
        3. If the first argument to the function is of the class specified * in the namespace or is a subclass of that class, look for the best * method of the class specified in the namespace with the specified * arguments. Compare all static and instance methods with the correct * method name. For static methods, use all arguments in the compare. * For instance methods, use all arguments after the first.
        4. *
        5. Otherwise, select the best static or instance method matching * all of the arguments. If the best method is an instance method, * call the function using a default object, creating it if needed.
        6. *
        * * @param funcName Function name. * @param args The arguments of the function call. * @param methodKey A key that uniquely identifies this class and method call. * @param exprContext The context in which this expression is being executed. * @return the return value of the function evaluation. * @throws TransformerException */ public Object callFunction (String funcName, Vector args, Object methodKey, ExpressionContext exprContext) throws TransformerException { Object[] methodArgs; Object[][] convertedArgs; Class[] paramTypes; try { TransformerImpl trans = (exprContext != null) ? (TransformerImpl)exprContext.getXPathContext().getOwnerObject() : null; if (funcName.equals("new")) { // Handle constructor call methodArgs = new Object[args.size()]; convertedArgs = new Object[1][]; for (int i = 0; i < methodArgs.length; i++) { methodArgs[i] = args.get(i); } Constructor c = null; if (methodKey != null) c = (Constructor) getFromCache(methodKey, null, methodArgs); if (c != null && !trans.getDebug()) { try { paramTypes = c.getParameterTypes(); MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext); return c.newInstance(convertedArgs[0]); } catch (InvocationTargetException ite) { throw ite; } catch(Exception e) { // Must not have been the right one } } c = MethodResolver.getConstructor(m_classObj, methodArgs, convertedArgs, exprContext); if (methodKey != null) putToCache(methodKey, null, methodArgs, c); if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, c, convertedArgs[0])); Object result; try { result = c.newInstance(convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, c, convertedArgs[0])); } return result; } else return c.newInstance(convertedArgs[0]); } else { int resolveType; Object targetObject = null; methodArgs = new Object[args.size()]; convertedArgs = new Object[1][]; for (int i = 0; i < methodArgs.length; i++) { methodArgs[i] = args.get(i); } Method m = null; if (methodKey != null) m = (Method) getFromCache(methodKey, null, methodArgs); if (m != null && !trans.getDebug()) { try { paramTypes = m.getParameterTypes(); MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext); if (Modifier.isStatic(m.getModifiers())) return m.invoke(null, convertedArgs[0]); else { // This is tricky. We get the actual number of target arguments (excluding any // ExpressionContext). If we passed in the same number, we need the implied object. int nTargetArgs = convertedArgs[0].length; if (ExpressionContext.class.isAssignableFrom(paramTypes[0])) nTargetArgs--; if (methodArgs.length <= nTargetArgs) return m.invoke(m_defaultInstance, convertedArgs[0]); else { targetObject = methodArgs[0]; if (targetObject instanceof XObject) targetObject = ((XObject) targetObject).object(); return m.invoke(targetObject, convertedArgs[0]); } } } catch (InvocationTargetException ite) { throw ite; } catch(Exception e) { // Must not have been the right one } } if (args.size() > 0) { targetObject = methodArgs[0]; if (targetObject instanceof XObject) targetObject = ((XObject) targetObject).object(); if (m_classObj.isAssignableFrom(targetObject.getClass())) resolveType = MethodResolver.DYNAMIC; else resolveType = MethodResolver.STATIC_AND_INSTANCE; } else { targetObject = null; resolveType = MethodResolver.STATIC_AND_INSTANCE; } m = MethodResolver.getMethod(m_classObj, funcName, methodArgs, convertedArgs, exprContext, resolveType); if (methodKey != null) putToCache(methodKey, null, methodArgs, m); if (MethodResolver.DYNAMIC == resolveType) { // First argument was object type if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(m, targetObject, convertedArgs[0]); Object result; try { result = m.invoke(targetObject, convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(m, targetObject, convertedArgs[0]); } return result; } else return m.invoke(targetObject, convertedArgs[0]); } else // First arg was not object. See if we need the implied object. { if (Modifier.isStatic(m.getModifiers())) { if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(m, null, convertedArgs[0]); Object result; try { result = m.invoke(null, convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(m, null, convertedArgs[0]); } return result; } else return m.invoke(null, convertedArgs[0]); } else { if (null == m_defaultInstance) { if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, m_classObj)); try { m_defaultInstance = m_classObj.newInstance(); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, m_classObj)); } } else m_defaultInstance = m_classObj.newInstance(); } if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(m, m_defaultInstance, convertedArgs[0]); Object result; try { result = m.invoke(m_defaultInstance, convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(m, m_defaultInstance, convertedArgs[0]); } return result; } else return m.invoke(m_defaultInstance, convertedArgs[0]); } } } } catch (InvocationTargetException ite) { Throwable resultException = ite; Throwable targetException = ite.getTargetException(); if (targetException instanceof TransformerException) throw ((TransformerException)targetException); else if (targetException != null) resultException = targetException; throw new TransformerException(resultException); } catch (Exception e) { // e.printStackTrace(); throw new TransformerException(e); } } /** * Process a call to an XPath extension function * * @param extFunction The XPath extension function * @param args The arguments of the function call. * @param exprContext The context in which this expression is being executed. * @return the return value of the function evaluation. * @throws TransformerException */ public Object callFunction(FuncExtFunction extFunction, Vector args, ExpressionContext exprContext) throws TransformerException { return callFunction(extFunction.getFunctionName(), args, extFunction.getMethodKey(), exprContext); } /** * Process a call to this extension namespace via an element. As a side * effect, the results are sent to the TransformerImpl's result tree. * We invoke the static or instance method in the class represented by * by the namespace URI. If we don't already have an instance of this class, * we create one upon the first call. * * @param localPart Element name's local part. * @param element The extension element being processed. * @param transformer Handle to TransformerImpl. * @param stylesheetTree The compiled stylesheet tree. * @param methodKey A key that uniquely identifies this element call. * @throws IOException if loading trouble * @throws TransformerException if parsing trouble */ public void processElement(String localPart, ElemTemplateElement element, TransformerImpl transformer, Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException { Object result = null; Method m = (Method) getFromCache(methodKey, null, null); if (null == m) { try { m = MethodResolver.getElementMethod(m_classObj, localPart); if ( (null == m_defaultInstance) && !Modifier.isStatic(m.getModifiers()) ) { if (transformer.getDebug()) { transformer.getTraceManager().fireExtensionEvent( new ExtensionEvent(transformer, m_classObj)); try { m_defaultInstance = m_classObj.newInstance(); } catch (Exception e) { throw e; } finally { transformer.getTraceManager().fireExtensionEndEvent( new ExtensionEvent(transformer, m_classObj)); } } else m_defaultInstance = m_classObj.newInstance(); } } catch (Exception e) { // e.printStackTrace (); throw new TransformerException (e.getMessage (), e); } putToCache(methodKey, null, null, m); } XSLProcessorContext xpc = new XSLProcessorContext(transformer, stylesheetTree); try { if (transformer.getDebug()) { transformer.getTraceManager().fireExtensionEvent(m, m_defaultInstance, new Object[] {xpc, element}); try { result = m.invoke(m_defaultInstance, new Object[] {xpc, element}); } catch (Exception e) { throw e; } finally { transformer.getTraceManager().fireExtensionEndEvent(m, m_defaultInstance, new Object[] {xpc, element}); } } else result = m.invoke(m_defaultInstance, new Object[] {xpc, element}); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof TransformerException) throw (TransformerException)targetException; else if (targetException != null) throw new TransformerException (targetException.getMessage (), targetException); else throw new TransformerException (e.getMessage (), e); } catch (Exception e) { // e.printStackTrace (); throw new TransformerException (e.getMessage (), e); } if (result != null) { xpc.outputToResultTree (stylesheetTree, result); } } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExpressionContext.java0000644000175000017500000000556310721374032025760 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExpressionContext.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import javax.xml.transform.ErrorListener; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeIterator; /** * An object that implements this interface can supply * information about the current XPath expression context. */ public interface ExpressionContext { /** * Get the current context node. * @return The current context node. */ public Node getContextNode(); /** * Get the current context node list. * @return An iterator for the current context list, as * defined in XSLT. */ public NodeIterator getContextNodes(); /** * Get the error listener. * @return The registered error listener. */ public ErrorListener getErrorListener(); /** * Get the value of a node as a number. * @param n Node to be converted to a number. May be null. * @return value of n as a number. */ public double toNumber(Node n); /** * Get the value of a node as a string. * @param n Node to be converted to a string. May be null. * @return value of n as a string, or an empty string if n is null. */ public String toString(Node n); /** * Get a variable based on it's qualified name. * * @param qname The qualified name of the variable. * * @return The evaluated value of the variable. * * @throws javax.xml.transform.TransformerException */ public XObject getVariableOrParam(org.apache.xml.utils.QName qname) throws javax.xml.transform.TransformerException; /** * Get the XPathContext that owns this ExpressionContext. * * Note: exslt:function requires the XPathContext to access * the variable stack and TransformerImpl. * * @return The current XPathContext. * @throws javax.xml.transform.TransformerException */ public org.apache.xpath.XPathContext getXPathContext() throws javax.xml.transform.TransformerException; } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java0000644000175000017500000004675410721374031027612 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionHandlerJavaPackage.java 469672 2006-10-31 21:56:19Z minchau $ */ package org.apache.xalan.extensions; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.trace.ExtensionEvent; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.objects.XObject; /** * Represents an extension namespace for XPath that handles java packages * that may be fully or partially specified. * It is recommended that the class URI be of one of the following forms: *
         *   xalan://partial.class.name
         *   xalan://
         *   http://xml.apache.org/xalan/java (which is the same as xalan://)
         * 
        * However, we do not enforce this. If the class name contains a * a /, we only use the part to the right of the rightmost slash. * In addition, we ignore any "class:" prefix. * Provides functions to test a function's existence and call a function. * Also provides functions to test an element's existence and call an * element. * * @author Gary L Peskin * * @xsl.usage internal */ public class ExtensionHandlerJavaPackage extends ExtensionHandlerJava { /** * Construct a new extension namespace handler given all the information * needed. * * @param namespaceUri the extension namespace URI that I'm implementing * @param scriptLang language of code implementing the extension * @param className the beginning of the class name of the class. This * should be followed by a dot (.) */ public ExtensionHandlerJavaPackage(String namespaceUri, String scriptLang, String className) { super(namespaceUri, scriptLang, className); } /** * Tests whether a certain function name is known within this namespace. * Since this is for a package, we concatenate the package name used when * this handler was created and the function name specified in the argument. * There is * no information regarding the arguments to the function call or * whether the method implementing the function is a static method or * an instance method. * @param function name of the function being tested * @return true if its known, false if not. */ public boolean isFunctionAvailable(String function) { try { String fullName = m_className + function; int lastDot = fullName.lastIndexOf("."); if (lastDot >= 0) { Class myClass = getClassForName(fullName.substring(0, lastDot)); Method[] methods = myClass.getMethods(); int nMethods = methods.length; function = fullName.substring(lastDot + 1); for (int i = 0; i < nMethods; i++) { if (methods[i].getName().equals(function)) return true; } } } catch (ClassNotFoundException cnfe) {} return false; } /** * Tests whether a certain element name is known within this namespace. * Looks for a method with the appropriate name and signature. * This method examines both static and instance methods. * @param element name of the element being tested * @return true if its known, false if not. */ public boolean isElementAvailable(String element) { try { String fullName = m_className + element; int lastDot = fullName.lastIndexOf("."); if (lastDot >= 0) { Class myClass = getClassForName(fullName.substring(0, lastDot)); Method[] methods = myClass.getMethods(); int nMethods = methods.length; element = fullName.substring(lastDot + 1); for (int i = 0; i < nMethods; i++) { if (methods[i].getName().equals(element)) { Class[] paramTypes = methods[i].getParameterTypes(); if ( (paramTypes.length == 2) && paramTypes[0].isAssignableFrom( org.apache.xalan.extensions.XSLProcessorContext.class) && paramTypes[1].isAssignableFrom( org.apache.xalan.templates.ElemExtensionCall.class) ) { return true; } } } } } catch (ClassNotFoundException cnfe) {} return false; } /** * Process a call to a function in the package java namespace. * There are three possible types of calls: *
           *   Constructor:
           *     packagens:class.name.new(arg1, arg2, ...)
           *
           *   Static method:
           *     packagens:class.name.method(arg1, arg2, ...)
           *
           *   Instance method:
           *     packagens:method(obj, arg1, arg2, ...)
           * 
        * We use the following rules to determine the type of call made: *
          *
        1. If the function name ends with a ".new", call the best constructor for * class whose name is formed by concatenating the value specified on * the namespace with the value specified in the function invocation * before ".new".
        2. *
        3. If the function name contains a period, call the best static method "method" * in the class whose name is formed by concatenating the value specified on * the namespace with the value specified in the function invocation.
        4. *
        5. Otherwise, call the best instance method "method" * in the class whose name is formed by concatenating the value specified on * the namespace with the value specified in the function invocation. * Note that a static method of the same * name will not be called in the current implementation. This * module does not verify that the obj argument is a member of the * package namespace.
        6. *
        * * @param funcName Function name. * @param args The arguments of the function call. * @param methodKey A key that uniquely identifies this class and method call. * @param exprContext The context in which this expression is being executed. * @return the return value of the function evaluation. * * @throws TransformerException if parsing trouble */ public Object callFunction (String funcName, Vector args, Object methodKey, ExpressionContext exprContext) throws TransformerException { String className; String methodName; Class classObj; Object targetObject; int lastDot = funcName.lastIndexOf("."); Object[] methodArgs; Object[][] convertedArgs; Class[] paramTypes; try { TransformerImpl trans = (exprContext != null) ? (TransformerImpl)exprContext.getXPathContext().getOwnerObject() : null; if (funcName.endsWith(".new")) { // Handle constructor call methodArgs = new Object[args.size()]; convertedArgs = new Object[1][]; for (int i = 0; i < methodArgs.length; i++) { methodArgs[i] = args.get(i); } Constructor c = (methodKey != null) ? (Constructor) getFromCache(methodKey, null, methodArgs) : null; if (c != null) { try { paramTypes = c.getParameterTypes(); MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext); return c.newInstance(convertedArgs[0]); } catch (InvocationTargetException ite) { throw ite; } catch(Exception e) { // Must not have been the right one } } className = m_className + funcName.substring(0, lastDot); try { classObj = getClassForName(className); } catch (ClassNotFoundException e) { throw new TransformerException(e); } c = MethodResolver.getConstructor(classObj, methodArgs, convertedArgs, exprContext); if (methodKey != null) putToCache(methodKey, null, methodArgs, c); if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, c, convertedArgs[0])); Object result; try { result = c.newInstance(convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, c, convertedArgs[0])); } return result; } else return c.newInstance(convertedArgs[0]); } else if (-1 != lastDot) { // Handle static method call methodArgs = new Object[args.size()]; convertedArgs = new Object[1][]; for (int i = 0; i < methodArgs.length; i++) { methodArgs[i] = args.get(i); } Method m = (methodKey != null) ? (Method) getFromCache(methodKey, null, methodArgs) : null; if (m != null && !trans.getDebug()) { try { paramTypes = m.getParameterTypes(); MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext); return m.invoke(null, convertedArgs[0]); } catch (InvocationTargetException ite) { throw ite; } catch(Exception e) { // Must not have been the right one } } className = m_className + funcName.substring(0, lastDot); methodName = funcName.substring(lastDot + 1); try { classObj = getClassForName(className); } catch (ClassNotFoundException e) { throw new TransformerException(e); } m = MethodResolver.getMethod(classObj, methodName, methodArgs, convertedArgs, exprContext, MethodResolver.STATIC_ONLY); if (methodKey != null) putToCache(methodKey, null, methodArgs, m); if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(m, null, convertedArgs[0]); Object result; try { result = m.invoke(null, convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(m, null, convertedArgs[0]); } return result; } else return m.invoke(null, convertedArgs[0]); } else { // Handle instance method call if (args.size() < 1) { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_INSTANCE_MTHD_CALL_REQUIRES, new Object[]{funcName })); //"Instance method call to method " + funcName //+ " requires an Object instance as first argument"); } targetObject = args.get(0); if (targetObject instanceof XObject) // Next level down for XObjects targetObject = ((XObject) targetObject).object(); methodArgs = new Object[args.size() - 1]; convertedArgs = new Object[1][]; for (int i = 0; i < methodArgs.length; i++) { methodArgs[i] = args.get(i+1); } Method m = (methodKey != null) ? (Method) getFromCache(methodKey, targetObject, methodArgs) : null; if (m != null) { try { paramTypes = m.getParameterTypes(); MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext); return m.invoke(targetObject, convertedArgs[0]); } catch (InvocationTargetException ite) { throw ite; } catch(Exception e) { // Must not have been the right one } } classObj = targetObject.getClass(); m = MethodResolver.getMethod(classObj, funcName, methodArgs, convertedArgs, exprContext, MethodResolver.INSTANCE_ONLY); if (methodKey != null) putToCache(methodKey, targetObject, methodArgs, m); if (trans != null && trans.getDebug()) { trans.getTraceManager().fireExtensionEvent(m, targetObject, convertedArgs[0]); Object result; try { result = m.invoke(targetObject, convertedArgs[0]); } catch (Exception e) { throw e; } finally { trans.getTraceManager().fireExtensionEndEvent(m, targetObject, convertedArgs[0]); } return result; } else return m.invoke(targetObject, convertedArgs[0]); } } catch (InvocationTargetException ite) { Throwable resultException = ite; Throwable targetException = ite.getTargetException(); if (targetException instanceof TransformerException) throw ((TransformerException)targetException); else if (targetException != null) resultException = targetException; throw new TransformerException(resultException); } catch (Exception e) { // e.printStackTrace(); throw new TransformerException(e); } } /** * Process a call to an XPath extension function * * @param extFunction The XPath extension function * @param args The arguments of the function call. * @param exprContext The context in which this expression is being executed. * @return the return value of the function evaluation. * @throws TransformerException */ public Object callFunction(FuncExtFunction extFunction, Vector args, ExpressionContext exprContext) throws TransformerException { return callFunction(extFunction.getFunctionName(), args, extFunction.getMethodKey(), exprContext); } /** * Process a call to this extension namespace via an element. As a side * effect, the results are sent to the TransformerImpl's result tree. * For this namespace, only static element methods are currently supported. * If instance methods are needed, please let us know your requirements. * @param localPart Element name's local part. * @param element The extension element being processed. * @param transformer Handle to TransformerImpl. * @param stylesheetTree The compiled stylesheet tree. * @param methodKey A key that uniquely identifies this element call. * @throws IOException if loading trouble * @throws TransformerException if parsing trouble */ public void processElement (String localPart, ElemTemplateElement element, TransformerImpl transformer, Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException { Object result = null; Class classObj; Method m = (Method) getFromCache(methodKey, null, null); if (null == m) { try { String fullName = m_className + localPart; int lastDot = fullName.lastIndexOf("."); if (lastDot < 0) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_ELEMENT_NAME, new Object[]{fullName })); //"Invalid element name specified " + fullName); try { classObj = getClassForName(fullName.substring(0, lastDot)); } catch (ClassNotFoundException e) { throw new TransformerException(e); } localPart = fullName.substring(lastDot + 1); m = MethodResolver.getElementMethod(classObj, localPart); if (!Modifier.isStatic(m.getModifiers())) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ELEMENT_NAME_METHOD_STATIC, new Object[]{fullName })); //"Element name method must be static " + fullName); } catch (Exception e) { // e.printStackTrace (); throw new TransformerException (e); } putToCache(methodKey, null, null, m); } XSLProcessorContext xpc = new XSLProcessorContext(transformer, stylesheetTree); try { if (transformer.getDebug()) { transformer.getTraceManager().fireExtensionEvent(m, null, new Object[] {xpc, element}); try { result = m.invoke(null, new Object[] {xpc, element}); } catch (Exception e) { throw e; } finally { transformer.getTraceManager().fireExtensionEndEvent(m, null, new Object[] {xpc, element}); } } else result = m.invoke(null, new Object[] {xpc, element}); } catch (InvocationTargetException ite) { Throwable resultException = ite; Throwable targetException = ite.getTargetException(); if (targetException instanceof TransformerException) throw ((TransformerException)targetException); else if (targetException != null) resultException = targetException; throw new TransformerException(resultException); } catch (Exception e) { // e.printStackTrace (); throw new TransformerException (e); } if (result != null) { xpc.outputToResultTree (stylesheetTree, result); } } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionNamespaceContext.java0000644000175000017500000001267510721374033027415 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xalan.extensions; import java.util.Iterator; import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; /** * A sample implementation of NamespaceContext, with support for * EXSLT extension functions and Java extension functions. */ public class ExtensionNamespaceContext implements NamespaceContext { public static final String EXSLT_PREFIX = "exslt"; public static final String EXSLT_URI = "http://exslt.org/common"; public static final String EXSLT_MATH_PREFIX = "math"; public static final String EXSLT_MATH_URI = "http://exslt.org/math"; public static final String EXSLT_SET_PREFIX = "set"; public static final String EXSLT_SET_URI = "http://exslt.org/sets"; public static final String EXSLT_STRING_PREFIX = "str"; public static final String EXSLT_STRING_URI = "http://exslt.org/strings"; public static final String EXSLT_DATETIME_PREFIX = "datetime"; public static final String EXSLT_DATETIME_URI = "http://exslt.org/dates-and-times"; public static final String EXSLT_DYNAMIC_PREFIX = "dyn"; public static final String EXSLT_DYNAMIC_URI = "http://exslt.org/dynamic"; public static final String JAVA_EXT_PREFIX = "java"; public static final String JAVA_EXT_URI = "http://xml.apache.org/xalan/java"; /** * Return the namespace uri for a given prefix */ public String getNamespaceURI(String prefix) { if (prefix == null) throw new IllegalArgumentException( XSLMessages.createMessage( XSLTErrorResources.ER_NAMESPACE_CONTEXT_NULL_PREFIX, null)); if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) return XMLConstants.NULL_NS_URI; else if (prefix.equals(XMLConstants.XML_NS_PREFIX)) return XMLConstants.XML_NS_URI; else if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) return XMLConstants.XMLNS_ATTRIBUTE_NS_URI; else if (prefix.equals(EXSLT_PREFIX)) return EXSLT_URI; else if (prefix.equals(EXSLT_MATH_PREFIX)) return EXSLT_MATH_URI; else if (prefix.equals(EXSLT_SET_PREFIX)) return EXSLT_SET_URI; else if (prefix.equals(EXSLT_STRING_PREFIX)) return EXSLT_STRING_URI; else if (prefix.equals(EXSLT_DATETIME_PREFIX)) return EXSLT_DATETIME_URI; else if (prefix.equals(EXSLT_DYNAMIC_PREFIX)) return EXSLT_DYNAMIC_URI; else if (prefix.equals(JAVA_EXT_PREFIX)) return JAVA_EXT_URI; else return XMLConstants.NULL_NS_URI; } /** * Return the prefix for a given namespace uri. */ public String getPrefix(String namespace) { if (namespace == null) throw new IllegalArgumentException( XSLMessages.createMessage( XSLTErrorResources.ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, null)); if (namespace.equals(XMLConstants.XML_NS_URI)) return XMLConstants.XML_NS_PREFIX; else if (namespace.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) return XMLConstants.XMLNS_ATTRIBUTE; else if (namespace.equals(EXSLT_URI)) return EXSLT_PREFIX; else if (namespace.equals(EXSLT_MATH_URI)) return EXSLT_MATH_PREFIX; else if (namespace.equals(EXSLT_SET_URI)) return EXSLT_SET_PREFIX; else if (namespace.equals(EXSLT_STRING_URI)) return EXSLT_STRING_PREFIX; else if (namespace.equals(EXSLT_DATETIME_URI)) return EXSLT_DATETIME_PREFIX; else if (namespace.equals(EXSLT_DYNAMIC_URI)) return EXSLT_DYNAMIC_PREFIX; else if (namespace.equals(JAVA_EXT_URI)) return JAVA_EXT_PREFIX; else return null; } public Iterator getPrefixes(String namespace) { final String result = getPrefix(namespace); return new Iterator () { private boolean isFirstIteration = (result != null); public boolean hasNext() { return isFirstIteration; } public Object next() { if (isFirstIteration) { isFirstIteration = false; return result; } else return null; } public void remove() { throw new UnsupportedOperationException(); } }; } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionsTable.java0000644000175000017500000001774710721374032025372 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionsTable.java 469672 2006-10-31 21:56:19Z minchau $ */ package org.apache.xalan.extensions; import java.util.Hashtable; import java.util.Vector; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.StylesheetRoot; import org.apache.xpath.XPathProcessorException; import org.apache.xpath.functions.FuncExtFunction; /** * Class holding a table registered extension namespace handlers * @xsl.usage internal */ public class ExtensionsTable { /** * Table of extensions that may be called from the expression language * via the call(name, ...) function. Objects are keyed on the call * name. * @xsl.usage internal */ public Hashtable m_extensionFunctionNamespaces = new Hashtable(); /** * The StylesheetRoot associated with this extensions table. */ private StylesheetRoot m_sroot; /** * The constructor (called from TransformerImpl) registers the * StylesheetRoot for the transformation and instantiates an * ExtensionHandler for each extension namespace. * @xsl.usage advanced */ public ExtensionsTable(StylesheetRoot sroot) throws javax.xml.transform.TransformerException { m_sroot = sroot; Vector extensions = m_sroot.getExtensions(); for (int i = 0; i < extensions.size(); i++) { ExtensionNamespaceSupport extNamespaceSpt = (ExtensionNamespaceSupport)extensions.get(i); ExtensionHandler extHandler = extNamespaceSpt.launch(); if (extHandler != null) addExtensionNamespace(extNamespaceSpt.getNamespace(), extHandler); } } /** * Get an ExtensionHandler object that represents the * given namespace. * @param extns A valid extension namespace. * * @return ExtensionHandler object that represents the * given namespace. */ public ExtensionHandler get(String extns) { return (ExtensionHandler) m_extensionFunctionNamespaces.get(extns); } /** * Register an extension namespace handler. This handler provides * functions for testing whether a function is known within the * namespace and also for invoking the functions. * * @param uri the URI for the extension. * @param extNS the extension handler. * @xsl.usage advanced */ public void addExtensionNamespace(String uri, ExtensionHandler extNS) { m_extensionFunctionNamespaces.put(uri, extNS); } /** * Execute the function-available() function. * @param ns the URI of namespace in which the function is needed * @param funcName the function name being tested * * @return whether the given function is available or not. * * @throws javax.xml.transform.TransformerException */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { boolean isAvailable = false; if (null != ns) { ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns); if (extNS != null) isAvailable = extNS.isFunctionAvailable(funcName); } return isAvailable; } /** * Execute the element-available() function. * @param ns the URI of namespace in which the function is needed * @param elemName name of element being tested * * @return whether the given element is available or not. * * @throws javax.xml.transform.TransformerException */ public boolean elementAvailable(String ns, String elemName) throws javax.xml.transform.TransformerException { boolean isAvailable = false; if (null != ns) { ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns); if (extNS != null) // defensive isAvailable = extNS.isElementAvailable(elemName); } return isAvailable; } /** * Handle an extension function. * @param ns the URI of namespace in which the function is needed * @param funcName the function name being called * @param argVec arguments to the function in a vector * @param methodKey a unique key identifying this function instance in the * stylesheet * @param exprContext a context which may be passed to an extension function * and provides callback functions to access various * areas in the environment * * @return result of executing the function * * @throws javax.xml.transform.TransformerException */ public Object extFunction(String ns, String funcName, Vector argVec, Object methodKey, ExpressionContext exprContext) throws javax.xml.transform.TransformerException { Object result = null; if (null != ns) { ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns); if (null != extNS) { try { result = extNS.callFunction(funcName, argVec, methodKey, exprContext); } catch (javax.xml.transform.TransformerException e) { throw e; } catch (Exception e) { throw new javax.xml.transform.TransformerException(e); } } else { throw new XPathProcessorException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN, new Object[]{ns, funcName })); //"Extension function '" + ns + ":" + funcName + "' is unknown"); } } return result; } /** * Handle an extension function. * @param extFunction the extension function * @param argVec arguments to the function in a vector * @param exprContext a context which may be passed to an extension function * and provides callback functions to access various * areas in the environment * * @return result of executing the function * * @throws javax.xml.transform.TransformerException */ public Object extFunction(FuncExtFunction extFunction, Vector argVec, ExpressionContext exprContext) throws javax.xml.transform.TransformerException { Object result = null; String ns = extFunction.getNamespace(); if (null != ns) { ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns); if (null != extNS) { try { result = extNS.callFunction(extFunction, argVec, exprContext); } catch (javax.xml.transform.TransformerException e) { throw e; } catch (Exception e) { throw new javax.xml.transform.TransformerException(e); } } else { throw new XPathProcessorException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN, new Object[]{ns, extFunction.getFunctionName()})); } } return result; } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionHandlerExsltFunction.java0000644000175000017500000001732010721374032030246 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionHandlerExsltFunction.java 469672 2006-10-31 21:56:19Z minchau $ */ package org.apache.xalan.extensions; import java.io.IOException; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemExsltFuncResult; import org.apache.xalan.templates.ElemExsltFunction; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.StylesheetRoot; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.utils.QName; import org.apache.xpath.ExpressionNode; import org.apache.xpath.XPathContext; import org.apache.xpath.functions.FuncExtFunction; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XString; /** * Execute EXSLT functions, determine the availability of EXSLT functions, and the * availability of an EXSLT result element. */ public class ExtensionHandlerExsltFunction extends ExtensionHandler { private String m_namespace; private StylesheetRoot m_stylesheet; private static final QName RESULTQNAME = new QName(Constants.S_EXSLT_FUNCTIONS_URL, Constants.EXSLT_ELEMNAME_FUNCRESULT_STRING); /** * Constructor called from ElemExsltFunction runtimeInit(). */ public ExtensionHandlerExsltFunction(String ns, StylesheetRoot stylesheet) { super(ns, "xml"); // required by ExtensionHandler interface. m_namespace = ns; m_stylesheet = stylesheet; } /** * Required by ExtensionHandler (an abstract method). No-op. */ public void processElement( String localPart, ElemTemplateElement element, TransformerImpl transformer, Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException {} /** * Get the ElemExsltFunction element associated with the * function. * * @param funcName Local name of the function. * @return the ElemExsltFunction element associated with * the function, null if none exists. */ public ElemExsltFunction getFunction(String funcName) { QName qname = new QName(m_namespace, funcName); ElemTemplate templ = m_stylesheet.getTemplateComposed(qname); if (templ != null && templ instanceof ElemExsltFunction) return (ElemExsltFunction) templ; else return null; } /** * Does the EXSLT function exist? * * @param funcName Local name of the function. * @return true if the function exists. */ public boolean isFunctionAvailable(String funcName) { return getFunction(funcName)!= null; } /** If an element-available() call applies to an EXSLT result element within * an EXSLT function element, return true. * * Note: The EXSLT function element is a template-level element, and * element-available() returns false for it. * * @param elemName name of the element. * @return true if the function is available. */ public boolean isElementAvailable(String elemName) { if (!(new QName(m_namespace, elemName).equals(RESULTQNAME))) { return false; } else { ElemTemplateElement elem = m_stylesheet.getFirstChildElem(); while (elem != null && elem != m_stylesheet) { if (elem instanceof ElemExsltFuncResult && ancestorIsFunction(elem)) return true; ElemTemplateElement nextElem = elem.getFirstChildElem(); if (nextElem == null) nextElem = elem.getNextSiblingElem(); if (nextElem == null) nextElem = elem.getParentElem(); elem = nextElem; } } return false; } /** * Determine whether the func:result element is within a func:function element. * If not, it is illegal. */ private boolean ancestorIsFunction(ElemTemplateElement child) { while (child.getParentElem() != null && !(child.getParentElem() instanceof StylesheetRoot)) { if (child.getParentElem() instanceof ElemExsltFunction) return true; child = child.getParentElem(); } return false; } /** * Execute the EXSLT function and return the result value. * * @param funcName Name of the EXSLT function. * @param args The arguments of the function call. * @param methodKey Not used. * @param exprContext Used to get the XPathContext. * @return the return value of the function evaluation. * @throws TransformerException */ public Object callFunction( String funcName, Vector args, Object methodKey, ExpressionContext exprContext) throws TransformerException { throw new TransformerException("This method should not be called."); } /** * Execute the EXSLT function and return the result value. * * @param extFunction The XPath extension function * @param args The arguments of the function call. * @param exprContext The context in which this expression is being executed. * @return the return value of the function evaluation. * @throws TransformerException */ public Object callFunction(FuncExtFunction extFunction, Vector args, ExpressionContext exprContext) throws TransformerException { // Find the template which invokes this EXSLT function. ExpressionNode parent = extFunction.exprGetParent(); while (parent != null && !(parent instanceof ElemTemplate)) { parent = parent.exprGetParent(); } ElemTemplate callerTemplate = (parent != null) ? (ElemTemplate)parent: null; XObject[] methodArgs; methodArgs = new XObject[args.size()]; try { for (int i = 0; i < methodArgs.length; i++) { methodArgs[i] = XObject.create(args.get(i)); } ElemExsltFunction elemFunc = getFunction(extFunction.getFunctionName()); if (null != elemFunc) { XPathContext context = exprContext.getXPathContext(); TransformerImpl transformer = (TransformerImpl)context.getOwnerObject(); transformer.pushCurrentFuncResult(null); elemFunc.execute(transformer, methodArgs); XObject val = (XObject)transformer.popCurrentFuncResult(); return (val == null) ? new XString("") // value if no result element. : val; } else { throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_FUNCTION_NOT_FOUND, new Object[] {extFunction.getFunctionName()})); } } catch (TransformerException e) { throw e; } catch (Exception e) { throw new TransformerException(e); } } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/package.html0000644000175000017500000000173310721374031023664 0ustar mkochmkoch Xalan Extension Mechanism Package.

        Implementation of Xalan Extension Mechanism.

        libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionNamespacesManager.java0000644000175000017500000002631710721374033027524 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionNamespacesManager.java 469672 2006-10-31 21:56:19Z minchau $ */ package org.apache.xalan.extensions; import java.util.Vector; import org.apache.xalan.templates.Constants; /** * Used during assembly of a stylesheet to collect the information for each * extension namespace that is required during the transformation process * to generate an {@link ExtensionHandler}. * */ public class ExtensionNamespacesManager { /** * Vector of ExtensionNamespaceSupport objects to be used to generate ExtensionHandlers. */ private Vector m_extensions = new Vector(); /** * Vector of ExtensionNamespaceSupport objects for predefined ExtensionNamespaces. Elements * from this vector are added to the m_extensions vector when encountered in the stylesheet. */ private Vector m_predefExtensions = new Vector(7); /** * Vector of extension namespaces for which sufficient information is not yet available to * complete the registration process. */ private Vector m_unregisteredExtensions = new Vector(); /** * An ExtensionNamespacesManager is instantiated the first time an extension function or * element is found in the stylesheet. During initialization, a vector of ExtensionNamespaceSupport * objects is created, one for each predefined extension namespace. */ public ExtensionNamespacesManager() { setPredefinedNamespaces(); } /** * If necessary, register the extension namespace found compiling a function or * creating an extension element. * * If it is a predefined namespace, create a * support object to simplify the instantiate of an appropriate ExtensionHandler * during transformation runtime. Otherwise, add the namespace, if necessary, * to a vector of undefined extension namespaces, to be defined later. * */ public void registerExtension(String namespace) { if (namespaceIndex(namespace, m_extensions) == -1) { int predef = namespaceIndex(namespace, m_predefExtensions); if (predef !=-1) m_extensions.add(m_predefExtensions.get(predef)); else if (!(m_unregisteredExtensions.contains(namespace))) m_unregisteredExtensions.add(namespace); } } /** * Register the extension namespace for an ElemExtensionDecl or ElemFunction, * and prepare a support object to launch the appropriate ExtensionHandler at * transformation runtime. */ public void registerExtension(ExtensionNamespaceSupport extNsSpt) { String namespace = extNsSpt.getNamespace(); if (namespaceIndex(namespace, m_extensions) == -1) { m_extensions.add(extNsSpt); if (m_unregisteredExtensions.contains(namespace)) m_unregisteredExtensions.remove(namespace); } } /** * Get the index for a namespace entry in the extension namespace Vector, -1 if * no such entry yet exists. */ public int namespaceIndex(String namespace, Vector extensions) { for (int i = 0; i < extensions.size(); i++) { if (((ExtensionNamespaceSupport)extensions.get(i)).getNamespace().equals(namespace)) return i; } return -1; } /** * Get the vector of extension namespaces. Used to provide * the extensions table access to a list of extension * namespaces encountered during composition of a stylesheet. */ public Vector getExtensions() { return m_extensions; } /** * Attempt to register any unregistered extension namespaces. */ public void registerUnregisteredNamespaces() { for (int i = 0; i < m_unregisteredExtensions.size(); i++) { String ns = (String)m_unregisteredExtensions.get(i); ExtensionNamespaceSupport extNsSpt = defineJavaNamespace(ns); if (extNsSpt != null) m_extensions.add(extNsSpt); } } /** * For any extension namespace that is not either predefined or defined * by a "component" declaration or exslt function declaration, attempt * to create an ExtensionNamespaceSuport object for the appropriate * Java class or Java package Extension Handler. * * Called by StylesheetRoot.recompose(), after all ElemTemplate compose() * operations have taken place, in order to set up handlers for * the remaining extension namespaces. * * @param ns The extension namespace URI. * @return An ExtensionNamespaceSupport object for this namespace * (which defines the ExtensionHandler to be used), or null if such * an object cannot be created. * * @throws javax.xml.transform.TransformerException */ public ExtensionNamespaceSupport defineJavaNamespace(String ns) { return defineJavaNamespace(ns, ns); } public ExtensionNamespaceSupport defineJavaNamespace(String ns, String classOrPackage) { if(null == ns || ns.trim().length() == 0) // defensive. I don't think it's needed. -sb return null; // Prepare the name of the actual class or package, stripping // out any leading "class:". Next, see if there is a /. If so, // only look at the text to the right of the rightmost /. String className = classOrPackage; if (className.startsWith("class:")) className = className.substring(6); int lastSlash = className.lastIndexOf("/"); if (-1 != lastSlash) className = className.substring(lastSlash + 1); // The className can be null here, and can cause an error in getClassForName // in JDK 1.8. if(null == className || className.trim().length() == 0) return null; try { ExtensionHandler.getClassForName(className); return new ExtensionNamespaceSupport( ns, "org.apache.xalan.extensions.ExtensionHandlerJavaClass", new Object[]{ns, "javaclass", className}); } catch (ClassNotFoundException e) { return new ExtensionNamespaceSupport( ns, "org.apache.xalan.extensions.ExtensionHandlerJavaPackage", new Object[]{ns, "javapackage", className + "."}); } } /* public ExtensionNamespaceSupport getSupport(int index, Vector extensions) { return (ExtensionNamespaceSupport)extensions.elementAt(index); } */ /** * Set up a Vector for predefined extension namespaces. */ private void setPredefinedNamespaces() { String uri = Constants.S_EXTENSIONS_JAVA_URL; String handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaPackage"; String lang = "javapackage"; String lib = ""; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXTENSIONS_OLD_JAVA_URL; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXTENSIONS_LOTUSXSL_JAVA_URL; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_BUILTIN_EXTENSIONS_URL; handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaClass"; lang = "javaclass"; // for remaining predefined extension namespaces. lib = "org.apache.xalan.lib.Extensions"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_BUILTIN_OLD_EXTENSIONS_URL; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); // Xalan extension namespaces (redirect, pipe and SQL). uri = Constants.S_EXTENSIONS_REDIRECT_URL; lib = "org.apache.xalan.lib.Redirect"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXTENSIONS_PIPE_URL; lib = "org.apache.xalan.lib.PipeDocument"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXTENSIONS_SQL_URL; lib = "org.apache.xalan.lib.sql.XConnection"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); //EXSLT namespaces (not including EXSLT function namespaces which are // registered by the associated ElemFunction. uri = Constants.S_EXSLT_COMMON_URL; lib = "org.apache.xalan.lib.ExsltCommon"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXSLT_MATH_URL; lib = "org.apache.xalan.lib.ExsltMath"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXSLT_SETS_URL; lib = "org.apache.xalan.lib.ExsltSets"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXSLT_DATETIME_URL; lib = "org.apache.xalan.lib.ExsltDatetime"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXSLT_DYNAMIC_URL; lib = "org.apache.xalan.lib.ExsltDynamic"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); uri = Constants.S_EXSLT_STRINGS_URL; lib = "org.apache.xalan.lib.ExsltStrings"; m_predefExtensions.add(new ExtensionNamespaceSupport(uri, handlerClassName, new Object[]{uri, lang, lib})); } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ExtensionNamespaceSupport.java0000644000175000017500000000672510721374031027442 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtensionNamespaceSupport.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.lang.reflect.Constructor; import javax.xml.transform.TransformerException; /** * During styleseet composition, an ExtensionNamespaceSupport object is created for each extension * namespace the stylesheet uses. At the beginning of a transformation, TransformerImpl generates * an ExtensionHandler for each of these objects and adds an entry to the ExtensionsTable hashtable. */ public class ExtensionNamespaceSupport { // Namespace, ExtensionHandler class name, constructor signature // and arguments. String m_namespace = null; String m_handlerClass = null; Class [] m_sig = null; Object [] m_args = null; public ExtensionNamespaceSupport(String namespace, String handlerClass, Object[] constructorArgs) { m_namespace = namespace; m_handlerClass = handlerClass; m_args = constructorArgs; // Create the constructor signature. m_sig = new Class[m_args.length]; for (int i = 0; i < m_args.length; i++) { if (m_args[i] != null) m_sig[i] = m_args[i].getClass();//System.out.println("arg class " + i + " " +m_sig[i]); else // If an arguments is null, pick the constructor later. { m_sig = null; break; } } } public String getNamespace() { return m_namespace; } /** * Launch the ExtensionHandler that this ExtensionNamespaceSupport object defines. */ public ExtensionHandler launch() throws TransformerException { ExtensionHandler handler = null; try { Class cl = ExtensionHandler.getClassForName(m_handlerClass); Constructor con = null; //System.out.println("class " + cl + " " + m_args + " " + m_args.length + " " + m_sig); if (m_sig != null) con = cl.getConstructor(m_sig); else // Pick the constructor based on number of args. { Constructor[] cons = cl.getConstructors(); for (int i = 0; i < cons.length; i ++) { if (cons[i].getParameterTypes().length == m_args.length) { con = cons[i]; break; } } } // System.out.println("constructor " + con); if (con != null) handler = (ExtensionHandler)con.newInstance(m_args); else throw new TransformerException("ExtensionHandler constructor not found"); } catch (Exception e) { throw new TransformerException(e); } return handler; } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/XSLProcessorContext.java0000644000175000017500000002321210721374030026154 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLProcessorContext.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.transformer.ClonerToResultTree; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMIterator; import org.apache.xalan.serialize.SerializerUtils; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.QName; import org.apache.xpath.XPathContext; import org.apache.xpath.axes.DescendantIterator; import org.apache.xpath.axes.OneStepIterator; import org.apache.xpath.objects.XBoolean; import org.apache.xpath.objects.XNodeSet; import org.apache.xpath.objects.XNumber; import org.apache.xpath.objects.XObject; import org.apache.xpath.objects.XRTreeFrag; import org.apache.xpath.objects.XString; import org.w3c.dom.DocumentFragment; import org.w3c.dom.traversal.NodeIterator; // import org.apache.xalan.xslt.*; /** * Provides transformer context to be passed to an extension element. * * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com) * @xsl.usage general */ public class XSLProcessorContext { /** * Create a processor context to be passed to an extension. * (Notice it is a package-only constructor). * * @param transformer non-null transformer instance * @param stylesheetTree The owning stylesheet */ public XSLProcessorContext(TransformerImpl transformer, Stylesheet stylesheetTree) { this.transformer = transformer; this.stylesheetTree = stylesheetTree; // %TBD% org.apache.xpath.XPathContext xctxt = transformer.getXPathContext(); this.mode = transformer.getMode(); this.sourceNode = xctxt.getCurrentNode(); this.sourceTree = xctxt.getDTM(this.sourceNode); } /** An instance of a transformer */ private TransformerImpl transformer; /** * Get the transformer. * * @return the transformer instance for this context */ public TransformerImpl getTransformer() { return transformer; } /** The owning stylesheet for this context */ private Stylesheet stylesheetTree; /** * Get the Stylesheet being executed. * * @return the Stylesheet being executed. */ public Stylesheet getStylesheet() { return stylesheetTree; } /** The root of the source tree being executed. */ private org.apache.xml.dtm.DTM sourceTree; /** * Get the root of the source tree being executed. * * @return the root of the source tree being executed. */ public org.w3c.dom.Node getSourceTree() { return sourceTree.getNode(sourceTree.getDocumentRoot(sourceNode)); } /** the current context node. */ private int sourceNode; /** * Get the current context node. * * @return the current context node. */ public org.w3c.dom.Node getContextNode() { return sourceTree.getNode(sourceNode); } /** the current mode being executed. */ private QName mode; /** * Get the current mode being executed. * * @return the current mode being executed. */ public QName getMode() { return mode; } /** * Output an object to the result tree by doing the right conversions. * This is public for access by extensions. * * * @param stylesheetTree The owning stylesheet * @param obj the Java object to output. If its of an X type * then that conversion is done first and then sent out. * * @throws TransformerException * @throws java.io.FileNotFoundException * @throws java.io.IOException * @throws java.net.MalformedURLException */ public void outputToResultTree(Stylesheet stylesheetTree, Object obj) throws TransformerException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException { try { SerializationHandler rtreeHandler = transformer.getResultTreeHandler(); XPathContext xctxt = transformer.getXPathContext(); XObject value; // Make the return object into an XObject because it // will be easier below. One of the reasons to do this // is to keep all the conversion functionality in the // XObject classes. if (obj instanceof XObject) { value = (XObject) obj; } else if (obj instanceof String) { value = new XString((String) obj); } else if (obj instanceof Boolean) { value = new XBoolean(((Boolean) obj).booleanValue()); } else if (obj instanceof Double) { value = new XNumber(((Double) obj).doubleValue()); } else if (obj instanceof DocumentFragment) { int handle = xctxt.getDTMHandleFromNode((DocumentFragment)obj); value = new XRTreeFrag(handle, xctxt); } else if (obj instanceof DTM) { DTM dtm = (DTM)obj; DTMIterator iterator = new DescendantIterator(); // %%ISSUE%% getDocument may not be valid for DTMs shared by multiple // document trees, eg RTFs. But in that case, we shouldn't be trying // to iterate over the whole DTM; we should be iterating over // dtm.getDocumentRoot(rootNodeHandle), and folks should have told us // this by passing a more appropriate type. iterator.setRoot(dtm.getDocument(), xctxt); value = new XNodeSet(iterator); } else if (obj instanceof DTMAxisIterator) { DTMAxisIterator iter = (DTMAxisIterator)obj; DTMIterator iterator = new OneStepIterator(iter, -1); value = new XNodeSet(iterator); } else if (obj instanceof DTMIterator) { value = new XNodeSet((DTMIterator) obj); } else if (obj instanceof NodeIterator) { value = new XNodeSet(new org.apache.xpath.NodeSetDTM(((NodeIterator)obj), xctxt)); } else if (obj instanceof org.w3c.dom.Node) { value = new XNodeSet(xctxt.getDTMHandleFromNode((org.w3c.dom.Node) obj), xctxt.getDTMManager()); } else { value = new XString(obj.toString()); } int type = value.getType(); String s; switch (type) { case XObject.CLASS_BOOLEAN : case XObject.CLASS_NUMBER : case XObject.CLASS_STRING : s = value.str(); rtreeHandler.characters(s.toCharArray(), 0, s.length()); break; case XObject.CLASS_NODESET : // System.out.println(value); DTMIterator nl = value.iter(); int pos; while (DTM.NULL != (pos = nl.nextNode())) { DTM dtm = nl.getDTM(pos); int top = pos; while (DTM.NULL != pos) { rtreeHandler.flushPending(); ClonerToResultTree.cloneToResultTree(pos, dtm.getNodeType(pos), dtm, rtreeHandler, true); int nextNode = dtm.getFirstChild(pos); while (DTM.NULL == nextNode) { if (DTM.ELEMENT_NODE == dtm.getNodeType(pos)) { rtreeHandler.endElement("", "", dtm.getNodeName(pos)); } if (top == pos) break; nextNode = dtm.getNextSibling(pos); if (DTM.NULL == nextNode) { pos = dtm.getParent(pos); if (top == pos) { if (DTM.ELEMENT_NODE == dtm.getNodeType(pos)) { rtreeHandler.endElement("", "", dtm.getNodeName(pos)); } nextNode = DTM.NULL; break; } } } pos = nextNode; } } break; case XObject.CLASS_RTREEFRAG : SerializerUtils.outputResultTreeFragment( rtreeHandler, value, transformer.getXPathContext()); // rtreeHandler.outputResultTreeFragment(value, // transformer.getXPathContext()); break; } } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } } /** * I need a "Node transformNode (Node)" method somewhere that the * user can call to process the transformation of a node but not * serialize out automatically. ???????????????? * * Does ElemTemplateElement.executeChildTemplates() cut it? It sends * results out to the stream directly, so that could be a problem. */ } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/XPathFunctionResolverImpl.java0000644000175000017500000001076310721374033027351 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xalan.extensions; import javax.xml.namespace.QName; import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionResolver; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; /** * A sample implementation of XPathFunctionResolver, with support for * EXSLT extension functions and Java extension functions. */ public class XPathFunctionResolverImpl implements XPathFunctionResolver { /** * Resolve an extension function from the qualified name and arity. */ public XPathFunction resolveFunction(QName qname, int arity) { if (qname == null) throw new NullPointerException( XSLMessages.createMessage( XSLTErrorResources.ER_XPATH_RESOLVER_NULL_QNAME, null)); if (arity < 0) throw new IllegalArgumentException( XSLMessages.createMessage( XSLTErrorResources.ER_XPATH_RESOLVER_NEGATIVE_ARITY, null)); String uri = qname.getNamespaceURI(); if (uri == null || uri.length() == 0) return null; String className = null; String methodName = null; if (uri.startsWith("http://exslt.org")) { className = getEXSLTClassName(uri); methodName = qname.getLocalPart(); } else if (!uri.equals(ExtensionNamespaceContext.JAVA_EXT_URI)) { int lastSlash = className.lastIndexOf("/"); if (-1 != lastSlash) className = className.substring(lastSlash + 1); } String localPart = qname.getLocalPart(); int lastDotIndex = localPart.lastIndexOf('.'); if (lastDotIndex > 0) { if (className != null) className = className + "." + localPart.substring(0, lastDotIndex); else className = localPart.substring(0, lastDotIndex); methodName = localPart.substring(lastDotIndex + 1); } else methodName = localPart; if(null == className || className.trim().length() == 0 || null == methodName || methodName.trim().length() == 0) return null; ExtensionHandler handler = null; try { ExtensionHandler.getClassForName(className); handler = new ExtensionHandlerJavaClass(uri, "javaclass", className); } catch (ClassNotFoundException e) { return null; } return new XPathFunctionImpl(handler, methodName); } /** * Return the implementation class name of an EXSLT extension from * a given namespace uri. The uri must starts with "http://exslt.org". */ private String getEXSLTClassName(String uri) { if (uri.equals(ExtensionNamespaceContext.EXSLT_MATH_URI)) return "org.apache.xalan.lib.ExsltMath"; else if (uri.equals(ExtensionNamespaceContext.EXSLT_SET_URI)) return "org.apache.xalan.lib.ExsltSets"; else if (uri.equals(ExtensionNamespaceContext.EXSLT_STRING_URI)) return "org.apache.xalan.lib.ExsltStrings"; else if (uri.equals(ExtensionNamespaceContext.EXSLT_DATETIME_URI)) return "org.apache.xalan.lib.ExsltDatetime"; else if (uri.equals(ExtensionNamespaceContext.EXSLT_DYNAMIC_URI)) return "org.apache.xalan.lib.ExsltDynamic"; else if (uri.equals(ExtensionNamespaceContext.EXSLT_URI)) return "org.apache.xalan.lib.ExsltCommon"; else return null; } } libxalan2-java-2.7.1/src/org/apache/xalan/extensions/ObjectFactory.java0000644000175000017500000006376510721374031025021 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468637 2006-10-28 06:51:02Z minchau $ */ package org.apache.xalan.extensions; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468637 2006-10-28 06:51:02Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 8564305128443551853L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/0000755000175000017500000000000010736146354020350 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/ProcessorVersion.java0000644000175000017500000000375610721374032024541 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorVersion.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; /** * Admin class that assigns a version number to the XSLTC software. * The version number is made up from three fields as in: * MAJOR.MINOR[.DELTA]. Fields are incremented based on the following: * DELTA field: changes for each bug fix, developer fixing the bug should * increment this field. * MINOR field: API changes or a milestone culminating from several * bug fixes. DELTA field goes to zero and MINOR is * incremented such as: {1.0,1.0.1,1.0.2,1.0.3,...1.0.18,1.1} * MAJOR field: milestone culminating in fundamental API changes or * architectural changes. MINOR field goes to zero * and MAJOR is incremented such as: {...,1.1.14,1.2,2.0} * Stability of a release follows: X.0 > X.X > X.X.X * @author G. Todd Miller */ public class ProcessorVersion { private static int MAJOR = 1; private static int MINOR = 0; private static int DELTA = 0; public static void main(String[] args) { System.out.println("XSLTC version " + MAJOR + "." + MINOR + ((DELTA > 0) ? ("."+DELTA) : (""))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/TransletException.java0000644000175000017500000000263410721374030024657 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransletException.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; import org.xml.sax.SAXException; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class TransletException extends SAXException { static final long serialVersionUID = -878916829521217293L; public TransletException() { super("Translet error"); } public TransletException(Exception e) { super(e.toString()); } public TransletException(String message) { super(message); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/DOMEnhancedForDTM.java0000644000175000017500000000372610721374033024273 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMEnhancedForDTM.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; /** * Interface for SAXImpl which adds methods used at run-time, over and above * those provided by the XSLTC DOM interface. An attempt to avoid the current * "Is the DTM a DOM, if so is it a SAXImpl, . . . * which was producing some ugly replicated code * and introducing bugs where that multipathing had not been * done. This makes it easier to provide other DOM/DOMEnhancedForDTM * implementations, rather than hard-wiring XSLTC to SAXImpl. * * @author Joseph Kesselman * */ public interface DOMEnhancedForDTM extends DOM { public short[] getMapping(String[] names, String[] uris, int[] types); public int[] getReverseMapping(String[] names, String[] uris, int[] types); public short[] getNamespaceMapping(String[] namespaces); public short[] getReverseNamespaceMapping(String[] namespaces); public String getDocumentURI(); public void setDocumentURI(String uri); public int getExpandedTypeID2(int nodeHandle); public boolean hasDOMSource(); public int getElementById(String idString); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/StripFilter.java0000644000175000017500000000212110721374030023442 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StripFilter.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface StripFilter { public boolean stripSpace(DOM dom, int node, int type); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/CollatorFactory.java0000644000175000017500000000233310721374031024310 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CollatorFactory.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; import java.text.Collator; import java.util.Locale; /** * @author W. Eliot Kimber (eliot@isogen.com) * @author Santiago Pericas-Geertsen */ public interface CollatorFactory { public Collator getCollator(String lang, String country); public Collator getCollator(Locale locale); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/0000755000175000017500000000000010736146354022162 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/StepPattern.java0000644000175000017500000004236410721374033025276 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StepPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.classfile.Field; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.GOTO_W; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.IFNE; import org.apache.bcel.generic.IFNONNULL; import org.apache.bcel.generic.IF_ICMPEQ; import org.apache.bcel.generic.IF_ICMPLT; import org.apache.bcel.generic.IF_ICMPNE; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUTFIELD; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Erwin Bolwidt */ class StepPattern extends RelativePathPattern { private static final int NO_CONTEXT = 0; private static final int SIMPLE_CONTEXT = 1; private static final int GENERAL_CONTEXT = 2; protected final int _axis; protected final int _nodeType; protected Vector _predicates; private Step _step = null; private boolean _isEpsilon = false; private int _contextCase; private double _priority = Double.MAX_VALUE; public StepPattern(int axis, int nodeType, Vector predicates) { _axis = axis; _nodeType = nodeType; _predicates = predicates; } public void setParser(Parser parser) { super.setParser(parser); if (_predicates != null) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Predicate exp = (Predicate)_predicates.elementAt(i); exp.setParser(parser); exp.setParent(this); } } } public int getNodeType() { return _nodeType; } public void setPriority(double priority) { _priority = priority; } public StepPattern getKernelPattern() { return this; } public boolean isWildcard() { return _isEpsilon && hasPredicates() == false; } public StepPattern setPredicates(Vector predicates) { _predicates = predicates; return(this); } protected boolean hasPredicates() { return _predicates != null && _predicates.size() > 0; } public double getDefaultPriority() { if (_priority != Double.MAX_VALUE) { return _priority; } if (hasPredicates()) { return 0.5; } else { switch(_nodeType) { case -1: return -0.5; // node() case 0: return 0.0; default: return (_nodeType >= NodeTest.GTYPE) ? 0.0 : -0.5; } } } public int getAxis() { return _axis; } public void reduceKernelPattern() { _isEpsilon = true; } public String toString() { final StringBuffer buffer = new StringBuffer("stepPattern(\""); buffer.append(Axis.getNames(_axis)) .append("\", ") .append(_isEpsilon ? ("epsilon{" + Integer.toString(_nodeType) + "}") : Integer.toString(_nodeType)); if (_predicates != null) buffer.append(", ").append(_predicates.toString()); return buffer.append(')').toString(); } private int analyzeCases() { boolean noContext = true; final int n = _predicates.size(); for (int i = 0; i < n && noContext; i++) { Predicate pred = (Predicate) _predicates.elementAt(i); if (pred.isNthPositionFilter() || pred.hasPositionCall() || pred.hasLastCall()) { noContext = false; } } if (noContext) { return NO_CONTEXT; } else if (n == 1) { return SIMPLE_CONTEXT; } return GENERAL_CONTEXT; } private String getNextFieldName() { return "__step_pattern_iter_" + getXSLTC().nextStepPatternSerial(); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (hasPredicates()) { // Type check all the predicates (e -> position() = e) final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Predicate pred = (Predicate)_predicates.elementAt(i); pred.typeCheck(stable); } // Analyze context cases _contextCase = analyzeCases(); Step step = null; // Create an instance of Step to do the translation if (_contextCase == SIMPLE_CONTEXT) { Predicate pred = (Predicate)_predicates.elementAt(0); if (pred.isNthPositionFilter()) { _contextCase = GENERAL_CONTEXT; step = new Step(_axis, _nodeType, _predicates); } else { step = new Step(_axis, _nodeType, null); } } else if (_contextCase == GENERAL_CONTEXT) { final int len = _predicates.size(); for (int i = 0; i < len; i++) { ((Predicate)_predicates.elementAt(i)).dontOptimize(); } step = new Step(_axis, _nodeType, _predicates); } if (step != null) { step.setParser(getParser()); step.typeCheck(stable); _step = step; } } return _axis == Axis.CHILD ? Type.Element : Type.Attribute; } private void translateKernel(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_nodeType == DTM.ELEMENT_NODE) { final int check = cpg.addInterfaceMethodref(DOM_INTF, "isElement", "(I)Z"); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(new INVOKEINTERFACE(check, 2)); // Need to allow for long jumps here final BranchHandle icmp = il.append(new IFNE(null)); _falseList.add(il.append(new GOTO_W(null))); icmp.setTarget(il.append(NOP)); } else if (_nodeType == DTM.ATTRIBUTE_NODE) { final int check = cpg.addInterfaceMethodref(DOM_INTF, "isAttribute", "(I)Z"); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(new INVOKEINTERFACE(check, 2)); // Need to allow for long jumps here final BranchHandle icmp = il.append(new IFNE(null)); _falseList.add(il.append(new GOTO_W(null))); icmp.setTarget(il.append(NOP)); } else { // context node is on the stack final int getEType = cpg.addInterfaceMethodref(DOM_INTF, "getExpandedTypeID", "(I)I"); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(new INVOKEINTERFACE(getEType, 2)); il.append(new PUSH(cpg, _nodeType)); // Need to allow for long jumps here final BranchHandle icmp = il.append(new IF_ICMPEQ(null)); _falseList.add(il.append(new GOTO_W(null))); icmp.setTarget(il.append(NOP)); } } private void translateNoContext(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Push current node on the stack il.append(methodGen.loadCurrentNode()); il.append(SWAP); // Overwrite current node with matching node il.append(methodGen.storeCurrentNode()); // If pattern not reduced then check kernel if (!_isEpsilon) { il.append(methodGen.loadCurrentNode()); translateKernel(classGen, methodGen); } // Compile the expressions within the predicates final int n = _predicates.size(); for (int i = 0; i < n; i++) { Predicate pred = (Predicate)_predicates.elementAt(i); Expression exp = pred.getExpr(); exp.translateDesynthesized(classGen, methodGen); _trueList.append(exp._trueList); _falseList.append(exp._falseList); } // Backpatch true list and restore current iterator/node InstructionHandle restore; restore = il.append(methodGen.storeCurrentNode()); backPatchTrueList(restore); BranchHandle skipFalse = il.append(new GOTO(null)); // Backpatch false list and restore current iterator/node restore = il.append(methodGen.storeCurrentNode()); backPatchFalseList(restore); _falseList.add(il.append(new GOTO(null))); // True list falls through skipFalse.setTarget(il.append(NOP)); } private void translateSimpleContext(ClassGenerator classGen, MethodGenerator methodGen) { int index; final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Store matching node into a local variable LocalVariableGen match; match = methodGen.addLocalVariable("step_pattern_tmp1", Util.getJCRefType(NODE_SIG), null, null); match.setStart(il.append(new ISTORE(match.getIndex()))); // If pattern not reduced then check kernel if (!_isEpsilon) { il.append(new ILOAD(match.getIndex())); translateKernel(classGen, methodGen); } // Push current iterator and current node on the stack il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadIterator()); // Create a new matching iterator using the matching node index = cpg.addMethodref(MATCHING_ITERATOR, "", "(I" + NODE_ITERATOR_SIG + ")V"); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches, // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. _step.translate(classGen, methodGen); LocalVariableGen stepIteratorTemp = methodGen.addLocalVariable("step_pattern_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); stepIteratorTemp.setStart( il.append(new ASTORE(stepIteratorTemp.getIndex()))); il.append(new NEW(cpg.addClass(MATCHING_ITERATOR))); il.append(DUP); il.append(new ILOAD(match.getIndex())); stepIteratorTemp.setEnd( il.append(new ALOAD(stepIteratorTemp.getIndex()))); il.append(new INVOKESPECIAL(index)); // Get the parent of the matching node il.append(methodGen.loadDOM()); il.append(new ILOAD(match.getIndex())); index = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); il.append(new INVOKEINTERFACE(index, 2)); // Start the iterator with the parent il.append(methodGen.setStartNode()); // Overwrite current iterator and current node il.append(methodGen.storeIterator()); match.setEnd(il.append(new ILOAD(match.getIndex()))); il.append(methodGen.storeCurrentNode()); // Translate the expression of the predicate Predicate pred = (Predicate) _predicates.elementAt(0); Expression exp = pred.getExpr(); exp.translateDesynthesized(classGen, methodGen); // Backpatch true list and restore current iterator/node InstructionHandle restore = il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode()); exp.backPatchTrueList(restore); BranchHandle skipFalse = il.append(new GOTO(null)); // Backpatch false list and restore current iterator/node restore = il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode()); exp.backPatchFalseList(restore); _falseList.add(il.append(new GOTO(null))); // True list falls through skipFalse.setTarget(il.append(NOP)); } private void translateGeneralContext(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int iteratorIndex = 0; BranchHandle ifBlock = null; LocalVariableGen iter, node, node2; final String iteratorName = getNextFieldName(); // Store node on the stack into a local variable node = methodGen.addLocalVariable("step_pattern_tmp1", Util.getJCRefType(NODE_SIG), null, null); node.setStart(il.append(new ISTORE(node.getIndex()))); // Create a new local to store the iterator iter = methodGen.addLocalVariable("step_pattern_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); // Add a new private field if this is the main class if (!classGen.isExternal()) { final Field iterator = new Field(ACC_PRIVATE, cpg.addUtf8(iteratorName), cpg.addUtf8(NODE_ITERATOR_SIG), null, cpg.getConstantPool()); classGen.addField(iterator); iteratorIndex = cpg.addFieldref(classGen.getClassName(), iteratorName, NODE_ITERATOR_SIG); il.append(classGen.loadTranslet()); il.append(new GETFIELD(iteratorIndex)); il.append(DUP); iter.setStart(il.append(new ASTORE(iter.getIndex()))); ifBlock = il.append(new IFNONNULL(null)); il.append(classGen.loadTranslet()); } // Compile the step created at type checking time _step.translate(classGen, methodGen); InstructionHandle iterStore = il.append(new ASTORE(iter.getIndex())); // If in the main class update the field too if (!classGen.isExternal()) { il.append(new ALOAD(iter.getIndex())); il.append(new PUTFIELD(iteratorIndex)); ifBlock.setTarget(il.append(NOP)); } else { // If class is not external, start of range for iter variable was // set above iter.setStart(iterStore); } // Get the parent of the node on the stack il.append(methodGen.loadDOM()); il.append(new ILOAD(node.getIndex())); int index = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); il.append(new INVOKEINTERFACE(index, 2)); // Initialize the iterator with the parent il.append(new ALOAD(iter.getIndex())); il.append(SWAP); il.append(methodGen.setStartNode()); /* * Inline loop: * * int node2; * while ((node2 = iter.next()) != NodeIterator.END * && node2 < node); * return node2 == node; */ BranchHandle skipNext; InstructionHandle begin, next; node2 = methodGen.addLocalVariable("step_pattern_tmp3", Util.getJCRefType(NODE_SIG), null, null); skipNext = il.append(new GOTO(null)); next = il.append(new ALOAD(iter.getIndex())); node2.setStart(next); begin = il.append(methodGen.nextNode()); il.append(DUP); il.append(new ISTORE(node2.getIndex())); _falseList.add(il.append(new IFLT(null))); // NodeIterator.END il.append(new ILOAD(node2.getIndex())); il.append(new ILOAD(node.getIndex())); iter.setEnd(il.append(new IF_ICMPLT(next))); node2.setEnd(il.append(new ILOAD(node2.getIndex()))); node.setEnd(il.append(new ILOAD(node.getIndex()))); _falseList.add(il.append(new IF_ICMPNE(null))); skipNext.setTarget(begin); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (hasPredicates()) { switch (_contextCase) { case NO_CONTEXT: translateNoContext(classGen, methodGen); break; case SIMPLE_CONTEXT: translateSimpleContext(classGen, methodGen); break; default: translateGeneralContext(classGen, methodGen); break; } } else if (isWildcard()) { il.append(POP); // true list falls through } else { translateKernel(classGen, methodGen); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CastExpr.java0000644000175000017500000002061110721374032024544 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CastExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.IF_ICMPNE; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.SIPUSH; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MultiHashtable; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xml.dtm.Axis; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt */ final class CastExpr extends Expression { private final Expression _left; /** * Legal conversions between internal types. */ static private MultiHashtable InternalTypeMap = new MultiHashtable(); static { // Possible type conversions between internal types InternalTypeMap.put(Type.Boolean, Type.Boolean); InternalTypeMap.put(Type.Boolean, Type.Real); InternalTypeMap.put(Type.Boolean, Type.String); InternalTypeMap.put(Type.Boolean, Type.Reference); InternalTypeMap.put(Type.Boolean, Type.Object); InternalTypeMap.put(Type.Real, Type.Real); InternalTypeMap.put(Type.Real, Type.Int); InternalTypeMap.put(Type.Real, Type.Boolean); InternalTypeMap.put(Type.Real, Type.String); InternalTypeMap.put(Type.Real, Type.Reference); InternalTypeMap.put(Type.Real, Type.Object); InternalTypeMap.put(Type.Int, Type.Int); InternalTypeMap.put(Type.Int, Type.Real); InternalTypeMap.put(Type.Int, Type.Boolean); InternalTypeMap.put(Type.Int, Type.String); InternalTypeMap.put(Type.Int, Type.Reference); InternalTypeMap.put(Type.Int, Type.Object); InternalTypeMap.put(Type.String, Type.String); InternalTypeMap.put(Type.String, Type.Boolean); InternalTypeMap.put(Type.String, Type.Real); InternalTypeMap.put(Type.String, Type.Reference); InternalTypeMap.put(Type.String, Type.Object); InternalTypeMap.put(Type.NodeSet, Type.NodeSet); InternalTypeMap.put(Type.NodeSet, Type.Boolean); InternalTypeMap.put(Type.NodeSet, Type.Real); InternalTypeMap.put(Type.NodeSet, Type.String); InternalTypeMap.put(Type.NodeSet, Type.Node); InternalTypeMap.put(Type.NodeSet, Type.Reference); InternalTypeMap.put(Type.NodeSet, Type.Object); InternalTypeMap.put(Type.Node, Type.Node); InternalTypeMap.put(Type.Node, Type.Boolean); InternalTypeMap.put(Type.Node, Type.Real); InternalTypeMap.put(Type.Node, Type.String); InternalTypeMap.put(Type.Node, Type.NodeSet); InternalTypeMap.put(Type.Node, Type.Reference); InternalTypeMap.put(Type.Node, Type.Object); InternalTypeMap.put(Type.ResultTree, Type.ResultTree); InternalTypeMap.put(Type.ResultTree, Type.Boolean); InternalTypeMap.put(Type.ResultTree, Type.Real); InternalTypeMap.put(Type.ResultTree, Type.String); InternalTypeMap.put(Type.ResultTree, Type.NodeSet); InternalTypeMap.put(Type.ResultTree, Type.Reference); InternalTypeMap.put(Type.ResultTree, Type.Object); InternalTypeMap.put(Type.Reference, Type.Reference); InternalTypeMap.put(Type.Reference, Type.Boolean); InternalTypeMap.put(Type.Reference, Type.Int); InternalTypeMap.put(Type.Reference, Type.Real); InternalTypeMap.put(Type.Reference, Type.String); InternalTypeMap.put(Type.Reference, Type.Node); InternalTypeMap.put(Type.Reference, Type.NodeSet); InternalTypeMap.put(Type.Reference, Type.ResultTree); InternalTypeMap.put(Type.Reference, Type.Object); InternalTypeMap.put(Type.Object, Type.String); InternalTypeMap.put(Type.Void, Type.String); } private boolean _typeTest = false; /** * Construct a cast expression and check that the conversion is * valid by calling typeCheck(). */ public CastExpr(Expression left, Type type) throws TypeCheckError { _left = left; _type = type; // use inherited field if ((_left instanceof Step) && (_type == Type.Boolean)) { Step step = (Step)_left; if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1)) _typeTest = true; } // check if conversion is valid setParser(left.getParser()); setParent(left.getParent()); left.setParent(this); typeCheck(left.getParser().getSymbolTable()); } public Expression getExpr() { return _left; } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { return(_left.hasPositionCall()); } public boolean hasLastCall() { return(_left.hasLastCall()); } public String toString() { return "cast(" + _left + ", " + _type + ")"; } /** * Type checking a cast expression amounts to verifying that the * type conversion is legal. Cast expressions are created during * type checking, but typeCheck() is usually not called on them. * As a result, this method is called from the constructor. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { Type tleft = _left.getType(); if (tleft == null) { tleft = _left.typeCheck(stable); } if (tleft instanceof NodeType) { tleft = Type.Node; // multiple instances } else if (tleft instanceof ResultTreeType) { tleft = Type.ResultTree; // multiple instances } if (InternalTypeMap.maps(tleft, _type) != null) { return _type; } // throw new TypeCheckError(this); throw new TypeCheckError(new ErrorMsg( ErrorMsg.DATA_CONVERSION_ERR, tleft.toString(), _type.toString())); } public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { FlowList fl; final Type ltype = _left.getType(); // This is a special case for the self:: axis. Instead of letting // the Step object create and iterator that we cast back to a single // node, we simply ask the DOM for the node type. if (_typeTest) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int idx = cpg.addInterfaceMethodref(DOM_INTF, "getExpandedTypeID", "(I)I"); il.append(new SIPUSH((short)((Step)_left).getNodeType())); il.append(methodGen.loadDOM()); il.append(methodGen.loadContextNode()); il.append(new INVOKEINTERFACE(idx, 2)); _falseList.add(il.append(new IF_ICMPNE(null))); } else { _left.translate(classGen, methodGen); if (_type != ltype) { _left.startIterator(classGen, methodGen); if (_type instanceof BooleanType) { fl = ltype.translateToDesynthesized(classGen, methodGen, _type); if (fl != null) { _falseList.append(fl); } } else { ltype.translateTo(classGen, methodGen, _type); } } } } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final Type ltype = _left.getType(); _left.translate(classGen, methodGen); if (_type.identicalTo(ltype) == false) { _left.startIterator(classGen, methodGen); ltype.translateTo(classGen, methodGen, _type); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/IllegalCharException.java0000644000175000017500000000226410721374032027045 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IllegalCharException.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ class IllegalCharException extends Exception { static final long serialVersionUID = -667236676706226266L; public IllegalCharException(String s) { super(s); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Expression.java0000644000175000017500000001604110721374032025154 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Expression.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO_W; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt */ abstract class Expression extends SyntaxTreeNode { /** * The type of this expression. It is set after calling * typeCheck(). */ protected Type _type; /** * Instruction handles that comprise the true list. */ protected FlowList _trueList = new FlowList(); /** * Instruction handles that comprise the false list. */ protected FlowList _falseList = new FlowList(); public Type getType() { return _type; } public abstract String toString(); public boolean hasPositionCall() { return false; // default should be 'false' for StepPattern } public boolean hasLastCall() { return false; } /** * Returns an object representing the compile-time evaluation * of an expression. We are only using this for function-available * and element-available at this time. */ public Object evaluateAtCompileTime() { return null; } /** * Type check all the children of this node. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return typeCheckContents(stable); } /** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); } /** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public final InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; } /** * Redefined by expressions of type boolean that use flow lists. */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { translate(classGen, methodGen); if (_type instanceof BooleanType) { desynthesize(classGen, methodGen); } } /** * If this expression is of type node-set and it is not a variable * reference, then call setStartNode() passing the context node. */ public void startIterator(ClassGenerator classGen, MethodGenerator methodGen) { // Ignore if type is not node-set if (_type instanceof NodeSetType == false) { return; } // setStartNode() should not be called if expr is a variable ref Expression expr = this; if (expr instanceof CastExpr) { expr = ((CastExpr) expr).getExpr(); } if (expr instanceof VariableRefBase == false) { final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadContextNode()); il.append(methodGen.setStartNode()); } } /** * Synthesize a boolean expression, i.e., either push a 0 or 1 onto the * operand stack for the next statement to succeed. Returns the handle * of the instruction to be backpatched. */ public void synthesize(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _trueList.backPatch(il.append(ICONST_1)); final BranchHandle truec = il.append(new GOTO_W(null)); _falseList.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); } public void desynthesize(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _falseList.add(il.append(new IFEQ(null))); } public FlowList getFalseList() { return _falseList; } public FlowList getTrueList() { return _trueList; } public void backPatchFalseList(InstructionHandle ih) { _falseList.backPatch(ih); } public void backPatchTrueList(InstructionHandle ih) { _trueList.backPatch(ih); } /** * Search for a primop in the symbol table that matches the method type * ctype. Two methods match if they have the same arity. * If a primop is overloaded then the "closest match" is returned. The * first entry in the vector of primops that has the right arity is * considered to be the default one. */ public MethodType lookupPrimop(SymbolTable stable, String op, MethodType ctype) { MethodType result = null; final Vector primop = stable.lookupPrimop(op); if (primop != null) { final int n = primop.size(); int minDistance = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { final MethodType ptype = (MethodType) primop.elementAt(i); // Skip if different arity if (ptype.argsCount() != ctype.argsCount()) { continue; } // The first method with the right arity is the default if (result == null) { result = ptype; // default method } // Check if better than last one found final int distance = ctype.distanceTo(ptype); if (distance < minDistance) { minDistance = distance; result = ptype; } } } return result; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/QName.java0000644000175000017500000000426510721374031024022 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: QName.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class QName { private final String _localname; private String _prefix; private String _namespace; private String _stringRep; private int _hashCode; public QName(String namespace, String prefix, String localname) { _namespace = namespace; _prefix = prefix; _localname = localname; _stringRep = (namespace != null && !namespace.equals(Constants.EMPTYSTRING)) ? (namespace + ':' + localname) : localname; _hashCode = _stringRep.hashCode() + 19; // cached for speed } public void clearNamespace() { _namespace = Constants.EMPTYSTRING; } public String toString() { return _stringRep; } public String getStringRep() { return _stringRep; } public boolean equals(Object other) { return (this == other); } public String getLocalPart() { return _localname; } public String getNamespace() { return _namespace; } public String getPrefix() { return _prefix; } public int hashCode() { return _hashCode; } public String dump() { return "QName: " + _namespace + "(" + _prefix + "):" + _localname; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Template.java0000644000175000017500000002375410721374032024601 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Template.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NamedMethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt */ public final class Template extends TopLevelElement { private QName _name; // The name of the template (if any) private QName _mode; // Mode in which this template is instantiated. private Pattern _pattern; // Matching pattern defined for this template. private double _priority; // Matching priority of this template. private int _position; // Position within stylesheet (prio. resolution) private boolean _disabled = false; private boolean _compiled = false;//make sure it is compiled only once private boolean _simplified = false; // True if this is a simple named template. A simple named // template is a template which only has a name but no match pattern. private boolean _isSimpleNamedTemplate = false; // The list of parameters in this template. This is only used // for simple named templates. private Vector _parameters = new Vector(); public boolean hasParams() { return _parameters.size() > 0; } public boolean isSimplified() { return(_simplified); } public void setSimplified() { _simplified = true; } public boolean isSimpleNamedTemplate() { return _isSimpleNamedTemplate; } public void addParameter(Param param) { _parameters.addElement(param); } public Vector getParameters() { return _parameters; } public void disable() { _disabled = true; } public boolean disabled() { return(_disabled); } public double getPriority() { return _priority; } public int getPosition() { return(_position); } public boolean isNamed() { return _name != null; } public Pattern getPattern() { return _pattern; } public QName getName() { return _name; } public void setName(QName qname) { if (_name == null) _name = qname; } public QName getModeName() { return _mode; } /** * Compare this template to another. First checks priority, then position. */ public int compareTo(Object template) { Template other = (Template)template; if (_priority > other._priority) return 1; else if (_priority < other._priority) return -1; else if (_position > other._position) return 1; else if (_position < other._position) return -1; else return 0; } public void display(int indent) { Util.println('\n'); indent(indent); if (_name != null) { indent(indent); Util.println("name = " + _name); } else if (_pattern != null) { indent(indent); Util.println("match = " + _pattern.toString()); } if (_mode != null) { indent(indent); Util.println("mode = " + _mode); } displayContents(indent + IndentIncrement); } private boolean resolveNamedTemplates(Template other, Parser parser) { if (other == null) return true; SymbolTable stable = parser.getSymbolTable(); final int us = this.getImportPrecedence(); final int them = other.getImportPrecedence(); if (us > them) { other.disable(); return true; } else if (us < them) { stable.addTemplate(other); this.disable(); return true; } else { return false; } } private Stylesheet _stylesheet = null; public Stylesheet getStylesheet() { return _stylesheet; } public void parseContents(Parser parser) { final String name = getAttribute("name"); final String mode = getAttribute("mode"); final String match = getAttribute("match"); final String priority = getAttribute("priority"); _stylesheet = super.getStylesheet(); if (name.length() > 0) { if (!XML11Char.isXML11ValidQName(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } _name = parser.getQNameIgnoreDefaultNs(name); } if (mode.length() > 0) { if (!XML11Char.isXML11ValidQName(mode)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, mode, this); parser.reportError(Constants.ERROR, err); } _mode = parser.getQNameIgnoreDefaultNs(mode); } if (match.length() > 0) { _pattern = parser.parsePattern(this, "match", null); } if (priority.length() > 0) { _priority = Double.parseDouble(priority); } else { if (_pattern != null) _priority = _pattern.getPriority(); else _priority = Double.NaN; } _position = parser.getTemplateIndex(); // Add the (named) template to the symbol table if (_name != null) { Template other = parser.getSymbolTable().addTemplate(this); if (!resolveNamedTemplates(other, parser)) { ErrorMsg err = new ErrorMsg(ErrorMsg.TEMPLATE_REDEF_ERR, _name, this); parser.reportError(Constants.ERROR, err); } // Is this a simple named template? if (_pattern == null && _mode == null) { _isSimpleNamedTemplate = true; } } if (_parent instanceof Stylesheet) { ((Stylesheet)_parent).addTemplate(this); } parser.setTemplate(this); // set current template parseChildren(parser); parser.setTemplate(null); // clear template } /** * When the parser realises that it is dealign with a simplified stylesheet * it will create an empty Stylesheet object with the root element of the * stylesheet (a LiteralElement object) as its only child. The Stylesheet * object will then create this Template object and invoke this method to * force some specific behaviour. What we need to do is: * o) create a pattern matching on the root node * o) add the LRE root node (the only child of the Stylesheet) as our * only child node * o) set the empty Stylesheet as our parent * o) set this template as the Stylesheet's only child */ public void parseSimplified(Stylesheet stylesheet, Parser parser) { _stylesheet = stylesheet; setParent(stylesheet); _name = null; _mode = null; _priority = Double.NaN; _pattern = parser.parsePattern(this, "/"); final Vector contents = _stylesheet.getContents(); final SyntaxTreeNode root = (SyntaxTreeNode)contents.elementAt(0); if (root instanceof LiteralElement) { addElement(root); root.setParent(this); contents.set(0, this); parser.setTemplate(this); root.parseContents(parser); parser.setTemplate(null); } } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_pattern != null) { _pattern.typeCheck(stable); } return typeCheckContents(stable); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_disabled) return; // bug fix #4433133, add a call to named template from applyTemplates String className = classGen.getClassName(); if (_compiled && isNamed()){ String methodName = Util.escape(_name.toString()); il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadIterator()); il.append(methodGen.loadHandler()); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEVIRTUAL(cpg.addMethodref(className, methodName, "(" + DOM_INTF_SIG + NODE_ITERATOR_SIG + TRANSLET_OUTPUT_SIG + "I)V"))); return; } if (_compiled) return; _compiled = true; // %OPT% Special handling for simple named templates. if (_isSimpleNamedTemplate && methodGen instanceof NamedMethodGenerator) { int numParams = _parameters.size(); NamedMethodGenerator namedMethodGen = (NamedMethodGenerator)methodGen; // Update load/store instructions to access Params from the stack for (int i = 0; i < numParams; i++) { Param param = (Param)_parameters.elementAt(i); param.setLoadInstruction(namedMethodGen.loadParameter(i)); param.setStoreInstruction(namedMethodGen.storeParameter(i)); } } translateContents(classGen, methodGen); il.setPositions(true); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/RelativeLocationPath.java0000644000175000017500000000221710721374033027077 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RelativeLocationPath.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ abstract class RelativeLocationPath extends Expression { public abstract int getAxis(); public abstract void setAxis(int axis); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/XSLTC.java0000644000175000017500000007575610721374030023732 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTC.java 577935 2007-09-20 21:35:20Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Date; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.Vector; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; import org.apache.bcel.classfile.JavaClass; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.DTM; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author G. Todd Miller * @author Morten Jorgensen * @author John Howard (johnh@schemasoft.com) */ public final class XSLTC { // A reference to the main stylesheet parser object. private Parser _parser; // A reference to an external XMLReader (SAX parser) passed to us private XMLReader _reader = null; // A reference to an external SourceLoader (for use with include/import) private SourceLoader _loader = null; // A reference to the stylesheet being compiled. private Stylesheet _stylesheet; // Counters used by various classes to generate unique names. // private int _variableSerial = 1; private int _modeSerial = 1; private int _stylesheetSerial = 1; private int _stepPatternSerial = 1; private int _helperClassSerial = 0; private int _attributeSetSerial = 0; private int[] _numberFieldIndexes; // Name index tables private int _nextGType; // Next available element type private Vector _namesIndex; // Index of all registered QNames private Hashtable _elements; // Hashtable of all registered elements private Hashtable _attributes; // Hashtable of all registered attributes // Namespace index tables private int _nextNSType; // Next available namespace type private Vector _namespaceIndex; // Index of all registered namespaces private Hashtable _namespaces; // Hashtable of all registered namespaces private Hashtable _namespacePrefixes;// Hashtable of all registered namespace prefixes // All literal text in the stylesheet private Vector m_characterData; // These define the various methods for outputting the translet public static final int FILE_OUTPUT = 0; public static final int JAR_OUTPUT = 1; public static final int BYTEARRAY_OUTPUT = 2; public static final int CLASSLOADER_OUTPUT = 3; public static final int BYTEARRAY_AND_FILE_OUTPUT = 4; public static final int BYTEARRAY_AND_JAR_OUTPUT = 5; // Compiler options (passed from command line or XSLTC client) private boolean _debug = false; // -x private String _jarFileName = null; // -j private String _className = null; // -o private String _packageName = null; // -p private File _destDir = null; // -d private int _outputType = FILE_OUTPUT; // by default private Vector _classes; private Vector _bcelClasses; private boolean _callsNodeset = false; private boolean _multiDocument = false; private boolean _hasIdCall = false; private Vector _stylesheetNSAncestorPointers; private Vector _prefixURIPairs; private Vector _prefixURIPairsIdx; /** * Set to true if template inlining is requested. Template * inlining used to be the default, but we have found that * Hotspots does a better job with shorter methods, so the * default is *not* to inline now. */ private boolean _templateInlining = false; /** * State of the secure processing feature. */ private boolean _isSecureProcessing = false; /** * XSLTC compiler constructor */ public XSLTC() { _parser = new Parser(this); } /** * Set the state of the secure processing feature. */ public void setSecureProcessing(boolean flag) { _isSecureProcessing = flag; } /** * Return the state of the secure processing feature. */ public boolean isSecureProcessing() { return _isSecureProcessing; } /** * Only for user by the internal TrAX implementation. */ public Parser getParser() { return _parser; } /** * Only for user by the internal TrAX implementation. */ public void setOutputType(int type) { _outputType = type; } /** * Only for user by the internal TrAX implementation. */ public Properties getOutputProperties() { return _parser.getOutputProperties(); } /** * Initializes the compiler to compile a new stylesheet */ public void init() { reset(); _reader = null; _classes = new Vector(); _bcelClasses = new Vector(); } /** * Initializes the compiler to produce a new translet */ private void reset() { _nextGType = DTM.NTYPES; _elements = new Hashtable(); _attributes = new Hashtable(); _namespaces = new Hashtable(); _namespaces.put("",new Integer(_nextNSType)); _namesIndex = new Vector(128); _namespaceIndex = new Vector(32); _namespacePrefixes = new Hashtable(); _stylesheet = null; _parser.init(); //_variableSerial = 1; _modeSerial = 1; _stylesheetSerial = 1; _stepPatternSerial = 1; _helperClassSerial = 0; _attributeSetSerial = 0; _multiDocument = false; _hasIdCall = false; _stylesheetNSAncestorPointers = null; _prefixURIPairs = null; _prefixURIPairsIdx = null; _numberFieldIndexes = new int[] { -1, // LEVEL_SINGLE -1, // LEVEL_MULTIPLE -1 // LEVEL_ANY }; } /** * Defines an external SourceLoader to provide the compiler with documents * referenced in xsl:include/import * @param loader The SourceLoader to use for include/import */ public void setSourceLoader(SourceLoader loader) { _loader = loader; } /** * Set a flag indicating if templates are to be inlined or not. The * default is to do inlining, but this causes problems when the * stylesheets have a large number of templates (e.g. branch targets * exceeding 64K or a length of a method exceeding 64K). */ public void setTemplateInlining(boolean templateInlining) { _templateInlining = templateInlining; } /** * Return the state of the template inlining feature. */ public boolean getTemplateInlining() { return _templateInlining; } /** * Set the parameters to use to locate the correct * processing instruction in the case where the input document to the * compiler (and parser) is an XML document. * @param media The media attribute to be matched. May be null, in which * case the prefered templates will be used (i.e. alternate = no). * @param title The value of the title attribute to match. May be null. * @param charset The value of the charset attribute to match. May be null. */ public void setPIParameters(String media, String title, String charset) { _parser.setPIParameters(media, title, charset); } /** * Compiles an XSL stylesheet pointed to by a URL * @param url An URL containing the input XSL stylesheet */ public boolean compile(URL url) { try { // Open input stream from URL and wrap inside InputSource final InputStream stream = url.openStream(); final InputSource input = new InputSource(stream); input.setSystemId(url.toString()); return compile(input, _className); } catch (IOException e) { _parser.reportError(Constants.FATAL, new ErrorMsg(e)); return false; } } /** * Compiles an XSL stylesheet pointed to by a URL * @param url An URL containing the input XSL stylesheet * @param name The name to assign to the translet class */ public boolean compile(URL url, String name) { try { // Open input stream from URL and wrap inside InputSource final InputStream stream = url.openStream(); final InputSource input = new InputSource(stream); input.setSystemId(url.toString()); return compile(input, name); } catch (IOException e) { _parser.reportError(Constants.FATAL, new ErrorMsg(e)); return false; } } /** * Compiles an XSL stylesheet passed in through an InputStream * @param stream An InputStream that will pass in the stylesheet contents * @param name The name of the translet class to generate * @return 'true' if the compilation was successful */ public boolean compile(InputStream stream, String name) { final InputSource input = new InputSource(stream); input.setSystemId(name); // We have nothing else!!! return compile(input, name); } /** * Compiles an XSL stylesheet passed in through an InputStream * @param input An InputSource that will pass in the stylesheet contents * @param name The name of the translet class to generate - can be null * @return 'true' if the compilation was successful */ public boolean compile(InputSource input, String name) { try { // Reset globals in case we're called by compile(Vector v); reset(); // The systemId may not be set, so we'll have to check the URL String systemId = null; if (input != null) { systemId = input.getSystemId(); } // Set the translet class name if not already set if (_className == null) { if (name != null) { setClassName(name); } else if (systemId != null && !systemId.equals("")) { setClassName(Util.baseName(systemId)); } // Ensure we have a non-empty class name at this point if (_className == null || _className.length() == 0) { setClassName("GregorSamsa"); // default translet name } } // Get the root node of the abstract syntax tree SyntaxTreeNode element = null; if (_reader == null) { element = _parser.parse(input); } else { element = _parser.parse(_reader, input); } // Compile the translet - this is where the work is done! if ((!_parser.errorsFound()) && (element != null)) { // Create a Stylesheet element from the root node _stylesheet = _parser.makeStylesheet(element); _stylesheet.setSourceLoader(_loader); _stylesheet.setSystemId(systemId); _stylesheet.setParentStylesheet(null); _stylesheet.setTemplateInlining(_templateInlining); _parser.setCurrentStylesheet(_stylesheet); // Create AST under the Stylesheet element (parse & type-check) _parser.createAST(_stylesheet); } // Generate the bytecodes and output the translet class(es) if ((!_parser.errorsFound()) && (_stylesheet != null)) { _stylesheet.setCallsNodeset(_callsNodeset); _stylesheet.setMultiDocument(_multiDocument); _stylesheet.setHasIdCall(_hasIdCall); // Class synchronization is needed for BCEL synchronized (getClass()) { _stylesheet.translate(); } } } catch (Exception e) { /*if (_debug)*/ e.printStackTrace(); _parser.reportError(Constants.FATAL, new ErrorMsg(e)); } catch (Error e) { if (_debug) e.printStackTrace(); _parser.reportError(Constants.FATAL, new ErrorMsg(e)); } finally { _reader = null; // reset this here to be sure it is not re-used } return !_parser.errorsFound(); } /** * Compiles a set of stylesheets pointed to by a Vector of URLs * @param stylesheets A Vector containing URLs pointing to the stylesheets * @return 'true' if the compilation was successful */ public boolean compile(Vector stylesheets) { // Get the number of stylesheets (ie. URLs) in the vector final int count = stylesheets.size(); // Return straight away if the vector is empty if (count == 0) return true; // Special handling needed if the URL count is one, becuase the // _className global must not be reset if it was set explicitly if (count == 1) { final Object url = stylesheets.firstElement(); if (url instanceof URL) return compile((URL)url); else return false; } else { // Traverse all elements in the vector and compile final Enumeration urls = stylesheets.elements(); while (urls.hasMoreElements()) { _className = null; // reset, so that new name will be computed final Object url = urls.nextElement(); if (url instanceof URL) { if (!compile((URL)url)) return false; } } } return true; } /** * Returns an array of bytecode arrays generated by a compilation. * @return JVM bytecodes that represent translet class definition */ public byte[][] getBytecodes() { final int count = _classes.size(); final byte[][] result = new byte[count][1]; for (int i = 0; i < count; i++) result[i] = (byte[])_classes.elementAt(i); return result; } /** * Compiles a stylesheet pointed to by a URL. The result is put in a * set of byte arrays. One byte array for each generated class. * @param name The name of the translet class to generate * @param input An InputSource that will pass in the stylesheet contents * @param outputType The output type * @return JVM bytecodes that represent translet class definition */ public byte[][] compile(String name, InputSource input, int outputType) { _outputType = outputType; if (compile(input, name)) return getBytecodes(); else return null; } /** * Compiles a stylesheet pointed to by a URL. The result is put in a * set of byte arrays. One byte array for each generated class. * @param name The name of the translet class to generate * @param input An InputSource that will pass in the stylesheet contents * @return JVM bytecodes that represent translet class definition */ public byte[][] compile(String name, InputSource input) { return compile(name, input, BYTEARRAY_OUTPUT); } /** * Set the XMLReader to use for parsing the next input stylesheet * @param reader XMLReader (SAX2 parser) to use */ public void setXMLReader(XMLReader reader) { _reader = reader; } /** * Get the XMLReader to use for parsing the next input stylesheet */ public XMLReader getXMLReader() { return _reader ; } /** * Get a Vector containing all compile error messages * @return A Vector containing all compile error messages */ public Vector getErrors() { return _parser.getErrors(); } /** * Get a Vector containing all compile warning messages * @return A Vector containing all compile error messages */ public Vector getWarnings() { return _parser.getWarnings(); } /** * Print all compile error messages to standard output */ public void printErrors() { _parser.printErrors(); } /** * Print all compile warning messages to standard output */ public void printWarnings() { _parser.printWarnings(); } /** * This method is called by the XPathParser when it encounters a call * to the document() function. Affects the DOM used by the translet. */ protected void setMultiDocument(boolean flag) { _multiDocument = flag; } public boolean isMultiDocument() { return _multiDocument; } /** * This method is called by the XPathParser when it encounters a call * to the nodeset() extension function. Implies multi document. */ protected void setCallsNodeset(boolean flag) { if (flag) setMultiDocument(flag); _callsNodeset = flag; } public boolean callsNodeset() { return _callsNodeset; } protected void setHasIdCall(boolean flag) { _hasIdCall = flag; } public boolean hasIdCall() { return _hasIdCall; } /** * Set the class name for the generated translet. This class name is * overridden if multiple stylesheets are compiled in one go using the * compile(Vector urls) method. * @param className The name to assign to the translet class */ public void setClassName(String className) { final String base = Util.baseName(className); final String noext = Util.noExtName(base); String name = Util.toJavaName(noext); if (_packageName == null) _className = name; else _className = _packageName + '.' + name; } /** * Get the class name for the generated translet. */ public String getClassName() { return _className; } /** * Convert for Java class name of local system file name. * (Replace '.' with '/' on UNIX and replace '.' by '\' on Windows/DOS.) */ private String classFileName(final String className) { return className.replace('.', File.separatorChar) + ".class"; } /** * Generate an output File object to send the translet to */ private File getOutputFile(String className) { if (_destDir != null) return new File(_destDir, classFileName(className)); else return new File(classFileName(className)); } /** * Set the destination directory for the translet. * The current working directory will be used by default. */ public boolean setDestDirectory(String dstDirName) { final File dir = new File(dstDirName); if (dir.exists() || dir.mkdirs()) { _destDir = dir; return true; } else { _destDir = null; return false; } } /** * Set an optional package name for the translet and auxiliary classes */ public void setPackageName(String packageName) { _packageName = packageName; if (_className != null) setClassName(_className); } /** * Set the name of an optional JAR-file to dump the translet and * auxiliary classes to */ public void setJarFileName(String jarFileName) { final String JAR_EXT = ".jar"; if (jarFileName.endsWith(JAR_EXT)) _jarFileName = jarFileName; else _jarFileName = jarFileName + JAR_EXT; _outputType = JAR_OUTPUT; } public String getJarFileName() { return _jarFileName; } /** * Set the top-level stylesheet */ public void setStylesheet(Stylesheet stylesheet) { if (_stylesheet == null) _stylesheet = stylesheet; } /** * Returns the top-level stylesheet */ public Stylesheet getStylesheet() { return _stylesheet; } /** * Registers an attribute and gives it a type so that it can be mapped to * DOM attribute types at run-time. */ public int registerAttribute(QName name) { Integer code = (Integer)_attributes.get(name.toString()); if (code == null) { code = new Integer(_nextGType++); _attributes.put(name.toString(), code); final String uri = name.getNamespace(); final String local = "@"+name.getLocalPart(); if ((uri != null) && (!uri.equals(""))) _namesIndex.addElement(uri+":"+local); else _namesIndex.addElement(local); if (name.getLocalPart().equals("*")) { registerNamespace(name.getNamespace()); } } return code.intValue(); } /** * Registers an element and gives it a type so that it can be mapped to * DOM element types at run-time. */ public int registerElement(QName name) { // Register element (full QName) Integer code = (Integer)_elements.get(name.toString()); if (code == null) { _elements.put(name.toString(), code = new Integer(_nextGType++)); _namesIndex.addElement(name.toString()); } if (name.getLocalPart().equals("*")) { registerNamespace(name.getNamespace()); } return code.intValue(); } /** * Registers a namespace prefix and gives it a type so that it can be mapped to * DOM namespace types at run-time. */ public int registerNamespacePrefix(QName name) { Integer code = (Integer)_namespacePrefixes.get(name.toString()); if (code == null) { code = new Integer(_nextGType++); _namespacePrefixes.put(name.toString(), code); final String uri = name.getNamespace(); if ((uri != null) && (!uri.equals(""))){ // namespace::ext2:ped2 will be made empty in TypedNamespaceIterator _namesIndex.addElement("?"); } else{ _namesIndex.addElement("?"+name.getLocalPart()); } } return code.intValue(); } /** * Registers a namespace and gives it a type so that it can be mapped to * DOM namespace types at run-time. */ public int registerNamespacePrefix(String name) { Integer code = (Integer)_namespacePrefixes.get(name); if (code == null) { code = new Integer(_nextGType++); _namespacePrefixes.put(name, code); _namesIndex.addElement("?"+name); } return code.intValue(); } /** * Registers a namespace and gives it a type so that it can be mapped to * DOM namespace types at run-time. */ public int registerNamespace(String namespaceURI) { Integer code = (Integer)_namespaces.get(namespaceURI); if (code == null) { code = new Integer(_nextNSType++); _namespaces.put(namespaceURI,code); _namespaceIndex.addElement(namespaceURI); } return code.intValue(); } /** * Registers namespace declarations that the stylesheet might need to * look up dynamically - for instance, if an xsl:element has a * a name attribute with variable parts and has no * namespace attribute. * * @param prefixMap a Hashtable mapping namespace prefixes to * URIs. Must not be null. The default * namespace and namespace undeclarations are represented * by a zero-length string. * @param ancestorID The int node ID of the nearest ancestor in * the stylesheet that declares namespaces, or a value less * than zero if there is no such ancestor * @return A new node ID for the stylesheet element */ public int registerStylesheetPrefixMappingForRuntime(Hashtable prefixMap, int ancestorID) { if (_stylesheetNSAncestorPointers == null) { _stylesheetNSAncestorPointers = new Vector(); } if (_prefixURIPairs == null) { _prefixURIPairs = new Vector(); } if (_prefixURIPairsIdx == null) { _prefixURIPairsIdx = new Vector(); } int currentNodeID = _stylesheetNSAncestorPointers.size(); _stylesheetNSAncestorPointers.add(new Integer(ancestorID)); Iterator prefixMapIterator = prefixMap.entrySet().iterator(); int prefixNSPairStartIdx = _prefixURIPairs.size(); _prefixURIPairsIdx.add(new Integer(prefixNSPairStartIdx)); while (prefixMapIterator.hasNext()) { Map.Entry entry = (Map.Entry) prefixMapIterator.next(); String prefix = (String) entry.getKey(); String uri = (String) entry.getValue(); _prefixURIPairs.add(prefix); _prefixURIPairs.add(uri); } return currentNodeID; } public Vector getNSAncestorPointers() { return _stylesheetNSAncestorPointers; } public Vector getPrefixURIPairs() { return _prefixURIPairs; } public Vector getPrefixURIPairsIdx() { return _prefixURIPairsIdx; } public int nextModeSerial() { return _modeSerial++; } public int nextStylesheetSerial() { return _stylesheetSerial++; } public int nextStepPatternSerial() { return _stepPatternSerial++; } public int[] getNumberFieldIndexes() { return _numberFieldIndexes; } public int nextHelperClassSerial() { return _helperClassSerial++; } public int nextAttributeSetSerial() { return _attributeSetSerial++; } public Vector getNamesIndex() { return _namesIndex; } public Vector getNamespaceIndex() { return _namespaceIndex; } /** * Returns a unique name for every helper class needed to * execute a translet. */ public String getHelperClassName() { return getClassName() + '$' + _helperClassSerial++; } public void dumpClass(JavaClass clazz) { if (_outputType == FILE_OUTPUT || _outputType == BYTEARRAY_AND_FILE_OUTPUT) { File outFile = getOutputFile(clazz.getClassName()); String parentDir = outFile.getParent(); if (parentDir != null) { File parentFile = new File(parentDir); if (!parentFile.exists()) parentFile.mkdirs(); } } try { switch (_outputType) { case FILE_OUTPUT: clazz.dump( new BufferedOutputStream( new FileOutputStream( getOutputFile(clazz.getClassName())))); break; case JAR_OUTPUT: _bcelClasses.addElement(clazz); break; case BYTEARRAY_OUTPUT: case BYTEARRAY_AND_FILE_OUTPUT: case BYTEARRAY_AND_JAR_OUTPUT: case CLASSLOADER_OUTPUT: ByteArrayOutputStream out = new ByteArrayOutputStream(2048); clazz.dump(out); _classes.addElement(out.toByteArray()); if (_outputType == BYTEARRAY_AND_FILE_OUTPUT) clazz.dump(new BufferedOutputStream( new FileOutputStream(getOutputFile(clazz.getClassName())))); else if (_outputType == BYTEARRAY_AND_JAR_OUTPUT) _bcelClasses.addElement(clazz); break; } } catch (Exception e) { e.printStackTrace(); } } /** * File separators are converted to forward slashes for ZIP files. */ private String entryName(File f) throws IOException { return f.getName().replace(File.separatorChar, '/'); } /** * Generate output JAR-file and packages */ public void outputToJar() throws IOException { // create the manifest final Manifest manifest = new Manifest(); final java.util.jar.Attributes atrs = manifest.getMainAttributes(); atrs.put(java.util.jar.Attributes.Name.MANIFEST_VERSION,"1.2"); final Map map = manifest.getEntries(); // create manifest Enumeration classes = _bcelClasses.elements(); final String now = (new Date()).toString(); final java.util.jar.Attributes.Name dateAttr = new java.util.jar.Attributes.Name("Date"); while (classes.hasMoreElements()) { final JavaClass clazz = (JavaClass)classes.nextElement(); final String className = clazz.getClassName().replace('.','/'); final java.util.jar.Attributes attr = new java.util.jar.Attributes(); attr.put(dateAttr, now); map.put(className+".class", attr); } final File jarFile = new File(_destDir, _jarFileName); final JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile), manifest); classes = _bcelClasses.elements(); while (classes.hasMoreElements()) { final JavaClass clazz = (JavaClass)classes.nextElement(); final String className = clazz.getClassName().replace('.','/'); jos.putNextEntry(new JarEntry(className+".class")); final ByteArrayOutputStream out = new ByteArrayOutputStream(2048); clazz.dump(out); // dump() closes it's output stream out.writeTo(jos); } jos.close(); } /** * Turn debugging messages on/off */ public void setDebug(boolean debug) { _debug = debug; } /** * Get current debugging message setting */ public boolean debug() { return _debug; } /** * Retrieve a string representation of the character data to be stored * in the translet as a char[]. There may be more than * one such array required. * @param index The index of the char[]. Zero-based. * @return String The character data to be stored in the corresponding * char[]. */ public String getCharacterData(int index) { return ((StringBuffer) m_characterData.elementAt(index)).toString(); } /** * Get the number of char[] arrays, thus far, that will be created to * store literal text in the stylesheet. */ public int getCharacterDataCount() { return (m_characterData != null) ? m_characterData.size() : 0; } /** * Add literal text to char arrays that will be used to store character * data in the stylesheet. * @param newData String data to be added to char arrays. * Pre-condition: newData.length() ≤ 21845 * @return int offset at which character data will be stored */ public int addCharacterData(String newData) { StringBuffer currData; if (m_characterData == null) { m_characterData = new Vector(); currData = new StringBuffer(); m_characterData.addElement(currData); } else { currData = (StringBuffer) m_characterData .elementAt(m_characterData.size()-1); } // Character data could take up to three-times as much space when // written to the class file as UTF-8. The maximum size for a // constant is 65535/3. If we exceed that, // (We really should use some "bin packing".) if (newData.length() + currData.length() > 21845) { currData = new StringBuffer(); m_characterData.addElement(currData); } int newDataOffset = currData.length(); currData.append(newData); return newDataOffset; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Choose.java0000644000175000017500000001275610721374033024247 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Choose.java 469688 2006-10-31 22:39:43Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Vector; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Choose extends Instruction { /** * Display the element contents (a lot of when's and an otherwise) */ public void display(int indent) { indent(indent); Util.println("Choose"); indent(indent + IndentIncrement); displayContents(indent + IndentIncrement); } /** * Translate this Choose element. Generate a test-chain for the various * elements and default to the if present. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final List whenElements = new ArrayList(); Otherwise otherwise = null; Enumeration elements = elements(); // These two are for reporting errors only ErrorMsg error = null; final int line = getLineNumber(); // Traverse all child nodes - must be either When or Otherwise while (elements.hasMoreElements()) { Object element = elements.nextElement(); // Add a When child element if (element instanceof When) { whenElements.add(element); } // Add an Otherwise child element else if (element instanceof Otherwise) { if (otherwise == null) { otherwise = (Otherwise)element; } else { error = new ErrorMsg(ErrorMsg.MULTIPLE_OTHERWISE_ERR, this); getParser().reportError(Constants.ERROR, error); } } else if (element instanceof Text) { ((Text)element).ignore(); } // It is an error if we find some other element here else { error = new ErrorMsg(ErrorMsg.WHEN_ELEMENT_ERR, this); getParser().reportError(Constants.ERROR, error); } } // Make sure that there is at least one element if (whenElements.size() == 0) { error = new ErrorMsg(ErrorMsg.MISSING_WHEN_ERR, this); getParser().reportError(Constants.ERROR, error); return; } InstructionList il = methodGen.getInstructionList(); // next element will hold a handle to the beginning of next // When/Otherwise if test on current When fails BranchHandle nextElement = null; List exitHandles = new ArrayList(); InstructionHandle exit = null; Iterator whens = whenElements.iterator(); while (whens.hasNext()) { final When when = (When)whens.next(); final Expression test = when.getTest(); InstructionHandle truec = il.getEnd(); if (nextElement != null) nextElement.setTarget(il.append(NOP)); test.translateDesynthesized(classGen, methodGen); if (test instanceof FunctionCall) { FunctionCall call = (FunctionCall)test; try { Type type = call.typeCheck(getParser().getSymbolTable()); if (type != Type.Boolean) { test._falseList.add(il.append(new IFEQ(null))); } } catch (TypeCheckError e) { // handled later! } } // remember end of condition truec = il.getEnd(); // The When object should be ignored completely in case it tests // for the support of a non-available element if (!when.ignore()) when.translateContents(classGen, methodGen); // goto exit after executing the body of when exitHandles.add(il.append(new GOTO(null))); if (whens.hasNext() || otherwise != null) { nextElement = il.append(new GOTO(null)); test.backPatchFalseList(nextElement); } else test.backPatchFalseList(exit = il.append(NOP)); test.backPatchTrueList(truec.getNext()); } // Translate any element if (otherwise != null) { nextElement.setTarget(il.append(NOP)); otherwise.translateContents(classGen, methodGen); exit = il.append(NOP); } // now that end is known set targets of exit gotos Iterator exitGotos = exitHandles.iterator(); while (exitGotos.hasNext()) { BranchHandle gotoExit = (BranchHandle)exitGotos.next(); gotoExit.setTarget(exit); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/SecuritySupport.java0000644000175000017500000000746110721374033026230 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ApplyTemplates.java0000644000175000017500000001557410721374031025772 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ApplyTemplates.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ApplyTemplates extends Instruction { private Expression _select; private Type _type = null; private QName _modeName; private String _functionName; public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } } public boolean hasWithParams() { return hasContents(); } public void parseContents(Parser parser) { final String select = getAttribute("select"); final String mode = getAttribute("mode"); if (select.length() > 0) { _select = parser.parseExpression(this, "select", null); } if (mode.length() > 0) { if (!XML11Char.isXML11ValidQName(mode)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, mode, this); parser.reportError(Constants.ERROR, err); } _modeName = parser.getQNameIgnoreDefaultNs(mode); } // instantiate Mode if needed, cache (apply temp) function name _functionName = parser.getTopLevelStylesheet().getMode(_modeName).functionName(); parseChildren(parser);// with-params } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_select != null) { _type = _select.typeCheck(stable); if (_type instanceof NodeType || _type instanceof ReferenceType) { _select = new CastExpr(_select, Type.NodeSet); _type = Type.NodeSet; } if (_type instanceof NodeSetType||_type instanceof ResultTreeType) { typeCheckContents(stable); // with-params return Type.Void; } throw new TypeCheckError(this); } else { typeCheckContents(stable); // with-params return Type.Void; } } /** * Translate call-template. A parameter frame is pushed only if * some template in the stylesheet uses parameters. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { boolean setStartNodeCalled = false; final Stylesheet stylesheet = classGen.getStylesheet(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int current = methodGen.getLocalIndex("current"); // check if sorting nodes is required final Vector sortObjects = new Vector(); final Enumeration children = elements(); while (children.hasMoreElements()) { final Object child = children.nextElement(); if (child instanceof Sort) { sortObjects.addElement(child); } } // Push a new parameter frame if (stylesheet.hasLocalParams() || hasContents()) { il.append(classGen.loadTranslet()); final int pushFrame = cpg.addMethodref(TRANSLET_CLASS, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG); il.append(new INVOKEVIRTUAL(pushFrame)); // translate with-params translateContents(classGen, methodGen); } il.append(classGen.loadTranslet()); // The 'select' expression is a result-tree if ((_type != null) && (_type instanceof ResultTreeType)) { // cannot be applied to a result tree - issue warning if (sortObjects.size() > 0) { ErrorMsg err = new ErrorMsg(ErrorMsg.RESULT_TREE_SORT_ERR,this); getParser().reportError(WARNING, err); } // Put the result tree (a DOM adapter) on the stack _select.translate(classGen, methodGen); // Get back the DOM and iterator (not just iterator!!!) _type.translateTo(classGen, methodGen, Type.NodeSet); } else { il.append(methodGen.loadDOM()); // compute node iterator for applyTemplates if (sortObjects.size() > 0) { Sort.translateSortIterator(classGen, methodGen, _select, sortObjects); int setStartNode = cpg.addInterfaceMethodref(NODE_ITERATOR, SET_START_NODE, "(I)"+ NODE_ITERATOR_SIG); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEINTERFACE(setStartNode,2)); setStartNodeCalled = true; } else { if (_select == null) Mode.compileGetChildren(classGen, methodGen, current); else _select.translate(classGen, methodGen); } } if (_select != null && !setStartNodeCalled) { _select.startIterator(classGen, methodGen); } //!!! need to instantiate all needed modes final String className = classGen.getStylesheet().getClassName(); il.append(methodGen.loadHandler()); final String applyTemplatesSig = classGen.getApplyTemplatesSig(); final int applyTemplates = cpg.addMethodref(className, _functionName, applyTemplatesSig); il.append(new INVOKEVIRTUAL(applyTemplates)); // Pop parameter frame if (stylesheet.hasLocalParams() || hasContents()) { il.append(classGen.loadTranslet()); final int popFrame = cpg.addMethodref(TRANSLET_CLASS, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG); il.append(new INVOKEVIRTUAL(popFrame)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/DocumentCall.java0000644000175000017500000001341610721374030025370 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DocumentCall.java 478657 2006-11-23 20:39:32Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Morten Jorgensen */ final class DocumentCall extends FunctionCall { private Expression _arg1 = null; private Expression _arg2 = null; private Type _arg1Type; /** * Default function call constructor */ public DocumentCall(QName fname, Vector arguments) { super(fname, arguments); } /** * Type checks the arguments passed to the document() function. The first * argument can be any type (we must cast it to a string) and contains the * URI of the document */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // At least one argument - two at most final int ac = argumentCount(); if ((ac < 1) || (ac > 2)) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this); throw new TypeCheckError(msg); } if (getStylesheet() == null) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this); throw new TypeCheckError(msg); } // Parse the first argument _arg1 = argument(0); if (_arg1 == null) {// should not happened ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this); throw new TypeCheckError(msg); } _arg1Type = _arg1.typeCheck(stable); if ((_arg1Type != Type.NodeSet) && (_arg1Type != Type.String)) { _arg1 = new CastExpr(_arg1, Type.String); } // Parse the second argument if (ac == 2) { _arg2 = argument(1); if (_arg2 == null) {// should not happened ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this); throw new TypeCheckError(msg); } final Type arg2Type = _arg2.typeCheck(stable); if (arg2Type.identicalTo(Type.Node)) { _arg2 = new CastExpr(_arg2, Type.NodeSet); } else if (arg2Type.identicalTo(Type.NodeSet)) { // falls through } else { ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this); throw new TypeCheckError(msg); } } return _type = Type.NodeSet; } /** * Translates the document() function call to a call to LoadDocument()'s * static method document(). */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int ac = argumentCount(); final int domField = cpg.addFieldref(classGen.getClassName(), DOM_FIELD, DOM_INTF_SIG); String docParamList = null; if (ac == 1) { // documentF(Object,String,AbstractTranslet,DOM) docParamList = "("+OBJECT_SIG+STRING_SIG+TRANSLET_SIG+DOM_INTF_SIG +")"+NODE_ITERATOR_SIG; } else { //ac == 2; ac < 1 or as >2 was tested in typeChec() // documentF(Object,DTMAxisIterator,String,AbstractTranslet,DOM) docParamList = "("+OBJECT_SIG+NODE_ITERATOR_SIG+STRING_SIG +TRANSLET_SIG+DOM_INTF_SIG+")"+NODE_ITERATOR_SIG; } final int docIdx = cpg.addMethodref(LOAD_DOCUMENT_CLASS, "documentF", docParamList); // The URI can be either a node-set or something else cast to a string _arg1.translate(classGen, methodGen); if (_arg1Type == Type.NodeSet) { _arg1.startIterator(classGen, methodGen); } if (ac == 2) { //_arg2 == null was tested in typeChec() _arg2.translate(classGen, methodGen); _arg2.startIterator(classGen, methodGen); } // Process the rest of the parameters on the stack il.append(new PUSH(cpg, getStylesheet().getSystemId())); il.append(classGen.loadTranslet()); il.append(DUP); il.append(new GETFIELD(domField)); il.append(new INVOKESTATIC(docIdx)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/xpath.cup0000644000175000017500000010742710721374031024017 0ustar mkochmkoch/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: xpath.cup 351910 2005-12-03 10:55:53Z zongaro $ */ /* * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author G. Todd Miller */ package org.apache.xalan.xsltc.compiler; import java.util.Stack; import java.util.Vector; import java.io.StringReader; import java_cup.runtime.*; import org.apache.xml.dtm.DTM; import org.apache.xalan.xsltc.DOM; import org.apache.xml.dtm.Axis; import org.apache.xalan.xsltc.runtime.Operators; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; parser code {: /** * Used by function calls with no args. */ static public final Vector EmptyArgs = new Vector(0); /** * Reference to non-existing variable. */ static public final VariableRef DummyVarRef = null; /** * Reference to the Parser class. */ private Parser _parser; private XSLTC _xsltc; /** * String representation of the expression being parsed. */ private String _expression; /** * Line number where this expression/pattern was declared. */ private int _lineNumber = 0; /** * Reference to the symbol table. */ public SymbolTable _symbolTable; public XPathParser(Parser parser) { _parser = parser; _xsltc = parser.getXSLTC(); _symbolTable = parser.getSymbolTable(); } public int getLineNumber() { return _lineNumber; } public QName getQNameIgnoreDefaultNs(String name) { return _parser.getQNameIgnoreDefaultNs(name); } public QName getQName(String namespace, String prefix, String localname) { return _parser.getQName(namespace, prefix, localname); } public void setMultiDocument(boolean flag) { _xsltc.setMultiDocument(flag); } public void setCallsNodeset(boolean flag) { _xsltc.setCallsNodeset(flag); } public void setHasIdCall(boolean flag) { _xsltc.setHasIdCall(flag); } /** * This method is similar to findNodeType(int, Object) except that it * creates a StepPattern instead of just returning a node type. It also * differs in the way it handles "{uri}:*" and "{uri}:@*". The last two * patterns are expanded as "*[namespace-uri() = 'uri']" and * "@*[namespace-uri() = 'uri']", respectively. This expansion considerably * simplifies the grouping of patterns in the Mode class. For this * expansion to be correct, the priority of the pattern/template must be * set to -0.25 (when no other predicates are present). */ public StepPattern createStepPattern(int axis, Object test, Vector predicates) { int nodeType; if (test == null) { // "*" nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : (axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT; return new StepPattern(axis, nodeType, predicates); } else if (test instanceof Integer) { nodeType = ((Integer) test).intValue(); return new StepPattern(axis, nodeType, predicates); } else { QName name = (QName)test; boolean setPriority = false; if (axis == Axis.NAMESPACE) { nodeType = (name.toString().equals("*")) ? -1 : _xsltc.registerNamespacePrefix(name);; } else { final String uri = name.getNamespace(); final String local = name.getLocalPart(); final QName namespace_uri = _parser.getQNameIgnoreDefaultNs("namespace-uri"); // Expand {uri}:* to *[namespace-uri() = 'uri'] - same for @* if (uri != null && (local.equals("*") || local.equals("@*"))) { if (predicates == null) { predicates = new Vector(2); } // Priority is set by hand if no other predicates exist setPriority = (predicates.size() == 0); predicates.add( new Predicate( new EqualityExpr(Operators.EQ, new NamespaceUriCall(namespace_uri), new LiteralExpr(uri)))); } if (local.equals("*")) { nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : NodeTest.ELEMENT; } else if (local.equals("@*")) { nodeType = NodeTest.ATTRIBUTE; } else { nodeType = (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name) : _xsltc.registerElement(name); } } final StepPattern result = new StepPattern(axis, nodeType, predicates); // Set priority for case prefix:* and prefix:@* (no predicates) if (setPriority) { result.setPriority(-0.25); } return result; } } public int findNodeType(int axis, Object test) { if (test == null) { // * return (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : (axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT; } else if (test instanceof Integer) { return ((Integer)test).intValue(); } else { QName name = (QName)test; if (axis == Axis.NAMESPACE) { return (name.toString().equals("*")) ? -1 : _xsltc.registerNamespacePrefix(name); } if (name.getNamespace() == null) { final String local = name.getLocalPart(); if (local.equals("*")) { return (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : NodeTest.ELEMENT; } else if (local.equals("@*")) { return NodeTest.ATTRIBUTE; } } return (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name) : _xsltc.registerElement(name); } } /** * Parse the expression passed to the current scanner. If this * expression contains references to local variables and it will be * compiled in an external module (not in the main class) request * the current template to create a new variable stack frame. * * @param lineNumber Line where the current expression is defined. * @param external Set to true if this expression is * compiled in a separate module. * */ public Symbol parse(String expression, int lineNumber) throws Exception { try { _expression = expression; _lineNumber = lineNumber; return super.parse(); } catch (IllegalCharException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_CHAR_ERR, lineNumber, e.getMessage()); _parser.reportError(Constants.FATAL, err); } return null; } /** * Lookup a variable or parameter in the symbol table given its name. * * @param name Name of the symbol being looked up. */ final SyntaxTreeNode lookupName(QName name) { // Is it a local var or param ? final SyntaxTreeNode result = _parser.lookupVariable(name); if (result != null) return(result); else return(_symbolTable.lookupName(name)); } public final void addError(ErrorMsg error) { _parser.reportError(Constants.ERROR, error); } public void report_error(String message, Object info) { final ErrorMsg err = new ErrorMsg(ErrorMsg.SYNTAX_ERR, _lineNumber, _expression); _parser.reportError(Constants.FATAL, err); } public void report_fatal_error(String message, Object info) { // empty } public RelativeLocationPath insertStep(Step step, RelativeLocationPath rlp) { if (rlp instanceof Step) { return new ParentLocationPath(step, (Step) rlp); } else if (rlp instanceof ParentLocationPath) { final ParentLocationPath plp = (ParentLocationPath) rlp; final RelativeLocationPath newrlp = insertStep(step, plp.getPath()); return new ParentLocationPath(newrlp, plp.getStep()); } else { addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep")); return rlp; } } /** * Returns true if the axis applies to elements only. The axes * child, attribute, namespace, descendant result in non-empty * nodesets only if the context node is of type element. */ public boolean isElementAxis(int axis) { return (axis == Axis.CHILD || axis == Axis.ATTRIBUTE || axis == Axis.NAMESPACE || axis == Axis.DESCENDANT); } :} terminal SLASH, DOT, LBRACK, RBRACK, VBAR, LPAREN, RPAREN, STAR, COMMA; terminal DOLLAR, ATSIGN; terminal DDOT, DCOLON, DSLASH; terminal EQ, NE; terminal LT, GT, LE, GE; terminal PLUS, MINUS, DIV, MOD, MULT; terminal String Literal; terminal String QNAME; terminal ID, KEY, TEXT, NODE, OR, AND, COMMENT, PI, PIPARAM, PRECEDINGSIBLING; terminal SELF, PARENT, CHILD, ATTRIBUTE, ANCESTOR, ANCESTORORSELF, DESCENDANT; terminal DESCENDANTORSELF, FOLLOWING, FOLLOWINGSIBLING, NAMESPACE, PRECEDING; terminal Double REAL; terminal Long INT; terminal PATTERN, EXPRESSION; non terminal SyntaxTreeNode TopLevel; non terminal Expression Expr, Argument, LocationPath; non terminal Expression Predicate, FilterExpr, Step; non terminal Expression OrExpr, AndExpr, EqualityExpr; non terminal Expression RelationalExpr, AdditiveExpr; non terminal Expression MultiplicativeExpr, UnaryExpr; non terminal Expression VariableReference, FunctionCall; non terminal Expression PrimaryExpr, UnionExpr, PathExpr, AbbreviatedStep; non terminal Expression RelativeLocationPath, AbbreviatedRelativeLocationPath; non terminal Expression AbsoluteLocationPath, AbbreviatedAbsoluteLocationPath; non terminal Object NodeTest, NameTest; non terminal IdKeyPattern IdKeyPattern; non terminal Pattern Pattern; non terminal Pattern LocationPathPattern; non terminal StepPattern ProcessingInstructionPattern; non terminal RelativePathPattern RelativePathPattern; non terminal StepPattern StepPattern; non terminal Object NodeTestPattern, NameTestPattern; non terminal Vector Predicates, NonemptyArgumentList; non terminal QName QName, FunctionName, VariableName; non terminal Integer AxisName, AxisSpecifier; non terminal Integer ChildOrAttributeAxisSpecifier; precedence left VBAR; precedence left OR; precedence left AND; precedence nonassoc EQ, NE; precedence left LT, GT, LE, GE; precedence left PLUS, MINUS; precedence left DIV, MOD, MULT; precedence left DOLLAR; precedence left ATSIGN; precedence right DCOLON; start with TopLevel; TopLevel ::= PATTERN Pattern:pattern {: RESULT = pattern; :} | EXPRESSION Expr:expr {: RESULT = expr; :}; /* --------------------------- Patterns ----------------------------------- */ Pattern ::= LocationPathPattern:lpp {: RESULT = lpp; :} | LocationPathPattern:lpp VBAR Pattern:p {: RESULT = new AlternativePattern(lpp, p); :}; LocationPathPattern ::= SLASH {: RESULT = new AbsolutePathPattern(null); :} | SLASH RelativePathPattern:rpp {: RESULT = new AbsolutePathPattern(rpp); :} | IdKeyPattern:ikp {: RESULT = ikp; :} | IdKeyPattern:ikp SLASH RelativePathPattern:rpp {: RESULT = new ParentPattern(ikp, rpp); :} | IdKeyPattern:ikp DSLASH RelativePathPattern:rpp {: RESULT = new AncestorPattern(ikp, rpp); :} | DSLASH RelativePathPattern:rpp {: RESULT = new AncestorPattern(rpp); :} | RelativePathPattern:rpp {: RESULT = rpp; :}; IdKeyPattern ::= ID LPAREN Literal:l RPAREN {: RESULT = new IdPattern(l); parser.setHasIdCall(true); :} | KEY LPAREN Literal:l1 COMMA Literal:l2 RPAREN {: RESULT = new KeyPattern(l1, l2); :}; ProcessingInstructionPattern ::= PIPARAM LPAREN Literal:l RPAREN {: RESULT = new ProcessingInstructionPattern(l); :}; RelativePathPattern ::= StepPattern:sp {: RESULT = sp; :} | StepPattern:sp SLASH RelativePathPattern:rpp {: RESULT = new ParentPattern(sp, rpp); :} | StepPattern:sp DSLASH RelativePathPattern:rpp {: RESULT = new AncestorPattern(sp, rpp); :}; StepPattern ::= NodeTestPattern:nt {: RESULT = parser.createStepPattern(Axis.CHILD, nt, null); :} | NodeTestPattern:nt Predicates:pp {: RESULT = parser.createStepPattern(Axis.CHILD, nt, pp); :} | ProcessingInstructionPattern:pip {: RESULT = pip; :} | ProcessingInstructionPattern:pip Predicates:pp {: RESULT = (ProcessingInstructionPattern)pip.setPredicates(pp); :} | ChildOrAttributeAxisSpecifier:axis NodeTestPattern:nt {: RESULT = parser.createStepPattern(axis.intValue(), nt, null); :} | ChildOrAttributeAxisSpecifier:axis NodeTestPattern:nt Predicates:pp {: RESULT = parser.createStepPattern(axis.intValue(), nt, pp); :} | ChildOrAttributeAxisSpecifier:axis ProcessingInstructionPattern:pip {: RESULT = pip; // TODO: report error if axis is attribute :} | ChildOrAttributeAxisSpecifier:axis ProcessingInstructionPattern:pip Predicates:pp {: // TODO: report error if axis is attribute RESULT = (ProcessingInstructionPattern)pip.setPredicates(pp); :}; NodeTestPattern ::= NameTestPattern:nt {: RESULT = nt; :} | NODE {: RESULT = new Integer(NodeTest.ANODE); :} | TEXT {: RESULT = new Integer(NodeTest.TEXT); :} | COMMENT {: RESULT = new Integer(NodeTest.COMMENT); :} | PI {: RESULT = new Integer(NodeTest.PI); :}; NameTestPattern ::= STAR {: RESULT = null; :} | QName:qn {: RESULT = qn; :}; ChildOrAttributeAxisSpecifier ::= ATSIGN {: RESULT = new Integer(Axis.ATTRIBUTE); :} | CHILD DCOLON {: RESULT = new Integer(Axis.CHILD); :} | ATTRIBUTE DCOLON {: RESULT = new Integer(Axis.ATTRIBUTE); :}; Predicates ::= Predicate:p {: Vector temp = new Vector(); temp.addElement(p); RESULT = temp; :} | Predicate:p Predicates:pp {: pp.insertElementAt(p, 0); RESULT = pp; :}; Predicate ::= LBRACK Expr:e RBRACK {: RESULT = new Predicate(e); :}; /* --------------------------- Expressions --------------------------------- */ Expr ::= OrExpr:ex {: RESULT = ex; :}; OrExpr ::= AndExpr:ae {: RESULT = ae; :} | OrExpr:oe OR AndExpr:ae {: RESULT = new LogicalExpr(LogicalExpr.OR, oe, ae); :}; AndExpr ::= EqualityExpr:e {: RESULT = e; :} | AndExpr:ae AND EqualityExpr:ee {: RESULT = new LogicalExpr(LogicalExpr.AND, ae, ee); :}; EqualityExpr ::= RelationalExpr:re {: RESULT = re; :} | EqualityExpr:ee EQ RelationalExpr:re {: RESULT = new EqualityExpr(Operators.EQ, ee, re); :} | EqualityExpr:ee NE RelationalExpr:re {: RESULT = new EqualityExpr(Operators.NE, ee, re); :}; RelationalExpr ::= AdditiveExpr:ae {: RESULT = ae; :} | RelationalExpr:re LT AdditiveExpr:ae {: RESULT = new RelationalExpr(Operators.LT, re, ae); :} | RelationalExpr:re GT AdditiveExpr:ae {: RESULT = new RelationalExpr(Operators.GT, re, ae); :} | RelationalExpr:re LE AdditiveExpr:ae {: RESULT = new RelationalExpr(Operators.LE, re, ae); :} | RelationalExpr:re GE AdditiveExpr:ae {: RESULT = new RelationalExpr(Operators.GE, re, ae); :}; AdditiveExpr ::= MultiplicativeExpr:me {: RESULT = me; :} | AdditiveExpr:ae PLUS MultiplicativeExpr:me {: RESULT = new BinOpExpr(BinOpExpr.PLUS, ae, me); :} | AdditiveExpr:ae MINUS MultiplicativeExpr:me {: RESULT = new BinOpExpr(BinOpExpr.MINUS, ae, me); :}; MultiplicativeExpr ::= UnaryExpr:ue {: RESULT = ue; :} | MultiplicativeExpr:me MULT UnaryExpr:ue {: RESULT = new BinOpExpr(BinOpExpr.TIMES, me, ue); :} | MultiplicativeExpr:me DIV UnaryExpr:ue {: RESULT = new BinOpExpr(BinOpExpr.DIV, me, ue); :} | MultiplicativeExpr:me MOD UnaryExpr:ue {: RESULT = new BinOpExpr(BinOpExpr.MOD, me, ue); :}; UnaryExpr ::= UnionExpr:ue {: RESULT = ue; :} | MINUS UnaryExpr:ue {: RESULT = new UnaryOpExpr(ue); :}; UnionExpr ::= PathExpr:pe {: RESULT = pe; :} | PathExpr:pe VBAR UnionExpr:rest {: RESULT = new UnionPathExpr(pe, rest); :}; PathExpr ::= LocationPath:lp {: RESULT = lp; :} | FilterExpr:fexp {: RESULT = fexp; :} | FilterExpr:fexp SLASH RelativeLocationPath:rlp {: RESULT = new FilterParentPath(fexp, rlp); :} | FilterExpr:fexp DSLASH RelativeLocationPath:rlp {: // // Expand '//' into '/descendant-or-self::node()/' or // into /descendant-or-self::*/ // int nodeType = DOM.NO_TYPE; if (rlp instanceof Step && parser.isElementAxis(((Step) rlp).getAxis())) { nodeType = DTM.ELEMENT_NODE; } final Step step = new Step(Axis.DESCENDANTORSELF, nodeType, null); FilterParentPath fpp = new FilterParentPath(fexp, step); fpp = new FilterParentPath(fpp, rlp); if (fexp instanceof KeyCall == false) { fpp.setDescendantAxis(); } RESULT = fpp; :}; LocationPath ::= RelativeLocationPath:rlp {: RESULT = rlp; :} | AbsoluteLocationPath:alp {: RESULT = alp; :}; RelativeLocationPath ::= Step:step {: RESULT = step; :} | RelativeLocationPath:rlp SLASH Step:step {: if (rlp instanceof Step && ((Step) rlp).isAbbreviatedDot()) { RESULT = step; // Remove './' from the middle } else if (((Step) step).isAbbreviatedDot()) { RESULT = rlp; // Remove '/.' from the end } else { RESULT = new ParentLocationPath((RelativeLocationPath) rlp, step); } :} | AbbreviatedRelativeLocationPath:arlp {: RESULT = arlp; :}; AbsoluteLocationPath ::= SLASH {: RESULT = new AbsoluteLocationPath(); :} | SLASH RelativeLocationPath:rlp {: RESULT = new AbsoluteLocationPath(rlp); :} | AbbreviatedAbsoluteLocationPath:aalp {: RESULT = aalp; :}; AbbreviatedRelativeLocationPath ::= RelativeLocationPath:rlp DSLASH Step:step {: final Step right = (Step)step; final int axis = right.getAxis(); final int type = right.getNodeType(); final Vector predicates = right.getPredicates(); if ((axis == Axis.CHILD) && (type != NodeTest.ATTRIBUTE)) { // Compress './/child:E' into 'descendant::E' - if possible if (predicates == null) { right.setAxis(Axis.DESCENDANT); if (rlp instanceof Step && ((Step)rlp).isAbbreviatedDot()) { RESULT = right; } else { // Expand 'rlp//child::E' into 'rlp/descendant::E' RelativeLocationPath left = (RelativeLocationPath)rlp; RESULT = new ParentLocationPath(left, right); } } else { // Expand './/step' -> 'descendant-or-self::*/step' if (rlp instanceof Step && ((Step)rlp).isAbbreviatedDot()) { Step left = new Step(Axis.DESCENDANTORSELF, DTM.ELEMENT_NODE, null); RESULT = new ParentLocationPath(left, right); } else { // Expand 'rlp//step' -> 'rlp/descendant-or-self::*/step' RelativeLocationPath left = (RelativeLocationPath)rlp; Step mid = new Step(Axis.DESCENDANTORSELF, DTM.ELEMENT_NODE, null); ParentLocationPath ppl = new ParentLocationPath(mid, right); RESULT = new ParentLocationPath(left, ppl); } } } else if ((axis == Axis.ATTRIBUTE) || (type == NodeTest.ATTRIBUTE)) { // Expand 'rlp//step' -> 'rlp/descendant-or-self::*/step' RelativeLocationPath left = (RelativeLocationPath)rlp; Step middle = new Step(Axis.DESCENDANTORSELF, DTM.ELEMENT_NODE, null); ParentLocationPath ppl = new ParentLocationPath(middle, right); RESULT = new ParentLocationPath(left, ppl); } else { // Expand 'rlp//step' -> 'rlp/descendant-or-self::node()/step' RelativeLocationPath left = (RelativeLocationPath)rlp; Step middle = new Step(Axis.DESCENDANTORSELF, DOM.NO_TYPE, null); ParentLocationPath ppl = new ParentLocationPath(middle, right); RESULT = new ParentLocationPath(left, ppl); } :}; AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath:rlp {: // // Expand '//' into '/descendant-or-self::node()/' or // into /descendant-or-self::*/ // int nodeType = DOM.NO_TYPE; if (rlp instanceof Step && parser.isElementAxis(((Step) rlp).getAxis())) { nodeType = DTM.ELEMENT_NODE; } final Step step = new Step(Axis.DESCENDANTORSELF, nodeType, null); RESULT = new AbsoluteLocationPath(parser.insertStep(step, (RelativeLocationPath) rlp)); :}; Step ::= NodeTest:ntest {: if (ntest instanceof Step) { RESULT = (Step)ntest; } else { RESULT = new Step(Axis.CHILD, parser.findNodeType(Axis.CHILD, ntest), null); } :} | NodeTest:ntest Predicates:pp {: if (ntest instanceof Step) { Step step = (Step)ntest; step.addPredicates(pp); RESULT = (Step)ntest; } else { RESULT = new Step(Axis.CHILD, parser.findNodeType(Axis.CHILD, ntest), pp); } :} | AxisSpecifier:axis NodeTest:ntest Predicates:pp {: RESULT = new Step(axis.intValue(), parser.findNodeType(axis.intValue(), ntest), pp); :} | AxisSpecifier:axis NodeTest:ntest {: RESULT = new Step(axis.intValue(), parser.findNodeType(axis.intValue(), ntest), null); :} | AbbreviatedStep:abbrev {: RESULT = abbrev; :}; AxisSpecifier ::= AxisName:an DCOLON {: RESULT = an; :} | ATSIGN {: RESULT = new Integer(Axis.ATTRIBUTE); :}; AxisName ::= ANCESTOR {: RESULT = new Integer(Axis.ANCESTOR); :} | ANCESTORORSELF {: RESULT = new Integer(Axis.ANCESTORORSELF); :} | ATTRIBUTE {: RESULT = new Integer(Axis.ATTRIBUTE); :} | CHILD {: RESULT = new Integer(Axis.CHILD); :} | DESCENDANT {: RESULT = new Integer(Axis.DESCENDANT); :} | DESCENDANTORSELF {: RESULT = new Integer(Axis.DESCENDANTORSELF); :} | FOLLOWING {: RESULT = new Integer(Axis.FOLLOWING); :} | FOLLOWINGSIBLING {: RESULT = new Integer(Axis.FOLLOWINGSIBLING); :} | NAMESPACE {: RESULT = new Integer(Axis.NAMESPACE); :} | PARENT {: RESULT = new Integer(Axis.PARENT); :} | PRECEDING {: RESULT = new Integer(Axis.PRECEDING); :} | PRECEDINGSIBLING {: RESULT = new Integer(Axis.PRECEDINGSIBLING); :} | SELF {: RESULT = new Integer(Axis.SELF); :}; AbbreviatedStep ::= DOT {: RESULT = new Step(Axis.SELF, NodeTest.ANODE, null); :} | DDOT {: RESULT = new Step(Axis.PARENT, NodeTest.ANODE, null); :}; FilterExpr ::= PrimaryExpr:primary {: RESULT = primary; :} | PrimaryExpr:primary Predicates:pp {: RESULT = new FilterExpr(primary, pp); :}; PrimaryExpr ::= VariableReference:vr {: RESULT = vr; :} | LPAREN Expr:ex RPAREN {: RESULT = ex; :} | Literal:string {: /* * If the string appears to have the syntax of a QName, store * namespace info in the literal expression. This is used for * element-available and function-available functions, among * others. Also, the default namespace must be ignored. */ String namespace = null; final int index = string.lastIndexOf(':'); if (index > 0) { final String prefix = string.substring(0, index); namespace = parser._symbolTable.lookupNamespace(prefix); } RESULT = (namespace == null) ? new LiteralExpr(string) : new LiteralExpr(string, namespace); :} | INT:num {: long value = num.longValue(); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { RESULT = new RealExpr(value); } else { if (num.doubleValue() == -0) RESULT = new RealExpr(num.doubleValue()); else if (num.intValue() == 0) RESULT = new IntExpr(num.intValue()); else if (num.doubleValue() == 0.0) RESULT = new RealExpr(num.doubleValue()); else RESULT = new IntExpr(num.intValue()); } :} | REAL:num {: RESULT = new RealExpr(num.doubleValue()); :} | FunctionCall:fc {: RESULT = fc; :}; VariableReference ::= DOLLAR VariableName:varName {: // An empty qname prefix for a variable or parameter reference // should map to the null namespace and not the default URI. SyntaxTreeNode node = parser.lookupName(varName); if (node != null) { if (node instanceof Variable) { RESULT = new VariableRef((Variable)node); } else if (node instanceof Param) { RESULT = new ParameterRef((Param)node); } else { RESULT = new UnresolvedRef(varName); } } if (node == null) { RESULT = new UnresolvedRef(varName); } :}; FunctionCall ::= FunctionName:fname LPAREN RPAREN {: if (fname == parser.getQNameIgnoreDefaultNs("current")) { RESULT = new CurrentCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("number")) { RESULT = new NumberCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("string")) { RESULT = new StringCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("concat")) { RESULT = new ConcatCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("true")) { RESULT = new BooleanExpr(true); } else if (fname == parser.getQNameIgnoreDefaultNs("false")) { RESULT = new BooleanExpr(false); } else if (fname == parser.getQNameIgnoreDefaultNs("name")) { RESULT = new NameCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) { RESULT = new GenerateIdCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) { RESULT = new StringLengthCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("position")) { RESULT = new PositionCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("last")) { RESULT = new LastCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("local-name")) { RESULT = new LocalNameCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("namespace-uri")) { RESULT = new NamespaceUriCall(fname); } else { RESULT = new FunctionCall(fname, parser.EmptyArgs); } :} | FunctionName:fname LPAREN NonemptyArgumentList:argl RPAREN {: if (fname == parser.getQNameIgnoreDefaultNs("concat")) { RESULT = new ConcatCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("number")) { RESULT = new NumberCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("document")) { parser.setMultiDocument(true); RESULT = new DocumentCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("string")) { RESULT = new StringCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("boolean")) { RESULT = new BooleanCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("name")) { RESULT = new NameCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) { RESULT = new GenerateIdCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("not")) { RESULT = new NotCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("format-number")) { RESULT = new FormatNumberCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("unparsed-entity-uri")) { RESULT = new UnparsedEntityUriCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("key")) { RESULT = new KeyCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("id")) { RESULT = new KeyCall(fname, argl); parser.setHasIdCall(true); } else if (fname == parser.getQNameIgnoreDefaultNs("ceiling")) { RESULT = new CeilingCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("round")) { RESULT = new RoundCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("floor")) { RESULT = new FloorCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("contains")) { RESULT = new ContainsCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) { RESULT = new StringLengthCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("starts-with")) { RESULT = new StartsWithCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("function-available")) { RESULT = new FunctionAvailableCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("element-available")) { RESULT = new ElementAvailableCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("local-name")) { RESULT = new LocalNameCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("lang")) { RESULT = new LangCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("namespace-uri")) { RESULT = new NamespaceUriCall(fname, argl); } else if (fname == parser.getQName(Constants.TRANSLET_URI, "xsltc", "cast")) { RESULT = new CastCall(fname, argl); } // Special case for extension function nodeset() else if (fname.getLocalPart().equals("nodeset") || fname.getLocalPart().equals("node-set")) { parser.setCallsNodeset(true); // implies MultiDOM RESULT = new FunctionCall(fname, argl); } else { RESULT = new FunctionCall(fname, argl); } :}; NonemptyArgumentList ::= Argument:arg {: Vector temp = new Vector(); temp.addElement(arg); RESULT = temp; :} | Argument:arg COMMA NonemptyArgumentList:argl {: argl.insertElementAt(arg, 0); RESULT = argl; :}; FunctionName ::= QName:fname {: RESULT = fname; :}; VariableName ::= QName:vname {: RESULT = vname; :}; Argument ::= Expr:ex {: RESULT = ex; :}; NodeTest ::= NameTest:nt {: RESULT = nt; :} | NODE {: RESULT = new Integer(NodeTest.ANODE); :} | TEXT {: RESULT = new Integer(NodeTest.TEXT); :} | COMMENT {: RESULT = new Integer(NodeTest.COMMENT); :} | PIPARAM LPAREN Literal:l RPAREN {: QName name = parser.getQNameIgnoreDefaultNs("name"); Expression exp = new EqualityExpr(Operators.EQ, new NameCall(name), new LiteralExpr(l)); Vector predicates = new Vector(); predicates.addElement(new Predicate(exp)); RESULT = new Step(Axis.CHILD, NodeTest.PI, predicates); :} | PI {: RESULT = new Integer(NodeTest.PI); :}; NameTest ::= STAR {: RESULT = null; :} | QName:qn {: RESULT = qn; :}; QName ::= QNAME:qname {: RESULT = parser.getQNameIgnoreDefaultNs(qname); :} | DIV {: RESULT = parser.getQNameIgnoreDefaultNs("div"); :} | MOD {: RESULT = parser.getQNameIgnoreDefaultNs("mod"); :} | KEY {: RESULT = parser.getQNameIgnoreDefaultNs("key"); :} | ANCESTOR {: RESULT = parser.getQNameIgnoreDefaultNs("child"); :} | ANCESTORORSELF {: RESULT = parser.getQNameIgnoreDefaultNs("ancestor-or-self"); :} | ATTRIBUTE {: RESULT = parser.getQNameIgnoreDefaultNs("attribute"); :} | CHILD {: RESULT = parser.getQNameIgnoreDefaultNs("child"); :} | DESCENDANT {: RESULT = parser.getQNameIgnoreDefaultNs("decendant"); :} | DESCENDANTORSELF {: RESULT = parser.getQNameIgnoreDefaultNs("decendant-or-self"); :} | FOLLOWING {: RESULT = parser.getQNameIgnoreDefaultNs("following"); :} | FOLLOWINGSIBLING {: RESULT = parser.getQNameIgnoreDefaultNs("following-sibling"); :} | NAMESPACE {: RESULT = parser.getQNameIgnoreDefaultNs("namespace"); :} | PARENT {: RESULT = parser.getQNameIgnoreDefaultNs("parent"); :} | PRECEDING {: RESULT = parser.getQNameIgnoreDefaultNs("preceding"); :} | PRECEDINGSIBLING {: RESULT = parser.getQNameIgnoreDefaultNs("preceding-sibling"); :} | SELF {: RESULT = parser.getQNameIgnoreDefaultNs("self"); :} | ID {: RESULT = parser.getQNameIgnoreDefaultNs("id"); :}; libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/RealExpr.java0000644000175000017500000000363010721374030024535 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RealExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class RealExpr extends Expression { private double _value; public RealExpr(double value) { _value = value; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return _type = Type.Real; } public String toString() { return "real-expr(" + _value + ')'; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/TopLevelElement.java0000644000175000017500000000621110721374033026060 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TopLevelElement.java 476471 2006-11-18 08:36:27Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; class TopLevelElement extends SyntaxTreeNode { /* * List of dependencies with other variables, parameters or * keys defined at the top level. */ protected Vector _dependencies = null; /** * Type check all the children of this node. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return typeCheckContents(stable); } /** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); } /** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; } public void display(int indent) { indent(indent); Util.println("TopLevelElement"); displayContents(indent + IndentIncrement); } /** * Add a dependency with other top-level elements like * variables, parameters or keys. */ public void addDependency(TopLevelElement other) { if (_dependencies == null) { _dependencies = new Vector(); } if (!_dependencies.contains(other)) { _dependencies.addElement(other); } } /** * Get the list of dependencies with other top-level elements * like variables, parameteres or keys. */ public Vector getDependencies() { return _dependencies; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/XPathLexer.java0000644000175000017500000015040410721374030025041 0ustar mkochmkoch/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: xpath.lex 351910 2005-12-03 10:55:53Z zongaro $ */ /* * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * */ package org.apache.xalan.xsltc.compiler; import java_cup.runtime.Symbol; class XPathLexer implements java_cup.runtime.Scanner { private final int YY_BUFFER_SIZE = 512; private final int YY_F = -1; private final int YY_NO_STATE = -1; private final int YY_NOT_ACCEPT = 0; private final int YY_START = 1; private final int YY_END = 2; private final int YY_NO_ANCHOR = 4; private final int YY_BOL = 65536; private final int YY_EOF = 65537; public final int YYEOF = -1; int last; void initialize() { last = -1; } static boolean isWhitespace(int c) { return (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f'); } /** * If symbol is not followed by '::' or '(', then treat it as a * name instead of an axis or function (Jira-1912). */ Symbol disambiguateAxisOrFunction(int ss) throws Exception { // Peek in the input buffer without changing the internal state int index = yy_buffer_index; // Skip whitespace while (index < yy_buffer_read && isWhitespace(yy_buffer[index])) { index++; } // If end of buffer, can't disambiguate :( if (index >= yy_buffer_read) { // Can't disambiguate, so return as symbol return new Symbol(ss); } // Return symbol if next token is '::' or '(' return (yy_buffer[index] == ':' && yy_buffer[index+1] == ':' || yy_buffer[index] == '(') ? newSymbol(ss) : newSymbol(sym.QNAME, yytext()); } /** * If symbol is first token or if it follows any of the operators * listed in http://www.w3.org/TR/xpath#exprlex then treat as a * name instead of a keyword (Jira-1912). */ Symbol disambiguateOperator(int ss) throws Exception { switch (last) { case -1: // first token case sym.ATSIGN: case sym.DCOLON: case sym.LPAREN: case sym.LBRACK: case sym.COMMA: case sym.AND: case sym.OR: case sym.MOD: case sym.DIV: case sym.MULT: case sym.SLASH: case sym.DSLASH: case sym.VBAR: case sym.PLUS: case sym.MINUS: case sym.EQ: case sym.NE: case sym.LT: case sym.LE: case sym.GT: case sym.GE: return newSymbol(sym.QNAME, yytext()); } return newSymbol(ss); } /** * If symbol is first token or if it follows any of the operators * listed in http://www.w3.org/TR/xpath#exprlex then treat as a * wildcard instead of a multiplication operator */ Symbol disambiguateStar() throws Exception { switch (last) { case -1: // first token case sym.ATSIGN: case sym.DCOLON: case sym.LPAREN: case sym.LBRACK: case sym.COMMA: case sym.AND: case sym.OR: case sym.MOD: case sym.DIV: case sym.MULT: case sym.SLASH: case sym.DSLASH: case sym.VBAR: case sym.PLUS: case sym.MINUS: case sym.EQ: case sym.NE: case sym.LT: case sym.LE: case sym.GT: case sym.GE: return newSymbol(sym.STAR); } return newSymbol(sym.MULT); } Symbol newSymbol(int ss) { last = ss; return new Symbol(ss); } Symbol newSymbol(int ss, String value) { last = ss; return new Symbol(ss, value); } Symbol newSymbol(int ss, Long value) { last = ss; return new Symbol(ss, value); } Symbol newSymbol(int ss, Double value) { last = ss; return new Symbol(ss, value); } private java.io.BufferedReader yy_reader; private int yy_buffer_index; private int yy_buffer_read; private int yy_buffer_start; private int yy_buffer_end; private char yy_buffer[]; private boolean yy_at_bol; private int yy_lexical_state; XPathLexer (java.io.Reader reader) { this (); if (null == reader) { throw (new Error("Error: Bad input stream initializer.")); } yy_reader = new java.io.BufferedReader(reader); } XPathLexer (java.io.InputStream instream) { this (); if (null == instream) { throw (new Error("Error: Bad input stream initializer.")); } yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream)); } private XPathLexer () { yy_buffer = new char[YY_BUFFER_SIZE]; yy_buffer_read = 0; yy_buffer_index = 0; yy_buffer_start = 0; yy_buffer_end = 0; yy_at_bol = true; yy_lexical_state = YYINITIAL; } private boolean yy_eof_done = false; private final int YYINITIAL = 0; private final int yy_state_dtrans[] = { 0 }; private void yybegin (int state) { yy_lexical_state = state; } private int yy_advance () throws java.io.IOException { int next_read; int i; int j; if (yy_buffer_index < yy_buffer_read) { return yy_buffer[yy_buffer_index++]; } if (0 != yy_buffer_start) { i = yy_buffer_start; j = 0; while (i < yy_buffer_read) { yy_buffer[j] = yy_buffer[i]; ++i; ++j; } yy_buffer_end = yy_buffer_end - yy_buffer_start; yy_buffer_start = 0; yy_buffer_read = j; yy_buffer_index = j; next_read = yy_reader.read(yy_buffer, yy_buffer_read, yy_buffer.length - yy_buffer_read); if (-1 == next_read) { return YY_EOF; } yy_buffer_read = yy_buffer_read + next_read; } while (yy_buffer_index >= yy_buffer_read) { if (yy_buffer_index >= yy_buffer.length) { yy_buffer = yy_double(yy_buffer); } next_read = yy_reader.read(yy_buffer, yy_buffer_read, yy_buffer.length - yy_buffer_read); if (-1 == next_read) { return YY_EOF; } yy_buffer_read = yy_buffer_read + next_read; } return yy_buffer[yy_buffer_index++]; } private void yy_move_end () { if (yy_buffer_end > yy_buffer_start && '\n' == yy_buffer[yy_buffer_end-1]) yy_buffer_end--; if (yy_buffer_end > yy_buffer_start && '\r' == yy_buffer[yy_buffer_end-1]) yy_buffer_end--; } private boolean yy_last_was_cr=false; private void yy_mark_start () { yy_buffer_start = yy_buffer_index; } private void yy_mark_end () { yy_buffer_end = yy_buffer_index; } private void yy_to_mark () { yy_buffer_index = yy_buffer_end; yy_at_bol = (yy_buffer_end > yy_buffer_start) && ('\r' == yy_buffer[yy_buffer_end-1] || '\n' == yy_buffer[yy_buffer_end-1] || 2028/*LS*/ == yy_buffer[yy_buffer_end-1] || 2029/*PS*/ == yy_buffer[yy_buffer_end-1]); } private java.lang.String yytext () { return (new java.lang.String(yy_buffer, yy_buffer_start, yy_buffer_end - yy_buffer_start)); } private int yylength () { return yy_buffer_end - yy_buffer_start; } private char[] yy_double (char buf[]) { int i; char newbuf[]; newbuf = new char[2*buf.length]; for (i = 0; i < buf.length; ++i) { newbuf[i] = buf[i]; } return newbuf; } private final int YY_E_INTERNAL = 0; private final int YY_E_MATCH = 1; private java.lang.String yy_error_string[] = { "Error: Internal error.\n", "Error: Unmatched input.\n" }; private void yy_error (int code,boolean fatal) { java.lang.System.out.print(yy_error_string[code]); java.lang.System.out.flush(); if (fatal) { throw new Error("Fatal Error.\n"); } } static private int[][] unpackFromString(int size1, int size2, String st) { int colonIndex = -1; String lengthString; int sequenceLength = 0; int sequenceInteger = 0; int commaIndex; String workString; int res[][] = new int[size1][size2]; for (int i= 0; i < size1; i++) { for (int j= 0; j < size2; j++) { if (sequenceLength != 0) { res[i][j] = sequenceInteger; sequenceLength--; continue; } commaIndex = st.indexOf(','); workString = (commaIndex==-1) ? st : st.substring(0, commaIndex); st = st.substring(commaIndex+1); colonIndex = workString.indexOf(':'); if (colonIndex == -1) { res[i][j]=Integer.parseInt(workString); continue; } lengthString = workString.substring(colonIndex+1); sequenceLength=Integer.parseInt(lengthString); workString=workString.substring(0,colonIndex); sequenceInteger=Integer.parseInt(workString); res[i][j] = sequenceInteger; sequenceLength--; } } return res; } private int yy_acpt[] = { /* 0 */ YY_NOT_ACCEPT, /* 1 */ YY_NO_ANCHOR, /* 2 */ YY_NO_ANCHOR, /* 3 */ YY_NO_ANCHOR, /* 4 */ YY_NO_ANCHOR, /* 5 */ YY_NO_ANCHOR, /* 6 */ YY_NO_ANCHOR, /* 7 */ YY_NO_ANCHOR, /* 8 */ YY_NO_ANCHOR, /* 9 */ YY_NO_ANCHOR, /* 10 */ YY_NO_ANCHOR, /* 11 */ YY_NO_ANCHOR, /* 12 */ YY_NO_ANCHOR, /* 13 */ YY_NO_ANCHOR, /* 14 */ YY_NO_ANCHOR, /* 15 */ YY_NO_ANCHOR, /* 16 */ YY_NO_ANCHOR, /* 17 */ YY_NO_ANCHOR, /* 18 */ YY_NO_ANCHOR, /* 19 */ YY_NO_ANCHOR, /* 20 */ YY_NO_ANCHOR, /* 21 */ YY_NO_ANCHOR, /* 22 */ YY_NO_ANCHOR, /* 23 */ YY_NO_ANCHOR, /* 24 */ YY_NO_ANCHOR, /* 25 */ YY_NO_ANCHOR, /* 26 */ YY_NO_ANCHOR, /* 27 */ YY_NO_ANCHOR, /* 28 */ YY_NO_ANCHOR, /* 29 */ YY_NO_ANCHOR, /* 30 */ YY_NO_ANCHOR, /* 31 */ YY_NO_ANCHOR, /* 32 */ YY_NO_ANCHOR, /* 33 */ YY_NO_ANCHOR, /* 34 */ YY_NO_ANCHOR, /* 35 */ YY_NO_ANCHOR, /* 36 */ YY_NO_ANCHOR, /* 37 */ YY_NO_ANCHOR, /* 38 */ YY_NO_ANCHOR, /* 39 */ YY_NO_ANCHOR, /* 40 */ YY_NO_ANCHOR, /* 41 */ YY_NO_ANCHOR, /* 42 */ YY_NO_ANCHOR, /* 43 */ YY_NO_ANCHOR, /* 44 */ YY_NO_ANCHOR, /* 45 */ YY_NO_ANCHOR, /* 46 */ YY_NO_ANCHOR, /* 47 */ YY_NO_ANCHOR, /* 48 */ YY_NO_ANCHOR, /* 49 */ YY_NO_ANCHOR, /* 50 */ YY_NO_ANCHOR, /* 51 */ YY_NO_ANCHOR, /* 52 */ YY_NO_ANCHOR, /* 53 */ YY_NO_ANCHOR, /* 54 */ YY_NO_ANCHOR, /* 55 */ YY_NO_ANCHOR, /* 56 */ YY_NO_ANCHOR, /* 57 */ YY_NO_ANCHOR, /* 58 */ YY_NO_ANCHOR, /* 59 */ YY_NO_ANCHOR, /* 60 */ YY_NO_ANCHOR, /* 61 */ YY_NO_ANCHOR, /* 62 */ YY_NO_ANCHOR, /* 63 */ YY_NO_ANCHOR, /* 64 */ YY_NOT_ACCEPT, /* 65 */ YY_NO_ANCHOR, /* 66 */ YY_NO_ANCHOR, /* 67 */ YY_NO_ANCHOR, /* 68 */ YY_NO_ANCHOR, /* 69 */ YY_NOT_ACCEPT, /* 70 */ YY_NO_ANCHOR, /* 71 */ YY_NO_ANCHOR, /* 72 */ YY_NOT_ACCEPT, /* 73 */ YY_NO_ANCHOR, /* 74 */ YY_NO_ANCHOR, /* 75 */ YY_NOT_ACCEPT, /* 76 */ YY_NO_ANCHOR, /* 77 */ YY_NO_ANCHOR, /* 78 */ YY_NOT_ACCEPT, /* 79 */ YY_NO_ANCHOR, /* 80 */ YY_NOT_ACCEPT, /* 81 */ YY_NO_ANCHOR, /* 82 */ YY_NOT_ACCEPT, /* 83 */ YY_NO_ANCHOR, /* 84 */ YY_NOT_ACCEPT, /* 85 */ YY_NO_ANCHOR, /* 86 */ YY_NOT_ACCEPT, /* 87 */ YY_NO_ANCHOR, /* 88 */ YY_NOT_ACCEPT, /* 89 */ YY_NO_ANCHOR, /* 90 */ YY_NOT_ACCEPT, /* 91 */ YY_NO_ANCHOR, /* 92 */ YY_NOT_ACCEPT, /* 93 */ YY_NO_ANCHOR, /* 94 */ YY_NOT_ACCEPT, /* 95 */ YY_NO_ANCHOR, /* 96 */ YY_NOT_ACCEPT, /* 97 */ YY_NO_ANCHOR, /* 98 */ YY_NOT_ACCEPT, /* 99 */ YY_NO_ANCHOR, /* 100 */ YY_NOT_ACCEPT, /* 101 */ YY_NO_ANCHOR, /* 102 */ YY_NOT_ACCEPT, /* 103 */ YY_NO_ANCHOR, /* 104 */ YY_NOT_ACCEPT, /* 105 */ YY_NO_ANCHOR, /* 106 */ YY_NOT_ACCEPT, /* 107 */ YY_NO_ANCHOR, /* 108 */ YY_NOT_ACCEPT, /* 109 */ YY_NO_ANCHOR, /* 110 */ YY_NOT_ACCEPT, /* 111 */ YY_NO_ANCHOR, /* 112 */ YY_NOT_ACCEPT, /* 113 */ YY_NO_ANCHOR, /* 114 */ YY_NOT_ACCEPT, /* 115 */ YY_NO_ANCHOR, /* 116 */ YY_NOT_ACCEPT, /* 117 */ YY_NO_ANCHOR, /* 118 */ YY_NOT_ACCEPT, /* 119 */ YY_NO_ANCHOR, /* 120 */ YY_NOT_ACCEPT, /* 121 */ YY_NO_ANCHOR, /* 122 */ YY_NOT_ACCEPT, /* 123 */ YY_NO_ANCHOR, /* 124 */ YY_NOT_ACCEPT, /* 125 */ YY_NO_ANCHOR, /* 126 */ YY_NOT_ACCEPT, /* 127 */ YY_NO_ANCHOR, /* 128 */ YY_NO_ANCHOR, /* 129 */ YY_NO_ANCHOR, /* 130 */ YY_NO_ANCHOR, /* 131 */ YY_NO_ANCHOR, /* 132 */ YY_NO_ANCHOR, /* 133 */ YY_NO_ANCHOR, /* 134 */ YY_NO_ANCHOR, /* 135 */ YY_NO_ANCHOR, /* 136 */ YY_NO_ANCHOR, /* 137 */ YY_NO_ANCHOR, /* 138 */ YY_NO_ANCHOR, /* 139 */ YY_NO_ANCHOR, /* 140 */ YY_NO_ANCHOR, /* 141 */ YY_NO_ANCHOR, /* 142 */ YY_NO_ANCHOR, /* 143 */ YY_NO_ANCHOR, /* 144 */ YY_NO_ANCHOR, /* 145 */ YY_NO_ANCHOR, /* 146 */ YY_NO_ANCHOR, /* 147 */ YY_NO_ANCHOR, /* 148 */ YY_NO_ANCHOR, /* 149 */ YY_NO_ANCHOR, /* 150 */ YY_NO_ANCHOR, /* 151 */ YY_NO_ANCHOR, /* 152 */ YY_NO_ANCHOR, /* 153 */ YY_NO_ANCHOR, /* 154 */ YY_NO_ANCHOR, /* 155 */ YY_NO_ANCHOR, /* 156 */ YY_NO_ANCHOR, /* 157 */ YY_NO_ANCHOR, /* 158 */ YY_NO_ANCHOR, /* 159 */ YY_NO_ANCHOR, /* 160 */ YY_NO_ANCHOR, /* 161 */ YY_NO_ANCHOR, /* 162 */ YY_NO_ANCHOR, /* 163 */ YY_NO_ANCHOR, /* 164 */ YY_NO_ANCHOR, /* 165 */ YY_NO_ANCHOR, /* 166 */ YY_NO_ANCHOR, /* 167 */ YY_NO_ANCHOR, /* 168 */ YY_NO_ANCHOR, /* 169 */ YY_NO_ANCHOR, /* 170 */ YY_NO_ANCHOR, /* 171 */ YY_NO_ANCHOR, /* 172 */ YY_NO_ANCHOR, /* 173 */ YY_NO_ANCHOR, /* 174 */ YY_NO_ANCHOR, /* 175 */ YY_NO_ANCHOR, /* 176 */ YY_NO_ANCHOR, /* 177 */ YY_NO_ANCHOR, /* 178 */ YY_NO_ANCHOR, /* 179 */ YY_NO_ANCHOR, /* 180 */ YY_NO_ANCHOR, /* 181 */ YY_NO_ANCHOR, /* 182 */ YY_NO_ANCHOR, /* 183 */ YY_NO_ANCHOR, /* 184 */ YY_NO_ANCHOR, /* 185 */ YY_NOT_ACCEPT, /* 186 */ YY_NOT_ACCEPT, /* 187 */ YY_NO_ANCHOR, /* 188 */ YY_NOT_ACCEPT, /* 189 */ YY_NO_ANCHOR, /* 190 */ YY_NOT_ACCEPT, /* 191 */ YY_NO_ANCHOR, /* 192 */ YY_NO_ANCHOR, /* 193 */ YY_NO_ANCHOR, /* 194 */ YY_NO_ANCHOR, /* 195 */ YY_NO_ANCHOR, /* 196 */ YY_NO_ANCHOR, /* 197 */ YY_NO_ANCHOR, /* 198 */ YY_NO_ANCHOR, /* 199 */ YY_NO_ANCHOR, /* 200 */ YY_NO_ANCHOR, /* 201 */ YY_NO_ANCHOR, /* 202 */ YY_NO_ANCHOR, /* 203 */ YY_NO_ANCHOR, /* 204 */ YY_NO_ANCHOR, /* 205 */ YY_NO_ANCHOR, /* 206 */ YY_NO_ANCHOR, /* 207 */ YY_NO_ANCHOR, /* 208 */ YY_NO_ANCHOR, /* 209 */ YY_NO_ANCHOR, /* 210 */ YY_NO_ANCHOR, /* 211 */ YY_NO_ANCHOR, /* 212 */ YY_NO_ANCHOR, /* 213 */ YY_NO_ANCHOR, /* 214 */ YY_NO_ANCHOR, /* 215 */ YY_NO_ANCHOR, /* 216 */ YY_NO_ANCHOR, /* 217 */ YY_NO_ANCHOR, /* 218 */ YY_NO_ANCHOR, /* 219 */ YY_NO_ANCHOR, /* 220 */ YY_NO_ANCHOR, /* 221 */ YY_NO_ANCHOR, /* 222 */ YY_NO_ANCHOR, /* 223 */ YY_NO_ANCHOR, /* 224 */ YY_NO_ANCHOR, /* 225 */ YY_NO_ANCHOR, /* 226 */ YY_NO_ANCHOR, /* 227 */ YY_NO_ANCHOR, /* 228 */ YY_NO_ANCHOR, /* 229 */ YY_NO_ANCHOR, /* 230 */ YY_NO_ANCHOR, /* 231 */ YY_NO_ANCHOR, /* 232 */ YY_NO_ANCHOR, /* 233 */ YY_NO_ANCHOR }; static private int yy_cmap[] = unpackFromString(1,65538, "54:9,27:2,54,27:2,54:18,27,17,53,54,15,54:2,55,25,26,1,3,11,4,13,2,56:10,10" + ",54,18,16,19,54,12,44,57:3,46,57:3,51,57:4,48,52,43,57,47,50,45,57:3,49,57:" + "2,41,54,42,54,58,54,35,38,29,5,21,39,33,36,6,57,20,37,8,28,9,30,57,31,32,23" + ",34,7,40,24,22,57,54,14,54:58,60,54:8,57:23,54,57:31,54,57:58,58:2,57:11,58" + ":2,57:8,58,57:53,58,57:68,58:9,57:36,58:3,57:2,58:4,57:30,58:56,57:89,58:18" + ",57:7,58:62,60:70,54:26,60:2,54:14,58:14,54,58:7,57,58,57:3,58,57,58,57:20," + "58,57:44,58,57:7,58:3,57,58,57,58,57,58,57,58,57:18,58:13,57:12,58,57:66,58" + ",57:12,58,57:36,58:14,57:53,58:2,57:2,58:2,57:2,58:3,57:28,58:2,57:8,58:2,5" + "7:2,58:55,57:38,58:2,57,58:7,57:38,58:73,57:27,58:5,57:3,58:46,57:26,58:6,5" + "7:10,58:21,59:10,58:7,57:71,58:2,57:5,58,57:15,58,57:4,58,57,58:15,57:2,58:" + "9,59:10,58:523,57:53,58:3,57,58:26,57:10,58:4,59:10,58:21,57:8,58:2,57:2,58" + ":2,57:22,58,57:7,58,57,58:3,57:4,58:34,57:2,58,57:3,58:4,59:10,57:2,58:19,5" + "7:6,58:4,57:2,58:2,57:22,58,57:7,58,57:2,58,57:2,58,57:2,58:31,57:4,58,57,5" + "8:7,59:10,58:2,57:3,58:16,57:7,58,57,58,57:3,58,57:22,58,57:7,58,57:2,58,57" + ":5,58:3,57,58:34,57,58:5,59:10,58:21,57:8,58:2,57:2,58:2,57:22,58,57:7,58,5" + "7:2,58:2,57:4,58:3,57,58:30,57:2,58,57:3,58:4,59:10,58:21,57:6,58:3,57:3,58" + ",57:4,58:3,57:2,58,57,58,57:2,58:3,57:2,58:3,57:3,58:3,57:8,58,57:3,58:45,5" + "9:9,58:21,57:8,58,57:3,58,57:23,58,57:10,58,57:5,58:38,57:2,58:4,59:10,58:2" + "1,57:8,58,57:3,58,57:23,58,57:10,58,57:5,58:36,57,58,57:2,58:4,59:10,58:21," + "57:8,58,57:3,58,57:23,58,57:16,58:38,57:2,58:4,59:10,58:145,57:46,58,57,58," + "57:2,58:12,57:6,58:10,59:10,58:39,57:2,58,57,58:2,57:2,58,57,58:2,57,58:6,5" + "7:4,58,57:7,58,57:3,58,57,58,57,58:2,57:2,58,57:2,58,57,58,57:2,58:9,57,58:" + "2,57:5,58:11,59:10,58:70,59:10,58:22,57:8,58,57:33,58:310,57:38,58:10,57:39" + ",58:9,57,58,57:2,58,57:3,58,57,58,57:2,58,57:5,58:41,57,58,57,58,57,58:11,5" + "7,58,57,58,57,58:3,57:2,58:3,57,58:5,57:3,58,57,58,57,58,57,58,57,58:3,57:2" + ",58:3,57:2,58,57,58:40,57,58:9,57,58:2,57,58:2,57:2,58:7,57:2,58,57,58,57:7" + ",58:40,57,58:4,57,58:8,57,58:3078,57:156,58:4,57:90,58:6,57:22,58:2,57:6,58" + ":2,57:38,58:2,57:6,58:2,57:8,58,57,58,57,58,57,58,57:31,58:2,57:53,58,57:7," + "58,57,58:3,57:3,58,57:7,58:3,57:4,58:2,57:6,58:4,57:13,58:5,57:3,58,57:7,58" + ":3,54:12,58:2,54:98,58:182,57,58:3,57:2,58:2,57,58:81,57:3,58:13,54:2672,58" + ":1008,54:17,58:64,57:84,58:12,57:90,58:10,57:40,58:31443,57:11172,58:92,54:" + "8448,58:1232,54:32,58:526,54:2,0:2")[0]; static private int yy_rmap[] = unpackFromString(1,234, "0,1:2,2,1:2,3,4,1,5,6,1:3,7,8,1:5,9,1,10:2,1:3,11,1:5,12,10,1,10:5,1:2,10,1" + ":2,13,1,10,1,14,10,15,16,1:2,10:4,17,1:2,18,19,20,21,22,23,24,25,26,27,1,25" + ",10,28:2,29,5,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,5" + "0,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,7" + "5,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,1" + "00,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118," + "119,120,121,122,123,124,125,126,127,128,129,130,131,132,10,133,134,135,136," + "137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155" + ",156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,17" + "4,175,176,177,178,179,180,181")[0]; static private int yy_nxt[][] = unpackFromString(182,61, "1,2,3,4,5,6,65,184,204,70,7,8,9,10,11,12,13,66,14,15,211,184:2,215,184,16,1" + "7,18,218,220,221,184,222,184:2,223,184:3,224,184,19,20,184:10,71,74,77,21,1" + "84:2,67,74,-1:63,22,-1:62,184:2,73,184:3,64,-1:2,76,-1:6,184,79,184:3,-1:3," + "184:13,-1:2,184:10,-1:3,76,184,76:3,-1:10,25,-1:51,26,-1:72,27,-1:42,28,-1:" + "2,28,-1:17,30,-1:26,69,-1:2,72,-1:30,31,-1:57,34,-1:42,21,-1:2,21,-1:5,184:" + "6,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:56,28,-" + "1:2,28,-1:57,34,-1:2,34,-1:5,155,184:5,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1" + ":2,184:10,-1:3,76,184,76:3,-1:4,209,184:5,64,-1:2,76,-1:6,184:5,-1:3,184:13" + ",-1:2,184:10,-1:3,76,184,76:3,-1:4,233,184:5,64,-1:2,76,-1:6,184:5,-1:3,184" + ":13,-1:2,184:10,-1:3,76,184,76:3,-1:4,158,184:5,64,-1:2,76,-1:6,184:5,-1:3," + "184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,122,-1" + ",124,183,184:12,-1:2,184:10,-1:3,76,184,76:3,-1,36,-1:3,103:5,-1:2,80,-1:7," + "103:5,-1:3,103:13,-1:2,103:10,-1:4,103:3,-1:5,184,23,184:4,64,-1:2,76,-1:6," + "184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:16,29,-1:48,184:6,64,-1:2" + ",68,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,67,184,76,67,76,-1:4,184:6,64,-" + "1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,68,184,76,68,76,-1:44,82,-1:" + "20,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:3,24,184:9,-1:2,184:10,-1:3,76,184," + "76:3,-1,75:52,32,75:7,-1:49,84,-1:15,184:3,35,184:2,64,-1:2,76,-1:6,184:5,-" + "1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1,78:54,33,78:5,-1:4,184:6,64,-1:2" + ",76,-1:6,184:5,-1:3,184:4,105,184:8,-1:2,184:10,-1:3,76,184,76:3,-1:4,184,3" + "7,184:4,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4" + "5,185,-1:19,184:6,64,-1:2,76,-1:6,184:2,38,184:2,-1:3,184:13,-1:2,184:10,-1" + ":3,76,184,76:3,-1:43,86,-1:21,184:6,64,-1:2,76,-1:6,184:4,191,-1:3,184:13,-" + "1:2,184:10,-1:3,76,184,76:3,-1:47,186,-1:17,184,107,184:4,64,-1:2,76,-1:6,1" + "84:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:46,96,-1:18,184:4,193,184," + "64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:26,42,-1:" + "38,184:2,205,184:3,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,18" + "4,76:3,-1:25,100,-1,92,-1:37,184:5,192,64,-1:2,76,-1:6,184,228,184:3,-1:3,1" + "84:13,-1:2,184:10,-1:3,76,184,76:3,-1:26,43,-1:38,184:6,64,-1:2,76,-1:6,184" + ":5,-1:3,184:3,206,184:9,-1:2,184:10,-1:3,76,184,76:3,-1:47,104,-1:17,184:6," + "64,-1:2,76,-1:6,184:5,-1:3,184:9,111,184:3,-1:2,184:10,-1:3,76,184,76:3,-1:" + "50,190,-1:14,184:6,64,-1:2,76,-1:6,184:3,113,184,-1:3,184:13,-1:2,184:10,-1" + ":3,76,184,76:3,-1:26,45,-1:38,184,39,184:4,64,-1:2,76,-1:6,184:5,-1:3,184,2" + "12,184:11,-1:2,184:10,-1:3,76,184,76:3,-1:26,46,-1:38,103:6,-1:3,103,-1:6,1" + "03:5,-1:3,103:13,-1:2,103:10,-1:3,103:5,-1:48,106,-1:16,184:6,64,-1:2,76,-1" + ":6,184:5,-1:3,184,216,184:11,-1:2,184:10,-1:3,76,184,76:3,-1:19,48,-1:45,18" + "4:6,64,-1:2,76,-1:6,184,119,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3," + "-1:51,114,-1:13,184:4,123,184,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10" + ",-1:3,76,184,76:3,-1:26,50,-1:38,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:11,40" + ",184,-1:2,184:10,-1:3,76,184,76:3,-1:25,116,-1,112,-1:37,184:6,64,-1:2,76,-" + "1:6,184:5,-1:3,184:3,128,184:9,-1:2,184:10,-1:3,76,184,76:3,-1:52,118,-1:12" + ",184:6,64,-1:2,76,-1:6,184:5,-1:3,184:9,129,184:3,-1:2,184:10,-1:3,76,184,7" + "6:3,-1:26,55,-1:38,184:6,64,-1:2,76,-1:6,184:3,130,184,90,-1,92,184:13,-1:2" + ",184:10,-1:3,76,184,76:3,-1:48,120,-1:16,184:6,64,-1:2,76,-1:6,184,131,184:" + "3,94,-1,188,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:19,56,-1:45,184:6,64,-1:" + "2,76,-1:6,184:5,-1:3,184:4,132,184:8,-1:2,184:10,-1:3,76,184,76:3,-1:26,62," + "-1:38,184:6,64,-1:2,76,-1:6,184,208,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,1" + "84,76:3,-1:25,126,-1,124,-1:37,184,41,184:4,64,-1:2,76,-1:6,184:5,-1:3,184:" + "13,-1:2,184:10,-1:3,76,184,76:3,-1:26,63,-1:38,184:6,64,-1:2,76,-1:6,184:5," + "-1:3,135,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,136,184:3,64,-1:2,7" + "6,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:5,138,64,-1:" + "2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2" + ",76,-1:6,184:3,130,184,-1:2,92,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184" + ":6,64,-1:2,76,-1:6,184,131,184:3,-1:2,188,184:13,-1:2,184:10,-1:3,76,184,76" + ":3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:2,139,184:10,-1:2,184:10,-1:3," + "76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:4,197,184:8,-1:2,184:" + "10,-1:3,76,184,76:3,-1:4,184,140,184:4,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1" + ":2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,44,184,-1:3,184" + ":13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:" + "10,141,184:2,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3," + "142,184,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6" + ",184:5,-1:3,184:12,225,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-" + "1:6,184:5,-1:3,184:7,143,184:5,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,145," + "184:3,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,1" + "84:6,64,-1:2,76,-1:6,184:5,-1:3,184:6,146,184:6,-1:2,184:10,-1:3,76,184,76:" + "3,-1:4,184:5,147,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184," + "76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184,148,184:11,-1:2,184:10,-1:3," + "76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,149,184,110,-1,112,184:13,-1:2" + ",184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,150,184:12,-" + "1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,151,184,-1:3,1" + "84:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,18" + "4:3,47,184:9,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,49" + ",184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6," + "184:3,149,184,-1:2,112,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1" + ":2,76,-1:6,184:5,-1:3,184:5,51,184:7,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:" + "6,64,-1:2,76,-1:6,184,52,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:" + "4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:5,53,184:7,-1:2,184:10,-1:3,76,184,7" + "6:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,54,184,-1:3,184:13,-1:2,184:10,-1:3,76" + ",184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:5,156,184:7,-1:2,184:10" + ",-1:3,76,184,76:3,-1:4,184:5,157,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184" + ":10,-1:3,76,184,76:3,-1:4,159,184:5,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2," + "184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:3,160,184" + ":9,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:5,161,64,-1:2,76,-1:6,184:5,-1:3,1" + "84:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,162,184:3,64,-1:2,76,-1:6,184" + ":5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,213,184:5,64,-1:2,76,-1:6," + "184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,1" + "84:5,-1:3,184:3,226,184:9,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,7" + "6,-1:6,184:5,-1:3,217,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:" + "2,76,-1:6,184:5,-1:3,184:10,164,184:2,-1:2,184:10,-1:3,76,184,76:3,-1:4,184" + ":6,64,-1:2,76,-1:6,184:5,-1:3,184:9,167,184:3,-1:2,184:10,-1:3,76,184,76:3," + "-1:4,184:6,64,-1:2,76,-1:6,184,168,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,18" + "4,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,170,184,-1:3,184:13,-1:2,184:10,-1:" + "3,76,184,76:3,-1:4,184:2,171,184:3,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,1" + "84:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:9,172,184:" + "3,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,173,184:3,-1:" + "3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3" + ",184:3,174,184:9,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,18" + "4:5,-1:3,175,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6" + ",184:5,-1:3,184:11,57,184,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,7" + "6,-1:6,184:5,-1:3,184:9,177,184:3,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,6" + "4,-1:2,76,-1:6,184:5,-1:3,184:6,178,184:6,-1:2,184:10,-1:3,76,184,76:3,-1:4" + ",184:6,64,-1:2,76,-1:6,184:5,-1:3,184:5,58,184:7,-1:2,184:10,-1:3,76,184,76" + ":3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:5,59,184:7,-1:2,184:10,-1:3,76" + ",184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:11,60,184,-1:2,184:10,-" + "1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184,179,184:11,-1:2,1" + "84:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,180,184,-1:3,184:13" + ",-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,181,184:3,64,-1:2,76,-1:6,184:5,-1" + ":3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:5,182,64,-1:2,76,-1:6,184:5" + ",-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5," + "-1:3,61,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:" + "5,-1:2,124,183,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:45,88,-1:61,98,-1:18," + "184:4,109,184,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:" + "3,-1:25,102,-1,188,-1:37,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:9,115,184:3,-" + "1:2,184:10,-1:3,76,184,76:3,-1:50,108,-1:14,184:6,64,-1:2,76,-1:6,184:3,117" + ",184,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,18" + "4:5,-1:3,184,195,184:11,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76," + "-1:6,184,121,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-" + "1:2,76,-1:6,184:5,-1:3,184:4,137,184:8,-1:2,184:10,-1:3,76,184,76:3,-1:4,18" + "4:6,64,-1:2,76,-1:6,184,133,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3," + "-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,198,184:12,-1:2,184:10,-1:3,76,184,76" + ":3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:4,229,184:8,-1:2,184:10,-1:3,7" + "6,184,76:3,-1:4,184,200,184:4,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10" + ",-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,144,184,-1:3,184:13,-1:2" + ",184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:7,210,18" + "4:5,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,152," + "184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,163,184:3,64,-1:2,76,-1:6,18" + "4:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184" + ":5,-1:3,176,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:5,81,64,-1:2,76,-1" + ":6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:" + "6,184:5,-1:3,184:9,125,184:3,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:" + "2,76,-1:6,184,127,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6" + ",64,-1:2,76,-1:6,184,134,184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:" + "4,184:6,64,-1:2,76,-1:6,184:5,-1:3,199,184:12,-1:2,184:10,-1:3,76,184,76:3," + "-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:4,202,184:8,-1:2,184:10,-1:3,76,1" + "84,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,153,184:12,-1:2,184:10,-1:3,7" + "6,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,83,184:3,-1:3,184:13,-1:2,184:10," + "-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,194,184:3,-1:3,184:13,-1:2," + "184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:4,165,184" + ":8,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,154,1" + "84:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,85,184:3," + "-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,196" + ",184:3,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6," + "184:5,-1:3,184:4,166,184:8,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:5,87,64,-1" + ":2,76,-1:6,184:5,-1:3,184:7,89,184:5,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:" + "6,64,-1:2,76,-1:6,184:5,-1:3,184:4,169,184:8,-1:2,184:10,-1:3,76,184,76:3,-" + "1:4,184:5,187,64,-1:2,76,-1:6,184:5,-1:3,184:8,91,184:4,-1:2,184:10,-1:3,76" + ",184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:3,93,184:3,95,184:5,-1:" + "2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184,97,184:3,-1:3,184:" + "13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:3,99,184,-1:" + "3,101,184:12,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:5,189,64,-1:2,76,-1:6,18" + "4:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,201,184:3,64,-1:2,7" + "6,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,219,184:5,64,-1:" + "2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:2,203,184" + ":3,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:" + "6,64,-1:2,76,-1:6,184:5,-1:3,184,207,184:11,-1:2,184:10,-1:3,76,184,76:3,-1" + ":4,184:2,214,184:3,64,-1:2,76,-1:6,184:5,-1:3,184:13,-1:2,184:10,-1:3,76,18" + "4,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:9,227,184:3,-1:2,184:10,-1" + ":3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:10,230,184:2,-1:2," + "184:10,-1:3,76,184,76:3,-1:4,184:2,231,184:3,64,-1:2,76,-1:6,184:5,-1:3,184" + ":13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:" + "4,232,184:8,-1:2,184:10,-1:3,76,184,76:3"); public java_cup.runtime.Symbol next_token () throws java.io.IOException, Exception { int yy_lookahead; int yy_anchor = YY_NO_ANCHOR; int yy_state = yy_state_dtrans[yy_lexical_state]; int yy_next_state = YY_NO_STATE; int yy_last_accept_state = YY_NO_STATE; boolean yy_initial = true; int yy_this_accept; yy_mark_start(); yy_this_accept = yy_acpt[yy_state]; if (YY_NOT_ACCEPT != yy_this_accept) { yy_last_accept_state = yy_state; yy_mark_end(); } while (true) { if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL; else yy_lookahead = yy_advance(); yy_next_state = YY_F; yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]]; if (YY_EOF == yy_lookahead && true == yy_initial) { return newSymbol(sym.EOF); } if (YY_F != yy_next_state) { yy_state = yy_next_state; yy_initial = false; yy_this_accept = yy_acpt[yy_state]; if (YY_NOT_ACCEPT != yy_this_accept) { yy_last_accept_state = yy_state; yy_mark_end(); } } else { if (YY_NO_STATE == yy_last_accept_state) { throw (new Error("Lexical Error: Unmatched Input.")); } else { yy_anchor = yy_acpt[yy_last_accept_state]; if (0 != (YY_END & yy_anchor)) { yy_move_end(); } yy_to_mark(); switch (yy_last_accept_state) { case 1: case -2: break; case 2: { return disambiguateStar(); } case -3: break; case 3: { return newSymbol(sym.SLASH); } case -4: break; case 4: { return newSymbol(sym.PLUS); } case -5: break; case 5: { return newSymbol(sym.MINUS); } case -6: break; case 6: { return newSymbol(sym.QNAME, yytext()); } case -7: break; case 7: { throw new Exception(yytext()); } case -8: break; case 8: { return newSymbol(sym.COMMA); } case -9: break; case 9: { return newSymbol(sym.ATSIGN); } case -10: break; case 10: { return newSymbol(sym.DOT); } case -11: break; case 11: { return newSymbol(sym.VBAR); } case -12: break; case 12: { return newSymbol(sym.DOLLAR); } case -13: break; case 13: { return newSymbol(sym.EQ); } case -14: break; case 14: { return newSymbol(sym.LT); } case -15: break; case 15: { return newSymbol(sym.GT); } case -16: break; case 16: { return newSymbol(sym.LPAREN); } case -17: break; case 17: { return newSymbol(sym.RPAREN); } case -18: break; case 18: { /* ignore white space. */ } case -19: break; case 19: { return newSymbol(sym.LBRACK); } case -20: break; case 20: { return newSymbol(sym.RBRACK); } case -21: break; case 21: { return newSymbol(sym.INT, new Long(yytext())); } case -22: break; case 22: { return newSymbol(sym.DSLASH); } case -23: break; case 23: { return disambiguateAxisOrFunction(sym.ID); } case -24: break; case 24: { return disambiguateOperator(sym.OR); } case -25: break; case 25: { return newSymbol(sym.DCOLON); } case -26: break; case 26: { return newSymbol(sym.QNAME, yytext()); } case -27: break; case 27: { return newSymbol(sym.DDOT); } case -28: break; case 28: { return newSymbol(sym.REAL, new Double(yytext())); } case -29: break; case 29: { return newSymbol(sym.NE); } case -30: break; case 30: { return newSymbol(sym.LE); } case -31: break; case 31: { return newSymbol(sym.GE); } case -32: break; case 32: { return newSymbol(sym.Literal, yytext().substring(1, yytext().length() - 1)); } case -33: break; case 33: { return newSymbol(sym.Literal, yytext().substring(1, yytext().length() - 1)); } case -34: break; case 34: { return newSymbol(sym.REAL, new Double(yytext())); } case -35: break; case 35: { return disambiguateOperator(sym.DIV); } case -36: break; case 36: { return newSymbol(sym.QNAME, yytext()); } case -37: break; case 37: { return disambiguateOperator(sym.MOD); } case -38: break; case 38: { return disambiguateAxisOrFunction(sym.KEY); } case -39: break; case 39: { return disambiguateOperator(sym.AND); } case -40: break; case 40: { return disambiguateAxisOrFunction(sym.SELF); } case -41: break; case 41: { return disambiguateAxisOrFunction(sym.CHILD); } case -42: break; case 42: { return newSymbol(sym.TEXT); } case -43: break; case 43: { return newSymbol(sym.NODE); } case -44: break; case 44: { return disambiguateAxisOrFunction(sym.PARENT); } case -45: break; case 45: { return newSymbol(sym.TEXT); } case -46: break; case 46: { return newSymbol(sym.NODE); } case -47: break; case 47: { return disambiguateAxisOrFunction(sym.ANCESTOR); } case -48: break; case 48: { initialize(); return new Symbol(sym.PATTERN); } case -49: break; case 49: { return disambiguateAxisOrFunction(sym.NAMESPACE); } case -50: break; case 50: { return newSymbol(sym.COMMENT); } case -51: break; case 51: { return disambiguateAxisOrFunction(sym.PRECEDING); } case -52: break; case 52: { return disambiguateAxisOrFunction(sym.ATTRIBUTE); } case -53: break; case 53: { return disambiguateAxisOrFunction(sym.FOLLOWING); } case -54: break; case 54: { return disambiguateAxisOrFunction(sym.DESCENDANT); } case -55: break; case 55: { return newSymbol(sym.COMMENT); } case -56: break; case 56: { initialize(); return new Symbol(sym.EXPRESSION); } case -57: break; case 57: { return disambiguateAxisOrFunction(sym.ANCESTORORSELF); } case -58: break; case 58: { return disambiguateAxisOrFunction(sym.PRECEDINGSIBLING); } case -59: break; case 59: { return disambiguateAxisOrFunction(sym.FOLLOWINGSIBLING); } case -60: break; case 60: { return disambiguateAxisOrFunction(sym.DESCENDANTORSELF); } case -61: break; case 61: { return disambiguateAxisOrFunction(sym.PIPARAM); } case -62: break; case 62: { return newSymbol(sym.PI); } case -63: break; case 63: { return newSymbol(sym.PI); } case -64: break; case 65: { return newSymbol(sym.QNAME, yytext()); } case -65: break; case 66: { throw new Exception(yytext()); } case -66: break; case 67: { return newSymbol(sym.INT, new Long(yytext())); } case -67: break; case 68: { return newSymbol(sym.REAL, new Double(yytext())); } case -68: break; case 70: { return newSymbol(sym.QNAME, yytext()); } case -69: break; case 71: { throw new Exception(yytext()); } case -70: break; case 73: { return newSymbol(sym.QNAME, yytext()); } case -71: break; case 74: { throw new Exception(yytext()); } case -72: break; case 76: { return newSymbol(sym.QNAME, yytext()); } case -73: break; case 77: { throw new Exception(yytext()); } case -74: break; case 79: { return newSymbol(sym.QNAME, yytext()); } case -75: break; case 81: { return newSymbol(sym.QNAME, yytext()); } case -76: break; case 83: { return newSymbol(sym.QNAME, yytext()); } case -77: break; case 85: { return newSymbol(sym.QNAME, yytext()); } case -78: break; case 87: { return newSymbol(sym.QNAME, yytext()); } case -79: break; case 89: { return newSymbol(sym.QNAME, yytext()); } case -80: break; case 91: { return newSymbol(sym.QNAME, yytext()); } case -81: break; case 93: { return newSymbol(sym.QNAME, yytext()); } case -82: break; case 95: { return newSymbol(sym.QNAME, yytext()); } case -83: break; case 97: { return newSymbol(sym.QNAME, yytext()); } case -84: break; case 99: { return newSymbol(sym.QNAME, yytext()); } case -85: break; case 101: { return newSymbol(sym.QNAME, yytext()); } case -86: break; case 103: { return newSymbol(sym.QNAME, yytext()); } case -87: break; case 105: { return newSymbol(sym.QNAME, yytext()); } case -88: break; case 107: { return newSymbol(sym.QNAME, yytext()); } case -89: break; case 109: { return newSymbol(sym.QNAME, yytext()); } case -90: break; case 111: { return newSymbol(sym.QNAME, yytext()); } case -91: break; case 113: { return newSymbol(sym.QNAME, yytext()); } case -92: break; case 115: { return newSymbol(sym.QNAME, yytext()); } case -93: break; case 117: { return newSymbol(sym.QNAME, yytext()); } case -94: break; case 119: { return newSymbol(sym.QNAME, yytext()); } case -95: break; case 121: { return newSymbol(sym.QNAME, yytext()); } case -96: break; case 123: { return newSymbol(sym.QNAME, yytext()); } case -97: break; case 125: { return newSymbol(sym.QNAME, yytext()); } case -98: break; case 127: { return newSymbol(sym.QNAME, yytext()); } case -99: break; case 128: { return newSymbol(sym.QNAME, yytext()); } case -100: break; case 129: { return newSymbol(sym.QNAME, yytext()); } case -101: break; case 130: { return newSymbol(sym.QNAME, yytext()); } case -102: break; case 131: { return newSymbol(sym.QNAME, yytext()); } case -103: break; case 132: { return newSymbol(sym.QNAME, yytext()); } case -104: break; case 133: { return newSymbol(sym.QNAME, yytext()); } case -105: break; case 134: { return newSymbol(sym.QNAME, yytext()); } case -106: break; case 135: { return newSymbol(sym.QNAME, yytext()); } case -107: break; case 136: { return newSymbol(sym.QNAME, yytext()); } case -108: break; case 137: { return newSymbol(sym.QNAME, yytext()); } case -109: break; case 138: { return newSymbol(sym.QNAME, yytext()); } case -110: break; case 139: { return newSymbol(sym.QNAME, yytext()); } case -111: break; case 140: { return newSymbol(sym.QNAME, yytext()); } case -112: break; case 141: { return newSymbol(sym.QNAME, yytext()); } case -113: break; case 142: { return newSymbol(sym.QNAME, yytext()); } case -114: break; case 143: { return newSymbol(sym.QNAME, yytext()); } case -115: break; case 144: { return newSymbol(sym.QNAME, yytext()); } case -116: break; case 145: { return newSymbol(sym.QNAME, yytext()); } case -117: break; case 146: { return newSymbol(sym.QNAME, yytext()); } case -118: break; case 147: { return newSymbol(sym.QNAME, yytext()); } case -119: break; case 148: { return newSymbol(sym.QNAME, yytext()); } case -120: break; case 149: { return newSymbol(sym.QNAME, yytext()); } case -121: break; case 150: { return newSymbol(sym.QNAME, yytext()); } case -122: break; case 151: { return newSymbol(sym.QNAME, yytext()); } case -123: break; case 152: { return newSymbol(sym.QNAME, yytext()); } case -124: break; case 153: { return newSymbol(sym.QNAME, yytext()); } case -125: break; case 154: { return newSymbol(sym.QNAME, yytext()); } case -126: break; case 155: { return newSymbol(sym.QNAME, yytext()); } case -127: break; case 156: { return newSymbol(sym.QNAME, yytext()); } case -128: break; case 157: { return newSymbol(sym.QNAME, yytext()); } case -129: break; case 158: { return newSymbol(sym.QNAME, yytext()); } case -130: break; case 159: { return newSymbol(sym.QNAME, yytext()); } case -131: break; case 160: { return newSymbol(sym.QNAME, yytext()); } case -132: break; case 161: { return newSymbol(sym.QNAME, yytext()); } case -133: break; case 162: { return newSymbol(sym.QNAME, yytext()); } case -134: break; case 163: { return newSymbol(sym.QNAME, yytext()); } case -135: break; case 164: { return newSymbol(sym.QNAME, yytext()); } case -136: break; case 165: { return newSymbol(sym.QNAME, yytext()); } case -137: break; case 166: { return newSymbol(sym.QNAME, yytext()); } case -138: break; case 167: { return newSymbol(sym.QNAME, yytext()); } case -139: break; case 168: { return newSymbol(sym.QNAME, yytext()); } case -140: break; case 169: { return newSymbol(sym.QNAME, yytext()); } case -141: break; case 170: { return newSymbol(sym.QNAME, yytext()); } case -142: break; case 171: { return newSymbol(sym.QNAME, yytext()); } case -143: break; case 172: { return newSymbol(sym.QNAME, yytext()); } case -144: break; case 173: { return newSymbol(sym.QNAME, yytext()); } case -145: break; case 174: { return newSymbol(sym.QNAME, yytext()); } case -146: break; case 175: { return newSymbol(sym.QNAME, yytext()); } case -147: break; case 176: { return newSymbol(sym.QNAME, yytext()); } case -148: break; case 177: { return newSymbol(sym.QNAME, yytext()); } case -149: break; case 178: { return newSymbol(sym.QNAME, yytext()); } case -150: break; case 179: { return newSymbol(sym.QNAME, yytext()); } case -151: break; case 180: { return newSymbol(sym.QNAME, yytext()); } case -152: break; case 181: { return newSymbol(sym.QNAME, yytext()); } case -153: break; case 182: { return newSymbol(sym.QNAME, yytext()); } case -154: break; case 183: { return newSymbol(sym.QNAME, yytext()); } case -155: break; case 184: { return newSymbol(sym.QNAME, yytext()); } case -156: break; case 187: { return newSymbol(sym.QNAME, yytext()); } case -157: break; case 189: { return newSymbol(sym.QNAME, yytext()); } case -158: break; case 191: { return newSymbol(sym.QNAME, yytext()); } case -159: break; case 192: { return newSymbol(sym.QNAME, yytext()); } case -160: break; case 193: { return newSymbol(sym.QNAME, yytext()); } case -161: break; case 194: { return newSymbol(sym.QNAME, yytext()); } case -162: break; case 195: { return newSymbol(sym.QNAME, yytext()); } case -163: break; case 196: { return newSymbol(sym.QNAME, yytext()); } case -164: break; case 197: { return newSymbol(sym.QNAME, yytext()); } case -165: break; case 198: { return newSymbol(sym.QNAME, yytext()); } case -166: break; case 199: { return newSymbol(sym.QNAME, yytext()); } case -167: break; case 200: { return newSymbol(sym.QNAME, yytext()); } case -168: break; case 201: { return newSymbol(sym.QNAME, yytext()); } case -169: break; case 202: { return newSymbol(sym.QNAME, yytext()); } case -170: break; case 203: { return newSymbol(sym.QNAME, yytext()); } case -171: break; case 204: { return newSymbol(sym.QNAME, yytext()); } case -172: break; case 205: { return newSymbol(sym.QNAME, yytext()); } case -173: break; case 206: { return newSymbol(sym.QNAME, yytext()); } case -174: break; case 207: { return newSymbol(sym.QNAME, yytext()); } case -175: break; case 208: { return newSymbol(sym.QNAME, yytext()); } case -176: break; case 209: { return newSymbol(sym.QNAME, yytext()); } case -177: break; case 210: { return newSymbol(sym.QNAME, yytext()); } case -178: break; case 211: { return newSymbol(sym.QNAME, yytext()); } case -179: break; case 212: { return newSymbol(sym.QNAME, yytext()); } case -180: break; case 213: { return newSymbol(sym.QNAME, yytext()); } case -181: break; case 214: { return newSymbol(sym.QNAME, yytext()); } case -182: break; case 215: { return newSymbol(sym.QNAME, yytext()); } case -183: break; case 216: { return newSymbol(sym.QNAME, yytext()); } case -184: break; case 217: { return newSymbol(sym.QNAME, yytext()); } case -185: break; case 218: { return newSymbol(sym.QNAME, yytext()); } case -186: break; case 219: { return newSymbol(sym.QNAME, yytext()); } case -187: break; case 220: { return newSymbol(sym.QNAME, yytext()); } case -188: break; case 221: { return newSymbol(sym.QNAME, yytext()); } case -189: break; case 222: { return newSymbol(sym.QNAME, yytext()); } case -190: break; case 223: { return newSymbol(sym.QNAME, yytext()); } case -191: break; case 224: { return newSymbol(sym.QNAME, yytext()); } case -192: break; case 225: { return newSymbol(sym.QNAME, yytext()); } case -193: break; case 226: { return newSymbol(sym.QNAME, yytext()); } case -194: break; case 227: { return newSymbol(sym.QNAME, yytext()); } case -195: break; case 228: { return newSymbol(sym.QNAME, yytext()); } case -196: break; case 229: { return newSymbol(sym.QNAME, yytext()); } case -197: break; case 230: { return newSymbol(sym.QNAME, yytext()); } case -198: break; case 231: { return newSymbol(sym.QNAME, yytext()); } case -199: break; case 232: { return newSymbol(sym.QNAME, yytext()); } case -200: break; case 233: { return newSymbol(sym.QNAME, yytext()); } case -201: break; default: yy_error(YY_E_INTERNAL,false); case -1: } yy_initial = true; yy_state = yy_state_dtrans[yy_lexical_state]; yy_next_state = YY_NO_STATE; yy_last_accept_state = YY_NO_STATE; yy_mark_start(); yy_this_accept = yy_acpt[yy_state]; if (YY_NOT_ACCEPT != yy_this_accept) { yy_last_accept_state = yy_state; yy_mark_end(); } } } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/VariableBase.java0000644000175000017500000002131010721374032025330 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VariableBase.java 528589 2007-04-13 18:50:56Z zongaro $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt * @author John Howard */ class VariableBase extends TopLevelElement { protected QName _name; // The name of the variable. protected String _escapedName; // The escaped qname of the variable. protected Type _type; // The type of this variable. protected boolean _isLocal; // True if the variable is local. protected LocalVariableGen _local; // Reference to JVM variable protected Instruction _loadInstruction; // Instruction to load JVM variable protected Instruction _storeInstruction; // Instruction to load JVM variable protected Expression _select; // Reference to variable expression protected String select; // Textual repr. of variable expr. // References to this variable (when local) protected Vector _refs = new Vector(2); // Dependencies to other variables/parameters (for globals only) protected Vector _dependencies = null; // Used to make sure parameter field is not added twice protected boolean _ignore = false; /** * Disable this variable/parameter */ public void disable() { _ignore = true; } /** * Add a reference to this variable. Called by VariableRef when an * expression contains a reference to this variable. */ public void addReference(VariableRefBase vref) { _refs.addElement(vref); } /** * Map this variable to a register */ public void mapRegister(MethodGenerator methodGen) { if (_local == null) { final String name = getEscapedName(); // TODO: namespace ? final org.apache.bcel.generic.Type varType = _type.toJCType(); _local = methodGen.addLocalVariable2(name, varType, null); } } /** * Remove the mapping of this variable to a register. * Called when we leave the AST scope of the variable's declaration */ public void unmapRegister(MethodGenerator methodGen) { if (_local != null) { _local.setEnd(methodGen.getInstructionList().getEnd()); methodGen.removeLocalVariable(_local); _refs = null; _local = null; } } /** * Returns an instruction for loading the value of this variable onto * the JVM stack. */ public Instruction loadInstruction() { final Instruction instr = _loadInstruction; if (_loadInstruction == null) { _loadInstruction = _type.LOAD(_local.getIndex()); } return _loadInstruction; } /** * Returns an instruction for storing a value from the JVM stack * into this variable. */ public Instruction storeInstruction() { final Instruction instr = _storeInstruction; if (_storeInstruction == null) { _storeInstruction = _type.STORE(_local.getIndex()); } return _storeInstruction; } /** * Returns the expression from this variable's select attribute (if any) */ public Expression getExpression() { return(_select); } /** * Display variable as single string */ public String toString() { return("variable("+_name+")"); } /** * Display variable in a full AST dump */ public void display(int indent) { indent(indent); System.out.println("Variable " + _name); if (_select != null) { indent(indent + IndentIncrement); System.out.println("select " + _select.toString()); } displayContents(indent + IndentIncrement); } /** * Returns the type of the variable */ public Type getType() { return _type; } /** * Returns the name of the variable or parameter as it will occur in the * compiled translet. */ public QName getName() { return _name; } /** * Returns the escaped qname of the variable or parameter */ public String getEscapedName() { return _escapedName; } /** * Set the name of the variable or paremeter. Escape all special chars. */ public void setName(QName name) { _name = name; _escapedName = Util.escape(name.getStringRep()); } /** * Returns the true if the variable is local */ public boolean isLocal() { return _isLocal; } /** * Parse the contents of the element. */ public void parseContents(Parser parser) { // Get the 'name attribute String name = getAttribute("name"); if (name.length() > 0) { if (!XML11Char.isXML11ValidQName(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } setName(parser.getQNameIgnoreDefaultNs(name)); } else reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name"); // Check whether variable/param of the same name is already in scope VariableBase other = parser.lookupVariable(_name); if ((other != null) && (other.getParent() == getParent())) { reportError(this, parser, ErrorMsg.VARIABLE_REDEF_ERR, name); } select = getAttribute("select"); if (select.length() > 0) { _select = getParser().parseExpression(this, "select", null); if (_select.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select"); return; } } // Children must be parsed first -> static scoping parseChildren(parser); } /** * Compile the value of the variable, which is either in an expression in * a 'select' attribute, or in the variable elements body */ public void translateValue(ClassGenerator classGen, MethodGenerator methodGen) { // Compile expression is 'select' attribute if present if (_select != null) { _select.translate(classGen, methodGen); // Create a CachedNodeListIterator for select expressions // in a variable or parameter. if (_select.getType() instanceof NodeSetType) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int initCNI = cpg.addMethodref(CACHED_NODE_LIST_ITERATOR_CLASS, "", "(" +NODE_ITERATOR_SIG +")V"); il.append(new NEW(cpg.addClass(CACHED_NODE_LIST_ITERATOR_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new INVOKESPECIAL(initCNI)); } _select.startIterator(classGen, methodGen); } // If not, compile result tree from parameter body if present. else if (hasContents()) { compileResultTree(classGen, methodGen); } // If neither are present then store empty string in variable else { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, Constants.EMPTYSTRING)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/VariableRefBase.java0000644000175000017500000001127710721374030025776 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VariableRefBase.java 476471 2006-11-18 08:36:27Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */ class VariableRefBase extends Expression { /** * A reference to the associated variable. */ protected VariableBase _variable; /** * A reference to the enclosing expression/instruction for which a * closure is needed (Predicate, Number or Sort). */ protected Closure _closure = null; public VariableRefBase(VariableBase variable) { _variable = variable; variable.addReference(this); } public VariableRefBase() { _variable = null; } /** * Returns a reference to the associated variable */ public VariableBase getVariable() { return _variable; } /** * If this variable reference is in a top-level element like * another variable, param or key, add a dependency between * that top-level element and the referenced variable. For * example, * * * * * and assuming this class represents "$x", add a reference * between variable y and variable x. */ public void addParentDependency() { SyntaxTreeNode node = this; while (node != null && node instanceof TopLevelElement == false) { node = node.getParent(); } TopLevelElement parent = (TopLevelElement) node; if (parent != null) { VariableBase var = _variable; if (_variable._ignore) { if (_variable instanceof Variable) { var = parent.getSymbolTable() .lookupVariable(_variable._name); } else if (_variable instanceof Param) { var = parent.getSymbolTable().lookupParam(_variable._name); } } parent.addDependency(var); } } /** * Two variable references are deemed equal if they refer to the * same variable. */ public boolean equals(Object obj) { try { return (_variable == ((VariableRefBase) obj)._variable); } catch (ClassCastException e) { return false; } } /** * Returns a string representation of this variable reference on the * format 'variable-ref()'. * @return Variable reference description */ public String toString() { return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')'; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Returned cached type if available if (_type != null) return _type; // Find nearest closure to add a variable reference if (_variable.isLocal()) { SyntaxTreeNode node = getParent(); do { if (node instanceof Closure) { _closure = (Closure) node; break; } if (node instanceof TopLevelElement) { break; // way up in the tree } node = node.getParent(); } while (node != null); if (_closure != null) { _closure.addVariable(this); } } // Attempt to get the cached variable type _type = _variable.getType(); // If that does not work we must force a type-check (this is normally // only needed for globals in included/imported stylesheets if (_type == null) { _variable.typeCheck(stable); _type = _variable.getType(); } // If in a top-level element, create dependency to the referenced var addParentDependency(); // Return the type of the referenced variable return _type; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AncestorPattern.java0000644000175000017500000001253310721374033026134 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AncestorPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Erwin Bolwidt */ final class AncestorPattern extends RelativePathPattern { private final Pattern _left; // may be null private final RelativePathPattern _right; private InstructionHandle _loop; public AncestorPattern(RelativePathPattern right) { this(null, right); } public AncestorPattern(Pattern left, RelativePathPattern right) { _left = left; (_right = right).setParent(this); if (left != null) { left.setParent(this); } } public InstructionHandle getLoopHandle() { return _loop; } public void setParser(Parser parser) { super.setParser(parser); if (_left != null) { _left.setParser(parser); } _right.setParser(parser); } public boolean isWildcard() { //!!! can be wildcard return false; } public StepPattern getKernelPattern() { return _right.getKernelPattern(); } public void reduceKernelPattern() { _right.reduceKernelPattern(); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_left != null) { _left.typeCheck(stable); } return _right.typeCheck(stable); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { InstructionHandle parent; final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); /* * The scope of this local var must be the entire method since * a another pattern may decide to jump back into the loop */ final LocalVariableGen local = methodGen.addLocalVariable2("app", Util.getJCRefType(NODE_SIG), il.getEnd()); final org.apache.bcel.generic.Instruction loadLocal = new ILOAD(local.getIndex()); final org.apache.bcel.generic.Instruction storeLocal = new ISTORE(local.getIndex()); if (_right instanceof StepPattern) { il.append(DUP); il.append(storeLocal); _right.translate(classGen, methodGen); il.append(methodGen.loadDOM()); il.append(loadLocal); } else { _right.translate(classGen, methodGen); if (_right instanceof AncestorPattern) { il.append(methodGen.loadDOM()); il.append(SWAP); } } if (_left != null) { final int getParent = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); parent = il.append(new INVOKEINTERFACE(getParent, 2)); il.append(DUP); il.append(storeLocal); _falseList.add(il.append(new IFLT(null))); il.append(loadLocal); _left.translate(classGen, methodGen); final SyntaxTreeNode p = getParent(); if (p == null || p instanceof Instruction || p instanceof TopLevelElement) { // do nothing } else { il.append(loadLocal); } final BranchHandle exit = il.append(new GOTO(null)); _loop = il.append(methodGen.loadDOM()); il.append(loadLocal); local.setEnd(_loop); il.append(new GOTO(parent)); exit.setTarget(il.append(NOP)); _left.backPatchFalseList(_loop); _trueList.append(_left._trueList); } else { il.append(POP2); } /* * If _right is an ancestor pattern, backpatch this pattern's false * list to the loop that searches for more ancestors. */ if (_right instanceof AncestorPattern) { final AncestorPattern ancestor = (AncestorPattern) _right; _falseList.backPatch(ancestor.getLoopHandle()); // clears list } _trueList.append(_right._trueList); _falseList.append(_right._falseList); } public String toString() { return "AncestorPattern(" + _left + ", " + _right + ')'; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CallTemplate.java0000644000175000017500000002131610721374032025365 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CallTemplate.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; import java.util.Vector; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Erwin Bolwidt */ final class CallTemplate extends Instruction { /** * Name of template to call. */ private QName _name; /** * The array of effective parameters in this CallTemplate. An object in * this array can be either a WithParam or a Param if no WithParam * exists for a particular parameter. */ private Object[] _parameters = null; /** * The corresponding template which this CallTemplate calls. */ private Template _calleeTemplate = null; public void display(int indent) { indent(indent); System.out.print("CallTemplate"); Util.println(" name " + _name); displayContents(indent + IndentIncrement); } public boolean hasWithParams() { return elementCount() > 0; } public void parseContents(Parser parser) { final String name = getAttribute("name"); if (name.length() > 0) { if (!XML11Char.isXML11ValidQName(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } _name = parser.getQNameIgnoreDefaultNs(name); } else { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name"); } parseChildren(parser); } /** * Verify that a template with this name exists. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Template template = stable.lookupTemplate(_name); if (template != null) { typeCheckContents(stable); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.TEMPLATE_UNDEF_ERR,_name,this); throw new TypeCheckError(err); } return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final Stylesheet stylesheet = classGen.getStylesheet(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // If there are Params in the stylesheet or WithParams in this call? if (stylesheet.hasLocalParams() || hasContents()) { _calleeTemplate = getCalleeTemplate(); // Build the parameter list if the called template is simple named if (_calleeTemplate != null) { buildParameterList(); } // This is only needed when the called template is not // a simple named template. else { // Push parameter frame final int push = cpg.addMethodref(TRANSLET_CLASS, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG); il.append(classGen.loadTranslet()); il.append(new INVOKEVIRTUAL(push)); translateContents(classGen, methodGen); } } // Generate a valid Java method name final String className = stylesheet.getClassName(); String methodName = Util.escape(_name.toString()); // Load standard arguments il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadIterator()); il.append(methodGen.loadHandler()); il.append(methodGen.loadCurrentNode()); // Initialize prefix of method signature StringBuffer methodSig = new StringBuffer("(" + DOM_INTF_SIG + NODE_ITERATOR_SIG + TRANSLET_OUTPUT_SIG + NODE_SIG); // If calling a simply named template, push actual arguments if (_calleeTemplate != null) { Vector calleeParams = _calleeTemplate.getParameters(); int numParams = _parameters.length; for (int i = 0; i < numParams; i++) { SyntaxTreeNode node = (SyntaxTreeNode)_parameters[i]; methodSig.append(OBJECT_SIG); // append Object to signature // Push 'null' if Param to indicate no actual parameter specified if (node instanceof Param) { il.append(ACONST_NULL); } else { // translate WithParam node.translate(classGen, methodGen); } } } // Complete signature and generate invokevirtual call methodSig.append(")V"); il.append(new INVOKEVIRTUAL(cpg.addMethodref(className, methodName, methodSig.toString()))); // Do not need to call Translet.popParamFrame() if we are // calling a simple named template. if (_calleeTemplate == null && (stylesheet.hasLocalParams() || hasContents())) { // Pop parameter frame final int pop = cpg.addMethodref(TRANSLET_CLASS, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG); il.append(classGen.loadTranslet()); il.append(new INVOKEVIRTUAL(pop)); } } /** * Return the simple named template which this CallTemplate calls. * Return false if there is no matched template or the matched * template is not a simple named template. */ public Template getCalleeTemplate() { Template foundTemplate = getXSLTC().getParser().getSymbolTable().lookupTemplate(_name); return foundTemplate.isSimpleNamedTemplate() ? foundTemplate : null; } /** * Build the list of effective parameters in this CallTemplate. * The parameters of the called template are put into the array first. * Then we visit the WithParam children of this CallTemplate and replace * the Param with a corresponding WithParam having the same name. */ private void buildParameterList() { // Put the parameters from the called template into the array first. // This is to ensure the order of the parameters. Vector defaultParams = _calleeTemplate.getParameters(); int numParams = defaultParams.size(); _parameters = new Object[numParams]; for (int i = 0; i < numParams; i++) { _parameters[i] = defaultParams.elementAt(i); } // Replace a Param with a WithParam if they have the same name. int count = elementCount(); for (int i = 0; i < count; i++) { Object node = elementAt(i); // Ignore if not WithParam if (node instanceof WithParam) { WithParam withParam = (WithParam)node; QName name = withParam.getName(); // Search for a Param with the same name for (int k = 0; k < numParams; k++) { Object object = _parameters[k]; if (object instanceof Param && ((Param)object).getName() == name) { withParam.setDoParameterOptimization(true); _parameters[k] = withParam; break; } else if (object instanceof WithParam && ((WithParam)object).getName() == name) { withParam.setDoParameterOptimization(true); _parameters[k] = withParam; break; } } } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FlowList.java0000644000175000017500000000624610721374032024566 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FlowList.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Iterator; import java.util.Vector; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class FlowList { private Vector _elements; public FlowList() { _elements = null; } public FlowList(InstructionHandle bh) { _elements = new Vector(); _elements.addElement(bh); } public FlowList(FlowList list) { _elements = list._elements; } public FlowList add(InstructionHandle bh) { if (_elements == null) { _elements = new Vector(); } _elements.addElement(bh); return this; } public FlowList append(FlowList right) { if (_elements == null) { _elements = right._elements; } else { final Vector temp = right._elements; if (temp != null) { final int n = temp.size(); for (int i = 0; i < n; i++) { _elements.addElement(temp.elementAt(i)); } } } return this; } /** * Back patch a flow list. All instruction handles must be branch handles. */ public void backPatch(InstructionHandle target) { if (_elements != null) { final int n = _elements.size(); for (int i = 0; i < n; i++) { BranchHandle bh = (BranchHandle)_elements.elementAt(i); bh.setTarget(target); } _elements.clear(); // avoid backpatching more than once } } /** * Redirect the handles from oldList to newList. "This" flow list * is assumed to be relative to oldList. */ public FlowList copyAndRedirect(InstructionList oldList, InstructionList newList) { final FlowList result = new FlowList(); if (_elements == null) { return result; } final int n = _elements.size(); final Iterator oldIter = oldList.iterator(); final Iterator newIter = newList.iterator(); while (oldIter.hasNext()) { final InstructionHandle oldIh = (InstructionHandle) oldIter.next(); final InstructionHandle newIh = (InstructionHandle) newIter.next(); for (int i = 0; i < n; i++) { if (_elements.elementAt(i) == oldIh) { result.add(newIh); } } } return result; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/EqualityExpr.java0000644000175000017500000002651110721374031025453 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EqualityExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFNE; import org.apache.bcel.generic.IF_ICMPEQ; import org.apache.bcel.generic.IF_ICMPNE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.IntType; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.NumberType; import org.apache.xalan.xsltc.compiler.util.RealType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.runtime.Operators; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt */ final class EqualityExpr extends Expression { private final int _op; private Expression _left; private Expression _right; public EqualityExpr(int op, Expression left, Expression right) { _op = op; (_left = left).setParent(this); (_right = right).setParent(this); } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); _right.setParser(parser); } public String toString() { return Operators.getOpNames(_op) + '(' + _left + ", " + _right + ')'; } public Expression getLeft() { return _left; } public Expression getRight() { return _right; } public boolean getOp() { return (_op != Operators.NE); } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { if (_left.hasPositionCall()) return true; if (_right.hasPositionCall()) return true; return false; } public boolean hasLastCall() { if (_left.hasLastCall()) return true; if (_right.hasLastCall()) return true; return false; } private void swapArguments() { final Expression temp = _left; _left = _right; _right = temp; } /** * Typing rules: see XSLT Reference by M. Kay page 345. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tleft = _left.typeCheck(stable); final Type tright = _right.typeCheck(stable); if (tleft.isSimple() && tright.isSimple()) { if (tleft != tright) { if (tleft instanceof BooleanType) { _right = new CastExpr(_right, Type.Boolean); } else if (tright instanceof BooleanType) { _left = new CastExpr(_left, Type.Boolean); } else if (tleft instanceof NumberType || tright instanceof NumberType) { _left = new CastExpr(_left, Type.Real); _right = new CastExpr(_right, Type.Real); } else { // both compared as strings _left = new CastExpr(_left, Type.String); _right = new CastExpr(_right, Type.String); } } } else if (tleft instanceof ReferenceType) { _right = new CastExpr(_right, Type.Reference); } else if (tright instanceof ReferenceType) { _left = new CastExpr(_left, Type.Reference); } // the following 2 cases optimize @attr|.|.. = 'string' else if (tleft instanceof NodeType && tright == Type.String) { _left = new CastExpr(_left, Type.String); } else if (tleft == Type.String && tright instanceof NodeType) { _right = new CastExpr(_right, Type.String); } // optimize node/node else if (tleft instanceof NodeType && tright instanceof NodeType) { _left = new CastExpr(_left, Type.String); _right = new CastExpr(_right, Type.String); } else if (tleft instanceof NodeType && tright instanceof NodeSetType) { // compare(Node, NodeSet) will be invoked } else if (tleft instanceof NodeSetType && tright instanceof NodeType) { swapArguments(); // for compare(Node, NodeSet) } else { // At least one argument is of type node, node-set or result-tree // Promote an expression of type node to node-set if (tleft instanceof NodeType) { _left = new CastExpr(_left, Type.NodeSet); } if (tright instanceof NodeType) { _right = new CastExpr(_right, Type.NodeSet); } // If one arg is a node-set then make it the left one if (tleft.isSimple() || tleft instanceof ResultTreeType && tright instanceof NodeSetType) { swapArguments(); } // Promote integers to doubles to have fewer compares if (_right.getType() instanceof IntType) { _right = new CastExpr(_right, Type.Real); } } return _type = Type.Boolean; } public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final Type tleft = _left.getType(); final InstructionList il = methodGen.getInstructionList(); if (tleft instanceof BooleanType) { _left.translate(classGen, methodGen); _right.translate(classGen, methodGen); _falseList.add(il.append(_op == Operators.EQ ? (BranchInstruction)new IF_ICMPNE(null) : (BranchInstruction)new IF_ICMPEQ(null))); } else if (tleft instanceof NumberType) { _left.translate(classGen, methodGen); _right.translate(classGen, methodGen); if (tleft instanceof RealType) { il.append(DCMPG); _falseList.add(il.append(_op == Operators.EQ ? (BranchInstruction)new IFNE(null) : (BranchInstruction)new IFEQ(null))); } else { _falseList.add(il.append(_op == Operators.EQ ? (BranchInstruction)new IF_ICMPNE(null) : (BranchInstruction)new IF_ICMPEQ(null))); } } else { translate(classGen, methodGen); desynthesize(classGen, methodGen); } } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final Type tleft = _left.getType(); Type tright = _right.getType(); if (tleft instanceof BooleanType || tleft instanceof NumberType) { translateDesynthesized(classGen, methodGen); synthesize(classGen, methodGen); return; } if (tleft instanceof StringType) { final int equals = cpg.addMethodref(STRING_CLASS, "equals", "(" + OBJECT_SIG +")Z"); _left.translate(classGen, methodGen); _right.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(equals)); if (_op == Operators.NE) { il.append(ICONST_1); il.append(IXOR); // not x <-> x xor 1 } return; } BranchHandle truec, falsec; if (tleft instanceof ResultTreeType) { if (tright instanceof BooleanType) { _right.translate(classGen, methodGen); if (_op == Operators.NE) { il.append(ICONST_1); il.append(IXOR); // not x <-> x xor 1 } return; } if (tright instanceof RealType) { _left.translate(classGen, methodGen); tleft.translateTo(classGen, methodGen, Type.Real); _right.translate(classGen, methodGen); il.append(DCMPG); falsec = il.append(_op == Operators.EQ ? (BranchInstruction) new IFNE(null) : (BranchInstruction) new IFEQ(null)); il.append(ICONST_1); truec = il.append(new GOTO(null)); falsec.setTarget(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); return; } // Next, result-tree/string and result-tree/result-tree comparisons _left.translate(classGen, methodGen); tleft.translateTo(classGen, methodGen, Type.String); _right.translate(classGen, methodGen); if (tright instanceof ResultTreeType) { tright.translateTo(classGen, methodGen, Type.String); } final int equals = cpg.addMethodref(STRING_CLASS, "equals", "(" +OBJECT_SIG+ ")Z"); il.append(new INVOKEVIRTUAL(equals)); if (_op == Operators.NE) { il.append(ICONST_1); il.append(IXOR); // not x <-> x xor 1 } return; } if (tleft instanceof NodeSetType && tright instanceof BooleanType) { _left.translate(classGen, methodGen); _left.startIterator(classGen, methodGen); Type.NodeSet.translateTo(classGen, methodGen, Type.Boolean); _right.translate(classGen, methodGen); il.append(IXOR); // x != y <-> x xor y if (_op == Operators.EQ) { il.append(ICONST_1); il.append(IXOR); // not x <-> x xor 1 } return; } if (tleft instanceof NodeSetType && tright instanceof StringType) { _left.translate(classGen, methodGen); _left.startIterator(classGen, methodGen); // needed ? _right.translate(classGen, methodGen); il.append(new PUSH(cpg, _op)); il.append(methodGen.loadDOM()); final int cmp = cpg.addMethodref(BASIS_LIBRARY_CLASS, "compare", "(" + tleft.toSignature() + tright.toSignature() + "I" + DOM_INTF_SIG + ")Z"); il.append(new INVOKESTATIC(cmp)); return; } // Next, node-set/t for t in {real, string, node-set, result-tree} _left.translate(classGen, methodGen); _left.startIterator(classGen, methodGen); _right.translate(classGen, methodGen); _right.startIterator(classGen, methodGen); // Cast a result tree to a string to use an existing compare if (tright instanceof ResultTreeType) { tright.translateTo(classGen, methodGen, Type.String); tright = Type.String; } // Call the appropriate compare() from the BasisLibrary il.append(new PUSH(cpg, _op)); il.append(methodGen.loadDOM()); final int compare = cpg.addMethodref(BASIS_LIBRARY_CLASS, "compare", "(" + tleft.toSignature() + tright.toSignature() + "I" + DOM_INTF_SIG + ")Z"); il.append(new INVOKESTATIC(compare)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Predicate.java0000644000175000017500000004645210721374031024725 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Predicate.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.ArrayList; import org.apache.bcel.classfile.Field; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUTFIELD; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.FilterGenerator; import org.apache.xalan.xsltc.compiler.util.IntType; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NumberType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.TestGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xalan.xsltc.runtime.Operators; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Predicate extends Expression implements Closure { /** * The predicate's expression. */ private Expression _exp = null; /** * This flag indicates if optimizations are turned on. The * method dontOptimize() can be called to turn * optimizations off. */ private boolean _canOptimize = true; /** * Flag indicatig if the nth position optimization is on. It * is set in typeCheck(). */ private boolean _nthPositionFilter = false; /** * Flag indicatig if the nth position descendant is on. It * is set in typeCheck(). */ private boolean _nthDescendant = false; /** * Cached node type of the expression that owns this predicate. */ int _ptype = -1; /** * Name of the inner class. */ private String _className = null; /** * List of variables in closure. */ private ArrayList _closureVars = null; /** * Reference to parent closure. */ private Closure _parentClosure = null; /** * Cached value of method getCompareValue(). */ private Expression _value = null; /** * Cached value of method getCompareValue(). */ private Step _step = null; /** * Initializes a predicate. */ public Predicate(Expression exp) { _exp = exp; _exp.setParent(this); } /** * Set the parser for this expression. */ public void setParser(Parser parser) { super.setParser(parser); _exp.setParser(parser); } /** * Returns a boolean value indicating if the nth position optimization * is on. Must be call after type checking! */ public boolean isNthPositionFilter() { return _nthPositionFilter; } /** * Returns a boolean value indicating if the nth descendant optimization * is on. Must be call after type checking! */ public boolean isNthDescendant() { return _nthDescendant; } /** * Turns off all optimizations for this predicate. */ public void dontOptimize() { _canOptimize = false; } /** * Returns true if the expression in this predicate contains a call * to position(). */ public boolean hasPositionCall() { return _exp.hasPositionCall(); } /** * Returns true if the expression in this predicate contains a call * to last(). */ public boolean hasLastCall() { return _exp.hasLastCall(); } // -- Begin Closure interface -------------------- /** * Returns true if this closure is compiled in an inner class (i.e. * if this is a real closure). */ public boolean inInnerClass() { return (_className != null); } /** * Returns a reference to its parent closure or null if outermost. */ public Closure getParentClosure() { if (_parentClosure == null) { SyntaxTreeNode node = getParent(); do { if (node instanceof Closure) { _parentClosure = (Closure) node; break; } if (node instanceof TopLevelElement) { break; // way up in the tree } node = node.getParent(); } while (node != null); } return _parentClosure; } /** * Returns the name of the auxiliary class or null if this predicate * is compiled inside the Translet. */ public String getInnerClassName() { return _className; } /** * Add new variable to the closure. */ public void addVariable(VariableRefBase variableRef) { if (_closureVars == null) { _closureVars = new ArrayList(); } // Only one reference per variable if (!_closureVars.contains(variableRef)) { _closureVars.add(variableRef); // Add variable to parent closure as well Closure parentClosure = getParentClosure(); if (parentClosure != null) { parentClosure.addVariable(variableRef); } } } // -- End Closure interface ---------------------- /** * Returns the node type of the expression owning this predicate. The * return value is cached in _ptype. */ public int getPosType() { if (_ptype == -1) { SyntaxTreeNode parent = getParent(); if (parent instanceof StepPattern) { _ptype = ((StepPattern)parent).getNodeType(); } else if (parent instanceof AbsoluteLocationPath) { AbsoluteLocationPath path = (AbsoluteLocationPath)parent; Expression exp = path.getPath(); if (exp instanceof Step) { _ptype = ((Step)exp).getNodeType(); } } else if (parent instanceof VariableRefBase) { final VariableRefBase ref = (VariableRefBase)parent; final VariableBase var = ref.getVariable(); final Expression exp = var.getExpression(); if (exp instanceof Step) { _ptype = ((Step)exp).getNodeType(); } } else if (parent instanceof Step) { _ptype = ((Step)parent).getNodeType(); } } return _ptype; } public boolean parentIsPattern() { return (getParent() instanceof Pattern); } public Expression getExpr() { return _exp; } public String toString() { return "pred(" + _exp + ')'; } /** * Type check a predicate expression. If the type of the expression is * number convert it to boolean by adding a comparison with position(). * Note that if the expression is a parameter, we cannot distinguish * at compile time if its type is number or not. Hence, expressions of * reference type are always converted to booleans. * * This method may be called twice, before and after calling * dontOptimize(). If so, the second time it should honor * the new value of _canOptimize. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { Type texp = _exp.typeCheck(stable); // We need explicit type information for reference types - no good! if (texp instanceof ReferenceType) { _exp = new CastExpr(_exp, texp = Type.Real); } // A result tree fragment should not be cast directly to a number type, // but rather to a boolean value, and then to a numer (0 or 1). // Ref. section 11.2 of the XSLT 1.0 spec if (texp instanceof ResultTreeType) { _exp = new CastExpr(_exp, Type.Boolean); _exp = new CastExpr(_exp, Type.Real); texp = _exp.typeCheck(stable); } // Numerical types will be converted to a position filter if (texp instanceof NumberType) { // Cast any numerical types to an integer if (texp instanceof IntType == false) { _exp = new CastExpr(_exp, Type.Int); } if (_canOptimize) { // Nth position optimization. Expression must not depend on context _nthPositionFilter = !_exp.hasLastCall() && !_exp.hasPositionCall(); // _nthDescendant optimization - only if _nthPositionFilter is on if (_nthPositionFilter) { SyntaxTreeNode parent = getParent(); _nthDescendant = (parent instanceof Step) && (parent.getParent() instanceof AbsoluteLocationPath); return _type = Type.NodeSet; } } // Reset optimization flags _nthPositionFilter = _nthDescendant = false; // Otherwise, expand [e] to [position() = e] final QName position = getParser().getQNameIgnoreDefaultNs("position"); final PositionCall positionCall = new PositionCall(position); positionCall.setParser(getParser()); positionCall.setParent(this); _exp = new EqualityExpr(Operators.EQ, positionCall, _exp); if (_exp.typeCheck(stable) != Type.Boolean) { _exp = new CastExpr(_exp, Type.Boolean); } return _type = Type.Boolean; } else { // All other types will be handled as boolean values if (texp instanceof BooleanType == false) { _exp = new CastExpr(_exp, Type.Boolean); } return _type = Type.Boolean; } } /** * Create a new "Filter" class implementing * CurrentNodeListFilter. Allocate registers for local * variables and local parameters passed in the closure to test(). * Notice that local variables need to be "unboxed". */ private void compileFilter(ClassGenerator classGen, MethodGenerator methodGen) { TestGenerator testGen; LocalVariableGen local; FilterGenerator filterGen; _className = getXSLTC().getHelperClassName(); filterGen = new FilterGenerator(_className, "java.lang.Object", toString(), ACC_PUBLIC | ACC_SUPER, new String[] { CURRENT_NODE_LIST_FILTER }, classGen.getStylesheet()); final ConstantPoolGen cpg = filterGen.getConstantPool(); final int length = (_closureVars == null) ? 0 : _closureVars.size(); // Add a new instance variable for each var in closure for (int i = 0; i < length; i++) { VariableBase var = ((VariableRefBase) _closureVars.get(i)).getVariable(); filterGen.addField(new Field(ACC_PUBLIC, cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool())); } final InstructionList il = new InstructionList(); testGen = new TestGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.BOOLEAN, new org.apache.bcel.generic.Type[] { org.apache.bcel.generic.Type.INT, org.apache.bcel.generic.Type.INT, org.apache.bcel.generic.Type.INT, org.apache.bcel.generic.Type.INT, Util.getJCRefType(TRANSLET_SIG), Util.getJCRefType(NODE_ITERATOR_SIG) }, new String[] { "node", "position", "last", "current", "translet", "iterator" }, "test", _className, il, cpg); // Store the dom in a local variable local = testGen.addLocalVariable("document", Util.getJCRefType(DOM_INTF_SIG), null, null); final String className = classGen.getClassName(); il.append(filterGen.loadTranslet()); il.append(new CHECKCAST(cpg.addClass(className))); il.append(new GETFIELD(cpg.addFieldref(className, DOM_FIELD, DOM_INTF_SIG))); local.setStart(il.append(new ASTORE(local.getIndex()))); // Store the dom index in the test generator testGen.setDomIndex(local.getIndex()); _exp.translate(filterGen, testGen); il.append(IRETURN); filterGen.addEmptyConstructor(ACC_PUBLIC); filterGen.addMethod(testGen); getXSLTC().dumpClass(filterGen.getJavaClass()); } /** * Returns true if the predicate is a test for the existance of an * element or attribute. All we have to do is to get the first node * from the step, check if it is there, and then return true/false. */ public boolean isBooleanTest() { return (_exp instanceof BooleanExpr); } /** * Method to see if we can optimise the predicate by using a specialised * iterator for expressions like '/foo/bar[@attr = $var]', which are * very common in many stylesheets */ public boolean isNodeValueTest() { if (!_canOptimize) return false; return (getStep() != null && getCompareValue() != null); } /** * Returns the step in an expression of the form 'step = value'. * Null is returned if the expression is not of the right form. * Optimization if off if null is returned. */ public Step getStep() { // Returned cached value if called more than once if (_step != null) { return _step; } // Nothing to do if _exp is null if (_exp == null) { return null; } // Ignore if not equality expression if (_exp instanceof EqualityExpr) { EqualityExpr exp = (EqualityExpr)_exp; Expression left = exp.getLeft(); Expression right = exp.getRight(); // Unwrap and set _step if appropriate if (left instanceof CastExpr) { left = ((CastExpr) left).getExpr(); } if (left instanceof Step) { _step = (Step) left; } // Unwrap and set _step if appropriate if (right instanceof CastExpr) { right = ((CastExpr)right).getExpr(); } if (right instanceof Step) { _step = (Step)right; } } return _step; } /** * Returns the value in an expression of the form 'step = value'. * A value may be either a literal string or a variable whose * type is string. Optimization if off if null is returned. */ public Expression getCompareValue() { // Returned cached value if called more than once if (_value != null) { return _value; } // Nothing to to do if _exp is null if (_exp == null) { return null; } // Ignore if not an equality expression if (_exp instanceof EqualityExpr) { EqualityExpr exp = (EqualityExpr) _exp; Expression left = exp.getLeft(); Expression right = exp.getRight(); // Return if left is literal string if (left instanceof LiteralExpr) { _value = left; return _value; } // Return if left is a variable reference of type string if (left instanceof VariableRefBase && left.getType() == Type.String) { _value = left; return _value; } // Return if right is literal string if (right instanceof LiteralExpr) { _value = right; return _value; } // Return if left is a variable reference whose type is string if (right instanceof VariableRefBase && right.getType() == Type.String) { _value = right; return _value; } } return null; } /** * Translate a predicate expression. This translation pushes * two references on the stack: a reference to a newly created * filter object and a reference to the predicate's closure. */ public void translateFilter(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Compile auxiliary class for filter compileFilter(classGen, methodGen); // Create new instance of filter il.append(new NEW(cpg.addClass(_className))); il.append(DUP); il.append(new INVOKESPECIAL(cpg.addMethodref(_className, "", "()V"))); // Initialize closure variables final int length = (_closureVars == null) ? 0 : _closureVars.size(); for (int i = 0; i < length; i++) { VariableRefBase varRef = (VariableRefBase) _closureVars.get(i); VariableBase var = varRef.getVariable(); Type varType = var.getType(); il.append(DUP); // Find nearest closure implemented as an inner class Closure variableClosure = _parentClosure; while (variableClosure != null) { if (variableClosure.inInnerClass()) break; variableClosure = variableClosure.getParentClosure(); } // Use getfield if in an inner class if (variableClosure != null) { il.append(ALOAD_0); il.append(new GETFIELD( cpg.addFieldref(variableClosure.getInnerClassName(), var.getEscapedName(), varType.toSignature()))); } else { // Use a load of instruction if in translet class il.append(var.loadInstruction()); } // Store variable in new closure il.append(new PUTFIELD( cpg.addFieldref(_className, var.getEscapedName(), varType.toSignature()))); } } /** * Translate a predicate expression. If non of the optimizations apply * then this translation pushes two references on the stack: a reference * to a newly created filter object and a reference to the predicate's * closure. See class Step for further details. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_nthPositionFilter || _nthDescendant) { _exp.translate(classGen, methodGen); } else if (isNodeValueTest() && (getParent() instanceof Step)) { _value.translate(classGen, methodGen); il.append(new CHECKCAST(cpg.addClass(STRING_CLASS))); il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp())); } else { translateFilter(classGen, methodGen); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/BinOpExpr.java0000644000175000017500000001001010721374031024650 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BinOpExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class BinOpExpr extends Expression { public static final int PLUS = 0; public static final int MINUS = 1; public static final int TIMES = 2; public static final int DIV = 3; public static final int MOD = 4; private static final String[] Ops = { "+", "-", "*", "/", "%" }; private int _op; private Expression _left, _right; public BinOpExpr(int op, Expression left, Expression right) { _op = op; (_left = left).setParent(this); (_right = right).setParent(this); } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { if (_left.hasPositionCall()) return true; if (_right.hasPositionCall()) return true; return false; } /** * Returns true if this expressions contains a call to last() */ public boolean hasLastCall() { return (_left.hasLastCall() || _right.hasLastCall()); } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); _right.setParser(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tleft = _left.typeCheck(stable); final Type tright = _right.typeCheck(stable); final MethodType ptype = lookupPrimop(stable, Ops[_op], new MethodType(Type.Void, tleft, tright)); if (ptype != null) { final Type arg1 = (Type) ptype.argsType().elementAt(0); if (!arg1.identicalTo(tleft)) { _left = new CastExpr(_left, arg1); } final Type arg2 = (Type) ptype.argsType().elementAt(1); if (!arg2.identicalTo(tright)) { _right = new CastExpr(_right, arg1); } return _type = ptype.resultType(); } throw new TypeCheckError(this); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _left.translate(classGen, methodGen); _right.translate(classGen, methodGen); switch (_op) { case PLUS: il.append(_type.ADD()); break; case MINUS: il.append(_type.SUB()); break; case TIMES: il.append(_type.MUL()); break; case DIV: il.append(_type.DIV()); break; case MOD: il.append(_type.REM()); break; default: ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_BINARY_OP_ERR, this); getParser().reportError(Constants.ERROR, msg); } } public String toString() { return Ops[_op] + '(' + _left + ", " + _right + ')'; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ContainsCall.java0000644000175000017500000000700310721374031025364 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ContainsCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class ContainsCall extends FunctionCall { private Expression _base = null; private Expression _token = null; /** * Create a contains() call - two arguments, both strings */ public ContainsCall(QName fname, Vector arguments) { super(fname, arguments); } /** * This XPath function returns true/false values */ public boolean isBoolean() { return true; } /** * Type check the two parameters for this function */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Check that the function was passed exactly two arguments if (argumentCount() != 2) { throw new TypeCheckError(ErrorMsg.ILLEGAL_ARG_ERR, getName(), this); } // The first argument must be a String, or cast to a String _base = argument(0); Type baseType = _base.typeCheck(stable); if (baseType != Type.String) _base = new CastExpr(_base, Type.String); // The second argument must also be a String, or cast to a String _token = argument(1); Type tokenType = _token.typeCheck(stable); if (tokenType != Type.String) _token = new CastExpr(_token, Type.String); return _type = Type.Boolean; } /** * Compile the expression - leave boolean expression on stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { translateDesynthesized(classGen, methodGen); synthesize(classGen, methodGen); } /** * Compile expression and update true/false-lists */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _base.translate(classGen, methodGen); _token.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "indexOf", "("+STRING_SIG+")I"))); _falseList.add(il.append(new IFLT(null))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Param.java0000644000175000017500000002110210721374032024047 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Param.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.classfile.Field; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.IFNONNULL; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUTFIELD; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.ObjectType; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.runtime.BasisLibrary; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt * @author John Howard */ final class Param extends VariableBase { /** * True if this Param is declared in a simple named template. * This is used to optimize codegen for parameter passing * in named templates. */ private boolean _isInSimpleNamedTemplate = false; /** * Display variable as single string */ public String toString() { return "param(" + _name + ")"; } /** * Set the instruction for loading the value of this variable onto the * JVM stack and returns the old instruction. */ public Instruction setLoadInstruction(Instruction instruction) { Instruction tmp = _loadInstruction; _loadInstruction = instruction; return tmp; } /** * Set the instruction for storing a value from the stack into this * variable and returns the old instruction. */ public Instruction setStoreInstruction(Instruction instruction) { Instruction tmp = _storeInstruction; _storeInstruction = instruction; return tmp; } /** * Display variable in a full AST dump */ public void display(int indent) { indent(indent); System.out.println("param " + _name); if (_select != null) { indent(indent + IndentIncrement); System.out.println("select " + _select.toString()); } displayContents(indent + IndentIncrement); } /** * Parse the contents of the element. This method must read * the 'name' (required) and 'select' (optional) attributes. */ public void parseContents(Parser parser) { // Parse 'name' and 'select' attributes plus parameter contents super.parseContents(parser); // Add a ref to this param to its enclosing construct final SyntaxTreeNode parent = getParent(); if (parent instanceof Stylesheet) { // Mark this as a global parameter _isLocal = false; // Check if a global variable with this name already exists... Param param = parser.getSymbolTable().lookupParam(_name); // ...and if it does we need to check import precedence if (param != null) { final int us = this.getImportPrecedence(); final int them = param.getImportPrecedence(); // It is an error if the two have the same import precedence if (us == them) { final String name = _name.toString(); reportError(this, parser, ErrorMsg.VARIABLE_REDEF_ERR,name); } // Ignore this if previous definition has higher precedence else if (them > us) { _ignore = true; return; } else { param.disable(); } } // Add this variable if we have higher precedence ((Stylesheet)parent).addParam(this); parser.getSymbolTable().addParam(this); } else if (parent instanceof Template) { Template template = (Template) parent; _isLocal = true; template.addParameter(this); if (template.isSimpleNamedTemplate()) { _isInSimpleNamedTemplate = true; } } } /** * Type-checks the parameter. The parameter type is determined by the * 'select' expression (if present) or is a result tree if the parameter * element has a body and no 'select' expression. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_select != null) { _type = _select.typeCheck(stable); if (_type instanceof ReferenceType == false && !(_type instanceof ObjectType)) { _select = new CastExpr(_select, Type.Reference); } } else if (hasContents()) { typeCheckContents(stable); } _type = Type.Reference; // This element has no type (the parameter does, but the parameter // element itself does not). return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_ignore) return; _ignore = true; /* * To fix bug 24518 related to setting parameters of the form * {namespaceuri}localName which will get mapped to an instance * variable in the class. */ final String name = BasisLibrary.mapQNameToJavaName(_name.toString()); final String signature = _type.toSignature(); final String className = _type.getClassName(); if (isLocal()) { /* * If simple named template then generate a conditional init of the * param using its default value: * if (param == null) param = */ if (_isInSimpleNamedTemplate) { il.append(loadInstruction()); BranchHandle ifBlock = il.append(new IFNONNULL(null)); translateValue(classGen, methodGen); il.append(storeInstruction()); ifBlock.setTarget(il.append(NOP)); return; } il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, name)); translateValue(classGen, methodGen); il.append(new PUSH(cpg, true)); // Call addParameter() from this class il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, ADD_PARAMETER, ADD_PARAMETER_SIG))); if (className != EMPTYSTRING) { il.append(new CHECKCAST(cpg.addClass(className))); } _type.translateUnBox(classGen, methodGen); if (_refs.isEmpty()) { // nobody uses the value il.append(_type.POP()); _local = null; } else { // normal case _local = methodGen.addLocalVariable2(name, _type.toJCType(), null); // Cache the result of addParameter() in a local variable _local.setStart(il.append(_type.STORE(_local.getIndex()))); } } else { if (classGen.containsField(name) == null) { classGen.addField(new Field(ACC_PUBLIC, cpg.addUtf8(name), cpg.addUtf8(signature), null, cpg.getConstantPool())); il.append(classGen.loadTranslet()); il.append(DUP); il.append(new PUSH(cpg, name)); translateValue(classGen, methodGen); il.append(new PUSH(cpg, true)); // Call addParameter() from this class il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, ADD_PARAMETER, ADD_PARAMETER_SIG))); _type.translateUnBox(classGen, methodGen); // Cache the result of addParameter() in a field if (className != EMPTYSTRING) { il.append(new CHECKCAST(cpg.addClass(className))); } il.append(new PUTFIELD(cpg.addFieldref(classGen.getClassName(), name, signature))); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NotCall.java0000644000175000017500000000405710721374033024356 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NotCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class NotCall extends FunctionCall { public NotCall(QName fname, Vector arguments) { super(fname, arguments); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); argument().translate(classGen, methodGen); il.append(ICONST_1); il.append(IXOR); } public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); final Expression exp = argument(); exp.translateDesynthesized(classGen, methodGen); final BranchHandle gotoh = il.append(new GOTO(null)); _trueList = exp._falseList; // swap flow lists _falseList = exp._trueList; _falseList.add(gotoh); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AbsoluteLocationPath.java0000644000175000017500000001111310721374032027074 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AbsoluteLocationPath.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class AbsoluteLocationPath extends Expression { private Expression _path; // may be null public AbsoluteLocationPath() { _path = null; } public AbsoluteLocationPath(Expression path) { _path = path; if (path != null) { _path.setParent(this); } } public void setParser(Parser parser) { super.setParser(parser); if (_path != null) { _path.setParser(parser); } } public Expression getPath() { return(_path); } public String toString() { return "AbsoluteLocationPath(" + (_path != null ? _path.toString() : "null") + ')'; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_path != null) { final Type ptype = _path.typeCheck(stable); if (ptype instanceof NodeType) { // promote to node-set _path = new CastExpr(_path, Type.NodeSet); } } return _type = Type.NodeSet; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_path != null) { final int initAI = cpg.addMethodref(ABSOLUTE_ITERATOR, "", "(" + NODE_ITERATOR_SIG + ")V"); // Compile relative path iterator(s) // // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches, // so we mustn't create the new object until after we've created // this argument to its constructor. Instead we calculate the // value of the argument to the constructor first, store it in // a temporary variable, create the object and reload the argument // from the temporary to avoid the problem. _path.translate(classGen, methodGen); LocalVariableGen relPathIterator = methodGen.addLocalVariable("abs_location_path_tmp", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); relPathIterator.setStart( il.append(new ASTORE(relPathIterator.getIndex()))); // Create new AbsoluteIterator il.append(new NEW(cpg.addClass(ABSOLUTE_ITERATOR))); il.append(DUP); relPathIterator.setEnd( il.append(new ALOAD(relPathIterator.getIndex()))); // Initialize AbsoluteIterator with iterator from the stack il.append(new INVOKESPECIAL(initAI)); } else { final int gitr = cpg.addInterfaceMethodref(DOM_INTF, "getIterator", "()"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new INVOKEINTERFACE(gitr, 1)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/SecuritySupport12.java0000644000175000017500000001176610721374032026375 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LiteralElement.java0000644000175000017500000004541510721374030025730 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LiteralElement.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.serializer.ElemDesc; import org.apache.xml.serializer.ToHTMLStream; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class LiteralElement extends Instruction { private String _name; private LiteralElement _literalElemParent = null; private Vector _attributeElements = null; private Hashtable _accessedPrefixes = null; // True if all attributes of this LRE are unique, i.e. they all have // different names. This flag is set to false if some attribute // names are not known at compile time. private boolean _allAttributesUnique = false; private final static String XMLNS_STRING = "xmlns"; /** * Returns the QName for this literal element */ public QName getName() { return _qname; } /** * Displays the contents of this literal element */ public void display(int indent) { indent(indent); Util.println("LiteralElement name = " + _name); displayContents(indent + IndentIncrement); } /** * Returns the namespace URI for which a prefix is pointing to */ private String accessedNamespace(String prefix) { if (_literalElemParent != null) { String result = _literalElemParent.accessedNamespace(prefix); if (result != null) { return result; } } return _accessedPrefixes != null ? (String) _accessedPrefixes.get(prefix) : null; } /** * Method used to keep track of what namespaces that are references by * this literal element and its attributes. The output must contain a * definition for each namespace, so we stuff them in a hashtable. */ public void registerNamespace(String prefix, String uri, SymbolTable stable, boolean declared) { // Check if the parent has a declaration for this namespace if (_literalElemParent != null) { final String parentUri = _literalElemParent.accessedNamespace(prefix); if (parentUri != null && parentUri.equals(uri)) { return; } } // Check if we have any declared namesaces if (_accessedPrefixes == null) { _accessedPrefixes = new Hashtable(); } else { if (!declared) { // Check if this node has a declaration for this namespace final String old = (String)_accessedPrefixes.get(prefix); if (old != null) { if (old.equals(uri)) return; else prefix = stable.generateNamespacePrefix(); } } } if (!prefix.equals("xml")) { _accessedPrefixes.put(prefix,uri); } } /** * Translates the prefix of a QName according to the rules set in * the attributes of xsl:stylesheet. Also registers a QName to assure * that the output element contains the necessary namespace declarations. */ private String translateQName(QName qname, SymbolTable stable) { // Break up the QName and get prefix:localname strings String localname = qname.getLocalPart(); String prefix = qname.getPrefix(); // Treat default namespace as "" and not null if (prefix == null) prefix = Constants.EMPTYSTRING; else if (prefix.equals(XMLNS_STRING)) return(XMLNS_STRING); // Check if we must translate the prefix final String alternative = stable.lookupPrefixAlias(prefix); if (alternative != null) { stable.excludeNamespaces(prefix); prefix = alternative; } // Get the namespace this prefix refers to String uri = lookupNamespace(prefix); if (uri == null) return(localname); // Register the namespace as accessed registerNamespace(prefix, uri, stable, false); // Construct the new name for the element (may be unchanged) if (prefix != Constants.EMPTYSTRING) return(prefix+":"+localname); else return(localname); } /** * Add an attribute to this element */ public void addAttribute(SyntaxTreeNode attribute) { if (_attributeElements == null) { _attributeElements = new Vector(2); } _attributeElements.add(attribute); } /** * Set the first attribute of this element */ public void setFirstAttribute(SyntaxTreeNode attribute) { if (_attributeElements == null) { _attributeElements = new Vector(2); } _attributeElements.insertElementAt(attribute,0); } /** * Type-check the contents of this element. The element itself does not * need any type checking as it leaves nothign on the JVM's stack. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type-check all attributes if (_attributeElements != null) { final int count = _attributeElements.size(); for (int i = 0; i < count; i++) { SyntaxTreeNode node = (SyntaxTreeNode)_attributeElements.elementAt(i); node.typeCheck(stable); } } typeCheckContents(stable); return Type.Void; } /** * This method starts at a given node, traverses all namespace mappings, * and assembles a list of all prefixes that (for the given node) maps * to _ANY_ namespace URI. Used by literal result elements to determine */ public Enumeration getNamespaceScope(SyntaxTreeNode node) { Hashtable all = new Hashtable(); while (node != null) { Hashtable mapping = node.getPrefixMapping(); if (mapping != null) { Enumeration prefixes = mapping.keys(); while (prefixes.hasMoreElements()) { String prefix = (String)prefixes.nextElement(); if (!all.containsKey(prefix)) { all.put(prefix, mapping.get(prefix)); } } } node = node.getParent(); } return(all.keys()); } /** * Determines the final QName for the element and its attributes. * Registers all namespaces that are used by the element/attributes */ public void parseContents(Parser parser) { final SymbolTable stable = parser.getSymbolTable(); stable.setCurrentNode(this); // Check if in a literal element context SyntaxTreeNode parent = getParent(); if (parent != null && parent instanceof LiteralElement) { _literalElemParent = (LiteralElement) parent; } _name = translateQName(_qname, stable); // Process all attributes and register all namespaces they use final int count = _attributes.getLength(); for (int i = 0; i < count; i++) { final QName qname = parser.getQName(_attributes.getQName(i)); final String uri = qname.getNamespace(); final String val = _attributes.getValue(i); // Handle xsl:use-attribute-sets. Attribute sets are placed first // in the vector or attributes to make sure that later local // attributes can override an attributes in the set. if (qname == parser.getUseAttributeSets()) { if (!Util.isValidQNames(val)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, val, this); parser.reportError(Constants.ERROR, err); } setFirstAttribute(new UseAttributeSets(val, parser)); } // Handle xsl:extension-element-prefixes else if (qname == parser.getExtensionElementPrefixes()) { stable.excludeNamespaces(val); } // Handle xsl:exclude-result-prefixes else if (qname == parser.getExcludeResultPrefixes()) { stable.excludeNamespaces(val); } else { // Ignore special attributes (e.g. xmlns:prefix and xmlns) final String prefix = qname.getPrefix(); if (prefix != null && prefix.equals(XMLNS_PREFIX) || prefix == null && qname.getLocalPart().equals("xmlns") || uri != null && uri.equals(XSLT_URI)) { continue; } // Handle all other literal attributes final String name = translateQName(qname, stable); LiteralAttribute attr = new LiteralAttribute(name, val, parser, this); addAttribute(attr); attr.setParent(this); attr.parseContents(parser); } } // Register all namespaces that are in scope, except for those that // are listed in the xsl:stylesheet element's *-prefixes attributes final Enumeration include = getNamespaceScope(this); while (include.hasMoreElements()) { final String prefix = (String)include.nextElement(); if (!prefix.equals("xml")) { final String uri = lookupNamespace(prefix); if (uri != null && !stable.isExcludedNamespace(uri)) { registerNamespace(prefix, uri, stable, true); } } } parseChildren(parser); // Process all attributes and register all namespaces they use for (int i = 0; i < count; i++) { final QName qname = parser.getQName(_attributes.getQName(i)); final String val = _attributes.getValue(i); // Handle xsl:extension-element-prefixes if (qname == parser.getExtensionElementPrefixes()) { stable.unExcludeNamespaces(val); } // Handle xsl:exclude-result-prefixes else if (qname == parser.getExcludeResultPrefixes()) { stable.unExcludeNamespaces(val); } } } protected boolean contextDependent() { return dependentContents(); } /** * Compiles code that emits the literal element to the output handler, * first the start tag, then namespace declaration, then attributes, * then the element contents, and then the element end tag. Since the * value of an attribute may depend on a variable, variables must be * compiled first. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Check whether all attributes are unique. _allAttributesUnique = checkAttributesUnique(); // Compile code to emit element start tag il.append(methodGen.loadHandler()); il.append(new PUSH(cpg, _name)); il.append(DUP2); // duplicate these 2 args for endElement il.append(methodGen.startElement()); // The value of an attribute may depend on a (sibling) variable int j=0; while (j < elementCount()) { final SyntaxTreeNode item = (SyntaxTreeNode) elementAt(j); if (item instanceof Variable) { item.translate(classGen, methodGen); } j++; } // Compile code to emit namespace attributes if (_accessedPrefixes != null) { boolean declaresDefaultNS = false; Enumeration e = _accessedPrefixes.keys(); while (e.hasMoreElements()) { final String prefix = (String)e.nextElement(); final String uri = (String)_accessedPrefixes.get(prefix); if (uri != Constants.EMPTYSTRING || prefix != Constants.EMPTYSTRING) { if (prefix == Constants.EMPTYSTRING) { declaresDefaultNS = true; } il.append(methodGen.loadHandler()); il.append(new PUSH(cpg,prefix)); il.append(new PUSH(cpg,uri)); il.append(methodGen.namespace()); } } /* * If our XslElement parent redeclares the default NS, and this * element doesn't, it must be redeclared one more time. */ if (!declaresDefaultNS && (_parent instanceof XslElement) && ((XslElement) _parent).declaresDefaultNS()) { il.append(methodGen.loadHandler()); il.append(new PUSH(cpg, Constants.EMPTYSTRING)); il.append(new PUSH(cpg, Constants.EMPTYSTRING)); il.append(methodGen.namespace()); } } // Output all attributes if (_attributeElements != null) { final int count = _attributeElements.size(); for (int i = 0; i < count; i++) { SyntaxTreeNode node = (SyntaxTreeNode)_attributeElements.elementAt(i); if (!(node instanceof XslAttribute)) { node.translate(classGen, methodGen); } } } // Compile code to emit attributes and child elements translateContents(classGen, methodGen); // Compile code to emit element end tag il.append(methodGen.endElement()); } /** * Return true if the output method is html. */ private boolean isHTMLOutput() { return getStylesheet().getOutputMethod() == Stylesheet.HTML_OUTPUT; } /** * Return the ElemDesc object for an HTML element. * Return null if the output method is not HTML or this is not a * valid HTML element. */ public ElemDesc getElemDesc() { if (isHTMLOutput()) { return ToHTMLStream.getElemDesc(_name); } else return null; } /** * Return true if all attributes of this LRE have unique names. */ public boolean allAttributesUnique() { return _allAttributesUnique; } /** * Check whether all attributes are unique. */ private boolean checkAttributesUnique() { boolean hasHiddenXslAttribute = canProduceAttributeNodes(this, true); if (hasHiddenXslAttribute) return false; if (_attributeElements != null) { int numAttrs = _attributeElements.size(); Hashtable attrsTable = null; for (int i = 0; i < numAttrs; i++) { SyntaxTreeNode node = (SyntaxTreeNode)_attributeElements.elementAt(i); if (node instanceof UseAttributeSets) { return false; } else if (node instanceof XslAttribute) { if (attrsTable == null) { attrsTable = new Hashtable(); for (int k = 0; k < i; k++) { SyntaxTreeNode n = (SyntaxTreeNode)_attributeElements.elementAt(k); if (n instanceof LiteralAttribute) { LiteralAttribute literalAttr = (LiteralAttribute)n; attrsTable.put(literalAttr.getName(), literalAttr); } } } XslAttribute xslAttr = (XslAttribute)node; AttributeValue attrName = xslAttr.getName(); if (attrName instanceof AttributeValueTemplate) { return false; } else if (attrName instanceof SimpleAttributeValue) { SimpleAttributeValue simpleAttr = (SimpleAttributeValue)attrName; String name = simpleAttr.toString(); if (name != null && attrsTable.get(name) != null) return false; else if (name != null) { attrsTable.put(name, xslAttr); } } } } } return true; } /** * Return true if the instructions under the given SyntaxTreeNode can produce attribute nodes * to an element. Only return false when we are sure that no attribute node is produced. * Return true if we are not sure. If the flag ignoreXslAttribute is true, the direct * children of the current node are not included in the check. */ private boolean canProduceAttributeNodes(SyntaxTreeNode node, boolean ignoreXslAttribute) { Vector contents = node.getContents(); int size = contents.size(); for (int i = 0; i < size; i++) { SyntaxTreeNode child = (SyntaxTreeNode)contents.elementAt(i); if (child instanceof Text) { Text text = (Text)child; if (text.isIgnore()) continue; else return false; } // Cannot add an attribute to an element after children have been added to it. // We can safely return false when the instruction can produce an output node. else if (child instanceof LiteralElement || child instanceof ValueOf || child instanceof XslElement || child instanceof Comment || child instanceof Number || child instanceof ProcessingInstruction) return false; else if (child instanceof XslAttribute) { if (ignoreXslAttribute) continue; else return true; } // In general, there is no way to check whether or // can produce attribute nodes. and // can also copy attribute nodes to an element. Return // true in those cases to be safe. else if (child instanceof CallTemplate || child instanceof ApplyTemplates || child instanceof Copy || child instanceof CopyOf) return true; else if ((child instanceof If || child instanceof ForEach) && canProduceAttributeNodes(child, false)) { return true; } else if (child instanceof Choose) { Vector chooseContents = child.getContents(); int num = chooseContents.size(); for (int k = 0; k < num; k++) { SyntaxTreeNode chooseChild = (SyntaxTreeNode)chooseContents.elementAt(k); if (chooseChild instanceof When || chooseChild instanceof Otherwise) { if (canProduceAttributeNodes(chooseChild, false)) return true; } } } } return false; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LangCall.java0000644000175000017500000000560010721374033024472 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LangCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.FilterGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Morten Jorgensen */ final class LangCall extends FunctionCall { private Expression _lang; private Type _langType; /** * Get the parameters passed to function: * lang(string) */ public LangCall(QName fname, Vector arguments) { super(fname, arguments); _lang = argument(0); } /** * */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { _langType = _lang.typeCheck(stable); if (!(_langType instanceof StringType)) { _lang = new CastExpr(_lang, Type.String); } return Type.Boolean; } /** * */ public Type getType() { return(Type.Boolean); } /** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS, "testLanguage", "("+STRING_SIG+DOM_INTF_SIG+"I)Z"); _lang.translate(classGen,methodGen); il.append(methodGen.loadDOM()); if (classGen instanceof FilterGenerator) il.append(new ILOAD(1)); else il.append(methodGen.loadContextNode()); il.append(new INVOKESTATIC(tst)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LocationPathPattern.java0000644000175000017500000000657510721374033026754 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LocationPathPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xml.dtm.Axis; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public abstract class LocationPathPattern extends Pattern { private Template _template; private int _importPrecedence; private double _priority = Double.NaN; private int _position = 0; public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; // TODO } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { // TODO: What does it mean to translate a Pattern ? } public void setTemplate(final Template template) { _template = template; _priority = template.getPriority(); _importPrecedence = template.getImportPrecedence(); _position = template.getPosition(); } public Template getTemplate() { return _template; } public final double getPriority() { return Double.isNaN(_priority) ? getDefaultPriority() : _priority; } public double getDefaultPriority() { return 0.5; } /** * This method is used by the Mode class to prioritise patterns and * template. This method is called for templates that are in the same * mode and that match on the same core pattern. The rules used are: * o) first check precedence - highest precedence wins * o) then check priority - highest priority wins * o) then check the position - the template that occured last wins */ public boolean noSmallerThan(LocationPathPattern other) { if (_importPrecedence > other._importPrecedence) { return true; } else if (_importPrecedence == other._importPrecedence) { if (_priority > other._priority) { return true; } else if (_priority == other._priority) { if (_position > other._position) { return true; } } } return false; } public abstract StepPattern getKernelPattern(); public abstract void reduceKernelPattern(); public abstract boolean isWildcard(); public int getAxis() { final StepPattern sp = getKernelPattern(); return (sp != null) ? sp.getAxis() : Axis.CHILD; } public String toString() { return "root()"; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ProcessingInstruction.java0000644000175000017500000001317010721374030027371 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessingInstruction.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ProcessingInstruction extends Instruction { private AttributeValue _name; // name treated as AVT (7.1.3) private boolean _isLiteral = false; // specified name is not AVT public void parseContents(Parser parser) { final String name = getAttribute("name"); if (name.length() > 0) { _isLiteral = Util.isLiteral(name); if (_isLiteral) { if (!XML11Char.isXML11ValidNCName(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_NCNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } } _name = AttributeValue.create(this, name, parser); } else reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name"); if (name.equals("xml")) { reportError(this, parser, ErrorMsg.ILLEGAL_PI_ERR, "xml"); } parseChildren(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { _name.typeCheck(stable); typeCheckContents(stable); return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (!_isLiteral) { // if the ncname is an AVT, then the ncname has to be checked at runtime if it is a valid ncname LocalVariableGen nameValue = methodGen.addLocalVariable2("nameValue", Util.getJCRefType(STRING_SIG), null); // store the name into a variable first so _name.translate only needs to be called once _name.translate(classGen, methodGen); nameValue.setStart(il.append(new ASTORE(nameValue.getIndex()))); il.append(new ALOAD(nameValue.getIndex())); // call checkNCName if the name is an AVT final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkNCName", "(" +STRING_SIG +")V"); il.append(new INVOKESTATIC(check)); // Save the current handler base on the stack il.append(methodGen.loadHandler()); il.append(DUP); // first arg to "attributes" call // load name value again nameValue.setEnd(il.append(new ALOAD(nameValue.getIndex()))); } else { // Save the current handler base on the stack il.append(methodGen.loadHandler()); il.append(DUP); // first arg to "attributes" call // Push attribute name _name.translate(classGen, methodGen);// 2nd arg } il.append(classGen.loadTranslet()); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, "stringValueHandler", STRING_VALUE_HANDLER_SIG))); il.append(DUP); il.append(methodGen.storeHandler()); // translate contents with substituted handler translateContents(classGen, methodGen); // get String out of the handler il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_VALUE_HANDLER, "getValueOfPI", "()" + STRING_SIG))); // call "processingInstruction" final int processingInstruction = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "processingInstruction", "(" + STRING_SIG + STRING_SIG + ")V"); il.append(new INVOKEINTERFACE(processingInstruction, 3)); // Restore old handler base from stack il.append(methodGen.storeHandler()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Instruction.java0000644000175000017500000000344510721374033025343 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Instruction.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ abstract class Instruction extends SyntaxTreeNode { /** * Type check all the children of this node. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return typeCheckContents(stable); } /** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ElementAvailableCall.java0000644000175000017500000000630710721374031027006 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ElementAvailableCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ElementAvailableCall extends FunctionCall { public ElementAvailableCall(QName fname, Vector arguments) { super(fname, arguments); } /** * Force the argument to this function to be a literal string. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (argument() instanceof LiteralExpr) { return _type = Type.Boolean; } ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR, "element-available", this); throw new TypeCheckError(err); } /** * Returns an object representing the compile-time evaluation * of an expression. We are only using this for function-available * and element-available at this time. */ public Object evaluateAtCompileTime() { return getResult() ? Boolean.TRUE : Boolean.FALSE; } /** * Returns the result that this function will return */ public boolean getResult() { try { final LiteralExpr arg = (LiteralExpr) argument(); final String qname = arg.getValue(); final int index = qname.indexOf(':'); final String localName = (index > 0) ? qname.substring(index + 1) : qname; return getParser().elementSupported(arg.getNamespace(), localName); } catch (ClassCastException e) { return false; } } /** * Calls to 'element-available' are resolved at compile time since * the namespaces declared in the stylsheet are not available at run * time. Consequently, arguments to this function must be literals. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final boolean result = getResult(); methodGen.getInstructionList().append(new PUSH(cpg, result)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/IdPattern.java0000644000175000017500000000215310721374031024705 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IdPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class IdPattern extends IdKeyPattern { public IdPattern(String id) { super("##id",id); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Step.java0000644000175000017500000004354410721374032023740 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Step.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ICONST; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Step extends RelativeLocationPath { /** * This step's axis as defined in class Axis. */ private int _axis; /** * A vector of predicates (filters) defined on this step - may be null */ private Vector _predicates; /** * Some simple predicates can be handled by this class (and not by the * Predicate class) and will be removed from the above vector as they are * handled. We use this boolean to remember if we did have any predicates. */ private boolean _hadPredicates = false; /** * Type of the node test. */ private int _nodeType; public Step(int axis, int nodeType, Vector predicates) { _axis = axis; _nodeType = nodeType; _predicates = predicates; } /** * Set the parser for this element and all child predicates */ public void setParser(Parser parser) { super.setParser(parser); if (_predicates != null) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Predicate exp = (Predicate)_predicates.elementAt(i); exp.setParser(parser); exp.setParent(this); } } } /** * Define the axis (defined in Axis class) for this step */ public int getAxis() { return _axis; } /** * Get the axis (defined in Axis class) for this step */ public void setAxis(int axis) { _axis = axis; } /** * Returns the node-type for this step */ public int getNodeType() { return _nodeType; } /** * Returns the vector containing all predicates for this step. */ public Vector getPredicates() { return _predicates; } /** * Returns the vector containing all predicates for this step. */ public void addPredicates(Vector predicates) { if (_predicates == null) { _predicates = predicates; } else { _predicates.addAll(predicates); } } /** * Returns 'true' if this step has a parent pattern. * This method will return 'false' if this step occurs on its own under * an element like or . */ private boolean hasParentPattern() { final SyntaxTreeNode parent = getParent(); return (parent instanceof ParentPattern || parent instanceof ParentLocationPath || parent instanceof UnionPathExpr || parent instanceof FilterParentPath); } /** * Returns 'true' if this step has any predicates */ private boolean hasPredicates() { return _predicates != null && _predicates.size() > 0; } /** * Returns 'true' if this step is used within a predicate */ private boolean isPredicate() { SyntaxTreeNode parent = this; while (parent != null) { parent = parent.getParent(); if (parent instanceof Predicate) return true; } return false; } /** * True if this step is the abbreviated step '.' */ public boolean isAbbreviatedDot() { return _nodeType == NodeTest.ANODE && _axis == Axis.SELF; } /** * True if this step is the abbreviated step '..' */ public boolean isAbbreviatedDDot() { return _nodeType == NodeTest.ANODE && _axis == Axis.PARENT; } /** * Type check this step. The abbreviated steps '.' and '@attr' are * assigned type node if they have no predicates. All other steps * have type node-set. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Save this value for later - important for testing for special // combinations of steps and patterns than can be optimised _hadPredicates = hasPredicates(); // Special case for '.' // in the case where '.' has a context such as book/. // or .[false()] we can not optimize the nodeset to a single node. if (isAbbreviatedDot()) { _type = (hasParentPattern() || hasPredicates() ) ? Type.NodeSet : Type.Node; } else { _type = Type.NodeSet; } // Type check all predicates (expressions applied to the step) if (_predicates != null) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Expression pred = (Expression)_predicates.elementAt(i); pred.typeCheck(stable); } } // Return either Type.Node or Type.NodeSet return _type; } /** * Translate a step by pushing the appropriate iterator onto the stack. * The abbreviated steps '.' and '@attr' do not create new iterators * if they are not part of a LocationPath and have no filters. * In these cases a node index instead of an iterator is pushed * onto the stack. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (hasPredicates()) { translatePredicates(classGen, methodGen); } else { int star = 0; String name = null; final XSLTC xsltc = getParser().getXSLTC(); if (_nodeType >= DTM.NTYPES) { final Vector ni = xsltc.getNamesIndex(); name = (String)ni.elementAt(_nodeType-DTM.NTYPES); star = name.lastIndexOf('*'); } // If it is an attribute, but not '@*', '@pre:*' or '@node()', // and has no parent if (_axis == Axis.ATTRIBUTE && _nodeType != NodeTest.ATTRIBUTE && _nodeType != NodeTest.ANODE && !hasParentPattern() && star == 0) { int iter = cpg.addInterfaceMethodref(DOM_INTF, "getTypedAxisIterator", "(II)"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, Axis.ATTRIBUTE)); il.append(new PUSH(cpg, _nodeType)); il.append(new INVOKEINTERFACE(iter, 3)); return; } SyntaxTreeNode parent = getParent(); // Special case for '.' if (isAbbreviatedDot()) { if (_type == Type.Node) { // Put context node on stack if using Type.Node il.append(methodGen.loadContextNode()); } else { if (parent instanceof ParentLocationPath){ // Wrap the context node in a singleton iterator if not. int init = cpg.addMethodref(SINGLETON_ITERATOR, "", "("+NODE_SIG+")V"); il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR))); il.append(DUP); il.append(methodGen.loadContextNode()); il.append(new INVOKESPECIAL(init)); } else { // DOM.getAxisIterator(int axis); int git = cpg.addInterfaceMethodref(DOM_INTF, "getAxisIterator", "(I)"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, _axis)); il.append(new INVOKEINTERFACE(git, 2)); } } return; } // Special case for /foo/*/bar if ((parent instanceof ParentLocationPath) && (parent.getParent() instanceof ParentLocationPath)) { if ((_nodeType == NodeTest.ELEMENT) && (!_hadPredicates)) { _nodeType = NodeTest.ANODE; } } // "ELEMENT" or "*" or "@*" or ".." or "@attr" with a parent. switch (_nodeType) { case NodeTest.ATTRIBUTE: _axis = Axis.ATTRIBUTE; case NodeTest.ANODE: // DOM.getAxisIterator(int axis); int git = cpg.addInterfaceMethodref(DOM_INTF, "getAxisIterator", "(I)"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, _axis)); il.append(new INVOKEINTERFACE(git, 2)); break; default: if (star > 1) { final String namespace; if (_axis == Axis.ATTRIBUTE) namespace = name.substring(0,star-2); else namespace = name.substring(0,star-1); final int nsType = xsltc.registerNamespace(namespace); final int ns = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceAxisIterator", "(II)"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, _axis)); il.append(new PUSH(cpg, nsType)); il.append(new INVOKEINTERFACE(ns, 3)); break; } case NodeTest.ELEMENT: // DOM.getTypedAxisIterator(int axis, int type); final int ty = cpg.addInterfaceMethodref(DOM_INTF, "getTypedAxisIterator", "(II)"+NODE_ITERATOR_SIG); // Get the typed iterator we're after il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, _axis)); il.append(new PUSH(cpg, _nodeType)); il.append(new INVOKEINTERFACE(ty, 3)); break; } } } /** * Translate a sequence of predicates. Each predicate is translated * by constructing an instance of CurrentNodeListIterator * which is initialized from another iterator (recursive call), * a filter and a closure (call to translate on the predicate) and "this". */ public void translatePredicates(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int idx = 0; if (_predicates.size() == 0) { translate(classGen, methodGen); } else { final Predicate predicate = (Predicate)_predicates.lastElement(); _predicates.remove(predicate); // Special case for predicates that can use the NodeValueIterator // instead of an auxiliary class. Certain path/predicates pairs // are translated into a base path, on top of which we place a // node value iterator that tests for the desired value: // foo[@attr = 'str'] -> foo/@attr + test(value='str') // foo[bar = 'str'] -> foo/bar + test(value='str') // foo/bar[. = 'str'] -> foo/bar + test(value='str') if (predicate.isNodeValueTest()) { Step step = predicate.getStep(); il.append(methodGen.loadDOM()); // If the predicate's Step is simply '.' we translate this Step // and place the node test on top of the resulting iterator if (step.isAbbreviatedDot()) { translate(classGen, methodGen); il.append(new ICONST(DOM.RETURN_CURRENT)); } // Otherwise we create a parent location path with this Step and // the predicates Step, and place the node test on top of that else { ParentLocationPath path = new ParentLocationPath(this,step); try { path.typeCheck(getParser().getSymbolTable()); } catch (TypeCheckError e) { } path.translate(classGen, methodGen); il.append(new ICONST(DOM.RETURN_PARENT)); } predicate.translate(classGen, methodGen); idx = cpg.addInterfaceMethodref(DOM_INTF, GET_NODE_VALUE_ITERATOR, GET_NODE_VALUE_ITERATOR_SIG); il.append(new INVOKEINTERFACE(idx, 5)); } // Handle '//*[n]' expression else if (predicate.isNthDescendant()) { il.append(methodGen.loadDOM()); // il.append(new ICONST(NodeTest.ELEMENT)); il.append(new ICONST(predicate.getPosType())); predicate.translate(classGen, methodGen); il.append(new ICONST(0)); idx = cpg.addInterfaceMethodref(DOM_INTF, "getNthDescendant", "(IIZ)"+NODE_ITERATOR_SIG); il.append(new INVOKEINTERFACE(idx, 4)); } // Handle 'elem[n]' expression else if (predicate.isNthPositionFilter()) { idx = cpg.addMethodref(NTH_ITERATOR_CLASS, "", "("+NODE_ITERATOR_SIG+"I)V"); // Backwards branches are prohibited if an uninitialized object // is on the stack by section 4.9.4 of the JVM Specification, // 2nd Ed. We don't know whether this code might contain // backwards branches, so we mustn't create the new object until // after we've created the suspect arguments to its constructor. // Instead we calculate the values of the arguments to the // constructor first, store them in temporary variables, create // the object and reload the arguments from the temporaries to // avoid the problem. translatePredicates(classGen, methodGen); // recursive call LocalVariableGen iteratorTemp = methodGen.addLocalVariable("step_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); iteratorTemp.setStart( il.append(new ASTORE(iteratorTemp.getIndex()))); predicate.translate(classGen, methodGen); LocalVariableGen predicateValueTemp = methodGen.addLocalVariable("step_tmp2", Util.getJCRefType("I"), null, null); predicateValueTemp.setStart( il.append(new ISTORE(predicateValueTemp.getIndex()))); il.append(new NEW(cpg.addClass(NTH_ITERATOR_CLASS))); il.append(DUP); iteratorTemp.setEnd( il.append(new ALOAD(iteratorTemp.getIndex()))); predicateValueTemp.setEnd( il.append(new ILOAD(predicateValueTemp.getIndex()))); il.append(new INVOKESPECIAL(idx)); } else { idx = cpg.addMethodref(CURRENT_NODE_LIST_ITERATOR, "", "(" + NODE_ITERATOR_SIG + CURRENT_NODE_LIST_FILTER_SIG + NODE_SIG + TRANSLET_SIG + ")V"); // Backwards branches are prohibited if an uninitialized object // is on the stack by section 4.9.4 of the JVM Specification, // 2nd Ed. We don't know whether this code might contain // backwards branches, so we mustn't create the new object until // after we've created the suspect arguments to its constructor. // Instead we calculate the values of the arguments to the // constructor first, store them in temporary variables, create // the object and reload the arguments from the temporaries to // avoid the problem. translatePredicates(classGen, methodGen); // recursive call LocalVariableGen iteratorTemp = methodGen.addLocalVariable("step_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); iteratorTemp.setStart( il.append(new ASTORE(iteratorTemp.getIndex()))); predicate.translateFilter(classGen, methodGen); LocalVariableGen filterTemp = methodGen.addLocalVariable("step_tmp2", Util.getJCRefType(CURRENT_NODE_LIST_FILTER_SIG), null, null); filterTemp.setStart( il.append(new ASTORE(filterTemp.getIndex()))); // create new CurrentNodeListIterator il.append(new NEW(cpg.addClass(CURRENT_NODE_LIST_ITERATOR))); il.append(DUP); iteratorTemp.setEnd( il.append(new ALOAD(iteratorTemp.getIndex()))); filterTemp.setEnd(il.append(new ALOAD(filterTemp.getIndex()))); il.append(methodGen.loadCurrentNode()); il.append(classGen.loadTranslet()); if (classGen.isExternal()) { final String className = classGen.getClassName(); il.append(new CHECKCAST(cpg.addClass(className))); } il.append(new INVOKESPECIAL(idx)); } } } /** * Returns a string representation of this step. */ public String toString() { final StringBuffer buffer = new StringBuffer("step(\""); buffer.append(Axis.getNames(_axis)).append("\", ").append(_nodeType); if (_predicates != null) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Predicate pred = (Predicate)_predicates.elementAt(i); buffer.append(", ").append(pred.toString()); } } return buffer.append(')').toString(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/StartsWithCall.java0000644000175000017500000000613310721374032025726 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StartsWithCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class StartsWithCall extends FunctionCall { private Expression _base = null; private Expression _token = null; /** * Create a starts-with() call - two arguments, both strings */ public StartsWithCall(QName fname, Vector arguments) { super(fname, arguments); } /** * Type check the two parameters for this function */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Check that the function was passed exactly two arguments if (argumentCount() != 2) { ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, getName(), this); throw new TypeCheckError(err); } // The first argument must be a String, or cast to a String _base = argument(0); Type baseType = _base.typeCheck(stable); if (baseType != Type.String) _base = new CastExpr(_base, Type.String); // The second argument must also be a String, or cast to a String _token = argument(1); Type tokenType = _token.typeCheck(stable); if (tokenType != Type.String) _token = new CastExpr(_token, Type.String); return _type = Type.Boolean; } /** * Compile the expression - leave boolean expression on stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _base.translate(classGen, methodGen); _token.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "startsWith", "("+STRING_SIG+")Z"))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/xpath.lex0000644000175000017500000003213010721374030024003 0ustar mkochmkoch/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: xpath.lex 351910 2005-12-03 10:55:53Z zongaro $ */ /* * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * */ package org.apache.xalan.xsltc.compiler; import java_cup.runtime.Symbol; %% %cup %unicode %class XPathLexer %yyeof %{ int last; void initialize() { last = -1; } static boolean isWhitespace(int c) { return (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f'); } /** * If symbol is not followed by '::' or '(', then treat it as a * name instead of an axis or function (Jira-1912). */ Symbol disambiguateAxisOrFunction(int ss) throws Exception { // Peek in the input buffer without changing the internal state int index = yy_buffer_index; // Skip whitespace while (index < yy_buffer_read && isWhitespace(yy_buffer[index])) { index++; } // If end of buffer, can't disambiguate :( if (index >= yy_buffer_read) { // Can't disambiguate, so return as symbol return new Symbol(ss); } // Return symbol if next token is '::' or '(' return (yy_buffer[index] == ':' && yy_buffer[index+1] == ':' || yy_buffer[index] == '(') ? newSymbol(ss) : newSymbol(sym.QNAME, yytext()); } /** * If symbol is first token or if it follows any of the operators * listed in http://www.w3.org/TR/xpath#exprlex then treat as a * name instead of a keyword (Jira-1912). */ Symbol disambiguateOperator(int ss) throws Exception { switch (last) { case -1: // first token case sym.ATSIGN: case sym.DCOLON: case sym.LPAREN: case sym.LBRACK: case sym.COMMA: case sym.AND: case sym.OR: case sym.MOD: case sym.DIV: case sym.MULT: case sym.SLASH: case sym.DSLASH: case sym.VBAR: case sym.PLUS: case sym.MINUS: case sym.EQ: case sym.NE: case sym.LT: case sym.LE: case sym.GT: case sym.GE: return newSymbol(sym.QNAME, yytext()); } return newSymbol(ss); } /** * If symbol is first token or if it follows any of the operators * listed in http://www.w3.org/TR/xpath#exprlex then treat as a * wildcard instead of a multiplication operator */ Symbol disambiguateStar() throws Exception { switch (last) { case -1: // first token case sym.ATSIGN: case sym.DCOLON: case sym.LPAREN: case sym.LBRACK: case sym.COMMA: case sym.AND: case sym.OR: case sym.MOD: case sym.DIV: case sym.MULT: case sym.SLASH: case sym.DSLASH: case sym.VBAR: case sym.PLUS: case sym.MINUS: case sym.EQ: case sym.NE: case sym.LT: case sym.LE: case sym.GT: case sym.GE: return newSymbol(sym.STAR); } return newSymbol(sym.MULT); } Symbol newSymbol(int ss) { last = ss; return new Symbol(ss); } Symbol newSymbol(int ss, String value) { last = ss; return new Symbol(ss, value); } Symbol newSymbol(int ss, Long value) { last = ss; return new Symbol(ss, value); } Symbol newSymbol(int ss, Double value) { last = ss; return new Symbol(ss, value); } %} %eofval{ return newSymbol(sym.EOF); %eofval} %yylexthrow{ Exception %yylexthrow} Letter={BaseChar}|{Ideographic} BaseChar=[\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3] Ideographic=[\u4E00-\u9FA5\u3007\u3021-\u3029] CombiningChar=[\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05A1\u05A3-\u05B9\u05BB-\u05BD\u05BF\u05C1-\u05C2\u05C4\u064B-\u0652\u0670\u06D6-\u06DC\u06DD-\u06DF\u06E0-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0901-\u0903\u093C\u093E-\u094C\u094D\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09BC\u09BE\u09BF\u09C0-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u0A02\u0A3C\u0A3E\u0A3F\u0A40-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A70-\u0A71\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0B01-\u0B03\u0B3C\u0B3E-\u0B43\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B82-\u0B83\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C82-\u0C83\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86-\u0F8B\u0F90-\u0F95\u0F97\u0F99-\u0FAD\u0FB1-\u0FB7\u0FB9\u20D0-\u20DC\u20E1\u302A-\u302F\u3099\u309A] Digit=[\u0030-\u0039\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE7-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29] Extender=[\u00B7\u02D0\u02D1\u0387\u0640\u0E46\u0EC6\u3005\u3031-\u3035\u309D-\u309E\u30FC-\u30FE] NCName=({Letter}|"_"|{NCNameStartChar})({NCNameChar})* NCNameChar={Letter}|{Digit}|"."|"-"|"_"|{CombiningChar}|{Extender}|{NCNameStartChar}| \u00B7 | [\u0300-\u036F] | [\u203F-\u2040] | [\u0130-\u0136] NCNameStartChar=[\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD] | \u005F |({HighSurrogate}{LowSurrogate}) HighSurrogate=[\uD800-\uDBFF] LowSurrogate=[\uDC00-\uDFFF] %% "*" { return disambiguateStar(); } "/" { return newSymbol(sym.SLASH); } "+" { return newSymbol(sym.PLUS); } "-" { return newSymbol(sym.MINUS); } "div" { return disambiguateOperator(sym.DIV); } "mod" { return disambiguateOperator(sym.MOD); } "::" { return newSymbol(sym.DCOLON); } "," { return newSymbol(sym.COMMA); } "@" { return newSymbol(sym.ATSIGN); } ".." { return newSymbol(sym.DDOT); } "|" { return newSymbol(sym.VBAR); } "$" { return newSymbol(sym.DOLLAR); } "//" { return newSymbol(sym.DSLASH); } "=" { return newSymbol(sym.EQ); } "!=" { return newSymbol(sym.NE); } "<" { return newSymbol(sym.LT); } ">" { return newSymbol(sym.GT); } "<=" { return newSymbol(sym.LE); } ">=" { return newSymbol(sym.GE); } "id" { return disambiguateAxisOrFunction(sym.ID); } "key" { return disambiguateAxisOrFunction(sym.KEY); } "text()" { return newSymbol(sym.TEXT); } "text"+[ \t\r\n\f]+"()" { return newSymbol(sym.TEXT); } "node()" { return newSymbol(sym.NODE); } "node"+[ \t\r\n\f]+"()" { return newSymbol(sym.NODE); } "comment()" { return newSymbol(sym.COMMENT); } "comment"+[ \t\r\n\f]+"()" { return newSymbol(sym.COMMENT); } "processing-instruction" { return disambiguateAxisOrFunction(sym.PIPARAM); } "processing-instruction()" { return newSymbol(sym.PI); } "processing-instruction"+[ \t\r\n\f]+"()" { return newSymbol(sym.PI); } "or" { return disambiguateOperator(sym.OR); } "and" { return disambiguateOperator(sym.AND); } "child" { return disambiguateAxisOrFunction(sym.CHILD); } "attribute" { return disambiguateAxisOrFunction(sym.ATTRIBUTE); } "ancestor" { return disambiguateAxisOrFunction(sym.ANCESTOR); } "ancestor-or-self" { return disambiguateAxisOrFunction(sym.ANCESTORORSELF); } "descendant" { return disambiguateAxisOrFunction(sym.DESCENDANT); } "descendant-or-self" { return disambiguateAxisOrFunction(sym.DESCENDANTORSELF); } "following" { return disambiguateAxisOrFunction(sym.FOLLOWING); } "following-sibling" { return disambiguateAxisOrFunction(sym.FOLLOWINGSIBLING); } "namespace" { return disambiguateAxisOrFunction(sym.NAMESPACE); } "parent" { return disambiguateAxisOrFunction(sym.PARENT); } "preceding" { return disambiguateAxisOrFunction(sym.PRECEDING); } "preceding-sibling" { return disambiguateAxisOrFunction(sym.PRECEDINGSIBLING); } "self" { return disambiguateAxisOrFunction(sym.SELF); } "[" { return newSymbol(sym.LBRACK); } "]" { return newSymbol(sym.RBRACK); } "(" { return newSymbol(sym.LPAREN); } ")" { return newSymbol(sym.RPAREN); } "" { initialize(); return new Symbol(sym.PATTERN); } "" { initialize(); return new Symbol(sym.EXPRESSION); } \"[^\"]*\" { return newSymbol(sym.Literal, yytext().substring(1, yytext().length() - 1)); } \'[^\']*\' { return newSymbol(sym.Literal, yytext().substring(1, yytext().length() - 1)); } {Digit}+ { return newSymbol(sym.INT, new Long(yytext())); } {Digit}+("."{Digit}*)? { return newSymbol(sym.REAL, new Double(yytext())); } "."{Digit}+ { return newSymbol(sym.REAL, new Double(yytext())); } "." { return newSymbol(sym.DOT); } ({NCName}":")?{NCName} { return newSymbol(sym.QNAME, yytext()); } ({NCName}":")?"*" { return newSymbol(sym.QNAME, yytext()); } ({NCName}":")?"@*" { return newSymbol(sym.QNAME, yytext()); } [ \t\r\n\f] { /* ignore white space. */ } . { throw new Exception(yytext()); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Text.java0000644000175000017500000002022510721374031023737 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Text.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETSTATIC; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Text extends Instruction { private String _text; private boolean _escaping = true; private boolean _ignore = false; private boolean _textElement = false; /** * Create a blank Text syntax tree node. */ public Text() { _textElement = true; } /** * Create text syntax tree node. * @param text is the text to put in the node. */ public Text(String text) { _text = text; } /** * Returns the text wrapped inside this node * @return The text wrapped inside this node */ protected String getText() { return _text; } /** * Set the text for this node. Appends the given text to any already * existing text (using string concatenation, so use only when needed). * @param text is the text to wrap inside this node. */ protected void setText(String text) { if (_text == null) _text = text; else _text = _text + text; } public void display(int indent) { indent(indent); Util.println("Text"); indent(indent + IndentIncrement); Util.println(_text); } public void parseContents(Parser parser) { final String str = getAttribute("disable-output-escaping"); if ((str != null) && (str.equals("yes"))) _escaping = false; parseChildren(parser); if (_text == null) { if (_textElement) { _text = EMPTYSTRING; } else { _ignore = true; } } else if (_textElement) { if (_text.length() == 0) _ignore = true; } else if (getParent() instanceof LiteralElement) { LiteralElement element = (LiteralElement)getParent(); String space = element.getAttribute("xml:space"); if ((space == null) || (!space.equals("preserve"))) { int i; final int textLength = _text.length(); for (i = 0; i < textLength; i++) { char c = _text.charAt(i); if (!isWhitespace(c)) break; } if (i == textLength) _ignore = true; } } else { int i; final int textLength = _text.length(); for (i = 0; i < textLength; i++) { char c = _text.charAt(i); if (!isWhitespace(c)) break; } if (i == textLength) _ignore = true; } } public void ignore() { _ignore = true; } public boolean isIgnore() { return _ignore; } public boolean isTextElement() { return _textElement; } protected boolean contextDependent() { return false; } private static boolean isWhitespace(char c) { return (c == 0x20 || c == 0x09 || c == 0x0A || c == 0x0D); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (!_ignore) { // Turn off character escaping if so is wanted. final int esc = cpg.addInterfaceMethodref(OUTPUT_HANDLER, "setEscaping", "(Z)Z"); if (!_escaping) { il.append(methodGen.loadHandler()); il.append(new PUSH(cpg, false)); il.append(new INVOKEINTERFACE(esc, 2)); } il.append(methodGen.loadHandler()); // Call characters(String) or characters(char[],int,int), as // appropriate. if (!canLoadAsArrayOffsetLength()) { final int characters = cpg.addInterfaceMethodref(OUTPUT_HANDLER, "characters", "("+STRING_SIG+")V"); il.append(new PUSH(cpg, _text)); il.append(new INVOKEINTERFACE(characters, 2)); } else { final int characters = cpg.addInterfaceMethodref(OUTPUT_HANDLER, "characters", "([CII)V"); loadAsArrayOffsetLength(classGen, methodGen); il.append(new INVOKEINTERFACE(characters, 4)); } // Restore character escaping setting to whatever it was. // Note: setEscaping(bool) returns the original (old) value if (!_escaping) { il.append(methodGen.loadHandler()); il.append(SWAP); il.append(new INVOKEINTERFACE(esc, 2)); il.append(POP); } } translateContents(classGen, methodGen); } /** * Check whether this Text node can be stored in a char[] in the translet. * Calling this is precondition to calling loadAsArrayOffsetLength. * @see #loadAsArrayOffsetLength(ClassGenerator,MethodGenerator) * @return true if this Text node can be */ public boolean canLoadAsArrayOffsetLength() { // Magic number! 21845*3 == 65535. BCEL uses a DataOutputStream to // serialize class files. The Java run-time places a limit on the size // of String data written using a DataOutputStream - it cannot require // more than 64KB when represented as UTF-8. The number of bytes // required to represent a Java string as UTF-8 cannot be greater // than three times the number of char's in the string, hence the // check for 21845. return (_text.length() <= 21845); } /** * Generates code that loads the array that will contain the character * data represented by this Text node, followed by the offset of the * data from the start of the array, and then the length of the data. * * The pre-condition to calling this method is that * canLoadAsArrayOffsetLength() returns true. * @see #canLoadArrayOffsetLength() */ public void loadAsArrayOffsetLength(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final XSLTC xsltc = classGen.getParser().getXSLTC(); // The XSLTC object keeps track of character data // that is to be stored in char arrays. final int offset = xsltc.addCharacterData(_text); final int length = _text.length(); String charDataFieldName = STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1); il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(), charDataFieldName, STATIC_CHAR_DATA_FIELD_SIG))); il.append(new PUSH(cpg, offset)); il.append(new PUSH(cpg, _text.length())); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CompilerException.java0000644000175000017500000000302210721374031026440 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CompilerException.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Morten Jorgensen */ public final class CompilerException extends Exception { static final long serialVersionUID = 1732939618562742663L; private String _msg; public CompilerException() { super(); } public CompilerException(Exception e) { super(e.toString()); _msg = e.toString(); } public CompilerException(String message) { super(message); _msg = message; } public String getMessage() { final int col = _msg.indexOf(':'); if (col > -1) return(_msg.substring(col)); else return(_msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/XslElement.java0000644000175000017500000002731410721374030025100 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XslElement.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETSTATIC; import org.apache.bcel.generic.ICONST; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class XslElement extends Instruction { private String _prefix; private boolean _ignore = false; private boolean _isLiteralName = true; private AttributeValueTemplate _name; private AttributeValueTemplate _namespace; /** * Displays the contents of the element */ public void display(int indent) { indent(indent); Util.println("Element " + _name); displayContents(indent + IndentIncrement); } /** * This method is now deprecated. The new implemation of this class * never declares the default NS. */ public boolean declaresDefaultNS() { return false; } public void parseContents(Parser parser) { final SymbolTable stable = parser.getSymbolTable(); // Handle the 'name' attribute String name = getAttribute("name"); if (name == EMPTYSTRING) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ELEM_NAME_ERR, name, this); parser.reportError(WARNING, msg); parseChildren(parser); _ignore = true; // Ignore the element if the QName is invalid return; } // Get namespace attribute String namespace = getAttribute("namespace"); // Optimize compilation when name is known at compile time _isLiteralName = Util.isLiteral(name); if (_isLiteralName) { if (!XML11Char.isXML11ValidQName(name)) { ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ELEM_NAME_ERR, name, this); parser.reportError(WARNING, msg); parseChildren(parser); _ignore = true; // Ignore the element if the QName is invalid return; } final QName qname = parser.getQNameSafe(name); String prefix = qname.getPrefix(); String local = qname.getLocalPart(); if (prefix == null) { prefix = EMPTYSTRING; } if (!hasAttribute("namespace")) { namespace = lookupNamespace(prefix); if (namespace == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.NAMESPACE_UNDEF_ERR, prefix, this); parser.reportError(WARNING, err); parseChildren(parser); _ignore = true; // Ignore the element if prefix is undeclared return; } _prefix = prefix; _namespace = new AttributeValueTemplate(namespace, parser, this); } else { if (prefix == EMPTYSTRING) { if (Util.isLiteral(namespace)) { prefix = lookupPrefix(namespace); if (prefix == null) { prefix = stable.generateNamespacePrefix(); } } // Prepend prefix to local name final StringBuffer newName = new StringBuffer(prefix); if (prefix != EMPTYSTRING) { newName.append(':'); } name = newName.append(local).toString(); } _prefix = prefix; _namespace = new AttributeValueTemplate(namespace, parser, this); } } else { // name attribute contains variable parts. If there is no namespace // attribute, the generated code needs to be prepared to look up // any prefix in the stylesheet at run-time. _namespace = (namespace == EMPTYSTRING) ? null : new AttributeValueTemplate(namespace, parser, this); } _name = new AttributeValueTemplate(name, parser, this); final String useSets = getAttribute("use-attribute-sets"); if (useSets.length() > 0) { if (!Util.isValidQNames(useSets)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, useSets, this); parser.reportError(Constants.ERROR, err); } setFirstElement(new UseAttributeSets(useSets, parser)); } parseChildren(parser); } /** * Run type check on element name & contents */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (!_ignore) { _name.typeCheck(stable); if (_namespace != null) { _namespace.typeCheck(stable); } } typeCheckContents(stable); return Type.Void; } /** * This method is called when the name of the element is known at compile time. * In this case, there is no need to inspect the element name at runtime to * determine if a prefix exists, needs to be generated, etc. */ public void translateLiteral(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (!_ignore) { il.append(methodGen.loadHandler()); _name.translate(classGen, methodGen); il.append(DUP2); il.append(methodGen.startElement()); if (_namespace != null) { il.append(methodGen.loadHandler()); il.append(new PUSH(cpg, _prefix)); _namespace.translate(classGen,methodGen); il.append(methodGen.namespace()); } } translateContents(classGen, methodGen); if (!_ignore) { il.append(methodGen.endElement()); } } /** * At runtime the compilation of xsl:element results in code that: (i) * evaluates the avt for the name, (ii) checks for a prefix in the name * (iii) generates a new prefix and create a new qname when necessary * (iv) calls startElement() on the handler (v) looks up a uri in the XML * when the prefix is not known at compile time (vi) calls namespace() * on the handler (vii) evaluates the contents (viii) calls endElement(). */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { LocalVariableGen local = null; final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Optimize translation if element name is a literal if (_isLiteralName) { translateLiteral(classGen, methodGen); return; } if (!_ignore) { // if the qname is an AVT, then the qname has to be checked at runtime if it is a valid qname LocalVariableGen nameValue = methodGen.addLocalVariable2("nameValue", Util.getJCRefType(STRING_SIG), null); // store the name into a variable first so _name.translate only needs to be called once _name.translate(classGen, methodGen); nameValue.setStart(il.append(new ASTORE(nameValue.getIndex()))); il.append(new ALOAD(nameValue.getIndex())); // call checkQName if the name is an AVT final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkQName", "(" +STRING_SIG +")V"); il.append(new INVOKESTATIC(check)); // Push handler for call to endElement() il.append(methodGen.loadHandler()); // load name value again nameValue.setEnd(il.append(new ALOAD(nameValue.getIndex()))); if (_namespace != null) { _namespace.translate(classGen, methodGen); } else { // If name is an AVT and namespace is not specified, need to // look up any prefix in the stylesheet by calling // BasisLibrary.lookupStylesheetQNameNamespace( // name, stylesheetNode, ancestorsArray, // prefixURIsIndexArray, prefixURIPairsArray, // !ignoreDefaultNamespace) String transletClassName = getXSLTC().getClassName(); il.append(DUP); il.append(new PUSH(cpg, getNodeIDForStylesheetNSLookup())); il.append(new GETSTATIC(cpg.addFieldref( transletClassName, STATIC_NS_ANCESTORS_ARRAY_FIELD, NS_ANCESTORS_INDEX_SIG))); il.append(new GETSTATIC(cpg.addFieldref( transletClassName, STATIC_PREFIX_URIS_IDX_ARRAY_FIELD, PREFIX_URIS_IDX_SIG))); il.append(new GETSTATIC(cpg.addFieldref( transletClassName, STATIC_PREFIX_URIS_ARRAY_FIELD, PREFIX_URIS_ARRAY_SIG))); // Default namespace is significant il.append(ICONST_0); il.append( new INVOKESTATIC( cpg.addMethodref(BASIS_LIBRARY_CLASS, LOOKUP_STYLESHEET_QNAME_NS_REF, LOOKUP_STYLESHEET_QNAME_NS_SIG))); } // Push additional arguments il.append(methodGen.loadHandler()); il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); // Invoke BasisLibrary.startXslElemCheckQName() il.append(new INVOKESTATIC( cpg.addMethodref(BASIS_LIBRARY_CLASS, "startXslElement", "(" + STRING_SIG + STRING_SIG + TRANSLET_OUTPUT_SIG + DOM_INTF_SIG + "I)" + STRING_SIG))); } translateContents(classGen, methodGen); if (!_ignore) { il.append(methodGen.endElement()); } } /** * Override this method to make sure that xsl:attributes are not * copied to output if this xsl:element is to be ignored */ public void translateContents(ClassGenerator classGen, MethodGenerator methodGen) { final int n = elementCount(); for (int i = 0; i < n; i++) { final SyntaxTreeNode item = (SyntaxTreeNode)getContents().elementAt(i); if (_ignore && item instanceof XslAttribute) continue; item.translate(classGen, methodGen); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AbsolutePathPattern.java0000644000175000017500000001116010721374032026743 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AbsolutePathPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO_W; import org.apache.bcel.generic.IF_ICMPEQ; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class AbsolutePathPattern extends LocationPathPattern { private final RelativePathPattern _left; // may be null public AbsolutePathPattern(RelativePathPattern left) { _left = left; if (left != null) { left.setParent(this); } } public void setParser(Parser parser) { super.setParser(parser); if (_left != null) _left.setParser(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return _left == null ? Type.Root : _left.typeCheck(stable); } public boolean isWildcard() { return false; } public StepPattern getKernelPattern() { return _left != null ? _left.getKernelPattern() : null; } public void reduceKernelPattern() { _left.reduceKernelPattern(); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_left != null) { if (_left instanceof StepPattern) { final LocalVariableGen local = // absolute path pattern temporary methodGen.addLocalVariable2("apptmp", Util.getJCRefType(NODE_SIG), null); il.append(DUP); local.setStart(il.append(new ISTORE(local.getIndex()))); _left.translate(classGen, methodGen); il.append(methodGen.loadDOM()); local.setEnd(il.append(new ILOAD(local.getIndex()))); methodGen.removeLocalVariable(local); } else { _left.translate(classGen, methodGen); } } final int getParent = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); final int getType = cpg.addInterfaceMethodref(DOM_INTF, "getExpandedTypeID", "(I)I"); InstructionHandle begin = il.append(methodGen.loadDOM()); il.append(SWAP); il.append(new INVOKEINTERFACE(getParent, 2)); if (_left instanceof AncestorPattern) { il.append(methodGen.loadDOM()); il.append(SWAP); } il.append(new INVOKEINTERFACE(getType, 2)); il.append(new PUSH(cpg, DTM.DOCUMENT_NODE)); final BranchHandle skip = il.append(new IF_ICMPEQ(null)); _falseList.add(il.append(new GOTO_W(null))); skip.setTarget(il.append(NOP)); if (_left != null) { _left.backPatchTrueList(begin); /* * If _left is an ancestor pattern, backpatch this pattern's false * list to the loop that searches for more ancestors. */ if (_left instanceof AncestorPattern) { final AncestorPattern ancestor = (AncestorPattern) _left; _falseList.backPatch(ancestor.getLoopHandle()); // clears list } _falseList.append(_left._falseList); } } public String toString() { return "absolutePathPattern(" + (_left != null ? _left.toString() : ")"); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/TransletOutput.java0000644000175000017500000001207210721374030026030 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransletOutput.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Morten Jorgensen */ final class TransletOutput extends Instruction { private Expression _filename; private boolean _append; /** * Displays the contents of this element. */ public void display(int indent) { indent(indent); Util.println("TransletOutput: " + _filename); } /** * Parse the contents of this element. The only attribute * we recognise is the 'file' attribute that contains teh output filename. */ public void parseContents(Parser parser) { // Get the output filename from the 'file' attribute String filename = getAttribute("file"); // If the 'append' attribute is set to "yes" or "true", // the output is appended to the file. String append = getAttribute("append"); // Verify that the filename is in fact set if ((filename == null) || (filename.equals(EMPTYSTRING))) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "file"); } // Save filename as an attribute value template _filename = AttributeValue.create(this, filename, parser); if (append != null && (append.toLowerCase().equals("yes") || append.toLowerCase().equals("true"))) { _append = true; } else _append = false; parseChildren(parser); } /** * Type checks the 'file' attribute (must be able to convert it to a str). */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type type = _filename.typeCheck(stable); if (type instanceof StringType == false) { _filename = new CastExpr(_filename, Type.String); } typeCheckContents(stable); return Type.Void; } /** * Compile code that opens the give file for output, dumps the contents of * the element to the file, then closes the file. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final boolean isSecureProcessing = classGen.getParser().getXSLTC() .isSecureProcessing(); if (isSecureProcessing) { int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unallowed_extension_elementF", "(Ljava/lang/String;)V"); il.append(new PUSH(cpg, "redirect")); il.append(new INVOKESTATIC(index)); return; } // Save the current output handler on the stack il.append(methodGen.loadHandler()); final int open = cpg.addMethodref(TRANSLET_CLASS, "openOutputHandler", "(" + STRING_SIG + "Z)" + TRANSLET_OUTPUT_SIG); final int close = cpg.addMethodref(TRANSLET_CLASS, "closeOutputHandler", "("+TRANSLET_OUTPUT_SIG+")V"); // Create the new output handler (leave it on stack) il.append(classGen.loadTranslet()); _filename.translate(classGen, methodGen); il.append(new PUSH(cpg, _append)); il.append(new INVOKEVIRTUAL(open)); // Overwrite current handler il.append(methodGen.storeHandler()); // Translate contents with substituted handler translateContents(classGen, methodGen); // Close the output handler (close file) il.append(classGen.loadTranslet()); il.append(methodGen.loadHandler()); il.append(new INVOKEVIRTUAL(close)); // Restore old output handler from stack il.append(methodGen.storeHandler()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CastCall.java0000644000175000017500000000672410721374031024511 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CastCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.ObjectType; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Santiago Pericas-Geertsen */ final class CastCall extends FunctionCall { /** * Name of the class that is the target of the cast. Must be a * fully-qualified Java class Name. */ private String _className; /** * A reference to the expression being casted. */ private Expression _right; /** * Constructor. */ public CastCall(QName fname, Vector arguments) { super(fname, arguments); } /** * Type check the two parameters for this function */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Check that the function was passed exactly two arguments if (argumentCount() != 2) { throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, getName(), this)); } // The first argument must be a literal String Expression exp = argument(0); if (exp instanceof LiteralExpr) { _className = ((LiteralExpr) exp).getValue(); _type = Type.newObjectType(_className); } else { throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR, getName(), this)); } // Second argument must be of type reference or object _right = argument(1); Type tright = _right.typeCheck(stable); if (tright != Type.Reference && tright instanceof ObjectType == false) { throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, tright, _type, this)); } return _type; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _right.translate(classGen, methodGen); il.append(new CHECKCAST(cpg.addClass(_className))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Output.java0000644000175000017500000003402110721374033024314 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Output.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.OutputStreamWriter; import java.util.Properties; import java.util.StringTokenizer; import javax.xml.transform.OutputKeys; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUTFIELD; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.serializer.Encodings; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Output extends TopLevelElement { // TODO: use three-value variables for boolean values: true/false/default // These attributes are extracted from the xsl:output element. They also // appear as fields (with the same type, only public) in the translet private String _version; private String _method; private String _encoding; private boolean _omitHeader = false; private String _standalone; private String _doctypePublic; private String _doctypeSystem; private String _cdata; private boolean _indent = false; private String _mediaType; private String _indentamount; // Disables this output element (when other element has higher precedence) private boolean _disabled = false; // Some global constants private final static String STRING_SIG = "Ljava/lang/String;"; private final static String XML_VERSION = "1.0"; private final static String HTML_VERSION = "4.0"; /** * Displays the contents of this element (for debugging) */ public void display(int indent) { indent(indent); Util.println("Output " + _method); } /** * Disables this element in case where there are some other * element (from a different imported/included stylesheet) * with higher precedence. */ public void disable() { _disabled = true; } public boolean enabled() { return !_disabled; } public String getCdata() { return _cdata; } public String getOutputMethod() { return _method; } private void transferAttribute(Output previous, String qname) { if (!hasAttribute(qname) && previous.hasAttribute(qname)) { addAttribute(qname, previous.getAttribute(qname)); } } public void mergeOutput(Output previous) { // Transfer attributes from previous xsl:output transferAttribute(previous, "version"); transferAttribute(previous, "method"); transferAttribute(previous, "encoding"); transferAttribute(previous, "doctype-system"); transferAttribute(previous, "doctype-public"); transferAttribute(previous, "media-type"); transferAttribute(previous, "indent"); transferAttribute(previous, "omit-xml-declaration"); transferAttribute(previous, "standalone"); // Merge cdata-section-elements if (previous.hasAttribute("cdata-section-elements")) { // addAttribute works as a setter if it already exists addAttribute("cdata-section-elements", previous.getAttribute("cdata-section-elements") + ' ' + getAttribute("cdata-section-elements")); } // Transfer non-standard attributes as well String prefix = lookupPrefix("http://xml.apache.org/xalan"); if (prefix != null) { transferAttribute(previous, prefix + ':' + "indent-amount"); } prefix = lookupPrefix("http://xml.apache.org/xslt"); if (prefix != null) { transferAttribute(previous, prefix + ':' + "indent-amount"); } } /** * Scans the attribute list for the xsl:output instruction */ public void parseContents(Parser parser) { final Properties outputProperties = new Properties(); // Ask the parser if it wants this element parser.setOutput(this); // Do nothing if other element has higher precedence if (_disabled) return; String attrib = null; // Get the output version _version = getAttribute("version"); if (_version.equals(Constants.EMPTYSTRING)) { _version = null; } else { outputProperties.setProperty(OutputKeys.VERSION, _version); } // Get the output method - "xml", "html", "text" or (but not ncname) _method = getAttribute("method"); if (_method.equals(Constants.EMPTYSTRING)) { _method = null; } if (_method != null) { _method = _method.toLowerCase(); if ((_method.equals("xml"))|| (_method.equals("html"))|| (_method.equals("text"))|| ((XML11Char.isXML11ValidQName(_method)&&(_method.indexOf(":") > 0)))) { outputProperties.setProperty(OutputKeys.METHOD, _method); } else { reportError(this, parser, ErrorMsg.INVALID_METHOD_IN_OUTPUT, _method); } } // Get the output encoding - any value accepted here _encoding = getAttribute("encoding"); if (_encoding.equals(Constants.EMPTYSTRING)) { _encoding = null; } else { try { // Create a write to verify encoding support String canonicalEncoding; canonicalEncoding = Encodings.convertMime2JavaEncoding(_encoding); OutputStreamWriter writer = new OutputStreamWriter(System.out, canonicalEncoding); } catch (java.io.UnsupportedEncodingException e) { ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_ENCODING, _encoding, this); parser.reportError(Constants.WARNING, msg); } outputProperties.setProperty(OutputKeys.ENCODING, _encoding); } // Should the XML header be omitted - translate to true/false attrib = getAttribute("omit-xml-declaration"); if (!attrib.equals(Constants.EMPTYSTRING)) { if (attrib.equals("yes")) { _omitHeader = true; } outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, attrib); } // Add 'standalone' decaration to output - use text as is _standalone = getAttribute("standalone"); if (_standalone.equals(Constants.EMPTYSTRING)) { _standalone = null; } else { outputProperties.setProperty(OutputKeys.STANDALONE, _standalone); } // Get system/public identifiers for output DOCTYPE declaration _doctypeSystem = getAttribute("doctype-system"); if (_doctypeSystem.equals(Constants.EMPTYSTRING)) { _doctypeSystem = null; } else { outputProperties.setProperty(OutputKeys.DOCTYPE_SYSTEM, _doctypeSystem); } _doctypePublic = getAttribute("doctype-public"); if (_doctypePublic.equals(Constants.EMPTYSTRING)) { _doctypePublic = null; } else { outputProperties.setProperty(OutputKeys.DOCTYPE_PUBLIC, _doctypePublic); } // Names the elements of whose text contents should be output as CDATA _cdata = getAttribute("cdata-section-elements"); if (_cdata.equals(Constants.EMPTYSTRING)) { _cdata = null; } else { StringBuffer expandedNames = new StringBuffer(); StringTokenizer tokens = new StringTokenizer(_cdata); // Make sure to store names in expanded form while (tokens.hasMoreTokens()) { String qname = tokens.nextToken(); if (!XML11Char.isXML11ValidQName(qname)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, qname, this); parser.reportError(Constants.ERROR, err); } expandedNames.append( parser.getQName(qname).toString()).append(' '); } _cdata = expandedNames.toString(); outputProperties.setProperty(OutputKeys.CDATA_SECTION_ELEMENTS, _cdata); } // Get the indent setting - only has effect for xml and html output attrib = getAttribute("indent"); if (!attrib.equals(EMPTYSTRING)) { if (attrib.equals("yes")) { _indent = true; } outputProperties.setProperty(OutputKeys.INDENT, attrib); } else if (_method != null && _method.equals("html")) { _indent = true; } // indent-amount: extension attribute of xsl:output _indentamount = getAttribute( lookupPrefix("http://xml.apache.org/xalan"), "indent-amount"); // Hack for supporting Old Namespace URI. if (_indentamount.equals(EMPTYSTRING)){ _indentamount = getAttribute( lookupPrefix("http://xml.apache.org/xslt"), "indent-amount"); } if (!_indentamount.equals(EMPTYSTRING)) { outputProperties.setProperty("indent_amount", _indentamount); } // Get the MIME type for the output file _mediaType = getAttribute("media-type"); if (_mediaType.equals(Constants.EMPTYSTRING)) { _mediaType = null; } else { outputProperties.setProperty(OutputKeys.MEDIA_TYPE, _mediaType); } // Implied properties if (_method != null) { if (_method.equals("html")) { if (_version == null) { _version = HTML_VERSION; } if (_mediaType == null) { _mediaType = "text/html"; } } else if (_method.equals("text")) { if (_mediaType == null) { _mediaType = "text/plain"; } } } // Set output properties in current stylesheet parser.getCurrentStylesheet().setOutputProperties(outputProperties); } /** * Compile code that passes the information in this element * to the appropriate fields in the translet */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { // Do nothing if other element has higher precedence if (_disabled) return; ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); int field = 0; il.append(classGen.loadTranslet()); // Only update _version field if set and different from default if ((_version != null) && (!_version.equals(XML_VERSION))) { field = cpg.addFieldref(TRANSLET_CLASS, "_version", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _version)); il.append(new PUTFIELD(field)); } // Only update _method field if "method" attribute used if (_method != null) { field = cpg.addFieldref(TRANSLET_CLASS, "_method", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _method)); il.append(new PUTFIELD(field)); } // Only update if _encoding field is "encoding" attribute used if (_encoding != null) { field = cpg.addFieldref(TRANSLET_CLASS, "_encoding", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _encoding)); il.append(new PUTFIELD(field)); } // Only update if "omit-xml-declaration" used and set to 'yes' if (_omitHeader) { field = cpg.addFieldref(TRANSLET_CLASS, "_omitHeader", "Z"); il.append(DUP); il.append(new PUSH(cpg, _omitHeader)); il.append(new PUTFIELD(field)); } // Add 'standalone' decaration to output - use text as is if (_standalone != null) { field = cpg.addFieldref(TRANSLET_CLASS, "_standalone", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _standalone)); il.append(new PUTFIELD(field)); } // Set system/public doctype only if both are set field = cpg.addFieldref(TRANSLET_CLASS,"_doctypeSystem",STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _doctypeSystem)); il.append(new PUTFIELD(field)); field = cpg.addFieldref(TRANSLET_CLASS,"_doctypePublic",STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _doctypePublic)); il.append(new PUTFIELD(field)); // Add 'medye-type' decaration to output - if used if (_mediaType != null) { field = cpg.addFieldref(TRANSLET_CLASS, "_mediaType", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _mediaType)); il.append(new PUTFIELD(field)); } // Compile code to set output indentation on/off if (_indent) { field = cpg.addFieldref(TRANSLET_CLASS, "_indent", "Z"); il.append(DUP); il.append(new PUSH(cpg, _indent)); il.append(new PUTFIELD(field)); } //Compile code to set indent amount. if(_indentamount != null && !_indentamount.equals(EMPTYSTRING)){ field = cpg.addFieldref(TRANSLET_CLASS, "_indentamount", "I"); il.append(DUP); il.append(new PUSH(cpg, Integer.parseInt(_indentamount))); il.append(new PUTFIELD(field)); } // Forward to the translet any elements that should be output as CDATA if (_cdata != null) { int index = cpg.addMethodref(TRANSLET_CLASS, "addCdataElement", "(Ljava/lang/String;)V"); StringTokenizer tokens = new StringTokenizer(_cdata); while (tokens.hasMoreTokens()) { il.append(DUP); il.append(new PUSH(cpg, tokens.nextToken())); il.append(new INVOKEVIRTUAL(index)); } } il.append(POP); // Cleanup - pop last translet reference off stack } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LiteralAttribute.java0000644000175000017500000001225210721374032026275 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LiteralAttribute.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.serializer.ElemDesc; import org.apache.xml.serializer.SerializationHandler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class LiteralAttribute extends Instruction { private final String _name; // Attribute name (incl. prefix) private final AttributeValue _value; // Attribute value /** * Creates a new literal attribute (but does not insert it into the AST). * @param name the attribute name (incl. prefix) as a String. * @param value the attribute value. * @param parser the XSLT parser (wraps XPath parser). */ public LiteralAttribute(String name, String value, Parser parser, SyntaxTreeNode parent) { _name = name; setParent(parent); _value = AttributeValue.create(this, value, parser); } public void display(int indent) { indent(indent); Util.println("LiteralAttribute name=" + _name + " value=" + _value); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { _value.typeCheck(stable); typeCheckContents(stable); return Type.Void; } protected boolean contextDependent() { return _value.contextDependent(); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // push handler il.append(methodGen.loadHandler()); // push attribute name - namespace prefix set by parent node il.append(new PUSH(cpg, _name)); // push attribute value _value.translate(classGen, methodGen); // Generate code that calls SerializationHandler.addUniqueAttribute() // if all attributes are unique. SyntaxTreeNode parent = getParent(); if (parent instanceof LiteralElement && ((LiteralElement)parent).allAttributesUnique()) { int flags = 0; boolean isHTMLAttrEmpty = false; ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc(); // Set the HTML flags if (elemDesc != null) { if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) { flags = flags | SerializationHandler.HTML_ATTREMPTY; isHTMLAttrEmpty = true; } else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) { flags = flags | SerializationHandler.HTML_ATTRURL; } } if (_value instanceof SimpleAttributeValue) { String attrValue = ((SimpleAttributeValue)_value).toString(); if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) { flags = flags | SerializationHandler.NO_BAD_CHARS; } } il.append(new PUSH(cpg, flags)); il.append(methodGen.uniqueAttribute()); } else { // call attribute il.append(methodGen.attribute()); } } /** * Return true if at least one character in the String is considered to * be a "bad" character. A bad character is one whose code is: * less than 32 (a space), * or greater than 126, * or it is one of '<', '>', '&' or '\"'. * This helps the serializer to decide whether the String needs to be escaped. */ private boolean hasBadChars(String value) { char[] chars = value.toCharArray(); int size = chars.length; for (int i = 0; i < size; i++) { char ch = chars[i]; if (ch < 32 || 126 < ch || ch == '<' || ch == '>' || ch == '&' || ch == '\"') return true; } return false; } /** * Return the name of the attribute */ public String getName() { return _name; } /** * Return the value of the attribute */ public AttributeValue getValue() { return _value; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LastCall.java0000644000175000017500000000441310721374031024513 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LastCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.CompareGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.TestGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class LastCall extends FunctionCall { public LastCall(QName fname) { super(fname); } public boolean hasPositionCall() { return true; } public boolean hasLastCall() { return true; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadLastNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(LAST_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int getLast = cpg.addInterfaceMethodref(NODE_ITERATOR, "getLast", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(getLast, 1)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Stylesheet.java0000644000175000017500000015117310721374033025155 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Stylesheet.java 577935 2007-09-20 21:35:20Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; import java.util.StringTokenizer; import org.apache.xml.utils.SystemIDResolver; import org.apache.bcel.generic.ANEWARRAY; import org.apache.bcel.generic.BasicType; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.FieldGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.GETSTATIC; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.NEWARRAY; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUTFIELD; import org.apache.bcel.generic.PUTSTATIC; import org.apache.bcel.generic.TargetLostException; import org.apache.bcel.util.InstructionFinder; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xml.dtm.DTM; public final class Stylesheet extends SyntaxTreeNode { /** * XSLT version defined in the stylesheet. */ private String _version; /** * Internal name of this stylesheet used as a key into the symbol table. */ private QName _name; /** * A URI that represents the system ID for this stylesheet. */ private String _systemId; /** * A reference to the parent stylesheet or null if topmost. */ private Stylesheet _parentStylesheet; /** * Contains global variables and parameters defined in the stylesheet. */ private Vector _globals = new Vector(); /** * Used to cache the result returned by hasLocalParams(). */ private Boolean _hasLocalParams = null; /** * The name of the class being generated. */ private String _className; /** * Contains all templates defined in this stylesheet */ private final Vector _templates = new Vector(); /** * Used to cache result of getAllValidTemplates(). Only * set in top-level stylesheets that include/import other stylesheets. */ private Vector _allValidTemplates = null; private Vector _elementsWithNamespacesUsedDynamically = null; /** * Counter to generate unique mode suffixes. */ private int _nextModeSerial = 1; /** * Mapping between mode names and Mode instances. */ private final Hashtable _modes = new Hashtable(); /** * A reference to the default Mode object. */ private Mode _defaultMode; /** * Mapping between extension URIs and their prefixes. */ private final Hashtable _extensions = new Hashtable(); /** * Reference to the stylesheet from which this stylesheet was * imported (if any). */ public Stylesheet _importedFrom = null; /** * Reference to the stylesheet from which this stylesheet was * included (if any). */ public Stylesheet _includedFrom = null; /** * Array of all the stylesheets imported or included from this one. */ private Vector _includedStylesheets = null; /** * Import precendence for this stylesheet. */ private int _importPrecedence = 1; /** * Minimum precendence of any descendant stylesheet by inclusion or * importation. */ private int _minimumDescendantPrecedence = -1; /** * Mapping between key names and Key objects (needed by Key/IdPattern). */ private Hashtable _keys = new Hashtable(); /** * A reference to the SourceLoader set by the user (a URIResolver * if the JAXP API is being used). */ private SourceLoader _loader = null; /** * Flag indicating if format-number() is called. */ private boolean _numberFormattingUsed = false; /** * Flag indicating if this is a simplified stylesheets. A template * matching on "/" must be added in this case. */ private boolean _simplified = false; /** * Flag indicating if multi-document support is needed. */ private boolean _multiDocument = false; /** * Flag indicating if nodset() is called. */ private boolean _callsNodeset = false; /** * Flag indicating if id() is called. */ private boolean _hasIdCall = false; /** * Set to true to enable template inlining optimization. * @see XSLTC#_templateInlining */ private boolean _templateInlining = false; /** * A reference to the last xsl:output object found in the styleshet. */ private Output _lastOutputElement = null; /** * Output properties for this stylesheet. */ private Properties _outputProperties = null; /** * Output method for this stylesheet (must be set to one of * the constants defined below). */ private int _outputMethod = UNKNOWN_OUTPUT; // Output method constants public static final int UNKNOWN_OUTPUT = 0; public static final int XML_OUTPUT = 1; public static final int HTML_OUTPUT = 2; public static final int TEXT_OUTPUT = 3; /** * Return the output method */ public int getOutputMethod() { return _outputMethod; } /** * Check and set the output method */ private void checkOutputMethod() { if (_lastOutputElement != null) { String method = _lastOutputElement.getOutputMethod(); if (method != null) { if (method.equals("xml")) _outputMethod = XML_OUTPUT; else if (method.equals("html")) _outputMethod = HTML_OUTPUT; else if (method.equals("text")) _outputMethod = TEXT_OUTPUT; } } } public boolean getTemplateInlining() { return _templateInlining; } public void setTemplateInlining(boolean flag) { _templateInlining = flag; } public boolean isSimplified() { return(_simplified); } public void setSimplified() { _simplified = true; } public void setHasIdCall(boolean flag) { _hasIdCall = flag; } public void setOutputProperty(String key, String value) { if (_outputProperties == null) { _outputProperties = new Properties(); } _outputProperties.setProperty(key, value); } public void setOutputProperties(Properties props) { _outputProperties = props; } public Properties getOutputProperties() { return _outputProperties; } public Output getLastOutputElement() { return _lastOutputElement; } public void setMultiDocument(boolean flag) { _multiDocument = flag; } public boolean isMultiDocument() { return _multiDocument; } public void setCallsNodeset(boolean flag) { if (flag) setMultiDocument(flag); _callsNodeset = flag; } public boolean callsNodeset() { return _callsNodeset; } public void numberFormattingUsed() { _numberFormattingUsed = true; /* * Fix for bug 23046, if the stylesheet is included, set the * numberFormattingUsed flag to the parent stylesheet too. * AbstractTranslet.addDecimalFormat() will be inlined once for the * outer most stylesheet. */ Stylesheet parent = getParentStylesheet(); if (null != parent) parent.numberFormattingUsed(); } public void setImportPrecedence(final int precedence) { // Set import precedence for this stylesheet _importPrecedence = precedence; // Set import precedence for all included stylesheets final Enumeration elements = elements(); while (elements.hasMoreElements()) { SyntaxTreeNode child = (SyntaxTreeNode)elements.nextElement(); if (child instanceof Include) { Stylesheet included = ((Include)child).getIncludedStylesheet(); if (included != null && included._includedFrom == this) { included.setImportPrecedence(precedence); } } } // Set import precedence for the stylesheet that imported this one if (_importedFrom != null) { if (_importedFrom.getImportPrecedence() < precedence) { final Parser parser = getParser(); final int nextPrecedence = parser.getNextImportPrecedence(); _importedFrom.setImportPrecedence(nextPrecedence); } } // Set import precedence for the stylesheet that included this one else if (_includedFrom != null) { if (_includedFrom.getImportPrecedence() != precedence) _includedFrom.setImportPrecedence(precedence); } } public int getImportPrecedence() { return _importPrecedence; } /** * Get the minimum of the precedence of this stylesheet, any stylesheet * imported by this stylesheet and any include/import descendant of this * stylesheet. */ public int getMinimumDescendantPrecedence() { if (_minimumDescendantPrecedence == -1) { // Start with precedence of current stylesheet as a basis. int min = getImportPrecedence(); // Recursively examine all imported/included stylesheets. final int inclImpCount = (_includedStylesheets != null) ? _includedStylesheets.size() : 0; for (int i = 0; i < inclImpCount; i++) { int prec = ((Stylesheet)_includedStylesheets.elementAt(i)) .getMinimumDescendantPrecedence(); if (prec < min) { min = prec; } } _minimumDescendantPrecedence = min; } return _minimumDescendantPrecedence; } public boolean checkForLoop(String systemId) { // Return true if this stylesheet includes/imports itself if (_systemId != null && _systemId.equals(systemId)) { return true; } // Then check with any stylesheets that included/imported this one if (_parentStylesheet != null) return _parentStylesheet.checkForLoop(systemId); // Otherwise OK return false; } public void setParser(Parser parser) { super.setParser(parser); _name = makeStylesheetName("__stylesheet_"); } public void setParentStylesheet(Stylesheet parent) { _parentStylesheet = parent; } public Stylesheet getParentStylesheet() { return _parentStylesheet; } public void setImportingStylesheet(Stylesheet parent) { _importedFrom = parent; parent.addIncludedStylesheet(this); } public void setIncludingStylesheet(Stylesheet parent) { _includedFrom = parent; parent.addIncludedStylesheet(this); } public void addIncludedStylesheet(Stylesheet child) { if (_includedStylesheets == null) { _includedStylesheets = new Vector(); } _includedStylesheets.addElement(child); } public void setSystemId(String systemId) { if (systemId != null) { _systemId = SystemIDResolver.getAbsoluteURI(systemId); } } public String getSystemId() { return _systemId; } public void setSourceLoader(SourceLoader loader) { _loader = loader; } public SourceLoader getSourceLoader() { return _loader; } private QName makeStylesheetName(String prefix) { return getParser().getQName(prefix+getXSLTC().nextStylesheetSerial()); } /** * Returns true if this stylesheet has global vars or params. */ public boolean hasGlobals() { return _globals.size() > 0; } /** * Returns true if at least one template in the stylesheet has params * defined. Uses the variable _hasLocalParams to cache the * result. */ public boolean hasLocalParams() { if (_hasLocalParams == null) { Vector templates = getAllValidTemplates(); final int n = templates.size(); for (int i = 0; i < n; i++) { final Template template = (Template)templates.elementAt(i); if (template.hasParams()) { _hasLocalParams = Boolean.TRUE; return true; } } _hasLocalParams = Boolean.FALSE; return false; } else { return _hasLocalParams.booleanValue(); } } /** * Adds a single prefix mapping to this syntax tree node. * @param prefix Namespace prefix. * @param uri Namespace URI. */ protected void addPrefixMapping(String prefix, String uri) { if (prefix.equals(EMPTYSTRING) && uri.equals(XHTML_URI)) return; super.addPrefixMapping(prefix, uri); } /** * Store extension URIs */ private void extensionURI(String prefixes, SymbolTable stable) { if (prefixes != null) { StringTokenizer tokens = new StringTokenizer(prefixes); while (tokens.hasMoreTokens()) { final String prefix = tokens.nextToken(); final String uri = lookupNamespace(prefix); if (uri != null) { _extensions.put(uri, prefix); } } } } public boolean isExtension(String uri) { return (_extensions.get(uri) != null); } public void excludeExtensionPrefixes(Parser parser) { final SymbolTable stable = parser.getSymbolTable(); final String excludePrefixes = getAttribute("exclude-result-prefixes"); final String extensionPrefixes = getAttribute("extension-element-prefixes"); // Exclude XSLT uri stable.excludeURI(Constants.XSLT_URI); stable.excludeNamespaces(excludePrefixes); stable.excludeNamespaces(extensionPrefixes); extensionURI(extensionPrefixes, stable); } /** * Parse the version and uri fields of the stylesheet and add an * entry to the symbol table mapping the name __stylesheet_ * to an instance of this class. */ public void parseContents(Parser parser) { final SymbolTable stable = parser.getSymbolTable(); /* // Make sure the XSL version set in this stylesheet if ((_version == null) || (_version.equals(EMPTYSTRING))) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR,"version"); } // Verify that the version is 1.0 and nothing else else if (!_version.equals("1.0")) { reportError(this, parser, ErrorMsg.XSL_VERSION_ERR, _version); } */ // Add the implicit mapping of 'xml' to the XML namespace URI addPrefixMapping("xml", "http://www.w3.org/XML/1998/namespace"); // Report and error if more than one stylesheet defined final Stylesheet sheet = stable.addStylesheet(_name, this); if (sheet != null) { // Error: more that one stylesheet defined ErrorMsg err = new ErrorMsg(ErrorMsg.MULTIPLE_STYLESHEET_ERR,this); parser.reportError(Constants.ERROR, err); } // If this is a simplified stylesheet we must create a template that // grabs the root node of the input doc ( ). // This template needs the current element (the one passed to this // method) as its only child, so the Template class has a special // method that handles this (parseSimplified()). if (_simplified) { stable.excludeURI(XSLT_URI); Template template = new Template(); template.parseSimplified(this, parser); } // Parse the children of this node else { parseOwnChildren(parser); } } /** * Parse all direct children of the element. */ public final void parseOwnChildren(Parser parser) { final Vector contents = getContents(); final int count = contents.size(); // We have to scan the stylesheet element's top-level elements for // variables and/or parameters before we parse the other elements for (int i = 0; i < count; i++) { SyntaxTreeNode child = (SyntaxTreeNode)contents.elementAt(i); if ((child instanceof VariableBase) || (child instanceof NamespaceAlias)) { parser.getSymbolTable().setCurrentNode(child); child.parseContents(parser); } } // Now go through all the other top-level elements... for (int i = 0; i < count; i++) { SyntaxTreeNode child = (SyntaxTreeNode)contents.elementAt(i); if (!(child instanceof VariableBase) && !(child instanceof NamespaceAlias)) { parser.getSymbolTable().setCurrentNode(child); child.parseContents(parser); } // All template code should be compiled as methods if the // element was ever used in this stylesheet if (!_templateInlining && (child instanceof Template)) { Template template = (Template)child; String name = "template$dot$" + template.getPosition(); template.setName(parser.getQName(name)); } } } public void processModes() { if (_defaultMode == null) _defaultMode = new Mode(null, this, Constants.EMPTYSTRING); _defaultMode.processPatterns(_keys); final Enumeration modes = _modes.elements(); while (modes.hasMoreElements()) { final Mode mode = (Mode)modes.nextElement(); mode.processPatterns(_keys); } } private void compileModes(ClassGenerator classGen) { _defaultMode.compileApplyTemplates(classGen); final Enumeration modes = _modes.elements(); while (modes.hasMoreElements()) { final Mode mode = (Mode)modes.nextElement(); mode.compileApplyTemplates(classGen); } } public Mode getMode(QName modeName) { if (modeName == null) { if (_defaultMode == null) { _defaultMode = new Mode(null, this, Constants.EMPTYSTRING); } return _defaultMode; } else { Mode mode = (Mode)_modes.get(modeName); if (mode == null) { final String suffix = Integer.toString(_nextModeSerial++); _modes.put(modeName, mode = new Mode(modeName, this, suffix)); } return mode; } } /** * Type check all the children of this node. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final int count = _globals.size(); for (int i = 0; i < count; i++) { final VariableBase var = (VariableBase)_globals.elementAt(i); var.typeCheck(stable); } return typeCheckContents(stable); } /** * Translate the stylesheet into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { translate(); } private void addDOMField(ClassGenerator classGen) { final FieldGen fgen = new FieldGen(ACC_PUBLIC, Util.getJCRefType(DOM_INTF_SIG), DOM_FIELD, classGen.getConstantPool()); classGen.addField(fgen.getField()); } /** * Add a static field */ private void addStaticField(ClassGenerator classGen, String type, String name) { final FieldGen fgen = new FieldGen(ACC_PROTECTED|ACC_STATIC, Util.getJCRefType(type), name, classGen.getConstantPool()); classGen.addField(fgen.getField()); } /** * Translate the stylesheet into JVM bytecodes. */ public void translate() { _className = getXSLTC().getClassName(); // Define a new class by extending TRANSLET_CLASS final ClassGenerator classGen = new ClassGenerator(_className, TRANSLET_CLASS, Constants.EMPTYSTRING, ACC_PUBLIC | ACC_SUPER, null, this); addDOMField(classGen); // Compile transform() to initialize parameters, globals & output // and run the transformation compileTransform(classGen); // Translate all non-template elements and filter out all templates final Enumeration elements = elements(); while (elements.hasMoreElements()) { Object element = elements.nextElement(); // xsl:template if (element instanceof Template) { // Separate templates by modes final Template template = (Template)element; //_templates.addElement(template); getMode(template.getModeName()).addTemplate(template); } // xsl:attribute-set else if (element instanceof AttributeSet) { ((AttributeSet)element).translate(classGen, null); } else if (element instanceof Output) { // save the element for later to pass to compileConstructor Output output = (Output)element; if (output.enabled()) _lastOutputElement = output; } else { // Global variables and parameters are handled elsewhere. // Other top-level non-template elements are ignored. Literal // elements outside of templates will never be output. } } checkOutputMethod(); processModes(); compileModes(classGen); compileStaticInitializer(classGen); compileConstructor(classGen, _lastOutputElement); if (!getParser().errorsFound()) { getXSLTC().dumpClass(classGen.getJavaClass()); } } /** *

        Compile the namesArray, urisArray, typesArray, namespaceArray, * namespaceAncestorsArray, prefixURIsIdxArray and prefixURIPairsArray into * the static initializer. They are read-only from the * translet. All translet instances can share a single * copy of this informtion.

        *

        The namespaceAncestorsArray, * prefixURIsIdxArray and prefixURIPairsArray * contain namespace information accessible from the stylesheet: *

        *
        namespaceAncestorsArray
        *
        Array indexed by integer stylesheet node IDs containing node IDs of * the nearest ancestor node in the stylesheet with namespace * declarations or -1 if there is no such ancestor. There * can be more than one disjoint tree of nodes - one for each stylesheet * module
        *
        prefixURIsIdxArray
        *
        Array indexed by integer stylesheet node IDs containing the index * into prefixURIPairsArray of the first namespace prefix * declared for the node. The values are stored in ascending order, so * the next value in this array (if any) can be used to find the last such * prefix-URI pair
        *
        prefixURIPairsArray
        *
        Array of pairs of namespace prefixes and URIs. A zero-length * string represents the default namespace if it appears as a prefix and * a namespace undeclaration if it appears as a URI.
        *
        *

        *

        For this stylesheet *

        
             * <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
             *   <xsl:template match="/">
             *     <xsl:for-each select="*" xmlns:foo="foouri">
             *       <xsl:element name="{n}" xmlns:foo="baruri">
             *     </xsl:for-each>
             *     <out xmlns="lumpit"/>
             *     <xsl:element name="{n}" xmlns="foouri"/>
             *     <xsl:element name="{n}" namespace="{ns}" xmlns="limpit"/gt;
             *   </xsl:template>
             * </xsl:stylesheet>
             * 
        * there will be four stylesheet nodes whose namespace information is * needed, and *
          *
        • namespaceAncestorsArray will have the value * [-1,0,1,0];
        • *
        • prefixURIsIdxArray will have the value * [0,4,6,8]; and
        • *
        • prefixURIPairsArray will have the value * ["xml","http://www.w3.org/XML/1998/namespace", * "xsl","http://www.w3.org/1999/XSL/Transform" * "foo","foouri","foo","baruri","","foouri"].
        • *
        *

        */ private void compileStaticInitializer(ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final MethodGenerator staticConst = new MethodGenerator(ACC_PUBLIC|ACC_STATIC, org.apache.bcel.generic.Type.VOID, null, null, "", _className, il, cpg); addStaticField(classGen, "[" + STRING_SIG, STATIC_NAMES_ARRAY_FIELD); addStaticField(classGen, "[" + STRING_SIG, STATIC_URIS_ARRAY_FIELD); addStaticField(classGen, "[I", STATIC_TYPES_ARRAY_FIELD); addStaticField(classGen, "[" + STRING_SIG, STATIC_NAMESPACE_ARRAY_FIELD); // Create fields of type char[] that will contain literal text from // the stylesheet. final int charDataFieldCount = getXSLTC().getCharacterDataCount(); for (int i = 0; i < charDataFieldCount; i++) { addStaticField(classGen, STATIC_CHAR_DATA_FIELD_SIG, STATIC_CHAR_DATA_FIELD+i); } // Put the names array into the translet - used for dom/translet mapping final Vector namesIndex = getXSLTC().getNamesIndex(); int size = namesIndex.size(); String[] namesArray = new String[size]; String[] urisArray = new String[size]; int[] typesArray = new int[size]; int index; for (int i = 0; i < size; i++) { String encodedName = (String)namesIndex.elementAt(i); if ((index = encodedName.lastIndexOf(':')) > -1) { urisArray[i] = encodedName.substring(0, index); } index = index + 1; if (encodedName.charAt(index) == '@') { typesArray[i] = DTM.ATTRIBUTE_NODE; index++; } else if (encodedName.charAt(index) == '?') { typesArray[i] = DTM.NAMESPACE_NODE; index++; } else { typesArray[i] = DTM.ELEMENT_NODE; } if (index == 0) { namesArray[i] = encodedName; } else { namesArray[i] = encodedName.substring(index); } } staticConst.markChunkStart(); il.append(new PUSH(cpg, size)); il.append(new ANEWARRAY(cpg.addClass(STRING))); int namesArrayRef = cpg.addFieldref(_className, STATIC_NAMES_ARRAY_FIELD, NAMES_INDEX_SIG); il.append(new PUTSTATIC(namesArrayRef)); staticConst.markChunkEnd(); for (int i = 0; i < size; i++) { final String name = namesArray[i]; staticConst.markChunkStart(); il.append(new GETSTATIC(namesArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, name)); il.append(AASTORE); staticConst.markChunkEnd(); } staticConst.markChunkStart(); il.append(new PUSH(cpg, size)); il.append(new ANEWARRAY(cpg.addClass(STRING))); int urisArrayRef = cpg.addFieldref(_className, STATIC_URIS_ARRAY_FIELD, URIS_INDEX_SIG); il.append(new PUTSTATIC(urisArrayRef)); staticConst.markChunkEnd(); for (int i = 0; i < size; i++) { final String uri = urisArray[i]; staticConst.markChunkStart(); il.append(new GETSTATIC(urisArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, uri)); il.append(AASTORE); staticConst.markChunkEnd(); } staticConst.markChunkStart(); il.append(new PUSH(cpg, size)); il.append(new NEWARRAY(BasicType.INT)); int typesArrayRef = cpg.addFieldref(_className, STATIC_TYPES_ARRAY_FIELD, TYPES_INDEX_SIG); il.append(new PUTSTATIC(typesArrayRef)); staticConst.markChunkEnd(); for (int i = 0; i < size; i++) { final int nodeType = typesArray[i]; staticConst.markChunkStart(); il.append(new GETSTATIC(typesArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, nodeType)); il.append(IASTORE); staticConst.markChunkEnd(); } // Put the namespace names array into the translet final Vector namespaces = getXSLTC().getNamespaceIndex(); staticConst.markChunkStart(); il.append(new PUSH(cpg, namespaces.size())); il.append(new ANEWARRAY(cpg.addClass(STRING))); int namespaceArrayRef = cpg.addFieldref(_className, STATIC_NAMESPACE_ARRAY_FIELD, NAMESPACE_INDEX_SIG); il.append(new PUTSTATIC(namespaceArrayRef)); staticConst.markChunkEnd(); for (int i = 0; i < namespaces.size(); i++) { final String ns = (String)namespaces.elementAt(i); staticConst.markChunkStart(); il.append(new GETSTATIC(namespaceArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, ns)); il.append(AASTORE); staticConst.markChunkEnd(); } // Put the tree of stylesheet namespace declarations into the translet final Vector namespaceAncestors = getXSLTC().getNSAncestorPointers(); if (namespaceAncestors != null && namespaceAncestors.size() != 0) { addStaticField(classGen, NS_ANCESTORS_INDEX_SIG, STATIC_NS_ANCESTORS_ARRAY_FIELD); staticConst.markChunkStart(); il.append(new PUSH(cpg, namespaceAncestors.size())); il.append(new NEWARRAY(BasicType.INT)); int namespaceAncestorsArrayRef = cpg.addFieldref(_className, STATIC_NS_ANCESTORS_ARRAY_FIELD, NS_ANCESTORS_INDEX_SIG); il.append(new PUTSTATIC(namespaceAncestorsArrayRef)); staticConst.markChunkEnd(); for (int i = 0; i < namespaceAncestors.size(); i++) { int ancestor = ((Integer) namespaceAncestors.get(i)).intValue(); staticConst.markChunkStart(); il.append(new GETSTATIC(namespaceAncestorsArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, ancestor)); il.append(IASTORE); staticConst.markChunkEnd(); } } // Put the array of indices into the namespace prefix/URI pairs array // into the translet final Vector prefixURIPairsIdx = getXSLTC().getPrefixURIPairsIdx(); if (prefixURIPairsIdx != null && prefixURIPairsIdx.size() != 0) { addStaticField(classGen, PREFIX_URIS_IDX_SIG, STATIC_PREFIX_URIS_IDX_ARRAY_FIELD); staticConst.markChunkStart(); il.append(new PUSH(cpg, prefixURIPairsIdx.size())); il.append(new NEWARRAY(BasicType.INT)); int prefixURIPairsIdxArrayRef = cpg.addFieldref(_className, STATIC_PREFIX_URIS_IDX_ARRAY_FIELD, PREFIX_URIS_IDX_SIG); il.append(new PUTSTATIC(prefixURIPairsIdxArrayRef)); staticConst.markChunkEnd(); for (int i = 0; i < prefixURIPairsIdx.size(); i++) { int idx = ((Integer) prefixURIPairsIdx.get(i)).intValue(); staticConst.markChunkStart(); il.append(new GETSTATIC(prefixURIPairsIdxArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, idx)); il.append(IASTORE); staticConst.markChunkEnd(); } } // Put the array of pairs of namespace prefixes and URIs into the // translet final Vector prefixURIPairs = getXSLTC().getPrefixURIPairs(); if (prefixURIPairs != null && prefixURIPairs.size() != 0) { addStaticField(classGen, PREFIX_URIS_ARRAY_SIG, STATIC_PREFIX_URIS_ARRAY_FIELD); staticConst.markChunkStart(); il.append(new PUSH(cpg, prefixURIPairs.size())); il.append(new ANEWARRAY(cpg.addClass(STRING))); int prefixURIPairsRef = cpg.addFieldref(_className, STATIC_PREFIX_URIS_ARRAY_FIELD, PREFIX_URIS_ARRAY_SIG); il.append(new PUTSTATIC(prefixURIPairsRef)); staticConst.markChunkEnd(); for (int i = 0; i < prefixURIPairs.size(); i++) { String prefixOrURI = (String) prefixURIPairs.get(i); staticConst.markChunkStart(); il.append(new GETSTATIC(prefixURIPairsRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, prefixOrURI)); il.append(AASTORE); staticConst.markChunkEnd(); } } // Grab all the literal text in the stylesheet and put it in a char[] final int charDataCount = getXSLTC().getCharacterDataCount(); final int toCharArray = cpg.addMethodref(STRING, "toCharArray", "()[C"); for (int i = 0; i < charDataCount; i++) { staticConst.markChunkStart(); il.append(new PUSH(cpg, getXSLTC().getCharacterData(i))); il.append(new INVOKEVIRTUAL(toCharArray)); il.append(new PUTSTATIC(cpg.addFieldref(_className, STATIC_CHAR_DATA_FIELD+i, STATIC_CHAR_DATA_FIELD_SIG))); staticConst.markChunkEnd(); } il.append(RETURN); classGen.addMethod(staticConst); } /** * Compile the translet's constructor */ private void compileConstructor(ClassGenerator classGen, Output output) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final MethodGenerator constructor = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, null, null, "", _className, il, cpg); // Call the constructor in the AbstractTranslet superclass il.append(classGen.loadTranslet()); il.append(new INVOKESPECIAL(cpg.addMethodref(TRANSLET_CLASS, "", "()V"))); constructor.markChunkStart(); il.append(classGen.loadTranslet()); il.append(new GETSTATIC(cpg.addFieldref(_className, STATIC_NAMES_ARRAY_FIELD, NAMES_INDEX_SIG))); il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS, NAMES_INDEX, NAMES_INDEX_SIG))); constructor.markChunkEnd(); constructor.markChunkStart(); il.append(classGen.loadTranslet()); il.append(new GETSTATIC(cpg.addFieldref(_className, STATIC_URIS_ARRAY_FIELD, URIS_INDEX_SIG))); il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS, URIS_INDEX, URIS_INDEX_SIG))); constructor.markChunkEnd(); constructor.markChunkStart(); il.append(classGen.loadTranslet()); il.append(new GETSTATIC(cpg.addFieldref(_className, STATIC_TYPES_ARRAY_FIELD, TYPES_INDEX_SIG))); il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS, TYPES_INDEX, TYPES_INDEX_SIG))); constructor.markChunkEnd(); constructor.markChunkStart(); il.append(classGen.loadTranslet()); il.append(new GETSTATIC(cpg.addFieldref(_className, STATIC_NAMESPACE_ARRAY_FIELD, NAMESPACE_INDEX_SIG))); il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS, NAMESPACE_INDEX, NAMESPACE_INDEX_SIG))); constructor.markChunkEnd(); constructor.markChunkStart(); il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, AbstractTranslet.CURRENT_TRANSLET_VERSION)); il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS, TRANSLET_VERSION_INDEX, TRANSLET_VERSION_INDEX_SIG))); constructor.markChunkEnd(); if (_hasIdCall) { constructor.markChunkStart(); il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, Boolean.TRUE)); il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS, HASIDCALL_INDEX, HASIDCALL_INDEX_SIG))); constructor.markChunkEnd(); } // Compile in code to set the output configuration from if (output != null) { // Set all the output settings files in the translet constructor.markChunkStart(); output.translate(classGen, constructor); constructor.markChunkEnd(); } // Compile default decimal formatting symbols. // This is an implicit, nameless xsl:decimal-format top-level element. if (_numberFormattingUsed) { constructor.markChunkStart(); DecimalFormatting.translateDefaultDFS(classGen, constructor); constructor.markChunkEnd(); } il.append(RETURN); classGen.addMethod(constructor); } /** * Compile a topLevel() method into the output class. This method is * called from transform() to handle all non-template top-level elements. * Returns the signature of the topLevel() method. * * Global variables/params and keys are first sorted to resolve * dependencies between them. The XSLT 1.0 spec does not allow a key * to depend on a variable. However, for compatibility with Xalan * interpretive, that type of dependency is allowed. Note also that * the buildKeys() method is still generated as it is used by the * LoadDocument class, but it no longer called from transform(). */ private String compileTopLevel(ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final org.apache.bcel.generic.Type[] argTypes = { Util.getJCRefType(DOM_INTF_SIG), Util.getJCRefType(NODE_ITERATOR_SIG), Util.getJCRefType(TRANSLET_OUTPUT_SIG) }; final String[] argNames = { DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME }; final InstructionList il = new InstructionList(); final MethodGenerator toplevel = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, argTypes, argNames, "topLevel", _className, il, classGen.getConstantPool()); toplevel.addException("org.apache.xalan.xsltc.TransletException"); // Define and initialize 'current' variable with the root node final LocalVariableGen current = toplevel.addLocalVariable("current", org.apache.bcel.generic.Type.INT, null, null); final int setFilter = cpg.addInterfaceMethodref(DOM_INTF, "setFilter", "(Lorg/apache/xalan/xsltc/StripFilter;)V"); final int gitr = cpg.addInterfaceMethodref(DOM_INTF, "getIterator", "()"+NODE_ITERATOR_SIG); il.append(toplevel.loadDOM()); il.append(new INVOKEINTERFACE(gitr, 1)); il.append(toplevel.nextNode()); current.setStart(il.append(new ISTORE(current.getIndex()))); // Create a new list containing variables/params + keys Vector varDepElements = new Vector(_globals); Enumeration elements = elements(); while (elements.hasMoreElements()) { final Object element = elements.nextElement(); if (element instanceof Key) { varDepElements.add(element); } } // Determine a partial order for the variables/params and keys varDepElements = resolveDependencies(varDepElements); // Translate vars/params and keys in the right order final int count = varDepElements.size(); for (int i = 0; i < count; i++) { final TopLevelElement tle = (TopLevelElement) varDepElements.elementAt(i); tle.translate(classGen, toplevel); if (tle instanceof Key) { final Key key = (Key) tle; _keys.put(key.getName(), key); } } // Compile code for other top-level elements Vector whitespaceRules = new Vector(); elements = elements(); while (elements.hasMoreElements()) { final Object element = elements.nextElement(); // xsl:decimal-format if (element instanceof DecimalFormatting) { ((DecimalFormatting)element).translate(classGen,toplevel); } // xsl:strip/preserve-space else if (element instanceof Whitespace) { whitespaceRules.addAll(((Whitespace)element).getRules()); } } // Translate all whitespace strip/preserve rules if (whitespaceRules.size() > 0) { Whitespace.translateRules(whitespaceRules,classGen); } if (classGen.containsMethod(STRIP_SPACE, STRIP_SPACE_PARAMS) != null) { il.append(toplevel.loadDOM()); il.append(classGen.loadTranslet()); il.append(new INVOKEINTERFACE(setFilter, 2)); } il.append(RETURN); // Compute max locals + stack and add method to class classGen.addMethod(toplevel); return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V"); } /** * This method returns a vector with variables/params and keys in the * order in which they are to be compiled for initialization. The order * is determined by analyzing the dependencies between them. The XSLT 1.0 * spec does not allow a key to depend on a variable. However, for * compatibility with Xalan interpretive, that type of dependency is * allowed and, therefore, consider to determine the partial order. */ private Vector resolveDependencies(Vector input) { /* DEBUG CODE - INGORE for (int i = 0; i < input.size(); i++) { final TopLevelElement e = (TopLevelElement) input.elementAt(i); System.out.println("e = " + e + " depends on:"); Vector dep = e.getDependencies(); for (int j = 0; j < (dep != null ? dep.size() : 0); j++) { System.out.println("\t" + dep.elementAt(j)); } } System.out.println("================================="); */ Vector result = new Vector(); while (input.size() > 0) { boolean changed = false; for (int i = 0; i < input.size(); ) { final TopLevelElement vde = (TopLevelElement) input.elementAt(i); final Vector dep = vde.getDependencies(); if (dep == null || result.containsAll(dep)) { result.addElement(vde); input.remove(i); changed = true; } else { i++; } } // If nothing was changed in this pass then we have a circular ref if (!changed) { ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR, input.toString(), this); getParser().reportError(Constants.ERROR, err); return(result); } } /* DEBUG CODE - INGORE System.out.println("================================="); for (int i = 0; i < result.size(); i++) { final TopLevelElement e = (TopLevelElement) result.elementAt(i); System.out.println("e = " + e); } */ return result; } /** * Compile a buildKeys() method into the output class. Note that keys * for the input document are created in topLevel(), not in this method. * However, we still need this method to create keys for documents loaded * via the XPath document() function. */ private String compileBuildKeys(ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final org.apache.bcel.generic.Type[] argTypes = { Util.getJCRefType(DOM_INTF_SIG), Util.getJCRefType(NODE_ITERATOR_SIG), Util.getJCRefType(TRANSLET_OUTPUT_SIG), org.apache.bcel.generic.Type.INT }; final String[] argNames = { DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current" }; final InstructionList il = new InstructionList(); final MethodGenerator buildKeys = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, argTypes, argNames, "buildKeys", _className, il, classGen.getConstantPool()); buildKeys.addException("org.apache.xalan.xsltc.TransletException"); final Enumeration elements = elements(); while (elements.hasMoreElements()) { // xsl:key final Object element = elements.nextElement(); if (element instanceof Key) { final Key key = (Key)element; key.translate(classGen, buildKeys); _keys.put(key.getName(),key); } } il.append(RETURN); // Add method to class classGen.addMethod(buildKeys); return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V"); } /** * Compile transform() into the output class. This method is used to * initialize global variables and global parameters. The current node * is set to be the document's root node. */ private void compileTransform(ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); /* * Define the the method transform with the following signature: * void transform(DOM, NodeIterator, HandlerBase) */ final org.apache.bcel.generic.Type[] argTypes = new org.apache.bcel.generic.Type[3]; argTypes[0] = Util.getJCRefType(DOM_INTF_SIG); argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG); argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); final String[] argNames = new String[3]; argNames[0] = DOCUMENT_PNAME; argNames[1] = ITERATOR_PNAME; argNames[2] = TRANSLET_OUTPUT_PNAME; final InstructionList il = new InstructionList(); final MethodGenerator transf = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, argTypes, argNames, "transform", _className, il, classGen.getConstantPool()); transf.addException("org.apache.xalan.xsltc.TransletException"); // Define and initialize current with the root node final LocalVariableGen current = transf.addLocalVariable("current", org.apache.bcel.generic.Type.INT, null, null); final String applyTemplatesSig = classGen.getApplyTemplatesSig(); final int applyTemplates = cpg.addMethodref(getClassName(), "applyTemplates", applyTemplatesSig); final int domField = cpg.addFieldref(getClassName(), DOM_FIELD, DOM_INTF_SIG); // push translet for PUTFIELD il.append(classGen.loadTranslet()); // prepare appropriate DOM implementation if (isMultiDocument()) { il.append(new NEW(cpg.addClass(MULTI_DOM_CLASS))); il.append(DUP); } il.append(classGen.loadTranslet()); il.append(transf.loadDOM()); il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, "makeDOMAdapter", "("+DOM_INTF_SIG+")"+ DOM_ADAPTER_SIG))); // DOMAdapter is on the stack if (isMultiDocument()) { final int init = cpg.addMethodref(MULTI_DOM_CLASS, "", "("+DOM_INTF_SIG+")V"); il.append(new INVOKESPECIAL(init)); // MultiDOM is on the stack } //store to _dom variable il.append(new PUTFIELD(domField)); // continue with globals initialization final int gitr = cpg.addInterfaceMethodref(DOM_INTF, "getIterator", "()"+NODE_ITERATOR_SIG); il.append(transf.loadDOM()); il.append(new INVOKEINTERFACE(gitr, 1)); il.append(transf.nextNode()); current.setStart(il.append(new ISTORE(current.getIndex()))); // Transfer the output settings to the output post-processor il.append(classGen.loadTranslet()); il.append(transf.loadHandler()); final int index = cpg.addMethodref(TRANSLET_CLASS, "transferOutputSettings", "("+OUTPUT_HANDLER_SIG+")V"); il.append(new INVOKEVIRTUAL(index)); /* * Compile buildKeys() method. Note that this method is not * invoked here as keys for the input document are now created * in topLevel(). However, this method is still needed by the * LoadDocument class. */ final String keySig = compileBuildKeys(classGen); final int keyIdx = cpg.addMethodref(getClassName(), "buildKeys", keySig); // Look for top-level elements that need handling final Enumeration toplevel = elements(); if (_globals.size() > 0 || toplevel.hasMoreElements()) { // Compile method for handling top-level elements final String topLevelSig = compileTopLevel(classGen); // Get a reference to that method final int topLevelIdx = cpg.addMethodref(getClassName(), "topLevel", topLevelSig); // Push all parameters on the stack and call topLevel() il.append(classGen.loadTranslet()); // The 'this' pointer il.append(classGen.loadTranslet()); il.append(new GETFIELD(domField)); // The DOM reference il.append(transf.loadIterator()); il.append(transf.loadHandler()); // The output handler il.append(new INVOKEVIRTUAL(topLevelIdx)); } // start document il.append(transf.loadHandler()); il.append(transf.startDocument()); // push first arg for applyTemplates il.append(classGen.loadTranslet()); // push translet for GETFIELD to get DOM arg il.append(classGen.loadTranslet()); il.append(new GETFIELD(domField)); // push remaining 2 args il.append(transf.loadIterator()); il.append(transf.loadHandler()); il.append(new INVOKEVIRTUAL(applyTemplates)); // endDocument il.append(transf.loadHandler()); il.append(transf.endDocument()); il.append(RETURN); // Compute max locals + stack and add method to class classGen.addMethod(transf); } /** * Peephole optimization: Remove sequences of [ALOAD, POP]. */ private void peepHoleOptimization(MethodGenerator methodGen) { final String pattern = "`aload'`pop'`instruction'"; final InstructionList il = methodGen.getInstructionList(); final InstructionFinder find = new InstructionFinder(il); for(Iterator iter=find.search(pattern); iter.hasNext(); ) { InstructionHandle[] match = (InstructionHandle[])iter.next(); try { il.delete(match[0], match[1]); } catch (TargetLostException e) { // TODO: move target down into the list } } } public int addParam(Param param) { _globals.addElement(param); return _globals.size() - 1; } public int addVariable(Variable global) { _globals.addElement(global); return _globals.size() - 1; } public void display(int indent) { indent(indent); Util.println("Stylesheet"); displayContents(indent + IndentIncrement); } // do we need this wrapper ????? public String getNamespace(String prefix) { return lookupNamespace(prefix); } public String getClassName() { return _className; } public Vector getTemplates() { return _templates; } public Vector getAllValidTemplates() { // Return templates if no imported/included stylesheets if (_includedStylesheets == null) { return _templates; } // Is returned value cached? if (_allValidTemplates == null) { Vector templates = new Vector(); int size = _includedStylesheets.size(); for (int i = 0; i < size; i++) { Stylesheet included =(Stylesheet)_includedStylesheets.elementAt(i); templates.addAll(included.getAllValidTemplates()); } templates.addAll(_templates); // Cache results in top-level stylesheet only if (_parentStylesheet != null) { return templates; } _allValidTemplates = templates; } return _allValidTemplates; } protected void addTemplate(Template template) { _templates.addElement(template); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Sort.java0000644000175000017500000006340510721374033023753 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Sort.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.text.Collator; import java.util.ArrayList; import java.util.NoSuchElementException; import java.util.StringTokenizer; import java.util.Vector; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ANEWARRAY; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.ICONST; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.NOP; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.PUTFIELD; import org.apache.bcel.generic.TABLESWITCH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.CompareGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.IntType; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSortRecordFactGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSortRecordGenerator; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.Axis; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Sort extends Instruction implements Closure { private Expression _select; private AttributeValue _order; private AttributeValue _caseOrder; private AttributeValue _dataType; private String _lang; // bug! see 26869 private String _data = null; private String _className = null; private ArrayList _closureVars = null; private boolean _needsSortRecordFactory = false; // -- Begin Closure interface -------------------- /** * Returns true if this closure is compiled in an inner class (i.e. * if this is a real closure). */ public boolean inInnerClass() { return (_className != null); } /** * Returns a reference to its parent closure or null if outermost. */ public Closure getParentClosure() { return null; } /** * Returns the name of the auxiliary class or null if this predicate * is compiled inside the Translet. */ public String getInnerClassName() { return _className; } /** * Add new variable to the closure. */ public void addVariable(VariableRefBase variableRef) { if (_closureVars == null) { _closureVars = new ArrayList(); } // Only one reference per variable if (!_closureVars.contains(variableRef)) { _closureVars.add(variableRef); _needsSortRecordFactory = true; } } // -- End Closure interface ---------------------- private void setInnerClassName(String className) { _className = className; } /** * Parse the attributes of the xsl:sort element */ public void parseContents(Parser parser) { final SyntaxTreeNode parent = getParent(); if (!(parent instanceof ApplyTemplates) && !(parent instanceof ForEach)) { reportError(this, parser, ErrorMsg.STRAY_SORT_ERR, null); return; } // Parse the select expression (node string value if no expression) _select = parser.parseExpression(this, "select", "string(.)"); // Get the sort order; default is 'ascending' String val = getAttribute("order"); if (val.length() == 0) val = "ascending"; _order = AttributeValue.create(this, val, parser); // Get the sort data type; default is text val = getAttribute("data-type"); if (val.length() == 0) { try { final Type type = _select.typeCheck(parser.getSymbolTable()); if (type instanceof IntType) val = "number"; else val = "text"; } catch (TypeCheckError e) { val = "text"; } } _dataType = AttributeValue.create(this, val, parser); _lang = getAttribute("lang"); // bug! see 26869 // val = getAttribute("lang"); // _lang = AttributeValue.create(this, val, parser); // Get the case order; default is language dependant val = getAttribute("case-order"); _caseOrder = AttributeValue.create(this, val, parser); } /** * Run type checks on the attributes; expression must return a string * which we will use as a sort key */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tselect = _select.typeCheck(stable); // If the sort data-type is not set we use the natural data-type // of the data we will sort if (!(tselect instanceof StringType)) { _select = new CastExpr(_select, Type.String); } _order.typeCheck(stable); _caseOrder.typeCheck(stable); _dataType.typeCheck(stable); return Type.Void; } /** * These two methods are needed in the static methods that compile the * overloaded NodeSortRecord.compareType() and NodeSortRecord.sortOrder() */ public void translateSortType(ClassGenerator classGen, MethodGenerator methodGen) { _dataType.translate(classGen, methodGen); } public void translateSortOrder(ClassGenerator classGen, MethodGenerator methodGen) { _order.translate(classGen, methodGen); } public void translateCaseOrder(ClassGenerator classGen, MethodGenerator methodGen) { _caseOrder.translate(classGen, methodGen); } public void translateLang(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _lang)); // bug! see 26869 } /** * This method compiles code for the select expression for this * xsl:sort element. The method is called from the static code-generating * methods in this class. */ public void translateSelect(ClassGenerator classGen, MethodGenerator methodGen) { _select.translate(classGen,methodGen); } /** * This method should not produce any code */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { // empty } /** * Compiles code that instantiates a SortingIterator object. * This object's constructor needs referencdes to the current iterator * and a node sort record producing objects as its parameters. */ public static void translateSortIterator(ClassGenerator classGen, MethodGenerator methodGen, Expression nodeSet, Vector sortObjects) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // SortingIterator.SortingIterator(NodeIterator,NodeSortRecordFactory); final int init = cpg.addMethodref(SORT_ITERATOR, "", "(" + NODE_ITERATOR_SIG + NODE_SORT_FACTORY_SIG + ")V"); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. LocalVariableGen nodesTemp = methodGen.addLocalVariable("sort_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); LocalVariableGen sortRecordFactoryTemp = methodGen.addLocalVariable("sort_tmp2", Util.getJCRefType(NODE_SORT_FACTORY_SIG), null, null); // Get the current node iterator if (nodeSet == null) { // apply-templates default final int children = cpg.addInterfaceMethodref(DOM_INTF, "getAxisIterator", "(I)"+ NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, Axis.CHILD)); il.append(new INVOKEINTERFACE(children, 2)); } else { nodeSet.translate(classGen, methodGen); } nodesTemp.setStart(il.append(new ASTORE(nodesTemp.getIndex()))); // Compile the code for the NodeSortRecord producing class and pass // that as the last argument to the SortingIterator constructor. compileSortRecordFactory(sortObjects, classGen, methodGen); sortRecordFactoryTemp.setStart( il.append(new ASTORE(sortRecordFactoryTemp.getIndex()))); il.append(new NEW(cpg.addClass(SORT_ITERATOR))); il.append(DUP); nodesTemp.setEnd(il.append(new ALOAD(nodesTemp.getIndex()))); sortRecordFactoryTemp.setEnd( il.append(new ALOAD(sortRecordFactoryTemp.getIndex()))); il.append(new INVOKESPECIAL(init)); } /** * Compiles code that instantiates a NodeSortRecordFactory object which * will produce NodeSortRecord objects of a specific type. */ public static void compileSortRecordFactory(Vector sortObjects, ClassGenerator classGen, MethodGenerator methodGen) { String sortRecordClass = compileSortRecord(sortObjects, classGen, methodGen); boolean needsSortRecordFactory = false; final int nsorts = sortObjects.size(); for (int i = 0; i < nsorts; i++) { final Sort sort = (Sort) sortObjects.elementAt(i); needsSortRecordFactory |= sort._needsSortRecordFactory; } String sortRecordFactoryClass = NODE_SORT_FACTORY; if (needsSortRecordFactory) { sortRecordFactoryClass = compileSortRecordFactory(sortObjects, classGen, methodGen, sortRecordClass); } final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. // Compile code that initializes the static _sortOrder LocalVariableGen sortOrderTemp = methodGen.addLocalVariable("sort_order_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateSortOrder(classGen, methodGen); il.append(AASTORE); } sortOrderTemp.setStart(il.append(new ASTORE(sortOrderTemp.getIndex()))); LocalVariableGen sortTypeTemp = methodGen.addLocalVariable("sort_type_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateSortType(classGen, methodGen); il.append(AASTORE); } sortTypeTemp.setStart(il.append(new ASTORE(sortTypeTemp.getIndex()))); LocalVariableGen sortLangTemp = methodGen.addLocalVariable("sort_lang_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateLang(classGen, methodGen); il.append(AASTORE); } sortLangTemp.setStart(il.append(new ASTORE(sortLangTemp.getIndex()))); LocalVariableGen sortCaseOrderTemp = methodGen.addLocalVariable("sort_case_order_tmp", Util.getJCRefType("[" + STRING_SIG), null, null); il.append(new PUSH(cpg, nsorts)); il.append(new ANEWARRAY(cpg.addClass(STRING))); for (int level = 0; level < nsorts; level++) { final Sort sort = (Sort)sortObjects.elementAt(level); il.append(DUP); il.append(new PUSH(cpg, level)); sort.translateCaseOrder(classGen, methodGen); il.append(AASTORE); } sortCaseOrderTemp.setStart( il.append(new ASTORE(sortCaseOrderTemp.getIndex()))); il.append(new NEW(cpg.addClass(sortRecordFactoryClass))); il.append(DUP); il.append(methodGen.loadDOM()); il.append(new PUSH(cpg, sortRecordClass)); il.append(classGen.loadTranslet()); sortOrderTemp.setEnd(il.append(new ALOAD(sortOrderTemp.getIndex()))); sortTypeTemp.setEnd(il.append(new ALOAD(sortTypeTemp.getIndex()))); sortLangTemp.setEnd(il.append(new ALOAD(sortLangTemp.getIndex()))); sortCaseOrderTemp.setEnd( il.append(new ALOAD(sortCaseOrderTemp.getIndex()))); il.append(new INVOKESPECIAL( cpg.addMethodref(sortRecordFactoryClass, "", "(" + DOM_INTF_SIG + STRING_SIG + TRANSLET_INTF_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + ")V"))); // Initialize closure variables in sortRecordFactory final ArrayList dups = new ArrayList(); for (int j = 0; j < nsorts; j++) { final Sort sort = (Sort) sortObjects.get(j); final int length = (sort._closureVars == null) ? 0 : sort._closureVars.size(); for (int i = 0; i < length; i++) { VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i); // Discard duplicate variable references if (dups.contains(varRef)) continue; final VariableBase var = varRef.getVariable(); // Store variable in new closure il.append(DUP); il.append(var.loadInstruction()); il.append(new PUTFIELD( cpg.addFieldref(sortRecordFactoryClass, var.getEscapedName(), var.getType().toSignature()))); dups.add(varRef); } } } public static String compileSortRecordFactory(Vector sortObjects, ClassGenerator classGen, MethodGenerator methodGen, String sortRecordClass) { final XSLTC xsltc = ((Sort)sortObjects.firstElement()).getXSLTC(); final String className = xsltc.getHelperClassName(); final NodeSortRecordFactGenerator sortRecordFactory = new NodeSortRecordFactGenerator(className, NODE_SORT_FACTORY, className + ".java", ACC_PUBLIC | ACC_SUPER | ACC_FINAL, new String[] {}, classGen.getStylesheet()); ConstantPoolGen cpg = sortRecordFactory.getConstantPool(); // Add a new instance variable for each var in closure final int nsorts = sortObjects.size(); final ArrayList dups = new ArrayList(); for (int j = 0; j < nsorts; j++) { final Sort sort = (Sort) sortObjects.get(j); final int length = (sort._closureVars == null) ? 0 : sort._closureVars.size(); for (int i = 0; i < length; i++) { final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i); // Discard duplicate variable references if (dups.contains(varRef)) continue; final VariableBase var = varRef.getVariable(); sortRecordFactory.addField(new Field(ACC_PUBLIC, cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool())); dups.add(varRef); } } // Define a constructor for this class final org.apache.bcel.generic.Type[] argTypes = new org.apache.bcel.generic.Type[7]; argTypes[0] = Util.getJCRefType(DOM_INTF_SIG); argTypes[1] = Util.getJCRefType(STRING_SIG); argTypes[2] = Util.getJCRefType(TRANSLET_INTF_SIG); argTypes[3] = Util.getJCRefType("[" + STRING_SIG); argTypes[4] = Util.getJCRefType("[" + STRING_SIG); argTypes[5] = Util.getJCRefType("[" + STRING_SIG); argTypes[6] = Util.getJCRefType("[" + STRING_SIG); final String[] argNames = new String[7]; argNames[0] = DOCUMENT_PNAME; argNames[1] = "className"; argNames[2] = TRANSLET_PNAME; argNames[3] = "order"; argNames[4] = "type"; argNames[5] = "lang"; argNames[6] = "case_order"; InstructionList il = new InstructionList(); final MethodGenerator constructor = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, argTypes, argNames, "", className, il, cpg); // Push all parameters onto the stack and called super.() il.append(ALOAD_0); il.append(ALOAD_1); il.append(ALOAD_2); il.append(new ALOAD(3)); il.append(new ALOAD(4)); il.append(new ALOAD(5)); il.append(new ALOAD(6)); il.append(new ALOAD(7)); il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_FACTORY, "", "(" + DOM_INTF_SIG + STRING_SIG + TRANSLET_INTF_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + "[" + STRING_SIG + ")V"))); il.append(RETURN); // Override the definition of makeNodeSortRecord() il = new InstructionList(); final MethodGenerator makeNodeSortRecord = new MethodGenerator(ACC_PUBLIC, Util.getJCRefType(NODE_SORT_RECORD_SIG), new org.apache.bcel.generic.Type[] { org.apache.bcel.generic.Type.INT, org.apache.bcel.generic.Type.INT }, new String[] { "node", "last" }, "makeNodeSortRecord", className, il, cpg); il.append(ALOAD_0); il.append(ILOAD_1); il.append(ILOAD_2); il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_FACTORY, "makeNodeSortRecord", "(II)" + NODE_SORT_RECORD_SIG))); il.append(DUP); il.append(new CHECKCAST(cpg.addClass(sortRecordClass))); // Initialize closure in record class final int ndups = dups.size(); for (int i = 0; i < ndups; i++) { final VariableRefBase varRef = (VariableRefBase) dups.get(i); final VariableBase var = varRef.getVariable(); final Type varType = var.getType(); il.append(DUP); // Get field from factory class il.append(ALOAD_0); il.append(new GETFIELD( cpg.addFieldref(className, var.getEscapedName(), varType.toSignature()))); // Put field in record class il.append(new PUTFIELD( cpg.addFieldref(sortRecordClass, var.getEscapedName(), varType.toSignature()))); } il.append(POP); il.append(ARETURN); constructor.setMaxLocals(); constructor.setMaxStack(); sortRecordFactory.addMethod(constructor); makeNodeSortRecord.setMaxLocals(); makeNodeSortRecord.setMaxStack(); sortRecordFactory.addMethod(makeNodeSortRecord); xsltc.dumpClass(sortRecordFactory.getJavaClass()); return className; } /** * Create a new auxillary class extending NodeSortRecord. */ private static String compileSortRecord(Vector sortObjects, ClassGenerator classGen, MethodGenerator methodGen) { final XSLTC xsltc = ((Sort)sortObjects.firstElement()).getXSLTC(); final String className = xsltc.getHelperClassName(); // This generates a new class for handling this specific sort final NodeSortRecordGenerator sortRecord = new NodeSortRecordGenerator(className, NODE_SORT_RECORD, "sort$0.java", ACC_PUBLIC | ACC_SUPER | ACC_FINAL, new String[] {}, classGen.getStylesheet()); final ConstantPoolGen cpg = sortRecord.getConstantPool(); // Add a new instance variable for each var in closure final int nsorts = sortObjects.size(); final ArrayList dups = new ArrayList(); for (int j = 0; j < nsorts; j++) { final Sort sort = (Sort) sortObjects.get(j); // Set the name of the inner class in this sort object sort.setInnerClassName(className); final int length = (sort._closureVars == null) ? 0 : sort._closureVars.size(); for (int i = 0; i < length; i++) { final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i); // Discard duplicate variable references if (dups.contains(varRef)) continue; final VariableBase var = varRef.getVariable(); sortRecord.addField(new Field(ACC_PUBLIC, cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool())); dups.add(varRef); } } MethodGenerator init = compileInit(sortObjects, sortRecord, cpg, className); MethodGenerator extract = compileExtract(sortObjects, sortRecord, cpg, className); sortRecord.addMethod(init); sortRecord.addMethod(extract); xsltc.dumpClass(sortRecord.getJavaClass()); return className; } /** * Create a constructor for the new class. Updates the reference to the * collator in the super calls only when the stylesheet specifies a new * language in xsl:sort. */ private static MethodGenerator compileInit(Vector sortObjects, NodeSortRecordGenerator sortRecord, ConstantPoolGen cpg, String className) { final InstructionList il = new InstructionList(); final MethodGenerator init = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, null, null, "", className, il, cpg); // Call the constructor in the NodeSortRecord superclass il.append(ALOAD_0); il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD, "", "()V"))); il.append(RETURN); return init; } /** * Compiles a method that overloads NodeSortRecord.extractValueFromDOM() */ private static MethodGenerator compileExtract(Vector sortObjects, NodeSortRecordGenerator sortRecord, ConstantPoolGen cpg, String className) { final InstructionList il = new InstructionList(); // String NodeSortRecord.extractValueFromDOM(dom,node,level); final CompareGenerator extractMethod = new CompareGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.STRING, new org.apache.bcel.generic.Type[] { Util.getJCRefType(DOM_INTF_SIG), org.apache.bcel.generic.Type.INT, org.apache.bcel.generic.Type.INT, Util.getJCRefType(TRANSLET_SIG), org.apache.bcel.generic.Type.INT }, new String[] { "dom", "current", "level", "translet", "last" }, "extractValueFromDOM", className, il, cpg); // Values needed for the switch statement final int levels = sortObjects.size(); final int match[] = new int[levels]; final InstructionHandle target[] = new InstructionHandle[levels]; InstructionHandle tblswitch = null; // Compile switch statement only if the key has multiple levels if (levels > 1) { // Put the parameter to the swtich statement on the stack il.append(new ILOAD(extractMethod.getLocalIndex("level"))); // Append the switch statement here later on tblswitch = il.append(new NOP()); } // Append all the cases for the switch statment for (int level = 0; level < levels; level++) { match[level] = level; final Sort sort = (Sort)sortObjects.elementAt(level); target[level] = il.append(NOP); sort.translateSelect(sortRecord, extractMethod); il.append(ARETURN); } // Compile def. target for switch statement if key has multiple levels if (levels > 1) { // Append the default target - it will _NEVER_ be reached InstructionHandle defaultTarget = il.append(new PUSH(cpg, EMPTYSTRING)); il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget)); il.append(ARETURN); } return extractMethod; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/sym.java0000644000175000017500000000472610721374033023635 0ustar mkochmkoch //---------------------------------------------------- // The following code was generated by CUP v0.10k // Thu Nov 22 16:41:50 EST 2007 //---------------------------------------------------- package org.apache.xalan.xsltc.compiler; /** CUP generated class containing symbol constants. */ public class sym { /* terminals */ public static final int MULT = 26; public static final int Literal = 27; public static final int GE = 21; public static final int NAMESPACE = 49; public static final int SLASH = 2; public static final int PI = 36; public static final int COMMENT = 35; public static final int PIPARAM = 37; public static final int FOLLOWINGSIBLING = 48; public static final int ATSIGN = 12; public static final int DSLASH = 15; public static final int LPAREN = 7; public static final int EXPRESSION = 54; public static final int INT = 52; public static final int CHILD = 41; public static final int MINUS = 23; public static final int STAR = 9; public static final int DESCENDANTORSELF = 46; public static final int RPAREN = 8; public static final int AND = 34; public static final int LT = 18; public static final int OR = 33; public static final int COMMA = 10; public static final int DDOT = 13; public static final int DIV = 24; public static final int PLUS = 22; public static final int DOT = 3; public static final int ID = 29; public static final int LE = 20; public static final int QNAME = 28; public static final int DESCENDANT = 45; public static final int PRECEDINGSIBLING = 38; public static final int EOF = 0; public static final int error = 1; public static final int SELF = 39; public static final int VBAR = 6; public static final int MOD = 25; public static final int ANCESTORORSELF = 44; public static final int PRECEDING = 50; public static final int EQ = 16; public static final int PATTERN = 53; public static final int LBRACK = 4; public static final int REAL = 51; public static final int ANCESTOR = 43; public static final int RBRACK = 5; public static final int DCOLON = 14; public static final int DOLLAR = 11; public static final int NE = 17; public static final int PARENT = 40; public static final int FOLLOWING = 47; public static final int KEY = 30; public static final int TEXT = 31; public static final int ATTRIBUTE = 42; public static final int GT = 19; public static final int NODE = 32; } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/If.java0000644000175000017500000000724710721374033023364 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: If.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class If extends Instruction { private Expression _test; private boolean _ignore = false; /** * Display the contents of this element */ public void display(int indent) { indent(indent); Util.println("If"); indent(indent + IndentIncrement); System.out.print("test "); Util.println(_test.toString()); displayContents(indent + IndentIncrement); } /** * Parse the "test" expression and contents of this element. */ public void parseContents(Parser parser) { // Parse the "test" expression _test = parser.parseExpression(this, "test", null); // Make sure required attribute(s) have been set if (_test.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "test"); return; } // Ignore xsl:if when test is false (function-available() and // element-available()) Object result = _test.evaluateAtCompileTime(); if (result != null && result instanceof Boolean) { _ignore = !((Boolean) result).booleanValue(); } parseChildren(parser); } /** * Type-check the "test" expression and contents of this element. * The contents will be ignored if we know the test will always fail. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type-check the "test" expression if (_test.typeCheck(stable) instanceof BooleanType == false) { _test = new CastExpr(_test, Type.Boolean); } // Type check the element contents if (!_ignore) { typeCheckContents(stable); } return Type.Void; } /** * Translate the "test" expression and contents of this element. * The contents will be ignored if we know the test will always fail. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _test.translateDesynthesized(classGen, methodGen); // remember end of condition final InstructionHandle truec = il.getEnd(); if (!_ignore) { translateContents(classGen, methodGen); } _test.backPatchFalseList(il.append(NOP)); _test.backPatchTrueList(truec.getNext()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/IdKeyPattern.java0000644000175000017500000000772410721374032025370 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IdKeyPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFNE; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ abstract class IdKeyPattern extends LocationPathPattern { protected RelativePathPattern _left = null;; private String _index = null; private String _value = null;; public IdKeyPattern(String index, String value) { _index = index; _value = value; } public String getIndexName() { return(_index); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.NodeSet; } public boolean isWildcard() { return false; } public void setLeft(RelativePathPattern left) { _left = left; } public StepPattern getKernelPattern() { return(null); } public void reduceKernelPattern() { } public String toString() { return "id/keyPattern(" + _index + ", " + _value + ')'; } /** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Returns the KeyIndex object of a given name final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS, "getKeyIndex", "(Ljava/lang/String;)"+ KEY_INDEX_SIG); // Initialises a KeyIndex to return nodes with specific values final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS, "containsID", "(ILjava/lang/Object;)I"); final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS, "containsKey", "(ILjava/lang/Object;)I"); final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF, "getNodeIdent", "(I)"+NODE_SIG); // Call getKeyIndex in AbstractTranslet with the name of the key // to get the index for this key (which is also a node iterator). il.append(classGen.loadTranslet()); il.append(new PUSH(cpg,_index)); il.append(new INVOKEVIRTUAL(getKeyIndex)); // Now use the value in the second argument to determine what nodes // the iterator should return. il.append(SWAP); il.append(new PUSH(cpg,_value)); if (this instanceof IdPattern) { il.append(new INVOKEVIRTUAL(lookupId)); } else { il.append(new INVOKEVIRTUAL(lookupKey)); } _trueList.add(il.append(new IFNE(null))); _falseList.add(il.append(new GOTO(null))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/IntExpr.java0000644000175000017500000000363210721374032024410 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class IntExpr extends Expression { private final int _value; public IntExpr(int value) { _value = value; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return _type = Type.Int; } public String toString() { return "int-expr(" + _value + ')'; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ParentLocationPath.java0000644000175000017500000002051410721374032026554 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ParentLocationPath.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ParentLocationPath extends RelativeLocationPath { private Expression _step; private final RelativeLocationPath _path; private Type stype; private boolean _orderNodes = false; private boolean _axisMismatch = false; public ParentLocationPath(RelativeLocationPath path, Expression step) { _path = path; _step = step; _path.setParent(this); _step.setParent(this); if (_step instanceof Step) { _axisMismatch = checkAxisMismatch(); } } public void setAxis(int axis) { _path.setAxis(axis); } public int getAxis() { return _path.getAxis(); } public RelativeLocationPath getPath() { return(_path); } public Expression getStep() { return(_step); } public void setParser(Parser parser) { super.setParser(parser); _step.setParser(parser); _path.setParser(parser); } public String toString() { return "ParentLocationPath(" + _path + ", " + _step + ')'; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { stype = _step.typeCheck(stable); _path.typeCheck(stable); if (_axisMismatch) enableNodeOrdering(); return _type = Type.NodeSet; } public void enableNodeOrdering() { SyntaxTreeNode parent = getParent(); if (parent instanceof ParentLocationPath) ((ParentLocationPath)parent).enableNodeOrdering(); else { _orderNodes = true; } } /** * This method is used to determine if this parent location path is a * combination of two step's with axes that will create duplicate or * unordered nodes. */ public boolean checkAxisMismatch() { int left = _path.getAxis(); int right = ((Step)_step).getAxis(); if (((left == Axis.ANCESTOR) || (left == Axis.ANCESTORORSELF)) && ((right == Axis.CHILD) || (right == Axis.DESCENDANT) || (right == Axis.DESCENDANTORSELF) || (right == Axis.PARENT) || (right == Axis.PRECEDING) || (right == Axis.PRECEDINGSIBLING))) return true; if ((left == Axis.CHILD) && (right == Axis.ANCESTOR) || (right == Axis.ANCESTORORSELF) || (right == Axis.PARENT) || (right == Axis.PRECEDING)) return true; if ((left == Axis.DESCENDANT) || (left == Axis.DESCENDANTORSELF)) return true; if (((left == Axis.FOLLOWING) || (left == Axis.FOLLOWINGSIBLING)) && ((right == Axis.FOLLOWING) || (right == Axis.PARENT) || (right == Axis.PRECEDING) || (right == Axis.PRECEDINGSIBLING))) return true; if (((left == Axis.PRECEDING) || (left == Axis.PRECEDINGSIBLING)) && ((right == Axis.DESCENDANT) || (right == Axis.DESCENDANTORSELF) || (right == Axis.FOLLOWING) || (right == Axis.FOLLOWINGSIBLING) || (right == Axis.PARENT) || (right == Axis.PRECEDING) || (right == Axis.PRECEDINGSIBLING))) return true; if ((right == Axis.FOLLOWING) && (left == Axis.CHILD)) { // Special case for '@*/following::*' expressions. The resulting // iterator is initialised with the parent's first child, and this // can cause duplicates in the output if the parent has more than // one attribute that matches the left step. if (_path instanceof Step) { int type = ((Step)_path).getNodeType(); if (type == DTM.ATTRIBUTE_NODE) return true; } } return false; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. // Compile path iterator _path.translate(classGen, methodGen); // iterator on stack.... LocalVariableGen pathTemp = methodGen.addLocalVariable("parent_location_path_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex()))); _step.translate(classGen, methodGen); LocalVariableGen stepTemp = methodGen.addLocalVariable("parent_location_path_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); stepTemp.setStart(il.append(new ASTORE(stepTemp.getIndex()))); // Create new StepIterator final int initSI = cpg.addMethodref(STEP_ITERATOR_CLASS, "", "(" +NODE_ITERATOR_SIG +NODE_ITERATOR_SIG +")V"); il.append(new NEW(cpg.addClass(STEP_ITERATOR_CLASS))); il.append(DUP); pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex()))); stepTemp.setEnd(il.append(new ALOAD(stepTemp.getIndex()))); // Initialize StepIterator with iterators from the stack il.append(new INVOKESPECIAL(initSI)); // This is a special case for the //* path with or without predicates Expression stp = _step; if (stp instanceof ParentLocationPath) stp = ((ParentLocationPath)stp).getStep(); if ((_path instanceof Step) && (stp instanceof Step)) { final int path = ((Step)_path).getAxis(); final int step = ((Step)stp).getAxis(); if ((path == Axis.DESCENDANTORSELF && step == Axis.CHILD) || (path == Axis.PRECEDING && step == Axis.PARENT)) { final int incl = cpg.addMethodref(NODE_ITERATOR_BASE, "includeSelf", "()" + NODE_ITERATOR_SIG); il.append(new INVOKEVIRTUAL(incl)); } } /* * If this pattern contains a sequence of descendant iterators we * run the risk of returning the same node several times. We put * a new iterator on top of the existing one to assure node order * and prevent returning a single node multiple times. */ if (_orderNodes) { final int order = cpg.addInterfaceMethodref(DOM_INTF, ORDER_ITERATOR, ORDER_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(methodGen.loadContextNode()); il.append(new INVOKEINTERFACE(order, 3)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FunctionAvailableCall.java0000644000175000017500000001424710721374032027205 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionAvailableCall.java 469266 2006-10-30 20:48:05Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author G. Todd Miller * @author Santiago Pericas-Geertsen */ final class FunctionAvailableCall extends FunctionCall { private Expression _arg; private String _nameOfFunct = null; private String _namespaceOfFunct = null; private boolean _isFunctionAvailable = false; /** * Constructs a FunctionAvailableCall FunctionCall. Takes the * function name qname, for example, 'function-available', and * a list of arguments where the arguments must be instances of * LiteralExpression. */ public FunctionAvailableCall(QName fname, Vector arguments) { super(fname, arguments); _arg = (Expression)arguments.elementAt(0); _type = null; if (_arg instanceof LiteralExpr) { LiteralExpr arg = (LiteralExpr) _arg; _namespaceOfFunct = arg.getNamespace(); _nameOfFunct = arg.getValue(); if (!isInternalNamespace()) { _isFunctionAvailable = hasMethods(); } } } /** * Argument of function-available call must be literal, typecheck * returns the type of function-available to be boolean. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_type != null) { return _type; } if (_arg instanceof LiteralExpr) { return _type = Type.Boolean; } ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR, "function-available", this); throw new TypeCheckError(err); } /** * Returns an object representing the compile-time evaluation * of an expression. We are only using this for function-available * and element-available at this time. */ public Object evaluateAtCompileTime() { return getResult() ? Boolean.TRUE : Boolean.FALSE; } /** * for external java functions only: reports on whether or not * the specified method is found in the specifed class. */ private boolean hasMethods() { // Get the class name from the namespace uri String className = getClassNameFromUri(_namespaceOfFunct); // Get the method name from the argument to function-available String methodName = null; int colonIndex = _nameOfFunct.indexOf(":"); if (colonIndex > 0) { String functionName = _nameOfFunct.substring(colonIndex+1); int lastDotIndex = functionName.lastIndexOf('.'); if (lastDotIndex > 0) { methodName = functionName.substring(lastDotIndex+1); if (className != null && !className.equals("")) className = className + "." + functionName.substring(0, lastDotIndex); else className = functionName.substring(0, lastDotIndex); } else methodName = functionName; } else methodName = _nameOfFunct; if (className == null || methodName == null) { return false; } // Replace the '-' characters in the method name if (methodName.indexOf('-') > 0) methodName = replaceDash(methodName); try { final Class clazz = ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); if (clazz == null) { return false; } final Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { final int mods = methods[i].getModifiers(); if (Modifier.isPublic(mods) && Modifier.isStatic(mods) && methods[i].getName().equals(methodName)) { return true; } } } catch (ClassNotFoundException e) { return false; } return false; } /** * Reports on whether the function specified in the argument to * xslt function 'function-available' was found. */ public boolean getResult() { if (_nameOfFunct == null) { return false; } if (isInternalNamespace()) { final Parser parser = getParser(); _isFunctionAvailable = parser.functionSupported(Util.getLocalName(_nameOfFunct)); } return _isFunctionAvailable; } /** * Return true if the namespace uri is null or it is the XSLTC translet uri. */ private boolean isInternalNamespace() { return (_namespaceOfFunct == null || _namespaceOfFunct.equals(EMPTYSTRING) || _namespaceOfFunct.equals(TRANSLET_URI)); } /** * Calls to 'function-available' are resolved at compile time since * the namespaces declared in the stylsheet are not available at run * time. Consequently, arguments to this function must be literals. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); methodGen.getInstructionList().append(new PUSH(cpg, getResult())); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/RoundCall.java0000644000175000017500000000361310721374031024700 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RoundCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class RoundCall extends FunctionCall { public RoundCall(QName fname, Vector arguments) { super(fname, arguments); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Get two copies of the argument on the stack argument().translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "roundF", "(D)D"))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/SimpleAttributeValue.java0000644000175000017500000000501310721374031027123 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SimpleAttributeValue.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class SimpleAttributeValue extends AttributeValue { private String _value; // The attributes value (literate string). /** * Creates a new simple attribute value. * @param value the attribute value. */ public SimpleAttributeValue(String value) { _value = value; } /** * Returns this attribute value's type (String). * @param stable The compiler/parser's symbol table */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return _type = Type.String; } public String toString() { return _value; } protected boolean contextDependent() { return false; } /** * Translate this attribute value into JVM bytecodes that pushes the * attribute value onto the JVM's stack. * @param classGen BCEL Java class generator * @param methodGen BCEL Java method generator */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/KeyCall.java0000644000175000017500000002100710721374032024337 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyCall.java 476471 2006-11-18 08:36:27Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFGT; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */ final class KeyCall extends FunctionCall { /** * The name of the key. */ private Expression _name; /** * The value to look up in the key/index. */ private Expression _value; /** * The value's data type. */ private Type _valueType; // The value's data type /** * Expanded qname when name is literal. */ private QName _resolvedQName = null; /** * Get the parameters passed to function: * key(String name, String value) * key(String name, NodeSet value) * The 'arguments' vector should contain two parameters for key() calls, * one holding the key name and one holding the value(s) to look up. The * vector has only one parameter for id() calls (the key name is always * "##id" for id() calls). * * @param fname The function name (should be 'key' or 'id') * @param arguments A vector containing the arguments the the function */ public KeyCall(QName fname, Vector arguments) { super(fname, arguments); switch(argumentCount()) { case 1: _name = null; _value = argument(0); break; case 2: _name = argument(0); _value = argument(1); break; default: _name = _value = null; break; } } /** * If this call to key() is in a top-level element like another variable * or param, add a dependency between that top-level element and the * referenced key. For example, * * * * * and assuming this class represents "key('x', 1)", add a reference * between variable y and key x. Note that if 'x' is unknown statically * in key('x', 1), there's nothing we can do at this point. */ public void addParentDependency() { // If name unknown statically, there's nothing we can do if (_resolvedQName == null) return; SyntaxTreeNode node = this; while (node != null && node instanceof TopLevelElement == false) { node = node.getParent(); } TopLevelElement parent = (TopLevelElement) node; if (parent != null) { parent.addDependency(getSymbolTable().getKey(_resolvedQName)); } } /** * Type check the parameters for the id() or key() function. * The index name (for key() call only) must be a string or convertable * to a string, and the lookup-value must be a string or a node-set. * @param stable The parser's symbol table * @throws TypeCheckError When the parameters have illegal type */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type returnType = super.typeCheck(stable); // Run type check on the key name (first argument) - must be a string, // and if it is not it must be converted to one using string() rules. if (_name != null) { final Type nameType = _name.typeCheck(stable); if (_name instanceof LiteralExpr) { final LiteralExpr literal = (LiteralExpr) _name; _resolvedQName = getParser().getQNameIgnoreDefaultNs(literal.getValue()); } else if (nameType instanceof StringType == false) { _name = new CastExpr(_name, Type.String); } } // Run type check on the value for this key. This value can be of // any data type, so this should never cause any type-check errors. // If the value is a reference, then we have to defer the decision // of how to process it until run-time. // If the value is known not to be a node-set, then it should be // converted to a string before the lookup is done. If the value is // known to be a node-set then this process (convert to string, then // do lookup) should be applied to every node in the set, and the // result from all lookups should be added to the resulting node-set. _valueType = _value.typeCheck(stable); if (_valueType != Type.NodeSet && _valueType != Type.Reference && _valueType != Type.String) { _value = new CastExpr(_value, Type.String); _valueType = _value.typeCheck(stable); } // If in a top-level element, create dependency to the referenced key addParentDependency(); return returnType; } /** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. *

        This method will generate byte code that produces an iterator * for the nodes in the node set for the key or id function call. * @param classGen The Java class generator * @param methodGen The method generator */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Returns the KeyIndex object of a given name final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS, "getKeyIndex", "(Ljava/lang/String;)"+ KEY_INDEX_SIG); // KeyIndex.setDom(Dom) => void final int keyDom = cpg.addMethodref(KEY_INDEX_CLASS, "setDom", "("+DOM_INTF_SIG+")V"); // Initialises a KeyIndex to return nodes with specific values final int getKeyIterator = cpg.addMethodref(KEY_INDEX_CLASS, "getKeyIndexIterator", "(" + _valueType.toSignature() + "Z)" + KEY_INDEX_ITERATOR_SIG); // Initialise the index specified in the first parameter of key() il.append(classGen.loadTranslet()); if (_name == null) { il.append(new PUSH(cpg,"##id")); } else if (_resolvedQName != null) { il.append(new PUSH(cpg, _resolvedQName.toString())); } else { _name.translate(classGen, methodGen); } // Generate following byte code: // // KeyIndex ki = translet.getKeyIndex(_name) // ki.setDom(translet.dom); // ki.getKeyIndexIterator(_value, true) - for key() // OR // ki.getKeyIndexIterator(_value, false) - for id() il.append(new INVOKEVIRTUAL(getKeyIndex)); il.append(DUP); il.append(methodGen.loadDOM()); il.append(new INVOKEVIRTUAL(keyDom)); _value.translate(classGen, methodGen); il.append((_name != null) ? ICONST_1: ICONST_0); il.append(new INVOKEVIRTUAL(getKeyIterator)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/WithParam.java0000644000175000017500000001540510721374032024714 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WithParam.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author John Howard */ final class WithParam extends Instruction { /** * Parameter's name. */ private QName _name; /** * The escaped qname of the with-param. */ protected String _escapedName; /** * Parameter's default value. */ private Expression _select; /** * %OPT% This is set to true when the WithParam is used in a CallTemplate * for a simple named template. If this is true, the parameters are * passed to the named template through method arguments rather than * using the expensive Translet.addParameter() call. */ private boolean _doParameterOptimization = false; /** * Displays the contents of this element */ public void display(int indent) { indent(indent); Util.println("with-param " + _name); if (_select != null) { indent(indent + IndentIncrement); Util.println("select " + _select.toString()); } displayContents(indent + IndentIncrement); } /** * Returns the escaped qname of the parameter */ public String getEscapedName() { return _escapedName; } /** * Return the name of this WithParam. */ public QName getName() { return _name; } /** * Set the name of the variable or paremeter. Escape all special chars. */ public void setName(QName name) { _name = name; _escapedName = Util.escape(name.getStringRep()); } /** * Set the do parameter optimization flag */ public void setDoParameterOptimization(boolean flag) { _doParameterOptimization = flag; } /** * The contents of a elements are either in the element's * 'select' attribute (this has precedence) or in the element body. */ public void parseContents(Parser parser) { final String name = getAttribute("name"); if (name.length() > 0) { if (!XML11Char.isXML11ValidQName(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } setName(parser.getQNameIgnoreDefaultNs(name)); } else { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name"); } final String select = getAttribute("select"); if (select.length() > 0) { _select = parser.parseExpression(this, "select", null); } parseChildren(parser); } /** * Type-check either the select attribute or the element body, depending * on which is in use. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_select != null) { final Type tselect = _select.typeCheck(stable); if (tselect instanceof ReferenceType == false) { _select = new CastExpr(_select, Type.Reference); } } else { typeCheckContents(stable); } return Type.Void; } /** * Compile the value of the parameter, which is either in an expression in * a 'select' attribute, or in the with-param element's body */ public void translateValue(ClassGenerator classGen, MethodGenerator methodGen) { // Compile expression is 'select' attribute if present if (_select != null) { _select.translate(classGen, methodGen); _select.startIterator(classGen, methodGen); } // If not, compile result tree from parameter body if present. else if (hasContents()) { compileResultTree(classGen, methodGen); } // If neither are present then store empty string in parameter slot else { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, Constants.EMPTYSTRING)); } } /** * This code generates a sequence of bytecodes that call the * addParameter() method in AbstractTranslet. The method call will add * (or update) the parameter frame with the new parameter value. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Translate the value and put it on the stack if (_doParameterOptimization) { translateValue(classGen, methodGen); return; } // Make name acceptable for use as field name in class String name = Util.escape(getEscapedName()); // Load reference to the translet (method is in AbstractTranslet) il.append(classGen.loadTranslet()); // Load the name of the parameter il.append(new PUSH(cpg, name)); // TODO: namespace ? // Generete the value of the parameter (use value in 'select' by def.) translateValue(classGen, methodGen); // Mark this parameter value is not being the default value il.append(new PUSH(cpg, false)); // Pass the parameter to the template il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, ADD_PARAMETER, ADD_PARAMETER_SIG))); il.append(POP); // cleanup stack } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FilteredAbsoluteLocationPath.java0000644000175000017500000001103110721374032030552 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilteredAbsoluteLocationPath.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author G. Todd Miller */ final class FilteredAbsoluteLocationPath extends Expression { private Expression _path; // may be null public FilteredAbsoluteLocationPath() { _path = null; } public FilteredAbsoluteLocationPath(Expression path) { _path = path; if (path != null) { _path.setParent(this); } } public void setParser(Parser parser) { super.setParser(parser); if (_path != null) { _path.setParser(parser); } } public Expression getPath() { return(_path); } public String toString() { return "FilteredAbsoluteLocationPath(" + (_path != null ? _path.toString() : "null") + ')'; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_path != null) { final Type ptype = _path.typeCheck(stable); if (ptype instanceof NodeType) { // promote to node-set _path = new CastExpr(_path, Type.NodeSet); } } return _type = Type.NodeSet; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_path != null) { final int initDFI = cpg.addMethodref(DUP_FILTERED_ITERATOR, "", "(" + NODE_ITERATOR_SIG + ")V"); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches, // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. // Compile relative path iterator(s) LocalVariableGen pathTemp = methodGen.addLocalVariable("filtered_absolute_location_path_tmp", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); _path.translate(classGen, methodGen); pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex()))); // Create new Dup Filter Iterator il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR))); il.append(DUP); pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex()))); // Initialize Dup Filter Iterator with iterator from the stack il.append(new INVOKESPECIAL(initDFI)); } else { final int git = cpg.addInterfaceMethodref(DOM_INTF, "getIterator", "()"+NODE_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(new INVOKEINTERFACE(git, 1)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NamespaceUriCall.java0000644000175000017500000000435010721374030026163 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NamespaceUriCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Morten Jorgensen */ final class NamespaceUriCall extends NameBase { /** * Handles calls with no parameter (current node is implicit parameter). */ public NamespaceUriCall(QName fname) { super(fname); } /** * Handles calls with one parameter (either node or node-set). */ public NamespaceUriCall(QName fname, Vector arguments) { super(fname, arguments); } /** * Translate code that leaves a node's namespace URI (as a String) * on the stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Returns the string value for a node in the DOM final int getNamespace = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceName", "(I)"+STRING_SIG); super.translate(classGen, methodGen); il.append(new INVOKEINTERFACE(getNamespace, 2)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Constants.java0000644000175000017500000005214710721374033025001 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Constants.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.InstructionConstants; import org.apache.xml.serializer.SerializerBase; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface Constants extends InstructionConstants { // Error categories used to report errors to Parser.reportError() // Unexpected internal errors, such as null-ptr exceptions, etc. // Immediately terminates compilation, no translet produced public final int INTERNAL = 0; // XSLT elements that are not implemented and unsupported ext. // Immediately terminates compilation, no translet produced public final int UNSUPPORTED = 1; // Fatal error in the stylesheet input (parsing or content) // Immediately terminates compilation, no translet produced public final int FATAL = 2; // Other error in the stylesheet input (parsing or content) // Does not terminate compilation, no translet produced public final int ERROR = 3; // Other error in the stylesheet input (content errors only) // Does not terminate compilation, a translet is produced public final int WARNING = 4; public static final String EMPTYSTRING = ""; public static final String NAMESPACE_FEATURE = "http://xml.org/sax/features/namespaces"; public static final String TRANSLET_INTF = "org.apache.xalan.xsltc.Translet"; public static final String TRANSLET_INTF_SIG = "Lorg/apache/xalan/xsltc/Translet;"; public static final String ATTRIBUTES_SIG = "Lorg/apache/xalan/xsltc/runtime/Attributes;"; public static final String NODE_ITERATOR_SIG = "Lorg/apache/xml/dtm/DTMAxisIterator;"; public static final String DOM_INTF_SIG = "Lorg/apache/xalan/xsltc/DOM;"; public static final String DOM_IMPL_CLASS = "org/apache/xalan/xsltc/DOM"; // xml/dtm/ref/DTMDefaultBaseIterators"; //xalan/xsltc/dom/DOMImpl"; public static final String SAX_IMPL_CLASS = "org/apache/xalan/xsltc/DOM/SAXImpl"; public static final String DOM_IMPL_SIG = "Lorg/apache/xalan/xsltc/dom/SAXImpl;"; //xml/dtm/ref/DTMDefaultBaseIterators"; //xalan/xsltc/dom/DOMImpl;"; public static final String SAX_IMPL_SIG = "Lorg/apache/xalan/xsltc/dom/SAXImpl;"; public static final String DOM_ADAPTER_CLASS = "org/apache/xalan/xsltc/dom/DOMAdapter"; public static final String DOM_ADAPTER_SIG = "Lorg/apache/xalan/xsltc/dom/DOMAdapter;"; public static final String MULTI_DOM_CLASS = "org.apache.xalan.xsltc.dom.MultiDOM"; public static final String MULTI_DOM_SIG = "Lorg/apache/xalan/xsltc/dom/MultiDOM;"; public static final String STRING = "java.lang.String"; public static final int ACC_PUBLIC = org.apache.bcel.Constants.ACC_PUBLIC; public static final int ACC_SUPER = org.apache.bcel.Constants.ACC_SUPER; public static final int ACC_FINAL = org.apache.bcel.Constants.ACC_FINAL; public static final int ACC_PRIVATE = org.apache.bcel.Constants.ACC_PRIVATE; public static final int ACC_PROTECTED = org.apache.bcel.Constants.ACC_PROTECTED; public static final int ACC_STATIC = org.apache.bcel.Constants.ACC_STATIC; public static final String STRING_SIG = "Ljava/lang/String;"; public static final String STRING_BUFFER_SIG = "Ljava/lang/StringBuffer;"; public static final String OBJECT_SIG = "Ljava/lang/Object;"; public static final String DOUBLE_SIG = "Ljava/lang/Double;"; public static final String INTEGER_SIG = "Ljava/lang/Integer;"; public static final String COLLATOR_CLASS = "java/text/Collator"; public static final String COLLATOR_SIG = "Ljava/text/Collator;"; public static final String NODE = "int"; public static final String NODE_ITERATOR = "org.apache.xml.dtm.DTMAxisIterator"; public static final String NODE_ITERATOR_BASE = "org.apache.xml.dtm.ref.DTMAxisIteratorBase"; public static final String SORT_ITERATOR = "org.apache.xalan.xsltc.dom.SortingIterator"; public static final String SORT_ITERATOR_SIG = "Lorg.apache.xalan.xsltc.dom.SortingIterator;"; public static final String NODE_SORT_RECORD = "org.apache.xalan.xsltc.dom.NodeSortRecord"; public static final String NODE_SORT_FACTORY = "org/apache/xalan/xsltc/dom/NodeSortRecordFactory"; public static final String NODE_SORT_RECORD_SIG = "Lorg/apache/xalan/xsltc/dom/NodeSortRecord;"; public static final String NODE_SORT_FACTORY_SIG = "Lorg/apache/xalan/xsltc/dom/NodeSortRecordFactory;"; public static final String LOCALE_CLASS = "java.util.Locale"; public static final String LOCALE_SIG = "Ljava/util/Locale;"; public static final String STRING_VALUE_HANDLER = "org.apache.xalan.xsltc.runtime.StringValueHandler"; public static final String STRING_VALUE_HANDLER_SIG = "Lorg/apache/xalan/xsltc/runtime/StringValueHandler;"; public static final String OUTPUT_HANDLER = SerializerBase.PKG_PATH+"/SerializationHandler"; public static final String OUTPUT_HANDLER_SIG = "L"+SerializerBase.PKG_PATH+"/SerializationHandler;"; public static final String FILTER_INTERFACE = "org.apache.xalan.xsltc.dom.Filter"; public static final String FILTER_INTERFACE_SIG = "Lorg/apache/xalan/xsltc/dom/Filter;"; public static final String UNION_ITERATOR_CLASS = "org.apache.xalan.xsltc.dom.UnionIterator"; public static final String STEP_ITERATOR_CLASS = "org.apache.xalan.xsltc.dom.StepIterator"; public static final String CACHED_NODE_LIST_ITERATOR_CLASS = "org.apache.xalan.xsltc.dom.CachedNodeListIterator"; public static final String NTH_ITERATOR_CLASS = "org.apache.xalan.xsltc.dom.NthIterator"; public static final String ABSOLUTE_ITERATOR = "org.apache.xalan.xsltc.dom.AbsoluteIterator"; public static final String DUP_FILTERED_ITERATOR = "org.apache.xalan.xsltc.dom.DupFilterIterator"; public static final String CURRENT_NODE_LIST_ITERATOR = "org.apache.xalan.xsltc.dom.CurrentNodeListIterator"; public static final String CURRENT_NODE_LIST_FILTER = "org.apache.xalan.xsltc.dom.CurrentNodeListFilter"; public static final String CURRENT_NODE_LIST_ITERATOR_SIG = "Lorg/apache/xalan/xsltc/dom/CurrentNodeListIterator;"; public static final String CURRENT_NODE_LIST_FILTER_SIG = "Lorg/apache/xalan/xsltc/dom/CurrentNodeListFilter;"; public static final String FILTER_STEP_ITERATOR = "org.apache.xalan.xsltc.dom.FilteredStepIterator"; public static final String FILTER_ITERATOR = "org.apache.xalan.xsltc.dom.FilterIterator"; public static final String SINGLETON_ITERATOR = "org.apache.xalan.xsltc.dom.SingletonIterator"; public static final String MATCHING_ITERATOR = "org.apache.xalan.xsltc.dom.MatchingIterator"; public static final String NODE_SIG = "I"; public static final String GET_PARENT = "getParent"; public static final String GET_PARENT_SIG = "(" + NODE_SIG + ")" + NODE_SIG; public static final String NEXT_SIG = "()" + NODE_SIG; public static final String NEXT = "next"; public static final String NEXTID = "nextNodeID"; public static final String MAKE_NODE = "makeNode"; public static final String MAKE_NODE_LIST = "makeNodeList"; public static final String GET_UNPARSED_ENTITY_URI = "getUnparsedEntityURI"; public static final String STRING_TO_REAL = "stringToReal"; public static final String STRING_TO_REAL_SIG = "(" + STRING_SIG + ")D"; public static final String STRING_TO_INT = "stringToInt"; public static final String STRING_TO_INT_SIG = "(" + STRING_SIG + ")I"; public static final String XSLT_PACKAGE = "org.apache.xalan.xsltc"; public static final String COMPILER_PACKAGE = XSLT_PACKAGE + ".compiler"; public static final String RUNTIME_PACKAGE = XSLT_PACKAGE + ".runtime"; public static final String TRANSLET_CLASS = RUNTIME_PACKAGE + ".AbstractTranslet"; public static final String TRANSLET_SIG = "Lorg/apache/xalan/xsltc/runtime/AbstractTranslet;"; public static final String UNION_ITERATOR_SIG = "Lorg/apache/xalan/xsltc/dom/UnionIterator;"; public static final String TRANSLET_OUTPUT_SIG = "L"+SerializerBase.PKG_PATH+"/SerializationHandler;"; public static final String MAKE_NODE_SIG = "(I)Lorg/w3c/dom/Node;"; public static final String MAKE_NODE_SIG2 = "(" + NODE_ITERATOR_SIG + ")Lorg/w3c/dom/Node;"; public static final String MAKE_NODE_LIST_SIG = "(I)Lorg/w3c/dom/NodeList;"; public static final String MAKE_NODE_LIST_SIG2 = "(" + NODE_ITERATOR_SIG + ")Lorg/w3c/dom/NodeList;"; public static final String STREAM_XML_OUTPUT = SerializerBase.PKG_NAME+".ToXMLStream"; public static final String OUTPUT_BASE = SerializerBase.PKG_NAME+".SerializerBase"; public static final String LOAD_DOCUMENT_CLASS = "org.apache.xalan.xsltc.dom.LoadDocument"; public static final String KEY_INDEX_CLASS = "org/apache/xalan/xsltc/dom/KeyIndex"; public static final String KEY_INDEX_SIG = "Lorg/apache/xalan/xsltc/dom/KeyIndex;"; public static final String KEY_INDEX_ITERATOR_SIG = "Lorg/apache/xalan/xsltc/dom/KeyIndex$KeyIndexIterator;"; public static final String DOM_INTF = "org.apache.xalan.xsltc.DOM"; public static final String DOM_IMPL = "org.apache.xalan.xsltc.dom.SAXImpl"; public static final String SAX_IMPL = "org.apache.xalan.xsltc.dom.SAXImpl"; public static final String STRING_CLASS = "java.lang.String"; public static final String OBJECT_CLASS = "java.lang.Object"; public static final String BOOLEAN_CLASS = "java.lang.Boolean"; public static final String STRING_BUFFER_CLASS = "java.lang.StringBuffer"; public static final String STRING_WRITER = "java.io.StringWriter"; public static final String WRITER_SIG = "Ljava/io/Writer;"; public static final String TRANSLET_OUTPUT_BASE = "org.apache.xalan.xsltc.TransletOutputBase"; // output interface public static final String TRANSLET_OUTPUT_INTERFACE = SerializerBase.PKG_NAME+".SerializationHandler"; public static final String BASIS_LIBRARY_CLASS = "org.apache.xalan.xsltc.runtime.BasisLibrary"; public static final String ATTRIBUTE_LIST_IMPL_CLASS = "org.apache.xalan.xsltc.runtime.AttributeListImpl"; public static final String DOUBLE_CLASS = "java.lang.Double"; public static final String INTEGER_CLASS = "java.lang.Integer"; public static final String RUNTIME_NODE_CLASS = "org.apache.xalan.xsltc.runtime.Node"; public static final String MATH_CLASS = "java.lang.Math"; public static final String BOOLEAN_VALUE = "booleanValue"; public static final String BOOLEAN_VALUE_SIG = "()Z"; public static final String INT_VALUE = "intValue"; public static final String INT_VALUE_SIG = "()I"; public static final String DOUBLE_VALUE = "doubleValue"; public static final String DOUBLE_VALUE_SIG = "()D"; public static final String DOM_PNAME = "dom"; public static final String NODE_PNAME = "node"; public static final String TRANSLET_OUTPUT_PNAME = "handler"; public static final String ITERATOR_PNAME = "iterator"; public static final String DOCUMENT_PNAME = "document"; public static final String TRANSLET_PNAME = "translet"; public static final String INVOKE_METHOD = "invokeMethod"; public static final String GET_NODE_NAME = "getNodeNameX"; public static final String CHARACTERSW = "characters"; public static final String GET_CHILDREN = "getChildren"; public static final String GET_TYPED_CHILDREN = "getTypedChildren"; public static final String CHARACTERS = "characters"; public static final String APPLY_TEMPLATES = "applyTemplates"; public static final String GET_NODE_TYPE = "getNodeType"; public static final String GET_NODE_VALUE = "getStringValueX"; public static final String GET_ELEMENT_VALUE = "getElementValue"; public static final String GET_ATTRIBUTE_VALUE = "getAttributeValue"; public static final String HAS_ATTRIBUTE = "hasAttribute"; public static final String ADD_ITERATOR = "addIterator"; public static final String SET_START_NODE = "setStartNode"; public static final String RESET = "reset"; public static final String ATTR_SET_SIG = "(" + DOM_INTF_SIG + NODE_ITERATOR_SIG + TRANSLET_OUTPUT_SIG + ")V"; public static final String GET_NODE_NAME_SIG = "(" + NODE_SIG + ")" + STRING_SIG; public static final String CHARACTERSW_SIG = "(" + STRING_SIG + TRANSLET_OUTPUT_SIG + ")V"; public static final String CHARACTERS_SIG = "(" + NODE_SIG + TRANSLET_OUTPUT_SIG + ")V"; public static final String GET_CHILDREN_SIG = "(" + NODE_SIG +")" + NODE_ITERATOR_SIG; public static final String GET_TYPED_CHILDREN_SIG = "(I)" + NODE_ITERATOR_SIG; public static final String GET_NODE_TYPE_SIG = "()S"; public static final String GET_NODE_VALUE_SIG = "(I)" + STRING_SIG; public static final String GET_ELEMENT_VALUE_SIG = "(I)" + STRING_SIG; public static final String GET_ATTRIBUTE_VALUE_SIG = "(II)" + STRING_SIG; public static final String HAS_ATTRIBUTE_SIG = "(II)Z"; public static final String GET_ITERATOR_SIG = "()" + NODE_ITERATOR_SIG; public static final String NAMES_INDEX = "namesArray"; public static final String NAMES_INDEX_SIG = "[" + STRING_SIG; public static final String URIS_INDEX = "urisArray"; public static final String URIS_INDEX_SIG = "[" + STRING_SIG; public static final String TYPES_INDEX = "typesArray"; public static final String TYPES_INDEX_SIG = "[I"; public static final String NAMESPACE_INDEX = "namespaceArray"; public static final String NAMESPACE_INDEX_SIG = "[" + STRING_SIG; public static final String NS_ANCESTORS_INDEX_SIG = "[I"; public static final String PREFIX_URIS_IDX_SIG = "[I"; public static final String PREFIX_URIS_ARRAY_SIG = "[" + STRING_SIG; public static final String HASIDCALL_INDEX = "_hasIdCall"; public static final String HASIDCALL_INDEX_SIG = "Z"; public static final String TRANSLET_VERSION_INDEX = "transletVersion"; public static final String TRANSLET_VERSION_INDEX_SIG = "I"; public static final String LOOKUP_STYLESHEET_QNAME_NS_REF = "lookupStylesheetQNameNamespace"; public static final String LOOKUP_STYLESHEET_QNAME_NS_SIG = "(" + STRING_SIG + "I" + NS_ANCESTORS_INDEX_SIG + PREFIX_URIS_IDX_SIG + PREFIX_URIS_ARRAY_SIG + "Z)" + STRING_SIG; public static final String EXPAND_STYLESHEET_QNAME_REF = "expandStylesheetQNameRef"; public static final String EXPAND_STYLESHEET_QNAME_SIG = "(" + STRING_SIG + "I" + NS_ANCESTORS_INDEX_SIG + PREFIX_URIS_IDX_SIG + PREFIX_URIS_ARRAY_SIG + "Z)" + STRING_SIG; public static final String DOM_FIELD = "_dom"; public static final String STATIC_NAMES_ARRAY_FIELD = "_sNamesArray"; public static final String STATIC_URIS_ARRAY_FIELD = "_sUrisArray"; public static final String STATIC_TYPES_ARRAY_FIELD = "_sTypesArray"; public static final String STATIC_NAMESPACE_ARRAY_FIELD = "_sNamespaceArray"; public static final String STATIC_NS_ANCESTORS_ARRAY_FIELD = "_sNamespaceAncestorsArray"; public static final String STATIC_PREFIX_URIS_IDX_ARRAY_FIELD = "_sPrefixURIsIdxArray"; public static final String STATIC_PREFIX_URIS_ARRAY_FIELD = "_sPrefixURIPairsArray"; public static final String STATIC_CHAR_DATA_FIELD = "_scharData"; public static final String STATIC_CHAR_DATA_FIELD_SIG = "[C"; public static final String FORMAT_SYMBOLS_FIELD = "format_symbols"; public static final String ITERATOR_FIELD_SIG = NODE_ITERATOR_SIG; public static final String NODE_FIELD = "node"; public static final String NODE_FIELD_SIG = "I"; public static final String EMPTYATTR_FIELD = "EmptyAttributes"; public static final String ATTRIBUTE_LIST_FIELD = "attributeList"; public static final String CLEAR_ATTRIBUTES = "clear"; public static final String ADD_ATTRIBUTE = "addAttribute"; public static final String ATTRIBUTE_LIST_IMPL_SIG = "Lorg/apache/xalan/xsltc/runtime/AttributeListImpl;"; public static final String CLEAR_ATTRIBUTES_SIG = "()" + ATTRIBUTE_LIST_IMPL_SIG; public static final String ADD_ATTRIBUTE_SIG = "(" + STRING_SIG + STRING_SIG + ")" + ATTRIBUTE_LIST_IMPL_SIG; public static final String ADD_ITERATOR_SIG = "(" + NODE_ITERATOR_SIG +")" + UNION_ITERATOR_SIG; public static final String ORDER_ITERATOR = "orderNodes"; public static final String ORDER_ITERATOR_SIG = "("+NODE_ITERATOR_SIG+"I)"+NODE_ITERATOR_SIG; public static final String SET_START_NODE_SIG = "(" + NODE_SIG + ")" + NODE_ITERATOR_SIG; public static final String NODE_COUNTER = "org.apache.xalan.xsltc.dom.NodeCounter"; public static final String NODE_COUNTER_SIG = "Lorg/apache/xalan/xsltc/dom/NodeCounter;"; public static final String DEFAULT_NODE_COUNTER = "org.apache.xalan.xsltc.dom.DefaultNodeCounter"; public static final String DEFAULT_NODE_COUNTER_SIG = "Lorg/apache/xalan/xsltc/dom/DefaultNodeCounter;"; public static final String TRANSLET_FIELD = "translet"; public static final String TRANSLET_FIELD_SIG = TRANSLET_SIG; public static final String RESET_SIG = "()" + NODE_ITERATOR_SIG; public static final String GET_PARAMETER = "getParameter"; public static final String ADD_PARAMETER = "addParameter"; public static final String PUSH_PARAM_FRAME = "pushParamFrame"; public static final String PUSH_PARAM_FRAME_SIG = "()V"; public static final String POP_PARAM_FRAME = "popParamFrame"; public static final String POP_PARAM_FRAME_SIG = "()V"; public static final String GET_PARAMETER_SIG = "(" + STRING_SIG + ")" + OBJECT_SIG; public static final String ADD_PARAMETER_SIG = "(" + STRING_SIG + OBJECT_SIG + "Z)" + OBJECT_SIG; public static final String STRIP_SPACE = "stripSpace"; public static final String STRIP_SPACE_INTF = "org/apache/xalan/xsltc/StripFilter"; public static final String STRIP_SPACE_SIG = "Lorg/apache/xalan/xsltc/StripFilter;"; public static final String STRIP_SPACE_PARAMS = "(Lorg/apache/xalan/xsltc/DOM;II)Z"; public static final String GET_NODE_VALUE_ITERATOR = "getNodeValueIterator"; public static final String GET_NODE_VALUE_ITERATOR_SIG = "("+NODE_ITERATOR_SIG+"I"+STRING_SIG+"Z)"+NODE_ITERATOR_SIG; public static final String GET_UNPARSED_ENTITY_URI_SIG = "("+STRING_SIG+")"+STRING_SIG; public static final int POSITION_INDEX = 2; public static final int LAST_INDEX = 3; public static final String XMLNS_PREFIX = "xmlns"; public static final String XMLNS_STRING = "xmlns:"; public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/"; public static final String XSLT_URI = "http://www.w3.org/1999/XSL/Transform"; public static final String XHTML_URI = "http://www.w3.org/1999/xhtml"; public static final String TRANSLET_URI = "http://xml.apache.org/xalan/xsltc"; public static final String REDIRECT_URI = "http://xml.apache.org/xalan/redirect"; public static final String FALLBACK_CLASS = "org.apache.xalan.xsltc.compiler.Fallback"; public static final int RTF_INITIAL_SIZE = 32; } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Comment.java0000644000175000017500000001151010721374031024412 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Comment.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Comment extends Instruction { public void parseContents(Parser parser) { parseChildren(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { typeCheckContents(stable); return Type.String; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Shortcut for literal strings Text rawText = null; if (elementCount() == 1) { Object content = elementAt(0); if (content instanceof Text) { rawText = (Text) content; } } // If the content is literal text, call comment(char[],int,int) or // comment(String), as appropriate. Otherwise, use a // StringValueHandler to gather the textual content of the xsl:comment // and call comment(String) with the result. if (rawText != null) { il.append(methodGen.loadHandler()); if (rawText.canLoadAsArrayOffsetLength()) { rawText.loadAsArrayOffsetLength(classGen, methodGen); final int comment = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "comment", "([CII)V"); il.append(new INVOKEINTERFACE(comment, 4)); } else { il.append(new PUSH(cpg, rawText.getText())); final int comment = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "comment", "(" + STRING_SIG + ")V"); il.append(new INVOKEINTERFACE(comment, 2)); } } else { // Save the current handler base on the stack il.append(methodGen.loadHandler()); il.append(DUP); // first arg to "comment" call // Get the translet's StringValueHandler il.append(classGen.loadTranslet()); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, "stringValueHandler", STRING_VALUE_HANDLER_SIG))); il.append(DUP); il.append(methodGen.storeHandler()); // translate contents with substituted handler translateContents(classGen, methodGen); // get String out of the handler il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_VALUE_HANDLER, "getValue", "()" + STRING_SIG))); // call "comment" final int comment = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "comment", "(" + STRING_SIG + ")V"); il.append(new INVOKEINTERFACE(comment, 2)); // Restore old handler base from stack il.append(methodGen.storeHandler()); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NamespaceAlias.java0000644000175000017500000000360510721374031025664 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NamespaceAlias.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class NamespaceAlias extends TopLevelElement { private String sPrefix; private String rPrefix; /* * The namespace alias definitions given here have an impact only on * literal elements and literal attributes. */ public void parseContents(Parser parser) { sPrefix = getAttribute("stylesheet-prefix"); rPrefix = getAttribute("result-prefix"); parser.getSymbolTable().addPrefixAlias(sPrefix,rPrefix); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { // do nada } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/BooleanCall.java0000644000175000017500000000362310721374031025171 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BooleanCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class BooleanCall extends FunctionCall { private Expression _arg = null; public BooleanCall(QName fname, Vector arguments) { super(fname, arguments); _arg = argument(0); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { _arg.typeCheck(stable); return _type = Type.Boolean; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { _arg.translate(classGen, methodGen); final Type targ = _arg.getType(); if (!targ.identicalTo(Type.Boolean)) { _arg.startIterator(classGen, methodGen); targ.translateTo(classGen, methodGen, Type.Boolean); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NumberCall.java0000644000175000017500000000421510721374031025040 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NumberCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class NumberCall extends FunctionCall { public NumberCall(QName fname, Vector arguments) { super(fname, arguments); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (argumentCount() > 0) { argument().typeCheck(stable); } return _type = Type.Real; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); Type targ; if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); targ = Type.Node; } else { final Expression arg = argument(); arg.translate(classGen, methodGen); arg.startIterator(classGen, methodGen); targ = arg.getType(); } if (!targ.identicalTo(Type.Real)) { targ.translateTo(classGen, methodGen, Type.Real); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LiteralExpr.java0000644000175000017500000000523310721374030025247 0ustar mkochmkoch /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LiteralExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class LiteralExpr extends Expression { private final String _value; private final String _namespace; /** * Creates a new literal expression node. * @param value the literal expression content/value. */ public LiteralExpr(String value) { _value = value; _namespace = null; } /** * Creates a new literal expression node. * @param value the literal expression content/value. * @param namespace the namespace in which the expression exists. */ public LiteralExpr(String value, String namespace) { _value = value; _namespace = namespace.equals(Constants.EMPTYSTRING) ? null : namespace; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return _type = Type.String; } public String toString() { return "literal-expr(" + _value + ')'; } protected boolean contextDependent() { return false; } protected String getValue() { return _value; } protected String getNamespace() { return _namespace; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/0000755000175000017500000000000010736146354023137 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/MarkerInstruction.java0000644000175000017500000000674410721374031027465 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xalan.xsltc.compiler.util; import java.io.DataOutputStream; import java.io.IOException; import org.apache.bcel.Constants; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.Visitor; /** * A special abstract dummy subclass of * {@link org.apache.bcel.generic.Instruction} used to mark locations of * interest in an {@link org.apache.bcel.generic.InstructionList}. It and * its subclasses are only used as placeholders, and do not contribute to the * actual byte code instruction stream. */ abstract class MarkerInstruction extends Instruction { /** * Zero-argument constructor. Sets the opcode to an invalid value and * sets the length to zero, as it will not be written as part of the * generated byte code. */ public MarkerInstruction() { super(Constants.UNDEFINED, (short) 0); } /** * {@link org.apache.bcel.generic.Visitor}s will know nothing about this * kind of {@link org.apche.bcel.generic.Instruction}, so this method does * nothing. */ public void accept(Visitor v) { } /** * The number of JVM stack entries consumed by the instruction. * This instruction is just a place holder, so it does not consume any * stack entries. * @param cpg The {@link org.apache.bcel.generic.ConstantPoolGen} for the * current {@link org.apache.bcel.generic.ClassGen} * @return 0 always */ final public int consumeStack(ConstantPoolGen cpg) { return 0; } /** * The number of JVM stack entries produced by the instruction. * This instruction is just a place holder, so it does not produce any * stack entries. * @param cpg The {@link org.apache.bcel.generic.ConstantPoolGen} for the * current {@link org.apache.bcel.generic.ClassGen} * @return 0 always */ final public int produceStack(ConstantPoolGen cpg) { return 0; } /** * Produce a copy of the instruction. By default a * {@link MarkerInstruction} has no parameters, so the base implementation * of {@link #copy()} returns the instruction itself. * @return The instruction itself. */ public Instruction copy() { return this; } /** * Dump instruction as byte code to stream out. A {@link MarkerInstruction} * has no effect on the generated byte code so it is never emitted to the * output stream. * @param out Output stream */ final public void dump(DataOutputStream out) throws IOException { } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport.java0000644000175000017500000000746610721374033027212 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/StringType.java0000644000175000017500000001652310721374033026110 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFNONNULL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public class StringType extends Type { protected StringType() {} public String toString() { return "string"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return "Ljava/lang/String;"; } public boolean isSimple() { return true; } public org.apache.bcel.generic.Type toJCType() { return org.apache.bcel.generic.Type.STRING; } /** * Translates a string into an object of internal type type. * The translation to int is undefined since strings are always converted * to reals in arithmetic expressions. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType) type); } else if (type == Type.Real) { translateTo(classGen, methodGen, (RealType) type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates a string into a synthesized boolean. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); } /** * Translates a string into a real by calling stringToReal() from the * basis library. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, STRING_TO_REAL, STRING_TO_REAL_SIG))); } /** * Translates a string into a non-synthesized boolean. It does not push a * 0 or a 1 but instead returns branchhandle list to be appended to the * false list. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "length", "()I"))); return new FlowList(il.append(new IFEQ(null))); } /** * Expects a string on the stack and pushes a boxed string. * Strings are already boxed so the translation is just a NOP. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { methodGen.getInstructionList().append(NOP); } /** * Translates a internal string into an external (Java) string. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateFrom */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { // Is String <: clazz? I.e. clazz in { String, Object } if (clazz.isAssignableFrom(java.lang.String.class)) { methodGen.getInstructionList().append(NOP); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an external (primitive) Java type into a string. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateFrom */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (clazz.getName().equals("java.lang.String")) { // same internal representation, convert null to "" il.append(DUP); final BranchHandle ifNonNull = il.append(new IFNONNULL(null)); il.append(POP); il.append(new PUSH(cpg, "")); ifNonNull.setTarget(il.append(NOP)); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { methodGen.getInstructionList().append(NOP); } /** * Returns the class name of an internal type's external representation. */ public String getClassName() { return(STRING_CLASS); } public Instruction LOAD(int slot) { return new ALOAD(slot); } public Instruction STORE(int slot) { return new ASTORE(slot); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_es.java0000644000175000017500000012061710721374033027250 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_es.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_es extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Hay m\u00e1s de una hoja de estilos definida en el mismo archivo."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "La plantilla ''{0}'' ya est\u00e1 definida en esta hoja de estilos."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "La plantilla ''{0}'' no est\u00e1 definida en esta hoja de estilos."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "La variable ''{0}'' se ha definido varias veces en el mismo \u00e1mbito."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "La variable o el par\u00e1metro ''{0}'' no est\u00e1n definidos."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "No se puede encontrar la clase ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "No se puede encontrar el m\u00e9todo externo ''{0}'' (debe ser p\u00fablico)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "No se puede convertir el argumento/tipo de devoluci\u00f3n en la llamada al m\u00e9todo ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Archivo o URI ''{0}'' no encontrado."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI ''{0}'' no v\u00e1lido."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "No se puede abrir el archivo o URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Se esperaba el elemento o ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "El prefijo ''{0}'' del espacio de nombres no est\u00e1 declarado."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "No se puede resolver la llamada a la funci\u00f3n ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "El argumento para ''{0}'' debe ser una serie literal."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Error al analizar la expresi\u00f3n ''{0}'' de XPath."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Falta el atributo necesario ''{0}''."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Car\u00e1cter ''{0}'' no permitido en expresi\u00f3n de XPath."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Nombre ''{0}'' no permitido para la instrucci\u00f3n de proceso."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Atributo ''{0}'' fuera del elemento."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Atributo ''{0}'' no permitido."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "import/include circular. Hoja de estilos ''{0}'' ya cargada."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Los fragmentos del \u00e1rbol de resultados no se pueden ordenar (elementos ignorados). Debe ordenar los nodos al crear el \u00e1rbol de resultados."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "El formato decimal ''{0}'' ya est\u00e1 definido."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "La versi\u00f3n de XSL ''{0}'' no est\u00e1 soportada por XSLTC."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Referencia de variable/par\u00e1metro circular en ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Operador desconocido para expresi\u00f3n binaria."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Argumento(s) no permitido(s) para llamada a funci\u00f3n."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "El segundo argumento de la funci\u00f3n document() debe ser un conjunto de nodos."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Se necesita al menos un elemento en ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "S\u00f3lo se permite un elemento en ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " s\u00f3lo puede utilizarse dentro de ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " s\u00f3lo puede utilizarse dentro de ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "S\u00f3lo est\u00e1n permitidos los elementos y en ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "Falta el atributo 'name' en ."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Elemento hijo no permitido."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "No puede llamar a un elemento ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "No puede llamar a un atributo ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Datos de texto fuera del elemento de nivel superior."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Analizador JAXP no configurado correctamente"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Error interno de XSLTC irrecuperable: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Elemento XSL ''{0}'' no soportado."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Extensi\u00f3n XSLTC ''{0}'' no reconocida."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "El documento de entrada no es una hoja de estilos (el espacio de nombres XSL no est\u00e1 declarado en el elemento ra\u00edz)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "No se ha podido encontrar el destino de la hoja de estilos ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "No implementado: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "El documento de entrada no contiene una hoja de estilos XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "No se ha podido analizar el elemento ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "El atributo use de debe ser node, node-set, string o number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "La versi\u00f3n del documento XML de salida deber\u00eda ser 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Operador desconocido para expresi\u00f3n relacional"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Intento de utilizar un conjunto de atributos no existente ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "No se puede analizar la plantilla de valor del atributo ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Tipo de datos desconocido en la firma de la clase ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "No se puede convertir el tipo de datos ''{0}'' a ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Templates no contiene una definici\u00f3n de clase translet v\u00e1lida."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Templates no contiene una clase con el nombre ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "No se ha podido cargar la clase translet ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Clase translet cargada, pero no es posible crear una instancia translet."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Intento de establecer ErrorListener para ''{0}'' en null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "S\u00f3lo StreamSource, SAXSource y DOMSource est\u00e1n soportadas por XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "El objeto Source pasado a ''{0}'' no tiene contenido."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "No se ha podido compilar la hoja de estilos"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory no reconoce el atributo ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() debe llamarse antes de startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer no tiene un objeto translet encapsulado."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "No se ha definido un manejador de salida para el resultado de la transformaci\u00f3n."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "El objeto Result pasado a ''{0}'' no es v\u00e1lido."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Intento de acceder a una propiedad de Transformer ''{0}'' no v\u00e1lida."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "No se ha podido crear adaptador SAX2DOMr: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() llamado sin establecer systemId."}, { ErrorMsg.ER_RESULT_NULL, "El resultado no deber\u00eda ser nulo"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "El valor del par\u00e1metro {0} debe ser un objeto Java v\u00e1lido"}, {ErrorMsg.COMPILE_STDIN_ERR, "La opci\u00f3n -i debe utilizarse con la opci\u00f3n -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SINOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPCIONES\n -o asigna el nombre al translet\n generado. De forma predeterminada, el nombre del translet\n se deriva del nombre de la . Esta opci\u00f3n\n se ignora si se compilan varias hojas de estilos.\n -d especificar un directorio de destino para el translet\n -j empaqueta las clases translet en el archivo jar del\n nombre especificado por \n -p especifica un prefijo de nombre de paquete para todas las\n clases translet generadas.\n -n habilita la inclusi\u00f3n en l\u00ednea de plantillas (comportamiento predeterminado\n mejor seg\u00fan promedio).\n -x activa la salida de mensajes de depuraci\u00f3n adicionales\n -u interpreta los argumentos como URL\n -i fuerza que el compilador lea la hoja de estilos de stdin\n -v imprime la versi\u00f3n del compilador\n -h imprime esta sentencia de uso\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SINOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u }\n [= ...]\n\n utiliza la translet para transformar un documento XML \n especificado como . La translet est\u00e1 en\n la CLASSPATH del usuario o en el especificado opcionalmente.\nOPCIONES\n -j especifica un archivo jar desde el que se va a cargar el translet\n -x activa la salida de mensajes de depuraci\u00f3n adicionales\n -n ejecuta la transformaci\u00f3n veces y\n muestra informaci\u00f3n de perfiles\n -u especifica el documento de entrada XML como un URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " s\u00f3lo puede utilizarse dentro de o ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "La codificaci\u00f3n de salida ''{0}'' no est\u00e1 soportada en esta JVM."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Error de sintaxis en ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "No se puede encontrar el constructor externo ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "El primer argumento de la funci\u00f3n Java no est\u00e1tica ''{0}'' no es una referencia de objeto v\u00e1lida."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Error al comprobar el tipo de la expresi\u00f3n ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Error al comprobar el tipo de una expresi\u00f3n en una ubicaci\u00f3n desconocida."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "La opci\u00f3n ''{0}'' de la l\u00ednea de mandatos no es v\u00e1lida."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Falta un argumento necesario en la opci\u00f3n ''{0}'' de la l\u00ednea de mandatos."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "AVISO: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "AVISO: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "ERROR MUY GRAVE: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "ERROR MUY GRAVE: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERROR: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERROR: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transformaci\u00f3n con translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transformaci\u00f3n con translet ''{0}'' del archivo jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "No se ha podido crear una instancia de la clase TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "No se ha podido utilizar el nombre ''{0}'' como nombre de la clase translet porque contiene caracteres que no est\u00e1n permitidos en los nombres de clases Java. Se utiliza el nombre ''{1}'' en su lugar."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Errores del compilador:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Avisos del compilador:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Errores de translet:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Un atributo cuyo valor debe ser un QName o una lista de QNames separados por espacios tiene el valor ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Un atributo cuyo valor debe ser un NCName tiene el valor ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "El atributo method de un elemento tiene el valor ''{0}''. El valor debe ser ''xml'', ''html'', ''text'' o qname-but-not-ncname"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "El nombre de caracter\u00edstica no puede ser null en TransformerFactory.getFeature(nombre de tipo String)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "El nombre de caracter\u00edstica no puede ser null en TransformerFactory.setFeature(nombre de tipo String, valor booleano)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "No se puede establecer la caracter\u00edstica ''{0}'' en esta TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_pl.java0000644000175000017500000012305610721374032027253 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_pl.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_pl extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "W jednym pliku zdefiniowano wi\u0119cej ni\u017c jeden arkusz styl\u00f3w."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "Szablon ''{0}'' zosta\u0142 ju\u017c zdefiniowany w tym arkuszu styl\u00f3w."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "Szablon ''{0}'' nie zosta\u0142 zdefiniowany w tym arkuszu styl\u00f3w."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "Zmienna ''{0}'' zosta\u0142a zdefiniowana wielokrotnie w tym samym zasi\u0119gu."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Nie zdefiniowano zmiennej lub parametru ''{0}''."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Nie mo\u017cna znale\u017a\u0107 klasy ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Nie mo\u017cna znale\u017a\u0107 metody zewn\u0119trznej ''{0}'' (musi by\u0107 zadeklarowana jako public)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Nie mo\u017cna przekszta\u0142ci\u0107 typu argumentu lub typu wyniku w wywo\u0142aniu metody ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Nie mo\u017cna znale\u017a\u0107 pliku lub identyfikatora URI ''{0}''."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "Niepoprawny identyfikator URI ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Nie mo\u017cna otworzy\u0107 pliku lub identyfikatora URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Oczekiwano elementu lub ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Nie zadeklarowano przedrostka przestrzeni nazw ''{0}''."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Nie mo\u017cna rozstrzygn\u0105\u0107 wywo\u0142ania funkcji ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "Argument funkcji ''{0}'' musi by\u0107 litera\u0142em \u0142a\u0144cuchowym."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "B\u0142\u0105d podczas analizowania wyra\u017cenia XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Brakuje atrybutu wymaganego ''{0}''."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Niedozwolony znak ''{0}'' w wyra\u017ceniu XPath."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Niedozwolona nazwa ''{0}'' instrukcji przetwarzania."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Atrybut ''{0}'' znajduje si\u0119 poza elementem."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Niedozwolony atrybut ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Cykliczny import/include. Arkusz styl\u00f3w ''{0}'' zosta\u0142 ju\u017c za\u0142adowany."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Nie mo\u017cna posortowa\u0107 fragment\u00f3w drzewa rezultat\u00f3w (elementy s\u0105 ignorowane). Trzeba sortowa\u0107 w\u0119z\u0142y podczas tworzenia drzewa rezultat\u00f3w."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Formatowanie dziesi\u0119tne ''{0}'' zosta\u0142o ju\u017c zdefiniowane."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "Wersja XSL ''{0}'' nie jest obs\u0142ugiwana przez XSLTC."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Cykliczne odwo\u0142anie do zmiennej lub parametru w ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Nieznany operator wyra\u017cenia dwuargumentowego."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Niedozwolone argumenty w wywo\u0142aniu funkcji."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Drugim argumentem funkcji document() musi by\u0107 zbi\u00f3r w\u0119z\u0142\u00f3w."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "W wymagany jest przynajmniej jeden element ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "W dozwolony jest tylko jeden element ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, "Elementu mo\u017cna u\u017cy\u0107 tylko wewn\u0105trz ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, "Elementu mo\u017cna u\u017cy\u0107 tylko wewn\u0105trz ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Tylko elementy i s\u0105 dozwolone w ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " nie ma atrybutu 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Niedozwolony element potomny."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Nie mo\u017cna wywo\u0142a\u0107 elementu ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Nie mo\u017cna wywo\u0142a\u0107 atrybutu ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Dane tekstowe poza elementem najwy\u017cszego poziomu."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Analizator sk\u0142adni JAXP nie zosta\u0142 poprawnie skonfigurowany."}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Nienaprawialny b\u0142\u0105d wewn\u0119trzny XSLTC: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Nieobs\u0142ugiwany element XSL ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Nierozpoznane rozszerzenie XSLTC ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Dokument wej\u015bciowy nie jest arkuszem styl\u00f3w (przestrze\u0144 nazw XSL nie zosta\u0142a zadeklarowana w elemencie g\u0142\u00f3wnym)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Nie mo\u017cna znale\u017a\u0107 elementu docelowego ''{0}'' arkusza styl\u00f3w."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Nie zaimplementowano: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Dokument wej\u015bciowy nie zawiera arkusza styl\u00f3w XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Nie mo\u017cna zanalizowa\u0107 elementu ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "Warto\u015bci\u0105 atrybutu use elementu musi by\u0107: node, node-set, string lub number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "Wyj\u015bciowy dokument XML powinien mie\u0107 wersj\u0119 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Nieznany operator wyra\u017cenia relacyjnego"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Pr\u00f3ba u\u017cycia nieistniej\u0105cego zbioru atrybut\u00f3w ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Nie mo\u017cna zanalizowa\u0107 szablonu warto\u015bci atrybutu ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Nieznany typ danych w sygnaturze klasy ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Nie mo\u017cna przekszta\u0142ci\u0107 typu danych ''{0}'' w ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Klasa Templates nie zawiera poprawnej definicji klasy transletu."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Ta klasa Templates nie zawiera klasy o nazwie ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Nie mo\u017cna za\u0142adowa\u0107 klasy transletu ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Za\u0142adowano klas\u0119 transletu, ale nie mo\u017cna utworzy\u0107 jego instancji."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Pr\u00f3ba ustawienia obiektu ErrorListener klasy ''{0}'' na warto\u015b\u0107 null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Tylko StreamSource, SAXSource i DOMSource s\u0105 obs\u0142ugiwane przez XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "Obiekt klasy Source przekazany do ''{0}'' nie ma kontekstu."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Nie mo\u017cna skompilowa\u0107 arkusza styl\u00f3w."}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "Klasa TransformerFactory nie rozpoznaje atrybutu ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "Przed wywo\u0142aniem metody startDocument() nale\u017cy wywo\u0142a\u0107 metod\u0119 setResult()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Obiekt Transformer nie zawiera referencji do obiektu transletu."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Nie zdefiniowano procedury obs\u0142ugi wyj\u015bcia rezultat\u00f3w transformacji."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "Obiekt Result przekazany do ''{0}'' jest niepoprawny."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Pr\u00f3ba dost\u0119pu do niepoprawnej w\u0142a\u015bciwo\u015bci interfejsu Transformer ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Nie mo\u017cna utworzy\u0107 adaptera SAX2DOM: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "Metoda XSLTCSource.build() zosta\u0142a wywo\u0142ana bez ustawienia warto\u015bci systemId."}, { ErrorMsg.ER_RESULT_NULL, "Rezultat nie powinien by\u0107 pusty"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "Warto\u015bci\u0105 parametru {0} musi by\u0107 poprawny obiekt j\u0119zyka Java."}, {ErrorMsg.COMPILE_STDIN_ERR, "Z opcj\u0105 -o trzeba u\u017cy\u0107 tak\u017ce opcji -i."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SK\u0141ADNIA\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPCJE\n -o przypisanie nazwy do wygenerowanego\n transletu. Domy\u015blnie nazwa transletu pochodzi \n od nazwy . Opcja ta jest ignorowana \n w przypadku kompilowania wielu arkuszy styl\u00f3w.\n -d Okre\u015blenie katalogu docelowego transletu.\n -j Pakowanie klas transletu do pliku jar o nazwie\n okre\u015blonej jako .\n -p Okre\u015blenie przedrostka nazwy pakietu dla wszystkich\n wygenerowanych klas translet\u00f3w.\n -n W\u0142\u0105czenie wstawiania szablon\u00f3w (zachowanie domy\u015blne\n zwykle lepsze).\n -x W\u0142\u0105czenie wypisywania dodatkowych komunikat\u00f3w debugowania.\n -u Interpretowanie argument\u00f3w jako\n adres\u00f3w URL.\n -i Wymuszenie odczytywania przez kompilator arkusza styl\u00f3w\n ze standardowego wej\u015bcia (stdin).\n -v Wypisanie wersji kompilatora.\n -h Wypisanie informacji o sk\u0142adni.\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SK\u0141ADNIA \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n U\u017cycie transletu do transformacji dokumentu XML \n okre\u015blonego jako . Translet znajduje si\u0119 w\n \u015bcie\u017cce CLASSPATH u\u017cytkownika lub w opcjonalnie podanym pliku .\nOPCJE\n -j Okre\u015blenie pliku jar, z kt\u00f3rego nale\u017cy za\u0142adowa\u0107 translet.\n -x W\u0142\u0105czenie wypisywania dodatkowych komunikat\u00f3w debugowania.\n -n Okre\u015blenie krotno\u015bci wykonywania transformacji oraz \n w\u0142\u0105czenie wy\u015bwietlania informacji z profilowania.\n -u \n Okre\u015blenie wej\u015bciowego dokumentu XML w postaci adresu URL.\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, "Elementu mo\u017cna u\u017cy\u0107 tylko wewn\u0105trz lub ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "Kodowanie wyj\u015bciowe ''{0}'' nie jest obs\u0142ugiwane przez t\u0119 maszyn\u0119 wirtualn\u0105 j\u0119zyka Java."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "B\u0142\u0105d sk\u0142adniowy w ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Nie mo\u017cna znale\u017a\u0107 konstruktora zewn\u0119trznego ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Pierwszy argument funkcji ''{0}'' j\u0119zyka Java (innej ni\u017c static) nie jest poprawnym odniesieniem do obiektu."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "B\u0142\u0105d podczas sprawdzania typu wyra\u017cenia ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "B\u0142\u0105d podczas sprawdzania typu wyra\u017cenia w nieznanym po\u0142o\u017ceniu."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "Niepoprawna opcja ''{0}'' wiersza komend."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Brakuje argumentu wymaganego opcji ''{0}'' wiersza komend."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "OSTRZE\u017bENIE: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "OSTRZE\u017bENIE: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "B\u0141\u0104D KRYTYCZNY: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "B\u0141\u0104D KRYTYCZNY: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "B\u0141\u0104D: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "B\u0141\u0104D: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Dokonaj transformacji za pomoc\u0105 transletu ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Dokonaj transformacji za pomoc\u0105 transletu ''{0}'' z pliku jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Nie mo\u017cna utworzy\u0107 instancji klasy ''{0}'' interfejsu TransformerFactory."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "Nazwy ''{0}'' nie mo\u017cna u\u017cy\u0107 jako nazwy klasy transletu, poniewa\u017c zawiera ona znaki, kt\u00f3re s\u0105 niedozwolone w nazwach klas j\u0119zyka Java. Zamiast niej u\u017cyto nazwy ''{1}''."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "B\u0142\u0119dy kompilatora:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Ostrze\u017cenia kompilatora:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "B\u0142\u0119dy transletu:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Atrybut, kt\u00f3rego warto\u015bci\u0105 musi by\u0107 nazwa QName lub lista rozdzielonych odst\u0119pami nazw QName, mia\u0142 warto\u015b\u0107 ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Atrybut, kt\u00f3rego warto\u015bci\u0105 musi by\u0107 nazwa NCName, mia\u0142 warto\u015b\u0107 ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Atrybut method elementu mia\u0142 warto\u015b\u0107 ''{0}''. Warto\u015bci\u0105 mo\u017ce by\u0107: ''xml'', ''html'', ''text'' lub nazwa qname nie b\u0119d\u0105ca nazw\u0105 ncname."}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "Nazwa opcji nie mo\u017ce mie\u0107 warto\u015bci null w TransformerFactory.getFeature(String nazwa)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "Nazwa opcji nie mo\u017ce mie\u0107 warto\u015bci null w TransformerFactory.setFeature(String nazwa, boolean warto\u015b\u0107)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Nie mo\u017cna ustawi\u0107 opcji ''{0}'' w tej klasie TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/MethodType.java0000644000175000017500000001120110721374033026046 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MethodType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.Vector; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class MethodType extends Type { private final Type _resultType; private final Vector _argsType; public MethodType(Type resultType) { _argsType = null; _resultType = resultType; } public MethodType(Type resultType, Type arg1) { if (arg1 != Type.Void) { _argsType = new Vector(); _argsType.addElement(arg1); } else { _argsType = null; } _resultType = resultType; } public MethodType(Type resultType, Type arg1, Type arg2) { _argsType = new Vector(2); _argsType.addElement(arg1); _argsType.addElement(arg2); _resultType = resultType; } public MethodType(Type resultType, Type arg1, Type arg2, Type arg3) { _argsType = new Vector(3); _argsType.addElement(arg1); _argsType.addElement(arg2); _argsType.addElement(arg3); _resultType = resultType; } public MethodType(Type resultType, Vector argsType) { _resultType = resultType; _argsType = argsType.size() > 0 ? argsType : null; } public String toString() { StringBuffer result = new StringBuffer("method{"); if (_argsType != null) { final int count = _argsType.size(); for (int i=0; ilastArgSig to the end of the argument list. */ public String toSignature(String lastArgSig) { final StringBuffer buffer = new StringBuffer(); buffer.append('('); if (_argsType != null) { final int n = _argsType.size(); for (int i = 0; i < n; i++) { buffer.append(((Type)_argsType.elementAt(i)).toSignature()); } } return buffer .append(lastArgSig) .append(')') .append(_resultType.toSignature()) .toString(); } public org.apache.bcel.generic.Type toJCType() { return null; // should never be called } public boolean identicalTo(Type other) { boolean result = false; if (other instanceof MethodType) { final MethodType temp = (MethodType) other; if (_resultType.identicalTo(temp._resultType)) { final int len = argsCount(); result = len == temp.argsCount(); for (int i = 0; i < len && result; i++) { final Type arg1 = (Type)_argsType.elementAt(i); final Type arg2 = (Type)temp._argsType.elementAt(i); result = arg1.identicalTo(arg2); } } } return result; } public int distanceTo(Type other) { int result = Integer.MAX_VALUE; if (other instanceof MethodType) { final MethodType mtype = (MethodType) other; if (_argsType != null) { final int len = _argsType.size(); if (len == mtype._argsType.size()) { result = 0; for (int i = 0; i < len; i++) { Type arg1 = (Type) _argsType.elementAt(i); Type arg2 = (Type) mtype._argsType.elementAt(i); final int temp = arg1.distanceTo(arg2); if (temp == Integer.MAX_VALUE) { result = temp; // return MAX_VALUE break; } else { result += arg1.distanceTo(arg2); } } } } else if (mtype._argsType == null) { result = 0; // both methods have no args } } return result; } public Type resultType() { return _resultType; } public Vector argsType() { return _argsType; } public int argsCount() { return _argsType == null ? 0 : _argsType.size(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_de.java0000644000175000017500000012107110721374032027223 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_de.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_de extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "In einer Datei sind mehrere Formatvorlagen definiert."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "Vorlage ''{0}'' ist in dieser Formatvorlage bereits definiert."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "Vorlage ''{0}'' ist in dieser Formatvorlage nicht definiert."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "Variable ''{0}'' ist in einem Bereich mehrmals definiert."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Variable oder Parameter ''{0}'' ist nicht definiert."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Klasse ''{0}'' wurde nicht gefunden."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Die externe Methode ''{0}'' wurde nicht gefunden (muss ''public'' sein)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Argument-/R\u00fcckgabetyp in Aufruf kann nicht in Methode ''{0}'' konvertiert werden."}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Datei oder URI ''{0}'' wurde nicht gefunden."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "Ung\u00fcltiger URI ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Datei oder URI ''{0}'' kann nicht ge\u00f6ffnet werden."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "- oder -Element erwartet."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Namensbereichspr\u00e4fix ''{0}'' ist nicht deklariert."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Aufruf f\u00fcr Funktion ''{0}'' kann nicht aufgel\u00f6st werden."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "Argument f\u00fcr ''{0}'' muss eine Literalzeichenfolge sein."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Fehler bei Syntaxanalyse des XPath-Ausdrucks ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Erforderliches Attribut ''{0}'' fehlt."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Unzul\u00e4ssiges Zeichen ''{0}'' in XPath-Ausdruck."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Unzul\u00e4ssiger Name ''{0}'' f\u00fcr Verarbeitungsanweisung."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Attribut ''{0}'' befindet sich nicht in einem Element."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Unzul\u00e4ssiges Attribut ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Schleife bei ''import''/''include''. Formatvorlage ''{0}'' ist bereits geladen."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Ergebnisbaumfragmente k\u00f6nnen nicht sortiert werden (-Elemente werden ignoriert). Sie m\u00fcssen die Knoten sortieren, wenn Sie den Ergebnisbaum erstellen."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Dezimalformatierung ''{0}'' ist bereits definiert."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSL-Version ''{0}'' wird von XSLTC nicht unterst\u00fctzt."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "R\u00fcckwirkender Variablen-/Parameterverweis in ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Unbekannter Operator f\u00fcr Bin\u00e4rausdruck."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Unzul\u00e4ssige(s) Argument(e) f\u00fcr Funktionsaufruf."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Zweites Argument f\u00fcr document()-Funktion muss eine Knotengruppe sein."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Es ist mindestens ein -Element in erforderlich."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Es ist nur ein -Element in zul\u00e4ssig."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " kann nur in verwendet werden."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " kann nur in verwendet werden."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "In sind nur - und -Elemente zul\u00e4ssig."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "Das Attribut 'name' fehlt f\u00fcr ."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Zul\u00e4ssiges Kindelement."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Sie k\u00f6nnen ein Element nicht ''{0}'' nennen."}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Sie k\u00f6nnen ein Attribut nicht ''{0}'' nennen."}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Textdaten au\u00dferhalb von -Element der h\u00f6chsten Ebene."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP-Parser ist nicht richtig konfiguriert."}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Nicht behebbarer XSLTC-interner Fehler: ''{0}'' "}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Nicht unterst\u00fctztes XSL-Element ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Nicht erkannte XSLTC-Erweiterung ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Das Eingabedokument ist keine Formatvorlage (der XSL-Namensbereich wird nicht im Stammelement deklariert)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Das Formatvorlagenziel ''{0}'' wurde nicht gefunden."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Nicht implementiert: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Das Eingabedokument enth\u00e4lt keine XSL-Formatvorlage."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Element ''{0}'' konnte nicht syntaktisch analysiert werden."}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "Das Attribut 'use' von muss 'node', 'node-set', 'string' oder 'number' sein."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "Die Version des XML-Ausgabedokuments sollte 1.0 sein."}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Unbekannter Operator f\u00fcr Vergleichsausdruck."}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Es wird versucht, die nicht vorhandene Attributgruppe ''{0}'' zu verwenden."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Die Attributwertvorlage ''{0}'' kann nicht syntaktisch analysiert werden."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Unbekannter Datentyp in Signatur f\u00fcr Klasse ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Datentyp ''{0}'' kann nicht in ''{1}'' konvertiert werden."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Diese Klasse 'Templates' enth\u00e4lt keine g\u00fcltige Translet-Klassendefinition."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Diese Klasse ''Templates'' enth\u00e4lt keine Klasse mit dem Namen ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Die Transletklasse ''{0}'' konnte nicht geladen werden."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Die Translet-Klasse wurde geladen, es kann jedoch keine Translet-Instanz erstellt werden."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Es wird versucht, ErrorListener f\u00fcr ''{0}'' auf null zu setzen."}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Nur StreamSource, SAXSource und DOMSource werden von XSLTC unterst\u00fctzt."}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "Das Source-Objekt, das an ''{0}'' \u00fcbergeben wurde, hat keinen Inhalt."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Die Formatvorlage konnte nicht kompiliert werden."}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory erkennt Attribut ''{0}'' nicht."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() muss vor startDocument() aufgerufen werden."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer hat kein eingebundenes Translet-Objekt."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Es ist keine Ausgabesteuerroutine f\u00fcr die Umsetzungsergebnisse definiert."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "Das Result-Objekt, das an ''{0}'' \u00fcbergeben wurde, ist ung\u00fcltig."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Es wird versucht, auf das ung\u00fcltige Transformer-Merkmal ''{0}'' zuzugreifen."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Der SAX2DOM-Adapter konnte nicht erstellt werden: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() wurde aufgerufen, ohne dass die System-ID gesetzt war."}, { ErrorMsg.ER_RESULT_NULL, "Das Ergebnis darf nicht Null sein."}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "Der Wert f\u00fcr Parameter {0} muss ein g\u00fcltiges Java-Objekt sein."}, {ErrorMsg.COMPILE_STDIN_ERR, "Die Option -i muss mit der Option -o verwendet werden."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONEN\n -o Ordnet dem generierten Translet den Namen zu.\n Der Translet-Name wird standardm\u00e4\u00dfig\n von dem Namen von abgeleitet. Diese Option\n wird ignoriert, wenn mehrere Formatvorlagen kompiliert werden. \n -d Gibt ein Zielverzeichnis f\u00fcr Translet an.\n -j Packt Translet-Klassen in eine jar-Datei mit dem\n Namen, der f\u00fcr angegeben wurde.\n -p Gibt ein Paketnamenpr\u00e4fix f\u00fcr alle\n generierten Translet-Klassen an.\n -n Aktiviert Inline-Anordnung von Vorlagen (Standardverhalten \n durchschnittlich besser).\n -x Aktiviert zus\u00e4tzliche Debugnachrichtenausgabe.\n -u Interpretiert Argumente als URLs.\n -i Erzwingt, dass der Compiler die Formatvorlage aus der Standardeingabe liest.\n -v Gibt die Version des Compilers aus.\n -h Gibt diese Syntaxanweisung aus.\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNTAX \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n Verwendet die von Translet, um ein XML-Dokument umzusetzen,\n das als angegeben wurde. Die von Translet befindet sich entweder in\n der CLASSPATH-Angabe des Benutzers oder in der optional angegebenen .\nOPTIONEN\n -j Gibt eine JAR-Datei an, aus der das Translet geladen wird.\n -x Aktiviert zus\u00e4tzliche Debugnachrichtenausgabe.\n -n F\u00fchrt die Umsetzung Mal aus und \n zeigt Profilinformationen an.\n -u Gibt das XML-Eingabedokument als URL an.\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " kann nur in oder verwendet werden."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "Ausgabeverschl\u00fcsselung ''{0}'' wird auf dieser JVM nicht unterst\u00fctzt."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Syntaxfehler in ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Der externe Konstruktor ''{0}'' wurde nicht gefunden."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Das erste Argument der nichtstatischen Java-Funktion ''{0}'' ist kein g\u00fcltiger Objektverweis."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Fehler beim \u00dcberpr\u00fcfen des Typs des Ausdrucks ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Fehler beim \u00dcberpr\u00fcfen des Typs eines Ausdrucks an einer unbekannten Position."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "Die Befehlszeilenoption ''{0}'' ist nicht g\u00fcltig."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "In der Befehlszeilenoption ''{0}'' fehlt ein erforderliches Argument."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "WARNUNG: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "WARNUNG: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "SCHWER WIEGENDER FEHLER: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "SCHWER WIEGENDER FEHLER: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "FEHLER: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "FEHLER: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Umsetzung mit Translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Umwandlung mit Translet ''{0}'' aus JAR-Datei ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Es konnte keine Instanz der TransformerFactory-Klasse ''{0}'' erstellt werden."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "Der Name ''{0}'' konnte nicht als Name der Transletklasse verwendet werden, da er Zeichen enth\u00e4lt, die im Namen einer Java-Klasse nicht zul\u00e4ssig sind. Stattdessen wurde der Name ''{1}'' verwendet."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Compilerfehler:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Compilerwarnungen:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Translet-Fehler:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Ein Attribut, dessen Wert ein QName oder eine durch Leerzeichen getrennte Liste von QNamen sein muss, hatte den Wert ''{0}''."}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Ein Attribut, dessen Wert ein NCName sein muss, hatte den Wert ''{0}''."}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Das Methodenattribut eines -Elements hatte den Wert ''{0}''. Als Wert muss ''xml'', ''html'', ''text'' oder ''qname-but-not-ncname'' verwendet werden."}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "Der Funktionsname darf in TransformerFactory.getFeature(Name der Zeichenfolge) nicht den Wert Null haben."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "Der Funktionsname darf in TransformerFactory.setFeature(Name der Zeichenfolge, Boolescher Wert) nicht den Wert Null haben."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Die Funktion ''{0}'' kann in dieser TransformerFactory nicht festgelegt werden."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/OutlineableChunkStart.java0000644000175000017500000000566510721374032030256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.Instruction; /** *

        This pseudo-instruction marks the beginning of a region of byte code that * can be copied into a new method, termed an "outlineable" chunk. The size of * the Java stack must be the same at the start of the region as it is at the * end of the region, any value on the stack at the start of the region must not * be consumed by an instruction in the region of code, the region must not * contain a return instruction, no branch instruction in the region is * permitted to have a target that is outside the region, and no branch * instruction outside the region is permitted to have a target that is inside * the region.

        *

        The end of the region is marked by an {@link OutlineableChunkEnd} * pseudo-instruction.

        *

        Such a region of code may contain other outlineable regions.

        */ class OutlineableChunkStart extends MarkerInstruction { /** * A constant instance of {@link OutlineableChunkStart}. As it has no fields, * there should be no need to create an instance of this class. */ public static final Instruction OUTLINEABLECHUNKSTART = new OutlineableChunkStart(); /** * Private default constructor. As it has no fields, * there should be no need to create an instance of this class. See * {@link OutlineableChunkStart#OUTLINEABLECHUNKSTART}. */ private OutlineableChunkStart() { } /** * Get the name of this instruction. Used for debugging. * @return the instruction name */ public String getName() { return OutlineableChunkStart.class.getName(); } /** * Get the name of this instruction. Used for debugging. * @return the instruction name */ public String toString() { return getName(); } /** * Get the name of this instruction. Used for debugging. * @return the instruction name */ public String toString(boolean verbose) { return getName(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/CompareGenerator.java0000644000175000017500000000722510721374030027231 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CompareGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ACONST_NULL; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.Type; import org.apache.xalan.xsltc.compiler.Constants; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class CompareGenerator extends MethodGenerator { private static int DOM_INDEX = 1; private static int CURRENT_INDEX = 2; private static int LEVEL_INDEX = 3; private static int TRANSLET_INDEX = 4; private static int LAST_INDEX = 5; private int ITERATOR_INDEX = 6; private final Instruction _iloadCurrent; private final Instruction _istoreCurrent; private final Instruction _aloadDom; private final Instruction _iloadLast; private final Instruction _aloadIterator; private final Instruction _astoreIterator; public CompareGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_INDEX); _istoreCurrent = new ISTORE(CURRENT_INDEX); _aloadDom = new ALOAD(DOM_INDEX); _iloadLast = new ILOAD(LAST_INDEX); LocalVariableGen iterator = addLocalVariable("iterator", Util.getJCRefType(Constants.NODE_ITERATOR_SIG), null, null); ITERATOR_INDEX = iterator.getIndex(); _aloadIterator = new ALOAD(ITERATOR_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); il.append(new ACONST_NULL()); il.append(storeIterator()); } public Instruction loadLastNode() { return _iloadLast; } public Instruction loadCurrentNode() { return _iloadCurrent; } public Instruction storeCurrentNode() { return _istoreCurrent; } public Instruction loadDOM() { return _aloadDom; } public int getHandlerIndex() { return INVALID_INDEX; // not available } public int getIteratorIndex() { return INVALID_INDEX; } public Instruction storeIterator() { return _astoreIterator; } public Instruction loadIterator() { return _aloadIterator; } //??? may not be used anymore public int getLocalIndex(String name) { if (name.equals("current")) { return CURRENT_INDEX; } return super.getLocalIndex(name); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java0000644000175000017500000003400110721374031025525 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMsg.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; import org.apache.xalan.xsltc.compiler.Stylesheet; import org.apache.xalan.xsltc.compiler.SyntaxTreeNode; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author G. Todd Miller * @author Erwin Bolwidt * @author Morten Jorgensen */ public final class ErrorMsg { private String _code; private int _line; private String _message = null; private String _url = null; Object[] _params = null; private boolean _isWarningError; // Compiler error messages public static final String MULTIPLE_STYLESHEET_ERR = "MULTIPLE_STYLESHEET_ERR"; public static final String TEMPLATE_REDEF_ERR = "TEMPLATE_REDEF_ERR"; public static final String TEMPLATE_UNDEF_ERR = "TEMPLATE_UNDEF_ERR"; public static final String VARIABLE_REDEF_ERR = "VARIABLE_REDEF_ERR"; public static final String VARIABLE_UNDEF_ERR = "VARIABLE_UNDEF_ERR"; public static final String CLASS_NOT_FOUND_ERR = "CLASS_NOT_FOUND_ERR"; public static final String METHOD_NOT_FOUND_ERR = "METHOD_NOT_FOUND_ERR"; public static final String ARGUMENT_CONVERSION_ERR = "ARGUMENT_CONVERSION_ERR"; public static final String FILE_NOT_FOUND_ERR = "FILE_NOT_FOUND_ERR"; public static final String INVALID_URI_ERR = "INVALID_URI_ERR"; public static final String FILE_ACCESS_ERR = "FILE_ACCESS_ERR"; public static final String MISSING_ROOT_ERR = "MISSING_ROOT_ERR"; public static final String NAMESPACE_UNDEF_ERR = "NAMESPACE_UNDEF_ERR"; public static final String FUNCTION_RESOLVE_ERR = "FUNCTION_RESOLVE_ERR"; public static final String NEED_LITERAL_ERR = "NEED_LITERAL_ERR"; public static final String XPATH_PARSER_ERR = "XPATH_PARSER_ERR"; public static final String REQUIRED_ATTR_ERR = "REQUIRED_ATTR_ERR"; public static final String ILLEGAL_CHAR_ERR = "ILLEGAL_CHAR_ERR"; public static final String ILLEGAL_PI_ERR = "ILLEGAL_PI_ERR"; public static final String STRAY_ATTRIBUTE_ERR = "STRAY_ATTRIBUTE_ERR"; public static final String ILLEGAL_ATTRIBUTE_ERR = "ILLEGAL_ATTRIBUTE_ERR"; public static final String CIRCULAR_INCLUDE_ERR = "CIRCULAR_INCLUDE_ERR"; public static final String RESULT_TREE_SORT_ERR = "RESULT_TREE_SORT_ERR"; public static final String SYMBOLS_REDEF_ERR = "SYMBOLS_REDEF_ERR"; public static final String XSL_VERSION_ERR = "XSL_VERSION_ERR"; public static final String CIRCULAR_VARIABLE_ERR = "CIRCULAR_VARIABLE_ERR"; public static final String ILLEGAL_BINARY_OP_ERR = "ILLEGAL_BINARY_OP_ERR"; public static final String ILLEGAL_ARG_ERR = "ILLEGAL_ARG_ERR"; public static final String DOCUMENT_ARG_ERR = "DOCUMENT_ARG_ERR"; public static final String MISSING_WHEN_ERR = "MISSING_WHEN_ERR"; public static final String MULTIPLE_OTHERWISE_ERR = "MULTIPLE_OTHERWISE_ERR"; public static final String STRAY_OTHERWISE_ERR = "STRAY_OTHERWISE_ERR"; public static final String STRAY_WHEN_ERR = "STRAY_WHEN_ERR"; public static final String WHEN_ELEMENT_ERR = "WHEN_ELEMENT_ERR"; public static final String UNNAMED_ATTRIBSET_ERR = "UNNAMED_ATTRIBSET_ERR"; public static final String ILLEGAL_CHILD_ERR = "ILLEGAL_CHILD_ERR"; public static final String ILLEGAL_ELEM_NAME_ERR = "ILLEGAL_ELEM_NAME_ERR"; public static final String ILLEGAL_ATTR_NAME_ERR = "ILLEGAL_ATTR_NAME_ERR"; public static final String ILLEGAL_TEXT_NODE_ERR = "ILLEGAL_TEXT_NODE_ERR"; public static final String SAX_PARSER_CONFIG_ERR = "SAX_PARSER_CONFIG_ERR"; public static final String INTERNAL_ERR = "INTERNAL_ERR"; public static final String UNSUPPORTED_XSL_ERR = "UNSUPPORTED_XSL_ERR"; public static final String UNSUPPORTED_EXT_ERR = "UNSUPPORTED_EXT_ERR"; public static final String MISSING_XSLT_URI_ERR = "MISSING_XSLT_URI_ERR"; public static final String MISSING_XSLT_TARGET_ERR = "MISSING_XSLT_TARGET_ERR"; public static final String NOT_IMPLEMENTED_ERR = "NOT_IMPLEMENTED_ERR"; public static final String NOT_STYLESHEET_ERR = "NOT_STYLESHEET_ERR"; public static final String ELEMENT_PARSE_ERR = "ELEMENT_PARSE_ERR"; public static final String KEY_USE_ATTR_ERR = "KEY_USE_ATTR_ERR"; public static final String OUTPUT_VERSION_ERR = "OUTPUT_VERSION_ERR"; public static final String ILLEGAL_RELAT_OP_ERR = "ILLEGAL_RELAT_OP_ERR"; public static final String ATTRIBSET_UNDEF_ERR = "ATTRIBSET_UNDEF_ERR"; public static final String ATTR_VAL_TEMPLATE_ERR = "ATTR_VAL_TEMPLATE_ERR"; public static final String UNKNOWN_SIG_TYPE_ERR = "UNKNOWN_SIG_TYPE_ERR"; public static final String DATA_CONVERSION_ERR = "DATA_CONVERSION_ERR"; // JAXP/TrAX error messages public static final String NO_TRANSLET_CLASS_ERR = "NO_TRANSLET_CLASS_ERR"; public static final String NO_MAIN_TRANSLET_ERR = "NO_MAIN_TRANSLET_ERR"; public static final String TRANSLET_CLASS_ERR = "TRANSLET_CLASS_ERR"; public static final String TRANSLET_OBJECT_ERR = "TRANSLET_OBJECT_ERR"; public static final String ERROR_LISTENER_NULL_ERR = "ERROR_LISTENER_NULL_ERR"; public static final String JAXP_UNKNOWN_SOURCE_ERR = "JAXP_UNKNOWN_SOURCE_ERR"; public static final String JAXP_NO_SOURCE_ERR = "JAXP_NO_SOURCE_ERR"; public static final String JAXP_COMPILE_ERR = "JAXP_COMPILE_ERR"; public static final String JAXP_INVALID_ATTR_ERR = "JAXP_INVALID_ATTR_ERR"; public static final String JAXP_SET_RESULT_ERR = "JAXP_SET_RESULT_ERR"; public static final String JAXP_NO_TRANSLET_ERR = "JAXP_NO_TRANSLET_ERR"; public static final String JAXP_NO_HANDLER_ERR = "JAXP_NO_HANDLER_ERR"; public static final String JAXP_NO_RESULT_ERR = "JAXP_NO_RESULT_ERR"; public static final String JAXP_UNKNOWN_PROP_ERR = "JAXP_UNKNOWN_PROP_ERR"; public static final String SAX2DOM_ADAPTER_ERR = "SAX2DOM_ADAPTER_ERR"; public static final String XSLTC_SOURCE_ERR = "XSLTC_SOURCE_ERR"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String JAXP_INVALID_SET_PARAM_VALUE = "JAXP_INVALID_SET_PARAM_VALUE"; public static final String JAXP_SET_FEATURE_NULL_NAME = "JAXP_SET_FEATURE_NULL_NAME"; public static final String JAXP_GET_FEATURE_NULL_NAME = "JAXP_GET_FEATURE_NULL_NAME"; public static final String JAXP_UNSUPPORTED_FEATURE = "JAXP_UNSUPPORTED_FEATURE"; // Command-line error messages public static final String COMPILE_STDIN_ERR = "COMPILE_STDIN_ERR"; public static final String COMPILE_USAGE_STR = "COMPILE_USAGE_STR"; public static final String TRANSFORM_USAGE_STR = "TRANSFORM_USAGE_STR"; // Recently added error messages public static final String STRAY_SORT_ERR = "STRAY_SORT_ERR"; public static final String UNSUPPORTED_ENCODING = "UNSUPPORTED_ENCODING"; public static final String SYNTAX_ERR = "SYNTAX_ERR"; public static final String CONSTRUCTOR_NOT_FOUND = "CONSTRUCTOR_NOT_FOUND"; public static final String NO_JAVA_FUNCT_THIS_REF = "NO_JAVA_FUNCT_THIS_REF"; public static final String TYPE_CHECK_ERR = "TYPE_CHECK_ERR"; public static final String TYPE_CHECK_UNK_LOC_ERR = "TYPE_CHECK_UNK_LOC_ERR"; public static final String ILLEGAL_CMDLINE_OPTION_ERR = "ILLEGAL_CMDLINE_OPTION_ERR"; public static final String CMDLINE_OPT_MISSING_ARG_ERR = "CMDLINE_OPT_MISSING_ARG_ERR"; public static final String WARNING_PLUS_WRAPPED_MSG = "WARNING_PLUS_WRAPPED_MSG"; public static final String WARNING_MSG = "WARNING_MSG"; public static final String FATAL_ERR_PLUS_WRAPPED_MSG = "FATAL_ERR_PLUS_WRAPPED_MSG"; public static final String FATAL_ERR_MSG = "FATAL_ERR_MSG"; public static final String ERROR_PLUS_WRAPPED_MSG = "ERROR_PLUS_WRAPPED_MSG"; public static final String ERROR_MSG = "ERROR_MSG"; public static final String TRANSFORM_WITH_TRANSLET_STR = "TRANSFORM_WITH_TRANSLET_STR"; public static final String TRANSFORM_WITH_JAR_STR = "TRANSFORM_WITH_JAR_STR"; public static final String COULD_NOT_CREATE_TRANS_FACT = "COULD_NOT_CREATE_TRANS_FACT"; public static final String TRANSLET_NAME_JAVA_CONFLICT = "TRANSLET_NAME_JAVA_CONFLICT"; public static final String INVALID_QNAME_ERR = "INVALID_QNAME_ERR"; public static final String INVALID_NCNAME_ERR = "INVALID_NCNAME_ERR"; public static final String INVALID_METHOD_IN_OUTPUT = "INVALID_METHOD_IN_OUTPUT"; public static final String OUTLINE_ERR_TRY_CATCH = "OUTLINE_ERR_TRY_CATCH"; public static final String OUTLINE_ERR_UNBALANCED_MARKERS = "OUTLINE_ERR_UNBALANCED_MARKERS"; public static final String OUTLINE_ERR_DELETED_TARGET = "OUTLINE_ERR_DELETED_TARGET"; public static final String OUTLINE_ERR_METHOD_TOO_BIG = "OUTLINE_ERR_METHOD_TOO_BIG"; // All error messages are localized and are stored in resource bundles. // This array and the following 4 strings are read from that bundle. private static ResourceBundle _bundle; public final static String ERROR_MESSAGES_KEY = "ERROR_MESSAGES_KEY"; public final static String COMPILER_ERROR_KEY = "COMPILER_ERROR_KEY"; public final static String COMPILER_WARNING_KEY = "COMPILER_WARNING_KEY"; public final static String RUNTIME_ERROR_KEY = "RUNTIME_ERROR_KEY"; static { _bundle = ResourceBundle.getBundle( "org.apache.xalan.xsltc.compiler.util.ErrorMessages", Locale.getDefault()); } public ErrorMsg(String code) { _code = code; _line = 0; } public ErrorMsg(Throwable e) { _code = null; _message = e.getMessage(); _line = 0; } public ErrorMsg(String message, int line) { _code = null; _message = message; _line = line; } public ErrorMsg(String code, int line, Object param) { _code = code; _line = line; _params = new Object[] { param }; } public ErrorMsg(String code, Object param) { this(code); _params = new Object[1]; _params[0] = param; } public ErrorMsg(String code, Object param1, Object param2) { this(code); _params = new Object[2]; _params[0] = param1; _params[1] = param2; } public ErrorMsg(String code, SyntaxTreeNode node) { _code = code; _url = getFileName(node); _line = node.getLineNumber(); } public ErrorMsg(String code, Object param1, SyntaxTreeNode node) { _code = code; _url = getFileName(node); _line = node.getLineNumber(); _params = new Object[1]; _params[0] = param1; } public ErrorMsg(String code, Object param1, Object param2, SyntaxTreeNode node) { _code = code; _url = getFileName(node); _line = node.getLineNumber(); _params = new Object[2]; _params[0] = param1; _params[1] = param2; } private String getFileName(SyntaxTreeNode node) { Stylesheet stylesheet = node.getStylesheet(); if (stylesheet != null) return stylesheet.getSystemId(); else return null; } private String formatLine() { StringBuffer result = new StringBuffer(); if (_url != null) { result.append(_url); result.append(": "); } if (_line > 0) { result.append("line "); result.append(Integer.toString(_line)); result.append(": "); } return result.toString(); } /** * This version of toString() uses the _params instance variable * to format the message. If the _code is negative * the use _message as the error string. */ public String toString() { String suffix = (_params == null) ? (null != _code ? getErrorMessage() : _message) : MessageFormat.format(getErrorMessage(), _params); return formatLine() + suffix; } public String toString(Object obj) { Object params[] = new Object[1]; params[0] = obj.toString(); String suffix = MessageFormat.format(getErrorMessage(), params); return formatLine() + suffix; } public String toString(Object obj0, Object obj1) { Object params[] = new Object[2]; params[0] = obj0.toString(); params[1] = obj1.toString(); String suffix = MessageFormat.format(getErrorMessage(), params); return formatLine() + suffix; } /** * Return an ErrorMessages string corresponding to the _code * This function is temporary until the three special-cased keys * below are moved into ErrorMessages * * @return ErrorMessages string */ private String getErrorMessage() { return _bundle.getString(_code); } // If the _isWarningError flag is true, the error is treated as // a warning by the compiler, but should be reported as an error // to the ErrorListener. This is a workaround for the TCK failure // ErrorListener.errorTests.error001. public void setWarningError(boolean flag) { _isWarningError = flag; } public boolean isWarningError() { return _isWarningError; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/BooleanType.java0000644000175000017500000001673010721374031026217 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BooleanType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFGE; import org.apache.bcel.generic.IFGT; import org.apache.bcel.generic.IFLE; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.IF_ICMPGE; import org.apache.bcel.generic.IF_ICMPGT; import org.apache.bcel.generic.IF_ICMPLE; import org.apache.bcel.generic.IF_ICMPLT; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class BooleanType extends Type { protected BooleanType() {} public String toString() { return "boolean"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return "Z"; } public boolean isSimple() { return true; } public org.apache.bcel.generic.Type toJCType() { return org.apache.bcel.generic.Type.BOOLEAN; } /** * Translates a real into an object of internal type type. The * translation to int is undefined since booleans are always converted to * reals in arithmetic expressions. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else if (type == Type.Real) { translateTo(classGen, methodGen, (RealType) type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects a boolean on the stack and pushes a string. If the value on the * stack is zero, then the string 'false' is pushed. Otherwise, the string * 'true' is pushed. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final BranchHandle falsec = il.append(new IFEQ(null)); il.append(new PUSH(cpg, "true")); final BranchHandle truec = il.append(new GOTO(null)); falsec.setTarget(il.append(new PUSH(cpg, "false"))); truec.setTarget(il.append(NOP)); } /** * Expects a boolean on the stack and pushes a real. The value "true" is * converted to 1.0 and the value "false" to 0.0. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { methodGen.getInstructionList().append(I2D); } /** * Expects a boolean on the stack and pushes a boxed boolean. * Boxed booleans are represented by an instance of * java.lang.Boolean. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(BOOLEAN_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new INVOKESPECIAL(cpg.addMethodref(BOOLEAN_CLASS, "", "(Z)V"))); } /** * Translates an internal boolean into an external (Java) boolean. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { if (clazz == java.lang.Boolean.TYPE) { methodGen.getInstructionList().append(NOP); } // Is Boolean <: clazz? I.e. clazz in { Boolean, Object } else if (clazz.isAssignableFrom(java.lang.Boolean.class)) { translateTo(classGen, methodGen, Type.Reference); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an external (Java) boolean into internal boolean. */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { translateTo(classGen, methodGen, clazz); } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(BOOLEAN_CLASS))); il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS, BOOLEAN_VALUE, BOOLEAN_VALUE_SIG))); } public Instruction LOAD(int slot) { return new ILOAD(slot); } public Instruction STORE(int slot) { return new ISTORE(slot); } public BranchInstruction GT(boolean tozero) { return tozero ? (BranchInstruction) new IFGT(null) : (BranchInstruction) new IF_ICMPGT(null); } public BranchInstruction GE(boolean tozero) { return tozero ? (BranchInstruction) new IFGE(null) : (BranchInstruction) new IF_ICMPGE(null); } public BranchInstruction LT(boolean tozero) { return tozero ? (BranchInstruction) new IFLT(null) : (BranchInstruction) new IF_ICMPLT(null); } public BranchInstruction LE(boolean tozero) { return tozero ? (BranchInstruction) new IFLE(null) : (BranchInstruction) new IF_ICMPLE(null); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NodeSortRecordFactGenerator.java0000644000175000017500000000315410721374031031333 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSortRecordFactGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.xalan.xsltc.compiler.Stylesheet; /** * Generator for subclasses of NodeSortRecordFactory. * @author Santiago Pericas-Geertsen */ public final class NodeSortRecordFactGenerator extends ClassGenerator { public NodeSortRecordFactGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); } /** * Returns true since this class is external to the * translet. */ public boolean isExternal() { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/MatchGenerator.java0000644000175000017500000000601110721374031026670 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MatchGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.Type; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class MatchGenerator extends MethodGenerator { private static int CURRENT_INDEX = 1; private int _iteratorIndex = INVALID_INDEX; private final Instruction _iloadCurrent; private final Instruction _istoreCurrent; private Instruction _aloadDom; public MatchGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_INDEX); _istoreCurrent = new ISTORE(CURRENT_INDEX); } public Instruction loadCurrentNode() { return _iloadCurrent; } public Instruction storeCurrentNode() { return _istoreCurrent; } public int getHandlerIndex() { return INVALID_INDEX; // not available } /** * Get index of the register where the DOM is stored. */ public Instruction loadDOM() { return _aloadDom; } /** * Set index where the reference to the DOM is stored. */ public void setDomIndex(int domIndex) { _aloadDom = new ALOAD(domIndex); } /** * Get index of the register where the current iterator is stored. */ public int getIteratorIndex() { return _iteratorIndex; } /** * Set index of the register where the current iterator is stored. */ public void setIteratorIndex(int iteratorIndex) { _iteratorIndex = iteratorIndex; } public int getLocalIndex(String name) { if (name.equals("current")) { return CURRENT_INDEX; } return super.getLocalIndex(name); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/StringStack.java0000644000175000017500000000257210721374031026231 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringStack.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.Stack; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class StringStack extends Stack { static final long serialVersionUID = -1506910875640317898L; public String peekString() { return (String) super.peek(); } public String popString() { return (String) super.pop(); } public String pushString(String val) { return (String) super.push(val); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport12.java0000644000175000017500000001177310721374033027351 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/Type.java0000644000175000017500000002255410721374032024721 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Type.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.Instruction; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; import org.apache.xalan.xsltc.compiler.NodeTest; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public abstract class Type implements Constants { public static final Type Int = new IntType(); public static final Type Real = new RealType(); public static final Type Boolean = new BooleanType(); public static final Type NodeSet = new NodeSetType(); public static final Type String = new StringType(); public static final Type ResultTree = new ResultTreeType(); public static final Type Reference = new ReferenceType(); public static final Type Void = new VoidType(); public static final Type Object = new ObjectType(java.lang.Object.class); public static final Type Node = new NodeType(NodeTest.ANODE); public static final Type Root = new NodeType(NodeTest.ROOT); public static final Type Element = new NodeType(NodeTest.ELEMENT); public static final Type Attribute = new NodeType(NodeTest.ATTRIBUTE); public static final Type Text = new NodeType(NodeTest.TEXT); public static final Type Comment = new NodeType(NodeTest.COMMENT); public static final Type Processing_Instruction = new NodeType(NodeTest.PI); /** * Factory method to instantiate object types. Returns a pre-defined * instance for "java.lang.Object" and "java.lang.String". */ public static Type newObjectType(String javaClassName) { if (javaClassName == "java.lang.Object") { return Type.Object; } else if (javaClassName == "java.lang.String") { return Type.String; } else { return new ObjectType(javaClassName); } } /** * Factory method to instantiate object types. Returns a pre-defined * instance for java.lang.Object.class and java.lang.String.class. */ public static Type newObjectType(Class clazz) { if (clazz == java.lang.Object.class) { return Type.Object; } else if (clazz == java.lang.String.class) { return Type.String; } else { return new ObjectType(clazz); } } /** * Returns a string representation of this type. */ public abstract String toString(); /** * Returns true if this and other are identical types. */ public abstract boolean identicalTo(Type other); /** * Returns true if this type is a numeric type. Redefined in NumberType. */ public boolean isNumber() { return false; } /** * Returns true if this type has no object representaion. Redefined in * ResultTreeType. */ public boolean implementedAsMethod() { return false; } /** * Returns true if this type is a simple type. Redefined in NumberType, * BooleanType and StringType. */ public boolean isSimple() { return false; } public abstract org.apache.bcel.generic.Type toJCType(); /** * Returns the distance between two types. This measure is used to select * overloaded functions/operators. This method is typically redefined by * the subclasses. */ public int distanceTo(Type type) { return type == this ? 0 : Integer.MAX_VALUE; } /** * Returns the signature of an internal type's external representation. */ public abstract String toSignature(); /** * Translates an object of this type to an object of type * type. * Expects an object of the former type and pushes an object of the latter. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } /** * Translates object of this type to an object of type type. * Expects an object of the former type and pushes an object of the latter * if not boolean. If type type is boolean then a branchhandle * list (to be appended to the false list) is returned. */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, Type type) { FlowList fl = null; if (type == Type.Boolean) { fl = translateToDesynthesized(classGen, methodGen, (BooleanType)type); } else { translateTo(classGen, methodGen, type); } return fl; } /** * Translates an object of this type to an non-synthesized boolean. It * does not push a 0 or a 1 but instead returns branchhandle list to be * appended to the false list. */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); return null; } /** * Translates an object of this type to the external (Java) type denoted * by clazz. This method is used to translate parameters * when external functions are called. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getClass().toString()); classGen.getParser().reportError(Constants.FATAL, err); } /** * Translates an external (Java) type denoted by clazz to * an object of this type. This method is used to translate return values * when external functions are called. */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, clazz.getClass().toString(), toString()); classGen.getParser().reportError(Constants.FATAL, err); } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), "["+toString()+"]"); classGen.getParser().reportError(Constants.FATAL, err); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, "["+toString()+"]", toString()); classGen.getParser().reportError(Constants.FATAL, err); } /** * Returns the class name of an internal type's external representation. */ public String getClassName() { return(EMPTYSTRING); } public Instruction ADD() { return null; // should never be called } public Instruction SUB() { return null; // should never be called } public Instruction MUL() { return null; // should never be called } public Instruction DIV() { return null; // should never be called } public Instruction REM() { return null; // should never be called } public Instruction NEG() { return null; // should never be called } public Instruction LOAD(int slot) { return null; // should never be called } public Instruction STORE(int slot) { return null; // should never be called } public Instruction POP() { return POP; } public BranchInstruction GT(boolean tozero) { return null; // should never be called } public BranchInstruction GE(boolean tozero) { return null; // should never be called } public BranchInstruction LT(boolean tozero) { return null; // should never be called } public BranchInstruction LE(boolean tozero) { return null; // should never be called } public Instruction CMP(boolean less) { return null; // should never be called } public Instruction DUP() { return DUP; // default } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_hu.java0000644000175000017500000012544510721374031027257 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_hu.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_hu extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Egyn\u00e9l t\u00f6bb st\u00edluslap van meghat\u00e1rozva ugyanabban a f\u00e1jlban."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "A(z) ''{0}'' sablon m\u00e1r meg van hat\u00e1rozva ebben a st\u00edluslapban."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "A(z) ''{0}'' sablon nincs meghat\u00e1rozva ebben a st\u00edluslapban."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "A(z) ''{0}'' v\u00e1ltoz\u00f3 t\u00f6bbsz\u00f6r van meghat\u00e1rozva ugyanabban a hat\u00f3k\u00f6rben."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "A(z) ''{0}'' v\u00e1ltoz\u00f3 vagy param\u00e9ter nincs meghat\u00e1rozva."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "A(z) ''{0}'' oszt\u00e1ly nem tal\u00e1lhat\u00f3."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Nem tal\u00e1lhat\u00f3 a(z) ''{0}'' k\u00fcls\u0151 met\u00f3dus (nyilv\u00e1nosnak kell lennie)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Nem lehet \u00e1talak\u00edtani az argumentum/visszat\u00e9r\u00e9si t\u00edpust a(z) ''{0}'' met\u00f3dus h\u00edv\u00e1s\u00e1ban."}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "A(z) ''{0}'' f\u00e1jl vagy URI nem tal\u00e1lhat\u00f3."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "\u00c9rv\u00e9nytelen URI: ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "A(z) ''{0}'' f\u00e1jlt vagy URI nem nyithat\u00f3 meg. "}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Hi\u00e1nyzik az vagy elem."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "A(z) ''{0}'' n\u00e9vt\u00e9r el\u0151tag nincs deklar\u00e1lva."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Nem lehet feloldani a(z) ''{0}'' f\u00fcggv\u00e9ny h\u00edv\u00e1s\u00e1t."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "A(z) ''{0}'' argumentum\u00e1nak egy liter\u00e1l karaktersorozatnak kell lennie."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Hiba t\u00f6rt\u00e9nt a(z) ''{0}'' XPath kifejez\u00e9s \u00e9rtelmez\u00e9sekor."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Hi\u00e1nyzik a(z) ''{0}'' k\u00f6telez\u0151 attrib\u00fatum."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Nem megengedett karakter (''{0}'') szerepel az XPath kifejez\u00e9sben."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Nem megengedett n\u00e9v (''{0}'') szerepel a feldolgoz\u00e1si utas\u00edt\u00e1sban."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "A(z) ''{0}'' attrib\u00fatum k\u00edv\u00fcl esik az elemen."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Illeg\u00e1lis attrib\u00fatum: ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "K\u00f6rk\u00f6r\u00f6s import\u00e1l\u00e1s/tartalmaz\u00e1s. A(z) ''{0}'' st\u00edluslap m\u00e1r be van t\u00f6ltve."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Az eredm\u00e9nyfa-r\u00e9szleteket nem lehet rendezni (az elemek figyelmen k\u00edv\u00fcl maradnak). Rendeznie kell a node-okat, amikor eredm\u00e9nyf\u00e1t hoz l\u00e9tre."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "M\u00e1r defini\u00e1lva van a(z) ''{0}'' decim\u00e1lis form\u00e1z\u00e1s."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "Az XSLTC nem t\u00e1mogatja a(z) ''{0}'' XSL verzi\u00f3t."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "K\u00f6rk\u00f6r\u00f6s v\u00e1ltoz\u00f3/param\u00e9ter hivatkoz\u00e1s a(z) ''{0}'' helyen."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Ismeretlen oper\u00e1tort haszn\u00e1lt a bin\u00e1ris kifejez\u00e9sben."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Nem megengedett argumentumo(ka)t haszn\u00e1lt a f\u00fcggv\u00e9nyh\u00edv\u00e1sban."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "A document() f\u00fcggv\u00e9ny m\u00e1sodik argumentuma egy node-k\u00e9szlet kell legyen."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Legal\u00e1bb egy elem sz\u00fcks\u00e9ges az -ban."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Csak egy elem megengedett -ban."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, "Az csak -on bel\u00fcl haszn\u00e1lhat\u00f3."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, "Az csak -on bel\u00fcl haszn\u00e1lhat\u00f3."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Csak \u00e9s elemek megengedettek az -ban."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "Hi\u00e1nyzik az -b\u0151l a 'name' attrib\u00fatum."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Nem megengedett gyermek elem."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Az elem neve nem lehet ''{0}''."}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Az attrib\u00fatum neve nem lehet ''{0}''."}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Sz\u00f6vegadat szerepel a fels\u0151 szint\u0171 elemen k\u00edv\u00fcl."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Nincs megfelel\u0151en konfigur\u00e1lva a JAXP \u00e9rtelmez\u0151."}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Helyrehozhatatlan bels\u0151 XSLTC hiba t\u00f6rt\u00e9nt: ''{0}'' "}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Nem t\u00e1mogatott XSL elem: ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Ismeretlen XSLTC kiterjeszt\u00e9s: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "A bemen\u0151 dokumentum nem st\u00edluslap (az XSL n\u00e9vt\u00e9r nincs deklar\u00e1lva a root elemben)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "A(z) ''{0}'' st\u00edluslap c\u00e9l nem tal\u00e1lhat\u00f3."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Nincs megval\u00f3s\u00edtva: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "A bemen\u0151 dokumentum nem tartalmaz XSL st\u00edluslapot."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "A(z) ''{0}'' elem nem \u00e9rtelmezhet\u0151. "}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "A(z) attrib\u00fatuma node, node-k\u00e9szlet, sz\u00f6veg vagy sz\u00e1m lehet."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "A kimen\u0151 XML dokumentum-verzi\u00f3 1.0 kell legyen."}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Ismeretlen oper\u00e1tort haszn\u00e1lt a rel\u00e1ci\u00f3s kifejez\u00e9sben."}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Neml\u00e9tez\u0151 attrib\u00fatumk\u00e9szletet (''{0}'') pr\u00f3b\u00e1lt haszn\u00e1lni."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Nem lehet \u00e9rtelmezni a(z) ''{0}'' attrib\u00fatum\u00e9rt\u00e9k-sablont."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Ismeretlen adatt\u00edpus szerepel a(z) ''{0}'' oszt\u00e1ly al\u00e1\u00edr\u00e1s\u00e1ban."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Nem lehet a(z) ''{0}'' adatt\u00edpust ''{1}'' t\u00edpusra konvert\u00e1lni."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Ez a Templates oszt\u00e1ly nem tartalmaz \u00e9rv\u00e9nyes translet oszt\u00e1lymeghat\u00e1roz\u00e1st."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Ez a Templates oszt\u00e1ly nem tartalmaz ''{0}'' nev\u0171 oszt\u00e1lyt."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Nem lehet bet\u00f6lteni a(z) ''{0}'' translet oszt\u00e1lyt."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "A translet oszt\u00e1ly bet\u00f6lt\u0151d\u00f6tt, de nem siker\u00fclt l\u00e9trehozni a translet p\u00e9ld\u00e1nyt."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Megpr\u00f3b\u00e1lta null\u00e9rt\u00e9kre \u00e1ll\u00edtani a(z) ''{0}'' objektum ErrorListener fel\u00fclet\u00e9t."}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Az XSLTC csak a StreamSource, SAXSource \u00e9s DOMSource interf\u00e9szeket t\u00e1mogatja."}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "A(z) ''{0}'' met\u00f3dusnak \u00e1tadott source objektumnak nincs tartalma."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Nem siker\u00fclt leford\u00edtani a st\u00edluslapot."}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "A TransformerFactory oszt\u00e1ly nem simeri fel a(z) ''{0}'' attrib\u00fatumot."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "A setResult() met\u00f3dust a startDocument() h\u00edv\u00e1sa el\u0151tt kell megh\u00edvni."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "A transformer interf\u00e9sz nem tartalmaz be\u00e1gyazott translet objektumot."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Nincs defini\u00e1lva kimenetkezel\u0151 az \u00e1talak\u00edt\u00e1s eredm\u00e9ny\u00e9hez."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "A(z) ''{0}'' met\u00f3dusnak \u00e1tadott result objektum \u00e9rv\u00e9nytelen."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "\u00c9rv\u00e9nytelen Transformer tulajdons\u00e1got (''{0}'') pr\u00f3b\u00e1lt meg el\u00e9rni."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Nem lehet l\u00e9trehozni a SAX2DOM adaptert: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() h\u00edv\u00e1sa systemId be\u00e1ll\u00edt\u00e1sa n\u00e9lk\u00fcl t\u00f6rt\u00e9nt."}, { ErrorMsg.ER_RESULT_NULL, "Az eredm\u00e9ny nem lehet null"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "A(z) {0} param\u00e9ter \u00e9rt\u00e9ke egy \u00e9rv\u00e9nyes J\u00e1va objektum kell legyen"}, {ErrorMsg.COMPILE_STDIN_ERR, "A -i kapcsol\u00f3t a -o kapcsol\u00f3val egy\u00fctt kell haszn\u00e1lni."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "Haszn\u00e1lat:\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nBE\u00c1LL\u00cdT\u00c1SOK\n -o hozz\u00e1rendeli a nevet az el\u0151\u00e1ll\u00edtott\n translethez. Alap\u00e9rtelmez\u00e9s szerint\n a translet neve a \n nev\u00e9b\u0151l sz\u00e1rmazik. Ez a be\u00e1ll\u00edt\u00e1s figyelmen\n k\u00edv\u00fcl marad, ha t\u00f6bb st\u00edluslapot ford\u00edt.\n -d meghat\u00e1rozza a translet c\u00e9lk\u00f6nyvt\u00e1r\u00e1t\n -j a translet oszt\u00e1lyokat egy jar f\u00e1jlba csomagolja,\n aminek a nev\u00e9t a attrib\u00fatum adja meg\n -p meghat\u00e1rozza az \u00f6sszes el\u0151\u00e1ll\u00edtott translet oszt\u00e1ly\n csomagn\u00e9v el\u0151tagj\u00e1t.\n -n enged\u00e9lyezi a sablonbeemel\u00e9st\n (az alap\u00e9rtelmezett viselked\u00e9s \u00e1ltal\u00e1ban jobb).\n -x bekapcsolja a tov\u00e1bbi hibakeres\u00e9si \u00fczeneteket\n -u \u00e9rtelmezi a argumentumokat \u00e9s URL c\u00edmeket\n -i k\u00e9nyszer\u00edti a ford\u00edt\u00f3t, hogy a st\u00edluslapot az stdin\n bemenetr\u0151l olvassa\n -v megjelen\u00edti a ford\u00edt\u00f3 verzi\u00f3sz\u00e1m\u00e1t\n -h megjelen\u00edti ezt a haszn\u00e1lati utas\u00edt\u00e1st\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "HASZN\u00c1LAT:\n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [=<\u00e9rt\u00e9k1> ...]\n\n a translet seg\u00edts\u00e9g\u00e9vel \u00e1talak\u00edtja a\n param\u00e9terben megadott dokumentumot. A translet\n vagy a felhaszn\u00e1l\u00f3 CLASSPATH v\u00e1ltoz\u00f3ja\n alapj\u00e1n, vagy a megadott -ban tal\u00e1lhat\u00f3 meg.\nBE\u00c1LL\u00cdT\u00c1SOK\n -j megadja a jar f\u00e1jlt a translet bet\u00f6lt\u00e9s\u00e9hez\n -x bekapcsolja a tov\u00e1bbi hibakeres\u00e9si \u00fczeneteket\n -n az \u00e1talak\u00edt\u00e1st az param\u00e9terben megadott\n alkalommal futtatja le, \u00e9s megjelen\u00edti a profiloz\u00e1si\n inform\u00e1ci\u00f3kat\n -u megadja a bemeneti XML dokumentum URL c\u00edm\u00e9t\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, "Az csak -en vagy -en bel\u00fcl haszn\u00e1lhat\u00f3."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "A(z) ''{0}'' kimeneti k\u00f3dol\u00e1st nem t\u00e1mogatja ez a JVM."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Szintaktikai hiba a(z) ''{0}'' kifejez\u00e9sben."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "A(z) ''{0}'' k\u00fcls\u0151 konstruktor nem tal\u00e1lhat\u00f3."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "A(z) ''{0}'' nem statikus Java f\u00fcggv\u00e9ny els\u0151 argumentuma nem \u00e9rv\u00e9nyes objektumhivatkoz\u00e1s."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Hiba t\u00f6rt\u00e9nt a(z) ''{0}'' kifejez\u00e9s t\u00edpus\u00e1nak ellen\u0151rz\u00e9sekor."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Hiba t\u00f6rt\u00e9nt egy ismeretlen helyen l\u00e9v\u0151 kifejez\u00e9s t\u00edpus\u00e1nak ellen\u0151rz\u00e9sekor."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "A(z) ''{0}'' parancssori param\u00e9ter \u00e9rv\u00e9nytelen."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "A(z) ''{0}'' parancssori param\u00e9terhez hi\u00e1nyzik egy k\u00f6telez\u0151 argumentum."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "FIGYELMEZTET\u00c9S: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "FIGYELMEZTET\u00c9S: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "S\u00daLYOS HIBA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "S\u00daLYOS HIBA: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "HIBA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "HIBA: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "\u00c1talak\u00edt\u00e1s a(z) ''{0}'' translet seg\u00edts\u00e9g\u00e9vel. "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "\u00c1talak\u00edt\u00e1s a(z) ''{0}'' translet haszn\u00e1lat\u00e1val a(z) ''{1}'' jar f\u00e1jlb\u00f3l. "}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Nem lehet l\u00e9trehozni a(z) ''{0}'' TransformerFactory oszt\u00e1ly p\u00e9ld\u00e1ny\u00e1t."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "A(z) ''{0}'' n\u00e9v nem haszn\u00e1lhat\u00f3 a translet oszt\u00e1ly nevek\u00e9nt, mivel olyan karaktereket tartalmaz, amelyek nem megengedettek Java oszt\u00e1lyok nev\u00e9ben. A rendszer a(z) ''{1}'' nevet haszn\u00e1lta helyette. "}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Ford\u00edt\u00e1s hib\u00e1k:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Ford\u00edt\u00e1si figyelmeztet\u00e9sek:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Translet hib\u00e1k:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Egy olyan attrib\u00fatum, amelynek az \u00e9rt\u00e9ke csak QName vagy QName \u00e9rt\u00e9kek sz\u00f3k\u00f6zzel elv\u00e1lasztott list\u00e1ja lehet, ''{0}'' \u00e9rt\u00e9kkel rendelkezett."}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Egy olyan attrib\u00fatum, amelynek \u00e9rt\u00e9ke csak NCName lehet, ''{0}'' \u00e9rt\u00e9kkel rendelkezett."}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Egy elem met\u00f3dus attrib\u00fatum\u00e1nak \u00e9rt\u00e9ke ''{0}'' volt. Az \u00e9rt\u00e9k csak ''xml'', ''html'', ''text'' vagy qname-but-not-ncname lehet."}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "A szolg\u00e1ltat\u00e1s neve nem lehet null a TransformerFactory.getFeature(String name) met\u00f3dusban."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "A szolg\u00e1ltat\u00e1s neve nem lehet null a TransformerFactory.setFeature(String name, boolean value) met\u00f3dusban."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "A(z) ''{0}'' szolg\u00e1ltat\u00e1s nem \u00e1ll\u00edthat\u00f3 be ehhez a TransformerFactory oszt\u00e1lyhoz."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/VoidType.java0000644000175000017500000000611710721374032025540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VoidType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class VoidType extends Type { protected VoidType() {} public String toString() { return "void"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return "V"; } public org.apache.bcel.generic.Type toJCType() { return null; // should never be called } public Instruction POP() { return NOP; } /** * Translates a void into an object of internal type type. * This translation is needed when calling external functions * that return void. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates a void into a string by pushing the empty string ''. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(classGen.getConstantPool(), "")); } /** * Translates an external (primitive) Java type into a void. * Only an external "void" can be converted to this class. */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { if (!clazz.getName().equals("void")) { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_pt_BR.java0000644000175000017500000012152410721374031027643 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_pt_BR.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_pt_BR extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Mais de uma p\u00e1gina de estilo definida no mesmo arquivo. "}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "O template ''{0}'' j\u00e1 est\u00e1 definido nesta folha de estilo."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "O template ''{0}'' n\u00e3o est\u00e1 definido nesta folha de estilo."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "A vari\u00e1vel ''{0}'' tem sua multiplica\u00e7\u00e3o definida no mesmo escopo. "}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "A vari\u00e1vel ou o par\u00e2metro ''{0}'' n\u00e3o est\u00e1 definido. "}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "N\u00e3o \u00e9 poss\u00edvel localizar a classe ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "N\u00e3o \u00e9 poss\u00edvel localizar o m\u00e9todo externo ''{0}'' (deve ser p\u00fablico)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "N\u00e3o \u00e9 poss\u00edvel converter o tipo de argumento/retorno na chamada para o m\u00e9todo ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Arquivo ou URI ''{0}'' n\u00e3o localizado."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI inv\u00e1lido ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "N\u00e3o \u00e9 poss\u00edvel abrir o arquivo ou URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Esperado elemento ou ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "O prefixo de espa\u00e7o de nomes ''{0}'' n\u00e3o foi declarado."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Imposs\u00edvel resolver a chamada para a fun\u00e7\u00e3o ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "O argumento para ''{0}'' deve ser uma cadeia literal."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Erro ao analisar a express\u00e3o XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "O atributo requerido ''{0}'' est\u00e1 ausente. "}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Caractere inv\u00e1lido ''{0}'' na express\u00e3o XPath. "}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Nome inv\u00e1lido ''{0}'' para instru\u00e7\u00e3o de processamento. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Atributo ''{0}'' fora do elemento. "}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Atributo inv\u00e1lido ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Import/include circular. A folha de estilo ''{0}'' j\u00e1 foi carregada. "}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Os fragmentos da \u00e1rvore de resultados n\u00e3o podem ser ordenados (os elementos ser\u00e3o ignorados). Voc\u00ea deve ordenar os n\u00f3s quando criar a \u00e1rvore de resultados. "}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "A formata\u00e7\u00e3o decimal ''{0}'' j\u00e1 est\u00e1 definida. "}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "A vers\u00e3o de XSL ''{0}'' n\u00e3o \u00e9 suportada por XSLTC."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Refer\u00eancia \u00e0 vari\u00e1vel/par\u00e2metro circular em ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Operador desconhecido para express\u00e3o bin\u00e1ria. "}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Argumentos inv\u00e1lidos para chamada de fun\u00e7\u00e3o. "}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "O segundo argumento para a fun\u00e7\u00e3o document() deve ser um node-set."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Pelo menos um elemento \u00e9 requerido em ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Apenas um elemento \u00e9 permitido em ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " somente pode ser utilizado em ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " somente pode ser utilizado em ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Apenas os elementos e s\u00e3o permitidos em ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " n\u00e3o possui o atributo 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Elemento filho inv\u00e1lido. "}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Voc\u00ea n\u00e3o pode chamar um elemento ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Voc\u00ea n\u00e3o pode chamar um atributo ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Dados de texto fora do elemento de n\u00edvel superior. "}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Analisador JAXP n\u00e3o configurado corretamente "}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Erro interno de XSLTC irrecuper\u00e1vel: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Elemento XSL n\u00e3o suportado ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Extens\u00e3o XSLTC n\u00e3o reconhecida ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "O documento de entrada n\u00e3o \u00e9 uma p\u00e1gina de estilo (o espa\u00e7o de nomes XSL n\u00e3o est\u00e1 declarado no elemento root)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "N\u00e3o foi poss\u00edvel localizar o destino da folha de estilo ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "N\u00e3o implementado: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "O documento de entrada n\u00e3o cont\u00e9m uma p\u00e1gina de estilo XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "N\u00e3o foi poss\u00edvel analisar o elemento ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "O atributo use de deve ser node, node-set, string ou number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "A vers\u00e3o do documento XML de sa\u00edda deve ser 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Operador desconhecido para express\u00e3o relacional "}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Tentando utilizar um conjunto de atributos n\u00e3o existente ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "N\u00e3o \u00e9 poss\u00edvel analisar o template de valor de atributo ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Tipo de dados desconhecido na assinatura da classe ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "N\u00e3o \u00e9 poss\u00edvel converter o tipo de dados ''{0}'' em ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Este template n\u00e3o cont\u00e9m uma defini\u00e7\u00e3o de classe translet v\u00e1lida. "}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Estes Templates n\u00e3o cont\u00eam uma classe com o nome ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "N\u00e3o foi poss\u00edvel carregar a classe translet ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Classe translet carregada, mas \u00e9 imposs\u00edvel criar a inst\u00e2ncia de translet. "}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Tentando definir ErrorListener de ''{0}'' como nulo "}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Apenas StreamSource, SAXSource e DOMSource s\u00e3o suportados por XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "O objeto Source transmitido para ''{0}'' n\u00e3o possui conte\u00fado. "}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "N\u00e3o foi poss\u00edvel compilar a p\u00e1gina de estilo "}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory n\u00e3o reconhece o atributo ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() deve ser chamado antes de startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer n\u00e3o possui nenhum objeto translet encapsulado. "}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Nenhuma rotina de tratamento de sa\u00edda definida para o resultado de transforma\u00e7\u00e3o. "}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "O objeto Result transmitido para ''{0}'' \u00e9 inv\u00e1lido. "}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Tentando acessar a propriedade Transformer inv\u00e1lida ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "N\u00e3o foi poss\u00edvel criar o adaptador SAX2DOM: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() foi chamado sem systemId estar definido. "}, { ErrorMsg.ER_RESULT_NULL, "O resultado n\u00e3o deve ser nulo"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "O valor do par\u00e2metro {0} deve ser um Objeto Java v\u00e1lido"}, {ErrorMsg.COMPILE_STDIN_ERR, "A op\u00e7\u00e3o -i deve ser utilizada com a op\u00e7\u00e3o -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o atribui o nome para o\n translet gerado. Por padr\u00e3o, o nome convertido \u00e9\n derivado do nome de . Esta op\u00e7\u00e3o\nser\u00e1 ignorada se estiverem sendo compiladas v\u00e1rias p\u00e1ginas de estilo.\n -d especifica um diret\u00f3rio de destino para translet\n -j empacota classes translet em um arquivo jar do\nnome especificado como \n -p especifica um prefixo de nome de pacote para todas as\nclasses translet geradas.\n -n ativa a seq\u00fc\u00eancia de templates (melhor comportamento padr\u00e3o\nna m\u00e9dia).\n -x ativa a sa\u00edda de mensagem de depura\u00e7\u00e3o adicional\n -u interpreta argumentos como URLs\n -i for\u00e7a o compilador a ler a folha de estilo de stdin\n -v imprime a vers\u00e3o do compilador\n -h imprime esta instru\u00e7\u00e3o de uso\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n utiliza o translet para transformar um documento XML \n especificado como . A translet no\n CLASSPATH do usu\u00e1rio ou no opcionalmente especificado.\nOPTIONS\n -j especifica um arquivo jar a partir do qual ser\u00e1 carregado o translet\n -x ativa a sa\u00edda de mensagem de depura\u00e7\u00e3o adicional\n -n executa os hor\u00e1rios de transforma\u00e7\u00e3o e\n exibe informa\u00e7\u00f5es sobre tra\u00e7ado de perfil\n -u especifica o documento XML de entrada como uma URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " somente pode ser utilizado em ou ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "A codifica\u00e7\u00e3o de sa\u00edda ''{0}'' n\u00e3o \u00e9 suportada nesta JVM."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Erro de sintaxe em ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "N\u00e3o \u00e9 poss\u00edvel localizar o construtor externo ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "O primeiro argumento para a fun\u00e7\u00e3o Java n\u00e3o est\u00e1tica ''{0}'' n\u00e3o \u00e9 uma refer\u00eancia de objeto v\u00e1lida. "}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Erro ao verificar o tipo de express\u00e3o ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Erro ao verificar tipo de express\u00e3o em uma localiza\u00e7\u00e3o desconhecida. "}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "A op\u00e7\u00e3o da linha de comandos ''{0}'' n\u00e3o \u00e9 v\u00e1lida. "}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "A op\u00e7\u00e3o da linha de comandos ''{0}'' n\u00e3o cont\u00e9m um argumento requerido. "}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "AVISO: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "AVISO: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "ERRO FATAL: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "ERRO FATAL: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERRO: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERRO: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transformar utilizando translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transformar utilizando translet ''{0}'' do arquivo jar ''{1}'' "}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "N\u00e3o foi poss\u00edvel criar uma inst\u00e2ncia da classe TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "N\u00e3o foi poss\u00edvel utilizar o nome ''{0}'' como o nome da classe translet porque ele cont\u00e9m caracteres n\u00e3o permitidos no nome da classe Java. O nome ''{1}'' foi utilizado como alternativa."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Erros do compilador:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Avisos do compilador:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Erros de translet:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Um atributo cujo valor deve ser um QName ou uma lista de QNames separados por espa\u00e7os em branco apresentou o valor ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Um atributo cujo valor deve ser um NCName apresentou o valor ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "O atributo de m\u00e9todo de um elemento apresentou o valor ''{0}''. O valor deve ser do tipo ''xml'', ''html'', ''text'' ou qname-but-not-ncname"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "O nome do recurso n\u00e3o pode ser nulo em TransformerFactory.getFeature(String name)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "O nome do recurso n\u00e3o pode ser nulo em TransformerFactory.setFeature(String name, boolean value)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "N\u00e3o \u00e9 poss\u00edvel definir o recurso ''{0}'' neste TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NodeSortRecordGenerator.java0000644000175000017500000000402110721374033030531 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSortRecordGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.Instruction; import org.apache.xalan.xsltc.compiler.Stylesheet; /** * * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class NodeSortRecordGenerator extends ClassGenerator { private static final int TRANSLET_INDEX = 4; // translet private final Instruction _aloadTranslet; public NodeSortRecordGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); } /** * The index of the translet pointer within the execution of * the test method. */ public Instruction loadTranslet() { return _aloadTranslet; } /** * Returns true since this class is external to the * translet. */ public boolean isExternal() { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/RtMethodGenerator.java0000644000175000017500000000453410721374030027371 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RtMethodGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.Type; /** * This class is used for result trees implemented as methods. These * methods take a reference to the DOM and to the handler only. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class RtMethodGenerator extends MethodGenerator { private static final int HANDLER_INDEX = 2; private final Instruction _astoreHandler; private final Instruction _aloadHandler; public RtMethodGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _astoreHandler = new ASTORE(HANDLER_INDEX); _aloadHandler = new ALOAD(HANDLER_INDEX); } public int getIteratorIndex() { return INVALID_INDEX; // not available } public final Instruction storeHandler() { return _astoreHandler; } public final Instruction loadHandler() { return _aloadHandler; } public int getLocalIndex(String name) { return INVALID_INDEX; // not available } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_it.java0000644000175000017500000012070410721374030027247 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_it.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_it extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Pi\u00f9 fogli di stile definiti nello stesso file."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "La maschera ''{0}'' gi\u00e0 definita in questo foglio di lavoro."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "La maschera ''{0}'' non definita in questo foglio di lavoro."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "La variabile ''{0}'' \u00e8 definita pi\u00f9 volte nello stesso ambito."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Variabile o parametro ''{0}'' non definito. "}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Impossibile trovare la classe ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Impossibile trovare il metodo esterno ''{0}'' (deve essere pubblico)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Impossibile convertire il tipo di argomento/ritorno nella chiamata nel metodo ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "File o URI ''{0}'' non trovato."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI non valido ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Impossibile aprire il file o l''''URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Era previsto l'elemento o ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Il prefisso dello spazio nome ''{0}'' non \u00e8 dichiarato. "}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Impossibile risolvere la chiamata alla funzione ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "L''''argomento di ''{0}'' deve essere una stringa letterale. "}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Errore durante l''''analisi dell''''espressione XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Attributo ''{0}'' richiesto mancante. "}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Carattere non valido ''{0}'' nell''''espressione XPath. "}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Nome ''{0}'' non valido per l''''istruzione di elaborazione. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "L''''attributo ''{0}'' al di fuori dell''''elemento."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Attributo non valido ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Import/include circolare. Foglio di lavoro ''{0}'' gi\u00e0 caricato. "}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Impossibile ordinare i frammenti della struttura ad albero dei risultati (elementi ignorati). \u00c8 necessario ordinare i nodi quando si crea la struttura ad albero dei risultati."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "La formattazione decimale ''{0}'' \u00e8 gi\u00e0 definita."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "La versione XSL ''{0}'' non \u00e8 supportata da XSLTC."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Riferimento variabile/parametro circolare in ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Operatore sconosciuto per l'espressione binaria."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Argomento(i) non valido(i) per la chiamata alla funzione."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Il secondo argomento di una funzione document() deve essere una serie di nodi."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "\u00c8 necessario almeno un elemento in ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Solo un elemento consentito in ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " pu\u00f2 essere utilizzato solo all'interno di ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " pu\u00f2 essere utilizzato solo all'interno di ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Solo gli elementi e sono consentiti in ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " non contiene l'attributo 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Elemento child non valido."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Impossibile chiamare un elemento ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Impossibile chiamare un attributo ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Dati di testo al di fuori dell'elemento di livello superiore."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Parser JAXP non configurato correttamente"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Errore XSLTC interno non recuperabile: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Elemento XSL non supportato ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Estensione XSLTC non riconosciuta ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Il documento di immissione non \u00e8 un foglio di lavoro (lo namespace XSL non \u00e8 dichiarato nell'elemento root)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Impossibile trovare la destinazione stylesheet ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Non implementato: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Il documento di immissione non contiene un foglio di lavoro XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Impossibile analizzare l''''elemento ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "L'attributo use di deve essere node, node-set, string o number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "La versione del documento XML di emissione deve essere 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Operatore sconosciuto per l'espressione relazionale"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Tentativo di utilizzare una serie di attributi ''{0}'' non esistente."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Impossibile analizzare la maschera del valore di attributo ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Tipo di dati sconosciuto nella firma per la classe ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Impossibile convertire il tipo di dati da ''{0}'' a ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Questa Templates non contiene una definizione di classe translet valida."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Questa Templates non contengono una classe con il nome ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Impossibile caricare la classe translet ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Classe translet caricata, ma non \u00e8 possibile creare l'istanza translet."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Tentativo di impostare ErrorListener per ''{0}'' su null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Solo StreamSource, SAXSource e DOMSource sono supportati da XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "L''oggetto Source passato a ''{0}'' non ha contenuto."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Impossibile compilare il foglio di lavoro"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory non riconosce l''''attributo ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() deve essere richiamato prima di startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer non dispone di un oggetto translet incapsulato."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Nessun programma di gestione dell'emissione definito per il risultato della trasformazione."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "Oggetto Result passato ''{0}'' non valido."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Tentativo di accedere alla propriet\u00e0 Transformer ''{0}'' non valida."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Impossibile creare l''''adattatore SAX2DOM: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() richiamato senza che sia impostato un systemId (identificativo di sistema)."}, { ErrorMsg.ER_RESULT_NULL, "Il risultato non pu\u00f2 essere nullo"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "Il valore del parametro {0} deve essere un oggetto Java valido"}, {ErrorMsg.COMPILE_STDIN_ERR, "L'opzione -i deve essere utilizzata con l'opzione -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o assegna il nome al translet generato\n. Per impostazione predefinita, il nome translet \u00e8\n derivato dal nome . Questa opzione\n viene ignorata se vengono compilati pi\u00f9 fogli di stile.\n -d specifica una directory di destinazione per il translet\n -j raggruppa le classi translet in un file jar del\n nome specificato come \n -p specifica un prefisso del nome pacchetto per tutte le classi\n translet generate.\n -n abilita l'allineamento della maschera (funzionamento predefinito migliore\n in media).\n -x attiva ulteriori emissioni dei messaggi di debug\n -u interpreta gli argomenti come URL\n -i impone al programma di compilazione di leggere il foglio di lavoro da stdin\n -v stampa la versione del programma di compilazione \n -h stampa queste istruzioni sull'utilizzo\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n utilizza il translet per convertire un documento XML \n specificato come . Il translet si trova \n nella istruzione CLASSPATH dell'utente o nel eventualmente specificato.\nOPTIONS\n -j specifica un jarfile dal quale caricare il translet\n -x attiva ulteriori output dei messaggi di debug\n -n esegue la trasformazione e\n visualizza le informazioni relative al profilo\n -u specifica il documento di immissione XML come URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " pu\u00f2 essere utilizzato solo all'interno di o ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "Codifica di emissione ''{0}'' non supportata in questa JVM."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Errore di sintassi in ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Impossibile trovare un costruttore esterno ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Il primo argomento della funzione Java non statica ''{0}'' non \u00e8 un riferimento ad un oggetto valido. "}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Errore durante la verifica del tipo di espressione ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Errore durante la verifica del tipo di espressione in una posizione sconosciuta."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "L''''opzione della riga comandi ''{0}'' non \u00e8 valida."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Manca un argomento obbligatorio per l''''opzione della riga comandi ''{0}''. "}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "ATTENZIONE: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "ATTENZIONE: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "ERRORE IRREVERSIBILE: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "ERRORE IRREVERSIBILE: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERRORE: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERRORE: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Trasformazione utilizzando il translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Trasformazione utilizzando il translet ''{0}'' dal file jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Impossibile creare un''istanza della classe TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "Non \u00e8 stato possibile utilizzare il nome ''{0}'' come nome della classe translet perch\u00e9 contiene dei caratteri che non sono consentiti nel nome della classe Java. \u00c8 stato invece utilizzato il nome ''{1}''."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Errori del programma di compilazione:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Messaggi di avvertenza del programma di compilazione:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Errori del translet:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Un attributo il cui valore deve essere un QName o un elenco separato da spazi vuoti di QName ha avuto il valore di ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Un attributo il cui valore deve essere un NCName aveva il valore ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "L''''attributo del metodo di un elemento aveva il valore ''{0}''. Il valore deve essere uno di ''xml'', ''html'', ''text'' o qname-but-not-ncname"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "Il nome della funzione non pu\u00f2 essere nullo in TransformerFactory.getFeature(Nome stringa)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "Il nome della funzione non pu\u00f2 essere nullo in TransformerFactory.setFeature(Nome stringa, valore booleano)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Impossibile impostare la funzione ''{0}'' su questo TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NodeCounterGenerator.java0000644000175000017500000000457210721374031030073 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeCounterGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.Instruction; import org.apache.xalan.xsltc.compiler.Stylesheet; /** * This class implements auxiliary classes needed to compile * patterns in xsl:number. These classes inherit from * {Any,Single,Multiple}NodeCounter and override the * matchFrom and matchCount methods. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class NodeCounterGenerator extends ClassGenerator { private Instruction _aloadTranslet; public NodeCounterGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); } /** * Set the index of the register where "this" (the pointer to * the translet) is stored. */ public void setTransletIndex(int index) { _aloadTranslet = new ALOAD(index); } /** * The index of the translet pointer within the execution of * matchFrom or matchCount. * Overridden from ClassGenerator. */ public Instruction loadTranslet() { return _aloadTranslet; } /** * Returns true since this class is external to the * translet. */ public boolean isExternal() { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_ko.java0000644000175000017500000013507010721374033027251 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ko.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ko extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "\ud558\ub098 \uc774\uc0c1\uc758 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uac00 \ub3d9\uc77c\ud55c \ud30c\uc77c\uc5d0\uc11c \uc815\uc758\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "''{0}'' \ud15c\ud50c\ub9ac\ud2b8\uac00 \uc774\ubbf8 \uc774 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uc5d0\uc11c \uc815\uc758\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "''{0}'' \ud15c\ud50c\ub9ac\ud2b8\uac00 \uc774 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uc5d0\uc11c \uc815\uc758\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "''{0}'' \ubcc0\uc218\uac00 \ub3d9\uc77c\ud55c \ubc94\uc704 \uc548\uc5d0\uc11c \uc5ec\ub7ec \ubc88 \uc815\uc758\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "''{0}'' \ub9e4\uac1c\ubcc0\uc218 \ub610\ub294 \ubcc0\uc218\uac00 \uc815\uc758\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "''{0}'' \ud074\ub798\uc2a4\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "''{0}'' \uc678\ubd80 \uba54\uc18c\ub4dc\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. (public\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4.)"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "''{0}'' \uba54\uc18c\ub4dc\ub85c\uc758 \ud638\ucd9c\uc5d0\uc11c \uc778\uc218/\ub9ac\ud134 \uc720\ud615\uc744 \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "''{0}'' URI \ub610\ub294 \ud30c\uc77c\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "''{0}'' URI\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "''{0}'' URI \ub610\ub294 \ud30c\uc77c\uc744 \uc5f4 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, " \ub610\ub294 \uc694\uc18c\uac00 \uc608\uc0c1\ub429\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "''{0}'' \uc774\ub984 \uacf5\uac04 \uc811\ub450\ubd80\uac00 \uc120\uc5b8\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "''{0}'' \ud568\uc218\uc5d0 \ub300\ud55c \ud638\ucd9c\uc744 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "''{0}''\uc5d0 \ub300\ud55c \uc778\uc218\ub294 \ub9ac\ud130\ub7f4 \ubb38\uc790\uc5f4\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "''{0}'' XPath \ud45c\ud604\uc2dd \uad6c\ubb38 \ubd84\uc11d \uc911\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "''{0}'' \ud544\uc218 \uc18d\uc131\uc774 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "XPath \ud45c\ud604\uc2dd\uc758 ''{0}'' \ubb38\uc790\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "\ucc98\ub9ac \uba85\ub839\uc5b4\uc5d0 \ub300\ud55c ''{0}'' \uc774\ub984\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "''{0}'' \uc18d\uc131\uc774 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "''{0}'' \uc18d\uc131\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "import/include\uac00 \uc21c\ud658\ub429\ub2c8\ub2e4. ''{0}'' \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uac00 \uc774\ubbf8 \ub85c\ub4dc\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "\uacb0\uacfc \ud2b8\ub9ac \ub2e8\ud3b8\uc744 \uc815\ub82c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. ( \uc694\uc18c\uac00 \ubb34\uc2dc\ub429\ub2c8\ub2e4.) \uacb0\uacfc \ud2b8\ub9ac\ub97c \uc791\uc131\ud560 \ub54c \ub178\ub4dc\ub97c \uc815\ub82c\ud574\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "''{0}'' 10\uc9c4\uc218 \ud3ec\ub9f7\ud305\uc774 \uc774\ubbf8 \uc815\uc758\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSLTC\uc5d0\uc11c ''{0}'' XSL \ubc84\uc804\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "''{0}''\uc5d0\uc11c \ubcc0\uc218/\ub9e4\uac1c\ubcc0\uc218 \ucc38\uc870\uac00 \uc21c\ud658\ub429\ub2c8\ub2e4."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "2\uc9c4 \ud45c\ud604\uc2dd\uc5d0 \ub300\ud55c \uc5f0\uc0b0\uc790\ub97c \uc54c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "\ud568\uc218 \ud638\ucd9c\uc5d0 \ub300\ud55c \uc778\uc218\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "document() \ud568\uc218\uc5d0 \ub300\ud55c \ub450 \ubc88\uc9f8 \uc778\uc218\ub294 node-set\uc5ec\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "\uc5d0 \ucd5c\uc18c \ud558\ub098\uc758 \uc694\uc18c\uac00 \ud544\uc694\ud569\ub2c8\ub2e4."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "\uc5d0 \ud558\ub098\uc758 \uc694\uc18c\ub9cc\uc774 \ud5c8\uc6a9\ub429\ub2c8\ub2e4."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, "\ub294 \uc5d0\uc11c\ub9cc \uc0ac\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, "\uc740 \uc5d0\uc11c\ub9cc \uc0ac\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, " \ubc0f \uc694\uc18c\ub9cc\uc774 \uc5d0\uc11c \ud5c8\uc6a9\ub429\ub2c8\ub2e4."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "\uc774 'name' \uc18d\uc131\uc5d0\uc11c \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "\ud558\uc704 \uc694\uc18c\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "''{0}'' \uc694\uc18c\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "''{0}'' \uc18d\uc131\uc744 \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "\ud14d\uc2a4\ud2b8 \ub370\uc774\ud130\uac00 \ucd5c\uc0c1\uc704 \ub808\ubca8 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP \uad6c\ubb38 \ubd84\uc11d\uae30\uac00 \uc81c\ub300\ub85c \uad6c\uc131\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "\ubcf5\uad6c\ud560 \uc218 \uc5c6\ub294 XSLTC-\ub0b4\ubd80 \uc624\ub958: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "''{0}'' XSL \uc694\uc18c\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "''{0}'' XSLTC \ud655\uc7a5\uc790\ub97c \uc778\uc2dd\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "\uc785\ub825 \ubb38\uc11c\ub294 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uac00 \uc544\ub2d9\ub2c8\ub2e4. (XSL \uc774\ub984 \uacf5\uac04\uc774 \ub8e8\ud2b8 \uc694\uc18c\uc5d0\uc11c \uc120\uc5b8\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4.)"}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "''{0}'' \uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ub300\uc0c1\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "\uad6c\ud604\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4: ''{0}''"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "\uc785\ub825 \ubb38\uc11c\uc5d0 XSL \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uac00 \ud3ec\ud568\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "''{0}'' \uc694\uc18c\ub97c \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "\uc758 use \uc18d\uc131\uc740 node, node-set, string \ub610\ub294 number\uc5ec\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "\ucd9c\ub825 XML \ubb38\uc11c \ubc84\uc804\uc740 1.0\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "\uad00\uacc4\uc2dd\uc5d0 \ub300\ud55c \uc5f0\uc0b0\uc790\ub97c \uc54c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "\uc874\uc7ac\ud558\uc9c0 \uc54a\ub294 \uc18d\uc131 \uc138\ud2b8 ''{0}'' \uc0ac\uc6a9\uc744 \uc2dc\ub3c4 \uc911\uc785\ub2c8\ub2e4."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "''{0}'' \uc18d\uc131\uac12 \ud15c\ud50c\ub9ac\ud2b8\ub97c \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "''{0}'' \ud074\ub798\uc2a4\uc5d0 \ub300\ud55c \uc11c\uba85\uc5d0 \uc54c \uc218 \uc5c6\ub294 \ub370\uc774\ud130 \uc720\ud615\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "\ub370\uc774\ud130 \uc720\ud615\uc744 ''{0}''\uc5d0\uc11c ''{1}''(\uc73c)\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "\uc774 Templates\uc5d0\ub294 \uc720\ud6a8\ud55c translet \ud074\ub798\uc2a4 \uc815\uc758\uac00 \ud3ec\ud568\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "\uc774 Templates\uc5d0\ub294 ''{0}'' \uc774\ub984\uc778 \ud074\ub798\uc2a4\uac00 \ud3ec\ud568\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "''{0}'' translet \ud074\ub798\uc2a4\ub97c \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "translet \ud074\ub798\uc2a4\uac00 \ub85c\ub4dc\ub418\uc5c8\uc9c0\ub9cc translet \uc778\uc2a4\ud134\uc2a4\ub97c \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "''{0}''\uc5d0 \ub300\ud55c ErrorListener\ub97c \ub110(null)\ub85c \uc124\uc815\ud558\ub824\uace0 \ud569\ub2c8\ub2e4."}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC\uc5d0\uc11c StreamSource, SAXSource \ubc0f DOMSource\ub9cc\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4."}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "''{0}''(\uc73c)\ub85c \ud328\uc2a4\ub41c Source \uc624\ube0c\uc81d\ud2b8\uc5d0 \ucee8\ud150\uce20\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8\ub97c \ucef4\ud30c\uc77c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory ''{0}'' \uc18d\uc131\uc744 \uc778\uc2dd\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult()\ub294 startDocument()\ubcf4\ub2e4 \uba3c\uc800 \ud638\ucd9c\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer\uc5d0 \uc694\uc57d\ub41c translet \uc624\ube0c\uc81d\ud2b8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "\ubcc0\ud658 \uacb0\uacfc\uc5d0 \ub300\ud55c \ucd9c\ub825 \ud578\ub4e4\ub7ec\uac00 \uc815\uc758\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "''{0}''(\uc73c)\ub85c \ud328\uc2a4\ub41c Result \uc624\ube0c\uc81d\ud2b8\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "''{0}'' \uc798\ubabb\ub41c Transformer \ud2b9\uc131\uc5d0 \uc561\uc138\uc2a4\ud558\ub824\uace0 \ud569\ub2c8\ub2e4."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "SAX2DOM ''{0}'' \uc5b4\ub311\ud130\ub97c \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build()\uac00 \uc124\uc815\ub41c \uc2dc\uc2a4\ud15c ID \uc5c6\uc774 \ud638\ucd9c\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ErrorMsg.ER_RESULT_NULL, "\uacb0\uacfc\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "{0} \ub9e4\uac1c\ubcc0\uc218 \uac12\uc740 \uc720\ud6a8\ud55c Java \uc624\ube0c\uc81d\ud2b8\uc5ec\uc57c \ud569\ub2c8\ub2e4."}, {ErrorMsg.COMPILE_STDIN_ERR, "-i \uc635\uc158\uc740 -o \uc635\uc158\uacfc \ud568\uaed8 \uc0ac\uc6a9\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\n \uc635\uc158\n -o \uc0dd\uc131\ub41c Translet\uc5d0 \uc774\ub984\uc744 \uc9c0\uc815\ud569\ub2c8\ub2e4. \n \uae30\ubcf8\uc801\uc73c\ub85c Translet \uc774\ub984\uc744 \uc774\ub984\uc5d0\uc11c\n \uac00\uc838\uc635\ub2c8\ub2e4. \uc774 \uc635\uc158\uc740 \uc5ec\ub7ec \uac1c\uc758 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\ub97c \n \ucef4\ud30c\uc77c\ud560 \uacbd\uc6b0 \ubb34\uc2dc\ub429\ub2c8\ub2e4.\n -d Translet\uc758 \ub300\uc0c1 \ub514\ub809\ud1a0\ub9ac\ub97c \uc9c0\uc815\ud569\ub2c8\ub2e4.\n -j \ub85c \uc9c0\uc815\ub41c jar \ud30c\uc77c \uc774\ub984\uc73c\ub85c\n Translet \ud074\ub798\uc2a4\ub97c \ud328\ud0a4\uc9c0\ud569\ub2c8\ub2e4.\n -p \uc0dd\uc131\ub41c \ubaa8\ub4e0 Translet \ud074\ub798\uc2a4\uc5d0 \ub300\ud574 \ud328\ud0a4\uc9c0 \uc774\ub984 \uc811\ub450\ubd80\ub97c\n \uc9c0\uc815\ud569\ub2c8\ub2e4.\n -n \ud15c\ud50c\ub9ac\ud2b8 \uc778\ub77c\uc774\ub2dd(\ud3c9\uade0\ubcf4\ub2e4 \uc6b0\uc218\ud55c)\uc744\n \uc0ac\uc6a9 \uac00\ub2a5\ud558\uac8c \ud569\ub2c8\ub2e4.\n -x \ucd94\uac00 \ub514\ubc84\uae45 \uba54\uc2dc\uc9c0 \ucd9c\ub825\uc744 \uc2dc\uc791\ud569\ub2c8\ub2e4.\n -u \uc778\uc218\ub97c URL\ub85c \ud574\uc11d\ud569\ub2c8\ub2e4.\n -i stdin\uc73c\ub85c\ubd80\ud130 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\ub97c \uc77d\ub3c4\ub85d \ucef4\ud30c\uc77c\ub7ec\ub97c \uac15\uc81c \uc2e4\ud589\ud569\ub2c8\ub2e4.\n -v \ucef4\ud30c\uc77c\ub7ec \ubc84\uc804\uc744 \uc778\uc1c4\ud569\ub2c8\ub2e4.\n -h \uc0ac\uc6a9\ubc95 \uba85\ub839\ubb38\uc744 \uc778\uc1c4\ud569\ub2c8\ub2e4.\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n Translet \ub97c \uc0ac\uc6a9\ud558\uc5ec \ub85c \uc9c0\uc815\ub41c XML \ubb38\uc11c\ub97c \n \ubcc0\ud658\ud569\ub2c8\ub2e4. Translet \ub294 \uc0ac\uc6a9\uc790\uc758 CLASSPATH \ub610\ub294\n \uc120\ud0dd\uc801\uc73c\ub85c \uc9c0\uc815\ub41c \ub0b4\uc5d0 \uc788\uc2b5\ub2c8\ub2e4.\n\uc635\uc158\n -j Translet\uc744 \ub85c\ub4dc\ud574\uc62c jarfile\uc744 \uc9c0\uc815\ud569\ub2c8\ub2e4.\n -x \ucd94\uac00 \ub514\ubc84\uae45 \uba54\uc2dc\uc9c0 \ucd9c\ub825\uc744 \uc2dc\uc791\ud569\ub2c8\ub2e4.\n -n \ucc28\ub840 \ubcc0\ud658\uc744 \uc2e4\ud589\ud558\uba70\n \ud504\ub85c\ud30c\uc77c\ub9c1 \uc815\ubcf4\ub97c \ud45c\uc2dc\ud569\ub2c8\ub2e4.\n -u XML \uc785\ub825 \ubb38\uc11c\ub97c URL\ub85c \uc9c0\uc815\ud569\ub2c8\ub2e4.\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, "\ub294 \ub610\ub294 \uc5d0\uc11c\ub9cc \uc0ac\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "\uc774 JVM\uc5d0\uc11c ''{0}'' \ucd9c\ub825 \uc778\ucf54\ub529\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "''{0}''\uc5d0 \uad6c\ubb38 \uc624\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "''{0}'' \uc678\ubd80 \uad6c\uc131\uc790\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "non-static Java \ud568\uc218 ''{0}''\uc758 \uccab \ubc88\uc9f8 \uc778\uc218\uac00 \uc720\ud6a8\ud55c \uc624\ube0c\uc81d\ud2b8 \ucc38\uc870\uac00 \uc544\ub2d9\ub2c8\ub2e4."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "''{0}'' \ud45c\ud604\uc2dd\uc758 \uc720\ud615\uc744 \uac80\uc0ac\ud558\ub294 \uc911\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "\uc54c \uc218 \uc5c6\ub294 \uc704\uce58\uc5d0\uc11c \ud45c\ud604\uc2dd\uc758 \uc720\ud615\uc744 \uac80\uc0ac\ud558\ub294 \uc911\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "''{0}'' \uba85\ub839\ud589 \uc635\uc158\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "''{0}'' \uba85\ub839\ud589 \uc635\uc158\uc5d0 \ud544\uc218 \uc778\uc218\uac00 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "\uacbd\uace0: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "\uacbd\uace0: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "\uc2ec\uac01\ud55c \uc624\ub958: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "\uc2ec\uac01\ud55c \uc624\ub958: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "\uc624\ub958: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "\uc624\ub958: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "''{0}'' translet\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubcc0\ud658\ud558\uc2ed\uc2dc\uc624."}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "''{1}'' jar \ud30c\uc77c\uc758 ''{0}'' Translet\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubcc0\ud658\ud558\uc2ed\uc2dc\uc624."}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "TransformerFactory \ud074\ub798\uc2a4 ''{0}''\uc758 \uc778\uc2a4\ud134\uc2a4\ub97c \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "''{0}'' \uc774\ub984\uc740 Java \ud074\ub798\uc2a4 \uc774\ub984\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\ub294 \ubb38\uc790\ub97c \ud3ec\ud568\ud558\uace0 \uc788\uc73c\ubbc0\ub85c Translet \ud074\ub798\uc2a4 \uc774\ub984\uc73c\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ub300\uc2e0\uc5d0 ''{1}'' \uc774\ub984\uc774 \uc0ac\uc6a9\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "\ucef4\ud30c\uc77c\ub7ec \uc624\ub958:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "\ucef4\ud30c\uc77c\ub7ec \uacbd\uace0:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Translet \uc624\ub958:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "\uac12\uc774 QName \ub610\ub294 QName\uc758 \ud654\uc774\ud2b8 \uc2a4\ud398\uc774\uc2a4\ub85c \uad6c\ubd84\ub41c \ubaa9\ub85d\uc774\uc5b4\uc57c \ud558\ub294 \uc18d\uc131\uc5d0 ''{0}'' \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "\uac12\uc774 NCName\uc774\uc5b4\uc57c \ud558\ub294 \uc18d\uc131\uc5d0 ''{0}'' \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, " \uc694\uc18c\uc758 \uba54\uc18c\ub4dc \uc18d\uc131\uc5d0 ''{0}'' \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uac12\uc740 ''xml'', ''html'', ''text'' \ub610\ub294 qname-but-not-ncname \uc911 \ud558\ub098\uc5ec\uc57c \ud569\ub2c8\ub2e4."}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "TransformerFactory.getFeature(\ubb38\uc790\uc5f4 \uc774\ub984)\uc5d0\uc11c \uae30\ub2a5 \uc774\ub984\uc774 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "TransformerFactory.setFeature(\ubb38\uc790\uc5f4 \uc774\ub984, \ubd80\uc6b8 \uac12)\uc5d0\uc11c \uae30\ub2a5 \uc774\ub984\uc774 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "\uc774 TransformerFactory\uc5d0\uc11c ''{0}'' \uae30\ub2a5\uc744 \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/FilterGenerator.java0000644000175000017500000000417010721374033027067 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.Instruction; import org.apache.xalan.xsltc.compiler.Stylesheet; /** * This class implements auxliary classes needed to compile * filters (predicates). These classes defined a single method * of type TestGenerator. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class FilterGenerator extends ClassGenerator { private static int TRANSLET_INDEX = 5; // translet private final Instruction _aloadTranslet; public FilterGenerator(String className, String superClassName, String fileName, int accessFlags, String[] interfaces, Stylesheet stylesheet) { super(className, superClassName, fileName, accessFlags, interfaces, stylesheet); _aloadTranslet = new ALOAD(TRANSLET_INDEX); } /** * The index of the translet pointer within the execution of * the test method. */ public final Instruction loadTranslet() { return _aloadTranslet; } /** * Returns true since this class is external to the * translet. */ public boolean isExternal() { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_tr.java0000644000175000017500000012606710721374030027270 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_tr.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_tr extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Ayn\u0131 dosyada birden \u00e7ok bi\u00e7em yapra\u011f\u0131 tan\u0131mland\u0131."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "Bi\u00e7em yapra\u011f\u0131nda ''{0}'' \u015fablonu zaten tan\u0131ml\u0131."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "Bu bi\u00e7em yapra\u011f\u0131nda ''{0}'' \u015fablonu tan\u0131ml\u0131 de\u011fil."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "''{0}'' de\u011fi\u015fkeni ayn\u0131 kapsamda bir kereden \u00e7ok tan\u0131mland\u0131."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "''{0}'' de\u011fi\u015fkeni ya da de\u011fi\u015ftirgesi tan\u0131ml\u0131 de\u011fil."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "''{0}'' s\u0131n\u0131f\u0131 bulunam\u0131yor."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "''{0}'' d\u0131\u015f y\u00f6ntemi bulunam\u0131yor (public olmal\u0131)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "''{0}'' y\u00f6ntemi \u00e7a\u011fr\u0131s\u0131nda ba\u011f\u0131ms\u0131z de\u011fi\u015fken/d\u00f6n\u00fc\u015f tipi d\u00f6n\u00fc\u015ft\u00fcr\u00fclemiyor."}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Dosya ya da URI ''{0}'' bulunamad\u0131."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "Ge\u00e7ersiz URI ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Dosya ya da URI ''{0}'' a\u00e7\u0131lam\u0131yor."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, " ya da \u00f6\u011fesi bekleniyor."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Ad alan\u0131 \u00f6neki ''{0}'' bildirilmemi\u015f."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "''{0}'' i\u015flevi \u00e7a\u011fr\u0131s\u0131 \u00e7\u00f6z\u00fclemiyor."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "''{0}'' i\u015flevine ili\u015fkin ba\u011f\u0131ms\u0131z de\u011fi\u015fken bir haz\u0131r bilgi dizgisi olmal\u0131d\u0131r."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "XPath ifadesi ''{0}'' ayr\u0131\u015ft\u0131r\u0131l\u0131rken hata olu\u015ftu."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Gerekli ''{0}'' \u00f6zniteli\u011fi eksik."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "XPath ifadesinde ge\u00e7ersiz ''{0}'' karakteri var."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "\u0130\u015fleme y\u00f6nergesi i\u00e7in ''{0}'' ad\u0131 ge\u00e7ersiz."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "''{0}'' \u00f6zniteli\u011fi \u00f6\u011fenin d\u0131\u015f\u0131nda."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "''{0}'' \u00f6zniteli\u011fi ge\u00e7ersiz."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "\u00c7evrimsel import/include. ''{0}'' bi\u00e7em yapra\u011f\u0131 zaten y\u00fcklendi."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Sonu\u00e7 a\u011fac\u0131 par\u00e7alar\u0131 s\u0131ralanam\u0131yor ( \u00f6\u011feleri yok say\u0131ld\u0131). D\u00fc\u011f\u00fcmleri sonu\u00e7 a\u011fac\u0131n\u0131 yarat\u0131rken s\u0131ralamal\u0131s\u0131n\u0131z."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Onlu bi\u00e7imleme bi\u00e7emi ''{0}'' zaten tan\u0131ml\u0131."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSL s\u00fcr\u00fcm\u00fc ''{0}'' XSLTC taraf\u0131ndan desteklenmiyor."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "''{0}'' i\u00e7inde \u00e7evrimsel de\u011fi\u015fken/de\u011fi\u015ftirge ba\u015fvurusu."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "\u0130kili ifadede bilinmeyen i\u015fle\u00e7."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "\u0130\u015flev \u00e7a\u011fr\u0131s\u0131 i\u00e7in ge\u00e7ersiz say\u0131da ba\u011f\u0131ms\u0131z de\u011fi\u015fken."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "document() i\u015flevinin ikinci ba\u011f\u0131ms\u0131z de\u011fi\u015fkeni d\u00fc\u011f\u00fcm k\u00fcmesi olmal\u0131d\u0131r."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, " i\u00e7inde en az bir \u00f6\u011fesi gereklidir."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, " i\u00e7inde tek bir \u00f6\u011fesine izin verilir."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " yaln\u0131zca i\u00e7inde kullan\u0131labilir."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " yaln\u0131zca i\u00e7inde kullan\u0131labilir."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, " i\u00e7inde yaln\u0131zca ve \u00f6\u011feleri kullan\u0131labilir."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " \u00f6\u011fesinde 'name' \u00f6zniteli\u011fi eksik."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Ge\u00e7ersiz alt \u00f6\u011fe."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Bir \u00f6\u011feye ''{0}'' ad\u0131 verilemez."}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Bir \u00f6zniteli\u011fe ''{0}'' ad\u0131 verilemez."}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "\u00dcst d\u00fczey \u00f6\u011fesi d\u0131\u015f\u0131nda metin verisi."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP ayr\u0131\u015ft\u0131r\u0131c\u0131s\u0131 do\u011fru yap\u0131land\u0131r\u0131lmam\u0131\u015f"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Kurtar\u0131lamaz XSLTC i\u00e7 hatas\u0131: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "XSL \u00f6\u011fesi ''{0}'' desteklenmiyor."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "XSLTC eklentisi ''{0}'' tan\u0131nm\u0131yor."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Giri\u015f belgesi bir bi\u00e7em yapra\u011f\u0131 de\u011fil (XSL ad alan\u0131 k\u00f6k \u00f6\u011fede bildirilmedi)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Bi\u00e7em yapra\u011f\u0131 hedefi ''{0}'' bulunamad\u0131."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Ger\u00e7ekle\u015ftirilmedi: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Giri\u015f belgesi bir XSL bi\u00e7em yapra\u011f\u0131 i\u00e7ermiyor."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "''{0}'' \u00f6\u011fesi ayr\u0131\u015ft\u0131r\u0131lamad\u0131."}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, " ile ilgili use \u00f6zniteli\u011fi node, node-set, string ya da number olmal\u0131d\u0131r."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "\u00c7\u0131k\u0131\u015f XML belgesi s\u00fcr\u00fcm\u00fc 1.0 olmal\u0131d\u0131r."}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "\u0130li\u015fkisel ifade i\u00e7in bilinmeyen i\u015fle\u00e7"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Varolmayan ''{0}'' \u00f6znitelik k\u00fcmesini kullanma giri\u015fimi."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "\u00d6znitelik de\u011feri \u015fablonu ''{0}'' ayr\u0131\u015ft\u0131r\u0131lam\u0131yor."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "''{0}'' s\u0131n\u0131f\u0131na ili\u015fkin imzada bilinmeyen veri tipi."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "''{0}'' veri tipi ''{1}'' tipine d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Bu Templates ge\u00e7erli bir derleme sonucu s\u0131n\u0131f tan\u0131m\u0131 i\u00e7ermiyor."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Bu Templates ''{0}'' ad\u0131nda bir s\u0131n\u0131f i\u00e7ermiyor."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Derleme sonucu s\u0131n\u0131f\u0131 ''{0}'' y\u00fcklenemedi."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Derleme sonucu s\u0131n\u0131f\u0131 y\u00fcklendi, ancak derleme sonucu s\u0131n\u0131f\u0131n\u0131n somut kopyas\u0131 yarat\u0131lam\u0131yor."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "''{0}'' ile ilgili ErrorListener nesnesini bo\u015f de\u011fer (null) olarak ayarlama giri\u015fimi."}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC yaln\u0131zca StreamSource, SAXSource ve DOMSource arabirimlerini destekler."}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "''{0}'' y\u00f6ntemine aktar\u0131lan Source nesnesinin i\u00e7eri\u011fi yok."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Bi\u00e7em yapra\u011f\u0131 derlenemedi."}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory ''{0}'' \u00f6zniteli\u011fini tan\u0131m\u0131yor."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "startDocument() y\u00f6nteminden \u00f6nce setResult() \u00e7a\u011fr\u0131lmal\u0131d\u0131r."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer, derleme sonucu s\u0131n\u0131f dosyas\u0131 nesnesine ba\u015fvuru i\u00e7ermiyor."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "D\u00f6n\u00fc\u015ft\u00fcrme sonucu i\u00e7in tan\u0131ml\u0131 \u00e7\u0131k\u0131\u015f i\u015fleyicisi yok."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "''{0}'' y\u00f6ntemine aktar\u0131lan Result nesnesi ge\u00e7ersiz."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Ge\u00e7ersiz ''{0}'' Transformer \u00f6zelli\u011fine (property) eri\u015fme giri\u015fimi."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "SAX2DOM ba\u011fda\u015ft\u0131r\u0131c\u0131s\u0131 yarat\u0131lamad\u0131: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() y\u00f6ntemi systemId tan\u0131mlanmadan \u00e7a\u011fr\u0131ld\u0131."}, { ErrorMsg.ER_RESULT_NULL, "Sonu\u00e7 bo\u015f de\u011ferli olmamal\u0131"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "{0} de\u011fi\u015ftirgesinin de\u011feri ge\u00e7erli bir Java nesnesi olmal\u0131d\u0131r"}, {ErrorMsg.COMPILE_STDIN_ERR, "-i se\u00e7ene\u011fi -o se\u00e7ene\u011fiyle birlikte kullan\u0131lmal\u0131d\u0131r."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "\u00d6ZET\n java org.apache.xalan.xsltc.cmdline.Compile [-o <\u00e7\u0131k\u0131\u015f>]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nSE\u00c7ENEKLER\n -o <\u00e7\u0131k\u0131\u015f> derleme sonucu s\u0131n\u0131f dosyas\u0131na <\u00e7\u0131k\u0131\u015f>\n ad\u0131n\u0131 atar. Varsay\u0131lan olarak, derleme sonucu s\u0131n\u0131f dosyas\u0131\n ad\u0131 ad\u0131ndan al\u0131n\u0131r. Birden \u00e7ok bi\u00e7em yapra\u011f\u0131 derleniyorsa\n bu se\u00e7enek dikkate al\u0131nmaz.\n -d derleme sonucu s\u0131n\u0131f dosyas\u0131 i\u00e7in hedef dizini belirtir.\n -j derleme sonucu s\u0131n\u0131f dosyalar\u0131n\u0131\n dosyas\u0131nda paketler.\n -p derleme sonucu \u00fcretilen t\u00fcm s\u0131n\u0131f dosyalar\u0131 i\u00e7in\n bir paket ad\u0131 \u00f6neki belirtir.\n -n \u015fablona do\u011frudan yerle\u015ftirmeyi etkinle\u015ftirir (ortalama olarak\n daha y\u00fcksek ba\u015far\u0131m sa\u011flar).\n -x ek hata ay\u0131klama iletisi \u00e7\u0131k\u0131\u015f\u0131n\u0131 etkinle\u015ftirir\n -u ba\u011f\u0131ms\u0131z de\u011fi\u015fkenlerini URL olarak yorumlars\n -i derleyiciyi stdin'den bi\u00e7em yapra\u011f\u0131n\u0131 okumaya zorlar\n -v derleyici s\u00fcr\u00fcm\u00fcn\u00fc yazd\u0131r\u0131r.\n -h bu kullan\u0131m bilgilerini yazd\u0131r\u0131r\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "\u00d6ZET \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n ile belirtilen XML belgesini d\u00f6n\u00fc\u015ft\u00fcrmek i\u00e7in \n s\u0131n\u0131f dosyas\u0131n\u0131 kullan\u0131r. s\u0131n\u0131f dosyas\u0131\n kullan\u0131c\u0131n\u0131n CLASSPATH de\u011fi\u015fkeninde ya da iste\u011fe ba\u011fl\u0131 olarak belirtilen dosyas\u0131ndad\u0131r.\nSE\u00c7ENEKLER\n -j derleme sonucu s\u0131n\u0131f dosyas\u0131n\u0131n hangi jar dosyas\u0131ndan y\u00fcklenece\u011fini belirtir\n -x ek hata ay\u0131klama iletisi \u00e7\u0131k\u0131\u015f\u0131n\u0131 etkinle\u015ftirir\n -n d\u00f6n\u00fc\u015ft\u00fcrmeyi ile belirtilen say\u0131 kadar \u00e7al\u0131\u015ft\u0131r\u0131r\n ve yakalama bilgilerini g\u00f6r\u00fcnt\u00fcler\n -u XML giri\u015f belgesini URL olarak belirtir\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " yaln\u0131zca ya da i\u00e7inde kullan\u0131labilir."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "''{0}'' \u00e7\u0131k\u0131\u015f kodlamas\u0131 bu JVM \u00fczerinde desteklenmiyor."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "''{0}'' ifadesinde s\u00f6zdizimi hatas\u0131."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "D\u0131\u015f olu\u015fturucu ''{0}'' bulunam\u0131yor."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Dura\u011fan (static) olmayan ''{0}'' Java i\u015flevine ili\u015fkin ilk ba\u011f\u0131ms\u0131z de\u011fi\u015fken ge\u00e7erli bir nesne ba\u015fvurusu de\u011fil."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "''{0}'' ifadesinin tipi denetlenirken hata saptand\u0131."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Bilinmeyen bir yerdeki bir ifadenin tipi denetlenirken hata saptand\u0131."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "Komut sat\u0131r\u0131 se\u00e7ene\u011fi ''{0}'' ge\u00e7erli de\u011fil."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "''{0}'' komut sat\u0131r\u0131 se\u00e7ene\u011finde gerekli bir ba\u011f\u0131ms\u0131z de\u011fi\u015fken eksik."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "UYARI: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "UYARI: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "ONULMAZ HATA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "ONULMAZ HATA: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "HATA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "HATA: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "''{0}'' s\u0131n\u0131f\u0131n\u0131 kullanarak d\u00f6n\u00fc\u015ft\u00fcr "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "''{1}'' jar dosyas\u0131ndan ''{0}'' derleme sonucu s\u0131n\u0131f dosyas\u0131n\u0131 kullanarak d\u00f6n\u00fc\u015ft\u00fcr"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "''{0}'' TransformerFactory s\u0131n\u0131f\u0131n\u0131n somut \u00f6rne\u011fi yarat\u0131lamad\u0131."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "''{0}'' ad\u0131, derleme sonucu s\u0131n\u0131f dosyas\u0131 ad\u0131 olarak kullan\u0131lamad\u0131; bir Java s\u0131n\u0131f\u0131nda kullan\u0131lmas\u0131na izin verilmeyen karakterler i\u00e7eriyor. Onun yerine ''{1}'' ad\u0131 kullan\u0131ld\u0131."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Derleyici hatalar\u0131:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Derleyici uyar\u0131lar\u0131:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Derleme sonusu s\u0131n\u0131f dosyas\u0131 hatalar\u0131:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "De\u011ferinin bir QName ya da beyaz alanla ayr\u0131lm\u0131\u015f QName listesi olmas\u0131 gereken bir \u00f6zniteli\u011fin de\u011feri ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "De\u011ferinin bir NCName olmas\u0131 gereken \u00f6zniteli\u011fin de\u011feri ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Bir \u00f6\u011fesinin y\u00f6ntem \u00f6zniteli\u011finin de\u011feri ''{0}''. De\u011fer ''xml'', ''html'', ''text'' ya da ncname olmayan bir qname olmal\u0131d\u0131r"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "TransformerFactory.getFeature(dizgi ad\u0131) i\u00e7inde \u00f6zellik (feature) ad\u0131 bo\u015f de\u011ferli olamaz."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "TransformerFactory.setFeature(dizgi ad\u0131, boole de\u011fer) i\u00e7inde \u00f6zellik (feature) ad\u0131 bo\u015f de\u011ferli olamaz."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Bu TransformerFactory \u00fczerinde ''{0}'' \u00f6zelli\u011fi tan\u0131mlanamaz."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ClassGenerator.java0000644000175000017500000001076310721374030026711 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ClassGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ClassGen; import org.apache.bcel.generic.Instruction; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.Parser; import org.apache.xalan.xsltc.compiler.Stylesheet; /** * The class that implements any class that inherits from * AbstractTranslet, i.e. any translet. Methods in this * class may be of the following kinds: * * 1. Main method: applyTemplates, implemented by intances of * MethodGenerator. * * 2. Named methods: for named templates, implemented by instances * of NamedMethodGenerator. * * 3. Rt methods: for result tree fragments, implemented by * instances of RtMethodGenerator. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public class ClassGenerator extends ClassGen { protected final static int TRANSLET_INDEX = 0; private Stylesheet _stylesheet; private final Parser _parser; // --> can be moved to XSLT // a single instance cached here private final Instruction _aloadTranslet; private final String _domClass; private final String _domClassSig; private final String _applyTemplatesSig; private final String _applyTemplatesSigForImport; public ClassGenerator(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces, Stylesheet stylesheet) { super(class_name, super_class_name, file_name, access_flags, interfaces); _stylesheet = stylesheet; _parser = stylesheet.getParser(); _aloadTranslet = new ALOAD(TRANSLET_INDEX); if (stylesheet.isMultiDocument()) { _domClass = "org.apache.xalan.xsltc.dom.MultiDOM"; _domClassSig = "Lorg/apache/xalan/xsltc/dom/MultiDOM;"; } else { _domClass = "org.apache.xalan.xsltc.dom.DOMAdapter"; _domClassSig = "Lorg/apache/xalan/xsltc/dom/DOMAdapter;"; } _applyTemplatesSig = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + ")V"; _applyTemplatesSigForImport = "(" + Constants.DOM_INTF_SIG + Constants.NODE_ITERATOR_SIG + Constants.TRANSLET_OUTPUT_SIG + Constants.NODE_FIELD_SIG + ")V"; } public final Parser getParser() { return _parser; } public final Stylesheet getStylesheet() { return _stylesheet; } /** * Pretend this is the stylesheet class. Useful when compiling * references to global variables inside a predicate. */ public final String getClassName() { return _stylesheet.getClassName(); } public Instruction loadTranslet() { return _aloadTranslet; } public final String getDOMClass() { return _domClass; } public final String getDOMClassSig() { return _domClassSig; } public final String getApplyTemplatesSig() { return _applyTemplatesSig; } public final String getApplyTemplatesSigForImport() { return _applyTemplatesSigForImport; } /** * Returns true or false depending on whether * this class inherits from AbstractTranslet or not. */ public boolean isExternal() { return false; } public void addMethod(MethodGenerator methodGen) { Method[] methodsToAdd = methodGen.getGeneratedMethods(this); for (int i = 0; i < methodsToAdd.length; i++) { addMethod(methodsToAdd[i]); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_ja.java0000644000175000017500000014202210721374030027222 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ja.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ja extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "\u8907\u6570\u306e\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u304c\u540c\u3058\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 ''{0}'' \u306f\u3053\u306e\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u5185\u306b\u3059\u3067\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 ''{0}'' \u306f\u3053\u306e\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u5185\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "\u5909\u6570 ''{0}'' \u306f\u540c\u4e00\u30b9\u30b3\u30fc\u30d7\u306b\u8907\u6570\u56de\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "\u5909\u6570\u307e\u305f\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc ''{0}'' \u304c\u672a\u5b9a\u7fa9\u3067\u3059\u3002"}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "\u30af\u30e9\u30b9 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "\u5916\u90e8\u30e1\u30bd\u30c3\u30c9 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093 (public \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093)"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "\u30e1\u30bd\u30c3\u30c9 ''{0}'' \u3078\u306e\u547c\u3073\u51fa\u3057\u306e\u5f15\u6570/\u623b\u308a\u5024\u306e\u578b\u3092\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "\u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306f URI ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI ''{0}'' \u304c\u7121\u52b9\u3067\u3059\u3002"}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "\u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306f URI ''{0}'' \u3092\u30aa\u30fc\u30d7\u30f3\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, " \u307e\u305f\u306f \u8981\u7d20\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002"}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "\u540d\u524d\u7a7a\u9593\u63a5\u982d\u90e8 ''{0}'' \u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "\u95a2\u6570 ''{0}'' \u3078\u306e\u547c\u3073\u51fa\u3057\u3092\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "''{0}'' \u3078\u306e\u5f15\u6570\u306f\u30ea\u30c6\u30e9\u30eb\u30fb\u30b9\u30c8\u30ea\u30f3\u30b0\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "XPath \u5f0f ''{0}'' \u3092\u69cb\u6587\u89e3\u6790\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002"}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "\u5fc5\u8981\u5c5e\u6027 ''{0}'' \u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "XPath \u5f0f\u5185\u306b\u6b63\u3057\u304f\u306a\u3044\u6587\u5b57 ''{0}'' \u304c\u3042\u308a\u307e\u3059\u3002"}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "\u51e6\u7406\u547d\u4ee4\u306e\u540d\u524d ''{0}'' \u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "\u5c5e\u6027 ''{0}'' \u304c\u8981\u7d20\u306e\u5916\u5074\u3067\u3059\u3002"}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "\u5c5e\u6027 ''{0}'' \u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "import/include \u304c\u76f8\u4e92\u4f9d\u5b58\u3057\u3066\u3044\u307e\u3059\u3002\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8 ''{0}'' \u306f\u3059\u3067\u306b\u30ed\u30fc\u30c9\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "\u7d50\u679c\u30c4\u30ea\u30fc\u30fb\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3092\u30bd\u30fc\u30c8\u3067\u304d\u307e\u305b\u3093 ( \u8981\u7d20\u306f\u7121\u8996\u3055\u308c\u307e\u3059)\u3002\u3053\u306e\u30ce\u30fc\u30c9\u306f\u7d50\u679c\u30c4\u30ea\u30fc\u306e\u4f5c\u6210\u6642\u306b\u30bd\u30fc\u30c8\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "10 \u9032\u6570\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 ''{0}'' \u306f\u3059\u3067\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSL \u30d0\u30fc\u30b8\u30e7\u30f3 ''{0}'' \u306f XSLTC \u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "''{0}'' \u306e\u5909\u6570/\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u53c2\u7167\u304c\u76f8\u4e92\u4f9d\u5b58\u3057\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "2 \u9032\u5f0f\u306e\u6f14\u7b97\u5b50\u304c\u4e0d\u660e\u3067\u3059\u3002"}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "\u95a2\u6570\u547c\u3073\u51fa\u3057\u306e\u5f15\u6570 (1 \u3064\u4ee5\u4e0a) \u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "document() \u95a2\u6570\u3078\u306e 2 \u3064\u76ee\u306e\u5f15\u6570\u306f\u30ce\u30fc\u30c9\u30fb\u30bb\u30c3\u30c8\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u306e \u8981\u7d20\u304c \u5185\u306b\u5fc5\u8981\u3067\u3059\u3002"}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, " \u3067\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b \u8981\u7d20\u306f 1 \u3064\u3060\u3051\u3067\u3059\u3002"}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " \u3092\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f \u5185\u3060\u3051\u3067\u3059\u3002"}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " \u3092\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f \u5185\u3060\u3051\u3067\u3059\u3002"}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, " \u3067\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u306e\u306f \u304a\u3088\u3073 \u8981\u7d20\u3060\u3051\u3067\u3059\u3002"}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " \u306b 'name' \u5c5e\u6027\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "\u5b50\u8981\u7d20\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "\u8981\u7d20\u306b ''{0}'' \u3068\u3044\u3046\u540d\u524d\u3092\u4ed8\u3051\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "\u5c5e\u6027\u306b ''{0}'' \u3068\u3044\u3046\u540d\u524d\u3092\u4ed8\u3051\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "\u30c6\u30ad\u30b9\u30c8\u30fb\u30c7\u30fc\u30bf\u304c\u6700\u4e0a\u4f4d\u306e \u8981\u7d20\u306e\u5916\u5074\u306b\u3042\u308a\u307e\u3059\u3002"}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP \u30d1\u30fc\u30b5\u30fc\u306f\u6b63\u3057\u304f\u69cb\u6210\u3055\u308c\u3066\u3044\u307e\u305b\u3093"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "\u30ea\u30ab\u30d0\u30ea\u30fc\u4e0d\u80fd XSLTC \u5185\u90e8\u30a8\u30e9\u30fc: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "XSL \u8981\u7d20 ''{0}'' \u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "XSLTC \u62e1\u5f35\u6a5f\u80fd ''{0}'' \u306f\u8a8d\u8b58\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "\u5165\u529b\u6587\u66f8\u306f\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3067\u306f\u3042\u308a\u307e\u305b\u3093 (XSL \u540d\u524d\u7a7a\u9593\u306f\u30eb\u30fc\u30c8\u8981\u7d20\u5185\u3067\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093)"}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u30fb\u30bf\u30fc\u30b2\u30c3\u30c8 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "''{0}'' \u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "\u5165\u529b\u6587\u66f8\u306b\u306f XSL \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u304c\u5165\u3063\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "\u8981\u7d20 ''{0}'' \u3092\u69cb\u6587\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, " \u306e use \u5c5e\u6027\u306f node\u3001node-set\u3001string\u3001\u307e\u305f\u306f number \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "\u51fa\u529b XML \u6587\u66f8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f 1.0 \u306b\u306a\u3063\u3066\u3044\u308b\u306f\u305a\u3067\u3059"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "\u95a2\u4fc2\u5f0f\u306e\u6f14\u7b97\u5b50\u304c\u4e0d\u660e\u3067\u3059"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "\u5b58\u5728\u3057\u306a\u3044\u5c5e\u6027\u30bb\u30c3\u30c8 ''{0}'' \u3092\u4f7f\u7528\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "\u5c5e\u6027\u5024\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 ''{0}'' \u3092\u69cb\u6587\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "\u30af\u30e9\u30b9 ''{0}'' \u306e\u30b7\u30b0\u30cb\u30c1\u30e3\u30fc\u5185\u306e\u30c7\u30fc\u30bf\u578b\u304c\u4e0d\u660e\u3067\u3059\u3002"}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "\u30c7\u30fc\u30bf\u578b ''{0}'' \u3092 ''{1}'' \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "\u3053\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u306f\u6709\u52b9\u306a translet \u30af\u30e9\u30b9\u5b9a\u7fa9\u304c\u5165\u3063\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "\u3053\u306e Templates \u306b\u306f\u540d\u524d\u304c ''{0}'' \u306e\u30af\u30e9\u30b9\u306f\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "translet \u30af\u30e9\u30b9 ''{0}'' \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, {ErrorMsg.TRANSLET_OBJECT_ERR, "translet \u30af\u30e9\u30b9\u304c\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3057\u305f\u304c\u3001translet \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "''{0}'' \u306e ErrorListener \u3092\u30cc\u30eb\u306b\u8a2d\u5b9a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC \u304c\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u306e\u306f StreamSource\u3001SAXSource\u3001\u304a\u3088\u3073 DOMSource \u3060\u3051\u3067\u3059"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "''{0}'' \u306b\u6e21\u3055\u308c\u305f Source \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f\u5185\u5bb9\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory \u306f\u5c5e\u6027 ''{0}'' \u3092\u8a8d\u8b58\u3057\u307e\u305b\u3093\u3002"}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() \u306f startDocument() \u306e\u524d\u306b\u547c\u3073\u51fa\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "\u5909\u63db\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u306f\u30ab\u30d7\u30bb\u30eb\u5316\u3055\u308c\u305f translet \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "\u5909\u63db\u7d50\u679c\u306e\u51fa\u529b\u30cf\u30f3\u30c9\u30e9\u30fc\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "''{0}'' \u306b\u6e21\u3055\u308c\u305f Result \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u7121\u52b9\u3067\u3059\u3002"}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "\u7121\u52b9\u306a Transformer \u30d7\u30ed\u30d1\u30c6\u30a3\u30fc ''{0}'' \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "SAX2DOM \u30a2\u30c0\u30d7\u30bf\u30fc ''{0}'' \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() \u304c systemId \u3092\u8a2d\u5b9a\u3057\u306a\u3044\u3067\u547c\u3073\u51fa\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, { ErrorMsg.ER_RESULT_NULL, "\u7d50\u679c\u306f\u30cc\u30eb\u306b\u306f\u306a\u3089\u306a\u3044\u306f\u305a\u3067\u3059\u3002"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "param {0} \u306e\u5024\u306f\u6709\u52b9\u306a Java \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059"}, {ErrorMsg.COMPILE_STDIN_ERR, "-i \u30aa\u30d7\u30b7\u30e7\u30f3\u306f -o \u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u4e00\u7dd2\u306b\u4f7f\u7528\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "\u5f62\u5f0f\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\n\u30aa\u30d7\u30b7\u30e7\u30f3\n -o \u540d\u524d \u3092\u751f\u6210\u3055\u308c\u308b translet \u306b\n \u5272\u308a\u5f53\u3066\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001translet \u540d\u306f \n \u540d\u304b\u3089\u6d3e\u751f\u3057\u307e\u3059\u3002\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u8907\u6570\u306e\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\n \u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u5834\u5408\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002\n-d translet \u306e\u5b9b\u5148\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u6307\u5b9a\u3057\u307e\u3059\n -j translet \u30af\u30e9\u30b9\u3092 \u3068\u3057\u3066\u6307\u5b9a\u3055\u308c\u305f\n \u540d\u524d\u306e JAR \u30d5\u30a1\u30a4\u30eb\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u3057\u307e\u3059\n -p \u751f\u6210\u5f8c\u306e\u3059\u3079\u3066\u306e translet \u30af\u30e9\u30b9\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\n \u63a5\u982d\u90e8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\n-n \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30a4\u30f3\u30e9\u30a4\u30f3\u5316\u3092\u4f7f\u7528\u53ef\u80fd\u306b\u3057\u307e\u3059 (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30a4\u30f3\n \u30e9\u30a4\u30f3\u5316\u3067\u5e73\u5747\u3068\u3057\u3066\u826f\u597d\u306a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059)\n-x \u8ffd\u52a0\u306e\u30c7\u30d0\u30c3\u30b0\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u51fa\u529b\u3092\u30aa\u30f3\u306b\u3057\u307e\u3059\n -u \u5f15\u6570\u3092 URL \u3068\u3057\u3066\u89e3\u91c8\u3057\u307e\u3059\n -i \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\u6a19\u6e96\u5165\u529b\u304b\u3089\u8aad\u307f\u53d6\u308b\u3088\u3046\u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u306b\u5f37\u5236\u3057\u307e\u3059\n -v \u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3057\u307e\u3059\n -h \u3053\u306e\u4f7f\u7528\u6cd5\u3092\u5370\u5237\u3057\u307e\u3059\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "\u5f62\u5f0f\n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n translet \u3092\u4f7f\u7528\u3057\u3066 \u3067\u6307\u5b9a\u3055\u308c\u305f\n XML \u6587\u66f8\u3092\u5909\u63db\u3057\u307e\u3059\u3002translet \u306f\u30e6\u30fc\u30b6\u30fc\u306e CLASSPATH\n \u307e\u305f\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u3055\u308c\u308b \u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002\n\u30aa\u30d7\u30b7\u30e7\u30f3\n -j \u30ed\u30fc\u30c9\u3059\u308b translet \u304c\u5165\u3063\u3066\u3044\u308b JAR \u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u307e\u3059\n -x \u8ffd\u52a0\u306e\u30c7\u30d0\u30c3\u30b0\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u51fa\u529b\u3092\u30aa\u30f3\u306b\u3057\u307e\u3059\n -n \u306f\u5909\u63db\u3092 \u56de\u5b9f\u884c\u3057\u3066\n \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u60c5\u5831\u3092\u8868\u793a\u3057\u307e\u3059\n -u \u306f XML \u5165\u529b\u6587\u66f8\u3092 URL \u3068\u3057\u3066\u6307\u5b9a\u3057\u307e\u3059\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " \u3092\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f \u307e\u305f\u306f \u5185\u3060\u3051\u3067\u3059\u3002"}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "\u51fa\u529b\u30a8\u30f3\u30b3\u30fc\u30c9 ''{0}'' \u306f\u3053\u306e JVM \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "''{0}'' \u306b\u69cb\u6587\u30a8\u30e9\u30fc\u304c\u3042\u308a\u307e\u3059\u3002"}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "\u5916\u90e8\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30fc ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "\u975e static Java \u95a2\u6570 ''{0}'' \u3078\u306e\u5148\u982d\u306e\u5f15\u6570\u306f\u6709\u52b9\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u53c2\u7167\u3067\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "\u5f0f ''{0}'' \u306e\u578b\u3092\u691c\u67fb\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002"}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "\u4e0d\u660e\u306a\u30ed\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u5f0f\u306e\u578b\u3092\u691c\u67fb\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002"}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "\u30b3\u30de\u30f3\u30c9\u884c\u30aa\u30d7\u30b7\u30e7\u30f3 ''{0}'' \u304c\u7121\u52b9\u3067\u3059\u3002"}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "\u30b3\u30de\u30f3\u30c9\u884c\u30aa\u30d7\u30b7\u30e7\u30f3 ''{0}'' \u306b\u5fc5\u8981\u306a\u5f15\u6570\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "\u8b66\u544a: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "\u8b66\u544a: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "\u81f4\u547d\u7684\u30a8\u30e9\u30fc: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "\u81f4\u547d\u7684\u30a8\u30e9\u30fc: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "\u30a8\u30e9\u30fc: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "\u30a8\u30e9\u30fc: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "translet ''{0}'' \u3092\u4f7f\u7528\u3059\u308b\u5909\u63db"}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "JAR \u30d5\u30a1\u30a4\u30eb ''{1}'' \u306e translet ''{0}'' \u3092\u4f7f\u7528\u3059\u308b\u5909\u63db"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "TransformerFactory \u30af\u30e9\u30b9 ''{0}'' \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "\u540d\u524d ''{0}'' \u306f translet \u30af\u30e9\u30b9\u306e\u540d\u524d\u3068\u3057\u3066\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002Java \u30af\u30e9\u30b9\u306e\u540d\u524d\u306b\u8a31\u53ef\u3055\u308c\u3066\u3044\u306a\u3044\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u305f\u3081\u3067\u3059\u3002\u4ee3\u308f\u308a\u306b\u3001\u540d\u524d ''{1}'' \u304c\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002"}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "\u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u30fb\u30a8\u30e9\u30fc:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "\u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u8b66\u544a:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Translet \u30a8\u30e9\u30fc:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "\u5024\u304c QName \u307e\u305f\u306f\u7a7a\u767d\u3067\u533a\u5207\u3089\u308c\u305f QNames \u306e\u30ea\u30b9\u30c8\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5c5e\u6027\u306b\u3001\u5024 ''{0}'' \u304c\u3042\u308a\u307e\u3057\u305f\u3002"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "\u5024\u304c NCName \u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5c5e\u6027\u306b\u3001\u5024 ''{0}'' \u304c\u3042\u308a\u307e\u3057\u305f\u3002"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, " \u8981\u7d20\u306e method \u5c5e\u6027\u306b\u3001\u5024 ''{0}'' \u304c\u3042\u308a\u307e\u3057\u305f\u3002\u5024\u306f ''xml''\u3001''html''\u3001''text''\u3001\u307e\u305f\u306f qname-but-not-ncname \u306e\u3044\u305a\u308c\u304b\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "TransformerFactory.getFeature(String name) \u306e\u6a5f\u80fd\u540d\u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "TransformerFactory.setFeature(String name, boolean value) \u306e\u6a5f\u80fd\u540d\u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "\u6a5f\u80fd ''{0}'' \u306f\u3053\u306e TransformerFactory \u306b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002"} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_ru.java0000644000175000017500000017427410721374033027277 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ru.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ru extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "\u0412 \u0444\u0430\u0439\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0442\u0438\u043b\u0435\u0439."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "\u0428\u0430\u0431\u043b\u043e\u043d ''{0}'' \u0443\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0442\u0438\u043b\u0435\u0439. "}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "\u0428\u0430\u0431\u043b\u043e\u043d ''{0}'' \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0442\u0438\u043b\u0435\u0439. "}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f ''{0}'' \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u043c\u0435\u043d. "}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ''{0}'' \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b. "}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u043a\u043b\u0430\u0441\u0441 ''{0}''. "}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 ''{0}'' (\u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 public). "}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f argument/return \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0444\u0430\u0439\u043b \u0438\u043b\u0438 URI ''{0}''. "}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 URI ''{0}''. "}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u0438\u043b\u0438 URI ''{0}''. "}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "\u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043b\u0438 ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "\u041d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u043f\u0440\u0435\u0444\u0438\u043a\u0441 ''{0}'' \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d. "}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ''{0}''. "}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 ''{0}'' \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439. "}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f XPath ''{0}''. "}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}''. "}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b ''{0}'' \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 XPath. "}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "\u0418\u043c\u044f ''{0}'' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0434\u043b\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}'' \u0432\u043d\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. "}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}''. "}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "\u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043c\u043f\u043e\u0440\u0442/\u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0442\u0438\u043b\u0435\u0439 ''{0}'' \u0443\u0436\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430. "}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 (\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f). \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0437\u043b\u044b."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "\u0421\u0442\u0438\u043b\u044c \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f ''{0}'' \u0443\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d. "}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "\u0412\u0435\u0440\u0441\u0438\u044f XSL ''{0}'' \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XSLTC. "}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "\u0426\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 ''{0}''. "}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "\u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 document() \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0443\u0437\u043b\u043e\u0432."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "\u0412 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, " \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "\u0412 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "\u0412 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 ''{0}''. "}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}''. "}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043d\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f ."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 JAXP"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "\u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 XSLTC: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 XSL ''{0}''. "}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 XSLTC ''{0}''. "}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0442\u0438\u043b\u0435\u0439 (\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d XSL \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 ''{0}''. "}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430: ''{0}''. "}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 use \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c node, node-set, string \u0438\u043b\u0438 number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 XML \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f."}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 ''{0}''. "}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 ''{0}''. "}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 ''{0}''. "}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 ''{0}'' \u0432 ''{1}''. "}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 Templates \u043d\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 Templates \u043d\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{0}''. "}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f ''{0}''. "}, {ErrorMsg.TRANSLET_OBJECT_ERR, "\u041a\u043b\u0430\u0441\u0441 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 ErrorListener \u0434\u043b\u044f ''{0}''"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e StreamSource, SAXSource \u0438 DOMSource"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 ''{0}'', \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0445. "}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "\u041e\u0431\u044a\u0435\u043a\u0442 TransformerFactory \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043b \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}''. "}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "\u041f\u0435\u0440\u0435\u0434 startDocument() \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c setResult()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "\u0412 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Transformer \u043d\u0435\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "\u0414\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u0432\u043e\u0434\u0430."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "\u041e\u0431\u044a\u0435\u043a\u0442 Result, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 ''{0}'', \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c. "}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 Transformer ''{0}''. "}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 SAX2DOM: ''{0}''. "}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() \u0432\u044b\u0437\u0432\u0430\u043d \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 systemId."}, { ErrorMsg.ER_RESULT_NULL, "\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 {0} \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c Java"}, {ErrorMsg.COMPILE_STDIN_ERR, "\u041e\u043f\u0446\u0438\u044f -i \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u043f\u0446\u0438\u0435\u0439 -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o <\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439-\u0444\u0430\u0439\u043b>]\n [-d <\u043a\u0430\u0442\u0430\u043b\u043e\u0433>] [-j <\u0444\u0430\u0439\u043b-jar>] [-p <\u043f\u0430\u043a\u0435\u0442>]\n [-n] [-x] [-u] [-v] [-h] { <\u0442\u0430\u0431\u043b\u0438\u0446\u0430-\u0441\u0442\u0438\u043b\u0435\u0439> | -i }\n\n\u041e\u041f\u0426\u0418\u0418\n -o <\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439-\u0444\u0430\u0439\u043b> \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0438\u043c\u044f <\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439-\u0444\u0430\u0439\u043b> \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \n translet. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f\n \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 \u0438\u043c\u0435\u043d\u0438 <\u0442\u0430\u0431\u043b\u0438\u0446\u044b-\u0441\u0442\u0438\u043b\u0435\u0439>. \u041f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0442\u0438\u043b\u0435\u0439\n \u044d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f.\n -d <\u043a\u0430\u0442\u0430\u043b\u043e\u0433> \u0437\u0430\u0434\u0430\u0435\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f\n -j <\u0444\u0430\u0439\u043b-jar> \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \n \u0432 <\u0444\u0430\u0439\u043b-jar> \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c\n -p <\u043f\u0430\u043a\u0435\u0442> \u0437\u0430\u0434\u0430\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445\n \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f\n -n \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0430 (\u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043f\u043e\u0441\u043e\u0431, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e,\n \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435).\n -x \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \n -u \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b <\u0442\u0430\u0431\u043b\u0438\u0446\u044b-\u0441\u0442\u0438\u043b\u0435\u0439> \u043a\u0430\u043a URL\n -i \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438\u0437 stdin\n -v \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\n -h \u0432\u044b\u0434\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j <\u0444\u0430\u0439\u043b-jar>]\n [-x] [-n <\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438>] {-u | <\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442>}\n <\u043a\u043b\u0430\u0441\u0441> [<\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u04401>=<\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u04351> ...]\n\n \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 <\u043a\u043b\u0430\u0441\u0441> \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 XML,\n \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442>. <\u041a\u043b\u0430\u0441\u0441> \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043b\u0438\u0431\u043e \n \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CLASSPATH \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043b\u0438\u0431\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e <\u0444\u0430\u0439\u043b\u0430-jar>.\n\u041e\u041f\u0426\u0418\u0418\n -j <\u0444\u0430\u0439\u043b-jar> \u0444\u0430\u0439\u043b jar, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c translet\n -x \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\n -n <\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0437 \u0438\n \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0430\u0445\n -u URL \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 XML\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u043b\u0438 ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "\u0412\u044b\u0445\u043e\u0434\u043d\u0430\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 ''{0}'' \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 JVM. "}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 ''{0}''. "}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 ''{0}''. "}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "\u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Java ''{0}'' \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442. "}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0442\u0438\u043f\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f ''{0}''. "}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0442\u0438\u043f\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430\u044f \u043e\u043f\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 ''{0}''. "}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "\u041e\u043f\u0446\u0438\u044f ''{0}'' \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. "}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "\u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "\u041d\u0435\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "\u041e\u0448\u0438\u0431\u043a\u0430: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "\u041e\u0448\u0438\u0431\u043a\u0430: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b ''{0}'' \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 TransformerFactory ''{0}''. "}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "\u0418\u043c\u044f ''{0}'' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043d\u044b\u0435 \u0432 \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 Java. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0438\u043c\u044f ''{1}''. "}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "\u041e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "\u041e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "\u0412 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 QName \u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a QName, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "\u0412 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NCName, \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "\u0412 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ''{0}''. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f ''xml'', ''html'', ''text'' \u0438 qname, \u043d\u043e \u043d\u0435 ncname"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "\u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c \u0432 TransformerFactory.getFeature(\u0418\u043c\u044f \u0441\u0442\u0440\u043e\u043a\u0438). "}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "\u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c \u0432 TransformerFactory.setFeature(\u0418\u043c\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u0431\u0443\u043b\u0435\u0432\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435). "}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e ''{0}'' \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 TransformerFactory. "} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java0000644000175000017500000012472410721374031026562 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "More than one stylesheet defined in the same file."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "Template ''{0}'' already defined in this stylesheet."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "Template ''{0}'' not defined in this stylesheet."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "Variable ''{0}'' is multiply defined in the same scope."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Variable or parameter ''{0}'' is undefined."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Cannot find class ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Cannot find external method ''{0}'' (must be public)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Cannot convert argument/return type in call to method ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "File or URI ''{0}'' not found."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "Invalid URI ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Cannot open file or URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, " or element expected."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Namespace prefix ''{0}'' is undeclared."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Unable to resolve call to function ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "Argument to ''{0}'' must be a literal string."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Error parsing XPath expression ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Required attribute ''{0}'' is missing."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Illegal character ''{0}'' in XPath expression."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Illegal name ''{0}'' for processing instruction."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Attribute ''{0}'' outside of element."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Illegal attribute ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Circular import/include. Stylesheet ''{0}'' already loaded."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Result-tree fragments cannot be sorted ( elements are " + "ignored). You must sort the nodes when creating the result tree."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Decimal formatting ''{0}'' is already defined."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSL version ''{0}'' is not supported by XSLTC."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Circular variable/parameter reference in ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Unknown operator for binary expression."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Illegal argument(s) for function call."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Second argument to document() function must be a node-set."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "At least one element required in ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Only one element allowed in ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " can only be used within ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " can only be used within ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Only and elements allowed in ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " is missing the 'name' attribute."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Illegal child element."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "You cannot call an element ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "You cannot call an attribute ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Text data outside of top-level element."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP parser not configured correctly"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Unrecoverable XSLTC-internal error: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Unsupported XSL element ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Unrecognised XSLTC extension ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "The input document is not a stylesheet (the XSL namespace is not "+ "declared in the root element)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Could not find stylesheet target ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Not implemented: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "The input document does not contain an XSL stylesheet."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Could not parse element ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "The use attribute of must be node, node-set, string or number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "Output XML document version should be 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Unknown operator for relational expression"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Attempting to use non-existing attribute set ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Cannot parse attribute value template ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Unknown data-type in signature for class ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Cannot convert data-type ''{0}'' to ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "This Templates does not contain a valid translet class definition."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "This Templates does not contain a class with the name ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Could not load the translet class ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Translet class loaded, but unable to create translet instance."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Attempting to set ErrorListener for ''{0}'' to null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Only StreamSource, SAXSource and DOMSource are supported by XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "Source object passed to ''{0}'' has no contents."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Could not compile stylesheet"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory does not recognise attribute ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() must be called prior to startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "The Transformer has no encapsulated translet object."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "No defined output handler for transformation result."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "Result object passed to ''{0}'' is invalid."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Attempting to access invalid Transformer property ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Could not create SAX2DOM adapter: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() called without systemId being set."}, { ErrorMsg.ER_RESULT_NULL, "Result should not be null"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "The value of param {0} must be a valid Java Object"}, {ErrorMsg.COMPILE_STDIN_ERR, "The -i option must be used with the -o option."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n"+ " java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n"+ " [-d ] [-j ] [-p ]\n"+ " [-n] [-x] [-u] [-v] [-h] { | -i }\n\n"+ "OPTIONS\n"+ " -o assigns the name to the generated\n"+ " translet. By default the translet name is\n"+ " derived from the name. This option\n"+ " is ignored if compiling multiple stylesheets.\n"+ " -d specifies a destination directory for translet\n"+ " -j packages translet classes into a jar file of the\n"+ " name specified as \n"+ " -p specifies a package name prefix for all generated\n"+ " translet classes.\n"+ " -n enables template inlining (default behavior better\n"+ " on average).\n"+ " -x turns on additional debugging message output\n"+ " -u interprets arguments as URLs\n"+ " -i forces compiler to read stylesheet from stdin\n"+ " -v prints the version of the compiler\n"+ " -h prints this usage statement\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n"+ " java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n"+ " [-x] [-n ] {-u | }\n"+ " [= ...]\n\n"+ " uses the translet to transform an XML document \n"+ " specified as . The translet is either in\n"+ " the user's CLASSPATH or in the optionally specified .\n"+ "OPTIONS\n"+ " -j specifies a jarfile from which to load translet\n"+ " -x turns on additional debugging message output\n"+ " -n runs the transformation times and\n"+ " displays profiling information\n"+ " -u specifies XML input document as a URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " can only be used within or ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "Output encoding ''{0}'' is not supported on this JVM."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Syntax error in ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Cannot find external constructor ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "The first argument to the non-static Java function ''{0}'' is not a "+ "valid object reference."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Error checking type of the expression ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Error checking type of an expression at an unknown location."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "The command-line option ''{0}'' is not valid."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "The command-line option ''{0}'' is missing a required argument."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "WARNING: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "WARNING: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "FATAL ERROR: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "FATAL ERROR: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERROR: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERROR: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transform using translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transform using translet ''{0}'' from jar file ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Could not create an instance of the TransformerFactory class ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "The name ''{0}'' could not be used as the name of the translet "+ "class because it contains characters that are not permitted in the "+ "name of Java class. The name ''{1}'' was used instead."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Compiler errors:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Compiler warnings:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Translet errors:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "An attribute whose value must be a QName or whitespace-separated list of QNames had the value ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "An attribute whose value must be an NCName had the value ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "The method attribute of an element had the value ''{0}''. The value must be one of ''xml'', ''html'', ''text'', or qname-but-not-ncname"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "The feature name cannot be null in TransformerFactory.getFeature(String name)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Cannot set the feature ''{0}'' on this TransformerFactory."}, /* * Note to translators: This message describes an internal error in the * processor. The term "byte code" is a Java technical term for the * executable code in a Java method, and "try-catch-finally block" * refers to the Java keywords with those names. "Outlined" is a * technical term internal to XSLTC and should not be translated. */ {ErrorMsg.OUTLINE_ERR_TRY_CATCH, "Internal XSLTC error: the generated byte code contains a " + "try-catch-finally block and cannot be outlined."}, /* * Note to translators: This message describes an internal error in the * processor. The terms "OutlineableChunkStart" and * "OutlineableChunkEnd" are the names of classes internal to XSLTC and * should not be translated. The message indicates that for every * "start" there must be a corresponding "end", and vice versa, and * that if one of a pair of "start" and "end" appears between another * pair of corresponding "start" and "end", then the other half of the * pair must also be between that same enclosing pair. */ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS, "Internal XSLTC error: OutlineableChunkStart and " + "OutlineableChunkEnd markers must be balanced and properly nested."}, /* * Note to translators: This message describes an internal error in the * processor. The term "byte code" is a Java technical term for the * executable code in a Java method. The "method" that is being * referred to is a Java method in a translet that XSLTC is generating * in processing a stylesheet. The "instruction" that is being * referred to is one of the instrutions in the Java byte code in that * method. "Outlined" is a technical term internal to XSLTC and * should not be translated. */ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET, "Internal XSLTC error: an instruction that was part of a block of " + "byte code that was outlined is still referred to in the original "+ "method." }, /* * Note to translators: This message describes an internal error in the * processor. The "method" that is being referred to is a Java method * in a translet that XSLTC is generating. * */ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG, "Internal XSLTC error: a method in the translet exceeds the Java " + "Virtual Machine limitation on the length of a method of 64 "+ "kilobytes. This is usually caused by templates in a stylesheet " + "that are very large. Try restructuring your stylesheet to use " + "smaller templates." } }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/Util.java0000644000175000017500000001272510721374032024714 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Util.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.StringTokenizer; import org.apache.bcel.generic.Type; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class Util { private static char filesep; static { String temp = System.getProperty("file.separator", "/"); filesep = temp.charAt(0); } public static String noExtName(String name) { final int index = name.lastIndexOf('.'); return name.substring(0, index >= 0 ? index : name.length()); } /** * Search for both slashes in order to support URLs and * files. */ public static String baseName(String name) { int index = name.lastIndexOf('\\'); if (index < 0) { index = name.lastIndexOf('/'); } if (index >= 0) return name.substring(index + 1); else { int lastColonIndex = name.lastIndexOf(':'); if (lastColonIndex > 0) return name.substring(lastColonIndex + 1); else return name; } } /** * Search for both slashes in order to support URLs and * files. */ public static String pathName(String name) { int index = name.lastIndexOf('/'); if (index < 0) { index = name.lastIndexOf('\\'); } return name.substring(0, index + 1); } /** * Replace all illegal Java chars by '_'. */ public static String toJavaName(String name) { if (name.length() > 0) { final StringBuffer result = new StringBuffer(); char ch = name.charAt(0); result.append(Character.isJavaIdentifierStart(ch) ? ch : '_'); final int n = name.length(); for (int i = 1; i < n; i++) { ch = name.charAt(i); result.append(Character.isJavaIdentifierPart(ch) ? ch : '_'); } return result.toString(); } return name; } public static Type getJCRefType(String signature) { return Type.getType(signature); } public static String internalName(String cname) { return cname.replace('.', filesep); } public static void println(String s) { System.out.println(s); } public static void println(char ch) { System.out.println(ch); } public static void TRACE1() { System.out.println("TRACE1"); } public static void TRACE2() { System.out.println("TRACE2"); } public static void TRACE3() { System.out.println("TRACE3"); } /** * Replace a certain character in a string with a new substring. */ public static String replace(String base, char ch, String str) { return (base.indexOf(ch) < 0) ? base : replace(base, String.valueOf(ch), new String[] { str }); } public static String replace(String base, String delim, String[] str) { final int len = base.length(); final StringBuffer result = new StringBuffer(); for (int i = 0; i < len; i++) { final char ch = base.charAt(i); final int k = delim.indexOf(ch); if (k >= 0) { result.append(str[k]); } else { result.append(ch); } } return result.toString(); } /** * Replace occurances of '.', '-', '/' and ':' */ public static String escape(String input) { return replace(input, ".-/:", new String[] { "$dot$", "$dash$", "$slash$", "$colon$" }); } public static String getLocalName(String qname) { final int index = qname.lastIndexOf(":"); return (index > 0) ? qname.substring(index + 1) : qname; } public static String getPrefix(String qname) { final int index = qname.lastIndexOf(":"); return (index > 0) ? qname.substring(0, index) : Constants.EMPTYSTRING; } /** * Checks if the string is a literal (i.e. not an AVT) or not. */ public static boolean isLiteral(String str) { final int length = str.length(); for (int i = 0; i < length - 1; i++) { if (str.charAt(i) == '{' && str.charAt(i + 1) != '{') { return false; } } return true; } /** * Checks if the string is valid list of qnames */ public static boolean isValidQNames(String str) { if ((str != null) && (!str.equals(Constants.EMPTYSTRING))) { final StringTokenizer tokens = new StringTokenizer(str); while (tokens.hasMoreTokens()) { if (!XML11Char.isXML11ValidQName(tokens.nextToken())) { return false; } } } return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_fr.java0000644000175000017500000012247710721374031027254 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_fr.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_fr extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Plusieurs feuilles de style ont \u00e9t\u00e9 d\u00e9finies dans le m\u00eame fichier."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "Le mod\u00e8le ''{0}'' est d\u00e9j\u00e0 d\u00e9fini dans cette feuille de style."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "Le mod\u00e8le ''{0}'' n''est pas d\u00e9fini dans cette feuille de style."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "La variable ''{0}'' est d\u00e9finie plusieurs fois dans la m\u00eame port\u00e9e."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "La variable ou le param\u00e8tre ''{0}'' n''est pas d\u00e9fini."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "La classe ''{0}'' est introuvable."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "La m\u00e9thode externe ''{0}'' est introuvable (doit \u00eatre public)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Impossible de convertir le type d''argument/de retour lors de l''appel de la m\u00e9thode ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Le fichier ou l'' URI ''{0}'' est introuvable."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI non valide ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Impossible d''ouvrir le fichier ou l''URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "L'\u00e9l\u00e9ment ou est attendu."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Le pr\u00e9fixe de l''espace de noms ''{0}'' n''est pas d\u00e9clar\u00e9."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Impossible de r\u00e9soudre l''appel \u00e0 la fonction ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "L''argument de ''{0}'' doit \u00eatre une cha\u00eene litt\u00e9rale."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Erreur lors de l''analyse de l''expression XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "L''attribut obligatoire ''{0}'' est absent."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Caract\u00e8re ''{0}'' non conforme dans l''expression XPath."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Nom ''{0}'' non conforme dans l''instruction de traitement."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "L''attribut ''{0}'' est \u00e0 l''ext\u00e9rieur de l''\u00e9l\u00e9ment."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Attribut ''{0}'' non conforme."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "import/include circulaire. La feuille de style ''{0}'' est d\u00e9j\u00e0 charg\u00e9e."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Tri impossible des fragments de l'arborescence de r\u00e9sultats (les \u00e9l\u00e9ments sont ignor\u00e9s). Vous devez trier les noeuds lors de la cr\u00e9ation de l'arborescence de r\u00e9sultats."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Le formatage d\u00e9cimal ''{0}'' est d\u00e9j\u00e0 d\u00e9fini."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "La version XSL ''{0}'' n''est pas prise en charge par XSLTC."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "R\u00e9f\u00e9rence variable/param\u00e8tre circulaire dans ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Op\u00e9rateur inconnu dans une expression binaire."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Argument(s) incorrect(s) pour l'appel de fonction."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Le deuxi\u00e8me argument de la fonction document() doit \u00eatre un ensemble de noeuds."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Au moins un \u00e9l\u00e9ment est requis dans ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Un seul \u00e9l\u00e9ment est autoris\u00e9 dans ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " peut \u00eatre utilis\u00e9 uniquement dans ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " peut \u00eatre utilis\u00e9 uniquement dans ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Seuls les \u00e9l\u00e9ments et sont autoris\u00e9s dans ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "Attribut 'name' absent de ."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "El\u00e9ment enfant incorrect."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Vous ne pouvez pas appeler un \u00e9l\u00e9ment ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Vous ne pouvez pas appeler un attribut ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Donn\u00e9es textuelles \u00e0 l'ext\u00e9rieur de l'\u00e9l\u00e9ment de niveau sup\u00e9rieur ."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "L'analyseur JAXP n'est pas configur\u00e9 correctement"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Erreur interne \u00e0 XSLTC irr\u00e9m\u00e9diable : ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "El\u00e9ment XSL non pris en charge ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Extension XSLTC ''{0}'' non reconnue."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Le document de base n'est pas une feuille de style (l'espace de noms XSL n'est pas d\u00e9clar\u00e9 dans l'\u00e9l\u00e9ment root)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "La feuille de style cible ''{0}'' est introuvable."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Non impl\u00e9ment\u00e9 : ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Le document de base ne contient pas de feuille de style XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Impossible d''analyser l''\u00e9l\u00e9ment ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "L'attribut use de doit avoir la valeur node, node-set, string ou number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "La version du document XML de sortie doit \u00eatre 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Op\u00e9rateur inconnu dans une expression relationnelle."}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Tentative d''utilisation d''un jeu d''attributs ''{0}'' inexistant."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Impossible d''analyser le mod\u00e8le de valeur d''attribut ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Type de donn\u00e9es inconnu dans la signature pour la classe ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Impossible de convertir le type de donn\u00e9es ''{0}'' en ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Cette classe Templates ne contient pas de d\u00e9finition de classe translet valide."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Cette classe Templates ne contient pas de classe portant le nom ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Impossible de charger la classe translet ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "La classe translet est charg\u00e9e, mais il est impossible de cr\u00e9er une instance translet."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Tentative de d\u00e9finition de l''\u00e9l\u00e9ment ErrorListener pour ''{0}'' \u00e0 une valeur null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Seuls StreamSource, SAXSource et DOMSource sont pris en charge par XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "L''objet source transmis \u00e0 ''{0}'' est vide."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Impossible de compiler la feuille de style"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory ne reconna\u00eet pas l''attribut ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() doit \u00eatre appel\u00e9 avant startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer ne comporte pas d'objet translet encapsul\u00e9."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Aucun gestionnaire de sortie n'a \u00e9t\u00e9 d\u00e9fini pour le r\u00e9sultat de la transformation."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "L''objet Result object transmis \u00e0 ''{0}'' n''est pas valide."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Tentative d''acc\u00e8s \u00e0 une propri\u00e9t\u00e9 Transformer non valide ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Impossible de cr\u00e9er l''adaptateur SAX2DOM : ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "Appel de la part de XSLTCSource.build() sans d\u00e9finition d'identification du syst\u00e8me."}, { ErrorMsg.ER_RESULT_NULL, "Le r\u00e9sultat doit \u00eatre vide"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "La valeur du param\u00e8tre {0} doit \u00eatre un objet Java valide"}, {ErrorMsg.COMPILE_STDIN_ERR, "L'option -i doit \u00eatre utilis\u00e9e avec l'option -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o attribue le nom au translet\n g\u00e9n\u00e9r\u00e9. Par d\u00e9faut, le nom du translet est\n d\u00e9riv\u00e9 du nom . Cette option\n est ignor\u00e9e si plusieurs feuilles de style sont compil\u00e9es.\n -d sp\u00e9cifie un r\u00e9pertoire de destination pour translet\n -j rassemble les classes translet dans le fichier \n \n -p sp\u00e9cifie un pr\u00e9fixe de nom de module pour toutes les classes\n translet g\u00e9n\u00e9r\u00e9es.\n -n active la mise en ligne de mod\u00e8le (comportement par d\u00e9faut - pr\u00e9f\u00e9rable \n on en moyenne).\n -x active le d\u00e9bogage suppl\u00e9mentaire de sortie de message\n -u interpr\u00e8te les arguments comme des adresses URL\n -i force le compilateur \u00e0 lire la feuille de style dans stdin\n -v imprime la version du compilateur\n -h imprime cette instruction de syntaxe\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n utilise la translet pour transformer un document XML \n d\u00e9fini comme . La translet se trouve dans la\n fonction CLASSPATH de l'utilisateur ou dans le indiqu\u00e9 en option.\nOPTIONS\n -j sp\u00e9cifie un fichier jar \u00e0 partir duquel charger le translet\n -x active le d\u00e9bogage suppl\u00e9mentaire de sortie de message\n -n ex\u00e9cute la transformation fois et\n affiche des informations de profil\n -u d\u00e9finit le document d'entr\u00e9e XML comme une URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " peut \u00eatre utilis\u00e9 uniquement dans ou ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "Le codage de sortie ''{0}'' n''est pas pris en charge dans cette JVM."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Erreur de syntaxe dans ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Impossible de trouver le constructeur externe ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Le premier argument de la fonction Java non static ''{0}'' n''est pas une r\u00e9f\u00e9rence d''objet valide."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Erreur lors de la v\u00e9rification du type de l''expression ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Erreur de contr\u00f4le du type d'une expression se trouvant dans un emplacement inconnu."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "L''option de ligne de commande ''{0}'' n''est pas valide."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Un argument obligatoire est absent de l''option de ligne de commande ''{0}''."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "AVERTISSEMENT : ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "AVERTISSEMENT : ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "ERREUR BLOQUANTE : ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "ERREUR BLOQUANTE : ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERREUR : ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERREUR : ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transformation \u00e0 l''aide du translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transformation \u00e0 l''aide du translet ''{0}'' \u00e0 partir du fichier jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Impossible de cr\u00e9er une instance de la classe TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "Le nom ''{0}'' ne peut pas \u00eatre utilis\u00e9 pour la classe translet du fait qu''elle contient des caract\u00e8res qui ne sont pas admis dans le nom d''une classe Java. Le nom ''{1}'' a \u00e9t\u00e9 utilis\u00e9 \u00e0 la place."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Erreurs de compilation :"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Avertissements de compilation :"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Erreurs de translet :"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Un attribut dont la valeur doit \u00eatre un QName ou une liste de QName d\u00e9limit\u00e9e par des espaces poss\u00e8de la valeur ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Un attribut dont la valeur doit \u00eatre un NCName poss\u00e8de la valeur ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "L''attribut method d''un \u00e9l\u00e9ment poss\u00e8de la valeur ''{0}''. La valeur doit \u00eatre ''xml'', ''html'', ''text'' ou qname-but-not-ncname"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "Le nom de la fonction ne peut pas avoir une valeur null dans TransformerFactory.getFeature (nom cha\u00eene)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "Le nom de la fonction ne peut pas avoir la valeur null dans TransformerFactory.setFeature (nom cha\u00eene, valeur bool\u00e9nne)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Impossible de d\u00e9finir la fonction ''{0}'' sur cet \u00e9l\u00e9ment TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java0000644000175000017500000004072310721374032026736 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ResultTreeType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class ResultTreeType extends Type { private final String _methodName; protected ResultTreeType() { _methodName = null; } public ResultTreeType(String methodName) { _methodName = methodName; } public String toString() { return "result-tree"; } public boolean identicalTo(Type other) { return (other instanceof ResultTreeType); } public String toSignature() { return DOM_INTF_SIG; } public org.apache.bcel.generic.Type toJCType() { return Util.getJCRefType(toSignature()); } public String getMethodName() { return _methodName; } public boolean implementedAsMethod() { return _methodName != null; } /** * Translates a result tree to object of internal type type. * The translation to int is undefined since result trees * are always converted to reals in arithmetic expressions. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of the type to translate the result tree to * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType)type); } else if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType)type); } else if (type == Type.Real) { translateTo(classGen, methodGen, (RealType)type); } else if (type == Type.NodeSet) { translateTo(classGen, methodGen, (NodeSetType)type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType)type); } else if (type == Type.Object) { translateTo(classGen, methodGen, (ObjectType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects an result tree on the stack and pushes a boolean. * Translates a result tree to a boolean by first converting it to string. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of BooleanType (any) * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { // A result tree is always 'true' when converted to a boolean value, // since the tree always has at least one node (the root). final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(POP); // don't need the DOM reference il.append(ICONST_1); // push 'true' on the stack } /** * Expects an result tree on the stack and pushes a string. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of StringType (any) * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_methodName == null) { int index = cpg.addInterfaceMethodref(DOM_INTF, "getStringValue", "()"+STRING_SIG); il.append(new INVOKEINTERFACE(index, 1)); } else { final String className = classGen.getClassName(); final int current = methodGen.getLocalIndex("current"); // Push required parameters il.append(classGen.loadTranslet()); if (classGen.isExternal()) { il.append(new CHECKCAST(cpg.addClass(className))); } il.append(DUP); il.append(new GETFIELD(cpg.addFieldref(className, "_dom", DOM_INTF_SIG))); // Create a new instance of a StringValueHandler int index = cpg.addMethodref(STRING_VALUE_HANDLER, "", "()V"); il.append(new NEW(cpg.addClass(STRING_VALUE_HANDLER))); il.append(DUP); il.append(DUP); il.append(new INVOKESPECIAL(index)); // Store new Handler into a local variable final LocalVariableGen handler = methodGen.addLocalVariable("rt_to_string_handler", Util.getJCRefType(STRING_VALUE_HANDLER_SIG), null, null); handler.setStart(il.append(new ASTORE(handler.getIndex()))); // Call the method that implements this result tree index = cpg.addMethodref(className, _methodName, "("+DOM_INTF_SIG+TRANSLET_OUTPUT_SIG+")V"); il.append(new INVOKEVIRTUAL(index)); // Restore new handler and call getValue() handler.setEnd(il.append(new ALOAD(handler.getIndex()))); index = cpg.addMethodref(STRING_VALUE_HANDLER, "getValue", "()" + STRING_SIG); il.append(new INVOKEVIRTUAL(index)); } } /** * Expects an result tree on the stack and pushes a real. * Translates a result tree into a real by first converting it to string. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of RealType (any) * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { translateTo(classGen, methodGen, Type.String); Type.String.translateTo(classGen, methodGen, Type.Real); } /** * Expects a result tree on the stack and pushes a boxed result tree. * Result trees are already boxed so the translation is just a NOP. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of ReferenceType (any) * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_methodName == null) { il.append(NOP); } else { LocalVariableGen domBuilder, newDom; final String className = classGen.getClassName(); final int current = methodGen.getLocalIndex("current"); // Push required parameters il.append(classGen.loadTranslet()); if (classGen.isExternal()) { il.append(new CHECKCAST(cpg.addClass(className))); } il.append(methodGen.loadDOM()); // Create new instance of DOM class (with RTF_INITIAL_SIZE nodes) il.append(methodGen.loadDOM()); int index = cpg.addInterfaceMethodref(DOM_INTF, "getResultTreeFrag", "(IZ)" + DOM_INTF_SIG); il.append(new PUSH(cpg, RTF_INITIAL_SIZE)); il.append(new PUSH(cpg, false)); il.append(new INVOKEINTERFACE(index,3)); il.append(DUP); // Store new DOM into a local variable newDom = methodGen.addLocalVariable("rt_to_reference_dom", Util.getJCRefType(DOM_INTF_SIG), null, null); il.append(new CHECKCAST(cpg.addClass(DOM_INTF_SIG))); newDom.setStart(il.append(new ASTORE(newDom.getIndex()))); // Overwrite old handler with DOM handler index = cpg.addInterfaceMethodref(DOM_INTF, "getOutputDomBuilder", "()" + TRANSLET_OUTPUT_SIG); il.append(new INVOKEINTERFACE(index,1)); //index = cpg.addMethodref(DOM_IMPL, // "getOutputDomBuilder", // "()" + TRANSLET_OUTPUT_SIG); //il.append(new INVOKEVIRTUAL(index)); il.append(DUP); il.append(DUP); // Store DOM handler in a local in order to call endDocument() domBuilder = methodGen.addLocalVariable("rt_to_reference_handler", Util.getJCRefType(TRANSLET_OUTPUT_SIG), null, null); domBuilder.setStart(il.append(new ASTORE(domBuilder.getIndex()))); // Call startDocument on the new handler index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "startDocument", "()V"); il.append(new INVOKEINTERFACE(index, 1)); // Call the method that implements this result tree index = cpg.addMethodref(className, _methodName, "(" + DOM_INTF_SIG + TRANSLET_OUTPUT_SIG +")V"); il.append(new INVOKEVIRTUAL(index)); // Call endDocument on the DOM handler domBuilder.setEnd(il.append(new ALOAD(domBuilder.getIndex()))); index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "endDocument", "()V"); il.append(new INVOKEINTERFACE(index, 1)); // Push the new DOM on the stack newDom.setEnd(il.append(new ALOAD(newDom.getIndex()))); } } /** * Expects a result tree on the stack and pushes a node-set (iterator). * Note that the produced iterator is an iterator for the DOM that * contains the result tree, and not the DOM that is currently in use. * This conversion here will therefore not directly work with elements * such as and without the DOM * parameter/variable being updates as well. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of NodeSetType (any) * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeSetType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Put an extra copy of the result tree (DOM) on the stack il.append(DUP); // DOM adapters containing a result tree are not initialised with // translet-type to DOM-type mapping. This must be done now for // XPath expressions and patterns to work for the iterator we create. il.append(classGen.loadTranslet()); // get names array il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, NAMES_INDEX, NAMES_INDEX_SIG))); il.append(classGen.loadTranslet()); // get uris array il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, URIS_INDEX, URIS_INDEX_SIG))); il.append(classGen.loadTranslet()); // get types array il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, TYPES_INDEX, TYPES_INDEX_SIG))); il.append(classGen.loadTranslet()); // get namespaces array il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, NAMESPACE_INDEX, NAMESPACE_INDEX_SIG))); // Pass the type mappings to the DOM adapter final int mapping = cpg.addInterfaceMethodref(DOM_INTF, "setupMapping", "(["+STRING_SIG+ "["+STRING_SIG+ "[I" + "["+STRING_SIG+")V"); il.append(new INVOKEINTERFACE(mapping, 5)); il.append(DUP); // Create an iterator for the root node of the DOM adapter final int iter = cpg.addInterfaceMethodref(DOM_INTF, "getIterator", "()"+NODE_ITERATOR_SIG); il.append(new INVOKEINTERFACE(iter, 1)); } /** * Subsume result tree into ObjectType. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ObjectType type) { methodGen.getInstructionList().append(NOP); } /** * Translates a result tree into a non-synthesized boolean. * It does not push a 0 or a 1 but instead returns branchhandle list * to be appended to the false list. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param type An instance of BooleanType (any) * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); translateTo(classGen, methodGen, Type.Boolean); return new FlowList(il.append(new IFEQ(null))); } /** * Translates a result tree to a Java type denoted by clazz. * Expects a result tree on the stack and pushes an object * of the appropriate type after coercion. Result trees are translated * to W3C Node or W3C NodeList and the translation is done * via node-set type. * * @param classGen A BCEL class generator * @param methodGen A BCEL method generator * @param clazz An reference to the Class to translate to * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final String className = clazz.getName(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (className.equals("org.w3c.dom.Node")) { translateTo(classGen, methodGen, Type.NodeSet); int index = cpg.addInterfaceMethodref(DOM_INTF, MAKE_NODE, MAKE_NODE_SIG2); il.append(new INVOKEINTERFACE(index, 2)); } else if (className.equals("org.w3c.dom.NodeList")) { translateTo(classGen, methodGen, Type.NodeSet); int index = cpg.addInterfaceMethodref(DOM_INTF, MAKE_NODE_LIST, MAKE_NODE_LIST_SIG2); il.append(new INVOKEINTERFACE(index, 2)); } else if (className.equals("java.lang.Object")) { il.append(NOP); } else if (className.equals("java.lang.String")) { translateTo(classGen, methodGen, Type.String); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), className); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { methodGen.getInstructionList().append(NOP); } /** * Returns the class name of an internal type's external representation. */ public String getClassName() { return(DOM_INTF); } public Instruction LOAD(int slot) { return new ALOAD(slot); } public Instruction STORE(int slot) { return new ASTORE(slot); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/SlotAllocator.java0000644000175000017500000000550110721374031026552 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SlotAllocator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.Type; /** * @author Jacek Ambroziak */ final class SlotAllocator { private int _firstAvailableSlot; private int _size = 8; private int _free = 0; private int[] _slotsTaken = new int[_size]; public void initialize(LocalVariableGen[] vars) { final int length = vars.length; int slot = 0, size, index; for (int i = 0; i < length; i++) { size = vars[i].getType().getSize(); index = vars[i].getIndex(); slot = Math.max(slot, index + size); } _firstAvailableSlot = slot; } public int allocateSlot(Type type) { final int size = type.getSize(); final int limit = _free; int slot = _firstAvailableSlot, where = 0; if (_free + size > _size) { final int[] array = new int[_size *= 2]; for (int j = 0; j < limit; j++) array[j] = _slotsTaken[j]; _slotsTaken = array; } while (where < limit) { if (slot + size <= _slotsTaken[where]) { // insert for (int j = limit - 1; j >= where; j--) _slotsTaken[j + size] = _slotsTaken[j]; break; } else { slot = _slotsTaken[where++] + 1; } } for (int j = 0; j < size; j++) _slotsTaken[where + j] = slot + j; _free += size; return slot; } public void releaseSlot(LocalVariableGen lvg) { final int size = lvg.getType().getSize(); final int slot = lvg.getIndex(); final int limit = _free; for (int i = 0; i < limit; i++) { if (_slotsTaken[i] == slot) { int j = i + size; while (j < limit) { _slotsTaken[i++] = _slotsTaken[j++]; } _free -= size; return; } } String state = "Variable slot allocation error"+ "(size="+size+", slot="+slot+", limit="+limit+")"; ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR, state); throw new Error(err.toString()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_zh.java0000644000175000017500000012511210721374030027252 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_zh.java 338081 2004-12-15 17:35:58Z jycli $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_zh extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "\u540c\u4e00\u6587\u4ef6\u4e2d\u5b9a\u4e49\u4e86\u591a\u4e2a\u6837\u5f0f\u8868\u3002"}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "\u6b64\u6837\u5f0f\u8868\u4e2d\u5df2\u7ecf\u5b9a\u4e49\u4e86\u6a21\u677f\u201c{0}\u201d\u3002"}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "\u6b64\u6837\u5f0f\u8868\u4e2d\u672a\u5b9a\u4e49\u6a21\u677f\u201c{0}\u201d\u3002"}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "\u540c\u4e00\u4f5c\u7528\u57df\u4e2d\u591a\u6b21\u5b9a\u4e49\u4e86\u53d8\u91cf\u201c{0}\u201d\u3002"}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "\u672a\u5b9a\u4e49\u53d8\u91cf\u6216\u53c2\u6570\u201c{0}\u201d\u3002"}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "\u627e\u4e0d\u5230\u7c7b\u201c{0}\u201d\u3002"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "\u627e\u4e0d\u5230\u5916\u90e8\u65b9\u6cd5\u201c{0}\u201d\uff08\u5fc5\u987b\u662f public\uff09\u3002"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "\u65e0\u6cd5\u5c06\u8c03\u7528\u4e2d\u7684\u53c2\u6570\uff0f\u8fd4\u56de\u7c7b\u578b\u8f6c\u6362\u4e3a\u65b9\u6cd5\u201c{0}\u201d"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "\u627e\u4e0d\u5230\u6587\u4ef6\u6216 URI\u201c{0}\u201d\u3002"}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI\u201c{0}\u201d\u65e0\u6548\u3002"}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "\u65e0\u6cd5\u6253\u5f00\u6587\u4ef6\u6216 URI\u201c{0}\u201d\u3002"}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "\u9884\u671f\u5b58\u5728 \u6216 \u5143\u7d20\u3002"}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "\u672a\u58f0\u660e\u540d\u79f0\u7a7a\u95f4\u524d\u7f00\u201c{0}\u201d\u3002"}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "\u65e0\u6cd5\u89e3\u6790\u5bf9\u51fd\u6570\u201c{0}\u201d\u7684\u8c03\u7528\u3002"}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "\u201c{0}\u201d\u7684\u81ea\u53d8\u91cf\u5fc5\u987b\u662f\u6587\u5b57\u4e32\u3002"}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "\u89e3\u6790 XPath \u8868\u8fbe\u5f0f\u201c{0}\u201d\u65f6\u51fa\u9519\u3002"}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "\u7f3a\u5c11\u5fc5\u9700\u7684\u5c5e\u6027\u201c{0}\u201d\u3002"}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "XPath \u8868\u8fbe\u5f0f\u4e2d\u7684\u5b57\u7b26\u201c{0}\u201d\u975e\u6cd5\u3002"}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "\u5904\u7406\u6307\u4ee4\u7684\u540d\u79f0\u201c{0}\u201d\u975e\u6cd5\u3002"}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "\u5c5e\u6027\u201c{0}\u201d\u5728\u5143\u7d20\u5916\u3002"}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "\u5c5e\u6027\u201c{0}\u201d\u975e\u6cd5\u3002"}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "\u5faa\u73af import\uff0finclude\u3002\u5df2\u88c5\u5165\u6837\u5f0f\u8868\u201c{0}\u201d\u3002"}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "\u65e0\u6cd5\u5bf9\u7ed3\u679c\u6811\u7247\u6bb5\u6392\u5e8f\uff08 \u5143\u7d20\u88ab\u5ffd\u7565\uff09\u3002\u5fc5\u987b\u5728\u521b\u5efa\u7ed3\u679c\u6811\u65f6\u5bf9\u8282\u70b9\u8fdb\u884c\u6392\u5e8f\u3002"}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "\u5df2\u7ecf\u5b9a\u4e49\u4e86\u5341\u8fdb\u5236\u683c\u5f0f\u7f16\u6392\u201c{0}\u201d\u3002"}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSLTC \u4e0d\u652f\u6301 XSL V{0}\u3002"}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "\u201c{0}\u201d\u4e2d\u7684\u5faa\u73af\u53d8\u91cf\uff0f\u53c2\u6570\u5f15\u7528\u3002"}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "\u4e8c\u8fdb\u5236\u8868\u8fbe\u5f0f\u7684\u8fd0\u7b97\u7b26\u672a\u77e5\u3002"}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "\u51fd\u6570\u8c03\u7528\u7684\u53c2\u6570\u975e\u6cd5\u3002"}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "\u51fd\u6570 document() \u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\u5fc5\u987b\u662f\u8282\u70b9\u96c6\u3002"}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, " \u4e2d\u81f3\u5c11\u8981\u6709\u4e00\u4e2a \u5143\u7d20\u3002"}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, " \u4e2d\u53ea\u5141\u8bb8\u6709\u4e00\u4e2a \u5143\u7d20\u3002"}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " \u53ea\u80fd\u5728 \u4e2d\u4f7f\u7528\u3002"}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " \u53ea\u80fd\u5728 \u4e2d\u4f7f\u7528\u3002"}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, " \u4e2d\u53ea\u5141\u8bb8\u4f7f\u7528 \u548c \u3002"}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " \u7f3a\u5c11\u201cname\u201d\u5c5e\u6027\u3002"}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "\u5b50\u5143\u7d20\u975e\u6cd5\u3002"}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "\u4e0d\u80fd\u8c03\u7528\u5143\u7d20\u201c{0}\u201d"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "\u4e0d\u80fd\u8c03\u7528\u5c5e\u6027\u201c{0}\u201d"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "\u6587\u672c\u6570\u636e\u5728\u9876\u7ea7 \u5143\u7d20\u5916\u3002"}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP \u89e3\u6790\u5668\u6ca1\u6709\u6b63\u786e\u914d\u7f6e"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "\u4e0d\u53ef\u6062\u590d\u7684 XSLTC \u5185\u90e8\u9519\u8bef\uff1a\u201c{0}\u201d"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "\u4e0d\u53d7\u652f\u6301\u7684 XSL \u5143\u7d20\u201c{0}\u201d\u3002"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "\u672a\u88ab\u8bc6\u522b\u7684 XSLTC \u6269\u5c55\u540d\u201c{0}\u201d\u3002"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "\u8f93\u5165\u6587\u6863\u4e0d\u662f\u6837\u5f0f\u8868\uff08XSL \u540d\u79f0\u7a7a\u95f4\u6ca1\u6709\u5728\u6839\u5143\u7d20\u4e2d\u58f0\u660e\uff09\u3002"}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "\u627e\u4e0d\u5230\u6837\u5f0f\u8868\u76ee\u6807\u201c{0}\u201d\u3002"}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "\u6ca1\u6709\u5b9e\u73b0\uff1a\u201c{0}\u201d\u3002"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "\u8f93\u5165\u6587\u6863\u4e0d\u5305\u542b XSL \u6837\u5f0f\u8868\u3002"}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "\u65e0\u6cd5\u89e3\u6790\u5143\u7d20\u201c{0}\u201d"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, " \u7684 use \u5c5e\u6027\u5fc5\u987b\u662f node\u3001node-set\u3001string \u6216 number\u3002"}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "\u8f93\u51fa XML \u6587\u6863\u7684\u7248\u672c\u5e94\u5f53\u662f 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "\u5173\u7cfb\u8868\u8fbe\u5f0f\u7684\u8fd0\u7b97\u7b26\u672a\u77e5"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "\u8bd5\u56fe\u4f7f\u7528\u4e0d\u5b58\u5728\u7684\u5c5e\u6027\u96c6\u201c{0}\u201d\u3002"}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "\u65e0\u6cd5\u89e3\u6790\u5c5e\u6027\u503c\u6a21\u677f\u201c{0}\u201d\u3002"}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "\u7c7b\u201c{0}\u201d\u7684\u7279\u5f81\u7b26\u4e2d\u7684\u6570\u636e\u7c7b\u578b\u672a\u77e5\u3002"}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "\u65e0\u6cd5\u5c06\u6570\u636e\u7c7b\u578b\u201c{0}\u201d\u8f6c\u6362\u6210\u201c{1}\u201d\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "\u6b64 Templates \u4e0d\u5305\u542b\u6709\u6548\u7684 translet \u7c7b\u5b9a\u4e49\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "\u6b64 Templates \u4e0d\u5305\u542b\u540d\u4e3a\u201c{0}\u201d\u7684\u7c7b\u3002"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "\u65e0\u6cd5\u88c5\u5165 translet \u7c7b\u201c{0}\u201d\u3002"}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Translet \u7c7b\u5df2\u88c5\u5165\uff0c\u4f46\u65e0\u6cd5\u521b\u5efa translet \u5b9e\u4f8b\u3002"}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "\u8bd5\u56fe\u5c06\u201c{0}\u201d\u7684 ErrorListener \u8bbe\u7f6e\u4e3a\u7a7a"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC \u53ea\u652f\u6301 StreamSource\u3001SAXSource \u548c DOMSource"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "\u4f20\u9012\u7ed9\u201c{0}\u201d\u7684\u6e90\u5bf9\u8c61\u6ca1\u6709\u5185\u5bb9\u3002"}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "\u65e0\u6cd5\u7f16\u8bd1\u6837\u5f0f\u8868"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory \u65e0\u6cd5\u8bc6\u522b\u5c5e\u6027\u201c{0}\u201d\u3002"}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() \u5fc5\u987b\u5728 startDocument() \u4e4b\u524d\u8c03\u7528\u3002"}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer \u6ca1\u6709\u5c01\u88c5\u7684 translet \u5bf9\u8c61\u3002"}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "\u6ca1\u6709\u4e3a\u8f6c\u6362\u7ed3\u679c\u5b9a\u4e49\u8f93\u51fa\u5904\u7406\u5668\u3002"}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "\u4f20\u9012\u7ed9\u201c{0}\u201d\u7684 Result \u5bf9\u8c61\u65e0\u6548\u3002"}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "\u8bd5\u56fe\u8bbf\u95ee\u65e0\u6548\u7684 Transformer \u5c5e\u6027\u201c{0}\u201d\u3002"}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "\u65e0\u6cd5\u521b\u5efa SAX2DOM \u9002\u914d\u5668\uff1a\u201c{0}\u201d\u3002"}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "\u6ca1\u6709\u8bbe\u7f6e systemId \u5c31\u8c03\u7528\u4e86 XSLTCSource.build()\u3002"}, { ErrorMsg.ER_RESULT_NULL, "\u7ed3\u679c\u4e0d\u5e94\u4e3a\u7a7a"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "\u53c2\u6570 {0} \u7684\u503c\u5fc5\u987b\u4e3a\u6709\u6548\u7684 Java \u5bf9\u8c61"}, {ErrorMsg.COMPILE_STDIN_ERR, "-i \u9009\u9879\u5fc5\u987b\u4e0e -o \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o \u5c06\u540d\u79f0 \u6307\u5b9a\u7ed9\u751f\u6210\u7684\n translet\u3002\u7f3a\u7701\u60c5\u51b5\u4e0b\uff0ctranslet \u540d\u79f0\n \u6d3e\u751f\u81ea \u540d\u79f0\u3002\n \u5982\u679c\u7f16\u8bd1\u591a\u4e2a\u6837\u5f0f\u8868\uff0c\u5219\u5ffd\u7565\u6b64\u9009\u9879\u3002\n-d \u6307\u5b9a translet \u7684\u76ee\u6807\u76ee\u5f55\n -j \u5c06 translet \u7c7b\u6253\u5305\u6210\u547d\u540d\u4e3a \n \u7684 jar \u6587\u4ef6\n -p \u4e3a\u6240\u6709\u751f\u6210\u7684 translet \u7c7b\n \u6307\u5b9a\u8f6f\u4ef6\u5305\u540d\u79f0\u7684\u524d\u7f00\u3002\n -n \u542f\u7528\u6a21\u677f\u5728\u7ebf\uff08\u5e73\u5747\u7f3a\u7701\n \u884c\u4e3a\u66f4\u4f73\uff09\u3002\n -x \u6253\u5f00\u989d\u5916\u8c03\u8bd5\u6d88\u606f\u8f93\u51fa\n -u \u5c06 \u81ea\u53d8\u91cf\u89e3\u91ca\u4e3a URL\n -i \u5f3a\u5236\u7f16\u8bd1\u5668\u4ece stdin \u8bfb\u5165\u6837\u5f0f\u8868\n -v \u6253\u5370\u7f16\u8bd1\u5668\u7684\u7248\u672c\n -h \u6253\u5370\u6b64\u7528\u6cd5\u8bed\u53e5\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n \u4f7f\u7528 translet \u6765\u8f6c\u6362\u6307\u5b9a\u4e3a \n \u7684 XML \u6587\u6863\u3002translet \u8981\u4e48\u5728\n \u7528\u6237\u7684 CLASSPATH \u4e2d\uff0c\u8981\u4e48\u5728\u4efb\u610f\u6307\u5b9a\u7684 \u4e2d\u3002\nOPTIONS\n -j \u6307\u5b9a\u88c5\u5165 translet \u7684 jarfile\n -x \u6253\u5f00\u989d\u5916\u8c03\u8bd5\u6d88\u606f\u8f93\u51fa\n -n \u8fd0\u884c\u8f6c\u6362\u8fc7\u7a0b \u6570\u6b21\u5e76\n \u663e\u793a\u6982\u8981\u5206\u6790\u4fe1\u606f\n -u \u5c06 XML \u8f93\u5165\u6307\u5b9a\u4e3a URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " \u53ea\u80fd\u5728 \u6216 \u4e2d\u4f7f\u7528\u3002"}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "\u6b64 JVM \u4e2d\u4e0d\u652f\u6301\u8f93\u51fa\u7f16\u7801\u201c{0}\u201d\u3002"}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "\u201c{0}\u201d\u4e2d\u51fa\u73b0\u8bed\u6cd5\u9519\u8bef\u3002"}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "\u627e\u4e0d\u5230\u5916\u90e8\u6784\u9020\u51fd\u6570\u201c{0}\u201d\u3002"}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "\u975e static Java \u51fd\u6570\u201c{0}\u201d\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e0d\u662f\u6709\u6548\u7684\u5bf9\u8c61\u5f15\u7528\u3002"}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "\u68c0\u67e5\u8868\u8fbe\u5f0f\u201c{0}\u201d\u7684\u7c7b\u578b\u65f6\u51fa\u9519\u3002"}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "\u68c0\u67e5\u672a\u77e5\u4f4d\u7f6e\u7684\u8868\u8fbe\u5f0f\u7c7b\u578b\u65f6\u51fa\u9519\u3002"}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "\u547d\u4ee4\u884c\u9009\u9879\u201c{0}\u201d\u65e0\u6548\u3002"}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "\u547d\u4ee4\u884c\u9009\u9879\u201c{0}\u201d\u7f3a\u5c11\u5fc5\u9700\u7684\u81ea\u53d8\u91cf\u3002"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "\u8b66\u544a\uff1a\u201c{0}\u201d\n \uff1a{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "\u8b66\u544a\uff1a\u201c{0}\u201d"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "\u81f4\u547d\u9519\u8bef\uff1a\u201c{0}\u201d\n \uff1a{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "\u81f4\u547d\u9519\u8bef\uff1a\u201c{0}\u201d"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "\u9519\u8bef\uff1a{0}\u201c\n \uff1a{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "\u9519\u8bef\uff1a\u201c{0}\u201d"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "\u4f7f\u7528 translet\u201c{0}\u201d\u8f6c\u6362"}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "\u4f7f\u7528 translet\u201c{0}\u201d\u4ece jar \u6587\u4ef6\u201c{1}\u201d\u8f6c\u6362"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "\u65e0\u6cd5\u521b\u5efa TransformerFactory \u7c7b\u201c{0}\u201d\u7684\u5b9e\u4f8b\u3002"}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "\u7531\u4e8e\u540d\u79f0\u201c{0}\u201d\u5305\u542b Java \u7c7b\u540d\u79f0\u4e2d\u4e0d\u5141\u8bb8\u4f7f\u7528\u7684\u5b57\u7b26\uff0c\u56e0\u6b64\u4e0d\u80fd\u5c06\u5b83\u7528\u4f5c translet \u7c7b\u7684\u540d\u79f0\u3002\u4f7f\u7528\u540d\u79f0\u201c{1}\u201d\u6765\u4ee3\u66ff\u3002"}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "\u7f16\u8bd1\u5668\u9519\u8bef\uff1a"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "\u7f16\u8bd1\u5668\u8b66\u544a\uff1a"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Translet \u9519\u8bef\uff1a"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "\u503c\u5fc5\u987b\u4e3a QName \u6216\u4e3a\u7528\u7a7a\u683c\u5206\u5f00\u7684 QName \u5217\u8868\u7684\u5c5e\u6027\u5177\u6709\u503c\u201c{0}\u201d"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "\u503c\u5fc5\u987b\u4e3a NCName \u7684\u5c5e\u6027\u5177\u6709\u503c\u201c{0}\u201d"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, " \u5143\u7d20\u7684 method \u5c5e\u6027\u5177\u6709\u503c\u201c{0}\u201d\u3002\u6b64\u503c\u5fc5\u987b\u4e3a\u201cxml\u201d\u3001\u201chtml\u201d\u3001\u201ctext\u201d \u6216 qname-but-not-ncname \u4e2d\u7684\u4e00\u4e2a"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "\u5728 TransformerFactory.getFeature(String name) \u4e2d\u7279\u5f81\u540d\u4e0d\u80fd\u4e3a\u7a7a\u3002"}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "\u5728 TransformerFactory.setFeature(String name, boolean value) \u4e2d\u7279\u5f81\u540d\u4e0d\u80fd\u4e3a\u7a7a\u3002"}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "\u65e0\u6cd5\u5bf9\u6b64 TransformerFactory \u8bbe\u7f6e\u7279\u5f81\u201c{0}\u201d\u3002"} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_no.java0000644000175000017500000002266610721374031027260 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_no.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; /** * @author Morten Jorgensen */ public final class ErrorMessages_no extends ErrorMessages { // Disse feilmeldingene maa korrespondere med konstantene som er definert // i kildekoden til {ErrorMsg. /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "En fil kan bare innehold ett stilark."}, {ErrorMsg.TEMPLATE_REDEF_ERR, " ''{0}'' er allerede definert i dette stilarket."}, {ErrorMsg.TEMPLATE_UNDEF_ERR, " ''{0}'' er ikke definert i dette stilarket."}, {ErrorMsg.VARIABLE_REDEF_ERR, "Variabel ''{0}'' er allerede definert."}, {ErrorMsg.VARIABLE_UNDEF_ERR, "Variabel eller parameter ''{0}'' er ikke definert."}, {ErrorMsg.CLASS_NOT_FOUND_ERR, "Finner ikke klassen ''{0}''."}, {ErrorMsg.METHOD_NOT_FOUND_ERR, "Finner ikke ekstern funksjon ''{0}'' (m\u00e5 v\00e6re deklarert b\u00e5de 'static' og 'public')."}, {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Kan ikke konvertere argument/retur type i kall til funksjon ''{0}''"}, {ErrorMsg.FILE_NOT_FOUND_ERR, "Finner ikke fil eller URI ''{0}''."}, {ErrorMsg.INVALID_URI_ERR, "Ugyldig URI ''{0}''."}, {ErrorMsg.FILE_ACCESS_ERR, "Kan ikke \u00e5pne fil eller URI ''{0}''."}, {ErrorMsg.MISSING_ROOT_ERR, "Forvented eller element."}, {ErrorMsg.NAMESPACE_UNDEF_ERR, "Prefiks ''{0}'' er ikke deklarert."}, {ErrorMsg.FUNCTION_RESOLVE_ERR, "Kunne ikke resolvere kall til funksjon ''{0}''."}, {ErrorMsg.NEED_LITERAL_ERR, "Argument til ''{0}'' m\u00e5 v\00e6re ordrett tekst."}, {ErrorMsg.XPATH_PARSER_ERR, "Kunne ikke tolke XPath uttrykk ''{0}''."}, {ErrorMsg.REQUIRED_ATTR_ERR, "N\u00f8dvendig attributt ''{0}'' er ikke deklarert."}, {ErrorMsg.ILLEGAL_CHAR_ERR, "Ugyldig bokstav/tegn ''{0}'' i XPath uttrykk."}, {ErrorMsg.ILLEGAL_PI_ERR, "Ugyldig navn ''{0}'' for prosesserings-instruksjon."}, {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Attributt ''{0}'' utenfor element."}, {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Ugyldig attributt ''{0}''."}, {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Sirkul \00e6 import/include; stilark ''{0}'' er alt lest."}, {ErrorMsg.RESULT_TREE_SORT_ERR, "Result-tre fragmenter kan ikke sorteres ( elementer vil "+ "bli ignorert). Du m\u00e5 sortere nodene mens du bygger treet."}, {ErrorMsg.SYMBOLS_REDEF_ERR, "Formatterings-symboler ''{0}'' er alt definert."}, {ErrorMsg.XSL_VERSION_ERR, "XSL versjon ''{0}'' er ikke st\u00f8ttet av XSLTC."}, {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Sirkul\00e6r variabel/parameter referanse i ''{0}''."}, {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Ugyldig operator for bin\00e6rt uttrykk."}, {ErrorMsg.ILLEGAL_ARG_ERR, "Ugyldig parameter i funksjons-kall."}, {ErrorMsg.DOCUMENT_ARG_ERR, "Andre argument til document() m\u00e5 v\00e6re et node-sett."}, {ErrorMsg.MISSING_WHEN_ERR, "Du m\u00e5 deklarere minst ett element innenfor ."}, {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Kun ett element kan deklareres innenfor ."}, {ErrorMsg.STRAY_OTHERWISE_ERR, " kan kun benyttes innenfor ."}, {ErrorMsg.STRAY_WHEN_ERR, " kan kun benyttes innenfor ."}, {ErrorMsg.WHEN_ELEMENT_ERR, "Kun og kan benyttes innenfor ."}, {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " element manger 'name' attributt."}, {ErrorMsg.ILLEGAL_CHILD_ERR, "Ugyldig element."}, {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "''{0}'' er ikke et gyldig navn for et element."}, {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "''{0}'' er ikke et gyldig navn for et attributt."}, {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Du kan ikke plassere tekst utenfor et element."}, {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP parser er ikke korrekt konfigurert."}, {ErrorMsg.INTERNAL_ERR, "XSLTC-intern feil: ''{0}''"}, {ErrorMsg.UNSUPPORTED_XSL_ERR, "St\u00f8tter ikke XSL element ''{0}''."}, {ErrorMsg.UNSUPPORTED_EXT_ERR, "XSLTC st\u00f8tter ikke utvidet funksjon ''{0}''."}, {ErrorMsg.MISSING_XSLT_URI_ERR, "Dette dokumentet er ikke et XSL stilark "+ "(xmlns:xsl='http://www.w3.org/1999/XSL/Transform' er ikke deklarert)."}, {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Kan ikke finne stilark ved navn ''{0}'' i dette dokumentet."}, {ErrorMsg.NOT_IMPLEMENTED_ERR, "Ikke implementert/gjenkjent: ''{0}''."}, {ErrorMsg.NOT_STYLESHEET_ERR, "Dokumentet inneholder ikke et XSL stilark"}, {ErrorMsg.ELEMENT_PARSE_ERR, "Kan ikke tolke element ''{0}''"}, {ErrorMsg.KEY_USE_ATTR_ERR, "'use'-attributtet i m\u00e5 v\00e6re node, node-sett, tekst eller nummer."}, {ErrorMsg.OUTPUT_VERSION_ERR, "Det genererte XML dokumentet m\u00e5 gis versjon 1.0"}, {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Ugyldig operator for relasjons-uttrykk."}, {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Finner ikke element med navn ''{0}''."}, {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Kan ikke tolke attributt ''{0}''."}, {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Ukjent data-type i signatur for klassen ''{0}''."}, {ErrorMsg.DATA_CONVERSION_ERR, "Kan ikke oversette mellom data-type ''{0}'' og ''{1}''."}, {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Dette Templates objected inneholder ingen translet klasse definisjon."}, {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Dette Templates objected inneholder ingen klasse ved navn ''{0}''."}, {ErrorMsg.TRANSLET_CLASS_ERR, "Kan ikke laste translet-klasse ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Translet klassen er lastet man kan instansieres."}, {ErrorMsg.ERROR_LISTENER_NULL_ERR, "ErrorListener for ''{0}'' fors\u00f8kt satt til 'null'."}, {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Kun StreamSource, SAXSource og DOMSOurce er st\u00f8ttet av XSLTC"}, {ErrorMsg.JAXP_NO_SOURCE_ERR, "Source objekt sendt til ''{0}'' har intet innhold."}, {ErrorMsg.JAXP_COMPILE_ERR, "Kan ikke kompilere stilark."}, {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory gjenkjenner ikke attributtet ''{0}''."}, {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() m\u00e5 kalles f\u00f8r startDocument()."}, {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer objektet inneholder ikken noen translet instans."}, {ErrorMsg.JAXP_NO_HANDLER_ERR, "Ingen 'handler' er satt for \u00e5 ta imot generert dokument."}, {ErrorMsg.JAXP_NO_RESULT_ERR, "Result objektet sendt til ''{0}'' er ikke gyldig."}, {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Fors\u00f8ker \u00e5 lese ugyldig attributt ''{0}'' fra Transformer."}, {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Kan ikke instansiere SAX2DOM adapter: ''{0}''."}, {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() kalt uten at 'systemId' er definert."}, {ErrorMsg.COMPILE_STDIN_ERR, "Du kan ikke bruke -i uten \u00e5 ogs\u00e5 angi klasse-navn med -o."}, {ErrorMsg.COMPILE_USAGE_STR, "Bruk:\n" + " xsltc [-o ] [-d ] [-j ]\n"+ " [-p ] [-x] [-s] [-u] |-i\n\n"+ " Der: er navnet du vil gi den kompilerte java klassen.\n"+ " er ett eller flere XSL stilark, eller dersom -u\n"+ " er benyttet, en eller flere URL'er til stilark.\n"+ " katalog der klasse filer vil plasseres.\n"+ " er en JAR-fil der klassene vil plasseres\n"+ " er an Java 'package' klassene vil legges i.\n\n"+ " Annet:\n"+ " -i tvinger kompilatoren til \u00e5 lese fra stdin.\n"+ " -o ignoreres dersom flere enn ett silark kompileres.\n"+ " -x sl\u00e5r p\u00e5 debug meldinger.\n"+ " -s blokkerer alle kall til System.exit()."}, {ErrorMsg.TRANSFORM_USAGE_STR, "Bruk: \n" + " xslt [-j ] {-u | } \n"+ " [= ...]\n\n" + " Der: er XML dokumentet som skal behandles.\n" + " er en URL til XML dokumentet som skal behandles.\n" + " er Java klassen som skal benyttes.\n" + " er en JAR-fil som klassen leses fra.\n"+ " Annet:\n"+ " -x sl\u00e5r p\u00e5 debug meldinger.\n"+ " -s blokkerer alle kall til System.exit()."}, {ErrorMsg.STRAY_SORT_ERR, " kan bare brukes under eller ."}, {ErrorMsg.UNSUPPORTED_ENCODING, "Karaktersett ''{0}'' er ikke st\u00f8ttet av denne JVM."}, {ErrorMsg.SYNTAX_ERR, "Syntax error in ''{0}''."} // TODO: How do you say "syntax error" in norwegian? }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_cs.java0000644000175000017500000012350610721374031027244 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_cs.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_cs extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "V\u00edce ne\u017e jedna p\u0159edloha stylu je definov\u00e1na ve stejn\u00e9m souboru."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "\u0160ablona ''{0}'' je ji\u017e v t\u00e9to p\u0159edloze stylu definov\u00e1na. "}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "\u0160ablona ''{0}'' nen\u00ed v t\u00e9to p\u0159edloze stylu definov\u00e1na."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "Prom\u011bnn\u00e1 ''{0}'' je n\u011bkolikan\u00e1sobn\u011b definov\u00e1na ve stejn\u00e9m oboru."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Prom\u011bnn\u00e1 nebo parametr ''{0}'' nejsou definov\u00e1ny."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Nelze naj\u00edt t\u0159\u00eddu ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Nelze naj\u00edt extern\u00ed metodu ''{0}'' (mus\u00ed b\u00fdt ve\u0159ejn\u00e1)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Nelze p\u0159ev\u00e9st argument/n\u00e1vratov\u00fd typ ve vol\u00e1n\u00ed metody ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Soubor nebo identifik\u00e1tor URI ''{0}'' nebyl nalezen."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "Neplatn\u00fd identifik\u00e1tor URI ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Nelze otev\u0159\u00edt soubor nebo identifik\u00e1tor URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Byl o\u010dek\u00e1v\u00e1n prvek nebo ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "P\u0159edpona oboru n\u00e1zv\u016f ''{0}'' nen\u00ed deklarov\u00e1na."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Nelze vy\u0159e\u0161it vol\u00e1n\u00ed funkce ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "Argumentem funkce ''{0}'' mus\u00ed b\u00fdt \u0159et\u011bzcov\u00fd liter\u00e1l."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Chyba p\u0159i anal\u00fdze v\u00fdrazu XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Po\u017eadovan\u00fd atribut ''{0}'' chyb\u00ed."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Neplatn\u00fd znak ''{0}'' ve v\u00fdrazu XPath."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Neplatn\u00fd n\u00e1zev ''{0}'' pro instrukci zpracov\u00e1n\u00ed. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Atribut ''{0}'' se nach\u00e1z\u00ed vn\u011b prvku."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Neplatn\u00fd atribut ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Cyklick\u00fd import/zahrnut\u00ed. P\u0159edloha stylu ''{0}'' je ji\u017e zavedena."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Fragmenty stromu v\u00fdsledk\u016f nemohou b\u00fdt \u0159azeny (prvky se ignoruj\u00ed). P\u0159i vytv\u00e1\u0159en\u00ed stromu v\u00fdsledk\u016f mus\u00edte se\u0159adit uzly."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Desetinn\u00e9 form\u00e1tov\u00e1n\u00ed ''{0}'' je ji\u017e definov\u00e1no."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "Verze XSL ''{0}'' nen\u00ed produktem XSLTC podporov\u00e1na."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Cyklick\u00fd odkaz na prom\u011bnnou/parametr ve funkci ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Nezn\u00e1m\u00fd oper\u00e1tor pro bin\u00e1rn\u00ed v\u00fdraz."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Neplatn\u00fd argument pro vol\u00e1n\u00ed funkce."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Druh\u00fd argument pro funkci document() mus\u00ed b\u00fdt node-set."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Alespo\u0148 jeden prvek se vy\u017eaduje v ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Jen jeden prvek je povolen v ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, "Prvek m\u016f\u017ee b\u00fdt pou\u017eit jen v ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, "Prvek m\u016f\u017ee b\u00fdt pou\u017eit jen v ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "Pouze prvky a jsou povoleny v ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "V prvku chyb\u00ed atribut 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Neplatn\u00fd prvek potomka."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Nelze volat prvek ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Nelze volat atribut ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Textov\u00e1 data jsou vn\u011b prvku nejvy\u0161\u0161\u00ed \u00farovn\u011b ."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Analyz\u00e1tor JAXP je nespr\u00e1vn\u011b konfigurov\u00e1n."}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Neopraviteln\u00e1 intern\u00ed chyba XSLTC: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Nepodporovan\u00fd prvek XSL ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Nerozpoznan\u00e1 p\u0159\u00edpona XSLTC ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Vstupn\u00ed dokument nen\u00ed p\u0159edloha stylu (obor n\u00e1zv\u016f XSL nen\u00ed deklarov\u00e1n v ko\u0159enov\u00e9m elementu)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Nelze naj\u00edt c\u00edlovou p\u0159edlohu se stylem ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Neimplementov\u00e1no: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Vstupn\u00ed dokument neobsahuje p\u0159edlohu stylu XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Nelze analyzovat prvek ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "Atribut use prom\u011bnn\u00e9 mus\u00ed b\u00fdt typu node, node-set, string nebo number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "V\u00fdstupn\u00ed verze dokumentu XML by m\u011bla b\u00fdt 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Nezn\u00e1m\u00fd oper\u00e1tor pro rela\u010dn\u00ed v\u00fdraz"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Pokus pou\u017e\u00edt neexistuj\u00edc\u00ed sadu atribut\u016f ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Nelze analyzovat \u0161ablonu hodnoty atributu ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Nezn\u00e1m\u00fd datov\u00fd typ v podpisu pro t\u0159\u00eddu ''{0}''. "}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Nelze p\u0159ev\u00e9st datov\u00fd typ ''{0}'' na ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Tato \u0161ablona neobsahuje platnou definici t\u0159\u00eddy translet."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Tato \u0161ablona neobsahuje t\u0159\u00eddu s n\u00e1zvem ''{0}''. "}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Nelze zav\u00e9st t\u0159\u00eddu translet ''{0}''. "}, {ErrorMsg.TRANSLET_OBJECT_ERR, "T\u0159\u00edda translet byla zavedena, av\u0161ak nelze vytvo\u0159it instanci translet."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Pokus nastavit objekt ErrorListener pro t\u0159\u00eddu ''{0}'' na hodnotu Null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "Pouze prom\u011bnn\u00e9 StreamSource, SAXSource a DOMSource jsou podporov\u00e1ny produktem XSLTC"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "Zdrojov\u00fd objekt p\u0159edan\u00fd metod\u011b ''{0}'' nem\u00e1 \u017e\u00e1dn\u00fd obsah."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Nelze kompilovat p\u0159edlohu se stylem"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "T\u0159\u00edda TransformerFactory nerozpoznala atribut ''{0}''. "}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "Metoda setResult() mus\u00ed b\u00fdt vol\u00e1na p\u0159ed metodou startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Objekt Transformer nem\u00e1 \u017e\u00e1dn\u00fd zapouzd\u0159en\u00fd objekt translet."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Neexistuje \u017e\u00e1dn\u00fd definovan\u00fd v\u00fdstupn\u00ed obslu\u017en\u00fd program pro v\u00fdsledek transformace."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "V\u00fdsledn\u00fd objekt p\u0159edan\u00fd metod\u011b ''{0}'' je neplatn\u00fd."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Pokus o p\u0159\u00edstup k neplatn\u00e9 vlastnosti objektu Transformer: ''{0}''. "}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Nelze vytvo\u0159it adapt\u00e9r SAX2DOM: ''{0}''. "}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "Byla vol\u00e1na metoda XSLTCSource.build(), ani\u017e by byla nastavena hodnota systemId."}, { ErrorMsg.ER_RESULT_NULL, "V\u00fdsledek by nem\u011bl m\u00edt hodnotu null"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "Hodnota parametru {0} mus\u00ed b\u00fdt platn\u00fdm objektem technologie Java."}, {ErrorMsg.COMPILE_STDIN_ERR, "Volba -i mus\u00ed b\u00fdt pou\u017eita s volbou -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSE\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nVOLBY\n -o p\u0159i\u0159ad\u00ed k vygenerovan\u00e9mu transletu n\u00e1zev . \n Podle v\u00fdchoz\u00edho nastaven\u00ed je jm\u00e9no transletu\n odvozeno z n\u00e1zvu . Tato volba\n se ignoruje, pokud se kompiluj\u00ed n\u00e1sobn\u00e9 p\u0159edlohy styl\u016f.\n -d ur\u010duje v\u00fdchoz\u00ed adres\u00e1\u0159 pro translet\n -j zabal\u00ed t\u0159\u00eddu transletu do souboru jar\n pojmenovan\u00e9ho jako \n -p ur\u010duje p\u0159edponu n\u00e1zvu bal\u00ed\u010dku pro v\u0161echny generovan\u00e9 \n t\u0159\u00eddy transletu.\n -n povoluje zarovn\u00e1n\u00ed \u0161ablony (v\u00fdchoz\u00ed chov\u00e1n\u00ed je v pr\u016fm\u011bru lep\u0161\u00ed)\n -x zapne dal\u0161\u00ed v\u00fdstup zpr\u00e1vy lad\u011bn\u00ed\n -u interpretuje argumenty jako URL \n -i vynut\u00ed \u010dten\u00ed p\u0159edlohy styl\u016f kompil\u00e1torem ze vstupu stdin\n -v tiskne verzi kompil\u00e1toru\n -h tiskne tyto pokyny k pou\u017eit\u00ed\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSE\n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [=...]\n\n Pou\u017e\u00edv\u00e1 translet k transformaci dokumentu XML \n ur\u010den\u00e9ho parametrem . Translet je bu\u010f\n v u\u017eivatelsk\u00e9 cest\u011b CLASSPATH, nebo ve voliteln\u011b ur\u010den\u00e9m souboru .\nVOLBY\n -j ur\u010duje soubor jar, z n\u011bj\u017e m\u00e1 b\u00fdt translet na\u010dten\n -x zap\u00edn\u00e1 v\u00fdstup dal\u0161\u00edch ladic\u00edch zpr\u00e1v\n -n spou\u0161t\u00ed transformaci opakovan\u011b, parametr ur\u010duje po\u010det opakov\u00e1n\u00ed,\n a zobraz\u00ed informace o profilu\n -u ur\u010duje adresu URL vstupn\u00edho dokumentu XML\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, "Prvek m\u016f\u017ee b\u00fdt pou\u017eit jen v nebo ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "V\u00fdstupn\u00ed k\u00f3dov\u00e1n\u00ed ''{0}'' nen\u00ed v tomto prost\u0159ed\u00ed JVM podporov\u00e1no."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Chyba syntaxe ve v\u00fdrazu ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Nelze naj\u00edt extern\u00ed konstruktor ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Prvn\u00ed argument nestatick\u00e9 funkce Java ''{0}'' nen\u00ed platn\u00fdm odkazem na objekt."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Chyba p\u0159i kontrole typu v\u00fdrazu ''{0}''. "}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Chyba p\u0159i kontrole typu v\u00fdrazu na nezn\u00e1m\u00e9m m\u00edst\u011b."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "Volba p\u0159\u00edkazov\u00e9ho \u0159\u00e1dku ''{0}'' nen\u00ed platn\u00e1."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Ve volb\u011b p\u0159\u00edkazov\u00e9ho \u0159\u00e1dku ''{0}'' chyb\u00ed po\u017eadovan\u00fd argument."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "VAROV\u00c1N\u00cd: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "VAROV\u00c1N\u00cd: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "Z\u00c1VA\u017dN\u00c1 CHYBA:''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "Z\u00c1VA\u017dN\u00c1 CHYBA:''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "CHYBA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "CHYBA: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transformace s pou\u017eit\u00edm transletu ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transformace s pou\u017eit\u00edm transletu ''{0}'' ze souboru JAR ''{1}'' "}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Nelze vytvo\u0159it instanci t\u0159\u00eddy TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "Jm\u00e9no ''{0}'' nelze pou\u017e\u00edt jako jm\u00e9no t\u0159\u00eddy translet\u016f, proto\u017ee obsahuje znaky, kter\u00e9 nejsou ve jm\u00e9nu t\u0159\u00eddy jazyka Java povoleny. Pou\u017eito bylo jm\u00e9no ''{1}''."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Chyby kompil\u00e1toru:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Varov\u00e1n\u00ed kompil\u00e1toru:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Chyby transletu:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Atribut, jeho\u017e hodnota mus\u00ed b\u00fdt jm\u00e9no QName nebo seznam jmen QName odd\u011blen\u00fdch mezerami, m\u00e1 hodnotu ''{0}''. "}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Atribut, jeho\u017e hodnota mus\u00ed b\u00fdt jm\u00e9no NCName, m\u00e1 hodnotu ''{0}''. "}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Atribut metody prvku m\u00e1 hodnotu ''{0}''. Hodnotou mus\u00ed b\u00fdt \u0159et\u011bzec ''xml'', ''html'', ''text'' nebo jm\u00e9no QName, kter\u00e9 nen\u00ed jm\u00e9nem NCName."}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "N\u00e1zev funkce pou\u017eit\u00fd ve vol\u00e1n\u00ed TransformerFactory.getFeature(\u0159et\u011bzec n\u00e1zvu) nesm\u00ed m\u00edt hodnotu Null. "}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "N\u00e1zev funkce pou\u017eit\u00fd ve vol\u00e1n\u00ed TransformerFactory.setFeature(\u0159et\u011bzec n\u00e1zvu, booleovsk\u00e1 hodnota) nesm\u00ed m\u00edt hodnotu Null. "}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Nelze nastavit funkci ''{0}'' pro tuto t\u0159\u00eddu TransformerFactory. "} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NodeSetType.java0000644000175000017500000002661210721374031026201 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSetType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class NodeSetType extends Type { protected NodeSetType() {} public String toString() { return "node-set"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return NODE_ITERATOR_SIG; } public org.apache.bcel.generic.Type toJCType() { return new org.apache.bcel.generic.ObjectType(NODE_ITERATOR); } /** * Translates a node-set into an object of internal type * type. The translation to int is undefined * since node-sets are always converted to * reals in arithmetic expressions. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType) type); } else if (type == Type.Real) { translateTo(classGen, methodGen, (RealType) type); } else if (type == Type.Node) { translateTo(classGen, methodGen, (NodeType) type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType) type); } else if (type == Type.Object) { translateTo(classGen, methodGen, (ObjectType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an external Java Class into an internal type. * Expects the Java object on the stack, pushes the internal type */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { InstructionList il = methodGen.getInstructionList(); ConstantPoolGen cpg = classGen.getConstantPool(); if (clazz.getName().equals("org.w3c.dom.NodeList")) { // w3c NodeList is on the stack from the external Java function call. // call BasisFunction to consume NodeList and leave Iterator on // the stack. il.append(classGen.loadTranslet()); // push translet onto stack il.append(methodGen.loadDOM()); // push DOM onto stack final int convert = cpg.addMethodref(BASIS_LIBRARY_CLASS, "nodeList2Iterator", "(" + "Lorg/w3c/dom/NodeList;" + TRANSLET_INTF_SIG + DOM_INTF_SIG + ")" + NODE_ITERATOR_SIG ); il.append(new INVOKESTATIC(convert)); } else if (clazz.getName().equals("org.w3c.dom.Node")) { // w3c Node is on the stack from the external Java function call. // call BasisLibrary.node2Iterator() to consume Node and leave // Iterator on the stack. il.append(classGen.loadTranslet()); // push translet onto stack il.append(methodGen.loadDOM()); // push DOM onto stack final int convert = cpg.addMethodref(BASIS_LIBRARY_CLASS, "node2Iterator", "(" + "Lorg/w3c/dom/Node;" + TRANSLET_INTF_SIG + DOM_INTF_SIG + ")" + NODE_ITERATOR_SIG ); il.append(new INVOKESTATIC(convert)); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates a node-set into a synthesized boolean. * The boolean value of a node-set is "true" if non-empty * and "false" otherwise. Notice that the * function getFirstNode() is called in translateToDesynthesized(). * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); } /** * Translates a node-set into a string. The string value of a node-set is * value of its first element. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final InstructionList il = methodGen.getInstructionList(); getFirstNode(classGen, methodGen); il.append(DUP); final BranchHandle falsec = il.append(new IFLT(null)); Type.Node.translateTo(classGen, methodGen, type); final BranchHandle truec = il.append(new GOTO(null)); falsec.setTarget(il.append(POP)); il.append(new PUSH(classGen.getConstantPool(), "")); truec.setTarget(il.append(NOP)); } /** * Expects a node-set on the stack and pushes a real. * First the node-set is converted to string, and from string to real. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { translateTo(classGen, methodGen, Type.String); Type.String.translateTo(classGen, methodGen, Type.Real); } /** * Expects a node-set on the stack and pushes a node. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeType type) { getFirstNode(classGen, methodGen); } /** * Subsume node-set into ObjectType. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ObjectType type) { methodGen.getInstructionList().append(NOP); } /** * Translates a node-set into a non-synthesized boolean. It does not * push a 0 or a 1 but instead returns branchhandle list to be appended * to the false list. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); getFirstNode(classGen, methodGen); return new FlowList(il.append(new IFLT(null))); } /** * Expects a node-set on the stack and pushes a boxed node-set. * Node sets are already boxed so the translation is just a NOP. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { methodGen.getInstructionList().append(NOP); } /** * Translates a node-set into the Java type denoted by clazz. * Expects a node-set on the stack and pushes an object of the appropriate * type after coercion. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final String className = clazz.getName(); il.append(methodGen.loadDOM()); il.append(SWAP); if (className.equals("org.w3c.dom.Node")) { int index = cpg.addInterfaceMethodref(DOM_INTF, MAKE_NODE, MAKE_NODE_SIG2); il.append(new INVOKEINTERFACE(index, 2)); } else if (className.equals("org.w3c.dom.NodeList") || className.equals("java.lang.Object")) { int index = cpg.addInterfaceMethodref(DOM_INTF, MAKE_NODE_LIST, MAKE_NODE_LIST_SIG2); il.append(new INVOKEINTERFACE(index, 2)); } else if (className.equals("java.lang.String")) { int next = cpg.addInterfaceMethodref(NODE_ITERATOR, "next", "()I"); int index = cpg.addInterfaceMethodref(DOM_INTF, GET_NODE_VALUE, "(I)"+STRING_SIG); // Get next node from the iterator il.append(new INVOKEINTERFACE(next, 1)); // Get the node's string value (from the DOM) il.append(new INVOKEINTERFACE(index, 2)); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), className); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Some type conversions require gettting the first node from the node-set. * This function is defined to avoid code repetition. */ private void getFirstNode(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKEINTERFACE(cpg.addInterfaceMethodref(NODE_ITERATOR, NEXT, NEXT_SIG), 1)); } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { methodGen.getInstructionList().append(NOP); } /** * Returns the class name of an internal type's external representation. */ public String getClassName() { return(NODE_ITERATOR); } public Instruction LOAD(int slot) { return new ALOAD(slot); } public Instruction STORE(int slot) { return new ASTORE(slot); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ObjectType.java0000644000175000017500000001310310721374033026037 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFNULL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; /** * @author Todd Miller * @author Santiago Pericas-Geertsen */ public final class ObjectType extends Type { private String _javaClassName = "java.lang.Object"; private Class _clazz = java.lang.Object.class; /** * Used to represent a Java Class type such is required to support * non-static java functions. * @param javaClassName name of the class such as 'com.foo.Processor' */ protected ObjectType(String javaClassName) { _javaClassName = javaClassName; try { _clazz = ObjectFactory.findProviderClass( javaClassName, ObjectFactory.findClassLoader(), true); } catch (ClassNotFoundException e) { _clazz = null; } } protected ObjectType(Class clazz) { _clazz = clazz; _javaClassName = clazz.getName(); } /** * Must return the same value for all ObjectType instances. This is * needed in CastExpr to ensure the mapping table is used correctly. */ public int hashCode() { return java.lang.Object.class.hashCode(); } public boolean equals(Object obj) { return (obj instanceof ObjectType); } public String getJavaClassName() { return _javaClassName; } public Class getJavaClass() { return _clazz; } public String toString() { return _javaClassName; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { final StringBuffer result = new StringBuffer("L"); result.append(_javaClassName.replace('.', '/')).append(';'); return result.toString(); } public org.apache.bcel.generic.Type toJCType() { return Util.getJCRefType(toSignature()); } /** * Translates a void into an object of internal type type. * This translation is needed when calling external functions * that return void. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects an integer on the stack and pushes its string value by calling * Integer.toString(int i). * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(DUP); final BranchHandle ifNull = il.append(new IFNULL(null)); il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName, "toString", "()" + STRING_SIG))); final BranchHandle gotobh = il.append(new GOTO(null)); ifNull.setTarget(il.append(POP)); il.append(new PUSH(cpg, "")); gotobh.setTarget(il.append(NOP)); } /** * Translates an object of this type to the external (Java) type denoted * by clazz. This method is used to translate parameters * when external functions are called. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { if (clazz.isAssignableFrom(_clazz)) methodGen.getInstructionList().append(NOP); else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getClass().toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an external Java type into an Object type */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { methodGen.getInstructionList().append(NOP); } public Instruction LOAD(int slot) { return new ALOAD(slot); } public Instruction STORE(int slot) { return new ASTORE(slot); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_sk.java0000644000175000017500000012240510721374033027253 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_sk.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_sk extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "Viac ne\u017e jeden \u0161t\u00fdl dokumentu bol definovan\u00fd v rovnakom s\u00fabore."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "V tomto \u0161t\u00fdle dokumentu u\u017e bola \u0161abl\u00f3na ''{0}'' definovan\u00e1."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "\u0160abl\u00f3na ''{0}'' nebola definovan\u00e1 v tomto \u0161t\u00fdle dokumentu."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "Premenn\u00e1 ''{0}'' je viackr\u00e1t definovan\u00e1 v rovnakom rozsahu."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Premenn\u00e1 alebo parameter ''{0}'' nie je definovan\u00fd."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Trieda ''{0}'' sa ned\u00e1 n\u00e1js\u0165."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Ned\u00e1 sa n\u00e1js\u0165 extern\u00e1 met\u00f3da ''{0}'' (mus\u00ed by\u0165 verejn\u00e1)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Argument/typ n\u00e1vratu vo volan\u00ed sa ned\u00e1 skonvertova\u0165 na met\u00f3du ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "S\u00fabor alebo URI ''{0}'' nebol n\u00e1jden\u00fd."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI ''{0}'' je neplatn\u00fd."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "S\u00fabor alebo URI ''{0}'' sa ned\u00e1 otvori\u0165."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "O\u010dak\u00e1va sa element alebo ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Predpona n\u00e1zvov\u00e9ho priestoru ''{0}'' nie je deklarovan\u00e1."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Nie je mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 volanie pre funkciu ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "Argument pre ''{0}'' mus\u00ed by\u0165 liter\u00e1lov\u00fdm re\u0165azcom."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Chyba pri syntaktickej anal\u00fdze XPath v\u00fdrazu ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Ch\u00fdba vy\u017eadovan\u00fd atrib\u00fat ''{0}''."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Vo v\u00fdraze XPath je neplatn\u00fd znak ''{0}''."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Pre in\u0161trukciu spracovania je n\u00e1zov ''{0}'' neplatn\u00fd."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Atrib\u00fat ''{0}'' je mimo prvku."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Atrib\u00fat ''{0}'' je neplatn\u00fd."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Cirkul\u00e1rny import/zahrnutie. \u0160t\u00fdl dokumentu ''{0}'' je u\u017e zaveden\u00fd."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Fragmenty stromu v\u00fdsledkov nemo\u017eno triedi\u0165 (elementy s\u00fa ignorovan\u00e9). Ke\u010f vytv\u00e1rate v\u00fdsledkov\u00fd strom, mus\u00edte triedi\u0165 uzly."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Desiatkov\u00e9 form\u00e1tovanie ''{0}'' je u\u017e definovan\u00e9."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSLTC nepodporuje XSL verziu ''{0}''."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Referencia na cyklick\u00fa premenn\u00fa/parameter v ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Nezn\u00e1my oper\u00e1tor pre bin\u00e1rny v\u00fdraz."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Neplatn\u00fd argument(y) pre volanie funkcie."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Druh\u00fd argument pre funkciu dokumentu() mus\u00ed by\u0165 sada uzlov."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "V sa vy\u017eaduje najmenej jeden element ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "V je povolen\u00fd len jeden element ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " mo\u017eno pou\u017ei\u0165 len v ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " mo\u017eno pou\u017ei\u0165 len v ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "V s\u00fa povolen\u00e9 len elementy a ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " ch\u00fdba atrib\u00fat 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Neplatn\u00fd element potomka."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Nem\u00f4\u017eete vola\u0165 prvok ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Nem\u00f4\u017eete vola\u0165 atrib\u00fat ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Textov\u00e9 \u00fadaje s\u00fa mimo elementu vrchnej \u00farovne ."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Analyz\u00e1tor JAXP nie je spr\u00e1vne nakonfigurovan\u00fd"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Neopravite\u013en\u00e1 intern\u00e1 chyba XSLTC: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "XSL prvok ''{0}'' nie je podporovan\u00fd."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "XSLTC pr\u00edpona ''{0}'' nebola rozpoznan\u00e1."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Vstupn\u00fd dokument nie je \u0161t\u00fdlom dokumentu (n\u00e1zvov\u00fd priestor XSL nie je deklarovan\u00fd v kore\u0148ovom elemente)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 cie\u013e \u0161t\u00fdlu dokumentu ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Nie je implementovan\u00e9: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Vstupn\u00fd dokument neobsahuje \u0161t\u00fdl dokumentu XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Nebolo mo\u017en\u00e9 analyzova\u0165 prvok ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "Atrib\u00fat pou\u017eitia mus\u00ed by\u0165 uzol, sada uzlov, re\u0165azec alebo \u010d\u00edslo."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "Verzia v\u00fdstupn\u00e9ho dokumentu XML by mala by\u0165 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Nezn\u00e1my oper\u00e1tor pre rela\u010dn\u00fd v\u00fdraz"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Prebieha pokus o pou\u017eitie neexistuj\u00facej sady atrib\u00fatov ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Ned\u00e1 sa analyzova\u0165 \u0161abl\u00f3na hodn\u00f4t atrib\u00fatu ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "V podpise pre triedu ''{0}'' je nezn\u00e1my typ \u00fadajov."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Typ \u00fadajov ''{0}'' sa ned\u00e1 skonvertova\u0165 na ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Tento vzor neobsahuje platn\u00fa defin\u00edciu triedy transletu."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "T\u00e1to \u0161abl\u00f3na neobsahuje triedu s n\u00e1zvom ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Nebolo mo\u017en\u00e9 zavies\u0165 triedu transletov ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Trieda transletu zaveden\u00e1, ale nie je mo\u017en\u00e9 vytvori\u0165 in\u0161tanciu transletu."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Prebieha pokus o nastavenie ErrorListener pre ''{0}'' na hodnotu null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC podporuje len StreamSource, SAXSource a DOMSource"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "Zdrojov\u00fd objekt, ktor\u00fd pre\u0161iel do ''{0}'', nem\u00e1 \u017eiadny obsah."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Nebolo mo\u017en\u00e9 skompilova\u0165 \u0161t\u00fdl dokumentu"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory nerozpozn\u00e1va atrib\u00fat ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() sa mus\u00ed vola\u0165 pred startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transform\u00e1tor nem\u00e1 \u017eiadny zapuzdren\u00fd objekt transletu."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Pre v\u00fdsledok transform\u00e1cie nebol definovan\u00fd \u017eiadny v\u00fdstupn\u00fd handler."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "V\u00fdsledn\u00fd objekt, ktor\u00fd pre\u0161iel do ''{0}'', je neplatn\u00fd."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Prebieha pokus o prist\u00fapenie na neplatn\u00fa Transformer vlastnos\u0165 ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Nebolo mo\u017en\u00e9 vytvori\u0165 SAX2DOM adapt\u00e9r: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "XSLTCSource.build() bol zavolan\u00fd bez nastaven\u00e9ho systemId."}, { ErrorMsg.ER_RESULT_NULL, "V\u00fdsledok by nemal by\u0165 nulov\u00fd"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "Hodnotou parametra {0} mus\u00ed by\u0165 platn\u00fd objekt Java"}, {ErrorMsg.COMPILE_STDIN_ERR, "Vo\u013eba -i sa mus\u00ed pou\u017e\u00edva\u0165 s vo\u013ebou -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o prirad\u00ed n\u00e1zov k vygenerovan\u00e9mu\n transletu. \u0160tandardne sa n\u00e1zov objektu translet \n odvodzuje od n\u00e1zvu . T\u00e1to vo\u013eba sa ignoruje pri kompilovan\u00ed viacer\u00fdch \u0161t\u00fdlov dokumentov\n\n. -d uv\u00e1dza cie\u013eov\u00fd adres\u00e1r pre translet\n -j pakuje triedy transletov do s\u00faboru jar n\u00e1zvu \n uveden\u00e9ho ako \n -p uv\u00e1dza predponu n\u00e1zvu bal\u00edku pre v\u0161etky generovan\u00e9 triedy transletu.\n\n -n povo\u013euje zoradenie vzorov v riadku (\u0161tandardn\u00e9 chovanie v priemere lep\u0161ie). \n\n -x zapne \u010fal\u0161\u00ed v\u00fdstup spr\u00e1v z procesu ladenia\n -u argumenty prelo\u017e\u00ed do URL\n -i prin\u00fati kompil\u00e1tor, aby pre\u010d\u00edtal \u0161t\u00fdl dokumentu zo stdin\n -v vytla\u010d\u00ed verziu kompil\u00e1tora\n -h vytla\u010d\u00ed tento n\u00e1vod na pou\u017eitie\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n pou\u017eije translet na transform\u00e1ciu XML dokumentu \n, ktor\u00fd je \u0161pecifikovan\u00fd ako . transletu je bu\u010f v \n u\u017e\u00edvate\u013eovej CLASSPATH alebo vo volite\u013ene uvedenom .\nOPTIONS\n -j \u0161pecifikuje jarfile, z ktor\u00e9ho sa m\u00e1 zavies\u0165 translet\n -x zapne \u010fal\u0161\u00ed v\u00fdstup spr\u00e1v z procesu ladenia\n -n spust\u00ed transform\u00e1ciu \u010dasov a\n zobraz\u00ed profilovacie inform\u00e1cie\n -u \u0161pecifikuje vstupn\u00fd dokument XML ako URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " mo\u017eno pou\u017ei\u0165 len v alebo ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "V\u00fdstupn\u00e9 k\u00f3dovanie ''{0}'' nie je na tomto JVM podporovan\u00e9."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "V ''{0}'' je chyba syntaxe."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Ned\u00e1 sa n\u00e1js\u0165 extern\u00fd kon\u0161trukt\u00e9r ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Prv\u00fd argument pre nestatick\u00fa Java funkciu ''{0}'' nie je odkaz na platn\u00fd objekt."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "''{0}'' je typ v\u00fdrazu na kontrolu ch\u00fdb."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Chyba pri kontrole typu v\u00fdrazu na nezn\u00e1mom mieste."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "Vo\u013eba ''{0}'' pr\u00edkazov\u00e9ho riadku je neplatn\u00e1."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Vo vo\u013ebe ''{0}'' pr\u00edkazov\u00e9ho riadku ch\u00fdba vy\u017eadovan\u00fd argument."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "WARNING: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "WARNING: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "FATAL ERROR: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "FATAL ERROR: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERROR: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERROR: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transform\u00e1cia s pou\u017eit\u00edm transletu ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transform\u00e1cia s pou\u017eit\u00edm transletu ''{0}'' z jar s\u00faboru ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Nebolo mo\u017en\u00e9 vytvori\u0165 in\u0161tanciu TransformerFactory triedy ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "N\u00e1zov ''{0}'' sa nedal pou\u017ei\u0165 ako n\u00e1zov triedy transletov, preto\u017ee obsahuje znaky, ktor\u00e9 nie s\u00fa povolen\u00e9 v n\u00e1zve Java triedy. Namiesto neho bol pou\u017eit\u00fd n\u00e1zov ''{1}''."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Chyby preklada\u010da:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Upozornenia preklada\u010da:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Chyby transletu:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Atrib\u00fat, ktor\u00fd mus\u00ed ma\u0165 hodnotu QName alebo medzerami oddelen\u00fd zoznam hodn\u00f4t QName, mal hodnotu ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Atrib\u00fat, ktor\u00fd mus\u00ed ma\u0165 hodnotu NCName, mal hodnotu ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Atrib\u00fat met\u00f3dy v prvku mal hodnotu ''{0}''. Touto hodnotou mus\u00ed by\u0165 bu\u010f ''xml'', ''html'', ''text'' alebo qname-but-not-ncname."}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "N\u00e1zov vlastnosti nem\u00f4\u017ee by\u0165 null v TransformerFactory.getFeature(N\u00e1zov re\u0165azca)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "N\u00e1zov vlastnosti nem\u00f4\u017ee by\u0165 null v TransformerFactory.setFeature(N\u00e1zov re\u0165azca, boolovsk\u00e1 hodnota)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "V tomto TransformerFactory sa ned\u00e1 nastavi\u0165 vlastnos\u0165 ''{0}''."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/AttributeSetMethodGenerator.java0000644000175000017500000000640010721374031031416 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributeSetMethodGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ClassGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class AttributeSetMethodGenerator extends MethodGenerator { private static final int DOM_INDEX = 1; private static final int ITERATOR_INDEX = 2; private static final int HANDLER_INDEX = 3; private static final org.apache.bcel.generic.Type[] argTypes = new org.apache.bcel.generic.Type[3]; private static final String[] argNames = new String[3]; static { argTypes[0] = Util.getJCRefType(DOM_INTF_SIG); argNames[0] = DOM_PNAME; argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG); argNames[1] = ITERATOR_PNAME; argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); argNames[2] = TRANSLET_OUTPUT_PNAME; } private final Instruction _aloadDom; private final Instruction _astoreDom; private final Instruction _astoreIterator; private final Instruction _aloadIterator; private final Instruction _astoreHandler; private final Instruction _aloadHandler; public AttributeSetMethodGenerator(String methodName, ClassGen classGen) { super(org.apache.bcel.Constants.ACC_PRIVATE, org.apache.bcel.generic.Type.VOID, argTypes, argNames, methodName, classGen.getClassName(), new InstructionList(), classGen.getConstantPool()); _aloadDom = new ALOAD(DOM_INDEX); _astoreDom = new ASTORE(DOM_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); _aloadIterator = new ALOAD(ITERATOR_INDEX); _astoreHandler = new ASTORE(HANDLER_INDEX); _aloadHandler = new ALOAD(HANDLER_INDEX); } public Instruction storeIterator() { return _astoreIterator; } public Instruction loadIterator() { return _aloadIterator; } public int getIteratorIndex() { return ITERATOR_INDEX; } public Instruction storeHandler() { return _astoreHandler; } public Instruction loadHandler() { return _aloadHandler; } public int getLocalIndex(String name) { return INVALID_INDEX; // not available } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_zh_TW.java0000644000175000017500000012507610721374031027676 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_zh_TW.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_zh_TW extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "\u540c\u4e00\u500b\u6a94\u6848\u4e2d\u5b9a\u7fa9\u4e00\u500b\u4ee5\u4e0a\u7684\u6a23\u5f0f\u8868\u3002"}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "\u6b64\u6a23\u5f0f\u8868\u4e2d\u5df2\u7d93\u5b9a\u7fa9\u6709\u7bc4\u672c ''{0}''\u3002"}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "\u6b64\u6a23\u5f0f\u8868\u4e2d\u5c1a\u672a\u5b9a\u7fa9\u7bc4\u672c ''{0}''\u3002"}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "\u76f8\u540c\u7684\u7bc4\u570d\u4e2d\u5b9a\u7fa9\u4e86\u591a\u500b\u8b8a\u6578 ''{0}''\u3002"}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "\u8b8a\u6578\u6216\u53c3\u6578 ''{0}'' \u5c1a\u672a\u5b9a\u7fa9\u3002"}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "\u627e\u4e0d\u5230\u985e\u5225 ''{0}''\u3002"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "\u627e\u4e0d\u5230\u5916\u90e8\u65b9\u6cd5 ''{0}''\uff08\u5fc5\u9808\u662f\u516c\u7528\u7684\uff09\u3002"}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "\u7121\u6cd5\u5c07\u547c\u53eb\u4e2d\u7684\u5f15\u6578/\u50b3\u56de\u985e\u578b\u8f49\u63db\u70ba\u65b9\u6cd5 ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "\u627e\u4e0d\u5230\u6a94\u6848\u6216 URI ''{0}''\u3002"}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "URI ''{0}'' \u7121\u6548\u3002"}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "\u7121\u6cd5\u958b\u555f\u6a94\u6848\u6216 URI ''{0}''\u3002"}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "\u539f\u9810\u671f\u70ba \u6216 \u5143\u7d20\u3002"}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "\u540d\u7a31\u7a7a\u9593\u5b57\u9996 ''{0}'' \u5c1a\u672a\u5ba3\u544a\u3002"}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "\u7121\u6cd5\u89e3\u6790\u5c0d\u51fd\u6578 ''{0}'' \u7684\u547c\u53eb\u3002"}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "''{0}'' \u7684\u5f15\u6578\u5fc5\u9808\u662f\u6587\u5b57\u5b57\u4e32\u3002"}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "\u5256\u6790 XPath \u8868\u793a\u5f0f ''{0}'' \u6642\u767c\u751f\u932f\u8aa4\u3002"}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "\u907a\u6f0f\u5fc5\u8981\u7684\u5c6c\u6027 ''{0}''\u3002"}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "XPath \u8868\u793a\u5f0f\u4e2d\u5305\u542b\u4e0d\u5408\u6cd5\u5b57\u5143 ''{0}''\u3002"}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "\u8655\u7406\u6307\u793a\u7684\u540d\u7a31 ''{0}'' \u4e0d\u5408\u6cd5\u3002"}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "\u5c6c\u6027 ''{0}'' \u8d85\u51fa\u5143\u7d20\u5916\u3002"}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "\u5c6c\u6027 ''{0}'' \u4e0d\u5408\u6cd5\u3002"}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "\u5faa\u74b0\u532f\u5165/\u4f75\u5165\u3002\u6a23\u5f0f\u8868 ''{0}'' \u5df2\u7d93\u8f09\u5165\u3002"}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "\u7d50\u679c\u6a39\u7247\u6bb5\u7121\u6cd5\u6392\u5e8f\uff08 \u5143\u7d20\u88ab\u5ffd\u7565\uff09\u3002\u60a8\u5fc5\u9808\u65bc\u5efa\u7acb\u7d50\u679c\u6a39\u6642\uff0c\u5c07\u7bc0\u9ede\u6392\u5e8f\u3002"}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "\u5df2\u7d93\u5b9a\u7fa9\u6709\u5341\u9032\u4f4d\u683c\u5f0f ''{0}''\u3002"}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSL \u7248\u672c ''{0}'' \u4e0d\u53d7 XSLTC \u652f\u63f4\u3002"}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "''{0}'' \u4e2d\u5305\u542b\u5faa\u74b0\u8b8a\u6578/\u53c3\u6578\u53c3\u7167\u3002"}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "\u4e8c\u9032\u4f4d\u8868\u793a\u5f0f\u7684\u904b\u7b97\u5b50\u4e0d\u660e\u3002"}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "\u51fd\u6578\u547c\u53eb\u7684\u5f15\u6578\u4e0d\u5408\u6cd5\u3002"}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "document() \u51fd\u6578\u7684\u7b2c\u4e8c\u500b\u5f15\u6578\u5fc5\u9808\u662f\u7bc0\u9ede\u96c6\u3002"}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, " \u4e2d\u81f3\u5c11\u8981\u6709\u4e00\u500b \u5143\u7d20\u3002"}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, " \u4e2d\u53ea\u63a5\u53d7\u4e00\u500b \u5143\u7d20\u3002"}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " \u53ea\u80fd\u7528\u5728 \u4e2d\u3002"}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " \u53ea\u80fd\u7528\u5728 \u4e2d\u3002"}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, " \u4e2d\u53ea\u63a5\u53d7 \u548c \u5169\u500b\u5143\u7d20\u3002"}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, " \u907a\u6f0f 'name' \u5c6c\u6027\u3002"}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "\u5b50\u9805\u5143\u7d20\u4e0d\u5408\u6cd5\u3002"}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "\u4e0d\u53ef\u4ee5\u547c\u53eb\u5143\u7d20 ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "\u4e0d\u53ef\u4ee5\u547c\u53eb\u5143\u7d20 ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "\u6587\u5b57\u8cc7\u6599\u8d85\u51fa\u9802\u5c64 \u5143\u7d20\u3002"}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "JAXP \u5256\u6790\u5668\u672a\u6b63\u78ba\u914d\u7f6e"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "\u767c\u751f\u7121\u6cd5\u5fa9\u539f\u7684 XSLTC \u5167\u90e8\u932f\u8aa4\uff1a''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "XSL \u5143\u7d20 ''{0}'' \u4e0d\u53d7\u652f\u63f4\u3002"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "XSLTC \u5ef6\u4f38\u9805\u76ee ''{0}'' \u7121\u6cd5\u8fa8\u8b58\u3002"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "\u8f38\u5165\u6587\u4ef6\u4e0d\u662f\u6a23\u5f0f\u8868\uff08XSL \u540d\u7a31\u7a7a\u9593\u672a\u5728\u6839\u5143\u7d20\u4e2d\u5ba3\u544a\uff09\u3002"}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "\u627e\u4e0d\u5230\u6a23\u5f0f\u8868\u76ee\u6a19 ''{0}''\u3002"}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "\u5c1a\u672a\u5be6\u4f5c\uff1a''{0}''\u3002"}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "\u8f38\u5165\u6587\u4ef6\u672a\u5305\u542b XSL \u6a23\u5f0f\u8868\u3002"}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "\u7121\u6cd5\u5256\u6790\u5143\u7d20 ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, " \u7684 use \u5c6c\u6027\u5fc5\u9808\u662f node\u3001node-set\u3001string \u6216 number\u3002"}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "\u8f38\u51fa XML \u6587\u4ef6\u7248\u672c\u61c9\u8a72\u662f 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "\u95dc\u806f\u5f0f\u8868\u793a\u5f0f\u7684\u904b\u7b97\u5b50\u4e0d\u660e"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "\u5617\u8a66\u4f7f\u7528\u4e0d\u5b58\u5728\u7684\u5c6c\u6027\u96c6 ''{0}''\u3002"}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "\u7121\u6cd5\u5256\u6790\u5c6c\u6027\u503c\u7bc4\u672c ''{0}''\u3002"}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "\u985e\u5225 ''{0}'' \u7684\u7c3d\u7ae0\u8cc7\u6599\u985e\u578b\u4e0d\u660e\u3002"}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "\u7121\u6cd5\u5c07\u8cc7\u6599\u985e\u578b ''{0}'' \u8f49\u63db\u70ba ''{1}''\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "\u6b64 Templates \u672a\u5305\u542b\u6709\u6548\u7684 translet \u985e\u5225\u5b9a\u7fa9\u3002"}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "\u6b64\u7bc4\u672c\u672a\u5305\u542b\u540d\u7a31\u70ba ''{0}'' \u7684\u985e\u5225\u3002"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "\u7121\u6cd5\u8f09\u5165 Translet \u985e\u5225 ''{0}''\u3002"}, {ErrorMsg.TRANSLET_OBJECT_ERR, "\u5df2\u8f09\u5165 Translet \u985e\u5225\uff0c\u4f46\u662f\u7121\u6cd5\u5efa\u7acb translet \u5be6\u4f8b\u3002"}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "\u5617\u8a66\u5c07 ''{0}'' \u7684 ErrorListener \u8a2d\u70ba null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC \u53ea\u652f\u63f4 StreamSource\u3001SAXSource \u8207 DOMSource"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "\u50b3\u905e\u5230 ''{0}'' \u7684 Source \u7269\u4ef6\u6c92\u6709\u5167\u5bb9\u3002"}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "\u7121\u6cd5\u7de8\u8b6f\u6a23\u5f0f\u8868"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory \u7121\u6cd5\u8fa8\u8b58\u5c6c\u6027 ''{0}''\u3002"}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() \u5fc5\u9808\u5728 startDocument() \u4e4b\u524d\u547c\u53eb\u3002"}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer \u6c92\u6709\u7c21\u5316\u7684 translet \u7269\u4ef6\u3002"}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "\u6c92\u6709\u5df2\u5b9a\u7fa9\u7684\u8f38\u51fa\u8655\u7406\u7a0b\u5f0f\u4f9b\u8f49\u63db\u7d50\u679c\u4f7f\u7528\u3002"}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "\u50b3\u905e\u5230 ''{0}'' \u7684 Result \u7269\u4ef6\u7121\u6548\u3002"}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "\u5617\u8a66\u5b58\u53d6\u7121\u6548\u7684 Transformer \u5167\u5bb9 ''{0}''\u3002"}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "\u7121\u6cd5\u5efa\u7acb SAX2DOM \u914d\u63a5\u5361\uff1a''{0}''\u3002"}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "\u547c\u53eb XSLTCSource.build() \u6642\uff0c\u672a\u8a2d\u5b9a systemId \u3002"}, { ErrorMsg.ER_RESULT_NULL, "\u7d50\u679c\u4e0d\u61c9\u70ba\u7a7a\u503c"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "\u53c3\u6578 {0} \u7684\u503c\u5fc5\u9808\u662f\u6709\u6548\u7684 Java \u7269\u4ef6"}, {ErrorMsg.COMPILE_STDIN_ERR, "-i \u9078\u9805\u5fc5\u9808\u548c -o \u9078\u9805\u4e00\u8d77\u4f7f\u7528\u3002"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "\u7528\u6cd5\u6982\u8981\n java org.apache.xalan.xsltc.cmdline.Compile [-o <\u8f38\u51fa>]\n [-d ] [-j ] [-p <\u5957\u4ef6>]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o <\u8f38\u51fa> \u6307\u5b9a\u540d\u7a31 <\u8f38\u51fa> \u7d66\u7522\u751f\u7684\n translet\u3002\u4f9d\u9810\u8a2d\uff0ctranslet \u540d\u7a31\u662f\n \u884d\u751f\u81ea \u540d\u7a31\u3002\u82e5\u7de8\u8b6f\n \u591a\u4efd\u6a23\u5f0f\u8868\u6642\uff0c\u6b64\u9078\u9805\u6703\u88ab\u5ffd\u7565\u3002\n -d \u6307\u5b9a translet \u7684\u76ee\u6a19\u76ee\u9304\n -j \u5c07 translet \u985e\u5225\u5c01\u88dd\u5728 jar \u6a94\u6848\u4e2d\uff0c\u8a72\u6a94\u6848\n \u540d\u7a31\u7531 \u6307\u5b9a\n -p \u6307\u5b9a\u6240\u6709\u7522\u751f\u7684\n translet \u985e\u5225\u4e4b\u5957\u4ef6\u540d\u7a31\u5b57\u9996\u3002\n -n \u555f\u7528\u7bc4\u672c\u5217\u5165\uff08\u5e73\u5747\u800c\u8a00\uff0c\u9810\u8a2d\u884c\u70ba\u8f03\u4f73\uff09\u3002\n \n -x \u958b\u555f\u984d\u5916\u7684\u9664\u932f\u8a0a\u606f\u8f38\u51fa\n -u \u5c07\u5f15\u6578 \u89e3\u8b6f\u70ba URL\n -i \u5f37\u5236\u7de8\u8b6f\u5668\u5f9e stdin \u8b80\u53d6\u6a23\u5f0f\u8868\n -v \u5217\u5370\u7de8\u8b6f\u5668\u7684\u7248\u672c\n -h \u5217\u5370\u6b64\u7528\u6cd5\u9673\u8ff0\u5f0f\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "\u7528\u6cd5\u6982\u8981\n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n <\u758a\u4ee3>] {-u | <\u6587\u4ef6>}\n <\u985e\u5225> [= ...]\n\n \u4f7f\u7528 translet <\u985e\u5225> \u8f49\u63db\u6307\u5b9a\u70ba <\u6587\u4ef6> \u7684 \n XML \u6587\u4ef6\u3002translet \u4f4d\u65bc\n \u4f7f\u7528\u8005\u7684 CLASSPATH \u4e2d\uff0c\u6216\u9078\u64c7\u6027\u6307\u5b9a\u7684 \u4e2d\u3002\nOPTIONS\n -j \u6307\u5b9a\u7528\u4f86\u8f09\u5165 translet \u7684 Jar \u6a94\n -x \u958b\u555f\u984d\u5916\u7684\u9664\u932f\u8a0a\u606f\u8f38\u51fa\n-n <\u758a\u4ee3> \u57f7\u884c\u8f49\u63db <\u758a\u4ee3> \u6b21\u4ee5\u53ca\n \u986f\u793a\u8a2d\u5b9a\u6a94\u8cc7\u8a0a\n -u \u6307\u5b9a XML \u8f38\u5165\u6587\u4ef6\u70ba URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " \u53ea\u80fd\u7528\u5728 \u6216 \u5167\u3002"}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "\u6b64 JVM \u4e0d\u652f\u63f4\u8f38\u51fa\u7de8\u78bc ''{0}''\u3002"}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "''{0}'' \u4e2d\u6709\u8a9e\u6cd5\u932f\u8aa4\u3002"}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "\u627e\u4e0d\u5230\u5916\u90e8\u5efa\u69cb\u5b50 ''{0}''\u3002"}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "\u975e\u975c\u614b Java \u51fd\u6578 ''{0}'' \u7684\u7b2c\u4e00\u500b\u5f15\u6578\u4e0d\u662f\u6709\u6548\u7684\u7269\u4ef6\u53c3\u7167\u3002"}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "\u6aa2\u67e5\u8868\u793a\u5f0f ''{0}'' \u7684\u985e\u578b\u6642\u767c\u751f\u932f\u8aa4\u3002"}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "\u5728\u4e0d\u660e\u4f4d\u7f6e\u6aa2\u67e5\u8868\u793a\u5f0f\u7684\u985e\u578b\u6642\uff0c\u767c\u751f\u932f\u8aa4\u3002"}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "\u6307\u4ee4\u884c\u9078\u9805 ''{0}'' \u7121\u6548\u3002"}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "\u6307\u4ee4\u884c\u9078\u9805 ''{0}'' \u907a\u6f0f\u5fc5\u8981\u7684\u5f15\u6578\u3002"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "\u8b66\u544a\uff1a ''{0}''\n \uff1a{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "\u8b66\u544a\uff1a ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "\u56b4\u91cd\u932f\u8aa4\uff1a ''{0}''\n \uff1a{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "\u56b4\u91cd\u932f\u8aa4\uff1a ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "\u932f\u8aa4\uff1a ''{0}''\n \uff1a{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "\u932f\u8aa4\uff1a''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "\u4f7f\u7528 translet ''{0}'' \u9032\u884c\u8f49\u63db"}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "\u5f9e Jar \u6a94 ''{1}'' \u4f7f\u7528 translet ''{0}'' \u9032\u884c\u8f49\u63db"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "\u7121\u6cd5\u5efa\u7acb TransformerFactory \u985e\u5225 ''{0}'' \u7684\u5be6\u4f8b\u3002"}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "\u7121\u6cd5\u4f7f\u7528\u540d\u7a31 ''{0}'' \u4f5c\u70ba translet \u985e\u5225\u7684\u540d\u7a31\uff0c\u56e0\u70ba\u5b83\u542b\u6709\u5728 Java \u985e\u5225\u7684\u540d\u7a31\u4e2d\u4e0d\u5141\u8a31\u4f7f\u7528\u7684\u5b57\u5143\u3002\u5df2\u6539\u70ba\u4f7f\u7528\u540d\u7a31 ''{1}''\u3002"}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "\u7de8\u8b6f\u5668\u932f\u8aa4\uff1a"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "\u7de8\u8b6f\u5668\u8b66\u544a\uff1a"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "\u7de8\u8b6f\u5668\u932f\u8aa4\uff1a"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "\u4e00\u500b\u503c\u5fc5\u9808\u662f QName \u6216\u662f\u7a7a\u683c\u5206\u9694 QNames \u6e05\u55ae\u7684\u5c6c\u6027\uff0c\u5177\u6709\u503c ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "\u4e00\u500b\u503c\u5fc5\u9808\u662f NCName \u7684\u5c6c\u6027\uff0c\u5177\u6709\u503c ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, " \u5143\u7d20\u7684\u65b9\u6cd5\u5c6c\u6027\u5177\u6709\u503c ''{0}''\u3002\u5176\u503c\u5fc5\u9808\u662f ''xml''\u3001''html''\u3001''text'' \u6216 qname-but-not-ncname \u5176\u4e2d\u4e4b\u3127"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "\u7279\u6027\u540d\u7a31\u5728 TransformerFactory.getFeature(String name) \u4e2d\u4e0d\u53ef\u662f\u7a7a\u503c\u3002"}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "\u7279\u6027\u540d\u7a31\u5728 TransformerFactory.setFeature(String name, boolean value) \u4e2d\u4e0d\u53ef\u662f\u7a7a\u503c\u3002"}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "\u7121\u6cd5\u5728\u9019\u500b TransformerFactory \u8a2d\u5b9a\u7279\u6027 ''{0}''\u3002"} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/TestGenerator.java0000644000175000017500000000675510721374033026574 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TestGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.Type; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class TestGenerator extends MethodGenerator { private static int CONTEXT_NODE_INDEX = 1; private static int CURRENT_NODE_INDEX = 4; private static int ITERATOR_INDEX = 6; private Instruction _aloadDom; private final Instruction _iloadCurrent; private final Instruction _iloadContext; private final Instruction _istoreCurrent; private final Instruction _istoreContext; private final Instruction _astoreIterator; private final Instruction _aloadIterator; public TestGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_NODE_INDEX); _istoreCurrent = new ISTORE(CURRENT_NODE_INDEX); _iloadContext = new ILOAD(CONTEXT_NODE_INDEX); _istoreContext = new ILOAD(CONTEXT_NODE_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); _aloadIterator = new ALOAD(ITERATOR_INDEX); } public int getHandlerIndex() { return INVALID_INDEX; // not available } public int getIteratorIndex() { return ITERATOR_INDEX; // not available } public void setDomIndex(int domIndex) { _aloadDom = new ALOAD(domIndex); } public Instruction loadDOM() { return _aloadDom; } public Instruction loadCurrentNode() { return _iloadCurrent; } /** by default context node is the same as current node. MK437 */ public Instruction loadContextNode() { return _iloadContext; } public Instruction storeContextNode() { return _istoreContext; } public Instruction storeCurrentNode() { return _istoreCurrent; } public Instruction storeIterator() { return _astoreIterator; } public Instruction loadIterator() { return _aloadIterator; } public int getLocalIndex(String name) { if (name.equals("current")) { return CURRENT_NODE_INDEX; } else { return super.getLocalIndex(name); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ReferenceType.java0000644000175000017500000003114510721374032026534 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ReferenceType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.PUSH; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Erwin Bolwidt */ public final class ReferenceType extends Type { protected ReferenceType() {} public String toString() { return "reference"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return "Ljava/lang/Object;"; } public org.apache.bcel.generic.Type toJCType() { return org.apache.bcel.generic.Type.OBJECT; } /** * Translates a reference to an object of internal type type. * The translation to int is undefined since references * are always converted to reals in arithmetic expressions. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else if (type == Type.Real) { translateTo(classGen, methodGen, (RealType) type); } else if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType) type); } else if (type == Type.NodeSet) { translateTo(classGen, methodGen, (NodeSetType) type); } else if (type == Type.Node) { translateTo(classGen, methodGen, (NodeType) type); } else if (type == Type.ResultTree) { translateTo(classGen, methodGen, (ResultTreeType) type); } else if (type == Type.Object) { translateTo(classGen, methodGen, (ObjectType) type); } else if (type == Type.Reference ) { } else { ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR, type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates reference into object of internal type type. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final int current = methodGen.getLocalIndex("current"); ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); // If no current, conversion is a top-level if (current < 0) { il.append(new PUSH(cpg, DTM.ROOT_NODE)); // push root node } else { il.append(new ILOAD(current)); } il.append(methodGen.loadDOM()); final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS, "stringF", "(" + OBJECT_SIG + NODE_SIG + DOM_INTF_SIG + ")" + STRING_SIG); il.append(new INVOKESTATIC(stringF)); } /** * Translates a reference into an object of internal type type. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "numberF", "(" + OBJECT_SIG + DOM_INTF_SIG + ")D"); il.append(new INVOKESTATIC(index)); } /** * Translates a reference to an object of internal type type. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "booleanF", "(" + OBJECT_SIG + ")Z"); il.append(new INVOKESTATIC(index)); } /** * Casts a reference into a NodeIterator. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeSetType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet", "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG); il.append(new INVOKESTATIC(index)); // Reset this iterator index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG); il.append(new INVOKEINTERFACE(index, 1)); } /** * Casts a reference into a Node. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeType type) { translateTo(classGen, methodGen, Type.NodeSet); Type.NodeSet.translateTo(classGen, methodGen, type); } /** * Casts a reference into a ResultTree. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ResultTreeType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToResultTree", "(" + OBJECT_SIG + ")" + DOM_INTF_SIG); il.append(new INVOKESTATIC(index)); } /** * Subsume reference into ObjectType. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ObjectType type) { methodGen.getInstructionList().append(NOP); } /** * Translates a reference into the Java type denoted by clazz. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int referenceToLong = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToLong", "(" + OBJECT_SIG + ")J"); int referenceToDouble = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToDouble", "(" + OBJECT_SIG + ")D"); int referenceToBoolean = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToBoolean", "(" + OBJECT_SIG + ")Z"); if (clazz.getName().equals("java.lang.Object")) { il.append(NOP); } else if (clazz == Double.TYPE) { il.append(new INVOKESTATIC(referenceToDouble)); } else if (clazz.getName().equals("java.lang.Double")) { il.append(new INVOKESTATIC(referenceToDouble)); Type.Real.translateTo(classGen, methodGen, Type.Reference); } else if (clazz == Float.TYPE) { il.append(new INVOKESTATIC(referenceToDouble)); il.append(D2F); } else if (clazz.getName().equals("java.lang.String")) { int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToString", "(" + OBJECT_SIG + DOM_INTF_SIG + ")" + "Ljava/lang/String;"); il.append(methodGen.loadDOM()); il.append(new INVOKESTATIC(index)); } else if (clazz.getName().equals("org.w3c.dom.Node")) { int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNode", "(" + OBJECT_SIG + DOM_INTF_SIG + ")" + "Lorg/w3c/dom/Node;"); il.append(methodGen.loadDOM()); il.append(new INVOKESTATIC(index)); } else if (clazz.getName().equals("org.w3c.dom.NodeList")) { int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeList", "(" + OBJECT_SIG + DOM_INTF_SIG + ")" + "Lorg/w3c/dom/NodeList;"); il.append(methodGen.loadDOM()); il.append(new INVOKESTATIC(index)); } else if (clazz.getName().equals("org.apache.xalan.xsltc.DOM")) { translateTo(classGen, methodGen, Type.ResultTree); } else if (clazz == Long.TYPE) { il.append(new INVOKESTATIC(referenceToLong)); } else if (clazz == Integer.TYPE) { il.append(new INVOKESTATIC(referenceToLong)); il.append(L2I); } else if (clazz == Short.TYPE) { il.append(new INVOKESTATIC(referenceToLong)); il.append(L2I); il.append(I2S); } else if (clazz == Byte.TYPE) { il.append(new INVOKESTATIC(referenceToLong)); il.append(L2I); il.append(I2B); } else if (clazz == Character.TYPE) { il.append(new INVOKESTATIC(referenceToLong)); il.append(L2I); il.append(I2C); } else if (clazz == java.lang.Boolean.TYPE) { il.append(new INVOKESTATIC(referenceToBoolean)); } else if (clazz.getName().equals("java.lang.Boolean")) { il.append(new INVOKESTATIC(referenceToBoolean)); Type.Boolean.translateTo(classGen, methodGen, Type.Reference); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an external Java type into a reference. Only conversion * allowed is from java.lang.Object. */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { if (clazz.getName().equals("java.lang.Object")) { methodGen.getInstructionList().append(NOP); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects a reference on the stack and translates it to a non-synthesized * boolean. It does not push a 0 or a 1 but instead returns branchhandle * list to be appended to the false list. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { InstructionList il = methodGen.getInstructionList(); translateTo(classGen, methodGen, type); return new FlowList(il.append(new IFEQ(null))); } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { } public Instruction LOAD(int slot) { return new ALOAD(slot); } public Instruction STORE(int slot) { return new ASTORE(slot); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NamedMethodGenerator.java0000644000175000017500000000454210721374030030027 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NamedMethodGenerator.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.Type; /** * This class is used for named templates. Named template methods have access * to the DOM, the current iterator, the handler and the current node. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class NamedMethodGenerator extends MethodGenerator { protected static final int CURRENT_INDEX = 4; // The index of the first parameter (after dom/iterator/handler/current) private static final int PARAM_START_INDEX = 5; public NamedMethodGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); } public int getLocalIndex(String name) { if (name.equals("current")) { return CURRENT_INDEX; } return super.getLocalIndex(name); } public Instruction loadParameter(int index) { return new ALOAD(index + PARAM_START_INDEX); } public Instruction storeParameter(int index) { return new ASTORE(index + PARAM_START_INDEX); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/OutlineableChunkEnd.java0000644000175000017500000000443110721374033027656 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.Instruction; /** *

        Marks the end of a region of byte code that can be copied into a new * method. See the {@link OutlineableChunkStart} pseudo-instruction for * details.

        */ class OutlineableChunkEnd extends MarkerInstruction { /** * A constant instance of {@link OutlineableChunkEnd}. As it has no fields, * there should be no need to create an instance of this class. */ public static final Instruction OUTLINEABLECHUNKEND = new OutlineableChunkEnd(); /** * Private default constructor. As it has no fields, * there should be no need to create an instance of this class. See * {@link OutlineableChunkEnd#OUTLINEABLECHUNKEND}. */ private OutlineableChunkEnd() { } /** * Get the name of this instruction. Used for debugging. * @return the instruction name */ public String getName() { return OutlineableChunkEnd.class.getName(); } /** * Get the name of this instruction. Used for debugging. * @return the instruction name */ public String toString() { return getName(); } /** * Get the name of this instruction. Used for debugging. * @return the instruction name */ public String toString(boolean verbose) { return getName(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/InternalError.java0000644000175000017500000000236710721374031026565 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ package org.apache.xalan.xsltc.compiler.util; /** * Marks a class of errors in which XSLTC has reached some incorrect internal * state from which it cannot recover. */ public class InternalError extends Error { /** * Construct an InternalError with the specified error message. * @param msg the error message */ public InternalError(String msg) { super(msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/MethodGenerator.java0000644000175000017500000027523210721374030027070 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MethodGenerator.java 469275 2006-10-30 21:04:47Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.Stack; import org.apache.bcel.Constants; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.DLOAD; import org.apache.bcel.generic.DSTORE; import org.apache.bcel.generic.FLOAD; import org.apache.bcel.generic.FSTORE; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.ICONST; import org.apache.bcel.generic.IfInstruction; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.IndexedInstruction; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionConstants; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.InstructionTargeter; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.LocalVariableInstruction; import org.apache.bcel.generic.LLOAD; import org.apache.bcel.generic.LSTORE; import org.apache.bcel.generic.MethodGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUTFIELD; import org.apache.bcel.generic.RET; import org.apache.bcel.generic.Select; import org.apache.bcel.generic.TargetLostException; import org.apache.bcel.generic.Type; import org.apache.xalan.xsltc.compiler.Pattern; import org.apache.xalan.xsltc.compiler.XSLTC; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public class MethodGenerator extends MethodGen implements org.apache.xalan.xsltc.compiler.Constants { protected static final int INVALID_INDEX = -1; private static final String START_ELEMENT_SIG = "(" + STRING_SIG + ")V"; private static final String END_ELEMENT_SIG = START_ELEMENT_SIG; private InstructionList _mapTypeSub; private static final int DOM_INDEX = 1; private static final int ITERATOR_INDEX = 2; private static final int HANDLER_INDEX = 3; private static final int MAX_METHOD_SIZE = 65535; private static final int MAX_BRANCH_TARGET_OFFSET = 32767; private static final int MIN_BRANCH_TARGET_OFFSET = -32768; private static final int TARGET_METHOD_SIZE = 60000; private static final int MINIMUM_OUTLINEABLE_CHUNK_SIZE = 1000; private Instruction _iloadCurrent; private Instruction _istoreCurrent; private final Instruction _astoreHandler; private final Instruction _aloadHandler; private final Instruction _astoreIterator; private final Instruction _aloadIterator; private final Instruction _aloadDom; private final Instruction _astoreDom; private final Instruction _startElement; private final Instruction _endElement; private final Instruction _startDocument; private final Instruction _endDocument; private final Instruction _attribute; private final Instruction _uniqueAttribute; private final Instruction _namespace; private final Instruction _setStartNode; private final Instruction _reset; private final Instruction _nextNode; private SlotAllocator _slotAllocator; private boolean _allocatorInit = false; private LocalVariableRegistry _localVariableRegistry; /** * A mapping between patterns and instruction lists used by * test sequences to avoid compiling the same pattern multiple * times. Note that patterns whose kernels are "*", "node()" * and "@*" can between shared by test sequences. */ private Hashtable _preCompiled = new Hashtable(); public MethodGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cpg) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cpg); _astoreHandler = new ASTORE(HANDLER_INDEX); _aloadHandler = new ALOAD(HANDLER_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); _aloadIterator = new ALOAD(ITERATOR_INDEX); _aloadDom = new ALOAD(DOM_INDEX); _astoreDom = new ASTORE(DOM_INDEX); final int startElement = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "startElement", START_ELEMENT_SIG); _startElement = new INVOKEINTERFACE(startElement, 2); final int endElement = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "endElement", END_ELEMENT_SIG); _endElement = new INVOKEINTERFACE(endElement, 2); final int attribute = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "addAttribute", "(" + STRING_SIG + STRING_SIG + ")V"); _attribute = new INVOKEINTERFACE(attribute, 3); final int uniqueAttribute = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "addUniqueAttribute", "(" + STRING_SIG + STRING_SIG + "I)V"); _uniqueAttribute = new INVOKEINTERFACE(uniqueAttribute, 4); final int namespace = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "namespaceAfterStartElement", "(" + STRING_SIG + STRING_SIG + ")V"); _namespace = new INVOKEINTERFACE(namespace, 3); int index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "startDocument", "()V"); _startDocument = new INVOKEINTERFACE(index, 1); index = cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "endDocument", "()V"); _endDocument = new INVOKEINTERFACE(index, 1); index = cpg.addInterfaceMethodref(NODE_ITERATOR, SET_START_NODE, SET_START_NODE_SIG); _setStartNode = new INVOKEINTERFACE(index, 2); index = cpg.addInterfaceMethodref(NODE_ITERATOR, "reset", "()"+NODE_ITERATOR_SIG); _reset = new INVOKEINTERFACE(index, 1); index = cpg.addInterfaceMethodref(NODE_ITERATOR, NEXT, NEXT_SIG); _nextNode = new INVOKEINTERFACE(index, 1); _slotAllocator = new SlotAllocator(); _slotAllocator.initialize(getLocalVariableRegistry().getLocals(false)); _allocatorInit = true; } /** * Allocates a local variable. If the slot allocator has already been * initialized, then call addLocalVariable2() so that the new variable * is known to the allocator. Failing to do this may cause the allocator * to return a slot that is already in use. */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { LocalVariableGen lvg; if (_allocatorInit) { lvg = addLocalVariable2(name, type, start); } else { lvg = super.addLocalVariable(name, type, start, end); getLocalVariableRegistry().registerLocalVariable(lvg); } return lvg; } public LocalVariableGen addLocalVariable2(String name, Type type, InstructionHandle start) { LocalVariableGen lvg = super.addLocalVariable(name, type, _slotAllocator.allocateSlot(type), start, null); getLocalVariableRegistry().registerLocalVariable(lvg); return lvg; } private LocalVariableRegistry getLocalVariableRegistry() { if (_localVariableRegistry == null) { _localVariableRegistry = new LocalVariableRegistry(); } return _localVariableRegistry; } /** * Keeps track of all local variables used in the method. *

        The * {@link MethodGen#addLocalVariable(String,Type,InstructionHandle,InstructionHandle)} * and * {@link MethodGen#addLocalVariable(String,Type,int,InstructionHandle,InstructionHandle)} * methods of {@link MethodGen} will only keep track of * {@link LocalVariableGen} object until it'ss removed by a call to * {@link MethodGen#removeLocalVariable(LocalVariableGen)}.

        *

        In order to support efficient copying of local variables to outlined * methods by * {@link #outline(InstructionHandle,InstructionHandle,String,ClassGenerator)}, * this class keeps track of all local variables defined by the method.

        */ protected class LocalVariableRegistry { /** *

        A java.lang.ArrayList of all * {@link LocalVariableGen}s created for this method, indexed by the * slot number of the local variable. The JVM stack frame of local * variables is divided into "slots". A single slot can be used to * store more than one variable in a method, without regard to type, so * long as the byte code keeps the ranges of the two disjoint.

        *

        If only one registration of use of a particular slot occurs, the * corresponding entry of _variables contains the * LocalVariableGen; if more than one occurs, the * corresponding entry contains all such LocalVariableGens * registered for the same slot; and if none occurs, the entry will be * null. */ protected ArrayList _variables = new ArrayList(); /** * Maps a name to a {@link LocalVariableGen} */ protected HashMap _nameToLVGMap = new HashMap(); /** * Registers a {@link org.apache.bcel.generic.LocalVariableGen} * for this method. *

        Preconditions: *

          *
        • The range of instructions for lvg does not * overlap with the range of instructions for any * LocalVariableGen with the same slot index previously * registered for this method. (Unchecked.)
        • *

        * @param lvg The variable to be registered */ protected void registerLocalVariable(LocalVariableGen lvg) { int slot = lvg.getIndex(); int registrySize = _variables.size(); // If the LocalVariableGen uses a slot index beyond any previously // encountered, expand the _variables, padding with intervening null // entries as required. if (slot >= registrySize) { for (int i = registrySize; i < slot; i++) { _variables.add(null); } _variables.add(lvg); } else { // If the LocalVariableGen reuses a slot, make sure the entry // in _variables contains an ArrayList and add the newly // registered LocalVariableGen to the list. If the entry in // _variables just contains null padding, store the // LocalVariableGen directly. Object localsInSlot = _variables.get(slot); if (localsInSlot != null) { if (localsInSlot instanceof LocalVariableGen) { ArrayList listOfLocalsInSlot = new ArrayList(); listOfLocalsInSlot.add(localsInSlot); listOfLocalsInSlot.add(lvg); _variables.set(slot, listOfLocalsInSlot); } else { ((ArrayList) localsInSlot).add(lvg); } } else { _variables.set(slot, lvg); } } registerByName(lvg); } /** *

        Find which {@link LocalVariableGen}, if any, is registered for a * particular JVM local stack frame slot at a particular position in the * byte code for the method.

        *

        Preconditions: *

          *
        • The {@link InstructionList#setPositions()} has been called for * the {@link InstructionList} associated with this * {@link MethodGenerator}.
        • *

        * @param slot the JVM local stack frame slot number * @param offset the position in the byte code * @return the LocalVariableGen for the local variable * stored in the relevant slot at the relevant offset; null * if there is none. */ protected LocalVariableGen lookupRegisteredLocalVariable(int slot, int offset) { Object localsInSlot = (_variables != null) ? _variables.get(slot) : null; // If this slot index was never used, _variables.get will return // null; if it was used once, it will return the LocalVariableGen; // more than once it will return an ArrayList of all the // LocalVariableGens for variables stored in that slot. For each // LocalVariableGen, check whether its range includes the // specified offset, and return the first such encountered. if (localsInSlot != null) { if (localsInSlot instanceof LocalVariableGen) { LocalVariableGen lvg = (LocalVariableGen)localsInSlot; if (offsetInLocalVariableGenRange(lvg, offset)) { return lvg; } } else { ArrayList listOfLocalsInSlot = (ArrayList) localsInSlot; int size = listOfLocalsInSlot.size(); for (int i = 0; i < size; i++) { LocalVariableGen lvg = (LocalVariableGen)listOfLocalsInSlot.get(i); if (offsetInLocalVariableGenRange(lvg, offset)) { return lvg; } } } } // No local variable stored in the specified slot at the specified return null; } /** *

        Set up a mapping of the name of the specified * {@link LocalVariableGen} object to the LocalVariableGen * itself.

        *

        This is a bit of a hack. XSLTC is relying on the fact that the * name that is being looked up won't be duplicated, which isn't * guaranteed. It replaces code which used to call * {@link MethodGen#getLocalVariables()} and looped through the * LocalVariableGen objects it contained to find the one * with the specified name. However, getLocalVariables() * has the side effect of setting the start and end for any * LocalVariableGen which did not already have them * set, which causes problems for outlining..

        *

        See also {@link #lookUpByName(String)} and * {@link #removeByNameTracking(LocalVariableGen)}

        LocalVariableGen */ protected void registerByName(LocalVariableGen lvg) { Object duplicateNameEntry = _nameToLVGMap.get(lvg.getName()); if (duplicateNameEntry == null) { _nameToLVGMap.put(lvg.getName(), lvg); } else { ArrayList sameNameList; if (duplicateNameEntry instanceof ArrayList) { sameNameList = (ArrayList) duplicateNameEntry; sameNameList.add(lvg); } else { sameNameList = new ArrayList(); sameNameList.add(duplicateNameEntry); sameNameList.add(lvg); } _nameToLVGMap.put(lvg.getName(), sameNameList); } } /** * Remove the mapping from the name of the specified * {@link LocalVariableGen} to itself. * See also {@link #registerByName(LocalVariableGen)} and * {@link #lookUpByName(String)} * @param lvg a LocalVariableGen */ protected void removeByNameTracking(LocalVariableGen lvg) { Object duplicateNameEntry = _nameToLVGMap.get(lvg.getName()); if (duplicateNameEntry instanceof ArrayList) { ArrayList sameNameList = (ArrayList) duplicateNameEntry; for (int i = 0; i < sameNameList.size(); i++) { if (sameNameList.get(i) == lvg) { sameNameList.remove(i); break; } } } else { _nameToLVGMap.remove(lvg); } } /** *

        Given the name of a variable, finds a {@link LocalVariableGen} * corresponding to it.

        *

        See also {@link #registerByName(LocalVariableGen)} and * {@link #removeByNameTracking(LocalVariableGen)}

        * @param name * @return */ protected LocalVariableGen lookUpByName(String name) { LocalVariableGen lvg = null; Object duplicateNameEntry = _nameToLVGMap.get(name); if (duplicateNameEntry instanceof ArrayList) { ArrayList sameNameList = (ArrayList) duplicateNameEntry; for (int i = 0; i < sameNameList.size(); i++) { lvg = (LocalVariableGen)sameNameList.get(i); if (lvg.getName() == name) { break; } } } else { lvg = (LocalVariableGen) duplicateNameEntry; } return lvg; } /** *

        Gets all {@link LocalVariableGen} objects for this method.

        *

        When the includeRemoved argument has the value * false, this method replaces uses of * {@link MethodGen#getLocalVariables()} which has * a side-effect of setting the start and end range for any * LocalVariableGen if either was null. That * side-effect causes problems for outlining of code in XSLTC. * @param includeRemoved Specifies whether all local variables ever * declared should be returned (true) or only those not * removed (false) * @return an array of LocalVariableGen containing all the * local variables */ protected LocalVariableGen[] getLocals(boolean includeRemoved) { LocalVariableGen[] locals = null; ArrayList allVarsEverDeclared = new ArrayList(); if (includeRemoved) { int slotCount = allVarsEverDeclared.size(); for (int i = 0; i < slotCount; i++) { Object slotEntries = _variables.get(i); if (slotEntries != null) { if (slotEntries instanceof ArrayList) { ArrayList slotList = (ArrayList) slotEntries; for (int j = 0; j < slotList.size(); j++) { allVarsEverDeclared.add(slotList.get(i)); } } else { allVarsEverDeclared.add(slotEntries); } } } } else { Iterator nameVarsPairsIter = _nameToLVGMap.entrySet().iterator(); while (nameVarsPairsIter.hasNext()) { Map.Entry nameVarsPair = (Map.Entry) nameVarsPairsIter.next(); Object vars = nameVarsPair.getValue(); if (vars != null) { if (vars instanceof ArrayList) { ArrayList varsList = (ArrayList) vars; for (int i = 0; i < varsList.size(); i++) { allVarsEverDeclared.add(varsList.get(i)); } } else { allVarsEverDeclared.add(vars); } } } } locals = new LocalVariableGen[allVarsEverDeclared.size()]; allVarsEverDeclared.toArray(locals); return locals; } } /** * Determines whether a particular variable is in use at a particular offset * in the byte code for this method. *

        Preconditions: *

          *
        • The {@link InstructionList#setPositions()} has been called for the * {@link InstructionList} associated with this {@link MethodGenerator}. *

        * @param lvg the {@link LocalVariableGen} for the variable * @param offset the position in the byte code * @return true if and only if the specified variable is in * use at the particular byte code offset. */ boolean offsetInLocalVariableGenRange(LocalVariableGen lvg, int offset) { InstructionHandle lvgStart = lvg.getStart(); InstructionHandle lvgEnd = lvg.getEnd(); // If no start handle is recorded for the LocalVariableGen, it is // assumed to be in use from the beginning of the method. if (lvgStart == null) { lvgStart = getInstructionList().getStart(); } // If no end handle is recorded for the LocalVariableGen, it is assumed // to be in use to the end of the method. if (lvgEnd == null) { lvgEnd = getInstructionList().getEnd(); } // Does the range of the instruction include the specified offset? // Note that the InstructionHandle.getPosition method returns the // offset of the beginning of an instruction. A LocalVariableGen's // range includes the end instruction itself, so that instruction's // length must be taken into consideration in computing whether the // varible is in range at a particular offset. return ((lvgStart.getPosition() <= offset) && (lvgEnd.getPosition() + lvgEnd.getInstruction().getLength() >= offset)); } public void removeLocalVariable(LocalVariableGen lvg) { _slotAllocator.releaseSlot(lvg); getLocalVariableRegistry().removeByNameTracking(lvg); super.removeLocalVariable(lvg); } public Instruction loadDOM() { return _aloadDom; } public Instruction storeDOM() { return _astoreDom; } public Instruction storeHandler() { return _astoreHandler; } public Instruction loadHandler() { return _aloadHandler; } public Instruction storeIterator() { return _astoreIterator; } public Instruction loadIterator() { return _aloadIterator; } public final Instruction setStartNode() { return _setStartNode; } public final Instruction reset() { return _reset; } public final Instruction nextNode() { return _nextNode; } public final Instruction startElement() { return _startElement; } public final Instruction endElement() { return _endElement; } public final Instruction startDocument() { return _startDocument; } public final Instruction endDocument() { return _endDocument; } public final Instruction attribute() { return _attribute; } public final Instruction uniqueAttribute() { return _uniqueAttribute; } public final Instruction namespace() { return _namespace; } public Instruction loadCurrentNode() { if (_iloadCurrent == null) { int idx = getLocalIndex("current"); if (idx > 0) _iloadCurrent = new ILOAD(idx); else _iloadCurrent = new ICONST(0); } return _iloadCurrent; } public Instruction storeCurrentNode() { return _istoreCurrent != null ? _istoreCurrent : (_istoreCurrent = new ISTORE(getLocalIndex("current"))); } /** by default context node is the same as current node. MK437 */ public Instruction loadContextNode() { return loadCurrentNode(); } public Instruction storeContextNode() { return storeCurrentNode(); } public int getLocalIndex(String name) { return getLocalVariable(name).getIndex(); } public LocalVariableGen getLocalVariable(String name) { return getLocalVariableRegistry().lookUpByName(name); } public void setMaxLocals() { // Get the current number of local variable slots int maxLocals = super.getMaxLocals(); // Get numer of actual variables final LocalVariableGen[] localVars = super.getLocalVariables(); if (localVars != null) { if (localVars.length > maxLocals) maxLocals = localVars.length; } // We want at least 5 local variable slots (for parameters) if (maxLocals < 5) maxLocals = 5; super.setMaxLocals(maxLocals); } /** * Add a pre-compiled pattern to this mode. */ public void addInstructionList(Pattern pattern, InstructionList ilist) { _preCompiled.put(pattern, ilist); } /** * Get the instruction list for a pre-compiled pattern. Used by * test sequences to avoid compiling patterns more than once. */ public InstructionList getInstructionList(Pattern pattern) { return (InstructionList) _preCompiled.get(pattern); } /** * Used to keep track of an outlineable chunk of instructions in the * current method. See {@link OutlineableChunkStart} and * {@link OutlineableChunkEnd} for more information. */ private class Chunk implements Comparable { /** * {@link InstructionHandle} of the first instruction in the outlineable * chunk. */ private InstructionHandle m_start; /** * {@link org.apache.bcel.generic.InstructionHandle} of the first * instruction in the outlineable chunk. */ private InstructionHandle m_end; /** * Number of bytes in the instructions contained in this outlineable * chunk. */ private int m_size; /** *

        Constructor for an outlineable {@link MethodGenerator.Chunk}.

        *

        Preconditions: *

          *
        • The {@link InstructionList#setPositions()} has been called for * the {@link InstructionList} associated with this * {@link MethodGenerator}.
        • *

        * @param start The {@link InstructionHandle} of the first * instruction in the outlineable chunk. * @param end The {@link InstructionHandle} of the last * instruction in the outlineable chunk. */ Chunk(InstructionHandle start, InstructionHandle end) { m_start = start; m_end = end; m_size = end.getPosition() - start.getPosition(); } /** * Determines whether this outlineable {@link MethodGenerator.Chunk} is * followed immediately by the argument * MethodGenerator.Chunk, with no other intervening * instructions, including {@link OutlineableChunkStart} or * {@link OutlineableChunkEnd} instructions. * @param neighbour an outlineable {@link MethodGenerator.Chunk} * @return true if and only if the argument chunk * immediately follows this chunk */ boolean isAdjacentTo(Chunk neighbour) { return getChunkEnd().getNext() == neighbour.getChunkStart(); } /** * Getter method for the start of this {@linke MethodGenerator.Chunk} * @return the {@link org.apache.bcel.generic.InstructionHandle} of the * start of this chunk */ InstructionHandle getChunkStart() { return m_start; } /** * Getter method for the end of this {@link MethodGenerator.Chunk} * @return the {@link InstructionHandle} of the start of this chunk */ InstructionHandle getChunkEnd() { return m_end; } /** * The size of this {@link MethodGenerator.Chunk} * @return the number of bytes in the byte code represented by this * chunk. */ int getChunkSize() { return m_size; } /** * Implements the java.util.Comparable.compareTo(Object) * method. * @return *
          *
        • A positive int if the length of this * chunk in bytes is greater than that of comparand
        • *
        • A negative int if the length of this * chunk in bytes is less than that of comparand
        • *
        • Zero, otherwise.
        • *
        */ public int compareTo(Object comparand) { return getChunkSize() - ((Chunk)comparand).getChunkSize(); } } /** * Find the outlineable chunks in this method that would be the best choices * to outline, based on size and position in the method. * @param classGen The {@link ClassGen} with which the generated methods * will be associated * @param totalMethodSize the size of the bytecode in the original method * @return a java.util.ArrayList containing the * {@link MethodGenerator.Chunk}s that may be outlined from this method */ private ArrayList getCandidateChunks(ClassGenerator classGen, int totalMethodSize) { Iterator instructions = getInstructionList().iterator(); ArrayList candidateChunks = new ArrayList(); ArrayList currLevelChunks = new ArrayList(); Stack subChunkStack = new Stack(); boolean openChunkAtCurrLevel = false; boolean firstInstruction = true; InstructionHandle currentHandle; if (m_openChunks != 0) { String msg = (new ErrorMsg(ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS)) .toString(); throw new InternalError(msg); } // Scan instructions in the method, keeping track of the nesting level // of outlineable chunks. // // currLevelChunks // keeps track of the child chunks of a chunk. For each chunk, // there will be a pair of entries: the InstructionHandles for the // start and for the end of the chunk // subChunkStack // a stack containing the partially accumulated currLevelChunks for // each chunk that's still open at the current position in the // InstructionList. // candidateChunks // the list of chunks which have been accepted as candidates chunks // for outlining do { // Get the next instruction. The loop will perform one extra // iteration after it reaches the end of the InstructionList, with // currentHandle set to null. currentHandle = instructions.hasNext() ? (InstructionHandle) instructions.next() : null; Instruction inst = (currentHandle != null) ? currentHandle.getInstruction() : null; // At the first iteration, create a chunk representing all the // code in the method. This is done just to simplify the logic - // this chunk can never be outlined because it will be too big. if (firstInstruction) { openChunkAtCurrLevel = true; currLevelChunks.add(currentHandle); firstInstruction = false; } // Found a new chunk if (inst instanceof OutlineableChunkStart) { // If last MarkerInstruction encountered was an // OutlineableChunkStart, this represents the first chunk // nested within that previous chunk - push the list of chunks // from the outer level onto the stack if (openChunkAtCurrLevel) { subChunkStack.push(currLevelChunks); currLevelChunks = new ArrayList(); } openChunkAtCurrLevel = true; currLevelChunks.add(currentHandle); // Close off an open chunk } else if (currentHandle == null || inst instanceof OutlineableChunkEnd) { ArrayList nestedSubChunks = null; // If the last MarkerInstruction encountered was an // OutlineableChunkEnd, it means that the current instruction // marks the end of a chunk that contained child chunks. // Those children might need to be examined below in case they // are better candidates for outlining than the current chunk. if (!openChunkAtCurrLevel) { nestedSubChunks = currLevelChunks; currLevelChunks = (ArrayList)subChunkStack.pop(); } // Get the handle for the start of this chunk (the last entry // in currLevelChunks) InstructionHandle chunkStart = (InstructionHandle) currLevelChunks.get( currLevelChunks.size()-1); int chunkEndPosition = (currentHandle != null) ? currentHandle.getPosition() : totalMethodSize; int chunkSize = chunkEndPosition - chunkStart.getPosition(); // Two ranges of chunk size to consider: // // 1. [0,TARGET_METHOD_SIZE] // Keep this chunk in consideration as a candidate, // and ignore its subchunks, if any - there's nothing to be // gained by outlining both the current chunk and its // children! // // 2. (TARGET_METHOD_SIZE,+infinity) // Ignore this chunk - it's too big. Add its subchunks // as candidates, after merging adjacent chunks to produce // chunks that are as large as possible if (chunkSize <= TARGET_METHOD_SIZE) { currLevelChunks.add(currentHandle); } else { if (!openChunkAtCurrLevel) { int childChunkCount = nestedSubChunks.size() / 2; if (childChunkCount > 0) { Chunk[] childChunks = new Chunk[childChunkCount]; // Gather all the child chunks of the current chunk for (int i = 0; i < childChunkCount; i++) { InstructionHandle start = (InstructionHandle) nestedSubChunks .get(i*2); InstructionHandle end = (InstructionHandle) nestedSubChunks .get(i*2+1); childChunks[i] = new Chunk(start, end); } // Merge adjacent siblings ArrayList mergedChildChunks = mergeAdjacentChunks(childChunks); // Add chunks that mean minimum size requirements // to the list of candidate chunks for outlining for (int i = 0; i < mergedChildChunks.size(); i++) { Chunk mergedChunk = (Chunk)mergedChildChunks.get(i); int mergedSize = mergedChunk.getChunkSize(); if (mergedSize >= MINIMUM_OUTLINEABLE_CHUNK_SIZE && mergedSize <= TARGET_METHOD_SIZE) { candidateChunks.add(mergedChunk); } } } } // Drop the chunk which was too big currLevelChunks.remove(currLevelChunks.size() - 1); } // currLevelChunks contains pairs of InstructionHandles. If // its size is an odd number, the loop has encountered the // start of a chunk at this level, but not its end. openChunkAtCurrLevel = ((currLevelChunks.size() & 0x1) == 1); } } while (currentHandle != null); return candidateChunks; } /** * Merge adjacent sibling chunks to produce larger candidate chunks for * outlining * @param chunks array of sibling {@link MethodGenerator.Chunk}s that are * under consideration for outlining. Chunks must be in * the order encountered in the {@link InstructionList} * @return a java.util.ArrayList of * MethodGenerator.Chunks maximally merged */ private ArrayList mergeAdjacentChunks(Chunk[] chunks) { int[] adjacencyRunStart = new int[chunks.length]; int[] adjacencyRunLength = new int[chunks.length]; boolean[] chunkWasMerged = new boolean[chunks.length]; int maximumRunOfChunks = 0; int startOfCurrentRun; int numAdjacentRuns = 0; ArrayList mergedChunks = new ArrayList(); startOfCurrentRun = 0; // Loop through chunks, and record in adjacencyRunStart where each // run of adjacent chunks begins and how many are in that run. For // example, given chunks A B C D E F, if A is adjacent to B, but not // to C, and C, D, E and F are all adjacent, // adjacencyRunStart[0] == 0; adjacencyRunLength[0] == 2 // adjacencyRunStart[1] == 2; adjacencyRunLength[1] == 4 for (int i = 1; i < chunks.length; i++) { if (!chunks[i-1].isAdjacentTo(chunks[i])) { int lengthOfRun = i - startOfCurrentRun; // Track the longest run of chunks found if (maximumRunOfChunks < lengthOfRun) { maximumRunOfChunks = lengthOfRun; } if (lengthOfRun > 1 ) { adjacencyRunLength[numAdjacentRuns] = lengthOfRun; adjacencyRunStart[numAdjacentRuns] = startOfCurrentRun; numAdjacentRuns++; } startOfCurrentRun = i; } } if (chunks.length - startOfCurrentRun > 1) { int lengthOfRun = chunks.length - startOfCurrentRun; // Track the longest run of chunks found if (maximumRunOfChunks < lengthOfRun) { maximumRunOfChunks = lengthOfRun; } adjacencyRunLength[numAdjacentRuns] = chunks.length - startOfCurrentRun; adjacencyRunStart[numAdjacentRuns] = startOfCurrentRun; numAdjacentRuns++; } // Try merging adjacent chunks to come up with better sized chunks for // outlining. This algorithm is not optimal, but it should be // reasonably fast. Consider an example like this, where four chunks // of the sizes specified in brackets are adjacent. The best way of // combining these chunks would be to merge the first pair and merge // the last three to form two chunks, but the algorithm will merge the // three in the middle instead, leaving three chunks in all. // [25000] [25000] [20000] [1000] [20000] // Start by trying to merge the maximum number of adjacent chunks, and // work down from there. for (int numToMerge = maximumRunOfChunks; numToMerge>1; numToMerge--) { // Look at each run of adjacent chunks for (int run = 0; run < numAdjacentRuns; run++) { int runStart = adjacencyRunStart[run]; int runEnd = runStart + adjacencyRunLength[run] - 1; boolean foundChunksToMerge = false; // Within the current run of adjacent chunks, look at all // "subruns" of length numToMerge, until we run out or find // a subrun that can be merged. for (int mergeStart = runStart; mergeStart+numToMerge-1 <= runEnd && !foundChunksToMerge; mergeStart++) { int mergeEnd = mergeStart + numToMerge - 1; int mergeSize = 0; // Find out how big the subrun is for (int j = mergeStart; j <= mergeEnd; j++) { mergeSize = mergeSize + chunks[j].getChunkSize(); } // If the current subrun is small enough to outline, // merge it, and split the remaining chunks in the run if (mergeSize <= TARGET_METHOD_SIZE) { foundChunksToMerge = true; for (int j = mergeStart; j <= mergeEnd; j++) { chunkWasMerged[j] = true; } mergedChunks.add( new Chunk(chunks[mergeStart].getChunkStart(), chunks[mergeEnd].getChunkEnd())); // Adjust the length of the current run of adjacent // chunks to end at the newly merged chunk... adjacencyRunLength[run] = adjacencyRunStart[run] - mergeStart; int trailingRunLength = runEnd - mergeEnd; // and any chunks that follow the newly merged chunk // in the current run of adjacent chunks form another // new run of adjacent chunks if (trailingRunLength >= 2) { adjacencyRunStart[numAdjacentRuns] = mergeEnd + 1; adjacencyRunLength[numAdjacentRuns] = trailingRunLength; numAdjacentRuns++; } } } } } // Make a final pass for any chunk that wasn't merged with a sibling // and include it in the list of chunks after merging. for (int i = 0; i < chunks.length; i++) { if (!chunkWasMerged[i]) { mergedChunks.add(chunks[i]); } } return mergedChunks; } /** * Breaks up the IL for this {@link MethodGenerator} into separate * outlined methods so that no method exceeds the 64KB limit on the length * of the byte code associated with a method. * @param classGen The {@link ClassGen} with which the generated methods * will be associated * @param originalMethodSize The number of bytes of bytecode represented by * the {@link InstructionList} of this method * @return an array of the outlined Methods and the original * method itself */ public Method[] outlineChunks(ClassGenerator classGen, int originalMethodSize) { ArrayList methodsOutlined = new ArrayList(); int currentMethodSize = originalMethodSize; int outlinedCount = 0; boolean moreMethodsOutlined; String originalMethodName = getName(); // Special handling for initialization methods. No other methods can // include the less than and greater than characters in their names, // so we munge the names here. if (originalMethodName.equals("")) { originalMethodName = "$lt$init$gt$"; } else if (originalMethodName.equals("")) { originalMethodName = "$lt$clinit$gt$"; } // Loop until the original method comes in under the JVM limit or // the loop was unable to outline any more methods do { // Get all the best candidates for outlining, and sort them in // ascending order of size ArrayList candidateChunks = getCandidateChunks(classGen, currentMethodSize); Collections.sort(candidateChunks); moreMethodsOutlined = false; // Loop over the candidates for outlining, from the largest to the // smallest and outline them one at a time, until the loop has // outlined all or the original method comes in under the JVM // limit on the size of a method. for (int i = candidateChunks.size()-1; i >= 0 && currentMethodSize > TARGET_METHOD_SIZE; i--) { Chunk chunkToOutline = (Chunk)candidateChunks.get(i); methodsOutlined.add(outline(chunkToOutline.getChunkStart(), chunkToOutline.getChunkEnd(), originalMethodName + "$outline$" + outlinedCount, classGen)); outlinedCount++; moreMethodsOutlined = true; InstructionList il = getInstructionList(); InstructionHandle lastInst = il.getEnd(); il.setPositions(); // Check the size of the method now currentMethodSize = lastInst.getPosition() + lastInst.getInstruction().getLength(); } } while (moreMethodsOutlined && currentMethodSize > TARGET_METHOD_SIZE); // Outlining failed to reduce the size of the current method // sufficiently. Throw an internal error. if (currentMethodSize > MAX_METHOD_SIZE) { String msg = (new ErrorMsg(ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG)) .toString(); throw new InternalError(msg); } Method[] methodsArr = new Method[methodsOutlined.size() + 1]; methodsOutlined.toArray(methodsArr); methodsArr[methodsOutlined.size()] = getThisMethod(); return methodsArr; } /** * Given an outlineable chunk of code in the current {@link MethodGenerator} * move ("outline") the chunk to a new method, and replace the chunk in the * old method with a reference to that new method. No * {@link OutlineableChunkStart} or {@link OutlineableChunkEnd} instructions * are copied. * @param first The {@link InstructionHandle} of the first instruction in * the chunk to outline * @param last The InstructionHandle of the last instruction in * the chunk to outline * @param outlinedMethodName The name of the new method * @param classGen The {@link ClassGenerator} of which the original * and new methods will be members * @return The new {@link Method} containing the outlined code. */ private Method outline(InstructionHandle first, InstructionHandle last, String outlinedMethodName, ClassGenerator classGen) { // We're not equipped to deal with exception handlers yet. Bail out! if (getExceptionHandlers().length != 0) { String msg = (new ErrorMsg(ErrorMsg.OUTLINE_ERR_TRY_CATCH)) .toString(); throw new InternalError(msg); } int outlineChunkStartOffset = first.getPosition(); int outlineChunkEndOffset = last.getPosition() + last.getInstruction().getLength(); ConstantPoolGen cpg = getConstantPool(); // Create new outlined method with signature: // // private final outlinedMethodName(CopyLocals copyLocals); // // CopyLocals is an object that is used to copy-in/copy-out local // variables that are used by the outlined method. Only locals whose // value is potentially set or referenced outside the range of the // chunk that is being outlined will be represented in CopyLocals. The // type of the variable for copying local variables is actually // generated to be unique - it is not named CopyLocals. // // The outlined method never needs to be referenced outside of this // class, and will never be overridden, so we mark it private final. final InstructionList newIL = new InstructionList(); final XSLTC xsltc = classGen.getParser().getXSLTC(); final String argTypeName = xsltc.getHelperClassName(); final Type[] argTypes = new Type[] {(new ObjectType(argTypeName)).toJCType()}; final String argName = "copyLocals"; final String[] argNames = new String[] {argName}; int methodAttributes = ACC_PRIVATE | ACC_FINAL; final boolean isStaticMethod = (getAccessFlags() & ACC_STATIC) != 0; if (isStaticMethod) { methodAttributes = methodAttributes | ACC_STATIC; } final MethodGenerator outlinedMethodGen = new MethodGenerator(methodAttributes, org.apache.bcel.generic.Type.VOID, argTypes, argNames, outlinedMethodName, getClassName(), newIL, cpg); // Create class for copying local variables to the outlined method. // The fields the class will need to contain will be determined as the // code in the outlineable chunk is examined. ClassGenerator copyAreaCG = new ClassGenerator(argTypeName, OBJECT_CLASS, argTypeName+".java", ACC_FINAL | ACC_PUBLIC | ACC_SUPER, null, classGen.getStylesheet()) { public boolean isExternal() { return true; } }; ConstantPoolGen copyAreaCPG = copyAreaCG.getConstantPool(); copyAreaCG.addEmptyConstructor(ACC_PUBLIC); // Number of fields in the copy class int copyAreaFieldCount = 0; // The handle for the instruction after the last one to be outlined. // Note that this should never end up being null. An outlineable chunk // won't contain a RETURN instruction or other branch out of the chunk, // and the JVM specification prohibits code in a method from just // "falling off the end" so this should always point to a valid handle. InstructionHandle limit = last.getNext(); // InstructionLists for copying values into and out of an instance of // CopyLocals: // oldMethCoypInIL - from locals in old method into an instance // of the CopyLocals class (oldMethCopyInIL) // oldMethCopyOutIL - from CopyLocals back into locals in the old // method // newMethCopyInIL - from CopyLocals into locals in the new // method // newMethCopyOutIL - from locals in new method into the instance // of the CopyLocals class InstructionList oldMethCopyInIL = new InstructionList(); InstructionList oldMethCopyOutIL = new InstructionList(); InstructionList newMethCopyInIL = new InstructionList(); InstructionList newMethCopyOutIL = new InstructionList(); // Allocate instance of class in which we'll copy in or copy out locals // and make two copies: last copy is used to invoke constructor; // other two are used for references to fields in the CopyLocals object InstructionHandle outlinedMethodCallSetup = oldMethCopyInIL.append(new NEW(cpg.addClass(argTypeName))); oldMethCopyInIL.append(InstructionConstants.DUP); oldMethCopyInIL.append(InstructionConstants.DUP); oldMethCopyInIL.append( new INVOKESPECIAL(cpg.addMethodref(argTypeName, "", "()V"))); // Generate code to invoke the new outlined method, and place the code // on oldMethCopyOutIL InstructionHandle outlinedMethodRef; if (isStaticMethod) { outlinedMethodRef = oldMethCopyOutIL.append( new INVOKESTATIC(cpg.addMethodref( classGen.getClassName(), outlinedMethodName, outlinedMethodGen.getSignature()))); } else { oldMethCopyOutIL.append(InstructionConstants.THIS); oldMethCopyOutIL.append(InstructionConstants.SWAP); outlinedMethodRef = oldMethCopyOutIL.append( new INVOKEVIRTUAL(cpg.addMethodref( classGen.getClassName(), outlinedMethodName, outlinedMethodGen.getSignature()))); } // Used to keep track of the first in a sequence of // OutlineableChunkStart instructions boolean chunkStartTargetMappingsPending = false; InstructionHandle pendingTargetMappingHandle = null; // Used to keep track of the last instruction that was copied InstructionHandle lastCopyHandle = null; // Keeps track of the mapping from instruction handles in the old // method to instruction handles in the outlined method. Only need // to track instructions that are targeted by something else in the // generated BCEL HashMap targetMap = new HashMap(); // Keeps track of the mapping from local variables in the old method // to local variables in the outlined method. HashMap localVarMap = new HashMap(); HashMap revisedLocalVarStart = new HashMap(); HashMap revisedLocalVarEnd = new HashMap(); // Pass 1: Make copies of all instructions, append them to the new list // and associate old instruction references with the new ones, i.e., // a 1:1 mapping. The special marker instructions are not copied. // Also, identify local variables whose values need to be copied into or // out of the new outlined method, and builds up targetMap and // localVarMap as described above. The code identifies those local // variables first so that they can have fixed slots in the stack // frame for the outlined method assigned them ahead of all those // variables that don't need to exist for the entirety of the outlined // method invocation. for (InstructionHandle ih = first; ih != limit; ih = ih.getNext()) { Instruction inst = ih.getInstruction(); // MarkerInstructions are not copied, so if something else targets // one, the targetMap will point to the nearest copied sibling // InstructionHandle: for an OutlineableChunkEnd, the nearest // preceding sibling; for an OutlineableChunkStart, the nearest // following sibling. if (inst instanceof MarkerInstruction) { if (ih.hasTargeters()) { if (inst instanceof OutlineableChunkEnd) { targetMap.put(ih, lastCopyHandle); } else { if (!chunkStartTargetMappingsPending) { chunkStartTargetMappingsPending = true; pendingTargetMappingHandle = ih; } } } } else { // Copy the instruction and append it to the outlined method's // InstructionList. Instruction c = inst.copy(); // Use clone for shallow copy if (c instanceof BranchInstruction) { lastCopyHandle = newIL.append((BranchInstruction)c); } else { lastCopyHandle = newIL.append(c); } if (c instanceof LocalVariableInstruction || c instanceof RET) { // For any instruction that touches a local variable, // check whether the local variable's value needs to be // copied into or out of the outlined method. If so, // generate the code to perform the necessary copying, and // use localVarMap to map the variable in the original // method to the variable in the new method. IndexedInstruction lvi = (IndexedInstruction)c; int oldLocalVarIndex = lvi.getIndex(); LocalVariableGen oldLVG = getLocalVariableRegistry() .lookupRegisteredLocalVariable(oldLocalVarIndex, ih.getPosition()); LocalVariableGen newLVG = (LocalVariableGen)localVarMap.get(oldLVG); // Has the code already mapped this local variable to a // local in the new method? if (localVarMap.get(oldLVG) == null) { // Determine whether the local variable needs to be // copied into or out of the outlined by checking // whether the range of instructions in which the // variable is accessible is outside the range of // instructions in the outlineable chunk. // Special case a chunk start offset of zero: a local // variable live at that position must be a method // parameter, so the code doesn't need to check whether // the variable is live before that point; being live // at offset zero is sufficient to know that the value // must be copied in to the outlined method. boolean copyInLocalValue = offsetInLocalVariableGenRange(oldLVG, (outlineChunkStartOffset != 0) ? outlineChunkStartOffset-1 : 0); boolean copyOutLocalValue = offsetInLocalVariableGenRange(oldLVG, outlineChunkEndOffset+1); // For any variable that needs to be copied into or out // of the outlined method, create a field in the // CopyLocals class, and generate the necessary code for // copying the value. if (copyInLocalValue || copyOutLocalValue) { String varName = oldLVG.getName(); Type varType = oldLVG.getType(); newLVG = outlinedMethodGen.addLocalVariable(varName, varType, null, null); int newLocalVarIndex = newLVG.getIndex(); String varSignature = varType.getSignature(); // Record the mapping from the old local to the new localVarMap.put(oldLVG, newLVG); copyAreaFieldCount++; String copyAreaFieldName = "field" + copyAreaFieldCount; copyAreaCG.addField( new Field(ACC_PUBLIC, copyAreaCPG.addUtf8(copyAreaFieldName), copyAreaCPG.addUtf8(varSignature), null, copyAreaCPG.getConstantPool())); int fieldRef = cpg.addFieldref(argTypeName, copyAreaFieldName, varSignature); if (copyInLocalValue) { // Generate code for the old method to store the // value of the local into the correct field in // CopyLocals prior to invocation of the // outlined method. oldMethCopyInIL.append( InstructionConstants.DUP); InstructionHandle copyInLoad = oldMethCopyInIL.append( loadLocal(oldLocalVarIndex, varType)); oldMethCopyInIL.append(new PUTFIELD(fieldRef)); // If the end of the live range of the old // variable was in the middle of the outlined // chunk. Make the load of its value the new // end of its range. if (!copyOutLocalValue) { revisedLocalVarEnd.put(oldLVG, copyInLoad); } // Generate code for start of the outlined // method to copy the value from a field in // CopyLocals to the new local in the outlined // method newMethCopyInIL.append( InstructionConstants.ALOAD_1); newMethCopyInIL.append(new GETFIELD(fieldRef)); newMethCopyInIL.append( storeLocal(newLocalVarIndex, varType)); } if (copyOutLocalValue) { // Generate code for the end of the outlined // method to copy the value from the new local // variable into a field in CopyLocals // method newMethCopyOutIL.append( InstructionConstants.ALOAD_1); newMethCopyOutIL.append( loadLocal(newLocalVarIndex, varType)); newMethCopyOutIL.append(new PUTFIELD(fieldRef)); // Generate code to copy the value from a field // in CopyLocals into a local in the original // method following invocation of the outlined // method. oldMethCopyOutIL.append( InstructionConstants.DUP); oldMethCopyOutIL.append(new GETFIELD(fieldRef)); InstructionHandle copyOutStore = oldMethCopyOutIL.append( storeLocal(oldLocalVarIndex, varType)); // If the start of the live range of the old // variable was in the middle of the outlined // chunk. Make this store into it the new start // of its range. if (!copyInLocalValue) { revisedLocalVarStart.put(oldLVG, copyOutStore); } } } } } if (ih.hasTargeters()) { targetMap.put(ih, lastCopyHandle); } // If this is the first instruction copied following a sequence // of OutlineableChunkStart instructions, indicate that the // sequence of old instruction all map to this newly created // instruction if (chunkStartTargetMappingsPending) { do { targetMap.put(pendingTargetMappingHandle, lastCopyHandle); pendingTargetMappingHandle = pendingTargetMappingHandle.getNext(); } while(pendingTargetMappingHandle != ih); chunkStartTargetMappingsPending = false; } } } // Pass 2: Walk old and new instruction lists, updating branch targets // and local variable references in the new list InstructionHandle ih = first; InstructionHandle ch = newIL.getStart(); while (ch != null) { // i == old instruction; c == copied instruction Instruction i = ih.getInstruction(); Instruction c = ch.getInstruction(); if (i instanceof BranchInstruction) { BranchInstruction bc = (BranchInstruction)c; BranchInstruction bi = (BranchInstruction)i; InstructionHandle itarget = bi.getTarget(); // old target // New target must be in targetMap InstructionHandle newTarget = (InstructionHandle)targetMap.get(itarget); bc.setTarget(newTarget); // Handle LOOKUPSWITCH or TABLESWITCH which may have many // target instructions if (bi instanceof Select) { InstructionHandle[] itargets = ((Select)bi).getTargets(); InstructionHandle[] ctargets = ((Select)bc).getTargets(); // Update all targets for (int j=0; j < itargets.length; j++) { ctargets[j] = (InstructionHandle)targetMap.get(itargets[j]); } } } else if (i instanceof LocalVariableInstruction || i instanceof RET) { // For any instruction that touches a local variable, // map the location of the variable in the original // method to its location in the new method. IndexedInstruction lvi = (IndexedInstruction)c; int oldLocalVarIndex = lvi.getIndex(); LocalVariableGen oldLVG = getLocalVariableRegistry() .lookupRegisteredLocalVariable(oldLocalVarIndex, ih.getPosition()); LocalVariableGen newLVG = (LocalVariableGen)localVarMap.get(oldLVG); int newLocalVarIndex; if (newLVG == null) { // Create new variable based on old variable - use same // name and type, but we will let the variable be active // for the entire outlined method. // LocalVariableGen oldLocal = oldLocals[oldLocalVarIndex]; String varName = oldLVG.getName(); Type varType = oldLVG.getType(); newLVG = outlinedMethodGen.addLocalVariable(varName, varType, null, null); newLocalVarIndex = newLVG.getIndex(); localVarMap.put(oldLVG, newLVG); // The old variable's live range was wholly contained in // the outlined chunk. There should no longer be stores // of values into it or loads of its value, so we can just // mark its live range as the reference to the outlined // method. revisedLocalVarStart.put(oldLVG, outlinedMethodRef); revisedLocalVarEnd.put(oldLVG, outlinedMethodRef); } else { newLocalVarIndex = newLVG.getIndex(); } lvi.setIndex(newLocalVarIndex); } // If the old instruction marks the end of the range of a local // variable, make sure that any slots on the stack reserved for // local variables are made available for reuse by calling // MethodGenerator.removeLocalVariable if (ih.hasTargeters()) { InstructionTargeter[] targeters = ih.getTargeters(); for (int idx = 0; idx < targeters.length; idx++) { InstructionTargeter targeter = targeters[idx]; if (targeter instanceof LocalVariableGen && ((LocalVariableGen)targeter).getEnd()==ih) { Object newLVG = localVarMap.get(targeter); if (newLVG != null) { outlinedMethodGen.removeLocalVariable( (LocalVariableGen)newLVG); } } } } // If the current instruction in the original list was a marker, // it wasn't copied, so don't advance through the list of copied // instructions yet. if (!(i instanceof MarkerInstruction)) { ch = ch.getNext(); } ih = ih.getNext(); } // POP the reference to the CopyLocals object from the stack oldMethCopyOutIL.append(InstructionConstants.POP); // Now that the generation of the outlined code is complete, update // the old local variables with new start and end ranges, as required. Iterator revisedLocalVarStartPairIter = revisedLocalVarStart.entrySet() .iterator(); while (revisedLocalVarStartPairIter.hasNext()) { Map.Entry lvgRangeStartPair = (Map.Entry)revisedLocalVarStartPairIter.next(); LocalVariableGen lvg = (LocalVariableGen)lvgRangeStartPair.getKey(); InstructionHandle startInst = (InstructionHandle)lvgRangeStartPair.getValue(); lvg.setStart(startInst); } Iterator revisedLocalVarEndPairIter = revisedLocalVarEnd.entrySet() .iterator(); while (revisedLocalVarEndPairIter.hasNext()) { Map.Entry lvgRangeEndPair = (Map.Entry)revisedLocalVarEndPairIter.next(); LocalVariableGen lvg = (LocalVariableGen)lvgRangeEndPair.getKey(); InstructionHandle endInst = (InstructionHandle)lvgRangeEndPair.getValue(); lvg.setEnd(endInst); } xsltc.dumpClass(copyAreaCG.getJavaClass()); // Assemble the instruction lists so that the old method invokes the // new outlined method InstructionList oldMethodIL = getInstructionList(); oldMethodIL.insert(first, oldMethCopyInIL); oldMethodIL.insert(first, oldMethCopyOutIL); // Insert the copying code into the outlined method newIL.insert(newMethCopyInIL); newIL.append(newMethCopyOutIL); newIL.append(InstructionConstants.RETURN); // Discard instructions in outlineable chunk from old method try { oldMethodIL.delete(first, last); } catch (TargetLostException e) { InstructionHandle[] targets = e.getTargets(); // If there were still references to old instructions lingering, // clean those up. The only instructions targetting the deleted // instructions should have been part of the chunk that was just // deleted, except that instructions might branch to the start of // the outlined chunk; similarly, all the live ranges of local // variables should have been adjusted, except for unreferenced // variables. for (int i = 0; i < targets.length; i++) { InstructionHandle lostTarget = targets[i]; InstructionTargeter[] targeters = lostTarget.getTargeters(); for (int j = 0; j < targeters.length; j++) { if (targeters[j] instanceof LocalVariableGen) { LocalVariableGen lvgTargeter = (LocalVariableGen) targeters[j]; // In the case of any lingering variable references, // just make the live range point to the outlined // function reference. Such variables should be unused // anyway. if (lvgTargeter.getStart() == lostTarget) { lvgTargeter.setStart(outlinedMethodRef); } if (lvgTargeter.getEnd() == lostTarget) { lvgTargeter.setEnd(outlinedMethodRef); } } else { targeters[j].updateTarget(lostTarget, outlinedMethodCallSetup); } } } } // Make a copy for the new method of all exceptions that might be thrown String[] exceptions = getExceptions(); for (int i = 0; i < exceptions.length; i++) { outlinedMethodGen.addException(exceptions[i]); } return outlinedMethodGen.getThisMethod(); } /** * Helper method to generate an instance of a subclass of * {@link LoadInstruction} based on the specified {@link Type} that will * load the specified local variable * @param index the JVM stack frame index of the variable that is to be * loaded * @param type the {@link Type} of the variable * @return the generated {@link LoadInstruction} */ private static Instruction loadLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ILOAD(index); } else if (type == Type.INT) { return new ILOAD(index); } else if (type == Type.SHORT) { return new ILOAD(index); } else if (type == Type.LONG) { return new LLOAD(index); } else if (type == Type.BYTE) { return new ILOAD(index); } else if (type == Type.CHAR) { return new ILOAD(index); } else if (type == Type.FLOAT) { return new FLOAD(index); } else if (type == Type.DOUBLE) { return new DLOAD(index); } else { return new ALOAD(index); } } /** * Helper method to generate an instance of a subclass of * {@link StoreInstruction} based on the specified {@link Type} that will * store a value in the specified local variable * @param index the JVM stack frame index of the variable that is to be * stored * @param type the {@link Type} of the variable * @return the generated {@link StoredInstruction} */ private static Instruction storeLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ISTORE(index); } else if (type == Type.INT) { return new ISTORE(index); } else if (type == Type.SHORT) { return new ISTORE(index); } else if (type == Type.LONG) { return new LSTORE(index); } else if (type == Type.BYTE) { return new ISTORE(index); } else if (type == Type.CHAR) { return new ISTORE(index); } else if (type == Type.FLOAT) { return new FSTORE(index); } else if (type == Type.DOUBLE) { return new DSTORE(index); } else { return new ASTORE(index); } } /** * Track the number of outlineable chunks seen. */ private int m_totalChunks = 0; /** * Track the number of outlineable chunks started but not yet ended. Used * to detect imbalances in byte code generation. */ private int m_openChunks = 0; /** * Mark the end of the method's * {@link InstructionList} as the start of an outlineable chunk of code. * The outlineable chunk begins after the {@link InstructionHandle} that is * at the end of the method's {@link InstructionList}, or at the start of * the method if the InstructionList is empty. * See {@link OutlineableChunkStart} for more information. */ public void markChunkStart() { // m_chunkTree.markChunkStart(); getInstructionList() .append(OutlineableChunkStart.OUTLINEABLECHUNKSTART); m_totalChunks++; m_openChunks++; } /** * Mark the end of an outlineable chunk of code. See * {@link OutlineableChunkStart} for more information. */ public void markChunkEnd() { // m_chunkTree.markChunkEnd(); getInstructionList() .append(OutlineableChunkEnd.OUTLINEABLECHUNKEND); m_openChunks--; if (m_openChunks < 0) { String msg = (new ErrorMsg(ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS)) .toString(); throw new InternalError(msg); } } /** *

        Get all {@link Method}s generated by this {@link MethodGenerator}. * The {@link MethodGen#getMethod()} only returns a single * Method object. This method takes into account the Java * Virtual Machine Specification limit of 64KB on the size of a method, and * may return more than one Method.

        *

        If the code associated with the MethodGenerator would * exceed the 64KB limit, this method will attempt to split the code in * the {@link InstructionList} associated with this * MethodGenerator into several methods.

        * @param classGen the {@link ClassGenerator} of which these methods are * members * @return an array of all the Methods generated */ Method[] getGeneratedMethods(ClassGenerator classGen) { Method[] generatedMethods; InstructionList il = getInstructionList(); InstructionHandle last = il.getEnd(); il.setPositions(); int instructionListSize = last.getPosition() + last.getInstruction().getLength(); // Need to look for any branch target offsets that exceed the range // [-32768,32767] if (instructionListSize > MAX_BRANCH_TARGET_OFFSET) { boolean ilChanged = widenConditionalBranchTargetOffsets(); // If any branch instructions needed widening, recompute the size // of the byte code for the method if (ilChanged) { il.setPositions(); last = il.getEnd(); instructionListSize = last.getPosition() + last.getInstruction().getLength(); } } if (instructionListSize > MAX_METHOD_SIZE) { generatedMethods = outlineChunks(classGen, instructionListSize); } else { generatedMethods = new Method[] {getThisMethod()}; } return generatedMethods; } protected Method getThisMethod() { stripAttributes(true); setMaxLocals(); setMaxStack(); removeNOPs(); return getMethod(); } /** *

        Rewrites branches to avoid the JVM limits of relative branch * offsets. There is no need to invoke this method if the bytecode for the * {@link MethodGenerator} does not exceed 32KB.

        *

        The Java Virtual Machine Specification permits the code portion of a * method to be up to 64KB in length. However, some control transfer * instructions specify relative offsets as a signed 16-bit quantity, * limiting the range to a subset of the instructions that might be in a * method.

        *

        The TABLESWITCH and LOOKUPSWITCH * instructions always use 32-bit signed relative offsets, so they are * immune to this problem.

        *

        The GOTO and JSR * instructions come in two forms, one of which uses 16-bit relative * offsets, and the other of which uses 32-bit relative offsets. The BCEL * library decides whether to use the wide form of GOTO or * JSRinstructions based on the relative offset of the target * of the instruction without any intervention by the user of the * library.

        *

        This leaves the various conditional branch instructions, * IFEQ, IFNULL, IF_ICMPEQ, * et al., all of which use 16-bit signed relative offsets, with no * 32-bit wide form available.

        *

        This method scans the {@link InstructionList} associated with this * {@link MethodGenerator} and finds all conditional branch instructions * that might exceed the 16-bit limitation for relative branch offsets. * The logic of each such instruction is inverted, and made to target the * instruction which follows it. An unconditional branch to the original * target of the instruction is then inserted between the conditional * branch and the instruction which previously followed it. The * unconditional branch is permitted to have a 16-bit or a 32-bit relative * offset, as described above. For example, * * 1234: NOP * ... * 55278: IFEQ -54044 * 55280: NOP * * is rewritten as * * 1234: NOP * ... * 55278: IFNE 7 * 55280: GOTO_W -54046 * 55285: NOP *

        *

        Preconditions: *

        • The {@link InstructionList#setPositions()} has been called for * the InstructionList associated with this * MethodGenerator. *

        *

        Postconditions: *

        • Any further changes to the InstructionList for this * MethodGenerator will invalidate the changes made by this * method.
        *

        * @return true if the InstructionList was * modified; false otherwise * @see The Java Virtual Machine Specification, Second Edition */ boolean widenConditionalBranchTargetOffsets() { boolean ilChanged = false; int maxOffsetChange = 0; InstructionList il = getInstructionList(); // Loop through all the instructions, finding those that would be // affected by inserting new instructions in the InstructionList, and // calculating the maximum amount by which the relative offset between // two instructions could possibly change. // In part this loop duplicates code in // org.apache.bcel.generic.InstructionList.setPosition(), which does // this to determine whether to use 16-bit or 32-bit offsets for GOTO // and JSR instructions. Ideally, that method would do the same for // conditional branch instructions, but it doesn't, so we duplicate the // processing here. for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) { Instruction inst = ih.getInstruction(); switch (inst.getOpcode()) { // Instructions that may have 16-bit or 32-bit branch targets. // The size of the branch offset might increase by two bytes. case Constants.GOTO: case Constants.JSR: maxOffsetChange = maxOffsetChange + 2; break; // Instructions that contain padding for alignment purposes // Up to three bytes of padding might be needed. For greater // accuracy, we should be able to discount any padding already // added to these instructions by InstructionList.setPosition(), // their APIs do not expose that information. case Constants.TABLESWITCH: case Constants.LOOKUPSWITCH: maxOffsetChange = maxOffsetChange + 3; break; // Instructions that might be rewritten by this method as a // conditional branch followed by an unconditional branch. // The unconditional branch would require five bytes. case Constants.IF_ACMPEQ: case Constants.IF_ACMPNE: case Constants.IF_ICMPEQ: case Constants.IF_ICMPGE: case Constants.IF_ICMPGT: case Constants.IF_ICMPLE: case Constants.IF_ICMPLT: case Constants.IF_ICMPNE: case Constants.IFEQ: case Constants.IFGE: case Constants.IFGT: case Constants.IFLE: case Constants.IFLT: case Constants.IFNE: case Constants.IFNONNULL: case Constants.IFNULL: maxOffsetChange = maxOffsetChange + 5; break; } } // Now that the maximum number of bytes by which the method might grow // has been determined, look for conditional branches to see which // might possibly exceed the 16-bit relative offset. for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) { Instruction inst = ih.getInstruction(); if (inst instanceof IfInstruction) { IfInstruction oldIfInst = (IfInstruction)inst; BranchHandle oldIfHandle = (BranchHandle)ih; InstructionHandle target = oldIfInst.getTarget(); int relativeTargetOffset = target.getPosition() - oldIfHandle.getPosition(); // Consider the worst case scenario in which the conditional // branch and its target are separated by all the instructions // in the method that might increase in size. If that results // in a relative offset that cannot be represented as a 32-bit // signed quantity, rewrite the instruction as described above. if ((relativeTargetOffset - maxOffsetChange < MIN_BRANCH_TARGET_OFFSET) || (relativeTargetOffset + maxOffsetChange > MAX_BRANCH_TARGET_OFFSET)) { // Invert the logic of the IF instruction, and append // that to the InstructionList following the original IF // instruction InstructionHandle nextHandle = oldIfHandle.getNext(); IfInstruction invertedIfInst = oldIfInst.negate(); BranchHandle invertedIfHandle = il.append(oldIfHandle, invertedIfInst); // Append an unconditional branch to the target of the // original IF instruction after the new IF instruction BranchHandle gotoHandle = il.append(invertedIfHandle, new GOTO(target)); // If the original IF was the last instruction in // InstructionList, add a new no-op to act as the target // of the new IF if (nextHandle == null) { nextHandle = il.append(gotoHandle, NOP); } // Make the new IF instruction branch around the GOTO invertedIfHandle.updateTarget(target, nextHandle); // If anything still "points" to the old IF instruction, // make adjustments to refer to either the new IF or GOTO // instruction if (oldIfHandle.hasTargeters()) { InstructionTargeter[] targeters = oldIfHandle.getTargeters(); for (int i = 0; i < targeters.length; i++) { InstructionTargeter targeter = targeters[i]; // Ideally, one should simply be able to use // InstructionTargeter.updateTarget to change // references to the old IF instruction to the new // IF instruction. However, if a LocalVariableGen // indicated the old IF marked the end of the range // in which the IF variable is in use, the live // range of the variable must extend to include the // newly created GOTO instruction. The need for // this sort of specific knowledge of an // implementor of the InstructionTargeter interface // makes the code more fragile. Future implementors // of the interface might have similar requirements // which wouldn't be accommodated seemlessly. if (targeter instanceof LocalVariableGen) { LocalVariableGen lvg = (LocalVariableGen) targeter; if (lvg.getStart() == oldIfHandle) { lvg.setStart(invertedIfHandle); } else if (lvg.getEnd() == oldIfHandle) { lvg.setEnd(gotoHandle); } } else { targeter.updateTarget(oldIfHandle, invertedIfHandle); } } } try { il.delete(oldIfHandle); } catch (TargetLostException tle) { // This can never happen - we updated the list of // instructions that target the deleted instruction // prior to deleting it. String msg = new ErrorMsg(ErrorMsg.OUTLINE_ERR_DELETED_TARGET, tle.getMessage()).toString(); throw new InternalError(msg); } // Adjust the pointer in the InstructionList to point after // the newly inserted IF instruction ih = gotoHandle; // Indicate that this method rewrote at least one IF ilChanged = true; } } } // Did this method rewrite any IF instructions? return ilChanged; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/IntType.java0000644000175000017500000002257710721374031025400 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFGE; import org.apache.bcel.generic.IFGT; import org.apache.bcel.generic.IFLE; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.IF_ICMPGE; import org.apache.bcel.generic.IF_ICMPGT; import org.apache.bcel.generic.IF_ICMPLE; import org.apache.bcel.generic.IF_ICMPLT; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionConstants; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class IntType extends NumberType { protected IntType() {} public String toString() { return "int"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return "I"; } public org.apache.bcel.generic.Type toJCType() { return org.apache.bcel.generic.Type.INT; } /** * @see org.apache.xalan.xsltc.compiler.util.Type#distanceTo */ public int distanceTo(Type type) { if (type == this) { return 0; } else if (type == Type.Real) { return 1; } else return Integer.MAX_VALUE; } /** * Translates an integer into an object of internal type type. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, final Type type) { if (type == Type.Real) { translateTo(classGen, methodGen, (RealType) type); } else if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType) type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects an integer on the stack and pushes a real. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { methodGen.getInstructionList().append(I2D); } /** * Expects an integer on the stack and pushes its string value by calling * Integer.toString(int i). * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(INTEGER_CLASS, "toString", "(I)" + STRING_SIG))); } /** * Expects an integer on the stack and pushes a 0 if its value is 0 and * a 1 otherwise. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); final BranchHandle falsec = il.append(new IFEQ(null)); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsec.setTarget(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); } /** * Expects an integer on the stack and translates it to a non-synthesized * boolean. It does not push a 0 or a 1 but instead returns branchhandle * list to be appended to the false list. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); return new FlowList(il.append(new IFEQ(null))); } /** * Expects an integer on the stack and pushes a boxed integer. * Boxed integers are represented by an instance of * java.lang.Integer. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(INTEGER_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new INVOKESPECIAL(cpg.addMethodref(INTEGER_CLASS, "", "(I)V"))); } /** * Translates an integer into the Java type denoted by clazz. * Expects an integer on the stack and pushes a number of the appropriate * type after coercion. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final InstructionList il = methodGen.getInstructionList(); if (clazz == Character.TYPE) { il.append(I2C); } else if (clazz == Byte.TYPE) { il.append(I2B); } else if (clazz == Short.TYPE) { il.append(I2S); } else if (clazz == Integer.TYPE) { il.append(NOP); } else if (clazz == Long.TYPE) { il.append(I2L); } else if (clazz == Float.TYPE) { il.append(I2F); } else if (clazz == Double.TYPE) { il.append(I2D); } // Is Double <: clazz? I.e. clazz in { Double, Number, Object } else if (clazz.isAssignableFrom(java.lang.Double.class)) { il.append(I2D); Type.Real.translateTo(classGen, methodGen, Type.Reference); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(INTEGER_CLASS))); final int index = cpg.addMethodref(INTEGER_CLASS, INT_VALUE, INT_VALUE_SIG); il.append(new INVOKEVIRTUAL(index)); } public Instruction ADD() { return InstructionConstants.IADD; } public Instruction SUB() { return InstructionConstants.ISUB; } public Instruction MUL() { return InstructionConstants.IMUL; } public Instruction DIV() { return InstructionConstants.IDIV; } public Instruction REM() { return InstructionConstants.IREM; } public Instruction NEG() { return InstructionConstants.INEG; } public Instruction LOAD(int slot) { return new ILOAD(slot); } public Instruction STORE(int slot) { return new ISTORE(slot); } public BranchInstruction GT(boolean tozero) { return tozero ? (BranchInstruction) new IFGT(null) : (BranchInstruction) new IF_ICMPGT(null); } public BranchInstruction GE(boolean tozero) { return tozero ? (BranchInstruction) new IFGE(null) : (BranchInstruction) new IF_ICMPGE(null); } public BranchInstruction LT(boolean tozero) { return tozero ? (BranchInstruction) new IFLT(null) : (BranchInstruction) new IF_ICMPLT(null); } public BranchInstruction LE(boolean tozero) { return tozero ? (BranchInstruction) new IFLE(null) : (BranchInstruction) new IF_ICMPLE(null); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_sl.java0000644000175000017500000011745410721374033027264 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_sl.java,v 1.25 2004/12/15 17:35:40 jycli Exp $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_sl extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "V isti datoteki je dolo\u010denih ve\u010d slogovnih datotek."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "Predloga ''{0}'' je \u017ee dolo\u010dena v tej slogovni datoteki."}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "Predloga ''{0}'' ni dolo\u010dena v tej slogovni datoteki."}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "Spremenljivka ''{0}'' je ve\u010dkrat dolo\u010dena znotraj istega obsega."}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "Spremenljivka ali parameter ''{0}'' je nedolo\u010den."}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "Ni mogo\u010de najti razreda ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "Zunanje metode ''{0}'' ni mogo\u010de najti (mora biti javna)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "Ni mogo\u010de pretvoriti argumenta / tipa vrnitve v klicu metode ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "Datoteke ali URI-ja ''{0}'' ni mogo\u010de najti."}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "Neveljaven URI ''{0}''."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "Datoteke ali URI-ja ''{0}'' ni mogo\u010de odpreti."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "Pri\u010dakovan element ali ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "Predpona imenskega prostora ''{0}'' ni dolo\u010dena."}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "Klica funkcije ''{0}'' ni mogo\u010de razre\u0161iti."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "Argument za ''{0}'' mora biti dobesedni niz."}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Napaka pri raz\u010dlenjevanju izraza XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Manjka zahtevani atribut ''{0}''."}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "Neveljavni znak ''{0}'' v izrazu XPath."}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "Neveljavno ime ''{0}'' za navodila za obdelavo."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "Atribut ''{0}'' zunaj elementa."}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Neveljaven atribut ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Kro\u017eni uvoz/vklju\u010ditev. Slogovna datoteka ''{0}'' je \u017ee nalo\u017eena."}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Ne morem razvrstiti fragmentov drevesa rezultatov (elementi so prezrti). Pri pripravi drevesa rezultatov morate razvrstiti vozli\u0161\u010da."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "Decimalno oblikovanje ''{0}'' je \u017ee dolo\u010deno."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSL razli\u010dice ''{0}'' XSLTC ne podpira."}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Sklic na kro\u017eno spremenljivko/parameter v ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "Neznan operator za binarni izraz."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "Neveljavni argument(i) za klic funkcije."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "Drugi argument funkcije document() mora biti skupina vozli\u0161\u010d."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Zahtevan vsaj en element v ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Dovoljen samo en element v ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " lahko uporabljamo samo znotraj ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " lahko uporabljamo samo znotraj ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "V sta dovoljena samo elementa in ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "V manjka atribut 'name'."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "Neveljavni podrejeni element."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "Elementa ''{0}'' ni mogo\u010de poklicati"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "Atributa ''{0}'' ni mogo\u010de poklicati"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Tekstovni podatki zunaj elementa na najvi\u0161ji ravni ."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "Raz\u010dlenjevalnik JAXP ni pravilno konfiguriran"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "Nepopravljiva XSLTC-notranja napaka: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "Nepodprt XSL element ''{0}''."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "Neprepoznana pripona XSLTC ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "Vhodni dokument ni slogovna datoteka (v korenskem elementu ni naveden imenski prostor XSL)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "Cilja slogovne datoteke ''{0}'' ni mogo\u010de najti."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "Ni izvedeno: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "Vhodni dokument ne vsebuje slogovne datoteke XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "Elementa ''{0}'' ni mogo\u010de raz\u010dleniti"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "Atribut uporabe za mora biti vozli\u0161\u010de, skupina vozli\u0161\u010d, niz ali \u0161tevilka."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "Razli\u010dica izhodnega dokumenta XML mora biti 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "Neznan operator za relacijski izraz"}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "Poskus uporabe neobstoje\u010de skupine atributov ''{0}''."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "Predloge vrednosti atributa ''{0}'' ni mogo\u010de raz\u010dleniti."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "V podpisu za razred ''{0}'' je neznan podatkovni tip."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "Ni mogo\u010de pretvoriti podatkovnega tipa ''{0}'' v ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Te Templates ne vsebujejo veljavne definicije razreda translet."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Te predloge ne vsebujejo razreda z imenom ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "Ni mogo\u010de nalo\u017eiti razreda transleta ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "Razred transleta je nalo\u017een, vendar priprava primerka transleta ni mogo\u010da."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "Poskus nastavitve ErrorListener za ''{0}'' na null"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC podpira samo StreamSource, SAXSource in DOMSource"}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "Predmet Source, ki je bil podan z ''{0}'', nima vsebine."}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "Ni mogo\u010de prevesti slogovne datoteke"}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory ne prepozna atributa ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "Klic za setResult() mora biti izveden pred klicem startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer ne vsebuje enkapsuliranih translet objektov."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "Za rezultat transformacije ni izhodne obravnave."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "Rezultat, ki je bil posredovan ''{0}'', je neveljaven."}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "Poskus dostopa do neveljavne lastnosti (property) Transformer ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "Ni mogo\u010de ustvariti adapterja SAX2DOM: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "Klic XSLTCSource.build() brez predhodne nastavitve systemId."}, { ErrorMsg.ER_RESULT_NULL, "Rezultat naj ne bi bil NULL"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "Vrednost parametra {0} mora biti veljaven javanski objekt"}, {ErrorMsg.COMPILE_STDIN_ERR, "Mo\u017enost -i mora biti uporabljena skupaj z mo\u017enostjo -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "SYNOPSIS\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPTIONS\n -o dodeli ime generiranemu\n transletu. Ime transleta se po privzetih nastavitvah\n izpelje iz imena . Pri prevajanju\n ve\u010d slogovnih datotek je ta mo\u017enost prezrta.\n -d dolo\u010di ciljno mapo za translet\n -j zdru\u017ei razrede translet v datoteko jar\n pod imenom, dolo\u010denim z \n -p dolo\u010di predpono imena paketa vsem generiranim\n razredom translet.\n -n omogo\u010da vrivanje predlog (v povpre\u010dju bolj\u0161e privzeto\n obna\u0161anje).\n -x vklopi dodatna izhodna sporo\u010dila za iskanje napak\n -u prevede argumente kot URL-je\n -i prisili prevajalnik k branju slogovne datoteke iz stdin\n -v natisne razli\u010dico prevajalnika\n -h natisne ta stavek za uporabo\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "SYNOPSIS \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n uporablja translet za pretvorbo dokumenta XML \n navedenega kot . Translet je ali v\n uporabnikovem CLASSPATH ali v izbirno navedeni datoteki .\nOPTIONS\n -j dolo\u010di datoteko jar, iz katere bo nalo\u017een translet\n -x vklopi dodatna sporo\u010dila za iskanje napak\n n -krat po\u017eene preoblikovanje in\n prika\u017ee informacije profiliranja\n -u dolo\u010di vhodni dokument XML za URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " je mogo\u010de uporabljati samo znotraj ali ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "Ta JVM ne podpira izhodnega kodiranja ''{0}''."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "Napaka v sintaksi v ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "Ni mogo\u010de najti zunanjega konstruktorja ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "Prvi argument nestati\u010dne (non-static) javanske funkcije ''{0}'' ni veljaven sklic na objekt."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "Napaka pri preverjanju tipa izraza ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "Napaka pri preverjanju tipa izraza na neznani lokaciji."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "Mo\u017enost ukazne vrstice ''{0}'' ni veljavna."}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "Mo\u017enosti ukazne vrstice ''{0}'' manjka zahtevani argument."}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "OPOZORILO: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "OPOZORILO: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "USODNA NAPAKA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "USODNA NAPAKA: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "USODNA NAPAKA: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "NAPAKA: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Pretvorba z uporabo transleta ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Pretvorba z uporabo transleta ''{0}'' iz datoteke jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "Ni mogo\u010de ustvariti primerka razreda TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "Imena ''{0}'' ni bilo mogo\u010de uporabiti kot ime razreda translet, saj vsebuje znake, ki v imenu javanskega razreda niso dovoljeni. Uporabljeno je bilo ime ''{1}''."}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Napake prevajalnika:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Opozorila prevajalnika:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Napake transleta:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Atribut, katerega vrednost mora biti vrednost QName ali s presledki lo\u010den seznam vrednosti Qname, je imel vrednost ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Atribut, katerega vrednost mora biti NCName, je imel vrednost ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "Atribut metode elementa je imel vrednost ''{0}''. Vrednost mora biti ena izmed ''xml'', ''html'', ''text'', ali qname-but-not-ncname (qname, vendar pa ne ncname)"}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "Ime funkcije ne sme biti null v TransformerFactory.getFeature(Ime niza)."}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "Ime funkcije ne sme biti null v TransformerFactory.getFeature(Ime niza, boolova vrednost)."}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "Ni mogo\u010de nastaviti funkcije ''{0}'' v tem TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/MultiHashtable.java0000644000175000017500000000335310721374030026700 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MultiHashtable.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.Hashtable; import java.util.Vector; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class MultiHashtable extends Hashtable { static final long serialVersionUID = -6151608290510033572L; public Object put(Object key, Object value) { Vector vector = (Vector)get(key); if (vector == null) super.put(key, vector = new Vector()); vector.add(value); return vector; } public Object maps(Object from, Object to) { if (from == null) return null; final Vector vector = (Vector) get(from); if (vector != null) { final int n = vector.size(); for (int i = 0; i < n; i++) { final Object item = vector.elementAt(i); if (item.equals(to)) { return item; } } } return null; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ObjectFactory.java0000644000175000017500000006377710721374032026552 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468649 2006-10-28 07:00:55Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -4417969773510154215L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NumberType.java0000644000175000017500000000224410721374031026063 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NumberType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class NumberType extends Type { public boolean isNumber() { return true; } public boolean isSimple() { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages_ca.java0000644000175000017500000012117010721374032027216 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ca.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ca extends ListResourceBundle { /* * XSLTC compile-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for "XSLT Compiler". * XSLT is an acronym for "XML Stylesheet Language: Transformations". * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 5) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 6) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 7) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 8) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 9) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 10) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * * 11) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {ErrorMsg.MULTIPLE_STYLESHEET_ERR, "S'ha definit m\u00e9s d'un full d'estils en el mateix fitxer."}, /* * Note to translators: The substitution text is the name of a * template. The same name was used on two different templates in the * same stylesheet. */ {ErrorMsg.TEMPLATE_REDEF_ERR, "La plantilla ''{0}'' ja est\u00e0 definida en aquest full d''estil. "}, /* * Note to translators: The substitution text is the name of a * template. A reference to the template name was encountered, but the * template is undefined. */ {ErrorMsg.TEMPLATE_UNDEF_ERR, "La plantilla ''{0}'' no est\u00e0 definida en aquest full d''estil. "}, /* * Note to translators: The substitution text is the name of a variable * that was defined more than once. */ {ErrorMsg.VARIABLE_REDEF_ERR, "La variable ''{0}'' s''ha definit m\u00e9s d''una vegada en el mateix \u00e0mbit. "}, /* * Note to translators: The substitution text is the name of a variable * or parameter. A reference to the variable or parameter was found, * but it was never defined. */ {ErrorMsg.VARIABLE_UNDEF_ERR, "La variable o el par\u00e0metre ''{0}'' no s''ha definit. "}, /* * Note to translators: The word "class" here refers to a Java class. * Processing the stylesheet required a class to be loaded, but it could * not be found. The substitution text is the name of the class. */ {ErrorMsg.CLASS_NOT_FOUND_ERR, "No es pot trobar la classe ''{0}''."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but it could not be found. "public" is the * Java keyword. */ {ErrorMsg.METHOD_NOT_FOUND_ERR, "No es pot trobar el m\u00e8tode extern ''{0}'' (ha de ser p\u00fablic)."}, /* * Note to translators: The word "method" here refers to a Java method. * Processing the stylesheet required a reference to the method named by * the substitution text, but no method with the required types of * arguments or return type could be found. */ {ErrorMsg.ARGUMENT_CONVERSION_ERR, "No es pot convertir el tipus d''argument/retorn en la crida al m\u00e8tode ''{0}''"}, /* * Note to translators: The file or URI named in the substitution text * is missing. */ {ErrorMsg.FILE_NOT_FOUND_ERR, "No s''ha trobat el fitxer o URI ''{0}''. "}, /* * Note to translators: This message is displayed when the URI * mentioned in the substitution text is not well-formed syntactically. */ {ErrorMsg.INVALID_URI_ERR, "L''URI ''{0}'' no \u00e9s v\u00e0lid."}, /* * Note to translators: The file or URI named in the substitution text * exists but could not be opened. */ {ErrorMsg.FILE_ACCESS_ERR, "No es pot obrir el fitxer o URI ''{0}''."}, /* * Note to translators: and are * keywords that should not be translated. */ {ErrorMsg.MISSING_ROOT_ERR, "S'esperava l'element o ."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {ErrorMsg.NAMESPACE_UNDEF_ERR, "No s''ha declarat el prefix de l''espai de noms ''{0}''. "}, /* * Note to translators: The Java function named in the stylesheet could * not be found. */ {ErrorMsg.FUNCTION_RESOLVE_ERR, "No es pot resoldre la crida a la funci\u00f3 ''{0}''."}, /* * Note to translators: The substitution text is the name of a * function. A literal string here means a constant string value. */ {ErrorMsg.NEED_LITERAL_ERR, "L''argument de ''{0}'' ha de ser una cadena de literals. "}, /* * Note to translators: This message indicates there was a syntactic * error in the form of an XPath expression. The substitution text is * the expression. */ {ErrorMsg.XPATH_PARSER_ERR, "Error en analitzar l''expressi\u00f3 XPath ''{0}''."}, /* * Note to translators: An element in the stylesheet requires a * particular attribute named by the substitution text, but that * attribute was not specified in the stylesheet. */ {ErrorMsg.REQUIRED_ATTR_ERR, "Falta l''atribut obligatori ''{0}''. "}, /* * Note to translators: This message indicates that a character not * permitted in an XPath expression was encountered. The substitution * text is the offending character. */ {ErrorMsg.ILLEGAL_CHAR_ERR, "L''expressi\u00f3 XPath cont\u00e9 el car\u00e0cter no perm\u00e8s ''{0}''. "}, /* * Note to translators: A processing instruction is a mark-up item in * an XML document that request some behaviour of an XML processor. The * form of the name of was invalid in this case, and the substitution * text is the name. */ {ErrorMsg.ILLEGAL_PI_ERR, "La instrucci\u00f3 de proc\u00e9s cont\u00e9 el nom no perm\u00e8s ''{0}''. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {ErrorMsg.STRAY_ATTRIBUTE_ERR, "L''atribut ''{0}'' es troba fora de l''element. "}, /* * Note to translators: An attribute that wasn't recognized was * specified on an element in the stylesheet. The attribute is named * by the substitution * text. */ {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, "Atribut no perm\u00e8s ''{0}''."}, /* * Note to translators: "import" and "include" are keywords that should * not be translated. This messages indicates that the stylesheet * named in the substitution text imported or included itself either * directly or indirectly. */ {ErrorMsg.CIRCULAR_INCLUDE_ERR, "Import/include circular. El full d''estil ''{0}'' ja s''ha carregat. "}, /* * Note to translators: A result-tree fragment is a portion of a * resulting XML document represented as a tree. "" is a * keyword and should not be translated. */ {ErrorMsg.RESULT_TREE_SORT_ERR, "Els fragments de l'arbre de resultats no es poden classificar (es passen per alt els elements ). Heu de classificar els nodes quan creeu l'arbre de resultats."}, /* * Note to translators: A name can be given to a particular style to be * used to format decimal values. The substitution text gives the name * of such a style for which more than one declaration was encountered. */ {ErrorMsg.SYMBOLS_REDEF_ERR, "El formatatge decimal ''{0}'' ja est\u00e0 definit."}, /* * Note to translators: The stylesheet version named in the * substitution text is not supported. */ {ErrorMsg.XSL_VERSION_ERR, "XSLTC no d\u00f3na suport a la versi\u00f3 XSL ''{0}''. "}, /* * Note to translators: The definitions of one or more variables or * parameters depend on one another. */ {ErrorMsg.CIRCULAR_VARIABLE_ERR, "Hi ha una refer\u00e8ncia de variable/par\u00e0metre circular a ''{0}''."}, /* * Note to translators: The operator in an expresion with two operands was * not recognized. */ {ErrorMsg.ILLEGAL_BINARY_OP_ERR, "L'operador de l'expressi\u00f3 bin\u00e0ria \u00e9s desconegut."}, /* * Note to translators: This message is produced if a reference to a * function has too many or too few arguments. */ {ErrorMsg.ILLEGAL_ARG_ERR, "La crida de funci\u00f3 t\u00e9 arguments no permesos."}, /* * Note to translators: "document()" is the name of function and must * not be translated. A node-set is a set of the nodes in the tree * representation of an XML document. */ {ErrorMsg.DOCUMENT_ARG_ERR, "El segon argument de la funci\u00f3 document() ha de ser un conjunt de nodes."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.MISSING_WHEN_ERR, "Es necessita com a m\u00ednim un element a ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.MULTIPLE_OTHERWISE_ERR, "Nom\u00e9s es permet un element a ."}, /* * Note to translators: "" and "" are * keywords and should not be translated. This message describes a * syntax error in the stylesheet. */ {ErrorMsg.STRAY_OTHERWISE_ERR, " nom\u00e9s es pot utilitzar dins de ."}, /* * Note to translators: "" and "" are keywords * and should not be translated. This message describes a syntax error * in the stylesheet. */ {ErrorMsg.STRAY_WHEN_ERR, " nom\u00e9s es pot utilitzar dins de ."}, /* * Note to translators: "", "" and * "" are keywords and should not be translated. This * message describes a syntax error in the stylesheet. */ {ErrorMsg.WHEN_ELEMENT_ERR, "A nom\u00e9s es permeten els elements i ."}, /* * Note to translators: "" and "name" are keywords * that should not be translated. */ {ErrorMsg.UNNAMED_ATTRIBSET_ERR, "L'atribut 'name' falta a ."}, /* * Note to translators: An element in the stylesheet contained an * element of a type that it was not permitted to contain. */ {ErrorMsg.ILLEGAL_CHILD_ERR, "L'element subordinat no \u00e9s perm\u00e8s."}, /* * Note to translators: The stylesheet tried to create an element with * a name that was not a valid XML name. The substitution text contains * the name. */ {ErrorMsg.ILLEGAL_ELEM_NAME_ERR, "No podeu cridar un element ''{0}''"}, /* * Note to translators: The stylesheet tried to create an attribute * with a name that was not a valid XML name. The substitution text * contains the name. */ {ErrorMsg.ILLEGAL_ATTR_NAME_ERR, "No podeu cridar un atribut ''{0}''"}, /* * Note to translators: The children of the outermost element of a * stylesheet are referred to as top-level elements. No text should * occur within that outermost element unless it is within a top-level * element. This message indicates that that constraint was violated. * "" is a keyword that should not be translated. */ {ErrorMsg.ILLEGAL_TEXT_NODE_ERR, "Hi ha dades fora de l'element de nivell superior ."}, /* * Note to translators: JAXP is an acronym for the Java API for XML * Processing. This message indicates that the XML parser provided to * XSLTC to process the XML input document had a configuration problem. */ {ErrorMsg.SAX_PARSER_CONFIG_ERR, "L'analitzador JAXP no s'ha configurat correctament"}, /* * Note to translators: The substitution text names the internal error * encountered. */ {ErrorMsg.INTERNAL_ERR, "S''ha produ\u00eft un error intern d''XSLTC irrecuperable: ''{0}''"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {ErrorMsg.UNSUPPORTED_XSL_ERR, "L''element XSL ''{0}'' no t\u00e9 suport."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSTLC does * not recognized the particular extension named. The substitution text * gives the extension name. */ {ErrorMsg.UNSUPPORTED_EXT_ERR, "No es reconeix l''extensi\u00f3 XSLTC ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. XSLTC is able to detect that in this * case because the outermost element in the stylesheet has to be * declared with respect to the XSL namespace URI, but no declaration * for that namespace was seen. */ {ErrorMsg.MISSING_XSLT_URI_ERR, "El document d'entrada no \u00e9s un full d'estils (l'espai de noms XSL no s'ha declarat en l'element arrel)."}, /* * Note to translators: XSLTC could not find the stylesheet document * with the name specified by the substitution text. */ {ErrorMsg.MISSING_XSLT_TARGET_ERR, "No s''ha pogut trobar la destinaci\u00f3 del full d''estil ''{0}''."}, /* * Note to translators: This message represents an internal error in * condition in XSLTC. The substitution text is the class name in XSLTC * that is missing some functionality. */ {ErrorMsg.NOT_IMPLEMENTED_ERR, "No s''ha implementat: ''{0}''."}, /* * Note to translators: The XML document given to XSLTC as a stylesheet * was not, in fact, a stylesheet. */ {ErrorMsg.NOT_STYLESHEET_ERR, "El document d'entrada no cont\u00e9 cap full d'estils XSL."}, /* * Note to translators: The element named in the substitution text was * encountered in the stylesheet but is not recognized. */ {ErrorMsg.ELEMENT_PARSE_ERR, "No s''ha pogut analitzar l''element ''{0}''"}, /* * Note to translators: "use", "", "node", "node-set", "string" * and "number" are keywords in this context and should not be * translated. This message indicates that the value of the "use" * attribute was not one of the permitted values. */ {ErrorMsg.KEY_USE_ATTR_ERR, "L'atribut use de ha de ser node, node-set, string o number."}, /* * Note to translators: An XML document can specify the version of the * XML specification to which it adheres. This message indicates that * the version specified for the output document was not valid. */ {ErrorMsg.OUTPUT_VERSION_ERR, "La versi\u00f3 del document XML de sortida ha de ser 1.0"}, /* * Note to translators: The operator in a comparison operation was * not recognized. */ {ErrorMsg.ILLEGAL_RELAT_OP_ERR, "L'operador de l'expressi\u00f3 relacional \u00e9s desconegut."}, /* * Note to translators: An attribute set defines as a set of XML * attributes that can be added to an element in the output XML document * as a group. This message is reported if the name specified was not * used to declare an attribute set. The substitution text is the name * that is in error. */ {ErrorMsg.ATTRIBSET_UNDEF_ERR, "S''ha intentat utilitzar el conjunt d''atributs ''{0}'' que no existeix."}, /* * Note to translators: The term "attribute value template" is a term * defined by XSLT which describes the value of an attribute that is * determined by an XPath expression. The message indicates that the * expression was syntactically incorrect; the substitution text * contains the expression that was in error. */ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR, "No es pot analitzar la plantilla del valor d''atribut ''{0}''."}, /* * Note to translators: ??? */ {ErrorMsg.UNKNOWN_SIG_TYPE_ERR, "Es desconeix el tipus de dades de la signatura de la classe ''{0}''."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of * type {0}. */ {ErrorMsg.DATA_CONVERSION_ERR, "No es pot convertir el tipus de dades ''{0}'' a ''{1}''."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_TRANSLET_CLASS_ERR, "Templates no cont\u00e9 cap definici\u00f3 de classe translet."}, /* * Note to translators: "Templates" is a Java class name that should * not be translated. */ {ErrorMsg.NO_MAIN_TRANSLET_ERR, "Templates no cont\u00e9 cap classe amb el nom ''{0}''."}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSLET_CLASS_ERR, "No s''ha pogut carregar la classe translet ''{0}''."}, {ErrorMsg.TRANSLET_OBJECT_ERR, "La classe translet s'ha carregat, per\u00f2 no s'ha pogut crear la inst\u00e0ncia translet."}, /* * Note to translators: "ErrorListener" is a Java interface name that * should not be translated. The message indicates that the user tried * to set an ErrorListener object on object of the class named in the * substitution text with "null" Java value. */ {ErrorMsg.ERROR_LISTENER_NULL_ERR, "S''ha intentat establir ErrorListener de ''{0}'' en nul"}, /* * Note to translators: StreamSource, SAXSource and DOMSource are Java * interface names that should not be translated. */ {ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR, "XSLTC nom\u00e9s d\u00f3na suport a StreamSource, SAXSource i DOMSource."}, /* * Note to translators: "Source" is a Java class name that should not * be translated. The substitution text is the name of Java method. */ {ErrorMsg.JAXP_NO_SOURCE_ERR, "L''objecte source passat a ''{0}'' no t\u00e9 contingut. "}, /* * Note to translators: The message indicates that XSLTC failed to * compile the stylesheet into a translet (class file). */ {ErrorMsg.JAXP_COMPILE_ERR, "No s'ha pogut compilar el full d'estils."}, /* * Note to translators: "TransformerFactory" is a class name. In this * context, an attribute is a property or setting of the * TransformerFactory object. The substitution text is the name of the * unrecognised attribute. The method used to retrieve the attribute is * "getAttribute", so it's not clear whether it would be best to * translate the term "attribute". */ {ErrorMsg.JAXP_INVALID_ATTR_ERR, "TransformerFactory no reconeix l''atribut ''{0}''."}, /* * Note to translators: "setResult()" and "startDocument()" are Java * method names that should not be translated. */ {ErrorMsg.JAXP_SET_RESULT_ERR, "setResult() s'ha de cridar abans de startDocument()."}, /* * Note to translators: "Transformer" is a Java interface name that * should not be translated. A Transformer object should contained a * reference to a translet object in order to be used for * transformations; this message is produced if that requirement is not * met. */ {ErrorMsg.JAXP_NO_TRANSLET_ERR, "Transformer no cont\u00e9 cap objecte translet."}, /* * Note to translators: The XML document that results from a * transformation needs to be sent to an output handler object; this * message is produced if that requirement is not met. */ {ErrorMsg.JAXP_NO_HANDLER_ERR, "No s'ha definit cap manejador de sortida per al resultat de transformaci\u00f3."}, /* * Note to translators: "Result" is a Java interface name in this * context. The substitution text is a method name. */ {ErrorMsg.JAXP_NO_RESULT_ERR, "L''objecte result passat a ''{0}'' no \u00e9s v\u00e0lid. "}, /* * Note to translators: "Transformer" is a Java interface name. The * user's program attempted to access an unrecognized property with the * name specified in the substitution text. The method used to retrieve * the property is "getOutputProperty", so it's not clear whether it * would be best to translate the term "property". */ {ErrorMsg.JAXP_UNKNOWN_PROP_ERR, "S''ha intentat accedir a una propietat Transformer no v\u00e0lida ''{0}''."}, /* * Note to translators: SAX2DOM is the name of a Java class that should * not be translated. This is an adapter in the sense that it takes a * DOM object and converts it to something that uses the SAX API. */ {ErrorMsg.SAX2DOM_ADAPTER_ERR, "No s''ha pogut crear l''adaptador SAX2DOMr: ''{0}''."}, /* * Note to translators: "XSLTCSource.build()" is a Java method name. * "systemId" is an XML term that is short for "system identification". */ {ErrorMsg.XSLTC_SOURCE_ERR, "S'ha cridat XSLTCSource.build() sense que s'hagu\u00e9s establert la identificaci\u00f3 del sistema."}, { ErrorMsg.ER_RESULT_NULL, "El resultat no ha de ser nul"}, /* * Note to translators: This message indicates that the value argument * of setParameter must be a valid Java Object. */ {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, "El valor del par\u00e0metre {0} ha de ser un objecte Java v\u00e0lid "}, {ErrorMsg.COMPILE_STDIN_ERR, "L'opci\u00f3 -i s'ha d'utilitzar amb l'opci\u00f3 -o."}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java package, so * it should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.COMPILE_USAGE_STR, "RESUM\n java org.apache.xalan.xsltc.cmdline.Compile [-o ]\n [-d ] [-j ] [-p ]\n [-n] [-x] [-u] [-v] [-h] { | -i }\n\nOPCIONS\n -o assigna el nom al translet\n generat. Per defecte, el nom del translet s'obt\u00e9\n del nom de . Aquesta opci\u00f3\n no es t\u00e9 en compte si es compilen diversos fulls d'estils.\n -d especifica un directori de destinaci\u00f3 per al translet\n -j empaqueta les classes translet en un fitxer jar del nom\n especificat com a \n -p especifica un prefix de nom de paquet per a totes les classes\n translet generades.\n -n habilita l'inlining (com a mitjana, el funcionament per defecte\n \u00e9s millor).\n -x habilita la sortida de missatges de depuraci\u00f3 addicionals\n -u interpreta els arguments del com URL\n -i obliga el compilador a llegir el full d'estil des de l'entrada est\u00e0ndardn\n -v imprimeix la versi\u00f3 del compilador\n -h imprimeix aquesta sent\u00e8ncia d'\u00fas\n"}, /* * Note to translators: This message contains usage information for a * means of invoking XSLTC from the command-line. The message is * formatted for presentation in English. The strings , * , etc. indicate user-specified argument values, and can * be translated - the argument refers to a Java class, so it * should be handled in the same way the term is handled for JDK * documentation. */ {ErrorMsg.TRANSFORM_USAGE_STR, "RESUM \n java org.apache.xalan.xsltc.cmdline.Transform [-j ]\n [-x] [-n ] {-u | }\n [= ...]\n\n fa servir la translet per transformar un document XML \n especificat com . La translet es troba\n o b\u00e9 a la CLASSPATH de l'usuari o b\u00e9 al que es pot especificar opcionalment.\nOPCIONS\n -j especifica un fitxer jar des del qual es carrega la classe translet\n -x habilita la sortida de missatges de depuraci\u00f3 addicionals \n -n executa la transformaci\u00f3 el nombre de vegades i\n mostra la informaci\u00f3 de perfil\n -u especifica el document d'entrada XML com una URL\n"}, /* * Note to translators: "", "" and * "" are keywords that should not be translated. * The message indicates that an xsl:sort element must be a child of * one of the other kinds of elements mentioned. */ {ErrorMsg.STRAY_SORT_ERR, " nom\u00e9s es pot utilitzar amb o ."}, /* * Note to translators: The message indicates that the encoding * requested for the output document was on that requires support that * is not available from the Java Virtual Machine being used to execute * the program. */ {ErrorMsg.UNSUPPORTED_ENCODING, "A aquesta JVM, no es d\u00f3na suport a la codificaci\u00f3 de sortida ''{0}''."}, /* * Note to translators: The message indicates that the XPath expression * named in the substitution text was not well formed syntactically. */ {ErrorMsg.SYNTAX_ERR, "S''ha produ\u00eft un error de sintaxi a ''{0}''."}, /* * Note to translators: The substitution text is the name of a Java * class. The term "constructor" here is the Java term. The message is * displayed if XSLTC could not find a constructor for the specified * class. */ {ErrorMsg.CONSTRUCTOR_NOT_FOUND, "No es pot trobar el constructor extern ''{0}''."}, /* * Note to translators: "static" is the Java keyword. The substitution * text is the name of a function. The first argument of that function * is not of the required type. */ {ErrorMsg.NO_JAVA_FUNCT_THIS_REF, "El primer argument de la funci\u00f3 Java no static ''{0}'' no \u00e9s una refer\u00e8ncia d''objecte v\u00e0lida. "}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. The substitution text is the * expression that was in error. */ {ErrorMsg.TYPE_CHECK_ERR, "S''ha produ\u00eft un error en comprovar el tipus de l''expressi\u00f3 ''{0}''."}, /* * Note to translators: An XPath expression was not of the type * required in a particular context. However, the location of the * problematic expression is unknown. */ {ErrorMsg.TYPE_CHECK_UNK_LOC_ERR, "S'ha produ\u00eft un error en comprovar el tipus d'expressi\u00f3 en una ubicaci\u00f3 desconeguda."}, /* * Note to translators: The substitution text is the name of a command- * line option that was not recognized. */ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR, "L''opci\u00f3 de l\u00ednia d''ordres ''{0}'' no \u00e9s v\u00e0lida. "}, /* * Note to translators: The substitution text is the name of a command- * line option. */ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR, "A l''opci\u00f3 de l\u00ednia d''ordres ''{0}'' falta un argument obligatori. "}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG, "AV\u00cdS: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.WARNING_MSG, "AV\u00cdS: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, "ERROR MOLT GREU: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.FATAL_ERR_MSG, "ERROR MOLT GREU: ''{0}''"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text contains two error * messages. The spacing before the second substitution text indents * it the same amount as the first in English. */ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG, "ERROR: ''{0}''\n :{1}"}, /* * Note to translators: This message is used to indicate the severity * of another message. The substitution text is an error message. */ {ErrorMsg.ERROR_MSG, "ERROR: ''{0}''"}, /* * Note to translators: The substitution text is the name of a class. */ {ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, "Transformaci\u00f3 mitjan\u00e7ant la classe translet ''{0}'' "}, /* * Note to translators: The first substitution is the name of a class, * while the second substitution is the name of a jar file. */ {ErrorMsg.TRANSFORM_WITH_JAR_STR, "Transformaci\u00f3 mitjan\u00e7ant la classe translet ''{0}'' des del fitxer jar ''{1}''"}, /* * Note to translators: "TransformerFactory" is the name of a Java * interface and must not be translated. The substitution text is * the name of the class that could not be instantiated. */ {ErrorMsg.COULD_NOT_CREATE_TRANS_FACT, "No s''ha pogut crear una inst\u00e0ncia de la classe TransformerFactory ''{0}''."}, /* * Note to translators: This message is produced when the user * specified a name for the translet class that contains characters * that are not permitted in a Java class name. The substitution * text "{0}" specifies the name the user requested, while "{1}" * specifies the name the processor used instead. */ {ErrorMsg.TRANSLET_NAME_JAVA_CONFLICT, "El nom ''{0}'' no s''ha pogut fer servir com nom de la classe translet perqu\u00e8 cont\u00e9 car\u00e0cters que no estan permesos al nom de la classe Java. En lloc d''aix\u00f2, es va fer servir el nom ''{1}''. "}, /* * Note to translators: The following message is used as a header. * All the error messages are collected together and displayed beneath * this message. */ {ErrorMsg.COMPILER_ERROR_KEY, "Errors del compilador:"}, /* * Note to translators: The following message is used as a header. * All the warning messages are collected together and displayed * beneath this message. */ {ErrorMsg.COMPILER_WARNING_KEY, "Avisos del compilador:"}, /* * Note to translators: The following message is used as a header. * All the error messages that are produced when the stylesheet is * applied to an input document are collected together and displayed * beneath this message. A 'translet' is the compiled form of a * stylesheet (see above). */ {ErrorMsg.RUNTIME_ERROR_KEY, "Errors del translet:"}, /* * Note to translators: An attribute whose value is constrained to * be a "QName" or a list of "QNames" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_QNAME_ERR, "Un atribut que ha de tenir el valor QName o una llista separada per espais de QNames tenia el valor ''{0}''"}, /* * Note to translators: An attribute whose value is required to * be an "NCName". * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {ErrorMsg.INVALID_NCNAME_ERR, "Un atribut, que ha de tenir el valor NCName, tenia el valor ''{0}''"}, /* * Note to translators: An attribute with an incorrect value was * encountered. The permitted value is one of the literal values * "xml", "html" or "text"; it is also permitted to have the form of * a QName that is not also an NCName. The terms "method", * "xsl:output", "xml", "html" and "text" are keywords that must not * be translated. The term "qname-but-not-ncname" is an XML syntactic * term. The substitution text contains the actual value of the * attribute. */ {ErrorMsg.INVALID_METHOD_IN_OUTPUT, "L''atribut del m\u00e8tode d''un element tenia el valor ''{0}''. El valor ha de ser un de ''xml'', ''html'', ''text'', o ncname per\u00f2 no qname "}, {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME, "El nom de la caracter\u00edstica no pot ser nul a TransformerFactory.getFeature(nom de cadena). "}, {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME, "El nom de la caracter\u00edstica no pot ser nul a TransformerFactory.setFeature(nom de la cadena, valor boole\u00e0). "}, {ErrorMsg.JAXP_UNSUPPORTED_FEATURE, "No es pot establir la caracter\u00edstica ''{0}'' en aquesta TransformerFactory."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/NodeType.java0000644000175000017500000002502410721374031025521 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; import org.apache.xalan.xsltc.compiler.NodeTest; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class NodeType extends Type { private final int _type; protected NodeType() { this(NodeTest.ANODE); } protected NodeType(int type) { _type = type; } public int getType() { return _type; } public String toString() { return "node-type"; } public boolean identicalTo(Type other) { return other instanceof NodeType; } public int hashCode() { return _type; } public String toSignature() { return "I"; } public org.apache.bcel.generic.Type toJCType() { return org.apache.bcel.generic.Type.INT; } /** * Translates a node into an object of internal type type. * The translation to int is undefined since nodes are always converted * to reals in arithmetic expressions. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType) type); } else if (type == Type.Real) { translateTo(classGen, methodGen, (RealType) type); } else if (type == Type.NodeSet) { translateTo(classGen, methodGen, (NodeSetType) type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType) type); } else if (type == Type.Object) { translateTo(classGen, methodGen, (ObjectType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects a node on the stack and pushes its string value. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); switch (_type) { case NodeTest.ROOT: case NodeTest.ELEMENT: il.append(methodGen.loadDOM()); il.append(SWAP); // dom ref must be below node index int index = cpg.addInterfaceMethodref(DOM_INTF, GET_ELEMENT_VALUE, GET_ELEMENT_VALUE_SIG); il.append(new INVOKEINTERFACE(index, 2)); break; case NodeTest.ANODE: case NodeTest.COMMENT: case NodeTest.ATTRIBUTE: case NodeTest.PI: il.append(methodGen.loadDOM()); il.append(SWAP); // dom ref must be below node index index = cpg.addInterfaceMethodref(DOM_INTF, GET_NODE_VALUE, GET_NODE_VALUE_SIG); il.append(new INVOKEINTERFACE(index, 2)); break; default: ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); break; } } /** * Translates a node into a synthesized boolean. * If the expression is "@attr", * then "true" is pushed iff "attr" is an attribute of the current node. * If the expression is ".", the result is always "true". * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); } /** * Expects a node on the stack and pushes a real. * First the node is converted to string, and from string to real. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { translateTo(classGen, methodGen, Type.String); Type.String.translateTo(classGen, methodGen, Type.Real); } /** * Expects a node on the stack and pushes a singleton node-set. Singleton * iterators are already started after construction. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeSetType type) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); // Create a new instance of SingletonIterator il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR))); il.append(DUP_X1); il.append(SWAP); final int init = cpg.addMethodref(SINGLETON_ITERATOR, "", "(" + NODE_SIG +")V"); il.append(new INVOKESPECIAL(init)); } /** * Subsume Node into ObjectType. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ObjectType type) { methodGen.getInstructionList().append(NOP); } /** * Translates a node into a non-synthesized boolean. It does not push a * 0 or a 1 but instead returns branchhandle list to be appended to the * false list. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); return new FlowList(il.append(new IFEQ(null))); } /** * Expects a node on the stack and pushes a boxed node. Boxed nodes * are represented by an instance of org.apache.xalan.xsltc.dom.Node. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(RUNTIME_NODE_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new PUSH(cpg, _type)); il.append(new INVOKESPECIAL(cpg.addMethodref(RUNTIME_NODE_CLASS, "", "(II)V"))); } /** * Translates a node into the Java type denoted by clazz. * Expects a node on the stack and pushes an object of the appropriate * type after coercion. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); String className = clazz.getName(); if (className.equals("java.lang.String")) { translateTo(classGen, methodGen, Type.String); return; } il.append(methodGen.loadDOM()); il.append(SWAP); // dom ref must be below node index if (className.equals("org.w3c.dom.Node") || className.equals("java.lang.Object")) { int index = cpg.addInterfaceMethodref(DOM_INTF, MAKE_NODE, MAKE_NODE_SIG); il.append(new INVOKEINTERFACE(index, 2)); } else if (className.equals("org.w3c.dom.NodeList")) { int index = cpg.addInterfaceMethodref(DOM_INTF, MAKE_NODE_LIST, MAKE_NODE_LIST_SIG); il.append(new INVOKEINTERFACE(index, 2)); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), className); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(RUNTIME_NODE_CLASS))); il.append(new GETFIELD(cpg.addFieldref(RUNTIME_NODE_CLASS, NODE_FIELD, NODE_FIELD_SIG))); } /** * Returns the class name of an internal type's external representation. */ public String getClassName() { return(RUNTIME_NODE_CLASS); } public Instruction LOAD(int slot) { return new ILOAD(slot); } public Instruction STORE(int slot) { return new ISTORE(slot); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/RealType.java0000644000175000017500000002476210721374030025526 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RealType.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.DLOAD; import org.apache.bcel.generic.DSTORE; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFNE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionConstants; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.compiler.FlowList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class RealType extends NumberType { protected RealType() {} public String toString() { return "real"; } public boolean identicalTo(Type other) { return this == other; } public String toSignature() { return "D"; } public org.apache.bcel.generic.Type toJCType() { return org.apache.bcel.generic.Type.DOUBLE; } /** * @see org.apache.xalan.xsltc.compiler.util.Type#distanceTo */ public int distanceTo(Type type) { if (type == this) { return 0; } else if (type == Type.Int) { return 1; } else { return Integer.MAX_VALUE; } } /** * Translates a real into an object of internal type type. The * translation to int is undefined since reals are never converted to ints. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, Type type) { if (type == Type.String) { translateTo(classGen, methodGen, (StringType) type); } else if (type == Type.Boolean) { translateTo(classGen, methodGen, (BooleanType) type); } else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType) type); } else if (type == Type.Int) { translateTo(classGen, methodGen, (IntType) type); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Expects a real on the stack and pushes its string value by calling * Double.toString(double d). * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "realToString", "(D)" + STRING_SIG))); } /** * Expects a real on the stack and pushes a 0 if that number is 0.0 and * a 1 otherwise. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final InstructionList il = methodGen.getInstructionList(); FlowList falsel = translateToDesynthesized(classGen, methodGen, type); il.append(ICONST_1); final BranchHandle truec = il.append(new GOTO(null)); falsel.backPatch(il.append(ICONST_0)); truec.setTarget(il.append(NOP)); } /** * Expects a real on the stack and pushes a truncated integer value * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, IntType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "realToInt","(D)I"))); } /** * Translates a real into a non-synthesized boolean. It does not push a * 0 or a 1 but instead returns branchhandle list to be appended to the * false list. A NaN must be converted to "false". * * @see org.apache.xalan.xsltc.compiler.util.Type#translateToDesynthesized */ public FlowList translateToDesynthesized(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { LocalVariableGen local; final FlowList flowlist = new FlowList(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Store real into a local variable il.append(DUP2); local = methodGen.addLocalVariable("real_to_boolean_tmp", org.apache.bcel.generic.Type.DOUBLE, null, null); local.setStart(il.append(new DSTORE(local.getIndex()))); // Compare it to 0.0 il.append(DCONST_0); il.append(DCMPG); flowlist.add(il.append(new IFEQ(null))); //!!! call isNaN // Compare it to itself to see if NaN il.append(new DLOAD(local.getIndex())); local.setEnd(il.append(new DLOAD(local.getIndex()))); il.append(DCMPG); flowlist.add(il.append(new IFNE(null))); // NaN != NaN return flowlist; } /** * Expects a double on the stack and pushes a boxed double. Boxed * double are represented by an instance of java.lang.Double. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(DOUBLE_CLASS))); il.append(DUP_X2); il.append(DUP_X2); il.append(POP); il.append(new INVOKESPECIAL(cpg.addMethodref(DOUBLE_CLASS, "", "(D)V"))); } /** * Translates a real into the Java type denoted by clazz. * Expects a real on the stack and pushes a number of the appropriate * type after coercion. */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, final Class clazz) { final InstructionList il = methodGen.getInstructionList(); if (clazz == Character.TYPE) { il.append(D2I); il.append(I2C); } else if (clazz == Byte.TYPE) { il.append(D2I); il.append(I2B); } else if (clazz == Short.TYPE) { il.append(D2I); il.append(I2S); } else if (clazz == Integer.TYPE) { il.append(D2I); } else if (clazz == Long.TYPE) { il.append(D2L); } else if (clazz == Float.TYPE) { il.append(D2F); } else if (clazz == Double.TYPE) { il.append(NOP); } // Is Double <: clazz? I.e. clazz in { Double, Number, Object } else if (clazz.isAssignableFrom(java.lang.Double.class)) { translateTo(classGen, methodGen, Type.Reference); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an external (primitive) Java type into a real. Expects a java * object on the stack and pushes a real (i.e., a double). */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { InstructionList il = methodGen.getInstructionList(); if (clazz == Character.TYPE || clazz == Byte.TYPE || clazz == Short.TYPE || clazz == Integer.TYPE) { il.append(I2D); } else if (clazz == Long.TYPE) { il.append(L2D); } else if (clazz == Float.TYPE) { il.append(F2D); } else if (clazz == Double.TYPE) { il.append(NOP); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } } /** * Translates an object of this type to its boxed representation. */ public void translateBox(ClassGenerator classGen, MethodGenerator methodGen) { translateTo(classGen, methodGen, Type.Reference); } /** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS))); il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS, DOUBLE_VALUE, DOUBLE_VALUE_SIG))); } public Instruction ADD() { return InstructionConstants.DADD; } public Instruction SUB() { return InstructionConstants.DSUB; } public Instruction MUL() { return InstructionConstants.DMUL; } public Instruction DIV() { return InstructionConstants.DDIV; } public Instruction REM() { return InstructionConstants.DREM; } public Instruction NEG() { return InstructionConstants.DNEG; } public Instruction LOAD(int slot) { return new DLOAD(slot); } public Instruction STORE(int slot) { return new DSTORE(slot); } public Instruction POP() { return POP2; } public Instruction CMP(boolean less) { return less ? InstructionConstants.DCMPG : InstructionConstants.DCMPL; } public Instruction DUP() { return DUP2; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/util/TypeCheckError.java0000644000175000017500000000422410721374032026663 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TypeCheckError.java 468649 2006-10-28 07:00:55Z minchau $ */ package org.apache.xalan.xsltc.compiler.util; import org.apache.xalan.xsltc.compiler.SyntaxTreeNode; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public class TypeCheckError extends Exception { static final long serialVersionUID = 3246224233917854640L; ErrorMsg _error = null; SyntaxTreeNode _node = null; public TypeCheckError(SyntaxTreeNode node) { super(); _node = node; } public TypeCheckError(ErrorMsg error) { super(); _error = error; } public TypeCheckError(String code, Object param) { super(); _error = new ErrorMsg(code, param); } public TypeCheckError(String code, Object param1, Object param2) { super(); _error = new ErrorMsg(code, param1, param2); } public ErrorMsg getErrorMsg() { return _error; } public String getMessage() { return toString(); } public String toString() { String result; if (_error == null) { if (_node != null) { _error = new ErrorMsg(ErrorMsg.TYPE_CHECK_ERR, _node.toString()); } else { _error = new ErrorMsg(ErrorMsg.TYPE_CHECK_UNK_LOC_ERR); } } return _error.toString(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Makefile.inc0000644000175000017500000000404510721374030024361 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: Makefile.inc 468650 2006-10-28 07:03:30Z minchau $ # #################################################################### # # # Makefile.inc for XSLT compiler # # # #################################################################### #################################################################### # Useful macros # #################################################################### JAVAC = javac #JAVAC_FLAGS = -g -d $(XSLT)/src/classes JAVAC_FLAGS = -sourcepath $(XSLT)/src JAVACC = javacc JAVACC_FLAGS = -static=FALSE JAVACUP = javacup JAVACUP_FLAGS = JAVALEX = jlex JAVALEX_FLAGS = #################################################################### # Explicit rules # #################################################################### .SUFFIXES: .java .class .jj .lex .cup .java.class: $(JAVAC) $(JAVAC_FLAGS) $< .jj.java: $(JAVACC) $(JAVACC_FLAGS) $< .cup.java: $(JAVACUP) $(JAVACUP_FLAGS) $< .lex.java: $(JAVALEX) $(JAVALEX_FLAGS) $< libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/XPathParser.java0000644000175000017500000057766010721374033025242 0ustar mkochmkoch //---------------------------------------------------- // The following code was generated by CUP v0.10k // Thu Nov 22 16:41:50 EST 2007 //---------------------------------------------------- package org.apache.xalan.xsltc.compiler; import java.util.Stack; import java.util.Vector; import java.io.StringReader; import java_cup.runtime.*; import org.apache.xml.dtm.DTM; import org.apache.xalan.xsltc.DOM; import org.apache.xml.dtm.Axis; import org.apache.xalan.xsltc.runtime.Operators; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; /** CUP v0.10k generated parser. * @version Thu Nov 22 16:41:50 EST 2007 */ public class XPathParser extends java_cup.runtime.lr_parser { /** Default constructor. */ public XPathParser() {super();} /** Constructor which sets the default scanner. */ public XPathParser(java_cup.runtime.Scanner s) {super(s);} /** Production table. */ protected static final short _production_table[][] = unpackFromStrings(new String[] { "\000\215\000\002\002\004\000\002\003\004\000\002\003" + "\004\000\002\036\003\000\002\036\005\000\002\037\003" + "\000\002\037\004\000\002\037\003\000\002\037\005\000" + "\002\037\005\000\002\037\004\000\002\037\003\000\002" + "\035\006\000\002\035\010\000\002\040\006\000\002\041" + "\003\000\002\041\005\000\002\041\005\000\002\042\003" + "\000\002\042\004\000\002\042\003\000\002\042\004\000" + "\002\042\004\000\002\042\005\000\002\042\004\000\002" + "\042\005\000\002\043\003\000\002\043\003\000\002\043" + "\003\000\002\043\003\000\002\043\003\000\002\044\003" + "\000\002\044\003\000\002\054\003\000\002\054\004\000" + "\002\054\004\000\002\045\003\000\002\045\004\000\002" + "\007\005\000\002\004\003\000\002\012\003\000\002\012" + "\005\000\002\013\003\000\002\013\005\000\002\014\003" + "\000\002\014\005\000\002\014\005\000\002\015\003\000" + "\002\015\005\000\002\015\005\000\002\015\005\000\002" + "\015\005\000\002\016\003\000\002\016\005\000\002\016" + "\005\000\002\017\003\000\002\017\005\000\002\017\005" + "\000\002\017\005\000\002\020\003\000\002\020\004\000" + "\002\024\003\000\002\024\005\000\002\025\003\000\002" + "\025\003\000\002\025\005\000\002\025\005\000\002\006" + "\003\000\002\006\003\000\002\027\003\000\002\027\005" + "\000\002\027\003\000\002\031\003\000\002\031\004\000" + "\002\031\003\000\002\030\005\000\002\032\004\000\002" + "\011\003\000\002\011\004\000\002\011\005\000\002\011" + "\004\000\002\011\003\000\002\053\004\000\002\053\003" + "\000\002\052\003\000\002\052\003\000\002\052\003\000" + "\002\052\003\000\002\052\003\000\002\052\003\000\002" + "\052\003\000\002\052\003\000\002\052\003\000\002\052" + "\003\000\002\052\003\000\002\052\003\000\002\052\003" + "\000\002\026\003\000\002\026\003\000\002\010\003\000" + "\002\010\004\000\002\023\003\000\002\023\005\000\002" + "\023\003\000\002\023\003\000\002\023\003\000\002\023" + "\003\000\002\021\004\000\002\022\005\000\002\022\006" + "\000\002\046\003\000\002\046\005\000\002\050\003\000" + "\002\051\003\000\002\005\003\000\002\033\003\000\002" + "\033\003\000\002\033\003\000\002\033\003\000\002\033" + "\006\000\002\033\003\000\002\034\003\000\002\034\003" + "\000\002\047\003\000\002\047\003\000\002\047\003\000" + "\002\047\003\000\002\047\003\000\002\047\003\000\002" + "\047\003\000\002\047\003\000\002\047\003\000\002\047" + "\003\000\002\047\003\000\002\047\003\000\002\047\003" + "\000\002\047\003\000\002\047\003\000\002\047\003\000" + "\002\047\003\000\002\047\003" }); /** Access to production table. */ public short[][] production_table() {return _production_table;} /** Parse-action table. */ protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\307\000\006\067\006\070\005\001\002\000\004\002" + "\311\001\002\000\110\004\061\005\111\011\071\013\103" + "\015\134\016\066\017\106\021\070\031\075\032\031\033" + "\040\035\057\036\034\037\113\040\141\041\142\042\145" + "\045\063\046\062\047\065\050\115\051\123\052\136\053" + "\077\054\143\055\131\056\125\057\116\060\104\061\140" + "\062\067\063\060\064\127\065\132\066\072\001\002\000" + "\070\004\013\013\027\016\020\021\023\032\031\033\040" + "\036\034\037\033\040\046\041\047\042\051\045\015\046" + "\014\047\016\050\036\051\037\052\044\053\025\054\050" + "\055\043\056\041\057\035\060\030\061\045\062\021\063" + "\012\064\042\001\002\000\006\002\ufffe\010\306\001\002" + "\000\004\002\000\001\002\000\014\002\uffe7\004\uffe7\006" + "\uffe7\010\uffe7\021\uffe7\001\002\000\054\002\uff7a\004\uff7a" + "\006\uff7a\007\uff7a\010\uff7a\012\uff7a\014\uff7a\021\uff7a\022" + "\uff7a\023\uff7a\024\uff7a\025\uff7a\026\uff7a\027\uff7a\030\uff7a" + "\031\uff7a\032\uff7a\033\uff7a\034\uff7a\043\uff7a\044\uff7a\001" + "\002\000\070\002\ufffc\010\ufffc\013\027\016\020\032\031" + "\033\040\036\034\037\113\040\141\041\047\042\051\045" + "\015\046\014\047\016\050\036\051\037\052\044\053\025" + "\054\050\055\043\056\041\057\035\060\030\061\045\062" + "\021\063\012\064\042\001\002\000\014\002\uffe3\004\uffe3" + "\006\uffe3\010\uffe3\021\uffe3\001\002\000\014\002\uffe4\004" + "\uffe4\006\uffe4\010\uffe4\021\uffe4\001\002\000\004\011\302" + "\001\002\000\012\002\ufffa\004\277\010\ufffa\021\276\001" + "\002\000\062\013\uffe0\032\uffe0\033\uffe0\036\uffe0\037\uffe0" + "\040\uffe0\041\uffe0\042\uffe0\045\uffe0\046\uffe0\047\uffe0\050" + "\uffe0\051\uffe0\052\uffe0\053\uffe0\054\uffe0\055\uffe0\056\uffe0" + "\057\uffe0\060\uffe0\061\uffe0\062\uffe0\063\uffe0\064\uffe0\001" + "\002\000\054\002\uff7b\004\uff7b\006\uff7b\007\uff7b\010\uff7b" + "\012\uff7b\014\uff7b\021\uff7b\022\uff7b\023\uff7b\024\uff7b\025" + "\uff7b\026\uff7b\027\uff7b\030\uff7b\031\uff7b\032\uff7b\033\uff7b" + "\034\uff7b\043\uff7b\044\uff7b\001\002\000\062\013\027\032" + "\031\033\040\036\034\037\113\040\141\041\047\042\051" + "\045\015\046\014\047\016\050\036\051\037\052\044\053" + "\170\054\166\055\043\056\041\057\035\060\030\061\045" + "\062\021\063\012\064\042\001\002\000\064\013\027\016" + "\020\032\031\033\040\036\034\037\113\040\141\041\047" + "\042\051\045\015\046\014\047\016\050\036\051\037\052" + "\044\053\025\054\050\055\043\056\041\057\035\060\030" + "\061\045\062\021\063\012\064\042\001\002\000\012\002" + "\ufff2\004\266\010\ufff2\021\265\001\002\000\016\002\uff7f" + "\004\uff7f\006\uff7f\010\uff7f\020\264\021\uff7f\001\002\000" + "\006\002\ufff6\010\ufff6\001\002\000\014\002\uffe2\004\uffe2" + "\006\uffe2\010\uffe2\021\uffe2\001\002\000\054\002\uff7d\004" + "\uff7d\006\uff7d\007\uff7d\010\uff7d\012\uff7d\014\uff7d\021\uff7d" + "\022\uff7d\023\uff7d\024\uff7d\025\uff7d\026\uff7d\027\uff7d\030" + "\uff7d\031\uff7d\032\uff7d\033\uff7d\034\uff7d\043\uff7d\044\uff7d" + "\001\002\000\056\002\uff85\004\uff85\006\uff85\007\uff85\010" + "\uff85\011\uff85\012\uff85\014\uff85\021\uff85\022\uff85\023\uff85" + "\024\uff85\025\uff85\026\uff85\027\uff85\030\uff85\031\uff85\032" + "\uff85\033\uff85\034\uff85\043\uff85\044\uff85\001\002\000\014" + "\002\uffed\004\uffed\006\055\010\uffed\021\uffed\001\002\000" + "\016\002\uff75\004\uff75\006\uff75\010\uff75\011\260\021\uff75" + "\001\002\000\056\002\uff86\004\uff86\006\uff86\007\uff86\010" + "\uff86\011\uff86\012\uff86\014\uff86\021\uff86\022\uff86\023\uff86" + "\024\uff86\025\uff86\026\uff86\027\uff86\030\uff86\031\uff86\032" + "\uff86\033\uff86\034\uff86\043\uff86\044\uff86\001\002\000\054" + "\002\uff7e\004\uff7e\006\uff7e\007\uff7e\010\uff7e\012\uff7e\014" + "\uff7e\021\uff7e\022\uff7e\023\uff7e\024\uff7e\025\uff7e\026\uff7e" + "\027\uff7e\030\uff7e\031\uff7e\032\uff7e\033\uff7e\034\uff7e\043" + "\uff7e\044\uff7e\001\002\000\054\002\uff77\004\uff77\006\uff77" + "\007\uff77\010\uff77\012\uff77\014\uff77\021\uff77\022\uff77\023" + "\uff77\024\uff77\025\uff77\026\uff77\027\uff77\030\uff77\031\uff77" + "\032\uff77\033\uff77\034\uff77\043\uff77\044\uff77\001\002\000" + "\054\002\uff76\004\uff76\006\uff76\007\uff76\010\uff76\012\uff76" + "\014\uff76\021\uff76\022\uff76\023\uff76\024\uff76\025\uff76\026" + "\uff76\027\uff76\030\uff76\031\uff76\032\uff76\033\uff76\034\uff76" + "\043\uff76\044\uff76\001\002\000\056\002\uff84\004\uff84\006" + "\uff84\007\uff84\010\uff84\011\uff84\012\uff84\014\uff84\021\uff84" + "\022\uff84\023\uff84\024\uff84\025\uff84\026\uff84\027\uff84\030" + "\uff84\031\uff84\032\uff84\033\uff84\034\uff84\043\uff84\044\uff84" + "\001\002\000\054\002\uff81\004\uff81\006\uff81\007\uff81\010" + "\uff81\012\uff81\014\uff81\021\uff81\022\uff81\023\uff81\024\uff81" + "\025\uff81\026\uff81\027\uff81\030\uff81\031\uff81\032\uff81\033" + "\uff81\034\uff81\043\uff81\044\uff81\001\002\000\054\002\uff78" + "\004\uff78\006\uff78\007\uff78\010\uff78\012\uff78\014\uff78\021" + "\uff78\022\uff78\023\uff78\024\uff78\025\uff78\026\uff78\027\uff78" + "\030\uff78\031\uff78\032\uff78\033\uff78\034\uff78\043\uff78\044" + "\uff78\001\002\000\054\002\uff82\004\uff82\006\uff82\007\uff82" + "\010\uff82\012\uff82\014\uff82\021\uff82\022\uff82\023\uff82\024" + "\uff82\025\uff82\026\uff82\027\uff82\030\uff82\031\uff82\032\uff82" + "\033\uff82\034\uff82\043\uff82\044\uff82\001\002\000\054\002" + "\uff79\004\uff79\006\uff79\007\uff79\010\uff79\012\uff79\014\uff79" + "\021\uff79\022\uff79\023\uff79\024\uff79\025\uff79\026\uff79\027" + "\uff79\030\uff79\031\uff79\032\uff79\033\uff79\034\uff79\043\uff79" + "\044\uff79\001\002\000\054\002\uff7c\004\uff7c\006\uff7c\007" + "\uff7c\010\uff7c\012\uff7c\014\uff7c\021\uff7c\022\uff7c\023\uff7c" + "\024\uff7c\025\uff7c\026\uff7c\027\uff7c\030\uff7c\031\uff7c\032" + "\uff7c\033\uff7c\034\uff7c\043\uff7c\044\uff7c\001\002\000\016" + "\002\uff83\004\uff83\006\uff83\010\uff83\011\253\021\uff83\001" + "\002\000\014\002\uffe5\004\uffe5\006\uffe5\010\uffe5\021\uffe5" + "\001\002\000\016\002\uff80\004\uff80\006\uff80\010\uff80\020" + "\252\021\uff80\001\002\000\014\002\uffe6\004\uffe6\006\uffe6" + "\010\uffe6\021\uffe6\001\002\000\014\002\uffe1\004\uffe1\006" + "\uffe1\010\uffe1\021\uffe1\001\002\000\014\002\uffef\004\uffef" + "\006\055\010\uffef\021\uffef\001\002\000\054\002\uffdd\004" + "\uffdd\006\055\007\uffdd\010\uffdd\012\uffdd\014\uffdd\021\uffdd" + "\022\uffdd\023\uffdd\024\uffdd\025\uffdd\026\uffdd\027\uffdd\030" + "\uffdd\031\uffdd\032\uffdd\033\uffdd\034\uffdd\043\uffdd\044\uffdd" + "\001\002\000\110\004\061\005\111\011\071\013\103\015" + "\134\016\066\017\106\021\070\031\075\032\031\033\040" + "\035\057\036\034\037\113\040\141\041\142\042\145\045" + "\063\046\062\047\065\050\115\051\123\052\136\053\077" + "\054\143\055\131\056\125\057\116\060\104\061\140\062" + "\067\063\060\064\127\065\132\066\072\001\002\000\012" + "\002\uffee\004\uffee\010\uffee\021\uffee\001\002\000\054\002" + "\uff9a\004\uff9a\006\uff9a\007\uff9a\010\uff9a\012\uff9a\014\uff9a" + "\021\uff9a\022\uff9a\023\uff9a\024\uff9a\025\uff9a\026\uff9a\027" + "\uff9a\030\uff9a\031\uff9a\032\uff9a\033\uff9a\034\uff9a\043\uff9a" + "\044\uff9a\001\002\000\060\002\uff7a\004\uff7a\006\uff7a\007" + "\uff7a\010\uff7a\011\uff7a\012\uff7a\014\uff7a\020\uffa5\021\uff7a" + "\022\uff7a\023\uff7a\024\uff7a\025\uff7a\026\uff7a\027\uff7a\030" + "\uff7a\031\uff7a\032\uff7a\033\uff7a\034\uff7a\043\uff7a\044\uff7a" + "\001\002\000\130\002\uffb9\005\111\007\uffb9\010\uffb9\012" + "\uffb9\013\103\014\uffb9\016\066\017\106\022\uffb9\023\uffb9" + "\024\uffb9\025\uffb9\026\uffb9\027\uffb9\030\uffb9\031\uffb9\032" + "\031\033\040\034\uffb9\036\034\037\113\040\141\041\142" + "\042\145\043\uffb9\044\uffb9\045\063\046\062\047\065\050" + "\115\051\123\052\136\053\077\054\143\055\131\056\125" + "\057\116\060\104\061\140\062\067\063\060\064\127\001" + "\002\000\054\002\uff89\004\uff89\006\uff89\007\uff89\010\uff89" + "\012\uff89\014\uff89\021\uff89\022\uff89\023\uff89\024\uff89\025" + "\uff89\026\uff89\027\uff89\030\uff89\031\uff89\032\uff89\033\uff89" + "\034\uff89\043\uff89\044\uff89\001\002\000\054\002\uff8b\004" + "\uff8b\006\uff8b\007\uff8b\010\uff8b\012\uff8b\014\uff8b\021\uff8b" + "\022\uff8b\023\uff8b\024\uff8b\025\uff8b\026\uff8b\027\uff8b\030" + "\uff8b\031\uff8b\032\uff8b\033\uff8b\034\uff8b\043\uff8b\044\uff8b" + "\001\002\000\032\002\uffd5\007\uffd5\012\uffd5\014\uffd5\022" + "\uffd5\023\uffd5\024\221\025\222\026\223\027\224\043\uffd5" + "\044\uffd5\001\002\000\004\011\245\001\002\000\062\013" + "\uffae\032\uffae\033\uffae\036\uffae\037\uffae\040\uffae\041\uffae" + "\042\uffae\045\uffae\046\uffae\047\uffae\050\uffae\051\uffae\052" + "\uffae\053\uffae\054\uffae\055\uffae\056\uffae\057\uffae\060\uffae" + "\061\uffae\062\uffae\063\uffae\064\uffae\001\002\000\060\002" + "\uff7b\004\uff7b\006\uff7b\007\uff7b\010\uff7b\011\uff7b\012\uff7b" + "\014\uff7b\020\uffa6\021\uff7b\022\uff7b\023\uff7b\024\uff7b\025" + "\uff7b\026\uff7b\027\uff7b\030\uff7b\031\uff7b\032\uff7b\033\uff7b" + "\034\uff7b\043\uff7b\044\uff7b\001\002\000\070\005\111\013" + "\103\016\066\017\106\032\031\033\040\036\034\037\113" + "\040\141\041\142\042\145\045\063\046\062\047\065\050" + "\115\051\123\052\136\053\077\054\143\055\131\056\125" + "\057\116\060\104\061\140\062\067\063\060\064\127\001" + "\002\000\110\004\061\005\111\011\071\013\103\015\134" + "\016\066\017\106\021\070\031\075\032\031\033\040\035" + "\057\036\034\037\113\040\141\041\142\042\145\045\063" + "\046\062\047\065\050\115\051\123\052\136\053\077\054" + "\143\055\131\056\125\057\116\060\104\061\140\062\067" + "\063\060\064\127\065\132\066\072\001\002\000\054\002" + "\uff99\004\uff99\006\uff99\007\uff99\010\uff99\012\uff99\014\uff99" + "\021\uff99\022\uff99\023\uff99\024\uff99\025\uff99\026\uff99\027" + "\uff99\030\uff99\031\uff99\032\uff99\033\uff99\034\uff99\043\uff99" + "\044\uff99\001\002\000\046\002\uffb7\007\uffb7\010\uffb7\012" + "\uffb7\014\uffb7\022\uffb7\023\uffb7\024\uffb7\025\uffb7\026\uffb7" + "\027\uffb7\030\uffb7\031\uffb7\032\uffb7\033\uffb7\034\uffb7\043" + "\uffb7\044\uffb7\001\002\000\054\002\uff97\004\uff97\006\uff97" + "\007\uff97\010\uff97\012\uff97\014\uff97\021\uff97\022\uff97\023" + "\uff97\024\uff97\025\uff97\026\uff97\027\uff97\030\uff97\031\uff97" + "\032\uff97\033\uff97\034\uff97\043\uff97\044\uff97\001\002\000" + "\110\004\061\005\111\011\071\013\103\015\134\016\066" + "\017\106\021\070\031\075\032\031\033\040\035\057\036" + "\034\037\113\040\141\041\142\042\145\045\063\046\062" + "\047\065\050\115\051\123\052\136\053\077\054\143\055" + "\131\056\125\057\116\060\104\061\140\062\067\063\060" + "\064\127\065\132\066\072\001\002\000\016\002\uffd9\007" + "\uffd9\012\uffd9\014\uffd9\043\uffd9\044\234\001\002\000\060" + "\002\uff7f\004\uff7f\006\uff7f\007\uff7f\010\uff7f\011\uff7f\012" + "\uff7f\014\uff7f\020\uffaa\021\uff7f\022\uff7f\023\uff7f\024\uff7f" + "\025\uff7f\026\uff7f\027\uff7f\030\uff7f\031\uff7f\032\uff7f\033" + "\uff7f\034\uff7f\043\uff7f\044\uff7f\001\002\000\062\013\103" + "\032\031\033\040\036\034\037\113\040\141\041\142\042" + "\145\045\063\046\062\047\065\050\036\051\037\052\044" + "\053\170\054\166\055\043\056\041\057\035\060\030\061" + "\045\062\021\063\012\064\042\001\002\000\004\020\236" + "\001\002\000\014\002\uffda\007\uffda\012\uffda\014\uffda\043" + "\232\001\002\000\054\002\uff88\004\uff88\006\uff88\007\uff88" + "\010\uff88\012\uff88\014\uff88\021\uff88\022\uff88\023\uff88\024" + "\uff88\025\uff88\026\uff88\027\uff88\030\uff88\031\uff88\032\uff88" + "\033\uff88\034\uff88\043\uff88\044\uff88\001\002\000\060\002" + "\uff7d\004\uff7d\006\uff7d\007\uff7d\010\uff7d\011\uff7d\012\uff7d" + "\014\uff7d\020\uffa8\021\uff7d\022\uff7d\023\uff7d\024\uff7d\025" + "\uff7d\026\uff7d\027\uff7d\030\uff7d\031\uff7d\032\uff7d\033\uff7d" + "\034\uff7d\043\uff7d\044\uff7d\001\002\000\022\002\uffd7\007" + "\uffd7\012\uffd7\014\uffd7\022\216\023\217\043\uffd7\044\uffd7" + "\001\002\000\052\002\uff9f\004\uff9f\007\uff9f\010\uff9f\012" + "\uff9f\014\uff9f\021\uff9f\022\uff9f\023\uff9f\024\uff9f\025\uff9f" + "\026\uff9f\027\uff9f\030\uff9f\031\uff9f\032\uff9f\033\uff9f\034" + "\uff9f\043\uff9f\044\uff9f\001\002\000\054\002\uffb4\004\uffb4" + "\006\055\007\uffb4\010\uffb4\012\uffb4\014\uffb4\021\uffb4\022" + "\uffb4\023\uffb4\024\uffb4\025\uffb4\026\uffb4\027\uffb4\030\uffb4" + "\031\uffb4\032\uffb4\033\uffb4\034\uffb4\043\uffb4\044\uffb4\001" + "\002\000\046\002\uffbd\007\uffbd\010\uffbd\012\uffbd\014\uffbd" + "\022\uffbd\023\uffbd\024\uffbd\025\uffbd\026\uffbd\027\uffbd\030" + "\uffbd\031\uffbd\032\uffbd\033\uffbd\034\uffbd\043\uffbd\044\uffbd" + "\001\002\000\052\002\uffa0\004\uffa0\007\uffa0\010\uffa0\012" + "\uffa0\014\uffa0\021\uffa0\022\uffa0\023\uffa0\024\uffa0\025\uffa0" + "\026\uffa0\027\uffa0\030\uffa0\031\uffa0\032\uffa0\033\uffa0\034" + "\uffa0\043\uffa0\044\uffa0\001\002\000\036\002\uffd2\007\uffd2" + "\012\uffd2\014\uffd2\022\uffd2\023\uffd2\024\uffd2\025\uffd2\026" + "\uffd2\027\uffd2\030\211\031\212\043\uffd2\044\uffd2\001\002" + "\000\056\002\uff75\004\uff75\006\uff75\007\uff75\010\uff75\011" + "\uff75\012\uff75\014\uff75\021\uff75\022\uff75\023\uff75\024\uff75" + "\025\uff75\026\uff75\027\uff75\030\uff75\031\uff75\032\uff75\033" + "\uff75\034\uff75\043\uff75\044\uff75\001\002\000\044\002\uffca" + "\007\uffca\012\uffca\014\uffca\022\uffca\023\uffca\024\uffca\025" + "\uffca\026\uffca\027\uffca\030\uffca\031\uffca\032\uffca\033\uffca" + "\034\uffca\043\uffca\044\uffca\001\002\000\060\002\uff77\004" + "\uff77\006\uff77\007\uff77\010\uff77\011\uff77\012\uff77\014\uff77" + "\020\uffa2\021\uff77\022\uff77\023\uff77\024\uff77\025\uff77\026" + "\uff77\027\uff77\030\uff77\031\uff77\032\uff77\033\uff77\034\uff77" + "\043\uff77\044\uff77\001\002\000\060\002\uff7e\004\uff7e\006" + "\uff7e\007\uff7e\010\uff7e\011\uff7e\012\uff7e\014\uff7e\020\uffa9" + "\021\uff7e\022\uff7e\023\uff7e\024\uff7e\025\uff7e\026\uff7e\027" + "\uff7e\030\uff7e\031\uff7e\032\uff7e\033\uff7e\034\uff7e\043\uff7e" + "\044\uff7e\001\002\000\004\011\201\001\002\000\052\002" + "\uffbc\004\uffbc\007\uffbc\010\uffbc\012\uffbc\014\uffbc\021\uffbc" + "\022\uffbc\023\uffbc\024\uffbc\025\uffbc\026\uffbc\027\uffbc\030" + "\uffbc\031\uffbc\032\uffbc\033\uffbc\034\uffbc\043\uffbc\044\uffbc" + "\001\002\000\046\002\uffc2\007\uffc2\010\uffc2\012\uffc2\014" + "\uffc2\022\uffc2\023\uffc2\024\uffc2\025\uffc2\026\uffc2\027\uffc2" + "\030\uffc2\031\uffc2\032\uffc2\033\uffc2\034\uffc2\043\uffc2\044" + "\uffc2\001\002\000\054\002\uff9e\004\uff9e\006\055\007\uff9e" + "\010\uff9e\012\uff9e\014\uff9e\021\uff9e\022\uff9e\023\uff9e\024" + "\uff9e\025\uff9e\026\uff9e\027\uff9e\030\uff9e\031\uff9e\032\uff9e" + "\033\uff9e\034\uff9e\043\uff9e\044\uff9e\001\002\000\060\002" + "\uff76\004\uff76\006\uff76\007\uff76\010\uff76\011\uff76\012\uff76" + "\014\uff76\020\uffa1\021\uff76\022\uff76\023\uff76\024\uff76\025" + "\uff76\026\uff76\027\uff76\030\uff76\031\uff76\032\uff76\033\uff76" + "\034\uff76\043\uff76\044\uff76\001\002\000\046\002\uffc4\007" + "\uffc4\010\176\012\uffc4\014\uffc4\022\uffc4\023\uffc4\024\uffc4" + "\025\uffc4\026\uffc4\027\uffc4\030\uffc4\031\uffc4\032\uffc4\033" + "\uffc4\034\uffc4\043\uffc4\044\uffc4\001\002\000\060\002\uff81" + "\004\uff81\006\uff81\007\uff81\010\uff81\011\uff81\012\uff81\014" + "\uff81\020\uffac\021\uff81\022\uff81\023\uff81\024\uff81\025\uff81" + "\026\uff81\027\uff81\030\uff81\031\uff81\032\uff81\033\uff81\034" + "\uff81\043\uff81\044\uff81\001\002\000\054\002\uff9c\004\uff9c" + "\006\uff9c\007\uff9c\010\uff9c\012\uff9c\014\uff9c\021\uff9c\022" + "\uff9c\023\uff9c\024\uff9c\025\uff9c\026\uff9c\027\uff9c\030\uff9c" + "\031\uff9c\032\uff9c\033\uff9c\034\uff9c\043\uff9c\044\uff9c\001" + "\002\000\060\002\uff78\004\uff78\006\uff78\007\uff78\010\uff78" + "\011\uff78\012\uff78\014\uff78\020\uffa3\021\uff78\022\uff78\023" + "\uff78\024\uff78\025\uff78\026\uff78\027\uff78\030\uff78\031\uff78" + "\032\uff78\033\uff78\034\uff78\043\uff78\044\uff78\001\002\000" + "\052\002\uffc1\004\173\007\uffc1\010\uffc1\012\uffc1\014\uffc1" + "\021\172\022\uffc1\023\uffc1\024\uffc1\025\uffc1\026\uffc1\027" + "\uffc1\030\uffc1\031\uffc1\032\uffc1\033\uffc1\034\uffc1\043\uffc1" + "\044\uffc1\001\002\000\060\002\uff82\004\uff82\006\uff82\007" + "\uff82\010\uff82\011\uff82\012\uff82\014\uff82\020\uffad\021\uff82" + "\022\uff82\023\uff82\024\uff82\025\uff82\026\uff82\027\uff82\030" + "\uff82\031\uff82\032\uff82\033\uff82\034\uff82\043\uff82\044\uff82" + "\001\002\000\054\002\uff98\004\uff98\006\uff98\007\uff98\010" + "\uff98\012\uff98\014\uff98\021\uff98\022\uff98\023\uff98\024\uff98" + "\025\uff98\026\uff98\027\uff98\030\uff98\031\uff98\032\uff98\033" + "\uff98\034\uff98\043\uff98\044\uff98\001\002\000\004\007\171" + "\001\002\000\046\032\031\033\040\036\034\037\113\040" + "\141\050\036\051\037\052\044\053\170\054\166\055\043" + "\056\041\057\035\060\030\061\045\062\021\063\012\064" + "\042\001\002\000\052\002\uffba\004\uffba\007\uffba\010\uffba" + "\012\uffba\014\uffba\021\uffba\022\uffba\023\uffba\024\uffba\025" + "\uffba\026\uffba\027\uffba\030\uffba\031\uffba\032\uffba\033\uffba" + "\034\uffba\043\uffba\044\uffba\001\002\000\060\002\uff79\004" + "\uff79\006\uff79\007\uff79\010\uff79\011\uff79\012\uff79\014\uff79" + "\020\uffa4\021\uff79\022\uff79\023\uff79\024\uff79\025\uff79\026" + "\uff79\027\uff79\030\uff79\031\uff79\032\uff79\033\uff79\034\uff79" + "\043\uff79\044\uff79\001\002\000\052\002\uffb0\004\uffb0\007" + "\uffb0\010\uffb0\012\uffb0\014\uffb0\021\uffb0\022\uffb0\023\uffb0" + "\024\uffb0\025\uffb0\026\uffb0\027\uffb0\030\uffb0\031\uffb0\032" + "\uffb0\033\uffb0\034\uffb0\043\uffb0\044\uffb0\001\002\000\060" + "\002\uff7c\004\uff7c\006\uff7c\007\uff7c\010\uff7c\011\uff7c\012" + "\uff7c\014\uff7c\020\uffa7\021\uff7c\022\uff7c\023\uff7c\024\uff7c" + "\025\uff7c\026\uff7c\027\uff7c\030\uff7c\031\uff7c\032\uff7c\033" + "\uff7c\034\uff7c\043\uff7c\044\uff7c\001\002\000\056\002\uff83" + "\004\uff83\006\uff83\007\uff83\010\uff83\011\uff83\012\uff83\014" + "\uff83\021\uff83\022\uff83\023\uff83\024\uff83\025\uff83\026\uff83" + "\027\uff83\030\uff83\031\uff83\032\uff83\033\uff83\034\uff83\043" + "\uff83\044\uff83\001\002\000\054\002\uff8c\004\uff8c\006\uff8c" + "\007\uff8c\010\uff8c\012\uff8c\014\uff8c\021\uff8c\022\uff8c\023" + "\uff8c\024\uff8c\025\uff8c\026\uff8c\027\uff8c\030\uff8c\031\uff8c" + "\032\uff8c\033\uff8c\034\uff8c\043\uff8c\044\uff8c\001\002\000" + "\060\002\uff80\004\uff80\006\uff80\007\uff80\010\uff80\011\uff80" + "\012\uff80\014\uff80\020\uffab\021\uff80\022\uff80\023\uff80\024" + "\uff80\025\uff80\026\uff80\027\uff80\030\uff80\031\uff80\032\uff80" + "\033\uff80\034\uff80\043\uff80\044\uff80\001\002\000\044\002" + "\uffc6\007\uffc6\012\uffc6\014\uffc6\022\uffc6\023\uffc6\024\uffc6" + "\025\uffc6\026\uffc6\027\uffc6\030\uffc6\031\uffc6\032\uffc6\033" + "\uffc6\034\uffc6\043\uffc6\044\uffc6\001\002\000\054\002\uff8d" + "\004\uff8d\006\uff8d\007\uff8d\010\uff8d\012\uff8d\014\uff8d\021" + "\uff8d\022\uff8d\023\uff8d\024\uff8d\025\uff8d\026\uff8d\027\uff8d" + "\030\uff8d\031\uff8d\032\uff8d\033\uff8d\034\uff8d\043\uff8d\044" + "\uff8d\001\002\000\044\002\uffcd\007\uffcd\012\uffcd\014\uffcd" + "\022\uffcd\023\uffcd\024\uffcd\025\uffcd\026\uffcd\027\uffcd\030" + "\uffcd\031\uffcd\032\161\033\157\034\160\043\uffcd\044\uffcd" + "\001\002\000\052\002\uffbe\004\153\007\uffbe\010\uffbe\012" + "\uffbe\014\uffbe\021\152\022\uffbe\023\uffbe\024\uffbe\025\uffbe" + "\026\uffbe\027\uffbe\030\uffbe\031\uffbe\032\uffbe\033\uffbe\034" + "\uffbe\043\uffbe\044\uffbe\001\002\000\054\002\uff8e\004\uff8e" + "\006\uff8e\007\uff8e\010\uff8e\012\uff8e\014\uff8e\021\uff8e\022" + "\uff8e\023\uff8e\024\uff8e\025\uff8e\026\uff8e\027\uff8e\030\uff8e" + "\031\uff8e\032\uff8e\033\uff8e\034\uff8e\043\uff8e\044\uff8e\001" + "\002\000\056\002\uff87\004\uff87\006\uff87\007\uff87\010\uff87" + "\011\uff91\012\uff87\014\uff87\021\uff87\022\uff87\023\uff87\024" + "\uff87\025\uff87\026\uff87\027\uff87\030\uff87\031\uff87\032\uff87" + "\033\uff87\034\uff87\043\uff87\044\uff87\001\002\000\070\005" + "\111\013\103\016\066\017\106\032\031\033\040\036\034" + "\037\113\040\141\041\142\042\145\045\063\046\062\047" + "\065\050\115\051\123\052\136\053\077\054\143\055\131" + "\056\125\057\116\060\104\061\140\062\067\063\060\064" + "\127\001\002\000\070\005\111\013\103\016\066\017\106" + "\032\031\033\040\036\034\037\113\040\141\041\142\042" + "\145\045\063\046\062\047\065\050\115\051\123\052\136" + "\053\077\054\143\055\131\056\125\057\116\060\104\061" + "\140\062\067\063\060\064\127\001\002\000\054\002\uff87" + "\004\uff87\006\uff87\007\uff87\010\uff87\012\uff87\014\uff87\021" + "\uff87\022\uff87\023\uff87\024\uff87\025\uff87\026\uff87\027\uff87" + "\030\uff87\031\uff87\032\uff87\033\uff87\034\uff87\043\uff87\044" + "\uff87\001\002\000\052\002\uffbb\004\uffbb\007\uffbb\010\uffbb" + "\012\uffbb\014\uffbb\021\uffbb\022\uffbb\023\uffbb\024\uffbb\025" + "\uffbb\026\uffbb\027\uffbb\030\uffbb\031\uffbb\032\uffbb\033\uffbb" + "\034\uffbb\043\uffbb\044\uffbb\001\002\000\052\002\uffb6\004" + "\uffb6\007\uffb6\010\uffb6\012\uffb6\014\uffb6\021\uffb6\022\uffb6" + "\023\uffb6\024\uffb6\025\uffb6\026\uffb6\027\uffb6\030\uffb6\031" + "\uffb6\032\uffb6\033\uffb6\034\uffb6\043\uffb6\044\uffb6\001\002" + "\000\110\004\061\005\111\011\071\013\103\015\134\016" + "\066\017\106\021\070\031\075\032\031\033\040\035\057" + "\036\034\037\113\040\141\041\142\042\145\045\063\046" + "\062\047\065\050\115\051\123\052\136\053\077\054\143" + "\055\131\056\125\057\116\060\104\061\140\062\067\063" + "\060\064\127\065\132\066\072\001\002\000\110\004\061" + "\005\111\011\071\013\103\015\134\016\066\017\106\021" + "\070\031\075\032\031\033\040\035\057\036\034\037\113" + "\040\141\041\142\042\145\045\063\046\062\047\065\050" + "\115\051\123\052\136\053\077\054\143\055\131\056\125" + "\057\116\060\104\061\140\062\067\063\060\064\127\065" + "\132\066\072\001\002\000\110\004\061\005\111\011\071" + "\013\103\015\134\016\066\017\106\021\070\031\075\032" + "\031\033\040\035\057\036\034\037\113\040\141\041\142" + "\042\145\045\063\046\062\047\065\050\115\051\123\052" + "\136\053\077\054\143\055\131\056\125\057\116\060\104" + "\061\140\062\067\063\060\064\127\065\132\066\072\001" + "\002\000\044\002\uffc8\007\uffc8\012\uffc8\014\uffc8\022\uffc8" + "\023\uffc8\024\uffc8\025\uffc8\026\uffc8\027\uffc8\030\uffc8\031" + "\uffc8\032\uffc8\033\uffc8\034\uffc8\043\uffc8\044\uffc8\001\002" + "\000\044\002\uffc9\007\uffc9\012\uffc9\014\uffc9\022\uffc9\023" + "\uffc9\024\uffc9\025\uffc9\026\uffc9\027\uffc9\030\uffc9\031\uffc9" + "\032\uffc9\033\uffc9\034\uffc9\043\uffc9\044\uffc9\001\002\000" + "\044\002\uffc7\007\uffc7\012\uffc7\014\uffc7\022\uffc7\023\uffc7" + "\024\uffc7\025\uffc7\026\uffc7\027\uffc7\030\uffc7\031\uffc7\032" + "\uffc7\033\uffc7\034\uffc7\043\uffc7\044\uffc7\001\002\000\054" + "\002\uff90\004\uff90\006\uff90\007\uff90\010\uff90\012\uff90\014" + "\uff90\021\uff90\022\uff90\023\uff90\024\uff90\025\uff90\026\uff90" + "\027\uff90\030\uff90\031\uff90\032\uff90\033\uff90\034\uff90\043" + "\uff90\044\uff90\001\002\000\054\002\uff80\004\uff80\006\uff80" + "\007\uff80\010\uff80\012\uff80\014\uff80\021\uff80\022\uff80\023" + "\uff80\024\uff80\025\uff80\026\uff80\027\uff80\030\uff80\031\uff80" + "\032\uff80\033\uff80\034\uff80\043\uff80\044\uff80\001\002\000" + "\054\002\uff96\004\uff96\006\uff96\007\uff96\010\uff96\012\uff96" + "\014\uff96\021\uff96\022\uff96\023\uff96\024\uff96\025\uff96\026" + "\uff96\027\uff96\030\uff96\031\uff96\032\uff96\033\uff96\034\uff96" + "\043\uff96\044\uff96\001\002\000\054\002\uff7f\004\uff7f\006" + "\uff7f\007\uff7f\010\uff7f\012\uff7f\014\uff7f\021\uff7f\022\uff7f" + "\023\uff7f\024\uff7f\025\uff7f\026\uff7f\027\uff7f\030\uff7f\031" + "\uff7f\032\uff7f\033\uff7f\034\uff7f\043\uff7f\044\uff7f\001\002" + "\000\054\002\uffdb\004\uffdb\006\uffdb\007\uffdb\010\uffdb\012" + "\uffdb\014\uffdb\021\uffdb\022\uffdb\023\uffdb\024\uffdb\025\uffdb" + "\026\uffdb\027\uffdb\030\uffdb\031\uffdb\032\uffdb\033\uffdb\034" + "\uffdb\043\uffdb\044\uffdb\001\002\000\070\005\111\013\103" + "\016\066\017\106\032\031\033\040\036\034\037\113\040" + "\141\041\142\042\145\045\063\046\062\047\065\050\115" + "\051\123\052\136\053\077\054\143\055\131\056\125\057" + "\116\060\104\061\140\062\067\063\060\064\127\001\002" + "\000\070\005\111\013\103\016\066\017\106\032\031\033" + "\040\036\034\037\113\040\141\041\142\042\145\045\063" + "\046\062\047\065\050\115\051\123\052\136\053\077\054" + "\143\055\131\056\125\057\116\060\104\061\140\062\067" + "\063\060\064\127\001\002\000\052\002\uffc0\004\153\007" + "\uffc0\010\uffc0\012\uffc0\014\uffc0\021\152\022\uffc0\023\uffc0" + "\024\uffc0\025\uffc0\026\uffc0\027\uffc0\030\uffc0\031\uffc0\032" + "\uffc0\033\uffc0\034\uffc0\043\uffc0\044\uffc0\001\002\000\052" + "\002\uffbf\004\153\007\uffbf\010\uffbf\012\uffbf\014\uffbf\021" + "\152\022\uffbf\023\uffbf\024\uffbf\025\uffbf\026\uffbf\027\uffbf" + "\030\uffbf\031\uffbf\032\uffbf\033\uffbf\034\uffbf\043\uffbf\044" + "\uffbf\001\002\000\106\004\061\005\111\011\071\013\103" + "\015\134\016\066\017\106\021\070\032\031\033\040\035" + "\057\036\034\037\113\040\141\041\142\042\145\045\063" + "\046\062\047\065\050\115\051\123\052\136\053\077\054" + "\143\055\131\056\125\057\116\060\104\061\140\062\067" + "\063\060\064\127\065\132\066\072\001\002\000\044\002" + "\uffc3\007\uffc3\012\uffc3\014\uffc3\022\uffc3\023\uffc3\024\uffc3" + "\025\uffc3\026\uffc3\027\uffc3\030\uffc3\031\uffc3\032\uffc3\033" + "\uffc3\034\uffc3\043\uffc3\044\uffc3\001\002\000\052\002\uff9d" + "\004\uff9d\007\uff9d\010\uff9d\012\uff9d\014\uff9d\021\uff9d\022" + "\uff9d\023\uff9d\024\uff9d\025\uff9d\026\uff9d\027\uff9d\030\uff9d" + "\031\uff9d\032\uff9d\033\uff9d\034\uff9d\043\uff9d\044\uff9d\001" + "\002\000\112\004\061\005\111\011\071\012\202\013\103" + "\015\134\016\066\017\106\021\070\031\075\032\031\033" + "\040\035\057\036\034\037\113\040\141\041\142\042\145" + "\045\063\046\062\047\065\050\115\051\123\052\136\053" + "\077\054\143\055\131\056\125\057\116\060\104\061\140" + "\062\067\063\060\064\127\065\132\066\072\001\002\000" + "\054\002\uff95\004\uff95\006\uff95\007\uff95\010\uff95\012\uff95" + "\014\uff95\021\uff95\022\uff95\023\uff95\024\uff95\025\uff95\026" + "\uff95\027\uff95\030\uff95\031\uff95\032\uff95\033\uff95\034\uff95" + "\043\uff95\044\uff95\001\002\000\006\012\uff93\014\207\001" + "\002\000\006\012\uff8f\014\uff8f\001\002\000\004\012\206" + "\001\002\000\054\002\uff94\004\uff94\006\uff94\007\uff94\010" + "\uff94\012\uff94\014\uff94\021\uff94\022\uff94\023\uff94\024\uff94" + "\025\uff94\026\uff94\027\uff94\030\uff94\031\uff94\032\uff94\033" + "\uff94\034\uff94\043\uff94\044\uff94\001\002\000\110\004\061" + "\005\111\011\071\013\103\015\134\016\066\017\106\021" + "\070\031\075\032\031\033\040\035\057\036\034\037\113" + "\040\141\041\142\042\145\045\063\046\062\047\065\050" + "\115\051\123\052\136\053\077\054\143\055\131\056\125" + "\057\116\060\104\061\140\062\067\063\060\064\127\065" + "\132\066\072\001\002\000\004\012\uff92\001\002\000\110" + "\004\061\005\111\011\071\013\103\015\134\016\066\017" + "\106\021\070\031\075\032\031\033\040\035\057\036\034" + "\037\113\040\141\041\142\042\145\045\063\046\062\047" + "\065\050\115\051\123\052\136\053\077\054\143\055\131" + "\056\125\057\116\060\104\061\140\062\067\063\060\064" + "\127\065\132\066\072\001\002\000\110\004\061\005\111" + "\011\071\013\103\015\134\016\066\017\106\021\070\031" + "\075\032\031\033\040\035\057\036\034\037\113\040\141" + "\041\142\042\145\045\063\046\062\047\065\050\115\051" + "\123\052\136\053\077\054\143\055\131\056\125\057\116" + "\060\104\061\140\062\067\063\060\064\127\065\132\066" + "\072\001\002\000\044\002\uffcb\007\uffcb\012\uffcb\014\uffcb" + "\022\uffcb\023\uffcb\024\uffcb\025\uffcb\026\uffcb\027\uffcb\030" + "\uffcb\031\uffcb\032\161\033\157\034\160\043\uffcb\044\uffcb" + "\001\002\000\044\002\uffcc\007\uffcc\012\uffcc\014\uffcc\022" + "\uffcc\023\uffcc\024\uffcc\025\uffcc\026\uffcc\027\uffcc\030\uffcc" + "\031\uffcc\032\161\033\157\034\160\043\uffcc\044\uffcc\001" + "\002\000\052\002\uffb3\004\uffb3\007\uffb3\010\uffb3\012\uffb3" + "\014\uffb3\021\uffb3\022\uffb3\023\uffb3\024\uffb3\025\uffb3\026" + "\uffb3\027\uffb3\030\uffb3\031\uffb3\032\uffb3\033\uffb3\034\uffb3" + "\043\uffb3\044\uffb3\001\002\000\110\004\061\005\111\011" + "\071\013\103\015\134\016\066\017\106\021\070\031\075" + "\032\031\033\040\035\057\036\034\037\113\040\141\041" + "\142\042\145\045\063\046\062\047\065\050\115\051\123" + "\052\136\053\077\054\143\055\131\056\125\057\116\060" + "\104\061\140\062\067\063\060\064\127\065\132\066\072" + "\001\002\000\110\004\061\005\111\011\071\013\103\015" + "\134\016\066\017\106\021\070\031\075\032\031\033\040" + "\035\057\036\034\037\113\040\141\041\142\042\145\045" + "\063\046\062\047\065\050\115\051\123\052\136\053\077" + "\054\143\055\131\056\125\057\116\060\104\061\140\062" + "\067\063\060\064\127\065\132\066\072\001\002\000\032" + "\002\uffd3\007\uffd3\012\uffd3\014\uffd3\022\uffd3\023\uffd3\024" + "\221\025\222\026\223\027\224\043\uffd3\044\uffd3\001\002" + "\000\110\004\061\005\111\011\071\013\103\015\134\016" + "\066\017\106\021\070\031\075\032\031\033\040\035\057" + "\036\034\037\113\040\141\041\142\042\145\045\063\046" + "\062\047\065\050\115\051\123\052\136\053\077\054\143" + "\055\131\056\125\057\116\060\104\061\140\062\067\063" + "\060\064\127\065\132\066\072\001\002\000\110\004\061" + "\005\111\011\071\013\103\015\134\016\066\017\106\021" + "\070\031\075\032\031\033\040\035\057\036\034\037\113" + "\040\141\041\142\042\145\045\063\046\062\047\065\050" + "\115\051\123\052\136\053\077\054\143\055\131\056\125" + "\057\116\060\104\061\140\062\067\063\060\064\127\065" + "\132\066\072\001\002\000\110\004\061\005\111\011\071" + "\013\103\015\134\016\066\017\106\021\070\031\075\032" + "\031\033\040\035\057\036\034\037\113\040\141\041\142" + "\042\145\045\063\046\062\047\065\050\115\051\123\052" + "\136\053\077\054\143\055\131\056\125\057\116\060\104" + "\061\140\062\067\063\060\064\127\065\132\066\072\001" + "\002\000\110\004\061\005\111\011\071\013\103\015\134" + "\016\066\017\106\021\070\031\075\032\031\033\040\035" + "\057\036\034\037\113\040\141\041\142\042\145\045\063" + "\046\062\047\065\050\115\051\123\052\136\053\077\054" + "\143\055\131\056\125\057\116\060\104\061\140\062\067" + "\063\060\064\127\065\132\066\072\001\002\000\036\002" + "\uffce\007\uffce\012\uffce\014\uffce\022\uffce\023\uffce\024\uffce" + "\025\uffce\026\uffce\027\uffce\030\211\031\212\043\uffce\044" + "\uffce\001\002\000\036\002\uffcf\007\uffcf\012\uffcf\014\uffcf" + "\022\uffcf\023\uffcf\024\uffcf\025\uffcf\026\uffcf\027\uffcf\030" + "\211\031\212\043\uffcf\044\uffcf\001\002\000\036\002\uffd0" + "\007\uffd0\012\uffd0\014\uffd0\022\uffd0\023\uffd0\024\uffd0\025" + "\uffd0\026\uffd0\027\uffd0\030\211\031\212\043\uffd0\044\uffd0" + "\001\002\000\036\002\uffd1\007\uffd1\012\uffd1\014\uffd1\022" + "\uffd1\023\uffd1\024\uffd1\025\uffd1\026\uffd1\027\uffd1\030\211" + "\031\212\043\uffd1\044\uffd1\001\002\000\032\002\uffd4\007" + "\uffd4\012\uffd4\014\uffd4\022\uffd4\023\uffd4\024\221\025\222" + "\026\223\027\224\043\uffd4\044\uffd4\001\002\000\110\004" + "\061\005\111\011\071\013\103\015\134\016\066\017\106" + "\021\070\031\075\032\031\033\040\035\057\036\034\037" + "\113\040\141\041\142\042\145\045\063\046\062\047\065" + "\050\115\051\123\052\136\053\077\054\143\055\131\056" + "\125\057\116\060\104\061\140\062\067\063\060\064\127" + "\065\132\066\072\001\002\000\016\002\uffd8\007\uffd8\012" + "\uffd8\014\uffd8\043\uffd8\044\234\001\002\000\110\004\061" + "\005\111\011\071\013\103\015\134\016\066\017\106\021" + "\070\031\075\032\031\033\040\035\057\036\034\037\113" + "\040\141\041\142\042\145\045\063\046\062\047\065\050" + "\115\051\123\052\136\053\077\054\143\055\131\056\125" + "\057\116\060\104\061\140\062\067\063\060\064\127\065" + "\132\066\072\001\002\000\022\002\uffd6\007\uffd6\012\uffd6" + "\014\uffd6\022\216\023\217\043\uffd6\044\uffd6\001\002\000" + "\062\013\uffaf\032\uffaf\033\uffaf\036\uffaf\037\uffaf\040\uffaf" + "\041\uffaf\042\uffaf\045\uffaf\046\uffaf\047\uffaf\050\uffaf\051" + "\uffaf\052\uffaf\053\uffaf\054\uffaf\055\uffaf\056\uffaf\057\uffaf" + "\060\uffaf\061\uffaf\062\uffaf\063\uffaf\064\uffaf\001\002\000" + "\054\002\uffb1\004\uffb1\006\055\007\uffb1\010\uffb1\012\uffb1" + "\014\uffb1\021\uffb1\022\uffb1\023\uffb1\024\uffb1\025\uffb1\026" + "\uffb1\027\uffb1\030\uffb1\031\uffb1\032\uffb1\033\uffb1\034\uffb1" + "\043\uffb1\044\uffb1\001\002\000\052\002\uffb2\004\uffb2\007" + "\uffb2\010\uffb2\012\uffb2\014\uffb2\021\uffb2\022\uffb2\023\uffb2" + "\024\uffb2\025\uffb2\026\uffb2\027\uffb2\030\uffb2\031\uffb2\032" + "\uffb2\033\uffb2\034\uffb2\043\uffb2\044\uffb2\001\002\000\044" + "\002\uffc5\007\uffc5\012\uffc5\014\uffc5\022\uffc5\023\uffc5\024" + "\uffc5\025\uffc5\026\uffc5\027\uffc5\030\uffc5\031\uffc5\032\uffc5" + "\033\uffc5\034\uffc5\043\uffc5\044\uffc5\001\002\000\004\012" + "\243\001\002\000\054\002\uff9b\004\uff9b\006\uff9b\007\uff9b" + "\010\uff9b\012\uff9b\014\uff9b\021\uff9b\022\uff9b\023\uff9b\024" + "\uff9b\025\uff9b\026\uff9b\027\uff9b\030\uff9b\031\uff9b\032\uff9b" + "\033\uff9b\034\uff9b\043\uff9b\044\uff9b\001\002\000\052\002" + "\uffb5\004\153\007\uffb5\010\uffb5\012\uffb5\014\uffb5\021\152" + "\022\uffb5\023\uffb5\024\uffb5\025\uffb5\026\uffb5\027\uffb5\030" + "\uffb5\031\uffb5\032\uffb5\033\uffb5\034\uffb5\043\uffb5\044\uffb5" + "\001\002\000\004\035\246\001\002\000\004\012\247\001" + "\002\000\054\002\uff8a\004\uff8a\006\uff8a\007\uff8a\010\uff8a" + "\012\uff8a\014\uff8a\021\uff8a\022\uff8a\023\uff8a\024\uff8a\025" + "\uff8a\026\uff8a\027\uff8a\030\uff8a\031\uff8a\032\uff8a\033\uff8a" + "\034\uff8a\043\uff8a\044\uff8a\001\002\000\052\002\uffb8\004" + "\153\007\uffb8\010\uffb8\012\uffb8\014\uffb8\021\152\022\uffb8" + "\023\uffb8\024\uffb8\025\uffb8\026\uffb8\027\uffb8\030\uffb8\031" + "\uffb8\032\uffb8\033\uffb8\034\uffb8\043\uffb8\044\uffb8\001\002" + "\000\052\002\uffdc\004\uffdc\007\uffdc\010\uffdc\012\uffdc\014" + "\uffdc\021\uffdc\022\uffdc\023\uffdc\024\uffdc\025\uffdc\026\uffdc" + "\027\uffdc\030\uffdc\031\uffdc\032\uffdc\033\uffdc\034\uffdc\043" + "\uffdc\044\uffdc\001\002\000\062\013\uffde\032\uffde\033\uffde" + "\036\uffde\037\uffde\040\uffde\041\uffde\042\uffde\045\uffde\046" + "\uffde\047\uffde\050\uffde\051\uffde\052\uffde\053\uffde\054\uffde" + "\055\uffde\056\uffde\057\uffde\060\uffde\061\uffde\062\uffde\063" + "\uffde\064\uffde\001\002\000\004\035\254\001\002\000\004" + "\014\255\001\002\000\004\035\256\001\002\000\004\012" + "\257\001\002\000\012\002\ufff4\004\ufff4\010\ufff4\021\ufff4" + "\001\002\000\004\035\261\001\002\000\004\012\262\001" + "\002\000\012\002\ufff5\004\ufff5\010\ufff5\021\ufff5\001\002" + "\000\012\002\uffec\004\uffec\010\uffec\021\uffec\001\002\000" + "\062\013\uffdf\032\uffdf\033\uffdf\036\uffdf\037\uffdf\040\uffdf" + "\041\uffdf\042\uffdf\045\uffdf\046\uffdf\047\uffdf\050\uffdf\051" + "\uffdf\052\uffdf\053\uffdf\054\uffdf\055\uffdf\056\uffdf\057\uffdf" + "\060\uffdf\061\uffdf\062\uffdf\063\uffdf\064\uffdf\001\002\000" + "\064\013\027\016\020\032\031\033\040\036\034\037\113" + "\040\141\041\047\042\051\045\015\046\014\047\016\050" + "\036\051\037\052\044\053\025\054\050\055\043\056\041" + "\057\035\060\030\061\045\062\021\063\012\064\042\001" + "\002\000\064\013\027\016\020\032\031\033\040\036\034" + "\037\113\040\141\041\047\042\051\045\015\046\014\047" + "\016\050\036\051\037\052\044\053\025\054\050\055\043" + "\056\041\057\035\060\030\061\045\062\021\063\012\064" + "\042\001\002\000\006\002\ufff1\010\ufff1\001\002\000\006" + "\002\ufff0\010\ufff0\001\002\000\006\002\ufff7\010\ufff7\001" + "\002\000\014\002\uffe9\004\uffe9\006\055\010\uffe9\021\uffe9" + "\001\002\000\014\002\uffeb\004\uffeb\006\055\010\uffeb\021" + "\uffeb\001\002\000\012\002\uffea\004\uffea\010\uffea\021\uffea" + "\001\002\000\012\002\uffe8\004\uffe8\010\uffe8\021\uffe8\001" + "\002\000\064\013\027\016\020\032\031\033\040\036\034" + "\037\113\040\141\041\047\042\051\045\015\046\014\047" + "\016\050\036\051\037\052\044\053\025\054\050\055\043" + "\056\041\057\035\060\030\061\045\062\021\063\012\064" + "\042\001\002\000\064\013\027\016\020\032\031\033\040" + "\036\034\037\113\040\141\041\047\042\051\045\015\046" + "\014\047\016\050\036\051\037\052\044\053\025\054\050" + "\055\043\056\041\057\035\060\030\061\045\062\021\063" + "\012\064\042\001\002\000\006\002\ufff9\010\ufff9\001\002" + "\000\006\002\ufff8\010\ufff8\001\002\000\004\035\303\001" + "\002\000\004\012\304\001\002\000\014\002\ufff3\004\ufff3" + "\006\ufff3\010\ufff3\021\ufff3\001\002\000\006\002\ufffb\010" + "\ufffb\001\002\000\070\004\013\013\027\016\020\021\023" + "\032\031\033\040\036\034\037\033\040\046\041\047\042" + "\051\045\015\046\014\047\016\050\036\051\037\052\044" + "\053\025\054\050\055\043\056\041\057\035\060\030\061" + "\045\062\021\063\012\064\042\001\002\000\004\002\ufffd" + "\001\002\000\004\002\uffff\001\002\000\004\002\001\001" + "\002" }); /** Access to parse-action table. */ public short[][] action_table() {return _action_table;} /** reduce_goto table. */ protected static final short[][] _reduce_table = unpackFromStrings(new String[] { "\000\307\000\004\003\003\001\001\000\002\001\001\000" + "\070\004\307\006\120\010\127\011\117\012\101\013\075" + "\014\104\015\063\016\111\017\145\020\113\021\125\022" + "\073\023\121\024\143\025\123\026\136\027\146\030\134" + "\031\107\032\072\033\106\034\147\047\150\050\116\052" + "\100\053\077\001\001\000\026\035\016\036\007\037\006" + "\040\031\041\025\042\023\043\052\044\010\047\051\054" + "\021\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\020\040\031\041\304\042" + "\023\043\052\044\010\047\051\054\021\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\012\040\271" + "\043\272\044\010\047\051\001\001\000\020\040\031\041" + "\270\042\023\043\052\044\010\047\051\054\021\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\006" + "\007\053\045\262\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\006\007\053\045\055\001\001" + "\000\006\007\053\045\250\001\001\000\070\004\132\006" + "\120\010\127\011\117\012\101\013\075\014\104\015\063" + "\016\111\017\145\020\113\021\125\022\073\023\121\024" + "\143\025\123\026\136\027\146\030\134\031\107\032\072" + "\033\106\034\147\047\150\050\116\052\100\053\077\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\024\011\117\026\136\027\247\030\134\033\106\034" + "\147\047\153\052\100\053\077\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\024\011\117\026\136" + "\027\243\030\134\033\106\034\147\047\153\052\100\053" + "\077\001\001\000\070\004\241\006\120\010\127\011\117" + "\012\101\013\075\014\104\015\063\016\111\017\145\020" + "\113\021\125\022\073\023\121\024\143\025\123\026\136" + "\027\146\030\134\031\107\032\072\033\106\034\147\047" + "\150\050\116\052\100\053\077\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\052\006\120\010" + "\127\011\117\020\240\021\125\022\073\023\121\024\143" + "\025\123\026\136\027\146\030\134\031\107\032\072\033" + "\106\034\147\047\150\050\116\052\100\053\077\001\001" + "\000\002\001\001\000\002\001\001\000\010\033\236\034" + "\147\047\153\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\006\007\053\045\214\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\006\007\053\045\177\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\006\047\164\051\166\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\020\011\155\026\136\033\106\034\147\047\153\052\100" + "\053\077\001\001\000\020\011\154\026\136\033\106\034" + "\147\047\153\052\100\053\077\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\052\006\120\010" + "\127\011\117\020\163\021\125\022\073\023\121\024\143" + "\025\123\026\136\027\146\030\134\031\107\032\072\033" + "\106\034\147\047\150\050\116\052\100\053\077\001\001" + "\000\052\006\120\010\127\011\117\020\162\021\125\022" + "\073\023\121\024\143\025\123\026\136\027\146\030\134" + "\031\107\032\072\033\106\034\147\047\150\050\116\052" + "\100\053\077\001\001\000\052\006\120\010\127\011\117" + "\020\161\021\125\022\073\023\121\024\143\025\123\026" + "\136\027\146\030\134\031\107\032\072\033\106\034\147" + "\047\150\050\116\052\100\053\077\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\024\011\117\026\136\027\174\030\134" + "\033\106\034\147\047\153\052\100\053\077\001\001\000" + "\024\011\117\026\136\027\173\030\134\033\106\034\147" + "\047\153\052\100\053\077\001\001\000\002\001\001\000" + "\002\001\001\000\050\006\120\010\127\011\117\021\125" + "\022\073\023\121\024\176\025\123\026\136\027\146\030" + "\134\031\107\032\072\033\106\034\147\047\150\050\116" + "\052\100\053\077\001\001\000\002\001\001\000\002\001" + "\001\000\074\004\203\005\202\006\120\010\127\011\117" + "\012\101\013\075\014\104\015\063\016\111\017\145\020" + "\113\021\125\022\073\023\121\024\143\025\123\026\136" + "\027\146\030\134\031\107\032\072\033\106\034\147\046" + "\204\047\150\050\116\052\100\053\077\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\074\004\203\005\202\006\120" + "\010\127\011\117\012\101\013\075\014\104\015\063\016" + "\111\017\145\020\113\021\125\022\073\023\121\024\143" + "\025\123\026\136\027\146\030\134\031\107\032\072\033" + "\106\034\147\046\207\047\150\050\116\052\100\053\077" + "\001\001\000\002\001\001\000\054\006\120\010\127\011" + "\117\017\213\020\113\021\125\022\073\023\121\024\143" + "\025\123\026\136\027\146\030\134\031\107\032\072\033" + "\106\034\147\047\150\050\116\052\100\053\077\001\001" + "\000\054\006\120\010\127\011\117\017\212\020\113\021" + "\125\022\073\023\121\024\143\025\123\026\136\027\146" + "\030\134\031\107\032\072\033\106\034\147\047\150\050" + "\116\052\100\053\077\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\060\006\120\010\127\011" + "\117\015\230\016\111\017\145\020\113\021\125\022\073" + "\023\121\024\143\025\123\026\136\027\146\030\134\031" + "\107\032\072\033\106\034\147\047\150\050\116\052\100" + "\053\077\001\001\000\060\006\120\010\127\011\117\015" + "\217\016\111\017\145\020\113\021\125\022\073\023\121" + "\024\143\025\123\026\136\027\146\030\134\031\107\032" + "\072\033\106\034\147\047\150\050\116\052\100\053\077" + "\001\001\000\002\001\001\000\056\006\120\010\127\011" + "\117\016\227\017\145\020\113\021\125\022\073\023\121" + "\024\143\025\123\026\136\027\146\030\134\031\107\032" + "\072\033\106\034\147\047\150\050\116\052\100\053\077" + "\001\001\000\056\006\120\010\127\011\117\016\226\017" + "\145\020\113\021\125\022\073\023\121\024\143\025\123" + "\026\136\027\146\030\134\031\107\032\072\033\106\034" + "\147\047\150\050\116\052\100\053\077\001\001\000\056" + "\006\120\010\127\011\117\016\225\017\145\020\113\021" + "\125\022\073\023\121\024\143\025\123\026\136\027\146" + "\030\134\031\107\032\072\033\106\034\147\047\150\050" + "\116\052\100\053\077\001\001\000\056\006\120\010\127" + "\011\117\016\224\017\145\020\113\021\125\022\073\023" + "\121\024\143\025\123\026\136\027\146\030\134\031\107" + "\032\072\033\106\034\147\047\150\050\116\052\100\053" + "\077\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\064\006" + "\120\010\127\011\117\013\232\014\104\015\063\016\111" + "\017\145\020\113\021\125\022\073\023\121\024\143\025" + "\123\026\136\027\146\030\134\031\107\032\072\033\106" + "\034\147\047\150\050\116\052\100\053\077\001\001\000" + "\002\001\001\000\062\006\120\010\127\011\117\014\234" + "\015\063\016\111\017\145\020\113\021\125\022\073\023" + "\121\024\143\025\123\026\136\027\146\030\134\031\107" + "\032\072\033\106\034\147\047\150\050\116\052\100\053" + "\077\001\001\000\002\001\001\000\002\001\001\000\006" + "\007\053\045\237\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\020\040\031\041\267\042\023\043\052\044\010\047\051" + "\054\021\001\001\000\020\040\031\041\266\042\023\043" + "\052\044\010\047\051\054\021\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\006\007\053\045" + "\274\001\001\000\006\007\053\045\273\001\001\000\002" + "\001\001\000\002\001\001\000\020\040\031\041\300\042" + "\023\043\052\044\010\047\051\054\021\001\001\000\020" + "\040\031\041\277\042\023\043\052\044\010\047\051\054" + "\021\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\026\035\016\036\306\037\006\040\031\041\025" + "\042\023\043\052\044\010\047\051\054\021\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001" }); /** Access to reduce_goto table. */ public short[][] reduce_table() {return _reduce_table;} /** Instance of action encapsulation class. */ protected CUP$XPathParser$actions action_obj; /** Action encapsulation object initializer. */ protected void init_actions() { action_obj = new CUP$XPathParser$actions(this); } /** Invoke a user supplied parse action. */ public java_cup.runtime.Symbol do_action( int act_num, java_cup.runtime.lr_parser parser, java.util.Stack stack, int top) throws java.lang.Exception { /* call code in generated class */ return action_obj.CUP$XPathParser$do_action(act_num, parser, stack, top); } /** Indicates start state. */ public int start_state() {return 0;} /** Indicates start production. */ public int start_production() {return 0;} /** EOF Symbol index. */ public int EOF_sym() {return 0;} /** error Symbol index. */ public int error_sym() {return 1;} /** * Used by function calls with no args. */ static public final Vector EmptyArgs = new Vector(0); /** * Reference to non-existing variable. */ static public final VariableRef DummyVarRef = null; /** * Reference to the Parser class. */ private Parser _parser; private XSLTC _xsltc; /** * String representation of the expression being parsed. */ private String _expression; /** * Line number where this expression/pattern was declared. */ private int _lineNumber = 0; /** * Reference to the symbol table. */ public SymbolTable _symbolTable; public XPathParser(Parser parser) { _parser = parser; _xsltc = parser.getXSLTC(); _symbolTable = parser.getSymbolTable(); } public int getLineNumber() { return _lineNumber; } public QName getQNameIgnoreDefaultNs(String name) { return _parser.getQNameIgnoreDefaultNs(name); } public QName getQName(String namespace, String prefix, String localname) { return _parser.getQName(namespace, prefix, localname); } public void setMultiDocument(boolean flag) { _xsltc.setMultiDocument(flag); } public void setCallsNodeset(boolean flag) { _xsltc.setCallsNodeset(flag); } public void setHasIdCall(boolean flag) { _xsltc.setHasIdCall(flag); } /** * This method is similar to findNodeType(int, Object) except that it * creates a StepPattern instead of just returning a node type. It also * differs in the way it handles "{uri}:*" and "{uri}:@*". The last two * patterns are expanded as "*[namespace-uri() = 'uri']" and * "@*[namespace-uri() = 'uri']", respectively. This expansion considerably * simplifies the grouping of patterns in the Mode class. For this * expansion to be correct, the priority of the pattern/template must be * set to -0.25 (when no other predicates are present). */ public StepPattern createStepPattern(int axis, Object test, Vector predicates) { int nodeType; if (test == null) { // "*" nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : (axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT; return new StepPattern(axis, nodeType, predicates); } else if (test instanceof Integer) { nodeType = ((Integer) test).intValue(); return new StepPattern(axis, nodeType, predicates); } else { QName name = (QName)test; boolean setPriority = false; if (axis == Axis.NAMESPACE) { nodeType = (name.toString().equals("*")) ? -1 : _xsltc.registerNamespacePrefix(name);; } else { final String uri = name.getNamespace(); final String local = name.getLocalPart(); final QName namespace_uri = _parser.getQNameIgnoreDefaultNs("namespace-uri"); // Expand {uri}:* to *[namespace-uri() = 'uri'] - same for @* if (uri != null && (local.equals("*") || local.equals("@*"))) { if (predicates == null) { predicates = new Vector(2); } // Priority is set by hand if no other predicates exist setPriority = (predicates.size() == 0); predicates.add( new Predicate( new EqualityExpr(Operators.EQ, new NamespaceUriCall(namespace_uri), new LiteralExpr(uri)))); } if (local.equals("*")) { nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : NodeTest.ELEMENT; } else if (local.equals("@*")) { nodeType = NodeTest.ATTRIBUTE; } else { nodeType = (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name) : _xsltc.registerElement(name); } } final StepPattern result = new StepPattern(axis, nodeType, predicates); // Set priority for case prefix:* and prefix:@* (no predicates) if (setPriority) { result.setPriority(-0.25); } return result; } } public int findNodeType(int axis, Object test) { if (test == null) { // * return (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : (axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT; } else if (test instanceof Integer) { return ((Integer)test).intValue(); } else { QName name = (QName)test; if (axis == Axis.NAMESPACE) { return (name.toString().equals("*")) ? -1 : _xsltc.registerNamespacePrefix(name); } if (name.getNamespace() == null) { final String local = name.getLocalPart(); if (local.equals("*")) { return (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE : NodeTest.ELEMENT; } else if (local.equals("@*")) { return NodeTest.ATTRIBUTE; } } return (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name) : _xsltc.registerElement(name); } } /** * Parse the expression passed to the current scanner. If this * expression contains references to local variables and it will be * compiled in an external module (not in the main class) request * the current template to create a new variable stack frame. * * @param lineNumber Line where the current expression is defined. * @param external Set to true if this expression is * compiled in a separate module. * */ public Symbol parse(String expression, int lineNumber) throws Exception { try { _expression = expression; _lineNumber = lineNumber; return super.parse(); } catch (IllegalCharException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_CHAR_ERR, lineNumber, e.getMessage()); _parser.reportError(Constants.FATAL, err); } return null; } /** * Lookup a variable or parameter in the symbol table given its name. * * @param name Name of the symbol being looked up. */ final SyntaxTreeNode lookupName(QName name) { // Is it a local var or param ? final SyntaxTreeNode result = _parser.lookupVariable(name); if (result != null) return(result); else return(_symbolTable.lookupName(name)); } public final void addError(ErrorMsg error) { _parser.reportError(Constants.ERROR, error); } public void report_error(String message, Object info) { final ErrorMsg err = new ErrorMsg(ErrorMsg.SYNTAX_ERR, _lineNumber, _expression); _parser.reportError(Constants.FATAL, err); } public void report_fatal_error(String message, Object info) { // empty } public RelativeLocationPath insertStep(Step step, RelativeLocationPath rlp) { if (rlp instanceof Step) { return new ParentLocationPath(step, (Step) rlp); } else if (rlp instanceof ParentLocationPath) { final ParentLocationPath plp = (ParentLocationPath) rlp; final RelativeLocationPath newrlp = insertStep(step, plp.getPath()); return new ParentLocationPath(newrlp, plp.getStep()); } else { addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep")); return rlp; } } /** * Returns true if the axis applies to elements only. The axes * child, attribute, namespace, descendant result in non-empty * nodesets only if the context node is of type element. */ public boolean isElementAxis(int axis) { return (axis == Axis.CHILD || axis == Axis.ATTRIBUTE || axis == Axis.NAMESPACE || axis == Axis.DESCENDANT); } } /** Cup generated class to encapsulate user supplied action code.*/ class CUP$XPathParser$actions { private final XPathParser parser; /** Constructor */ CUP$XPathParser$actions(XPathParser parser) { this.parser = parser; } /** Method with the actual generated action code. */ public final java_cup.runtime.Symbol CUP$XPathParser$do_action( int CUP$XPathParser$act_num, java_cup.runtime.lr_parser CUP$XPathParser$parser, java.util.Stack CUP$XPathParser$stack, int CUP$XPathParser$top) throws java.lang.Exception { /* Symbol object for return from actions */ java_cup.runtime.Symbol CUP$XPathParser$result; /* select the action based on the action number */ switch (CUP$XPathParser$act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 140: // QName ::= ID { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("id"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 139: // QName ::= SELF { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("self"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 138: // QName ::= PRECEDINGSIBLING { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("preceding-sibling"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 137: // QName ::= PRECEDING { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("preceding"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 136: // QName ::= PARENT { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("parent"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 135: // QName ::= NAMESPACE { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("namespace"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 134: // QName ::= FOLLOWINGSIBLING { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("following-sibling"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 133: // QName ::= FOLLOWING { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("following"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 132: // QName ::= DESCENDANTORSELF { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("decendant-or-self"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 131: // QName ::= DESCENDANT { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("decendant"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 130: // QName ::= CHILD { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("child"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 129: // QName ::= ATTRIBUTE { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("attribute"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 128: // QName ::= ANCESTORORSELF { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("ancestor-or-self"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 127: // QName ::= ANCESTOR { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("child"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 126: // QName ::= KEY { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("key"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 125: // QName ::= MOD { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("mod"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 124: // QName ::= DIV { QName RESULT = null; RESULT = parser.getQNameIgnoreDefaultNs("div"); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 123: // QName ::= QNAME { QName RESULT = null; int qnameleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int qnameright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; String qname = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = parser.getQNameIgnoreDefaultNs(qname); CUP$XPathParser$result = new java_cup.runtime.Symbol(37/*QName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 122: // NameTest ::= QName { Object RESULT = null; int qnleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int qnright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; QName qn = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = qn; CUP$XPathParser$result = new java_cup.runtime.Symbol(26/*NameTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 121: // NameTest ::= STAR { Object RESULT = null; RESULT = null; CUP$XPathParser$result = new java_cup.runtime.Symbol(26/*NameTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 120: // NodeTest ::= PI { Object RESULT = null; RESULT = new Integer(NodeTest.PI); CUP$XPathParser$result = new java_cup.runtime.Symbol(25/*NodeTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 119: // NodeTest ::= PIPARAM LPAREN Literal RPAREN { Object RESULT = null; int lleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int lright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; String l = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; QName name = parser.getQNameIgnoreDefaultNs("name"); Expression exp = new EqualityExpr(Operators.EQ, new NameCall(name), new LiteralExpr(l)); Vector predicates = new Vector(); predicates.addElement(new Predicate(exp)); RESULT = new Step(Axis.CHILD, NodeTest.PI, predicates); CUP$XPathParser$result = new java_cup.runtime.Symbol(25/*NodeTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 118: // NodeTest ::= COMMENT { Object RESULT = null; RESULT = new Integer(NodeTest.COMMENT); CUP$XPathParser$result = new java_cup.runtime.Symbol(25/*NodeTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 117: // NodeTest ::= TEXT { Object RESULT = null; RESULT = new Integer(NodeTest.TEXT); CUP$XPathParser$result = new java_cup.runtime.Symbol(25/*NodeTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 116: // NodeTest ::= NODE { Object RESULT = null; RESULT = new Integer(NodeTest.ANODE); CUP$XPathParser$result = new java_cup.runtime.Symbol(25/*NodeTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 115: // NodeTest ::= NameTest { Object RESULT = null; int ntleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ntright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Object nt = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = nt; CUP$XPathParser$result = new java_cup.runtime.Symbol(25/*NodeTest*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 114: // Argument ::= Expr { Expression RESULT = null; int exleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int exright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ex = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ex; CUP$XPathParser$result = new java_cup.runtime.Symbol(3/*Argument*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 113: // VariableName ::= QName { QName RESULT = null; int vnameleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int vnameright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; QName vname = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = vname; CUP$XPathParser$result = new java_cup.runtime.Symbol(39/*VariableName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 112: // FunctionName ::= QName { QName RESULT = null; int fnameleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int fnameright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; QName fname = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = fname; CUP$XPathParser$result = new java_cup.runtime.Symbol(38/*FunctionName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 111: // NonemptyArgumentList ::= Argument COMMA NonemptyArgumentList { Vector RESULT = null; int argleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int argright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression arg = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int arglleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int arglright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector argl = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; argl.insertElementAt(arg, 0); RESULT = argl; CUP$XPathParser$result = new java_cup.runtime.Symbol(36/*NonemptyArgumentList*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 110: // NonemptyArgumentList ::= Argument { Vector RESULT = null; int argleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int argright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression arg = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; Vector temp = new Vector(); temp.addElement(arg); RESULT = temp; CUP$XPathParser$result = new java_cup.runtime.Symbol(36/*NonemptyArgumentList*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 109: // FunctionCall ::= FunctionName LPAREN NonemptyArgumentList RPAREN { Expression RESULT = null; int fnameleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).left; int fnameright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).right; QName fname = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).value; int arglleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int arglright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Vector argl = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; if (fname == parser.getQNameIgnoreDefaultNs("concat")) { RESULT = new ConcatCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("number")) { RESULT = new NumberCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("document")) { parser.setMultiDocument(true); RESULT = new DocumentCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("string")) { RESULT = new StringCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("boolean")) { RESULT = new BooleanCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("name")) { RESULT = new NameCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) { RESULT = new GenerateIdCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("not")) { RESULT = new NotCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("format-number")) { RESULT = new FormatNumberCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("unparsed-entity-uri")) { RESULT = new UnparsedEntityUriCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("key")) { RESULT = new KeyCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("id")) { RESULT = new KeyCall(fname, argl); parser.setHasIdCall(true); } else if (fname == parser.getQNameIgnoreDefaultNs("ceiling")) { RESULT = new CeilingCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("round")) { RESULT = new RoundCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("floor")) { RESULT = new FloorCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("contains")) { RESULT = new ContainsCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) { RESULT = new StringLengthCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("starts-with")) { RESULT = new StartsWithCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("function-available")) { RESULT = new FunctionAvailableCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("element-available")) { RESULT = new ElementAvailableCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("local-name")) { RESULT = new LocalNameCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("lang")) { RESULT = new LangCall(fname, argl); } else if (fname == parser.getQNameIgnoreDefaultNs("namespace-uri")) { RESULT = new NamespaceUriCall(fname, argl); } else if (fname == parser.getQName(Constants.TRANSLET_URI, "xsltc", "cast")) { RESULT = new CastCall(fname, argl); } // Special case for extension function nodeset() else if (fname.getLocalPart().equals("nodeset") || fname.getLocalPart().equals("node-set")) { parser.setCallsNodeset(true); // implies MultiDOM RESULT = new FunctionCall(fname, argl); } else { RESULT = new FunctionCall(fname, argl); } CUP$XPathParser$result = new java_cup.runtime.Symbol(16/*FunctionCall*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 108: // FunctionCall ::= FunctionName LPAREN RPAREN { Expression RESULT = null; int fnameleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int fnameright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; QName fname = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; if (fname == parser.getQNameIgnoreDefaultNs("current")) { RESULT = new CurrentCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("number")) { RESULT = new NumberCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("string")) { RESULT = new StringCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("concat")) { RESULT = new ConcatCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("true")) { RESULT = new BooleanExpr(true); } else if (fname == parser.getQNameIgnoreDefaultNs("false")) { RESULT = new BooleanExpr(false); } else if (fname == parser.getQNameIgnoreDefaultNs("name")) { RESULT = new NameCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) { RESULT = new GenerateIdCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) { RESULT = new StringLengthCall(fname, parser.EmptyArgs); } else if (fname == parser.getQNameIgnoreDefaultNs("position")) { RESULT = new PositionCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("last")) { RESULT = new LastCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("local-name")) { RESULT = new LocalNameCall(fname); } else if (fname == parser.getQNameIgnoreDefaultNs("namespace-uri")) { RESULT = new NamespaceUriCall(fname); } else { RESULT = new FunctionCall(fname, parser.EmptyArgs); } CUP$XPathParser$result = new java_cup.runtime.Symbol(16/*FunctionCall*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 107: // VariableReference ::= DOLLAR VariableName { Expression RESULT = null; int varNameleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int varNameright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; QName varName = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; // An empty qname prefix for a variable or parameter reference // should map to the null namespace and not the default URI. SyntaxTreeNode node = parser.lookupName(varName); if (node != null) { if (node instanceof Variable) { RESULT = new VariableRef((Variable)node); } else if (node instanceof Param) { RESULT = new ParameterRef((Param)node); } else { RESULT = new UnresolvedRef(varName); } } if (node == null) { RESULT = new UnresolvedRef(varName); } CUP$XPathParser$result = new java_cup.runtime.Symbol(15/*VariableReference*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 106: // PrimaryExpr ::= FunctionCall { Expression RESULT = null; int fcleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int fcright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression fc = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = fc; CUP$XPathParser$result = new java_cup.runtime.Symbol(17/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 105: // PrimaryExpr ::= REAL { Expression RESULT = null; int numleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int numright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Double num = (Double)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new RealExpr(num.doubleValue()); CUP$XPathParser$result = new java_cup.runtime.Symbol(17/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 104: // PrimaryExpr ::= INT { Expression RESULT = null; int numleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int numright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Long num = (Long)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; long value = num.longValue(); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { RESULT = new RealExpr(value); } else { if (num.doubleValue() == -0) RESULT = new RealExpr(num.doubleValue()); else if (num.intValue() == 0) RESULT = new IntExpr(num.intValue()); else if (num.doubleValue() == 0.0) RESULT = new RealExpr(num.doubleValue()); else RESULT = new IntExpr(num.intValue()); } CUP$XPathParser$result = new java_cup.runtime.Symbol(17/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 103: // PrimaryExpr ::= Literal { Expression RESULT = null; int stringleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int stringright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; String string = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; /* * If the string appears to have the syntax of a QName, store * namespace info in the literal expression. This is used for * element-available and function-available functions, among * others. Also, the default namespace must be ignored. */ String namespace = null; final int index = string.lastIndexOf(':'); if (index > 0) { final String prefix = string.substring(0, index); namespace = parser._symbolTable.lookupNamespace(prefix); } RESULT = (namespace == null) ? new LiteralExpr(string) : new LiteralExpr(string, namespace); CUP$XPathParser$result = new java_cup.runtime.Symbol(17/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 102: // PrimaryExpr ::= LPAREN Expr RPAREN { Expression RESULT = null; int exleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int exright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Expression ex = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = ex; CUP$XPathParser$result = new java_cup.runtime.Symbol(17/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 101: // PrimaryExpr ::= VariableReference { Expression RESULT = null; int vrleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int vrright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression vr = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = vr; CUP$XPathParser$result = new java_cup.runtime.Symbol(17/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 100: // FilterExpr ::= PrimaryExpr Predicates { Expression RESULT = null; int primaryleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int primaryright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Expression primary = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new FilterExpr(primary, pp); CUP$XPathParser$result = new java_cup.runtime.Symbol(6/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 99: // FilterExpr ::= PrimaryExpr { Expression RESULT = null; int primaryleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int primaryright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression primary = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = primary; CUP$XPathParser$result = new java_cup.runtime.Symbol(6/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 98: // AbbreviatedStep ::= DDOT { Expression RESULT = null; RESULT = new Step(Axis.PARENT, NodeTest.ANODE, null); CUP$XPathParser$result = new java_cup.runtime.Symbol(20/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 97: // AbbreviatedStep ::= DOT { Expression RESULT = null; RESULT = new Step(Axis.SELF, NodeTest.ANODE, null); CUP$XPathParser$result = new java_cup.runtime.Symbol(20/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 96: // AxisName ::= SELF { Integer RESULT = null; RESULT = new Integer(Axis.SELF); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 95: // AxisName ::= PRECEDINGSIBLING { Integer RESULT = null; RESULT = new Integer(Axis.PRECEDINGSIBLING); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 94: // AxisName ::= PRECEDING { Integer RESULT = null; RESULT = new Integer(Axis.PRECEDING); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 93: // AxisName ::= PARENT { Integer RESULT = null; RESULT = new Integer(Axis.PARENT); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 92: // AxisName ::= NAMESPACE { Integer RESULT = null; RESULT = new Integer(Axis.NAMESPACE); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 91: // AxisName ::= FOLLOWINGSIBLING { Integer RESULT = null; RESULT = new Integer(Axis.FOLLOWINGSIBLING); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 90: // AxisName ::= FOLLOWING { Integer RESULT = null; RESULT = new Integer(Axis.FOLLOWING); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 89: // AxisName ::= DESCENDANTORSELF { Integer RESULT = null; RESULT = new Integer(Axis.DESCENDANTORSELF); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 88: // AxisName ::= DESCENDANT { Integer RESULT = null; RESULT = new Integer(Axis.DESCENDANT); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 87: // AxisName ::= CHILD { Integer RESULT = null; RESULT = new Integer(Axis.CHILD); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 86: // AxisName ::= ATTRIBUTE { Integer RESULT = null; RESULT = new Integer(Axis.ATTRIBUTE); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 85: // AxisName ::= ANCESTORORSELF { Integer RESULT = null; RESULT = new Integer(Axis.ANCESTORORSELF); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 84: // AxisName ::= ANCESTOR { Integer RESULT = null; RESULT = new Integer(Axis.ANCESTOR); CUP$XPathParser$result = new java_cup.runtime.Symbol(40/*AxisName*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 83: // AxisSpecifier ::= ATSIGN { Integer RESULT = null; RESULT = new Integer(Axis.ATTRIBUTE); CUP$XPathParser$result = new java_cup.runtime.Symbol(41/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 82: // AxisSpecifier ::= AxisName DCOLON { Integer RESULT = null; int anleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int anright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Integer an = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = an; CUP$XPathParser$result = new java_cup.runtime.Symbol(41/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 81: // Step ::= AbbreviatedStep { Expression RESULT = null; int abbrevleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int abbrevright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression abbrev = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = abbrev; CUP$XPathParser$result = new java_cup.runtime.Symbol(7/*Step*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 80: // Step ::= AxisSpecifier NodeTest { Expression RESULT = null; int axisleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int axisright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Integer axis = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ntestleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ntestright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Object ntest = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new Step(axis.intValue(), parser.findNodeType(axis.intValue(), ntest), null); CUP$XPathParser$result = new java_cup.runtime.Symbol(7/*Step*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 79: // Step ::= AxisSpecifier NodeTest Predicates { Expression RESULT = null; int axisleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int axisright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Integer axis = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int ntestleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int ntestright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Object ntest = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new Step(axis.intValue(), parser.findNodeType(axis.intValue(), ntest), pp); CUP$XPathParser$result = new java_cup.runtime.Symbol(7/*Step*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 78: // Step ::= NodeTest Predicates { Expression RESULT = null; int ntestleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int ntestright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Object ntest = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; if (ntest instanceof Step) { Step step = (Step)ntest; step.addPredicates(pp); RESULT = (Step)ntest; } else { RESULT = new Step(Axis.CHILD, parser.findNodeType(Axis.CHILD, ntest), pp); } CUP$XPathParser$result = new java_cup.runtime.Symbol(7/*Step*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 77: // Step ::= NodeTest { Expression RESULT = null; int ntestleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ntestright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Object ntest = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; if (ntest instanceof Step) { RESULT = (Step)ntest; } else { RESULT = new Step(Axis.CHILD, parser.findNodeType(Axis.CHILD, ntest), null); } CUP$XPathParser$result = new java_cup.runtime.Symbol(7/*Step*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 76: // AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath { Expression RESULT = null; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; // // Expand '//' into '/descendant-or-self::node()/' or // into /descendant-or-self::*/ // int nodeType = DOM.NO_TYPE; if (rlp instanceof Step && parser.isElementAxis(((Step) rlp).getAxis())) { nodeType = DTM.ELEMENT_NODE; } final Step step = new Step(Axis.DESCENDANTORSELF, nodeType, null); RESULT = new AbsoluteLocationPath(parser.insertStep(step, (RelativeLocationPath) rlp)); CUP$XPathParser$result = new java_cup.runtime.Symbol(24/*AbbreviatedAbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 75: // AbbreviatedRelativeLocationPath ::= RelativeLocationPath DSLASH Step { Expression RESULT = null; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int stepleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int stepright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression step = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; final Step right = (Step)step; final int axis = right.getAxis(); final int type = right.getNodeType(); final Vector predicates = right.getPredicates(); if ((axis == Axis.CHILD) && (type != NodeTest.ATTRIBUTE)) { // Compress './/child:E' into 'descendant::E' - if possible if (predicates == null) { right.setAxis(Axis.DESCENDANT); if (rlp instanceof Step && ((Step)rlp).isAbbreviatedDot()) { RESULT = right; } else { // Expand 'rlp//child::E' into 'rlp/descendant::E' RelativeLocationPath left = (RelativeLocationPath)rlp; RESULT = new ParentLocationPath(left, right); } } else { // Expand './/step' -> 'descendant-or-self::*/step' if (rlp instanceof Step && ((Step)rlp).isAbbreviatedDot()) { Step left = new Step(Axis.DESCENDANTORSELF, DTM.ELEMENT_NODE, null); RESULT = new ParentLocationPath(left, right); } else { // Expand 'rlp//step' -> 'rlp/descendant-or-self::*/step' RelativeLocationPath left = (RelativeLocationPath)rlp; Step mid = new Step(Axis.DESCENDANTORSELF, DTM.ELEMENT_NODE, null); ParentLocationPath ppl = new ParentLocationPath(mid, right); RESULT = new ParentLocationPath(left, ppl); } } } else if ((axis == Axis.ATTRIBUTE) || (type == NodeTest.ATTRIBUTE)) { // Expand 'rlp//step' -> 'rlp/descendant-or-self::*/step' RelativeLocationPath left = (RelativeLocationPath)rlp; Step middle = new Step(Axis.DESCENDANTORSELF, DTM.ELEMENT_NODE, null); ParentLocationPath ppl = new ParentLocationPath(middle, right); RESULT = new ParentLocationPath(left, ppl); } else { // Expand 'rlp//step' -> 'rlp/descendant-or-self::node()/step' RelativeLocationPath left = (RelativeLocationPath)rlp; Step middle = new Step(Axis.DESCENDANTORSELF, DOM.NO_TYPE, null); ParentLocationPath ppl = new ParentLocationPath(middle, right); RESULT = new ParentLocationPath(left, ppl); } CUP$XPathParser$result = new java_cup.runtime.Symbol(22/*AbbreviatedRelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 74: // AbsoluteLocationPath ::= AbbreviatedAbsoluteLocationPath { Expression RESULT = null; int aalpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aalpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression aalp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = aalp; CUP$XPathParser$result = new java_cup.runtime.Symbol(23/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 73: // AbsoluteLocationPath ::= SLASH RelativeLocationPath { Expression RESULT = null; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new AbsoluteLocationPath(rlp); CUP$XPathParser$result = new java_cup.runtime.Symbol(23/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 72: // AbsoluteLocationPath ::= SLASH { Expression RESULT = null; RESULT = new AbsoluteLocationPath(); CUP$XPathParser$result = new java_cup.runtime.Symbol(23/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 71: // RelativeLocationPath ::= AbbreviatedRelativeLocationPath { Expression RESULT = null; int arlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int arlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression arlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = arlp; CUP$XPathParser$result = new java_cup.runtime.Symbol(21/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 70: // RelativeLocationPath ::= RelativeLocationPath SLASH Step { Expression RESULT = null; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int stepleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int stepright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression step = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; if (rlp instanceof Step && ((Step) rlp).isAbbreviatedDot()) { RESULT = step; // Remove './' from the middle } else if (((Step) step).isAbbreviatedDot()) { RESULT = rlp; // Remove '/.' from the end } else { RESULT = new ParentLocationPath((RelativeLocationPath) rlp, step); } CUP$XPathParser$result = new java_cup.runtime.Symbol(21/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 69: // RelativeLocationPath ::= Step { Expression RESULT = null; int stepleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int stepright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression step = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = step; CUP$XPathParser$result = new java_cup.runtime.Symbol(21/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 68: // LocationPath ::= AbsoluteLocationPath { Expression RESULT = null; int alpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int alpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression alp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = alp; CUP$XPathParser$result = new java_cup.runtime.Symbol(4/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 67: // LocationPath ::= RelativeLocationPath { Expression RESULT = null; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = rlp; CUP$XPathParser$result = new java_cup.runtime.Symbol(4/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 66: // PathExpr ::= FilterExpr DSLASH RelativeLocationPath { Expression RESULT = null; int fexpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int fexpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression fexp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; // // Expand '//' into '/descendant-or-self::node()/' or // into /descendant-or-self::*/ // int nodeType = DOM.NO_TYPE; if (rlp instanceof Step && parser.isElementAxis(((Step) rlp).getAxis())) { nodeType = DTM.ELEMENT_NODE; } final Step step = new Step(Axis.DESCENDANTORSELF, nodeType, null); FilterParentPath fpp = new FilterParentPath(fexp, step); fpp = new FilterParentPath(fpp, rlp); if (fexp instanceof KeyCall == false) { fpp.setDescendantAxis(); } RESULT = fpp; CUP$XPathParser$result = new java_cup.runtime.Symbol(19/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 65: // PathExpr ::= FilterExpr SLASH RelativeLocationPath { Expression RESULT = null; int fexpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int fexpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression fexp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int rlpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rlpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression rlp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new FilterParentPath(fexp, rlp); CUP$XPathParser$result = new java_cup.runtime.Symbol(19/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 64: // PathExpr ::= FilterExpr { Expression RESULT = null; int fexpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int fexpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression fexp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = fexp; CUP$XPathParser$result = new java_cup.runtime.Symbol(19/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 63: // PathExpr ::= LocationPath { Expression RESULT = null; int lpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int lpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression lp = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = lp; CUP$XPathParser$result = new java_cup.runtime.Symbol(19/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 62: // UnionExpr ::= PathExpr VBAR UnionExpr { Expression RESULT = null; int peleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int peright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression pe = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int restleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int restright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression rest = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new UnionPathExpr(pe, rest); CUP$XPathParser$result = new java_cup.runtime.Symbol(18/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 61: // UnionExpr ::= PathExpr { Expression RESULT = null; int peleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int peright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression pe = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = pe; CUP$XPathParser$result = new java_cup.runtime.Symbol(18/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 60: // UnaryExpr ::= MINUS UnaryExpr { Expression RESULT = null; int ueleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ueright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ue = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new UnaryOpExpr(ue); CUP$XPathParser$result = new java_cup.runtime.Symbol(14/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 59: // UnaryExpr ::= UnionExpr { Expression RESULT = null; int ueleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ueright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ue = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ue; CUP$XPathParser$result = new java_cup.runtime.Symbol(14/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 58: // MultiplicativeExpr ::= MultiplicativeExpr MOD UnaryExpr { Expression RESULT = null; int meleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int meright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression me = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int ueleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ueright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ue = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new BinOpExpr(BinOpExpr.MOD, me, ue); CUP$XPathParser$result = new java_cup.runtime.Symbol(13/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 57: // MultiplicativeExpr ::= MultiplicativeExpr DIV UnaryExpr { Expression RESULT = null; int meleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int meright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression me = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int ueleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ueright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ue = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new BinOpExpr(BinOpExpr.DIV, me, ue); CUP$XPathParser$result = new java_cup.runtime.Symbol(13/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 56: // MultiplicativeExpr ::= MultiplicativeExpr MULT UnaryExpr { Expression RESULT = null; int meleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int meright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression me = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int ueleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ueright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ue = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new BinOpExpr(BinOpExpr.TIMES, me, ue); CUP$XPathParser$result = new java_cup.runtime.Symbol(13/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 55: // MultiplicativeExpr ::= UnaryExpr { Expression RESULT = null; int ueleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ueright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ue = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ue; CUP$XPathParser$result = new java_cup.runtime.Symbol(13/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 54: // AdditiveExpr ::= AdditiveExpr MINUS MultiplicativeExpr { Expression RESULT = null; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int meleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int meright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression me = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new BinOpExpr(BinOpExpr.MINUS, ae, me); CUP$XPathParser$result = new java_cup.runtime.Symbol(12/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 53: // AdditiveExpr ::= AdditiveExpr PLUS MultiplicativeExpr { Expression RESULT = null; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int meleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int meright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression me = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new BinOpExpr(BinOpExpr.PLUS, ae, me); CUP$XPathParser$result = new java_cup.runtime.Symbol(12/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 52: // AdditiveExpr ::= MultiplicativeExpr { Expression RESULT = null; int meleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int meright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression me = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = me; CUP$XPathParser$result = new java_cup.runtime.Symbol(12/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 51: // RelationalExpr ::= RelationalExpr GE AdditiveExpr { Expression RESULT = null; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new RelationalExpr(Operators.GE, re, ae); CUP$XPathParser$result = new java_cup.runtime.Symbol(11/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 50: // RelationalExpr ::= RelationalExpr LE AdditiveExpr { Expression RESULT = null; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new RelationalExpr(Operators.LE, re, ae); CUP$XPathParser$result = new java_cup.runtime.Symbol(11/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 49: // RelationalExpr ::= RelationalExpr GT AdditiveExpr { Expression RESULT = null; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new RelationalExpr(Operators.GT, re, ae); CUP$XPathParser$result = new java_cup.runtime.Symbol(11/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 48: // RelationalExpr ::= RelationalExpr LT AdditiveExpr { Expression RESULT = null; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new RelationalExpr(Operators.LT, re, ae); CUP$XPathParser$result = new java_cup.runtime.Symbol(11/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 47: // RelationalExpr ::= AdditiveExpr { Expression RESULT = null; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ae; CUP$XPathParser$result = new java_cup.runtime.Symbol(11/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 46: // EqualityExpr ::= EqualityExpr NE RelationalExpr { Expression RESULT = null; int eeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int eeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression ee = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new EqualityExpr(Operators.NE, ee, re); CUP$XPathParser$result = new java_cup.runtime.Symbol(10/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 45: // EqualityExpr ::= EqualityExpr EQ RelationalExpr { Expression RESULT = null; int eeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int eeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression ee = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new EqualityExpr(Operators.EQ, ee, re); CUP$XPathParser$result = new java_cup.runtime.Symbol(10/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 44: // EqualityExpr ::= RelationalExpr { Expression RESULT = null; int releft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int reright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression re = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = re; CUP$XPathParser$result = new java_cup.runtime.Symbol(10/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 43: // AndExpr ::= AndExpr AND EqualityExpr { Expression RESULT = null; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int eeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int eeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ee = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new LogicalExpr(LogicalExpr.AND, ae, ee); CUP$XPathParser$result = new java_cup.runtime.Symbol(9/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 42: // AndExpr ::= EqualityExpr { Expression RESULT = null; int eleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int eright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression e = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = e; CUP$XPathParser$result = new java_cup.runtime.Symbol(9/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 41: // OrExpr ::= OrExpr OR AndExpr { Expression RESULT = null; int oeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int oeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Expression oe = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new LogicalExpr(LogicalExpr.OR, oe, ae); CUP$XPathParser$result = new java_cup.runtime.Symbol(8/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 40: // OrExpr ::= AndExpr { Expression RESULT = null; int aeleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int aeright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ae = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ae; CUP$XPathParser$result = new java_cup.runtime.Symbol(8/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 39: // Expr ::= OrExpr { Expression RESULT = null; int exleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int exright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression ex = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ex; CUP$XPathParser$result = new java_cup.runtime.Symbol(2/*Expr*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 38: // Predicate ::= LBRACK Expr RBRACK { Expression RESULT = null; int eleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int eright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Expression e = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = new Predicate(e); CUP$XPathParser$result = new java_cup.runtime.Symbol(5/*Predicate*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 37: // Predicates ::= Predicate Predicates { Vector RESULT = null; int pleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int pright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Expression p = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; pp.insertElementAt(p, 0); RESULT = pp; CUP$XPathParser$result = new java_cup.runtime.Symbol(35/*Predicates*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 36: // Predicates ::= Predicate { Vector RESULT = null; int pleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int pright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression p = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; Vector temp = new Vector(); temp.addElement(p); RESULT = temp; CUP$XPathParser$result = new java_cup.runtime.Symbol(35/*Predicates*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 35: // ChildOrAttributeAxisSpecifier ::= ATTRIBUTE DCOLON { Integer RESULT = null; RESULT = new Integer(Axis.ATTRIBUTE); CUP$XPathParser$result = new java_cup.runtime.Symbol(42/*ChildOrAttributeAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 34: // ChildOrAttributeAxisSpecifier ::= CHILD DCOLON { Integer RESULT = null; RESULT = new Integer(Axis.CHILD); CUP$XPathParser$result = new java_cup.runtime.Symbol(42/*ChildOrAttributeAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 33: // ChildOrAttributeAxisSpecifier ::= ATSIGN { Integer RESULT = null; RESULT = new Integer(Axis.ATTRIBUTE); CUP$XPathParser$result = new java_cup.runtime.Symbol(42/*ChildOrAttributeAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 32: // NameTestPattern ::= QName { Object RESULT = null; int qnleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int qnright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; QName qn = (QName)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = qn; CUP$XPathParser$result = new java_cup.runtime.Symbol(34/*NameTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 31: // NameTestPattern ::= STAR { Object RESULT = null; RESULT = null; CUP$XPathParser$result = new java_cup.runtime.Symbol(34/*NameTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 30: // NodeTestPattern ::= PI { Object RESULT = null; RESULT = new Integer(NodeTest.PI); CUP$XPathParser$result = new java_cup.runtime.Symbol(33/*NodeTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 29: // NodeTestPattern ::= COMMENT { Object RESULT = null; RESULT = new Integer(NodeTest.COMMENT); CUP$XPathParser$result = new java_cup.runtime.Symbol(33/*NodeTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 28: // NodeTestPattern ::= TEXT { Object RESULT = null; RESULT = new Integer(NodeTest.TEXT); CUP$XPathParser$result = new java_cup.runtime.Symbol(33/*NodeTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 27: // NodeTestPattern ::= NODE { Object RESULT = null; RESULT = new Integer(NodeTest.ANODE); CUP$XPathParser$result = new java_cup.runtime.Symbol(33/*NodeTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 26: // NodeTestPattern ::= NameTestPattern { Object RESULT = null; int ntleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ntright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Object nt = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = nt; CUP$XPathParser$result = new java_cup.runtime.Symbol(33/*NodeTestPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 25: // StepPattern ::= ChildOrAttributeAxisSpecifier ProcessingInstructionPattern Predicates { StepPattern RESULT = null; int axisleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int axisright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Integer axis = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int pipleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int pipright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; StepPattern pip = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; // TODO: report error if axis is attribute RESULT = (ProcessingInstructionPattern)pip.setPredicates(pp); CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 24: // StepPattern ::= ChildOrAttributeAxisSpecifier ProcessingInstructionPattern { StepPattern RESULT = null; int axisleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int axisright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Integer axis = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int pipleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int pipright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; StepPattern pip = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = pip; // TODO: report error if axis is attribute CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 23: // StepPattern ::= ChildOrAttributeAxisSpecifier NodeTestPattern Predicates { StepPattern RESULT = null; int axisleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int axisright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Integer axis = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int ntleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int ntright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Object nt = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = parser.createStepPattern(axis.intValue(), nt, pp); CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 22: // StepPattern ::= ChildOrAttributeAxisSpecifier NodeTestPattern { StepPattern RESULT = null; int axisleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int axisright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Integer axis = (Integer)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ntleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ntright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Object nt = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = parser.createStepPattern(axis.intValue(), nt, null); CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 21: // StepPattern ::= ProcessingInstructionPattern Predicates { StepPattern RESULT = null; int pipleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int pipright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; StepPattern pip = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = (ProcessingInstructionPattern)pip.setPredicates(pp); CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 20: // StepPattern ::= ProcessingInstructionPattern { StepPattern RESULT = null; int pipleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int pipright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; StepPattern pip = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = pip; CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 19: // StepPattern ::= NodeTestPattern Predicates { StepPattern RESULT = null; int ntleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int ntright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; Object nt = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; int ppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = parser.createStepPattern(Axis.CHILD, nt, pp); CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 18: // StepPattern ::= NodeTestPattern { StepPattern RESULT = null; int ntleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ntright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Object nt = (Object)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = parser.createStepPattern(Axis.CHILD, nt, null); CUP$XPathParser$result = new java_cup.runtime.Symbol(32/*StepPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 17: // RelativePathPattern ::= StepPattern DSLASH RelativePathPattern { RelativePathPattern RESULT = null; int spleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int spright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; StepPattern sp = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new AncestorPattern(sp, rpp); CUP$XPathParser$result = new java_cup.runtime.Symbol(31/*RelativePathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 16: // RelativePathPattern ::= StepPattern SLASH RelativePathPattern { RelativePathPattern RESULT = null; int spleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int spright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; StepPattern sp = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new ParentPattern(sp, rpp); CUP$XPathParser$result = new java_cup.runtime.Symbol(31/*RelativePathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 15: // RelativePathPattern ::= StepPattern { RelativePathPattern RESULT = null; int spleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int spright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; StepPattern sp = (StepPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = sp; CUP$XPathParser$result = new java_cup.runtime.Symbol(31/*RelativePathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 14: // ProcessingInstructionPattern ::= PIPARAM LPAREN Literal RPAREN { StepPattern RESULT = null; int lleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int lright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; String l = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = new ProcessingInstructionPattern(l); CUP$XPathParser$result = new java_cup.runtime.Symbol(30/*ProcessingInstructionPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 13: // IdKeyPattern ::= KEY LPAREN Literal COMMA Literal RPAREN { IdKeyPattern RESULT = null; int l1left = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).left; int l1right = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).right; String l1 = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).value; int l2left = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int l2right = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; String l2 = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = new KeyPattern(l1, l2); CUP$XPathParser$result = new java_cup.runtime.Symbol(27/*IdKeyPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 12: // IdKeyPattern ::= ID LPAREN Literal RPAREN { IdKeyPattern RESULT = null; int lleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int lright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; String l = (String)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = new IdPattern(l); parser.setHasIdCall(true); CUP$XPathParser$result = new java_cup.runtime.Symbol(27/*IdKeyPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 11: // LocationPathPattern ::= RelativePathPattern { Pattern RESULT = null; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = rpp; CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 10: // LocationPathPattern ::= DSLASH RelativePathPattern { Pattern RESULT = null; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new AncestorPattern(rpp); CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // LocationPathPattern ::= IdKeyPattern DSLASH RelativePathPattern { Pattern RESULT = null; int ikpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int ikpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; IdKeyPattern ikp = (IdKeyPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new AncestorPattern(ikp, rpp); CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // LocationPathPattern ::= IdKeyPattern SLASH RelativePathPattern { Pattern RESULT = null; int ikpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int ikpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; IdKeyPattern ikp = (IdKeyPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new ParentPattern(ikp, rpp); CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // LocationPathPattern ::= IdKeyPattern { Pattern RESULT = null; int ikpleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int ikpright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; IdKeyPattern ikp = (IdKeyPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = ikp; CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // LocationPathPattern ::= SLASH RelativePathPattern { Pattern RESULT = null; int rppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int rppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; RelativePathPattern rpp = (RelativePathPattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new AbsolutePathPattern(rpp); CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // LocationPathPattern ::= SLASH { Pattern RESULT = null; RESULT = new AbsolutePathPattern(null); CUP$XPathParser$result = new java_cup.runtime.Symbol(29/*LocationPathPattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // Pattern ::= LocationPathPattern VBAR Pattern { Pattern RESULT = null; int lppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left; int lppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).right; Pattern lpp = (Pattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).value; int pleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int pright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Pattern p = (Pattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = new AlternativePattern(lpp, p); CUP$XPathParser$result = new java_cup.runtime.Symbol(28/*Pattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // Pattern ::= LocationPathPattern { Pattern RESULT = null; int lppleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int lppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Pattern lpp = (Pattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = lpp; CUP$XPathParser$result = new java_cup.runtime.Symbol(28/*Pattern*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // TopLevel ::= EXPRESSION Expr { SyntaxTreeNode RESULT = null; int exprleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int exprright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Expression expr = (Expression)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = expr; CUP$XPathParser$result = new java_cup.runtime.Symbol(1/*TopLevel*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // TopLevel ::= PATTERN Pattern { SyntaxTreeNode RESULT = null; int patternleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).left; int patternright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right; Pattern pattern = (Pattern)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value; RESULT = pattern; CUP$XPathParser$result = new java_cup.runtime.Symbol(1/*TopLevel*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } return CUP$XPathParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // $START ::= TopLevel EOF { Object RESULT = null; int start_valleft = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left; int start_valright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).right; SyntaxTreeNode start_val = (SyntaxTreeNode)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).value; RESULT = start_val; CUP$XPathParser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT); } /* ACCEPT */ CUP$XPathParser$parser.done_parsing(); return CUP$XPathParser$result; /* . . . . . .*/ default: throw new Exception( "Invalid action number found in internal parse table"); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AttributeValue.java0000644000175000017500000000304610721374032025756 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributeValue.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ abstract class AttributeValue extends Expression { public static final AttributeValue create(SyntaxTreeNode parent, String text, Parser parser) { AttributeValue result; if (text.indexOf('{') != -1) { result = new AttributeValueTemplate(text, parser, parent); } else if (text.indexOf('}') != -1) { result = new AttributeValueTemplate(text, parser, parent); } else { result = new SimpleAttributeValue(text); result.setParser(parser); result.setParent(parent); } return result; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LocalNameCall.java0000644000175000017500000000477010721374031025451 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LocalNameCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Morten Jorgensen */ final class LocalNameCall extends NameBase { /** * Handles calls with no parameter (current node is implicit parameter). */ public LocalNameCall(QName fname) { super(fname); } /** * Handles calls with one parameter (either node or node-set). */ public LocalNameCall(QName fname, Vector arguments) { super(fname, arguments); } /** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Returns the name of a node in the DOM final int getNodeName = cpg.addInterfaceMethodref(DOM_INTF, "getNodeName", "(I)"+STRING_SIG); final int getLocalName = cpg.addMethodref(BASIS_LIBRARY_CLASS, "getLocalName", "(Ljava/lang/String;)"+ "Ljava/lang/String;"); super.translate(classGen, methodGen); il.append(new INVOKEINTERFACE(getNodeName, 2)); il.append(new INVOKESTATIC(getLocalName)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AttributeSet.java0000644000175000017500000001636610721374032025446 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributeSet.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.AttributeSetMethodGenerator; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class AttributeSet extends TopLevelElement { // This prefix is used for the method name of attribute set methods private static final String AttributeSetPrefix = "$as$"; // Element contents private QName _name; private UseAttributeSets _useSets; private AttributeSet _mergeSet; private String _method; private boolean _ignore = false; /** * Returns the QName of this attribute set */ public QName getName() { return _name; } /** * Returns the method name of this attribute set. This method name is * generated by the compiler (XSLTC) */ public String getMethodName() { return _method; } /** * Call this method to prevent a method for being compiled for this set. * This is used in case several elements constitute * a single set (with one name). The last element will merge itself with * any previous set(s) with the same name and disable the other set(s). */ public void ignore() { _ignore = true; } /** * Parse the contents of this attribute set. Recognised attributes are * "name" (required) and "use-attribute-sets" (optional). */ public void parseContents(Parser parser) { // Get this attribute set's name final String name = getAttribute("name"); if (!XML11Char.isXML11ValidQName(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } _name = parser.getQNameIgnoreDefaultNs(name); if ((_name == null) || (_name.equals(EMPTYSTRING))) { ErrorMsg msg = new ErrorMsg(ErrorMsg.UNNAMED_ATTRIBSET_ERR, this); parser.reportError(Constants.ERROR, msg); } // Get any included attribute sets (similar to inheritance...) final String useSets = getAttribute("use-attribute-sets"); if (useSets.length() > 0) { if (!Util.isValidQNames(useSets)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, useSets, this); parser.reportError(Constants.ERROR, err); } _useSets = new UseAttributeSets(useSets, parser); } // Parse the contents of this node. All child elements must be // elements. Other elements cause an error. final Vector contents = getContents(); final int count = contents.size(); for (int i=0; itrue if this instance of number has neither * a from nor a count pattern. */ public boolean isDefault() { return _from == null && _count == null; } private void compileDefault(ClassGenerator classGen, MethodGenerator methodGen) { int index; ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); int[] fieldIndexes = getXSLTC().getNumberFieldIndexes(); if (fieldIndexes[_level] == -1) { Field defaultNode = new Field(ACC_PRIVATE, cpg.addUtf8(FieldNames[_level]), cpg.addUtf8(NODE_COUNTER_SIG), null, cpg.getConstantPool()); // Add a new private field to this class classGen.addField(defaultNode); // Get a reference to the newly added field fieldIndexes[_level] = cpg.addFieldref(classGen.getClassName(), FieldNames[_level], NODE_COUNTER_SIG); } // Check if field is initialized (runtime) il.append(classGen.loadTranslet()); il.append(new GETFIELD(fieldIndexes[_level])); final BranchHandle ifBlock1 = il.append(new IFNONNULL(null)); // Create an instance of DefaultNodeCounter index = cpg.addMethodref(ClassNames[_level], "getDefaultNodeCounter", "(" + TRANSLET_INTF_SIG + DOM_INTF_SIG + NODE_ITERATOR_SIG + ")" + NODE_COUNTER_SIG); il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadIterator()); il.append(new INVOKESTATIC(index)); il.append(DUP); // Store the node counter in the field il.append(classGen.loadTranslet()); il.append(SWAP); il.append(new PUTFIELD(fieldIndexes[_level])); final BranchHandle ifBlock2 = il.append(new GOTO(null)); // Backpatch conditionals ifBlock1.setTarget(il.append(classGen.loadTranslet())); il.append(new GETFIELD(fieldIndexes[_level])); ifBlock2.setTarget(il.append(NOP)); } /** * Compiles a constructor for the class _className that * inherits from {Any,Single,Multiple}NodeCounter. This constructor * simply calls the same constructor in the super class. */ private void compileConstructor(ClassGenerator classGen) { MethodGenerator cons; final InstructionList il = new InstructionList(); final ConstantPoolGen cpg = classGen.getConstantPool(); cons = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, new org.apache.bcel.generic.Type[] { Util.getJCRefType(TRANSLET_INTF_SIG), Util.getJCRefType(DOM_INTF_SIG), Util.getJCRefType(NODE_ITERATOR_SIG) }, new String[] { "dom", "translet", "iterator" }, "", _className, il, cpg); il.append(ALOAD_0); // this il.append(ALOAD_1); // translet il.append(ALOAD_2); // DOM il.append(new ALOAD(3));// iterator int index = cpg.addMethodref(ClassNames[_level], "", "(" + TRANSLET_INTF_SIG + DOM_INTF_SIG + NODE_ITERATOR_SIG + ")V"); il.append(new INVOKESPECIAL(index)); il.append(RETURN); classGen.addMethod(cons); } /** * This method compiles code that is common to matchesFrom() and * matchesCount() in the auxillary class. */ private void compileLocals(NodeCounterGenerator nodeCounterGen, MatchGenerator matchGen, InstructionList il) { int field; LocalVariableGen local; ConstantPoolGen cpg = nodeCounterGen.getConstantPool(); // Get NodeCounter._iterator and store locally local = matchGen.addLocalVariable("iterator", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); field = cpg.addFieldref(NODE_COUNTER, "_iterator", ITERATOR_FIELD_SIG); il.append(ALOAD_0); // 'this' pointer on stack il.append(new GETFIELD(field)); local.setStart(il.append(new ASTORE(local.getIndex()))); matchGen.setIteratorIndex(local.getIndex()); // Get NodeCounter._translet and store locally local = matchGen.addLocalVariable("translet", Util.getJCRefType(TRANSLET_SIG), null, null); field = cpg.addFieldref(NODE_COUNTER, "_translet", "Lorg/apache/xalan/xsltc/Translet;"); il.append(ALOAD_0); // 'this' pointer on stack il.append(new GETFIELD(field)); il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS))); local.setStart(il.append(new ASTORE(local.getIndex()))); nodeCounterGen.setTransletIndex(local.getIndex()); // Get NodeCounter._document and store locally local = matchGen.addLocalVariable("document", Util.getJCRefType(DOM_INTF_SIG), null, null); field = cpg.addFieldref(_className, "_document", DOM_INTF_SIG); il.append(ALOAD_0); // 'this' pointer on stack il.append(new GETFIELD(field)); // Make sure we have the correct DOM type on the stack!!! local.setStart(il.append(new ASTORE(local.getIndex()))); matchGen.setDomIndex(local.getIndex()); } private void compilePatterns(ClassGenerator classGen, MethodGenerator methodGen) { int current; int field; LocalVariableGen local; MatchGenerator matchGen; NodeCounterGenerator nodeCounterGen; _className = getXSLTC().getHelperClassName(); nodeCounterGen = new NodeCounterGenerator(_className, ClassNames[_level], toString(), ACC_PUBLIC | ACC_SUPER, null, classGen.getStylesheet()); InstructionList il = null; ConstantPoolGen cpg = nodeCounterGen.getConstantPool(); // Add a new instance variable for each var in closure final int closureLen = (_closureVars == null) ? 0 : _closureVars.size(); for (int i = 0; i < closureLen; i++) { VariableBase var = ((VariableRefBase) _closureVars.get(i)).getVariable(); nodeCounterGen.addField(new Field(ACC_PUBLIC, cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool())); } // Add a single constructor to the class compileConstructor(nodeCounterGen); /* * Compile method matchesFrom() */ if (_from != null) { il = new InstructionList(); matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.BOOLEAN, new org.apache.bcel.generic.Type[] { org.apache.bcel.generic.Type.INT, }, new String[] { "node", }, "matchesFrom", _className, il, cpg); compileLocals(nodeCounterGen,matchGen,il); // Translate Pattern il.append(matchGen.loadContextNode()); _from.translate(nodeCounterGen, matchGen); _from.synthesize(nodeCounterGen, matchGen); il.append(IRETURN); nodeCounterGen.addMethod(matchGen); } /* * Compile method matchesCount() */ if (_count != null) { il = new InstructionList(); matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.BOOLEAN, new org.apache.bcel.generic.Type[] { org.apache.bcel.generic.Type.INT, }, new String[] { "node", }, "matchesCount", _className, il, cpg); compileLocals(nodeCounterGen,matchGen,il); // Translate Pattern il.append(matchGen.loadContextNode()); _count.translate(nodeCounterGen, matchGen); _count.synthesize(nodeCounterGen, matchGen); il.append(IRETURN); nodeCounterGen.addMethod(matchGen); } getXSLTC().dumpClass(nodeCounterGen.getJavaClass()); // Push an instance of the newly created class cpg = classGen.getConstantPool(); il = methodGen.getInstructionList(); final int index = cpg.addMethodref(_className, "", "(" + TRANSLET_INTF_SIG + DOM_INTF_SIG + NODE_ITERATOR_SIG + ")V"); il.append(new NEW(cpg.addClass(_className))); il.append(DUP); il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadIterator()); il.append(new INVOKESPECIAL(index)); // Initialize closure variables for (int i = 0; i < closureLen; i++) { final VariableRefBase varRef = (VariableRefBase) _closureVars.get(i); final VariableBase var = varRef.getVariable(); final Type varType = var.getType(); // Store variable in new closure il.append(DUP); il.append(var.loadInstruction()); il.append(new PUTFIELD( cpg.addFieldref(_className, var.getEscapedName(), varType.toSignature()))); } } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { int index; final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Push "this" for the call to characters() il.append(classGen.loadTranslet()); if (hasValue()) { compileDefault(classGen, methodGen); _value.translate(classGen, methodGen); // Using java.lang.Math.floor(number + 0.5) to return a double value il.append(new PUSH(cpg, 0.5)); il.append(DADD); index = cpg.addMethodref(MATH_CLASS, "floor", "(D)D"); il.append(new INVOKESTATIC(index)); // Call setValue on the node counter index = cpg.addMethodref(NODE_COUNTER, "setValue", "(D)" + NODE_COUNTER_SIG); il.append(new INVOKEVIRTUAL(index)); } else if (isDefault()) { compileDefault(classGen, methodGen); } else { compilePatterns(classGen, methodGen); } // Call setStartNode() if (!hasValue()) { il.append(methodGen.loadContextNode()); index = cpg.addMethodref(NODE_COUNTER, SET_START_NODE, "(I)" + NODE_COUNTER_SIG); il.append(new INVOKEVIRTUAL(index)); } // Call getCounter() with or without args if (_formatNeeded) { if (_format != null) { _format.translate(classGen, methodGen); } else { il.append(new PUSH(cpg, "1")); } if (_lang != null) { _lang.translate(classGen, methodGen); } else { il.append(new PUSH(cpg, "en")); // TODO ?? } if (_letterValue != null) { _letterValue.translate(classGen, methodGen); } else { il.append(new PUSH(cpg, Constants.EMPTYSTRING)); } if (_groupingSeparator != null) { _groupingSeparator.translate(classGen, methodGen); } else { il.append(new PUSH(cpg, Constants.EMPTYSTRING)); } if (_groupingSize != null) { _groupingSize.translate(classGen, methodGen); } else { il.append(new PUSH(cpg, "0")); } index = cpg.addMethodref(NODE_COUNTER, "getCounter", "(" + STRING_SIG + STRING_SIG + STRING_SIG + STRING_SIG + STRING_SIG + ")" + STRING_SIG); il.append(new INVOKEVIRTUAL(index)); } else { index = cpg.addMethodref(NODE_COUNTER, "setDefaultFormatting", "()" + NODE_COUNTER_SIG); il.append(new INVOKEVIRTUAL(index)); index = cpg.addMethodref(NODE_COUNTER, "getCounter", "()" + STRING_SIG); il.append(new INVOKEVIRTUAL(index)); } // Output the resulting string to the handler il.append(methodGen.loadHandler()); index = cpg.addMethodref(TRANSLET_CLASS, CHARACTERSW, CHARACTERSW_SIG); il.append(new INVOKEVIRTUAL(index)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Message.java0000644000175000017500000001522410721374030024401 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Message.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class Message extends Instruction { private boolean _terminate = false; public void parseContents(Parser parser) { String termstr = getAttribute("terminate"); if (termstr != null) { _terminate = termstr.equals("yes"); } parseChildren(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { typeCheckContents(stable); return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Load the translet (for call to displayMessage() function) il.append(classGen.loadTranslet()); switch (elementCount()) { case 0: il.append(new PUSH(cpg, "")); break; case 1: SyntaxTreeNode child = (SyntaxTreeNode) elementAt(0); if (child instanceof Text) { il.append(new PUSH(cpg, ((Text) child).getText())); break; } // falls through default: // Push current output handler onto the stack il.append(methodGen.loadHandler()); // Replace the current output handler by a ToXMLStream il.append(new NEW(cpg.addClass(STREAM_XML_OUTPUT))); il.append(methodGen.storeHandler()); // Push a reference to a StringWriter il.append(new NEW(cpg.addClass(STRING_WRITER))); il.append(DUP); il.append(DUP); il.append(new INVOKESPECIAL( cpg.addMethodref(STRING_WRITER, "", "()V"))); // Load ToXMLStream il.append(methodGen.loadHandler()); il.append(new INVOKESPECIAL( cpg.addMethodref(STREAM_XML_OUTPUT, "", "()V"))); // Invoke output.setWriter(STRING_WRITER) il.append(methodGen.loadHandler()); il.append(SWAP); il.append(new INVOKEINTERFACE( cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "setWriter", "("+WRITER_SIG+")V"), 2)); // Invoke output.setEncoding("UTF-8") il.append(methodGen.loadHandler()); il.append(new PUSH(cpg, "UTF-8")); // other encodings? il.append(new INVOKEINTERFACE( cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "setEncoding", "("+STRING_SIG+")V"), 2)); // Invoke output.setOmitXMLDeclaration(true) il.append(methodGen.loadHandler()); il.append(ICONST_1); il.append(new INVOKEINTERFACE( cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "setOmitXMLDeclaration", "(Z)V"), 2)); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE( cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "startDocument", "()V"), 1)); // Inline translation of contents translateContents(classGen, methodGen); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE( cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE, "endDocument", "()V"), 1)); // Call toString() on StringWriter il.append(new INVOKEVIRTUAL( cpg.addMethodref(STRING_WRITER, "toString", "()" + STRING_SIG))); // Restore old output handler il.append(SWAP); il.append(methodGen.storeHandler()); break; } // Send the resulting string to the message handling method il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, "displayMessage", "("+STRING_SIG+")V"))); // If 'terminate' attribute is set to 'yes': Instanciate a // RunTimeException, but it on the stack and throw an exception if (_terminate == true) { // Create a new instance of RunTimeException final int einit = cpg.addMethodref("java.lang.RuntimeException", "", "(Ljava/lang/String;)V"); il.append(new NEW(cpg.addClass("java.lang.RuntimeException"))); il.append(DUP); il.append(new PUSH(cpg,"Termination forced by an " + "xsl:message instruction")); il.append(new INVOKESPECIAL(einit)); il.append(ATHROW); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FunctionCall.java0000644000175000017500000011300610721374030025373 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FunctionCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionConstants; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.InvokeInstruction; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.IntType; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.MultiHashtable; import org.apache.xalan.xsltc.compiler.util.ObjectType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt * @author Todd Miller */ class FunctionCall extends Expression { // Name of this function call private QName _fname; // Arguments to this function call (might not be any) private final Vector _arguments; // Empty argument list, used for certain functions private final static Vector EMPTY_ARG_LIST = new Vector(0); // Valid namespaces for Java function-call extension protected final static String EXT_XSLTC = TRANSLET_URI; protected final static String JAVA_EXT_XSLTC = EXT_XSLTC + "/java"; protected final static String EXT_XALAN = "http://xml.apache.org/xalan"; protected final static String JAVA_EXT_XALAN = "http://xml.apache.org/xalan/java"; protected final static String JAVA_EXT_XALAN_OLD = "http://xml.apache.org/xslt/java"; protected final static String EXSLT_COMMON = "http://exslt.org/common"; protected final static String EXSLT_MATH = "http://exslt.org/math"; protected final static String EXSLT_SETS = "http://exslt.org/sets"; protected final static String EXSLT_DATETIME = "http://exslt.org/dates-and-times"; protected final static String EXSLT_STRINGS = "http://exslt.org/strings"; // Namespace format constants protected final static int NAMESPACE_FORMAT_JAVA = 0; protected final static int NAMESPACE_FORMAT_CLASS = 1; protected final static int NAMESPACE_FORMAT_PACKAGE = 2; protected final static int NAMESPACE_FORMAT_CLASS_OR_PACKAGE = 3; // Namespace format private int _namespace_format = NAMESPACE_FORMAT_JAVA; /** * Stores reference to object for non-static Java calls */ Expression _thisArgument = null; // External Java function's class/method/signature private String _className; private Class _clazz; private Method _chosenMethod; private Constructor _chosenConstructor; private MethodType _chosenMethodType; // Encapsulates all unsupported external function calls private boolean unresolvedExternal; // If FunctionCall is a external java constructor private boolean _isExtConstructor = false; // If the java method is static private boolean _isStatic = false; // Legal conversions between internal and Java types. private static final MultiHashtable _internal2Java = new MultiHashtable(); // Legal conversions between Java and internal types. private static final Hashtable _java2Internal = new Hashtable(); // The mappings between EXSLT extension namespaces and implementation classes private static final Hashtable _extensionNamespaceTable = new Hashtable(); // Extension functions that are implemented in BasisLibrary private static final Hashtable _extensionFunctionTable = new Hashtable(); /** * inner class to used in internal2Java mappings, contains * the Java type and the distance between the internal type and * the Java type. */ static class JavaType { public Class type; public int distance; public JavaType(Class type, int distance){ this.type = type; this.distance = distance; } public boolean equals(Object query){ return query.equals(type); } } /** * Defines 2 conversion tables: * 1. From internal types to Java types and * 2. From Java types to internal types. * These two tables are used when calling external (Java) functions. */ static { try { final Class nodeClass = Class.forName("org.w3c.dom.Node"); final Class nodeListClass = Class.forName("org.w3c.dom.NodeList"); // -- Internal to Java -------------------------------------------- // Type.Boolean -> { boolean(0), Boolean(1), Object(2) } _internal2Java.put(Type.Boolean, new JavaType(Boolean.TYPE, 0)); _internal2Java.put(Type.Boolean, new JavaType(Boolean.class, 1)); _internal2Java.put(Type.Boolean, new JavaType(Object.class, 2)); // Type.Real -> { double(0), Double(1), float(2), long(3), int(4), // short(5), byte(6), char(7), Object(8) } _internal2Java.put(Type.Real, new JavaType(Double.TYPE, 0)); _internal2Java.put(Type.Real, new JavaType(Double.class, 1)); _internal2Java.put(Type.Real, new JavaType(Float.TYPE, 2)); _internal2Java.put(Type.Real, new JavaType(Long.TYPE, 3)); _internal2Java.put(Type.Real, new JavaType(Integer.TYPE, 4)); _internal2Java.put(Type.Real, new JavaType(Short.TYPE, 5)); _internal2Java.put(Type.Real, new JavaType(Byte.TYPE, 6)); _internal2Java.put(Type.Real, new JavaType(Character.TYPE, 7)); _internal2Java.put(Type.Real, new JavaType(Object.class, 8)); // Type.Int must be the same as Type.Real _internal2Java.put(Type.Int, new JavaType(Double.TYPE, 0)); _internal2Java.put(Type.Int, new JavaType(Double.class, 1)); _internal2Java.put(Type.Int, new JavaType(Float.TYPE, 2)); _internal2Java.put(Type.Int, new JavaType(Long.TYPE, 3)); _internal2Java.put(Type.Int, new JavaType(Integer.TYPE, 4)); _internal2Java.put(Type.Int, new JavaType(Short.TYPE, 5)); _internal2Java.put(Type.Int, new JavaType(Byte.TYPE, 6)); _internal2Java.put(Type.Int, new JavaType(Character.TYPE, 7)); _internal2Java.put(Type.Int, new JavaType(Object.class, 8)); // Type.String -> { String(0), Object(1) } _internal2Java.put(Type.String, new JavaType(String.class, 0)); _internal2Java.put(Type.String, new JavaType(Object.class, 1)); // Type.NodeSet -> { NodeList(0), Node(1), Object(2), String(3) } _internal2Java.put(Type.NodeSet, new JavaType(nodeListClass, 0)); _internal2Java.put(Type.NodeSet, new JavaType(nodeClass, 1)); _internal2Java.put(Type.NodeSet, new JavaType(Object.class, 2)); _internal2Java.put(Type.NodeSet, new JavaType(String.class, 3)); // Type.Node -> { Node(0), NodeList(1), Object(2), String(3) } _internal2Java.put(Type.Node, new JavaType(nodeListClass, 0)); _internal2Java.put(Type.Node, new JavaType(nodeClass, 1)); _internal2Java.put(Type.Node, new JavaType(Object.class, 2)); _internal2Java.put(Type.Node, new JavaType(String.class, 3)); // Type.ResultTree -> { NodeList(0), Node(1), Object(2), String(3) } _internal2Java.put(Type.ResultTree, new JavaType(nodeListClass, 0)); _internal2Java.put(Type.ResultTree, new JavaType(nodeClass, 1)); _internal2Java.put(Type.ResultTree, new JavaType(Object.class, 2)); _internal2Java.put(Type.ResultTree, new JavaType(String.class, 3)); _internal2Java.put(Type.Reference, new JavaType(Object.class, 0)); // Possible conversions between Java and internal types _java2Internal.put(Boolean.TYPE, Type.Boolean); _java2Internal.put(Void.TYPE, Type.Void); _java2Internal.put(Character.TYPE, Type.Real); _java2Internal.put(Byte.TYPE, Type.Real); _java2Internal.put(Short.TYPE, Type.Real); _java2Internal.put(Integer.TYPE, Type.Real); _java2Internal.put(Long.TYPE, Type.Real); _java2Internal.put(Float.TYPE, Type.Real); _java2Internal.put(Double.TYPE, Type.Real); _java2Internal.put(String.class, Type.String); _java2Internal.put(Object.class, Type.Reference); // Conversions from org.w3c.dom.Node/NodeList to internal NodeSet _java2Internal.put(nodeListClass, Type.NodeSet); _java2Internal.put(nodeClass, Type.NodeSet); // Initialize the extension namespace table _extensionNamespaceTable.put(EXT_XALAN, "org.apache.xalan.lib.Extensions"); _extensionNamespaceTable.put(EXSLT_COMMON, "org.apache.xalan.lib.ExsltCommon"); _extensionNamespaceTable.put(EXSLT_MATH, "org.apache.xalan.lib.ExsltMath"); _extensionNamespaceTable.put(EXSLT_SETS, "org.apache.xalan.lib.ExsltSets"); _extensionNamespaceTable.put(EXSLT_DATETIME, "org.apache.xalan.lib.ExsltDatetime"); _extensionNamespaceTable.put(EXSLT_STRINGS, "org.apache.xalan.lib.ExsltStrings"); // Initialize the extension function table _extensionFunctionTable.put(EXSLT_COMMON + ":nodeSet", "nodeset"); _extensionFunctionTable.put(EXSLT_COMMON + ":objectType", "objectType"); _extensionFunctionTable.put(EXT_XALAN + ":nodeset", "nodeset"); } catch (ClassNotFoundException e) { System.err.println(e); } } public FunctionCall(QName fname, Vector arguments) { _fname = fname; _arguments = arguments; _type = null; } public FunctionCall(QName fname) { this(fname, EMPTY_ARG_LIST); } public String getName() { return(_fname.toString()); } public void setParser(Parser parser) { super.setParser(parser); if (_arguments != null) { final int n = _arguments.size(); for (int i = 0; i < n; i++) { final Expression exp = (Expression)_arguments.elementAt(i); exp.setParser(parser); exp.setParent(this); } } } public String getClassNameFromUri(String uri) { String className = (String)_extensionNamespaceTable.get(uri); if (className != null) return className; else { if (uri.startsWith(JAVA_EXT_XSLTC)) { int length = JAVA_EXT_XSLTC.length() + 1; return (uri.length() > length) ? uri.substring(length) : EMPTYSTRING; } else if (uri.startsWith(JAVA_EXT_XALAN)) { int length = JAVA_EXT_XALAN.length() + 1; return (uri.length() > length) ? uri.substring(length) : EMPTYSTRING; } else if (uri.startsWith(JAVA_EXT_XALAN_OLD)) { int length = JAVA_EXT_XALAN_OLD.length() + 1; return (uri.length() > length) ? uri.substring(length) : EMPTYSTRING; } else { int index = uri.lastIndexOf('/'); return (index > 0) ? uri.substring(index+1) : uri; } } } /** * Type check a function call. Since different type conversions apply, * type checking is different for standard and external (Java) functions. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_type != null) return _type; final String namespace = _fname.getNamespace(); String local = _fname.getLocalPart(); if (isExtension()) { _fname = new QName(null, null, local); return typeCheckStandard(stable); } else if (isStandard()) { return typeCheckStandard(stable); } // Handle extension functions (they all have a namespace) else { try { _className = getClassNameFromUri(namespace); final int pos = local.lastIndexOf('.'); if (pos > 0) { _isStatic = true; if (_className != null && _className.length() > 0) { _namespace_format = NAMESPACE_FORMAT_PACKAGE; _className = _className + "." + local.substring(0, pos); } else { _namespace_format = NAMESPACE_FORMAT_JAVA; _className = local.substring(0, pos); } _fname = new QName(namespace, null, local.substring(pos + 1)); } else { if (_className != null && _className.length() > 0) { try { _clazz = ObjectFactory.findProviderClass( _className, ObjectFactory.findClassLoader(), true); _namespace_format = NAMESPACE_FORMAT_CLASS; } catch (ClassNotFoundException e) { _namespace_format = NAMESPACE_FORMAT_PACKAGE; } } else _namespace_format = NAMESPACE_FORMAT_JAVA; if (local.indexOf('-') > 0) { local = replaceDash(local); } String extFunction = (String)_extensionFunctionTable.get(namespace + ":" + local); if (extFunction != null) { _fname = new QName(null, null, extFunction); return typeCheckStandard(stable); } else _fname = new QName(namespace, null, local); } return typeCheckExternal(stable); } catch (TypeCheckError e) { ErrorMsg errorMsg = e.getErrorMsg(); if (errorMsg == null) { final String name = _fname.getLocalPart(); errorMsg = new ErrorMsg(ErrorMsg.METHOD_NOT_FOUND_ERR, name); } getParser().reportError(ERROR, errorMsg); return _type = Type.Void; } } } /** * Type check a call to a standard function. Insert CastExprs when needed. * If as a result of the insertion of a CastExpr a type check error is * thrown, then catch it and re-throw it with a new "this". */ public Type typeCheckStandard(SymbolTable stable) throws TypeCheckError { _fname.clearNamespace(); // HACK!!! final int n = _arguments.size(); final Vector argsType = typeCheckArgs(stable); final MethodType args = new MethodType(Type.Void, argsType); final MethodType ptype = lookupPrimop(stable, _fname.getLocalPart(), args); if (ptype != null) { for (int i = 0; i < n; i++) { final Type argType = (Type) ptype.argsType().elementAt(i); final Expression exp = (Expression)_arguments.elementAt(i); if (!argType.identicalTo(exp.getType())) { try { _arguments.setElementAt(new CastExpr(exp, argType), i); } catch (TypeCheckError e) { throw new TypeCheckError(this); // invalid conversion } } } _chosenMethodType = ptype; return _type = ptype.resultType(); } throw new TypeCheckError(this); } public Type typeCheckConstructor(SymbolTable stable) throws TypeCheckError{ final Vector constructors = findConstructors(); if (constructors == null) { // Constructor not found in this class throw new TypeCheckError(ErrorMsg.CONSTRUCTOR_NOT_FOUND, _className); } final int nConstructors = constructors.size(); final int nArgs = _arguments.size(); final Vector argsType = typeCheckArgs(stable); // Try all constructors int bestConstrDistance = Integer.MAX_VALUE; _type = null; // reset for (int j, i = 0; i < nConstructors; i++) { // Check if all parameters to this constructor can be converted final Constructor constructor = (Constructor)constructors.elementAt(i); final Class[] paramTypes = constructor.getParameterTypes(); Class extType = null; int currConstrDistance = 0; for (j = 0; j < nArgs; j++) { // Convert from internal (translet) type to external (Java) type extType = paramTypes[j]; final Type intType = (Type)argsType.elementAt(j); Object match = _internal2Java.maps(intType, extType); if (match != null) { currConstrDistance += ((JavaType)match).distance; } else if (intType instanceof ObjectType) { ObjectType objectType = (ObjectType)intType; if (objectType.getJavaClass() == extType) continue; else if (extType.isAssignableFrom(objectType.getJavaClass())) currConstrDistance += 1; else { currConstrDistance = Integer.MAX_VALUE; break; } } else { // no mapping available currConstrDistance = Integer.MAX_VALUE; break; } } if (j == nArgs && currConstrDistance < bestConstrDistance ) { _chosenConstructor = constructor; _isExtConstructor = true; bestConstrDistance = currConstrDistance; _type = (_clazz != null) ? Type.newObjectType(_clazz) : Type.newObjectType(_className); } } if (_type != null) { return _type; } throw new TypeCheckError(ErrorMsg.ARGUMENT_CONVERSION_ERR, getMethodSignature(argsType)); } /** * Type check a call to an external (Java) method. * The method must be static an public, and a legal type conversion * must exist for all its arguments and its return type. * Every method of name _fname is inspected * as a possible candidate. */ public Type typeCheckExternal(SymbolTable stable) throws TypeCheckError { int nArgs = _arguments.size(); final String name = _fname.getLocalPart(); // check if function is a contructor 'new' if (_fname.getLocalPart().equals("new")) { return typeCheckConstructor(stable); } // check if we are calling an instance method else { boolean hasThisArgument = false; if (nArgs == 0) _isStatic = true; if (!_isStatic) { if (_namespace_format == NAMESPACE_FORMAT_JAVA || _namespace_format == NAMESPACE_FORMAT_PACKAGE) hasThisArgument = true; Expression firstArg = (Expression)_arguments.elementAt(0); Type firstArgType = (Type)firstArg.typeCheck(stable); if (_namespace_format == NAMESPACE_FORMAT_CLASS && firstArgType instanceof ObjectType && _clazz != null && _clazz.isAssignableFrom(((ObjectType)firstArgType).getJavaClass())) hasThisArgument = true; if (hasThisArgument) { _thisArgument = (Expression) _arguments.elementAt(0); _arguments.remove(0); nArgs--; if (firstArgType instanceof ObjectType) { _className = ((ObjectType) firstArgType).getJavaClassName(); } else throw new TypeCheckError(ErrorMsg.NO_JAVA_FUNCT_THIS_REF, name); } } else if (_className.length() == 0) { /* * Warn user if external function could not be resolved. * Warning will _NOT_ be issued is the call is properly * wrapped in an or element. For details * see If.parserContents() and When.parserContents() */ final Parser parser = getParser(); if (parser != null) { reportWarning(this, parser, ErrorMsg.FUNCTION_RESOLVE_ERR, _fname.toString()); } unresolvedExternal = true; return _type = Type.Int; // use "Int" as "unknown" } } final Vector methods = findMethods(); if (methods == null) { // Method not found in this class throw new TypeCheckError(ErrorMsg.METHOD_NOT_FOUND_ERR, _className + "." + name); } Class extType = null; final int nMethods = methods.size(); final Vector argsType = typeCheckArgs(stable); // Try all methods to identify the best fit int bestMethodDistance = Integer.MAX_VALUE; _type = null; // reset internal type for (int j, i = 0; i < nMethods; i++) { // Check if all paramteters to this method can be converted final Method method = (Method)methods.elementAt(i); final Class[] paramTypes = method.getParameterTypes(); int currMethodDistance = 0; for (j = 0; j < nArgs; j++) { // Convert from internal (translet) type to external (Java) type extType = paramTypes[j]; final Type intType = (Type)argsType.elementAt(j); Object match = _internal2Java.maps(intType, extType); if (match != null) { currMethodDistance += ((JavaType)match).distance; } else { // no mapping available // // Allow a Reference type to match any external (Java) type at // the moment. The real type checking is performed at runtime. if (intType instanceof ReferenceType) { currMethodDistance += 1; } else if (intType instanceof ObjectType) { ObjectType object = (ObjectType)intType; if (extType.getName().equals(object.getJavaClassName())) currMethodDistance += 0; else if (extType.isAssignableFrom(object.getJavaClass())) currMethodDistance += 1; else { currMethodDistance = Integer.MAX_VALUE; break; } } else { currMethodDistance = Integer.MAX_VALUE; break; } } } if (j == nArgs) { // Check if the return type can be converted extType = method.getReturnType(); _type = (Type) _java2Internal.get(extType); if (_type == null) { _type = Type.newObjectType(extType); } // Use this method if all parameters & return type match if (_type != null && currMethodDistance < bestMethodDistance) { _chosenMethod = method; bestMethodDistance = currMethodDistance; } } } // It is an error if the chosen method is an instance menthod but we don't // have a this argument. if (_chosenMethod != null && _thisArgument == null && !Modifier.isStatic(_chosenMethod.getModifiers())) { throw new TypeCheckError(ErrorMsg.NO_JAVA_FUNCT_THIS_REF, getMethodSignature(argsType)); } if (_type != null) { if (_type == Type.NodeSet) { getXSLTC().setMultiDocument(true); } return _type; } throw new TypeCheckError(ErrorMsg.ARGUMENT_CONVERSION_ERR, getMethodSignature(argsType)); } /** * Type check the actual arguments of this function call. */ public Vector typeCheckArgs(SymbolTable stable) throws TypeCheckError { final Vector result = new Vector(); final Enumeration e = _arguments.elements(); while (e.hasMoreElements()) { final Expression exp = (Expression)e.nextElement(); result.addElement(exp.typeCheck(stable)); } return result; } protected final Expression argument(int i) { return (Expression)_arguments.elementAt(i); } protected final Expression argument() { return argument(0); } protected final int argumentCount() { return _arguments.size(); } protected final void setArgument(int i, Expression exp) { _arguments.setElementAt(exp, i); } /** * Compile the function call and treat as an expression * Update true/false-lists. */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { Type type = Type.Boolean; if (_chosenMethodType != null) type = _chosenMethodType.resultType(); final InstructionList il = methodGen.getInstructionList(); translate(classGen, methodGen); if ((type instanceof BooleanType) || (type instanceof IntType)) { _falseList.add(il.append(new IFEQ(null))); } } /** * Translate a function call. The compiled code will leave the function's * return value on the JVM's stack. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final int n = argumentCount(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing(); int index; // Translate calls to methods in the BasisLibrary if (isStandard() || isExtension()) { for (int i = 0; i < n; i++) { final Expression exp = argument(i); exp.translate(classGen, methodGen); exp.startIterator(classGen, methodGen); } // append "F" to the function's name final String name = _fname.toString().replace('-', '_') + "F"; String args = Constants.EMPTYSTRING; // Special precautions for some method calls if (name.equals("sumF")) { args = DOM_INTF_SIG; il.append(methodGen.loadDOM()); } else if (name.equals("normalize_spaceF")) { if (_chosenMethodType.toSignature(args). equals("()Ljava/lang/String;")) { args = "I"+DOM_INTF_SIG; il.append(methodGen.loadContextNode()); il.append(methodGen.loadDOM()); } } // Invoke the method in the basis library index = cpg.addMethodref(BASIS_LIBRARY_CLASS, name, _chosenMethodType.toSignature(args)); il.append(new INVOKESTATIC(index)); } // Add call to BasisLibrary.unresolved_externalF() to generate // run-time error message for unsupported external functions else if (unresolvedExternal) { index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unresolved_externalF", "(Ljava/lang/String;)V"); il.append(new PUSH(cpg, _fname.toString())); il.append(new INVOKESTATIC(index)); } else if (_isExtConstructor) { if (isSecureProcessing) translateUnallowedExtension(cpg, il); final String clazz = _chosenConstructor.getDeclaringClass().getName(); Class[] paramTypes = _chosenConstructor.getParameterTypes(); LocalVariableGen[] paramTemp = new LocalVariableGen[n]; // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. for (int i = 0; i < n; i++) { final Expression exp = argument(i); Type expType = exp.getType(); exp.translate(classGen, methodGen); // Convert the argument to its Java type exp.startIterator(classGen, methodGen); expType.translateTo(classGen, methodGen, paramTypes[i]); paramTemp[i] = methodGen.addLocalVariable("function_call_tmp"+i, expType.toJCType(), null, null); paramTemp[i].setStart( il.append(expType.STORE(paramTemp[i].getIndex()))); } il.append(new NEW(cpg.addClass(_className))); il.append(InstructionConstants.DUP); for (int i = 0; i < n; i++) { final Expression arg = argument(i); paramTemp[i].setEnd( il.append(arg.getType().LOAD(paramTemp[i].getIndex()))); } final StringBuffer buffer = new StringBuffer(); buffer.append('('); for (int i = 0; i < paramTypes.length; i++) { buffer.append(getSignature(paramTypes[i])); } buffer.append(')'); buffer.append("V"); index = cpg.addMethodref(clazz, "", buffer.toString()); il.append(new INVOKESPECIAL(index)); // Convert the return type back to our internal type (Type.Object).translateFrom(classGen, methodGen, _chosenConstructor.getDeclaringClass()); } // Invoke function calls that are handled in separate classes else { if (isSecureProcessing) translateUnallowedExtension(cpg, il); final String clazz = _chosenMethod.getDeclaringClass().getName(); Class[] paramTypes = _chosenMethod.getParameterTypes(); // Push "this" if it is an instance method if (_thisArgument != null) { _thisArgument.translate(classGen, methodGen); } for (int i = 0; i < n; i++) { final Expression exp = argument(i); exp.translate(classGen, methodGen); // Convert the argument to its Java type exp.startIterator(classGen, methodGen); exp.getType().translateTo(classGen, methodGen, paramTypes[i]); } final StringBuffer buffer = new StringBuffer(); buffer.append('('); for (int i = 0; i < paramTypes.length; i++) { buffer.append(getSignature(paramTypes[i])); } buffer.append(')'); buffer.append(getSignature(_chosenMethod.getReturnType())); if (_thisArgument != null && _clazz.isInterface()) { index = cpg.addInterfaceMethodref(clazz, _fname.getLocalPart(), buffer.toString()); il.append(new INVOKEINTERFACE(index, n+1)); } else { index = cpg.addMethodref(clazz, _fname.getLocalPart(), buffer.toString()); il.append(_thisArgument != null ? (InvokeInstruction) new INVOKEVIRTUAL(index) : (InvokeInstruction) new INVOKESTATIC(index)); } // Convert the return type back to our internal type _type.translateFrom(classGen, methodGen, _chosenMethod.getReturnType()); } } public String toString() { return "funcall(" + _fname + ", " + _arguments + ')'; } public boolean isStandard() { final String namespace = _fname.getNamespace(); return (namespace == null) || (namespace.equals(Constants.EMPTYSTRING)); } public boolean isExtension() { final String namespace = _fname.getNamespace(); return (namespace != null) && (namespace.equals(EXT_XSLTC)); } /** * Returns a vector with all methods named _fname * after stripping its namespace or null * if no such methods exist. */ private Vector findMethods() { Vector result = null; final String namespace = _fname.getNamespace(); if (_className != null && _className.length() > 0) { final int nArgs = _arguments.size(); try { if (_clazz == null) { _clazz = ObjectFactory.findProviderClass( _className, ObjectFactory.findClassLoader(), true); if (_clazz == null) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, _className); getParser().reportError(Constants.ERROR, msg); } } final String methodName = _fname.getLocalPart(); final Method[] methods = _clazz.getMethods(); for (int i = 0; i < methods.length; i++) { final int mods = methods[i].getModifiers(); // Is it public and same number of args ? if (Modifier.isPublic(mods) && methods[i].getName().equals(methodName) && methods[i].getParameterTypes().length == nArgs) { if (result == null) { result = new Vector(); } result.addElement(methods[i]); } } } catch (ClassNotFoundException e) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, _className); getParser().reportError(Constants.ERROR, msg); } } return result; } /** * Returns a vector with all constructors named _fname * after stripping its namespace or null * if no such methods exist. */ private Vector findConstructors() { Vector result = null; final String namespace = _fname.getNamespace(); final int nArgs = _arguments.size(); try { if (_clazz == null) { _clazz = ObjectFactory.findProviderClass( _className, ObjectFactory.findClassLoader(), true); if (_clazz == null) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, _className); getParser().reportError(Constants.ERROR, msg); } } final Constructor[] constructors = _clazz.getConstructors(); for (int i = 0; i < constructors.length; i++) { final int mods = constructors[i].getModifiers(); // Is it public, static and same number of args ? if (Modifier.isPublic(mods) && constructors[i].getParameterTypes().length == nArgs) { if (result == null) { result = new Vector(); } result.addElement(constructors[i]); } } } catch (ClassNotFoundException e) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, _className); getParser().reportError(Constants.ERROR, msg); } return result; } /** * Compute the JVM signature for the class. */ static final String getSignature(Class clazz) { if (clazz.isArray()) { final StringBuffer sb = new StringBuffer(); Class cl = clazz; while (cl.isArray()) { sb.append("["); cl = cl.getComponentType(); } sb.append(getSignature(cl)); return sb.toString(); } else if (clazz.isPrimitive()) { if (clazz == Integer.TYPE) { return "I"; } else if (clazz == Byte.TYPE) { return "B"; } else if (clazz == Long.TYPE) { return "J"; } else if (clazz == Float.TYPE) { return "F"; } else if (clazz == Double.TYPE) { return "D"; } else if (clazz == Short.TYPE) { return "S"; } else if (clazz == Character.TYPE) { return "C"; } else if (clazz == Boolean.TYPE) { return "Z"; } else if (clazz == Void.TYPE) { return "V"; } else { final String name = clazz.toString(); ErrorMsg err = new ErrorMsg(ErrorMsg.UNKNOWN_SIG_TYPE_ERR,name); throw new Error(err.toString()); } } else { return "L" + clazz.getName().replace('.', '/') + ';'; } } /** * Compute the JVM method descriptor for the method. */ static final String getSignature(Method meth) { final StringBuffer sb = new StringBuffer(); sb.append('('); final Class[] params = meth.getParameterTypes(); // avoid clone for (int j = 0; j < params.length; j++) { sb.append(getSignature(params[j])); } return sb.append(')').append(getSignature(meth.getReturnType())) .toString(); } /** * Compute the JVM constructor descriptor for the constructor. */ static final String getSignature(Constructor cons) { final StringBuffer sb = new StringBuffer(); sb.append('('); final Class[] params = cons.getParameterTypes(); // avoid clone for (int j = 0; j < params.length; j++) { sb.append(getSignature(params[j])); } return sb.append(")V").toString(); } /** * Return the signature of the current method */ private String getMethodSignature(Vector argsType) { final StringBuffer buf = new StringBuffer(_className); buf.append('.').append(_fname.getLocalPart()).append('('); int nArgs = argsType.size(); for (int i = 0; i < nArgs; i++) { final Type intType = (Type)argsType.elementAt(i); buf.append(intType.toString()); if (i < nArgs - 1) buf.append(", "); } buf.append(')'); return buf.toString(); } /** * To support EXSLT extensions, convert names with dash to allowable Java names: * e.g., convert abc-xyz to abcXyz. * Note: dashes only appear in middle of an EXSLT function or element name. */ protected static String replaceDash(String name) { char dash = '-'; StringBuffer buff = new StringBuffer(""); for (int i = 0; i < name.length(); i++) { if (i > 0 && name.charAt(i-1) == dash) buff.append(Character.toUpperCase(name.charAt(i))); else if (name.charAt(i) != dash) buff.append(name.charAt(i)); } return buff.toString(); } /** * Translate code to call the BasisLibrary.unallowed_extensionF(String) * method. */ private void translateUnallowedExtension(ConstantPoolGen cpg, InstructionList il) { int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unallowed_extension_functionF", "(Ljava/lang/String;)V"); il.append(new PUSH(cpg, _fname.toString())); il.append(new INVOKESTATIC(index)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NameCall.java0000644000175000017500000000426710721374033024501 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NameCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class NameCall extends NameBase { /** * Handles calls with no parameter (current node is implicit parameter). */ public NameCall(QName fname) { super(fname); } /** * Handles calls with one parameter (either node or node-set). */ public NameCall(QName fname, Vector arguments) { super(fname, arguments); } /** * Translate code that leaves a node's QName (as a String) on the stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int getName = cpg.addInterfaceMethodref(DOM_INTF, GET_NODE_NAME, GET_NODE_NAME_SIG); super.translate(classGen, methodGen); il.append(new INVOKEINTERFACE(getName, 2)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/SymbolTable.java0000644000175000017500000002021410721374031025226 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SymbolTable.java 476471 2006-11-18 08:36:27Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; import org.apache.xalan.xsltc.compiler.util.MethodType; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class SymbolTable { // These hashtables are used for all stylesheets private final Hashtable _stylesheets = new Hashtable(); private final Hashtable _primops = new Hashtable(); // These hashtables are used for some stylesheets private Hashtable _variables = null; private Hashtable _templates = null; private Hashtable _attributeSets = null; private Hashtable _aliases = null; private Hashtable _excludedURI = null; private Hashtable _decimalFormats = null; private Hashtable _keys = null; public DecimalFormatting getDecimalFormatting(QName name) { if (_decimalFormats == null) return null; return((DecimalFormatting)_decimalFormats.get(name)); } public void addDecimalFormatting(QName name, DecimalFormatting symbols) { if (_decimalFormats == null) _decimalFormats = new Hashtable(); _decimalFormats.put(name, symbols); } public Key getKey(QName name) { if (_keys == null) return null; return (Key) _keys.get(name); } public void addKey(QName name, Key key) { if (_keys == null) _keys = new Hashtable(); _keys.put(name, key); } public Stylesheet addStylesheet(QName name, Stylesheet node) { return (Stylesheet)_stylesheets.put(name, node); } public Stylesheet lookupStylesheet(QName name) { return (Stylesheet)_stylesheets.get(name); } public Template addTemplate(Template template) { final QName name = template.getName(); if (_templates == null) _templates = new Hashtable(); return (Template)_templates.put(name, template); } public Template lookupTemplate(QName name) { if (_templates == null) return null; return (Template)_templates.get(name); } public Variable addVariable(Variable variable) { if (_variables == null) _variables = new Hashtable(); final String name = variable.getName().getStringRep(); return (Variable)_variables.put(name, variable); } public Param addParam(Param parameter) { if (_variables == null) _variables = new Hashtable(); final String name = parameter.getName().getStringRep(); return (Param)_variables.put(name, parameter); } public Variable lookupVariable(QName qname) { if (_variables == null) return null; final String name = qname.getStringRep(); final Object obj = _variables.get(name); return obj instanceof Variable ? (Variable)obj : null; } public Param lookupParam(QName qname) { if (_variables == null) return null; final String name = qname.getStringRep(); final Object obj = _variables.get(name); return obj instanceof Param ? (Param)obj : null; } public SyntaxTreeNode lookupName(QName qname) { if (_variables == null) return null; final String name = qname.getStringRep(); return (SyntaxTreeNode)_variables.get(name); } public AttributeSet addAttributeSet(AttributeSet atts) { if (_attributeSets == null) _attributeSets = new Hashtable(); return (AttributeSet)_attributeSets.put(atts.getName(), atts); } public AttributeSet lookupAttributeSet(QName name) { if (_attributeSets == null) return null; return (AttributeSet)_attributeSets.get(name); } /** * Add a primitive operator or function to the symbol table. To avoid * name clashes with user-defined names, the prefix PrimopPrefix * is prepended. */ public void addPrimop(String name, MethodType mtype) { Vector methods = (Vector)_primops.get(name); if (methods == null) { _primops.put(name, methods = new Vector()); } methods.addElement(mtype); } /** * Lookup a primitive operator or function in the symbol table by * prepending the prefix PrimopPrefix. */ public Vector lookupPrimop(String name) { return (Vector)_primops.get(name); } /** * This is used for xsl:attribute elements that have a "namespace" * attribute that is currently not defined using xmlns: */ private int _nsCounter = 0; public String generateNamespacePrefix() { return("ns"+(_nsCounter++)); } /** * Use a namespace prefix to lookup a namespace URI */ private SyntaxTreeNode _current = null; public void setCurrentNode(SyntaxTreeNode node) { _current = node; } public String lookupNamespace(String prefix) { if (_current == null) return(Constants.EMPTYSTRING); return(_current.lookupNamespace(prefix)); } /** * Adds an alias for a namespace prefix */ public void addPrefixAlias(String prefix, String alias) { if (_aliases == null) _aliases = new Hashtable(); _aliases.put(prefix,alias); } /** * Retrieves any alias for a given namespace prefix */ public String lookupPrefixAlias(String prefix) { if (_aliases == null) return null; return (String)_aliases.get(prefix); } /** * Register a namespace URI so that it will not be declared in the output * unless it is actually referenced in the output. */ public void excludeURI(String uri) { // The null-namespace cannot be excluded if (uri == null) return; // Create new hashtable of exlcuded URIs if none exists if (_excludedURI == null) _excludedURI = new Hashtable(); // Register the namespace URI Integer refcnt = (Integer)_excludedURI.get(uri); if (refcnt == null) refcnt = new Integer(1); else refcnt = new Integer(refcnt.intValue() + 1); _excludedURI.put(uri,refcnt); } /** * Exclude a series of namespaces given by a list of whitespace * separated namespace prefixes. */ public void excludeNamespaces(String prefixes) { if (prefixes != null) { StringTokenizer tokens = new StringTokenizer(prefixes); while (tokens.hasMoreTokens()) { final String prefix = tokens.nextToken(); final String uri; if (prefix.equals("#default")) uri = lookupNamespace(Constants.EMPTYSTRING); else uri = lookupNamespace(prefix); if (uri != null) excludeURI(uri); } } } /** * Check if a namespace should not be declared in the output (unless used) */ public boolean isExcludedNamespace(String uri) { if (uri != null && _excludedURI != null) { final Integer refcnt = (Integer)_excludedURI.get(uri); return (refcnt != null && refcnt.intValue() > 0); } return false; } /** * Turn of namespace declaration exclusion */ public void unExcludeNamespaces(String prefixes) { if (_excludedURI == null) return; if (prefixes != null) { StringTokenizer tokens = new StringTokenizer(prefixes); while (tokens.hasMoreTokens()) { final String prefix = tokens.nextToken(); final String uri; if (prefix.equals("#default")) uri = lookupNamespace(Constants.EMPTYSTRING); else uri = lookupNamespace(prefix); Integer refcnt = (Integer)_excludedURI.get(uri); if (refcnt != null) _excludedURI.put(uri, new Integer(refcnt.intValue() - 1)); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Pattern.java0000644000175000017500000000501210721374031024425 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Pattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class Pattern extends Expression { /** * Returns the type of a pattern, which is always a NodeType. * A NodeType has a number of subtypes defined by * NodeType._type corresponding to each type of node. */ public abstract Type typeCheck(SymbolTable stable) throws TypeCheckError; /** * Translate this node into JVM bytecodes. Patterns are translated as * boolean expressions with true/false lists. Before calling * translate on a pattern, make sure that the node being * matched is on top of the stack. After calling translate, * make sure to backpatch both true and false lists. True lists are the * default, in the sense that they always "fall through". If this * is not the intended semantics (e.g., see * {@link org.apache.xalan.xsltc.compiler.AlternativePattern#translate}) * then a GOTO must be appended to the instruction list after calling * translate. */ public abstract void translate(ClassGenerator classGen, MethodGenerator methodGen); /** * Returns the priority of this pattern (section 5.5 in the XSLT spec). */ public abstract double getPriority(); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/StringLengthCall.java0000644000175000017500000000375410721374033026231 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringLengthCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class StringLengthCall extends FunctionCall { public StringLengthCall(QName fname, Vector arguments) { super(fname, arguments); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (argumentCount() > 0) { argument().translate(classGen, methodGen); } else { il.append(methodGen.loadContextNode()); Type.Node.translateTo(classGen, methodGen, Type.String); } il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS, "length", "()I"))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FloorCall.java0000644000175000017500000000315310721374032024672 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FloorCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class FloorCall extends FunctionCall { public FloorCall(QName fname, Vector arguments) { super(fname, arguments); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { argument().translate(classGen, methodGen); methodGen.getInstructionList() .append(new INVOKESTATIC(classGen.getConstantPool() .addMethodref(MATH_CLASS, "floor", "(D)D"))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Parser.java0000644000175000017500000013451310721374032024256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Parser.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.File; import java.io.IOException; import java.io.StringReader; import java.util.Dictionary; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import java.util.Stack; import java.util.StringTokenizer; import java.util.Vector; import java_cup.runtime.Symbol; import javax.xml.XMLConstants; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.runtime.AttributeList; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author G. Todd Miller * @author Morten Jorgensen * @author Erwin Bolwidt */ public class Parser implements Constants, ContentHandler { private static final String XSL = "xsl"; // standard prefix private static final String TRANSLET = "translet"; // extension prefix private Locator _locator = null; private XSLTC _xsltc; // Reference to the compiler object. private XPathParser _xpathParser; // Reference to the XPath parser. private Vector _errors; // Contains all compilation errors private Vector _warnings; // Contains all compilation errors private Hashtable _instructionClasses; // Maps instructions to classes private Hashtable _instructionAttrs;; // reqd and opt attrs private Hashtable _qNames; private Hashtable _namespaces; private QName _useAttributeSets; private QName _excludeResultPrefixes; private QName _extensionElementPrefixes; private Hashtable _variableScope; private Stylesheet _currentStylesheet; private SymbolTable _symbolTable; // Maps QNames to syntax-tree nodes private Output _output; private Template _template; // Reference to the template being parsed. private boolean _rootNamespaceDef; // Used for validity check private SyntaxTreeNode _root; private String _target; private int _currentImportPrecedence; public Parser(XSLTC xsltc) { _xsltc = xsltc; } public void init() { _qNames = new Hashtable(512); _namespaces = new Hashtable(); _instructionClasses = new Hashtable(); _instructionAttrs = new Hashtable(); _variableScope = new Hashtable(); _template = null; _errors = new Vector(); _warnings = new Vector(); _symbolTable = new SymbolTable(); _xpathParser = new XPathParser(this); _currentStylesheet = null; _output = null; _root = null; _rootNamespaceDef = false; _currentImportPrecedence = 1; initStdClasses(); initInstructionAttrs(); initExtClasses(); initSymbolTable(); _useAttributeSets = getQName(XSLT_URI, XSL, "use-attribute-sets"); _excludeResultPrefixes = getQName(XSLT_URI, XSL, "exclude-result-prefixes"); _extensionElementPrefixes = getQName(XSLT_URI, XSL, "extension-element-prefixes"); } public void setOutput(Output output) { if (_output != null) { if (_output.getImportPrecedence() <= output.getImportPrecedence()) { String cdata = _output.getCdata(); output.mergeOutput(_output); _output.disable(); _output = output; } else { output.disable(); } } else { _output = output; } } public Output getOutput() { return _output; } public Properties getOutputProperties() { return getTopLevelStylesheet().getOutputProperties(); } public void addVariable(Variable var) { addVariableOrParam(var); } public void addParameter(Param param) { addVariableOrParam(param); } private void addVariableOrParam(VariableBase var) { Object existing = _variableScope.get(var.getName()); if (existing != null) { if (existing instanceof Stack) { Stack stack = (Stack)existing; stack.push(var); } else if (existing instanceof VariableBase) { Stack stack = new Stack(); stack.push(existing); stack.push(var); _variableScope.put(var.getName(), stack); } } else { _variableScope.put(var.getName(), var); } } public void removeVariable(QName name) { Object existing = _variableScope.get(name); if (existing instanceof Stack) { Stack stack = (Stack)existing; if (!stack.isEmpty()) stack.pop(); if (!stack.isEmpty()) return; } _variableScope.remove(name); } public VariableBase lookupVariable(QName name) { Object existing = _variableScope.get(name); if (existing instanceof VariableBase) { return((VariableBase)existing); } else if (existing instanceof Stack) { Stack stack = (Stack)existing; return((VariableBase)stack.peek()); } return(null); } public void setXSLTC(XSLTC xsltc) { _xsltc = xsltc; } public XSLTC getXSLTC() { return _xsltc; } public int getCurrentImportPrecedence() { return _currentImportPrecedence; } public int getNextImportPrecedence() { return ++_currentImportPrecedence; } public void setCurrentStylesheet(Stylesheet stylesheet) { _currentStylesheet = stylesheet; } public Stylesheet getCurrentStylesheet() { return _currentStylesheet; } public Stylesheet getTopLevelStylesheet() { return _xsltc.getStylesheet(); } public QName getQNameSafe(final String stringRep) { // parse and retrieve namespace final int colon = stringRep.lastIndexOf(':'); if (colon != -1) { final String prefix = stringRep.substring(0, colon); final String localname = stringRep.substring(colon + 1); String namespace = null; // Get the namespace uri from the symbol table if (prefix.equals(XMLNS_PREFIX) == false) { namespace = _symbolTable.lookupNamespace(prefix); if (namespace == null) namespace = EMPTYSTRING; } return getQName(namespace, prefix, localname); } else { final String uri = stringRep.equals(XMLNS_PREFIX) ? null : _symbolTable.lookupNamespace(EMPTYSTRING); return getQName(uri, null, stringRep); } } public QName getQName(final String stringRep) { return getQName(stringRep, true, false); } public QName getQNameIgnoreDefaultNs(final String stringRep) { return getQName(stringRep, true, true); } public QName getQName(final String stringRep, boolean reportError) { return getQName(stringRep, reportError, false); } private QName getQName(final String stringRep, boolean reportError, boolean ignoreDefaultNs) { // parse and retrieve namespace final int colon = stringRep.lastIndexOf(':'); if (colon != -1) { final String prefix = stringRep.substring(0, colon); final String localname = stringRep.substring(colon + 1); String namespace = null; // Get the namespace uri from the symbol table if (prefix.equals(XMLNS_PREFIX) == false) { namespace = _symbolTable.lookupNamespace(prefix); if (namespace == null && reportError) { final int line = getLineNumber(); ErrorMsg err = new ErrorMsg(ErrorMsg.NAMESPACE_UNDEF_ERR, line, prefix); reportError(ERROR, err); } } return getQName(namespace, prefix, localname); } else { if (stringRep.equals(XMLNS_PREFIX)) { ignoreDefaultNs = true; } final String defURI = ignoreDefaultNs ? null : _symbolTable.lookupNamespace(EMPTYSTRING); return getQName(defURI, null, stringRep); } } public QName getQName(String namespace, String prefix, String localname) { if (namespace == null || namespace.equals(EMPTYSTRING)) { QName name = (QName)_qNames.get(localname); if (name == null) { name = new QName(null, prefix, localname); _qNames.put(localname, name); } return name; } else { Dictionary space = (Dictionary)_namespaces.get(namespace); if (space == null) { final QName name = new QName(namespace, prefix, localname); _namespaces.put(namespace, space = new Hashtable()); space.put(localname, name); return name; } else { QName name = (QName)space.get(localname); if (name == null) { name = new QName(namespace, prefix, localname); space.put(localname, name); } return name; } } } public QName getQName(String scope, String name) { return getQName(scope + name); } public QName getQName(QName scope, QName name) { return getQName(scope.toString() + name.toString()); } public QName getUseAttributeSets() { return _useAttributeSets; } public QName getExtensionElementPrefixes() { return _extensionElementPrefixes; } public QName getExcludeResultPrefixes() { return _excludeResultPrefixes; } /** * Create an instance of the Stylesheet class, * and then parse, typecheck and compile the instance. * Must be called after parse(). */ public Stylesheet makeStylesheet(SyntaxTreeNode element) throws CompilerException { try { Stylesheet stylesheet; if (element instanceof Stylesheet) { stylesheet = (Stylesheet)element; } else { stylesheet = new Stylesheet(); stylesheet.setSimplified(); stylesheet.addElement(element); stylesheet.setAttributes((AttributeList) element.getAttributes()); // Map the default NS if not already defined if (element.lookupNamespace(EMPTYSTRING) == null) { element.addPrefixMapping(EMPTYSTRING, EMPTYSTRING); } } stylesheet.setParser(this); return stylesheet; } catch (ClassCastException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.NOT_STYLESHEET_ERR, element); throw new CompilerException(err.toString()); } } /** * Instanciates a SAX2 parser and generate the AST from the input. */ public void createAST(Stylesheet stylesheet) { try { if (stylesheet != null) { stylesheet.parseContents(this); final int precedence = stylesheet.getImportPrecedence(); final Enumeration elements = stylesheet.elements(); while (elements.hasMoreElements()) { Object child = elements.nextElement(); if (child instanceof Text) { final int l = getLineNumber(); ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_TEXT_NODE_ERR,l,null); reportError(ERROR, err); } } if (!errorsFound()) { stylesheet.typeCheck(_symbolTable); } } } catch (TypeCheckError e) { reportError(ERROR, new ErrorMsg(e)); } } /** * Parses a stylesheet and builds the internal abstract syntax tree * @param reader A SAX2 SAXReader (parser) * @param input A SAX2 InputSource can be passed to a SAX reader * @return The root of the abstract syntax tree */ public SyntaxTreeNode parse(XMLReader reader, InputSource input) { try { // Parse the input document and build the abstract syntax tree reader.setContentHandler(this); reader.parse(input); // Find the start of the stylesheet within the tree return (SyntaxTreeNode)getStylesheet(_root); } catch (IOException e) { if (_xsltc.debug()) e.printStackTrace(); reportError(ERROR,new ErrorMsg(e)); } catch (SAXException e) { Throwable ex = e.getException(); if (_xsltc.debug()) { e.printStackTrace(); if (ex != null) ex.printStackTrace(); } reportError(ERROR, new ErrorMsg(e)); } catch (CompilerException e) { if (_xsltc.debug()) e.printStackTrace(); reportError(ERROR, new ErrorMsg(e)); } catch (Exception e) { if (_xsltc.debug()) e.printStackTrace(); reportError(ERROR, new ErrorMsg(e)); } return null; } /** * Parses a stylesheet and builds the internal abstract syntax tree * @param input A SAX2 InputSource can be passed to a SAX reader * @return The root of the abstract syntax tree */ public SyntaxTreeNode parse(InputSource input) { try { // Create a SAX parser and get the XMLReader object it uses final SAXParserFactory factory = SAXParserFactory.newInstance(); if (_xsltc.isSecureProcessing()) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (SAXException e) {} } try { factory.setFeature(Constants.NAMESPACE_FEATURE,true); } catch (Exception e) { factory.setNamespaceAware(true); } final SAXParser parser = factory.newSAXParser(); final XMLReader reader = parser.getXMLReader(); return(parse(reader, input)); } catch (ParserConfigurationException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.SAX_PARSER_CONFIG_ERR); reportError(ERROR, err); } catch (SAXParseException e){ reportError(ERROR, new ErrorMsg(e.getMessage(),e.getLineNumber())); } catch (SAXException e) { reportError(ERROR, new ErrorMsg(e.getMessage())); } return null; } public SyntaxTreeNode getDocumentRoot() { return _root; } private String _PImedia = null; private String _PItitle = null; private String _PIcharset = null; /** * Set the parameters to use to locate the correct * processing instruction in the case where the input document is an * XML document with one or more references to a stylesheet. * @param media The media attribute to be matched. May be null, in which * case the prefered templates will be used (i.e. alternate = no). * @param title The value of the title attribute to match. May be null. * @param charset The value of the charset attribute to match. May be null. */ protected void setPIParameters(String media, String title, String charset) { _PImedia = media; _PItitle = title; _PIcharset = charset; } /** * Extracts the DOM for the stylesheet. In the case of an embedded * stylesheet, it extracts the DOM subtree corresponding to the * embedded stylesheet that has an 'id' attribute whose value is the * same as the value declared in the processing * instruction (P.I.). In the xml-stylesheet P.I. the value is labeled * as the 'href' data of the P.I. The extracted DOM representing the * stylesheet is returned as an Element object. */ private SyntaxTreeNode getStylesheet(SyntaxTreeNode root) throws CompilerException { // Assume that this is a pure XSL stylesheet if there is not // processing instruction if (_target == null) { if (!_rootNamespaceDef) { ErrorMsg msg = new ErrorMsg(ErrorMsg.MISSING_XSLT_URI_ERR); throw new CompilerException(msg.toString()); } return(root); } // Find the xsl:stylesheet or xsl:transform with this reference if (_target.charAt(0) == '#') { SyntaxTreeNode element = findStylesheet(root, _target.substring(1)); if (element == null) { ErrorMsg msg = new ErrorMsg(ErrorMsg.MISSING_XSLT_TARGET_ERR, _target, root); throw new CompilerException(msg.toString()); } return(element); } else { return(loadExternalStylesheet(_target)); } } /** * Find a Stylesheet element with a specific ID attribute value. * This method is used to find a Stylesheet node that is referred * in a processing instruction. */ private SyntaxTreeNode findStylesheet(SyntaxTreeNode root, String href) { if (root == null) return null; if (root instanceof Stylesheet) { String id = root.getAttribute("id"); if (id.equals(href)) return root; } Vector children = root.getContents(); if (children != null) { final int count = children.size(); for (int i = 0; i < count; i++) { SyntaxTreeNode child = (SyntaxTreeNode)children.elementAt(i); SyntaxTreeNode node = findStylesheet(child, href); if (node != null) return node; } } return null; } /** * For embedded stylesheets: Load an external file with stylesheet */ private SyntaxTreeNode loadExternalStylesheet(String location) throws CompilerException { InputSource source; // Check if the location is URL or a local file if ((new File(location)).exists()) source = new InputSource("file:"+location); else source = new InputSource(location); SyntaxTreeNode external = (SyntaxTreeNode)parse(source); return(external); } private void initAttrTable(String elementName, String[] attrs) { _instructionAttrs.put(getQName(XSLT_URI, XSL, elementName), attrs); } private void initInstructionAttrs() { initAttrTable("template", new String[] {"match", "name", "priority", "mode"}); initAttrTable("stylesheet", new String[] {"id", "version", "extension-element-prefixes", "exclude-result-prefixes"}); initAttrTable("transform", new String[] {"id", "version", "extension-element-prefixes", "exclude-result-prefixes"}); initAttrTable("text", new String[] {"disable-output-escaping"}); initAttrTable("if", new String[] {"test"}); initAttrTable("choose", new String[] {}); initAttrTable("when", new String[] {"test"}); initAttrTable("otherwise", new String[] {}); initAttrTable("for-each", new String[] {"select"}); initAttrTable("message", new String[] {"terminate"}); initAttrTable("number", new String[] {"level", "count", "from", "value", "format", "lang", "letter-value", "grouping-separator", "grouping-size"}); initAttrTable("comment", new String[] {}); initAttrTable("copy", new String[] {"use-attribute-sets"}); initAttrTable("copy-of", new String[] {"select"}); initAttrTable("param", new String[] {"name", "select"}); initAttrTable("with-param", new String[] {"name", "select"}); initAttrTable("variable", new String[] {"name", "select"}); initAttrTable("output", new String[] {"method", "version", "encoding", "omit-xml-declaration", "standalone", "doctype-public", "doctype-system", "cdata-section-elements", "indent", "media-type"}); initAttrTable("sort", new String[] {"select", "order", "case-order", "lang", "data-type"}); initAttrTable("key", new String[] {"name", "match", "use"}); initAttrTable("fallback", new String[] {}); initAttrTable("attribute", new String[] {"name", "namespace"}); initAttrTable("attribute-set", new String[] {"name", "use-attribute-sets"}); initAttrTable("value-of", new String[] {"select", "disable-output-escaping"}); initAttrTable("element", new String[] {"name", "namespace", "use-attribute-sets"}); initAttrTable("call-template", new String[] {"name"}); initAttrTable("apply-templates", new String[] {"select", "mode"}); initAttrTable("apply-imports", new String[] {}); initAttrTable("decimal-format", new String[] {"name", "decimal-separator", "grouping-separator", "infinity", "minus-sign", "NaN", "percent", "per-mille", "zero-digit", "digit", "pattern-separator"}); initAttrTable("import", new String[] {"href"}); initAttrTable("include", new String[] {"href"}); initAttrTable("strip-space", new String[] {"elements"}); initAttrTable("preserve-space", new String[] {"elements"}); initAttrTable("processing-instruction", new String[] {"name"}); initAttrTable("namespace-alias", new String[] {"stylesheet-prefix", "result-prefix"}); } /** * Initialize the _instructionClasses Hashtable, which maps XSL element * names to Java classes in this package. */ private void initStdClasses() { initStdClass("template", "Template"); initStdClass("stylesheet", "Stylesheet"); initStdClass("transform", "Stylesheet"); initStdClass("text", "Text"); initStdClass("if", "If"); initStdClass("choose", "Choose"); initStdClass("when", "When"); initStdClass("otherwise", "Otherwise"); initStdClass("for-each", "ForEach"); initStdClass("message", "Message"); initStdClass("number", "Number"); initStdClass("comment", "Comment"); initStdClass("copy", "Copy"); initStdClass("copy-of", "CopyOf"); initStdClass("param", "Param"); initStdClass("with-param", "WithParam"); initStdClass("variable", "Variable"); initStdClass("output", "Output"); initStdClass("sort", "Sort"); initStdClass("key", "Key"); initStdClass("fallback", "Fallback"); initStdClass("attribute", "XslAttribute"); initStdClass("attribute-set", "AttributeSet"); initStdClass("value-of", "ValueOf"); initStdClass("element", "XslElement"); initStdClass("call-template", "CallTemplate"); initStdClass("apply-templates", "ApplyTemplates"); initStdClass("apply-imports", "ApplyImports"); initStdClass("decimal-format", "DecimalFormatting"); initStdClass("import", "Import"); initStdClass("include", "Include"); initStdClass("strip-space", "Whitespace"); initStdClass("preserve-space", "Whitespace"); initStdClass("processing-instruction", "ProcessingInstruction"); initStdClass("namespace-alias", "NamespaceAlias"); } private void initStdClass(String elementName, String className) { _instructionClasses.put(getQName(XSLT_URI, XSL, elementName), COMPILER_PACKAGE + '.' + className); } public boolean elementSupported(String namespace, String localName) { return(_instructionClasses.get(getQName(namespace, XSL, localName)) != null); } public boolean functionSupported(String fname) { return(_symbolTable.lookupPrimop(fname) != null); } private void initExtClasses() { initExtClass("output", "TransletOutput"); initExtClass(REDIRECT_URI, "write", "TransletOutput"); } private void initExtClass(String elementName, String className) { _instructionClasses.put(getQName(TRANSLET_URI, TRANSLET, elementName), COMPILER_PACKAGE + '.' + className); } private void initExtClass(String namespace, String elementName, String className) { _instructionClasses.put(getQName(namespace, TRANSLET, elementName), COMPILER_PACKAGE + '.' + className); } /** * Add primops and base functions to the symbol table. */ private void initSymbolTable() { MethodType I_V = new MethodType(Type.Int, Type.Void); MethodType I_R = new MethodType(Type.Int, Type.Real); MethodType I_S = new MethodType(Type.Int, Type.String); MethodType I_D = new MethodType(Type.Int, Type.NodeSet); MethodType R_I = new MethodType(Type.Real, Type.Int); MethodType R_V = new MethodType(Type.Real, Type.Void); MethodType R_R = new MethodType(Type.Real, Type.Real); MethodType R_D = new MethodType(Type.Real, Type.NodeSet); MethodType R_O = new MethodType(Type.Real, Type.Reference); MethodType I_I = new MethodType(Type.Int, Type.Int); MethodType D_O = new MethodType(Type.NodeSet, Type.Reference); MethodType D_V = new MethodType(Type.NodeSet, Type.Void); MethodType D_S = new MethodType(Type.NodeSet, Type.String); MethodType D_D = new MethodType(Type.NodeSet, Type.NodeSet); MethodType A_V = new MethodType(Type.Node, Type.Void); MethodType S_V = new MethodType(Type.String, Type.Void); MethodType S_S = new MethodType(Type.String, Type.String); MethodType S_A = new MethodType(Type.String, Type.Node); MethodType S_D = new MethodType(Type.String, Type.NodeSet); MethodType S_O = new MethodType(Type.String, Type.Reference); MethodType B_O = new MethodType(Type.Boolean, Type.Reference); MethodType B_V = new MethodType(Type.Boolean, Type.Void); MethodType B_B = new MethodType(Type.Boolean, Type.Boolean); MethodType B_S = new MethodType(Type.Boolean, Type.String); MethodType D_X = new MethodType(Type.NodeSet, Type.Object); MethodType R_RR = new MethodType(Type.Real, Type.Real, Type.Real); MethodType I_II = new MethodType(Type.Int, Type.Int, Type.Int); MethodType B_RR = new MethodType(Type.Boolean, Type.Real, Type.Real); MethodType B_II = new MethodType(Type.Boolean, Type.Int, Type.Int); MethodType S_SS = new MethodType(Type.String, Type.String, Type.String); MethodType S_DS = new MethodType(Type.String, Type.Real, Type.String); MethodType S_SR = new MethodType(Type.String, Type.String, Type.Real); MethodType O_SO = new MethodType(Type.Reference, Type.String, Type.Reference); MethodType D_SS = new MethodType(Type.NodeSet, Type.String, Type.String); MethodType D_SD = new MethodType(Type.NodeSet, Type.String, Type.NodeSet); MethodType B_BB = new MethodType(Type.Boolean, Type.Boolean, Type.Boolean); MethodType B_SS = new MethodType(Type.Boolean, Type.String, Type.String); MethodType S_SD = new MethodType(Type.String, Type.String, Type.NodeSet); MethodType S_DSS = new MethodType(Type.String, Type.Real, Type.String, Type.String); MethodType S_SRR = new MethodType(Type.String, Type.String, Type.Real, Type.Real); MethodType S_SSS = new MethodType(Type.String, Type.String, Type.String, Type.String); /* * Standard functions: implemented but not in this table concat(). * When adding a new function make sure to uncomment * the corresponding line in FunctionAvailableCall. */ // The following functions are inlined _symbolTable.addPrimop("current", A_V); _symbolTable.addPrimop("last", I_V); _symbolTable.addPrimop("position", I_V); _symbolTable.addPrimop("true", B_V); _symbolTable.addPrimop("false", B_V); _symbolTable.addPrimop("not", B_B); _symbolTable.addPrimop("name", S_V); _symbolTable.addPrimop("name", S_A); _symbolTable.addPrimop("generate-id", S_V); _symbolTable.addPrimop("generate-id", S_A); _symbolTable.addPrimop("ceiling", R_R); _symbolTable.addPrimop("floor", R_R); _symbolTable.addPrimop("round", R_R); _symbolTable.addPrimop("contains", B_SS); _symbolTable.addPrimop("number", R_O); _symbolTable.addPrimop("number", R_V); _symbolTable.addPrimop("boolean", B_O); _symbolTable.addPrimop("string", S_O); _symbolTable.addPrimop("string", S_V); _symbolTable.addPrimop("translate", S_SSS); _symbolTable.addPrimop("string-length", I_V); _symbolTable.addPrimop("string-length", I_S); _symbolTable.addPrimop("starts-with", B_SS); _symbolTable.addPrimop("format-number", S_DS); _symbolTable.addPrimop("format-number", S_DSS); _symbolTable.addPrimop("unparsed-entity-uri", S_S); _symbolTable.addPrimop("key", D_SS); _symbolTable.addPrimop("key", D_SD); _symbolTable.addPrimop("id", D_S); _symbolTable.addPrimop("id", D_D); _symbolTable.addPrimop("namespace-uri", S_V); _symbolTable.addPrimop("function-available", B_S); _symbolTable.addPrimop("element-available", B_S); _symbolTable.addPrimop("document", D_S); _symbolTable.addPrimop("document", D_V); // The following functions are implemented in the basis library _symbolTable.addPrimop("count", I_D); _symbolTable.addPrimop("sum", R_D); _symbolTable.addPrimop("local-name", S_V); _symbolTable.addPrimop("local-name", S_D); _symbolTable.addPrimop("namespace-uri", S_V); _symbolTable.addPrimop("namespace-uri", S_D); _symbolTable.addPrimop("substring", S_SR); _symbolTable.addPrimop("substring", S_SRR); _symbolTable.addPrimop("substring-after", S_SS); _symbolTable.addPrimop("substring-before", S_SS); _symbolTable.addPrimop("normalize-space", S_V); _symbolTable.addPrimop("normalize-space", S_S); _symbolTable.addPrimop("system-property", S_S); // Extensions _symbolTable.addPrimop("nodeset", D_O); _symbolTable.addPrimop("objectType", S_O); _symbolTable.addPrimop("cast", O_SO); // Operators +, -, *, /, % defined on real types. _symbolTable.addPrimop("+", R_RR); _symbolTable.addPrimop("-", R_RR); _symbolTable.addPrimop("*", R_RR); _symbolTable.addPrimop("/", R_RR); _symbolTable.addPrimop("%", R_RR); // Operators +, -, * defined on integer types. // Operators / and % are not defined on integers (may cause exception) _symbolTable.addPrimop("+", I_II); _symbolTable.addPrimop("-", I_II); _symbolTable.addPrimop("*", I_II); // Operators <, <= >, >= defined on real types. _symbolTable.addPrimop("<", B_RR); _symbolTable.addPrimop("<=", B_RR); _symbolTable.addPrimop(">", B_RR); _symbolTable.addPrimop(">=", B_RR); // Operators <, <= >, >= defined on int types. _symbolTable.addPrimop("<", B_II); _symbolTable.addPrimop("<=", B_II); _symbolTable.addPrimop(">", B_II); _symbolTable.addPrimop(">=", B_II); // Operators <, <= >, >= defined on boolean types. _symbolTable.addPrimop("<", B_BB); _symbolTable.addPrimop("<=", B_BB); _symbolTable.addPrimop(">", B_BB); _symbolTable.addPrimop(">=", B_BB); // Operators 'and' and 'or'. _symbolTable.addPrimop("or", B_BB); _symbolTable.addPrimop("and", B_BB); // Unary minus. _symbolTable.addPrimop("u-", R_R); _symbolTable.addPrimop("u-", I_I); } public SymbolTable getSymbolTable() { return _symbolTable; } public Template getTemplate() { return _template; } public void setTemplate(Template template) { _template = template; } private int _templateIndex = 0; public int getTemplateIndex() { return(_templateIndex++); } /** * Creates a new node in the abstract syntax tree. This node can be * o) a supported XSLT 1.0 element * o) an unsupported XSLT element (post 1.0) * o) a supported XSLT extension * o) an unsupported XSLT extension * o) a literal result element (not an XSLT element and not an extension) * Unsupported elements do not directly generate an error. We have to wait * until we have received all child elements of an unsupported element to * see if any elements exist. */ private boolean versionIsOne = true; public SyntaxTreeNode makeInstance(String uri, String prefix, String local, Attributes attributes) { SyntaxTreeNode node = null; QName qname = getQName(uri, prefix, local); String className = (String)_instructionClasses.get(qname); if (className != null) { try { final Class clazz = ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); node = (SyntaxTreeNode)clazz.newInstance(); node.setQName(qname); node.setParser(this); if (_locator != null) { node.setLineNumber(getLineNumber()); } if (node instanceof Stylesheet) { _xsltc.setStylesheet((Stylesheet)node); } checkForSuperfluousAttributes(node, attributes); } catch (ClassNotFoundException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, node); reportError(ERROR, err); } catch (Exception e) { ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR, e.getMessage(), node); reportError(FATAL, err); } } else { if (uri != null) { // Check if the element belongs in our namespace if (uri.equals(XSLT_URI)) { node = new UnsupportedElement(uri, prefix, local, false); UnsupportedElement element = (UnsupportedElement)node; ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_XSL_ERR, getLineNumber(),local); element.setErrorMessage(msg); if (versionIsOne) { reportError(UNSUPPORTED,msg); } } // Check if this is an XSLTC extension element else if (uri.equals(TRANSLET_URI)) { node = new UnsupportedElement(uri, prefix, local, true); UnsupportedElement element = (UnsupportedElement)node; ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_EXT_ERR, getLineNumber(),local); element.setErrorMessage(msg); } // Check if this is an extension of some other XSLT processor else { Stylesheet sheet = _xsltc.getStylesheet(); if ((sheet != null) && (sheet.isExtension(uri))) { if (sheet != (SyntaxTreeNode)_parentStack.peek()) { node = new UnsupportedElement(uri, prefix, local, true); UnsupportedElement elem = (UnsupportedElement)node; ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_EXT_ERR, getLineNumber(), prefix+":"+local); elem.setErrorMessage(msg); } } } } if (node == null) { node = new LiteralElement(); node.setLineNumber(getLineNumber()); } } if ((node != null) && (node instanceof LiteralElement)) { ((LiteralElement)node).setQName(qname); } return(node); } /** * checks the list of attributes against a list of allowed attributes * for a particular element node. */ private void checkForSuperfluousAttributes(SyntaxTreeNode node, Attributes attrs) { QName qname = node.getQName(); boolean isStylesheet = (node instanceof Stylesheet); String[] legal = (String[]) _instructionAttrs.get(qname); if (versionIsOne && legal != null) { int j; final int n = attrs.getLength(); for (int i = 0; i < n; i++) { final String attrQName = attrs.getQName(i); if (isStylesheet && attrQName.equals("version")) { versionIsOne = attrs.getValue(i).equals("1.0"); } // Ignore if special or if it has a prefix if (attrQName.startsWith("xml") || attrQName.indexOf(':') > 0) continue; for (j = 0; j < legal.length; j++) { if (attrQName.equalsIgnoreCase(legal[j])) { break; } } if (j == legal.length) { final ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ATTRIBUTE_ERR, attrQName, node); // Workaround for the TCK failure ErrorListener.errorTests.error001.. err.setWarningError(true); reportError(WARNING, err); } } } } /** * Parse an XPath expression: * @param parent - XSL element where the expression occured * @param exp - textual representation of the expression */ public Expression parseExpression(SyntaxTreeNode parent, String exp) { return (Expression)parseTopLevel(parent, ""+exp, null); } /** * Parse an XPath expression: * @param parent - XSL element where the expression occured * @param attr - name of this element's attribute to get expression from * @param def - default expression (if the attribute was not found) */ public Expression parseExpression(SyntaxTreeNode parent, String attr, String def) { // Get the textual representation of the expression (if any) String exp = parent.getAttribute(attr); // Use the default expression if none was found if ((exp.length() == 0) && (def != null)) exp = def; // Invoke the XPath parser return (Expression)parseTopLevel(parent, ""+exp, exp); } /** * Parse an XPath pattern: * @param parent - XSL element where the pattern occured * @param pattern - textual representation of the pattern */ public Pattern parsePattern(SyntaxTreeNode parent, String pattern) { return (Pattern)parseTopLevel(parent, ""+pattern, pattern); } /** * Parse an XPath pattern: * @param parent - XSL element where the pattern occured * @param attr - name of this element's attribute to get pattern from * @param def - default pattern (if the attribute was not found) */ public Pattern parsePattern(SyntaxTreeNode parent, String attr, String def) { // Get the textual representation of the pattern (if any) String pattern = parent.getAttribute(attr); // Use the default pattern if none was found if ((pattern.length() == 0) && (def != null)) pattern = def; // Invoke the XPath parser return (Pattern)parseTopLevel(parent, ""+pattern, pattern); } /** * Parse an XPath expression or pattern using the generated XPathParser * The method will return a Dummy node if the XPath parser fails. */ private SyntaxTreeNode parseTopLevel(SyntaxTreeNode parent, String text, String expression) { int line = getLineNumber(); try { _xpathParser.setScanner(new XPathLexer(new StringReader(text))); Symbol result = _xpathParser.parse(expression, line); if (result != null) { final SyntaxTreeNode node = (SyntaxTreeNode)result.value; if (node != null) { node.setParser(this); node.setParent(parent); node.setLineNumber(line); // System.out.println("e = " + text + " " + node); return node; } } reportError(ERROR, new ErrorMsg(ErrorMsg.XPATH_PARSER_ERR, expression, parent)); } catch (Exception e) { if (_xsltc.debug()) e.printStackTrace(); reportError(ERROR, new ErrorMsg(ErrorMsg.XPATH_PARSER_ERR, expression, parent)); } // Return a dummy pattern (which is an expression) SyntaxTreeNode.Dummy.setParser(this); return SyntaxTreeNode.Dummy; } /************************ ERROR HANDLING SECTION ************************/ /** * Returns true if there were any errors during compilation */ public boolean errorsFound() { return _errors.size() > 0; } /** * Prints all compile-time errors */ public void printErrors() { final int size = _errors.size(); if (size > 0) { System.err.println(new ErrorMsg(ErrorMsg.COMPILER_ERROR_KEY)); for (int i = 0; i < size; i++) { System.err.println(" " + _errors.elementAt(i)); } } } /** * Prints all compile-time warnings */ public void printWarnings() { final int size = _warnings.size(); if (size > 0) { System.err.println(new ErrorMsg(ErrorMsg.COMPILER_WARNING_KEY)); for (int i = 0; i < size; i++) { System.err.println(" " + _warnings.elementAt(i)); } } } /** * Common error/warning message handler */ public void reportError(final int category, final ErrorMsg error) { switch (category) { case Constants.INTERNAL: // Unexpected internal errors, such as null-ptr exceptions, etc. // Immediately terminates compilation, no translet produced _errors.addElement(error); break; case Constants.UNSUPPORTED: // XSLT elements that are not implemented and unsupported ext. // Immediately terminates compilation, no translet produced _errors.addElement(error); break; case Constants.FATAL: // Fatal error in the stylesheet input (parsing or content) // Immediately terminates compilation, no translet produced _errors.addElement(error); break; case Constants.ERROR: // Other error in the stylesheet input (parsing or content) // Does not terminate compilation, no translet produced _errors.addElement(error); break; case Constants.WARNING: // Other error in the stylesheet input (content errors only) // Does not terminate compilation, a translet is produced _warnings.addElement(error); break; } } public Vector getErrors() { return _errors; } public Vector getWarnings() { return _warnings; } /************************ SAX2 ContentHandler INTERFACE *****************/ private Stack _parentStack = null; private Hashtable _prefixMapping = null; /** * SAX2: Receive notification of the beginning of a document. */ public void startDocument() { _root = null; _target = null; _prefixMapping = null; _parentStack = new Stack(); } /** * SAX2: Receive notification of the end of a document. */ public void endDocument() { } /** * SAX2: Begin the scope of a prefix-URI Namespace mapping. * This has to be passed on to the symbol table! */ public void startPrefixMapping(String prefix, String uri) { if (_prefixMapping == null) { _prefixMapping = new Hashtable(); } _prefixMapping.put(prefix, uri); } /** * SAX2: End the scope of a prefix-URI Namespace mapping. * This has to be passed on to the symbol table! */ public void endPrefixMapping(String prefix) { } /** * SAX2: Receive notification of the beginning of an element. * The parser may re-use the attribute list that we're passed so * we clone the attributes in our own Attributes implementation */ public void startElement(String uri, String localname, String qname, Attributes attributes) throws SAXException { final int col = qname.lastIndexOf(':'); final String prefix = (col == -1) ? null : qname.substring(0, col); SyntaxTreeNode element = makeInstance(uri, prefix, localname, attributes); if (element == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.ELEMENT_PARSE_ERR, prefix+':'+localname); throw new SAXException(err.toString()); } // If this is the root element of the XML document we need to make sure // that it contains a definition of the XSL namespace URI if (_root == null) { if ((_prefixMapping == null) || (_prefixMapping.containsValue(Constants.XSLT_URI) == false)) _rootNamespaceDef = false; else _rootNamespaceDef = true; _root = element; } else { SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek(); parent.addElement(element); element.setParent(parent); } element.setAttributes(new AttributeList(attributes)); element.setPrefixMapping(_prefixMapping); if (element instanceof Stylesheet) { // Extension elements and excluded elements have to be // handled at this point in order to correctly generate // Fallback elements from s. getSymbolTable().setCurrentNode(element); ((Stylesheet)element).excludeExtensionPrefixes(this); } _prefixMapping = null; _parentStack.push(element); } /** * SAX2: Receive notification of the end of an element. */ public void endElement(String uri, String localname, String qname) { _parentStack.pop(); } /** * SAX2: Receive notification of character data. */ public void characters(char[] ch, int start, int length) { String string = new String(ch, start, length); SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek(); if (string.length() == 0) return; // If this text occurs within an element we append it // as-is to the existing text element if (parent instanceof Text) { ((Text)parent).setText(string); return; } // Ignore text nodes that occur directly under if (parent instanceof Stylesheet) return; SyntaxTreeNode bro = parent.lastChild(); if ((bro != null) && (bro instanceof Text)) { Text text = (Text)bro; if (!text.isTextElement()) { if ((length > 1) || ( ((int)ch[0]) < 0x100)) { text.setText(string); return; } } } // Add it as a regular text node otherwise parent.addElement(new Text(string)); } private String getTokenValue(String token) { final int start = token.indexOf('"'); final int stop = token.lastIndexOf('"'); return token.substring(start+1, stop); } /** * SAX2: Receive notification of a processing instruction. * These require special handling for stylesheet PIs. */ public void processingInstruction(String name, String value) { // We only handle the PI if ((_target == null) && (name.equals("xml-stylesheet"))) { String href = null; // URI of stylesheet found String media = null; // Media of stylesheet found String title = null; // Title of stylesheet found String charset = null; // Charset of stylesheet found // Get the attributes from the processing instruction StringTokenizer tokens = new StringTokenizer(value); while (tokens.hasMoreElements()) { String token = (String)tokens.nextElement(); if (token.startsWith("href")) href = getTokenValue(token); else if (token.startsWith("media")) media = getTokenValue(token); else if (token.startsWith("title")) title = getTokenValue(token); else if (token.startsWith("charset")) charset = getTokenValue(token); } // Set the target to this PI's href if the parameters are // null or match the corresponding attributes of this PI. if ( ((_PImedia == null) || (_PImedia.equals(media))) && ((_PItitle == null) || (_PImedia.equals(title))) && ((_PIcharset == null) || (_PImedia.equals(charset))) ) { _target = href; } } } /** * IGNORED - all ignorable whitespace is ignored */ public void ignorableWhitespace(char[] ch, int start, int length) { } /** * IGNORED - we do not have to do anything with skipped entities */ public void skippedEntity(String name) { } /** * Store the document locator to later retrieve line numbers of all * elements from the stylesheet */ public void setDocumentLocator(Locator locator) { _locator = locator; } /** * Get the line number, or zero * if there is no _locator. */ private int getLineNumber() { int line = 0; if (_locator != null) line = _locator.getLineNumber(); return line; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AttributeValueTemplate.java0000644000175000017500000002351310721374031027452 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributeValueTemplate.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Vector; import java.util.StringTokenizer; import java.util.NoSuchElementException; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class AttributeValueTemplate extends AttributeValue { final static int OUT_EXPR = 0; final static int IN_EXPR = 1; final static int IN_EXPR_SQUOTES = 2; final static int IN_EXPR_DQUOTES = 3; final static String DELIMITER = "\uFFFE"; // A Unicode nonchar public AttributeValueTemplate(String value, Parser parser, SyntaxTreeNode parent) { setParent(parent); setParser(parser); try { parseAVTemplate(value, parser); } catch (NoSuchElementException e) { reportError(parent, parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, value); } } /** * Two-pass parsing of ATVs. In the first pass, double curly braces are * replaced by one, and expressions are delimited using DELIMITER. The * second pass splits up the resulting buffer into literal and non-literal * expressions. Errors are reported during the first pass. */ private void parseAVTemplate(String text, Parser parser) { StringTokenizer tokenizer = new StringTokenizer(text, "{}\"\'", true); /* * First pass: replace double curly braces and delimit expressions * Simple automaton to parse ATVs, delimit expressions and report * errors. */ String t = null; String lookahead = null; StringBuffer buffer = new StringBuffer(); int state = OUT_EXPR; while (tokenizer.hasMoreTokens()) { // Use lookahead if available if (lookahead != null) { t = lookahead; lookahead = null; } else { t = tokenizer.nextToken(); } if (t.length() == 1) { switch (t.charAt(0)) { case '{': switch (state) { case OUT_EXPR: lookahead = tokenizer.nextToken(); if (lookahead.equals("{")) { buffer.append(lookahead); // replace {{ by { lookahead = null; } else { buffer.append(DELIMITER); state = IN_EXPR; } break; case IN_EXPR: case IN_EXPR_SQUOTES: case IN_EXPR_DQUOTES: reportError(getParent(), parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, text); break; } break; case '}': switch (state) { case OUT_EXPR: lookahead = tokenizer.nextToken(); if (lookahead.equals("}")) { buffer.append(lookahead); // replace }} by } lookahead = null; } else { reportError(getParent(), parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, text); } break; case IN_EXPR: buffer.append(DELIMITER); state = OUT_EXPR; break; case IN_EXPR_SQUOTES: case IN_EXPR_DQUOTES: buffer.append(t); break; } break; case '\'': switch (state) { case IN_EXPR: state = IN_EXPR_SQUOTES; break; case IN_EXPR_SQUOTES: state = IN_EXPR; break; case OUT_EXPR: case IN_EXPR_DQUOTES: break; } buffer.append(t); break; case '\"': switch (state) { case IN_EXPR: state = IN_EXPR_DQUOTES; break; case IN_EXPR_DQUOTES: state = IN_EXPR; break; case OUT_EXPR: case IN_EXPR_SQUOTES: break; } buffer.append(t); break; default: buffer.append(t); break; } } else { buffer.append(t); } } // Must be in OUT_EXPR at the end of parsing if (state != OUT_EXPR) { reportError(getParent(), parser, ErrorMsg.ATTR_VAL_TEMPLATE_ERR, text); } /* * Second pass: split up buffer into literal and non-literal expressions. */ tokenizer = new StringTokenizer(buffer.toString(), DELIMITER, true); while (tokenizer.hasMoreTokens()) { t = tokenizer.nextToken(); if (t.equals(DELIMITER)) { addElement(parser.parseExpression(this, tokenizer.nextToken())); tokenizer.nextToken(); // consume other delimiter } else { addElement(new LiteralExpr(t)); } } } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Vector contents = getContents(); final int n = contents.size(); for (int i = 0; i < n; i++) { final Expression exp = (Expression)contents.elementAt(i); if (!exp.typeCheck(stable).identicalTo(Type.String)) { contents.setElementAt(new CastExpr(exp, Type.String), i); } } return _type = Type.String; } public String toString() { final StringBuffer buffer = new StringBuffer("AVT:["); final int count = elementCount(); for (int i = 0; i < count; i++) { buffer.append(elementAt(i).toString()); if (i < count - 1) buffer.append(' '); } return buffer.append(']').toString(); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (elementCount() == 1) { final Expression exp = (Expression)elementAt(0); exp.translate(classGen, methodGen); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int initBuffer = cpg.addMethodref(STRING_BUFFER_CLASS, "", "()V"); final Instruction append = new INVOKEVIRTUAL(cpg.addMethodref(STRING_BUFFER_CLASS, "append", "(" + STRING_SIG + ")" + STRING_BUFFER_SIG)); final int toString = cpg.addMethodref(STRING_BUFFER_CLASS, "toString", "()"+STRING_SIG); il.append(new NEW(cpg.addClass(STRING_BUFFER_CLASS))); il.append(DUP); il.append(new INVOKESPECIAL(initBuffer)); // StringBuffer is on the stack final Enumeration elements = elements(); while (elements.hasMoreElements()) { final Expression exp = (Expression)elements.nextElement(); exp.translate(classGen, methodGen); il.append(append); } il.append(new INVOKEVIRTUAL(toString)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Include.java0000644000175000017500000001167410721374030024405 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Include.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.File; import java.io.FileNotFoundException; import java.net.MalformedURLException; import java.net.URL; import java.util.Enumeration; import org.apache.xml.utils.SystemIDResolver; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; /** * @author Jacek Ambroziak * @author Morten Jorgensen * @author Erwin Bolwidt * @author Gunnlaugur Briem */ final class Include extends TopLevelElement { private Stylesheet _included = null; public Stylesheet getIncludedStylesheet() { return _included; } public void parseContents(final Parser parser) { XSLTC xsltc = parser.getXSLTC(); Stylesheet context = parser.getCurrentStylesheet(); String docToLoad = getAttribute("href"); try { if (context.checkForLoop(docToLoad)) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.CIRCULAR_INCLUDE_ERR, docToLoad, this); parser.reportError(Constants.FATAL, msg); return; } InputSource input = null; XMLReader reader = null; String currLoadedDoc = context.getSystemId(); SourceLoader loader = context.getSourceLoader(); // Use SourceLoader if available if (loader != null) { input = loader.loadSource(docToLoad, currLoadedDoc, xsltc); if (input != null) { docToLoad = input.getSystemId(); reader = xsltc.getXMLReader(); } } // No SourceLoader or not resolved by SourceLoader if (input == null) { docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc); input = new InputSource(docToLoad); } // Return if we could not resolve the URL if (input == null) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.FILE_NOT_FOUND_ERR, docToLoad, this); parser.reportError(Constants.FATAL, msg); return; } final SyntaxTreeNode root; if (reader != null) { root = parser.parse(reader,input); } else { root = parser.parse(input); } if (root == null) return; _included = parser.makeStylesheet(root); if (_included == null) return; _included.setSourceLoader(loader); _included.setSystemId(docToLoad); _included.setParentStylesheet(context); _included.setIncludingStylesheet(context); _included.setTemplateInlining(context.getTemplateInlining()); // An included stylesheet gets the same import precedence // as the stylesheet that included it. final int precedence = context.getImportPrecedence(); _included.setImportPrecedence(precedence); parser.setCurrentStylesheet(_included); _included.parseContents(parser); final Enumeration elements = _included.elements(); final Stylesheet topStylesheet = parser.getTopLevelStylesheet(); while (elements.hasMoreElements()) { final Object element = elements.nextElement(); if (element instanceof TopLevelElement) { if (element instanceof Variable) { topStylesheet.addVariable((Variable) element); } else if (element instanceof Param) { topStylesheet.addParam((Param) element); } else { topStylesheet.addElement((TopLevelElement) element); } } } } catch (Exception e) { e.printStackTrace(); } finally { parser.setCurrentStylesheet(context); } } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { // do nothing } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/TestSeq.java0000644000175000017500000002145010721374031024404 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TestSeq.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Dictionary; import java.util.Vector; import org.apache.bcel.generic.GOTO_W; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * A test sequence is a sequence of patterns that * * (1) occured in templates in the same mode * (2) share the same kernel node type (e.g. A/B and C/C/B) * (3) may also contain patterns matching "*" and "node()" * (element sequence only) or matching "@*" (attribute * sequence only). * * A test sequence may have a default template, which will be * instantiated if none of the other patterns match. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Erwin Bolwidt * @author Morten Jorgensen */ final class TestSeq { /** * Integer code for the kernel type of this test sequence */ private int _kernelType; /** * Vector of all patterns in the test sequence. May include * patterns with "*", "@*" or "node()" kernel. */ private Vector _patterns = null; /** * A reference to the Mode object. */ private Mode _mode = null; /** * Default template for this test sequence */ private Template _default = null; /** * Instruction list representing this test sequence. */ private InstructionList _instructionList; /** * Cached handle to avoid compiling more than once. */ private InstructionHandle _start = null; /** * Creates a new test sequence given a set of patterns and a mode. */ public TestSeq(Vector patterns, Mode mode) { this(patterns, -2, mode); } public TestSeq(Vector patterns, int kernelType, Mode mode) { _patterns = patterns; _kernelType = kernelType; _mode = mode; } /** * Returns a string representation of this test sequence. Notice * that test sequences are mutable, so the value returned by this * method is different before and after calling reduce(). */ public String toString() { final int count = _patterns.size(); final StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { final LocationPathPattern pattern = (LocationPathPattern) _patterns.elementAt(i); if (i == 0) { result.append("Testseq for kernel " + _kernelType) .append('\n'); } result.append(" pattern " + i + ": ") .append(pattern.toString()) .append('\n'); } return result.toString(); } /** * Returns the instruction list for this test sequence */ public InstructionList getInstructionList() { return _instructionList; } /** * Return the highest priority for a pattern in this test * sequence. This is either the priority of the first or * of the default pattern. */ public double getPriority() { final Template template = (_patterns.size() == 0) ? _default : ((Pattern) _patterns.elementAt(0)).getTemplate(); return template.getPriority(); } /** * Returns the position of the highest priority pattern in * this test sequence. */ public int getPosition() { final Template template = (_patterns.size() == 0) ? _default : ((Pattern) _patterns.elementAt(0)).getTemplate(); return template.getPosition(); } /** * Reduce the patterns in this test sequence. Creates a new * vector of patterns and sets the default pattern if it * finds a patterns that is fully reduced. */ public void reduce() { final Vector newPatterns = new Vector(); final int count = _patterns.size(); for (int i = 0; i < count; i++) { final LocationPathPattern pattern = (LocationPathPattern)_patterns.elementAt(i); // Reduce this pattern pattern.reduceKernelPattern(); // Is this pattern fully reduced? if (pattern.isWildcard()) { _default = pattern.getTemplate(); break; // Ignore following patterns } else { newPatterns.addElement(pattern); } } _patterns = newPatterns; } /** * Returns, by reference, the templates that are included in * this test sequence. Note that a single template can occur * in several test sequences if its pattern is a union. */ public void findTemplates(Dictionary templates) { if (_default != null) { templates.put(_default, this); } for (int i = 0; i < _patterns.size(); i++) { final LocationPathPattern pattern = (LocationPathPattern)_patterns.elementAt(i); templates.put(pattern.getTemplate(), this); } } /** * Get the instruction handle to a template's code. This is * used when a single template occurs in several test * sequences; that is, if its pattern is a union of patterns * (e.g. match="A/B | A/C"). */ private InstructionHandle getTemplateHandle(Template template) { return (InstructionHandle)_mode.getTemplateInstructionHandle(template); } /** * Returns pattern n in this test sequence */ private LocationPathPattern getPattern(int n) { return (LocationPathPattern)_patterns.elementAt(n); } /** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/UnparsedEntityUriCall.java0000644000175000017500000000536510721374032027256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnparsedEntityUriCall.java 478670 2006-11-23 20:52:22Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class UnparsedEntityUriCall extends FunctionCall { private Expression _entity; public UnparsedEntityUriCall(QName fname, Vector arguments) { super(fname, arguments); _entity = argument(); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type entity = _entity.typeCheck(stable); if (entity instanceof StringType == false) { _entity = new CastExpr(_entity, Type.String); } return _type = Type.String; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Push the this pointer on the stack... il.append(methodGen.loadDOM()); // ...then the entity name... _entity.translate(classGen, methodGen); // ...to get the URI from the DOM object. il.append(new INVOKEINTERFACE( cpg.addInterfaceMethodref(DOM_INTF, GET_UNPARSED_ENTITY_URI, GET_UNPARSED_ENTITY_URI_SIG), 2)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ForEach.java0000644000175000017500000001524710721374030024331 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ForEach.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Vector; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFGT; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class ForEach extends Instruction { private Expression _select; private Type _type; public void display(int indent) { indent(indent); Util.println("ForEach"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); displayContents(indent + IndentIncrement); } public void parseContents(Parser parser) { _select = parser.parseExpression(this, "select", null); parseChildren(parser); // make sure required attribute(s) have been set if (_select.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select"); } } public Type typeCheck(SymbolTable stable) throws TypeCheckError { _type = _select.typeCheck(stable); if (_type instanceof ReferenceType || _type instanceof NodeType) { _select = new CastExpr(_select, Type.NodeSet); typeCheckContents(stable); return Type.Void; } if (_type instanceof NodeSetType||_type instanceof ResultTreeType) { typeCheckContents(stable); return Type.Void; } throw new TypeCheckError(this); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Save current node and current iterator on the stack il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadIterator()); // Collect sort objects associated with this instruction final Vector sortObjects = new Vector(); Enumeration children = elements(); while (children.hasMoreElements()) { final Object child = children.nextElement(); if (child instanceof Sort) { sortObjects.addElement(child); } } if ((_type != null) && (_type instanceof ResultTreeType)) { // Store existing DOM on stack - must be restored when loop is done il.append(methodGen.loadDOM()); // cannot be applied to a result tree - issue warning if (sortObjects.size() > 0) { ErrorMsg msg = new ErrorMsg(ErrorMsg.RESULT_TREE_SORT_ERR,this); getParser().reportError(WARNING, msg); } // Put the result tree on the stack (DOM) _select.translate(classGen, methodGen); // Get an iterator for the whole DOM - excluding the root node _type.translateTo(classGen, methodGen, Type.NodeSet); // Store the result tree as the default DOM il.append(SWAP); il.append(methodGen.storeDOM()); } else { // Compile node iterator if (sortObjects.size() > 0) { Sort.translateSortIterator(classGen, methodGen, _select, sortObjects); } else { _select.translate(classGen, methodGen); } if (_type instanceof ReferenceType == false) { il.append(methodGen.loadContextNode()); il.append(methodGen.setStartNode()); } } // Overwrite current iterator il.append(methodGen.storeIterator()); // Give local variables (if any) default values before starting loop initializeVariables(classGen, methodGen); final BranchHandle nextNode = il.append(new GOTO(null)); final InstructionHandle loop = il.append(NOP); translateContents(classGen, methodGen); nextNode.setTarget(il.append(methodGen.loadIterator())); il.append(methodGen.nextNode()); il.append(DUP); il.append(methodGen.storeCurrentNode()); il.append(new IFGT(loop)); // Restore current DOM (if result tree was used instead for this loop) if ((_type != null) && (_type instanceof ResultTreeType)) { il.append(methodGen.storeDOM()); } // Restore current node and current iterator from the stack il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode()); } /** * The code that is generated by nested for-each loops can appear to some * JVMs as if it is accessing un-initialized variables. We must add some * code that pushes the default variable value on the stack and pops it * into the variable slot. This is done by the Variable.initialize() * method. The code that we compile for this loop looks like this: * * initialize iterator * initialize variables <-- HERE!!! * goto Iterate * Loop: : * : (code for contents) * : * Iterate: node = iterator.next(); * if (node != END) goto Loop */ public void initializeVariables(ClassGenerator classGen, MethodGenerator methodGen) { final int n = elementCount(); for (int i = 0; i < n; i++) { final Object child = getContents().elementAt(i); if (child instanceof Variable) { Variable var = (Variable)child; var.initialize(classGen, methodGen); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NameBase.java0000644000175000017500000000741310721374030024471 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NameBase.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Morten Jorgensen * @author Erwin Bolwidt */ class NameBase extends FunctionCall { private Expression _param = null; private Type _paramType = Type.Node; /** * Handles calls with no parameter (current node is implicit parameter). */ public NameBase(QName fname) { super(fname); } /** * Handles calls with one parameter (either node or node-set). */ public NameBase(QName fname, Vector arguments) { super(fname, arguments); _param = argument(0); } /** * Check that we either have no parameters or one parameter that is * either a node or a node-set. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Check the argument type (if any) switch(argumentCount()) { case 0: _paramType = Type.Node; break; case 1: _paramType = _param.typeCheck(stable); break; default: throw new TypeCheckError(this); } // The argument has to be a node, a node-set or a node reference if ((_paramType != Type.NodeSet) && (_paramType != Type.Node) && (_paramType != Type.Reference)) { throw new TypeCheckError(this); } return (_type = Type.String); } public Type getType() { return _type; } /** * Translate the code required for getting the node for which the * QName, local-name or namespace URI should be extracted. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); // Function was called with no parameters if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } // Function was called with node parameter else if (_paramType == Type.Node) { _param.translate(classGen, methodGen); } else if (_paramType == Type.Reference) { _param.translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref (BASIS_LIBRARY_CLASS, "referenceToNodeSet", "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG))); il.append(methodGen.nextNode()); } // Function was called with node-set parameter else { _param.translate(classGen, methodGen); _param.startIterator(classGen, methodGen); il.append(methodGen.nextNode()); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Fallback.java0000644000175000017500000000470710721374030024520 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Fallback.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Morten Jorgensen */ final class Fallback extends Instruction { private boolean _active = false; /** * This element never produces any data on the stack */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_active) { return(typeCheckContents(stable)); } else { return Type.Void; } } /** * Activate this fallback element */ public void activate() { _active = true; } public String toString() { return("fallback"); } /** * Parse contents only if this fallback element is put in place of * some unsupported element or non-XSLTC extension element */ public void parseContents(Parser parser) { if (_active) parseChildren(parser); } /** * Translate contents only if this fallback element is put in place of * some unsupported element or non-XSLTC extension element */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_active) translateContents(classGen, methodGen); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/RelativePathPattern.java0000644000175000017500000000210310721374030026733 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RelativePathPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ abstract class RelativePathPattern extends LocationPathPattern {} libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CeilingCall.java0000644000175000017500000000340610721374033025165 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CeilingCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class CeilingCall extends FunctionCall { public CeilingCall(QName fname, Vector arguments) { super(fname, arguments); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); argument(0).translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref(MATH_CLASS, "ceil", "(D)D"))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ProcessingInstructionPattern.java0000644000175000017500000001247310721374030030734 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessingInstructionPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IF_ICMPEQ; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; /** * @author Morten Jorgensen */ final class ProcessingInstructionPattern extends StepPattern { private String _name = null; private boolean _typeChecked = false; /** * Handles calls with no parameter (current node is implicit parameter). */ public ProcessingInstructionPattern(String name) { super(Axis.CHILD, DTM.PROCESSING_INSTRUCTION_NODE, null); _name = name; //if (_name.equals("*")) _typeChecked = true; no wildcard allowed! } /** * */ public double getDefaultPriority() { return (_name != null) ? 0.0 : -0.5; } public String toString() { if (_predicates == null) return "processing-instruction("+_name+")"; else return "processing-instruction("+_name+")"+_predicates; } public void reduceKernelPattern() { _typeChecked = true; } public boolean isWildcard() { return false; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (hasPredicates()) { // Type check all the predicates (e -> position() = e) final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Predicate pred = (Predicate)_predicates.elementAt(i); pred.typeCheck(stable); } } return Type.NodeSet; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // context node is on the stack int gname = cpg.addInterfaceMethodref(DOM_INTF, "getNodeName", "(I)Ljava/lang/String;"); int cmp = cpg.addMethodref(STRING_CLASS, "equals", "(Ljava/lang/Object;)Z"); // Push current node on the stack il.append(methodGen.loadCurrentNode()); il.append(SWAP); // Overwrite current node with matching node il.append(methodGen.storeCurrentNode()); // If pattern not reduced then check kernel if (!_typeChecked) { il.append(methodGen.loadCurrentNode()); final int getType = cpg.addInterfaceMethodref(DOM_INTF, "getExpandedTypeID", "(I)I"); il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEINTERFACE(getType, 2)); il.append(new PUSH(cpg, DTM.PROCESSING_INSTRUCTION_NODE)); _falseList.add(il.append(new IF_ICMPEQ(null))); } // Load the requested processing instruction name il.append(new PUSH(cpg, _name)); // Load the current processing instruction's name il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEINTERFACE(gname, 2)); // Compare the two strings il.append(new INVOKEVIRTUAL(cmp)); _falseList.add(il.append(new IFEQ(null))); // Compile the expressions within the predicates if (hasPredicates()) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { Predicate pred = (Predicate)_predicates.elementAt(i); Expression exp = pred.getExpr(); exp.translateDesynthesized(classGen, methodGen); _trueList.append(exp._trueList); _falseList.append(exp._falseList); } } // Backpatch true list and restore current iterator/node InstructionHandle restore; restore = il.append(methodGen.storeCurrentNode()); backPatchTrueList(restore); BranchHandle skipFalse = il.append(new GOTO(null)); // Backpatch false list and restore current iterator/node restore = il.append(methodGen.storeCurrentNode()); backPatchFalseList(restore); _falseList.add(il.append(new GOTO(null))); // True list falls through skipFalse.setTarget(il.append(NOP)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Attribute.java0000644000175000017500000000271210721374032024760 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Attribute.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class Attribute extends Instruction { private QName _name; public void display(int indent) { indent(indent); Util.println("Attribute " + _name); displayContents(indent + IndentIncrement); } public void parseContents(Parser parser) { _name = parser.getQName(getAttribute("name")); parseChildren(parser); //!!! add text nodes //!!! take care of value templates } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ParameterRef.java0000644000175000017500000000707310721374030025375 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ParameterRef.java 528589 2007-04-13 18:50:56Z zongaro $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.runtime.BasisLibrary; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt */ final class ParameterRef extends VariableRefBase { /** * Name of param being referenced. */ QName _name = null; public ParameterRef(Param param) { super(param); _name = param._name; } public String toString() { return "parameter-ref("+_variable.getName()+'/'+_variable.getType()+')'; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); /* * To fix bug 24518 related to setting parameters of the form * {namespaceuri}localName, which will get mapped to an instance * variable in the class. */ final String name = BasisLibrary.mapQNameToJavaName (_name.toString()); final String signature = _type.toSignature(); if (_variable.isLocal()) { if (classGen.isExternal()) { Closure variableClosure = _closure; while (variableClosure != null) { if (variableClosure.inInnerClass()) break; variableClosure = variableClosure.getParentClosure(); } if (variableClosure != null) { il.append(ALOAD_0); il.append(new GETFIELD( cpg.addFieldref(variableClosure.getInnerClassName(), name, signature))); } else { il.append(_variable.loadInstruction()); } } else { il.append(_variable.loadInstruction()); } } else { final String className = classGen.getClassName(); il.append(classGen.loadTranslet()); if (classGen.isExternal()) { il.append(new CHECKCAST(cpg.addClass(className))); } il.append(new GETFIELD(cpg.addFieldref(className,name,signature))); } if (_variable.getType() instanceof NodeSetType) { // The method cloneIterator() also does resetting final int clone = cpg.addInterfaceMethodref(NODE_ITERATOR, "cloneIterator", "()" + NODE_ITERATOR_SIG); il.append(new INVOKEINTERFACE(clone, 1)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Whitespace.java0000644000175000017500000004211110721374032025106 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Whitespace.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.StringTokenizer; import java.util.Vector; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.IF_ICMPEQ; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Morten Jorgensen */ final class Whitespace extends TopLevelElement { // Three possible actions for the translet: public static final int USE_PREDICATE = 0; public static final int STRIP_SPACE = 1; public static final int PRESERVE_SPACE = 2; // The 3 different categories of strip/preserve rules (order important) public static final int RULE_NONE = 0; public static final int RULE_ELEMENT = 1; // priority 0 public static final int RULE_NAMESPACE = 2; // priority -1/4 public static final int RULE_ALL = 3; // priority -1/2 private String _elementList; private int _action; private int _importPrecedence; /** * Auxillary class for encapsulating a single strip/preserve rule */ private final static class WhitespaceRule { private final int _action; private String _namespace; // Should be replaced by NS type (int) private String _element; // Should be replaced by node type (int) private int _type; private int _priority; /** * Strip/preserve rule constructor */ public WhitespaceRule(int action, String element, int precedence) { // Determine the action (strip or preserve) for this rule _action = action; // Get the namespace and element name for this rule final int colon = element.lastIndexOf(':'); if (colon >= 0) { _namespace = element.substring(0,colon); _element = element.substring(colon+1,element.length()); } else { _namespace = Constants.EMPTYSTRING; _element = element; } // Determine the initial priority for this rule _priority = precedence << 2; // Get the strip/preserve type; either "NS:EL", "NS:*" or "*" if (_element.equals("*")) { if (_namespace == Constants.EMPTYSTRING) { _type = RULE_ALL; // Strip/preserve _all_ elements _priority += 2; // Lowest priority } else { _type = RULE_NAMESPACE; // Strip/reserve elements within NS _priority += 1; // Medium priority } } else { _type = RULE_ELEMENT; // Strip/preserve single element } } /** * For sorting rules depending on priority */ public int compareTo(WhitespaceRule other) { return _priority < other._priority ? -1 : _priority > other._priority ? 1 : 0; } public int getAction() { return _action; } public int getStrength() { return _type; } public int getPriority() { return _priority; } public String getElement() { return _element; } public String getNamespace() { return _namespace; } } /** * Parse the attributes of the xsl:strip/preserve-space element. * The element should have not contents (ignored if any). */ public void parseContents(Parser parser) { // Determine if this is an xsl:strip- or preserve-space element _action = _qname.getLocalPart().endsWith("strip-space") ? STRIP_SPACE : PRESERVE_SPACE; // Determine the import precedence _importPrecedence = parser.getCurrentImportPrecedence(); // Get the list of elements to strip/preserve _elementList = getAttribute("elements"); if (_elementList == null || _elementList.length() == 0) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "elements"); return; } final SymbolTable stable = parser.getSymbolTable(); StringTokenizer list = new StringTokenizer(_elementList); StringBuffer elements = new StringBuffer(Constants.EMPTYSTRING); while (list.hasMoreElements()) { String token = list.nextToken(); String prefix; String namespace; int col = token.indexOf(':'); if (col != -1) { namespace = lookupNamespace(token.substring(0,col)); if (namespace != null) { elements.append(namespace+":"+ token.substring(col+1,token.length())); } else { elements.append(token); } } else { elements.append(token); } if (list.hasMoreElements()) elements.append(" "); } _elementList = elements.toString(); } /** * De-tokenize the elements listed in the 'elements' attribute and * instanciate a set of strip/preserve rules. */ public Vector getRules() { final Vector rules = new Vector(); // Go through each element and instanciate strip/preserve-object final StringTokenizer list = new StringTokenizer(_elementList); while (list.hasMoreElements()) { rules.add(new WhitespaceRule(_action, list.nextToken(), _importPrecedence)); } return rules; } /** * Scans through the rules vector and looks for a rule of higher * priority that contradicts the current rule. */ private static WhitespaceRule findContradictingRule(Vector rules, WhitespaceRule rule) { for (int i = 0; i < rules.size(); i++) { // Get the next rule in the prioritized list WhitespaceRule currentRule = (WhitespaceRule)rules.elementAt(i); // We only consider rules with higher priority if (currentRule == rule) { return null; } /* * See if there is a contradicting rule with higher priority. * If the rules has the same action then this rule is redundant, * if they have different action then this rule will never win. */ switch (currentRule.getStrength()) { case RULE_ALL: return currentRule; case RULE_ELEMENT: if (!rule.getElement().equals(currentRule.getElement())) { break; } // intentional fall-through case RULE_NAMESPACE: if (rule.getNamespace().equals(currentRule.getNamespace())) { return currentRule; } break; } } return null; } /** * Orders a set or rules by priority, removes redundant rules and rules * that are shadowed by stronger, contradicting rules. */ private static int prioritizeRules(Vector rules) { WhitespaceRule currentRule; int defaultAction = PRESERVE_SPACE; // Sort all rules with regard to priority quicksort(rules, 0, rules.size()-1); // Check if there are any "xsl:strip-space" elements at all. // If there are no xsl:strip elements we can ignore all xsl:preserve // elements and signal that all whitespaces should be preserved boolean strip = false; for (int i = 0; i < rules.size(); i++) { currentRule = (WhitespaceRule)rules.elementAt(i); if (currentRule.getAction() == STRIP_SPACE) { strip = true; } } // Return with default action: PRESERVE_SPACE if (!strip) { rules.removeAllElements(); return PRESERVE_SPACE; } // Remove all rules that are contradicted by rules with higher priority for (int idx = 0; idx < rules.size(); ) { currentRule = (WhitespaceRule)rules.elementAt(idx); // Remove this single rule if it has no purpose if (findContradictingRule(rules,currentRule) != null) { rules.remove(idx); } else { // Remove all following rules if this one overrides all if (currentRule.getStrength() == RULE_ALL) { defaultAction = currentRule.getAction(); for (int i = idx; i < rules.size(); i++) { rules.removeElementAt(i); } } // Skip to next rule (there might not be any)... idx++; } } // The rules vector could be empty if first rule has strength RULE_ALL if (rules.size() == 0) { return defaultAction; } // Now work backwards and strip away all rules that have the same // action as the default rule (no reason the check them at the end). do { currentRule = (WhitespaceRule)rules.lastElement(); if (currentRule.getAction() == defaultAction) { rules.removeElementAt(rules.size() - 1); } else { break; } } while (rules.size() > 0); // Signal that whitespace detection predicate must be used. return defaultAction; } public static void compileStripSpace(BranchHandle strip[], int sCount, InstructionList il) { final InstructionHandle target = il.append(ICONST_1); il.append(IRETURN); for (int i = 0; i < sCount; i++) { strip[i].setTarget(target); } } public static void compilePreserveSpace(BranchHandle preserve[], int pCount, InstructionList il) { final InstructionHandle target = il.append(ICONST_0); il.append(IRETURN); for (int i = 0; i < pCount; i++) { preserve[i].setTarget(target); } } /* private static void compileDebug(ClassGenerator classGen, InstructionList il) { final ConstantPoolGen cpg = classGen.getConstantPool(); final int prt = cpg.addMethodref("java/lang/System/out", "println", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new INVOKESTATIC(prt)); } */ /** * Compiles the predicate method */ private static void compilePredicate(Vector rules, int defaultAction, ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final XSLTC xsltc = classGen.getParser().getXSLTC(); // private boolean Translet.stripSpace(int type) - cannot be static final MethodGenerator stripSpace = new MethodGenerator(ACC_PUBLIC | ACC_FINAL , org.apache.bcel.generic.Type.BOOLEAN, new org.apache.bcel.generic.Type[] { Util.getJCRefType(DOM_INTF_SIG), org.apache.bcel.generic.Type.INT, org.apache.bcel.generic.Type.INT }, new String[] { "dom","node","type" }, "stripSpace",classGen.getClassName(),il,cpg); classGen.addInterface("org/apache/xalan/xsltc/StripFilter"); final int paramDom = stripSpace.getLocalIndex("dom"); final int paramCurrent = stripSpace.getLocalIndex("node"); final int paramType = stripSpace.getLocalIndex("type"); BranchHandle strip[] = new BranchHandle[rules.size()]; BranchHandle preserve[] = new BranchHandle[rules.size()]; int sCount = 0; int pCount = 0; // Traverse all strip/preserve rules for (int i = 0; i>> 1); int i = p - 1, j = r + 1; while (true) { while (x.compareTo((WhitespaceRule)rules.elementAt(--j)) < 0) { } while (x.compareTo((WhitespaceRule)rules.elementAt(++i)) > 0) { } if (i < j) { final WhitespaceRule tmp = (WhitespaceRule)rules.elementAt(i); rules.setElementAt(rules.elementAt(j), i); rules.setElementAt(tmp, j); } else { return j; } } } /** * Type-check contents/attributes - nothing to do... */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; // We don't return anything. } /** * This method should not produce any code */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/VariableRef.java0000644000175000017500000000622710721374030025202 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: VariableRef.java 528589 2007-04-13 18:50:56Z zongaro $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt */ final class VariableRef extends VariableRefBase { public VariableRef(Variable variable) { super(variable); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Fall-through for variables that are implemented as methods if (_type.implementedAsMethod()) return; final String name = _variable.getEscapedName(); final String signature = _type.toSignature(); if (_variable.isLocal()) { if (classGen.isExternal()) { Closure variableClosure = _closure; while (variableClosure != null) { if (variableClosure.inInnerClass()) break; variableClosure = variableClosure.getParentClosure(); } if (variableClosure != null) { il.append(ALOAD_0); il.append(new GETFIELD( cpg.addFieldref(variableClosure.getInnerClassName(), name, signature))); } else { il.append(_variable.loadInstruction()); } } else { il.append(_variable.loadInstruction()); } } else { final String className = classGen.getClassName(); il.append(classGen.loadTranslet()); if (classGen.isExternal()) { il.append(new CHECKCAST(cpg.addClass(className))); } il.append(new GETFIELD(cpg.addFieldref(className,name,signature))); } if (_variable.getType() instanceof NodeSetType) { // The method cloneIterator() also does resetting final int clone = cpg.addInterfaceMethodref(NODE_ITERATOR, "cloneIterator", "()" + NODE_ITERATOR_SIG); il.append(new INVOKEINTERFACE(clone, 1)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CopyOf.java0000644000175000017500000001202610721374032024213 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CopyOf.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class CopyOf extends Instruction { private Expression _select; public void display(int indent) { indent(indent); Util.println("CopyOf"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); } public void parseContents(Parser parser) { _select = parser.parseExpression(this, "select", null); // make sure required attribute(s) have been set if (_select.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select"); return; } } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tselect = _select.typeCheck(stable); if (tselect instanceof NodeType || tselect instanceof NodeSetType || tselect instanceof ReferenceType || tselect instanceof ResultTreeType) { // falls through } else { _select = new CastExpr(_select, Type.String); } return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final Type tselect = _select.getType(); final String CPY1_SIG = "("+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V"; final int cpy1 = cpg.addInterfaceMethodref(DOM_INTF, "copy", CPY1_SIG); final String CPY2_SIG = "("+NODE_SIG+TRANSLET_OUTPUT_SIG+")V"; final int cpy2 = cpg.addInterfaceMethodref(DOM_INTF, "copy", CPY2_SIG); final String getDoc_SIG = "()"+NODE_SIG; final int getDoc = cpg.addInterfaceMethodref(DOM_INTF, "getDocument", getDoc_SIG); if (tselect instanceof NodeSetType) { il.append(methodGen.loadDOM()); // push NodeIterator _select.translate(classGen, methodGen); _select.startIterator(classGen, methodGen); // call copy from the DOM 'library' il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE(cpy1, 3)); } else if (tselect instanceof NodeType) { il.append(methodGen.loadDOM()); _select.translate(classGen, methodGen); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE(cpy2, 3)); } else if (tselect instanceof ResultTreeType) { _select.translate(classGen, methodGen); // We want the whole tree, so we start with the root node il.append(DUP); //need a pointer to the DOM ; il.append(new INVOKEINTERFACE(getDoc,1)); //ICONST_0); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE(cpy2, 3)); } else if (tselect instanceof ReferenceType) { _select.translate(classGen, methodGen); il.append(methodGen.loadHandler()); il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadDOM()); final int copy = cpg.addMethodref(BASIS_LIBRARY_CLASS, "copy", "(" + OBJECT_SIG + TRANSLET_OUTPUT_SIG + NODE_SIG + DOM_INTF_SIG + ")V"); il.append(new INVOKESTATIC(copy)); } else { il.append(classGen.loadTranslet()); _select.translate(classGen, methodGen); il.append(methodGen.loadHandler()); il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, CHARACTERSW, CHARACTERSW_SIG))); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/DecimalFormatting.java0000644000175000017500000002146510721374030026412 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DecimalFormatting.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETSTATIC; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class DecimalFormatting extends TopLevelElement { private static final String DFS_CLASS = "java.text.DecimalFormatSymbols"; private static final String DFS_SIG = "Ljava/text/DecimalFormatSymbols;"; private QName _name = null; /** * No type check needed for the element */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; } /** * Parse the name of the element */ public void parseContents(Parser parser) { // Get the name of these decimal formatting symbols final String name = getAttribute("name"); if (name.length() > 0) { if (!XML11Char.isXML11ValidQName(name)){ ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } } _name = parser.getQNameIgnoreDefaultNs(name); if (_name == null) { _name = parser.getQNameIgnoreDefaultNs(EMPTYSTRING); } // Check if a set of symbols has already been registered under this name SymbolTable stable = parser.getSymbolTable(); if (stable.getDecimalFormatting(_name) != null) { reportWarning(this, parser, ErrorMsg.SYMBOLS_REDEF_ERR, _name.toString()); } else { stable.addDecimalFormatting(_name, this); } } /** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); // DecimalFormatSymbols.(Locale); // xsl:decimal-format - except for the NaN and infinity attributes. final int init = cpg.addMethodref(DFS_CLASS, "", "("+LOCALE_SIG+")V"); // Push the format name on the stack for call to addDecimalFormat() il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, _name.toString())); // Manufacture a DecimalFormatSymbols on the stack // for call to addDecimalFormat() // Use the US Locale as the default, as most of its settings // are equivalent to the default settings required of il.append(new NEW(cpg.addClass(DFS_CLASS))); il.append(DUP); il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US", LOCALE_SIG))); il.append(new INVOKESPECIAL(init)); String tmp = getAttribute("NaN"); if ((tmp == null) || (tmp.equals(EMPTYSTRING))) { int nan = cpg.addMethodref(DFS_CLASS, "setNaN", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "NaN")); il.append(new INVOKEVIRTUAL(nan)); } tmp = getAttribute("infinity"); if ((tmp == null) || (tmp.equals(EMPTYSTRING))) { int inf = cpg.addMethodref(DFS_CLASS, "setInfinity", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "Infinity")); il.append(new INVOKEVIRTUAL(inf)); } final int nAttributes = _attributes.getLength(); for (int i = 0; i < nAttributes; i++) { final String name = _attributes.getQName(i); final String value = _attributes.getValue(i); boolean valid = true; int method = 0; if (name.equals("decimal-separator")) { // DecimalFormatSymbols.setDecimalSeparator(); method = cpg.addMethodref(DFS_CLASS, "setDecimalSeparator", "(C)V"); } else if (name.equals("grouping-separator")) { method = cpg.addMethodref(DFS_CLASS, "setGroupingSeparator", "(C)V"); } else if (name.equals("minus-sign")) { method = cpg.addMethodref(DFS_CLASS, "setMinusSign", "(C)V"); } else if (name.equals("percent")) { method = cpg.addMethodref(DFS_CLASS, "setPercent", "(C)V"); } else if (name.equals("per-mille")) { method = cpg.addMethodref(DFS_CLASS, "setPerMill", "(C)V"); } else if (name.equals("zero-digit")) { method = cpg.addMethodref(DFS_CLASS, "setZeroDigit", "(C)V"); } else if (name.equals("digit")) { method = cpg.addMethodref(DFS_CLASS, "setDigit", "(C)V"); } else if (name.equals("pattern-separator")) { method = cpg.addMethodref(DFS_CLASS, "setPatternSeparator", "(C)V"); } else if (name.equals("NaN")) { method = cpg.addMethodref(DFS_CLASS, "setNaN", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, value)); il.append(new INVOKEVIRTUAL(method)); valid = false; } else if (name.equals("infinity")) { method = cpg.addMethodref(DFS_CLASS, "setInfinity", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, value)); il.append(new INVOKEVIRTUAL(method)); valid = false; } else { valid = false; } if (valid) { il.append(DUP); il.append(new PUSH(cpg, value.charAt(0))); il.append(new INVOKEVIRTUAL(method)); } } final int put = cpg.addMethodref(TRANSLET_CLASS, "addDecimalFormat", "("+STRING_SIG+DFS_SIG+")V"); il.append(new INVOKEVIRTUAL(put)); } /** * Creates the default, nameless, DecimalFormat object in * AbstractTranslet's format_symbols hashtable. * This should be called for every stylesheet, and the entry * may be overridden by later nameless xsl:decimal-format instructions. */ public static void translateDefaultDFS(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); final int init = cpg.addMethodref(DFS_CLASS, "", "("+LOCALE_SIG+")V"); // Push the format name, which is empty, on the stack // for call to addDecimalFormat() il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, EMPTYSTRING)); // Manufacture a DecimalFormatSymbols on the stack for // call to addDecimalFormat(). Use the US Locale as the // default, as most of its settings are equivalent to // the default settings required of xsl:decimal-format - // except for the NaN and infinity attributes. il.append(new NEW(cpg.addClass(DFS_CLASS))); il.append(DUP); il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US", LOCALE_SIG))); il.append(new INVOKESPECIAL(init)); int nan = cpg.addMethodref(DFS_CLASS, "setNaN", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "NaN")); il.append(new INVOKEVIRTUAL(nan)); int inf = cpg.addMethodref(DFS_CLASS, "setInfinity", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "Infinity")); il.append(new INVOKEVIRTUAL(inf)); final int put = cpg.addMethodref(TRANSLET_CLASS, "addDecimalFormat", "("+STRING_SIG+DFS_SIG+")V"); il.append(new INVOKEVIRTUAL(put)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ParentPattern.java0000644000175000017500000001115710721374032025607 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ParentPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ParentPattern extends RelativePathPattern { private final Pattern _left; private final RelativePathPattern _right; public ParentPattern(Pattern left, RelativePathPattern right) { (_left = left).setParent(this); (_right = right).setParent(this); } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); _right.setParser(parser); } public boolean isWildcard() { return false; } public StepPattern getKernelPattern() { return _right.getKernelPattern(); } public void reduceKernelPattern() { _right.reduceKernelPattern(); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { _left.typeCheck(stable); return _right.typeCheck(stable); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final LocalVariableGen local = methodGen.addLocalVariable2("ppt", Util.getJCRefType(NODE_SIG), null); final org.apache.bcel.generic.Instruction loadLocal = new ILOAD(local.getIndex()); final org.apache.bcel.generic.Instruction storeLocal = new ISTORE(local.getIndex()); if (_right.isWildcard()) { il.append(methodGen.loadDOM()); il.append(SWAP); } else if (_right instanceof StepPattern) { il.append(DUP); local.setStart(il.append(storeLocal)); _right.translate(classGen, methodGen); il.append(methodGen.loadDOM()); local.setEnd(il.append(loadLocal)); } else { _right.translate(classGen, methodGen); if (_right instanceof AncestorPattern) { il.append(methodGen.loadDOM()); il.append(SWAP); } } final int getParent = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG); il.append(new INVOKEINTERFACE(getParent, 2)); final SyntaxTreeNode p = getParent(); if (p == null || p instanceof Instruction || p instanceof TopLevelElement) { _left.translate(classGen, methodGen); } else { il.append(DUP); InstructionHandle storeInst = il.append(storeLocal); if (local.getStart() == null) { local.setStart(storeInst); } _left.translate(classGen, methodGen); il.append(methodGen.loadDOM()); local.setEnd(il.append(loadLocal)); } methodGen.removeLocalVariable(local); /* * If _right is an ancestor pattern, backpatch _left false * list to the loop that searches for more ancestors. */ if (_right instanceof AncestorPattern) { final AncestorPattern ancestor = (AncestorPattern) _right; _left.backPatchFalseList(ancestor.getLoopHandle()); // clears list } _trueList.append(_right._trueList.append(_left._trueList)); _falseList.append(_right._falseList.append(_left._falseList)); } public String toString() { return "Parent(" + _left + ", " + _right + ')'; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/RelationalExpr.java0000644000175000017500000002132510721374032025747 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: RelationalExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.IntType; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.RealType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.ResultTreeType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.runtime.Operators; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class RelationalExpr extends Expression { private int _op; private Expression _left, _right; public RelationalExpr(int op, Expression left, Expression right) { _op = op; (_left = left).setParent(this); (_right = right).setParent(this); } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); _right.setParser(parser); } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { if (_left.hasPositionCall()) return true; if (_right.hasPositionCall()) return true; return false; } /** * Returns true if this expressions contains a call to last() */ public boolean hasLastCall() { return (_left.hasLastCall() || _right.hasLastCall()); } public boolean hasReferenceArgs() { return _left.getType() instanceof ReferenceType || _right.getType() instanceof ReferenceType; } public boolean hasNodeArgs() { return _left.getType() instanceof NodeType || _right.getType() instanceof NodeType; } public boolean hasNodeSetArgs() { return _left.getType() instanceof NodeSetType || _right.getType() instanceof NodeSetType; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { Type tleft = _left.typeCheck(stable); Type tright = _right.typeCheck(stable); //bug fix # 2838, cast to reals if both are result tree fragments if (tleft instanceof ResultTreeType && tright instanceof ResultTreeType ) { _right = new CastExpr(_right, Type.Real); _left = new CastExpr(_left, Type.Real); return _type = Type.Boolean; } // If one is of reference type, then convert the other too if (hasReferenceArgs()) { Type type = null; Type typeL = null; Type typeR = null; if (tleft instanceof ReferenceType) { if (_left instanceof VariableRefBase) { VariableRefBase ref = (VariableRefBase)_left; VariableBase var = ref.getVariable(); typeL = var.getType(); } } if (tright instanceof ReferenceType) { if (_right instanceof VariableRefBase) { VariableRefBase ref = (VariableRefBase)_right; VariableBase var = ref.getVariable(); typeR = var.getType(); } } // bug fix # 2838 if (typeL == null) type = typeR; else if (typeR == null) type = typeL; else { type = Type.Real; } if (type == null) type = Type.Real; _right = new CastExpr(_right, type); _left = new CastExpr(_left, type); return _type = Type.Boolean; } if (hasNodeSetArgs()) { // Ensure that the node-set is the left argument if (tright instanceof NodeSetType) { final Expression temp = _right; _right = _left; _left = temp; _op = (_op == Operators.GT) ? Operators.LT : (_op == Operators.LT) ? Operators.GT : (_op == Operators.GE) ? Operators.LE : Operators.GE; tright = _right.getType(); } // Promote nodes to node sets if (tright instanceof NodeType) { _right = new CastExpr(_right, Type.NodeSet); } // Promote integer to doubles to have fewer compares if (tright instanceof IntType) { _right = new CastExpr(_right, Type.Real); } // Promote result-trees to strings if (tright instanceof ResultTreeType) { _right = new CastExpr(_right, Type.String); } return _type = Type.Boolean; } // In the node-boolean case, convert node to boolean first if (hasNodeArgs()) { if (tleft instanceof BooleanType) { _right = new CastExpr(_right, Type.Boolean); tright = Type.Boolean; } if (tright instanceof BooleanType) { _left = new CastExpr(_left, Type.Boolean); tleft = Type.Boolean; } } // Lookup the table of primops to find the best match MethodType ptype = lookupPrimop(stable, Operators.getOpNames(_op), new MethodType(Type.Void, tleft, tright)); if (ptype != null) { Type arg1 = (Type) ptype.argsType().elementAt(0); if (!arg1.identicalTo(tleft)) { _left = new CastExpr(_left, arg1); } Type arg2 = (Type) ptype.argsType().elementAt(1); if (!arg2.identicalTo(tright)) { _right = new CastExpr(_right, arg1); } return _type = ptype.resultType(); } throw new TypeCheckError(this); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (hasNodeSetArgs() || hasReferenceArgs()) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Call compare() from the BasisLibrary _left.translate(classGen, methodGen); _left.startIterator(classGen, methodGen); _right.translate(classGen, methodGen); _right.startIterator(classGen, methodGen); il.append(new PUSH(cpg, _op)); il.append(methodGen.loadDOM()); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "compare", "(" + _left.getType().toSignature() + _right.getType().toSignature() + "I" + DOM_INTF_SIG + ")Z"); il.append(new INVOKESTATIC(index)); } else { translateDesynthesized(classGen, methodGen); synthesize(classGen, methodGen); } } public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { if (hasNodeSetArgs() || hasReferenceArgs()) { translate(classGen, methodGen); desynthesize(classGen, methodGen); } else { BranchInstruction bi = null; final InstructionList il = methodGen.getInstructionList(); _left.translate(classGen, methodGen); _right.translate(classGen, methodGen); // TODO: optimize if one of the args is 0 boolean tozero = false; Type tleft = _left.getType(); if (tleft instanceof RealType) { il.append(tleft.CMP(_op == Operators.LT || _op == Operators.LE)); tleft = Type.Int; tozero = true; } switch (_op) { case Operators.LT: bi = tleft.GE(tozero); break; case Operators.GT: bi = tleft.LE(tozero); break; case Operators.LE: bi = tleft.GT(tozero); break; case Operators.GE: bi = tleft.LT(tozero); break; default: ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_RELAT_OP_ERR,this); getParser().reportError(Constants.FATAL, msg); } _falseList.add(il.append(bi)); // must be backpatched } } public String toString() { return Operators.getOpNames(_op) + '(' + _left + ", " + _right + ')'; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/BooleanExpr.java0000644000175000017500000000474710721374031025244 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BooleanExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * This class implements inlined calls to the XSLT standard functions * true() and false(). * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class BooleanExpr extends Expression { private boolean _value; public BooleanExpr(boolean value) { _value = value; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { _type = Type.Boolean; return _type; } public String toString() { return _value ? "true()" : "false()"; } public boolean getValue() { return _value; } public boolean contextDependent() { return false; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (_value) { il.append(NOP); // true list falls through } else { _falseList.add(il.append(new GOTO(null))); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FilterExpr.java0000644000175000017500000002375410721374032025112 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ class FilterExpr extends Expression { /** * Primary expression of this filter. I.e., 'e' in '(e)[p1]...[pn]'. */ private Expression _primary; /** * Array of predicates in '(e)[p1]...[pn]'. */ private final Vector _predicates; public FilterExpr(Expression primary, Vector predicates) { _primary = primary; _predicates = predicates; primary.setParent(this); } protected Expression getExpr() { if (_primary instanceof CastExpr) return ((CastExpr)_primary).getExpr(); else return _primary; } public void setParser(Parser parser) { super.setParser(parser); _primary.setParser(parser); if (_predicates != null) { final int n = _predicates.size(); for (int i = 0; i < n; i++) { final Expression exp = (Expression)_predicates.elementAt(i); exp.setParser(parser); exp.setParent(this); } } } public String toString() { return "filter-expr(" + _primary + ", " + _predicates + ")"; } /** * Type check a FilterParentPath. If the filter is not a node-set add a * cast to node-set only if it is of reference type. This type coercion * is needed for expressions like $x where $x is a parameter reference. * All optimizations are turned off before type checking underlying * predicates. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { Type ptype = _primary.typeCheck(stable); boolean canOptimize = _primary instanceof KeyCall; if (ptype instanceof NodeSetType == false) { if (ptype instanceof ReferenceType) { _primary = new CastExpr(_primary, Type.NodeSet); } else { throw new TypeCheckError(this); } } // Type check predicates and turn all optimizations off if appropriate int n = _predicates.size(); for (int i = 0; i < n; i++) { Predicate pred = (Predicate) _predicates.elementAt(i); if (!canOptimize) { pred.dontOptimize(); } pred.typeCheck(stable); } return _type = Type.NodeSet; } /** * Translate a filter expression by pushing the appropriate iterator * onto the stack. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (_predicates.size() > 0) { translatePredicates(classGen, methodGen); } else { _primary.translate(classGen, methodGen); } } /** * Translate a sequence of predicates. Each predicate is translated * by constructing an instance of CurrentNodeListIterator * which is initialized from another iterator (recursive call), a * filter and a closure (call to translate on the predicate) and "this". */ public void translatePredicates(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // If not predicates left, translate primary expression if (_predicates.size() == 0) { translate(classGen, methodGen); } else { // Remove the next predicate to be translated Predicate predicate = (Predicate)_predicates.lastElement(); _predicates.remove(predicate); // Translate the rest of the predicates from right to left translatePredicates(classGen, methodGen); if (predicate.isNthPositionFilter()) { int nthIteratorIdx = cpg.addMethodref(NTH_ITERATOR_CLASS, "", "("+NODE_ITERATOR_SIG+"I)V"); // Backwards branches are prohibited if an uninitialized object // is on the stack by section 4.9.4 of the JVM Specification, // 2nd Ed. We don't know whether this code might contain // backwards branches, so we mustn't create the new object unti // after we've created the suspect arguments to its constructor // Instead we calculate the values of the arguments to the // constructor first, store them in temporary variables, create // the object and reload the arguments from the temporaries to // avoid the problem. LocalVariableGen iteratorTemp = methodGen.addLocalVariable("filter_expr_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); iteratorTemp.setStart( il.append(new ASTORE(iteratorTemp.getIndex()))); predicate.translate(classGen, methodGen); LocalVariableGen predicateValueTemp = methodGen.addLocalVariable("filter_expr_tmp2", Util.getJCRefType("I"), null, null); predicateValueTemp.setStart( il.append(new ISTORE(predicateValueTemp.getIndex()))); il.append(new NEW(cpg.addClass(NTH_ITERATOR_CLASS))); il.append(DUP); iteratorTemp.setEnd( il.append(new ALOAD(iteratorTemp.getIndex()))); predicateValueTemp.setEnd( il.append(new ILOAD(predicateValueTemp.getIndex()))); il.append(new INVOKESPECIAL(nthIteratorIdx)); } else { // Translate predicates from right to left final int initCNLI = cpg.addMethodref(CURRENT_NODE_LIST_ITERATOR, "", "("+NODE_ITERATOR_SIG+"Z"+ CURRENT_NODE_LIST_FILTER_SIG + NODE_SIG+TRANSLET_SIG+")V"); // Backwards branches are prohibited if an uninitialized object // is on the stack by section 4.9.4 of the JVM Specification, // 2nd Ed. We don't know whether this code might contain // backwards branches, so we mustn't create the new object // until after we've created the suspect arguments to its // constructor. Instead we calculate the values of the // arguments to the constructor first, store them in temporary // variables, create the object and reload the arguments from // the temporaries to avoid the problem. LocalVariableGen nodeIteratorTemp = methodGen.addLocalVariable("filter_expr_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); nodeIteratorTemp.setStart( il.append(new ASTORE(nodeIteratorTemp.getIndex()))); predicate.translate(classGen, methodGen); LocalVariableGen filterTemp = methodGen.addLocalVariable("filter_expr_tmp2", Util.getJCRefType(CURRENT_NODE_LIST_FILTER_SIG), null, null); filterTemp.setStart( il.append(new ASTORE(filterTemp.getIndex()))); // Create a CurrentNodeListIterator il.append(new NEW(cpg.addClass(CURRENT_NODE_LIST_ITERATOR))); il.append(DUP); // Initialize CurrentNodeListIterator nodeIteratorTemp.setEnd( il.append(new ALOAD(nodeIteratorTemp.getIndex()))); il.append(ICONST_1); filterTemp.setEnd(il.append(new ALOAD(filterTemp.getIndex()))); il.append(methodGen.loadCurrentNode()); il.append(classGen.loadTranslet()); il.append(new INVOKESPECIAL(initCNLI)); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ConcatCall.java0000644000175000017500000000623410721374030025021 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ConcatCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ConcatCall extends FunctionCall { public ConcatCall(QName fname, Vector arguments) { super(fname, arguments); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { for (int i = 0; i < argumentCount(); i++) { final Expression exp = argument(i); if (!exp.typeCheck(stable).identicalTo(Type.String)) { setArgument(i, new CastExpr(exp, Type.String)); } } return _type = Type.String; } /** translate leaves a String on the stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int nArgs = argumentCount(); switch (nArgs) { case 0: il.append(new PUSH(cpg, EMPTYSTRING)); break; case 1: argument().translate(classGen, methodGen); break; default: final int initBuffer = cpg.addMethodref(STRING_BUFFER_CLASS, "", "()V"); final Instruction append = new INVOKEVIRTUAL(cpg.addMethodref(STRING_BUFFER_CLASS, "append", "("+STRING_SIG+")" +STRING_BUFFER_SIG)); final int toString = cpg.addMethodref(STRING_BUFFER_CLASS, "toString", "()"+STRING_SIG); il.append(new NEW(cpg.addClass(STRING_BUFFER_CLASS))); il.append(DUP); il.append(new INVOKESPECIAL(initBuffer)); for (int i = 0; i < nArgs; i++) { argument(i).translate(classGen, methodGen); il.append(append); } il.append(new INVOKEVIRTUAL(toString)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/UnionPathExpr.java0000644000175000017500000001146210721374030025561 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnionPathExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class UnionPathExpr extends Expression { private final Expression _pathExpr; private final Expression _rest; private boolean _reverse = false; // linearization for top level UnionPathExprs private Expression[] _components; public UnionPathExpr(Expression pathExpr, Expression rest) { _pathExpr = pathExpr; _rest = rest; } public void setParser(Parser parser) { super.setParser(parser); // find all expressions in this Union final Vector components = new Vector(); flatten(components); final int size = components.size(); _components = (Expression[])components.toArray(new Expression[size]); for (int i = 0; i < size; i++) { _components[i].setParser(parser); _components[i].setParent(this); if (_components[i] instanceof Step) { final Step step = (Step)_components[i]; final int axis = step.getAxis(); final int type = step.getNodeType(); // Put attribute iterators first if ((axis == Axis.ATTRIBUTE) || (type == DTM.ATTRIBUTE_NODE)) { _components[i] = _components[0]; _components[0] = step; } // Check if the union contains a reverse iterator if (Axis.isReverse(axis)) _reverse = true; } } // No need to reverse anything if another expression lies on top of this if (getParent() instanceof Expression) _reverse = false; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final int length = _components.length; for (int i = 0; i < length; i++) { if (_components[i].typeCheck(stable) != Type.NodeSet) { _components[i] = new CastExpr(_components[i], Type.NodeSet); } } return _type = Type.NodeSet; } public String toString() { return "union(" + _pathExpr + ", " + _rest + ')'; } private void flatten(Vector components) { components.addElement(_pathExpr); if (_rest != null) { if (_rest instanceof UnionPathExpr) { ((UnionPathExpr)_rest).flatten(components); } else { components.addElement(_rest); } } } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int init = cpg.addMethodref(UNION_ITERATOR_CLASS, "", "("+DOM_INTF_SIG+")V"); final int iter = cpg.addMethodref(UNION_ITERATOR_CLASS, ADD_ITERATOR, ADD_ITERATOR_SIG); // Create the UnionIterator and leave it on the stack il.append(new NEW(cpg.addClass(UNION_ITERATOR_CLASS))); il.append(DUP); il.append(methodGen.loadDOM()); il.append(new INVOKESPECIAL(init)); // Add the various iterators to the UnionIterator final int length = _components.length; for (int i = 0; i < length; i++) { _components[i].translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(iter)); } // Order the iterator only if strictly needed if (_reverse) { final int order = cpg.addInterfaceMethodref(DOM_INTF, ORDER_ITERATOR, ORDER_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(methodGen.loadContextNode()); il.append(new INVOKEINTERFACE(order, 3)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FilterParentPath.java0000644000175000017500000001477510721374030026243 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterParentPath.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.NEW; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.ReferenceType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class FilterParentPath extends Expression { private Expression _filterExpr; private Expression _path; private boolean _hasDescendantAxis = false; public FilterParentPath(Expression filterExpr, Expression path) { (_path = path).setParent(this); (_filterExpr = filterExpr).setParent(this); } public void setParser(Parser parser) { super.setParser(parser); _filterExpr.setParser(parser); _path.setParser(parser); } public String toString() { return "FilterParentPath(" + _filterExpr + ", " + _path + ')'; } public void setDescendantAxis() { _hasDescendantAxis = true; } /** * Type check a FilterParentPath. If the filter is not a node-set add a * cast to node-set only if it is of reference type. This type coercion is * needed for expressions like $x/LINE where $x is a parameter reference. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type ftype = _filterExpr.typeCheck(stable); if (ftype instanceof NodeSetType == false) { if (ftype instanceof ReferenceType) { _filterExpr = new CastExpr(_filterExpr, Type.NodeSet); } /* else if (ftype instanceof ResultTreeType) { _filterExpr = new CastExpr(_filterExpr, Type.NodeSet); } */ else if (ftype instanceof NodeType) { _filterExpr = new CastExpr(_filterExpr, Type.NodeSet); } else { throw new TypeCheckError(this); } } // Wrap single node path in a node set final Type ptype = _path.typeCheck(stable); if (!(ptype instanceof NodeSetType)) { _path = new CastExpr(_path, Type.NodeSet); } return _type = Type.NodeSet; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Create new StepIterator final int initSI = cpg.addMethodref(STEP_ITERATOR_CLASS, "", "(" +NODE_ITERATOR_SIG +NODE_ITERATOR_SIG +")V"); // Backwards branches are prohibited if an uninitialized object is // on the stack by section 4.9.4 of the JVM Specification, 2nd Ed. // We don't know whether this code might contain backwards branches, // so we mustn't create the new object until after we've created // the suspect arguments to its constructor. Instead we calculate // the values of the arguments to the constructor first, store them // in temporary variables, create the object and reload the // arguments from the temporaries to avoid the problem. // Recursively compile 2 iterators _filterExpr.translate(classGen, methodGen); LocalVariableGen filterTemp = methodGen.addLocalVariable("filter_parent_path_tmp1", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); filterTemp.setStart(il.append(new ASTORE(filterTemp.getIndex()))); _path.translate(classGen, methodGen); LocalVariableGen pathTemp = methodGen.addLocalVariable("filter_parent_path_tmp2", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); pathTemp.setStart(il.append(new ASTORE(pathTemp.getIndex()))); il.append(new NEW(cpg.addClass(STEP_ITERATOR_CLASS))); il.append(DUP); filterTemp.setEnd(il.append(new ALOAD(filterTemp.getIndex()))); pathTemp.setEnd(il.append(new ALOAD(pathTemp.getIndex()))); // Initialize StepIterator with iterators from the stack il.append(new INVOKESPECIAL(initSI)); // This is a special case for the //* path with or without predicates if (_hasDescendantAxis) { final int incl = cpg.addMethodref(NODE_ITERATOR_BASE, "includeSelf", "()" + NODE_ITERATOR_SIG); il.append(new INVOKEVIRTUAL(incl)); } SyntaxTreeNode parent = getParent(); boolean parentAlreadyOrdered = (parent instanceof RelativeLocationPath) || (parent instanceof FilterParentPath) || (parent instanceof KeyCall) || (parent instanceof CurrentCall) || (parent instanceof DocumentCall); if (!parentAlreadyOrdered) { final int order = cpg.addInterfaceMethodref(DOM_INTF, ORDER_ITERATOR, ORDER_ITERATOR_SIG); il.append(methodGen.loadDOM()); il.append(SWAP); il.append(methodGen.loadContextNode()); il.append(new INVOKEINTERFACE(order, 3)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/XslAttribute.java0000644000175000017500000002425010721374033025451 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XslAttribute.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.serializer.ElemDesc; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.XML11Char; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt * @author Gunnlaugur Briem */ final class XslAttribute extends Instruction { private String _prefix; private AttributeValue _name; // name treated as AVT (7.1.3) private AttributeValueTemplate _namespace = null; private boolean _ignore = false; private boolean _isLiteral = false; // specified name is not AVT /** * Returns the name of the attribute */ public AttributeValue getName() { return _name; } /** * Displays the contents of the attribute */ public void display(int indent) { indent(indent); Util.println("Attribute " + _name); displayContents(indent + IndentIncrement); } /** * Parses the attribute's contents. Special care taken for namespaces. */ public void parseContents(Parser parser) { boolean generated = false; final SymbolTable stable = parser.getSymbolTable(); String name = getAttribute("name"); String namespace = getAttribute("namespace"); QName qname = parser.getQName(name, false); final String prefix = qname.getPrefix(); if (((prefix != null) && (prefix.equals(XMLNS_PREFIX)))||(name.equals(XMLNS_PREFIX))) { reportError(this, parser, ErrorMsg.ILLEGAL_ATTR_NAME_ERR, name); return; } _isLiteral = Util.isLiteral(name); if (_isLiteral) { if (!XML11Char.isXML11ValidQName(name)) { reportError(this, parser, ErrorMsg.ILLEGAL_ATTR_NAME_ERR, name); return; } } // Ignore attribute if preceeded by some other type of element final SyntaxTreeNode parent = getParent(); final Vector siblings = parent.getContents(); for (int i = 0; i < parent.elementCount(); i++) { SyntaxTreeNode item = (SyntaxTreeNode)siblings.elementAt(i); if (item == this) break; // These three objects result in one or more attribute output if (item instanceof XslAttribute) continue; if (item instanceof UseAttributeSets) continue; if (item instanceof LiteralAttribute) continue; if (item instanceof Text) continue; // These objects _can_ result in one or more attribute // The output handler will generate an error if not (at runtime) if (item instanceof If) continue; if (item instanceof Choose) continue; if (item instanceof CopyOf) continue; if (item instanceof VariableBase) continue; // Report warning but do not ignore attribute reportWarning(this, parser, ErrorMsg.STRAY_ATTRIBUTE_ERR, name); } // Get namespace from namespace attribute? if (namespace != null && namespace != Constants.EMPTYSTRING) { _prefix = lookupPrefix(namespace); _namespace = new AttributeValueTemplate(namespace, parser, this); } // Get namespace from prefix in name attribute? else if (prefix != null && prefix != Constants.EMPTYSTRING) { _prefix = prefix; namespace = lookupNamespace(prefix); if (namespace != null) { _namespace = new AttributeValueTemplate(namespace, parser, this); } } // Common handling for namespaces: if (_namespace != null) { // Generate prefix if we have none if (_prefix == null || _prefix == Constants.EMPTYSTRING) { if (prefix != null) { _prefix = prefix; } else { _prefix = stable.generateNamespacePrefix(); generated = true; } } else if (prefix != null && !prefix.equals(_prefix)) { _prefix = prefix; } name = _prefix + ":" + qname.getLocalPart(); /* * TODO: The namespace URI must be passed to the parent * element but we don't yet know what the actual URI is * (as we only know it as an attribute value template). */ if ((parent instanceof LiteralElement) && (!generated)) { ((LiteralElement)parent).registerNamespace(_prefix, namespace, stable, false); } } if (parent instanceof LiteralElement) { ((LiteralElement)parent).addAttribute(this); } _name = AttributeValue.create(this, name, parser); parseChildren(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (!_ignore) { _name.typeCheck(stable); if (_namespace != null) { _namespace.typeCheck(stable); } typeCheckContents(stable); } return Type.Void; } /** * */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (_ignore) return; _ignore = true; // Compile code that emits any needed namespace declaration if (_namespace != null) { // public void attribute(final String name, final String value) il.append(methodGen.loadHandler()); il.append(new PUSH(cpg,_prefix)); _namespace.translate(classGen,methodGen); il.append(methodGen.namespace()); } if (!_isLiteral) { // if the qname is an AVT, then the qname has to be checked at runtime if it is a valid qname LocalVariableGen nameValue = methodGen.addLocalVariable2("nameValue", Util.getJCRefType(STRING_SIG), null); // store the name into a variable first so _name.translate only needs to be called once _name.translate(classGen, methodGen); nameValue.setStart(il.append(new ASTORE(nameValue.getIndex()))); il.append(new ALOAD(nameValue.getIndex())); // call checkQName if the name is an AVT final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkAttribQName", "(" +STRING_SIG +")V"); il.append(new INVOKESTATIC(check)); // Save the current handler base on the stack il.append(methodGen.loadHandler()); il.append(DUP); // first arg to "attributes" call // load name value again nameValue.setEnd(il.append(new ALOAD(nameValue.getIndex()))); } else { // Save the current handler base on the stack il.append(methodGen.loadHandler()); il.append(DUP); // first arg to "attributes" call // Push attribute name _name.translate(classGen, methodGen);// 2nd arg } // Push attribute value - shortcut for literal strings if ((elementCount() == 1) && (elementAt(0) instanceof Text)) { il.append(new PUSH(cpg, ((Text)elementAt(0)).getText())); } else { il.append(classGen.loadTranslet()); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, "stringValueHandler", STRING_VALUE_HANDLER_SIG))); il.append(DUP); il.append(methodGen.storeHandler()); // translate contents with substituted handler translateContents(classGen, methodGen); // get String out of the handler il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_VALUE_HANDLER, "getValue", "()" + STRING_SIG))); } SyntaxTreeNode parent = getParent(); if (parent instanceof LiteralElement && ((LiteralElement)parent).allAttributesUnique()) { int flags = 0; ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc(); // Set the HTML flags if (elemDesc != null && _name instanceof SimpleAttributeValue) { String attrName = ((SimpleAttributeValue)_name).toString(); if (elemDesc.isAttrFlagSet(attrName, ElemDesc.ATTREMPTY)) { flags = flags | SerializationHandler.HTML_ATTREMPTY; } else if (elemDesc.isAttrFlagSet(attrName, ElemDesc.ATTRURL)) { flags = flags | SerializationHandler.HTML_ATTRURL; } } il.append(new PUSH(cpg, flags)); il.append(methodGen.uniqueAttribute()); } else { // call "attribute" il.append(methodGen.attribute()); } // Restore old handler base from stack il.append(methodGen.storeHandler()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Import.java0000644000175000017500000001174410721374032024274 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Import.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.File; import java.net.URL; import java.net.MalformedURLException; import java.util.Enumeration; import org.apache.xml.utils.SystemIDResolver; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; /** * @author Jacek Ambroziak * @author Morten Jorgensen * @author Erwin Bolwidt * @author Gunnlaugur Briem */ final class Import extends TopLevelElement { private Stylesheet _imported = null; public Stylesheet getImportedStylesheet() { return _imported; } public void parseContents(final Parser parser) { final XSLTC xsltc = parser.getXSLTC(); final Stylesheet context = parser.getCurrentStylesheet(); try { String docToLoad = getAttribute("href"); if (context.checkForLoop(docToLoad)) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.CIRCULAR_INCLUDE_ERR, docToLoad, this); parser.reportError(Constants.FATAL, msg); return; } InputSource input = null; XMLReader reader = null; String currLoadedDoc = context.getSystemId(); SourceLoader loader = context.getSourceLoader(); // Use SourceLoader if available if (loader != null) { input = loader.loadSource(docToLoad, currLoadedDoc, xsltc); if (input != null) { docToLoad = input.getSystemId(); reader = xsltc.getXMLReader(); } } // No SourceLoader or not resolved by SourceLoader if (input == null) { docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc); input = new InputSource(docToLoad); } // Return if we could not resolve the URL if (input == null) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.FILE_NOT_FOUND_ERR, docToLoad, this); parser.reportError(Constants.FATAL, msg); return; } final SyntaxTreeNode root; if (reader != null) { root = parser.parse(reader,input); } else { root = parser.parse(input); } if (root == null) return; _imported = parser.makeStylesheet(root); if (_imported == null) return; _imported.setSourceLoader(loader); _imported.setSystemId(docToLoad); _imported.setParentStylesheet(context); _imported.setImportingStylesheet(context); _imported.setTemplateInlining(context.getTemplateInlining()); // precedence for the including stylesheet final int currPrecedence = parser.getCurrentImportPrecedence(); final int nextPrecedence = parser.getNextImportPrecedence(); _imported.setImportPrecedence(currPrecedence); context.setImportPrecedence(nextPrecedence); parser.setCurrentStylesheet(_imported); _imported.parseContents(parser); final Enumeration elements = _imported.elements(); final Stylesheet topStylesheet = parser.getTopLevelStylesheet(); while (elements.hasMoreElements()) { final Object element = elements.nextElement(); if (element instanceof TopLevelElement) { if (element instanceof Variable) { topStylesheet.addVariable((Variable) element); } else if (element instanceof Param) { topStylesheet.addParam((Param) element); } else { topStylesheet.addElement((TopLevelElement) element); } } } } catch (Exception e) { e.printStackTrace(); } finally { parser.setCurrentStylesheet(context); } } public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { // do nothing } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/UseAttributeSets.java0000644000175000017500000000776310721374031026306 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UseAttributeSets.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.StringTokenizer; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class UseAttributeSets extends Instruction { // Only error that can occur: private final static String ATTR_SET_NOT_FOUND = ""; // Contains the names of all references attribute sets private final Vector _sets = new Vector(2); /** * Constructur - define initial attribute sets to use */ public UseAttributeSets(String setNames, Parser parser) { setParser(parser); addAttributeSets(setNames); } /** * This method is made public to enable an AttributeSet object to merge * itself with another AttributeSet (including any other AttributeSets * the two may inherit from). */ public void addAttributeSets(String setNames) { if ((setNames != null) && (!setNames.equals(Constants.EMPTYSTRING))) { final StringTokenizer tokens = new StringTokenizer(setNames); while (tokens.hasMoreTokens()) { final QName qname = getParser().getQNameIgnoreDefaultNs(tokens.nextToken()); _sets.add(qname); } } } /** * Do nada. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { return Type.Void; } /** * Generate a call to the method compiled for this attribute set */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final SymbolTable symbolTable = getParser().getSymbolTable(); // Go through each attribute set and generate a method call for (int i=0; i<_sets.size(); i++) { // Get the attribute set name final QName name = (QName)_sets.elementAt(i); // Get the AttributeSet reference from the symbol table final AttributeSet attrs = symbolTable.lookupAttributeSet(name); // Compile the call to the set's method if the set exists if (attrs != null) { final String methodName = attrs.getMethodName(); il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadIterator()); il.append(methodGen.loadHandler()); final int method = cpg.addMethodref(classGen.getClassName(), methodName, ATTR_SET_SIG); il.append(new INVOKESPECIAL(method)); } // Generate an error if the attribute set does not exist else { final Parser parser = getParser(); final String atrs = name.toString(); reportError(this, parser, ErrorMsg.ATTRIBSET_UNDEF_ERR, atrs); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/NodeTest.java0000644000175000017500000000314310721374031024540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeTest.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.DOM; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface NodeTest { public static final int TEXT = DTM.TEXT_NODE; public static final int COMMENT = DTM.COMMENT_NODE; public static final int PI = DTM.PROCESSING_INSTRUCTION_NODE; public static final int ROOT = DTM.DOCUMENT_NODE; public static final int ELEMENT = DTM.ELEMENT_NODE; public static final int ATTRIBUTE = DTM.ATTRIBUTE_NODE; // generalized type public static final int GTYPE = DTM.NTYPES; public static final int ANODE = DOM.FIRST_TYPE - 1; } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/StringCall.java0000644000175000017500000000454010721374033025061 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class StringCall extends FunctionCall { public StringCall(QName fname, Vector arguments) { super(fname, arguments); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final int argc = argumentCount(); if (argc > 1) { ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this); throw new TypeCheckError(err); } if (argc > 0) { argument().typeCheck(stable); } return _type = Type.String; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); Type targ; if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); targ = Type.Node; } else { final Expression arg = argument(); arg.translate(classGen, methodGen); arg.startIterator(classGen, methodGen); targ = arg.getType(); } if (!targ.identicalTo(Type.String)) { targ.translateTo(classGen, methodGen, Type.String); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/KeyPattern.java0000644000175000017500000000220310721374030025074 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyPattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class KeyPattern extends IdKeyPattern { public KeyPattern(String index, String value) { super(index,value); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/FormatNumberCall.java0000644000175000017500000000754010721374031026215 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FormatNumberCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.RealType; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class FormatNumberCall extends FunctionCall { private Expression _value; private Expression _format; private Expression _name; private QName _resolvedQName = null; public FormatNumberCall(QName fname, Vector arguments) { super(fname, arguments); _value = argument(0); _format = argument(1); _name = argumentCount() == 3 ? argument(2) : null; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Inform stylesheet to instantiate a DecimalFormat object getStylesheet().numberFormattingUsed(); final Type tvalue = _value.typeCheck(stable); if (tvalue instanceof RealType == false) { _value = new CastExpr(_value, Type.Real); } final Type tformat = _format.typeCheck(stable); if (tformat instanceof StringType == false) { _format = new CastExpr(_format, Type.String); } if (argumentCount() == 3) { final Type tname = _name.typeCheck(stable); if (_name instanceof LiteralExpr) { final LiteralExpr literal = (LiteralExpr) _name; _resolvedQName = getParser().getQNameIgnoreDefaultNs(literal.getValue()); } else if (tname instanceof StringType == false) { _name = new CastExpr(_name, Type.String); } } return _type = Type.String; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); _value.translate(classGen, methodGen); _format.translate(classGen, methodGen); final int fn3arg = cpg.addMethodref(BASIS_LIBRARY_CLASS, "formatNumber", "(DLjava/lang/String;"+ "Ljava/text/DecimalFormat;)"+ "Ljava/lang/String;"); final int get = cpg.addMethodref(TRANSLET_CLASS, "getDecimalFormat", "(Ljava/lang/String;)"+ "Ljava/text/DecimalFormat;"); il.append(classGen.loadTranslet()); if (_name == null) { il.append(new PUSH(cpg, EMPTYSTRING)); } else if (_resolvedQName != null) { il.append(new PUSH(cpg, _resolvedQName.toString())); } else { _name.translate(classGen, methodGen); } il.append(new INVOKEVIRTUAL(get)); il.append(new INVOKESTATIC(fn3arg)); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Otherwise.java0000644000175000017500000000364110721374031024767 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Otherwise.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class Otherwise extends Instruction { public void display(int indent) { indent(indent); Util.println("Otherwise"); indent(indent + IndentIncrement); displayContents(indent + IndentIncrement); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { typeCheckContents(stable); return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final Parser parser = getParser(); final ErrorMsg err = new ErrorMsg(ErrorMsg.STRAY_OTHERWISE_ERR, this); parser.reportError(Constants.ERROR, err); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Closure.java0000644000175000017500000000311010721374031024421 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Closure.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Santiago Pericas-Geertsen */ public interface Closure { /** * Returns true if this closure is compiled in an inner class (i.e. * if this is a real closure). */ public boolean inInnerClass(); /** * Returns a reference to its parent closure or null if outermost. */ public Closure getParentClosure(); /** * Returns the name of the auxiliary class or null if this predicate * is compiled inside the Translet. */ public String getInnerClassName(); /** * Add new variable to the closure. */ public void addVariable(VariableRefBase variableRef); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/PositionCall.java0000644000175000017500000000455110721374030025416 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: PositionCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.CompareGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.TestGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class PositionCall extends FunctionCall { public PositionCall(QName fname) { super(fname); } public boolean hasPositionCall() { return true; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadCurrentNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(POSITION_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int index = cpg.addInterfaceMethodref(NODE_ITERATOR, "getPosition", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(index,1)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/UnaryOpExpr.java0000644000175000017500000000545410721374031025256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnaryOpExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class UnaryOpExpr extends Expression { private Expression _left; public UnaryOpExpr(Expression left) { (_left = left).setParent(this); } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { return(_left.hasPositionCall()); } /** * Returns true if this expressions contains a call to last() */ public boolean hasLastCall() { return(_left.hasLastCall()); } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tleft = _left.typeCheck(stable); final MethodType ptype = lookupPrimop(stable, "u-", new MethodType(Type.Void, tleft)); if (ptype != null) { final Type arg1 = (Type) ptype.argsType().elementAt(0); if (!arg1.identicalTo(tleft)) { _left = new CastExpr(_left, arg1); } return _type = ptype.resultType(); } throw new TypeCheckError(this); } public String toString() { return "u-" + '(' + _left + ')'; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { InstructionList il = methodGen.getInstructionList(); _left.translate(classGen, methodGen); il.append(_type.NEG()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Key.java0000644000175000017500000002452510721374032023553 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Key.java 478664 2006-11-23 20:46:53Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFGE; import org.apache.bcel.generic.IFGT; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeSetType; import org.apache.xalan.xsltc.compiler.util.StringType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.Axis; import org.apache.xml.utils.XML11Char; /** * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */ final class Key extends TopLevelElement { /** * The name of this key as defined in xsl:key. */ private QName _name; /** * The pattern to match starting at the root node. */ private Pattern _match; /** * The expression that generates the values for this key. */ private Expression _use; /** * The type of the _use expression. */ private Type _useType; /** * Parse the element and attributes * @param parser A reference to the stylesheet parser */ public void parseContents(Parser parser) { // Get the required attributes and parser XPath expressions final String name = getAttribute("name"); if (!XML11Char.isXML11ValidQName(name)){ ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this); parser.reportError(Constants.ERROR, err); } // Parse key name and add to symbol table _name = parser.getQNameIgnoreDefaultNs(name); getSymbolTable().addKey(_name, this); _match = parser.parsePattern(this, "match", null); _use = parser.parseExpression(this, "use", null); // Make sure required attribute(s) have been set if (_name == null) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name"); return; } if (_match.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "match"); return; } if (_use.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "use"); return; } } /** * Returns a String-representation of this key's name * @return The key's name (from the elements 'name' attribute). */ public String getName() { return _name.toString(); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type check match pattern _match.typeCheck(stable); // Cast node values to string values (except for nodesets) _useType = _use.typeCheck(stable); if (_useType instanceof StringType == false && _useType instanceof NodeSetType == false) { _use = new CastExpr(_use, Type.String); } return Type.Void; } /** * This method is called if the "use" attribute of the key contains a * node set. In this case we must traverse all nodes in the set and * create one entry in this key's index for each node in the set. */ public void traverseNodeSet(ClassGenerator classGen, MethodGenerator methodGen, int buildKeyIndex) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // DOM.getStringValueX(nodeIndex) => String final int getNodeValue = cpg.addInterfaceMethodref(DOM_INTF, GET_NODE_VALUE, "(I)"+STRING_SIG); final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF, "getNodeIdent", "(I)"+NODE_SIG); // AbstractTranslet.SetKeyIndexDom(name, Dom) => void final int keyDom = cpg.addMethodref(TRANSLET_CLASS, "setKeyIndexDom", "("+STRING_SIG+DOM_INTF_SIG+")V"); // This variable holds the id of the node we found with the "match" // attribute of xsl:key. This is the id we store, with the value we // get from the nodes we find here, in the index for this key. final LocalVariableGen parentNode = methodGen.addLocalVariable("parentNode", Util.getJCRefType("I"), null, null); // Get the 'parameter' from the stack and store it in a local var. parentNode.setStart(il.append(new ISTORE(parentNode.getIndex()))); // Save current node and current iterator on the stack il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadIterator()); // Overwrite current iterator with one that gives us only what we want _use.translate(classGen, methodGen); _use.startIterator(classGen, methodGen); il.append(methodGen.storeIterator()); final BranchHandle nextNode = il.append(new GOTO(null)); final InstructionHandle loop = il.append(NOP); // Prepare to call buildKeyIndex(String name, int node, String value); il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, _name.toString())); parentNode.setEnd(il.append(new ILOAD(parentNode.getIndex()))); // Now get the node value and push it on the parameter stack il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEINTERFACE(getNodeValue, 2)); // Finally do the call to add an entry in the index for this key. il.append(new INVOKEVIRTUAL(buildKeyIndex)); il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, getName())); il.append(methodGen.loadDOM()); il.append(new INVOKEVIRTUAL(keyDom)); nextNode.setTarget(il.append(methodGen.loadIterator())); il.append(methodGen.nextNode()); il.append(DUP); il.append(methodGen.storeCurrentNode()); il.append(new IFGE(loop)); // Go on to next matching node.... // Restore current node and current iterator from the stack il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode()); } /** * Gather all nodes that match the expression in the attribute "match" * and add one (or more) entries in this key's index. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int current = methodGen.getLocalIndex("current"); // AbstractTranslet.buildKeyIndex(name,node_id,value) => void final int key = cpg.addMethodref(TRANSLET_CLASS, "buildKeyIndex", "("+STRING_SIG+"I"+OBJECT_SIG+")V"); // AbstractTranslet.SetKeyIndexDom(name, Dom) => void final int keyDom = cpg.addMethodref(TRANSLET_CLASS, "setKeyIndexDom", "("+STRING_SIG+DOM_INTF_SIG+")V"); final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF, "getNodeIdent", "(I)"+NODE_SIG); // DOM.getAxisIterator(root) => NodeIterator final int git = cpg.addInterfaceMethodref(DOM_INTF, "getAxisIterator", "(I)"+NODE_ITERATOR_SIG); il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadIterator()); // Get an iterator for all nodes in the DOM il.append(methodGen.loadDOM()); il.append(new PUSH(cpg,Axis.DESCENDANT)); il.append(new INVOKEINTERFACE(git, 2)); // Reset the iterator to start with the root node il.append(methodGen.loadCurrentNode()); il.append(methodGen.setStartNode()); il.append(methodGen.storeIterator()); // Loop for traversing all nodes in the DOM final BranchHandle nextNode = il.append(new GOTO(null)); final InstructionHandle loop = il.append(NOP); // Check if the current node matches the pattern in "match" il.append(methodGen.loadCurrentNode()); _match.translate(classGen, methodGen); _match.synthesize(classGen, methodGen); // Leaves 0 or 1 on stack final BranchHandle skipNode = il.append(new IFEQ(null)); // If this is a node-set we must go through each node in the set if (_useType instanceof NodeSetType) { // Pass current node as parameter (we're indexing on that node) il.append(methodGen.loadCurrentNode()); traverseNodeSet(classGen, methodGen, key); } else { il.append(classGen.loadTranslet()); il.append(DUP); il.append(new PUSH(cpg, _name.toString())); il.append(DUP_X1); il.append(methodGen.loadCurrentNode()); _use.translate(classGen, methodGen); il.append(new INVOKEVIRTUAL(key)); il.append(methodGen.loadDOM()); il.append(new INVOKEVIRTUAL(keyDom)); } // Get the next node from the iterator and do loop again... final InstructionHandle skip = il.append(NOP); il.append(methodGen.loadIterator()); il.append(methodGen.nextNode()); il.append(DUP); il.append(methodGen.storeCurrentNode()); il.append(new IFGT(loop)); // Restore current node and current iterator from the stack il.append(methodGen.storeIterator()); il.append(methodGen.storeCurrentNode()); nextNode.setTarget(skip); skipNode.setTarget(skip); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Copy.java0000644000175000017500000001271010721374032023726 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Copy.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ALOAD; import org.apache.bcel.generic.ASTORE; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.IFEQ; import org.apache.bcel.generic.IFNULL; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class Copy extends Instruction { private UseAttributeSets _useSets; public void parseContents(Parser parser) { final String useSets = getAttribute("use-attribute-sets"); if (useSets.length() > 0) { if (!Util.isValidQNames(useSets)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, useSets, this); parser.reportError(Constants.ERROR, err); } _useSets = new UseAttributeSets(useSets, parser); } parseChildren(parser); } public void display(int indent) { indent(indent); Util.println("Copy"); indent(indent + IndentIncrement); displayContents(indent + IndentIncrement); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_useSets != null) { _useSets.typeCheck(stable); } typeCheckContents(stable); return Type.Void; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final LocalVariableGen name = methodGen.addLocalVariable2("name", Util.getJCRefType(STRING_SIG), null); final LocalVariableGen length = methodGen.addLocalVariable2("length", Util.getJCRefType("I"), null); // Get the name of the node to copy and save for later il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); il.append(methodGen.loadHandler()); final int cpy = cpg.addInterfaceMethodref(DOM_INTF, "shallowCopy", "(" + NODE_SIG + TRANSLET_OUTPUT_SIG + ")" + STRING_SIG); il.append(new INVOKEINTERFACE(cpy, 3)); il.append(DUP); name.setStart(il.append(new ASTORE(name.getIndex()))); final BranchHandle ifBlock1 = il.append(new IFNULL(null)); // Get the length of the node name and save for later il.append(new ALOAD(name.getIndex())); final int lengthMethod = cpg.addMethodref(STRING_CLASS,"length","()I"); il.append(new INVOKEVIRTUAL(lengthMethod)); length.setStart(il.append(new ISTORE(length.getIndex()))); // Copy in attribute sets if specified if (_useSets != null) { // If the parent of this element will result in an element being // output then we know that it is safe to copy out the attributes final SyntaxTreeNode parent = getParent(); if ((parent instanceof LiteralElement) || (parent instanceof LiteralElement)) { _useSets.translate(classGen, methodGen); } // If not we have to check to see if the copy will result in an // element being output. else { // check if element; if not skip to translate body il.append(new ILOAD(length.getIndex())); final BranchHandle ifBlock2 = il.append(new IFEQ(null)); // length != 0 -> element -> do attribute sets _useSets.translate(classGen, methodGen); // not an element; root ifBlock2.setTarget(il.append(NOP)); } } // Instantiate body of xsl:copy translateContents(classGen, methodGen); // Call the output handler's endElement() if we copied an element // (The DOM.shallowCopy() method calls startElement().) length.setEnd(il.append(new ILOAD(length.getIndex()))); final BranchHandle ifBlock3 = il.append(new IFEQ(null)); il.append(methodGen.loadHandler()); name.setEnd(il.append(new ALOAD(name.getIndex()))); il.append(methodGen.endElement()); final InstructionHandle end = il.append(NOP); ifBlock1.setTarget(end); ifBlock3.setTarget(end); methodGen.removeLocalVariable(name); methodGen.removeLocalVariable(length); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/When.java0000644000175000017500000000672710721374031023727 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: When.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class When extends Instruction { private Expression _test; private boolean _ignore = false; public void display(int indent) { indent(indent); Util.println("When"); indent(indent + IndentIncrement); System.out.print("test "); Util.println(_test.toString()); displayContents(indent + IndentIncrement); } public Expression getTest() { return _test; } public boolean ignore() { return(_ignore); } public void parseContents(Parser parser) { _test = parser.parseExpression(this, "test", null); // Ignore xsl:if when test is false (function-available() and // element-available()) Object result = _test.evaluateAtCompileTime(); if (result != null && result instanceof Boolean) { _ignore = !((Boolean) result).booleanValue(); } parseChildren(parser); // Make sure required attribute(s) have been set if (_test.isDummy()) { reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "test"); } } /** * Type-check this when element. The test should always be type checked, * while we do not bother with the contents if we know the test fails. * This is important in cases where the "test" expression tests for * the support of a non-available element, and the body contains * this non-available element. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type-check the test expression if (_test.typeCheck(stable) instanceof BooleanType == false) { _test = new CastExpr(_test, Type.Boolean); } // Type-check the contents (if necessary) if (!_ignore) { typeCheckContents(stable); } return Type.Void; } /** * This method should never be called. An Otherwise object will explicitly * translate the "test" expression and and contents of this element. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.STRAY_WHEN_ERR, this); getParser().reportError(Constants.ERROR, msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java0000644000175000017500000001722310721374033025232 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LogicalExpr.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.MethodType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ final class LogicalExpr extends Expression { public static final int OR = 0; public static final int AND = 1; private final int _op; // operator private Expression _left; // first operand private Expression _right; // second operand private static final String[] Ops = { "or", "and" }; /** * Creates a new logical expression - either OR or AND. Note that the * left- and right-hand side expressions can also be logical expressions, * thus creating logical trees representing structures such as * (a and (b or c) and d), etc... */ public LogicalExpr(int op, Expression left, Expression right) { _op = op; (_left = left).setParent(this); (_right = right).setParent(this); } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { return (_left.hasPositionCall() || _right.hasPositionCall()); } /** * Returns true if this expressions contains a call to last() */ public boolean hasLastCall() { return (_left.hasLastCall() || _right.hasLastCall()); } /** * Returns an object representing the compile-time evaluation * of an expression. We are only using this for function-available * and element-available at this time. */ public Object evaluateAtCompileTime() { final Object leftb = _left.evaluateAtCompileTime(); final Object rightb = _right.evaluateAtCompileTime(); // Return null if we can't evaluate at compile time if (leftb == null || rightb == null) { return null; } if (_op == AND) { return (leftb == Boolean.TRUE && rightb == Boolean.TRUE) ? Boolean.TRUE : Boolean.FALSE; } else { return (leftb == Boolean.TRUE || rightb == Boolean.TRUE) ? Boolean.TRUE : Boolean.FALSE; } } /** * Returns this logical expression's operator - OR or AND represented * by 0 and 1 respectively. */ public int getOp() { return(_op); } /** * Override the SyntaxTreeNode.setParser() method to make sure that the * parser is set for sub-expressions */ public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); _right.setParser(parser); } /** * Returns a string describing this expression */ public String toString() { return Ops[_op] + '(' + _left + ", " + _right + ')'; } /** * Type-check this expression, and possibly child expressions. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Get the left and right operand types Type tleft = _left.typeCheck(stable); Type tright = _right.typeCheck(stable); // Check if the operator supports the two operand types MethodType wantType = new MethodType(Type.Void, tleft, tright); MethodType haveType = lookupPrimop(stable, Ops[_op], wantType); // Yes, the operation is supported if (haveType != null) { // Check if left-hand side operand must be type casted Type arg1 = (Type)haveType.argsType().elementAt(0); if (!arg1.identicalTo(tleft)) _left = new CastExpr(_left, arg1); // Check if right-hand side operand must be type casted Type arg2 = (Type) haveType.argsType().elementAt(1); if (!arg2.identicalTo(tright)) _right = new CastExpr(_right, arg1); // Return the result type for the operator we will use return _type = haveType.resultType(); } throw new TypeCheckError(this); } /** * Compile the expression - leave boolean expression on stack */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { translateDesynthesized(classGen, methodGen); synthesize(classGen, methodGen); } /** * Compile expression and update true/false-lists */ public void translateDesynthesized(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); final SyntaxTreeNode parent = getParent(); // Compile AND-expression if (_op == AND) { // Translate left hand side - must be true _left.translateDesynthesized(classGen, methodGen); // Need this for chaining any OR-expression children InstructionHandle middle = il.append(NOP); // Translate left right side - must be true _right.translateDesynthesized(classGen, methodGen); // Need this for chaining any OR-expression children InstructionHandle after = il.append(NOP); // Append child expression false-lists to our false-list _falseList.append(_right._falseList.append(_left._falseList)); // Special case for OR-expression as a left child of AND. // The true-list of OR must point to second clause of AND. if ((_left instanceof LogicalExpr) && (((LogicalExpr)_left).getOp() == OR)) { _left.backPatchTrueList(middle); } else if (_left instanceof NotCall) { _left.backPatchTrueList(middle); } else { _trueList.append(_left._trueList); } // Special case for OR-expression as a right child of AND // The true-list of OR must point to true-list of AND. if ((_right instanceof LogicalExpr) && (((LogicalExpr)_right).getOp() == OR)) { _right.backPatchTrueList(after); } else if (_right instanceof NotCall) { _right.backPatchTrueList(after); } else { _trueList.append(_right._trueList); } } // Compile OR-expression else { // Translate left-hand side expression and produce true/false list _left.translateDesynthesized(classGen, methodGen); // This GOTO is used to skip over the code for the last test // in the case where the the first test succeeds InstructionHandle ih = il.append(new GOTO(null)); // Translate right-hand side expression and produce true/false list _right.translateDesynthesized(classGen, methodGen); _left._trueList.backPatch(ih); _left._falseList.backPatch(ih.getNext()); _falseList.append(_right._falseList); _trueList.add(ih).append(_right._trueList); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java0000644000175000017500000007724210721374031025742 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SyntaxTreeNode.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import org.apache.bcel.generic.ANEWARRAY; import org.apache.bcel.generic.BasicType; import org.apache.bcel.generic.CHECKCAST; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.DUP_X1; import org.apache.bcel.generic.GETFIELD; import org.apache.bcel.generic.ICONST; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKESPECIAL; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.NEW; import org.apache.bcel.generic.NEWARRAY; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.runtime.AttributeList; import org.xml.sax.Attributes; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author G. Todd Miller * @author Morten Jorensen * @author Erwin Bolwidt * @author John Howard */ public abstract class SyntaxTreeNode implements Constants { // Reference to the AST parser private Parser _parser; // AST navigation pointers protected SyntaxTreeNode _parent; // Parent node private Stylesheet _stylesheet; // Stylesheet ancestor node private Template _template; // Template ancestor node private final Vector _contents = new Vector(2); // Child nodes // Element description data protected QName _qname; // The element QName private int _line; // Source file line number protected AttributeList _attributes = null; // Attributes of this element private Hashtable _prefixMapping = null; // Namespace declarations public static final int UNKNOWN_STYLESHEET_NODE_ID = -1; // Records whether this node or any descendant needs to know the // in-scope namespaces at transform-time private int _nodeIDForStylesheetNSLookup = UNKNOWN_STYLESHEET_NODE_ID; // Sentinel - used to denote unrecognised syntaxt tree nodes. static final SyntaxTreeNode Dummy = new AbsolutePathPattern(null); // These two are used for indenting nodes in the AST (debug output) protected static final int IndentIncrement = 4; private static final char[] _spaces = " ".toCharArray(); /** * Creates a new SyntaxTreeNode with a 'null' QName and no source file * line number reference. */ public SyntaxTreeNode() { _line = 0; _qname = null; } /** * Creates a new SyntaxTreeNode with a 'null' QName. * @param line Source file line number reference */ public SyntaxTreeNode(int line) { _line = line; _qname = null; } /** * Creates a new SyntaxTreeNode with no source file line number reference. * @param uri The element's namespace URI * @param prefix The element's namespace prefix * @param local The element's local name */ public SyntaxTreeNode(String uri, String prefix, String local) { _line = 0; setQName(uri, prefix, local); } /** * Set the source file line number for this element * @param line The source file line number. */ protected final void setLineNumber(int line) { _line = line; } /** * Get the source file line number for this element. If unavailable, lookup * in ancestors. * * @return The source file line number. */ public final int getLineNumber() { if (_line > 0) return _line; SyntaxTreeNode parent = getParent(); return (parent != null) ? parent.getLineNumber() : 0; } /** * Set the QName for the syntax tree node. * @param qname The QName for the syntax tree node */ protected void setQName(QName qname) { _qname = qname; } /** * Set the QName for the SyntaxTreeNode * @param uri The element's namespace URI * @param prefix The element's namespace prefix * @param local The element's local name */ protected void setQName(String uri, String prefix, String localname) { _qname = new QName(uri, prefix, localname); } /** * Set the QName for the SyntaxTreeNode * @param qname The QName for the syntax tree node */ protected QName getQName() { return(_qname); } /** * Set the attributes for this SyntaxTreeNode. * @param attributes Attributes for the element. Must be passed in as an * implementation of org.xml.sax.Attributes. */ protected void setAttributes(AttributeList attributes) { _attributes = attributes; } /** * Returns a value for an attribute from the source element. * @param qname The QName of the attribute to return. * @return The value of the attribute of name 'qname'. */ protected String getAttribute(String qname) { if (_attributes == null) { return EMPTYSTRING; } final String value = _attributes.getValue(qname); return (value == null || value.equals(EMPTYSTRING)) ? EMPTYSTRING : value; } protected String getAttribute(String prefix, String localName) { return getAttribute(prefix + ':' + localName); } protected boolean hasAttribute(String qname) { return (_attributes != null && _attributes.getValue(qname) != null); } protected void addAttribute(String qname, String value) { _attributes.add(qname, value); } /** * Returns a list of all attributes declared for the element represented by * this syntax tree node. * @return Attributes for this syntax tree node */ protected Attributes getAttributes() { return(_attributes); } /** * Sets the prefix mapping for the namespaces that were declared in this * element. This does not include all prefix mappings in scope, so one * may have to check ancestor elements to get all mappings that are in * in scope. The prefixes must be passed in as a Hashtable that maps * namespace prefixes (String objects) to namespace URIs (also String). * @param mapping The Hashtable containing the mappings. */ protected void setPrefixMapping(Hashtable mapping) { _prefixMapping = mapping; } /** * Returns a Hashtable containing the prefix mappings that were declared * for this element. This does not include all prefix mappings in scope, * so one may have to check ancestor elements to get all mappings that are * in in scope. * @return Prefix mappings (for this element only). */ protected Hashtable getPrefixMapping() { return _prefixMapping; } /** * Adds a single prefix mapping to this syntax tree node. * @param prefix Namespace prefix. * @param uri Namespace URI. */ protected void addPrefixMapping(String prefix, String uri) { if (_prefixMapping == null) _prefixMapping = new Hashtable(); _prefixMapping.put(prefix, uri); } /** * Returns any namespace URI that is in scope for a given prefix. This * method checks namespace mappings for this element, and if necessary * for ancestor elements as well (ie. if the prefix maps to an URI in this * scope then you'll definately get the URI from this method). * @param prefix Namespace prefix. * @return Namespace URI. */ protected String lookupNamespace(String prefix) { // Initialise the output (default is 'null' for undefined) String uri = null; // First look up the prefix/uri mapping in our own hashtable... if (_prefixMapping != null) uri = (String)_prefixMapping.get(prefix); // ... but if we can't find it there we ask our parent for the mapping if ((uri == null) && (_parent != null)) { uri = _parent.lookupNamespace(prefix); if ((prefix == Constants.EMPTYSTRING) && (uri == null)) uri = Constants.EMPTYSTRING; } // ... and then we return whatever URI we've got. return(uri); } /** * Returns any namespace prefix that is mapped to a prefix in the current * scope. This method checks namespace mappings for this element, and if * necessary for ancestor elements as well (ie. if the URI is declared * within the current scope then you'll definately get the prefix from * this method). Note that this is a very slow method and consequentially * it should only be used strictly when needed. * @param uri Namespace URI. * @return Namespace prefix. */ protected String lookupPrefix(String uri) { // Initialise the output (default is 'null' for undefined) String prefix = null; // First look up the prefix/uri mapping in our own hashtable... if ((_prefixMapping != null) && (_prefixMapping.contains(uri))) { Enumeration prefixes = _prefixMapping.keys(); while (prefixes.hasMoreElements()) { prefix = (String)prefixes.nextElement(); String mapsTo = (String)_prefixMapping.get(prefix); if (mapsTo.equals(uri)) return(prefix); } } // ... but if we can't find it there we ask our parent for the mapping else if (_parent != null) { prefix = _parent.lookupPrefix(uri); if ((uri == Constants.EMPTYSTRING) && (prefix == null)) prefix = Constants.EMPTYSTRING; } return(prefix); } /** * Set this node's parser. The parser (the XSLT parser) gives this * syntax tree node access to the symbol table and XPath parser. * @param parser The XSLT parser. */ protected void setParser(Parser parser) { _parser = parser; } /** * Returns this node's XSLT parser. * @return The XSLT parser. */ public final Parser getParser() { return _parser; } /** * Set this syntax tree node's parent node * @param parent The parent node. */ protected void setParent(SyntaxTreeNode parent) { if (_parent == null) _parent = parent; } /** * Returns this syntax tree node's parent node. * @return The parent syntax tree node. */ protected final SyntaxTreeNode getParent() { return _parent; } /** * Returns 'true' if this syntax tree node is the Sentinal node. * @return 'true' if this syntax tree node is the Sentinal node. */ protected final boolean isDummy() { return this == Dummy; } /** * Get the import precedence of this element. The import precedence equals * the import precedence of the stylesheet in which this element occured. * @return The import precedence of this syntax tree node. */ protected int getImportPrecedence() { Stylesheet stylesheet = getStylesheet(); if (stylesheet == null) return Integer.MIN_VALUE; return stylesheet.getImportPrecedence(); } /** * Get the Stylesheet node that represents the element * that this node occured under. * @return The Stylesheet ancestor node of this node. */ public Stylesheet getStylesheet() { if (_stylesheet == null) { SyntaxTreeNode parent = this; while (parent != null) { if (parent instanceof Stylesheet) return((Stylesheet)parent); parent = parent.getParent(); } _stylesheet = (Stylesheet)parent; } return(_stylesheet); } /** * Get the Template node that represents the element * that this node occured under. Note that this method will return 'null' * for nodes that represent top-level elements. * @return The Template ancestor node of this node or 'null'. */ protected Template getTemplate() { if (_template == null) { SyntaxTreeNode parent = this; while ((parent != null) && (!(parent instanceof Template))) parent = parent.getParent(); _template = (Template)parent; } return(_template); } /** * Returns a reference to the XSLTC (XSLT compiler) in use. * @return XSLTC - XSLT compiler. */ protected final XSLTC getXSLTC() { return _parser.getXSLTC(); } /** * Returns the XSLT parser's symbol table. * @return Symbol table. */ protected final SymbolTable getSymbolTable() { return (_parser == null) ? null : _parser.getSymbolTable(); } /** * Parse the contents of this syntax tree nodes (child nodes, XPath * expressions, patterns and functions). The default behaviour is to parser * the syntax tree node's children (since there are no common expressions, * patterns, etc. that can be handled in this base class. * @param parser reference to the XSLT parser */ public void parseContents(Parser parser) { parseChildren(parser); } /** * Parse all children of this syntax tree node. This method is normally * called by the parseContents() method. * @param parser reference to the XSLT parser */ protected final void parseChildren(Parser parser) { Vector locals = null; // only create when needed final int count = _contents.size(); for (int i=0; i or . * * @param node A node * @return true if the node content can be considered as an adaptive RTF. */ private boolean isAdaptiveRTF(SyntaxTreeNode node) { Vector contents = node.getContents(); for (int i = 0; i < contents.size(); i++) { SyntaxTreeNode item = (SyntaxTreeNode)contents.elementAt(i); if (!isTextElement(item, true)) return false; } return true; } /** * Return true if the node only produces Text content. * * A node is a Text element if it is Text, xsl:value-of, xsl:number, * or a combination of these nested in a control instruction (xsl:if or * xsl:choose). * * If the doExtendedCheck flag is true, xsl:call-template and xsl:apply-templates * are also considered as Text elements. * * @param node A node * @param doExtendedCheck If this flag is true, and * are also considered as Text elements. * * @return true if the node of Text type */ private boolean isTextElement(SyntaxTreeNode node, boolean doExtendedCheck) { if (node instanceof ValueOf || node instanceof Number || node instanceof Text) { return true; } else if (node instanceof If) { return doExtendedCheck ? isAdaptiveRTF(node) : isSimpleRTF(node); } else if (node instanceof Choose) { Vector contents = node.getContents(); for (int i = 0; i < contents.size(); i++) { SyntaxTreeNode item = (SyntaxTreeNode)contents.elementAt(i); if (item instanceof Text || ((item instanceof When || item instanceof Otherwise) && ((doExtendedCheck && isAdaptiveRTF(item)) || (!doExtendedCheck && isSimpleRTF(item))))) continue; else return false; } return true; } else if (doExtendedCheck && (node instanceof CallTemplate || node instanceof ApplyTemplates)) return true; else return false; } /** * Utility method used by parameters and variables to store result trees * @param classGen BCEL Java class generator * @param methodGen BCEL Java method generator */ protected void compileResultTree(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final Stylesheet stylesheet = classGen.getStylesheet(); boolean isSimple = isSimpleRTF(this); boolean isAdaptive = false; if (!isSimple) { isAdaptive = isAdaptiveRTF(this); } int rtfType = isSimple ? DOM.SIMPLE_RTF : (isAdaptive ? DOM.ADAPTIVE_RTF : DOM.TREE_RTF); // Save the current handler base on the stack il.append(methodGen.loadHandler()); final String DOM_CLASS = classGen.getDOMClass(); // Create new instance of DOM class (with RTF_INITIAL_SIZE nodes) //int index = cpg.addMethodref(DOM_IMPL, "", "(I)V"); //il.append(new NEW(cpg.addClass(DOM_IMPL))); il.append(methodGen.loadDOM()); int index = cpg.addInterfaceMethodref(DOM_INTF, "getResultTreeFrag", "(IIZ)" + DOM_INTF_SIG); il.append(new PUSH(cpg, RTF_INITIAL_SIZE)); il.append(new PUSH(cpg, rtfType)); il.append(new PUSH(cpg, stylesheet.callsNodeset())); il.append(new INVOKEINTERFACE(index,4)); il.append(DUP); // Overwrite old handler with DOM handler index = cpg.addInterfaceMethodref(DOM_INTF, "getOutputDomBuilder", "()" + TRANSLET_OUTPUT_SIG); il.append(new INVOKEINTERFACE(index,1)); il.append(DUP); il.append(methodGen.storeHandler()); // Call startDocument on the new handler il.append(methodGen.startDocument()); // Instantiate result tree fragment translateContents(classGen, methodGen); // Call endDocument on the new handler il.append(methodGen.loadHandler()); il.append(methodGen.endDocument()); // Check if we need to wrap the DOMImpl object in a DOMAdapter object. // DOMAdapter is not needed if the RTF is a simple RTF and the nodeset() // function is not used. if (stylesheet.callsNodeset() && !DOM_CLASS.equals(DOM_IMPL_CLASS)) { // new org.apache.xalan.xsltc.dom.DOMAdapter(DOMImpl,String[]); index = cpg.addMethodref(DOM_ADAPTER_CLASS, "", "("+DOM_INTF_SIG+ "["+STRING_SIG+ "["+STRING_SIG+ "[I"+ "["+STRING_SIG+")V"); il.append(new NEW(cpg.addClass(DOM_ADAPTER_CLASS))); il.append(new DUP_X1()); il.append(SWAP); /* * Give the DOM adapter an empty type mapping if the nodeset * extension function is never called. */ if (!stylesheet.callsNodeset()) { il.append(new ICONST(0)); il.append(new ANEWARRAY(cpg.addClass(STRING))); il.append(DUP); il.append(DUP); il.append(new ICONST(0)); il.append(new NEWARRAY(BasicType.INT)); il.append(SWAP); il.append(new INVOKESPECIAL(index)); } else { // Push name arrays on the stack il.append(ALOAD_0); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, NAMES_INDEX, NAMES_INDEX_SIG))); il.append(ALOAD_0); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, URIS_INDEX, URIS_INDEX_SIG))); il.append(ALOAD_0); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, TYPES_INDEX, TYPES_INDEX_SIG))); il.append(ALOAD_0); il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS, NAMESPACE_INDEX, NAMESPACE_INDEX_SIG))); // Initialized DOM adapter il.append(new INVOKESPECIAL(index)); // Add DOM adapter to MultiDOM class by calling addDOMAdapter() il.append(DUP); il.append(methodGen.loadDOM()); il.append(new CHECKCAST(cpg.addClass(classGen.getDOMClass()))); il.append(SWAP); index = cpg.addMethodref(MULTI_DOM_CLASS, "addDOMAdapter", "(" + DOM_ADAPTER_SIG + ")I"); il.append(new INVOKEVIRTUAL(index)); il.append(POP); // ignore mask returned by addDOMAdapter } } // Restore old handler base from stack il.append(SWAP); il.append(methodGen.storeHandler()); } /** * Retrieve an ID to identify the namespaces in scope at this point in the * stylesheet * @return An int representing the node ID or -1 * if no namespace declarations are in scope */ protected final int getNodeIDForStylesheetNSLookup() { if (_nodeIDForStylesheetNSLookup == UNKNOWN_STYLESHEET_NODE_ID) { Hashtable prefixMapping = getPrefixMapping(); int parentNodeID = (_parent != null) ? _parent.getNodeIDForStylesheetNSLookup() : UNKNOWN_STYLESHEET_NODE_ID; // If this node in the stylesheet has no namespace declarations of // its own, use the ID of the nearest ancestor element that does // have namespace declarations. if (prefixMapping == null) { _nodeIDForStylesheetNSLookup = parentNodeID; } else { // Inform the XSLTC object that we'll need to know about this // node's namespace declarations. _nodeIDForStylesheetNSLookup = getXSLTC().registerStylesheetPrefixMappingForRuntime( prefixMapping, parentNodeID); } } return _nodeIDForStylesheetNSLookup; } /** * Returns true if this expression/instruction depends on the context. By * default, every expression/instruction depends on the context unless it * overrides this method. Currently used to determine if result trees are * compiled using procedures or little DOMs (result tree fragments). * @return 'true' if this node depends on the context. */ protected boolean contextDependent() { return true; } /** * Return true if any of the expressions/instructions in the contents of * this node is context dependent. * @return 'true' if the contents of this node is context dependent. */ protected boolean dependentContents() { final int n = elementCount(); for (int i = 0; i < n; i++) { final SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i); if (item.contextDependent()) { return true; } } return false; } /** * Adds a child node to this syntax tree node. * @param element is the new child node. */ protected final void addElement(SyntaxTreeNode element) { _contents.addElement(element); element.setParent(this); } /** * Inserts the first child node of this syntax tree node. The existing * children are shifted back one position. * @param element is the new child node. */ protected final void setFirstElement(SyntaxTreeNode element) { _contents.insertElementAt(element,0); element.setParent(this); } /** * Removed a child node of this syntax tree node. * @param element is the child node to remove. */ protected final void removeElement(SyntaxTreeNode element) { _contents.remove(element); element.setParent(null); } /** * Returns a Vector containing all the child nodes of this node. * @return A Vector containing all the child nodes of this node. */ protected final Vector getContents() { return _contents; } /** * Tells you if this node has any child nodes. * @return 'true' if this node has any children. */ protected final boolean hasContents() { return elementCount() > 0; } /** * Returns the number of children this node has. * @return Number of child nodes. */ protected final int elementCount() { return _contents.size(); } /** * Returns an Enumeration of all child nodes of this node. * @return An Enumeration of all child nodes of this node. */ protected final Enumeration elements() { return _contents.elements(); } /** * Returns a child node at a given position. * @param pos The child node's position. * @return The child node. */ protected final Object elementAt(int pos) { return _contents.elementAt(pos); } /** * Returns this element's last child * @return The child node. */ protected final SyntaxTreeNode lastChild() { if (_contents.size() == 0) return null; return (SyntaxTreeNode)_contents.lastElement(); } /** * Displays the contents of this syntax tree node (to stdout). * This method is intended for debugging _only_, and should be overridden * by all syntax tree node implementations. * @param indent Indentation level for syntax tree levels. */ public void display(int indent) { displayContents(indent); } /** * Displays the contents of this syntax tree node (to stdout). * This method is intended for debugging _only_ !!! * @param indent Indentation level for syntax tree levels. */ protected void displayContents(int indent) { final int n = elementCount(); for (int i = 0; i < n; i++) { SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i); item.display(indent); } } /** * Set the indentation level for debug output. * @param indent Indentation level for syntax tree levels. */ protected final void indent(int indent) { System.out.print(new String(_spaces, 0, indent)); } /** * Report an error to the parser. * @param element The element in which the error occured (normally 'this' * but it could also be an expression/pattern/etc.) * @param parser The XSLT parser to report the error to. * @param error The error code (from util/ErrorMsg). * @param message Any additional error message. */ protected void reportError(SyntaxTreeNode element, Parser parser, String errorCode, String message) { final ErrorMsg error = new ErrorMsg(errorCode, message, element); parser.reportError(Constants.ERROR, error); } /** * Report a recoverable error to the parser. * @param element The element in which the error occured (normally 'this' * but it could also be an expression/pattern/etc.) * @param parser The XSLT parser to report the error to. * @param error The error code (from util/ErrorMsg). * @param message Any additional error message. */ protected void reportWarning(SyntaxTreeNode element, Parser parser, String errorCode, String message) { final ErrorMsg error = new ErrorMsg(errorCode, message, element); parser.reportError(Constants.WARNING, error); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/SourceLoader.java0000644000175000017500000000277410721374031025413 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SourceLoader.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.xml.sax.InputSource; /** * @author Morten Jorgensen */ public interface SourceLoader { /** * This interface is used to plug external document loaders into XSLTC * (used with the and elements. * * @param href The URI of the document to load * @param context The URI of the currently loaded document * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */ public InputSource loadSource(String href, String context, XSLTC xsltc); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Mode.java0000644000175000017500000014577710721374030023722 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Mode.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.DUP; import org.apache.bcel.generic.GOTO_W; import org.apache.bcel.generic.IFLT; import org.apache.bcel.generic.ILOAD; import org.apache.bcel.generic.INVOKEINTERFACE; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.ISTORE; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.LocalVariableGen; import org.apache.bcel.generic.SWITCH; import org.apache.bcel.generic.TargetLostException; import org.apache.bcel.util.InstructionFinder; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NamedMethodGenerator; import org.apache.xalan.xsltc.compiler.util.Util; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; /** * Mode gathers all the templates belonging to a given mode; * it is responsible for generating an appropriate * applyTemplates + (mode name) method in the translet. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Erwin Bolwidt * @author G. Todd Miller */ final class Mode implements Constants { /** * The name of this mode as defined in the stylesheet. */ private final QName _name; /** * A reference to the stylesheet object that owns this mode. */ private final Stylesheet _stylesheet; /** * The name of the method in which this mode is compiled. */ private final String _methodName; /** * A vector of all the templates in this mode. */ private Vector _templates; /** * Group for patterns with node()-type kernel and child axis. */ private Vector _childNodeGroup = null; /** * Test sequence for patterns with node()-type kernel and child axis. */ private TestSeq _childNodeTestSeq = null; /** * Group for patterns with node()-type kernel and attribute axis. */ private Vector _attribNodeGroup = null; /** * Test sequence for patterns with node()-type kernel and attribute axis. */ private TestSeq _attribNodeTestSeq = null; /** * Group for patterns with id() or key()-type kernel. */ private Vector _idxGroup = null; /** * Test sequence for patterns with id() or key()-type kernel. */ private TestSeq _idxTestSeq = null; /** * Group for patterns with any other kernel type. */ private Vector[] _patternGroups; /** * Test sequence for patterns with any other kernel type. */ private TestSeq[] _testSeq; /** * A mapping between templates and test sequences. */ private Hashtable _neededTemplates = new Hashtable(); /** * A mapping between named templates and Mode objects. */ private Hashtable _namedTemplates = new Hashtable(); /** * A mapping between templates and instruction handles. */ private Hashtable _templateIHs = new Hashtable(); /** * A mapping between templates and instruction lists. */ private Hashtable _templateILs = new Hashtable(); /** * A reference to the pattern matching the root node. */ private LocationPathPattern _rootPattern = null; /** * Stores ranges of template precendences for the compilation * of apply-imports (a Hashtable for historical reasons). */ private Hashtable _importLevels = null; /** * A mapping between key names and keys. */ private Hashtable _keys = null; /** * Variable index for the current node used in code generation. */ private int _currentIndex; /** * Creates a new Mode. * * @param name A textual representation of the mode's QName * @param stylesheet The Stylesheet in which the mode occured * @param suffix A suffix to append to the method name for this mode * (normally a sequence number - still in a String). */ public Mode(QName name, Stylesheet stylesheet, String suffix) { _name = name; _stylesheet = stylesheet; _methodName = APPLY_TEMPLATES + suffix; _templates = new Vector(); _patternGroups = new Vector[32]; } /** * Returns the name of the method (_not_ function) that will be * compiled for this mode. Normally takes the form 'applyTemplates()' * or * 'applyTemplates2()'. * * @return Method name for this mode */ public String functionName() { return _methodName; } public String functionName(int min, int max) { if (_importLevels == null) { _importLevels = new Hashtable(); } _importLevels.put(new Integer(max), new Integer(min)); return _methodName + '_' + max; } /** * Shortcut to get the class compiled for this mode (will be inlined). */ private String getClassName() { return _stylesheet.getClassName(); } public Stylesheet getStylesheet() { return _stylesheet; } public void addTemplate(Template template) { _templates.addElement(template); } private Vector quicksort(Vector templates, int p, int r) { if (p < r) { final int q = partition(templates, p, r); quicksort(templates, p, q); quicksort(templates, q + 1, r); } return templates; } private int partition(Vector templates, int p, int r) { final Template x = (Template)templates.elementAt(p); int i = p - 1; int j = r + 1; while (true) { while (x.compareTo((Template)templates.elementAt(--j)) > 0); while (x.compareTo((Template)templates.elementAt(++i)) < 0); if (i < j) { templates.set(j, templates.set(i, templates.elementAt(j))); } else { return j; } } } /** * Process all the test patterns in this mode */ public void processPatterns(Hashtable keys) { _keys = keys; /* System.out.println("Before Sort " + _name); for (int i = 0; i < _templates.size(); i++) { System.out.println("name = " + ((Template)_templates.elementAt(i)).getName()); System.out.println("pattern = " + ((Template)_templates.elementAt(i)).getPattern()); System.out.println("priority = " + ((Template)_templates.elementAt(i)).getPriority()); System.out.println("position = " + ((Template)_templates.elementAt(i)).getPosition()); } */ _templates = quicksort(_templates, 0, _templates.size() - 1); /* System.out.println("\n After Sort " + _name); for (int i = 0; i < _templates.size(); i++) { System.out.println("name = " + ((Template)_templates.elementAt(i)).getName()); System.out.println("pattern = " + ((Template)_templates.elementAt(i)).getPattern()); System.out.println("priority = " + ((Template)_templates.elementAt(i)).getPriority()); System.out.println("position = " + ((Template)_templates.elementAt(i)).getPosition()); } */ // Traverse all templates final Enumeration templates = _templates.elements(); while (templates.hasMoreElements()) { // Get the next template final Template template = (Template)templates.nextElement(); /* * Add this template to a table of named templates if it has a name. * If there are multiple templates with the same name, all but one * (the one with highest priority) will be disabled. */ if (template.isNamed() && !template.disabled()) { _namedTemplates.put(template, this); } // Add this template to a test sequence if it has a pattern final Pattern pattern = template.getPattern(); if (pattern != null) { flattenAlternative(pattern, template, keys); } } prepareTestSequences(); } /** * This method will break up alternative patterns (ie. unions of patterns, * such as match="A/B | C/B") and add the basic patterns to their * respective pattern groups. */ private void flattenAlternative(Pattern pattern, Template template, Hashtable keys) { // Patterns on type id() and key() are special since they do not have // any kernel node type (it can be anything as long as the node is in // the id's or key's index). if (pattern instanceof IdKeyPattern) { final IdKeyPattern idkey = (IdKeyPattern)pattern; idkey.setTemplate(template); if (_idxGroup == null) _idxGroup = new Vector(); _idxGroup.add(pattern); } // Alternative patterns are broken up and re-processed recursively else if (pattern instanceof AlternativePattern) { final AlternativePattern alt = (AlternativePattern)pattern; flattenAlternative(alt.getLeft(), template, keys); flattenAlternative(alt.getRight(), template, keys); } // Finally we have a pattern that can be added to a test sequence! else if (pattern instanceof LocationPathPattern) { final LocationPathPattern lpp = (LocationPathPattern)pattern; lpp.setTemplate(template); addPatternToGroup(lpp); } } /** * Group patterns by NodeTests of their last Step * Keep them sorted by priority within group */ private void addPatternToGroup(final LocationPathPattern lpp) { // id() and key()-type patterns do not have a kernel type if (lpp instanceof IdKeyPattern) { addPattern(-1, lpp); } // Otherwise get the kernel pattern from the LPP else { // kernel pattern is the last (maybe only) Step final StepPattern kernel = lpp.getKernelPattern(); if (kernel != null) { addPattern(kernel.getNodeType(), lpp); } else if (_rootPattern == null || lpp.noSmallerThan(_rootPattern)) { _rootPattern = lpp; } } } /** * Adds a pattern to a pattern group */ private void addPattern(int kernelType, LocationPathPattern pattern) { // Make sure the array of pattern groups is long enough final int oldLength = _patternGroups.length; if (kernelType >= oldLength) { Vector[] newGroups = new Vector[kernelType * 2]; System.arraycopy(_patternGroups, 0, newGroups, 0, oldLength); _patternGroups = newGroups; } // Find the vector to put this pattern into Vector patterns; if (kernelType == DOM.NO_TYPE) { if (pattern.getAxis() == Axis.ATTRIBUTE) { patterns = (_attribNodeGroup == null) ? (_attribNodeGroup = new Vector(2)) : _attribNodeGroup; } else { patterns = (_childNodeGroup == null) ? (_childNodeGroup = new Vector(2)) : _childNodeGroup; } } else { patterns = (_patternGroups[kernelType] == null) ? (_patternGroups[kernelType] = new Vector(2)) : _patternGroups[kernelType]; } if (patterns.size() == 0) { patterns.addElement(pattern); } else { boolean inserted = false; for (int i = 0; i < patterns.size(); i++) { final LocationPathPattern lppToCompare = (LocationPathPattern)patterns.elementAt(i); if (pattern.noSmallerThan(lppToCompare)) { inserted = true; patterns.insertElementAt(pattern, i); break; } } if (inserted == false) { patterns.addElement(pattern); } } } /** * Complete test sequences of a given type by adding all patterns * from a given group. */ private void completeTestSequences(int nodeType, Vector patterns) { if (patterns != null) { if (_patternGroups[nodeType] == null) { _patternGroups[nodeType] = patterns; } else { final int m = patterns.size(); for (int j = 0; j < m; j++) { addPattern(nodeType, (LocationPathPattern) patterns.elementAt(j)); } } } } /** * Build test sequences. The first step is to complete the test sequences * by including patterns of "*" and "node()" kernel to all element test * sequences, and of "@*" to all attribute test sequences. */ private void prepareTestSequences() { final Vector starGroup = _patternGroups[DTM.ELEMENT_NODE]; final Vector atStarGroup = _patternGroups[DTM.ATTRIBUTE_NODE]; // Complete test sequence for "text()" with "child::node()" completeTestSequences(DTM.TEXT_NODE, _childNodeGroup); // Complete test sequence for "*" with "child::node()" completeTestSequences(DTM.ELEMENT_NODE, _childNodeGroup); // Complete test sequence for "pi()" with "child::node()" completeTestSequences(DTM.PROCESSING_INSTRUCTION_NODE, _childNodeGroup); // Complete test sequence for "comment()" with "child::node()" completeTestSequences(DTM.COMMENT_NODE, _childNodeGroup); // Complete test sequence for "@*" with "attribute::node()" completeTestSequences(DTM.ATTRIBUTE_NODE, _attribNodeGroup); final Vector names = _stylesheet.getXSLTC().getNamesIndex(); if (starGroup != null || atStarGroup != null || _childNodeGroup != null || _attribNodeGroup != null) { final int n = _patternGroups.length; // Complete test sequence for user-defined types for (int i = DTM.NTYPES; i < n; i++) { if (_patternGroups[i] == null) continue; final String name = (String) names.elementAt(i - DTM.NTYPES); if (isAttributeName(name)) { // If an attribute then copy "@*" to its test sequence completeTestSequences(i, atStarGroup); // And also copy "attribute::node()" to its test sequence completeTestSequences(i, _attribNodeGroup); } else { // If an element then copy "*" to its test sequence completeTestSequences(i, starGroup); // And also copy "child::node()" to its test sequence completeTestSequences(i, _childNodeGroup); } } } _testSeq = new TestSeq[DTM.NTYPES + names.size()]; final int n = _patternGroups.length; for (int i = 0; i < n; i++) { final Vector patterns = _patternGroups[i]; if (patterns != null) { final TestSeq testSeq = new TestSeq(patterns, i, this); // System.out.println("testSeq[" + i + "] = " + testSeq); testSeq.reduce(); _testSeq[i] = testSeq; testSeq.findTemplates(_neededTemplates); } } if (_childNodeGroup != null && _childNodeGroup.size() > 0) { _childNodeTestSeq = new TestSeq(_childNodeGroup, -1, this); _childNodeTestSeq.reduce(); _childNodeTestSeq.findTemplates(_neededTemplates); } /* if (_attribNodeGroup != null && _attribNodeGroup.size() > 0) { _attribNodeTestSeq = new TestSeq(_attribNodeGroup, -1, this); _attribNodeTestSeq.reduce(); _attribNodeTestSeq.findTemplates(_neededTemplates); } */ if (_idxGroup != null && _idxGroup.size() > 0) { _idxTestSeq = new TestSeq(_idxGroup, this); _idxTestSeq.reduce(); _idxTestSeq.findTemplates(_neededTemplates); } if (_rootPattern != null) { // doesn't matter what is 'put', only key matters _neededTemplates.put(_rootPattern.getTemplate(), this); } } private void compileNamedTemplate(Template template, ClassGenerator classGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); String methodName = Util.escape(template.getName().toString()); int numParams = 0; if (template.isSimpleNamedTemplate()) { Vector parameters = template.getParameters(); numParams = parameters.size(); } // Initialize the types and names arrays for the NamedMethodGenerator. org.apache.bcel.generic.Type[] types = new org.apache.bcel.generic.Type[4 + numParams]; String[] names = new String[4 + numParams]; types[0] = Util.getJCRefType(DOM_INTF_SIG); types[1] = Util.getJCRefType(NODE_ITERATOR_SIG); types[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); types[3] = org.apache.bcel.generic.Type.INT; names[0] = DOCUMENT_PNAME; names[1] = ITERATOR_PNAME; names[2] = TRANSLET_OUTPUT_PNAME; names[3] = NODE_PNAME; // For simple named templates, the signature of the generated method // is not fixed. It depends on the number of parameters declared in the // template. for (int i = 4; i < 4 + numParams; i++) { types[i] = Util.getJCRefType(OBJECT_SIG); names[i] = "param" + String.valueOf(i-4); } NamedMethodGenerator methodGen = new NamedMethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, types, names, methodName, getClassName(), il, cpg); il.append(template.compile(classGen, methodGen)); il.append(RETURN); classGen.addMethod(methodGen); } private void compileTemplates(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next) { Enumeration templates = _namedTemplates.keys(); while (templates.hasMoreElements()) { final Template template = (Template)templates.nextElement(); compileNamedTemplate(template, classGen); } templates = _neededTemplates.keys(); while (templates.hasMoreElements()) { final Template template = (Template)templates.nextElement(); if (template.hasContents()) { // !!! TODO templates both named and matched InstructionList til = template.compile(classGen, methodGen); til.append(new GOTO_W(next)); _templateILs.put(template, til); _templateIHs.put(template, til.getStart()); } else { // empty template _templateIHs.put(template, next); } } } private void appendTemplateCode(InstructionList body) { final Enumeration templates = _neededTemplates.keys(); while (templates.hasMoreElements()) { final Object iList = _templateILs.get(templates.nextElement()); if (iList != null) { body.append((InstructionList)iList); } } } private void appendTestSequences(InstructionList body) { final int n = _testSeq.length; for (int i = 0; i < n; i++) { final TestSeq testSeq = _testSeq[i]; if (testSeq != null) { InstructionList il = testSeq.getInstructionList(); if (il != null) body.append(il); // else trivial TestSeq } } } public static void compileGetChildren(ClassGenerator classGen, MethodGenerator methodGen, int node) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int git = cpg.addInterfaceMethodref(DOM_INTF, GET_CHILDREN, GET_CHILDREN_SIG); il.append(methodGen.loadDOM()); il.append(new ILOAD(node)); il.append(new INVOKEINTERFACE(git, 2)); } /** * Compiles the default handling for DOM elements: traverse all children */ private InstructionList compileDefaultRecursion(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final String applyTemplatesSig = classGen.getApplyTemplatesSig(); final int git = cpg.addInterfaceMethodref(DOM_INTF, GET_CHILDREN, GET_CHILDREN_SIG); final int applyTemplates = cpg.addMethodref(getClassName(), functionName(), applyTemplatesSig); il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(git, 2)); il.append(methodGen.loadHandler()); il.append(new INVOKEVIRTUAL(applyTemplates)); il.append(new GOTO_W(next)); return il; } /** * Compiles the default action for DOM text nodes and attribute nodes: * output the node's text value */ private InstructionList compileDefaultText(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final int chars = cpg.addInterfaceMethodref(DOM_INTF, CHARACTERS, CHARACTERS_SIG); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE(chars, 3)); il.append(new GOTO_W(next)); return il; } private InstructionList compileNamespaces(ClassGenerator classGen, MethodGenerator methodGen, boolean[] isNamespace, boolean[] isAttribute, boolean attrFlag, InstructionHandle defaultTarget) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); // Append switch() statement - namespace test dispatch loop final Vector namespaces = xsltc.getNamespaceIndex(); final Vector names = xsltc.getNamesIndex(); final int namespaceCount = namespaces.size() + 1; final int namesCount = names.size(); final InstructionList il = new InstructionList(); final int[] types = new int[namespaceCount]; final InstructionHandle[] targets = new InstructionHandle[types.length]; if (namespaceCount > 0) { boolean compiled = false; // Initialize targets for namespace() switch statement for (int i = 0; i < namespaceCount; i++) { targets[i] = defaultTarget; types[i] = i; } // Add test sequences for known namespace types for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) { if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) { String name = (String)names.elementAt(i-DTM.NTYPES); String namespace = name.substring(0,name.lastIndexOf(':')); final int type = xsltc.registerNamespace(namespace); if ((i < _testSeq.length) && (_testSeq[i] != null)) { targets[type] = (_testSeq[i]).compile(classGen, methodGen, defaultTarget); compiled = true; } } } // Return "null" if no test sequences were compiled if (!compiled) return(null); // Append first code in applyTemplates() - get type of current node final int getNS = cpg.addInterfaceMethodref(DOM_INTF, "getNamespaceType", "(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget)); return(il); } else { return(null); } } /** * Compiles the applyTemplates() method and adds it to the translet. * This is the main dispatch method. */ public void compileApplyTemplates(ClassGenerator classGen) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); final Vector names = xsltc.getNamesIndex(); // Create the applyTemplates() method final org.apache.bcel.generic.Type[] argTypes = new org.apache.bcel.generic.Type[3]; argTypes[0] = Util.getJCRefType(DOM_INTF_SIG); argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG); argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); final String[] argNames = new String[3]; argNames[0] = DOCUMENT_PNAME; argNames[1] = ITERATOR_PNAME; argNames[2] = TRANSLET_OUTPUT_PNAME; final InstructionList mainIL = new InstructionList(); final MethodGenerator methodGen = new MethodGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.VOID, argTypes, argNames, functionName(), getClassName(), mainIL, classGen.getConstantPool()); methodGen.addException("org.apache.xalan.xsltc.TransletException"); // Insert an extra NOP just to keep "current" from appearing as if it // has a value before the start of the loop. mainIL.append(NOP); // Create a local variable to hold the current node final LocalVariableGen current; current = methodGen.addLocalVariable2("current", org.apache.bcel.generic.Type.INT, null); _currentIndex = current.getIndex(); // Create the "body" instruction list that will eventually hold the // code for the entire method (other ILs will be appended). final InstructionList body = new InstructionList(); body.append(NOP); // Create an instruction list that contains the default next-node // iteration final InstructionList ilLoop = new InstructionList(); ilLoop.append(methodGen.loadIterator()); ilLoop.append(methodGen.nextNode()); ilLoop.append(DUP); ilLoop.append(new ISTORE(_currentIndex)); // The body of this code can get very large - large than can be handled // by a single IFNE(body.getStart()) instruction - need workaround: final BranchHandle ifeq = ilLoop.append(new IFLT(null)); final BranchHandle loop = ilLoop.append(new GOTO_W(null)); ifeq.setTarget(ilLoop.append(RETURN)); // applyTemplates() ends here! final InstructionHandle ihLoop = ilLoop.getStart(); current.setStart(mainIL.append(new GOTO_W(ihLoop))); // Live range of "current" ends at end of loop current.setEnd(loop); // Compile default handling of elements (traverse children) InstructionList ilRecurse = compileDefaultRecursion(classGen, methodGen, ihLoop); InstructionHandle ihRecurse = ilRecurse.getStart(); // Compile default handling of text/attribute nodes (output text) InstructionList ilText = compileDefaultText(classGen, methodGen, ihLoop); InstructionHandle ihText = ilText.getStart(); // Distinguish attribute/element/namespace tests for further processing final int[] types = new int[DTM.NTYPES + names.size()]; for (int i = 0; i < types.length; i++) { types[i] = i; } // Initialize isAttribute[] and isNamespace[] arrays final boolean[] isAttribute = new boolean[types.length]; final boolean[] isNamespace = new boolean[types.length]; for (int i = 0; i < names.size(); i++) { final String name = (String)names.elementAt(i); isAttribute[i + DTM.NTYPES] = isAttributeName(name); isNamespace[i + DTM.NTYPES] = isNamespaceName(name); } // Compile all templates - regardless of pattern type compileTemplates(classGen, methodGen, ihLoop); // Handle template with explicit "*" pattern final TestSeq elemTest = _testSeq[DTM.ELEMENT_NODE]; InstructionHandle ihElem = ihRecurse; if (elemTest != null) ihElem = elemTest.compile(classGen, methodGen, ihRecurse); // Handle template with explicit "@*" pattern final TestSeq attrTest = _testSeq[DTM.ATTRIBUTE_NODE]; InstructionHandle ihAttr = ihText; if (attrTest != null) ihAttr = attrTest.compile(classGen, methodGen, ihAttr); // Do tests for id() and key() patterns first InstructionList ilKey = null; if (_idxTestSeq != null) { loop.setTarget(_idxTestSeq.compile(classGen, methodGen, body.getStart())); ilKey = _idxTestSeq.getInstructionList(); } else { loop.setTarget(body.getStart()); } // If there is a match on node() we need to replace ihElem // and ihText if the priority of node() is higher if (_childNodeTestSeq != null) { // Compare priorities of node() and "*" double nodePrio = _childNodeTestSeq.getPriority(); int nodePos = _childNodeTestSeq.getPosition(); double elemPrio = (0 - Double.MAX_VALUE); int elemPos = Integer.MIN_VALUE; if (elemTest != null) { elemPrio = elemTest.getPriority(); elemPos = elemTest.getPosition(); } if (elemPrio == Double.NaN || elemPrio < nodePrio || (elemPrio == nodePrio && elemPos < nodePos)) { ihElem = _childNodeTestSeq.compile(classGen, methodGen, ihLoop); } // Compare priorities of node() and text() final TestSeq textTest = _testSeq[DTM.TEXT_NODE]; double textPrio = (0 - Double.MAX_VALUE); int textPos = Integer.MIN_VALUE; if (textTest != null) { textPrio = textTest.getPriority(); textPos = textTest.getPosition(); } if (textPrio == Double.NaN || textPrio < nodePrio || (textPrio == nodePrio && textPos < nodePos)) { ihText = _childNodeTestSeq.compile(classGen, methodGen, ihLoop); _testSeq[DTM.TEXT_NODE] = _childNodeTestSeq; } } // Handle templates with "ns:*" pattern InstructionHandle elemNamespaceHandle = ihElem; InstructionList nsElem = compileNamespaces(classGen, methodGen, isNamespace, isAttribute, false, ihElem); if (nsElem != null) elemNamespaceHandle = nsElem.getStart(); // Handle templates with "ns:@*" pattern InstructionHandle attrNamespaceHandle = ihAttr; InstructionList nsAttr = compileNamespaces(classGen, methodGen, isNamespace, isAttribute, true, ihAttr); if (nsAttr != null) attrNamespaceHandle = nsAttr.getStart(); // Handle templates with "ns:elem" or "ns:@attr" pattern final InstructionHandle[] targets = new InstructionHandle[types.length]; for (int i = DTM.NTYPES; i < targets.length; i++) { final TestSeq testSeq = _testSeq[i]; // Jump straight to namespace tests ? if (isNamespace[i]) { if (isAttribute[i]) targets[i] = attrNamespaceHandle; else targets[i] = elemNamespaceHandle; } // Test first, then jump to namespace tests else if (testSeq != null) { if (isAttribute[i]) targets[i] = testSeq.compile(classGen, methodGen, attrNamespaceHandle); else targets[i] = testSeq.compile(classGen, methodGen, elemNamespaceHandle); } else { targets[i] = ihLoop; } } // Handle pattern with match on root node - default: traverse children targets[DTM.ROOT_NODE] = _rootPattern != null ? getTemplateInstructionHandle(_rootPattern.getTemplate()) : ihRecurse; // Handle pattern with match on root node - default: traverse children targets[DTM.DOCUMENT_NODE] = _rootPattern != null ? getTemplateInstructionHandle(_rootPattern.getTemplate()) : ihRecurse; // Handle any pattern with match on text nodes - default: output text targets[DTM.TEXT_NODE] = _testSeq[DTM.TEXT_NODE] != null ? _testSeq[DTM.TEXT_NODE].compile(classGen, methodGen, ihText) : ihText; // This DOM-type is not in use - default: process next node targets[DTM.NAMESPACE_NODE] = ihLoop; // Match unknown element in DOM - default: check for namespace match targets[DTM.ELEMENT_NODE] = elemNamespaceHandle; // Match unknown attribute in DOM - default: check for namespace match targets[DTM.ATTRIBUTE_NODE] = attrNamespaceHandle; // Match on processing instruction - default: process next node InstructionHandle ihPI = ihLoop; if (_childNodeTestSeq != null) ihPI = ihElem; if (_testSeq[DTM.PROCESSING_INSTRUCTION_NODE] != null) targets[DTM.PROCESSING_INSTRUCTION_NODE] = _testSeq[DTM.PROCESSING_INSTRUCTION_NODE]. compile(classGen, methodGen, ihPI); else targets[DTM.PROCESSING_INSTRUCTION_NODE] = ihPI; // Match on comments - default: process next node InstructionHandle ihComment = ihLoop; if (_childNodeTestSeq != null) ihComment = ihElem; targets[DTM.COMMENT_NODE] = _testSeq[DTM.COMMENT_NODE] != null ? _testSeq[DTM.COMMENT_NODE].compile(classGen, methodGen, ihComment) : ihComment; // This DOM-type is not in use - default: process next node targets[DTM.CDATA_SECTION_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.DOCUMENT_FRAGMENT_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.DOCUMENT_TYPE_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.ENTITY_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.ENTITY_REFERENCE_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.NOTATION_NODE] = ihLoop; // Now compile test sequences for various match patterns: for (int i = DTM.NTYPES; i < targets.length; i++) { final TestSeq testSeq = _testSeq[i]; // Jump straight to namespace tests ? if ((testSeq == null) || (isNamespace[i])) { if (isAttribute[i]) targets[i] = attrNamespaceHandle; else targets[i] = elemNamespaceHandle; } // Match on node type else { if (isAttribute[i]) targets[i] = testSeq.compile(classGen, methodGen, attrNamespaceHandle); else targets[i] = testSeq.compile(classGen, methodGen, elemNamespaceHandle); } } if (ilKey != null) body.insert(ilKey); // Append first code in applyTemplates() - get type of current node final int getType = cpg.addInterfaceMethodref(DOM_INTF, "getExpandedTypeID", "(I)I"); body.append(methodGen.loadDOM()); body.append(new ILOAD(_currentIndex)); body.append(new INVOKEINTERFACE(getType, 2)); // Append switch() statement - main dispatch loop in applyTemplates() InstructionHandle disp = body.append(new SWITCH(types, targets, ihLoop)); // Append all the "case:" statements appendTestSequences(body); // Append the actual template code appendTemplateCode(body); // Append NS:* node tests (if any) if (nsElem != null) body.append(nsElem); // Append NS:@* node tests (if any) if (nsAttr != null) body.append(nsAttr); // Append default action for element and root nodes body.append(ilRecurse); // Append default action for text and attribute nodes body.append(ilText); // putting together constituent instruction lists mainIL.append(body); // fall through to ilLoop mainIL.append(ilLoop); peepHoleOptimization(methodGen); classGen.addMethod(methodGen); // Compile method(s) for for this mode if (_importLevels != null) { Enumeration levels = _importLevels.keys(); while (levels.hasMoreElements()) { Integer max = (Integer)levels.nextElement(); Integer min = (Integer)_importLevels.get(max); compileApplyImports(classGen, min.intValue(), max.intValue()); } } } private void compileTemplateCalls(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next, int min, int max){ Enumeration templates = _neededTemplates.keys(); while (templates.hasMoreElements()) { final Template template = (Template)templates.nextElement(); final int prec = template.getImportPrecedence(); if ((prec >= min) && (prec < max)) { if (template.hasContents()) { InstructionList til = template.compile(classGen, methodGen); til.append(new GOTO_W(next)); _templateILs.put(template, til); _templateIHs.put(template, til.getStart()); } else { // empty template _templateIHs.put(template, next); } } } } public void compileApplyImports(ClassGenerator classGen, int min, int max) { final XSLTC xsltc = classGen.getParser().getXSLTC(); final ConstantPoolGen cpg = classGen.getConstantPool(); final Vector names = xsltc.getNamesIndex(); // Clear some datastructures _namedTemplates = new Hashtable(); _neededTemplates = new Hashtable(); _templateIHs = new Hashtable(); _templateILs = new Hashtable(); _patternGroups = new Vector[32]; _rootPattern = null; // IMPORTANT: Save orignal & complete set of templates!!!! Vector oldTemplates = _templates; // Gather templates that are within the scope of this import _templates = new Vector(); final Enumeration templates = oldTemplates.elements(); while (templates.hasMoreElements()) { final Template template = (Template)templates.nextElement(); final int prec = template.getImportPrecedence(); if ((prec >= min) && (prec < max)) addTemplate(template); } // Process all patterns from those templates processPatterns(_keys); // Create the applyTemplates() method final org.apache.bcel.generic.Type[] argTypes = new org.apache.bcel.generic.Type[4]; argTypes[0] = Util.getJCRefType(DOM_INTF_SIG); argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG); argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); argTypes[3] = org.apache.bcel.generic.Type.INT; final String[] argNames = new String[4]; argNames[0] = DOCUMENT_PNAME; argNames[1] = ITERATOR_PNAME; argNames[2] = TRANSLET_OUTPUT_PNAME; argNames[3] = NODE_PNAME; final InstructionList mainIL = new InstructionList(); final MethodGenerator methodGen = new MethodGenerator(ACC_PUBLIC | ACC_FINAL, org.apache.bcel.generic.Type.VOID, argTypes, argNames, functionName()+'_'+max, getClassName(), mainIL, classGen.getConstantPool()); methodGen.addException("org.apache.xalan.xsltc.TransletException"); // Create the local variable to hold the current node final LocalVariableGen current; current = methodGen.addLocalVariable2("current", org.apache.bcel.generic.Type.INT, null); _currentIndex = current.getIndex(); mainIL.append(new ILOAD(methodGen.getLocalIndex(NODE_PNAME))); current.setStart(mainIL.append(new ISTORE(_currentIndex))); // Create the "body" instruction list that will eventually hold the // code for the entire method (other ILs will be appended). final InstructionList body = new InstructionList(); body.append(NOP); // Create an instruction list that contains the default next-node // iteration final InstructionList ilLoop = new InstructionList(); ilLoop.append(RETURN); final InstructionHandle ihLoop = ilLoop.getStart(); // Compile default handling of elements (traverse children) InstructionList ilRecurse = compileDefaultRecursion(classGen, methodGen, ihLoop); InstructionHandle ihRecurse = ilRecurse.getStart(); // Compile default handling of text/attribute nodes (output text) InstructionList ilText = compileDefaultText(classGen, methodGen, ihLoop); InstructionHandle ihText = ilText.getStart(); // Distinguish attribute/element/namespace tests for further processing final int[] types = new int[DTM.NTYPES + names.size()]; for (int i = 0; i < types.length; i++) { types[i] = i; } final boolean[] isAttribute = new boolean[types.length]; final boolean[] isNamespace = new boolean[types.length]; for (int i = 0; i < names.size(); i++) { final String name = (String)names.elementAt(i); isAttribute[i+DTM.NTYPES] = isAttributeName(name); isNamespace[i+DTM.NTYPES] = isNamespaceName(name); } // Compile all templates - regardless of pattern type compileTemplateCalls(classGen, methodGen, ihLoop, min, max); // Handle template with explicit "*" pattern final TestSeq elemTest = _testSeq[DTM.ELEMENT_NODE]; InstructionHandle ihElem = ihRecurse; if (elemTest != null) { ihElem = elemTest.compile(classGen, methodGen, ihLoop); } // Handle template with explicit "@*" pattern final TestSeq attrTest = _testSeq[DTM.ATTRIBUTE_NODE]; InstructionHandle ihAttr = ihLoop; if (attrTest != null) { ihAttr = attrTest.compile(classGen, methodGen, ihAttr); } // Do tests for id() and key() patterns first InstructionList ilKey = null; if (_idxTestSeq != null) { ilKey = _idxTestSeq.getInstructionList(); } // If there is a match on node() we need to replace ihElem // and ihText if the priority of node() is higher if (_childNodeTestSeq != null) { // Compare priorities of node() and "*" double nodePrio = _childNodeTestSeq.getPriority(); int nodePos = _childNodeTestSeq.getPosition(); double elemPrio = (0 - Double.MAX_VALUE); int elemPos = Integer.MIN_VALUE; if (elemTest != null) { elemPrio = elemTest.getPriority(); elemPos = elemTest.getPosition(); } if (elemPrio == Double.NaN || elemPrio < nodePrio || (elemPrio == nodePrio && elemPos < nodePos)) { ihElem = _childNodeTestSeq.compile(classGen, methodGen, ihLoop); } // Compare priorities of node() and text() final TestSeq textTest = _testSeq[DTM.TEXT_NODE]; double textPrio = (0 - Double.MAX_VALUE); int textPos = Integer.MIN_VALUE; if (textTest != null) { textPrio = textTest.getPriority(); textPos = textTest.getPosition(); } if (textPrio == Double.NaN || textPrio < nodePrio || (textPrio == nodePrio && textPos < nodePos)) { ihText = _childNodeTestSeq.compile(classGen, methodGen, ihLoop); _testSeq[DTM.TEXT_NODE] = _childNodeTestSeq; } } // Handle templates with "ns:*" pattern InstructionHandle elemNamespaceHandle = ihElem; InstructionList nsElem = compileNamespaces(classGen, methodGen, isNamespace, isAttribute, false, ihElem); if (nsElem != null) elemNamespaceHandle = nsElem.getStart(); // Handle templates with "ns:@*" pattern InstructionList nsAttr = compileNamespaces(classGen, methodGen, isNamespace, isAttribute, true, ihAttr); InstructionHandle attrNamespaceHandle = ihAttr; if (nsAttr != null) attrNamespaceHandle = nsAttr.getStart(); // Handle templates with "ns:elem" or "ns:@attr" pattern final InstructionHandle[] targets = new InstructionHandle[types.length]; for (int i = DTM.NTYPES; i < targets.length; i++) { final TestSeq testSeq = _testSeq[i]; // Jump straight to namespace tests ? if (isNamespace[i]) { if (isAttribute[i]) targets[i] = attrNamespaceHandle; else targets[i] = elemNamespaceHandle; } // Test first, then jump to namespace tests else if (testSeq != null) { if (isAttribute[i]) targets[i] = testSeq.compile(classGen, methodGen, attrNamespaceHandle); else targets[i] = testSeq.compile(classGen, methodGen, elemNamespaceHandle); } else { targets[i] = ihLoop; } } // Handle pattern with match on root node - default: traverse children targets[DTM.ROOT_NODE] = _rootPattern != null ? getTemplateInstructionHandle(_rootPattern.getTemplate()) : ihRecurse; // Handle pattern with match on root node - default: traverse children targets[DTM.DOCUMENT_NODE] = _rootPattern != null ? getTemplateInstructionHandle(_rootPattern.getTemplate()) : ihRecurse; // %HZ%: Was ihLoop in XSLTC_DTM branch // Handle any pattern with match on text nodes - default: loop targets[DTM.TEXT_NODE] = _testSeq[DTM.TEXT_NODE] != null ? _testSeq[DTM.TEXT_NODE].compile(classGen, methodGen, ihText) : ihText; // This DOM-type is not in use - default: process next node targets[DTM.NAMESPACE_NODE] = ihLoop; // Match unknown element in DOM - default: check for namespace match targets[DTM.ELEMENT_NODE] = elemNamespaceHandle; // Match unknown attribute in DOM - default: check for namespace match targets[DTM.ATTRIBUTE_NODE] = attrNamespaceHandle; // Match on processing instruction - default: loop InstructionHandle ihPI = ihLoop; if (_childNodeTestSeq != null) ihPI = ihElem; if (_testSeq[DTM.PROCESSING_INSTRUCTION_NODE] != null) { targets[DTM.PROCESSING_INSTRUCTION_NODE] = _testSeq[DTM.PROCESSING_INSTRUCTION_NODE]. compile(classGen, methodGen, ihPI); } else { targets[DTM.PROCESSING_INSTRUCTION_NODE] = ihPI; } // Match on comments - default: process next node InstructionHandle ihComment = ihLoop; if (_childNodeTestSeq != null) ihComment = ihElem; targets[DTM.COMMENT_NODE] = _testSeq[DTM.COMMENT_NODE] != null ? _testSeq[DTM.COMMENT_NODE].compile(classGen, methodGen, ihComment) : ihComment; // This DOM-type is not in use - default: process next node targets[DTM.CDATA_SECTION_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.DOCUMENT_FRAGMENT_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.DOCUMENT_TYPE_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.ENTITY_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.ENTITY_REFERENCE_NODE] = ihLoop; // This DOM-type is not in use - default: process next node targets[DTM.NOTATION_NODE] = ihLoop; // Now compile test sequences for various match patterns: for (int i = DTM.NTYPES; i < targets.length; i++) { final TestSeq testSeq = _testSeq[i]; // Jump straight to namespace tests ? if ((testSeq == null) || (isNamespace[i])) { if (isAttribute[i]) targets[i] = attrNamespaceHandle; else targets[i] = elemNamespaceHandle; } // Match on node type else { if (isAttribute[i]) targets[i] = testSeq.compile(classGen, methodGen, attrNamespaceHandle); else targets[i] = testSeq.compile(classGen, methodGen, elemNamespaceHandle); } } if (ilKey != null) body.insert(ilKey); // Append first code in applyTemplates() - get type of current node final int getType = cpg.addInterfaceMethodref(DOM_INTF, "getExpandedTypeID", "(I)I"); body.append(methodGen.loadDOM()); body.append(new ILOAD(_currentIndex)); body.append(new INVOKEINTERFACE(getType, 2)); // Append switch() statement - main dispatch loop in applyTemplates() InstructionHandle disp = body.append(new SWITCH(types,targets,ihLoop)); // Append all the "case:" statements appendTestSequences(body); // Append the actual template code appendTemplateCode(body); // Append NS:* node tests (if any) if (nsElem != null) body.append(nsElem); // Append NS:@* node tests (if any) if (nsAttr != null) body.append(nsAttr); // Append default action for element and root nodes body.append(ilRecurse); // Append default action for text and attribute nodes body.append(ilText); // putting together constituent instruction lists mainIL.append(body); // Mark the end of the live range for the "current" variable current.setEnd(body.getEnd()); // fall through to ilLoop mainIL.append(ilLoop); peepHoleOptimization(methodGen); classGen.addMethod(methodGen); // Restore original (complete) set of templates for this transformation _templates = oldTemplates; } /** * Peephole optimization. */ private void peepHoleOptimization(MethodGenerator methodGen) { InstructionList il = methodGen.getInstructionList(); InstructionFinder find = new InstructionFinder(il); InstructionHandle ih; String pattern; // LoadInstruction, POP => (removed) pattern = "LoadInstruction POP"; for (Iterator iter = find.search(pattern); iter.hasNext();) { InstructionHandle[] match = (InstructionHandle[]) iter.next(); try { if (!match[0].hasTargeters() && !match[1].hasTargeters()) { il.delete(match[0], match[1]); } } catch (TargetLostException e) { // TODO: move target down into the list } } // ILOAD_N, ILOAD_N, SWAP, ISTORE_N => ILOAD_N pattern = "ILOAD ILOAD SWAP ISTORE"; for (Iterator iter = find.search(pattern); iter.hasNext();) { InstructionHandle[] match = (InstructionHandle[]) iter.next(); try { org.apache.bcel.generic.ILOAD iload1 = (org.apache.bcel.generic.ILOAD) match[0].getInstruction(); org.apache.bcel.generic.ILOAD iload2 = (org.apache.bcel.generic.ILOAD) match[1].getInstruction(); org.apache.bcel.generic.ISTORE istore = (org.apache.bcel.generic.ISTORE) match[3].getInstruction(); if (!match[1].hasTargeters() && !match[2].hasTargeters() && !match[3].hasTargeters() && iload1.getIndex() == iload2.getIndex() && iload2.getIndex() == istore.getIndex()) { il.delete(match[1], match[3]); } } catch (TargetLostException e) { // TODO: move target down into the list } } // LoadInstruction_N, LoadInstruction_M, SWAP => LoadInstruction_M, LoadInstruction_N pattern = "LoadInstruction LoadInstruction SWAP"; for (Iterator iter = find.search(pattern); iter.hasNext();) { InstructionHandle[] match = (InstructionHandle[])iter.next(); try { if (!match[0].hasTargeters() && !match[1].hasTargeters() && !match[2].hasTargeters()) { Instruction load_m = match[1].getInstruction(); il.insert(match[0], load_m); il.delete(match[1], match[2]); } } catch (TargetLostException e) { // TODO: move target down into the list } } // ALOAD_N ALOAD_N => ALOAD_N DUP pattern = "ALOAD ALOAD"; for (Iterator iter = find.search(pattern); iter.hasNext();) { InstructionHandle[] match = (InstructionHandle[])iter.next(); try { if (!match[1].hasTargeters()) { org.apache.bcel.generic.ALOAD aload1 = (org.apache.bcel.generic.ALOAD) match[0].getInstruction(); org.apache.bcel.generic.ALOAD aload2 = (org.apache.bcel.generic.ALOAD) match[1].getInstruction(); if (aload1.getIndex() == aload2.getIndex()) { il.insert(match[1], new DUP()); il.delete(match[1]); } } } catch (TargetLostException e) { // TODO: move target down into the list } } } public InstructionHandle getTemplateInstructionHandle(Template template) { return (InstructionHandle)_templateIHs.get(template); } /** * Auxiliary method to determine if a qname is an attribute. */ private static boolean isAttributeName(String qname) { final int col = qname.lastIndexOf(':') + 1; return (qname.charAt(col) == '@'); } /** * Auxiliary method to determine if a qname is a namespace * qualified "*". */ private static boolean isNamespaceName(String qname) { final int col = qname.lastIndexOf(':'); return (col > -1 && qname.charAt(qname.length()-1) == '*'); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ObjectFactory.java0000644000175000017500000006377110721374032025567 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468650 2006-10-28 07:03:30Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 3326843611085065902L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/AlternativePattern.java0000644000175000017500000000576710721374032026646 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AlternativePattern.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.GOTO; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class AlternativePattern extends Pattern { private final Pattern _left; private final Pattern _right; /** * Construct an alternative pattern. The method setParent * should not be called in this case. */ public AlternativePattern(Pattern left, Pattern right) { _left = left; _right = right; } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); _right.setParser(parser); } public Pattern getLeft() { return _left; } public Pattern getRight() { return _right; } /** * The type of an '|' is not really defined, hence null is returned. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { _left.typeCheck(stable); _right.typeCheck(stable); return null; } public double getPriority() { double left = _left.getPriority(); double right = _right.getPriority(); if (left < right) return(left); else return(right); } public String toString() { return "alternative(" + _left + ", " + _right + ')'; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); _left.translate(classGen, methodGen); final InstructionHandle gotot = il.append(new GOTO(null)); il.append(methodGen.loadContextNode()); _right.translate(classGen, methodGen); _left._trueList.backPatch(gotot); _left._falseList.backPatch(gotot.getNext()); _trueList.append(_right._trueList.add(gotot)); _falseList.append(_right._falseList); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/UnsupportedElement.java0000644000175000017500000001217710721374031026664 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnsupportedElement.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUSH; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; /** * @author Morten Jorgensen */ final class UnsupportedElement extends SyntaxTreeNode { private Vector _fallbacks = null; private ErrorMsg _message = null; private boolean _isExtension = false; /** * Basic consutrcor - stores element uri/prefix/localname */ public UnsupportedElement(String uri, String prefix, String local, boolean isExtension) { super(uri, prefix, local); _isExtension = isExtension; } /** * There are different categories of unsupported elements (believe it * or not): there are elements within the XSLT namespace (these would * be elements that are not yet implemented), there are extensions of * other XSLT processors and there are unrecognised extension elements * of this XSLT processor. The error message passed to this method * should describe the unsupported element itself and what category * the element belongs in. */ public void setErrorMessage(ErrorMsg message) { _message = message; } /** * Displays the contents of this element */ public void display(int indent) { indent(indent); Util.println("Unsupported element = " + _qname.getNamespace() + ":" + _qname.getLocalPart()); displayContents(indent + IndentIncrement); } /** * Scan and process all fallback children of the unsupported element. */ private void processFallbacks(Parser parser) { Vector children = getContents(); if (children != null) { final int count = children.size(); for (int i = 0; i < count; i++) { SyntaxTreeNode child = (SyntaxTreeNode)children.elementAt(i); if (child instanceof Fallback) { Fallback fallback = (Fallback)child; fallback.activate(); fallback.parseContents(parser); if (_fallbacks == null) { _fallbacks = new Vector(); } _fallbacks.addElement(child); } } } } /** * Find any fallback in the descendant nodes; then activate & parse it */ public void parseContents(Parser parser) { processFallbacks(parser); } /** * Run type check on the fallback element (if any). */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_fallbacks != null) { int count = _fallbacks.size(); for (int i = 0; i < count; i++) { Fallback fallback = (Fallback)_fallbacks.elementAt(i); fallback.typeCheck(stable); } } return Type.Void; } /** * Translate the fallback element (if any). */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (_fallbacks != null) { int count = _fallbacks.size(); for (int i = 0; i < count; i++) { Fallback fallback = (Fallback)_fallbacks.elementAt(i); fallback.translate(classGen, methodGen); } } // We only go into the else block in forward-compatibility mode, when // the unsupported element has no fallback. else { // If the unsupported element does not have any fallback child, then // at runtime, a runtime error should be raised when the unsupported // element is instantiated. Otherwise, no error is thrown. ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF", "(" + STRING_SIG + "Z)V"); il.append(new PUSH(cpg, getQName().toString())); il.append(new PUSH(cpg, _isExtension)); il.append(new INVOKESTATIC(unsupportedElem)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/UnresolvedRef.java0000644000175000017500000000617210721374032025604 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnresolvedRef.java 476471 2006-11-18 08:36:27Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; /** * @author Morten Jorgensen */ final class UnresolvedRef extends VariableRefBase { private QName _variableName = null; private VariableRefBase _ref = null; public UnresolvedRef(QName name) { super(); _variableName = name; } public QName getName() { return(_variableName); } private ErrorMsg reportError() { ErrorMsg err = new ErrorMsg(ErrorMsg.VARIABLE_UNDEF_ERR, _variableName, this); getParser().reportError(Constants.ERROR, err); return(err); } private VariableRefBase resolve(Parser parser, SymbolTable stable) { // At this point the AST is already built and we should be able to // find any declared global variable or parameter VariableBase ref = parser.lookupVariable(_variableName); if (ref == null) { ref = (VariableBase)stable.lookupName(_variableName); } if (ref == null) { reportError(); return null; } // If in a top-level element, create dependency to the referenced var _variable = ref; addParentDependency(); if (ref instanceof Variable) { return new VariableRef((Variable) ref); } else if (ref instanceof Param) { return new ParameterRef((Param)ref); } return null; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_ref != null) { final String name = _variableName.toString(); ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR, name, this); } if ((_ref = resolve(getParser(), stable)) != null) { return (_type = _ref.typeCheck(stable)); } throw new TypeCheckError(reportError()); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (_ref != null) _ref.translate(classGen, methodGen); else reportError(); } public String toString() { return "unresolved-ref()"; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/CurrentCall.java0000644000175000017500000000260610721374030025233 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CurrentCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class CurrentCall extends FunctionCall { public CurrentCall(QName fname) { super(fname); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { methodGen.getInstructionList().append(methodGen.loadCurrentNode()); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/Variable.java0000644000175000017500000001604110721374032024542 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Variable.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.classfile.Field; import org.apache.bcel.generic.ACONST_NULL; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.DCONST; import org.apache.bcel.generic.ICONST; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; import org.apache.bcel.generic.PUTFIELD; import org.apache.xalan.xsltc.compiler.util.BooleanType; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.compiler.util.IntType; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.NodeType; import org.apache.xalan.xsltc.compiler.util.RealType; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; final class Variable extends VariableBase { public int getIndex() { return (_local != null) ? _local.getIndex() : -1; } /** * Parse the contents of the variable */ public void parseContents(Parser parser) { // Parse 'name' and 'select' attributes plus parameter contents super.parseContents(parser); // Add a ref to this var to its enclosing construct SyntaxTreeNode parent = getParent(); if (parent instanceof Stylesheet) { // Mark this as a global variable _isLocal = false; // Check if a global variable with this name already exists... Variable var = parser.getSymbolTable().lookupVariable(_name); // ...and if it does we need to check import precedence if (var != null) { final int us = this.getImportPrecedence(); final int them = var.getImportPrecedence(); // It is an error if the two have the same import precedence if (us == them) { final String name = _name.toString(); reportError(this, parser, ErrorMsg.VARIABLE_REDEF_ERR,name); } // Ignore this if previous definition has higher precedence else if (them > us) { _ignore = true; return; } else { var.disable(); } // Add this variable if we have higher precedence } ((Stylesheet)parent).addVariable(this); parser.getSymbolTable().addVariable(this); } else { _isLocal = true; } } /** * Runs a type check on either the variable element body or the * expression in the 'select' attribute */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Type check the 'select' expression if present if (_select != null) { _type = _select.typeCheck(stable); } // Type check the element contents otherwise else if (hasContents()) { typeCheckContents(stable); _type = Type.ResultTree; } else { _type = Type.Reference; } // The return type is void as the variable element does not leave // anything on the JVM's stack. The '_type' global will be returned // by the references to this variable, and not by the variable itself. return Type.Void; } /** * This method is part of a little trick that is needed to use local * variables inside nested for-each loops. See the initializeVariables() * method in the ForEach class for an explanation */ public void initialize(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // This is only done for local variables that are actually used if (isLocal() && !_refs.isEmpty()) { // Create a variable slot if none is allocated if (_local == null) { _local = methodGen.addLocalVariable2(getEscapedName(), _type.toJCType(), null); } // Push the default value on the JVM's stack if ((_type instanceof IntType) || (_type instanceof NodeType) || (_type instanceof BooleanType)) il.append(new ICONST(0)); // 0 for node-id, integer and boolean else if (_type instanceof RealType) il.append(new DCONST(0)); // 0.0 for floating point numbers else il.append(new ACONST_NULL()); // and 'null' for anything else // Mark the store as the start of the live range of the variable _local.setStart(il.append(_type.STORE(_local.getIndex()))); } } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Don't generate code for unreferenced variables if (_refs.isEmpty()) { _ignore = true; } // Make sure that a variable instance is only compiled once if (_ignore) return; _ignore = true; final String name = getEscapedName(); if (isLocal()) { // Compile variable value computation translateValue(classGen, methodGen); // Add a new local variable and store value boolean createLocal = _local == null; if (createLocal) { mapRegister(methodGen); } InstructionHandle storeInst = il.append(_type.STORE(_local.getIndex())); // If the local is just being created, mark the store as the start // of its live range. Note that it might have been created by // initializeVariables already, which would have set the start of // the live range already. if (createLocal) { _local.setStart(storeInst); } } else { String signature = _type.toSignature(); // Global variables are store in class fields if (classGen.containsField(name) == null) { classGen.addField(new Field(ACC_PUBLIC, cpg.addUtf8(name), cpg.addUtf8(signature), null, cpg.getConstantPool())); // Push a reference to "this" for putfield il.append(classGen.loadTranslet()); // Compile variable value computation translateValue(classGen, methodGen); // Store the variable in the allocated field il.append(new PUTFIELD(cpg.addFieldref(classGen.getClassName(), name, signature))); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ApplyImports.java0000644000175000017500000001341210721374032025457 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ApplyImports.java 469276 2006-10-30 21:09:47Z minchau $ */ package org.apache.xalan.xsltc.compiler; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKEVIRTUAL; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; import org.apache.xalan.xsltc.compiler.util.Type; import org.apache.xalan.xsltc.compiler.util.TypeCheckError; import org.apache.xalan.xsltc.compiler.util.Util; final class ApplyImports extends Instruction { private QName _modeName; private int _precedence; public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } } /** * Returns true if this element has parameters */ public boolean hasWithParams() { return hasContents(); } /** * Determine the lowest import precedence for any stylesheet imported * or included by the stylesheet in which this * element occured. The templates that are imported by the stylesheet in * which this element occured will all have higher import precedence than * the integer returned by this method. */ private int getMinPrecedence(int max) { // Move to root of include tree Stylesheet includeRoot = getStylesheet(); while (includeRoot._includedFrom != null) { includeRoot = includeRoot._includedFrom; } return includeRoot.getMinimumDescendantPrecedence(); } /** * Parse the attributes and contents of an element. */ public void parseContents(Parser parser) { // Indicate to the top-level stylesheet that all templates must be // compiled into separate methods. Stylesheet stylesheet = getStylesheet(); stylesheet.setTemplateInlining(false); // Get the mode we are currently in (might not be any) Template template = getTemplate(); _modeName = template.getModeName(); _precedence = template.getImportPrecedence(); parseChildren(parser); // with-params } /** * Type-check the attributes/contents of an element. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { typeCheckContents(stable); // with-params return Type.Void; } /** * Translate call-template. A parameter frame is pushed only if * some template in the stylesheet uses parameters. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final Stylesheet stylesheet = classGen.getStylesheet(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int current = methodGen.getLocalIndex("current"); // Push the arguments that are passed to applyTemplates() il.append(classGen.loadTranslet()); il.append(methodGen.loadDOM()); il.append(methodGen.loadIterator()); il.append(methodGen.loadHandler()); il.append(methodGen.loadCurrentNode()); // Push a new parameter frame in case imported template might expect // parameters. The apply-imports has nothing that it can pass. if (stylesheet.hasLocalParams()) { il.append(classGen.loadTranslet()); final int pushFrame = cpg.addMethodref(TRANSLET_CLASS, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG); il.append(new INVOKEVIRTUAL(pushFrame)); } // Get the [min,max> precedence of all templates imported under the // current stylesheet final int maxPrecedence = _precedence; final int minPrecedence = getMinPrecedence(maxPrecedence); final Mode mode = stylesheet.getMode(_modeName); // Get name of appropriate apply-templates function for this // xsl:apply-imports instruction String functionName = mode.functionName(minPrecedence, maxPrecedence); // Construct the translet class-name and the signature of the method final String className = classGen.getStylesheet().getClassName(); final String signature = classGen.getApplyTemplatesSigForImport(); final int applyTemplates = cpg.addMethodref(className, functionName, signature); il.append(new INVOKEVIRTUAL(applyTemplates)); // Pop any parameter frame that was pushed above. if (stylesheet.hasLocalParams()) { il.append(classGen.loadTranslet()); final int pushFrame = cpg.addMethodref(TRANSLET_CLASS, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG); il.append(new INVOKEVIRTUAL(pushFrame)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/GenerateIdCall.java0000644000175000017500000000370510721374030025621 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: GenerateIdCall.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; import java.util.Vector; import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.INVOKESTATIC; import org.apache.bcel.generic.InstructionList; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.MethodGenerator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class GenerateIdCall extends FunctionCall { public GenerateIdCall(QName fname, Vector arguments) { super(fname, arguments); } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } else { // one argument argument().translate(classGen, methodGen); } final ConstantPoolGen cpg = classGen.getConstantPool(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "generate_idF", // reuse signature GET_NODE_NAME_SIG))); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/compiler/ArgumentList.java0000644000175000017500000000253010721374030025427 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ArgumentList.java 468650 2006-10-28 07:03:30Z minchau $ */ package org.apache.xalan.xsltc.compiler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class ArgumentList { private final Expression _arg; private final ArgumentList _rest; public ArgumentList(Expression arg, ArgumentList rest) { _arg = arg; _rest = rest; } public String toString() { return _rest == null ? _arg.toString() : _arg.toString() + ", " + _rest.toString(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/NodeIterator.java0000644000175000017500000000441010721374030023575 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeIterator.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; import org.apache.xml.dtm.DTM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface NodeIterator extends Cloneable { public static final int END = DTM.NULL; /** * Callers should not call next() after it returns END. */ public int next(); /** * Resets the iterator to the last start node. */ public NodeIterator reset(); /** * Returns the number of elements in this iterator. */ public int getLast(); /** * Returns the position of the current node in the set. */ public int getPosition(); /** * Remembers the current node for the next call to gotoMark(). */ public void setMark(); /** * Restores the current node remembered by setMark(). */ public void gotoMark(); /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. */ public NodeIterator setStartNode(int node); /** * True if this iterator has a reversed axis. */ public boolean isReverse(); /** * Returns a deep copy of this iterator. */ public NodeIterator cloneIterator(); /** * Prevents or allows iterator restarts. */ public void setRestartable(boolean isRestartable); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/0000755000175000017500000000000010736146354022033 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/MessageHandler.java0000644000175000017500000000210710721374032025546 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MessageHandler.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; /** * @author Morten Jorgensen */ public class MessageHandler { public void displayMessage(String msg) { System.err.println(msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/SecuritySupport.java0000644000175000017500000000746010721374033026100 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_es.java0000644000175000017500000003026010721374031026134 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_es.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_es extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Error interno de ejecuci\u00f3n en ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Error de ejecuci\u00f3n al ejecutar ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Conversi\u00f3n no v\u00e1lida de ''{0}'' a ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Funci\u00f3n externa ''{0}'' no soportada por XSLTC."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Tipo de argumento desconocido en expresi\u00f3n de igualdad."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Tipo de argumento ''{0}'' no v\u00e1lido en la llamada a ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Se intenta dar formato al n\u00famero ''{0}'' con el patr\u00f3n ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "No se puede replicar el iterador ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iterador para el eje ''{0}'' no soportado."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iterador para el eje escrito ''{0}'' no soportado."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Atributo ''{0}'' fuera del elemento."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Declaraci\u00f3n del espacio de nombres ''{0}''=''{1}'' fuera del elemento."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "No se ha declarado el espacio de nombres para el prefijo ''{0}''."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter creado mediante un tipo incorrecto de DOM origen."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "El analizador SAX utilizado no maneja sucesos de declaraci\u00f3n DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "El analizador SAX utilizado no tiene soporte de espacios de nombres XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "No se ha podido resolver la referencia de URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Elemento XSL ''{0}'' no soportado."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Extensi\u00f3n XSLTC ''{0}'' no reconocida."}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "El translet especificado, ''{0}'', se ha creado utilizando una versi\u00f3n de XSLTC m\u00e1s reciente que la versi\u00f3n de ejecuci\u00f3n de XSLTC que est\u00e1 en uso. Debe recompilar la hoja de estilos o utilizar una versi\u00f3n m\u00e1s reciente de XSLTC para ejecutar este translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Un atributo cuyo valor debe ser un QName tiene el valor ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Un atributo cuyo valor debe ser un NCName tiene el valor ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "No se permite el uso de la funci\u00f3n de extensi\u00f3n ''{0}'' cuando la caracter\u00edstica de proceso seguro est\u00e1 establecida en true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "No se permite el uso del elemento de extensi\u00f3n ''{0}'' cuando la caracter\u00edstica de proceso seguro est\u00e1 establecida en true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_pl.java0000644000175000017500000003064510721374030026146 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_pl.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_pl extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "B\u0142\u0105d wewn\u0119trzny czasu wykonywania w klasie ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "B\u0142\u0105d czasu wykonywania podczas wykonywania ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Niepoprawna konwersja z ''{0}'' na ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Funkcja zewn\u0119trzna ''{0}'' jest nieobs\u0142ugiwana przez XSLTC."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Nieznany typ argumentu w wyra\u017ceniu r\u00f3wno\u015bci."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Niepoprawny typ argumentu ''{0}'' w wywo\u0142aniu funkcji ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Pr\u00f3ba sformatowania liczby ''{0}'' za pomoc\u0105 wzorca ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Nie mo\u017cna utworzy\u0107 kopii iteratora ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iterator dla osi ''{0}'' jest nieobs\u0142ugiwany."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iterator dla osi ''{0}'' okre\u015blonego typu jest nieobs\u0142ugiwany."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Atrybut ''{0}'' znajduje si\u0119 poza elementem."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Deklaracja przestrzeni nazw ''{0}''=''{1}'' znajduje si\u0119 poza elementem."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "Nie zadeklarowano przestrzeni nazw dla przedrostka ''{0}''."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "Utworzono DOMAdapter za pomoc\u0105 \u017ar\u00f3d\u0142owego DOM o b\u0142\u0119dnym typie."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "U\u017cywany analizator sk\u0142adni SAX nie obs\u0142uguje zdarze\u0144 deklaracji DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "U\u017cywany analizator sk\u0142adni SAX nie obs\u0142uguje przestrzeni nazw XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Nie mo\u017cna rozstrzygn\u0105\u0107 odwo\u0142ania do identyfikatora URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Nieobs\u0142ugiwany element XSL ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Nierozpoznane rozszerzenie XSLTC ''{0}''."}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "Podany translet ''{0}'' zosta\u0142 utworzony za pomoc\u0105 wersji XSLTC, kt\u00f3ra jest nowsza od u\u017cywanego obecnie modu\u0142u wykonawczego XSLTC. Trzeba zrekompilowa\u0107 arkusz styl\u00f3w lub uruchomi\u0107 ten translet za pomoc\u0105 nowszej wersji XSLTC."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Atrybut, kt\u00f3rego warto\u015bci\u0105 musi by\u0107 nazwa QName, mia\u0142 warto\u015b\u0107 ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Atrybut, kt\u00f3rego warto\u015bci\u0105 musi by\u0107 nazwa NCName, mia\u0142 warto\u015b\u0107 ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "U\u017cycie funkcji rozszerzenia ''{0}'' jest niedozwolone, gdy opcja przetwarzania bezpiecznego jest ustawiona na warto\u015b\u0107 true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "U\u017cycie elementu rozszerzenia ''{0}'' jest niedozwolone, gdy opcja przetwarzania bezpiecznego jest ustawiona na warto\u015b\u0107 true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_de.java0000644000175000017500000003051210721374031026115 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_de.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_de extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Interner Fehler bei der Ausf\u00fchrung in ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Fehler bei der Ausf\u00fchrung von ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Ung\u00fcltige Konvertierung von ''{0}'' in ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Die externe Funktion ''{0}'' wird nicht von XSLTC unterst\u00fctzt."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Unbekannter Argumenttyp in Gleichheitsausdruck."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Ung\u00fcltiger Argumenttyp ''{0}'' in Aufruf von ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Es wird versucht, Nummer ''{0}'' mit Muster ''{1}'' zu formatieren."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Iterator ''{0}'' kann nicht geklont werden."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iterator f\u00fcr Achse ''{0}'' wird nicht unterst\u00fctzt."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iterator f\u00fcr Achse ''{0}'' mit Typangabe wird nicht unterst\u00fctzt."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Attribut ''{0}'' befindet sich nicht in einem Element."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Namensbereichdeklaration ''{0}''=''{1}'' befindet sich nicht in einem Element."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "Der Namensbereich f\u00fcr Pr\u00e4fix ''{0}'' wurde nicht deklariert."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter wurde mit dem falschen Typ f\u00fcr das Dokumentobjektmodell der Quelle erstellt."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "Der von Ihnen verwendete SAX-Parser bearbeitet keine DTD-Deklarationsereignisse."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "Der von Ihnen verwendete SAX-Parser unterst\u00fctzt keine XML-Namensbereiche."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Der URI-Verweis ''{0}'' konnte nicht aufgel\u00f6st werden."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Nicht unterst\u00fctztes XSL-Element ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Nicht erkannte XSLTC-Erweiterung ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "Das angegebene Translet ''{0}'' wurde mit einer neueren XSLTC-Version erstellt als die verwendete Version der XSLTC-Laufzeitsoftware. Sie m\u00fcssen die Formatvorlage erneut kompilieren oder eine neuere XSLTC-Version zum Ausf\u00fchren dieses Translets verwenden."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Ein Attribut, dessen Wert ein QName sein muss, hatte den Wert ''{0}''."}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Ein Attribut, dessen Wert ein NCName sein muss, hatte den Wert ''{0}''."}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "Die Verwendung der Erweiterungsfunktion ''{0}'' ist nicht zul\u00e4ssig, wenn f\u00fcr die Funktion zur sicheren Verarbeitung der Wert ''true'' festgelegt wurde."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "Die Verwendung des Erweiterungselements ''{0}'' ist nicht zul\u00e4ssig, wenn f\u00fcr die Funktion zur sicheren Verarbeitung der Wert ''true'' festgelegt wurde."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/AttributeList.java0000644000175000017500000001330610721374031025465 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AttributeList.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.Vector; /** * @author Morten Jorgensen */ public class AttributeList implements org.xml.sax.Attributes { private final static String EMPTYSTRING = ""; private final static String CDATASTRING = "CDATA"; private Hashtable _attributes; private Vector _names; private Vector _qnames; private Vector _values; private Vector _uris; private int _length; /** * AttributeList constructor */ public AttributeList() { /* _attributes = new Hashtable(); _names = new Vector(); _values = new Vector(); _qnames = new Vector(); _uris = new Vector(); */ _length = 0; } /** * Attributes clone constructor */ public AttributeList(org.xml.sax.Attributes attributes) { this(); if (attributes != null) { final int count = attributes.getLength(); for (int i = 0; i < count; i++) { add(attributes.getQName(i),attributes.getValue(i)); } } } /** * Allocate memory for the AttributeList * %OPT% Use on-demand allocation for the internal vectors. The memory * is only allocated when there is an attribute. This reduces the cost * of creating many small RTFs. */ private void alloc() { _attributes = new Hashtable(); _names = new Vector(); _values = new Vector(); _qnames = new Vector(); _uris = new Vector(); } /** * SAX2: Return the number of attributes in the list. */ public int getLength() { return(_length); } /** * SAX2: Look up an attribute's Namespace URI by index. */ public String getURI(int index) { if (index < _length) return((String)_uris.elementAt(index)); else return(null); } /** * SAX2: Look up an attribute's local name by index. */ public String getLocalName(int index) { if (index < _length) return((String)_names.elementAt(index)); else return(null); } /** * Return the name of an attribute in this list (by position). */ public String getQName(int pos) { if (pos < _length) return((String)_qnames.elementAt(pos)); else return(null); } /** * SAX2: Look up an attribute's type by index. */ public String getType(int index) { return(CDATASTRING); } /** * SAX2: Look up the index of an attribute by Namespace name. */ public int getIndex(String namespaceURI, String localPart) { return(-1); } /** * SAX2: Look up the index of an attribute by XML 1.0 qualified name. */ public int getIndex(String qname) { return(-1); } /** * SAX2: Look up an attribute's type by Namespace name. */ public String getType(String uri, String localName) { return(CDATASTRING); } /** * SAX2: Look up an attribute's type by qname. */ public String getType(String qname) { return(CDATASTRING); } /** * SAX2: Look up an attribute's value by index. */ public String getValue(int pos) { if (pos < _length) return((String)_values.elementAt(pos)); else return(null); } /** * SAX2: Look up an attribute's value by qname. */ public String getValue(String qname) { if (_attributes != null) { final Integer obj = (Integer)_attributes.get(qname); if (obj == null) return null; return(getValue(obj.intValue())); } else return null; } /** * SAX2: Look up an attribute's value by Namespace name - SLOW! */ public String getValue(String uri, String localName) { return(getValue(uri+':'+localName)); } /** * Adds an attribute to the list */ public void add(String qname, String value) { // Initialize the internal vectors at the first usage. if (_attributes == null) alloc(); // Stuff the QName into the names vector & hashtable Integer obj = (Integer)_attributes.get(qname); if (obj == null) { _attributes.put(qname, obj = new Integer(_length++)); _qnames.addElement(qname); _values.addElement(value); int col = qname.lastIndexOf(':'); if (col > -1) { _uris.addElement(qname.substring(0,col)); _names.addElement(qname.substring(col+1)); } else { _uris.addElement(EMPTYSTRING); _names.addElement(qname); } } else { final int index = obj.intValue(); _values.set(index, value); } } /** * Clears the attribute list */ public void clear() { _length = 0; if (_attributes != null) { _attributes.clear(); _names.removeAllElements(); _values.removeAllElements(); _qnames.removeAllElements(); _uris.removeAllElements(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/Operators.java0000644000175000017500000000342210721374033024644 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Operators.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class Operators { public static final int EQ = 0; public static final int NE = 1; public static final int GT = 2; public static final int LT = 3; public static final int GE = 4; public static final int LE = 5; private static final String[] names = { "=", "!=", ">", "<", ">=", "<=" }; public static final String getOpNames(int operator) { return names[operator]; } // Swap operator array private static final int[] swapOpArray = { EQ, // EQ NE, // NE LT, // GT GT, // LT LE, // GE GE // LE }; public static final int swapOp(int operator) { return swapOpArray[operator]; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/output/0000755000175000017500000000000010736146354023373 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/output/TransletOutputHandlerFactory.java0000644000175000017500000001260110721374031032066 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransletOutputHandlerFactory.java 475979 2006-11-16 23:32:48Z minchau $ */ package org.apache.xalan.xsltc.runtime.output; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import javax.xml.parsers.ParserConfigurationException; import org.apache.xalan.xsltc.trax.SAX2DOM; import org.apache.xml.serializer.ToHTMLStream; import org.apache.xml.serializer.ToTextStream; import org.apache.xml.serializer.ToUnknownStream; import org.apache.xml.serializer.ToXMLSAXHandler; import org.apache.xml.serializer.ToXMLStream; import org.apache.xml.serializer.SerializationHandler; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.ext.LexicalHandler; /** * @author Santiago Pericas-Geertsen */ public class TransletOutputHandlerFactory { public static final int STREAM = 0; public static final int SAX = 1; public static final int DOM = 2; private String _encoding = "utf-8"; private String _method = null; private int _outputType = STREAM; private OutputStream _ostream = System.out; private Writer _writer = null; private Node _node = null; private Node _nextSibling = null; private int _indentNumber = -1; private ContentHandler _handler = null; private LexicalHandler _lexHandler = null; static public TransletOutputHandlerFactory newInstance() { return new TransletOutputHandlerFactory(); } public void setOutputType(int outputType) { _outputType = outputType; } public void setEncoding(String encoding) { if (encoding != null) { _encoding = encoding; } } public void setOutputMethod(String method) { _method = method; } public void setOutputStream(OutputStream ostream) { _ostream = ostream; } public void setWriter(Writer writer) { _writer = writer; } public void setHandler(ContentHandler handler) { _handler = handler; } public void setLexicalHandler(LexicalHandler lex) { _lexHandler = lex; } public void setNode(Node node) { _node = node; } public Node getNode() { return (_handler instanceof SAX2DOM) ? ((SAX2DOM)_handler).getDOM() : null; } public void setNextSibling(Node nextSibling) { _nextSibling = nextSibling; } public void setIndentNumber(int value) { _indentNumber = value; } public SerializationHandler getSerializationHandler() throws IOException, ParserConfigurationException { SerializationHandler result = null; switch (_outputType) { case STREAM : if (_method == null) { result = new ToUnknownStream(); } else if (_method.equalsIgnoreCase("xml")) { result = new ToXMLStream(); } else if (_method.equalsIgnoreCase("html")) { result = new ToHTMLStream(); } else if (_method.equalsIgnoreCase("text")) { result = new ToTextStream(); } if (result != null && _indentNumber >= 0) { result.setIndentAmount(_indentNumber); } result.setEncoding(_encoding); if (_writer != null) { result.setWriter(_writer); } else { result.setOutputStream(_ostream); } return result; case DOM : _handler = (_node != null) ? new SAX2DOM(_node, _nextSibling) : new SAX2DOM(); _lexHandler = (LexicalHandler) _handler; // falls through case SAX : if (_method == null) { _method = "xml"; // default case } if (_lexHandler == null) { result = new ToXMLSAXHandler(_handler, _encoding); } else { result = new ToXMLSAXHandler( _handler, _lexHandler, _encoding); } return result; } return null; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/output/WriterOutputBuffer.java0000644000175000017500000000505110721374033030055 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WriterOutputBuffer.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime.output; import java.io.BufferedWriter; import java.io.IOException; import java.io.Writer; /** * @author Santiago Pericas-Geertsen */ class WriterOutputBuffer implements OutputBuffer { private static final int KB = 1024; private static int BUFFER_SIZE = 4 * KB; static { // Set a larger buffer size for Solaris final String osName = System.getProperty("os.name"); if (osName.equalsIgnoreCase("solaris")) { BUFFER_SIZE = 32 * KB; } } private Writer _writer; /** * Initializes a WriterOutputBuffer by creating an instance of a * BufferedWriter. The size of the buffer in this writer may have * a significant impact on throughput. Solaris prefers a larger * buffer, while Linux works better with a smaller one. */ public WriterOutputBuffer(Writer writer) { _writer = new BufferedWriter(writer, BUFFER_SIZE); } public String close() { try { _writer.flush(); } catch (IOException e) { throw new RuntimeException(e.toString()); } return ""; } public OutputBuffer append(String s) { try { _writer.write(s); } catch (IOException e) { throw new RuntimeException(e.toString()); } return this; } public OutputBuffer append(char[] s, int from, int to) { try { _writer.write(s, from, to); } catch (IOException e) { throw new RuntimeException(e.toString()); } return this; } public OutputBuffer append(char ch) { try { _writer.write(ch); } catch (IOException e) { throw new RuntimeException(e.toString()); } return this; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/output/StringOutputBuffer.java0000644000175000017500000000277510721374033030061 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringOutputBuffer.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime.output; /** * @author Santiago Pericas-Geertsen */ class StringOutputBuffer implements OutputBuffer { private StringBuffer _buffer; public StringOutputBuffer() { _buffer = new StringBuffer(); } public String close() { return _buffer.toString(); } public OutputBuffer append(String s) { _buffer.append(s); return this; } public OutputBuffer append(char[] s, int from, int to) { _buffer.append(s, from, to); return this; } public OutputBuffer append(char ch) { _buffer.append(ch); return this; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/output/OutputBuffer.java0000644000175000017500000000226610721374031026663 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OutputBuffer.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime.output; /** * @author Santiago Pericas-Geertsen */ interface OutputBuffer { public String close(); public OutputBuffer append(char ch); public OutputBuffer append(String s); public OutputBuffer append(char[] s, int from, int to); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/Attributes.java0000644000175000017500000000321310721374030025007 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Attributes.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import org.apache.xalan.xsltc.DOM; import org.xml.sax.AttributeList; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class Attributes implements AttributeList { private int _element; private DOM _document; public Attributes(DOM document, int element) { _element = element; _document = document; } public int getLength() { return 0; } public String getName(int i) { return null; } public String getType(int i) { return null; } public String getType(String name) { return null; } public String getValue(int i) { return null; } public String getValue(String name) { return null; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/SecuritySupport12.java0000644000175000017500000001176510721374032026245 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_hu.java0000644000175000017500000003121010721374033026137 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_hu.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_hu extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Fut\u00e1s k\u00f6zbeni bels\u0151 hiba a(z) ''{0}'' oszt\u00e1lyban. "}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Fut\u00e1s k\u00f6zbeni bels\u0151 hiba az v\u00e9grehajt\u00e1sakor."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "\u00c9rv\u00e9nytelen \u00e1talak\u00edt\u00e1s ''{0}'' t\u00edpusr\u00f3l ''{1}'' t\u00edpusra."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "A(z) ''{0}'' k\u00fcls\u0151 f\u00fcggv\u00e9nyt az XSLTC nem t\u00e1mogatja."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Ismeretlen argumentumt\u00edpus tal\u00e1lhat\u00f3 az egyenl\u0151s\u00e9gi kifejez\u00e9sben."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "A(z) ''{0}'' \u00e9rv\u00e9nytelen argumentumt\u00edpus a(z) ''{1}'' h\u00edv\u00e1s\u00e1hoz "}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "K\u00eds\u00e9rlet a(z) ''{0}'' form\u00e1z\u00e1s\u00e1ra a(z) ''{1}'' mint\u00e1val."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "A(z) ''{0}'' iter\u00e1tor nem kl\u00f3nozhat\u00f3."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "A(z) ''{0}'' tengelyre az iter\u00e1tor nem t\u00e1mogatott."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "A tipiz\u00e1lt ''{0}'' tengelyre az iter\u00e1tor nem t\u00e1mogatott."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "A(z) ''{0}'' attrib\u00fatum k\u00edv\u00fcl esik az elemen."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "A(z) ''{0}''=''{1}'' n\u00e9vt\u00e9rdeklar\u00e1ci\u00f3 k\u00edv\u00fcl esik az elemen."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "A(z) ''{0}'' el\u0151tag n\u00e9vtere nincs deklar\u00e1lva."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "Nem megfelel\u0151 t\u00edpus\u00fa forr\u00e1s DOM haszn\u00e1lat\u00e1val j\u00f6tt l\u00e9tre a DOMAdapter."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "A haszn\u00e1lt SAX \u00e9rtelmez\u0151 nem kezeli a DTD deklar\u00e1ci\u00f3s esem\u00e9nyeket."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "A haszn\u00e1lt SAX \u00e9rtelmez\u0151 nem t\u00e1mogatja az XML n\u00e9vtereket."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Nem lehet feloldani a(z) ''{0}'' URI hivatkoz\u00e1st."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Nem t\u00e1mogatott XSL elem: ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Ismeretlen XSLTC kiterjeszt\u00e9s: ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "A megadott ''{0}'' translet az XSLTC egy \u00fajabb verzi\u00f3j\u00e1val k\u00e9sz\u00fclt, mint a haszn\u00e1latban l\u00e9v\u0151 XSLTC verzi\u00f3. \u00dajra kell ford\u00edtania a st\u00edluslapot, vagy a translet futtat\u00e1s\u00e1hoz az XSLTC \u00fajabb verzi\u00f3j\u00e1t kell haszn\u00e1lnia."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Egy olyan attrib\u00fatum, aminek az \u00e9rt\u00e9ke csak QName lehet, ''{0}'' \u00e9rt\u00e9kkel rendelkezett."}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Egy olyan attrib\u00fatum, amelynek \u00e9rt\u00e9ke csak NCName lehet, ''{0}'' \u00e9rt\u00e9kkel rendelkezett."}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "A(z) ''{0}'' kiterjeszt\u00e9si f\u00fcggv\u00e9ny haszn\u00e1lata nem megengedett, ha biztons\u00e1gos feldolgoz\u00e1s be van kapcsolva. "}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "A(z) ''{0}'' kiterjeszt\u00e9si elem haszn\u00e1lata nem megengedett, ha biztons\u00e1gos feldolgoz\u00e1s be van kapcsolva. "}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/Hashtable.java0000644000175000017500000002167610721374031024572 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Hashtable.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.Enumeration; /** * IMPORTANT NOTE: * This code was taken from Sun's Java1.1 JDK java.util.HashTable.java * All "synchronized" keywords and some methods we do not need have been * all been removed. */ /** * Object that wraps entries in the hash-table * @author Morten Jorgensen */ class HashtableEntry { int hash; Object key; Object value; HashtableEntry next; protected Object clone() { HashtableEntry entry = new HashtableEntry(); entry.hash = hash; entry.key = key; entry.value = value; entry.next = (next != null) ? (HashtableEntry)next.clone() : null; return entry; } } /** * The main hash-table implementation */ public class Hashtable { private transient HashtableEntry table[]; // hash-table entries private transient int count; // number of entries private int threshold; // current size of hash-tabke private float loadFactor; // load factor /** * Constructs a new, empty hashtable with the specified initial * capacity and the specified load factor. */ public Hashtable(int initialCapacity, float loadFactor) { if (initialCapacity <= 0) initialCapacity = 11; if (loadFactor <= 0.0) loadFactor = 0.75f; this.loadFactor = loadFactor; table = new HashtableEntry[initialCapacity]; threshold = (int)(initialCapacity * loadFactor); } /** * Constructs a new, empty hashtable with the specified initial capacity * and default load factor. */ public Hashtable(int initialCapacity) { this(initialCapacity, 0.75f); } /** * Constructs a new, empty hashtable with a default capacity and load * factor. */ public Hashtable() { this(101, 0.75f); } /** * Returns the number of keys in this hashtable. */ public int size() { return count; } /** * Tests if this hashtable maps no keys to values. */ public boolean isEmpty() { return count == 0; } /** * Returns an enumeration of the keys in this hashtable. */ public Enumeration keys() { return new HashtableEnumerator(table, true); } /** * Returns an enumeration of the values in this hashtable. * Use the Enumeration methods on the returned object to fetch the elements * sequentially. */ public Enumeration elements() { return new HashtableEnumerator(table, false); } /** * Tests if some key maps into the specified value in this hashtable. * This operation is more expensive than the containsKey * method. */ public boolean contains(Object value) { if (value == null) throw new NullPointerException(); int i; HashtableEntry e; HashtableEntry tab[] = table; for (i = tab.length ; i-- > 0 ;) { for (e = tab[i] ; e != null ; e = e.next) { if (e.value.equals(value)) { return true; } } } return false; } /** * Tests if the specified object is a key in this hashtable. */ public boolean containsKey(Object key) { HashtableEntry e; HashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (e = tab[index] ; e != null ; e = e.next) if ((e.hash == hash) && e.key.equals(key)) return true; return false; } /** * Returns the value to which the specified key is mapped in this hashtable. */ public Object get(Object key) { HashtableEntry e; HashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (e = tab[index] ; e != null ; e = e.next) if ((e.hash == hash) && e.key.equals(key)) return e.value; return null; } /** * Rehashes the contents of the hashtable into a hashtable with a * larger capacity. This method is called automatically when the * number of keys in the hashtable exceeds this hashtable's capacity * and load factor. */ protected void rehash() { HashtableEntry e, old; int i, index; int oldCapacity = table.length; HashtableEntry oldTable[] = table; int newCapacity = oldCapacity * 2 + 1; HashtableEntry newTable[] = new HashtableEntry[newCapacity]; threshold = (int)(newCapacity * loadFactor); table = newTable; for (i = oldCapacity ; i-- > 0 ;) { for (old = oldTable[i] ; old != null ; ) { e = old; old = old.next; index = (e.hash & 0x7FFFFFFF) % newCapacity; e.next = newTable[index]; newTable[index] = e; } } } /** * Maps the specified key to the specified * value in this hashtable. Neither the key nor the * value can be null. *

        * The value can be retrieved by calling the get method * with a key that is equal to the original key. */ public Object put(Object key, Object value) { // Make sure the value is not null if (value == null) throw new NullPointerException(); // Makes sure the key is not already in the hashtable. HashtableEntry e; HashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (e = tab[index] ; e != null ; e = e.next) { if ((e.hash == hash) && e.key.equals(key)) { Object old = e.value; e.value = value; return old; } } // Rehash the table if the threshold is exceeded if (count >= threshold) { rehash(); return put(key, value); } // Creates the new entry. e = new HashtableEntry(); e.hash = hash; e.key = key; e.value = value; e.next = tab[index]; tab[index] = e; count++; return null; } /** * Removes the key (and its corresponding value) from this * hashtable. This method does nothing if the key is not in the hashtable. */ public Object remove(Object key) { HashtableEntry e, prev; HashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (e = tab[index], prev = null ; e != null ; prev = e, e = e.next) { if ((e.hash == hash) && e.key.equals(key)) { if (prev != null) prev.next = e.next; else tab[index] = e.next; count--; return e.value; } } return null; } /** * Clears this hashtable so that it contains no keys. */ public void clear() { HashtableEntry tab[] = table; for (int index = tab.length; --index >= 0; ) tab[index] = null; count = 0; } /** * Returns a rather long string representation of this hashtable. * Handy for debugging - leave it here!!! */ public String toString() { int i; int max = size() - 1; StringBuffer buf = new StringBuffer(); Enumeration k = keys(); Enumeration e = elements(); buf.append("{"); for (i = 0; i <= max; i++) { String s1 = k.nextElement().toString(); String s2 = e.nextElement().toString(); buf.append(s1 + "=" + s2); if (i < max) buf.append(", "); } buf.append("}"); return buf.toString(); } /** * A hashtable enumerator class. This class should remain opaque * to the client. It will use the Enumeration interface. */ class HashtableEnumerator implements Enumeration { boolean keys; int index; HashtableEntry table[]; HashtableEntry entry; HashtableEnumerator(HashtableEntry table[], boolean keys) { this.table = table; this.keys = keys; this.index = table.length; } public boolean hasMoreElements() { if (entry != null) { return true; } while (index-- > 0) { if ((entry = table[index]) != null) { return true; } } return false; } public Object nextElement() { if (entry == null) { while ((index-- > 0) && ((entry = table[index]) == null)); } if (entry != null) { HashtableEntry e = entry; entry = e.next; return keys ? e.key : e.value; } return null; } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_pt_BR.java0000644000175000017500000003054410721374031026540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_pt_BR.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_pt_BR extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Erro interno de tempo de execu\u00e7\u00e3o em ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Erro de tempo de execu\u00e7\u00e3o ao executar ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Convers\u00e3o inv\u00e1lida de ''{0}'' em ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Fun\u00e7\u00e3o externa ''{0}'' n\u00e3o suportada por XSLTC."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Tipo de argumento desconhecido na express\u00e3o de igualdade. "}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Tipo de argumento inv\u00e1lido ''{0}'' na chamada para ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Tentando formatar o n\u00famero ''{0}'' utilizando o padr\u00e3o ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "N\u00e3o \u00e9 poss\u00edvel clonar o iterador ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "O iterador do eixo ''{0}'' n\u00e3o \u00e9 suportado. "}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "O iterador do eixo digitado ''{0}'' n\u00e3o \u00e9 suportado. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Atributo ''{0}'' fora do elemento. "}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Declara\u00e7\u00e3o de espa\u00e7o de nomes ''{0}''=''{1}'' fora do elemento. "}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "O espa\u00e7o de nomes do prefixo ''{0}'' n\u00e3o foi declarado. "}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter criado utilizando tipo incorreto de DOM de origem."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "O analisador SAX que est\u00e1 sendo utilizado n\u00e3o trata de eventos de declara\u00e7\u00e3o de DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "O analisador SAX que est\u00e1 sendo utilizado n\u00e3o possui suporte para Namespaces XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "N\u00e3o foi poss\u00edvel resolver a refer\u00eancia de URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Elemento XSL n\u00e3o suportado ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Extens\u00e3o XSLTC n\u00e3o reconhecida ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "O translet especificado, ''{0}'', foi criado com o uso de uma vers\u00e3o do XSLTC mais recente que a vers\u00e3o do tempo de execu\u00e7\u00e3o XSLTC atualmente em uso. \u00c9 necess\u00e1rio recompilar a folha de estilo ou utilizar uma vers\u00e3o mais recente do XSLTC para executar esse translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Um atributo cujo valor deve ser um QName apresentou o valor ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Um atributo cujo valor deve ser um NCName apresentou o valor ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "O uso da fun\u00e7\u00e3o de extens\u00e3o ''{0}'' n\u00e3o \u00e9 permitido quando o recurso de processamento seguro \u00e9 definido como true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "O uso do elemento de extens\u00e3o ''{0}'' n\u00e3o \u00e9 permitido quando o recurso de processamento seguro \u00e9 definido como true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_it.java0000644000175000017500000003030710721374032026144 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_it.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_it extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Errore run-time interno in ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Errore run-time durante l'esecuzione di ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Conversione non valida da ''{0}'' a ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Funzione esterna ''{0}'' non supportata da XSLTC."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Tipo di argomento sconosciuto nell'espressione di uguaglianza."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Tipo argomento non valido ''{0}'' nella chiamata a ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Tentativo di formattare il numero ''{0}'' utilizzando il modello ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Impossibile clonare l''''iteratore ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iteratore per asse ''{0}'' non supportato."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iteratore per l''''asse immesso ''{0}'' non sopportato."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "L''''attributo ''{0}'' al di fuori dell''''elemento."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Dichiarazione dello spazio nome ''{0}''=''{1}'' al di fuori dell''''elemento."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "Lo spazio nomi per il prefisso ''{0}'' non \u00e8 stato dichiarato. "}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter creato utilizzando il tipo di origine DOM errato."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "Il parser SAX utilizzato non gestisce gli eventi di dichiarazione DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "Il parser SAX utilizzato non dispone del supporto per gli spazi nome XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Impossibile risolvere il riferimento URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Elemento XSL non supportato ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Estensione XSLTC non riconosciuta ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "Il translet specificato, ''{0}'', \u00e8 stato creato utilizzando una versione di XSLTC pi\u00f9 recente della versione del run-time XSLTC che \u00e8 in uso. \u00c8 necessario ricompilare il foglio di lavoro oppure utilizzare una versione pi\u00f9 recente di XSLTC per eseguire questo translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Un attributo il cui valore deve essere un QName aveva il valore ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Un attributo il cui valore deve essere un NCName aveva il valore ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "L''''utilizzo di una funzione di estensione ''{0}'' non \u00e8 consentito quando la funzione di elaborazione sicura \u00e8 impostata su true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "L''''utilizzo di un elemento di estensione ''{0}'' non \u00e8 consentito quando la funzione di elaborazione sicura \u00e8 impostata su true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_ko.java0000644000175000017500000003336210721374032026145 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ko.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ko extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "''{0}''\uc5d0 \ub7f0\ud0c0\uc784 \ub0b4\ubd80 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, " \uc2e4\ud589\uc2dc \ub7f0\ud0c0\uc784 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "''{0}''\uc5d0\uc11c ''{1}''(\uc73c)\ub85c\uc758 \ubcc0\ud658\uc740 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "XSLTC\uc5d0\uc11c ''{0}'' \uc678\ubd80 \ud568\uc218\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "\ub4f1\uc2dd\uc5d0 \uc54c \uc218 \uc5c6\ub294 \uc778\uc218 \uc720\ud615\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "''{1}''\uc5d0 \ub300\ud55c \ud638\ucd9c\uc5d0\uc11c ''{0}'' \uc778\uc218 \uc720\ud615\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "''{1}'' \ud328\ud134\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc22b\uc790 ''{0}''\uc744(\ub97c) \ud3ec\ub9f7\ud558\ub824\uace0 \uc2dc\ub3c4\ud588\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "''{0}'' \ubc18\ubcf5\uae30\ub97c \ubcf5\uc81c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "''{0}'' \ucd95\uc5d0 \ub300\ud55c \ubc18\ubcf5\uae30\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "\uc720\ud615\uc774 \uc9c0\uc815\ub41c \ucd95 ''{0}''\uc5d0 \ub300\ud574 \ubc18\ubcf5\uae30\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "''{0}'' \uc18d\uc131\uc774 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "''{0}''=''{1}'' \uc774\ub984 \uacf5\uac04 \uc120\uc5b8\uc774 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "''{0}'' \uc811\ub450\ubd80\uc5d0 \ub300\ud55c \uc774\ub984 \uacf5\uac04\uc774 \uc120\uc5b8\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "\uc18c\uc2a4 DOM\uc758 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc740 \uc720\ud615\uc744 \uc0ac\uc6a9\ud558\uc5ec DOMAdapter\uac00 \uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "\uc0ac\uc6a9 \uc911\uc778 SAX \uad6c\ubb38 \ubd84\uc11d\uae30\uac00 DTD \uc120\uc5b8 \uc774\ubca4\ud2b8\ub97c \ucc98\ub9ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "\uc0ac\uc6a9 \uc911\uc778 SAX \uad6c\ubb38 \ubd84\uc11d\uae30\uac00 XML \uc774\ub984 \uacf5\uac04\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "''{0}'' URI \ucc38\uc870\ub97c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "''{0}'' XSL \uc694\uc18c\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "''{0}'' XSLTC \ud655\uc7a5\uc790\ub97c \uc778\uc2dd\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "\uc0ac\uc6a9 \uc911\uc778 XSLTC \ub7f0\ud0c0\uc784 \ubc84\uc804\ubcf4\ub2e4 \ub354 \ucd5c\uc2e0\uc758 XSLTC \ubc84\uc804\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc9c0\uc815\ub41c ''{0}'' Translet\uc744 \uc791\uc131\ud588\uc2b5\ub2c8\ub2e4. \uc774 Translet\uc744 \uc2e4\ud589\ud558\ub824\uba74 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\ub97c \ub2e4\uc2dc \ucef4\ud30c\uc77c\ud558\uac70\ub098 \ub354 \ucd5c\uc2e0\uc758 XSLTC \ubc84\uc804\uc744 \uc0ac\uc6a9\ud574\uc57c \ud569\ub2c8\ub2e4. "}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "\uac12\uc774 QName\uc774\uc5b4\uc57c \ud558\ub294 \uc18d\uc131\uc5d0 ''{0}'' \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "\uac12\uc774 NCName\uc774\uc5b4\uc57c \ud558\ub294 \uc18d\uc131\uc5d0 ''{0}'' \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "\ubcf4\uc548 \ucc98\ub9ac \uae30\ub2a5\uc774 true\ub85c \uc124\uc815\ub41c \uacbd\uc6b0\uc5d0\ub294 ''{0}'' \ud655\uc7a5 \ud568\uc218\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "\ubcf4\uc548 \ucc98\ub9ac \uae30\ub2a5\uc774 true\ub85c \uc124\uc815\ub41c \uacbd\uc6b0\uc5d0\ub294 ''{0}'' \ud655\uc7a5 \uc694\uc18c\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/StringValueHandler.java0000644000175000017500000000647010721374030026432 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StringValueHandler.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import org.xml.sax.SAXException; import org.apache.xml.serializer.EmptySerializer; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class StringValueHandler extends EmptySerializer { private StringBuffer _buffer = new StringBuffer(); private String _str = null; private static final String EMPTY_STR = ""; private boolean m_escaping = false; private int _nestedLevel = 0; public void characters(char[] ch, int off, int len) throws SAXException { if (_nestedLevel > 0) return; if (_str != null) { _buffer.append(_str); _str = null; } _buffer.append(ch, off, len); } public String getValue() { if (_buffer.length() != 0) { String result = _buffer.toString(); _buffer.setLength(0); return result; } else { String result = _str; _str = null; return (result != null) ? result : EMPTY_STR; } } public void characters(String characters) throws SAXException { if (_nestedLevel > 0) return; if (_str == null && _buffer.length() == 0) { _str = characters; } else { if (_str != null) { _buffer.append(_str); _str = null; } _buffer.append(characters); } } public void startElement(String qname) throws SAXException { _nestedLevel++; } public void endElement(String qname) throws SAXException { _nestedLevel--; } // Override the setEscaping method just to indicate that this class is // aware that that method might be called. public boolean setEscaping(boolean bool) { boolean oldEscaping = m_escaping; m_escaping = bool; return bool; } /** * The value of a PI must not contain the substring "?>". Should * that substring be present, replace it by "? >". */ public String getValueOfPI() { final String value = getValue(); if (value.indexOf("?>") > 0) { final int n = value.length(); final StringBuffer valueOfPI = new StringBuffer(); for (int i = 0; i < n;) { final char ch = value.charAt(i++); if (ch == '?' && value.charAt(i) == '>') { valueOfPI.append("? >"); i++; } else { valueOfPI.append(ch); } } return valueOfPI.toString(); } return value; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_tr.java0000644000175000017500000003157510721374032026165 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_tr.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_tr extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "''{0}'' i\u00e7inde y\u00fcr\u00fctme zaman\u0131 i\u00e7 hatas\u0131"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, " y\u00fcr\u00fct\u00fcl\u00fcrken y\u00fcr\u00fctme zaman\u0131 hatas\u0131."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "''{0}'' tipinden ''{1}'' tipine d\u00f6n\u00fc\u015ft\u00fcrme ge\u00e7ersiz."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "''{0}'' d\u0131\u015f i\u015flevi XSLTC taraf\u0131ndan desteklenmiyor."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "E\u015fitlik ifadesinde bilinmeyen ba\u011f\u0131ms\u0131z de\u011fi\u015fken tipi."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "''{1}'' i\u015flevi \u00e7a\u011fr\u0131s\u0131nda ba\u011f\u0131ms\u0131z de\u011fi\u015fken tipi ''{0}'' ge\u00e7ersiz."}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "''{0}'' say\u0131s\u0131n\u0131 ''{1}'' \u00f6r\u00fcnt\u00fcs\u00fcn\u00fc kullanarak bi\u00e7imleme giri\u015fimi."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "''{0}'' yineleyicisinin e\u015fkopyas\u0131 yarat\u0131lam\u0131yor."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "''{0}'' ekseni i\u00e7in yineleyici desteklenmiyor."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Tip atanm\u0131\u015f ''{0}'' ekseni i\u00e7in yineleyici desteklenmiyor."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "''{0}'' \u00f6zniteli\u011fi \u00f6\u011fenin d\u0131\u015f\u0131nda."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "''{0}''=''{1}'' ad alan\u0131 bildirimi \u00f6\u011fenin d\u0131\u015f\u0131nda."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "''{0}'' \u00f6nekine ili\u015fkin ad alan\u0131 bildirilmedi."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter, yanl\u0131\u015f tipte kaynak DOM kullan\u0131larak yarat\u0131ld\u0131."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "Kulland\u0131\u011f\u0131n\u0131z SAX ayr\u0131\u015ft\u0131r\u0131c\u0131s\u0131 DTD bildirim olaylar\u0131n\u0131 i\u015flemiyor."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "Kulland\u0131\u011f\u0131n\u0131z SAX ayr\u0131\u015ft\u0131r\u0131c\u0131s\u0131n\u0131n XML ad alanlar\u0131 deste\u011fi yok."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "''{0}'' URI ba\u015fvurusu \u00e7\u00f6z\u00fclemedi."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "XSL \u00f6\u011fesi ''{0}'' desteklenmiyor"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "XSLTC uzant\u0131s\u0131 ''{0}'' tan\u0131nm\u0131yor"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "Belirtilen derleme sonucu s\u0131n\u0131f dosyas\u0131 ''{0}'', kullan\u0131lmakta olan XSLTC s\u00fcr\u00fcm\u00fcnden daha yeni bir XSLTC s\u00fcr\u00fcm\u00fcyle yarat\u0131lm\u0131\u015f. Bi\u00e7em yapra\u011f\u0131n\u0131 yeniden derlemeli ya da bu derleme sonucu s\u0131n\u0131f dosyas\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rmak i\u00e7in daha yeni bir XSLTC s\u00fcr\u00fcm\u00fcn\u00fc kullanmal\u0131s\u0131n\u0131z."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "De\u011ferinin bir QName olmas\u0131 gereken \u00f6zniteli\u011fin de\u011feri ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "De\u011ferinin bir NCName olmas\u0131 gereken \u00f6zniteli\u011fin de\u011feri ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "G\u00fcvenli i\u015fleme \u00f6zelli\u011fi true de\u011ferine ayarland\u0131\u011f\u0131nda ''{0}'' eklenti i\u015flevinin kullan\u0131lmas\u0131na izin verilmez."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "G\u00fcvenli i\u015fleme \u00f6zelli\u011fi true de\u011ferine ayarland\u0131\u011f\u0131nda ''{0}'' eklenti \u00f6\u011fesinin kullan\u0131lmas\u0131na izin verilmez."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_ja.java0000644000175000017500000003427110721374032026126 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ja.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ja extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "''{0}'' \u3067\u30e9\u30f3\u30bf\u30a4\u30e0\u5185\u90e8\u30a8\u30e9\u30fc\u304c\u3042\u308a\u307e\u3057\u305f\u3002"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, " \u5b9f\u884c\u6642\u306e\u30e9\u30f3\u30bf\u30a4\u30e0\u30fb\u30a8\u30e9\u30fc"}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "''{0}'' \u304b\u3089 ''{1}'' \u3078\u306e\u5909\u63db\u306f\u7121\u52b9\u3067\u3059\u3002"}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "\u5916\u90e8\u95a2\u6570 ''{0}'' \u306f XSLTC \u306b\u3088\u3063\u3066\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "\u7b49\u5f0f\u5185\u306e\u5f15\u6570\u304c\u4e0d\u660e\u3067\u3059\u3002"}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "''{1}'' \u3078\u306e\u547c\u3073\u51fa\u3057\u306e\u5f15\u6570\u306e\u578b ''{0}'' \u304c\u7121\u52b9\u3067\u3059\u3002"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "\u30d1\u30bf\u30fc\u30f3 ''{1}'' \u3092\u4f7f\u7528\u3057\u3066\u6570\u5024 ''{0}'' \u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u8a2d\u5b9a\u3092\u8a66\u307f\u3066\u3044\u307e\u3059\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc ''{0}'' \u3092\u8907\u88fd\u3067\u304d\u307e\u305b\u3093\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "\u8ef8 ''{0}'' \u306e\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "\u578b\u4ed8\u304d\u306e\u8ef8 ''{0}'' \u306e\u30a4\u30c6\u30ec\u30fc\u30bf\u30fc\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "\u5c5e\u6027 ''{0}'' \u304c\u8981\u7d20\u306e\u5916\u5074\u3067\u3059\u3002"}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "\u540d\u524d\u7a7a\u9593\u5ba3\u8a00 ''{0}''=''{1}'' \u304c\u8981\u7d20\u306e\u5916\u5074\u3067\u3059\u3002"}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "\u63a5\u982d\u90e8 ''{0}'' \u306e\u540d\u524d\u7a7a\u9593\u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter \u304c\u9593\u9055\u3063\u305f\u578b\u306e\u30bd\u30fc\u30b9 DOM \u3092\u4f7f\u7528\u3057\u3066\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002"}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "\u4f7f\u7528\u4e2d\u306e SAX \u30d1\u30fc\u30b5\u30fc\u306f DTD \u5ba3\u8a00\u30a4\u30d9\u30f3\u30c8\u3092\u51e6\u7406\u3057\u307e\u305b\u3093\u3002"}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "\u4f7f\u7528\u4e2d\u306e SAX \u30d1\u30fc\u30b5\u30fc\u306b\u306f XML \u540d\u524d\u7a7a\u9593\u306e\u30b5\u30dd\u30fc\u30c8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "URI \u53c2\u7167 ''{0}'' \u3092\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "XSL \u8981\u7d20 ''{0}'' \u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "XSLTC \u62e1\u5f35 ''{0}'' \u306f\u8a8d\u8b58\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "\u6307\u5b9a\u3055\u308c\u305f translet ''{0}'' \u306f\u3001\u4f7f\u7528\u4e2d\u306e XSLTC \u30e9\u30f3\u30bf\u30a4\u30e0\u3088\u308a\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306e XSLTC \u3092\u4f7f\u7528\u3057\u3066\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002\u3053\u306e translet \u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u304b\u3001\u307e\u305f\u306f\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306e XSLTC \u3092\u4f7f\u7528\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "\u5024\u304c QName \u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5c5e\u6027\u306b\u3001\u5024 ''{0}'' \u304c\u3042\u308a\u307e\u3057\u305f\u3002"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "\u5024\u304c NCName \u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5c5e\u6027\u306b\u3001\u5024 ''{0}'' \u304c\u3042\u308a\u307e\u3057\u305f\u3002"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u4fdd\u8b77\u3055\u308c\u305f\u51e6\u7406\u6a5f\u80fd\u304c true \u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3068\u304d\u306b\u3001\u62e1\u5f35\u95a2\u6570 ''{0}'' \u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u4fdd\u8b77\u3055\u308c\u305f\u51e6\u7406\u6a5f\u80fd\u304c true \u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3068\u304d\u306b\u3001\u62e1\u5f35\u8981\u7d20 ''{0}'' \u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/Constants.java0000644000175000017500000000372310721374030024643 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Constants.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import org.apache.xml.dtm.DTM; /** * This class defines constants used by both the compiler and the * runtime system. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface Constants { final static int ANY = -1; final static int ATTRIBUTE = -2; final static int ROOT = DTM.ROOT_NODE; final static int TEXT = DTM.TEXT_NODE; final static int ELEMENT = DTM.ELEMENT_NODE; final static int COMMENT = DTM.COMMENT_NODE; final static int PROCESSING_INSTRUCTION = DTM.PROCESSING_INSTRUCTION_NODE; public static final String XSLT_URI = "http://www.w3.org/1999/XSL/Transform"; public static final String NAMESPACE_FEATURE = "http://xml.org/sax/features/namespaces"; public static final String EMPTYSTRING = ""; public static final String XML_PREFIX = "xml"; public static final String XMLNS_PREFIX = "xmlns"; public static final String XMLNS_STRING = "xmlns:"; public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/"; } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java0000644000175000017500000006260310721374030026151 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AbstractTranslet.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.io.File; import java.io.FileWriter; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Enumeration; import java.util.Vector; import javax.xml.transform.Templates; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.DOMImplementation; import javax.xml.parsers.ParserConfigurationException; import org.apache.xml.dtm.DTM; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMCache; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.dom.DOMAdapter; import org.apache.xalan.xsltc.dom.KeyIndex; import org.apache.xalan.xsltc.runtime.output.TransletOutputHandlerFactory; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.serializer.SerializationHandler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author G. Todd Miller * @author John Howard, JohnH@schemasoft.com */ public abstract class AbstractTranslet implements Translet { // These attributes are extracted from the xsl:output element. They also // appear as fields (with the same type, only public) in Output.java public String _version = "1.0"; public String _method = null; public String _encoding = "UTF-8"; public boolean _omitHeader = false; public String _standalone = null; public String _doctypePublic = null; public String _doctypeSystem = null; public boolean _indent = false; public String _mediaType = null; public Vector _cdata = null; public int _indentamount = -1; public static final int FIRST_TRANSLET_VERSION = 100; public static final int VER_SPLIT_NAMES_ARRAY = 101; public static final int CURRENT_TRANSLET_VERSION = VER_SPLIT_NAMES_ARRAY; // Initialize Translet version field to base value. A class that extends // AbstractTranslet may override this value to a more recent translet // version; if it doesn't override the value (because it was compiled // before the notion of a translet version was introduced, it will get // this default value). protected int transletVersion = FIRST_TRANSLET_VERSION; // DOM/translet handshaking - the arrays are set by the compiled translet protected String[] namesArray; protected String[] urisArray; protected int[] typesArray; protected String[] namespaceArray; // The Templates object that is used to create this Translet instance protected Templates _templates = null; // Boolean flag to indicate whether this translet has id functions. protected boolean _hasIdCall = false; // TODO - these should only be instanciated when needed protected StringValueHandler stringValueHandler = new StringValueHandler(); // Use one empty string instead of constantly instanciating String(""); private final static String EMPTYSTRING = ""; // This is the name of the index used for ID attributes private final static String ID_INDEX_NAME = "##id"; /************************************************************************ * Debugging ************************************************************************/ public void printInternalState() { System.out.println("-------------------------------------"); System.out.println("AbstractTranslet this = " + this); System.out.println("pbase = " + pbase); System.out.println("vframe = " + pframe); System.out.println("paramsStack.size() = " + paramsStack.size()); System.out.println("namesArray.size = " + namesArray.length); System.out.println("namespaceArray.size = " + namespaceArray.length); System.out.println(""); System.out.println("Total memory = " + Runtime.getRuntime().totalMemory()); } /** * Wrap the initial input DOM in a dom adapter. This adapter is wrapped in * a DOM multiplexer if the document() function is used (handled by compiled * code in the translet - see compiler/Stylesheet.compileTransform()). */ public final DOMAdapter makeDOMAdapter(DOM dom) throws TransletException { setRootForKeys(dom.getDocument()); return new DOMAdapter(dom, namesArray, urisArray, typesArray, namespaceArray); } /************************************************************************ * Parameter handling ************************************************************************/ // Parameter's stack: pbase and pframe are used // to denote the current parameter frame. protected int pbase = 0, pframe = 0; protected ArrayList paramsStack = new ArrayList(); /** * Push a new parameter frame. */ public final void pushParamFrame() { paramsStack.add(pframe, new Integer(pbase)); pbase = ++pframe; } /** * Pop the topmost parameter frame. */ public final void popParamFrame() { if (pbase > 0) { final int oldpbase = ((Integer)paramsStack.get(--pbase)).intValue(); for (int i = pframe - 1; i >= pbase; i--) { paramsStack.remove(i); } pframe = pbase; pbase = oldpbase; } } /** * Add a new global parameter if not already in the current frame. * To setParameters of the form {http://foo.bar}xyz * This needs to get mapped to an instance variable in the class * The mapping created so that * the global variables in the generated class become * http$colon$$flash$$flash$foo$dot$bar$colon$xyz */ public final Object addParameter(String name, Object value) { name = BasisLibrary.mapQNameToJavaName (name); return addParameter(name, value, false); } /** * Add a new global or local parameter if not already in the current frame. * The 'isDefault' parameter is set to true if the value passed is the * default value from the element's select attribute or * element body. */ public final Object addParameter(String name, Object value, boolean isDefault) { // Local parameters need to be re-evaluated for each iteration for (int i = pframe - 1; i >= pbase; i--) { final Parameter param = (Parameter) paramsStack.get(i); if (param._name.equals(name)) { // Only overwrite if current value is the default value and // the new value is _NOT_ the default value. if (param._isDefault || !isDefault) { param._value = value; param._isDefault = isDefault; return value; } return param._value; } } // Add new parameter to parameter stack paramsStack.add(pframe++, new Parameter(name, value, isDefault)); return value; } /** * Clears the parameter stack. */ public void clearParameters() { pbase = pframe = 0; paramsStack.clear(); } /** * Get the value of a parameter from the current frame or * null if undefined. */ public final Object getParameter(String name) { name = BasisLibrary.mapQNameToJavaName (name); for (int i = pframe - 1; i >= pbase; i--) { final Parameter param = (Parameter)paramsStack.get(i); if (param._name.equals(name)) return param._value; } return null; } /************************************************************************ * Message handling - implementation of ************************************************************************/ // Holds the translet's message handler - used for . // The deault message handler dumps a string stdout, but anything can be // used, such as a dialog box for applets, etc. private MessageHandler _msgHandler = null; /** * Set the translet's message handler - must implement MessageHandler */ public final void setMessageHandler(MessageHandler handler) { _msgHandler = handler; } /** * Pass a message to the message handler - used by Message class. */ public final void displayMessage(String msg) { if (_msgHandler == null) { System.err.println(msg); } else { _msgHandler.displayMessage(msg); } } /************************************************************************ * Decimal number format symbol handling ************************************************************************/ // Contains decimal number formatting symbols used by FormatNumberCall public Hashtable _formatSymbols = null; /** * Adds a DecimalFormat object to the _formatSymbols hashtable. * The entry is created with the input DecimalFormatSymbols. */ public void addDecimalFormat(String name, DecimalFormatSymbols symbols) { // Instanciate hashtable for formatting symbols if needed if (_formatSymbols == null) _formatSymbols = new Hashtable(); // The name cannot be null - use empty string instead if (name == null) name = EMPTYSTRING; // Construct a DecimalFormat object containing the symbols we got final DecimalFormat df = new DecimalFormat(); if (symbols != null) { df.setDecimalFormatSymbols(symbols); } _formatSymbols.put(name, df); } /** * Retrieves a named DecimalFormat object from _formatSymbols hashtable. */ public final DecimalFormat getDecimalFormat(String name) { if (_formatSymbols != null) { // The name cannot be null - use empty string instead if (name == null) name = EMPTYSTRING; DecimalFormat df = (DecimalFormat)_formatSymbols.get(name); if (df == null) df = (DecimalFormat)_formatSymbols.get(EMPTYSTRING); return df; } return(null); } /** * Give the translet an opportunity to perform a prepass on the document * to extract any information that it can store in an optimized form. * * Currently, it only extracts information about attributes of type ID. */ public final void prepassDocument(DOM document) { setIndexSize(document.getSize()); buildIDIndex(document); } /** * Leverages the Key Class to implement the XSLT id() function. * buildIdIndex creates the index (##id) that Key Class uses. * The index contains the element node index (int) and Id value (String). */ private final void buildIDIndex(DOM document) { setRootForKeys(document.getDocument()); if (document instanceof DOMEnhancedForDTM) { DOMEnhancedForDTM enhancedDOM = (DOMEnhancedForDTM)document; // If the input source is DOMSource, the KeyIndex table is not // built at this time. It will be built later by the lookupId() // and containsId() methods of the KeyIndex class. if (enhancedDOM.hasDOMSource()) { buildKeyIndex(ID_INDEX_NAME, document); return; } else { final Hashtable elementsByID = enhancedDOM.getElementsWithIDs(); if (elementsByID == null) { return; } // Given a Hashtable of DTM nodes indexed by ID attribute values, // loop through the table copying information to a KeyIndex // for the mapping from ID attribute value to DTM node final Enumeration idValues = elementsByID.keys(); boolean hasIDValues = false; while (idValues.hasMoreElements()) { final Object idValue = idValues.nextElement(); final int element = document.getNodeHandle( ((Integer)elementsByID.get(idValue)) .intValue()); buildKeyIndex(ID_INDEX_NAME, element, idValue); hasIDValues = true; } if (hasIDValues) { setKeyIndexDom(ID_INDEX_NAME, document); } } } } /** * After constructing the translet object, this method must be called to * perform any version-specific post-initialization that's required. */ public final void postInitialization() { // If the version of the translet had just one namesArray, split // it into multiple fields. if (transletVersion < VER_SPLIT_NAMES_ARRAY) { int arraySize = namesArray.length; String[] newURIsArray = new String[arraySize]; String[] newNamesArray = new String[arraySize]; int[] newTypesArray = new int[arraySize]; for (int i = 0; i < arraySize; i++) { String name = namesArray[i]; int colonIndex = name.lastIndexOf(':'); int lNameStartIdx = colonIndex+1; if (colonIndex > -1) { newURIsArray[i] = name.substring(0, colonIndex); } // Distinguish attribute and element names. Attribute has // @ before local part of name. if (name.charAt(lNameStartIdx) == '@') { lNameStartIdx++; newTypesArray[i] = DTM.ATTRIBUTE_NODE; } else if (name.charAt(lNameStartIdx) == '?') { lNameStartIdx++; newTypesArray[i] = DTM.NAMESPACE_NODE; } else { newTypesArray[i] = DTM.ELEMENT_NODE; } newNamesArray[i] = (lNameStartIdx == 0) ? name : name.substring(lNameStartIdx); } namesArray = newNamesArray; urisArray = newURIsArray; typesArray = newTypesArray; } // Was translet compiled using a more recent version of the XSLTC // compiler than is known by the AbstractTranslet class? If, so // and we've made it this far (which is doubtful), we should give up. if (transletVersion > CURRENT_TRANSLET_VERSION) { BasisLibrary.runTimeError(BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, this.getClass().getName()); } } /************************************************************************ * Index(es) for / key() / id() ************************************************************************/ // Container for all indexes for xsl:key elements private Hashtable _keyIndexes = null; private KeyIndex _emptyKeyIndex = null; private int _indexSize = 0; private int _currentRootForKeys = 0; /** * This method is used to pass the largest DOM size to the translet. * Needed to make sure that the translet can index the whole DOM. */ public void setIndexSize(int size) { if (size > _indexSize) _indexSize = size; } /** * Creates a KeyIndex object of the desired size - don't want to resize!!! */ public KeyIndex createKeyIndex() { return(new KeyIndex(_indexSize)); } /** * Adds a value to a key/id index * @param name is the name of the index (the key or ##id) * @param node is the node handle of the node to insert * @param value is the value that will look up the node in the given index */ public void buildKeyIndex(String name, int node, Object value) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.add(value, node, _currentRootForKeys); } /** * Create an empty KeyIndex in the DOM case * @param name is the name of the index (the key or ##id) * @param dom is the DOM */ public void buildKeyIndex(String name, DOM dom) { if (_keyIndexes == null) _keyIndexes = new Hashtable(); KeyIndex index = (KeyIndex)_keyIndexes.get(name); if (index == null) { _keyIndexes.put(name, index = new KeyIndex(_indexSize)); } index.setDom(dom); } /** * Returns the index for a given key (or id). * The index implements our internal iterator interface */ public KeyIndex getKeyIndex(String name) { // Return an empty key index iterator if none are defined if (_keyIndexes == null) { return (_emptyKeyIndex != null) ? _emptyKeyIndex : (_emptyKeyIndex = new KeyIndex(1)); } // Look up the requested key index final KeyIndex index = (KeyIndex)_keyIndexes.get(name); // Return an empty key index iterator if the requested index not found if (index == null) { return (_emptyKeyIndex != null) ? _emptyKeyIndex : (_emptyKeyIndex = new KeyIndex(1)); } return(index); } private void setRootForKeys(int root) { _currentRootForKeys = root; } /** * This method builds key indexes - it is overridden in the compiled * translet in cases where the element is used */ public void buildKeys(DOM document, DTMAxisIterator iterator, SerializationHandler handler, int root) throws TransletException { } /** * This method builds key indexes - it is overridden in the compiled * translet in cases where the element is used */ public void setKeyIndexDom(String name, DOM document) { getKeyIndex(name).setDom(document); } /************************************************************************ * DOM cache handling ************************************************************************/ // Hold the DOM cache (if any) used with this translet private DOMCache _domCache = null; /** * Sets the DOM cache used for additional documents loaded using the * document() function. */ public void setDOMCache(DOMCache cache) { _domCache = cache; } /** * Returns the DOM cache used for this translet. Used by the LoadDocument * class (if present) when the document() function is used. */ public DOMCache getDOMCache() { return(_domCache); } /************************************************************************ * Multiple output document extension. * See compiler/TransletOutput for actual implementation. ************************************************************************/ public SerializationHandler openOutputHandler(String filename, boolean append) throws TransletException { try { final TransletOutputHandlerFactory factory = TransletOutputHandlerFactory.newInstance(); String dirStr = new File(filename).getParent(); if ((null != dirStr) && (dirStr.length() > 0)) { File dir = new File(dirStr); dir.mkdirs(); } factory.setEncoding(_encoding); factory.setOutputMethod(_method); factory.setWriter(new FileWriter(filename, append)); factory.setOutputType(TransletOutputHandlerFactory.STREAM); final SerializationHandler handler = factory.getSerializationHandler(); transferOutputSettings(handler); handler.startDocument(); return handler; } catch (Exception e) { throw new TransletException(e); } } public SerializationHandler openOutputHandler(String filename) throws TransletException { return openOutputHandler(filename, false); } public void closeOutputHandler(SerializationHandler handler) { try { handler.endDocument(); handler.close(); } catch (Exception e) { // what can you do? } } /************************************************************************ * Native API transformation methods - _NOT_ JAXP/TrAX ************************************************************************/ /** * Main transform() method - this is overridden by the compiled translet */ public abstract void transform(DOM document, DTMAxisIterator iterator, SerializationHandler handler) throws TransletException; /** * Calls transform() with a given output handler */ public final void transform(DOM document, SerializationHandler handler) throws TransletException { try { transform(document, document.getIterator(), handler); } finally { _keyIndexes = null; } } /** * Used by some compiled code as a shortcut for passing strings to the * output handler */ public final void characters(final String string, SerializationHandler handler) throws TransletException { if (string != null) { //final int length = string.length(); try { handler.characters(string); } catch (Exception e) { throw new TransletException(e); } } } /** * Add's a name of an element whose text contents should be output as CDATA */ public void addCdataElement(String name) { if (_cdata == null) { _cdata = new Vector(); } int lastColon = name.lastIndexOf(':'); if (lastColon > 0) { String uri = name.substring(0, lastColon); String localName = name.substring(lastColon+1); _cdata.addElement(uri); _cdata.addElement(localName); } else { _cdata.addElement(null); _cdata.addElement(name); } } /** * Transfer the output settings to the output post-processor */ protected void transferOutputSettings(SerializationHandler handler) { if (_method != null) { if (_method.equals("xml")) { if (_standalone != null) { handler.setStandalone(_standalone); } if (_omitHeader) { handler.setOmitXMLDeclaration(true); } handler.setCdataSectionElements(_cdata); if (_version != null) { handler.setVersion(_version); } handler.setIndent(_indent); handler.setIndentAmount(_indentamount); if (_doctypeSystem != null) { handler.setDoctype(_doctypeSystem, _doctypePublic); } } else if (_method.equals("html")) { handler.setIndent(_indent); handler.setDoctype(_doctypeSystem, _doctypePublic); if (_mediaType != null) { handler.setMediaType(_mediaType); } } } else { handler.setCdataSectionElements(_cdata); if (_version != null) { handler.setVersion(_version); } if (_standalone != null) { handler.setStandalone(_standalone); } if (_omitHeader) { handler.setOmitXMLDeclaration(true); } handler.setIndent(_indent); handler.setDoctype(_doctypeSystem, _doctypePublic); } } private Hashtable _auxClasses = null; public void addAuxiliaryClass(Class auxClass) { if (_auxClasses == null) _auxClasses = new Hashtable(); _auxClasses.put(auxClass.getName(), auxClass); } public void setAuxiliaryClasses(Hashtable auxClasses) { _auxClasses = auxClasses; } public Class getAuxiliaryClass(String className) { if (_auxClasses == null) return null; return((Class)_auxClasses.get(className)); } // GTM added (see pg 110) public String[] getNamesArray() { return namesArray; } public String[] getUrisArray() { return urisArray; } public int[] getTypesArray() { return typesArray; } public String[] getNamespaceArray() { return namespaceArray; } public boolean hasIdCall() { return _hasIdCall; } public Templates getTemplates() { return _templates; } public void setTemplates(Templates templates) { _templates = templates; } /************************************************************************ * DOMImplementation caching for basis library ************************************************************************/ protected DOMImplementation _domImplementation = null; public Document newDocument(String uri, String qname) throws ParserConfigurationException { if (_domImplementation == null) { _domImplementation = DocumentBuilderFactory.newInstance() .newDocumentBuilder().getDOMImplementation(); } return _domImplementation.createDocument(uri, qname, null); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_ru.java0000644000175000017500000004273010721374031026160 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ru.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ru extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 ''{0}'' \u0432 ''{1}''. "}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "\u0412\u043d\u0435\u0448\u043d\u044f\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ''{0}'' \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f XSLTC. "}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 ''{0}'' \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e ''{0}'' \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 ''{1}''. "}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 ''{0}''. "}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "\u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u043e\u0441\u0438 ''{0}'' \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. "}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "\u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043e\u0441\u0438 ''{0}'' \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 ''{0}'' \u0432\u043d\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. "}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d ''{0}''=''{1}'' \u0432\u043d\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. "}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 ''{0}'' \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e. "}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e DOM."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 SAX \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 SAX \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 URI ''{0}''. "}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 XSL ''{0}'' "}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 XSLTC ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f ''{0}'' \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 XSLTC, \u0447\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u044f XSLTC. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e XSLTC. "}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "\u0412 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 QName, \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "\u0412 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NCName, \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ''{0}'' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true. "}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ''{0}'' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true. "}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages.java0000644000175000017500000002762210721374032025456 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Run-time internal error in ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Run-time error when executing ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Invalid conversion from ''{0}'' to ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "External function ''{0}'' not supported by XSLTC."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Unknown argument type in equality expression."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Invalid argument type ''{0}'' in call to ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Attempting to format number ''{0}'' using pattern ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Cannot clone iterator ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iterator for axis ''{0}'' not supported."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iterator for typed axis ''{0}'' not supported."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Attribute ''{0}'' outside of element."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Namespace declaration ''{0}''=''{1}'' outside of element."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "Namespace for prefix ''{0}'' has not been declared."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter created using wrong type of source DOM."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "The SAX parser you are using does not handle DTD declaration events."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "The SAX parser you are using does not have support for XML Namespaces."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Could not resolve the URI reference ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Unsupported XSL element ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Unrecognized XSLTC extension ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "The specified translet, ''{0}'', was created using a version of XSLTC more recent than the version of the XSLTC run-time that is in use. You must recompile the stylesheet or use a more recent version of XSLTC to run this translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "An attribute whose value must be a QName had the value ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "An attribute whose value must be an NCName had the value ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "Use of the extension function ''{0}'' is not allowed when the secure processing feature is set to true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "Use of the extension element ''{0}'' is not allowed when the secure processing feature is set to true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_fr.java0000644000175000017500000003066710721374033026151 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_fr.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_fr extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Erreur interne d''ex\u00e9cution dans ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Erreur d'ex\u00e9cution de ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Conversion non valide de ''{0}'' en ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Fonction externe ''{0}'' non prise en charge par XSLTC."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Type d'argument inconnu dans l'expression d'\u00e9galit\u00e9."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Type d''argument non valide ''{0}'' lors de l''appel de ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Tentative de formatage du nombre ''{0}'' \u00e0 l''aide du motif ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Clonage impossible de l''it\u00e9rateur ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "It\u00e9rateur de l''axe ''{0}'' non pris en charge."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "It\u00e9rateur de l''axe indiqu\u00e9 ''{0}'' non pris en charge."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "L''attribut ''{0}'' est \u00e0 l''ext\u00e9rieur de l''\u00e9l\u00e9ment."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "La d\u00e9claration d''espace de noms ''{0}''=''{1}'' est \u00e0 l''ext\u00e9rieur de l''\u00e9l\u00e9ment."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "L''espace de noms du pr\u00e9fixe ''{0}'' n''a pas \u00e9t\u00e9 d\u00e9clar\u00e9."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter a \u00e9t\u00e9 cr\u00e9\u00e9 avec un type incorrect de source de DOM."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "L'analyseur SAX que vous utilisez ne traite pas les \u00e9v\u00e9nements de d\u00e9claration DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "L'analyseur SAX que vous utilisez ne prend pas en charge les espaces de nom XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "R\u00e9solution impossible de la r\u00e9f\u00e9rence de l''URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "El\u00e9ment XSL non pris en charge ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Extension XSLTC non reconnue ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "La classe translet indiqu\u00e9e, ''{0}'', a \u00e9t\u00e9 cr\u00e9\u00e9e \u00e0 l''aide d''une version de XSLTC plus r\u00e9cente que la version de l''ex\u00e9cutable XSLTC utilis\u00e9e. Vous devez compiler \u00e0 nouveau la feuille de style ou utiliser une version plus r\u00e9cente pour ex\u00e9cuter la classe translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Un attribut dont la valeur doit \u00eatre un QName poss\u00e8de la valeur ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Un attribut dont la valeur doit \u00eatre un NCName poss\u00e8de la valeur ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "L''utilisation de la fonction d''extension ''{0}'' n''est pas admise lorsque la fonction de traitement s\u00e9curis\u00e9e a la valeur true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "L''utilisation de l''\u00e9l\u00e9ment d''extension ''{0}'' n''est pas admise lorsque la fonction de traitement s\u00e9curis\u00e9e a la valeur true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_zh.java0000644000175000017500000003147410721374032026157 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_zh.java 338081 2004-12-15 17:35:58Z jycli $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_zh extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "\u201c{0}\u201d\u4e2d\u51fa\u73b0\u8fd0\u884c\u65f6\u5185\u90e8\u9519\u8bef"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "\u5728\u6267\u884c \u65f6\u53d1\u751f\u8fd0\u884c\u65f6\u9519\u8bef\u3002"}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "\u4ece\u201c{0}\u201d\u5230\u201c{1}\u201d\u7684\u8f6c\u6362\u65e0\u6548\u3002"}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "XSLTC \u4e0d\u652f\u6301\u5916\u90e8\u51fd\u6570\u201c{0}\u201d\u3002"}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "\u7b49\u5f0f\u8868\u8fbe\u5f0f\u4e2d\u7684\u81ea\u53d8\u91cf\u7c7b\u578b\u672a\u77e5\u3002"}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "\u8c03\u7528\u201c{1}\u201d\u65f6\u4f7f\u7528\u7684\u53c2\u6570\u7c7b\u578b\u201c{0}\u201d\u65e0\u6548"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "\u8bd5\u56fe\u4f7f\u7528\u6a21\u5f0f\u201c{1}\u201d\u4e3a\u6570\u5b57\u201c{0}\u201d\u7f16\u6392\u683c\u5f0f\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "\u65e0\u6cd5\u514b\u9686\u8fed\u4ee3\u5668\u201c{0}\u201d\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "\u4e0d\u652f\u6301\u8f74\u201c{0}\u201d\u7684\u8fed\u4ee3\u5668\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "\u4e0d\u652f\u6301\u8f93\u5165\u7684\u8f74\u201c{0}\u201d\u7684\u8fed\u4ee3\u5668\u3002"}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "\u5c5e\u6027\u201c{0}\u201d\u5728\u5143\u7d20\u5916\u3002"}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "\u540d\u79f0\u7a7a\u95f4\u58f0\u660e\u201c{0}\u201d=\u201c{1}\u201d\u5728\u5143\u7d20\u5916\u3002"}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "\u5c1a\u672a\u58f0\u660e\u524d\u7f00\u201c{0}\u201d\u7684\u540d\u79f0\u7a7a\u95f4\u3002"}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "\u4f7f\u7528\u9519\u8bef\u7c7b\u578b\u7684\u6e90 DOM \u521b\u5efa\u4e86 DOMAdapter\u3002"}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "\u6b63\u5728\u4f7f\u7528\u7684 SAX \u89e3\u6790\u5668\u4e0d\u5904\u7406 DTD \u58f0\u660e\u4e8b\u4ef6\u3002"}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "\u6b63\u5728\u4f7f\u7528\u7684 SAX \u89e3\u6790\u5668\u4e0d\u652f\u6301 XML \u540d\u79f0\u7a7a\u95f4\u3002"}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "\u65e0\u6cd5\u89e3\u6790 URI \u5f15\u7528\u201c{0}\u201d\u3002"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "\u4e0d\u53d7\u652f\u6301\u7684 XSL \u5143\u7d20\u201c{0}\u201d"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "\u672a\u88ab\u8bc6\u522b\u7684 XSLTC \u6269\u5c55\u540d\u201c{0}\u201d"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "\u521b\u5efa\u6307\u5b9a\u7684 translet\u201c{0}\u201d\u65f6\uff0c\u4f7f\u7528\u7684 XSLTC \u7248\u672c\u6bd4\u6b63\u5728\u4f7f\u7528\u7684 XSLTC \u8fd0\u884c\u65f6\u7248\u672c\u66f4\u65b0\u3002\u60a8\u5fc5\u987b\u91cd\u65b0\u7f16\u8bd1\u6837\u5f0f\u8868\u6216\u4f7f\u7528\u66f4\u65b0\u7684 XSLTC \u7248\u672c\u6765\u8fd0\u884c\u6b64 translet\u3002"}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "\u503c\u5fc5\u987b\u4e3a QName \u7684\u5c5e\u6027\u5177\u6709\u503c\u201c{0}\u201d"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "\u503c\u5fc5\u987b\u4e3a NCName \u7684\u5c5e\u6027\u5177\u6709\u503c\u201c{0}\u201d"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "\u5f53\u5b89\u5168\u5904\u7406\u529f\u80fd\u8bbe\u7f6e\u4e3a true \u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6269\u5c55\u51fd\u6570\u201c{0}\u201d\u3002"}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "\u5f53\u5b89\u5168\u5904\u7406\u529f\u80fd\u8bbe\u7f6e\u4e3a true \u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6269\u5c55\u5143\u7d20\u201c{0}\u201d\u3002"}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_no.java0000644000175000017500000000532410721374033026146 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_no.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_no extends ListResourceBundle { // Disse feilmeldingene maa korrespondere med konstantene some er definert // nederst i kildekoden til BasisLibrary. /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Intern programfeil i ''{0}''"}, {BasisLibrary.RUN_TIME_COPY_ERR, "Programfeil under utf\u00f8ing av ."}, {BasisLibrary.DATA_CONVERSION_ERR, "Ugyldig konvertering av ''{0}'' fra ''{1}''."}, {BasisLibrary.EXTERNAL_FUNC_ERR, "Ekstern funksjon ''{0}'' er ikke st\u00f8ttet av XSLTC."}, {BasisLibrary.EQUALITY_EXPR_ERR, "Ugyldig argument i EQUALITY uttrykk."}, {BasisLibrary.INVALID_ARGUMENT_ERR, "Ugyldig argument ''{0}'' i kall til ''{1}''"}, {BasisLibrary.FORMAT_NUMBER_ERR, "Fors\u00f8k p\u00e5 \u00e5 formattere nummer ''{0}'' med ''{1}''."}, {BasisLibrary.ITERATOR_CLONE_ERR, "Kan ikke klone iterator ''{0}''."}, {BasisLibrary.AXIS_SUPPORT_ERR, "Iterator for axis ''{0}'' er ikke st\u00e8ttet."}, {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iterator for typet axis ''{0}'' er ikke st\u00e8ttet."}, {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Attributt ''{0}'' utenfor element."}, {BasisLibrary.STRAY_NAMESPACE_ERR, "Navnedeklarasjon ''{0}''=''{1}'' utenfor element."}, {BasisLibrary.NAMESPACE_PREFIX_ERR, "Prefix ''{0}'' er ikke deklartert."}, {BasisLibrary.DOM_ADAPTER_INIT_ERR, "Fors\u00f8k p\u00e5 \u00e5 instansiere DOMAdapter med feil type DOM."} }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_cs.java0000644000175000017500000003116410721374033026140 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_cs.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_cs extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Vnit\u0159n\u00ed b\u011bhov\u00e1 chyba ve t\u0159\u00edd\u011b ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Vnit\u0159n\u00ed b\u011bhov\u00e1 chyba p\u0159i prov\u00e1d\u011bn\u00ed funkce ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Neplatn\u00e1 konverze z typu ''{0}'' na typ ''{1}''. "}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "Extern\u00ed funkce ''{0}'' nen\u00ed produktem XSLTC podporov\u00e1na. "}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Nezn\u00e1m\u00fd typ argumentu ve v\u00fdrazu rovnosti."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Neplatn\u00fd argument typu ''{0}'' ve vol\u00e1n\u00ed funkce ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Pokus o zform\u00e1tov\u00e1n\u00ed \u010d\u00edsla ''{0}'' s pou\u017eit\u00edm vzorku ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Nelze klonovat iter\u00e1tor ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iter\u00e1tor pro osu ''{0}'' nen\u00ed podporov\u00e1n."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iter\u00e1tor pro typizovanou osu ''{0}'' nen\u00ed podporov\u00e1n."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Atribut ''{0}'' se nach\u00e1z\u00ed vn\u011b prvku."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Deklarace oboru n\u00e1zv\u016f ''{0}''=''{1}'' se nach\u00e1z\u00ed vn\u011b prvku."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "Obor n\u00e1zv\u016f pro p\u0159edponu ''{0}'' nebyl deklarov\u00e1n."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter byl vytvo\u0159en s pou\u017eit\u00edm chybn\u00e9ho typu zdroje DOM."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "Pou\u017eit\u00fd analyz\u00e1tor SAX nem\u016f\u017ee manipulovat s deklara\u010dn\u00edmi ud\u00e1lostmi DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "Pou\u017eit\u00fd analyz\u00e1tor SAX nem\u016f\u017ee podporovat obory n\u00e1zv\u016f pro XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Nelze p\u0159elo\u017eit odkaz na URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Nepodporovan\u00fd prvek XSL ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Nerozpoznan\u00e1 p\u0159\u00edpona XSLTC ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "Ur\u010den\u00fd translet ''{0}'' byl vytvo\u0159en pomoc\u00ed verze prost\u0159ed\u00ed XSLTC, kter\u00e1 je nov\u011bj\u0161\u00ed ne\u017e verze pou\u017e\u00edvan\u00e9ho b\u011bhov\u00e9ho prost\u0159ed\u00ed XSLTC. P\u0159edlohu se styly je t\u0159eba znovu zkompilovat nebo tento translet spustit v nov\u011bj\u0161\u00ed verzi prost\u0159ed\u00ed XSLTC."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Atribut, jeho\u017e hodnotou mus\u00ed b\u00fdt jm\u00e9no QName, m\u00e1 hodnotu ''{0}''. "}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Atribut, jeho\u017e hodnotou mus\u00ed b\u00fdt jm\u00e9no NCName, m\u00e1 hodnotu ''{0}''. "}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "Je-li funkce zabezpe\u010den\u00e9ho zpracov\u00e1n\u00ed nastavena na hodnotu true, nen\u00ed povoleno pou\u017eit\u00ed roz\u0161i\u0159uj\u00edc\u00ed funkce ''{0}''. "}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "Je-li funkce zabezpe\u010den\u00e9ho zpracov\u00e1n\u00ed nastavena na hodnotu true, nen\u00ed povoleno pou\u017eit\u00ed roz\u0161i\u0159uj\u00edc\u00edho prvku ''{0}''. "}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_sk.java0000644000175000017500000003073010721374031026144 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_sk.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_sk extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "V ''{0}'' sa vyskytla intern\u00e1 runtime chyba"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Chyba \u010dasu spustenia pri sp\u00fa\u0161\u0165an\u00ed ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Konverzia z ''{0}'' na ''{1}'' je neplatn\u00e1."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "XLTC nepodporuje extern\u00fa funkciu ''{0}''."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Nezn\u00e1my typ argumentu je v\u00fdrazom rovnosti."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Vo volan\u00ed do ''{1}'' je neplatn\u00fd typ argumentu ''{0}'' "}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Prebieha pokus o form\u00e1tovanie \u010d\u00edsla ''{0}'' pomocou vzoru ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Iter\u00e1tor ''{0}'' sa ned\u00e1 klonova\u0165."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iter\u00e1tor pre os ''{0}'' nie je podporovan\u00fd."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iter\u00e1tor pre zadan\u00fa os ''{0}'' nie je podporovan\u00fd."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Atrib\u00fat ''{0}'' je mimo prvku."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Deklar\u00e1cia n\u00e1zvov\u00e9ho priestoru ''{0}''=''{1}'' je mimo prvku."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "N\u00e1zvov\u00fd priestor pre predponu ''{0}'' nebol deklarovan\u00fd."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter bol vytvoren\u00fd pomocou nespr\u00e1vneho typu zdrojov\u00e9ho DOM."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "Analyz\u00e1tor SAX, ktor\u00fd pou\u017e\u00edvate, nesprac\u00fava udalosti deklar\u00e1cie DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "Analyz\u00e1tor SAX, ktor\u00fd pou\u017e\u00edvate, nem\u00e1 podporu pre n\u00e1zvov\u00e9 priestory XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Nebolo mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 odkaz na URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "XSL prvok ''{0}'' nie je podporovan\u00fd"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "XSLTC pr\u00edpona ''{0}'' nebola rozpoznan\u00e1"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "\u0160pecifikovan\u00fd translet ''{0}'' bol vytvoren\u00fd pomocou verzie XSLTC, ktor\u00e1 je nov\u0161ia ako verzia XSLTC runtime, ktor\u00fd sa pou\u017e\u00edva. Mus\u00edte prekompilova\u0165 defin\u00edcie \u0161t\u00fdlov (objekt stylesheet) alebo pou\u017ei\u0165 na spustenie tohto transletu nov\u0161iu verziu n\u00e1stroja XSLTC."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Atrib\u00fat, ktor\u00fd mus\u00ed ma\u0165 hodnotu QName, mal hodnotu ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Atrib\u00fat, ktor\u00fd mus\u00ed ma\u0165 hodnotu NCName, mal hodnotu ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "Pou\u017e\u00edvanie funkcie roz\u0161\u00edrenia ''{0}'' nie je povolen\u00e9, ke\u010f je funkcia bezpe\u010dn\u00e9ho spracovania nastaven\u00e1 na hodnotu true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "Pou\u017e\u00edvanie prvku roz\u0161\u00edrenia ''{0}'' nie je povolen\u00e9, ke\u010f je funkcia bezpe\u010dn\u00e9ho spracovania nastaven\u00e1 na hodnotu true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_zh_TW.java0000644000175000017500000003134410721374030026563 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_zh_TW.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_zh_TW extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "''{0}'' \u767c\u751f\u57f7\u884c\u6642\u671f\u5167\u90e8\u932f\u8aa4"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "\u57f7\u884c \u6642\uff0c\u767c\u751f\u57f7\u884c\u6642\u671f\u932f\u8aa4\u3002"}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "\u5f9e ''{0}'' \u6210\u70ba ''{1}'' \u7684\u8f49\u63db\u7121\u6548\u3002"}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "XSLTC \u4e0d\u652f\u63f4\u5916\u90e8\u51fd\u6578 ''{0}''\u3002"}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "\u76f8\u7b49\u8868\u793a\u5f0f\u4e2d\u5305\u542b\u4e0d\u660e\u7684\u5f15\u6578\u985e\u578b\u3002"}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "\u547c\u53eb ''{1}'' \u6240\u4f7f\u7528\u7684\u5f15\u6578\u985e\u578b ''{0}'' \u7121\u6548\u3002"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "\u5617\u8a66\u4f7f\u7528\u578b\u6a23 ''{1}'' \u683c\u5f0f\u5316\u6578\u5b57 ''{0}''\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "\u7121\u6cd5\u8907\u88fd\u91cd\u8907\u9805\u76ee ''{0}''\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "\u4e0d\u652f\u63f4\u8ef8 ''{0}'' \u7684\u91cd\u8907\u9805\u76ee\u3002"}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "\u4e0d\u652f\u63f4\u6240\u9375\u5165\u8ef8 ''{0}'' \u7684\u91cd\u8907\u9805\u76ee\u3002"}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "\u5c6c\u6027 ''{0}'' \u8d85\u51fa\u5143\u7d20\u5916\u3002"}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "\u540d\u7a31\u7a7a\u9593\u5ba3\u544a ''{0}''=''{1}'' \u8d85\u51fa\u5143\u7d20\u5916\u3002"}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "\u5b57\u9996 ''{0}'' \u7684\u540d\u7a31\u7a7a\u9593\u5c1a\u672a\u5ba3\u544a\u3002"}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "\u5efa\u7acb DOMAdapter \u6642\u4f7f\u7528\u7684\u539f\u59cb\u6a94 DOM \u985e\u578b\u932f\u8aa4\u3002"}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "\u60a8\u4f7f\u7528\u7684 SAX \u5256\u6790\u5668\u7121\u6cd5\u8655\u7406 DTD \u5ba3\u544a\u4e8b\u4ef6\u3002"}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "\u60a8\u4f7f\u7528\u7684 SAX \u5256\u6790\u5668\u4e0d\u652f\u63f4 XML \u540d\u7a31\u7a7a\u9593\u3002"}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "\u7121\u6cd5\u89e3\u6790 URI \u53c3\u7167 ''{0}''\u3002"}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "XSL \u5143\u7d20 ''{0}'' \u4e0d\u53d7\u652f\u63f4"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "XSLTC \u5ef6\u4f38\u9805\u76ee ''{0}'' \u7121\u6cd5\u8fa8\u8b58"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "\u6307\u5b9a\u7684 translet ''{0}'' \u662f\u4ee5\u6bd4\u4f7f\u7528\u4e2d XSLTC \u57f7\u884c\u6642\u671f\u7248\u672c\u66f4\u65b0\u7684 XSLTC \u7248\u672c\u6240\u5efa\u7acb\u3002\u60a8\u5fc5\u9808\u91cd\u65b0\u7de8\u8b6f\u6a23\u5f0f\u8868\u6216\u4f7f\u7528\u66f4\u65b0\u7684 XSLTC \u7248\u672c\u4f86\u57f7\u884c\u6b64 translet\u3002"}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "\u4e00\u500b\u503c\u5fc5\u9808\u662f QName \u7684\u5c6c\u6027\uff0c\u5177\u6709\u503c ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "\u4e00\u500b\u503c\u5fc5\u9808\u662f NCName \u7684\u5c6c\u6027\uff0c\u5177\u6709\u503c ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "\u7576\u5b89\u5168\u8655\u7406\u7279\u6027\u8a2d\u70ba true \u6642\uff0c\u4e0d\u63a5\u53d7\u4f7f\u7528\u5ef6\u4f38\u51fd\u6578 ''{0}''\u3002"}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "\u7576\u5b89\u5168\u8655\u7406\u7279\u6027\u8a2d\u70ba true \u6642\uff0c\u4e0d\u63a5\u53d7\u4f7f\u7528\u5ef6\u4f38\u5143\u7d20 ''{0}''\u3002"}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java0000644000175000017500000016024710721374030025262 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BasisLibrary.java 505310 2007-02-09 14:39:50Z zongaro $ */ package org.apache.xalan.xsltc.runtime; import java.text.DecimalFormat; import java.text.FieldPosition; import java.text.MessageFormat; import java.text.NumberFormat; import java.util.Locale; import java.util.ResourceBundle; import javax.xml.transform.dom.DOMSource; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.dom.AbsoluteIterator; import org.apache.xml.dtm.Axis; import org.apache.xalan.xsltc.dom.DOMAdapter; import org.apache.xalan.xsltc.dom.MultiDOM; import org.apache.xalan.xsltc.dom.SingletonIterator; import org.apache.xalan.xsltc.dom.StepIterator; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.DTMDefaultBase; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import org.apache.xml.serializer.NamespaceMappings; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.XML11Char; /** * Standard XSLT functions. All standard functions expect the current node * and the DOM as their last two arguments. */ public final class BasisLibrary { private final static String EMPTYSTRING = ""; /** * Standard function count(node-set) */ public static int countF(DTMAxisIterator iterator) { return(iterator.getLast()); } /** * Standard function position() * @deprecated This method exists only for backwards compatibility with old * translets. New code should not reference it. */ public static int positionF(DTMAxisIterator iterator) { return iterator.isReverse() ? iterator.getLast() - iterator.getPosition() + 1 : iterator.getPosition(); } /** * XSLT Standard function sum(node-set). * stringToDouble is inlined */ public static double sumF(DTMAxisIterator iterator, DOM dom) { try { double result = 0.0; int node; while ((node = iterator.next()) != DTMAxisIterator.END) { result += Double.parseDouble(dom.getStringValueX(node)); } return result; } catch (NumberFormatException e) { return Double.NaN; } } /** * XSLT Standard function string() */ public static String stringF(int node, DOM dom) { return dom.getStringValueX(node); } /** * XSLT Standard function string(value) */ public static String stringF(Object obj, DOM dom) { if (obj instanceof DTMAxisIterator) { return dom.getStringValueX(((DTMAxisIterator)obj).reset().next()); } else if (obj instanceof Node) { return dom.getStringValueX(((Node)obj).node); } else if (obj instanceof DOM) { return ((DOM)obj).getStringValue(); } else { return obj.toString(); } } /** * XSLT Standard function string(value) */ public static String stringF(Object obj, int node, DOM dom) { if (obj instanceof DTMAxisIterator) { return dom.getStringValueX(((DTMAxisIterator)obj).reset().next()); } else if (obj instanceof Node) { return dom.getStringValueX(((Node)obj).node); } else if (obj instanceof DOM) { // When the first argument is a DOM we want the whole // DOM and not just a single node - that would not make sense. //return ((DOM)obj).getStringValueX(node); return ((DOM)obj).getStringValue(); } else if (obj instanceof Double) { Double d = (Double)obj; final String result = d.toString(); final int length = result.length(); if ((result.charAt(length-2)=='.') && (result.charAt(length-1) == '0')) return result.substring(0, length-2); else return result; } else { if (obj != null) return obj.toString(); else return stringF(node, dom); } } /** * XSLT Standard function number() */ public static double numberF(int node, DOM dom) { return stringToReal(dom.getStringValueX(node)); } /** * XSLT Standard function number(value) */ public static double numberF(Object obj, DOM dom) { if (obj instanceof Double) { return ((Double) obj).doubleValue(); } else if (obj instanceof Integer) { return ((Integer) obj).doubleValue(); } else if (obj instanceof Boolean) { return ((Boolean) obj).booleanValue() ? 1.0 : 0.0; } else if (obj instanceof String) { return stringToReal((String) obj); } else if (obj instanceof DTMAxisIterator) { DTMAxisIterator iter = (DTMAxisIterator) obj; return stringToReal(dom.getStringValueX(iter.reset().next())); } else if (obj instanceof Node) { return stringToReal(dom.getStringValueX(((Node) obj).node)); } else if (obj instanceof DOM) { return stringToReal(((DOM) obj).getStringValue()); } else { final String className = obj.getClass().getName(); runTimeError(INVALID_ARGUMENT_ERR, className, "number()"); return 0.0; } } /** * XSLT Standard function round() */ public static double roundF(double d) { return (d<-0.5 || d>0.0)?Math.floor(d+0.5):((d==0.0)? d:(Double.isNaN(d)?Double.NaN:-0.0)); } /** * XSLT Standard function boolean() */ public static boolean booleanF(Object obj) { if (obj instanceof Double) { final double temp = ((Double) obj).doubleValue(); return temp != 0.0 && !Double.isNaN(temp); } else if (obj instanceof Integer) { return ((Integer) obj).doubleValue() != 0; } else if (obj instanceof Boolean) { return ((Boolean) obj).booleanValue(); } else if (obj instanceof String) { return !((String) obj).equals(EMPTYSTRING); } else if (obj instanceof DTMAxisIterator) { DTMAxisIterator iter = (DTMAxisIterator) obj; return iter.reset().next() != DTMAxisIterator.END; } else if (obj instanceof Node) { return true; } else if (obj instanceof DOM) { String temp = ((DOM) obj).getStringValue(); return !temp.equals(EMPTYSTRING); } else { final String className = obj.getClass().getName(); runTimeError(INVALID_ARGUMENT_ERR, className, "boolean()"); } return false; } /** * XSLT Standard function substring(). Must take a double because of * conversions resulting into NaNs and rounding. */ public static String substringF(String value, double start) { try { final int strlen = value.length(); int istart = (int)Math.round(start) - 1; if (Double.isNaN(start)) return(EMPTYSTRING); if (istart > strlen) return(EMPTYSTRING); if (istart < 1) istart = 0; return value.substring(istart); } catch (IndexOutOfBoundsException e) { runTimeError(RUN_TIME_INTERNAL_ERR, "substring()"); return null; } } /** * XSLT Standard function substring(). Must take a double because of * conversions resulting into NaNs and rounding. */ public static String substringF(String value, double start, double length) { try { final int strlen = value.length(); int istart = (int)Math.round(start) - 1; int isum = istart + (int)Math.round(length); if (Double.isInfinite(length)) isum = Integer.MAX_VALUE; if (Double.isNaN(start) || Double.isNaN(length)) return(EMPTYSTRING); if (Double.isInfinite(start)) return(EMPTYSTRING); if (istart > strlen) return(EMPTYSTRING); if (isum < 0) return(EMPTYSTRING); if (istart < 0) istart = 0; if (isum > strlen) return value.substring(istart); else return value.substring(istart, isum); } catch (IndexOutOfBoundsException e) { runTimeError(RUN_TIME_INTERNAL_ERR, "substring()"); return null; } } /** * XSLT Standard function substring-after(). */ public static String substring_afterF(String value, String substring) { final int index = value.indexOf(substring); if (index >= 0) return value.substring(index + substring.length()); else return EMPTYSTRING; } /** * XSLT Standard function substring-before(). */ public static String substring_beforeF(String value, String substring) { final int index = value.indexOf(substring); if (index >= 0) return value.substring(0, index); else return EMPTYSTRING; } /** * XSLT Standard function translate(). */ public static String translateF(String value, String from, String to) { final int tol = to.length(); final int froml = from.length(); final int valuel = value.length(); final StringBuffer result = new StringBuffer(); for (int j, i = 0; i < valuel; i++) { final char ch = value.charAt(i); for (j = 0; j < froml; j++) { if (ch == from.charAt(j)) { if (j < tol) result.append(to.charAt(j)); break; } } if (j == froml) result.append(ch); } return result.toString(); } /** * XSLT Standard function normalize-space(). */ public static String normalize_spaceF(int node, DOM dom) { return normalize_spaceF(dom.getStringValueX(node)); } /** * XSLT Standard function normalize-space(string). */ public static String normalize_spaceF(String value) { int i = 0, n = value.length(); StringBuffer result = new StringBuffer(); while (i < n && isWhiteSpace(value.charAt(i))) i++; while (true) { while (i < n && !isWhiteSpace(value.charAt(i))) { result.append(value.charAt(i++)); } if (i == n) break; while (i < n && isWhiteSpace(value.charAt(i))) { i++; } if (i < n) result.append(' '); } return result.toString(); } /** * XSLT Standard function generate-id(). */ public static String generate_idF(int node) { if (node > 0) // Only generate ID if node exists return "N" + node; else // Otherwise return an empty string return EMPTYSTRING; } /** * utility function for calls to local-name(). */ public static String getLocalName(String value) { int idx = value.lastIndexOf(':'); if (idx >= 0) value = value.substring(idx + 1); idx = value.lastIndexOf('@'); if (idx >= 0) value = value.substring(idx + 1); return(value); } /** * External functions that cannot be resolved are replaced with a call * to this method. This method will generate a runtime errors. A good * stylesheet checks whether the function exists using conditional * constructs, and never really tries to call it if it doesn't exist. * But simple stylesheets may result in a call to this method. * The compiler should generate a warning if it encounters a call to * an unresolved external function. */ public static void unresolved_externalF(String name) { runTimeError(EXTERNAL_FUNC_ERR, name); } /** * Utility function to throw a runtime error on the use of an extension * function when the secure processing feature is set to true. */ public static void unallowed_extension_functionF(String name) { runTimeError(UNALLOWED_EXTENSION_FUNCTION_ERR, name); } /** * Utility function to throw a runtime error on the use of an extension * element when the secure processing feature is set to true. */ public static void unallowed_extension_elementF(String name) { runTimeError(UNALLOWED_EXTENSION_ELEMENT_ERR, name); } /** * Utility function to throw a runtime error for an unsupported element. * * This is only used in forward-compatibility mode, when the control flow * cannot be determined. In 1.0 mode, the error message is emitted at * compile time. */ public static void unsupported_ElementF(String qname, boolean isExtension) { if (isExtension) runTimeError(UNSUPPORTED_EXT_ERR, qname); else runTimeError(UNSUPPORTED_XSL_ERR, qname); } /** * XSLT Standard function namespace-uri(node-set). */ public static String namespace_uriF(DTMAxisIterator iter, DOM dom) { return namespace_uriF(iter.next(), dom); } /** * XSLT Standard function system-property(name) */ public static String system_propertyF(String name) { if (name.equals("xsl:version")) return("1.0"); if (name.equals("xsl:vendor")) return("Apache Software Foundation (Xalan XSLTC)"); if (name.equals("xsl:vendor-url")) return("http://xml.apache.org/xalan-j"); runTimeError(INVALID_ARGUMENT_ERR, name, "system-property()"); return(EMPTYSTRING); } /** * XSLT Standard function namespace-uri(). */ public static String namespace_uriF(int node, DOM dom) { final String value = dom.getNodeName(node); final int colon = value.lastIndexOf(':'); if (colon >= 0) return value.substring(0, colon); else return EMPTYSTRING; } /** * Implements the object-type() extension function. * * @see EXSLT */ public static String objectTypeF(Object obj) { if (obj instanceof String) return "string"; else if (obj instanceof Boolean) return "boolean"; else if (obj instanceof Number) return "number"; else if (obj instanceof DOM) return "RTF"; else if (obj instanceof DTMAxisIterator) return "node-set"; else return "unknown"; } /** * Implements the nodeset() extension function. */ public static DTMAxisIterator nodesetF(Object obj) { if (obj instanceof DOM) { //final DOMAdapter adapter = (DOMAdapter) obj; final DOM dom = (DOM)obj; return new SingletonIterator(dom.getDocument(), true); } else if (obj instanceof DTMAxisIterator) { return (DTMAxisIterator) obj; } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, "node-set", className); return null; } } //-- Begin utility functions private static boolean isWhiteSpace(char ch) { return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'; } private static boolean compareStrings(String lstring, String rstring, int op, DOM dom) { switch (op) { case Operators.EQ: return lstring.equals(rstring); case Operators.NE: return !lstring.equals(rstring); case Operators.GT: return numberF(lstring, dom) > numberF(rstring, dom); case Operators.LT: return numberF(lstring, dom) < numberF(rstring, dom); case Operators.GE: return numberF(lstring, dom) >= numberF(rstring, dom); case Operators.LE: return numberF(lstring, dom) <= numberF(rstring, dom); default: runTimeError(RUN_TIME_INTERNAL_ERR, "compare()"); return false; } } /** * Utility function: node-set/node-set compare. */ public static boolean compare(DTMAxisIterator left, DTMAxisIterator right, int op, DOM dom) { int lnode; left.reset(); while ((lnode = left.next()) != DTMAxisIterator.END) { final String lvalue = dom.getStringValueX(lnode); int rnode; right.reset(); while ((rnode = right.next()) != DTMAxisIterator.END) { // String value must be the same if both nodes are the same if (lnode == rnode) { if (op == Operators.EQ) { return true; } else if (op == Operators.NE) { continue; } } if (compareStrings(lvalue, dom.getStringValueX(rnode), op, dom)) { return true; } } } return false; } public static boolean compare(int node, DTMAxisIterator iterator, int op, DOM dom) { //iterator.reset(); int rnode; String value; switch(op) { case Operators.EQ: rnode = iterator.next(); if (rnode != DTMAxisIterator.END) { value = dom.getStringValueX(node); do { if (node == rnode || value.equals(dom.getStringValueX(rnode))) { return true; } } while ((rnode = iterator.next()) != DTMAxisIterator.END); } break; case Operators.NE: rnode = iterator.next(); if (rnode != DTMAxisIterator.END) { value = dom.getStringValueX(node); do { if (node != rnode && !value.equals(dom.getStringValueX(rnode))) { return true; } } while ((rnode = iterator.next()) != DTMAxisIterator.END); } break; case Operators.LT: // Assume we're comparing document order here while ((rnode = iterator.next()) != DTMAxisIterator.END) { if (rnode > node) return true; } break; case Operators.GT: // Assume we're comparing document order here while ((rnode = iterator.next()) != DTMAxisIterator.END) { if (rnode < node) return true; } break; } return(false); } /** * Utility function: node-set/number compare. */ public static boolean compare(DTMAxisIterator left, final double rnumber, final int op, DOM dom) { int node; //left.reset(); switch (op) { case Operators.EQ: while ((node = left.next()) != DTMAxisIterator.END) { if (numberF(dom.getStringValueX(node), dom) == rnumber) return true; } break; case Operators.NE: while ((node = left.next()) != DTMAxisIterator.END) { if (numberF(dom.getStringValueX(node), dom) != rnumber) return true; } break; case Operators.GT: while ((node = left.next()) != DTMAxisIterator.END) { if (numberF(dom.getStringValueX(node), dom) > rnumber) return true; } break; case Operators.LT: while ((node = left.next()) != DTMAxisIterator.END) { if (numberF(dom.getStringValueX(node), dom) < rnumber) return true; } break; case Operators.GE: while ((node = left.next()) != DTMAxisIterator.END) { if (numberF(dom.getStringValueX(node), dom) >= rnumber) return true; } break; case Operators.LE: while ((node = left.next()) != DTMAxisIterator.END) { if (numberF(dom.getStringValueX(node), dom) <= rnumber) return true; } break; default: runTimeError(RUN_TIME_INTERNAL_ERR, "compare()"); } return false; } /** * Utility function: node-set/string comparison. */ public static boolean compare(DTMAxisIterator left, final String rstring, int op, DOM dom) { int node; //left.reset(); while ((node = left.next()) != DTMAxisIterator.END) { if (compareStrings(dom.getStringValueX(node), rstring, op, dom)) { return true; } } return false; } public static boolean compare(Object left, Object right, int op, DOM dom) { boolean result = false; boolean hasSimpleArgs = hasSimpleType(left) && hasSimpleType(right); if (op != Operators.EQ && op != Operators.NE) { // If node-boolean comparison -> convert node to boolean if (left instanceof Node || right instanceof Node) { if (left instanceof Boolean) { right = new Boolean(booleanF(right)); hasSimpleArgs = true; } if (right instanceof Boolean) { left = new Boolean(booleanF(left)); hasSimpleArgs = true; } } if (hasSimpleArgs) { switch (op) { case Operators.GT: return numberF(left, dom) > numberF(right, dom); case Operators.LT: return numberF(left, dom) < numberF(right, dom); case Operators.GE: return numberF(left, dom) >= numberF(right, dom); case Operators.LE: return numberF(left, dom) <= numberF(right, dom); default: runTimeError(RUN_TIME_INTERNAL_ERR, "compare()"); } } // falls through } if (hasSimpleArgs) { if (left instanceof Boolean || right instanceof Boolean) { result = booleanF(left) == booleanF(right); } else if (left instanceof Double || right instanceof Double || left instanceof Integer || right instanceof Integer) { result = numberF(left, dom) == numberF(right, dom); } else { // compare them as strings result = stringF(left, dom).equals(stringF(right, dom)); } if (op == Operators.NE) { result = !result; } } else { if (left instanceof Node) { left = new SingletonIterator(((Node)left).node); } if (right instanceof Node) { right = new SingletonIterator(((Node)right).node); } if (hasSimpleType(left) || left instanceof DOM && right instanceof DTMAxisIterator) { // swap operands and operator final Object temp = right; right = left; left = temp; op = Operators.swapOp(op); } if (left instanceof DOM) { if (right instanceof Boolean) { result = ((Boolean)right).booleanValue(); return result == (op == Operators.EQ); } final String sleft = ((DOM)left).getStringValue(); if (right instanceof Number) { result = ((Number)right).doubleValue() == stringToReal(sleft); } else if (right instanceof String) { result = sleft.equals((String)right); } else if (right instanceof DOM) { result = sleft.equals(((DOM)right).getStringValue()); } if (op == Operators.NE) { result = !result; } return result; } // Next, node-set/t for t in {real, string, node-set, result-tree} DTMAxisIterator iter = ((DTMAxisIterator)left).reset(); if (right instanceof DTMAxisIterator) { result = compare(iter, (DTMAxisIterator)right, op, dom); } else if (right instanceof String) { result = compare(iter, (String)right, op, dom); } else if (right instanceof Number) { final double temp = ((Number)right).doubleValue(); result = compare(iter, temp, op, dom); } else if (right instanceof Boolean) { boolean temp = ((Boolean)right).booleanValue(); result = (iter.reset().next() != DTMAxisIterator.END) == temp; } else if (right instanceof DOM) { result = compare(iter, ((DOM)right).getStringValue(), op, dom); } else if (right == null) { return(false); } else { final String className = right.getClass().getName(); runTimeError(INVALID_ARGUMENT_ERR, className, "compare()"); } } return result; } /** * Utility function: used to test context node's language */ public static boolean testLanguage(String testLang, DOM dom, int node) { // language for context node (if any) String nodeLang = dom.getLanguage(node); if (nodeLang == null) return(false); else nodeLang = nodeLang.toLowerCase(); // compare context node's language agains test language testLang = testLang.toLowerCase(); if (testLang.length() == 2) { return(nodeLang.startsWith(testLang)); } else { return(nodeLang.equals(testLang)); } } private static boolean hasSimpleType(Object obj) { return obj instanceof Boolean || obj instanceof Double || obj instanceof Integer || obj instanceof String || obj instanceof Node || obj instanceof DOM; } /** * Utility function: used in StringType to convert a string to a real. */ public static double stringToReal(String s) { try { return Double.valueOf(s).doubleValue(); } catch (NumberFormatException e) { return Double.NaN; } } /** * Utility function: used in StringType to convert a string to an int. */ public static int stringToInt(String s) { try { return Integer.parseInt(s); } catch (NumberFormatException e) { return(-1); // ??? } } private static final int DOUBLE_FRACTION_DIGITS = 340; private static final double lowerBounds = 0.001; private static final double upperBounds = 10000000; private static DecimalFormat defaultFormatter; private static String defaultPattern = ""; static { NumberFormat f = NumberFormat.getInstance(Locale.getDefault()); defaultFormatter = (f instanceof DecimalFormat) ? (DecimalFormat) f : new DecimalFormat(); // Set max fraction digits so that truncation does not occur. Setting // the max to Integer.MAX_VALUE may cause problems with some JDK's. defaultFormatter.setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS); defaultFormatter.setMinimumFractionDigits(0); defaultFormatter.setMinimumIntegerDigits(1); defaultFormatter.setGroupingUsed(false); } /** * Utility function: used in RealType to convert a real to a string. * Removes the decimal if null. */ public static String realToString(double d) { final double m = Math.abs(d); if ((m >= lowerBounds) && (m < upperBounds)) { final String result = Double.toString(d); final int length = result.length(); // Remove leading zeros. if ((result.charAt(length-2) == '.') && (result.charAt(length-1) == '0')) return result.substring(0, length-2); else return result; } else { if (Double.isNaN(d) || Double.isInfinite(d)) return(Double.toString(d)); return formatNumber(d, defaultPattern, defaultFormatter); } } /** * Utility function: used in RealType to convert a real to an integer */ public static int realToInt(double d) { return (int)d; } /** * Utility function: used to format/adjust a double to a string. The * DecimalFormat object comes from the 'formatSymbols' hashtable in * AbstractTranslet. */ private static FieldPosition _fieldPosition = new FieldPosition(0); public static String formatNumber(double number, String pattern, DecimalFormat formatter) { // bugzilla fix 12813 if (formatter == null) { formatter = defaultFormatter; } try { StringBuffer result = new StringBuffer(); if (pattern != defaultPattern) { formatter.applyLocalizedPattern(pattern); } formatter.format(number, result, _fieldPosition); return result.toString(); } catch (IllegalArgumentException e) { runTimeError(FORMAT_NUMBER_ERR, Double.toString(number), pattern); return(EMPTYSTRING); } } /** * Utility function: used to convert references to node-sets. If the * obj is an instanceof Node then create a singleton iterator. */ public static DTMAxisIterator referenceToNodeSet(Object obj) { // Convert var/param -> node if (obj instanceof Node) { return(new SingletonIterator(((Node)obj).node)); } // Convert var/param -> node-set else if (obj instanceof DTMAxisIterator) { return(((DTMAxisIterator)obj).cloneIterator().reset()); } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, "node-set"); return null; } } /** * Utility function: used to convert reference to org.w3c.dom.NodeList. */ public static NodeList referenceToNodeList(Object obj, DOM dom) { if (obj instanceof Node || obj instanceof DTMAxisIterator) { DTMAxisIterator iter = referenceToNodeSet(obj); return dom.makeNodeList(iter); } else if (obj instanceof DOM) { dom = (DOM)obj; return dom.makeNodeList(DTMDefaultBase.ROOTNODE); } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, "org.w3c.dom.NodeList"); return null; } } /** * Utility function: used to convert reference to org.w3c.dom.Node. */ public static org.w3c.dom.Node referenceToNode(Object obj, DOM dom) { if (obj instanceof Node || obj instanceof DTMAxisIterator) { DTMAxisIterator iter = referenceToNodeSet(obj); return dom.makeNode(iter); } else if (obj instanceof DOM) { dom = (DOM)obj; DTMAxisIterator iter = dom.getChildren(DTMDefaultBase.ROOTNODE); return dom.makeNode(iter); } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, "org.w3c.dom.Node"); return null; } } /** * Utility function: used to convert reference to long. */ public static long referenceToLong(Object obj) { if (obj instanceof Number) { return ((Number) obj).longValue(); // handles Integer and Double } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, Long.TYPE); return 0; } } /** * Utility function: used to convert reference to double. */ public static double referenceToDouble(Object obj) { if (obj instanceof Number) { return ((Number) obj).doubleValue(); // handles Integer and Double } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, Double.TYPE); return 0; } } /** * Utility function: used to convert reference to boolean. */ public static boolean referenceToBoolean(Object obj) { if (obj instanceof Boolean) { return ((Boolean) obj).booleanValue(); } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, Boolean.TYPE); return false; } } /** * Utility function: used to convert reference to String. */ public static String referenceToString(Object obj, DOM dom) { if (obj instanceof String) { return (String) obj; } else if (obj instanceof DTMAxisIterator) { return dom.getStringValueX(((DTMAxisIterator)obj).reset().next()); } else if (obj instanceof Node) { return dom.getStringValueX(((Node)obj).node); } else if (obj instanceof DOM) { return ((DOM) obj).getStringValue(); } else { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, className, String.class); return null; } } /** * Utility function used to convert a w3c Node into an internal DOM iterator. */ public static DTMAxisIterator node2Iterator(org.w3c.dom.Node node, Translet translet, DOM dom) { final org.w3c.dom.Node inNode = node; // Create a dummy NodeList which only contains the given node to make // use of the nodeList2Iterator() interface. org.w3c.dom.NodeList nodelist = new org.w3c.dom.NodeList() { public int getLength() { return 1; } public org.w3c.dom.Node item(int index) { if (index == 0) return inNode; else return null; } }; return nodeList2Iterator(nodelist, translet, dom); } /** * Utility function used to copy a node list to be under a parent node. */ private static void copyNodes(org.w3c.dom.NodeList nodeList, org.w3c.dom.Document doc, org.w3c.dom.Node parent) { final int size = nodeList.getLength(); // copy Nodes from NodeList into new w3c DOM for (int i = 0; i < size; i++) { org.w3c.dom.Node curr = nodeList.item(i); int nodeType = curr.getNodeType(); String value = null; try { value = curr.getNodeValue(); } catch (DOMException ex) { runTimeError(RUN_TIME_INTERNAL_ERR, ex.getMessage()); return; } String nodeName = curr.getNodeName(); org.w3c.dom.Node newNode = null; switch (nodeType){ case org.w3c.dom.Node.ATTRIBUTE_NODE: newNode = doc.createAttributeNS(curr.getNamespaceURI(), nodeName); break; case org.w3c.dom.Node.CDATA_SECTION_NODE: newNode = doc.createCDATASection(value); break; case org.w3c.dom.Node.COMMENT_NODE: newNode = doc.createComment(value); break; case org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE: newNode = doc.createDocumentFragment(); break; case org.w3c.dom.Node.DOCUMENT_NODE: newNode = doc.createElementNS(null, "__document__"); copyNodes(curr.getChildNodes(), doc, newNode); break; case org.w3c.dom.Node.DOCUMENT_TYPE_NODE: // nothing? break; case org.w3c.dom.Node.ELEMENT_NODE: // For Element node, also copy the children and the // attributes. org.w3c.dom.Element element = doc.createElementNS( curr.getNamespaceURI(), nodeName); if (curr.hasAttributes()) { org.w3c.dom.NamedNodeMap attributes = curr.getAttributes(); for (int k = 0; k < attributes.getLength(); k++) { org.w3c.dom.Node attr = attributes.item(k); element.setAttributeNS(attr.getNamespaceURI(), attr.getNodeName(), attr.getNodeValue()); } } copyNodes(curr.getChildNodes(), doc, element); newNode = element; break; case org.w3c.dom.Node.ENTITY_NODE: // nothing ? break; case org.w3c.dom.Node.ENTITY_REFERENCE_NODE: newNode = doc.createEntityReference(nodeName); break; case org.w3c.dom.Node.NOTATION_NODE: // nothing ? break; case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE: newNode = doc.createProcessingInstruction(nodeName, value); break; case org.w3c.dom.Node.TEXT_NODE: newNode = doc.createTextNode(value); break; } try { parent.appendChild(newNode); } catch (DOMException e) { runTimeError(RUN_TIME_INTERNAL_ERR, e.getMessage()); return; } } } /** * Utility function used to convert a w3c NodeList into a internal * DOM iterator. */ public static DTMAxisIterator nodeList2Iterator( org.w3c.dom.NodeList nodeList, Translet translet, DOM dom) { // w3c NodeList -> w3c DOM Document doc = null; try { doc = ((AbstractTranslet) translet).newDocument("", "__top__"); } catch (javax.xml.parsers.ParserConfigurationException e) { runTimeError(RUN_TIME_INTERNAL_ERR, e.getMessage()); return null; } // Copy all the nodes in the nodelist to be under the top element copyNodes(nodeList, doc, doc.getDocumentElement()); // w3cDOM -> DTM -> DOMImpl if (dom instanceof MultiDOM) { final MultiDOM multiDOM = (MultiDOM) dom; DTMDefaultBase dtm = (DTMDefaultBase)((DOMAdapter)multiDOM.getMain()).getDOMImpl(); DTMManager dtmManager = dtm.getManager(); DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false, null, true, false); // Create DOMAdapter and register with MultiDOM DOMAdapter domAdapter = new DOMAdapter(idom, translet.getNamesArray(), translet.getUrisArray(), translet.getTypesArray(), translet.getNamespaceArray()); multiDOM.addDOMAdapter(domAdapter); DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD); DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD); DTMAxisIterator iter = new AbsoluteIterator( new StepIterator(iter1, iter2)); iter.setStartNode(DTMDefaultBase.ROOTNODE); return iter; } else { runTimeError(RUN_TIME_INTERNAL_ERR, "nodeList2Iterator()"); return null; } } /** * Utility function used to convert references to DOMs. */ public static DOM referenceToResultTree(Object obj) { try { return ((DOM) obj); } catch (IllegalArgumentException e) { final String className = obj.getClass().getName(); runTimeError(DATA_CONVERSION_ERR, "reference", className); return null; } } /** * Utility function: used with nth position filters to convert a sequence * of nodes to just one single node (the one at position n). */ public static DTMAxisIterator getSingleNode(DTMAxisIterator iterator) { int node = iterator.next(); return(new SingletonIterator(node)); } /** * Utility function: used in xsl:copy. */ private static char[] _characterArray = new char[32]; public static void copy(Object obj, SerializationHandler handler, int node, DOM dom) { try { if (obj instanceof DTMAxisIterator) { DTMAxisIterator iter = (DTMAxisIterator) obj; dom.copy(iter.reset(), handler); } else if (obj instanceof Node) { dom.copy(((Node) obj).node, handler); } else if (obj instanceof DOM) { //((DOM)obj).copy(((org.apache.xml.dtm.ref.DTMDefaultBase)((DOMAdapter)obj).getDOMImpl()).getDocument(), handler); DOM newDom = (DOM)obj; newDom.copy(newDom.getDocument(), handler); } else { String string = obj.toString(); // or call stringF() final int length = string.length(); if (length > _characterArray.length) _characterArray = new char[length]; string.getChars(0, length, _characterArray, 0); handler.characters(_characterArray, 0, length); } } catch (SAXException e) { runTimeError(RUN_TIME_COPY_ERR); } } /** * Utility function to check if xsl:attribute has a valid qname * This method should only be invoked if the name attribute is an AVT */ public static void checkAttribQName(String name) { final int firstOccur = name.indexOf(":"); final int lastOccur = name.lastIndexOf(":"); final String localName = name.substring(lastOccur + 1); if (firstOccur > 0) { final String newPrefix = name.substring(0, firstOccur); if (firstOccur != lastOccur) { final String oriPrefix = name.substring(firstOccur+1, lastOccur); if (!XML11Char.isXML11ValidNCName(oriPrefix)) { // even though the orignal prefix is ignored, it should still get checked for valid NCName runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName); } } // prefix must be a valid NCName if (!XML11Char.isXML11ValidNCName(newPrefix)) { runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName); } } // local name must be a valid NCName and must not be XMLNS if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) { runTimeError(INVALID_QNAME_ERR,localName); } } /** * Utility function to check if a name is a valid ncname * This method should only be invoked if the attribute value is an AVT */ public static void checkNCName(String name) { if (!XML11Char.isXML11ValidNCName(name)) { runTimeError(INVALID_NCNAME_ERR,name); } } /** * Utility function to check if a name is a valid qname * This method should only be invoked if the attribute value is an AVT */ public static void checkQName(String name) { if (!XML11Char.isXML11ValidQName(name)) { runTimeError(INVALID_QNAME_ERR,name); } } /** * Utility function for the implementation of xsl:element. */ public static String startXslElement(String qname, String namespace, SerializationHandler handler, DOM dom, int node) { try { // Get prefix from qname String prefix; final int index = qname.indexOf(':'); if (index > 0) { prefix = qname.substring(0, index); // Handle case when prefix is not known at compile time if (namespace == null || namespace.length() == 0) { runTimeError(NAMESPACE_PREFIX_ERR,prefix); } handler.startElement(namespace, qname.substring(index+1), qname); handler.namespaceAfterStartElement(prefix, namespace); } else { // Need to generate a prefix? if (namespace != null && namespace.length() > 0) { prefix = generatePrefix(); qname = prefix + ':' + qname; handler.startElement(namespace, qname, qname); handler.namespaceAfterStartElement(prefix, namespace); } else { handler.startElement(null, null, qname); } } } catch (SAXException e) { throw new RuntimeException(e.getMessage()); } return qname; } /** *

        Look up the namespace for a lexical QName using the namespace * declarations available at a particular location in the stylesheet.

        *

        See {@link org.apache.xalan.xsltc.compiler.Stylesheet#compileStaticInitializer(org.apache.xalan.xsltc.compiler.util.ClassGenerator)} * for more information about the ancestorNodeIDs, * prefixURIsIndex and prefixURIPairs * * @param lexicalQName The QName as a java.lang.String * @param stylesheetNodeID An int representing the element in * the stylesheet relative to which the namespace of * the lexical QName is to be determined * @param ancestorNodeIDs An int array, indexed by stylesheet * node IDs, containing the ID of the nearest ancestor * node in the stylesheet that has namespace * declarations, or -1 if there is no * such ancestor * @param prefixURIsIndex An int array, indexed by stylesheet * node IDs, containing the index into the * prefixURIPairs array of the first * prefix declared on that stylesheet node * @param prefixURIPairs A java.lang.String array that contains * pairs of * @param ignoreDefault A boolean indicating whether any * default namespace decarlation should be considered * @return The namespace of the lexical QName or a zero-length string if * the QName is in no namespace or no namespace declaration for the * prefix of the QName was found */ public static String lookupStylesheetQNameNamespace(String lexicalQName, int stylesheetNodeID, int[] ancestorNodeIDs, int[] prefixURIsIndex, String[] prefixURIPairs, boolean ignoreDefault) { String prefix = getPrefix(lexicalQName); String uri = ""; if (prefix == null && !ignoreDefault) { prefix = ""; } if (prefix != null) { // Loop from current node in the stylesheet to its ancestors nodeLoop: for (int currentNodeID = stylesheetNodeID; currentNodeID >= 0; currentNodeID = ancestorNodeIDs[currentNodeID]) { // Look at all declarations on the current stylesheet node // The prefixURIsIndex is an array of indices into the // prefixURIPairs array that are stored in ascending order. // The declarations for a node I are in elements // prefixURIsIndex[I] to prefixURIsIndex[I+1]-1 (or // prefixURIPairs.length-1 if I is the last node) int prefixStartIdx = prefixURIsIndex[currentNodeID]; int prefixLimitIdx = (currentNodeID+1 < prefixURIsIndex.length) ? prefixURIsIndex[currentNodeID + 1] : prefixURIPairs.length; for (int prefixIdx = prefixStartIdx; prefixIdx < prefixLimitIdx; prefixIdx = prefixIdx + 2) { // Did we find the declaration of our prefix if (prefix.equals(prefixURIPairs[prefixIdx])) { uri = prefixURIPairs[prefixIdx+1]; break nodeLoop; } } } } return uri; } /** *

        Look up the namespace for a lexical QName using the namespace * declarations available at a particular location in the stylesheet and * return the expanded QName

        *

        See {@link org.apache.xalan.xsltc.compiler.Stylesheet#compileStaticInitializer(org.apache.xalan.xsltc.compiler.util.ClassGenerator)} * for more information about the ancestorNodeIDs, * prefixURIsIndex and prefixURIPairs * * @param lexicalQName The QName as a java.lang.String * @param stylesheetNodeID An int representing the element in * the stylesheet relative to which the namespace of * the lexical QName is to be determined * @param ancestorNodeIDs An int array, indexed by stylesheet * node IDs, containing the ID of the nearest ancestor * node in the stylesheet that has namespace * declarations, or -1 if there is no * such ancestor * @param prefixURIsIndex An int array, indexed by stylesheet * node IDs, containing the index into the * prefixURIPairs array of the first * prefix declared on that stylesheet node * @param prefixURIPairs A java.lang.String array that contains * pairs of * @param ignoreDefault A boolean indicating whether any * default namespace decarlation should be considered * @return The expanded QName in the form "uri:localName" or just * "localName" if the QName is in no namespace or no namespace * declaration for the prefix of the QName was found */ public static String expandStylesheetQNameRef(String lexicalQName, int stylesheetNodeID, int[] ancestorNodeIDs, int[] prefixURIsIndex, String[] prefixURIPairs, boolean ignoreDefault) { String expandedQName; String prefix = getPrefix(lexicalQName); String localName = (prefix != null) ? lexicalQName.substring(prefix.length()+1) : lexicalQName; String uri = lookupStylesheetQNameNamespace(lexicalQName, stylesheetNodeID, ancestorNodeIDs, prefixURIsIndex, prefixURIPairs, ignoreDefault); // Handle case when prefix is not resolved if (prefix != null && prefix.length() != 0 && (uri == null || uri.length() == 0)) { runTimeError(NAMESPACE_PREFIX_ERR, prefix); } if (uri.length() == 0) { expandedQName = localName; } else { expandedQName = uri + ':' + localName; } return expandedQName; } /** * This function is used in the execution of xsl:element */ public static String getPrefix(String qname) { final int index = qname.indexOf(':'); return (index > 0) ? qname.substring(0, index) : null; } /** * This function is used in the execution of xsl:element */ private static int prefixIndex = 0; // not thread safe!! public static String generatePrefix() { return ("ns" + prefixIndex++); } public static final String RUN_TIME_INTERNAL_ERR = "RUN_TIME_INTERNAL_ERR"; public static final String RUN_TIME_COPY_ERR = "RUN_TIME_COPY_ERR"; public static final String DATA_CONVERSION_ERR = "DATA_CONVERSION_ERR"; public static final String EXTERNAL_FUNC_ERR = "EXTERNAL_FUNC_ERR"; public static final String EQUALITY_EXPR_ERR = "EQUALITY_EXPR_ERR"; public static final String INVALID_ARGUMENT_ERR = "INVALID_ARGUMENT_ERR"; public static final String FORMAT_NUMBER_ERR = "FORMAT_NUMBER_ERR"; public static final String ITERATOR_CLONE_ERR = "ITERATOR_CLONE_ERR"; public static final String AXIS_SUPPORT_ERR = "AXIS_SUPPORT_ERR"; public static final String TYPED_AXIS_SUPPORT_ERR = "TYPED_AXIS_SUPPORT_ERR"; public static final String STRAY_ATTRIBUTE_ERR = "STRAY_ATTRIBUTE_ERR"; public static final String STRAY_NAMESPACE_ERR = "STRAY_NAMESPACE_ERR"; public static final String NAMESPACE_PREFIX_ERR = "NAMESPACE_PREFIX_ERR"; public static final String DOM_ADAPTER_INIT_ERR = "DOM_ADAPTER_INIT_ERR"; public static final String PARSER_DTD_SUPPORT_ERR = "PARSER_DTD_SUPPORT_ERR"; public static final String NAMESPACES_SUPPORT_ERR = "NAMESPACES_SUPPORT_ERR"; public static final String CANT_RESOLVE_RELATIVE_URI_ERR = "CANT_RESOLVE_RELATIVE_URI_ERR"; public static final String UNSUPPORTED_XSL_ERR = "UNSUPPORTED_XSL_ERR"; public static final String UNSUPPORTED_EXT_ERR = "UNSUPPORTED_EXT_ERR"; public static final String UNKNOWN_TRANSLET_VERSION_ERR = "UNKNOWN_TRANSLET_VERSION_ERR"; public static final String INVALID_QNAME_ERR = "INVALID_QNAME_ERR"; public static final String INVALID_NCNAME_ERR = "INVALID_NCNAME_ERR"; public static final String UNALLOWED_EXTENSION_FUNCTION_ERR = "UNALLOWED_EXTENSION_FUNCTION_ERR"; public static final String UNALLOWED_EXTENSION_ELEMENT_ERR = "UNALLOWED_EXTENSION_ELEMENT_ERR"; // All error messages are localized and are stored in resource bundles. private static ResourceBundle m_bundle; public final static String ERROR_MESSAGES_KEY = "error-messages"; static { String resource = "org.apache.xalan.xsltc.runtime.ErrorMessages"; m_bundle = ResourceBundle.getBundle(resource); } /** * Print a run-time error message. */ public static void runTimeError(String code) { throw new RuntimeException(m_bundle.getString(code)); } public static void runTimeError(String code, Object[] args) { final String message = MessageFormat.format(m_bundle.getString(code), args); throw new RuntimeException(message); } public static void runTimeError(String code, Object arg0) { runTimeError(code, new Object[]{ arg0 } ); } public static void runTimeError(String code, Object arg0, Object arg1) { runTimeError(code, new Object[]{ arg0, arg1 } ); } public static void consoleOutput(String msg) { System.out.println(msg); } /** * Replace a certain character in a string with a new substring. */ public static String replace(String base, char ch, String str) { return (base.indexOf(ch) < 0) ? base : replace(base, String.valueOf(ch), new String[] { str }); } public static String replace(String base, String delim, String[] str) { final int len = base.length(); final StringBuffer result = new StringBuffer(); for (int i = 0; i < len; i++) { final char ch = base.charAt(i); final int k = delim.indexOf(ch); if (k >= 0) { result.append(str[k]); } else { result.append(ch); } } return result.toString(); } /** * Utility method to allow setting parameters of the form * {namespaceuri}localName * which get mapped to an instance variable in the class * Hence a parameter of the form "{http://foo.bar}xyz" * will be replaced with the corresponding values * by the BasisLibrary's utility method mapQNametoJavaName * and thus get mapped to legal java variable names */ public static String mapQNameToJavaName (String base ) { return replace(base, ".-:/{}?#%*", new String[] { "$dot$", "$dash$" ,"$colon$", "$slash$", "","$colon$","$ques$","$hash$","$per$", "$aster$"}); } //-- End utility functions } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/Node.java0000644000175000017500000000236610721374033023561 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Node.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; /** * This class is used as "wrapper" for dom nodes. Wrappers are needed when * a node is passed as a parameter to a template. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public class Node { public int node; public int type; public Node(int n, int t) { node = n; type = t; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_sl.java0000644000175000017500000003002310721374032026141 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_sl.java,v 1.11 2004/12/15 17:35:45 jycli Exp $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_sl extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "Notranja napaka izvajanja v ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Notranja napaka izvajanja pri izvajanju ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Neveljavna pretvorba iz ''{0}'' v ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "XSLTC ne podpira zunanje funkcije ''{0}''."}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "Neznan tip argumenta v izrazu enakovrednosti."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "Neveljavna vrsta argumenta ''{0}'' pri klicu na ''{1}''"}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "Pokus nastavitve formata \u0161tevilke ''{0}'' z uporabo vzorca ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "Iteratorja ''{0}'' ni mogo\u010de klonirati."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "Iterator za os ''{0}'' ni podprt."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "Iterator za tipizirano os ''{0}'' ni podprt."}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "Atribut ''{0}'' zunaj elementa."}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "Deklaracija imenskega prostora ''{0}''=''{1}'' je zunaj elementa."}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "Imenski prostor za predpono ''{0}'' ni bil naveden."}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter ustvarjen z uporabo napa\u010dnega tipa izvornega DOM."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "Uporabljeni raz\u010dlenjevalnik SAX ne obravnava dogodkov deklaracije DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "Uporabljeni raz\u010dlenjevalnik SAX ne podpira imenskih prostorov XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "Ni mogo\u010de razre\u0161iti sklica URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "Nepodprt XSL element ''{0}''"}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "Neprepoznana raz\u0161iritev XSLTC ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "Navedeni translet, ''{0}'', je bil ustvarjen z uporabo XSLTC novej\u0161e razli\u010dice, kot je trenutno uporabljana razli\u010dica izvajalnega okolja XSLTC. Slogovno datoteko morate ponovno prevesti ali pa uporabiti novej\u0161o razli\u010dico XSLTC-ja, da bi zagnali ta translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Atribut, katerega vrednost mora biti QName, je imel vrednost ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Atribut, katerega vrednost mora biti NCName, je imel vrednost ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "Uporaba raz\u0161iritvene funkcije ''{0}'' ni dovoljena, ko je funkcija varne obdelave nastavljena na True."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "Uporaba raz\u0161iritvene elementa ''{0}'' ni dovoljena, ko je funkcija varne obdelave nastavljena na True."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ObjectFactory.java0000644000175000017500000006377110721374033025441 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468652 2006-10-28 07:05:17Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -2293620736651286953L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/ErrorMessages_ca.java0000644000175000017500000003060010721374031026106 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ErrorMessages_ca.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; import java.util.ListResourceBundle; /** * @author Morten Jorgensen */ public class ErrorMessages_ca extends ListResourceBundle { /* * XSLTC run-time error messages. * * General notes to translators and definitions: * * 1) XSLTC is the name of the product. It is an acronym for XML Stylesheet: * Transformations Compiler * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant output XML document (or HTML document or text) * * 3) An axis is a particular "dimension" in a tree representation of an XML * document; the nodes in the tree are divided along different axes. * Traversing the "child" axis, for instance, means that the program * would visit each child of a particular node; traversing the "descendant" * axis means that the program would visit the child nodes of a particular * node, their children, and so on until the leaf nodes of the tree are * reached. * * 4) An iterator is an object that traverses nodes in a tree along a * particular axis, one at a time. * * 5) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 6) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 7) DOM is an acronym for Document Object Model. It is a tree * representation of an XML document. * * SAX is an acronym for the Simple API for XML processing. It is an API * used inform an XML processor (in this case XSLTC) of the structure and * content of an XML document. * * Input to the stylesheet processor can come from an XML parser in the * form of a DOM tree or through the SAX API. * * 8) DTD is a document type declaration. It is a way of specifying the * grammar for an XML file, the names and types of elements, attributes, * etc. * * 9) Translet is an invented term that refers to the class file that contains * the compiled form of a stylesheet. */ // These message should be read from a locale-specific resource bundle /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /* * Note to translators: the substitution text in the following message * is a class name. Used for internal errors in the processor. */ {BasisLibrary.RUN_TIME_INTERNAL_ERR, "S''ha produ\u00eft un error intern de temps d''execuci\u00f3 a ''{0}''"}, /* * Note to translators: is a keyword that should not be * translated. */ {BasisLibrary.RUN_TIME_COPY_ERR, "Es produeix un error de temps d'execuci\u00f3 en executar ."}, /* * Note to translators: The substitution text refers to data types. * The message is displayed if a value in a particular context needs to * be converted to type {1}, but that's not possible for a value of type * {0}. */ {BasisLibrary.DATA_CONVERSION_ERR, "Conversi\u00f3 no v\u00e0lida de ''{0}'' a ''{1}''."}, /* * Note to translators: This message is displayed if the function named * by the substitution text is not a function that is supported. XSLTC * is the acronym naming the product. */ {BasisLibrary.EXTERNAL_FUNC_ERR, "XSLTC no d\u00f3na suport a la funci\u00f3 externa ''{0}''. "}, /* * Note to translators: This message is displayed if two values are * compared for equality, but the data type of one of the values is * unknown. */ {BasisLibrary.EQUALITY_EXPR_ERR, "L'expressi\u00f3 d'igualtat cont\u00e9 un tipus d'argument desconegut."}, /* * Note to translators: The substitution text for {0} will be a data * type; the substitution text for {1} will be the name of a function. * This is displayed if an argument of the particular data type is not * permitted for a call to this function. */ {BasisLibrary.INVALID_ARGUMENT_ERR, "El tipus d''argument ''{0}'' a la crida de ''{1}'' no \u00e9s v\u00e0lid "}, /* * Note to translators: There is way of specifying a format for a * number using a pattern; the processor was unable to format the * particular value using the specified pattern. */ {BasisLibrary.FORMAT_NUMBER_ERR, "S''ha intentat formatar el n\u00famero ''{0}'' fent servir el patr\u00f3 ''{1}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor was unable to create a copy of an * iterator. (See definition of iterator above.) */ {BasisLibrary.ITERATOR_CLONE_ERR, "No es pot clonar l''iterador ''{0}''."}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.AXIS_SUPPORT_ERR, "No est\u00e0 suportat l''iterador de l''eix ''{0}''. "}, /* * Note to translators: The following represents an internal error * situation in XSLTC. The processor attempted to create an iterator * for a particular axis (see definition above) that it does not * support. */ {BasisLibrary.TYPED_AXIS_SUPPORT_ERR, "No est\u00e0 suportat l''iterador de l''eix escrit ''{0}''. "}, /* * Note to translators: This message is reported if the stylesheet * being processed attempted to construct an XML document with an * attribute in a place other than on an element. The substitution text * specifies the name of the attribute. */ {BasisLibrary.STRAY_ATTRIBUTE_ERR, "L''atribut ''{0}'' es troba fora de l''element. "}, /* * Note to translators: As with the preceding message, a namespace * declaration has the form of an attribute and is only permitted to * appear on an element. The substitution text {0} is the namespace * prefix and {1} is the URI that was being used in the erroneous * namespace declaration. */ {BasisLibrary.STRAY_NAMESPACE_ERR, "La declaraci\u00f3 de l''espai de noms ''{0}''=''{1}'' es troba fora de l''element. "}, /* * Note to translators: The stylesheet contained a reference to a * namespace prefix that was undefined. The value of the substitution * text is the name of the prefix. */ {BasisLibrary.NAMESPACE_PREFIX_ERR, "L''espai de noms del prefix ''{0}'' no s''ha declarat. "}, /* * Note to translators: The following represents an internal error. * DOMAdapter is a Java class in XSLTC. */ {BasisLibrary.DOM_ADAPTER_INIT_ERR, "DOMAdapter s'ha creat mitjan\u00e7ant un tipus incorrecte de DOM d'origen."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not describe to XSLTC the structure of the input XML document's * DTD. */ {BasisLibrary.PARSER_DTD_SUPPORT_ERR, "L'analitzador SAX que feu servir no gestiona esdeveniments de declaraci\u00f3 de DTD."}, /* * Note to translators: The following message indicates that the XML * parser that is providing input to XSLTC cannot be used because it * does not distinguish between ordinary XML attributes and namespace * declarations. */ {BasisLibrary.NAMESPACES_SUPPORT_ERR, "L'analitzador SAX que feu servir no d\u00f3na suport a espais de noms XML."}, /* * Note to translators: The substitution text is the URI that was in * error. */ {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR, "No s''ha pogut resoldre la refer\u00e8ncia d''URI ''{0}''."}, /* * Note to translators: The stylesheet contained an element that was * not recognized as part of the XSL syntax. The substitution text * gives the element name. */ {BasisLibrary.UNSUPPORTED_XSL_ERR, "L''element XSL ''{0}'' no t\u00e9 suport "}, /* * Note to translators: The stylesheet referred to an extension to the * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does * not recognize the particular extension named. The substitution text * gives the extension name. */ {BasisLibrary.UNSUPPORTED_EXT_ERR, "No es reconeix l''extensi\u00f3 XSLTC ''{0}''"}, /* * Note to translators: This error message is produced if the translet * class was compiled using a newer version of XSLTC and deployed for * execution with an older version of XSLTC. The substitution text is * the name of the translet class. */ {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR, "La classe translet especificada, ''{0}'', es va crear fent servir una versi\u00f3 d''XSLTC m\u00e9s recent que la versi\u00f3 del temps d''execuci\u00f3 d''XSLTC que ja s''est\u00e0 utilitzant. Heu de recompilar el full d''estil o fer servir una versi\u00f3 m\u00e9s recent d''XSLTC per executar aquesta classe translet."}, /* * Note to translators: An attribute whose effective value is required * to be a "QName" had a value that was incorrect. * 'QName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_QNAME_ERR, "Un atribut, que ha de tenir el valor QName, tenia el valor ''{0}''"}, /* * Note to translators: An attribute whose effective value is required * to be a "NCName" had a value that was incorrect. * 'NCName' is an XML syntactic term that must not be translated. The * substitution text contains the actual value of the attribute. */ {BasisLibrary.INVALID_NCNAME_ERR, "Un atribut, que ha de tenir el valor NCName, tenia el valor ''{0}''"}, {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR, "L''\u00fas de la funci\u00f3 d''extensi\u00f3 ''{0}'' no est\u00e0 perm\u00e8s, si la caracter\u00edstica de proc\u00e9s segur s''ha establert en true."}, {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR, "L''\u00fas de l''element d''extensi\u00f3 ''{0}'' no est\u00e0 perm\u00e8s, si la caracter\u00edstica de proc\u00e9s segur s''ha establert en true."}, }; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/runtime/Parameter.java0000644000175000017500000000260610721374032024610 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Parameter.java 468652 2006-10-28 07:05:17Z minchau $ */ package org.apache.xalan.xsltc.runtime; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public class Parameter { public String _name; public Object _value; public boolean _isDefault; public Parameter(String name, Object value) { _name = name; _value = value; _isDefault = true; } public Parameter(String name, Object value, boolean isDefault) { _name = name; _value = value; _isDefault = isDefault; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/0000755000175000017500000000000010736146354021326 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/SecuritySupport.java0000644000175000017500000000745510721374032025376 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/TransformerHandlerImpl.java0000644000175000017500000003466610721374031026617 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerHandlerImpl.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.dom.DOMResult; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.dom.DOMWSFilter; import org.apache.xalan.xsltc.dom.SAXImpl; import org.apache.xalan.xsltc.dom.XSLTCDTMManager; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.serializer.SerializationHandler; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.DefaultHandler; /** * Implementation of a JAXP1.1 TransformerHandler * @author Morten Jorgensen */ public class TransformerHandlerImpl implements TransformerHandler, DeclHandler { private TransformerImpl _transformer; private AbstractTranslet _translet = null; private String _systemId; private SAXImpl _dom = null; private ContentHandler _handler = null; private LexicalHandler _lexHandler = null; private DTDHandler _dtdHandler = null; private DeclHandler _declHandler = null; private Result _result = null; private Locator _locator = null; private boolean _done = false; // Set in endDocument() /** * A flag indicating whether this transformer handler implements the * identity transform. */ private boolean _isIdentity = false; /** * Cosntructor - pass in reference to a TransformerImpl object */ public TransformerHandlerImpl(TransformerImpl transformer) { // Save the reference to the transformer _transformer = transformer; if (transformer.isIdentity()) { // Set initial handler to the empty handler _handler = new DefaultHandler(); _isIdentity = true; } else { // Get a reference to the translet wrapped inside the transformer _translet = _transformer.getTranslet(); } } /** * Implements javax.xml.transform.sax.TransformerHandler.getSystemId() * Get the base ID (URI or system ID) from where relative URLs will be * resolved. * @return The systemID that was set with setSystemId(String id) */ public String getSystemId() { return _systemId; } /** * Implements javax.xml.transform.sax.TransformerHandler.setSystemId() * Get the base ID (URI or system ID) from where relative URLs will be * resolved. * @param id Base URI for this stylesheet */ public void setSystemId(String id) { _systemId = id; } /** * Implements javax.xml.transform.sax.TransformerHandler.getTransformer() * Get the Transformer associated with this handler, which is needed in * order to set parameters and output properties. * @return The Transformer object */ public Transformer getTransformer() { return _transformer; } /** * Implements javax.xml.transform.sax.TransformerHandler.setResult() * Enables the user of the TransformerHandler to set the to set the Result * for the transformation. * @param result A Result instance, should not be null * @throws IllegalArgumentException if result is invalid for some reason */ public void setResult(Result result) throws IllegalArgumentException { _result = result; if (null == result) { ErrorMsg err = new ErrorMsg(ErrorMsg.ER_RESULT_NULL); throw new IllegalArgumentException(err.toString()); //"result should not be null"); } if (_isIdentity) { try { // Connect this object with output system directly SerializationHandler outputHandler = _transformer.getOutputHandler(result); _transformer.transferOutputProperties(outputHandler); _handler = outputHandler; _lexHandler = outputHandler; } catch (TransformerException e) { _result = null; } } else if (_done) { // Run the transformation now, if not already done try { _transformer.setDOM(_dom); _transformer.transform(null, _result); } catch (TransformerException e) { // What the hell are we supposed to do with this??? throw new IllegalArgumentException(e.getMessage()); } } } /** * Implements org.xml.sax.ContentHandler.characters() * Receive notification of character data. */ public void characters(char[] ch, int start, int length) throws SAXException { _handler.characters(ch, start, length); } /** * Implements org.xml.sax.ContentHandler.startDocument() * Receive notification of the beginning of a document. */ public void startDocument() throws SAXException { // Make sure setResult() was called before the first SAX event if (_result == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_RESULT_ERR); throw new SAXException(err.toString()); } if (!_isIdentity) { boolean hasIdCall = (_translet != null) ? _translet.hasIdCall() : false; XSLTCDTMManager dtmManager = null; // Create an internal DOM (not W3C) and get SAX2 input handler try { dtmManager = (XSLTCDTMManager)_transformer.getTransformerFactory() .getDTMManagerClass() .newInstance(); } catch (Exception e) { throw new SAXException(e); } DTMWSFilter wsFilter; if (_translet != null && _translet instanceof StripFilter) { wsFilter = new DOMWSFilter(_translet); } else { wsFilter = null; } // Construct the DTM using the SAX events that come through _dom = (SAXImpl)dtmManager.getDTM(null, false, wsFilter, true, false, hasIdCall); _handler = _dom.getBuilder(); _lexHandler = (LexicalHandler) _handler; _dtdHandler = (DTDHandler) _handler; _declHandler = (DeclHandler) _handler; // Set document URI _dom.setDocumentURI(_systemId); if (_locator != null) { _handler.setDocumentLocator(_locator); } } // Proxy call _handler.startDocument(); } /** * Implements org.xml.sax.ContentHandler.endDocument() * Receive notification of the end of a document. */ public void endDocument() throws SAXException { // Signal to the DOMBuilder that the document is complete _handler.endDocument(); if (!_isIdentity) { // Run the transformation now if we have a reference to a Result object if (_result != null) { try { _transformer.setDOM(_dom); _transformer.transform(null, _result); } catch (TransformerException e) { throw new SAXException(e); } } // Signal that the internal DOM is built (see 'setResult()'). _done = true; // Set this DOM as the transformer's DOM _transformer.setDOM(_dom); } if (_isIdentity && _result instanceof DOMResult) { ((DOMResult)_result).setNode(_transformer.getTransletOutputHandlerFactory().getNode()); } } /** * Implements org.xml.sax.ContentHandler.startElement() * Receive notification of the beginning of an element. */ public void startElement(String uri, String localName, String qname, Attributes attributes) throws SAXException { _handler.startElement(uri, localName, qname, attributes); } /** * Implements org.xml.sax.ContentHandler.endElement() * Receive notification of the end of an element. */ public void endElement(String namespaceURI, String localName, String qname) throws SAXException { _handler.endElement(namespaceURI, localName, qname); } /** * Implements org.xml.sax.ContentHandler.processingInstruction() * Receive notification of a processing instruction. */ public void processingInstruction(String target, String data) throws SAXException { _handler.processingInstruction(target, data); } /** * Implements org.xml.sax.ext.LexicalHandler.startCDATA() */ public void startCDATA() throws SAXException { if (_lexHandler != null) { _lexHandler.startCDATA(); } } /** * Implements org.xml.sax.ext.LexicalHandler.endCDATA() */ public void endCDATA() throws SAXException { if (_lexHandler != null) { _lexHandler.endCDATA(); } } /** * Implements org.xml.sax.ext.LexicalHandler.comment() * Receieve notification of a comment */ public void comment(char[] ch, int start, int length) throws SAXException { if (_lexHandler != null) { _lexHandler.comment(ch, start, length); } } /** * Implements org.xml.sax.ContentHandler.ignorableWhitespace() * Receive notification of ignorable whitespace in element * content. Similar to characters(char[], int, int). */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { _handler.ignorableWhitespace(ch, start, length); } /** * Implements org.xml.sax.ContentHandler.setDocumentLocator() * Receive an object for locating the origin of SAX document events. */ public void setDocumentLocator(Locator locator) { _locator = locator; if (_handler != null) { _handler.setDocumentLocator(locator); } } /** * Implements org.xml.sax.ContentHandler.skippedEntity() * Receive notification of a skipped entity. */ public void skippedEntity(String name) throws SAXException { _handler.skippedEntity(name); } /** * Implements org.xml.sax.ContentHandler.startPrefixMapping() * Begin the scope of a prefix-URI Namespace mapping. */ public void startPrefixMapping(String prefix, String uri) throws SAXException { _handler.startPrefixMapping(prefix, uri); } /** * Implements org.xml.sax.ContentHandler.endPrefixMapping() * End the scope of a prefix-URI Namespace mapping. */ public void endPrefixMapping(String prefix) throws SAXException { _handler.endPrefixMapping(prefix); } /** * Implements org.xml.sax.ext.LexicalHandler.startDTD() */ public void startDTD(String name, String publicId, String systemId) throws SAXException { if (_lexHandler != null) { _lexHandler.startDTD(name, publicId, systemId); } } /** * Implements org.xml.sax.ext.LexicalHandler.endDTD() */ public void endDTD() throws SAXException { if (_lexHandler != null) { _lexHandler.endDTD(); } } /** * Implements org.xml.sax.ext.LexicalHandler.startEntity() */ public void startEntity(String name) throws SAXException { if (_lexHandler != null) { _lexHandler.startEntity(name); } } /** * Implements org.xml.sax.ext.LexicalHandler.endEntity() */ public void endEntity(String name) throws SAXException { if (_lexHandler != null) { _lexHandler.endEntity(name); } } /** * Implements org.xml.sax.DTDHandler.unparsedEntityDecl() */ public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException { if (_dtdHandler != null) { _dtdHandler.unparsedEntityDecl(name, publicId, systemId, notationName); } } /** * Implements org.xml.sax.DTDHandler.notationDecl() */ public void notationDecl(String name, String publicId, String systemId) throws SAXException { if (_dtdHandler != null) { _dtdHandler.notationDecl(name, publicId, systemId); } } /** * Implements org.xml.sax.ext.DeclHandler.attributeDecl() */ public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException { if (_declHandler != null) { _declHandler.attributeDecl(eName, aName, type, valueDefault, value); } } /** * Implements org.xml.sax.ext.DeclHandler.elementDecl() */ public void elementDecl(String name, String model) throws SAXException { if (_declHandler != null) { _declHandler.elementDecl(name, model); } } /** * Implements org.xml.sax.ext.DeclHandler.externalEntityDecl() */ public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException { if (_declHandler != null) { _declHandler.externalEntityDecl(name, publicId, systemId); } } /** * Implements org.xml.sax.ext.DeclHandler.externalEntityDecl() */ public void internalEntityDecl(String name, String value) throws SAXException { if (_declHandler != null) { _declHandler.internalEntityDecl(name, value); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/DOM2TO.java0000644000175000017500000002642710721374031023135 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM2TO.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.IOException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.apache.xml.serializer.SerializationHandler; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.apache.xml.serializer.NamespaceMappings; /** * @author Santiago Pericas-Geertsen */ public class DOM2TO implements XMLReader, Locator { private final static String EMPTYSTRING = ""; private static final String XMLNS_PREFIX = "xmlns"; /** * A reference to the DOM to be traversed. */ private Node _dom; /** * A reference to the output handler receiving the events. */ private SerializationHandler _handler; public DOM2TO(Node root, SerializationHandler handler) { _dom = root; _handler = handler; } public ContentHandler getContentHandler() { return null; } public void setContentHandler(ContentHandler handler) { // Empty } public void parse(InputSource unused) throws IOException, SAXException { parse(_dom); } public void parse() throws IOException, SAXException { if (_dom != null) { boolean isIncomplete = (_dom.getNodeType() != org.w3c.dom.Node.DOCUMENT_NODE); if (isIncomplete) { _handler.startDocument(); parse(_dom); _handler.endDocument(); } else { parse(_dom); } } } /** * Traverse the DOM and generate TO events for a handler. Notice that * we need to handle implicit namespace declarations too. */ private void parse(Node node) throws IOException, SAXException { if (node == null) return; switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // handled by ELEMENT_NODE case Node.DOCUMENT_TYPE_NODE : case Node.ENTITY_NODE : case Node.ENTITY_REFERENCE_NODE: case Node.NOTATION_NODE : // These node types are ignored!!! break; case Node.CDATA_SECTION_NODE: _handler.startCDATA(); _handler.characters(node.getNodeValue()); _handler.endCDATA(); break; case Node.COMMENT_NODE: // should be handled!!! _handler.comment(node.getNodeValue()); break; case Node.DOCUMENT_NODE: _handler.startDocument(); Node next = node.getFirstChild(); while (next != null) { parse(next); next = next.getNextSibling(); } _handler.endDocument(); break; case Node.DOCUMENT_FRAGMENT_NODE: next = node.getFirstChild(); while (next != null) { parse(next); next = next.getNextSibling(); } break; case Node.ELEMENT_NODE: // Generate SAX event to start element final String qname = node.getNodeName(); _handler.startElement(null, null, qname); int colon; String prefix; final NamedNodeMap map = node.getAttributes(); final int length = map.getLength(); // Process all namespace attributes first for (int i = 0; i < length; i++) { final Node attr = map.item(i); final String qnameAttr = attr.getNodeName(); // Is this a namespace declaration? if (qnameAttr.startsWith(XMLNS_PREFIX)) { final String uriAttr = attr.getNodeValue(); colon = qnameAttr.lastIndexOf(':'); prefix = (colon > 0) ? qnameAttr.substring(colon + 1) : EMPTYSTRING; _handler.namespaceAfterStartElement(prefix, uriAttr); } } // Process all non-namespace attributes next NamespaceMappings nm = new NamespaceMappings(); for (int i = 0; i < length; i++) { final Node attr = map.item(i); final String qnameAttr = attr.getNodeName(); // Is this a regular attribute? if (!qnameAttr.startsWith(XMLNS_PREFIX)) { final String uriAttr = attr.getNamespaceURI(); // Uri may be implicitly declared if (uriAttr != null && !uriAttr.equals(EMPTYSTRING) ) { colon = qnameAttr.lastIndexOf(':'); // Fix for bug 26319 // For attributes not given an prefix explictly // but having a namespace uri we need // to explicitly generate the prefix String newPrefix = nm.lookupPrefix(uriAttr); if (newPrefix == null) newPrefix = nm.generateNextPrefix(); prefix = (colon > 0) ? qnameAttr.substring(0, colon) : newPrefix; _handler.namespaceAfterStartElement(prefix, uriAttr); _handler.addAttribute((prefix + ":" + qnameAttr), attr.getNodeValue()); } else { _handler.addAttribute(qnameAttr, attr.getNodeValue()); } } } // Now element namespace and children final String uri = node.getNamespaceURI(); final String localName = node.getLocalName(); // Uri may be implicitly declared if (uri != null) { colon = qname.lastIndexOf(':'); prefix = (colon > 0) ? qname.substring(0, colon) : EMPTYSTRING; _handler.namespaceAfterStartElement(prefix, uri); }else { // Fix for bug 26319 // If an element foo is created using // createElementNS(null,locName) // then the element should be serialized // if (uri == null && localName != null) { prefix = EMPTYSTRING; _handler.namespaceAfterStartElement(prefix, EMPTYSTRING); } } // Traverse all child nodes of the element (if any) next = node.getFirstChild(); while (next != null) { parse(next); next = next.getNextSibling(); } // Generate SAX event to close element _handler.endElement(qname); break; case Node.PROCESSING_INSTRUCTION_NODE: _handler.processingInstruction(node.getNodeName(), node.getNodeValue()); break; case Node.TEXT_NODE: _handler.characters(node.getNodeValue()); break; } } /** * This class is only used internally so this method should never * be called. */ public DTDHandler getDTDHandler() { return null; } /** * This class is only used internally so this method should never * be called. */ public ErrorHandler getErrorHandler() { return null; } /** * This class is only used internally so this method should never * be called. */ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return false; } /** * This class is only used internally so this method should never * be called. */ public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { } /** * This class is only used internally so this method should never * be called. */ public void parse(String sysId) throws IOException, SAXException { throw new IOException("This method is not yet implemented."); } /** * This class is only used internally so this method should never * be called. */ public void setDTDHandler(DTDHandler handler) throws NullPointerException { } /** * This class is only used internally so this method should never * be called. */ public void setEntityResolver(EntityResolver resolver) throws NullPointerException { } /** * This class is only used internally so this method should never * be called. */ public EntityResolver getEntityResolver() { return null; } /** * This class is only used internally so this method should never * be called. */ public void setErrorHandler(ErrorHandler handler) throws NullPointerException { } /** * This class is only used internally so this method should never * be called. */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { } /** * This class is only used internally so this method should never * be called. */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return null; } /** * This class is only used internally so this method should never * be called. */ public int getColumnNumber() { return 0; } /** * This class is only used internally so this method should never * be called. */ public int getLineNumber() { return 0; } /** * This class is only used internally so this method should never * be called. */ public String getPublicId() { return null; } /** * This class is only used internally so this method should never * be called. */ public String getSystemId() { return null; } // Debugging private String getNodeTypeFromCode(short code) { String retval = null; switch (code) { case Node.ATTRIBUTE_NODE : retval = "ATTRIBUTE_NODE"; break; case Node.CDATA_SECTION_NODE : retval = "CDATA_SECTION_NODE"; break; case Node.COMMENT_NODE : retval = "COMMENT_NODE"; break; case Node.DOCUMENT_FRAGMENT_NODE : retval = "DOCUMENT_FRAGMENT_NODE"; break; case Node.DOCUMENT_NODE : retval = "DOCUMENT_NODE"; break; case Node.DOCUMENT_TYPE_NODE : retval = "DOCUMENT_TYPE_NODE"; break; case Node.ELEMENT_NODE : retval = "ELEMENT_NODE"; break; case Node.ENTITY_NODE : retval = "ENTITY_NODE"; break; case Node.ENTITY_REFERENCE_NODE : retval = "ENTITY_REFERENCE_NODE"; break; case Node.NOTATION_NODE : retval = "NOTATION_NODE"; break; case Node.PROCESSING_INSTRUCTION_NODE : retval = "PROCESSING_INSTRUCTION_NODE"; break; case Node.TEXT_NODE: retval = "TEXT_NODE"; break; } return retval; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/DOM2SAX.java0000644000175000017500000003214210721374033023237 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM2SAX.java 469688 2006-10-31 22:39:43Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.IOException; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Stack; import org.apache.xalan.xsltc.dom.SAXImpl; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.AttributesImpl; /** * @author G. Todd Miller */ public class DOM2SAX implements XMLReader, Locator { private final static String EMPTYSTRING = ""; private static final String XMLNS_PREFIX = "xmlns"; private Node _dom = null; private ContentHandler _sax = null; private LexicalHandler _lex = null; private SAXImpl _saxImpl = null; private Hashtable _nsPrefixes = new Hashtable(); public DOM2SAX(Node root) { _dom = root; } public ContentHandler getContentHandler() { return _sax; } public void setContentHandler(ContentHandler handler) throws NullPointerException { _sax = handler; if (handler instanceof LexicalHandler) { _lex = (LexicalHandler) handler; } if (handler instanceof SAXImpl) { _saxImpl = (SAXImpl)handler; } } /** * Begin the scope of namespace prefix. Forward the event to the * SAX handler only if the prefix is unknown or it is mapped to a * different URI. */ private boolean startPrefixMapping(String prefix, String uri) throws SAXException { boolean pushed = true; Stack uriStack = (Stack) _nsPrefixes.get(prefix); if (uriStack != null) { if (uriStack.isEmpty()) { _sax.startPrefixMapping(prefix, uri); uriStack.push(uri); } else { final String lastUri = (String) uriStack.peek(); if (!lastUri.equals(uri)) { _sax.startPrefixMapping(prefix, uri); uriStack.push(uri); } else { pushed = false; } } } else { _sax.startPrefixMapping(prefix, uri); _nsPrefixes.put(prefix, uriStack = new Stack()); uriStack.push(uri); } return pushed; } /* * End the scope of a name prefix by popping it from the stack and * passing the event to the SAX Handler. */ private void endPrefixMapping(String prefix) throws SAXException { final Stack uriStack = (Stack) _nsPrefixes.get(prefix); if (uriStack != null) { _sax.endPrefixMapping(prefix); uriStack.pop(); } } /** * If the DOM was created using a DOM 1.0 API, the local name may be * null. If so, get the local name from the qualified name before * generating the SAX event. */ private static String getLocalName(Node node) { final String localName = node.getLocalName(); if (localName == null) { final String qname = node.getNodeName(); final int col = qname.lastIndexOf(':'); return (col > 0) ? qname.substring(col + 1) : qname; } return localName; } public void parse(InputSource unused) throws IOException, SAXException { parse(_dom); } public void parse() throws IOException, SAXException { if (_dom != null) { boolean isIncomplete = (_dom.getNodeType() != org.w3c.dom.Node.DOCUMENT_NODE); if (isIncomplete) { _sax.startDocument(); parse(_dom); _sax.endDocument(); } else { parse(_dom); } } } /** * Traverse the DOM and generate SAX events for a handler. A * startElement() event passes all attributes, including namespace * declarations. */ private void parse(Node node) throws IOException, SAXException { Node first = null; if (node == null) return; switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE: // handled by ELEMENT_NODE case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_TYPE_NODE : case Node.ENTITY_NODE : case Node.ENTITY_REFERENCE_NODE: case Node.NOTATION_NODE : // These node types are ignored!!! break; case Node.CDATA_SECTION_NODE: final String cdata = node.getNodeValue(); if (_lex != null) { _lex.startCDATA(); _sax.characters(cdata.toCharArray(), 0, cdata.length()); _lex.endCDATA(); } else { // in the case where there is no lex handler, we still // want the text of the cdate to make its way through. _sax.characters(cdata.toCharArray(), 0, cdata.length()); } break; case Node.COMMENT_NODE: // should be handled!!! if (_lex != null) { final String value = node.getNodeValue(); _lex.comment(value.toCharArray(), 0, value.length()); } break; case Node.DOCUMENT_NODE: _sax.setDocumentLocator(this); _sax.startDocument(); Node next = node.getFirstChild(); while (next != null) { parse(next); next = next.getNextSibling(); } _sax.endDocument(); break; case Node.ELEMENT_NODE: String prefix; List pushedPrefixes = new ArrayList(); final AttributesImpl attrs = new AttributesImpl(); final NamedNodeMap map = node.getAttributes(); final int length = map.getLength(); // Process all namespace declarations for (int i = 0; i < length; i++) { final Node attr = map.item(i); final String qnameAttr = attr.getNodeName(); // Ignore everything but NS declarations here if (qnameAttr.startsWith(XMLNS_PREFIX)) { final String uriAttr = attr.getNodeValue(); final int colon = qnameAttr.lastIndexOf(':'); prefix = (colon > 0) ? qnameAttr.substring(colon + 1) : EMPTYSTRING; if (startPrefixMapping(prefix, uriAttr)) { pushedPrefixes.add(prefix); } } } // Process all other attributes for (int i = 0; i < length; i++) { final Node attr = map.item(i); final String qnameAttr = attr.getNodeName(); // Ignore NS declarations here if (!qnameAttr.startsWith(XMLNS_PREFIX)) { final String uriAttr = attr.getNamespaceURI(); final String localNameAttr = getLocalName(attr); // Uri may be implicitly declared if (uriAttr != null) { final int colon = qnameAttr.lastIndexOf(':'); prefix = (colon > 0) ? qnameAttr.substring(0, colon) : EMPTYSTRING; if (startPrefixMapping(prefix, uriAttr)) { pushedPrefixes.add(prefix); } } // Add attribute to list attrs.addAttribute(attr.getNamespaceURI(), getLocalName(attr), qnameAttr, "CDATA", attr.getNodeValue()); } } // Now process the element itself final String qname = node.getNodeName(); final String uri = node.getNamespaceURI(); final String localName = getLocalName(node); // Uri may be implicitly declared if (uri != null) { final int colon = qname.lastIndexOf(':'); prefix = (colon > 0) ? qname.substring(0, colon) : EMPTYSTRING; if (startPrefixMapping(prefix, uri)) { pushedPrefixes.add(prefix); } } // Generate SAX event to start element if (_saxImpl != null) { _saxImpl.startElement(uri, localName, qname, attrs, node); } else { _sax.startElement(uri, localName, qname, attrs); } // Traverse all child nodes of the element (if any) next = node.getFirstChild(); while (next != null) { parse(next); next = next.getNextSibling(); } // Generate SAX event to close element _sax.endElement(uri, localName, qname); // Generate endPrefixMapping() for all pushed prefixes final int nPushedPrefixes = pushedPrefixes.size(); for (int i = 0; i < nPushedPrefixes; i++) { endPrefixMapping((String) pushedPrefixes.get(i)); } break; case Node.PROCESSING_INSTRUCTION_NODE: _sax.processingInstruction(node.getNodeName(), node.getNodeValue()); break; case Node.TEXT_NODE: final String data = node.getNodeValue(); _sax.characters(data.toCharArray(), 0, data.length()); break; } } /** * This class is only used internally so this method should never * be called. */ public DTDHandler getDTDHandler() { return null; } /** * This class is only used internally so this method should never * be called. */ public ErrorHandler getErrorHandler() { return null; } /** * This class is only used internally so this method should never * be called. */ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return false; } /** * This class is only used internally so this method should never * be called. */ public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { } /** * This class is only used internally so this method should never * be called. */ public void parse(String sysId) throws IOException, SAXException { throw new IOException("This method is not yet implemented."); } /** * This class is only used internally so this method should never * be called. */ public void setDTDHandler(DTDHandler handler) throws NullPointerException { } /** * This class is only used internally so this method should never * be called. */ public void setEntityResolver(EntityResolver resolver) throws NullPointerException { } /** * This class is only used internally so this method should never * be called. */ public EntityResolver getEntityResolver() { return null; } /** * This class is only used internally so this method should never * be called. */ public void setErrorHandler(ErrorHandler handler) throws NullPointerException { } /** * This class is only used internally so this method should never * be called. */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { } /** * This class is only used internally so this method should never * be called. */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return null; } /** * This class is only used internally so this method should never * be called. */ public int getColumnNumber() { return 0; } /** * This class is only used internally so this method should never * be called. */ public int getLineNumber() { return 0; } /** * This class is only used internally so this method should never * be called. */ public String getPublicId() { return null; } /** * This class is only used internally so this method should never * be called. */ public String getSystemId() { return null; } // Debugging private String getNodeTypeFromCode(short code) { String retval = null; switch (code) { case Node.ATTRIBUTE_NODE : retval = "ATTRIBUTE_NODE"; break; case Node.CDATA_SECTION_NODE : retval = "CDATA_SECTION_NODE"; break; case Node.COMMENT_NODE : retval = "COMMENT_NODE"; break; case Node.DOCUMENT_FRAGMENT_NODE : retval = "DOCUMENT_FRAGMENT_NODE"; break; case Node.DOCUMENT_NODE : retval = "DOCUMENT_NODE"; break; case Node.DOCUMENT_TYPE_NODE : retval = "DOCUMENT_TYPE_NODE"; break; case Node.ELEMENT_NODE : retval = "ELEMENT_NODE"; break; case Node.ENTITY_NODE : retval = "ENTITY_NODE"; break; case Node.ENTITY_REFERENCE_NODE : retval = "ENTITY_REFERENCE_NODE"; break; case Node.NOTATION_NODE : retval = "NOTATION_NODE"; break; case Node.PROCESSING_INSTRUCTION_NODE : retval = "PROCESSING_INSTRUCTION_NODE"; break; case Node.TEXT_NODE: retval = "TEXT_NODE"; break; } return retval; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/SecuritySupport12.java0000644000175000017500000001176210721374033025536 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/XSLTCSource.java0000644000175000017500000001074110721374032024240 0ustar mkochmkoch /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTCSource.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.dom.DOMWSFilter; import org.apache.xalan.xsltc.dom.SAXImpl; import org.apache.xalan.xsltc.dom.XSLTCDTMManager; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.xml.sax.SAXException; /** * @author Morten Jorgensen */ public final class XSLTCSource implements Source { private String _systemId = null; private Source _source = null; private ThreadLocal _dom = new ThreadLocal(); /** * Create a new XSLTC-specific source from a system ID */ public XSLTCSource(String systemId) { _systemId = systemId; } /** * Create a new XSLTC-specific source from a JAXP Source */ public XSLTCSource(Source source) { _source = source; } /** * Implements javax.xml.transform.Source.setSystemId() * Set the system identifier for this Source. * This Source can get its input either directly from a file (in this case * it will instanciate and use a JAXP parser) or it can receive it through * ContentHandler/LexicalHandler interfaces. * @param systemId The system Id for this Source */ public void setSystemId(String systemId) { _systemId = systemId; if (_source != null) { _source.setSystemId(systemId); } } /** * Implements javax.xml.transform.Source.getSystemId() * Get the system identifier that was set with setSystemId. * @return The system identifier that was set with setSystemId, * or null if setSystemId was not called. */ public String getSystemId() { if (_source != null) { return _source.getSystemId(); } else { return(_systemId); } } /** * Internal interface which returns a DOM for a given DTMManager and translet. */ protected DOM getDOM(XSLTCDTMManager dtmManager, AbstractTranslet translet) throws SAXException { SAXImpl idom = (SAXImpl)_dom.get(); if (idom != null) { if (dtmManager != null) { idom.migrateTo(dtmManager); } } else { Source source = _source; if (source == null) { if (_systemId != null && _systemId.length() > 0) { source = new StreamSource(_systemId); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.XSLTC_SOURCE_ERR); throw new SAXException(err.toString()); } } DOMWSFilter wsfilter = null; if (translet != null && translet instanceof StripFilter) { wsfilter = new DOMWSFilter(translet); } boolean hasIdCall = (translet != null) ? translet.hasIdCall() : false; if (dtmManager == null) { dtmManager = XSLTCDTMManager.newInstance(); } idom = (SAXImpl)dtmManager.getDTM(source, true, wsfilter, false, false, hasIdCall); String systemId = getSystemId(); if (systemId != null) { idom.setDocumentURI(systemId); } _dom.set(idom); } return idom; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/SAX2DOM.java0000644000175000017500000001644610721374033023250 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAX2DOM.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.util.Stack; import java.util.Vector; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xalan.xsltc.runtime.Constants; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; import org.w3c.dom.ProcessingInstruction; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; /** * @author G. Todd Miller */ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants { private Node _root = null; private Document _document = null; private Node _nextSibling = null; private Stack _nodeStk = new Stack(); private Vector _namespaceDecls = null; private Node _lastSibling = null; public SAX2DOM() throws ParserConfigurationException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); _document = factory.newDocumentBuilder().newDocument(); _root = _document; } public SAX2DOM(Node root, Node nextSibling) throws ParserConfigurationException { _root = root; if (root instanceof Document) { _document = (Document)root; } else if (root != null) { _document = root.getOwnerDocument(); } else { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); _document = factory.newDocumentBuilder().newDocument(); _root = _document; } _nextSibling = nextSibling; } public SAX2DOM(Node root) throws ParserConfigurationException { this(root, null); } public Node getDOM() { return _root; } public void characters(char[] ch, int start, int length) { final Node last = (Node)_nodeStk.peek(); // No text nodes can be children of root (DOM006 exception) if (last != _document) { final String text = new String(ch, start, length); if( _lastSibling != null && _lastSibling.getNodeType() == Node.TEXT_NODE ){ ((Text)_lastSibling).appendData(text); } else if (last == _root && _nextSibling != null) { _lastSibling = last.insertBefore(_document.createTextNode(text), _nextSibling); } else { _lastSibling = last.appendChild(_document.createTextNode(text)); } } } public void startDocument() { _nodeStk.push(_root); } public void endDocument() { _nodeStk.pop(); } public void startElement(String namespace, String localName, String qName, Attributes attrs) { final Element tmp = (Element)_document.createElementNS(namespace, qName); // Add namespace declarations first if (_namespaceDecls != null) { final int nDecls = _namespaceDecls.size(); for (int i = 0; i < nDecls; i++) { final String prefix = (String) _namespaceDecls.elementAt(i++); if (prefix == null || prefix.equals(EMPTYSTRING)) { tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, (String) _namespaceDecls.elementAt(i)); } else { tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, (String) _namespaceDecls.elementAt(i)); } } _namespaceDecls.clear(); } // Add attributes to element final int nattrs = attrs.getLength(); for (int i = 0; i < nattrs; i++) { if (attrs.getLocalName(i) == null) { tmp.setAttribute(attrs.getQName(i), attrs.getValue(i)); } else { tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i)); } } // Append this new node onto current stack node Node last = (Node)_nodeStk.peek(); // If the SAX2DOM is created with a non-null next sibling node, // insert the result nodes before the next sibling under the root. if (last == _root && _nextSibling != null) last.insertBefore(tmp, _nextSibling); else last.appendChild(tmp); // Push this node onto stack _nodeStk.push(tmp); _lastSibling = null; } public void endElement(String namespace, String localName, String qName) { _nodeStk.pop(); _lastSibling = null; } public void startPrefixMapping(String prefix, String uri) { if (_namespaceDecls == null) { _namespaceDecls = new Vector(2); } _namespaceDecls.addElement(prefix); _namespaceDecls.addElement(uri); } public void endPrefixMapping(String prefix) { // do nothing } /** * This class is only used internally so this method should never * be called. */ public void ignorableWhitespace(char[] ch, int start, int length) { } /** * adds processing instruction node to DOM. */ public void processingInstruction(String target, String data) { final Node last = (Node)_nodeStk.peek(); ProcessingInstruction pi = _document.createProcessingInstruction( target, data); if (pi != null){ if (last == _root && _nextSibling != null) last.insertBefore(pi, _nextSibling); else last.appendChild(pi); _lastSibling = pi; } } /** * This class is only used internally so this method should never * be called. */ public void setDocumentLocator(Locator locator) { } /** * This class is only used internally so this method should never * be called. */ public void skippedEntity(String name) { } /** * Lexical Handler method to create comment node in DOM tree. */ public void comment(char[] ch, int start, int length) { final Node last = (Node)_nodeStk.peek(); Comment comment = _document.createComment(new String(ch,start,length)); if (comment != null){ if (last == _root && _nextSibling != null) last.insertBefore(comment, _nextSibling); else last.appendChild(comment); _lastSibling = comment; } } // Lexical Handler methods- not implemented public void startCDATA() { } public void endCDATA() { } public void startEntity(java.lang.String name) { } public void endDTD() { } public void endEntity(String name) { } public void startDTD(String name, String publicId, String systemId) throws SAXException { } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java0000644000175000017500000012777110721374030025320 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerImpl.java 486494 2006-12-13 04:58:06Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.net.URL; import java.net.URLConnection; import java.net.UnknownServiceException; import java.util.Enumeration; import java.util.Properties; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xml.utils.SystemIDResolver; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMCache; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.TransletException; import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.serializer.SerializationHandler; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.dom.DOMWSFilter; import org.apache.xalan.xsltc.dom.SAXImpl; import org.apache.xalan.xsltc.dom.XSLTCDTMManager; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xalan.xsltc.runtime.output.TransletOutputHandlerFactory; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.utils.XMLReaderManager; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.ext.LexicalHandler; /** * @author Morten Jorgensen * @author G. Todd Miller * @author Santiago Pericas-Geertsen */ public final class TransformerImpl extends Transformer implements DOMCache, ErrorListener { private final static String EMPTY_STRING = ""; private final static String NO_STRING = "no"; private final static String YES_STRING = "yes"; private final static String XML_STRING = "xml"; private final static String LEXICAL_HANDLER_PROPERTY = "http://xml.org/sax/properties/lexical-handler"; private static final String NAMESPACE_FEATURE = "http://xml.org/sax/features/namespaces"; /** * A reference to the translet or null if the identity transform. */ private AbstractTranslet _translet = null; /** * The output method of this transformation. */ private String _method = null; /** * The output encoding of this transformation. */ private String _encoding = null; /** * The systemId set in input source. */ private String _sourceSystemId = null; /** * An error listener for runtime errors. */ private ErrorListener _errorListener = this; /** * A reference to a URI resolver for calls to document(). */ private URIResolver _uriResolver = null; /** * Output properties of this transformer instance. */ private Properties _properties, _propertiesClone; /** * A reference to an output handler factory. */ private TransletOutputHandlerFactory _tohFactory = null; /** * A reference to a internal DOM represenation of the input. */ private DOM _dom = null; /** * Number of indent spaces to add when indentation is on. */ private int _indentNumber; /** * A reference to the transformer factory that this templates * object belongs to. */ private TransformerFactoryImpl _tfactory = null; /** * A reference to the output stream, if we create one in our code. */ private OutputStream _ostream = null; /** * A reference to the XSLTCDTMManager which is used to build the DOM/DTM * for this transformer. */ private XSLTCDTMManager _dtmManager = null; /** * A reference to an object that creates and caches XMLReader objects. */ private XMLReaderManager _readerManager = XMLReaderManager.getInstance(); /** * A flag indicating whether we use incremental building of the DTM. */ //private boolean _isIncremental = false; /** * A flag indicating whether this transformer implements the identity * transform. */ private boolean _isIdentity = false; /** * State of the secure processing feature. */ private boolean _isSecureProcessing = false; /** * A hashtable to store parameters for the identity transform. These * are not needed during the transformation, but we must keep track of * them to be fully complaint with the JAXP API. */ private Hashtable _parameters = null; /** * This class wraps an ErrorListener into a MessageHandler in order to * capture messages reported via xsl:message. */ static class MessageHandler extends org.apache.xalan.xsltc.runtime.MessageHandler { private ErrorListener _errorListener; public MessageHandler(ErrorListener errorListener) { _errorListener = errorListener; } public void displayMessage(String msg) { if(_errorListener == null) { System.err.println(msg); } else { try { _errorListener.warning(new TransformerException(msg)); } catch (TransformerException e) { // ignored } } } } protected TransformerImpl(Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory) { this(null, outputProperties, indentNumber, tfactory); _isIdentity = true; // _properties.put(OutputKeys.METHOD, "xml"); } protected TransformerImpl(Translet translet, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory) { _translet = (AbstractTranslet) translet; _properties = createOutputProperties(outputProperties); _propertiesClone = (Properties) _properties.clone(); _indentNumber = indentNumber; _tfactory = tfactory; //_isIncremental = tfactory._incremental; } /** * Return the state of the secure processing feature. */ public boolean isSecureProcessing() { return _isSecureProcessing; } /** * Set the state of the secure processing feature. */ public void setSecureProcessing(boolean flag) { _isSecureProcessing = flag; } /** * Returns the translet wrapped inside this Transformer or * null if this is the identity transform. */ protected AbstractTranslet getTranslet() { return _translet; } public boolean isIdentity() { return _isIdentity; } /** * Implements JAXP's Transformer.transform() * * @param source Contains the input XML document * @param result Will contain the output from the transformation * @throws TransformerException */ public void transform(Source source, Result result) throws TransformerException { if (!_isIdentity) { if (_translet == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_TRANSLET_ERR); throw new TransformerException(err.toString()); } // Pass output properties to the translet transferOutputProperties(_translet); } final SerializationHandler toHandler = getOutputHandler(result); if (toHandler == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR); throw new TransformerException(err.toString()); } if (_uriResolver != null && !_isIdentity) { _translet.setDOMCache(this); } // Pass output properties to handler if identity if (_isIdentity) { transferOutputProperties(toHandler); } transform(source, toHandler, _encoding); if (result instanceof DOMResult) { ((DOMResult)result).setNode(_tohFactory.getNode()); } } /** * Create an output handler for the transformation output based on * the type and contents of the TrAX Result object passed to the * transform() method. */ public SerializationHandler getOutputHandler(Result result) throws TransformerException { // Get output method using get() to ignore defaults _method = (String) _properties.get(OutputKeys.METHOD); // Get encoding using getProperty() to use defaults _encoding = (String) _properties.getProperty(OutputKeys.ENCODING); _tohFactory = TransletOutputHandlerFactory.newInstance(); _tohFactory.setEncoding(_encoding); if (_method != null) { _tohFactory.setOutputMethod(_method); } // Set indentation number in the factory if (_indentNumber >= 0) { _tohFactory.setIndentNumber(_indentNumber); } // Return the content handler for this Result object try { // Result object could be SAXResult, DOMResult, or StreamResult if (result instanceof SAXResult) { final SAXResult target = (SAXResult)result; final ContentHandler handler = target.getHandler(); _tohFactory.setHandler(handler); /** * Fix for bug 24414 * If the lexicalHandler is set then we need to get that * for obtaining the lexical information */ LexicalHandler lexicalHandler = target.getLexicalHandler(); if (lexicalHandler != null ) { _tohFactory.setLexicalHandler(lexicalHandler); } _tohFactory.setOutputType(TransletOutputHandlerFactory.SAX); return _tohFactory.getSerializationHandler(); } else if (result instanceof DOMResult) { _tohFactory.setNode(((DOMResult) result).getNode()); _tohFactory.setNextSibling(((DOMResult) result).getNextSibling()); _tohFactory.setOutputType(TransletOutputHandlerFactory.DOM); return _tohFactory.getSerializationHandler(); } else if (result instanceof StreamResult) { // Get StreamResult final StreamResult target = (StreamResult) result; // StreamResult may have been created with a java.io.File, // java.io.Writer, java.io.OutputStream or just a String // systemId. _tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM); // try to get a Writer from Result object final Writer writer = target.getWriter(); if (writer != null) { _tohFactory.setWriter(writer); return _tohFactory.getSerializationHandler(); } // or try to get an OutputStream from Result object final OutputStream ostream = target.getOutputStream(); if (ostream != null) { _tohFactory.setOutputStream(ostream); return _tohFactory.getSerializationHandler(); } // or try to get just a systemId string from Result object String systemId = result.getSystemId(); if (systemId == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR); throw new TransformerException(err.toString()); } // System Id may be in one of several forms, (1) a uri // that starts with 'file:', (2) uri that starts with 'http:' // or (3) just a filename on the local system. URL url = null; if (systemId.startsWith("file:")) { url = new URL(systemId); _tohFactory.setOutputStream( _ostream = new FileOutputStream(url.getFile())); return _tohFactory.getSerializationHandler(); } else if (systemId.startsWith("http:")) { url = new URL(systemId); final URLConnection connection = url.openConnection(); _tohFactory.setOutputStream(_ostream = connection.getOutputStream()); return _tohFactory.getSerializationHandler(); } else { // system id is just a filename url = new File(systemId).toURL(); _tohFactory.setOutputStream( _ostream = new FileOutputStream(url.getFile())); return _tohFactory.getSerializationHandler(); } } } // If we cannot write to the location specified by the SystemId catch (UnknownServiceException e) { throw new TransformerException(e); } catch (ParserConfigurationException e) { throw new TransformerException(e); } // If we cannot create the file specified by the SystemId catch (IOException e) { throw new TransformerException(e); } return null; } /** * Set the internal DOM that will be used for the next transformation */ protected void setDOM(DOM dom) { _dom = dom; } /** * Builds an internal DOM from a TrAX Source object */ private DOM getDOM(Source source) throws TransformerException { try { DOM dom = null; if (source != null) { DTMWSFilter wsfilter; if (_translet != null && _translet instanceof StripFilter) { wsfilter = new DOMWSFilter(_translet); } else { wsfilter = null; } boolean hasIdCall = (_translet != null) ? _translet.hasIdCall() : false; if (_dtmManager == null) { _dtmManager = (XSLTCDTMManager)_tfactory.getDTMManagerClass() .newInstance(); } dom = (DOM)_dtmManager.getDTM(source, false, wsfilter, true, false, false, 0, hasIdCall); } else if (_dom != null) { dom = _dom; _dom = null; // use only once, so reset to 'null' } else { return null; } if (!_isIdentity) { // Give the translet the opportunity to make a prepass of // the document, in case it can extract useful information early _translet.prepassDocument(dom); } return dom; } catch (Exception e) { if (_errorListener != null) { postErrorToListener(e.getMessage()); } throw new TransformerException(e); } } /** * Returns the {@link org.apache.xalan.xsltc.trax.TransformerFactoryImpl} * object that create this Transformer. */ protected TransformerFactoryImpl getTransformerFactory() { return _tfactory; } /** * Returns the {@link org.apache.xalan.xsltc.runtime.output.TransletOutputHandlerFactory} * object that create the TransletOutputHandler. */ protected TransletOutputHandlerFactory getTransletOutputHandlerFactory() { return _tohFactory; } private void transformIdentity(Source source, SerializationHandler handler) throws Exception { // Get systemId from source if (source != null) { _sourceSystemId = source.getSystemId(); } if (source instanceof StreamSource) { final StreamSource stream = (StreamSource) source; final InputStream streamInput = stream.getInputStream(); final Reader streamReader = stream.getReader(); final XMLReader reader = _readerManager.getXMLReader(); try { // Hook up reader and output handler try { reader.setProperty(LEXICAL_HANDLER_PROPERTY, handler); } catch (SAXException e) { // Falls through } reader.setContentHandler(handler); // Create input source from source InputSource input; if (streamInput != null) { input = new InputSource(streamInput); input.setSystemId(_sourceSystemId); } else if (streamReader != null) { input = new InputSource(streamReader); input.setSystemId(_sourceSystemId); } else if (_sourceSystemId != null) { input = new InputSource(_sourceSystemId); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR); throw new TransformerException(err.toString()); } // Start pushing SAX events reader.parse(input); } finally { _readerManager.releaseXMLReader(reader); } } else if (source instanceof SAXSource) { final SAXSource sax = (SAXSource) source; XMLReader reader = sax.getXMLReader(); final InputSource input = sax.getInputSource(); boolean userReader = true; try { // Create a reader if not set by user if (reader == null) { reader = _readerManager.getXMLReader(); userReader = false; } // Hook up reader and output handler try { reader.setProperty(LEXICAL_HANDLER_PROPERTY, handler); } catch (SAXException e) { // Falls through } reader.setContentHandler(handler); // Start pushing SAX events reader.parse(input); } finally { if (!userReader) { _readerManager.releaseXMLReader(reader); } } } else if (source instanceof DOMSource) { final DOMSource domsrc = (DOMSource) source; new DOM2TO(domsrc.getNode(), handler).parse(); } else if (source instanceof XSLTCSource) { final DOM dom = ((XSLTCSource) source).getDOM(null, _translet); ((SAXImpl)dom).copy(handler); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR); throw new TransformerException(err.toString()); } } /** * Internal transformation method - uses the internal APIs of XSLTC */ private void transform(Source source, SerializationHandler handler, String encoding) throws TransformerException { try { /* * According to JAXP1.2, new SAXSource()/StreamSource() * should create an empty input tree, with a default root node. * new DOMSource()creates an empty document using DocumentBuilder. * newDocument(); Use DocumentBuilder.newDocument() for all 3 * situations, since there is no clear spec. how to create * an empty tree when both SAXSource() and StreamSource() are used. */ if ((source instanceof StreamSource && source.getSystemId()==null && ((StreamSource)source).getInputStream()==null && ((StreamSource)source).getReader()==null)|| (source instanceof SAXSource && ((SAXSource)source).getInputSource()==null && ((SAXSource)source).getXMLReader()==null )|| (source instanceof DOMSource && ((DOMSource)source).getNode()==null)){ DocumentBuilderFactory builderF = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderF.newDocumentBuilder(); String systemID = source.getSystemId(); source = new DOMSource(builder.newDocument()); // Copy system ID from original, empty Source to new if (systemID != null) { source.setSystemId(systemID); } } if (_isIdentity) { transformIdentity(source, handler); } else { _translet.transform(getDOM(source), handler); } } catch (TransletException e) { if (_errorListener != null) postErrorToListener(e.getMessage()); throw new TransformerException(e); } catch (RuntimeException e) { if (_errorListener != null) postErrorToListener(e.getMessage()); throw new TransformerException(e); } catch (Exception e) { if (_errorListener != null) postErrorToListener(e.getMessage()); throw new TransformerException(e); } finally { _dtmManager = null; } // If we create an output stream for the Result, we need to close it after the transformation. if (_ostream != null) { try { _ostream.close(); } catch (IOException e) {} _ostream = null; } } /** * Implements JAXP's Transformer.getErrorListener() * Get the error event handler in effect for the transformation. * * @return The error event handler currently in effect */ public ErrorListener getErrorListener() { return _errorListener; } /** * Implements JAXP's Transformer.setErrorListener() * Set the error event listener in effect for the transformation. * Register a message handler in the translet in order to forward * xsl:messages to error listener. * * @param listener The error event listener to use * @throws IllegalArgumentException */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { if (listener == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR, "Transformer"); throw new IllegalArgumentException(err.toString()); } _errorListener = listener; // Register a message handler to report xsl:messages if (_translet != null) _translet.setMessageHandler(new MessageHandler(_errorListener)); } /** * Inform TrAX error listener of an error */ private void postErrorToListener(String message) { try { _errorListener.error(new TransformerException(message)); } catch (TransformerException e) { // ignored - transformation cannot be continued } } /** * Inform TrAX error listener of a warning */ private void postWarningToListener(String message) { try { _errorListener.warning(new TransformerException(message)); } catch (TransformerException e) { // ignored - transformation cannot be continued } } /** * The translet stores all CDATA sections set in the element * in a Hashtable. This method will re-construct the whitespace separated * list of elements given in the element. */ private String makeCDATAString(Hashtable cdata) { // Return a 'null' string if no CDATA section elements were specified if (cdata == null) return null; StringBuffer result = new StringBuffer(); // Get an enumeration of all the elements in the hashtable Enumeration elements = cdata.keys(); if (elements.hasMoreElements()) { result.append((String)elements.nextElement()); while (elements.hasMoreElements()) { String element = (String)elements.nextElement(); result.append(' '); result.append(element); } } return(result.toString()); } /** * Implements JAXP's Transformer.getOutputProperties(). * Returns a copy of the output properties for the transformation. This is * a set of layered properties. The first layer contains properties set by * calls to setOutputProperty() and setOutputProperties() on this class, * and the output settings defined in the stylesheet's * element makes up the second level, while the default XSLT output * settings are returned on the third level. * * @return Properties in effect for this Transformer */ public Properties getOutputProperties() { return (Properties) _properties.clone(); } /** * Implements JAXP's Transformer.getOutputProperty(). * Get an output property that is in effect for the transformation. The * property specified may be a property that was set with setOutputProperty, * or it may be a property specified in the stylesheet. * * @param name A non-null string that contains the name of the property * @throws IllegalArgumentException if the property name is not known */ public String getOutputProperty(String name) throws IllegalArgumentException { if (!validOutputProperty(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name); throw new IllegalArgumentException(err.toString()); } return _properties.getProperty(name); } /** * Implements JAXP's Transformer.setOutputProperties(). * Set the output properties for the transformation. These properties * will override properties set in the Templates with xsl:output. * Unrecognised properties will be quitely ignored. * * @param properties The properties to use for the Transformer * @throws IllegalArgumentException Never, errors are ignored */ public void setOutputProperties(Properties properties) throws IllegalArgumentException { if (properties != null) { final Enumeration names = properties.propertyNames(); while (names.hasMoreElements()) { final String name = (String) names.nextElement(); // Ignore lower layer properties if (isDefaultProperty(name, properties)) continue; if (validOutputProperty(name)) { _properties.setProperty(name, properties.getProperty(name)); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name); throw new IllegalArgumentException(err.toString()); } } } else { _properties = _propertiesClone; } } /** * Implements JAXP's Transformer.setOutputProperty(). * Get an output property that is in effect for the transformation. The * property specified may be a property that was set with * setOutputProperty(), or it may be a property specified in the stylesheet. * * @param name The name of the property to set * @param value The value to assign to the property * @throws IllegalArgumentException Never, errors are ignored */ public void setOutputProperty(String name, String value) throws IllegalArgumentException { if (!validOutputProperty(name)) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name); throw new IllegalArgumentException(err.toString()); } _properties.setProperty(name, value); } /** * Internal method to pass any properties to the translet prior to * initiating the transformation */ private void transferOutputProperties(AbstractTranslet translet) { // Return right now if no properties are set if (_properties == null) return; // Get a list of all the defined properties Enumeration names = _properties.propertyNames(); while (names.hasMoreElements()) { // Note the use of get() instead of getProperty() String name = (String) names.nextElement(); String value = (String) _properties.get(name); // Ignore default properties if (value == null) continue; // Pass property value to translet - override previous setting if (name.equals(OutputKeys.ENCODING)) { translet._encoding = value; } else if (name.equals(OutputKeys.METHOD)) { translet._method = value; } else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) { translet._doctypePublic = value; } else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) { translet._doctypeSystem = value; } else if (name.equals(OutputKeys.MEDIA_TYPE)) { translet._mediaType = value; } else if (name.equals(OutputKeys.STANDALONE)) { translet._standalone = value; } else if (name.equals(OutputKeys.VERSION)) { translet._version = value; } else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) { translet._omitHeader = (value != null && value.toLowerCase().equals("yes")); } else if (name.equals(OutputKeys.INDENT)) { translet._indent = (value != null && value.toLowerCase().equals("yes")); } else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) { if (value != null) { translet._cdata = null; // clear previous setting StringTokenizer e = new StringTokenizer(value); while (e.hasMoreTokens()) { translet.addCdataElement(e.nextToken()); } } } } } /** * This method is used to pass any properties to the output handler * when running the identity transform. */ public void transferOutputProperties(SerializationHandler handler) { // Return right now if no properties are set if (_properties == null) return; String doctypePublic = null; String doctypeSystem = null; // Get a list of all the defined properties Enumeration names = _properties.propertyNames(); while (names.hasMoreElements()) { // Note the use of get() instead of getProperty() String name = (String) names.nextElement(); String value = (String) _properties.get(name); // Ignore default properties if (value == null) continue; // Pass property value to translet - override previous setting if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) { doctypePublic = value; } else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) { doctypeSystem = value; } else if (name.equals(OutputKeys.MEDIA_TYPE)) { handler.setMediaType(value); } else if (name.equals(OutputKeys.STANDALONE)) { handler.setStandalone(value); } else if (name.equals(OutputKeys.VERSION)) { handler.setVersion(value); } else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) { handler.setOmitXMLDeclaration( value != null && value.toLowerCase().equals("yes")); } else if (name.equals(OutputKeys.INDENT)) { handler.setIndent( value != null && value.toLowerCase().equals("yes")); } else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) { if (value != null) { StringTokenizer e = new StringTokenizer(value); Vector uriAndLocalNames = null; while (e.hasMoreTokens()) { final String token = e.nextToken(); // look for the last colon, as the String may be // something like "http://abc.com:local" int lastcolon = token.lastIndexOf(':'); String uri; String localName; if (lastcolon > 0) { uri = token.substring(0, lastcolon); localName = token.substring(lastcolon+1); } else { // no colon at all, lets hope this is the // local name itself then uri = null; localName = token; } if (uriAndLocalNames == null) { uriAndLocalNames = new Vector(); } // add the uri/localName as a pair, in that order uriAndLocalNames.addElement(uri); uriAndLocalNames.addElement(localName); } handler.setCdataSectionElements(uriAndLocalNames); } } } // Call setDoctype() if needed if (doctypePublic != null || doctypeSystem != null) { handler.setDoctype(doctypeSystem, doctypePublic); } } /** * Internal method to create the initial set of properties. There * are two layers of properties: the default layer and the base layer. * The latter contains properties defined in the stylesheet or by * the user using this API. */ private Properties createOutputProperties(Properties outputProperties) { final Properties defaults = new Properties(); setDefaults(defaults, "xml"); // Copy propeties set in stylesheet to base final Properties base = new Properties(defaults); if (outputProperties != null) { final Enumeration names = outputProperties.propertyNames(); while (names.hasMoreElements()) { final String name = (String) names.nextElement(); base.setProperty(name, outputProperties.getProperty(name)); } } else { base.setProperty(OutputKeys.ENCODING, _translet._encoding); if (_translet._method != null) base.setProperty(OutputKeys.METHOD, _translet._method); } // Update defaults based on output method final String method = base.getProperty(OutputKeys.METHOD); if (method != null) { if (method.equals("html")) { setDefaults(defaults,"html"); } else if (method.equals("text")) { setDefaults(defaults,"text"); } } return base; } /** * Internal method to get the default properties from the * serializer factory and set them on the property object. * @param props a java.util.Property object on which the properties are set. * @param method The output method type, one of "xml", "text", "html" ... */ private void setDefaults(Properties props, String method) { final Properties method_props = OutputPropertiesFactory.getDefaultMethodProperties(method); { final Enumeration names = method_props.propertyNames(); while (names.hasMoreElements()) { final String name = (String)names.nextElement(); props.setProperty(name, method_props.getProperty(name)); } } } /** * Verifies if a given output property name is a property defined in * the JAXP 1.1 / TrAX spec */ private boolean validOutputProperty(String name) { return (name.equals(OutputKeys.ENCODING) || name.equals(OutputKeys.METHOD) || name.equals(OutputKeys.INDENT) || name.equals(OutputKeys.DOCTYPE_PUBLIC) || name.equals(OutputKeys.DOCTYPE_SYSTEM) || name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) || name.equals(OutputKeys.MEDIA_TYPE) || name.equals(OutputKeys.OMIT_XML_DECLARATION) || name.equals(OutputKeys.STANDALONE) || name.equals(OutputKeys.VERSION) || name.charAt(0) == '{'); } /** * Checks if a given output property is default (2nd layer only) */ private boolean isDefaultProperty(String name, Properties properties) { return (properties.get(name) == null); } /** * Implements JAXP's Transformer.setParameter() * Add a parameter for the transformation. The parameter is simply passed * on to the translet - no validation is performed - so any unused * parameters are quitely ignored by the translet. * * @param name The name of the parameter * @param value The value to assign to the parameter */ public void setParameter(String name, Object value) { if (value == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, name); throw new IllegalArgumentException(err.toString()); } if (_isIdentity) { if (_parameters == null) { _parameters = new Hashtable(); } _parameters.put(name, value); } else { _translet.addParameter(name, value); } } /** * Implements JAXP's Transformer.clearParameters() * Clear all parameters set with setParameter. Clears the translet's * parameter stack. */ public void clearParameters() { if (_isIdentity && _parameters != null) { _parameters.clear(); } else { _translet.clearParameters(); } } /** * Implements JAXP's Transformer.getParameter() * Returns the value of a given parameter. Note that the translet will not * keep values for parameters that were not defined in the stylesheet. * * @param name The name of the parameter * @return An object that contains the value assigned to the parameter */ public final Object getParameter(String name) { if (_isIdentity) { return (_parameters != null) ? _parameters.get(name) : null; } else { return _translet.getParameter(name); } } /** * Implements JAXP's Transformer.getURIResolver() * Set the object currently used to resolve URIs used in document(). * * @return The URLResolver object currently in use */ public URIResolver getURIResolver() { return _uriResolver; } /** * Implements JAXP's Transformer.setURIResolver() * Set an object that will be used to resolve URIs used in document(). * * @param resolver The URIResolver to use in document() */ public void setURIResolver(URIResolver resolver) { _uriResolver = resolver; } /** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = new String(baseURI); } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * org.apache.xalan.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } } /** * Receive notification of a recoverable error. * The transformer must continue to provide normal parsing events after * invoking this method. It should still be possible for the application * to process the document through to the end. * * @param e The warning information encapsulated in a transformer * exception. * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ public void error(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG, e.getMessageAndLocation())); } throw e; } /** * Receive notification of a non-recoverable error. * The application must assume that the transformation cannot continue * after the Transformer has invoked this method, and should continue * (if at all) only to collect addition error messages. In fact, * Transformers are free to stop reporting events once this method has * been invoked. * * @param e The warning information encapsulated in a transformer * exception. * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ public void fatalError(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG, e.getMessageAndLocation())); } throw e; } /** * Receive notification of a warning. * Transformers can use this method to report conditions that are not * errors or fatal errors. The default behaviour is to take no action. * After invoking this method, the Transformer must continue with the * transformation. It should still be possible for the application to * process the document through to the end. * * @param e The warning information encapsulated in a transformer * exception. * @throws TransformerException if the application chooses to discontinue * the transformation (never does in our case). */ public void warning(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG, e.getMessageAndLocation())); } } /** * This method resets the Transformer to its original configuration * Transformer code is reset to the same state it was when it was * created * @since 1.5 */ public void reset() { _method = null; _encoding = null; _sourceSystemId = null; _errorListener = this; _uriResolver = null; _dom = null; _parameters = null; _indentNumber = 0; setOutputProperties (null); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/TrAXFilter.java0000644000175000017500000001124210721374032024143 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TrAXFilter.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.ErrorListener; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.sax.SAXResult; import org.apache.xml.utils.XMLReaderManager; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; import org.xml.sax.helpers.XMLReaderFactory; /** * skeleton extension of XMLFilterImpl for now. * @author Santiago Pericas-Geertsen * @author G. Todd Miller */ public class TrAXFilter extends XMLFilterImpl { private Templates _templates; private TransformerImpl _transformer; private TransformerHandlerImpl _transformerHandler; public TrAXFilter(Templates templates) throws TransformerConfigurationException { _templates = templates; _transformer = (TransformerImpl) templates.newTransformer(); _transformerHandler = new TransformerHandlerImpl(_transformer); } public Transformer getTransformer() { return _transformer; } private void createParent() throws SAXException { XMLReader parent = null; try { SAXParserFactory pfactory = SAXParserFactory.newInstance(); pfactory.setNamespaceAware(true); if (_transformer.isSecureProcessing()) { try { pfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (SAXException e) {} } SAXParser saxparser = pfactory.newSAXParser(); parent = saxparser.getXMLReader(); } catch (ParserConfigurationException e) { throw new SAXException(e); } catch (FactoryConfigurationError e) { throw new SAXException(e.toString()); } if (parent == null) { parent = XMLReaderFactory.createXMLReader(); } // make this XMLReader the parent of this filter setParent(parent); } public void parse (InputSource input) throws SAXException, IOException { XMLReader managedReader = null; try { if (getParent() == null) { try { managedReader = XMLReaderManager.getInstance() .getXMLReader(); setParent(managedReader); } catch (SAXException e) { throw new SAXException(e.toString()); } } // call parse on the parent getParent().parse(input); } finally { if (managedReader != null) { XMLReaderManager.getInstance().releaseXMLReader(managedReader); } } } public void parse (String systemId) throws SAXException, IOException { parse(new InputSource(systemId)); } public void setContentHandler (ContentHandler handler) { _transformerHandler.setResult(new SAXResult(handler)); if (getParent() == null) { try { createParent(); } catch (SAXException e) { return; } } getParent().setContentHandler(_transformerHandler); } public void setErrorListener (ErrorListener handler) { } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java0000644000175000017500000014056210721374032026643 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerFactoryImpl.java 577935 2007-09-20 21:35:20Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.Properties; import java.util.Vector; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import javax.xml.XMLConstants; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TemplatesHandler; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.xsltc.compiler.SourceLoader; import org.apache.xalan.xsltc.compiler.XSLTC; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.dom.XSLTCDTMManager; import org.apache.xml.utils.StopParseException; import org.apache.xml.utils.StylesheetPIHandler; import org.xml.sax.InputSource; import org.xml.sax.XMLFilter; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * Implementation of a JAXP1.1 TransformerFactory for Translets. * @author G. Todd Miller * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */ public class TransformerFactoryImpl extends SAXTransformerFactory implements SourceLoader, ErrorListener { // Public constants for attributes supported by the XSLTC TransformerFactory. public final static String TRANSLET_NAME = "translet-name"; public final static String DESTINATION_DIRECTORY = "destination-directory"; public final static String PACKAGE_NAME = "package-name"; public final static String JAR_NAME = "jar-name"; public final static String GENERATE_TRANSLET = "generate-translet"; public final static String AUTO_TRANSLET = "auto-translet"; public final static String USE_CLASSPATH = "use-classpath"; public final static String DEBUG = "debug"; public final static String ENABLE_INLINING = "enable-inlining"; public final static String INDENT_NUMBER = "indent-number"; /** * This error listener is used only for this factory and is not passed to * the Templates or Transformer objects that we create. */ private ErrorListener _errorListener = this; /** * This URIResolver is passed to all created Templates and Transformers */ private URIResolver _uriResolver = null; /** * As Gregor Samsa awoke one morning from uneasy dreams he found himself * transformed in his bed into a gigantic insect. He was lying on his hard, * as it were armour plated, back, and if he lifted his head a little he * could see his big, brown belly divided into stiff, arched segments, on * top of which the bed quilt could hardly keep in position and was about * to slide off completely. His numerous legs, which were pitifully thin * compared to the rest of his bulk, waved helplessly before his eyes. * "What has happened to me?", he thought. It was no dream.... */ protected final static String DEFAULT_TRANSLET_NAME = "GregorSamsa"; /** * The class name of the translet */ private String _transletName = DEFAULT_TRANSLET_NAME; /** * The destination directory for the translet */ private String _destinationDirectory = null; /** * The package name prefix for all generated translet classes */ private String _packageName = null; /** * The jar file name which the translet classes are packaged into */ private String _jarFileName = null; /** * This Hashtable is used to store parameters for locating * processing instructions in XML docs. */ private Hashtable _piParams = null; /** * The above hashtable stores objects of this class. */ private static class PIParamWrapper { public String _media = null; public String _title = null; public String _charset = null; public PIParamWrapper(String media, String title, String charset) { _media = media; _title = title; _charset = charset; } } /** * Set to true when debugging is enabled. */ private boolean _debug = false; /** * Set to true when templates are inlined. */ private boolean _enableInlining = false; /** * Set to true when we want to generate * translet classes from the stylesheet. */ private boolean _generateTranslet = false; /** * If this is set to true, we attempt to use translet classes * for transformation if possible without compiling the stylesheet. The * translet class is only used if its timestamp is newer than the timestamp * of the stylesheet. */ private boolean _autoTranslet = false; /** * If this is set to true, we attempt to load the translet * from the CLASSPATH. */ private boolean _useClasspath = false; /** * Number of indent spaces when indentation is turned on. */ private int _indentNumber = -1; /** * The provider of the XSLTC DTM Manager service. This is fixed for any * instance of this class. In order to change service providers, a new * XSLTC TransformerFactory must be instantiated. * @see XSLTCDTMManager#getDTMManagerClass() */ private Class m_DTMManagerClass; /** *

        State of secure processing feature.

        */ private boolean _isSecureProcessing = false; /** * javax.xml.transform.sax.TransformerFactory implementation. */ public TransformerFactoryImpl() { m_DTMManagerClass = XSLTCDTMManager.getDTMManagerClass(); } /** * javax.xml.transform.sax.TransformerFactory implementation. * Set the error event listener for the TransformerFactory, which is used * for the processing of transformation instructions, and not for the * transformation itself. * * @param listener The error listener to use with the TransformerFactory * @throws IllegalArgumentException */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { if (listener == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR, "TransformerFactory"); throw new IllegalArgumentException(err.toString()); } _errorListener = listener; } /** * javax.xml.transform.sax.TransformerFactory implementation. * Get the error event handler for the TransformerFactory. * * @return The error listener used with the TransformerFactory */ public ErrorListener getErrorListener() { return _errorListener; } /** * javax.xml.transform.sax.TransformerFactory implementation. * Returns the value set for a TransformerFactory attribute * * @param name The attribute name * @return An object representing the attribute value * @throws IllegalArgumentException */ public Object getAttribute(String name) throws IllegalArgumentException { // Return value for attribute 'translet-name' if (name.equals(TRANSLET_NAME)) { return _transletName; } else if (name.equals(GENERATE_TRANSLET)) { return new Boolean(_generateTranslet); } else if (name.equals(AUTO_TRANSLET)) { return new Boolean(_autoTranslet); } else if (name.equals(ENABLE_INLINING)) { if (_enableInlining) return Boolean.TRUE; else return Boolean.FALSE; } // Throw an exception for all other attributes ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name); throw new IllegalArgumentException(err.toString()); } /** * javax.xml.transform.sax.TransformerFactory implementation. * Sets the value for a TransformerFactory attribute. * * @param name The attribute name * @param value An object representing the attribute value * @throws IllegalArgumentException */ public void setAttribute(String name, Object value) throws IllegalArgumentException { // Set the default translet name (ie. class name), which will be used // for translets that cannot be given a name from their system-id. if (name.equals(TRANSLET_NAME) && value instanceof String) { _transletName = (String) value; return; } else if (name.equals(DESTINATION_DIRECTORY) && value instanceof String) { _destinationDirectory = (String) value; return; } else if (name.equals(PACKAGE_NAME) && value instanceof String) { _packageName = (String) value; return; } else if (name.equals(JAR_NAME) && value instanceof String) { _jarFileName = (String) value; return; } else if (name.equals(GENERATE_TRANSLET)) { if (value instanceof Boolean) { _generateTranslet = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _generateTranslet = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(AUTO_TRANSLET)) { if (value instanceof Boolean) { _autoTranslet = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _autoTranslet = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(USE_CLASSPATH)) { if (value instanceof Boolean) { _useClasspath = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _useClasspath = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(DEBUG)) { if (value instanceof Boolean) { _debug = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _debug = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(ENABLE_INLINING)) { if (value instanceof Boolean) { _enableInlining = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _enableInlining = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(INDENT_NUMBER)) { if (value instanceof String) { try { _indentNumber = Integer.parseInt((String) value); return; } catch (NumberFormatException e) { // Falls through } } else if (value instanceof Integer) { _indentNumber = ((Integer) value).intValue(); return; } } // Throw an exception for all other attributes final ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name); throw new IllegalArgumentException(err.toString()); } /** *

        Set a feature for this TransformerFactory and Transformers * or Templates created by this factory.

        * *

        * Feature names are fully qualified {@link java.net.URI}s. * Implementations may define their own features. * An {@link TransformerConfigurationException} is thrown if this TransformerFactory or the * Transformers or Templates it creates cannot support the feature. * It is possible for an TransformerFactory to expose a feature value but be unable to change its state. *

        * *

        See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.

        * * @param name Feature name. * @param value Is feature state true or false. * * @throws TransformerConfigurationException if this TransformerFactory * or the Transformers or Templates it creates cannot support this feature. * @throws NullPointerException If the name parameter is null. */ public void setFeature(String name, boolean value) throws TransformerConfigurationException { // feature name cannot be null if (name == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME); throw new NullPointerException(err.toString()); } // secure processing? else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { _isSecureProcessing = value; // all done processing feature return; } else { // unknown feature ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name); throw new TransformerConfigurationException(err.toString()); } } /** * javax.xml.transform.sax.TransformerFactory implementation. * Look up the value of a feature (to see if it is supported). * This method must be updated as the various methods and features of this * class are implemented. * * @param name The feature name * @return 'true' if feature is supported, 'false' if not */ public boolean getFeature(String name) { // All supported features should be listed here String[] features = { DOMSource.FEATURE, DOMResult.FEATURE, SAXSource.FEATURE, SAXResult.FEATURE, StreamSource.FEATURE, StreamResult.FEATURE, SAXTransformerFactory.FEATURE, SAXTransformerFactory.FEATURE_XMLFILTER }; // feature name cannot be null if (name == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME); throw new NullPointerException(err.toString()); } // Inefficient, but array is small for (int i =0; i < features.length; i++) { if (name.equals(features[i])) { return true; } } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return _isSecureProcessing; } // Feature not supported return false; } /** * javax.xml.transform.sax.TransformerFactory implementation. * Get the object that is used by default during the transformation to * resolve URIs used in document(), xsl:import, or xsl:include. * * @return The URLResolver used for this TransformerFactory and all * Templates and Transformer objects created using this factory */ public URIResolver getURIResolver() { return _uriResolver; } /** * javax.xml.transform.sax.TransformerFactory implementation. * Set the object that is used by default during the transformation to * resolve URIs used in document(), xsl:import, or xsl:include. Note that * this does not affect Templates and Transformers that are already * created with this factory. * * @param resolver The URLResolver used for this TransformerFactory and all * Templates and Transformer objects created using this factory */ public void setURIResolver(URIResolver resolver) { _uriResolver = resolver; } /** * javax.xml.transform.sax.TransformerFactory implementation. * Get the stylesheet specification(s) associated via the xml-stylesheet * processing instruction (see http://www.w3.org/TR/xml-stylesheet/) with * the document document specified in the source parameter, and that match * the given criteria. * * @param source The XML source document. * @param media The media attribute to be matched. May be null, in which * case the prefered templates will be used (i.e. alternate = no). * @param title The value of the title attribute to match. May be null. * @param charset The value of the charset attribute to match. May be null. * @return A Source object suitable for passing to the TransformerFactory. * @throws TransformerConfigurationException */ public Source getAssociatedStylesheet(Source source, String media, String title, String charset) throws TransformerConfigurationException { String baseId; XMLReader reader = null; InputSource isource = null; /** * Fix for bugzilla bug 24187 */ StylesheetPIHandler _stylesheetPIHandler = new StylesheetPIHandler(null,media,title,charset); try { if (source instanceof DOMSource ) { final DOMSource domsrc = (DOMSource) source; baseId = domsrc.getSystemId(); final org.w3c.dom.Node node = domsrc.getNode(); final DOM2SAX dom2sax = new DOM2SAX(node); _stylesheetPIHandler.setBaseId(baseId); dom2sax.setContentHandler( _stylesheetPIHandler); dom2sax.parse(); } else { isource = SAXSource.sourceToInputSource(source); baseId = isource.getSystemId(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); if (_isSecureProcessing) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException e) {} } SAXParser jaxpParser = factory.newSAXParser(); reader = jaxpParser.getXMLReader(); if (reader == null) { reader = XMLReaderFactory.createXMLReader(); } _stylesheetPIHandler.setBaseId(baseId); reader.setContentHandler(_stylesheetPIHandler); reader.parse(isource); } if (_uriResolver != null ) { _stylesheetPIHandler.setURIResolver(_uriResolver); } } catch (StopParseException e ) { // startElement encountered so do not parse further } catch (javax.xml.parsers.ParserConfigurationException e) { throw new TransformerConfigurationException( "getAssociatedStylesheets failed", e); } catch (org.xml.sax.SAXException se) { throw new TransformerConfigurationException( "getAssociatedStylesheets failed", se); } catch (IOException ioe ) { throw new TransformerConfigurationException( "getAssociatedStylesheets failed", ioe); } return _stylesheetPIHandler.getAssociatedStylesheet(); } /** * javax.xml.transform.sax.TransformerFactory implementation. * Create a Transformer object that copies the input document to the result. * * @return A Transformer object that simply copies the source to the result. * @throws TransformerConfigurationException */ public Transformer newTransformer() throws TransformerConfigurationException { TransformerImpl result = new TransformerImpl(new Properties(), _indentNumber, this); if (_uriResolver != null) { result.setURIResolver(_uriResolver); } if (_isSecureProcessing) { result.setSecureProcessing(true); } return result; } /** * javax.xml.transform.sax.TransformerFactory implementation. * Process the Source into a Templates object, which is a a compiled * representation of the source. Note that this method should not be * used with XSLTC, as the time-consuming compilation is done for each * and every transformation. * * @return A Templates object that can be used to create Transformers. * @throws TransformerConfigurationException */ public Transformer newTransformer(Source source) throws TransformerConfigurationException { final Templates templates = newTemplates(source); final Transformer transformer = templates.newTransformer(); if (_uriResolver != null) { transformer.setURIResolver(_uriResolver); } return(transformer); } /** * Pass warning messages from the compiler to the error listener */ private void passWarningsToListener(Vector messages) throws TransformerException { if (_errorListener == null || messages == null) { return; } // Pass messages to listener, one by one final int count = messages.size(); for (int pos = 0; pos < count; pos++) { ErrorMsg msg = (ErrorMsg)messages.elementAt(pos); // Workaround for the TCK failure ErrorListener.errorTests.error001. if (msg.isWarningError()) _errorListener.error( new TransformerConfigurationException(msg.toString())); else _errorListener.warning( new TransformerConfigurationException(msg.toString())); } } /** * Pass error messages from the compiler to the error listener */ private void passErrorsToListener(Vector messages) { try { if (_errorListener == null || messages == null) { return; } // Pass messages to listener, one by one final int count = messages.size(); for (int pos = 0; pos < count; pos++) { String message = messages.elementAt(pos).toString(); _errorListener.error(new TransformerException(message)); } } catch (TransformerException e) { // nada } } /** * javax.xml.transform.sax.TransformerFactory implementation. * Process the Source into a Templates object, which is a a compiled * representation of the source. * * @param source The input stylesheet - DOMSource not supported!!! * @return A Templates object that can be used to create Transformers. * @throws TransformerConfigurationException */ public Templates newTemplates(Source source) throws TransformerConfigurationException { // If the _useClasspath attribute is true, try to load the translet from // the CLASSPATH and create a template object using the loaded // translet. if (_useClasspath) { String transletName = getTransletBaseName(source); if (_packageName != null) transletName = _packageName + "." + transletName; try { final Class clazz = ObjectFactory.findProviderClass( transletName, ObjectFactory.findClassLoader(), true); resetTransientAttributes(); return new TemplatesImpl(new Class[]{clazz}, transletName, null, _indentNumber, this); } catch (ClassNotFoundException cnfe) { ErrorMsg err = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, transletName); throw new TransformerConfigurationException(err.toString()); } catch (Exception e) { ErrorMsg err = new ErrorMsg( new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY) + e.getMessage()); throw new TransformerConfigurationException(err.toString()); } } // If _autoTranslet is true, we will try to load the bytecodes // from the translet classes without compiling the stylesheet. if (_autoTranslet) { byte[][] bytecodes = null; String transletClassName = getTransletBaseName(source); if (_packageName != null) transletClassName = _packageName + "." + transletClassName; if (_jarFileName != null) bytecodes = getBytecodesFromJar(source, transletClassName); else bytecodes = getBytecodesFromClasses(source, transletClassName); if (bytecodes != null) { if (_debug) { if (_jarFileName != null) System.err.println(new ErrorMsg( ErrorMsg.TRANSFORM_WITH_JAR_STR, transletClassName, _jarFileName)); else System.err.println(new ErrorMsg( ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, transletClassName)); } // Reset the per-session attributes to their default values // after each newTemplates() call. resetTransientAttributes(); return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this); } } // Create and initialize a stylesheet compiler final XSLTC xsltc = new XSLTC(); if (_debug) xsltc.setDebug(true); if (_enableInlining) xsltc.setTemplateInlining(true); else xsltc.setTemplateInlining(false); if (_isSecureProcessing) xsltc.setSecureProcessing(true); xsltc.init(); // Set a document loader (for xsl:include/import) if defined if (_uriResolver != null) { xsltc.setSourceLoader(this); } // Pass parameters to the Parser to make sure it locates the correct // PI in an XML input document if ((_piParams != null) && (_piParams.get(source) != null)) { // Get the parameters for this Source object PIParamWrapper p = (PIParamWrapper)_piParams.get(source); // Pass them on to the compiler (which will pass then to the parser) if (p != null) { xsltc.setPIParameters(p._media, p._title, p._charset); } } // Set the attributes for translet generation int outputType = XSLTC.BYTEARRAY_OUTPUT; if (_generateTranslet || _autoTranslet) { // Set the translet name xsltc.setClassName(getTransletBaseName(source)); if (_destinationDirectory != null) xsltc.setDestDirectory(_destinationDirectory); else { String xslName = getStylesheetFileName(source); if (xslName != null) { File xslFile = new File(xslName); String xslDir = xslFile.getParent(); if (xslDir != null) xsltc.setDestDirectory(xslDir); } } if (_packageName != null) xsltc.setPackageName(_packageName); if (_jarFileName != null) { xsltc.setJarFileName(_jarFileName); outputType = XSLTC.BYTEARRAY_AND_JAR_OUTPUT; } else outputType = XSLTC.BYTEARRAY_AND_FILE_OUTPUT; } // Compile the stylesheet final InputSource input = Util.getInputSource(xsltc, source); byte[][] bytecodes = xsltc.compile(null, input, outputType); final String transletName = xsltc.getClassName(); // Output to the jar file if the jar file name is set. if ((_generateTranslet || _autoTranslet) && bytecodes != null && _jarFileName != null) { try { xsltc.outputToJar(); } catch (java.io.IOException e) { } } // Reset the per-session attributes to their default values // after each newTemplates() call. resetTransientAttributes(); // Pass compiler warnings to the error listener if (_errorListener != this) { try { passWarningsToListener(xsltc.getWarnings()); } catch (TransformerException e) { throw new TransformerConfigurationException(e); } } else { xsltc.printWarnings(); } // Check that the transformation went well before returning if (bytecodes == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR); TransformerConfigurationException exc = new TransformerConfigurationException(err.toString()); // Pass compiler errors to the error listener if (_errorListener != null) { passErrorsToListener(xsltc.getErrors()); // As required by TCK 1.2, send a fatalError to the // error listener because compilation of the stylesheet // failed and no further processing will be possible. try { _errorListener.fatalError(exc); } catch (TransformerException te) { // well, we tried. } } else { xsltc.printErrors(); } throw exc; } return new TemplatesImpl(bytecodes, transletName, xsltc.getOutputProperties(), _indentNumber, this); } /** * javax.xml.transform.sax.SAXTransformerFactory implementation. * Get a TemplatesHandler object that can process SAX ContentHandler * events into a Templates object. * * @return A TemplatesHandler object that can handle SAX events * @throws TransformerConfigurationException */ public TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException { final TemplatesHandlerImpl handler = new TemplatesHandlerImpl(_indentNumber, this); if (_uriResolver != null) { handler.setURIResolver(_uriResolver); } return handler; } /** * javax.xml.transform.sax.SAXTransformerFactory implementation. * Get a TransformerHandler object that can process SAX ContentHandler * events into a Result. This method will return a pure copy transformer. * * @return A TransformerHandler object that can handle SAX events * @throws TransformerConfigurationException */ public TransformerHandler newTransformerHandler() throws TransformerConfigurationException { final Transformer transformer = newTransformer(); if (_uriResolver != null) { transformer.setURIResolver(_uriResolver); } return new TransformerHandlerImpl((TransformerImpl) transformer); } /** * javax.xml.transform.sax.SAXTransformerFactory implementation. * Get a TransformerHandler object that can process SAX ContentHandler * events into a Result, based on the transformation instructions * specified by the argument. * * @param src The source of the transformation instructions. * @return A TransformerHandler object that can handle SAX events * @throws TransformerConfigurationException */ public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException { final Transformer transformer = newTransformer(src); if (_uriResolver != null) { transformer.setURIResolver(_uriResolver); } return new TransformerHandlerImpl((TransformerImpl) transformer); } /** * javax.xml.transform.sax.SAXTransformerFactory implementation. * Get a TransformerHandler object that can process SAX ContentHandler * events into a Result, based on the transformation instructions * specified by the argument. * * @param templates Represents a pre-processed stylesheet * @return A TransformerHandler object that can handle SAX events * @throws TransformerConfigurationException */ public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException { final Transformer transformer = templates.newTransformer(); final TransformerImpl internal = (TransformerImpl)transformer; return new TransformerHandlerImpl(internal); } /** * javax.xml.transform.sax.SAXTransformerFactory implementation. * Create an XMLFilter that uses the given source as the * transformation instructions. * * @param src The source of the transformation instructions. * @return An XMLFilter object, or null if this feature is not supported. * @throws TransformerConfigurationException */ public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException { Templates templates = newTemplates(src); if (templates == null) return null; return newXMLFilter(templates); } /** * javax.xml.transform.sax.SAXTransformerFactory implementation. * Create an XMLFilter that uses the given source as the * transformation instructions. * * @param templates The source of the transformation instructions. * @return An XMLFilter object, or null if this feature is not supported. * @throws TransformerConfigurationException */ public XMLFilter newXMLFilter(Templates templates) throws TransformerConfigurationException { try { return new org.apache.xalan.xsltc.trax.TrAXFilter(templates); } catch (TransformerConfigurationException e1) { if (_errorListener != null) { try { _errorListener.fatalError(e1); return null; } catch (TransformerException e2) { new TransformerConfigurationException(e2); } } throw e1; } } /** * Receive notification of a recoverable error. * The transformer must continue to provide normal parsing events after * invoking this method. It should still be possible for the application * to process the document through to the end. * * @param e The warning information encapsulated in a transformer * exception. * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ public void error(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG, e.getMessageAndLocation())); } throw e; } /** * Receive notification of a non-recoverable error. * The application must assume that the transformation cannot continue * after the Transformer has invoked this method, and should continue * (if at all) only to collect addition error messages. In fact, * Transformers are free to stop reporting events once this method has * been invoked. * * @param e warning information encapsulated in a transformer * exception. * @throws TransformerException if the application chooses to discontinue * the transformation (always does in our case). */ public void fatalError(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG, e.getMessageAndLocation())); } throw e; } /** * Receive notification of a warning. * Transformers can use this method to report conditions that are not * errors or fatal errors. The default behaviour is to take no action. * After invoking this method, the Transformer must continue with the * transformation. It should still be possible for the application to * process the document through to the end. * * @param e The warning information encapsulated in a transformer * exception. * @throws TransformerException if the application chooses to discontinue * the transformation (never does in our case). */ public void warning(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG, e.getMessageAndLocation())); } } /** * This method implements XSLTC's SourceLoader interface. It is used to * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes. * * @param href The URI of the document to load * @param context The URI of the currently loaded document * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */ public InputSource loadSource(String href, String context, XSLTC xsltc) { try { if (_uriResolver != null) { final Source source = _uriResolver.resolve(href, context); if (source != null) { return Util.getInputSource(xsltc, source); } } } catch (TransformerException e) { // Falls through } return null; } /** * Reset the per-session attributes to their default values */ private void resetTransientAttributes() { _transletName = DEFAULT_TRANSLET_NAME; _destinationDirectory = null; _packageName = null; _jarFileName = null; } /** * Load the translet classes from local .class files and return * the bytecode array. * * @param source The xsl source * @param fullClassName The full name of the translet * @return The bytecode array */ private byte[][] getBytecodesFromClasses(Source source, String fullClassName) { if (fullClassName == null) return null; String xslFileName = getStylesheetFileName(source); File xslFile = null; if (xslFileName != null) xslFile = new File(xslFileName); // Find the base name of the translet final String transletName; int lastDotIndex = fullClassName.lastIndexOf('.'); if (lastDotIndex > 0) transletName = fullClassName.substring(lastDotIndex+1); else transletName = fullClassName; // Construct the path name for the translet class file String transletPath = fullClassName.replace('.', '/'); if (_destinationDirectory != null) { transletPath = _destinationDirectory + "/" + transletPath + ".class"; } else { if (xslFile != null && xslFile.getParent() != null) transletPath = xslFile.getParent() + "/" + transletPath + ".class"; else transletPath = transletPath + ".class"; } // Return null if the translet class file does not exist. File transletFile = new File(transletPath); if (!transletFile.exists()) return null; // Compare the timestamps of the translet and the xsl file. // If the translet is older than the xsl file, return null // so that the xsl file is used for the transformation and // the translet is regenerated. if (xslFile != null && xslFile.exists()) { long xslTimestamp = xslFile.lastModified(); long transletTimestamp = transletFile.lastModified(); if (transletTimestamp < xslTimestamp) return null; } // Load the translet into a bytecode array. List bytecodes = new ArrayList(); int fileLength = (int)transletFile.length(); if (fileLength > 0) { FileInputStream input = null; try { input = new FileInputStream(transletFile); } catch (FileNotFoundException e) { return null; } byte[] bytes = new byte[fileLength]; try { readFromInputStream(bytes, input, fileLength); input.close(); } catch (IOException e) { return null; } bytecodes.add(bytes); } else return null; // Find the parent directory of the translet. String transletParentDir = transletFile.getParent(); if (transletParentDir == null) transletParentDir = System.getProperty("user.dir"); File transletParentFile = new File(transletParentDir); // Find all the auxiliary files which have a name pattern of "transletClass$nnn.class". final String transletAuxPrefix = transletName + "$"; File[] auxfiles = transletParentFile.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return (name.endsWith(".class") && name.startsWith(transletAuxPrefix)); } }); // Load the auxiliary class files and add them to the bytecode array. for (int i = 0; i < auxfiles.length; i++) { File auxfile = auxfiles[i]; int auxlength = (int)auxfile.length(); if (auxlength > 0) { FileInputStream auxinput = null; try { auxinput = new FileInputStream(auxfile); } catch (FileNotFoundException e) { continue; } byte[] bytes = new byte[auxlength]; try { readFromInputStream(bytes, auxinput, auxlength); auxinput.close(); } catch (IOException e) { continue; } bytecodes.add(bytes); } } // Convert the Vector of byte[] to byte[][]. final int count = bytecodes.size(); if ( count > 0) { final byte[][] result = new byte[count][1]; for (int i = 0; i < count; i++) { result[i] = (byte[])bytecodes.get(i); } return result; } else return null; } /** * Load the translet classes from the jar file and return the bytecode. * * @param source The xsl source * @param fullClassName The full name of the translet * @return The bytecode array */ private byte[][] getBytecodesFromJar(Source source, String fullClassName) { String xslFileName = getStylesheetFileName(source); File xslFile = null; if (xslFileName != null) xslFile = new File(xslFileName); // Construct the path for the jar file String jarPath = null; if (_destinationDirectory != null) jarPath = _destinationDirectory + "/" + _jarFileName; else { if (xslFile != null && xslFile.getParent() != null) jarPath = xslFile.getParent() + "/" + _jarFileName; else jarPath = _jarFileName; } // Return null if the jar file does not exist. File file = new File(jarPath); if (!file.exists()) return null; // Compare the timestamps of the jar file and the xsl file. Return null // if the xsl file is newer than the jar file. if (xslFile != null && xslFile.exists()) { long xslTimestamp = xslFile.lastModified(); long transletTimestamp = file.lastModified(); if (transletTimestamp < xslTimestamp) return null; } // Create a ZipFile object for the jar file ZipFile jarFile = null; try { jarFile = new ZipFile(file); } catch (IOException e) { return null; } String transletPath = fullClassName.replace('.', '/'); String transletAuxPrefix = transletPath + "$"; String transletFullName = transletPath + ".class"; List bytecodes = new ArrayList(); // Iterate through all entries in the jar file to find the // translet and auxiliary classes. Enumeration entries = jarFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry)entries.nextElement(); String entryName = entry.getName(); if (entry.getSize() > 0 && (entryName.equals(transletFullName) || (entryName.endsWith(".class") && entryName.startsWith(transletAuxPrefix)))) { try { InputStream input = jarFile.getInputStream(entry); int size = (int)entry.getSize(); byte[] bytes = new byte[size]; readFromInputStream(bytes, input, size); input.close(); bytecodes.add(bytes); } catch (IOException e) { return null; } } } // Convert the Vector of byte[] to byte[][]. final int count = bytecodes.size(); if (count > 0) { final byte[][] result = new byte[count][1]; for (int i = 0; i < count; i++) { result[i] = (byte[])bytecodes.get(i); } return result; } else return null; } /** * Read a given number of bytes from the InputStream into a byte array. * * @param bytes The byte array to store the input content. * @param input The input stream. * @param size The number of bytes to read. */ private void readFromInputStream(byte[] bytes, InputStream input, int size) throws IOException { int n = 0; int offset = 0; int length = size; while (length > 0 && (n = input.read(bytes, offset, length)) > 0) { offset = offset + n; length = length - n; } } /** * Return the base class name of the translet. * The translet name is resolved using the following rules: * 1. if the _transletName attribute is set and its value is not "GregorSamsa", * then _transletName is returned. * 2. otherwise get the translet name from the base name of the system ID * 3. return "GregorSamsa" if the result from step 2 is null. * * @param source The input Source * @return The name of the translet class */ private String getTransletBaseName(Source source) { String transletBaseName = null; if (!_transletName.equals(DEFAULT_TRANSLET_NAME)) return _transletName; else { String systemId = source.getSystemId(); if (systemId != null) { String baseName = Util.baseName(systemId); if (baseName != null) { baseName = Util.noExtName(baseName); transletBaseName = Util.toJavaName(baseName); } } } return (transletBaseName != null) ? transletBaseName : DEFAULT_TRANSLET_NAME; } /** * Return the local file name from the systemId of the Source object * * @param source The Source * @return The file name in the local filesystem, or null if the * systemId does not represent a local file. */ private String getStylesheetFileName(Source source) { String systemId = source.getSystemId(); if (systemId != null) { File file = new File(systemId); if (file.exists()) return systemId; else { URL url = null; try { url = new URL(systemId); } catch (MalformedURLException e) { return null; } if ("file".equals(url.getProtocol())) return url.getFile(); else return null; } } else return null; } /** * Returns the Class object the provides the XSLTC DTM Manager service. */ protected Class getDTMManagerClass() { return m_DTMManagerClass; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java0000644000175000017500000003034610721374031024744 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TemplatesImpl.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Properties; import java.security.AccessController; import java.security.PrivilegedAction; import javax.xml.XMLConstants; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.URIResolver; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.runtime.Hashtable; /** * @author Morten Jorgensen * @author G. Todd Millerj * @author Jochen Cordes * @author Santiago Pericas-Geertsen */ public final class TemplatesImpl implements Templates, Serializable { static final long serialVersionUID = 673094361519270707L; /** * Name of the superclass of all translets. This is needed to * determine which, among all classes comprising a translet, * is the main one. */ private static String ABSTRACT_TRANSLET = "org.apache.xalan.xsltc.runtime.AbstractTranslet"; /** * Name of the main class or default name if unknown. */ private String _name = null; /** * Contains the actual class definition for the translet class and * any auxiliary classes. */ private byte[][] _bytecodes = null; /** * Contains the translet class definition(s). These are created when * this Templates is created or when it is read back from disk. */ private Class[] _class = null; /** * The index of the main translet class in the arrays _class[] and * _bytecodes. */ private int _transletIndex = -1; /** * Contains the list of auxiliary class definitions. */ private Hashtable _auxClasses = null; /** * Output properties of this translet. */ private Properties _outputProperties; /** * Number of spaces to add for output indentation. */ private int _indentNumber; /** * This URIResolver is passed to all Transformers. * Declaring it transient to fix bug 22438 */ private transient URIResolver _uriResolver = null; /** * Cache the DTM for the stylesheet in a thread local variable, * which is used by the document('') function. * Use ThreadLocal because a DTM cannot be shared between * multiple threads. * Declaring it transient to fix bug 22438 */ private transient ThreadLocal _sdom = new ThreadLocal(); /** * A reference to the transformer factory that this templates * object belongs to. */ private transient TransformerFactoryImpl _tfactory = null; static final class TransletClassLoader extends ClassLoader { TransletClassLoader(ClassLoader parent) { super(parent); } /** * Access to final protected superclass member from outer class. */ Class defineClass(final byte[] b) { return defineClass(null, b, 0, b.length); } } /** * Create an XSLTC template object from the bytecodes. * The bytecodes for the translet and auxiliary classes, plus the name of * the main translet class, must be supplied. */ protected TemplatesImpl(byte[][] bytecodes, String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory) { _bytecodes = bytecodes; _name = transletName; _outputProperties = outputProperties; _indentNumber = indentNumber; _tfactory = tfactory; } /** * Create an XSLTC template object from the translet class definition(s). */ protected TemplatesImpl(Class[] transletClasses, String transletName, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory) { _class = transletClasses; _name = transletName; _transletIndex = 0; _outputProperties = outputProperties; _indentNumber = indentNumber; _tfactory = tfactory; } /** * Need for de-serialization, see readObject(). */ public TemplatesImpl() { } /** * Overrides the default readObject implementation since we decided * it would be cleaner not to serialize the entire tranformer * factory. [ ref bugzilla 12317 ] * We need to check if the user defined class for URIResolver also * implemented Serializable * if yes then we need to deserialize the URIResolver * Fix for bugzilla bug 22438 */ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { is.defaultReadObject(); if (is.readBoolean()) { _uriResolver = (URIResolver) is.readObject(); } _tfactory = new TransformerFactoryImpl(); } /** * This is to fix bugzilla bug 22438 * If the user defined class implements URIResolver and Serializable * then we want it to get serialized */ private void writeObject(ObjectOutputStream os) throws IOException, ClassNotFoundException { os.defaultWriteObject(); if (_uriResolver instanceof Serializable) { os.writeBoolean(true); os.writeObject((Serializable) _uriResolver); } else { os.writeBoolean(false); } } /** * Store URIResolver needed for Transformers. */ public synchronized void setURIResolver(URIResolver resolver) { _uriResolver = resolver; } /** * The TransformerFactory must pass us the translet bytecodes using this * method before we can create any translet instances */ protected synchronized void setTransletBytecodes(byte[][] bytecodes) { _bytecodes = bytecodes; } /** * Returns the translet bytecodes stored in this template */ public synchronized byte[][] getTransletBytecodes() { return _bytecodes; } /** * Returns the translet bytecodes stored in this template */ public synchronized Class[] getTransletClasses() { try { if (_class == null) defineTransletClasses(); } catch (TransformerConfigurationException e) { // Falls through } return _class; } /** * Returns the index of the main class in array of bytecodes */ public synchronized int getTransletIndex() { try { if (_class == null) defineTransletClasses(); } catch (TransformerConfigurationException e) { // Falls through } return _transletIndex; } /** * The TransformerFactory should call this method to set the translet name */ protected synchronized void setTransletName(String name) { _name = name; } /** * Returns the name of the main translet class stored in this template */ protected synchronized String getTransletName() { return _name; } /** * Defines the translet class and auxiliary classes. * Returns a reference to the Class object that defines the main class */ private void defineTransletClasses() throws TransformerConfigurationException { if (_bytecodes == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.NO_TRANSLET_CLASS_ERR); throw new TransformerConfigurationException(err.toString()); } TransletClassLoader loader = (TransletClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new TransletClassLoader(ObjectFactory.findClassLoader()); } }); try { final int classCount = _bytecodes.length; _class = new Class[classCount]; if (classCount > 1) { _auxClasses = new Hashtable(); } for (int i = 0; i < classCount; i++) { _class[i] = loader.defineClass(_bytecodes[i]); final Class superClass = _class[i].getSuperclass(); // Check if this is the main class if (superClass.getName().equals(ABSTRACT_TRANSLET)) { _transletIndex = i; } else { _auxClasses.put(_class[i].getName(), _class[i]); } } if (_transletIndex < 0) { ErrorMsg err= new ErrorMsg(ErrorMsg.NO_MAIN_TRANSLET_ERR, _name); throw new TransformerConfigurationException(err.toString()); } } catch (ClassFormatError e) { ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_CLASS_ERR, _name); throw new TransformerConfigurationException(err.toString()); } catch (LinkageError e) { ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_OBJECT_ERR, _name); throw new TransformerConfigurationException(err.toString()); } } /** * This method generates an instance of the translet class that is * wrapped inside this Template. The translet instance will later * be wrapped inside a Transformer object. */ private Translet getTransletInstance() throws TransformerConfigurationException { try { if (_name == null) return null; if (_class == null) defineTransletClasses(); // The translet needs to keep a reference to all its auxiliary // class to prevent the GC from collecting them AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance(); translet.postInitialization(); translet.setTemplates(this); if (_auxClasses != null) { translet.setAuxiliaryClasses(_auxClasses); } return translet; } catch (InstantiationException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_OBJECT_ERR, _name); throw new TransformerConfigurationException(err.toString()); } catch (IllegalAccessException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_OBJECT_ERR, _name); throw new TransformerConfigurationException(err.toString()); } } /** * Implements JAXP's Templates.newTransformer() * * @throws TransformerConfigurationException */ public synchronized Transformer newTransformer() throws TransformerConfigurationException { TransformerImpl transformer; transformer = new TransformerImpl(getTransletInstance(), _outputProperties, _indentNumber, _tfactory); if (_uriResolver != null) { transformer.setURIResolver(_uriResolver); } if (_tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) { transformer.setSecureProcessing(true); } return transformer; } /** * Implements JAXP's Templates.getOutputProperties(). We need to * instanciate a translet to get the output settings, so * we might as well just instanciate a Transformer and use its * implementation of this method. */ public synchronized Properties getOutputProperties() { try { return newTransformer().getOutputProperties(); } catch (TransformerConfigurationException e) { return null; } } /** * Return the thread local copy of the stylesheet DOM. */ public DOM getStylesheetDOM() { return (DOM)_sdom.get(); } /** * Set the thread local copy of the stylesheet DOM. */ public void setStylesheetDOM(DOM sdom) { _sdom.set(sdom); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/Util.java0000644000175000017500000001610510721374033023100 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Util.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.InputStream; import java.io.Reader; import javax.xml.XMLConstants; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Source; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.xsltc.compiler.XSLTC; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * @author Santiago Pericas-Geertsen */ public final class Util { public static String baseName(String name) { return org.apache.xalan.xsltc.compiler.util.Util.baseName(name); } public static String noExtName(String name) { return org.apache.xalan.xsltc.compiler.util.Util.noExtName(name); } public static String toJavaName(String name) { return org.apache.xalan.xsltc.compiler.util.Util.toJavaName(name); } /** * Creates a SAX2 InputSource object from a TrAX Source object */ public static InputSource getInputSource(XSLTC xsltc, Source source) throws TransformerConfigurationException { InputSource input = null; String systemId = source.getSystemId(); try { // Try to get InputSource from SAXSource input if (source instanceof SAXSource) { final SAXSource sax = (SAXSource)source; input = sax.getInputSource(); // Pass the SAX parser to the compiler try { XMLReader reader = sax.getXMLReader(); /* * Fix for bug 24695 * According to JAXP 1.2 specification if a SAXSource * is created using a SAX InputSource the Transformer or * TransformerFactory creates a reader via the * XMLReaderFactory if setXMLReader is not used */ if (reader == null) { try { reader= XMLReaderFactory.createXMLReader(); } catch (Exception e ) { try { //Incase there is an exception thrown // resort to JAXP SAXParserFactory parserFactory = SAXParserFactory.newInstance(); parserFactory.setNamespaceAware(true); if (xsltc.isSecureProcessing()) { try { parserFactory.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException se) {} } reader = parserFactory.newSAXParser() .getXMLReader(); } catch (ParserConfigurationException pce ) { throw new TransformerConfigurationException ("ParserConfigurationException" ,pce); } } } reader.setFeature ("http://xml.org/sax/features/namespaces",true); reader.setFeature ("http://xml.org/sax/features/namespace-prefixes",false); xsltc.setXMLReader(reader); }catch (SAXNotRecognizedException snre ) { throw new TransformerConfigurationException ("SAXNotRecognizedException ",snre); }catch (SAXNotSupportedException snse ) { throw new TransformerConfigurationException ("SAXNotSupportedException ",snse); }catch (SAXException se ) { throw new TransformerConfigurationException ("SAXException ",se); } } // handle DOMSource else if (source instanceof DOMSource) { final DOMSource domsrc = (DOMSource)source; final Document dom = (Document)domsrc.getNode(); final DOM2SAX dom2sax = new DOM2SAX(dom); xsltc.setXMLReader(dom2sax); // Try to get SAX InputSource from DOM Source. input = SAXSource.sourceToInputSource(source); if (input == null){ input = new InputSource(domsrc.getSystemId()); } } // Try to get InputStream or Reader from StreamSource else if (source instanceof StreamSource) { final StreamSource stream = (StreamSource)source; final InputStream istream = stream.getInputStream(); final Reader reader = stream.getReader(); xsltc.setXMLReader(null); // Clear old XML reader // Create InputSource from Reader or InputStream in Source if (istream != null) { input = new InputSource(istream); } else if (reader != null) { input = new InputSource(reader); } else { input = new InputSource(systemId); } } else { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_SOURCE_ERR); throw new TransformerConfigurationException(err.toString()); } input.setSystemId(systemId); } catch (NullPointerException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR, "TransformerFactory.newTemplates()"); throw new TransformerConfigurationException(err.toString()); } catch (SecurityException e) { ErrorMsg err = new ErrorMsg(ErrorMsg.FILE_ACCESS_ERR, systemId); throw new TransformerConfigurationException(err.toString()); } return input; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java0000644000175000017500000002630210721374030026236 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TemplatesHandlerImpl.java 577935 2007-09-20 21:35:20Z minchau $ */ package org.apache.xalan.xsltc.trax; import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.sax.TemplatesHandler; import org.apache.xalan.xsltc.compiler.CompilerException; import org.apache.xalan.xsltc.compiler.Parser; import org.apache.xalan.xsltc.compiler.SourceLoader; import org.apache.xalan.xsltc.compiler.Stylesheet; import org.apache.xalan.xsltc.compiler.SyntaxTreeNode; import org.apache.xalan.xsltc.compiler.XSLTC; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.Attributes; import java.util.Vector; /** * Implementation of a JAXP1.1 TemplatesHandler * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */ public class TemplatesHandlerImpl implements ContentHandler, TemplatesHandler, SourceLoader { /** * System ID for this stylesheet. */ private String _systemId; /** * Number of spaces to add for output indentation. */ private int _indentNumber; /** * This URIResolver is passed to all Transformers. */ private URIResolver _uriResolver = null; /** * A reference to the transformer factory that this templates * object belongs to. */ private TransformerFactoryImpl _tfactory = null; /** * A reference to XSLTC's parser object. */ private Parser _parser = null; /** * The created Templates object. */ private TemplatesImpl _templates = null; /** * Default constructor */ protected TemplatesHandlerImpl(int indentNumber, TransformerFactoryImpl tfactory) { _indentNumber = indentNumber; _tfactory = tfactory; // Instantiate XSLTC and get reference to parser object XSLTC xsltc = new XSLTC(); if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) xsltc.setSecureProcessing(true); if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING))) xsltc.setTemplateInlining(true); else xsltc.setTemplateInlining(false); _parser = xsltc.getParser(); } /** * Implements javax.xml.transform.sax.TemplatesHandler.getSystemId() * Get the base ID (URI or system ID) from where relative URLs will be * resolved. * @return The systemID that was set with setSystemId(String id) */ public String getSystemId() { return _systemId; } /** * Implements javax.xml.transform.sax.TemplatesHandler.setSystemId() * Get the base ID (URI or system ID) from where relative URLs will be * resolved. * @param id Base URI for this stylesheet */ public void setSystemId(String id) { _systemId = id; } /** * Store URIResolver needed for Transformers. */ public void setURIResolver(URIResolver resolver) { _uriResolver = resolver; } /** * Implements javax.xml.transform.sax.TemplatesHandler.getTemplates() * When a TemplatesHandler object is used as a ContentHandler or * DocumentHandler for the parsing of transformation instructions, it * creates a Templates object, which the caller can get once the SAX * events have been completed. * @return The Templates object that was created during the SAX event * process, or null if no Templates object has been created. */ public Templates getTemplates() { return _templates; } /** * This method implements XSLTC's SourceLoader interface. It is used to * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes. * * @param href The URI of the document to load * @param context The URI of the currently loaded document * @param xsltc The compiler that resuests the document * @return An InputSource with the loaded document */ public InputSource loadSource(String href, String context, XSLTC xsltc) { try { // A _uriResolver must be set if this method is called final Source source = _uriResolver.resolve(href, context); if (source != null) { return Util.getInputSource(xsltc, source); } } catch (TransformerException e) { // Falls through } return null; } // -- ContentHandler -------------------------------------------------- /** * Re-initialize parser and forward SAX2 event. */ public void startDocument() { XSLTC xsltc = _parser.getXSLTC(); xsltc.init(); // calls _parser.init() xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT); _parser.startDocument(); } /** * Just forward SAX2 event to parser object. */ public void endDocument() throws SAXException { _parser.endDocument(); // create the templates try { XSLTC xsltc = _parser.getXSLTC(); // Set the translet class name if not already set String transletName; if (_systemId != null) { transletName = Util.baseName(_systemId); } else { transletName = (String)_tfactory.getAttribute("translet-name"); } xsltc.setClassName(transletName); // Get java-legal class name from XSLTC module transletName = xsltc.getClassName(); Stylesheet stylesheet = null; SyntaxTreeNode root = _parser.getDocumentRoot(); // Compile the translet - this is where the work is done! if (!_parser.errorsFound() && root != null) { // Create a Stylesheet element from the root node stylesheet = _parser.makeStylesheet(root); stylesheet.setSystemId(_systemId); stylesheet.setParentStylesheet(null); if (xsltc.getTemplateInlining()) stylesheet.setTemplateInlining(true); else stylesheet.setTemplateInlining(false); // Set a document loader (for xsl:include/import) if defined if (_uriResolver != null) { stylesheet.setSourceLoader(this); } _parser.setCurrentStylesheet(stylesheet); // Set it as top-level in the XSLTC object xsltc.setStylesheet(stylesheet); // Create AST under the Stylesheet element _parser.createAST(stylesheet); } // Generate the bytecodes and output the translet class(es) if (!_parser.errorsFound() && stylesheet != null) { stylesheet.setMultiDocument(xsltc.isMultiDocument()); stylesheet.setHasIdCall(xsltc.hasIdCall()); // Class synchronization is needed for BCEL synchronized (xsltc.getClass()) { stylesheet.translate(); } } if (!_parser.errorsFound()) { // Check that the transformation went well before returning final byte[][] bytecodes = xsltc.getBytecodes(); if (bytecodes != null) { _templates = new TemplatesImpl(xsltc.getBytecodes(), transletName, _parser.getOutputProperties(), _indentNumber, _tfactory); // Set URIResolver on templates object if (_uriResolver != null) { _templates.setURIResolver(_uriResolver); } } } else { StringBuffer errorMessage = new StringBuffer(); Vector errors = _parser.getErrors(); final int count = errors.size(); for (int i = 0; i < count; i++) { if (errorMessage.length() > 0) errorMessage.append('\n'); errorMessage.append(errors.elementAt(i).toString()); } throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, new TransformerException(errorMessage.toString())); } } catch (CompilerException e) { throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, e); } } /** * Just forward SAX2 event to parser object. */ public void startPrefixMapping(String prefix, String uri) { _parser.startPrefixMapping(prefix, uri); } /** * Just forward SAX2 event to parser object. */ public void endPrefixMapping(String prefix) { _parser.endPrefixMapping(prefix); } /** * Just forward SAX2 event to parser object. */ public void startElement(String uri, String localname, String qname, Attributes attributes) throws SAXException { _parser.startElement(uri, localname, qname, attributes); } /** * Just forward SAX2 event to parser object. */ public void endElement(String uri, String localname, String qname) { _parser.endElement(uri, localname, qname); } /** * Just forward SAX2 event to parser object. */ public void characters(char[] ch, int start, int length) { _parser.characters(ch, start, length); } /** * Just forward SAX2 event to parser object. */ public void processingInstruction(String name, String value) { _parser.processingInstruction(name, value); } /** * Just forward SAX2 event to parser object. */ public void ignorableWhitespace(char[] ch, int start, int length) { _parser.ignorableWhitespace(ch, start, length); } /** * Just forward SAX2 event to parser object. */ public void skippedEntity(String name) { _parser.skippedEntity(name); } /** * Set internal system Id and forward SAX2 event to parser object. */ public void setDocumentLocator(Locator locator) { setSystemId(locator.getSystemId()); _parser.setDocumentLocator(locator); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/SmartTransformerFactoryImpl.java0000644000175000017500000003610510721374032027647 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SmartTransformerFactoryImpl.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import javax.xml.XMLConstants; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TemplatesHandler; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.xml.sax.XMLFilter; /** * Implementation of a transformer factory that uses an XSLTC * transformer factory for the creation of Templates objects * and uses the Xalan processor transformer factory for the * creation of Transformer objects. * @author G. Todd Miller */ public class SmartTransformerFactoryImpl extends SAXTransformerFactory { /** *

        Name of class as a constant to use for debugging.

        */ private static final String CLASS_NAME = "SmartTransformerFactoryImpl"; private SAXTransformerFactory _xsltcFactory = null; private SAXTransformerFactory _xalanFactory = null; private SAXTransformerFactory _currFactory = null; private ErrorListener _errorlistener = null; private URIResolver _uriresolver = null; /** *

        State of secure processing feature.

        */ private boolean featureSecureProcessing = false; /** * implementation of the SmartTransformerFactory. This factory * uses org.apache.xalan.xsltc.trax.TransformerFactory * to return Templates objects; and uses * org.apache.xalan.processor.TransformerFactory * to return Transformer objects. */ public SmartTransformerFactoryImpl() { } private void createXSLTCTransformerFactory() { _xsltcFactory = new TransformerFactoryImpl(); _currFactory = _xsltcFactory; } private void createXalanTransformerFactory() { final String xalanMessage = "org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl "+ "could not create an "+ "org.apache.xalan.processor.TransformerFactoryImpl."; // try to create instance of Xalan factory... try { Class xalanFactClass = ObjectFactory.findProviderClass( "org.apache.xalan.processor.TransformerFactoryImpl", ObjectFactory.findClassLoader(), true); _xalanFactory = (SAXTransformerFactory) xalanFactClass.newInstance(); } catch (ClassNotFoundException e) { System.err.println(xalanMessage); } catch (InstantiationException e) { System.err.println(xalanMessage); } catch (IllegalAccessException e) { System.err.println(xalanMessage); } _currFactory = _xalanFactory; } public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { _errorlistener = listener; } public ErrorListener getErrorListener() { return _errorlistener; } public Object getAttribute(String name) throws IllegalArgumentException { // GTM: NB: 'debug' should change to something more unique... if ((name.equals("translet-name")) || (name.equals("debug"))) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } return _xsltcFactory.getAttribute(name); } else { if (_xalanFactory == null) { createXalanTransformerFactory(); } return _xalanFactory.getAttribute(name); } } public void setAttribute(String name, Object value) throws IllegalArgumentException { // GTM: NB: 'debug' should change to something more unique... if ((name.equals("translet-name")) || (name.equals("debug"))) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } _xsltcFactory.setAttribute(name, value); } else { if (_xalanFactory == null) { createXalanTransformerFactory(); } _xalanFactory.setAttribute(name, value); } } /** *

        Set a feature for this SmartTransformerFactory and Transformers * or Templates created by this factory.

        * *

        * Feature names are fully qualified {@link java.net.URI}s. * Implementations may define their own features. * An {@link TransformerConfigurationException} is thrown if this TransformerFactory or the * Transformers or Templates it creates cannot support the feature. * It is possible for an TransformerFactory to expose a feature value but be unable to change its state. *

        * *

        See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.

        * * @param name Feature name. * @param value Is feature state true or false. * * @throws TransformerConfigurationException if this TransformerFactory * or the Transformers or Templates it creates cannot support this feature. * @throws NullPointerException If the name parameter is null. */ public void setFeature(String name, boolean value) throws TransformerConfigurationException { // feature name cannot be null if (name == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME); throw new NullPointerException(err.toString()); } // secure processing? else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { featureSecureProcessing = value; // all done processing feature return; } else { // unknown feature ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name); throw new TransformerConfigurationException(err.toString()); } } /** * javax.xml.transform.sax.TransformerFactory implementation. * Look up the value of a feature (to see if it is supported). * This method must be updated as the various methods and features of this * class are implemented. * * @param name The feature name * @return 'true' if feature is supported, 'false' if not */ public boolean getFeature(String name) { // All supported features should be listed here String[] features = { DOMSource.FEATURE, DOMResult.FEATURE, SAXSource.FEATURE, SAXResult.FEATURE, StreamSource.FEATURE, StreamResult.FEATURE }; // feature name cannot be null if (name == null) { ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME); throw new NullPointerException(err.toString()); } // Inefficient, but it really does not matter in a function like this for (int i = 0; i < features.length; i++) { if (name.equals(features[i])) return true; } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return featureSecureProcessing; } // unknown feature return false; } public URIResolver getURIResolver() { return _uriresolver; } public void setURIResolver(URIResolver resolver) { _uriresolver = resolver; } public Source getAssociatedStylesheet(Source source, String media, String title, String charset) throws TransformerConfigurationException { if (_currFactory == null) { createXSLTCTransformerFactory(); } return _currFactory.getAssociatedStylesheet(source, media, title, charset); } /** * Create a Transformer object that copies the input document to the * result. Uses the org.apache.xalan.processor.TransformerFactory. * @return A Transformer object. */ public Transformer newTransformer() throws TransformerConfigurationException { if (_xalanFactory == null) { createXalanTransformerFactory(); } if (_errorlistener != null) { _xalanFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xalanFactory.setURIResolver(_uriresolver); } _currFactory = _xalanFactory; return _currFactory.newTransformer(); } /** * Create a Transformer object that from the input stylesheet * Uses the org.apache.xalan.processor.TransformerFactory. * @param source the stylesheet. * @return A Transformer object. */ public Transformer newTransformer(Source source) throws TransformerConfigurationException { if (_xalanFactory == null) { createXalanTransformerFactory(); } if (_errorlistener != null) { _xalanFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xalanFactory.setURIResolver(_uriresolver); } _currFactory = _xalanFactory; return _currFactory.newTransformer(source); } /** * Create a Templates object that from the input stylesheet * Uses the org.apache.xalan.xsltc.trax.TransformerFactory. * @param source the stylesheet. * @return A Templates object. */ public Templates newTemplates(Source source) throws TransformerConfigurationException { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } if (_errorlistener != null) { _xsltcFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xsltcFactory.setURIResolver(_uriresolver); } _currFactory = _xsltcFactory; return _currFactory.newTemplates(source); } /** * Get a TemplatesHandler object that can process SAX ContentHandler * events into a Templates object. Uses the * org.apache.xalan.xsltc.trax.TransformerFactory. */ public TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } if (_errorlistener != null) { _xsltcFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xsltcFactory.setURIResolver(_uriresolver); } return _xsltcFactory.newTemplatesHandler(); } /** * Get a TransformerHandler object that can process SAX ContentHandler * events based on a copy transformer. * Uses org.apache.xalan.processor.TransformerFactory. */ public TransformerHandler newTransformerHandler() throws TransformerConfigurationException { if (_xalanFactory == null) { createXalanTransformerFactory(); } if (_errorlistener != null) { _xalanFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xalanFactory.setURIResolver(_uriresolver); } return _xalanFactory.newTransformerHandler(); } /** * Get a TransformerHandler object that can process SAX ContentHandler * events based on a transformer specified by the stylesheet Source. * Uses org.apache.xalan.processor.TransformerFactory. */ public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException { if (_xalanFactory == null) { createXalanTransformerFactory(); } if (_errorlistener != null) { _xalanFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xalanFactory.setURIResolver(_uriresolver); } return _xalanFactory.newTransformerHandler(src); } /** * Get a TransformerHandler object that can process SAX ContentHandler * events based on a transformer specified by the stylesheet Source. * Uses org.apache.xalan.xsltc.trax.TransformerFactory. */ public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } if (_errorlistener != null) { _xsltcFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xsltcFactory.setURIResolver(_uriresolver); } return _xsltcFactory.newTransformerHandler(templates); } /** * Create an XMLFilter that uses the given source as the * transformation instructions. Uses * org.apache.xalan.xsltc.trax.TransformerFactory. */ public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } if (_errorlistener != null) { _xsltcFactory.setErrorListener(_errorlistener); } if (_uriresolver != null) { _xsltcFactory.setURIResolver(_uriresolver); } Templates templates = _xsltcFactory.newTemplates(src); if (templates == null ) return null; return newXMLFilter(templates); } /* * Create an XMLFilter that uses the given source as the * transformation instructions. Uses * org.apache.xalan.xsltc.trax.TransformerFactory. */ public XMLFilter newXMLFilter(Templates templates) throws TransformerConfigurationException { try { return new org.apache.xalan.xsltc.trax.TrAXFilter(templates); } catch(TransformerConfigurationException e1) { if (_xsltcFactory == null) { createXSLTCTransformerFactory(); } ErrorListener errorListener = _xsltcFactory.getErrorListener(); if(errorListener != null) { try { errorListener.fatalError(e1); return null; } catch( TransformerException e2) { new TransformerConfigurationException(e2); } } throw e1; } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/ObjectFactory.java0000644000175000017500000006376610721374030024735 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468653 2006-10-28 07:07:05Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -1877553852268428278L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/trax/OutputSettings.java0000644000175000017500000000302110721374030025172 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: OutputSettings.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.trax; import java.util.Properties; /** * @author Morten Jorgensen */ public final class OutputSettings { private String _cdata_section_elements = null; private String _doctype_public = null; private String _encoding = null; private String _indent = null; private String _media_type = null; private String _method = null; private String _omit_xml_declaration = null; private String _standalone = null; private String _version = null; public Properties getProperties() { Properties properties = new Properties(); return(properties); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/Translet.java0000644000175000017500000000362310721374032023001 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Translet.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.serializer.SerializationHandler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface Translet { public void transform(DOM document, SerializationHandler handler) throws TransletException; public void transform(DOM document, SerializationHandler[] handlers) throws TransletException; public void transform(DOM document, DTMAxisIterator iterator, SerializationHandler handler) throws TransletException; public Object addParameter(String name, Object value); public void buildKeys(DOM document, DTMAxisIterator iterator, SerializationHandler handler, int root) throws TransletException; public void addAuxiliaryClass(Class auxClass); public Class getAuxiliaryClass(String className); public String[] getNamesArray(); public String[] getUrisArray(); public int[] getTypesArray(); public String[] getNamespaceArray(); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/util/0000755000175000017500000000000010736146354021325 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/util/IntegerArray.java0000644000175000017500000001207010721374033024553 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IntegerArray.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.util; /** * @author Jacek Ambroziak */ public final class IntegerArray { private static final int InitialSize = 32; private int[] _array; private int _size; private int _free = 0; public IntegerArray() { this(InitialSize); } public IntegerArray(int size) { _array = new int[_size = size]; } public IntegerArray(int[] array) { this(array.length); System.arraycopy(array, 0, _array, 0, _free = _size); } public void clear() { _free = 0; } public Object clone() { final IntegerArray clone = new IntegerArray(_free > 0 ? _free : 1); System.arraycopy(_array, 0, clone._array, 0, _free); clone._free = _free; return clone; } public int[] toIntArray() { final int[] result = new int[cardinality()]; System.arraycopy(_array, 0, result, 0, cardinality()); return result; } public final int at(int index) { return _array[index]; } public final void set(int index, int value) { _array[index] = value; } public int indexOf(int n) { for (int i = 0; i < _free; i++) { if (n == _array[i]) return i; } return -1; } public final void add(int value) { if (_free == _size) { growArray(_size * 2); } _array[_free++] = value; } /** * Adds new int at the end if not already present. */ public void addNew(int value) { for (int i = 0; i < _free; i++) { if (_array[i] == value) return; // already in array } add(value); } public void reverse() { int left = 0; int right = _free - 1; while (left < right) { int temp = _array[left]; _array[left++] = _array[right]; _array[right--] = temp; } } /** * Merge two sorted arrays and eliminate duplicates. * Elements of the other IntegerArray must not be changed. */ public void merge(final IntegerArray other) { final int newSize = _free + other._free; // System.out.println("IntegerArray.merge() begin newSize = " + newSize); int[] newArray = new int[newSize]; // Merge the two arrays int i = 0, j = 0, k; for (k = 0; i < _free && j < other._free; k++) { int x = _array[i]; int y = other._array[j]; if (x < y) { newArray[k] = x; i++; } else if (x > y) { newArray[k] = y; j++; } else { newArray[k] = x; i++; j++; } } // Copy the rest if of different lengths if (i >= _free) { while (j < other._free) { newArray[k++] = other._array[j++]; } } else { while (i < _free) { newArray[k++] = _array[i++]; } } // Update reference to this array _array = newArray; _free = _size = newSize; // System.out.println("IntegerArray.merge() end"); } public void sort() { quicksort(_array, 0, _free - 1); } private static void quicksort(int[] array, int p, int r) { if (p < r) { final int q = partition(array, p, r); quicksort(array, p, q); quicksort(array, q + 1, r); } } private static int partition(int[] array, int p, int r) { final int x = array[(p + r) >>> 1]; int i = p - 1; int j = r + 1; while (true) { while (x < array[--j]); while (x > array[++i]); if (i < j) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } else { return j; } } } private void growArray(int size) { final int[] newArray = new int[_size = size]; System.arraycopy(_array, 0, newArray, 0, _free); _array = newArray; } public int popLast() { return _array[--_free]; } public int last() { return _array[_free - 1]; } public void setLast(int n) { _array[_free - 1] = n; } public void pop() { _free--; } public void pop(int n) { _free -= n; } public final int cardinality() { return _free; } public void print(java.io.PrintStream out) { if (_free > 0) { for (int i = 0; i < _free - 1; i++) { out.print(_array[i]); out.print(' '); } out.println(_array[_free - 1]); } else { out.println("IntegerArray: empty"); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/util/JavaCupRedirect.java0000644000175000017500000000620110721374030025166 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: JavaCupRedirect.java 468653 2006-10-28 07:07:05Z minchau $ */ package org.apache.xalan.xsltc.util; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; /** * Utility class to redirect input to JavaCup program. * * Usage-command line: * java org.apache.xalan.xsltc.utils.JavaCupRedirect [args] -stdin filename.ext * * @author Morten Jorgensen * @version $Id: JavaCupRedirect.java 468653 2006-10-28 07:07:05Z minchau $ */ public class JavaCupRedirect { private final static String ERRMSG = "You must supply a filename with the -stdin option."; public static void main (String args[]) { // If we should call System.exit or not //@todo make this settable for use inside other java progs boolean systemExitOK = true; // This is the stream we'll set as our System.in InputStream input = null; // The number of arguments final int argc = args.length; // The arguments we'll pass to the real 'main()' String[] new_args = new String[argc - 2]; int new_argc = 0; // Parse all parameters passed to this class for (int i = 0; i < argc; i++) { // Parse option '-stdin ' if (args[i].equals("-stdin")) { // This option must have an argument if ((++i >= argc) || (args[i].startsWith("-"))) { System.err.println(ERRMSG); throw new RuntimeException(ERRMSG); } try { input = new FileInputStream(args[i]); } catch (FileNotFoundException e) { System.err.println("Could not open file "+args[i]); throw new RuntimeException(e.getMessage()); } catch (SecurityException e) { System.err.println("No permission to file "+args[i]); throw new RuntimeException(e.getMessage()); } } else { if (new_argc == new_args.length) { System.err.println("Missing -stdin option!"); throw new RuntimeException(); } new_args[new_argc++] = args[i]; } } System.setIn(input); try { java_cup.Main.main(new_args); } catch (Exception e) { System.err.println("Error running JavaCUP:"); e.printStackTrace(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/javax.xml.transform.TransformerFactory0000644000175000017500000000006410721374032030034 0ustar mkochmkochorg.apache.xalan.xsltc.trax.TransformerFactoryImpl libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/DOMCache.java0000644000175000017500000000361110721374030022543 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMCache.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; /** * @author Morten Jorgensen */ public interface DOMCache { /** * This method is responsible for: * * (1) building the DOMImpl tree * * Parser _parser = new Parser(); * DOMImpl _dom = new DOMImpl(); * _parser.setDocumentHandler(_dom.getBuilder()); * _parser.setDTDHandler(_dom.getBuilder()); * _parser.parse(uri); * * (2) giving the translet an early opportunity to extract anything from * the DOMImpl that it would like * * translet.documentPrepass(_dom); * * (3) setting the document URI: * * _dom.setDocumentURI(uri); * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ public DOM retrieveDocument(String baseURI, String href, Translet translet); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/0000755000175000017500000000000010736146354021763 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/SecuritySupport.java0000644000175000017500000000746010721374030026025 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/SecuritySupport12.java0000644000175000017500000001176510721374033026176 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/Compile.java0000644000175000017500000001070310721374031024204 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Compile.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline; import java.io.File; import java.net.URL; import java.util.Vector; import org.apache.xalan.xsltc.cmdline.getopt.GetOpt; import org.apache.xalan.xsltc.cmdline.getopt.GetOptsException; import org.apache.xalan.xsltc.compiler.XSLTC; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author G. Todd Miller * @author Morten Jorgensen */ public final class Compile { // Versioning numbers for the compiler -v option output private static int VERSION_MAJOR = 1; private static int VERSION_MINOR = 4; private static int VERSION_DELTA = 0; public static void printUsage() { StringBuffer vers = new StringBuffer("XSLTC version " + VERSION_MAJOR + "." + VERSION_MINOR + ((VERSION_DELTA > 0) ? ("."+VERSION_DELTA) : (""))); System.err.println(vers + "\n" + new ErrorMsg(ErrorMsg.COMPILE_USAGE_STR)); } /** * This method implements the command line compiler. See the USAGE_STRING * constant for a description. It may make sense to move the command-line * handling to a separate package (ie. make one xsltc.cmdline.Compiler * class that contains this main() method and one xsltc.cmdline.Transform * class that contains the DefaultRun stuff). */ public static void main(String[] args) { try { boolean inputIsURL = false; boolean useStdIn = false; boolean classNameSet = false; final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); if (args.length < 1) printUsage(); final XSLTC xsltc = new XSLTC(); xsltc.init(); int c; while ((c = getopt.getNextOption()) != -1) { switch(c) { case 'i': useStdIn = true; break; case 'o': xsltc.setClassName(getopt.getOptionArg()); classNameSet = true; break; case 'd': xsltc.setDestDirectory(getopt.getOptionArg()); break; case 'p': xsltc.setPackageName(getopt.getOptionArg()); break; case 'j': xsltc.setJarFileName(getopt.getOptionArg()); break; case 'x': xsltc.setDebug(true); break; case 'u': inputIsURL = true; break; case 'n': xsltc.setTemplateInlining(true); // used to be 'false' break; case 'v': // fall through to case h case 'h': default: printUsage(); break; } } boolean compileOK; if (useStdIn) { if (!classNameSet) { System.err.println(new ErrorMsg(ErrorMsg.COMPILE_STDIN_ERR)); } compileOK = xsltc.compile(System.in, xsltc.getClassName()); } else { // Generate a vector containg URLs for all stylesheets specified final String[] stylesheetNames = getopt.getCmdArgs(); final Vector stylesheetVector = new Vector(); for (int i = 0; i < stylesheetNames.length; i++) { final String name = stylesheetNames[i]; URL url; if (inputIsURL) url = new URL(name); else url = (new File(name)).toURL(); stylesheetVector.addElement(url); } compileOK = xsltc.compile(stylesheetVector); } // Compile the stylesheet and output class/jar file(s) if (compileOK) { xsltc.printWarnings(); if (xsltc.getJarFileName() != null) xsltc.outputToJar(); } else { xsltc.printWarnings(); xsltc.printErrors(); } } catch (GetOptsException ex) { System.err.println(ex); printUsage(); // exits with code '-1' } catch (Exception e) { e.printStackTrace(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/Transform.java0000644000175000017500000002307210721374032024573 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Transform.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline; import java.io.FileNotFoundException; import java.net.MalformedURLException; import java.net.UnknownHostException; import java.util.Vector; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.dom.XSLTCDTMManager; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.runtime.Constants; import org.apache.xalan.xsltc.runtime.Parameter; import org.apache.xalan.xsltc.runtime.output.TransletOutputHandlerFactory; import org.apache.xml.serializer.SerializationHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.apache.xalan.xsltc.StripFilter; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xalan.xsltc.dom.DOMWSFilter; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author G. Todd Miller * @author Morten Jorgensen */ final public class Transform { private SerializationHandler _handler; private String _fileName; private String _className; private String _jarFileSrc; private boolean _isJarFileSpecified = false; private Vector _params = null; private boolean _uri, _debug; private int _iterations; public Transform(String className, String fileName, boolean uri, boolean debug, int iterations) { _fileName = fileName; _className = className; _uri = uri; _debug = debug; _iterations = iterations; } public String getFileName(){return _fileName;} public String getClassName(){return _className;} public void setParameters(Vector params) { _params = params; } private void setJarFileInputSrc(boolean flag, String jarFile) { // TODO: at this time we do not do anything with this // information, attempts to add the jarfile to the CLASSPATH // were successful via System.setProperty, but the effects // were not visible to the running JVM. For now we add jarfile // to CLASSPATH in the wrapper script that calls this program. _isJarFileSpecified = flag; // TODO verify jarFile exists... _jarFileSrc = jarFile; } private void doTransform() { try { final Class clazz = ObjectFactory.findProviderClass( _className, ObjectFactory.findClassLoader(), true); final AbstractTranslet translet = (AbstractTranslet)clazz.newInstance(); translet.postInitialization(); // Create a SAX parser and get the XMLReader object it uses final SAXParserFactory factory = SAXParserFactory.newInstance(); try { factory.setFeature(Constants.NAMESPACE_FEATURE,true); } catch (Exception e) { factory.setNamespaceAware(true); } final SAXParser parser = factory.newSAXParser(); final XMLReader reader = parser.getXMLReader(); // Set the DOM's DOM builder as the XMLReader's SAX2 content handler XSLTCDTMManager dtmManager = (XSLTCDTMManager)XSLTCDTMManager.getDTMManagerClass() .newInstance(); DTMWSFilter wsfilter; if (translet != null && translet instanceof StripFilter) { wsfilter = new DOMWSFilter(translet); } else { wsfilter = null; } final DOMEnhancedForDTM dom = (DOMEnhancedForDTM)dtmManager.getDTM( new SAXSource(reader, new InputSource(_fileName)), false, wsfilter, true, false, translet.hasIdCall()); dom.setDocumentURI(_fileName); translet.prepassDocument(dom); // Pass global parameters int n = _params.size(); for (int i = 0; i < n; i++) { Parameter param = (Parameter) _params.elementAt(i); translet.addParameter(param._name, param._value); } // Transform the document TransletOutputHandlerFactory tohFactory = TransletOutputHandlerFactory.newInstance(); tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM); tohFactory.setEncoding(translet._encoding); tohFactory.setOutputMethod(translet._method); if (_iterations == -1) { translet.transform(dom, tohFactory.getSerializationHandler()); } else if (_iterations > 0) { long mm = System.currentTimeMillis(); for (int i = 0; i < _iterations; i++) { translet.transform(dom, tohFactory.getSerializationHandler()); } mm = System.currentTimeMillis() - mm; System.err.println("\n"); } } catch (TransletException e) { if (_debug) e.printStackTrace(); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ e.getMessage()); } catch (RuntimeException e) { if (_debug) e.printStackTrace(); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ e.getMessage()); } catch (FileNotFoundException e) { if (_debug) e.printStackTrace(); ErrorMsg err = new ErrorMsg(ErrorMsg.FILE_NOT_FOUND_ERR, _fileName); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ err.toString()); } catch (MalformedURLException e) { if (_debug) e.printStackTrace(); ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, _fileName); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ err.toString()); } catch (ClassNotFoundException e) { if (_debug) e.printStackTrace(); ErrorMsg err= new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR,_className); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ err.toString()); } catch (UnknownHostException e) { if (_debug) e.printStackTrace(); ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, _fileName); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ err.toString()); } catch (SAXException e) { Exception ex = e.getException(); if (_debug) { if (ex != null) ex.printStackTrace(); e.printStackTrace(); } System.err.print(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)); if (ex != null) System.err.println(ex.getMessage()); else System.err.println(e.getMessage()); } catch (Exception e) { if (_debug) e.printStackTrace(); System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+ e.getMessage()); } } public static void printUsage() { System.err.println(new ErrorMsg(ErrorMsg.TRANSFORM_USAGE_STR)); } public static void main(String[] args) { try { if (args.length > 0) { int i; int iterations = -1; boolean uri = false, debug = false; boolean isJarFileSpecified = false; String jarFile = null; // Parse options starting with '-' for (i = 0; i < args.length && args[i].charAt(0) == '-'; i++) { if (args[i].equals("-u")) { uri = true; } else if (args[i].equals("-x")) { debug = true; } else if (args[i].equals("-j")) { isJarFileSpecified = true; jarFile = args[++i]; } else if (args[i].equals("-n")) { try { iterations = Integer.parseInt(args[++i]); } catch (NumberFormatException e) { // ignore } } else { printUsage(); } } // Enough arguments left ? if (args.length - i < 2) printUsage(); // Get document file and class name Transform handler = new Transform(args[i+1], args[i], uri, debug, iterations); handler.setJarFileInputSrc(isJarFileSpecified, jarFile); // Parse stylesheet parameters Vector params = new Vector(); for (i += 2; i < args.length; i++) { final int equal = args[i].indexOf('='); if (equal > 0) { final String name = args[i].substring(0, equal); final String value = args[i].substring(equal+1); params.addElement(new Parameter(name, value)); } else { printUsage(); } } if (i == args.length) { handler.setParameters(params); handler.doTransform(); } } else { printUsage(); } } catch (Exception e) { e.printStackTrace(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/getopt/0000755000175000017500000000000010736146354023265 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/getopt/GetOptsException.java0000644000175000017500000000222110721374031027356 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: GetOptsException.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline.getopt; /** * @author G Todd Miller */ public class GetOptsException extends Exception{ static final long serialVersionUID = 8736874967183039804L; public GetOptsException(String msg){ super(msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/getopt/MissingOptArgException.java0000644000175000017500000000224610721374032030527 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MissingOptArgException.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline.getopt; /** * @author G Todd Miller */ class MissingOptArgException extends GetOptsException{ static final long serialVersionUID = -1972471465394544822L; public MissingOptArgException(String msg){ super(msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/getopt/IllegalArgumentException.java0000644000175000017500000000220510721374033031051 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: IllegalArgumentException.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline.getopt; class IllegalArgumentException extends GetOptsException{ static final long serialVersionUID = 8642122427294793651L; public IllegalArgumentException(String msg){ super(msg); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/getopt/GetOpt.java0000644000175000017500000002161210721374032025322 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: GetOpt.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline.getopt; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.apache.xalan.xsltc.compiler.util.ErrorMsg; /** * GetOpt is a Java equivalent to the C getopt() library function * discussed in man page getopt(3C). It provides command line * parsing for Java applications. It supports the most rules of the * command line standard (see man page intro(1)) including stacked * options such as '-sxm' (which is equivalent to -s -x -m); it * handles special '--' option that signifies the end of options. * Additionally this implementation of getopt will check for * mandatory arguments to options such as in the case of * '-d ' it will throw a MissingOptArgException if the * option argument '' is not included on the commandline. * getopt(3C) does not check for this. * @author G Todd Miller */ public class GetOpt{ public GetOpt(String[] args, String optString){ theOptions = new ArrayList(); int currOptIndex = 0; theCmdArgs = new ArrayList(); theOptionMatcher = new OptionMatcher(optString); // fill in the options list for(int i=0; i 2){ // stacked options found, such as '-shm' // iterate thru the tokens after the dash and // add them to theOptions list for(int j=1; j', if current option parsed is 'd' then * getOptionArg() would return ''. * @return String - argument for current parsed option. */ public String getOptionArg(){ String retval = null; String tmp = theCurrentOption.getArgument(); char c = theCurrentOption.getArgLetter(); if(theOptionMatcher.hasArg(c)){ retval = tmp; } return retval; } /** * gets list of the commandline arguments. For example, in command * such as 'cmd -s -d file file2 file3 file4' with the usage * 'cmd [-s] [-d ] ...', getCmdArgs() would return * the list {file2, file3, file4}. * @return String[] - list of command arguments that may appear * after options and option arguments. */ public String[] getCmdArgs(){ String[] retval = new String[theCmdArgs.size()]; int i=0; for(ListIterator it=theCmdArgs.listIterator(); it.hasNext();){ retval[i++] = (String)it.next(); } return retval; } private Option theCurrentOption = null; private ListIterator theOptionsIterator; private List theOptions = null; private List theCmdArgs = null; private OptionMatcher theOptionMatcher = null; /////////////////////////////////////////////////////////// // // Inner Classes // /////////////////////////////////////////////////////////// // inner class to model an option class Option{ private char theArgLetter; private String theArgument = null; public Option(char argLetter) { theArgLetter = argLetter; } public void setArg(String arg) { theArgument = arg; } public boolean hasArg() { return (theArgument != null); } public char getArgLetter() { return theArgLetter; } public String getArgument() { return theArgument; } } // end class Option // inner class to query optString for a possible option match, // and whether or not a given legal option takes an argument. // class OptionMatcher{ public OptionMatcher(String optString){ theOptString = optString; } public boolean match(char c){ boolean retval = false; if(theOptString.indexOf(c) != -1){ retval = true; } return retval; } public boolean hasArg(char c){ boolean retval = false; int index = theOptString.indexOf(c)+1; if (index == theOptString.length()){ // reached end of theOptString retval = false; } else if(theOptString.charAt(index) == ':'){ retval = true; } return retval; } private String theOptString = null; } // end class OptionMatcher }// end class GetOpt libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/cmdline/ObjectFactory.java0000644000175000017500000006377110721374032025370 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468647 2006-10-28 06:59:33Z minchau $ */ package org.apache.xalan.xsltc.cmdline; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468647 2006-10-28 06:59:33Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -6072257854297546607L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/DOM.java0000644000175000017500000001103210721374033021616 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOM.java 468648 2006-10-28 07:00:06Z minchau $ */ package org.apache.xalan.xsltc; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xml.dtm.DTMAxisIterator; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.apache.xml.serializer.SerializationHandler; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface DOM { public final static int FIRST_TYPE = 0; public final static int NO_TYPE = -1; // 0 is reserved for NodeIterator.END public final static int NULL = 0; // used by some node iterators to know which node to return public final static int RETURN_CURRENT = 0; public final static int RETURN_PARENT = 1; // Constants used by getResultTreeFrag to indicate the types of the RTFs. public final static int SIMPLE_RTF = 0; public final static int ADAPTIVE_RTF = 1; public final static int TREE_RTF = 2; /** returns singleton iterator containg the document root */ public DTMAxisIterator getIterator(); public String getStringValue(); public DTMAxisIterator getChildren(final int node); public DTMAxisIterator getTypedChildren(final int type); public DTMAxisIterator getAxisIterator(final int axis); public DTMAxisIterator getTypedAxisIterator(final int axis, final int type); public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself); public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns); public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType, String value, boolean op); public DTMAxisIterator orderNodes(DTMAxisIterator source, int node); public String getNodeName(final int node); public String getNodeNameX(final int node); public String getNamespaceName(final int node); public int getExpandedTypeID(final int node); public int getNamespaceType(final int node); public int getParent(final int node); public int getAttributeNode(final int gType, final int element); public String getStringValueX(final int node); public void copy(final int node, SerializationHandler handler) throws TransletException; public void copy(DTMAxisIterator nodes, SerializationHandler handler) throws TransletException; public String shallowCopy(final int node, SerializationHandler handler) throws TransletException; public boolean lessThan(final int node1, final int node2); public void characters(final int textNode, SerializationHandler handler) throws TransletException; public Node makeNode(int index); public Node makeNode(DTMAxisIterator iter); public NodeList makeNodeList(int index); public NodeList makeNodeList(DTMAxisIterator iter); public String getLanguage(int node); public int getSize(); public String getDocumentURI(int node); public void setFilter(StripFilter filter); public void setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces); public boolean isElement(final int node); public boolean isAttribute(final int node); public String lookupNamespace(int node, String prefix) throws TransletException; public int getNodeIdent(final int nodehandle); public int getNodeHandle(final int nodeId); public DOM getResultTreeFrag(int initialSize, int rtfType); public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToDTMManager); public SerializationHandler getOutputDomBuilder(); public int getNSType(int node); public int getDocument(); public String getUnparsedEntityURI(String name); public Hashtable getElementsWithIDs(); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/0000755000175000017500000000000010736146354021127 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/StepIterator.java0000644000175000017500000001065010721374032024407 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StepIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * A step iterator is used to evaluate expressions like "BOOK/TITLE". * A better name for this iterator would have been ParentIterator since * both "BOOK" and "TITLE" are steps in XPath lingo. Step iterators are * constructed from two other iterators which we are going to refer to * as "outer" and "inner". Every node from the outer iterator (the one * for BOOK in our example) is used to initialize the inner iterator. * After this initialization, every node from the inner iterator is * returned (in essence, implementing a "nested loop"). * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Erwin Bolwidt * @author Morten Jorgensen */ public class StepIterator extends DTMAxisIteratorBase { /** * A reference to the "outer" iterator. */ protected DTMAxisIterator _source; /** * A reference to the "inner" iterator. */ protected DTMAxisIterator _iterator; /** * Temp variable to store a marked position. */ private int _pos = -1; public StepIterator(DTMAxisIterator source, DTMAxisIterator iterator) { _source = source; _iterator = iterator; // System.out.println("SI source = " + source + " this = " + this); // System.out.println("SI iterator = " + iterator + " this = " + this); } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); _iterator.setRestartable(true); // must be restartable } public DTMAxisIterator cloneIterator() { _isRestartable = false; try { final StepIterator clone = (StepIterator) super.clone(); clone._source = _source.cloneIterator(); clone._iterator = _iterator.cloneIterator(); clone._iterator.setRestartable(true); // must be restartable clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { // Set start node for left-hand iterator... _source.setStartNode(_startNode = node); // ... and get start node for right-hand iterator from left-hand, // with special case for //* path - see ParentLocationPath _iterator.setStartNode(_includeSelf ? _startNode : _source.next()); return resetPosition(); } return this; } public DTMAxisIterator reset() { _source.reset(); // Special case for //* path - see ParentLocationPath _iterator.setStartNode(_includeSelf ? _startNode : _source.next()); return resetPosition(); } public int next() { for (int node;;) { // Try to get another node from the right-hand iterator if ((node = _iterator.next()) != END) { return returnNode(node); } // If not, get the next starting point from left-hand iterator... else if ((node = _source.next()) == END) { return END; } // ...and pass it on to the right-hand iterator else { _iterator.setStartNode(node); } } } public void setMark() { _source.setMark(); _iterator.setMark(); //_pos = _position; } public void gotoMark() { _source.gotoMark(); _iterator.gotoMark(); //_position = _pos; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SecuritySupport.java0000644000175000017500000000745410721374030025174 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/LoadDocument.java0000644000175000017500000002732310721374030024343 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: LoadDocument.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.io.FileNotFoundException; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMCache; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.trax.TemplatesImpl; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.DTMDefaultBase; import org.apache.xml.dtm.ref.EmptyIterator; import org.apache.xml.utils.SystemIDResolver; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; /** * @author Morten Jorgensen */ public final class LoadDocument { private static final String NAMESPACE_FEATURE = "http://xml.org/sax/features/namespaces"; /** * Interprets the arguments passed from the document() function (see * org/apache/xalan/xsltc/compiler/DocumentCall.java) and returns an * iterator containing the requested nodes. Builds a union-iterator if * several documents are requested. * 2 arguments arg1 and arg2. document(Obj, node-set) call */ public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2, String xslURI, AbstractTranslet translet, DOM dom) throws TransletException { String baseURI = null; final int arg2FirstNode = arg2.next(); if (arg2FirstNode == DTMAxisIterator.END) { // the second argument node-set is empty return EmptyIterator.getInstance(); } else { //System.err.println("arg2FirstNode name: " // + dom.getNodeName(arg2FirstNode )+"[" // +Integer.toHexString(arg2FirstNode )+"]"); baseURI = dom.getDocumentURI(arg2FirstNode); if (!SystemIDResolver.isAbsoluteURI(baseURI)) baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI); } try { if (arg1 instanceof String) { if (((String)arg1).length() == 0) { return document(xslURI, "", translet, dom); } else { return document((String)arg1, baseURI, translet, dom); } } else if (arg1 instanceof DTMAxisIterator) { return document((DTMAxisIterator)arg1, baseURI, translet, dom); } else { final String err = "document("+arg1.toString()+")"; throw new IllegalArgumentException(err); } } catch (Exception e) { throw new TransletException(e); } } /** * Interprets the arguments passed from the document() function (see * org/apache/xalan/xsltc/compiler/DocumentCall.java) and returns an * iterator containing the requested nodes. Builds a union-iterator if * several documents are requested. * 1 arguments arg. document(Obj) call */ public static DTMAxisIterator documentF(Object arg, String xslURI, AbstractTranslet translet, DOM dom) throws TransletException { try { if (arg instanceof String) { if (xslURI == null ) xslURI = ""; String baseURI = xslURI; if (!SystemIDResolver.isAbsoluteURI(xslURI)) baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI); String href = (String)arg; if (href.length() == 0) { href = ""; // %OPT% Optimization to cache the stylesheet DOM. // The stylesheet DOM is built once and cached // in the Templates object. TemplatesImpl templates = (TemplatesImpl)translet.getTemplates(); DOM sdom = null; if (templates != null) { sdom = templates.getStylesheetDOM(); } // If the cached dom exists, we need to migrate it // to the new DTMManager and create a DTMAxisIterator // for the document. if (sdom != null) { return document(sdom, translet, dom); } else { return document(href, baseURI, translet, dom, true); } } else { return document(href, baseURI, translet, dom); } } else if (arg instanceof DTMAxisIterator) { return document((DTMAxisIterator)arg, null, translet, dom); } else { final String err = "document("+arg.toString()+")"; throw new IllegalArgumentException(err); } } catch (Exception e) { throw new TransletException(e); } } private static DTMAxisIterator document(String uri, String base, AbstractTranslet translet, DOM dom) throws Exception { return document(uri, base, translet, dom, false); } private static DTMAxisIterator document(String uri, String base, AbstractTranslet translet, DOM dom, boolean cacheDOM) throws Exception { try { final String originalUri = uri; MultiDOM multiplexer = (MultiDOM)dom; // Prepend URI base to URI (from context) if (base != null && !base.equals("")) { uri = SystemIDResolver.getAbsoluteURI(uri, base); } // Return an empty iterator if the URI is clearly invalid // (to prevent some unncessary MalformedURL exceptions). if (uri == null || uri.equals("")) { return(EmptyIterator.getInstance()); } // Check if this DOM has already been added to the multiplexer int mask = multiplexer.getDocumentMask(uri); if (mask != -1) { DOM newDom = ((DOMAdapter)multiplexer.getDOMAdapter(uri)) .getDOMImpl(); if (newDom instanceof DOMEnhancedForDTM) { return new SingletonIterator(((DOMEnhancedForDTM)newDom) .getDocument(), true); } } // Check if we can get the DOM from a DOMCache DOMCache cache = translet.getDOMCache(); DOM newdom; mask = multiplexer.nextMask(); // peek if (cache != null) { newdom = cache.retrieveDocument(base, originalUri, translet); if (newdom == null) { final Exception e = new FileNotFoundException(originalUri); throw new TransletException(e); } } else { // Parse the input document and construct DOM object // Trust the DTMManager to pick the right parser and // set up the DOM correctly. XSLTCDTMManager dtmManager = (XSLTCDTMManager)multiplexer .getDTMManager(); DOMEnhancedForDTM enhancedDOM = (DOMEnhancedForDTM) dtmManager.getDTM(new StreamSource(uri), false, null, true, false, translet.hasIdCall(), cacheDOM); newdom = enhancedDOM; // Cache the stylesheet DOM in the Templates object if (cacheDOM) { TemplatesImpl templates = (TemplatesImpl)translet.getTemplates(); if (templates != null) { templates.setStylesheetDOM(enhancedDOM); } } translet.prepassDocument(enhancedDOM); enhancedDOM.setDocumentURI(uri); } // Wrap the DOM object in a DOM adapter and add to multiplexer final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom); multiplexer.addDOMAdapter(domAdapter); // Create index for any key elements translet.buildKeys(domAdapter, null, null, newdom.getDocument()); // Return a singleton iterator containing the root node return new SingletonIterator(newdom.getDocument(), true); } catch (Exception e) { throw e; } } private static DTMAxisIterator document(DTMAxisIterator arg1, String baseURI, AbstractTranslet translet, DOM dom) throws Exception { UnionIterator union = new UnionIterator(dom); int node = DTM.NULL; while ((node = arg1.next()) != DTM.NULL) { String uri = dom.getStringValueX(node); //document(node-set) if true; document(node-set,node-set) if false if (baseURI == null) { baseURI = dom.getDocumentURI(node); if (!SystemIDResolver.isAbsoluteURI(baseURI)) baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI); } union.addIterator(document(uri, baseURI, translet, dom)); } return(union); } /** * Create a DTMAxisIterator for the newdom. This is currently only * used to create an iterator for the cached stylesheet DOM. * * @param newdom the cached stylesheet DOM * @param translet the translet * @param the main dom (should be a MultiDOM) * @return a DTMAxisIterator from the document root */ private static DTMAxisIterator document(DOM newdom, AbstractTranslet translet, DOM dom) throws Exception { DTMManager dtmManager = ((MultiDOM)dom).getDTMManager(); // Need to migrate the cached DTM to the new DTMManager if (dtmManager != null && newdom instanceof DTM) { ((DTM)newdom).migrateTo(dtmManager); } translet.prepassDocument(newdom); // Wrap the DOM object in a DOM adapter and add to multiplexer final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom); ((MultiDOM)dom).addDOMAdapter(domAdapter); // Create index for any key elements translet.buildKeys(domAdapter, null, null, newdom.getDocument()); // Return a singleton iterator containing the root node return new SingletonIterator(newdom.getDocument(), true); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/EmptyFilter.java0000644000175000017500000000214510721374033024227 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EmptyFilter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class EmptyFilter implements Filter { public boolean test(int node) { return true; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/DOMAdapter.java0000644000175000017500000003073510721374031023707 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMAdapter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.serializer.SerializationHandler; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * @author Jacek Ambroziak * @author Morten Jorgensen */ public final class DOMAdapter implements DOM { // Mutually exclusive casting of DOM interface to known implementations private DOMEnhancedForDTM _enhancedDOM; private DOM _dom; private String[] _namesArray; private String[] _urisArray; private int[] _typesArray; private String[] _namespaceArray; // Cached mappings private short[] _mapping = null; private int[] _reverse = null; private short[] _NSmapping = null; private short[] _NSreverse = null; private StripFilter _filter = null; private int _multiDOMMask; public DOMAdapter(DOM dom, String[] namesArray, String[] urisArray, int[] typesArray, String[] namespaceArray) { if (dom instanceof DOMEnhancedForDTM){ _enhancedDOM = (DOMEnhancedForDTM) dom; } _dom = dom; _namesArray = namesArray; _urisArray = urisArray; _typesArray = typesArray; _namespaceArray = namespaceArray; } public void setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces) { _namesArray = names; _urisArray = urisArray; _typesArray = typesArray; _namespaceArray = namespaces; } public String[] getNamesArray() { return _namesArray; } public String[] getUrisArray() { return _urisArray; } public int[] getTypesArray() { return _typesArray; } public String[] getNamespaceArray() { return _namespaceArray; } public DOM getDOMImpl() { return _dom; } private short[] getMapping() { if (_mapping == null) { if (_enhancedDOM != null) { _mapping = _enhancedDOM.getMapping(_namesArray, _urisArray, _typesArray); } } return _mapping; } private int[] getReverse() { if (_reverse == null) { if (_enhancedDOM != null) { _reverse = _enhancedDOM.getReverseMapping(_namesArray, _urisArray, _typesArray); } } return _reverse; } private short[] getNSMapping() { if (_NSmapping == null) { if (_enhancedDOM != null) { _NSmapping = _enhancedDOM.getNamespaceMapping(_namespaceArray); } } return _NSmapping; } private short[] getNSReverse() { if (_NSreverse == null) { if (_enhancedDOM != null) { _NSreverse = _enhancedDOM .getReverseNamespaceMapping(_namespaceArray); } } return _NSreverse; } /** * Returns singleton iterator containg the document root */ public DTMAxisIterator getIterator() { return _dom.getIterator(); } public String getStringValue() { return _dom.getStringValue(); } public DTMAxisIterator getChildren(final int node) { if (_enhancedDOM != null) { return _enhancedDOM.getChildren(node); } else { DTMAxisIterator iterator = _dom.getChildren(node); return iterator.setStartNode(node); } } public void setFilter(StripFilter filter) { _filter = filter; } public DTMAxisIterator getTypedChildren(final int type) { final int[] reverse = getReverse(); if (_enhancedDOM != null) { return _enhancedDOM.getTypedChildren(reverse[type]); } else { return _dom.getTypedChildren(type); } } public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns) { return _dom.getNamespaceAxisIterator(axis, getNSReverse()[ns]); } public DTMAxisIterator getAxisIterator(final int axis) { if (_enhancedDOM != null) { return _enhancedDOM.getAxisIterator(axis); } else { return _dom.getAxisIterator(axis); } } public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) { final int[] reverse = getReverse(); if (_enhancedDOM != null) { return _enhancedDOM.getTypedAxisIterator(axis, reverse[type]); } else { return _dom.getTypedAxisIterator(axis, type); } } public int getMultiDOMMask() { return _multiDOMMask; } public void setMultiDOMMask(int mask) { _multiDOMMask = mask; } public DTMAxisIterator getNthDescendant(int type, int n, boolean includeself) { return _dom.getNthDescendant(getReverse()[type], n, includeself); } public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iterator, int type, String value, boolean op) { return _dom.getNodeValueIterator(iterator, type, value, op); } public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) { return _dom.orderNodes(source, node); } public int getExpandedTypeID(final int node) { final short[] mapping = getMapping(); final int type; if (_enhancedDOM != null) { type = mapping[_enhancedDOM.getExpandedTypeID2(node)]; } else { if(null != mapping) { type = mapping[_dom.getExpandedTypeID(node)]; } else { type = _dom.getExpandedTypeID(node); } } return type; } public int getNamespaceType(final int node) { return getNSMapping()[_dom.getNSType(node)]; } public int getNSType(int node) { return _dom.getNSType(node); } public int getParent(final int node) { return _dom.getParent(node); } public int getAttributeNode(final int type, final int element) { return _dom.getAttributeNode(getReverse()[type], element); } public String getNodeName(final int node) { if (node == DTM.NULL) { return ""; } return _dom.getNodeName(node); } public String getNodeNameX(final int node) { if (node == DTM.NULL) { return ""; } return _dom.getNodeNameX(node); } public String getNamespaceName(final int node) { if (node == DTM.NULL) { return ""; } return _dom.getNamespaceName(node); } public String getStringValueX(final int node) { if (_enhancedDOM != null) { return _enhancedDOM.getStringValueX(node); } else { if (node == DTM.NULL) { return ""; } return _dom.getStringValueX(node); } } public void copy(final int node, SerializationHandler handler) throws TransletException { _dom.copy(node, handler); } public void copy(DTMAxisIterator nodes,SerializationHandler handler) throws TransletException { _dom.copy(nodes, handler); } public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { if (_enhancedDOM != null) { return _enhancedDOM.shallowCopy(node, handler); } else { return _dom.shallowCopy(node, handler); } } public boolean lessThan(final int node1, final int node2) { return _dom.lessThan(node1, node2); } public void characters(final int textNode, SerializationHandler handler) throws TransletException { if (_enhancedDOM != null) { _enhancedDOM.characters(textNode, handler); } else { _dom.characters(textNode, handler); } } public Node makeNode(int index) { return _dom.makeNode(index); } public Node makeNode(DTMAxisIterator iter) { return _dom.makeNode(iter); } public NodeList makeNodeList(int index) { return _dom.makeNodeList(index); } public NodeList makeNodeList(DTMAxisIterator iter) { return _dom.makeNodeList(iter); } public String getLanguage(int node) { return _dom.getLanguage(node); } public int getSize() { return _dom.getSize(); } public void setDocumentURI(String uri) { if (_enhancedDOM != null) { _enhancedDOM.setDocumentURI(uri); } } public String getDocumentURI() { if (_enhancedDOM != null) { return _enhancedDOM.getDocumentURI(); } else { return ""; } } public String getDocumentURI(int node) { return _dom.getDocumentURI(node); } public int getDocument() { return _dom.getDocument(); } public boolean isElement(final int node) { return(_dom.isElement(node)); } public boolean isAttribute(final int node) { return(_dom.isAttribute(node)); } public int getNodeIdent(int nodeHandle) { return _dom.getNodeIdent(nodeHandle); } public int getNodeHandle(int nodeId) { return _dom.getNodeHandle(nodeId); } /** * Return a instance of a DOM class to be used as an RTF */ public DOM getResultTreeFrag(int initSize, int rtfType) { if (_enhancedDOM != null) { return _enhancedDOM.getResultTreeFrag(initSize, rtfType); } else { return _dom.getResultTreeFrag(initSize, rtfType); } } /** * Return a instance of a DOM class to be used as an RTF */ public DOM getResultTreeFrag(int initSize, int rtfType, boolean addToManager) { if (_enhancedDOM != null) { return _enhancedDOM.getResultTreeFrag(initSize, rtfType, addToManager); } else { return _dom.getResultTreeFrag(initSize, rtfType, addToManager); } } /** * Returns a SerializationHandler class wrapped in a SAX adapter. */ public SerializationHandler getOutputDomBuilder() { return _dom.getOutputDomBuilder(); } public String lookupNamespace(int node, String prefix) throws TransletException { return _dom.lookupNamespace(node, prefix); } public String getUnparsedEntityURI(String entity) { return _dom.getUnparsedEntityURI(entity); } public Hashtable getElementsWithIDs() { return _dom.getElementsWithIDs(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/MultipleNodeCounter.java0000644000175000017500000000716710721374033025735 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MultipleNodeCounter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.util.IntegerArray; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.Axis; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class MultipleNodeCounter extends NodeCounter { private DTMAxisIterator _precSiblings = null; public MultipleNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { super(translet, document, iterator); } public NodeCounter setStartNode(int node) { _node = node; _nodeType = _document.getExpandedTypeID(node); _precSiblings = _document.getAxisIterator(Axis.PRECEDINGSIBLING); return this; } public String getCounter() { if (_value != Integer.MIN_VALUE) { //See Errata E24 if (_value == 0) return "0"; else if (Double.isNaN(_value)) return "NaN"; else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity"; else if (Double.isInfinite(_value)) return "Infinity"; else return formatNumbers((int)_value); } IntegerArray ancestors = new IntegerArray(); // Gather all ancestors that do not match from pattern int next = _node; ancestors.add(next); // include self while ((next = _document.getParent(next)) > END && !matchesFrom(next)) { ancestors.add(next); } // Create an array of counters final int nAncestors = ancestors.cardinality(); final int[] counters = new int[nAncestors]; for (int i = 0; i < nAncestors; i++) { counters[i] = Integer.MIN_VALUE; } // Increment array of counters according to semantics for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) { final int counter = counters[j]; final int ancestor = ancestors.at(i); if (matchesCount(ancestor)) { _precSiblings.setStartNode(ancestor); while ((next = _precSiblings.next()) != END) { if (matchesCount(next)) { counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1 : counters[j] + 1; } } // Count the node itself counters[j] = counters[j] == Integer.MIN_VALUE ? 1 : counters[j] + 1; } } return formatNumbers(counters); } public static NodeCounter getDefaultNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { return new DefaultMultipleNodeCounter(translet, document, iterator); } static class DefaultMultipleNodeCounter extends MultipleNodeCounter { public DefaultMultipleNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { super(translet, document, iterator); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/DOMBuilder.java0000644000175000017500000000200310721374031023700 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMBuilder.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; /** * @author Morten Jorgensen */ public interface DOMBuilder extends ExtendedSAX { } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/CollatorFactoryBase.java0000644000175000017500000000327010721374032025664 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CollatorFactoryBase.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.text.Collator; import java.util.Locale; import org.apache.xalan.xsltc.CollatorFactory; /** * @author W. Eliot Kimber (eliot@isogen.com) */ public class CollatorFactoryBase implements CollatorFactory { public static final Locale DEFAULT_LOCALE = Locale.getDefault(); public static final Collator DEFAULT_COLLATOR = Collator.getInstance(); public CollatorFactoryBase() { } public Collator getCollator(String lang, String country) { return Collator.getInstance(new Locale(lang, country)); } public Collator getCollator(Locale locale) { if (locale == DEFAULT_LOCALE) return DEFAULT_COLLATOR; else return Collator.getInstance(locale); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/AnyNodeCounter.java0000644000175000017500000000741310721374032024662 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AnyNodeCounter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xml.dtm.DTMAxisIterator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class AnyNodeCounter extends NodeCounter { public AnyNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { super(translet, document, iterator); } public NodeCounter setStartNode(int node) { _node = node; _nodeType = _document.getExpandedTypeID(node); return this; } public String getCounter() { int result; if (_value != Integer.MIN_VALUE) { //See Errata E24 if (_value == 0) return "0"; else if (Double.isNaN(_value)) return "NaN"; else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity"; else if (Double.isInfinite(_value)) return "Infinity"; else return formatNumbers((int)_value); } else { int next = _node; final int root = _document.getDocument(); result = 0; while (next >= root && !matchesFrom(next)) { if (matchesCount(next)) { ++result; } next--; //%HZ%: Is this the best way of finding the root? Is it better to check //%HZ%: parent(next)? /* if (next == root) { break; } else { --next; } */ } } return formatNumbers(result); } public static NodeCounter getDefaultNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { return new DefaultAnyNodeCounter(translet, document, iterator); } static class DefaultAnyNodeCounter extends AnyNodeCounter { public DefaultAnyNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { super(translet, document, iterator); } public String getCounter() { int result; if (_value != Integer.MIN_VALUE) { //See Errata E24 if (_value == 0) return "0"; else if (Double.isNaN(_value)) return "NaN"; else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity"; else if (Double.isInfinite(_value)) return "Infinity"; else result = (int) _value; } else { int next = _node; result = 0; final int ntype = _document.getExpandedTypeID(_node); final int root = _document.getDocument(); while (next >= 0) { if (ntype == _document.getExpandedTypeID(next)) { result++; } //%HZ%: Is this the best way of finding the root? Is it better to check //%HZ%: parent(next)? if (next == root) { break; } else { --next; } } } return formatNumbers(result); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/NodeSortRecord.java0000644000175000017500000002037310721374032024661 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSortRecord.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.text.CollationKey; import java.text.Collator; import java.util.Locale; import org.apache.xalan.xsltc.CollatorFactory; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xml.utils.StringComparable; /** * Base class for sort records containing application specific sort keys */ public abstract class NodeSortRecord { public static final int COMPARE_STRING = 0; public static final int COMPARE_NUMERIC = 1; public static final int COMPARE_ASCENDING = 0; public static final int COMPARE_DESCENDING = 1; /** * A reference to a collator. May be updated by subclass if the stylesheet * specifies a different language (will be updated iff _locale is updated). * @deprecated This field continues to exist for binary compatibility. * New code should not refer to it. */ private static final Collator DEFAULT_COLLATOR = Collator.getInstance(); /** * A reference to the first Collator * @deprecated This field continues to exist for binary compatibility. * New code should not refer to it. */ protected Collator _collator = DEFAULT_COLLATOR; protected Collator[] _collators; /** * A locale field that might be set by an instance of a subclass. * @deprecated This field continues to exist for binary compatibility. * New code should not refer to it. */ protected Locale _locale; protected CollatorFactory _collatorFactory; protected SortSettings _settings; private DOM _dom = null; private int _node; // The position in the current iterator private int _last = 0; // Number of nodes in the current iterator private int _scanned = 0; // Number of key levels extracted from DOM private Object[] _values; // Contains Comparable objects /** * This constructor is run by a call to ClassLoader in the * makeNodeSortRecord method in the NodeSortRecordFactory class. Since we * cannot pass any parameters to the constructor in that case we just set * the default values here and wait for new values through initialize(). */ public NodeSortRecord(int node) { _node = node; } public NodeSortRecord() { this(0); } /** * This method allows the caller to set the values that could not be passed * to the default constructor. */ public final void initialize(int node, int last, DOM dom, SortSettings settings) throws TransletException { _dom = dom; _node = node; _last = last; _settings = settings; int levels = settings.getSortOrders().length; _values = new Object[levels]; // -- W. Eliot Kimber (eliot@isogen.com) String colFactClassname = System.getProperty("org.apache.xalan.xsltc.COLLATOR_FACTORY"); if (colFactClassname != null) { try { Object candObj = ObjectFactory.findProviderClass( colFactClassname, ObjectFactory.findClassLoader(), true); _collatorFactory = (CollatorFactory)candObj; } catch (ClassNotFoundException e) { throw new TransletException(e); } Locale[] locales = settings.getLocales(); _collators = new Collator[levels]; for (int i = 0; i < levels; i++){ _collators[i] = _collatorFactory.getCollator(locales[i]); } _collator = _collators[0]; } else { _collators = settings.getCollators(); _collator = _collators[0]; } } /** * Returns the node for this sort object */ public final int getNode() { return _node; } /** * */ public final int compareDocOrder(NodeSortRecord other) { return _node - other._node; } /** * Get the string or numeric value of a specific level key for this sort * element. The value is extracted from the DOM if it is not already in * our sort key vector. */ private final Comparable stringValue(int level) { // Get value from our array if possible if (_scanned <= level) { AbstractTranslet translet = _settings.getTranslet(); Locale[] locales = _settings.getLocales(); String[] caseOrder = _settings.getCaseOrders(); // Get value from DOM if accessed for the first time final String str = extractValueFromDOM(_dom, _node, level, translet, _last); final Comparable key = StringComparable.getComparator(str, locales[level], _collators[level], caseOrder[level]); _values[_scanned++] = key; return(key); } return((Comparable)_values[level]); } private final Double numericValue(int level) { // Get value from our vector if possible if (_scanned <= level) { AbstractTranslet translet = _settings.getTranslet(); // Get value from DOM if accessed for the first time final String str = extractValueFromDOM(_dom, _node, level, translet, _last); Double num; try { num = new Double(str); } // Treat number as NaN if it cannot be parsed as a double catch (NumberFormatException e) { num = new Double(Double.NEGATIVE_INFINITY); } _values[_scanned++] = num; return(num); } return((Double)_values[level]); } /** * Compare this sort element to another. The first level is checked first, * and we proceed to the next level only if the first level keys are * identical (and so the key values may not even be extracted from the DOM) * * !!!!MUST OPTIMISE - THIS IS REALLY, REALLY SLOW!!!! */ public int compareTo(NodeSortRecord other) { int cmp, level; int[] sortOrder = _settings.getSortOrders(); int levels = _settings.getSortOrders().length; int[] compareTypes = _settings.getTypes(); for (level = 0; level < levels; level++) { // Compare the two nodes either as numeric or text values if (compareTypes[level] == COMPARE_NUMERIC) { final Double our = numericValue(level); final Double their = other.numericValue(level); cmp = our.compareTo(their); } else { final Comparable our = stringValue(level); final Comparable their = other.stringValue(level); cmp = our.compareTo(their); } // Return inverse compare value if inverse sort order if (cmp != 0) { return sortOrder[level] == COMPARE_DESCENDING ? 0 - cmp : cmp; } } // Compare based on document order if all sort keys are equal return(_node - other._node); } /** * Returns the array of Collators used for text comparisons in this object. * May be overridden by inheriting classes */ public Collator[] getCollator() { return _collators; } /** * Extract the sort value for a level of this key. */ public abstract String extractValueFromDOM(DOM dom, int current, int level, AbstractTranslet translet, int last); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/DOMWSFilter.java0000644000175000017500000001152610721374033024025 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMWSFilter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMWSFilter; /** * A wrapper class that adapts the * {@link org.apache.xml.dtm.DTMWSFilter DTMWSFilter} interface to the XSLTC * DOM {@link org.apache.xalan.xsltc.StripFilter StripFilter} interface. */ public class DOMWSFilter implements DTMWSFilter { private AbstractTranslet m_translet; private StripFilter m_filter; // The Hashtable for DTM to mapping array private Hashtable m_mappings; // Cache the DTM and mapping that are used last time private DTM m_currentDTM; private short[] m_currentMapping; /** * Construct an adapter connecting the DTMWSFilter interface * to the StripFilter interface. * * @param translet A translet that also implements the StripFilter * interface. * * @see org.apache.xml.dtm.DTMWSFilter * @see org.apache.xalan.xsltc.StripFilter */ public DOMWSFilter(AbstractTranslet translet) { m_translet = translet; m_mappings = new Hashtable(); if (translet instanceof StripFilter) { m_filter = (StripFilter) translet; } } /** * Test whether whitespace-only text nodes are visible in the logical * view of DTM. Normally, this function * will be called by the implementation of DTM; * it is not normally called directly from * user code. * * @param node int handle of the node. * @param dtm the DTM that owns this node * @return one of NOTSTRIP, STRIP or * INHERIT. */ public short getShouldStripSpace(int node, DTM dtm) { if (m_filter != null && dtm instanceof DOM) { DOM dom = (DOM)dtm; int type = 0; if (dtm instanceof DOMEnhancedForDTM) { DOMEnhancedForDTM mappableDOM = (DOMEnhancedForDTM)dtm; short[] mapping; if (dtm == m_currentDTM) { mapping = m_currentMapping; } else { mapping = (short[])m_mappings.get(dtm); if (mapping == null) { mapping = mappableDOM.getMapping( m_translet.getNamesArray(), m_translet.getUrisArray(), m_translet.getTypesArray()); m_mappings.put(dtm, mapping); m_currentDTM = dtm; m_currentMapping = mapping; } } int expType = mappableDOM.getExpandedTypeID(node); // %OPT% The mapping array does not have information about all the // exptypes. However it does contain enough information about all names // in the translet's namesArray. If the expType does not fall into the // range of the mapping array, it means that the expType is not for one // of the recognized names. In this case we can just set the type to -1. if (expType >= 0 && expType < mapping.length) type = mapping[expType]; else type = -1; } else { return INHERIT; } if (m_filter.stripSpace(dom, node, type)) { return STRIP; } else { return NOTSTRIP; } } else { return NOTSTRIP; } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SecuritySupport12.java0000644000175000017500000001176110721374030025333 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/StripWhitespaceFilter.java0000644000175000017500000000221510721374031026243 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StripWhitespaceFilter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface StripWhitespaceFilter { public boolean stripSpace(DOM dom, int node, int type); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/XSLTCDTMManager.java0000644000175000017500000004201610721374031024517 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTCDTMManager.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.ref.DTMDefaultBase; import org.apache.xml.dtm.DTMException; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.dtm.ref.DTMManagerDefault; import org.apache.xml.res.XMLErrorResources; import org.apache.xml.res.XMLMessages; import org.apache.xml.utils.SystemIDResolver; import org.apache.xalan.xsltc.trax.DOM2SAX; import org.xml.sax.InputSource; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; /** * The default implementation for the DTMManager. */ public class XSLTCDTMManager extends DTMManagerDefault { /** The default class name to use as the manager. */ private static final String DEFAULT_CLASS_NAME = "org.apache.xalan.xsltc.dom.XSLTCDTMManager"; private static final String DEFAULT_PROP_NAME = "org.apache.xalan.xsltc.dom.XSLTCDTMManager"; /** Set this to true if you want a dump of the DTM after creation */ private static final boolean DUMPTREE = false; /** Set this to true if you want basic diagnostics */ private static final boolean DEBUG = false; /** * Constructor DTMManagerDefault * */ public XSLTCDTMManager() { super(); } /** * Obtain a new instance of a DTMManager. * This static method creates a new factory instance. * The current implementation just returns a new XSLTCDTMManager instance. */ public static XSLTCDTMManager newInstance() { return new XSLTCDTMManager(); } /** * Look up the class that provides the XSLTC DTM Manager service. * The following lookup procedure is used to find the service provider. *
          *
        1. The value of the * org.apache.xalan.xsltc.dom.XSLTCDTMManager property, is * checked.
        2. *
        3. The xalan.propeties file is checked for a property * of the same name.
        4. *
        5. The * META-INF/services/org.apache.xalan.xsltc.dom.XSLTCDTMManager * file is checked. *
        * The default is org.apache.xalan.xsltc.dom.XSLTCDTMManager. */ public static Class getDTMManagerClass() { Class mgrClass = ObjectFactory.lookUpFactoryClass(DEFAULT_PROP_NAME, null, DEFAULT_CLASS_NAME); // If no class found, default to this one. (This should never happen - // the ObjectFactory has already been told that the current class is // the default). return (mgrClass != null) ? mgrClass : XSLTCDTMManager.class; } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * (I think more parameters will need to be added for error handling, and * entity resolution). * * @param source the specification of the source object. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * * @return a non-null DTM reference. */ public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing) { return getDTM(source, unique, whiteSpaceFilter, incremental, doIndexing, false, 0, true, false); } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * (I think more parameters will need to be added for error handling, and * entity resolution). * * @param source the specification of the source object. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param buildIdIndex true if the id index table should be built. * * @return a non-null DTM reference. */ public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing, boolean buildIdIndex) { return getDTM(source, unique, whiteSpaceFilter, incremental, doIndexing, false, 0, buildIdIndex, false); } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * (I think more parameters will need to be added for error handling, and * entity resolution). * * @param source the specification of the source object. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param buildIdIndex true if the id index table should be built. * @param newNameTable true if we want to use a separate ExpandedNameTable * for this DTM. * * @return a non-null DTM reference. */ public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing, boolean buildIdIndex, boolean newNameTable) { return getDTM(source, unique, whiteSpaceFilter, incremental, doIndexing, false, 0, buildIdIndex, newNameTable); } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * (I think more parameters will need to be added for error handling, and * entity resolution). * * @param source the specification of the source object. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param hasUserReader true if source is a * SAXSource object that has an * XMLReader, that was specified by the * user. * @param size Specifies initial size of tables that represent the DTM * @param buildIdIndex true if the id index table should be built. * * @return a non-null DTM reference. */ public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing, boolean hasUserReader, int size, boolean buildIdIndex) { return getDTM(source, unique, whiteSpaceFilter, incremental, doIndexing, hasUserReader, size, buildIdIndex, false); } /** * Get an instance of a DTM, loaded with the content from the * specified source. If the unique flag is true, a new instance will * always be returned. Otherwise it is up to the DTMManager to return a * new instance or an instance that it already created and may be being used * by someone else. * (I think more parameters will need to be added for error handling, and * entity resolution). * * @param source the specification of the source object. * @param unique true if the returned DTM must be unique, probably because it * is going to be mutated. * @param whiteSpaceFilter Enables filtering of whitespace nodes, and may * be null. * @param incremental true if the DTM should be built incrementally, if * possible. * @param doIndexing true if the caller considers it worth it to use * indexing schemes. * @param hasUserReader true if source is a * SAXSource object that has an * XMLReader, that was specified by the * user. * @param size Specifies initial size of tables that represent the DTM * @param buildIdIndex true if the id index table should be built. * @param newNameTable true if we want to use a separate ExpandedNameTable * for this DTM. * * @return a non-null DTM reference. */ public DTM getDTM(Source source, boolean unique, DTMWSFilter whiteSpaceFilter, boolean incremental, boolean doIndexing, boolean hasUserReader, int size, boolean buildIdIndex, boolean newNameTable) { if(DEBUG && null != source) { System.out.println("Starting "+ (unique ? "UNIQUE" : "shared")+ " source: "+source.getSystemId()); } int dtmPos = getFirstFreeDTMID(); int documentID = dtmPos << IDENT_DTM_NODE_BITS; if ((null != source) && source instanceof DOMSource) { final DOMSource domsrc = (DOMSource) source; final org.w3c.dom.Node node = domsrc.getNode(); final DOM2SAX dom2sax = new DOM2SAX(node); SAXImpl dtm; if (size <= 0) { dtm = new SAXImpl(this, source, documentID, whiteSpaceFilter, null, doIndexing, DTMDefaultBase.DEFAULT_BLOCKSIZE, buildIdIndex, newNameTable); } else { dtm = new SAXImpl(this, source, documentID, whiteSpaceFilter, null, doIndexing, size, buildIdIndex, newNameTable); } dtm.setDocumentURI(source.getSystemId()); addDTM(dtm, dtmPos, 0); dom2sax.setContentHandler(dtm); try { dom2sax.parse(); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new org.apache.xml.utils.WrappedRuntimeException(e); } return dtm; } else { boolean isSAXSource = (null != source) ? (source instanceof SAXSource) : true; boolean isStreamSource = (null != source) ? (source instanceof StreamSource) : false; if (isSAXSource || isStreamSource) { XMLReader reader; InputSource xmlSource; if (null == source) { xmlSource = null; reader = null; hasUserReader = false; // Make sure the user didn't lie } else { reader = getXMLReader(source); xmlSource = SAXSource.sourceToInputSource(source); String urlOfSource = xmlSource.getSystemId(); if (null != urlOfSource) { try { urlOfSource = SystemIDResolver.getAbsoluteURI(urlOfSource); } catch (Exception e) { // %REVIEW% Is there a better way to send a warning? System.err.println("Can not absolutize URL: " + urlOfSource); } xmlSource.setSystemId(urlOfSource); } } // Create the basic SAX2DTM. SAXImpl dtm; if (size <= 0) { dtm = new SAXImpl(this, source, documentID, whiteSpaceFilter, null, doIndexing, DTMDefaultBase.DEFAULT_BLOCKSIZE, buildIdIndex, newNameTable); } else { dtm = new SAXImpl(this, source, documentID, whiteSpaceFilter, null, doIndexing, size, buildIdIndex, newNameTable); } // Go ahead and add the DTM to the lookup table. This needs to be // done before any parsing occurs. Note offset 0, since we've just // created a new DTM. addDTM(dtm, dtmPos, 0); if (null == reader) { // Then the user will construct it themselves. return dtm; } reader.setContentHandler(dtm.getBuilder()); if (!hasUserReader || null == reader.getDTDHandler()) { reader.setDTDHandler(dtm); } if(!hasUserReader || null == reader.getErrorHandler()) { reader.setErrorHandler(dtm); } try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", dtm); } catch (SAXNotRecognizedException e){} catch (SAXNotSupportedException e){} try { reader.parse(xmlSource); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new org.apache.xml.utils.WrappedRuntimeException(e); } finally { if (!hasUserReader) { releaseXMLReader(reader); } } if (DUMPTREE) { System.out.println("Dumping SAX2DOM"); dtm.dumpDTM(System.err); } return dtm; } else { // It should have been handled by a derived class or the caller // made a mistake. throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NOT_SUPPORTED, new Object[]{source})); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SortingIterator.java0000644000175000017500000001010310721374033025113 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SortingIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class SortingIterator extends DTMAxisIteratorBase { private final static int INIT_DATA_SIZE = 16; private DTMAxisIterator _source; private NodeSortRecordFactory _factory; private NodeSortRecord[] _data; private int _free = 0; private int _current; // index in _nodes of the next node to try public SortingIterator(DTMAxisIterator source, NodeSortRecordFactory factory) { _source = source; _factory = factory; } public int next() { return _current < _free ? _data[_current++].getNode() : END; } public DTMAxisIterator setStartNode(int node) { try { _source.setStartNode(_startNode = node); _data = new NodeSortRecord[INIT_DATA_SIZE]; _free = 0; // gather all nodes from the source iterator while ((node = _source.next()) != END) { addRecord(_factory.makeNodeSortRecord(node,_free)); } // now sort the records quicksort(0, _free - 1); _current = 0; return this; } catch (Exception e) { return this; } } public int getPosition() { return _current == 0 ? 1 : _current; } public int getLast() { return _free; } public void setMark() { _source.setMark(); _markedNode = _current; } public void gotoMark() { _source.gotoMark(); _current = _markedNode; } /** * Clone a SortingIterator by cloning its source * iterator and then sharing the factory and the array of * NodeSortRecords. */ public DTMAxisIterator cloneIterator() { try { final SortingIterator clone = (SortingIterator) super.clone(); clone._source = _source.cloneIterator(); clone._factory = _factory; // shared between clones clone._data = _data; // shared between clones clone._free = _free; clone._current = _current; clone.setRestartable(false); return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } private void addRecord(NodeSortRecord record) { if (_free == _data.length) { NodeSortRecord[] newArray = new NodeSortRecord[_data.length * 2]; System.arraycopy(_data, 0, newArray, 0, _free); _data = newArray; } _data[_free++] = record; } private void quicksort(int p, int r) { while (p < r) { final int q = partition(p, r); quicksort(p, q); p = q + 1; } } private int partition(int p, int r) { final NodeSortRecord x = _data[(p + r) >>> 1]; int i = p - 1; int j = r + 1; while (true) { while (x.compareTo(_data[--j]) < 0); while (x.compareTo(_data[++i]) > 0); if (i < j) { final NodeSortRecord t = _data[i]; _data[i] = _data[j]; _data[j] = t; } else { return(j); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/MatchingIterator.java0000644000175000017500000000742010721374030025225 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MatchingIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * This is a special kind of iterator that takes a source iterator and a * node N. If initialized with a node M (the parent of N) it computes the * position of N amongst the children of M. This position can be obtained * by calling getPosition(). * It is an iterator even though next() will never be called. It is used to * match patterns with a single predicate like: * * BOOK[position() = last()] * * In this example, the source iterator will return elements of type BOOK, * a call to position() will return the position of N. Notice that because * of the way the pattern matching is implemented, N will always be a node * in the source since (i) it is a BOOK or the test sequence would not be * considered and (ii) the source iterator is initialized with M which is * the parent of N. Also, and still in this example, a call to last() will * return the number of elements in the source (i.e. the number of BOOKs). * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class MatchingIterator extends DTMAxisIteratorBase { /** * A reference to a source iterator. */ private DTMAxisIterator _source; /** * The node to match. */ private final int _match; public MatchingIterator(int match, DTMAxisIterator source) { _source = source; _match = match; } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public DTMAxisIterator cloneIterator() { try { final MatchingIterator clone = (MatchingIterator) super.clone(); clone._source = _source.cloneIterator(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { // iterator is not a clone _source.setStartNode(node); // Calculate the position of the node in the set _position = 1; while ((node = _source.next()) != END && node != _match) { _position++; } } return this; } public DTMAxisIterator reset() { _source.reset(); return resetPosition(); } public int next() { return _source.next(); } public int getLast() { if (_last == -1) { _last = _source.getLast(); } return _last; } public int getPosition() { return _position; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/MultiValuedNodeHeapIterator.java0000644000175000017500000002134010721374031027330 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnionIterator.java 337874 2004-02-16 23:06:53Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** *

        MultiValuedNodeHeapIterator takes a set of multi-valued * heap nodes and produces a merged NodeSet in document order with duplicates * removed.

        *

        Each multi-valued heap node (which might be a * {@link org.apache.xml.dtm.DTMAxisIterator}, but that's not necessary) * generates DTM node handles in document order. The class * maintains the multi-valued heap nodes in a heap, not surprisingly, sorted by * the next DTM node handle available form the heap node.

        *

        After a DTM node is pulled from the heap node that's at the top of the * heap, the heap node is advanced to the next DTM node handle it makes * available, and the heap nature of the heap is restored to ensure the next * DTM node handle pulled is next in document order overall. * * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class MultiValuedNodeHeapIterator extends DTMAxisIteratorBase { /** wrapper for NodeIterators to support iterator comparison on the value of their next() method */ /** * An abstract representation of a set of nodes that will be retrieved in * document order. */ public abstract class HeapNode implements Cloneable { protected int _node, _markedNode; protected boolean _isStartSet = false; /** * Advance to the next node represented by this {@link HeapNode} * * @return the next DTM node. */ public abstract int step(); /** * Creates a deep copy of this {@link HeapNode}. The clone is not * reset from the current position of the original. * * @return the cloned heap node */ public HeapNode cloneHeapNode() { HeapNode clone; try { clone = (HeapNode) super.clone(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } clone._node = _node; clone._markedNode = _node; return clone; } /** * Remembers the current node for the next call to {@link #gotoMark()}. */ public void setMark() { _markedNode = _node; } /** * Restores the current node remembered by {@link #setMark()}. */ public void gotoMark() { _node = _markedNode; } /** * Performs a comparison of the two heap nodes * * @param heapNode the heap node against which to compare * @return true if and only if the current node for this * heap node is before the current node of the argument heap * node in document order. */ public abstract boolean isLessThan(HeapNode heapNode); /** * Sets context with respect to which this heap node is evaluated. * * @param node The new context node * @return a {@link HeapNode} which may or may not be the same as * this HeapNode. */ public abstract HeapNode setStartNode(int node); /** * Reset the heap node back to its beginning. * * @return a {@link HeapNode} which may or may not be the same as * this HeapNode. */ public abstract HeapNode reset(); } // end of HeapNode private static final int InitSize = 8; private int _heapSize = 0; private int _size = InitSize; private HeapNode[] _heap = new HeapNode[InitSize]; private int _free = 0; // Last node returned by this MultiValuedNodeHeapIterator to the caller of // next; used to prune duplicates private int _returnedLast; // cached returned last for use in gotoMark private int _cachedReturnedLast = END; // cached heap size for use in gotoMark private int _cachedHeapSize; public DTMAxisIterator cloneIterator() { _isRestartable = false; final HeapNode[] heapCopy = new HeapNode[_heap.length]; try { MultiValuedNodeHeapIterator clone = (MultiValuedNodeHeapIterator)super.clone(); for (int i = 0; i < _free; i++) { heapCopy[i] = _heap[i].cloneHeapNode(); } clone.setRestartable(false); clone._heap = heapCopy; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } protected void addHeapNode(HeapNode node) { if (_free == _size) { HeapNode[] newArray = new HeapNode[_size *= 2]; System.arraycopy(_heap, 0, newArray, 0, _free); _heap = newArray; } _heapSize++; _heap[_free++] = node; } public int next() { while (_heapSize > 0) { final int smallest = _heap[0]._node; if (smallest == END) { // iterator _heap[0] is done if (_heapSize > 1) { // Swap first and last (iterator must be restartable) final HeapNode temp = _heap[0]; _heap[0] = _heap[--_heapSize]; _heap[_heapSize] = temp; } else { return END; } } else if (smallest == _returnedLast) { // duplicate _heap[0].step(); // value consumed } else { _heap[0].step(); // value consumed heapify(0); return returnNode(_returnedLast = smallest); } // fallthrough if not returned above heapify(0); } return END; } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = node; for (int i = 0; i < _free; i++) { if(!_heap[i]._isStartSet){ _heap[i].setStartNode(node); _heap[i].step(); // to get the first node _heap[i]._isStartSet = true; } } // build heap for (int i = (_heapSize = _free)/2; i >= 0; i--) { heapify(i); } _returnedLast = END; return resetPosition(); } return this; } protected void init() { for (int i =0; i < _free; i++) { _heap[i] = null; } _heapSize = 0; _free = 0; } /* Build a heap in document order. put the smallest node on the top. * "smallest node" means the node before other nodes in document order */ private void heapify(int i) { for (int r, l, smallest;;) { r = (i + 1) << 1; l = r - 1; smallest = l < _heapSize && _heap[l].isLessThan(_heap[i]) ? l : i; if (r < _heapSize && _heap[r].isLessThan(_heap[smallest])) { smallest = r; } if (smallest != i) { final HeapNode temp = _heap[smallest]; _heap[smallest] = _heap[i]; _heap[i] = temp; i = smallest; } else { break; } } } public void setMark() { for (int i = 0; i < _free; i++) { _heap[i].setMark(); } _cachedReturnedLast = _returnedLast; _cachedHeapSize = _heapSize; } public void gotoMark() { for (int i = 0; i < _free; i++) { _heap[i].gotoMark(); } // rebuild heap after call last() function. fix for bug 20913 for (int i = (_heapSize = _cachedHeapSize)/2; i >= 0; i--) { heapify(i); } _returnedLast = _cachedReturnedLast; } public DTMAxisIterator reset() { for (int i = 0; i < _free; i++) { _heap[i].reset(); _heap[i].step(); } // build heap for (int i = (_heapSize = _free)/2; i >= 0; i--) { heapify(i); } _returnedLast = END; return resetPosition(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/FilterIterator.java0000644000175000017500000000650410721374031024723 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilterIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMFilter; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * Similar to a CurrentNodeListIterator except that the filter has a * simpler interface (only needs the node, no position, last, etc.) * It takes a source iterator and a Filter object and returns nodes * from the source after filtering them by calling filter.test(node). * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class FilterIterator extends DTMAxisIteratorBase { /** * Reference to source iterator. */ private DTMAxisIterator _source; /** * Reference to a filter object that to be applied to each node. */ private final DTMFilter _filter; /** * A flag indicating if position is reversed. */ private final boolean _isReverse; public FilterIterator(DTMAxisIterator source, DTMFilter filter) { _source = source; // System.out.println("FI souce = " + source + " this = " + this); _filter = filter; _isReverse = source.isReverse(); } public boolean isReverse() { return _isReverse; } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public DTMAxisIterator cloneIterator() { try { final FilterIterator clone = (FilterIterator) super.clone(); clone._source = _source.cloneIterator(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public DTMAxisIterator reset() { _source.reset(); return resetPosition(); } public int next() { int node; while ((node = _source.next()) != END) { if (_filter.acceptNode(node, DTMFilter.SHOW_ALL) == DTMIterator.FILTER_ACCEPT) { return returnNode(node); } } return END; } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _source.setStartNode(_startNode = node); return resetPosition(); } return this; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/NodeIteratorBase.java0000644000175000017500000001101210721374030025143 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeIteratorBase.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.NodeIterator; import org.apache.xalan.xsltc.runtime.BasisLibrary; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public abstract class NodeIteratorBase implements NodeIterator { /** * Cached computed value of last(). */ protected int _last = -1; /** * Value of position() in this iterator. Incremented in * returnNode(). */ protected int _position = 0; /** * Store node in call to setMark(). */ protected int _markedNode; /** * Store node in call to setStartNode(). */ protected int _startNode = NodeIterator.END; /** * Flag indicating if "self" should be returned. */ protected boolean _includeSelf = false; /** * Flag indicating if iterator can be restarted. */ protected boolean _isRestartable = true; /** * Setter for _isRestartable flag. */ public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; } /** * Initialize iterator using a node. If iterator is not * restartable, then do nothing. If node is equal to END then * subsequent calls to next() must return END. */ abstract public NodeIterator setStartNode(int node); /** * Reset this iterator using state from last call to * setStartNode(). */ public NodeIterator reset() { final boolean temp = _isRestartable; _isRestartable = true; // Must adjust _startNode if self is included setStartNode(_includeSelf ? _startNode + 1 : _startNode); _isRestartable = temp; return this; } /** * Setter for _includeSelf flag. */ public NodeIterator includeSelf() { _includeSelf = true; return this; } /** * Default implementation of getLast(). Stores current position * and current node, resets the iterator, counts all nodes and * restores iterator to original state. */ public int getLast() { if (_last == -1) { final int temp = _position; setMark(); reset(); do { _last++; } while (next() != END); gotoMark(); _position = temp; } return _last; } /** * Returns the position() in this iterator. */ public int getPosition() { return _position == 0 ? 1 : _position; } /** * Indicates if position in this iterator is computed in reverse * document order. Note that nodes are always returned in document * order. */ public boolean isReverse() { return false; } /** * Clones and resets this iterator. Note that the cloned iterator is * not restartable. This is because cloning is needed for variable * references, and the context node of the original variable * declaration must be preserved. */ public NodeIterator cloneIterator() { try { final NodeIteratorBase clone = (NodeIteratorBase)super.clone(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } /** * Utility method that increments position and returns its * argument. */ protected final int returnNode(final int node) { _position++; return node; } /** * Reset the position in this iterator. */ protected final NodeIterator resetPosition() { _position = 0; return this; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/CurrentNodeListFilter.java0000644000175000017500000000246710721374031026222 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CurrentNodeListFilter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xml.dtm.DTMAxisIterator; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public interface CurrentNodeListFilter { public abstract boolean test(int node, int position, int last, int current, AbstractTranslet translet, DTMAxisIterator iter); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/CurrentNodeListIterator.java0000644000175000017500000001322310721374032026557 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CurrentNodeListIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.util.IntegerArray; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * Iterators of this kind use a CurrentNodeListFilter to filter a subset of * nodes from a source iterator. For each node from the source, the boolean * method CurrentNodeListFilter.test() is called. * * All nodes from the source are read into an array upon calling setStartNode() * (this is needed to determine the value of last, a parameter to * CurrentNodeListFilter.test()). The method getLast() returns the last element * after applying the filter. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class CurrentNodeListIterator extends DTMAxisIteratorBase { /** * A flag indicating if nodes are returned in document order. */ private boolean _docOrder; /** * The source for this iterator. */ private DTMAxisIterator _source; /** * A reference to a filter object. */ private final CurrentNodeListFilter _filter; /** * An integer array to store nodes from source iterator. */ private IntegerArray _nodes = new IntegerArray(); /** * Index in _nodes of the next node to filter. */ private int _currentIndex; /** * The current node in the stylesheet at the time of evaluation. */ private final int _currentNode; /** * A reference to the translet. */ private AbstractTranslet _translet; public CurrentNodeListIterator(DTMAxisIterator source, CurrentNodeListFilter filter, int currentNode, AbstractTranslet translet) { this(source, !source.isReverse(), filter, currentNode, translet); } public CurrentNodeListIterator(DTMAxisIterator source, boolean docOrder, CurrentNodeListFilter filter, int currentNode, AbstractTranslet translet) { _source = source; _filter = filter; _translet = translet; _docOrder = docOrder; _currentNode = currentNode; } public DTMAxisIterator forceNaturalOrder() { _docOrder = true; return this; } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public boolean isReverse() { return !_docOrder; } public DTMAxisIterator cloneIterator() { try { final CurrentNodeListIterator clone = (CurrentNodeListIterator) super.clone(); clone._nodes = (IntegerArray) _nodes.clone(); clone._source = _source.cloneIterator(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public DTMAxisIterator reset() { _currentIndex = 0; return resetPosition(); } public int next() { final int last = _nodes.cardinality(); final int currentNode = _currentNode; final AbstractTranslet translet = _translet; for (int index = _currentIndex; index < last; ) { final int position = _docOrder ? index + 1 : last - index; final int node = _nodes.at(index++); // note increment if (_filter.test(node, position, last, currentNode, translet, this)) { _currentIndex = index; return returnNode(node); } } return END; } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _source.setStartNode(_startNode = node); _nodes.clear(); while ((node = _source.next()) != END) { _nodes.add(node); } _currentIndex = 0; resetPosition(); } return this; } public int getLast() { if (_last == -1) { _last = computePositionOfLast(); } return _last; } public void setMark() { _markedNode = _currentIndex; } public void gotoMark() { _currentIndex = _markedNode; } private int computePositionOfLast() { final int last = _nodes.cardinality(); final int currNode = _currentNode; final AbstractTranslet translet = _translet; int lastPosition = _position; for (int index = _currentIndex; index < last; ) { final int position = _docOrder ? index + 1 : last - index; int nodeIndex = _nodes.at(index++); // note increment if (_filter.test(nodeIndex, position, last, currNode, translet, this)) { lastPosition++; } } return lastPosition; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/CachedNodeListIterator.java0000644000175000017500000000615710721374031026313 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: CachedNodeListIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; import org.apache.xalan.xsltc.util.IntegerArray; /** * CachedNodeListIterator is used for select expressions in a * variable or parameter. This iterator caches all nodes in an * IntegerArray. Its cloneIterator() method is overridden to * return an object of ClonedNodeListIterator. */ public final class CachedNodeListIterator extends DTMAxisIteratorBase { /** * Source for this iterator. */ private DTMAxisIterator _source; private IntegerArray _nodes = new IntegerArray(); private int _numCachedNodes = 0; private int _index = 0; private boolean _isEnded = false; public CachedNodeListIterator(DTMAxisIterator source) { _source = source; } public void setRestartable(boolean isRestartable) { //_isRestartable = isRestartable; //_source.setRestartable(isRestartable); } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = node; _source.setStartNode(node); resetPosition(); _isRestartable = false; } return this; } public int next() { return getNode(_index++); } public int getPosition() { return _index == 0 ? 1 : _index; } public int getNodeByPosition(int pos) { return getNode(pos); } public int getNode(int index) { if (index < _numCachedNodes) { return _nodes.at(index); } else if (!_isEnded){ int node = _source.next(); if (node != END) { _nodes.add(node); _numCachedNodes++; } else { _isEnded = true; } return node; } else return END; } public DTMAxisIterator cloneIterator() { ClonedNodeListIterator clone = new ClonedNodeListIterator(this); return clone; } public DTMAxisIterator reset() { _index = 0; return this; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/ClonedNodeListIterator.java0000644000175000017500000000442010721374032026340 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ClonedNodeListIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * A ClonedNodeListIterator is returned by the cloneIterator() method * of a CachedNodeListIterator. Its next() method retrieves the nodes from * the cache of the CachedNodeListIterator. */ public final class ClonedNodeListIterator extends DTMAxisIteratorBase { /** * Source for this iterator. */ private CachedNodeListIterator _source; private int _index = 0; public ClonedNodeListIterator(CachedNodeListIterator source) { _source = source; } public void setRestartable(boolean isRestartable) { //_isRestartable = isRestartable; //_source.setRestartable(isRestartable); } public DTMAxisIterator setStartNode(int node) { return this; } public int next() { return _source.getNode(_index++); } public int getPosition() { return _index == 0 ? 1 : _index; } public int getNodeByPosition(int pos) { return _source.getNode(pos); } public DTMAxisIterator cloneIterator() { return _source.cloneIterator(); } public DTMAxisIterator reset() { _index = 0; return this; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/BitArray.java0000644000175000017500000001716010721374033023503 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: BitArray.java 478667 2006-11-23 20:50:36Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import org.apache.xml.dtm.DTMAxisIterator; /** * @author Morten Jorgensen */ public class BitArray implements Externalizable { static final long serialVersionUID = -4876019880708377663L; private int[] _bits; private int _bitSize; private int _intSize; private int _mask; // This table is used to prevent expensive shift operations // (These operations are inexpensive on CPUs but very expensive on JVMs.) private final static int[] _masks = { 0x80000000, 0x40000000, 0x20000000, 0x10000000, 0x08000000, 0x04000000, 0x02000000, 0x01000000, 0x00800000, 0x00400000, 0x00200000, 0x00100000, 0x00080000, 0x00040000, 0x00020000, 0x00010000, 0x00008000, 0x00004000, 0x00002000, 0x00001000, 0x00000800, 0x00000400, 0x00000200, 0x00000100, 0x00000080, 0x00000040, 0x00000020, 0x00000010, 0x00000008, 0x00000004, 0x00000002, 0x00000001 }; private final static boolean DEBUG_ASSERTIONS = false; /** * Constructor. Defines the initial size of the bit array (in bits). */ public BitArray() { this(32); } public BitArray(int size) { if (size < 32) size = 32; _bitSize = size; _intSize = (_bitSize >>> 5) + 1; _bits = new int[_intSize + 1]; } public BitArray(int size, int[] bits) { if (size < 32) size = 32; _bitSize = size; _intSize = (_bitSize >>> 5) + 1; _bits = bits; } /** * Set the mask for this bit array. The upper 8 bits of this mask * indicate the DOM in which the nodes in this array belong. */ public void setMask(int mask) { _mask = mask; } /** * See setMask() */ public int getMask() { return(_mask); } /** * Returns the size of this bit array (in bits). */ public final int size() { return(_bitSize); } /** * Returns true if the given bit is set */ public final boolean getBit(int bit) { if (DEBUG_ASSERTIONS) { if (bit >= _bitSize) { throw new Error( "Programmer's assertion in BitArray.getBit"); } } return((_bits[bit>>>5] & _masks[bit%32]) != 0); } /** * Returns the next set bit from a given position */ public final int getNextBit(int startBit) { for (int i = (startBit >>> 5) ; i<=_intSize; i++) { int bits = _bits[i]; if (bits != 0) { for (int b = (startBit % 32); b<32; b++) { if ((bits & _masks[b]) != 0) { return((i << 5) + b); } } } startBit = 0; } return(DTMAxisIterator.END); } /** * This method returns the Nth bit that is set in the bit array. The * current position is cached in the following 4 variables and will * help speed up a sequence of next() call in an index iterator. This * method is a mess, but it is fast and it works, so don't change it. */ private int _pos = Integer.MAX_VALUE; private int _node = 0; private int _int = 0; private int _bit = 0; public final int getBitNumber(int pos) { // Return last node if position we're looking for is the same if (pos == _pos) return(_node); // Start from beginning of position we're looking for is before // the point where we left off the last time. if (pos < _pos) { _int = _bit = _pos = 0; } // Scan through the bit array - skip integers that have no bits set for ( ; _int <= _intSize; _int++) { int bits = _bits[_int]; if (bits != 0) { // Any bits set? for ( ; _bit < 32; _bit++) { if ((bits & _masks[_bit]) != 0) { if (++_pos == pos) { _node = ((_int << 5) + _bit) - 1; return (_node); } } } _bit = 0; } } return(0); } /** * Returns the integer array in which the bit array is contained */ public final int[] data() { return(_bits); } int _first = Integer.MAX_VALUE; // The index where first set bit is int _last = Integer.MIN_VALUE; // The _INTEGER INDEX_ where last set bit is /** * Sets a given bit */ public final void setBit(int bit) { if (DEBUG_ASSERTIONS) { if (bit >= _bitSize) { throw new Error( "Programmer's assertion in BitArray.getBit"); } } if (bit >= _bitSize) return; final int i = (bit >>> 5); if (i < _first) _first = i; if (i > _last) _last = i; _bits[i] |= _masks[bit % 32]; } /** * Merge two bit arrays. This currently only works for nodes from * a single DOM (because there is only one _mask per array). */ public final BitArray merge(BitArray other) { // Take other array's bits if we have node set if (_last == -1) { _bits = other._bits; } // Only merge if other array has any bits set else if (other._last != -1) { int start = (_first < other._first) ? _first : other._first; int stop = (_last > other._last) ? _last : other._last; // Merge these bits into other array if other array is larger if (other._intSize > _intSize) { if (stop > _intSize) stop = _intSize; for (int i=start; i<=stop; i++) other._bits[i] |= _bits[i]; _bits = other._bits; } // Merge other bits into this array if this arrai is large/equal. else { if (stop > other._intSize) stop = other._intSize; for (int i=start; i<=stop; i++) _bits[i] |= other._bits[i]; } } return(this); } /** * Resizes the bit array - try to avoid using this method!!! */ public final void resize(int newSize) { if (newSize > _bitSize) { _intSize = (newSize >>> 5) + 1; final int[] newBits = new int[_intSize + 1]; System.arraycopy(_bits, 0, newBits, 0, (_bitSize>>>5) + 1); _bits = newBits; _bitSize = newSize; } } public BitArray cloneArray() { return(new BitArray(_intSize, _bits)); } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(_bitSize); out.writeInt(_mask); out.writeObject(_bits); out.flush(); } /** * Read the whole tree from a file (serialized) */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { _bitSize = in.readInt(); _intSize = (_bitSize >>> 5) + 1; _mask = in.readInt(); _bits = (int[])in.readObject(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/ForwardPositionIterator.java0000644000175000017500000000700410721374030026622 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ForwardPositionIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * This iterator is a wrapper that always returns the position of * a node in document order. It is needed for the case where * a call to position() occurs in the context of an XSLT element * such as xsl:for-each, xsl:apply-templates, etc. * * The getPosition() methods in DTMAxisIterators defined * in DTMDefaultBaseIterators always return the position * in document order, which is backwards for XPath in the * case of the ancestor, ancestor-or-self, previous and * previous-sibling. * * XSLTC implements position() with the * BasisLibrary.positionF() method, and uses the * DTMAxisIterator.isReverse() method to determine * whether the result of getPosition() should be * interpreted as being equal to position(). * But when the expression appears in apply-templates of * for-each, the position() function operates in document * order. * * The only effect of the ForwardPositionIterator is to force * the result of isReverse() to false, so that * BasisLibrary.positionF() calculates position() in a way * that's consistent with the context in which the * iterator is being used." * * (Apparently the correction of isReverse() occurs * implicitly, by inheritance. This class also appears * to maintain its own position counter, which seems * redundant.) * * @deprecated This class exists only for backwards compatibility with old * translets. New code should not reference it. */ public final class ForwardPositionIterator extends DTMAxisIteratorBase { private DTMAxisIterator _source; public ForwardPositionIterator(DTMAxisIterator source) { _source = source; } public DTMAxisIterator cloneIterator() { try { final ForwardPositionIterator clone = (ForwardPositionIterator) super.clone(); clone._source = _source.cloneIterator(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public int next() { return returnNode(_source.next()); } public DTMAxisIterator setStartNode(int node) { _source.setStartNode(node); return this; } public DTMAxisIterator reset() { _source.reset(); return resetPosition(); } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/Filter.java0000644000175000017500000000206010721374030023201 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Filter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public interface Filter { public boolean test(int node); } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/NthIterator.java0000644000175000017500000000600310721374033024223 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NthIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * @author Jacek Ambroziak * @author Morten Jorgensen */ public final class NthIterator extends DTMAxisIteratorBase { // ...[N] private DTMAxisIterator _source; private final int _position; private boolean _ready; public NthIterator(DTMAxisIterator source, int n) { _source = source; _position = n; } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public DTMAxisIterator cloneIterator() { try { final NthIterator clone = (NthIterator) super.clone(); clone._source = _source.cloneIterator(); // resets source clone._isRestartable = false; return clone; } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public int next() { if (_ready) { _ready = false; return _source.getNodeByPosition(_position); } return DTMAxisIterator.END; /* if (_ready && _position > 0) { final int pos = _source.isReverse() ? _source.getLast() - _position + 1 : _position; _ready = false; int node; while ((node = _source.next()) != DTMAxisIterator.END) { if (pos == _source.getPosition()) { return node; } } } return DTMAxisIterator.END; */ } public DTMAxisIterator setStartNode(final int node) { if (_isRestartable) { _source.setStartNode(node); _ready = true; } return this; } public DTMAxisIterator reset() { _source.reset(); _ready = true; return this; } public int getLast() { return 1; } public int getPosition() { return 1; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/NodeSortRecordFactory.java0000644000175000017500000001400410721374033026204 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeSortRecordFactory.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xml.utils.LocaleUtility; import java.util.Locale; import java.text.Collator; public class NodeSortRecordFactory { private static int DESCENDING = "descending".length(); private static int NUMBER = "number".length(); private final DOM _dom; private final String _className; private Class _class; private SortSettings _sortSettings; /** * */ protected Collator _collator; /** * Creates a NodeSortRecord producing object. The DOM specifies which tree * to get the nodes to sort from, the class name specifies what auxillary * class to use to sort the nodes (this class is generated by the Sort * class), and the translet parameter is needed for methods called by * this object. * * @deprecated This constructor is no longer used in generated code. It * exists only for backwards compatibility. */ public NodeSortRecordFactory(DOM dom, String className, Translet translet, String order[], String type[]) throws TransletException { this(dom, className, translet, order, type, null, null); } /** * Creates a NodeSortRecord producing object. The DOM specifies which tree * to get the nodes to sort from, the class name specifies what auxillary * class to use to sort the nodes (this class is generated by the Sort * class), and the translet parameter is needed for methods called by * this object. */ public NodeSortRecordFactory(DOM dom, String className, Translet translet, String order[], String type[], String lang[], String caseOrder[]) throws TransletException { try { _dom = dom; _className = className; // This should return a Class definition if using TrAX _class = translet.getAuxiliaryClass(className); // This code is only run when the native API is used if (_class == null) { _class = ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); } int levels = order.length; int[] iOrder = new int[levels]; int[] iType = new int[levels]; for (int i = 0; i < levels; i++) { if (order[i].length() == DESCENDING) { iOrder[i] = NodeSortRecord.COMPARE_DESCENDING; } if (type[i].length() == NUMBER) { iType[i] = NodeSortRecord.COMPARE_NUMERIC; } } // Old NodeSortRecordFactory constructor had no lang or case_order // arguments. Provide default values in that case for binary // compatibility. String[] emptyStringArray = null; if (lang == null || caseOrder == null) { int numSortKeys = order.length; emptyStringArray = new String[numSortKeys]; // Set up array of zero-length strings as default values // of lang and case_order for (int i = 0; i < numSortKeys; i++) { emptyStringArray[i] = ""; } } if (lang == null) { lang = emptyStringArray; } if (caseOrder == null) { caseOrder = emptyStringArray; } final int length = lang.length; Locale[] locales = new Locale[length]; Collator[] collators = new Collator[length]; for (int i = 0; i< length; i++){ locales[i] = LocaleUtility.langToLocale(lang[i]); collators[i] = Collator.getInstance(locales[i]); } _sortSettings = new SortSettings((AbstractTranslet) translet, iOrder, iType, locales, collators, caseOrder); } catch (ClassNotFoundException e) { throw new TransletException(e); } } /** * Create an instance of a sub-class of NodeSortRecord. The name of this * sub-class is passed to us in the constructor. */ public NodeSortRecord makeNodeSortRecord(int node, int last) throws ExceptionInInitializerError, LinkageError, IllegalAccessException, InstantiationException, SecurityException, TransletException { final NodeSortRecord sortRecord = (NodeSortRecord)_class.newInstance(); sortRecord.initialize(node, last, _dom, _sortSettings); return sortRecord; } public String getClassName() { return _className; } private final void setLang(final String lang[]){ } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/MultiDOM.java0000644000175000017500000005157710721374033023432 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: MultiDOM.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.StripFilter; import org.apache.xml.serializer.SerializationHandler; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; import org.apache.xml.dtm.ref.DTMDefaultBase; import org.apache.xml.utils.SuballocatedIntVector; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * @author Jacek Ambroziak * @author Morten Jorgensen * @author Erwin Bolwidt */ public final class MultiDOM implements DOM { private static final int NO_TYPE = DOM.FIRST_TYPE - 2; private static final int INITIAL_SIZE = 4; private DOM[] _adapters; private DOMAdapter _main; private DTMManager _dtmManager; private int _free; private int _size; private Hashtable _documents = new Hashtable(); private final class AxisIterator extends DTMAxisIteratorBase { // constitutive data private final int _axis; private final int _type; // implementation mechanism private DTMAxisIterator _source; private int _dtmId = -1; public AxisIterator(final int axis, final int type) { _axis = axis; _type = type; } public int next() { if (_source == null) { return(END); } return _source.next(); } public void setRestartable(boolean flag) { if (_source != null) { _source.setRestartable(flag); } } public DTMAxisIterator setStartNode(final int node) { if (node == DTM.NULL) { return this; } int dom = node >>> DTMManager.IDENT_DTM_NODE_BITS; // Get a new source first time and when mask changes if (_source == null || _dtmId != dom) { if (_type == NO_TYPE) { _source = _adapters[dom].getAxisIterator(_axis); } else if (_axis == Axis.CHILD) { _source = _adapters[dom].getTypedChildren(_type); } else { _source = _adapters[dom].getTypedAxisIterator(_axis, _type); } } _dtmId = dom; _source.setStartNode(node); return this; } public DTMAxisIterator reset() { if (_source != null) { _source.reset(); } return this; } public int getLast() { if (_source != null) { return _source.getLast(); } else { return END; } } public int getPosition() { if (_source != null) { return _source.getPosition(); } else { return END; } } public boolean isReverse() { return Axis.isReverse(_axis); } public void setMark() { if (_source != null) { _source.setMark(); } } public void gotoMark() { if (_source != null) { _source.gotoMark(); } } public DTMAxisIterator cloneIterator() { final AxisIterator clone = new AxisIterator(_axis, _type); if (_source != null) { clone._source = _source.cloneIterator(); } clone._dtmId = _dtmId; return clone; } } // end of AxisIterator /************************************************************** * This is a specialised iterator for predicates comparing node or * attribute values to variable or parameter values. */ private final class NodeValueIterator extends DTMAxisIteratorBase { private DTMAxisIterator _source; private String _value; private boolean _op; private final boolean _isReverse; private int _returnType = RETURN_PARENT; public NodeValueIterator(DTMAxisIterator source, int returnType, String value, boolean op) { _source = source; _returnType = returnType; _value = value; _op = op; _isReverse = source.isReverse(); } public boolean isReverse() { return _isReverse; } public DTMAxisIterator cloneIterator() { try { NodeValueIterator clone = (NodeValueIterator)super.clone(); clone._source = _source.cloneIterator(); clone.setRestartable(false); return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public DTMAxisIterator reset() { _source.reset(); return resetPosition(); } public int next() { int node; while ((node = _source.next()) != END) { String val = getStringValueX(node); if (_value.equals(val) == _op) { if (_returnType == RETURN_CURRENT) return returnNode(node); else return returnNode(getParent(node)); } } return END; } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _source.setStartNode(_startNode = node); return resetPosition(); } return this; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } public MultiDOM(DOM main) { _size = INITIAL_SIZE; _free = 1; _adapters = new DOM[INITIAL_SIZE]; DOMAdapter adapter = (DOMAdapter)main; _adapters[0] = adapter; _main = adapter; DOM dom = adapter.getDOMImpl(); if (dom instanceof DTMDefaultBase) { _dtmManager = ((DTMDefaultBase)dom).getManager(); } // %HZ% %REVISIT% Is this the right thing to do here? In the old // %HZ% %REVISIT% version, the main document did not get added through // %HZ% %REVISIT% a call to addDOMAdapter, which meant it couldn't be // %HZ% %REVISIT% found by a call to getDocumentMask. The problem is // %HZ% %REVISIT% TransformerHandler is typically constructed with a // %HZ% %REVISIT% system ID equal to the stylesheet's URI; with SAX // %HZ% %REVISIT% input, it ends up giving that URI to the document. // %HZ% %REVISIT% Then, any references to document('') are resolved // %HZ% %REVISIT% using the stylesheet's URI. // %HZ% %REVISIT% MultiDOM.getDocumentMask is called to verify that // %HZ% %REVISIT% a document associated with that URI has not been // %HZ% %REVISIT% encountered, and that method ends up returning the // %HZ% %REVISIT% mask of the main document, when what we really what // %HZ% %REVISIT% is to read the stylesheet itself! addDOMAdapter(adapter, false); } public int nextMask() { return _free; } public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces) { // This method only has a function in DOM adapters } public int addDOMAdapter(DOMAdapter adapter) { return addDOMAdapter(adapter, true); } private int addDOMAdapter(DOMAdapter adapter, boolean indexByURI) { // Add the DOM adapter to the array of DOMs DOM dom = adapter.getDOMImpl(); int domNo = 1; int dtmSize = 1; SuballocatedIntVector dtmIds = null; if (dom instanceof DTMDefaultBase) { DTMDefaultBase dtmdb = (DTMDefaultBase)dom; dtmIds = dtmdb.getDTMIDs(); dtmSize = dtmIds.size(); domNo = dtmIds.elementAt(dtmSize-1) >>> DTMManager.IDENT_DTM_NODE_BITS; } else if (dom instanceof SimpleResultTreeImpl) { SimpleResultTreeImpl simpleRTF = (SimpleResultTreeImpl)dom; domNo = simpleRTF.getDocument() >>> DTMManager.IDENT_DTM_NODE_BITS; } if (domNo >= _size) { int oldSize = _size; do { _size *= 2; } while (_size <= domNo); final DOMAdapter[] newArray = new DOMAdapter[_size]; System.arraycopy(_adapters, 0, newArray, 0, oldSize); _adapters = newArray; } _free = domNo + 1; if (dtmSize == 1) { _adapters[domNo] = adapter; } else if (dtmIds != null) { int domPos = 0; for (int i = dtmSize - 1; i >= 0; i--) { domPos = dtmIds.elementAt(i) >>> DTMManager.IDENT_DTM_NODE_BITS; _adapters[domPos] = adapter; } domNo = domPos; } // Store reference to document (URI) in hashtable if (indexByURI) { String uri = adapter.getDocumentURI(0); _documents.put(uri, new Integer(domNo)); } // If the dom is an AdaptiveResultTreeImpl, we need to create a // DOMAdapter around its nested dom object (if it is non-null) and // add the DOMAdapter to the list. if (dom instanceof AdaptiveResultTreeImpl) { AdaptiveResultTreeImpl adaptiveRTF = (AdaptiveResultTreeImpl)dom; DOM nestedDom = adaptiveRTF.getNestedDOM(); if (nestedDom != null) { DOMAdapter newAdapter = new DOMAdapter(nestedDom, adapter.getNamesArray(), adapter.getUrisArray(), adapter.getTypesArray(), adapter.getNamespaceArray()); addDOMAdapter(newAdapter); } } return domNo; } public int getDocumentMask(String uri) { Integer domIdx = (Integer)_documents.get(uri); if (domIdx == null) { return(-1); } else { return domIdx.intValue(); } } public DOM getDOMAdapter(String uri) { Integer domIdx = (Integer)_documents.get(uri); if (domIdx == null) { return(null); } else { return(_adapters[domIdx.intValue()]); } } public int getDocument() { return _main.getDocument(); } public DTMManager getDTMManager() { return _dtmManager; } /** * Returns singleton iterator containing the document root */ public DTMAxisIterator getIterator() { // main source document @ 0 return _main.getIterator(); } public String getStringValue() { return _main.getStringValue(); } public DTMAxisIterator getChildren(final int node) { return _adapters[getDTMId(node)].getChildren(node); } public DTMAxisIterator getTypedChildren(final int type) { return new AxisIterator(Axis.CHILD, type); } public DTMAxisIterator getAxisIterator(final int axis) { return new AxisIterator(axis, NO_TYPE); } public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) { return new AxisIterator(axis, type); } public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself) { return _adapters[getDTMId(node)].getNthDescendant(node, n, includeself); } public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iterator, int type, String value, boolean op) { return(new NodeValueIterator(iterator, type, value, op)); } public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns) { DTMAxisIterator iterator = _main.getNamespaceAxisIterator(axis, ns); return(iterator); } public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) { return _adapters[getDTMId(node)].orderNodes(source, node); } public int getExpandedTypeID(final int node) { if (node != DTM.NULL) { return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getExpandedTypeID(node); } else { return DTM.NULL; } } public int getNamespaceType(final int node) { return _adapters[getDTMId(node)].getNamespaceType(node); } public int getNSType(int node) { return _adapters[getDTMId(node)].getNSType(node); } public int getParent(final int node) { if (node == DTM.NULL) { return DTM.NULL; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getParent(node); } public int getAttributeNode(final int type, final int el) { if (el == DTM.NULL) { return DTM.NULL; } return _adapters[el >>> DTMManager.IDENT_DTM_NODE_BITS].getAttributeNode(type, el); } public String getNodeName(final int node) { if (node == DTM.NULL) { return ""; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getNodeName(node); } public String getNodeNameX(final int node) { if (node == DTM.NULL) { return ""; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getNodeNameX(node); } public String getNamespaceName(final int node) { if (node == DTM.NULL) { return ""; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getNamespaceName(node); } public String getStringValueX(final int node) { if (node == DTM.NULL) { return ""; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getStringValueX(node); } public void copy(final int node, SerializationHandler handler) throws TransletException { if (node != DTM.NULL) { _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler); } } public void copy(DTMAxisIterator nodes, SerializationHandler handler) throws TransletException { int node; while ((node = nodes.next()) != DTM.NULL) { _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler); } } public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { if (node == DTM.NULL) { return ""; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler); } public boolean lessThan(final int node1, final int node2) { if (node1 == DTM.NULL) { return true; } if (node2 == DTM.NULL) { return false; } final int dom1 = getDTMId(node1); final int dom2 = getDTMId(node2); return dom1 == dom2 ? _adapters[dom1].lessThan(node1, node2) : dom1 < dom2; } public void characters(final int textNode, SerializationHandler handler) throws TransletException { if (textNode != DTM.NULL) { _adapters[textNode >>> DTMManager.IDENT_DTM_NODE_BITS].characters(textNode, handler); } } public void setFilter(StripFilter filter) { for (int dom=0; dom<_free; dom++) { if (_adapters[dom] != null) { _adapters[dom].setFilter(filter); } } } public Node makeNode(int index) { if (index == DTM.NULL) { return null; } return _adapters[getDTMId(index)].makeNode(index); } public Node makeNode(DTMAxisIterator iter) { // TODO: gather nodes from all DOMs ? return _main.makeNode(iter); } public NodeList makeNodeList(int index) { if (index == DTM.NULL) { return null; } return _adapters[getDTMId(index)].makeNodeList(index); } public NodeList makeNodeList(DTMAxisIterator iter) { // TODO: gather nodes from all DOMs ? return _main.makeNodeList(iter); } public String getLanguage(int node) { return _adapters[getDTMId(node)].getLanguage(node); } public int getSize() { int size = 0; for (int i=0; i<_size; i++) { size += _adapters[i].getSize(); } return(size); } public String getDocumentURI(int node) { if (node == DTM.NULL) { node = DOM.NULL; } return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getDocumentURI(0); } public boolean isElement(final int node) { if (node == DTM.NULL) { return false; } return(_adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].isElement(node)); } public boolean isAttribute(final int node) { if (node == DTM.NULL) { return false; } return(_adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].isAttribute(node)); } public int getDTMId(int nodeHandle) { if (nodeHandle == DTM.NULL) return 0; int id = nodeHandle >>> DTMManager.IDENT_DTM_NODE_BITS; while (id >= 2 && _adapters[id] == _adapters[id-1]) { id--; } return id; } public int getNodeIdent(int nodeHandle) { return _adapters[nodeHandle >>> DTMManager.IDENT_DTM_NODE_BITS].getNodeIdent(nodeHandle); } public int getNodeHandle(int nodeId) { return _main.getNodeHandle(nodeId); } public DOM getResultTreeFrag(int initSize, int rtfType) { return _main.getResultTreeFrag(initSize, rtfType); } public DOM getResultTreeFrag(int initSize, int rtfType, boolean addToManager) { return _main.getResultTreeFrag(initSize, rtfType, addToManager); } public DOM getMain() { return _main; } /** * Returns a DOMBuilder class wrapped in a SAX adapter. */ public SerializationHandler getOutputDomBuilder() { return _main.getOutputDomBuilder(); } public String lookupNamespace(int node, String prefix) throws TransletException { return _main.lookupNamespace(node, prefix); } // %HZ% Does this method make any sense here??? public String getUnparsedEntityURI(String entity) { return _main.getUnparsedEntityURI(entity); } // %HZ% Does this method make any sense here??? public Hashtable getElementsWithIDs() { return _main.getElementsWithIDs(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SingleNodeCounter.java0000644000175000017500000001007110721374031025345 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SingleNodeCounter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.Axis; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class SingleNodeCounter extends NodeCounter { static private final int[] EmptyArray = new int[] { }; DTMAxisIterator _countSiblings = null; public SingleNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { super(translet, document, iterator); } public NodeCounter setStartNode(int node) { _node = node; _nodeType = _document.getExpandedTypeID(node); _countSiblings = _document.getAxisIterator(Axis.PRECEDINGSIBLING); return this; } public String getCounter() { int result; if (_value != Integer.MIN_VALUE) { //See Errata E24 if (_value == 0) return "0"; else if (Double.isNaN(_value)) return "NaN"; else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity"; else if (Double.isInfinite(_value)) return "Infinity"; else result = (int) _value; } else { int next = _node; result = 0; if (!matchesCount(next)) { while ((next = _document.getParent(next)) > END) { if (matchesCount(next)) { break; // found target } if (matchesFrom(next)) { next = END; break; // no target found } } } if (next != END) { _countSiblings.setStartNode(next); do { if (matchesCount(next)) result++; } while ((next = _countSiblings.next()) != END); } else { // If no target found then pass the empty list return formatNumbers(EmptyArray); } } return formatNumbers(result); } public static NodeCounter getDefaultNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { return new DefaultSingleNodeCounter(translet, document, iterator); } static class DefaultSingleNodeCounter extends SingleNodeCounter { public DefaultSingleNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { super(translet, document, iterator); } public NodeCounter setStartNode(int node) { _node = node; _nodeType = _document.getExpandedTypeID(node); _countSiblings = _document.getTypedAxisIterator(Axis.PRECEDINGSIBLING, _document.getExpandedTypeID(node)); return this; } public String getCounter() { int result; if (_value != Integer.MIN_VALUE) { //See Errata E24 if (_value == 0) return "0"; else if (Double.isNaN(_value)) return "NaN"; else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity"; else if (Double.isInfinite(_value)) return "Infinity"; else result = (int) _value; } else { int next; result = 1; _countSiblings.setStartNode(_node); while ((next = _countSiblings.next()) != END) { result++; } } return formatNumbers(result); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/DocumentCache.java0000644000175000017500000002431010721374032024462 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DocumentCache.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.io.File; import java.io.PrintWriter; import java.net.URL; import java.net.URLConnection; import java.net.URLDecoder; import java.util.Date; import java.util.Hashtable; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.TransformerException; import javax.xml.transform.sax.SAXSource; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMCache; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.Translet; import org.apache.xalan.xsltc.runtime.AbstractTranslet; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.runtime.Constants; import org.apache.xml.utils.SystemIDResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** * @author Morten Jorgensen */ public final class DocumentCache implements DOMCache { private int _size; private Hashtable _references; private String[] _URIs; private int _count; private int _current; private SAXParser _parser; private XMLReader _reader; private XSLTCDTMManager _dtmManager; private static final int REFRESH_INTERVAL = 1000; /* * Inner class containing a DOMImpl object and DTD handler */ public final class CachedDocument { // Statistics data private long _firstReferenced; private long _lastReferenced; private long _accessCount; private long _lastModified; private long _lastChecked; private long _buildTime; // DOM and DTD handler references private DOMEnhancedForDTM _dom = null; /** * Constructor - load document and initialise statistics */ public CachedDocument(String uri) { // Initialise statistics variables final long stamp = System.currentTimeMillis(); _firstReferenced = stamp; _lastReferenced = stamp; _accessCount = 0; loadDocument(uri); _buildTime = System.currentTimeMillis() - stamp; } /** * Loads the document and updates build-time (latency) statistics */ public void loadDocument(String uri) { try { final long stamp = System.currentTimeMillis(); _dom = (DOMEnhancedForDTM)_dtmManager.getDTM( new SAXSource(_reader, new InputSource(uri)), false, null, true, false); _dom.setDocumentURI(uri); // The build time can be used for statistics for a better // priority algorithm (currently round robin). final long thisTime = System.currentTimeMillis() - stamp; if (_buildTime > 0) _buildTime = (_buildTime + thisTime) >>> 1; else _buildTime = thisTime; } catch (Exception e) { _dom = null; } } public DOM getDocument() { return(_dom); } public long getFirstReferenced() { return(_firstReferenced); } public long getLastReferenced() { return(_lastReferenced); } public long getAccessCount() { return(_accessCount); } public void incAccessCount() { _accessCount++; } public long getLastModified() { return(_lastModified); } public void setLastModified(long t){ _lastModified = t; } public long getLatency() { return(_buildTime); } public long getLastChecked() { return(_lastChecked); } public void setLastChecked(long t) { _lastChecked = t; } public long getEstimatedSize() { if (_dom != null) return(_dom.getSize() << 5); // ??? else return(0); } } /** * DocumentCache constructor */ public DocumentCache(int size) throws SAXException { this(size, null); try { _dtmManager = (XSLTCDTMManager)XSLTCDTMManager.getDTMManagerClass() .newInstance(); } catch (Exception e) { throw new SAXException(e); } } /** * DocumentCache constructor */ public DocumentCache(int size, XSLTCDTMManager dtmManager) throws SAXException { _dtmManager = dtmManager; _count = 0; _current = 0; _size = size; _references = new Hashtable(_size+2); _URIs = new String[_size]; try { // Create a SAX parser and get the XMLReader object it uses final SAXParserFactory factory = SAXParserFactory.newInstance(); try { factory.setFeature(Constants.NAMESPACE_FEATURE,true); } catch (Exception e) { factory.setNamespaceAware(true); } _parser = factory.newSAXParser(); _reader = _parser.getXMLReader(); } catch (ParserConfigurationException e) { BasisLibrary.runTimeError(BasisLibrary.NAMESPACES_SUPPORT_ERR); } } /** * Returns the time-stamp for a document's last update */ private final long getLastModified(String uri) { try { URL url = new URL(uri); URLConnection connection = url.openConnection(); long timestamp = connection.getLastModified(); // Check for a "file:" URI (courtesy of Brian Ewins) if (timestamp == 0){ // get 0 for local URI if ("file".equals(url.getProtocol())){ File localfile = new File(URLDecoder.decode(url.getFile())); timestamp = localfile.lastModified(); } } return(timestamp); } // Brutal handling of all exceptions catch (Exception e) { return(System.currentTimeMillis()); } } /** * */ private CachedDocument lookupDocument(String uri) { return((CachedDocument)_references.get(uri)); } /** * */ private synchronized void insertDocument(String uri, CachedDocument doc) { if (_count < _size) { // Insert out URI in circular buffer _URIs[_count++] = uri; _current = 0; } else { // Remove oldest URI from reference Hashtable _references.remove(_URIs[_current]); // Insert our URI in circular buffer _URIs[_current] = uri; if (++_current >= _size) _current = 0; } _references.put(uri, doc); } /** * */ private synchronized void replaceDocument(String uri, CachedDocument doc) { CachedDocument old = (CachedDocument)_references.get(uri); if (doc == null) insertDocument(uri, doc); else _references.put(uri, doc); } /** * Returns a document either by finding it in the cache or * downloading it and putting it in the cache. */ public DOM retrieveDocument(String baseURI, String href, Translet trs) { CachedDocument doc; String uri = href; if (baseURI != null && !baseURI.equals("")) { try { uri = SystemIDResolver.getAbsoluteURI(uri, baseURI); } catch (TransformerException te) { // ignore } } // Try to get the document from the cache first if ((doc = lookupDocument(uri)) == null) { doc = new CachedDocument(uri); if (doc == null) return null; // better error handling needed!!! doc.setLastModified(getLastModified(uri)); insertDocument(uri, doc); } // If the document is in the cache we must check if it is still valid else { long now = System.currentTimeMillis(); long chk = doc.getLastChecked(); doc.setLastChecked(now); // Has the modification time for this file been checked lately? if (now > (chk + REFRESH_INTERVAL)) { doc.setLastChecked(now); long last = getLastModified(uri); // Reload document if it has been modified since last download if (last > doc.getLastModified()) { doc = new CachedDocument(uri); if (doc == null) return null; doc.setLastModified(getLastModified(uri)); replaceDocument(uri, doc); } } } // Get the references to the actual DOM and DTD handler final DOM dom = doc.getDocument(); // The dom reference may be null if the URL pointed to a // non-existing document if (dom == null) return null; doc.incAccessCount(); // For statistics final AbstractTranslet translet = (AbstractTranslet)trs; // Give the translet an early opportunity to extract any // information from the DOM object that it would like. translet.prepassDocument(dom); return(doc.getDocument()); } /** * Outputs the cache statistics */ public void getStatistics(PrintWriter out) { out.println("

        DOM cache statistics

        "+ ""+ ""+ ""+ ""+ ""); for (int i=0; i<_count; i++) { CachedDocument doc = (CachedDocument)_references.get(_URIs[i]); out.print(""); out.print(""); out.print(""); out.print(""); out.print(""); out.println(""); } out.println("
        Document URI
        Build time
        Access count
        Last accessed
        Last modified
        "+ ""+_URIs[i]+"
        "+doc.getLatency()+"ms
        "+doc.getAccessCount()+"
        "+(new Date(doc.getLastReferenced()))+ "
        "+(new Date(doc.getLastModified()))+ "
        "); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SimpleResultTreeImpl.java0000644000175000017500000007024110721374032026056 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SimpleResultTreeImpl.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; import org.apache.xml.dtm.ref.DTMManagerDefault; import org.apache.xml.serializer.EmptySerializer; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.utils.XMLString; import org.apache.xml.utils.XMLStringDefault; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.xml.transform.SourceLocator; /** * This class represents a light-weight DOM model for simple result tree fragment(RTF). * A simple RTF is an RTF that has only one Text node. The Text node can be produced by a * combination of Text, xsl:value-of and xsl:number instructions. It can also be produced * by a control structure (xsl:if or xsl:choose) whose body is pure Text. *

        * A SimpleResultTreeImpl has only two nodes, i.e. the ROOT node and its Text child. All DOM * interfaces are overridden with this in mind. For example, the getStringValue() interface * returns the value of the Text node. This class receives the character data from the * characters() interface. *

        * This class implements DOM and SerializationHandler. It also implements the DTM interface * for support in MultiDOM. The nested iterators (SimpleIterator and SingletonIterator) are * used to support the nodeset() extension function. */ public class SimpleResultTreeImpl extends EmptySerializer implements DOM, DTM { /** * The SimpleIterator is designed to support the nodeset() extension function. It has * a traversal direction parameter. The DOWN direction is used for child and descendant * axes, while the UP direction is used for parent and ancestor axes. * * This iterator only handles two nodes (RTF_ROOT and RTF_TEXT). If the type is set, * it will also match the node type with the given type. */ public final class SimpleIterator extends DTMAxisIteratorBase { static final int DIRECTION_UP = 0; static final int DIRECTION_DOWN = 1; static final int NO_TYPE = -1; // The direction of traversal (default to DOWN). // DOWN is for child and descendant. UP is for parent and ancestor. int _direction = DIRECTION_DOWN; int _type = NO_TYPE; int _currentNode; public SimpleIterator() { } public SimpleIterator(int direction) { _direction = direction; } public SimpleIterator(int direction, int type) { _direction = direction; _type = type; } public int next() { // Increase the node ID for down traversal. Also match the node type // if the type is given. if (_direction == DIRECTION_DOWN) { while (_currentNode < NUMBER_OF_NODES) { if (_type != NO_TYPE) { if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE) || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE)) return returnNode(getNodeHandle(_currentNode++)); else _currentNode++; } else return returnNode(getNodeHandle(_currentNode++)); } return END; } // Decrease the node ID for up traversal. else { while (_currentNode >= 0) { if (_type != NO_TYPE) { if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE) || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE)) return returnNode(getNodeHandle(_currentNode--)); else _currentNode--; } else return returnNode(getNodeHandle(_currentNode--)); } return END; } } public DTMAxisIterator setStartNode(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); _startNode = nodeID; // Increase the node ID by 1 if self is not included. if (!_includeSelf && nodeID != DTM.NULL) { if (_direction == DIRECTION_DOWN) nodeID++; else if (_direction == DIRECTION_UP) nodeID--; } _currentNode = nodeID; return this; } public void setMark() { _markedNode = _currentNode; } public void gotoMark() { _currentNode = _markedNode; } } // END of SimpleIterator /** * The SingletonIterator is used for the self axis. */ public final class SingletonIterator extends DTMAxisIteratorBase { static final int NO_TYPE = -1; int _type = NO_TYPE; int _currentNode; public SingletonIterator() { } public SingletonIterator(int type) { _type = type; } public void setMark() { _markedNode = _currentNode; } public void gotoMark() { _currentNode = _markedNode; } public DTMAxisIterator setStartNode(int nodeHandle) { _currentNode = _startNode = getNodeIdent(nodeHandle); return this; } public int next() { if (_currentNode == END) return END; _currentNode = END; if (_type != NO_TYPE) { if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE) || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE)) return getNodeHandle(_currentNode); } else return getNodeHandle(_currentNode); return END; } } // END of SingletonIterator // empty iterator to be returned when there are no children private final static DTMAxisIterator EMPTY_ITERATOR = new DTMAxisIteratorBase() { public DTMAxisIterator reset() { return this; } public DTMAxisIterator setStartNode(int node) { return this; } public int next() { return DTM.NULL; } public void setMark() {} public void gotoMark() {} public int getLast() { return 0; } public int getPosition() { return 0; } public DTMAxisIterator cloneIterator() { return this; } public void setRestartable(boolean isRestartable) { } }; // The root node id of the simple RTF public static final int RTF_ROOT = 0; // The Text node id of the simple RTF (simple RTF has only one Text node). public static final int RTF_TEXT = 1; // The number of nodes. public static final int NUMBER_OF_NODES = 2; // Document URI index, which increases by 1 at each getDocumentURI() call. private static int _documentURIIndex = 0; // Constant for empty String private static final String EMPTY_STR = ""; // The String value of the Text node. // This is set at the endDocument() call. private String _text; // The array of Text items, which is built by the characters() call. // The characters() interface can be called multiple times. Each character item // can have different escape settings. protected String[] _textArray; // The DTMManager protected XSLTCDTMManager _dtmManager; // Number of character items protected int _size = 0; // The document ID private int _documentID; // A BitArray, each bit holding the escape setting for a character item. private BitArray _dontEscape = null; // The current escape setting private boolean _escaping = true; // Create a SimpleResultTreeImpl from a DTMManager and a document ID. public SimpleResultTreeImpl(XSLTCDTMManager dtmManager, int documentID) { _dtmManager = dtmManager; _documentID = documentID; _textArray = new String[4]; } public DTMManagerDefault getDTMManager() { return _dtmManager; } // Return the document ID public int getDocument() { return _documentID; } // Return the String value of the RTF public String getStringValue() { return _text; } public DTMAxisIterator getIterator() { return new SingletonIterator(getDocument()); } public DTMAxisIterator getChildren(final int node) { return new SimpleIterator().setStartNode(node); } public DTMAxisIterator getTypedChildren(final int type) { return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type); } // Return the axis iterator for a given axis. // The SimpleIterator is used for the child, descendant, parent and ancestor axes. public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.CHILD: case Axis.DESCENDANT: return new SimpleIterator(SimpleIterator.DIRECTION_DOWN); case Axis.PARENT: case Axis.ANCESTOR: return new SimpleIterator(SimpleIterator.DIRECTION_UP); case Axis.ANCESTORORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf(); case Axis.DESCENDANTORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf(); case Axis.SELF: return new SingletonIterator(); default: return EMPTY_ITERATOR; } } public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) { switch (axis) { case Axis.CHILD: case Axis.DESCENDANT: return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type); case Axis.PARENT: case Axis.ANCESTOR: return new SimpleIterator(SimpleIterator.DIRECTION_UP, type); case Axis.ANCESTORORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_UP, type)).includeSelf(); case Axis.DESCENDANTORSELF: return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type)).includeSelf(); case Axis.SELF: return new SingletonIterator(type); default: return EMPTY_ITERATOR; } } // %REVISIT% Can this one ever get used? public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself) { return null; } public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns) { return null; } // %REVISIT% Can this one ever get used? public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType, String value, boolean op) { return null; } public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) { return source; } public String getNodeName(final int node) { if (getNodeIdent(node) == RTF_TEXT) return "#text"; else return EMPTY_STR; } public String getNodeNameX(final int node) { return EMPTY_STR; } public String getNamespaceName(final int node) { return EMPTY_STR; } // Return the expanded type id of a given node public int getExpandedTypeID(final int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_TEXT) return DTM.TEXT_NODE; else if (nodeID == RTF_ROOT) return DTM.ROOT_NODE; else return DTM.NULL; } public int getNamespaceType(final int node) { return 0; } public int getParent(final int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); return (nodeID == RTF_TEXT) ? getNodeHandle(RTF_ROOT) : DTM.NULL; } public int getAttributeNode(final int gType, final int element) { return DTM.NULL; } public String getStringValueX(final int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) return _text; else return EMPTY_STR; } public void copy(final int node, SerializationHandler handler) throws TransletException { characters(node, handler); } public void copy(DTMAxisIterator nodes, SerializationHandler handler) throws TransletException { int node; while ((node = nodes.next()) != DTM.NULL) { copy(node, handler); } } public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { characters(node, handler); return null; } public boolean lessThan(final int node1, final int node2) { if (node1 == DTM.NULL) { return false; } else if (node2 == DTM.NULL) { return true; } else return (node1 < node2); } /** * Dispatch the character content of a node to an output handler. * * The escape setting should be taken care of when outputting to * a handler. */ public void characters(final int node, SerializationHandler handler) throws TransletException { int nodeID = getNodeIdent(node); if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) { boolean escapeBit = false; boolean oldEscapeSetting = false; try { for (int i = 0; i < _size; i++) { if (_dontEscape != null) { escapeBit = _dontEscape.getBit(i); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } handler.characters(_textArray[i]); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } } } catch (SAXException e) { throw new TransletException(e); } } } // %REVISIT% Can the makeNode() and makeNodeList() interfaces ever get used? public Node makeNode(int index) { return null; } public Node makeNode(DTMAxisIterator iter) { return null; } public NodeList makeNodeList(int index) { return null; } public NodeList makeNodeList(DTMAxisIterator iter) { return null; } public String getLanguage(int node) { return null; } public int getSize() { return 2; } public String getDocumentURI(int node) { return "simple_rtf" + _documentURIIndex++; } public void setFilter(StripFilter filter) { } public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces) { } public boolean isElement(final int node) { return false; } public boolean isAttribute(final int node) { return false; } public String lookupNamespace(int node, String prefix) throws TransletException { return null; } /** * Return the node identity from a node handle. */ public int getNodeIdent(final int nodehandle) { return (nodehandle != DTM.NULL) ? (nodehandle - _documentID) : DTM.NULL; } /** * Return the node handle from a node identity. */ public int getNodeHandle(final int nodeId) { return (nodeId != DTM.NULL) ? (nodeId + _documentID) : DTM.NULL; } public DOM getResultTreeFrag(int initialSize, int rtfType) { return null; } public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToManager) { return null; } public SerializationHandler getOutputDomBuilder() { return this; } public int getNSType(int node) { return 0; } public String getUnparsedEntityURI(String name) { return null; } public Hashtable getElementsWithIDs() { return null; } /** Implementation of the SerializationHandler interfaces **/ /** * We only need to override the endDocument, characters, and * setEscaping interfaces. A simple RTF does not have element * nodes. We do not need to touch startElement and endElement. */ public void startDocument() throws SAXException { } public void endDocument() throws SAXException { // Set the String value when the document is built. if (_size == 1) _text = _textArray[0]; else { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < _size; i++) { buffer.append(_textArray[i]); } _text = buffer.toString(); } } public void characters(String str) throws SAXException { // Resize the text array if necessary if (_size >= _textArray.length) { String[] newTextArray = new String[_textArray.length * 2]; System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length); _textArray = newTextArray; } // If the escape setting is false, set the corresponding bit in // the _dontEscape BitArray. if (!_escaping) { // The _dontEscape array is only created when needed. if (_dontEscape == null) { _dontEscape = new BitArray(8); } // Resize the _dontEscape array if necessary if (_size >= _dontEscape.size()) _dontEscape.resize(_dontEscape.size() * 2); _dontEscape.setBit(_size); } _textArray[_size++] = str; } public void characters(char[] ch, int offset, int length) throws SAXException { if (_size >= _textArray.length) { String[] newTextArray = new String[_textArray.length * 2]; System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length); _textArray = newTextArray; } if (!_escaping) { if (_dontEscape == null) { _dontEscape = new BitArray(8); } if (_size >= _dontEscape.size()) _dontEscape.resize(_dontEscape.size() * 2); _dontEscape.setBit(_size); } _textArray[_size++] = new String(ch, offset, length); } public boolean setEscaping(boolean escape) throws SAXException { final boolean temp = _escaping; _escaping = escape; return temp; } /** Implementation of the DTM interfaces **/ /** * The DTM interfaces are not used in this class. Implementing the DTM * interface is a requirement from MultiDOM. If we have a better way * of handling multiple documents, we can get rid of the DTM dependency. * * The following interfaces are just placeholders. The implementation * does not have an impact because they will not be used. */ public void setFeature(String featureId, boolean state) { } public void setProperty(String property, Object value) { } public DTMAxisTraverser getAxisTraverser(final int axis) { return null; } public boolean hasChildNodes(int nodeHandle) { return (getNodeIdent(nodeHandle) == RTF_ROOT); } public int getFirstChild(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_ROOT) return getNodeHandle(RTF_TEXT); else return DTM.NULL; } public int getLastChild(int nodeHandle) { return getFirstChild(nodeHandle); } public int getAttributeNode(int elementHandle, String namespaceURI, String name) { return DTM.NULL; } public int getFirstAttribute(int nodeHandle) { return DTM.NULL; } public int getFirstNamespaceNode(int nodeHandle, boolean inScope) { return DTM.NULL; } public int getNextSibling(int nodeHandle) { return DTM.NULL; } public int getPreviousSibling(int nodeHandle) { return DTM.NULL; } public int getNextAttribute(int nodeHandle) { return DTM.NULL; } public int getNextNamespaceNode(int baseHandle, int namespaceHandle, boolean inScope) { return DTM.NULL; } public int getOwnerDocument(int nodeHandle) { return getDocument(); } public int getDocumentRoot(int nodeHandle) { return getDocument(); } public XMLString getStringValue(int nodeHandle) { return new XMLStringDefault(getStringValueX(nodeHandle)); } public int getStringValueChunkCount(int nodeHandle) { return 0; } public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen) { return null; } public int getExpandedTypeID(String namespace, String localName, int type) { return DTM.NULL; } public String getLocalNameFromExpandedNameID(int ExpandedNameID) { return EMPTY_STR; } public String getNamespaceFromExpandedNameID(int ExpandedNameID) { return EMPTY_STR; } public String getLocalName(int nodeHandle) { return EMPTY_STR; } public String getPrefix(int nodeHandle) { return null; } public String getNamespaceURI(int nodeHandle) { return EMPTY_STR; } public String getNodeValue(int nodeHandle) { return (getNodeIdent(nodeHandle) == RTF_TEXT) ? _text : null; } public short getNodeType(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_TEXT) return DTM.TEXT_NODE; else if (nodeID == RTF_ROOT) return DTM.ROOT_NODE; else return DTM.NULL; } public short getLevel(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_TEXT) return 2; else if (nodeID == RTF_ROOT) return 1; else return DTM.NULL; } public boolean isSupported(String feature, String version) { return false; } public String getDocumentBaseURI() { return EMPTY_STR; } public void setDocumentBaseURI(String baseURI) { } public String getDocumentSystemIdentifier(int nodeHandle) { return null; } public String getDocumentEncoding(int nodeHandle) { return null; } public String getDocumentStandalone(int nodeHandle) { return null; } public String getDocumentVersion(int documentHandle) { return null; } public boolean getDocumentAllDeclarationsProcessed() { return false; } public String getDocumentTypeDeclarationSystemIdentifier() { return null; } public String getDocumentTypeDeclarationPublicIdentifier() { return null; } public int getElementById(String elementId) { return DTM.NULL; } public boolean supportsPreStripping() { return false; } public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle) { return lessThan(firstNodeHandle, secondNodeHandle); } public boolean isCharacterElementContentWhitespace(int nodeHandle) { return false; } public boolean isDocumentAllDeclarationsProcessed(int documentHandle) { return false; } public boolean isAttributeSpecified(int attributeHandle) { return false; } public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException { } public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { } public org.w3c.dom.Node getNode(int nodeHandle) { return makeNode(nodeHandle); } public boolean needsTwoThreads() { return false; } public org.xml.sax.ContentHandler getContentHandler() { return null; } public org.xml.sax.ext.LexicalHandler getLexicalHandler() { return null; } public org.xml.sax.EntityResolver getEntityResolver() { return null; } public org.xml.sax.DTDHandler getDTDHandler() { return null; } public org.xml.sax.ErrorHandler getErrorHandler() { return null; } public org.xml.sax.ext.DeclHandler getDeclHandler() { return null; } public void appendChild(int newChild, boolean clone, boolean cloneDepth) { } public void appendTextChild(String str) { } public SourceLocator getSourceLocatorFor(int node) { return null; } public void documentRegistration() { } public void documentRelease() { } public void migrateTo(DTMManager manager) { } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/KeyIndex.java0000644000175000017500000007666010721374032023517 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: KeyIndex.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.util.StringTokenizer; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xalan.xsltc.util.IntegerArray; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * Stores mappings of key values or IDs to DTM nodes. * Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated. * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */ public class KeyIndex extends DTMAxisIteratorBase { /** * A mapping between values and nodesets for the current document. Used * only while building keys. */ private Hashtable _index; /** * The document node currently being processed. Used only while building * keys. */ private int _currentDocumentNode = DTM.NULL; /** * A mapping from a document node to the mapping between values and nodesets */ private Hashtable _rootToIndexMap = new Hashtable(); /** * The node set associated to the current value passed * to lookupKey(); */ private IntegerArray _nodes = null; /** * The XSLTC DOM object if this KeyIndex is being used to implement the * id() function. */ private DOM _dom; private DOMEnhancedForDTM _enhancedDOM; /** * Store position after call to setMark() */ private int _markedPosition = 0; public KeyIndex(int dummy) { } public void setRestartable(boolean flag) { } /** * Adds a node to the node list for a given value. Nodes will * always be added in document order. */ public void add(Object value, int node, int rootNode) { if (_currentDocumentNode != rootNode) { _currentDocumentNode = rootNode; _index = new Hashtable(); _rootToIndexMap.put(new Integer(rootNode), _index); } IntegerArray nodes = (IntegerArray) _index.get(value); if (nodes == null) { nodes = new IntegerArray(); _index.put(value, nodes); nodes.add(node); // Because nodes are added in document order, // duplicates can be eliminated easily at this stage. } else if (node != nodes.at(nodes.cardinality() - 1)) { nodes.add(node); } } /** * Merge the current value's nodeset set by lookupKey() with _nodes. * @deprecated */ public void merge(KeyIndex other) { if (other == null) return; if (other._nodes != null) { if (_nodes == null) { _nodes = (IntegerArray)other._nodes.clone(); } else { _nodes.merge(other._nodes); } } } /** * This method must be called by the code generated by the id() function * prior to returning the node iterator. The lookup code for key() and * id() differ in the way the lookup value can be whitespace separated * list of tokens for the id() function, but a single string for the * key() function. * @deprecated */ public void lookupId(Object value) { // Clear _nodes array _nodes = null; final StringTokenizer values = new StringTokenizer((String) value, " \n\t"); while (values.hasMoreElements()) { final String token = (String) values.nextElement(); IntegerArray nodes = (IntegerArray) _index.get(token); if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) { nodes = getDOMNodeById(token); } if (nodes == null) continue; if (_nodes == null) { nodes = (IntegerArray)nodes.clone(); _nodes = nodes; } else { _nodes.merge(nodes); } } } /** * Return an IntegerArray for the DOM Node which has the given id. * * @param id The id * @return A IntegerArray representing the Node whose id is the given value. */ public IntegerArray getDOMNodeById(String id) { IntegerArray nodes = null; if (_enhancedDOM != null) { int ident = _enhancedDOM.getElementById(id); if (ident != DTM.NULL) { Integer root = new Integer(_enhancedDOM.getDocument()); Hashtable index = (Hashtable) _rootToIndexMap.get(root); if (index == null) { index = new Hashtable(); _rootToIndexMap.put(root, index); } else { nodes = (IntegerArray) index.get(id); } if (nodes == null) { nodes = new IntegerArray(); index.put(id, nodes); } nodes.add(_enhancedDOM.getNodeHandle(ident)); } } return nodes; } /** *

        This method must be called by the code generated by the key() function * prior to returning the node iterator.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public void lookupKey(Object value) { IntegerArray nodes = (IntegerArray) _index.get(value); _nodes = (nodes != null) ? (IntegerArray) nodes.clone() : null; _position = 0; } /** *

        Callers should not call next() after it returns END.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public int next() { if (_nodes == null) return DTMAxisIterator.END; return (_position < _nodes.cardinality()) ? _dom.getNodeHandle(_nodes.at(_position++)) : DTMAxisIterator.END; } /** * Given a context node and the argument to the XPath id * function, checks whether the context node is in the set of nodes that * results from that reference to the id function. This is * used in the implementation of id patterns. * * @param node The context node * @param value The argument to the id function * @return 1 if the context node is in the set of nodes * returned by the reference to the id function; * 0, otherwise */ public int containsID(int node, Object value) { final String string = (String)value; int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Hashtable index = (Hashtable) _rootToIndexMap.get(new Integer(rootHandle)); // Split argument to id function into XML whitespace separated tokens final StringTokenizer values = new StringTokenizer(string, " \n\t"); while (values.hasMoreElements()) { final String token = (String) values.nextElement(); IntegerArray nodes = null; if (index != null) { nodes = (IntegerArray) index.get(token); } // If input was from W3C DOM, use DOM's getElementById to do // the look-up. if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) { nodes = getDOMNodeById(token); } // Did we find the context node in the set of nodes? if (nodes != null && nodes.indexOf(node) >= 0) { return 1; } } // Didn't find the context node in the set of nodes returned by id return 0; } /** *

        Given a context node and the second argument to the XSLT * key function, checks whether the context node is in the * set of nodes that results from that reference to the key * function. This is used in the implementation of key patterns.

        *

        This particular {@link KeyIndex} object is the result evaluating the * first argument to the key function, so it's not taken into * any further account.

        * * @param node The context node * @param value The second argument to the key function * @return 1 if and only if the context node is in the set of * nodes returned by the reference to the key function; * 0, otherwise */ public int containsKey(int node, Object value) { int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(node).next(); // Get the mapping table for the document containing the context node Hashtable index = (Hashtable) _rootToIndexMap.get(new Integer(rootHandle)); // Check whether the context node is present in the set of nodes // returned by the key function if (index != null) { final IntegerArray nodes = (IntegerArray) index.get(value); return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0; } // The particular key name identifies no nodes in this document return 0; } /** *

        Resets the iterator to the last start node.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public DTMAxisIterator reset() { _position = 0; return this; } /** *

        Returns the number of elements in this iterator.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public int getLast() { return (_nodes == null) ? 0 : _nodes.cardinality(); } /** *

        Returns the position of the current node in the set.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public int getPosition() { return _position; } /** *

        Remembers the current node for the next call to gotoMark().

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public void setMark() { _markedPosition = _position; } /** *

        Restores the current node remembered by setMark().

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public void gotoMark() { _position = _markedPosition; } /** *

        Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public DTMAxisIterator setStartNode(int start) { if (start == DTMAxisIterator.END) { _nodes = null; } else if (_nodes != null) { _position = 0; } return (DTMAxisIterator) this; } /** *

        Get start to END should 'close' the iterator, * i.e. subsequent call to next() should return END.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public int getStartNode() { return 0; } /** *

        True if this iterator has a reversed axis.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public boolean isReverse() { return(false); } /** *

        Returns a deep copy of this iterator.

        *

        Use of an instance of this class as a {@link DTMAxisIterator} is * deprecated.

        * @deprecated */ public DTMAxisIterator cloneIterator() { KeyIndex other = new KeyIndex(0); other._index = _index; other._rootToIndexMap = _rootToIndexMap; other._nodes = _nodes; other._position = _position; return (DTMAxisIterator) other; } public void setDom(DOM dom) { _dom = dom; if (dom instanceof DOMEnhancedForDTM) { _enhancedDOM = (DOMEnhancedForDTM)dom; } else if (dom instanceof DOMAdapter) { DOM idom = ((DOMAdapter)dom).getDOMImpl(); if (idom instanceof DOMEnhancedForDTM) { _enhancedDOM = (DOMEnhancedForDTM)idom; } } } /** * Create a {@link KeyIndexIterator} that iterates over the nodes that * result from a reference to the XSLT key function or * XPath id function. * * @param keyValue A string or iterator representing the key values or id * references * @param isKeyCall A boolean indicating whether the iterator * is being created for a reference key or * id */ public KeyIndexIterator getKeyIndexIterator(Object keyValue, boolean isKeyCall) { if (keyValue instanceof DTMAxisIterator) { return getKeyIndexIterator((DTMAxisIterator) keyValue, isKeyCall); } else { return getKeyIndexIterator(BasisLibrary.stringF(keyValue, _dom), isKeyCall); } } /** * Create a {@link KeyIndexIterator} that iterates over the nodes that * result from a reference to the XSLT key function or * XPath id function. * * @param keyValue A string representing the key values or id * references * @param isKeyCall A boolean indicating whether the iterator * is being created for a reference key or * id */ public KeyIndexIterator getKeyIndexIterator(String keyValue, boolean isKeyCall) { return new KeyIndexIterator(keyValue, isKeyCall); } /** * Create a {@link KeyIndexIterator} that iterates over the nodes that * result from a reference to the XSLT key function or * XPath id function. * * @param keyValue An iterator representing the key values or id * references * @param isKeyCall A boolean indicating whether the iterator * is being created for a reference key or * id */ public KeyIndexIterator getKeyIndexIterator(DTMAxisIterator keyValue, boolean isKeyCall) { return new KeyIndexIterator(keyValue, isKeyCall); } /** * Used to represent an empty node set. */ final private static IntegerArray EMPTY_NODES = new IntegerArray(0); /** * An iterator representing the result of a reference to either the * XSLT key function or the XPath id function. */ public class KeyIndexIterator extends MultiValuedNodeHeapIterator { /** *

        A reference to the key function that only has one * key value or to the id function that has only one string * argument can be optimized to ignore the multi-valued heap. This * field will be null otherwise. */ private IntegerArray _nodes; /** *

        This field contains the iterator representing a node set key value * argument to the key function or a node set argument * to the id function.

        * *

        Exactly one of this field and {@link #_keyValue} must be * null.

        */ private DTMAxisIterator _keyValueIterator; /** *

        This field contains the iterator representing a non-node-set key * value argument to the key function or a non-node-set * argument to the id function.

        * *

        Exactly one of this field and {@link #_keyValueIterator} must be * null.

        */ private String _keyValue; /** * Indicates whether this object represents the result of a reference * to the key function (true) or the * id function (false). */ private boolean _isKeyIterator; /** * Represents the DTM nodes retrieved for one key value or one string * argument to id for use as one heap node in a * {@link MultiValuedNodeHeapIterator}. */ protected class KeyIndexHeapNode extends MultiValuedNodeHeapIterator.HeapNode { /** * {@link IntegerArray} of DTM nodes retrieved for one key value. * Must contain no duplicates and be stored in document order. */ private IntegerArray _nodes; /** * Position in {@link #_nodes} array of next node to return from * this heap node. */ private int _position = 0; /** * Marked position. Used by {@link #setMark()} and * {@link #gotoMark()} */ private int _markPosition = -1; /** * Create a heap node representing DTM nodes retrieved for one * key value in a reference to the key function * or string argument to the id function. */ KeyIndexHeapNode(IntegerArray nodes) { _nodes = nodes; } /** * Advance to the next node represented by this {@link HeapNode} * * @return the next DTM node. */ public int step() { if (_position < _nodes.cardinality()) { _node = _nodes.at(_position); _position++; } else { _node = DTMAxisIterator.END; } return _node; } /** * Creates a deep copy of this {@link HeapNode}. The clone is not * reset from the current position of the original. * * @return the cloned heap node */ public HeapNode cloneHeapNode() { KeyIndexHeapNode clone = (KeyIndexHeapNode) super.cloneHeapNode(); clone._nodes = _nodes; clone._position = _position; clone._markPosition = _markPosition; return clone; } /** * Remembers the current node for the next call to * {@link #gotoMark()}. */ public void setMark() { _markPosition = _position; } /** * Restores the current node remembered by {@link #setMark()}. */ public void gotoMark() { _position = _markPosition; } /** * Performs a comparison of the two heap nodes * * @param heapNode the heap node against which to compare * @return true if and only if the current node for * this heap node is before the current node of the * argument heap node in document order. */ public boolean isLessThan(HeapNode heapNode) { return _node < heapNode._node; } /** *

        Sets context with respect to which this heap node is * evaluated.

        *

        This has no real effect on this kind of heap node. Instead, * the {@link KeyIndexIterator#setStartNode(int)} method should * create new instances of this class to represent the effect of * changing the context.

        */ public HeapNode setStartNode(int node) { return this; } /** * Reset the heap node back to its beginning. */ public HeapNode reset() { _position = 0; return this; } } /** * Constructor used when the argument to key or * id is not a node set. * * @param keyValue the argument to key or id * cast to a String * @param isKeyIterator indicates whether the constructed iterator * represents a reference to key or * id. */ KeyIndexIterator(String keyValue, boolean isKeyIterator) { _isKeyIterator = isKeyIterator; _keyValue = keyValue; } /** * Constructor used when the argument to key or * id is a node set. * * @param keyValues the argument to key or id * @param isKeyIterator indicates whether the constructed iterator * represents a reference to key or * id. */ KeyIndexIterator(DTMAxisIterator keyValues, boolean isKeyIterator) { _keyValueIterator = keyValues; _isKeyIterator = isKeyIterator; } /** * Retrieve nodes for a particular key value or a particular id * argument value. * * @param root The root node of the document containing the context node * @param keyValue The key value of id string argument value * @return an {@link IntegerArray} of the resulting nodes */ protected IntegerArray lookupNodes(int root, String keyValue) { IntegerArray result = null; // Get mapping from key values/IDs to DTM nodes for this document Hashtable index = (Hashtable)_rootToIndexMap.get(new Integer(root)); if (!_isKeyIterator) { // For id function, tokenize argument as whitespace separated // list of values and look up nodes identified by each ID. final StringTokenizer values = new StringTokenizer(keyValue, " \n\t"); while (values.hasMoreElements()) { final String token = (String) values.nextElement(); IntegerArray nodes = null; // Does the ID map to any node in the document? if (index != null) { nodes = (IntegerArray) index.get(token); } // If input was from W3C DOM, use DOM's getElementById to do // the look-up. if (nodes == null && _enhancedDOM != null && _enhancedDOM.hasDOMSource()) { nodes = getDOMNodeById(token); } // If we found any nodes, merge them into the cumulative // result if (nodes != null) { if (result == null) { result = (IntegerArray)nodes.clone(); } else { result.merge(nodes); } } } } else if (index != null) { // For key function, map key value to nodes result = (IntegerArray) index.get(keyValue); } return result; } /** * Set context node for the iterator. This will cause the iterator * to reset itself, reevaluate arguments to the function, look up * nodes in the input and reinitialize its internal heap. * * @param node the context node * @return A {@link DTMAxisIterator} set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { _startNode = node; // If the arugment to the function is a node set, set the // context node on it. if (_keyValueIterator != null) { _keyValueIterator = _keyValueIterator.setStartNode(node); } init(); return super.setStartNode(node); } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int nodeHandle; // If at most one key value or at most one string argument to id // resulted in nodes being returned, use the IntegerArray // stored at _nodes directly. This relies on the fact that the // IntegerArray never includes duplicate nodes and is always stored // in document order. if (_nodes != null) { if (_position < _nodes.cardinality()) { nodeHandle = returnNode(_nodes.at(_position)); } else { nodeHandle = DTMAxisIterator.END; } } else { nodeHandle = super.next(); } return nodeHandle; } /** * Resets the iterator to the last start node. * * @return A DTMAxisIterator, which may or may not be the same as this * iterator. */ public DTMAxisIterator reset() { if (_nodes == null) { init(); } else { super.reset(); } return resetPosition(); } /** * Evaluate the reference to the key or id * function with the context specified by {@link #setStartNode(int)} * and set up this iterator to iterate over the DTM nodes that are * to be returned. */ protected void init() { super.init(); _position = 0; // All nodes retrieved are in the same document int rootHandle = _dom.getAxisIterator(Axis.ROOT) .setStartNode(_startNode).next(); // Is the argument not a node set? if (_keyValueIterator == null) { // Look up nodes returned for the single string argument _nodes = lookupNodes(rootHandle, _keyValue); if (_nodes == null) { _nodes = EMPTY_NODES; } } else { DTMAxisIterator keyValues = _keyValueIterator.reset(); int retrievedKeyValueIdx = 0; boolean foundNodes = false; _nodes = null; // For each node in the node set argument, get the string value // and look up the nodes returned by key or id for that string // value. If at most one string value has nodes associated, // the nodes will be stored in _nodes; otherwise, the nodes // will be placed in a heap. for (int keyValueNode = keyValues.next(); keyValueNode != DTMAxisIterator.END; keyValueNode = keyValues.next()) { String keyValue = BasisLibrary.stringF(keyValueNode, _dom); IntegerArray nodes = lookupNodes(rootHandle, keyValue); if (nodes != null) { if (!foundNodes) { _nodes = nodes; foundNodes = true; } else { if (_nodes != null) { addHeapNode(new KeyIndexHeapNode(_nodes)); _nodes = null; } addHeapNode(new KeyIndexHeapNode(nodes)); } } } if (!foundNodes) { _nodes = EMPTY_NODES; } } } /** * Returns the number of nodes in this iterator. * * @return the number of nodes */ public int getLast() { // If nodes are stored in _nodes, take advantage of the fact that // there are no duplicates. Otherwise, fall back to the base heap // implementaiton and hope it does a good job with this. return (_nodes != null) ? _nodes.cardinality() : super.getLast(); } /** * Return the node at the given position. * * @param position The position * @return The node at the given position. */ public int getNodeByPosition(int position) { int node = DTMAxisIterator.END; // If nodes are stored in _nodes, take advantage of the fact that // there are no duplicates and they are stored in document order. // Otherwise, fall back to the base heap implementation to do a // good job with this. if (_nodes != null) { if (position > 0) { if (position <= _nodes.cardinality()) { _position = position; node = _nodes.at(position-1); } else { _position = _nodes.cardinality(); } } } else { node = super.getNodeByPosition(position); } return node; } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/AdaptiveResultTreeImpl.java0000644000175000017500000010507510721374031026365 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AdaptiveResultTreeImpl.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.runtime.AttributeList; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMAxisTraverser; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.utils.XMLString; import org.apache.xml.serializer.SerializationHandler; import javax.xml.transform.SourceLocator; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * AdaptiveResultTreeImpl is a adaptive DOM model for result tree fragments (RTF). It is * used in the case where the RTF is likely to be pure text yet it can still be a DOM tree. * It is designed for RTFs which have <xsl:call-template> or <xsl:apply-templates> in * the contents. Example: *
         *    <xsl:variable name = "x">
         *      <xsl:call-template name = "test">
         *         <xsl:with-param name="a" select="."/>
         *      </xsl:call-template>
         *    </xsl:variable>
         * 
        *

        In this example the result produced by is likely to be a single * Text node. But it can also be a DOM tree. This kind of RTF cannot be modelled by * SimpleResultTreeImpl. *

        * AdaptiveResultTreeImpl can be considered as a smart switcher between SimpleResultTreeImpl * and SAXImpl. It treats the RTF as simple Text and uses the SimpleResultTreeImpl model * at the beginning. However, if it receives a call which indicates that this is a DOM tree * (e.g. startElement), it will automatically transform itself into a wrapper around a * SAXImpl. In this way we can have a light-weight model when the result only contains * simple text, while at the same time it still works when the RTF is a DOM tree. *

        * All methods in this class are overridden to delegate the action to the wrapped SAXImpl object * if it is non-null, or delegate the action to the SimpleResultTreeImpl if there is no * wrapped SAXImpl. *

        * %REVISIT% Can we combine this class with SimpleResultTreeImpl? I think it is possible, but * it will make SimpleResultTreeImpl more expensive. I will use two separate classes at * this time. */ public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl { // Document URI index, which increases by 1 at each getDocumentURI() call. private static int _documentURIIndex = 0; // The SAXImpl object wrapped by this class, if the RTF is a tree. private SAXImpl _dom; /** The following fields are only used for the nested SAXImpl **/ // The whitespace filter private DTMWSFilter _wsfilter; // The size of the RTF private int _initSize; // True if we want to build the ID index table private boolean _buildIdIndex; // The AttributeList private final AttributeList _attributes = new AttributeList(); // The element name private String _openElementName; // Create a AdaptiveResultTreeImpl public AdaptiveResultTreeImpl(XSLTCDTMManager dtmManager, int documentID, DTMWSFilter wsfilter, int initSize, boolean buildIdIndex) { super(dtmManager, documentID); _wsfilter = wsfilter; _initSize = initSize; _buildIdIndex = buildIdIndex; } // Return the DOM object wrapped in this object. public DOM getNestedDOM() { return _dom; } // Return the document ID public int getDocument() { if (_dom != null) { return _dom.getDocument(); } else { return super.getDocument(); } } // Return the String value of the RTF public String getStringValue() { if (_dom != null) { return _dom.getStringValue(); } else { return super.getStringValue(); } } public DTMAxisIterator getIterator() { if (_dom != null) { return _dom.getIterator(); } else { return super.getIterator(); } } public DTMAxisIterator getChildren(final int node) { if (_dom != null) { return _dom.getChildren(node); } else { return super.getChildren(node); } } public DTMAxisIterator getTypedChildren(final int type) { if (_dom != null) { return _dom.getTypedChildren(type); } else { return super.getTypedChildren(type); } } public DTMAxisIterator getAxisIterator(final int axis) { if (_dom != null) { return _dom.getAxisIterator(axis); } else { return super.getAxisIterator(axis); } } public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) { if (_dom != null) { return _dom.getTypedAxisIterator(axis, type); } else { return super.getTypedAxisIterator(axis, type); } } public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself) { if (_dom != null) { return _dom.getNthDescendant(node, n, includeself); } else { return super.getNthDescendant(node, n, includeself); } } public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns) { if (_dom != null) { return _dom.getNamespaceAxisIterator(axis, ns); } else { return super.getNamespaceAxisIterator(axis, ns); } } public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType, String value, boolean op) { if (_dom != null) { return _dom.getNodeValueIterator(iter, returnType, value, op); } else { return super.getNodeValueIterator(iter, returnType, value, op); } } public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) { if (_dom != null) { return _dom.orderNodes(source, node); } else { return super.orderNodes(source, node); } } public String getNodeName(final int node) { if (_dom != null) { return _dom.getNodeName(node); } else { return super.getNodeName(node); } } public String getNodeNameX(final int node) { if (_dom != null) { return _dom.getNodeNameX(node); } else { return super.getNodeNameX(node); } } public String getNamespaceName(final int node) { if (_dom != null) { return _dom.getNamespaceName(node); } else { return super.getNamespaceName(node); } } // Return the expanded type id of a given node public int getExpandedTypeID(final int nodeHandle) { if (_dom != null) { return _dom.getExpandedTypeID(nodeHandle); } else { return super.getExpandedTypeID(nodeHandle); } } public int getNamespaceType(final int node) { if (_dom != null) { return _dom.getNamespaceType(node); } else { return super.getNamespaceType(node); } } public int getParent(final int nodeHandle) { if (_dom != null) { return _dom.getParent(nodeHandle); } else { return super.getParent(nodeHandle); } } public int getAttributeNode(final int gType, final int element) { if (_dom != null) { return _dom.getAttributeNode(gType, element); } else { return super.getAttributeNode(gType, element); } } public String getStringValueX(final int nodeHandle) { if (_dom != null) { return _dom.getStringValueX(nodeHandle); } else { return super.getStringValueX(nodeHandle); } } public void copy(final int node, SerializationHandler handler) throws TransletException { if (_dom != null) { _dom.copy(node, handler); } else { super.copy(node, handler); } } public void copy(DTMAxisIterator nodes, SerializationHandler handler) throws TransletException { if (_dom != null) { _dom.copy(nodes, handler); } else { super.copy(nodes, handler); } } public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { if (_dom != null) { return _dom.shallowCopy(node, handler); } else { return super.shallowCopy(node, handler); } } public boolean lessThan(final int node1, final int node2) { if (_dom != null) { return _dom.lessThan(node1, node2); } else { return super.lessThan(node1, node2); } } /** * Dispatch the character content of a node to an output handler. * * The escape setting should be taken care of when outputting to * a handler. */ public void characters(final int node, SerializationHandler handler) throws TransletException { if (_dom != null) { _dom.characters(node, handler); } else { super.characters(node, handler); } } public Node makeNode(int index) { if (_dom != null) { return _dom.makeNode(index); } else { return super.makeNode(index); } } public Node makeNode(DTMAxisIterator iter) { if (_dom != null) { return _dom.makeNode(iter); } else { return super.makeNode(iter); } } public NodeList makeNodeList(int index) { if (_dom != null) { return _dom.makeNodeList(index); } else { return super.makeNodeList(index); } } public NodeList makeNodeList(DTMAxisIterator iter) { if (_dom != null) { return _dom.makeNodeList(iter); } else { return super.makeNodeList(iter); } } public String getLanguage(int node) { if (_dom != null) { return _dom.getLanguage(node); } else { return super.getLanguage(node); } } public int getSize() { if (_dom != null) { return _dom.getSize(); } else { return super.getSize(); } } public String getDocumentURI(int node) { if (_dom != null) { return _dom.getDocumentURI(node); } else { return "adaptive_rtf" + _documentURIIndex++; } } public void setFilter(StripFilter filter) { if (_dom != null) { _dom.setFilter(filter); } else { super.setFilter(filter); } } public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces) { if (_dom != null) { _dom.setupMapping(names, uris, types, namespaces); } else { super.setupMapping(names, uris, types, namespaces); } } public boolean isElement(final int node) { if (_dom != null) { return _dom.isElement(node); } else { return super.isElement(node); } } public boolean isAttribute(final int node) { if (_dom != null) { return _dom.isAttribute(node); } else { return super.isAttribute(node); } } public String lookupNamespace(int node, String prefix) throws TransletException { if (_dom != null) { return _dom.lookupNamespace(node, prefix); } else { return super.lookupNamespace(node, prefix); } } /** * Return the node identity from a node handle. */ public final int getNodeIdent(final int nodehandle) { if (_dom != null) { return _dom.getNodeIdent(nodehandle); } else { return super.getNodeIdent(nodehandle); } } /** * Return the node handle from a node identity. */ public final int getNodeHandle(final int nodeId) { if (_dom != null) { return _dom.getNodeHandle(nodeId); } else { return super.getNodeHandle(nodeId); } } public DOM getResultTreeFrag(int initialSize, int rtfType) { if (_dom != null) { return _dom.getResultTreeFrag(initialSize, rtfType); } else { return super.getResultTreeFrag(initialSize, rtfType); } } public SerializationHandler getOutputDomBuilder() { return this; } public int getNSType(int node) { if (_dom != null) { return _dom.getNSType(node); } else { return super.getNSType(node); } } public String getUnparsedEntityURI(String name) { if (_dom != null) { return _dom.getUnparsedEntityURI(name); } else { return super.getUnparsedEntityURI(name); } } public Hashtable getElementsWithIDs() { if (_dom != null) { return _dom.getElementsWithIDs(); } else { return super.getElementsWithIDs(); } } /** Implementation of the SerializationHandler interfaces **/ /** The code in some of the following interfaces are copied from SAXAdapter. **/ private void maybeEmitStartElement() throws SAXException { if (_openElementName != null) { int index; if ((index =_openElementName.indexOf(":")) < 0) _dom.startElement(null, _openElementName, _openElementName, _attributes); else _dom.startElement(null, _openElementName.substring(index+1), _openElementName, _attributes); _openElementName = null; } } // Create and initialize the wrapped SAXImpl object private void prepareNewDOM() throws SAXException { _dom = (SAXImpl)_dtmManager.getDTM(null, true, _wsfilter, true, false, false, _initSize, _buildIdIndex); _dom.startDocument(); // Flush pending Text nodes to SAXImpl for (int i = 0; i < _size; i++) { String str = _textArray[i]; _dom.characters(str.toCharArray(), 0, str.length()); } _size = 0; } public void startDocument() throws SAXException { } public void endDocument() throws SAXException { if (_dom != null) { _dom.endDocument(); } else { super.endDocument(); } } public void characters(String str) throws SAXException { if (_dom != null) { characters(str.toCharArray(), 0, str.length()); } else { super.characters(str); } } public void characters(char[] ch, int offset, int length) throws SAXException { if (_dom != null) { maybeEmitStartElement(); _dom.characters(ch, offset, length); } else { super.characters(ch, offset, length); } } public boolean setEscaping(boolean escape) throws SAXException { if (_dom != null) { return _dom.setEscaping(escape); } else { return super.setEscaping(escape); } } public void startElement(String elementName) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _openElementName = elementName; _attributes.clear(); } public void startElement(String uri, String localName, String qName) throws SAXException { startElement(qName); } public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { startElement(qName); } public void endElement(String elementName) throws SAXException { maybeEmitStartElement(); _dom.endElement(null, null, elementName); } public void endElement(String uri, String localName, String qName) throws SAXException { endElement(qName); } public void addUniqueAttribute(String qName, String value, int flags) throws SAXException { addAttribute(qName, value); } public void addAttribute(String name, String value) { if (_openElementName != null) { _attributes.add(name, value); } else { BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, name); } } public void namespaceAfterStartElement(String prefix, String uri) throws SAXException { if (_dom == null) { prepareNewDOM(); } _dom.startPrefixMapping(prefix, uri); } public void comment(String comment) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); char[] chars = comment.toCharArray(); _dom.comment(chars, 0, chars.length); } public void comment(char[] chars, int offset, int length) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _dom.comment(chars, offset, length); } public void processingInstruction(String target, String data) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _dom.processingInstruction(target, data); } /** Implementation of the DTM interfaces **/ public void setFeature(String featureId, boolean state) { if (_dom != null) { _dom.setFeature(featureId, state); } } public void setProperty(String property, Object value) { if (_dom != null) { _dom.setProperty(property, value); } } public DTMAxisTraverser getAxisTraverser(final int axis) { if (_dom != null) { return _dom.getAxisTraverser(axis); } else { return super.getAxisTraverser(axis); } } public boolean hasChildNodes(int nodeHandle) { if (_dom != null) { return _dom.hasChildNodes(nodeHandle); } else { return super.hasChildNodes(nodeHandle); } } public int getFirstChild(int nodeHandle) { if (_dom != null) { return _dom.getFirstChild(nodeHandle); } else { return super.getFirstChild(nodeHandle); } } public int getLastChild(int nodeHandle) { if (_dom != null) { return _dom.getLastChild(nodeHandle); } else { return super.getLastChild(nodeHandle); } } public int getAttributeNode(int elementHandle, String namespaceURI, String name) { if (_dom != null) { return _dom.getAttributeNode(elementHandle, namespaceURI, name); } else { return super.getAttributeNode(elementHandle, namespaceURI, name); } } public int getFirstAttribute(int nodeHandle) { if (_dom != null) { return _dom.getFirstAttribute(nodeHandle); } else { return super.getFirstAttribute(nodeHandle); } } public int getFirstNamespaceNode(int nodeHandle, boolean inScope) { if (_dom != null) { return _dom.getFirstNamespaceNode(nodeHandle, inScope); } else { return super.getFirstNamespaceNode(nodeHandle, inScope); } } public int getNextSibling(int nodeHandle) { if (_dom != null) { return _dom.getNextSibling(nodeHandle); } else { return super.getNextSibling(nodeHandle); } } public int getPreviousSibling(int nodeHandle) { if (_dom != null) { return _dom.getPreviousSibling(nodeHandle); } else { return super.getPreviousSibling(nodeHandle); } } public int getNextAttribute(int nodeHandle) { if (_dom != null) { return _dom.getNextAttribute(nodeHandle); } else { return super.getNextAttribute(nodeHandle); } } public int getNextNamespaceNode(int baseHandle, int namespaceHandle, boolean inScope) { if (_dom != null) { return _dom.getNextNamespaceNode(baseHandle, namespaceHandle, inScope); } else { return super.getNextNamespaceNode(baseHandle, namespaceHandle, inScope); } } public int getOwnerDocument(int nodeHandle) { if (_dom != null) { return _dom.getOwnerDocument(nodeHandle); } else { return super.getOwnerDocument(nodeHandle); } } public int getDocumentRoot(int nodeHandle) { if (_dom != null) { return _dom.getDocumentRoot(nodeHandle); } else { return super.getDocumentRoot(nodeHandle); } } public XMLString getStringValue(int nodeHandle) { if (_dom != null) { return _dom.getStringValue(nodeHandle); } else { return super.getStringValue(nodeHandle); } } public int getStringValueChunkCount(int nodeHandle) { if (_dom != null) { return _dom.getStringValueChunkCount(nodeHandle); } else { return super.getStringValueChunkCount(nodeHandle); } } public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen) { if (_dom != null) { return _dom.getStringValueChunk(nodeHandle, chunkIndex, startAndLen); } else { return super.getStringValueChunk(nodeHandle, chunkIndex, startAndLen); } } public int getExpandedTypeID(String namespace, String localName, int type) { if (_dom != null) { return _dom.getExpandedTypeID(namespace, localName, type); } else { return super.getExpandedTypeID(namespace, localName, type); } } public String getLocalNameFromExpandedNameID(int ExpandedNameID) { if (_dom != null) { return _dom.getLocalNameFromExpandedNameID(ExpandedNameID); } else { return super.getLocalNameFromExpandedNameID(ExpandedNameID); } } public String getNamespaceFromExpandedNameID(int ExpandedNameID) { if (_dom != null) { return _dom.getNamespaceFromExpandedNameID(ExpandedNameID); } else { return super.getNamespaceFromExpandedNameID(ExpandedNameID); } } public String getLocalName(int nodeHandle) { if (_dom != null) { return _dom.getLocalName(nodeHandle); } else { return super.getLocalName(nodeHandle); } } public String getPrefix(int nodeHandle) { if (_dom != null) { return _dom.getPrefix(nodeHandle); } else { return super.getPrefix(nodeHandle); } } public String getNamespaceURI(int nodeHandle) { if (_dom != null) { return _dom.getNamespaceURI(nodeHandle); } else { return super.getNamespaceURI(nodeHandle); } } public String getNodeValue(int nodeHandle) { if (_dom != null) { return _dom.getNodeValue(nodeHandle); } else { return super.getNodeValue(nodeHandle); } } public short getNodeType(int nodeHandle) { if (_dom != null) { return _dom.getNodeType(nodeHandle); } else { return super.getNodeType(nodeHandle); } } public short getLevel(int nodeHandle) { if (_dom != null) { return _dom.getLevel(nodeHandle); } else { return super.getLevel(nodeHandle); } } public boolean isSupported(String feature, String version) { if (_dom != null) { return _dom.isSupported(feature, version); } else { return super.isSupported(feature, version); } } public String getDocumentBaseURI() { if (_dom != null) { return _dom.getDocumentBaseURI(); } else { return super.getDocumentBaseURI(); } } public void setDocumentBaseURI(String baseURI) { if (_dom != null) { _dom.setDocumentBaseURI(baseURI); } else { super.setDocumentBaseURI(baseURI); } } public String getDocumentSystemIdentifier(int nodeHandle) { if (_dom != null) { return _dom.getDocumentSystemIdentifier(nodeHandle); } else { return super.getDocumentSystemIdentifier(nodeHandle); } } public String getDocumentEncoding(int nodeHandle) { if (_dom != null) { return _dom.getDocumentEncoding(nodeHandle); } else { return super.getDocumentEncoding(nodeHandle); } } public String getDocumentStandalone(int nodeHandle) { if (_dom != null) { return _dom.getDocumentStandalone(nodeHandle); } else { return super.getDocumentStandalone(nodeHandle); } } public String getDocumentVersion(int documentHandle) { if (_dom != null) { return _dom.getDocumentVersion(documentHandle); } else { return super.getDocumentVersion(documentHandle); } } public boolean getDocumentAllDeclarationsProcessed() { if (_dom != null) { return _dom.getDocumentAllDeclarationsProcessed(); } else { return super.getDocumentAllDeclarationsProcessed(); } } public String getDocumentTypeDeclarationSystemIdentifier() { if (_dom != null) { return _dom.getDocumentTypeDeclarationSystemIdentifier(); } else { return super.getDocumentTypeDeclarationSystemIdentifier(); } } public String getDocumentTypeDeclarationPublicIdentifier() { if (_dom != null) { return _dom.getDocumentTypeDeclarationPublicIdentifier(); } else { return super.getDocumentTypeDeclarationPublicIdentifier(); } } public int getElementById(String elementId) { if (_dom != null) { return _dom.getElementById(elementId); } else { return super.getElementById(elementId); } } public boolean supportsPreStripping() { if (_dom != null) { return _dom.supportsPreStripping(); } else { return super.supportsPreStripping(); } } public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle) { if (_dom != null) { return _dom.isNodeAfter(firstNodeHandle, secondNodeHandle); } else { return super.isNodeAfter(firstNodeHandle, secondNodeHandle); } } public boolean isCharacterElementContentWhitespace(int nodeHandle) { if (_dom != null) { return _dom.isCharacterElementContentWhitespace(nodeHandle); } else { return super.isCharacterElementContentWhitespace(nodeHandle); } } public boolean isDocumentAllDeclarationsProcessed(int documentHandle) { if (_dom != null) { return _dom.isDocumentAllDeclarationsProcessed(documentHandle); } else { return super.isDocumentAllDeclarationsProcessed(documentHandle); } } public boolean isAttributeSpecified(int attributeHandle) { if (_dom != null) { return _dom.isAttributeSpecified(attributeHandle); } else { return super.isAttributeSpecified(attributeHandle); } } public void dispatchCharactersEvents(int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException { if (_dom != null) { _dom.dispatchCharactersEvents(nodeHandle, ch, normalize); } else { super.dispatchCharactersEvents(nodeHandle, ch, normalize); } } public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { if (_dom != null) { _dom.dispatchToEvents(nodeHandle, ch); } else { super.dispatchToEvents(nodeHandle, ch); } } public org.w3c.dom.Node getNode(int nodeHandle) { if (_dom != null) { return _dom.getNode(nodeHandle); } else { return super.getNode(nodeHandle); } } public boolean needsTwoThreads() { if (_dom != null) { return _dom.needsTwoThreads(); } else { return super.needsTwoThreads(); } } public org.xml.sax.ContentHandler getContentHandler() { if (_dom != null) { return _dom.getContentHandler(); } else { return super.getContentHandler(); } } public org.xml.sax.ext.LexicalHandler getLexicalHandler() { if (_dom != null) { return _dom.getLexicalHandler(); } else { return super.getLexicalHandler(); } } public org.xml.sax.EntityResolver getEntityResolver() { if (_dom != null) { return _dom.getEntityResolver(); } else { return super.getEntityResolver(); } } public org.xml.sax.DTDHandler getDTDHandler() { if (_dom != null) { return _dom.getDTDHandler(); } else { return super.getDTDHandler(); } } public org.xml.sax.ErrorHandler getErrorHandler() { if (_dom != null) { return _dom.getErrorHandler(); } else { return super.getErrorHandler(); } } public org.xml.sax.ext.DeclHandler getDeclHandler() { if (_dom != null) { return _dom.getDeclHandler(); } else { return super.getDeclHandler(); } } public void appendChild(int newChild, boolean clone, boolean cloneDepth) { if (_dom != null) { _dom.appendChild(newChild, clone, cloneDepth); } else { super.appendChild(newChild, clone, cloneDepth); } } public void appendTextChild(String str) { if (_dom != null) { _dom.appendTextChild(str); } else { super.appendTextChild(str); } } public SourceLocator getSourceLocatorFor(int node) { if (_dom != null) { return _dom.getSourceLocatorFor(node); } else { return super.getSourceLocatorFor(node); } } public void documentRegistration() { if (_dom != null) { _dom.documentRegistration(); } else { super.documentRegistration(); } } public void documentRelease() { if (_dom != null) { _dom.documentRelease(); } else { super.documentRelease(); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/ExtendedSAX.java0000644000175000017500000000235210721374031024075 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ExtendedSAX.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; /** * @author Morten Jorgensen */ public interface ExtendedSAX extends ContentHandler, LexicalHandler, DTDHandler, DeclHandler { } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SAXImpl.java0000644000175000017500000017333710721374030023251 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SAXImpl.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.net.URL; import java.net.MalformedURLException; import java.util.Enumeration; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.DOMEnhancedForDTM; import org.apache.xalan.xsltc.StripFilter; import org.apache.xalan.xsltc.TransletException; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.runtime.Hashtable; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.Axis; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.DTMManager; import org.apache.xml.dtm.DTMWSFilter; import org.apache.xml.dtm.ref.DTMAxisIterNodeList; import org.apache.xml.dtm.ref.DTMDefaultBase; import org.apache.xml.dtm.ref.EmptyIterator; import org.apache.xml.dtm.ref.DTMNodeProxy; import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2; import org.apache.xml.serializer.SerializationHandler; import org.apache.xml.serializer.ToXMLSAXHandler; import org.apache.xml.utils.XMLStringFactory; import org.apache.xml.utils.SystemIDResolver; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Entity; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * SAXImpl is the core model for SAX input source. SAXImpl objects are * usually created from an XSLTCDTMManager. * *

        DOMSource inputs are handled using DOM2SAX + SAXImpl. SAXImpl has a * few specific fields (e.g. _node2Ids, _document) to keep DOM-related * information. They are used when the processing behavior between DOM and * SAX has to be different. Examples of these include id function and * unparsed entity. * *

        SAXImpl extends SAX2DTM2 instead of SAX2DTM for better performance. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen * @author Douglas Sellers */ public final class SAXImpl extends SAX2DTM2 implements DOMEnhancedForDTM, DOMBuilder { /* ------------------------------------------------------------------- */ /* DOMBuilder fields BEGIN */ /* ------------------------------------------------------------------- */ // Namespace prefix-to-uri mapping stuff private int _uriCount = 0; private int _prefixCount = 0; // Stack used to keep track of what whitespace text nodes are protected // by xml:space="preserve" attributes and which nodes that are not. private int[] _xmlSpaceStack; private int _idx = 1; private boolean _preserve = false; private static final String XML_STRING = "xml:"; private static final String XML_PREFIX = "xml"; private static final String XMLSPACE_STRING = "xml:space"; private static final String PRESERVE_STRING = "preserve"; private static final String XMLNS_PREFIX = "xmlns"; private static final String XML_URI = "http://www.w3.org/XML/1998/namespace"; private boolean _escaping = true; private boolean _disableEscaping = false; private int _textNodeToProcess = DTM.NULL; /* ------------------------------------------------------------------- */ /* DOMBuilder fields END */ /* ------------------------------------------------------------------- */ // empty String for null attribute values private final static String EMPTYSTRING = ""; // empty iterator to be returned when there are no children private final static DTMAxisIterator EMPTYITERATOR = EmptyIterator.getInstance(); // The number of expanded names private int _namesSize = -1; // Namespace related stuff private Hashtable _nsIndex = new Hashtable(); // The initial size of the text buffer private int _size = 0; // Tracks which textnodes are not escaped private BitArray _dontEscape = null; // The URI to this document private String _documentURI = null; static private int _documentURIIndex = 0; // The owner Document when the input source is DOMSource. private Document _document; // The hashtable for org.w3c.dom.Node to node id mapping. // This is only used when the input is a DOMSource and the // buildIdIndex flag is true. private Hashtable _node2Ids = null; // True if the input source is a DOMSource. private boolean _hasDOMSource = false; // The DTMManager private XSLTCDTMManager _dtmManager; // Support for access/navigation through org.w3c.dom API private Node[] _nodes; private NodeList[] _nodeLists; private final static String XML_LANG_ATTRIBUTE = "http://www.w3.org/XML/1998/namespace:@lang"; /** * Define the origin of the document from which the tree was built */ public void setDocumentURI(String uri) { if (uri != null) { setDocumentBaseURI(SystemIDResolver.getAbsoluteURI(uri)); } } /** * Returns the origin of the document from which the tree was built */ public String getDocumentURI() { String baseURI = getDocumentBaseURI(); return (baseURI != null) ? baseURI : "rtf" + _documentURIIndex++; } public String getDocumentURI(int node) { return getDocumentURI(); } public void setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces) { // This method only has a function in DOM adapters } /** * Lookup a namespace URI from a prefix starting at node. This method * is used in the execution of xsl:element when the prefix is not known * at compile time. */ public String lookupNamespace(int node, String prefix) throws TransletException { int anode, nsnode; final AncestorIterator ancestors = new AncestorIterator(); if (isElement(node)) { ancestors.includeSelf(); } ancestors.setStartNode(node); while ((anode = ancestors.next()) != DTM.NULL) { final NamespaceIterator namespaces = new NamespaceIterator(); namespaces.setStartNode(anode); while ((nsnode = namespaces.next()) != DTM.NULL) { if (getLocalName(nsnode).equals(prefix)) { return getNodeValue(nsnode); } } } BasisLibrary.runTimeError(BasisLibrary.NAMESPACE_PREFIX_ERR, prefix); return null; } /** * Returns 'true' if a specific node is an element (of any type) */ public boolean isElement(final int node) { return getNodeType(node) == DTM.ELEMENT_NODE; } /** * Returns 'true' if a specific node is an attribute (of any type) */ public boolean isAttribute(final int node) { return getNodeType(node) == DTM.ATTRIBUTE_NODE; } /** * Returns the number of nodes in the tree (used for indexing) */ public int getSize() { return getNumberOfNodes(); } /** * Part of the DOM interface - no function here. */ public void setFilter(StripFilter filter) { } /** * Returns true if node1 comes before node2 in document order */ public boolean lessThan(int node1, int node2) { if (node1 == DTM.NULL) { return false; } if (node2 == DTM.NULL) { return true; } return (node1 < node2); } /** * Create an org.w3c.dom.Node from a node in the tree */ public Node makeNode(int index) { if (_nodes == null) { _nodes = new Node[_namesSize]; } int nodeID = makeNodeIdentity(index); if (nodeID < 0) { return null; } else if (nodeID < _nodes.length) { return (_nodes[nodeID] != null) ? _nodes[nodeID] : (_nodes[nodeID] = new DTMNodeProxy((DTM)this, index)); } else { return new DTMNodeProxy((DTM)this, index); } } /** * Create an org.w3c.dom.Node from a node in an iterator * The iterator most be started before this method is called */ public Node makeNode(DTMAxisIterator iter) { return makeNode(iter.next()); } /** * Create an org.w3c.dom.NodeList from a node in the tree */ public NodeList makeNodeList(int index) { if (_nodeLists == null) { _nodeLists = new NodeList[_namesSize]; } int nodeID = makeNodeIdentity(index); if (nodeID < 0) { return null; } else if (nodeID < _nodeLists.length) { return (_nodeLists[nodeID] != null) ? _nodeLists[nodeID] : (_nodeLists[nodeID] = new DTMAxisIterNodeList(this, new SingletonIterator(index))); } else { return new DTMAxisIterNodeList(this, new SingletonIterator(index)); } } /** * Create an org.w3c.dom.NodeList from a node iterator * The iterator most be started before this method is called */ public NodeList makeNodeList(DTMAxisIterator iter) { return new DTMAxisIterNodeList(this, iter); } /** * Iterator that returns the namespace nodes as defined by the XPath data * model for a given node, filtered by extended type ID. */ public class TypedNamespaceIterator extends NamespaceIterator { private String _nsPrefix; /** * Constructor TypedChildrenIterator * * * @param nodeType The extended type ID being requested. */ public TypedNamespaceIterator(int nodeType) { super(); if(m_expandedNameTable != null){ _nsPrefix = m_expandedNameTable.getLocalName(nodeType); } } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if ((_nsPrefix == null) ||(_nsPrefix.length() == 0) ){ return (END); } int node = END; for (node = super.next(); node != END; node = super.next()) { if (_nsPrefix.compareTo(getLocalName(node))== 0) { return returnNode(node); } } return (END); } } // end of TypedNamespaceIterator /************************************************************** * This is a specialised iterator for predicates comparing node or * attribute values to variable or parameter values. */ private final class NodeValueIterator extends InternalAxisIteratorBase { private DTMAxisIterator _source; private String _value; private boolean _op; private final boolean _isReverse; private int _returnType = RETURN_PARENT; public NodeValueIterator(DTMAxisIterator source, int returnType, String value, boolean op) { _source = source; _returnType = returnType; _value = value; _op = op; _isReverse = source.isReverse(); } public boolean isReverse() { return _isReverse; } public DTMAxisIterator cloneIterator() { try { NodeValueIterator clone = (NodeValueIterator)super.clone(); clone._isRestartable = false; clone._source = _source.cloneIterator(); clone._value = _value; clone._op = _op; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public DTMAxisIterator reset() { _source.reset(); return resetPosition(); } public int next() { int node; while ((node = _source.next()) != END) { String val = getStringValueX(node); if (_value.equals(val) == _op) { if (_returnType == RETURN_CURRENT) { return returnNode(node); } else { return returnNode(getParent(node)); } } } return END; } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _source.setStartNode(_startNode = node); return resetPosition(); } return this; } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } // end NodeValueIterator public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iterator, int type, String value, boolean op) { return(DTMAxisIterator)(new NodeValueIterator(iterator, type, value, op)); } /** * Encapsulates an iterator in an OrderedIterator to ensure node order */ public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) { return new DupFilterIterator(source); } /** * Returns singleton iterator containg the document root * Works for them main document (mark == 0). It cannot be made * to point to any other node through setStartNode(). */ public DTMAxisIterator getIterator() { return new SingletonIterator(getDocument(), true); } /** * Get mapping from DOM namespace types to external namespace types */ public int getNSType(int node) { String s = getNamespaceURI(node); if (s == null) { return 0; } int eType = getIdForNamespace(s); return ((Integer)_nsIndex.get(new Integer(eType))).intValue(); } /** * Returns the namespace type of a specific node */ public int getNamespaceType(final int node) { return super.getNamespaceType(node); } /** * Sets up a translet-to-dom type mapping table */ private int[] setupMapping(String[] names, String[] uris, int[] types, int nNames) { // Padding with number of names, because they // may need to be added, i.e for RTFs. See copy03 final int[] result = new int[m_expandedNameTable.getSize()]; for (int i = 0; i < nNames; i++) { //int type = getGeneralizedType(namesArray[i]); int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], false); result[type] = type; } return result; } /** * Returns the internal type associated with an expanded QName */ public int getGeneralizedType(final String name) { return getGeneralizedType(name, true); } /** * Returns the internal type associated with an expanded QName */ public int getGeneralizedType(final String name, boolean searchOnly) { String lName, ns = null; int index = -1; int code; // Is there a prefix? if ((index = name.lastIndexOf(":"))> -1) { ns = name.substring(0, index); } // Local part of name is after colon. lastIndexOf returns -1 if // there is no colon, so lNameStartIdx will be zero in that case. int lNameStartIdx = index+1; // Distinguish attribute and element names. Attribute has @ before // local part of name. if (name.charAt(lNameStartIdx) == '@') { code = DTM.ATTRIBUTE_NODE; lNameStartIdx++; } else { code = DTM.ELEMENT_NODE; } // Extract local name lName = (lNameStartIdx == 0) ? name : name.substring(lNameStartIdx); return m_expandedNameTable.getExpandedTypeID(ns, lName, code, searchOnly); } /** * Get mapping from DOM element/attribute types to external types */ public short[] getMapping(String[] names, String[] uris, int[] types) { // Delegate the work to getMapping2 if the document is not fully built. // Some of the processing has to be different in this case. if (_namesSize < 0) { return getMapping2(names, uris, types); } int i; final int namesLength = names.length; final int exLength = m_expandedNameTable.getSize(); final short[] result = new short[exLength]; // primitive types map to themselves for (i = 0; i < DTM.NTYPES; i++) { result[i] = (short)i; } for (i = NTYPES; i < exLength; i++) { result[i] = m_expandedNameTable.getType(i); } // actual mapping of caller requested names for (i = 0; i < namesLength; i++) { int genType = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], true); if (genType >= 0 && genType < exLength) { result[genType] = (short)(i + DTM.NTYPES); } } return result; } /** * Get mapping from external element/attribute types to DOM types */ public int[] getReverseMapping(String[] names, String[] uris, int[] types) { int i; final int[] result = new int[names.length + DTM.NTYPES]; // primitive types map to themselves for (i = 0; i < DTM.NTYPES; i++) { result[i] = i; } // caller's types map into appropriate dom types for (i = 0; i < names.length; i++) { int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], true); result[i+DTM.NTYPES] = type; } return(result); } /** * Get mapping from DOM element/attribute types to external types. * This method is used when the document is not fully built. */ private short[] getMapping2(String[] names, String[] uris, int[] types) { int i; final int namesLength = names.length; final int exLength = m_expandedNameTable.getSize(); int[] generalizedTypes = null; if (namesLength > 0) { generalizedTypes = new int[namesLength]; } int resultLength = exLength; for (i = 0; i < namesLength; i++) { // When the document is not fully built, the searchOnly // flag should be set to false. That means we should add // the type if it is not already in the expanded name table. //generalizedTypes[i] = getGeneralizedType(names[i], false); generalizedTypes[i] = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], false); if (_namesSize < 0 && generalizedTypes[i] >= resultLength) { resultLength = generalizedTypes[i] + 1; } } final short[] result = new short[resultLength]; // primitive types map to themselves for (i = 0; i < DTM.NTYPES; i++) { result[i] = (short)i; } for (i = NTYPES; i < exLength; i++) { result[i] = m_expandedNameTable.getType(i); } // actual mapping of caller requested names for (i = 0; i < namesLength; i++) { int genType = generalizedTypes[i]; if (genType >= 0 && genType < resultLength) { result[genType] = (short)(i + DTM.NTYPES); } } return(result); } /** * Get mapping from DOM namespace types to external namespace types */ public short[] getNamespaceMapping(String[] namespaces) { int i; final int nsLength = namespaces.length; final int mappingLength = _uriCount; final short[] result = new short[mappingLength]; // Initialize all entries to -1 for (i=0; i= _dontEscape.size()) { _dontEscape.resize(_dontEscape.size() * 2); } _dontEscape.setBit(_textNodeToProcess); _disableEscaping = false; } _textNodeToProcess = DTM.NULL; } /****************************************************************/ /* SAX Interface Starts Here */ /****************************************************************/ /** * SAX2: Receive notification of character data. */ public void characters(char[] ch, int start, int length) throws SAXException { super.characters(ch, start, length); _disableEscaping = !_escaping; _textNodeToProcess = getNumberOfNodes(); } /** * SAX2: Receive notification of the beginning of a document. */ public void startDocument() throws SAXException { super.startDocument(); _nsIndex.put(new Integer(0), new Integer(_uriCount++)); definePrefixAndUri(XML_PREFIX, XML_URI); } /** * SAX2: Receive notification of the end of a document. */ public void endDocument() throws SAXException { super.endDocument(); handleTextEscaping(); _namesSize = m_expandedNameTable.getSize(); } /** * Specialized interface used by DOM2SAX. This one has an extra Node * parameter to build the Node -> id map. */ public void startElement(String uri, String localName, String qname, Attributes attributes, Node node) throws SAXException { this.startElement(uri, localName, qname, attributes); if (m_buildIdIndex) { _node2Ids.put(node, new Integer(m_parents.peek())); } } /** * SAX2: Receive notification of the beginning of an element. */ public void startElement(String uri, String localName, String qname, Attributes attributes) throws SAXException { super.startElement(uri, localName, qname, attributes); handleTextEscaping(); if (m_wsfilter != null) { // Look for any xml:space attributes // Depending on the implementation of attributes, this // might be faster than looping through all attributes. ILENE final int index = attributes.getIndex(XMLSPACE_STRING); if (index >= 0) { xmlSpaceDefine(attributes.getValue(index), m_parents.peek()); } } } /** * SAX2: Receive notification of the end of an element. */ public void endElement(String namespaceURI, String localName, String qname) throws SAXException { super.endElement(namespaceURI, localName, qname); handleTextEscaping(); // Revert to strip/preserve-space setting from before this element if (m_wsfilter != null) { xmlSpaceRevert(m_previous); } } /** * SAX2: Receive notification of a processing instruction. */ public void processingInstruction(String target, String data) throws SAXException { super.processingInstruction(target, data); handleTextEscaping(); } /** * SAX2: Receive notification of ignorable whitespace in element * content. Similar to characters(char[], int, int). */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { super.ignorableWhitespace(ch, start, length); _textNodeToProcess = getNumberOfNodes(); } /** * SAX2: Begin the scope of a prefix-URI Namespace mapping. */ public void startPrefixMapping(String prefix, String uri) throws SAXException { super.startPrefixMapping(prefix, uri); handleTextEscaping(); definePrefixAndUri(prefix, uri); } private void definePrefixAndUri(String prefix, String uri) throws SAXException { // Check if the URI already exists before pushing on stack Integer eType = new Integer(getIdForNamespace(uri)); if ((Integer)_nsIndex.get(eType) == null) { _nsIndex.put(eType, new Integer(_uriCount++)); } } /** * SAX2: Report an XML comment anywhere in the document. */ public void comment(char[] ch, int start, int length) throws SAXException { super.comment(ch, start, length); handleTextEscaping(); } public boolean setEscaping(boolean value) { final boolean temp = _escaping; _escaping = value; return temp; } /*---------------------------------------------------------------------------*/ /* DOMBuilder methods end */ /*---------------------------------------------------------------------------*/ /** * Prints the whole tree to standard output */ public void print(int node, int level) { switch(getNodeType(node)) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: print(getFirstChild(node), level); break; case DTM.TEXT_NODE: case DTM.COMMENT_NODE: case DTM.PROCESSING_INSTRUCTION_NODE: System.out.print(getStringValueX(node)); break; default: final String name = getNodeName(node); System.out.print("<" + name); for (int a = getFirstAttribute(node); a != DTM.NULL; a = getNextAttribute(a)) { System.out.print("\n" + getNodeName(a) + "=\"" + getStringValueX(a) + "\""); } System.out.print('>'); for (int child = getFirstChild(node); child != DTM.NULL; child = getNextSibling(child)) { print(child, level + 1); } System.out.println("'); break; } } /** * Returns the name of a node (attribute or element). */ public String getNodeName(final int node) { // Get the node type and make sure that it is within limits int nodeh = node; final short type = getNodeType(nodeh); switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: case DTM.TEXT_NODE: case DTM.COMMENT_NODE: return EMPTYSTRING; case DTM.NAMESPACE_NODE: return this.getLocalName(nodeh); default: return super.getNodeName(nodeh); } } /** * Returns the namespace URI to which a node belongs */ public String getNamespaceName(final int node) { if (node == DTM.NULL) { return ""; } String s; return (s = getNamespaceURI(node)) == null ? EMPTYSTRING : s; } /** * Returns the attribute node of a given type (if any) for an element */ public int getAttributeNode(final int type, final int element) { for (int attr = getFirstAttribute(element); attr != DTM.NULL; attr = getNextAttribute(attr)) { if (getExpandedTypeID(attr) == type) return attr; } return DTM.NULL; } /** * Returns the value of a given attribute type of a given element */ public String getAttributeValue(final int type, final int element) { final int attr = getAttributeNode(type, element); return (attr != DTM.NULL) ? getStringValueX(attr) : EMPTYSTRING; } /** * This method is for testing/debugging only */ public String getAttributeValue(final String name, final int element) { return getAttributeValue(getGeneralizedType(name), element); } /** * Returns an iterator with all the children of a given node */ public DTMAxisIterator getChildren(final int node) { return (new ChildrenIterator()).setStartNode(node); } /** * Returns an iterator with all children of a specific type * for a given node (element) */ public DTMAxisIterator getTypedChildren(final int type) { return(new TypedChildrenIterator(type)); } /** * This is a shortcut to the iterators that implement the * supported XPath axes (only namespace::) is not supported. * Returns a bare-bones iterator that must be initialized * with a start node (using iterator.setStartNode()). */ public DTMAxisIterator getAxisIterator(final int axis) { switch (axis) { case Axis.SELF: return new SingletonIterator(); case Axis.CHILD: return new ChildrenIterator(); case Axis.PARENT: return new ParentIterator(); case Axis.ANCESTOR: return new AncestorIterator(); case Axis.ANCESTORORSELF: return (new AncestorIterator()).includeSelf(); case Axis.ATTRIBUTE: return new AttributeIterator(); case Axis.DESCENDANT: return new DescendantIterator(); case Axis.DESCENDANTORSELF: return (new DescendantIterator()).includeSelf(); case Axis.FOLLOWING: return new FollowingIterator(); case Axis.PRECEDING: return new PrecedingIterator(); case Axis.FOLLOWINGSIBLING: return new FollowingSiblingIterator(); case Axis.PRECEDINGSIBLING: return new PrecedingSiblingIterator(); case Axis.NAMESPACE: return new NamespaceIterator(); case Axis.ROOT: return new RootIterator(); default: BasisLibrary.runTimeError(BasisLibrary.AXIS_SUPPORT_ERR, Axis.getNames(axis)); } return null; } /** * Similar to getAxisIterator, but this one returns an iterator * containing nodes of a typed axis (ex.: child::foo) */ public DTMAxisIterator getTypedAxisIterator(int axis, int type) { // Most common case handled first if (axis == Axis.CHILD) { return new TypedChildrenIterator(type); } if (type == NO_TYPE) { return(EMPTYITERATOR); } switch (axis) { case Axis.SELF: return new TypedSingletonIterator(type); case Axis.CHILD: return new TypedChildrenIterator(type); case Axis.PARENT: return new ParentIterator().setNodeType(type); case Axis.ANCESTOR: return new TypedAncestorIterator(type); case Axis.ANCESTORORSELF: return (new TypedAncestorIterator(type)).includeSelf(); case Axis.ATTRIBUTE: return new TypedAttributeIterator(type); case Axis.DESCENDANT: return new TypedDescendantIterator(type); case Axis.DESCENDANTORSELF: return (new TypedDescendantIterator(type)).includeSelf(); case Axis.FOLLOWING: return new TypedFollowingIterator(type); case Axis.PRECEDING: return new TypedPrecedingIterator(type); case Axis.FOLLOWINGSIBLING: return new TypedFollowingSiblingIterator(type); case Axis.PRECEDINGSIBLING: return new TypedPrecedingSiblingIterator(type); case Axis.NAMESPACE: return new TypedNamespaceIterator(type); case Axis.ROOT: return new TypedRootIterator(type); default: BasisLibrary.runTimeError(BasisLibrary.TYPED_AXIS_SUPPORT_ERR, Axis.getNames(axis)); } return null; } /** * Do not think that this returns an iterator for the namespace axis. * It returns an iterator with nodes that belong in a certain namespace, * such as with * The 'axis' specifies the axis for the base iterator from which the * nodes are taken, while 'ns' specifies the namespace URI type. */ public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns) { DTMAxisIterator iterator = null; if (ns == NO_TYPE) { return EMPTYITERATOR; } else { switch (axis) { case Axis.CHILD: return new NamespaceChildrenIterator(ns); case Axis.ATTRIBUTE: return new NamespaceAttributeIterator(ns); default: return new NamespaceWildcardIterator(axis, ns); } } } /** * Iterator that handles node tests that test for a namespace, but have * a wild card for the local name of the node, i.e., node tests of the * form :::* */ public final class NamespaceWildcardIterator extends InternalAxisIteratorBase { /** * The namespace type index. */ protected int m_nsType; /** * A nested typed axis iterator that retrieves nodes of the principal * node kind for that axis. */ protected DTMAxisIterator m_baseIterator; /** * Constructor NamespaceWildcard * * @param axis The axis that this iterator will traverse * @param nsType The namespace type index */ public NamespaceWildcardIterator(int axis, int nsType) { m_nsType = nsType; // Create a nested iterator that will select nodes of // the principal node kind for the selected axis. switch (axis) { case Axis.ATTRIBUTE: { // For "attribute::p:*", the principal node kind is // attribute m_baseIterator = getAxisIterator(axis); } case Axis.NAMESPACE: { // This covers "namespace::p:*". It is syntactically // correct, though it doesn't make much sense. m_baseIterator = getAxisIterator(axis); } default: { // In all other cases, the principal node kind is // element m_baseIterator = getTypedAxisIterator(axis, DTM.ELEMENT_NODE); } } } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = node; m_baseIterator.setStartNode(node); resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node; while ((node = m_baseIterator.next()) != END) { // Return only nodes that are in the selected namespace if (getNSType(node) == m_nsType) { return returnNode(node); } } return END; } /** * Returns a deep copy of this iterator. The cloned iterator is not * reset. * * @return a deep copy of this iterator. */ public DTMAxisIterator cloneIterator() { try { DTMAxisIterator nestedClone = m_baseIterator.cloneIterator(); NamespaceWildcardIterator clone = (NamespaceWildcardIterator) super.clone(); clone.m_baseIterator = nestedClone; clone.m_nsType = m_nsType; clone._isRestartable = false; return clone; } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } /** * True if this iterator has a reversed axis. * * @return true if this iterator is a reversed axis. */ public boolean isReverse() { return m_baseIterator.isReverse(); } public void setMark() { m_baseIterator.setMark(); } public void gotoMark() { m_baseIterator.gotoMark(); } } /** * Iterator that returns children within a given namespace for a * given node. The functionality chould be achieved by putting a * filter on top of a basic child iterator, but a specialised * iterator is used for efficiency (both speed and size of translet). */ public final class NamespaceChildrenIterator extends InternalAxisIteratorBase { /** The extended type ID being requested. */ private final int _nsType; /** * Constructor NamespaceChildrenIterator * * * @param type The extended type ID being requested. */ public NamespaceChildrenIterator(final int type) { _nsType = type; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) { node = getDocument(); } if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : NOTPROCESSED; return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { if (_currentNode != DTM.NULL) { for (int node = (NOTPROCESSED == _currentNode) ? _firstch(makeNodeIdentity(_startNode)) : _nextsib(_currentNode); node != END; node = _nextsib(node)) { int nodeHandle = makeNodeHandle(node); if (getNSType(nodeHandle) == _nsType) { _currentNode = node; return returnNode(nodeHandle); } } } return END; } } // end of NamespaceChildrenIterator /** * Iterator that returns attributes within a given namespace for a node. */ public final class NamespaceAttributeIterator extends InternalAxisIteratorBase { /** The extended type ID being requested. */ private final int _nsType; /** * Constructor NamespaceAttributeIterator * * * @param nsType The extended type ID being requested. */ public NamespaceAttributeIterator(int nsType) { super(); _nsType = nsType; } /** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) { node = getDocument(); } if (_isRestartable) { int nsType = _nsType; _startNode = node; for (node = getFirstAttribute(node); node != END; node = getNextAttribute(node)) { if (getNSType(node) == nsType) { break; } } _currentNode = node; return resetPosition(); } return this; } /** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { int node = _currentNode; int nsType = _nsType; int nextNode; if (node == END) { return END; } for (nextNode = getNextAttribute(node); nextNode != END; nextNode = getNextAttribute(nextNode)) { if (getNSType(nextNode) == nsType) { break; } } _currentNode = nextNode; return returnNode(node); } } // end of NamespaceAttributeIterator /** * Returns an iterator with all descendants of a node that are of * a given type. */ public DTMAxisIterator getTypedDescendantIterator(int type) { return new TypedDescendantIterator(type); } /** * Returns the nth descendant of a node */ public DTMAxisIterator getNthDescendant(int type, int n, boolean includeself) { DTMAxisIterator source = (DTMAxisIterator) new TypedDescendantIterator(type); return new NthDescendantIterator(n); } /** * Copy the string value of a node directly to an output handler */ public void characters(final int node, SerializationHandler handler) throws TransletException { if (node != DTM.NULL) { try { dispatchCharactersEvents(node, handler, false); } catch (SAXException e) { throw new TransletException(e); } } } /** * Copy a node-set to an output handler */ public void copy(DTMAxisIterator nodes, SerializationHandler handler) throws TransletException { int node; while ((node = nodes.next()) != DTM.NULL) { copy(node, handler); } } /** * Copy the whole tree to an output handler */ public void copy(SerializationHandler handler) throws TransletException { copy(getDocument(), handler); } /** * Performs a deep copy (ref. XSLs copy-of()) * * TODO: Copy namespace declarations. Can't be done until we * add namespace nodes and keep track of NS prefixes * TODO: Copy comment nodes */ public void copy(final int node, SerializationHandler handler) throws TransletException { copy(node, handler, false ); } private final void copy(final int node, SerializationHandler handler, boolean isChild) throws TransletException { int nodeID = makeNodeIdentity(node); int eType = _exptype2(nodeID); int type = _exptype2Type(eType); try { switch(type) { case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } break; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); break; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); break; case DTM.TEXT_NODE: boolean oldEscapeSetting = false; boolean escapeBit = false; if (_dontEscape != null) { escapeBit = _dontEscape.getBit(getNodeIdent(node)); if (escapeBit) { oldEscapeSetting = handler.setEscaping(false); } } copyTextNode(nodeID, handler); if (escapeBit) { handler.setEscaping(oldEscapeSetting); } break; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, eType, handler); break; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); break; default: if (type == DTM.ELEMENT_NODE) { // Start element definition final String name = copyElement(nodeID, eType, handler); //if(isChild) => not to copy any namespaces from parents // else copy all namespaces in scope copyNS(nodeID, handler,!isChild); copyAttributes(nodeID, handler); // Copy element children for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) { copy(makeNodeHandle(c), handler, true); } // Close element definition handler.endElement(name); } // Shallow copy of attribute to output handler else { final String uri = getNamespaceName(node); if (uri.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri); } handler.addAttribute(getNodeName(node), getNodeValue(node)); } break; } } catch (Exception e) { throw new TransletException(e); } } /** * Copies a processing instruction node to an output handler */ private void copyPI(final int node, SerializationHandler handler) throws TransletException { final String target = getNodeName(node); final String value = getStringValueX(node); try { handler.processingInstruction(target, value); } catch (Exception e) { throw new TransletException(e); } } /** * Performs a shallow copy (ref. XSLs copy()) */ public String shallowCopy(final int node, SerializationHandler handler) throws TransletException { int nodeID = makeNodeIdentity(node); int exptype = _exptype2(nodeID); int type = _exptype2Type(exptype); try { switch(type) { case DTM.ELEMENT_NODE: final String name = copyElement(nodeID, exptype, handler); copyNS(nodeID, handler, true); return name; case DTM.ROOT_NODE: case DTM.DOCUMENT_NODE: return EMPTYSTRING; case DTM.TEXT_NODE: copyTextNode(nodeID, handler); return null; case DTM.PROCESSING_INSTRUCTION_NODE: copyPI(node, handler); return null; case DTM.COMMENT_NODE: handler.comment(getStringValueX(node)); return null; case DTM.NAMESPACE_NODE: handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node)); return null; case DTM.ATTRIBUTE_NODE: copyAttribute(nodeID, exptype, handler); return null; default: final String uri1 = getNamespaceName(node); if (uri1.length() != 0) { final String prefix = getPrefix(node); handler.namespaceAfterStartElement(prefix, uri1); } handler.addAttribute(getNodeName(node), getNodeValue(node)); return null; } } catch (Exception e) { throw new TransletException(e); } } /** * Returns a node' defined language for a node (if any) */ public String getLanguage(int node) { int parent = node; while (DTM.NULL != parent) { if (DTM.ELEMENT_NODE == getNodeType(parent)) { int langAttr = getAttributeNode(parent, "http://www.w3.org/XML/1998/namespace", "lang"); if (DTM.NULL != langAttr) { return getNodeValue(langAttr); } } parent = getParent(parent); } return(null); } /** * Returns an instance of the DOMBuilder inner class * This class will consume the input document through a SAX2 * interface and populate the tree. */ public DOMBuilder getBuilder() { return this; } /** * Return a SerializationHandler for output handling. * This method is used by Result Tree Fragments. */ public SerializationHandler getOutputDomBuilder() { return new ToXMLSAXHandler(this, "UTF-8"); } /** * Return a instance of a DOM class to be used as an RTF */ public DOM getResultTreeFrag(int initSize, int rtfType) { return getResultTreeFrag(initSize, rtfType, true); } /** * Return a instance of a DOM class to be used as an RTF * * @param initSize The initial size of the DOM. * @param rtfType The type of the RTF * @param addToManager true if the RTF should be registered with the DTMManager. * @return The DOM object which represents the RTF. */ public DOM getResultTreeFrag(int initSize, int rtfType, boolean addToManager) { if (rtfType == DOM.SIMPLE_RTF) { if (addToManager) { int dtmPos = _dtmManager.getFirstFreeDTMID(); SimpleResultTreeImpl rtf = new SimpleResultTreeImpl(_dtmManager, dtmPos << DTMManager.IDENT_DTM_NODE_BITS); _dtmManager.addDTM(rtf, dtmPos, 0); return rtf; } else { return new SimpleResultTreeImpl(_dtmManager, 0); } } else if (rtfType == DOM.ADAPTIVE_RTF) { if (addToManager) { int dtmPos = _dtmManager.getFirstFreeDTMID(); AdaptiveResultTreeImpl rtf = new AdaptiveResultTreeImpl(_dtmManager, dtmPos << DTMManager.IDENT_DTM_NODE_BITS, m_wsfilter, initSize, m_buildIdIndex); _dtmManager.addDTM(rtf, dtmPos, 0); return rtf; } else { return new AdaptiveResultTreeImpl(_dtmManager, 0, m_wsfilter, initSize, m_buildIdIndex); } } else { return (DOM) _dtmManager.getDTM(null, true, m_wsfilter, true, false, false, initSize, m_buildIdIndex); } } /** * %HZ% Need Javadoc */ public Hashtable getElementsWithIDs() { if (m_idAttributes == null) { return null; } // Convert a java.util.Hashtable to an xsltc.runtime.Hashtable Enumeration idValues = m_idAttributes.keys(); if (!idValues.hasMoreElements()) { return null; } Hashtable idAttrsTable = new Hashtable(); while (idValues.hasMoreElements()) { Object idValue = idValues.nextElement(); idAttrsTable.put(idValue, m_idAttributes.get(idValue)); } return idAttrsTable; } /** * The getUnparsedEntityURI function returns the URI of the unparsed * entity with the specified name in the same document as the context * node (see [3.3 Unparsed Entities]). It returns the empty string if * there is no such entity. */ public String getUnparsedEntityURI(String name) { // Special handling for DOM input if (_document != null) { String uri = ""; DocumentType doctype = _document.getDoctype(); if (doctype != null) { NamedNodeMap entities = doctype.getEntities(); if (entities == null) { return uri; } Entity entity = (Entity) entities.getNamedItem(name); if (entity == null) { return uri; } String notationName = entity.getNotationName(); if (notationName != null) { uri = entity.getSystemId(); if (uri == null) { uri = entity.getPublicId(); } } } return uri; } else { return super.getUnparsedEntityURI(name); } } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/DupFilterIterator.java0000644000175000017500000001134210721374032025371 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DupFilterIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xalan.xsltc.util.IntegerArray; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; import org.apache.xml.dtm.ref.DTMDefaultBase; /** * Removes duplicates and sorts a source iterator. The nodes from the * source are collected in an array upon calling setStartNode(). This * array is later sorted and duplicates are ignored in next(). * @author G. Todd Miller */ public final class DupFilterIterator extends DTMAxisIteratorBase { /** * Reference to source iterator. */ private DTMAxisIterator _source; /** * Array to cache all nodes from source. */ private IntegerArray _nodes = new IntegerArray(); /** * Index in _nodes array to current node. */ private int _current = 0; /** * Cardinality of _nodes array. */ private int _nodesSize = 0; /** * Last value returned by next(). */ private int _lastNext = END; /** * Temporary variable to store _lastNext. */ private int _markedLastNext = END; public DupFilterIterator(DTMAxisIterator source) { _source = source; // System.out.println("DFI source = " + source + " this = " + this); // Cache contents of id() or key() index right away. Necessary for // union expressions containing multiple calls to the same index, and // correct as well since start-node is irrelevant for id()/key() exrp. if (source instanceof KeyIndex) { setStartNode(DTMDefaultBase.ROOTNODE); } } /** * Set the start node for this iterator * @param node The start node * @return A reference to this node iterator */ public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { // KeyIndex iterators are always relative to the root node, so there // is never any point in re-reading the iterator (and we SHOULD NOT). boolean sourceIsKeyIndex = _source instanceof KeyIndex; if (sourceIsKeyIndex && _startNode == DTMDefaultBase.ROOTNODE) { return this; } if (node != _startNode) { _source.setStartNode(_startNode = node); _nodes.clear(); while ((node = _source.next()) != END) { _nodes.add(node); } // Nodes produced by KeyIndex are known to be in document order. // Take advantage of it. if (!sourceIsKeyIndex) { _nodes.sort(); } _nodesSize = _nodes.cardinality(); _current = 0; _lastNext = END; resetPosition(); } } return this; } public int next() { while (_current < _nodesSize) { final int next = _nodes.at(_current++); if (next != _lastNext) { return returnNode(_lastNext = next); } } return END; } public DTMAxisIterator cloneIterator() { try { final DupFilterIterator clone = (DupFilterIterator) super.clone(); clone._nodes = (IntegerArray) _nodes.clone(); clone._source = _source.cloneIterator(); clone._isRestartable = false; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public void setMark() { _markedNode = _current; _markedLastNext = _lastNext; // Bugzilla 25924 } public void gotoMark() { _current = _markedNode; _lastNext = _markedLastNext; // Bugzilla 25924 } public DTMAxisIterator reset() { _current = 0; _lastNext = END; return resetPosition(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/UnionIterator.java0000644000175000017500000000572210721374032024570 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: UnionIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * UnionIterator takes a set of NodeIterators and produces * a merged NodeSet in document order with duplicates removed * The individual iterators are supposed to generate nodes * in document order * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class UnionIterator extends MultiValuedNodeHeapIterator { /** wrapper for NodeIterators to support iterator comparison on the value of their next() method */ final private DOM _dom; private final class LookAheadIterator extends MultiValuedNodeHeapIterator.HeapNode { public DTMAxisIterator iterator; public LookAheadIterator(DTMAxisIterator iterator) { super(); this.iterator = iterator; } public int step() { _node = iterator.next(); return _node; } public HeapNode cloneHeapNode() { LookAheadIterator clone = (LookAheadIterator) super.cloneHeapNode(); clone.iterator = iterator.cloneIterator(); return clone; } public void setMark() { super.setMark(); iterator.setMark(); } public void gotoMark() { super.gotoMark(); iterator.gotoMark(); } public boolean isLessThan(HeapNode heapNode) { LookAheadIterator comparand = (LookAheadIterator) heapNode; return _dom.lessThan(_node, heapNode._node); } public HeapNode setStartNode(int node) { iterator.setStartNode(node); return this; } public HeapNode reset() { iterator.reset(); return this; } } // end of LookAheadIterator public UnionIterator(DOM dom) { _dom = dom; } public UnionIterator addIterator(DTMAxisIterator iterator) { addHeapNode(new LookAheadIterator(iterator)); return this; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/AbsoluteIterator.java0000644000175000017500000000605610721374031025256 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: AbsoluteIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xalan.xsltc.runtime.BasisLibrary; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; import org.apache.xml.dtm.ref.DTMDefaultBase; /** * Absolute iterators ignore the node that is passed to setStartNode(). * Instead, they always start from the root node. The node passed to * setStartNode() is not totally useless, though. It is needed to obtain the * DOM mask, i.e. the index into the MultiDOM table that corresponds to the * DOM "owning" the node. * * The DOM mask is cached, so successive calls to setStartNode() passing * nodes from other DOMs will have no effect (i.e. this iterator cannot * migrate between DOMs). * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public final class AbsoluteIterator extends DTMAxisIteratorBase { /** * Source for this iterator. */ private DTMAxisIterator _source; public AbsoluteIterator(DTMAxisIterator source) { _source = source; // System.out.println("AI source = " + source + " this = " + this); } public void setRestartable(boolean isRestartable) { _isRestartable = isRestartable; _source.setRestartable(isRestartable); } public DTMAxisIterator setStartNode(int node) { _startNode = DTMDefaultBase.ROOTNODE; if (_isRestartable) { _source.setStartNode(_startNode); resetPosition(); } return this; } public int next() { return returnNode(_source.next()); } public DTMAxisIterator cloneIterator() { try { final AbsoluteIterator clone = (AbsoluteIterator) super.clone(); clone._source = _source.cloneIterator(); // resets source clone.resetPosition(); clone._isRestartable = false; return clone; } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } public DTMAxisIterator reset() { _source.reset(); return resetPosition(); } public void setMark() { _source.setMark(); } public void gotoMark() { _source.gotoMark(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/FilteredStepIterator.java0000644000175000017500000000317410721374033026072 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: FilteredStepIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xml.dtm.DTMAxisIterator; /** * Extends a StepIterator by adding the ability to filter nodes. It * uses filters similar to those of a FilterIterator. * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public final class FilteredStepIterator extends StepIterator { private Filter _filter; public FilteredStepIterator(DTMAxisIterator source, DTMAxisIterator iterator, Filter filter) { super(source, iterator); _filter = filter; } public int next() { int node; while ((node = super.next()) != END) { if (_filter.test(node)) { return returnNode(node); } } return node; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/NodeCounter.java0000644000175000017500000002557310721374033024222 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NodeCounter.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.util.Vector; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.Axis; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @author Morten Jorgensen */ public abstract class NodeCounter { public static final int END = DTM.NULL; protected int _node = END; protected int _nodeType = DOM.FIRST_TYPE - 1; protected double _value = Integer.MIN_VALUE; public final DOM _document; public final DTMAxisIterator _iterator; public final Translet _translet; protected String _format; protected String _lang; protected String _letterValue; protected String _groupSep; protected int _groupSize; private boolean _separFirst = true; private boolean _separLast = false; private Vector _separToks = new Vector(); private Vector _formatToks = new Vector(); private int _nSepars = 0; private int _nFormats = 0; private final static String[] Thousands = {"", "m", "mm", "mmm" }; private final static String[] Hundreds = {"", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm"}; private final static String[] Tens = {"", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc"}; private final static String[] Ones = {"", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix"}; private StringBuffer _tempBuffer = new StringBuffer(); protected NodeCounter(Translet translet, DOM document, DTMAxisIterator iterator) { _translet = translet; _document = document; _iterator = iterator; } /** * Set the start node for this counter. The same NodeCounter * object can be used multiple times by resetting the starting node. */ abstract public NodeCounter setStartNode(int node); /** * If the user specified a value attribute, use this instead of * counting nodes. */ public NodeCounter setValue(double value) { _value = value; return this; } /** * Sets formatting fields before calling formatNumbers(). */ protected void setFormatting(String format, String lang, String letterValue, String groupSep, String groupSize) { _lang = lang; _groupSep = groupSep; _letterValue = letterValue; try { _groupSize = Integer.parseInt(groupSize); } catch (NumberFormatException e) { _groupSize = 0; } setTokens(format); } // format == null assumed here private final void setTokens(final String format){ if( (_format!=null) &&(format.equals(_format)) ){// has already been set return; } _format = format; // reset final int length = _format.length(); boolean isFirst = true; _separFirst = true; _separLast = false; _nSepars = 0; _nFormats = 0; _separToks.clear() ; _formatToks.clear(); /* * Tokenize the format string into alphanumeric and non-alphanumeric * tokens as described in M. Kay page 241. */ for (int j = 0, i = 0; i < length;) { char c = format.charAt(i); for (j = i; Character.isLetterOrDigit(c);) { if (++i == length) break; c = format.charAt(i); } if (i > j) { if (isFirst) { _separToks.addElement("."); isFirst = _separFirst = false; } _formatToks.addElement(format.substring(j, i)); } if (i == length) break; c = format.charAt(i); for (j = i; !Character.isLetterOrDigit(c);) { if (++i == length) break; c = format.charAt(i); isFirst = false; } if (i > j) { _separToks.addElement(format.substring(j, i)); } } _nSepars = _separToks.size(); _nFormats = _formatToks.size(); if (_nSepars > _nFormats) _separLast = true; if (_separFirst) _nSepars--; if (_separLast) _nSepars--; if (_nSepars == 0) { _separToks.insertElementAt(".", 1); _nSepars++; } if (_separFirst) _nSepars ++; } /** * Sets formatting fields to their default values. */ public NodeCounter setDefaultFormatting() { setFormatting("1", "en", "alphabetic", null, null); return this; } /** * Returns the position of node according to the level and * the from and count patterns. */ abstract public String getCounter(); /** * Returns the position of node according to the level and * the from and count patterns. This position is converted into a * string based on the arguments passed. */ public String getCounter(String format, String lang, String letterValue, String groupSep, String groupSize) { setFormatting(format, lang, letterValue, groupSep, groupSize); return getCounter(); } /** * Returns true if node matches the count pattern. By * default a node matches the count patterns if it is of the * same type as the starting node. */ public boolean matchesCount(int node) { return _nodeType == _document.getExpandedTypeID(node); } /** * Returns true if node matches the from pattern. By default, * no node matches the from pattern. */ public boolean matchesFrom(int node) { return false; } /** * Format a single value according to the format parameters. */ protected String formatNumbers(int value) { return formatNumbers(new int[] { value }); } /** * Format a sequence of values according to the format paramaters * set by calling setFormatting(). */ protected String formatNumbers(int[] values) { final int nValues = values.length; final int length = _format.length(); boolean isEmpty = true; for (int i = 0; i < nValues; i++) if (values[i] != Integer.MIN_VALUE) isEmpty = false; if (isEmpty) return(""); // Format the output string using the values array and the fmt. tokens boolean isFirst = true; int t = 0, n = 0, s = 1; _tempBuffer.setLength(0); final StringBuffer buffer = _tempBuffer; // Append separation token before first digit/letter/numeral if (_separFirst) buffer.append((String)_separToks.elementAt(0)); // Append next digit/letter/numeral and separation token while (n < nValues) { final int value = values[n]; if (value != Integer.MIN_VALUE) { if (!isFirst) buffer.append((String) _separToks.elementAt(s++)); formatValue(value, (String)_formatToks.elementAt(t++), buffer); if (t == _nFormats) t--; if (s >= _nSepars) s--; isFirst = false; } n++; } // Append separation token after last digit/letter/numeral if (_separLast) buffer.append((String)_separToks.lastElement()); return buffer.toString(); } /** * Format a single value based on the appropriate formatting token. * This method is based on saxon (Michael Kay) and only implements * lang="en". */ private void formatValue(int value, String format, StringBuffer buffer) { char c = format.charAt(0); if (Character.isDigit(c)) { char zero = (char)(c - Character.getNumericValue(c)); StringBuffer temp = buffer; if (_groupSize > 0) { temp = new StringBuffer(); } String s = ""; int n = value; while (n > 0) { s = (char) ((int) zero + (n % 10)) + s; n = n / 10; } for (int i = 0; i < format.length() - s.length(); i++) { temp.append(zero); } temp.append(s); if (_groupSize > 0) { for (int i = 0; i < temp.length(); i++) { if (i != 0 && ((temp.length() - i) % _groupSize) == 0) { buffer.append(_groupSep); } buffer.append(temp.charAt(i)); } } } else if (c == 'i' && !_letterValue.equals("alphabetic")) { buffer.append(romanValue(value)); } else if (c == 'I' && !_letterValue.equals("alphabetic")) { buffer.append(romanValue(value).toUpperCase()); } else { int min = (int) c; int max = (int) c; // Special case for Greek alphabet if (c >= 0x3b1 && c <= 0x3c9) { max = 0x3c9; // omega } else { // General case: search for end of group while (Character.isLetterOrDigit((char) (max + 1))) { max++; } } buffer.append(alphaValue(value, min, max)); } } private String alphaValue(int value, int min, int max) { if (value <= 0) { return "" + value; } int range = max - min + 1; char last = (char)(((value-1) % range) + min); if (value > range) { return alphaValue((value-1) / range, min, max) + last; } else { return "" + last; } } private String romanValue(int n) { if (n <= 0 || n > 4000) { return "" + n; } return Thousands[n / 1000] + Hundreds[(n / 100) % 10] + Tens[(n/10) % 10] + Ones[n % 10]; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/ObjectFactory.java0000644000175000017500000006376510721374032024537 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468651 2006-10-28 07:04:25Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = -5948733402959678002L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SortSettings.java0000644000175000017500000001064510721374030024434 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SortSettings.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import java.text.Collator; import java.util.Locale; import org.apache.xalan.xsltc.runtime.AbstractTranslet; /** * Class for carrying settings that are to be used for a particular set * of xsl:sort elements. */ final class SortSettings { /** * A reference to the translet object for the transformation. */ private AbstractTranslet _translet; /** * The sort order (ascending or descending) for each level of * xsl:sort */ private int[] _sortOrders; /** * The type of comparison (text or number) for each level of * xsl:sort */ private int[] _types; /** * The Locale for each level of xsl:sort, based on any lang * attribute or the default Locale. */ private Locale[] _locales; /** * The Collator object in effect for each level of xsl:sort */ private Collator[] _collators; /** * Case ordering for each level of xsl:sort. */ private String[] _caseOrders; /** * Create an instance of SortSettings. * @param translet {@link org.apache.xalan.xsltc.runtime.AbstractTranslet} * object for the transformation * @param sortOrders an array specifying the sort order for each sort level * @param types an array specifying the type of comparison for each sort * level (text or number) * @param locales an array specifying the Locale for each sort level * @param collators an array specifying the Collation in effect for each * sort level * @param caseOrders an array specifying whether upper-case, lower-case * or neither is to take precedence for each sort level. * The value of each element is equal to one of * "upper-first", "lower-first", or "". */ SortSettings(AbstractTranslet translet, int[] sortOrders, int[] types, Locale[] locales, Collator[] collators, String[] caseOrders) { _translet = translet; _sortOrders = sortOrders; _types = types; _locales = locales; _collators = collators; _caseOrders = caseOrders; } /** * @return A reference to the translet object for the transformation. */ AbstractTranslet getTranslet() { return _translet; } /** * @return An array containing the sort order (ascending or descending) * for each level of xsl:sort */ int[] getSortOrders() { return _sortOrders; } /** * @return An array containing the type of comparison (text or number) * to perform for each level of xsl:sort */ int[] getTypes() { return _types; } /** * @return An array containing the Locale object in effect for each level * of xsl:sort */ Locale[] getLocales() { return _locales; } /** * @return An array containing the Collator object in effect for each level * of xsl:sort */ Collator[] getCollators() { return _collators; } /** * @return An array specifying the case ordering for each level of * xsl:sort. */ String[] getCaseOrders() { return _caseOrders; } } libxalan2-java-2.7.1/src/org/apache/xalan/xsltc/dom/SingletonIterator.java0000644000175000017500000000464710721374031025446 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SingletonIterator.java 468651 2006-10-28 07:04:25Z minchau $ */ package org.apache.xalan.xsltc.dom; import org.apache.xml.dtm.DTMAxisIterator; import org.apache.xml.dtm.ref.DTMAxisIteratorBase; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public class SingletonIterator extends DTMAxisIteratorBase { private int _node; private final boolean _isConstant; public SingletonIterator() { this(Integer.MIN_VALUE, false); } public SingletonIterator(int node) { this(node, false); } public SingletonIterator(int node, boolean constant) { _node = _startNode = node; _isConstant = constant; } /** * Override the value of _node only when this * object was constructed using the empty constructor. */ public DTMAxisIterator setStartNode(int node) { if (_isConstant) { _node = _startNode; return resetPosition(); } else if (_isRestartable) { if (_node <= 0) _node = _startNode = node; return resetPosition(); } return this; } public DTMAxisIterator reset() { if (_isConstant) { _node = _startNode; return resetPosition(); } else { final boolean temp = _isRestartable; _isRestartable = true; setStartNode(_startNode); _isRestartable = temp; } return this; } public int next() { final int result = _node; _node = DTMAxisIterator.END; return returnNode(result); } public void setMark() { _markedNode = _node; } public void gotoMark() { _node = _markedNode; } } libxalan2-java-2.7.1/src/org/apache/xalan/xslt/0000755000175000017500000000000010736146354020205 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/xslt/SecuritySupport.java0000644000175000017500000000744710721374033024257 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport.java 468646 2006-10-28 06:57:58Z minchau $ */ package org.apache.xalan.xslt; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Base class with security related methods that work on JDK 1.1. */ class SecuritySupport { /* * Make this of type Object so that the verifier won't try to * prove its type, thus possibly trying to load the SecuritySupport12 * class. */ private static final Object securitySupport; static { SecuritySupport ss = null; try { Class c = Class.forName("java.security.AccessController"); // if that worked, we're on 1.2. /* // don't reference the class explicitly so it doesn't // get dragged in accidentally. c = Class.forName("javax.mail.SecuritySupport12"); Constructor cons = c.getConstructor(new Class[] { }); ss = (SecuritySupport)cons.newInstance(new Object[] { }); */ /* * Unfortunately, we can't load the class using reflection * because the class is package private. And the class has * to be package private so the APIs aren't exposed to other * code that could use them to circumvent security. Thus, * we accept the risk that the direct reference might fail * on some JDK 1.1 JVMs, even though we would never execute * this code in such a case. Sigh... */ ss = new SecuritySupport12(); } catch (Exception ex) { // ignore it } finally { if (ss == null) ss = new SecuritySupport(); securitySupport = ss; } } /** * Return an appropriate instance of this class, depending on whether * we're on a JDK 1.1 or J2SE 1.2 (or later) system. */ static SecuritySupport getInstance() { return (SecuritySupport)securitySupport; } ClassLoader getContextClassLoader() { return null; } ClassLoader getSystemClassLoader() { return null; } ClassLoader getParentClassLoader(ClassLoader cl) { return null; } String getSystemProperty(String propName) { return System.getProperty(propName); } FileInputStream getFileInputStream(File file) throws FileNotFoundException { return new FileInputStream(file); } InputStream getResourceAsStream(ClassLoader cl, String name) { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } boolean getFileExists(File f) { return f.exists(); } long getLastModified(File f) { return f.lastModified(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xslt/SecuritySupport12.java0000644000175000017500000001175410721374031024414 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: SecuritySupport12.java 468646 2006-10-28 06:57:58Z minchau $ */ package org.apache.xalan.xslt; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Properties; /** * This class is duplicated for each Xalan-Java subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the Xalan-Java * API. * * Security related methods that only work on J2SE 1.2 and newer. */ class SecuritySupport12 extends SecuritySupport { ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); } ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) {} return cl; } }); } ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) {} // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); } String getSystemProperty(final String propName) { return (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty(propName); } }); } FileInputStream getFileInputStream(final File file) throws FileNotFoundException { try { return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws FileNotFoundException { return new FileInputStream(file); } }); } catch (PrivilegedActionException e) { throw (FileNotFoundException)e.getException(); } } InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = ClassLoader.getSystemResourceAsStream(name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); } boolean getFileExists(final File f) { return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Boolean(f.exists()); } })).booleanValue(); } long getLastModified(final File f) { return ((Long) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return new Long(f.lastModified()); } })).longValue(); } } libxalan2-java-2.7.1/src/org/apache/xalan/xslt/EnvironmentCheck.java0000644000175000017500000013225010721374031024302 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: EnvironmentCheck.java 468646 2006-10-28 06:57:58Z minchau $ */ package org.apache.xalan.xslt; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Enumeration; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * Utility class to report simple information about the environment. * Simplistic reporting about certain classes found in your JVM may * help answer some FAQs for simple problems. * *

        Usage-command line: * * java org.apache.xalan.xslt.EnvironmentCheck [-out outFile] *

        * *

        Usage-from program: * * boolean environmentOK = * (new EnvironmentCheck()).checkEnvironment(yourPrintWriter); *

        * *

        Usage-from stylesheet: *

         *    <?xml version="1.0"?>
         *    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
         *        xmlns:xalan="http://xml.apache.org/xalan"
         *        exclude-result-prefixes="xalan">
         *    <xsl:output indent="yes"/>
         *    <xsl:template match="/">
         *      <xsl:copy-of select="xalan:checkEnvironment()"/>
         *    </xsl:template>
         *    </xsl:stylesheet>
         * 

        * *

        Xalan users reporting problems are encouraged to use this class * to see if there are potential problems with their actual * Java environment before reporting a bug. Note that you * should both check from the JVM/JRE's command line as well as * temporarily calling checkEnvironment() directly from your code, * since the classpath may differ (especially for servlets, etc).

        * *

        Also see http://xml.apache.org/xalan-j/faq.html

        * *

        Note: This class is pretty simplistic: * results are not necessarily definitive nor will it find all * problems related to environment setup. Also, you should avoid * calling this in deployed production code, both because it is * quite slow and because it forces classes to get loaded.

        * *

        Note: This class explicitly has very limited compile-time * dependencies to enable easy compilation and usage even when * Xalan, DOM/SAX/JAXP, etc. are not present.

        * *

        Note: for an improved version of this utility, please see * the xml-commons' project Which utility which does the same kind * of thing but in a much simpler manner.

        * * @author Shane_Curcuru@us.ibm.com * @version $Id: EnvironmentCheck.java 468646 2006-10-28 06:57:58Z minchau $ */ public class EnvironmentCheck { /** * Command line runnability: checks for [-out outFilename] arg. *

        Command line entrypoint; Sets output and calls * {@link #checkEnvironment(PrintWriter)}.

        * @param args command line args */ public static void main(String[] args) { // Default to System.out, autoflushing PrintWriter sendOutputTo = new PrintWriter(System.out, true); // Read our simplistic input args, if supplied for (int i = 0; i < args.length; i++) { if ("-out".equalsIgnoreCase(args[i])) { i++; if (i < args.length) { try { sendOutputTo = new PrintWriter(new FileWriter(args[i], true)); } catch (Exception e) { System.err.println("# WARNING: -out " + args[i] + " threw " + e.toString()); } } else { System.err.println( "# WARNING: -out argument should have a filename, output sent to console"); } } } EnvironmentCheck app = new EnvironmentCheck(); app.checkEnvironment(sendOutputTo); } /** * Programmatic entrypoint: Report on basic Java environment * and CLASSPATH settings that affect Xalan. * *

        Note that this class is not advanced enough to tell you * everything about the environment that affects Xalan, and * sometimes reports errors that will not actually affect * Xalan's behavior. Currently, it very simplistically * checks the JVM's environment for some basic properties and * logs them out; it will report a problem if it finds a setting * or .jar file that is likely to cause problems.

        * *

        Advanced users can peruse the code herein to help them * investigate potential environment problems found; other users * may simply send the output from this tool along with any bugs * they submit to help us in the debugging process.

        * * @param pw PrintWriter to send output to; can be sent to a * file that will look similar to a Properties file; defaults * to System.out if null * @return true if your environment appears to have no major * problems; false if potential environment problems found * @see #getEnvironmentHash() */ public boolean checkEnvironment(PrintWriter pw) { // Use user-specified output writer if non-null if (null != pw) outWriter = pw; // Setup a hash to store various environment information in Hashtable hash = getEnvironmentHash(); // Check for ERROR keys in the hashtable, and print report boolean environmentHasErrors = writeEnvironmentReport(hash); if (environmentHasErrors) { // Note: many logMsg calls have # at the start to // fake a property-file like output logMsg("# WARNING: Potential problems found in your environment!"); logMsg("# Check any 'ERROR' items above against the Xalan FAQs"); logMsg("# to correct potential problems with your classes/jars"); logMsg("# http://xml.apache.org/xalan-j/faq.html"); if (null != outWriter) outWriter.flush(); return false; } else { logMsg("# YAHOO! Your environment seems to be OK."); if (null != outWriter) outWriter.flush(); return true; } } /** * Fill a hash with basic environment settings that affect Xalan. * *

        Worker method called from various places.

        *

        Various system and CLASSPATH, etc. properties are put into * the hash as keys with a brief description of the current state * of that item as the value. Any serious problems will be put in * with a key that is prefixed with {@link #ERROR 'ERROR.'} so it * stands out in any resulting report; also a key with just that * constant will be set as well for any error.

        *

        Note that some legitimate cases are flaged as potential * errors - namely when a developer recompiles xalan.jar on their * own - and even a non-error state doesn't guaruntee that * everything in the environment is correct. But this will help * point out the most common classpath and system property * problems that we've seen.

        * * @return Hashtable full of useful environment info about Xalan * and related system properties, etc. */ public Hashtable getEnvironmentHash() { // Setup a hash to store various environment information in Hashtable hash = new Hashtable(); // Call various worker methods to fill in the hash // These are explicitly separate for maintenance and so // advanced users could call them standalone checkJAXPVersion(hash); checkProcessorVersion(hash); checkParserVersion(hash); checkAntVersion(hash); checkDOMVersion(hash); checkSAXVersion(hash); checkSystemProperties(hash); return hash; } /** * Dump a basic Xalan environment report to outWriter. * *

        This dumps a simple header and then each of the entries in * the Hashtable to our PrintWriter; it does special processing * for entries that are .jars found in the classpath.

        * * @param h Hashtable of items to report on; presumably * filled in by our various check*() methods * @return true if your environment appears to have no major * problems; false if potential environment problems found * @see #appendEnvironmentReport(Node, Document, Hashtable) * for an equivalent that appends to a Node instead */ protected boolean writeEnvironmentReport(Hashtable h) { if (null == h) { logMsg("# ERROR: writeEnvironmentReport called with null Hashtable"); return false; } boolean errors = false; logMsg( "#---- BEGIN writeEnvironmentReport($Revision$): Useful stuff found: ----"); // Fake the Properties-like output for (Enumeration keys = h.keys(); keys.hasMoreElements(); /* no increment portion */ ) { Object key = keys.nextElement(); String keyStr = (String) key; try { // Special processing for classes found.. if (keyStr.startsWith(FOUNDCLASSES)) { Vector v = (Vector) h.get(keyStr); errors |= logFoundJars(v, keyStr); } // ..normal processing for all other entries else { // Note: we could just check for the ERROR key by itself, // since we now set that, but since we have to go // through the whole hash anyway, do it this way, // which is safer for maintenance if (keyStr.startsWith(ERROR)) { errors = true; } logMsg(keyStr + "=" + h.get(keyStr)); } } catch (Exception e) { logMsg("Reading-" + key + "= threw: " + e.toString()); } } logMsg( "#----- END writeEnvironmentReport: Useful properties found: -----"); return errors; } /** Prefixed to hash keys that signify serious problems. */ public static final String ERROR = "ERROR."; /** Added to descriptions that signify potential problems. */ public static final String WARNING = "WARNING."; /** Value for any error found. */ public static final String ERROR_FOUND = "At least one error was found!"; /** Prefixed to hash keys that signify version numbers. */ public static final String VERSION = "version."; /** Prefixed to hash keys that signify .jars found in classpath. */ public static final String FOUNDCLASSES = "foundclasses."; /** Marker that a class or .jar was found. */ public static final String CLASS_PRESENT = "present-unknown-version"; /** Marker that a class or .jar was not found. */ public static final String CLASS_NOTPRESENT = "not-present"; /** Listing of common .jar files that include Xalan-related classes. */ public String[] jarNames = { "xalan.jar", "xalansamples.jar", "xalanj1compat.jar", "xalanservlet.jar", "serializer.jar", // Serializer (shared between Xalan & Xerces) "xerces.jar", // Xerces-J 1.x "xercesImpl.jar", // Xerces-J 2.x "testxsl.jar", "crimson.jar", "lotusxsl.jar", "jaxp.jar", "parser.jar", "dom.jar", "sax.jar", "xml.jar", "xml-apis.jar", "xsltc.jar" }; /** * Print out report of .jars found in a classpath. * * Takes the information encoded from a checkPathForJars() * call and dumps it out to our PrintWriter. * * @param v Vector of Hashtables of .jar file info * @param desc description to print out in header * * @return false if OK, true if any .jars were reported * as having errors * @see #checkPathForJars(String, String[]) */ protected boolean logFoundJars(Vector v, String desc) { if ((null == v) || (v.size() < 1)) return false; boolean errors = false; logMsg("#---- BEGIN Listing XML-related jars in: " + desc + " ----"); for (int i = 0; i < v.size(); i++) { Hashtable subhash = (Hashtable) v.elementAt(i); for (Enumeration keys = subhash.keys(); keys.hasMoreElements(); /* no increment portion */ ) { Object key = keys.nextElement(); String keyStr = (String) key; try { if (keyStr.startsWith(ERROR)) { errors = true; } logMsg(keyStr + "=" + subhash.get(keyStr)); } catch (Exception e) { errors = true; logMsg("Reading-" + key + "= threw: " + e.toString()); } } } logMsg("#----- END Listing XML-related jars in: " + desc + " -----"); return errors; } /** * Stylesheet extension entrypoint: Dump a basic Xalan * environment report from getEnvironmentHash() to a Node. * *

        Copy of writeEnvironmentReport that creates a Node suitable * for other processing instead of a properties-like text output. *

        * @param container Node to append our report to * @param factory Document providing createElement, etc. services * @param h Hash presumably from {@link #getEnvironmentHash()} * @see #writeEnvironmentReport(Hashtable) * for an equivalent that writes to a PrintWriter instead */ public void appendEnvironmentReport(Node container, Document factory, Hashtable h) { if ((null == container) || (null == factory)) { return; } try { Element envCheckNode = factory.createElement("EnvironmentCheck"); envCheckNode.setAttribute("version", "$Revision$"); container.appendChild(envCheckNode); if (null == h) { Element statusNode = factory.createElement("status"); statusNode.setAttribute("result", "ERROR"); statusNode.appendChild(factory.createTextNode("appendEnvironmentReport called with null Hashtable!")); envCheckNode.appendChild(statusNode); return; } boolean errors = false; Element hashNode = factory.createElement("environment"); envCheckNode.appendChild(hashNode); for (Enumeration keys = h.keys(); keys.hasMoreElements(); /* no increment portion */ ) { Object key = keys.nextElement(); String keyStr = (String) key; try { // Special processing for classes found.. if (keyStr.startsWith(FOUNDCLASSES)) { Vector v = (Vector) h.get(keyStr); // errors |= logFoundJars(v, keyStr); errors |= appendFoundJars(hashNode, factory, v, keyStr); } // ..normal processing for all other entries else { // Note: we could just check for the ERROR key by itself, // since we now set that, but since we have to go // through the whole hash anyway, do it this way, // which is safer for maintenance if (keyStr.startsWith(ERROR)) { errors = true; } Element node = factory.createElement("item"); node.setAttribute("key", keyStr); node.appendChild(factory.createTextNode((String)h.get(keyStr))); hashNode.appendChild(node); } } catch (Exception e) { errors = true; Element node = factory.createElement("item"); node.setAttribute("key", keyStr); node.appendChild(factory.createTextNode(ERROR + " Reading " + key + " threw: " + e.toString())); hashNode.appendChild(node); } } // end of for... Element statusNode = factory.createElement("status"); statusNode.setAttribute("result", (errors ? "ERROR" : "OK" )); envCheckNode.appendChild(statusNode); } catch (Exception e2) { System.err.println("appendEnvironmentReport threw: " + e2.toString()); e2.printStackTrace(); } } /** * Print out report of .jars found in a classpath. * * Takes the information encoded from a checkPathForJars() * call and dumps it out to our PrintWriter. * * @param container Node to append our report to * @param factory Document providing createElement, etc. services * @param v Vector of Hashtables of .jar file info * @param desc description to print out in header * * @return false if OK, true if any .jars were reported * as having errors * @see #checkPathForJars(String, String[]) */ protected boolean appendFoundJars(Node container, Document factory, Vector v, String desc) { if ((null == v) || (v.size() < 1)) return false; boolean errors = false; for (int i = 0; i < v.size(); i++) { Hashtable subhash = (Hashtable) v.elementAt(i); for (Enumeration keys = subhash.keys(); keys.hasMoreElements(); /* no increment portion */ ) { Object key = keys.nextElement(); try { String keyStr = (String) key; if (keyStr.startsWith(ERROR)) { errors = true; } Element node = factory.createElement("foundJar"); node.setAttribute("name", keyStr.substring(0, keyStr.indexOf("-"))); node.setAttribute("desc", keyStr.substring(keyStr.indexOf("-") + 1)); node.appendChild(factory.createTextNode((String)subhash.get(keyStr))); container.appendChild(node); } catch (Exception e) { errors = true; Element node = factory.createElement("foundJar"); node.appendChild(factory.createTextNode(ERROR + " Reading " + key + " threw: " + e.toString())); container.appendChild(node); } } } return errors; } /** * Fillin hash with info about SystemProperties. * * Logs java.class.path and other likely paths; then attempts * to search those paths for .jar files with Xalan-related classes. * * //@todo NOTE: We don't actually search java.ext.dirs for * // *.jar files therein! This should be updated * * @param h Hashtable to put information in * @see #jarNames * @see #checkPathForJars(String, String[]) */ protected void checkSystemProperties(Hashtable h) { if (null == h) h = new Hashtable(); // Grab java version for later use try { String javaVersion = System.getProperty("java.version"); h.put("java.version", javaVersion); } catch (SecurityException se) { // For applet context, etc. h.put( "java.version", "WARNING: SecurityException thrown accessing system version properties"); } // Printout jar files on classpath(s) that may affect operation // Do this in order try { // This is present in all JVM's String cp = System.getProperty("java.class.path"); h.put("java.class.path", cp); Vector classpathJars = checkPathForJars(cp, jarNames); if (null != classpathJars) h.put(FOUNDCLASSES + "java.class.path", classpathJars); // Also check for JDK 1.2+ type classpaths String othercp = System.getProperty("sun.boot.class.path"); if (null != othercp) { h.put("sun.boot.class.path", othercp); classpathJars = checkPathForJars(othercp, jarNames); if (null != classpathJars) h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars); } //@todo NOTE: We don't actually search java.ext.dirs for // *.jar files therein! This should be updated othercp = System.getProperty("java.ext.dirs"); if (null != othercp) { h.put("java.ext.dirs", othercp); classpathJars = checkPathForJars(othercp, jarNames); if (null != classpathJars) h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars); } //@todo also check other System properties' paths? // v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed // v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed } catch (SecurityException se2) { // For applet context, etc. h.put( "java.class.path", "WARNING: SecurityException thrown accessing system classpath properties"); } } /** * Cheap-o listing of specified .jars found in the classpath. * * cp should be separated by the usual File.pathSeparator. We * then do a simplistic search of the path for any requested * .jar filenames, and return a listing of their names and * where (apparently) they came from. * * @param cp classpath to search * @param jars array of .jar base filenames to look for * * @return Vector of Hashtables filled with info about found .jars * @see #jarNames * @see #logFoundJars(Vector, String) * @see #appendFoundJars(Node, Document, Vector, String ) * @see #getApparentVersion(String, long) */ protected Vector checkPathForJars(String cp, String[] jars) { if ((null == cp) || (null == jars) || (0 == cp.length()) || (0 == jars.length)) return null; Vector v = new Vector(); StringTokenizer st = new StringTokenizer(cp, File.pathSeparator); while (st.hasMoreTokens()) { // Look at each classpath entry for each of our requested jarNames String filename = st.nextToken(); for (int i = 0; i < jars.length; i++) { if (filename.indexOf(jars[i]) > -1) { File f = new File(filename); if (f.exists()) { // If any requested jarName exists, report on // the details of that .jar file try { Hashtable h = new Hashtable(2); // Note "-" char is looked for in appendFoundJars h.put(jars[i] + "-path", f.getAbsolutePath()); // We won't bother reporting on the xalan.jar apparent version // since this requires knowing the jar size of the xalan.jar // before we build it. // For other jars, eg. xml-apis.jar and xercesImpl.jar, we // report the apparent version of the file we've found if (!("xalan.jar".equalsIgnoreCase(jars[i]))) { h.put(jars[i] + "-apparent.version", getApparentVersion(jars[i], f.length())); } v.addElement(h); } catch (Exception e) { /* no-op, don't add it */ } } else { Hashtable h = new Hashtable(2); // Note "-" char is looked for in appendFoundJars h.put(jars[i] + "-path", WARNING + " Classpath entry: " + filename + " does not exist"); h.put(jars[i] + "-apparent.version", CLASS_NOTPRESENT); v.addElement(h); } } } } return v; } /** * Cheap-o method to determine the product version of a .jar. * * Currently does a lookup into a local table of some recent * shipped Xalan builds to determine where the .jar probably * came from. Note that if you recompile Xalan or Xerces * yourself this will likely report a potential error, since * we can't certify builds other than the ones we ship. * Only reports against selected posted Xalan-J builds. * * //@todo actually look up version info in manifests * * @param jarName base filename of the .jarfile * @param jarSize size of the .jarfile * * @return String describing where the .jar file probably * came from */ protected String getApparentVersion(String jarName, long jarSize) { // If we found a matching size and it's for our // jar, then return it's description // Lookup in static jarVersions Hashtable String foundSize = (String) jarVersions.get(new Long(jarSize)); if ((null != foundSize) && (foundSize.startsWith(jarName))) { return foundSize; } else { if ("xerces.jar".equalsIgnoreCase(jarName) || "xercesImpl.jar".equalsIgnoreCase(jarName)) // || "xalan.jar".equalsIgnoreCase(jarName)) { // For xalan.jar and xerces.jar/xercesImpl.jar, which we ship together: // The jar is not from a shipped copy of xalan-j, so // it's up to the user to ensure that it's compatible return jarName + " " + WARNING + CLASS_PRESENT; } else { // Otherwise, it's just a jar we don't have the version info calculated for return jarName + " " + CLASS_PRESENT; } } } /** * Report version information about JAXP interfaces. * * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1, * and not found; only tests the interfaces, and does not * check for reference implementation versions. * * @param h Hashtable to put information in */ protected void checkJAXPVersion(Hashtable h) { if (null == h) h = new Hashtable(); final Class noArgs[] = new Class[0]; Class clazz = null; try { final String JAXP1_CLASS = "javax.xml.parsers.DocumentBuilder"; final String JAXP11_METHOD = "getDOMImplementation"; clazz = ObjectFactory.findProviderClass( JAXP1_CLASS, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(JAXP11_METHOD, noArgs); // If we succeeded, we at least have JAXP 1.1 available h.put(VERSION + "JAXP", "1.1 or higher"); } catch (Exception e) { if (null != clazz) { // We must have found the class itself, just not the // method, so we (probably) have JAXP 1.0.1 h.put(ERROR + VERSION + "JAXP", "1.0.1"); h.put(ERROR, ERROR_FOUND); } else { // We couldn't even find the class, and don't have // any JAXP support at all, or only have the // transform half of it h.put(ERROR + VERSION + "JAXP", CLASS_NOTPRESENT); h.put(ERROR, ERROR_FOUND); } } } /** * Report product version information from Xalan-J. * * Looks for version info in xalan.jar from Xalan-J products. * * @param h Hashtable to put information in */ protected void checkProcessorVersion(Hashtable h) { if (null == h) h = new Hashtable(); try { final String XALAN1_VERSION_CLASS = "org.apache.xalan.xslt.XSLProcessorVersion"; Class clazz = ObjectFactory.findProviderClass( XALAN1_VERSION_CLASS, ObjectFactory.findClassLoader(), true); // Found Xalan-J 1.x, grab it's version fields StringBuffer buf = new StringBuffer(); Field f = clazz.getField("PRODUCT"); buf.append(f.get(null)); buf.append(';'); f = clazz.getField("LANGUAGE"); buf.append(f.get(null)); buf.append(';'); f = clazz.getField("S_VERSION"); buf.append(f.get(null)); buf.append(';'); h.put(VERSION + "xalan1", buf.toString()); } catch (Exception e1) { h.put(VERSION + "xalan1", CLASS_NOTPRESENT); } try { // NOTE: This is the old Xalan 2.0, 2.1, 2.2 version class, // is being replaced by class below final String XALAN2_VERSION_CLASS = "org.apache.xalan.processor.XSLProcessorVersion"; Class clazz = ObjectFactory.findProviderClass( XALAN2_VERSION_CLASS, ObjectFactory.findClassLoader(), true); // Found Xalan-J 2.x, grab it's version fields StringBuffer buf = new StringBuffer(); Field f = clazz.getField("S_VERSION"); buf.append(f.get(null)); h.put(VERSION + "xalan2x", buf.toString()); } catch (Exception e2) { h.put(VERSION + "xalan2x", CLASS_NOTPRESENT); } try { // NOTE: This is the new Xalan 2.2+ version class final String XALAN2_2_VERSION_CLASS = "org.apache.xalan.Version"; final String XALAN2_2_VERSION_METHOD = "getVersion"; final Class noArgs[] = new Class[0]; Class clazz = ObjectFactory.findProviderClass( XALAN2_2_VERSION_CLASS, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(XALAN2_2_VERSION_METHOD, noArgs); Object returnValue = method.invoke(null, new Object[0]); h.put(VERSION + "xalan2_2", (String)returnValue); } catch (Exception e2) { h.put(VERSION + "xalan2_2", CLASS_NOTPRESENT); } } /** * Report product version information from common parsers. * * Looks for version info in xerces.jar/xercesImpl.jar/crimson.jar. * * //@todo actually look up version info in crimson manifest * * @param h Hashtable to put information in */ protected void checkParserVersion(Hashtable h) { if (null == h) h = new Hashtable(); try { final String XERCES1_VERSION_CLASS = "org.apache.xerces.framework.Version"; Class clazz = ObjectFactory.findProviderClass( XERCES1_VERSION_CLASS, ObjectFactory.findClassLoader(), true); // Found Xerces-J 1.x, grab it's version fields Field f = clazz.getField("fVersion"); String parserVersion = (String) f.get(null); h.put(VERSION + "xerces1", parserVersion); } catch (Exception e) { h.put(VERSION + "xerces1", CLASS_NOTPRESENT); } // Look for xerces1 and xerces2 parsers separately try { final String XERCES2_VERSION_CLASS = "org.apache.xerces.impl.Version"; Class clazz = ObjectFactory.findProviderClass( XERCES2_VERSION_CLASS, ObjectFactory.findClassLoader(), true); // Found Xerces-J 2.x, grab it's version fields Field f = clazz.getField("fVersion"); String parserVersion = (String) f.get(null); h.put(VERSION + "xerces2", parserVersion); } catch (Exception e) { h.put(VERSION + "xerces2", CLASS_NOTPRESENT); } try { final String CRIMSON_CLASS = "org.apache.crimson.parser.Parser2"; Class clazz = ObjectFactory.findProviderClass( CRIMSON_CLASS, ObjectFactory.findClassLoader(), true); //@todo determine specific crimson version h.put(VERSION + "crimson", CLASS_PRESENT); } catch (Exception e) { h.put(VERSION + "crimson", CLASS_NOTPRESENT); } } /** * Report product version information from Ant. * * @param h Hashtable to put information in */ protected void checkAntVersion(Hashtable h) { if (null == h) h = new Hashtable(); try { final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main"; final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs final Class noArgs[] = new Class[0]; Class clazz = ObjectFactory.findProviderClass( ANT_VERSION_CLASS, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs); Object returnValue = method.invoke(null, new Object[0]); h.put(VERSION + "ant", (String)returnValue); } catch (Exception e) { h.put(VERSION + "ant", CLASS_NOTPRESENT); } } /** * Report version info from DOM interfaces. * * Currently distinguishes between pre-DOM level 2, the DOM * level 2 working draft, the DOM level 2 final draft, * and not found. * * @param h Hashtable to put information in */ protected void checkDOMVersion(Hashtable h) { if (null == h) h = new Hashtable(); final String DOM_LEVEL2_CLASS = "org.w3c.dom.Document"; final String DOM_LEVEL2_METHOD = "createElementNS"; // String, String final String DOM_LEVEL2WD_CLASS = "org.w3c.dom.Node"; final String DOM_LEVEL2WD_METHOD = "supported"; // String, String final String DOM_LEVEL2FD_CLASS = "org.w3c.dom.Node"; final String DOM_LEVEL2FD_METHOD = "isSupported"; // String, String final Class twoStringArgs[] = { java.lang.String.class, java.lang.String.class }; try { Class clazz = ObjectFactory.findProviderClass( DOM_LEVEL2_CLASS, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(DOM_LEVEL2_METHOD, twoStringArgs); // If we succeeded, we have loaded interfaces from a // level 2 DOM somewhere h.put(VERSION + "DOM", "2.0"); try { // Check for the working draft version, which is // commonly found, but won't work anymore clazz = ObjectFactory.findProviderClass( DOM_LEVEL2WD_CLASS, ObjectFactory.findClassLoader(), true); method = clazz.getMethod(DOM_LEVEL2WD_METHOD, twoStringArgs); h.put(ERROR + VERSION + "DOM.draftlevel", "2.0wd"); h.put(ERROR, ERROR_FOUND); } catch (Exception e2) { try { // Check for the final draft version as well clazz = ObjectFactory.findProviderClass( DOM_LEVEL2FD_CLASS, ObjectFactory.findClassLoader(), true); method = clazz.getMethod(DOM_LEVEL2FD_METHOD, twoStringArgs); h.put(VERSION + "DOM.draftlevel", "2.0fd"); } catch (Exception e3) { h.put(ERROR + VERSION + "DOM.draftlevel", "2.0unknown"); h.put(ERROR, ERROR_FOUND); } } } catch (Exception e) { h.put(ERROR + VERSION + "DOM", "ERROR attempting to load DOM level 2 class: " + e.toString()); h.put(ERROR, ERROR_FOUND); } //@todo load an actual DOM implmementation and query it as well //@todo load an actual DOM implmementation and check if // isNamespaceAware() == true, which is needed to parse // xsl stylesheet files into a DOM } /** * Report version info from SAX interfaces. * * Currently distinguishes between SAX 2, SAX 2.0beta2, * SAX1, and not found. * * @param h Hashtable to put information in */ protected void checkSAXVersion(Hashtable h) { if (null == h) h = new Hashtable(); final String SAX_VERSION1_CLASS = "org.xml.sax.Parser"; final String SAX_VERSION1_METHOD = "parse"; // String final String SAX_VERSION2_CLASS = "org.xml.sax.XMLReader"; final String SAX_VERSION2_METHOD = "parse"; // String final String SAX_VERSION2BETA_CLASSNF = "org.xml.sax.helpers.AttributesImpl"; final String SAX_VERSION2BETA_METHODNF = "setAttributes"; // Attributes final Class oneStringArg[] = { java.lang.String.class }; // Note this introduces a minor compile dependency on SAX... final Class attributesArg[] = { org.xml.sax.Attributes.class }; try { // This method was only added in the final SAX 2.0 release; // see changes.html "Changes from SAX 2.0beta2 to SAX 2.0prerelease" Class clazz = ObjectFactory.findProviderClass( SAX_VERSION2BETA_CLASSNF, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(SAX_VERSION2BETA_METHODNF, attributesArg); // If we succeeded, we have loaded interfaces from a // real, final SAX version 2.0 somewhere h.put(VERSION + "SAX", "2.0"); } catch (Exception e) { // If we didn't find the SAX 2.0 class, look for a 2.0beta2 h.put(ERROR + VERSION + "SAX", "ERROR attempting to load SAX version 2 class: " + e.toString()); h.put(ERROR, ERROR_FOUND); try { Class clazz = ObjectFactory.findProviderClass( SAX_VERSION2_CLASS, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(SAX_VERSION2_METHOD, oneStringArg); // If we succeeded, we have loaded interfaces from a // SAX version 2.0beta2 or earlier; these might work but // you should really have the final SAX 2.0 h.put(VERSION + "SAX-backlevel", "2.0beta2-or-earlier"); } catch (Exception e2) { // If we didn't find the SAX 2.0beta2 class, look for a 1.0 one h.put(ERROR + VERSION + "SAX", "ERROR attempting to load SAX version 2 class: " + e.toString()); h.put(ERROR, ERROR_FOUND); try { Class clazz = ObjectFactory.findProviderClass( SAX_VERSION1_CLASS, ObjectFactory.findClassLoader(), true); Method method = clazz.getMethod(SAX_VERSION1_METHOD, oneStringArg); // If we succeeded, we have loaded interfaces from a // SAX version 1.0 somewhere; which won't work very // well for JAXP 1.1 or beyond! h.put(VERSION + "SAX-backlevel", "1.0"); } catch (Exception e3) { // If we didn't find the SAX 2.0 class, look for a 1.0 one // Note that either 1.0 or no SAX are both errors h.put(ERROR + VERSION + "SAX-backlevel", "ERROR attempting to load SAX version 1 class: " + e3.toString()); } } } } /** * Manual table of known .jar sizes. * Only includes shipped versions of certain projects. * key=jarsize, value=jarname ' from ' distro name * Note assumption: two jars cannot have the same size! * * @see #getApparentVersion(String, long) */ private static Hashtable jarVersions = new Hashtable(); /** * Static initializer for jarVersions table. * Doing this just once saves time and space. * * @see #getApparentVersion(String, long) */ static { // Note: hackish Hashtable, this could use improvement jarVersions.put(new Long(857192), "xalan.jar from xalan-j_1_1"); jarVersions.put(new Long(440237), "xalan.jar from xalan-j_1_2"); jarVersions.put(new Long(436094), "xalan.jar from xalan-j_1_2_1"); jarVersions.put(new Long(426249), "xalan.jar from xalan-j_1_2_2"); jarVersions.put(new Long(702536), "xalan.jar from xalan-j_2_0_0"); jarVersions.put(new Long(720930), "xalan.jar from xalan-j_2_0_1"); jarVersions.put(new Long(732330), "xalan.jar from xalan-j_2_1_0"); jarVersions.put(new Long(872241), "xalan.jar from xalan-j_2_2_D10"); jarVersions.put(new Long(882739), "xalan.jar from xalan-j_2_2_D11"); jarVersions.put(new Long(923866), "xalan.jar from xalan-j_2_2_0"); jarVersions.put(new Long(905872), "xalan.jar from xalan-j_2_3_D1"); jarVersions.put(new Long(906122), "xalan.jar from xalan-j_2_3_0"); jarVersions.put(new Long(906248), "xalan.jar from xalan-j_2_3_1"); jarVersions.put(new Long(983377), "xalan.jar from xalan-j_2_4_D1"); jarVersions.put(new Long(997276), "xalan.jar from xalan-j_2_4_0"); jarVersions.put(new Long(1031036), "xalan.jar from xalan-j_2_4_1"); // Stop recording xalan.jar sizes as of Xalan Java 2.5.0 jarVersions.put(new Long(596540), "xsltc.jar from xalan-j_2_2_0"); jarVersions.put(new Long(590247), "xsltc.jar from xalan-j_2_3_D1"); jarVersions.put(new Long(589914), "xsltc.jar from xalan-j_2_3_0"); jarVersions.put(new Long(589915), "xsltc.jar from xalan-j_2_3_1"); jarVersions.put(new Long(1306667), "xsltc.jar from xalan-j_2_4_D1"); jarVersions.put(new Long(1328227), "xsltc.jar from xalan-j_2_4_0"); jarVersions.put(new Long(1344009), "xsltc.jar from xalan-j_2_4_1"); jarVersions.put(new Long(1348361), "xsltc.jar from xalan-j_2_5_D1"); // Stop recording xsltc.jar sizes as of Xalan Java 2.5.0 jarVersions.put(new Long(1268634), "xsltc.jar-bundled from xalan-j_2_3_0"); jarVersions.put(new Long(100196), "xml-apis.jar from xalan-j_2_2_0 or xalan-j_2_3_D1"); jarVersions.put(new Long(108484), "xml-apis.jar from xalan-j_2_3_0, or xalan-j_2_3_1 from xml-commons-1.0.b2"); jarVersions.put(new Long(109049), "xml-apis.jar from xalan-j_2_4_0 from xml-commons RIVERCOURT1 branch"); jarVersions.put(new Long(113749), "xml-apis.jar from xalan-j_2_4_1 from factoryfinder-build of xml-commons RIVERCOURT1"); jarVersions.put(new Long(124704), "xml-apis.jar from tck-jaxp-1_2_0 branch of xml-commons"); jarVersions.put(new Long(124724), "xml-apis.jar from tck-jaxp-1_2_0 branch of xml-commons, tag: xml-commons-external_1_2_01"); jarVersions.put(new Long(194205), "xml-apis.jar from head branch of xml-commons, tag: xml-commons-external_1_3_02"); // If the below were more common I would update it to report // errors better; but this is so old hardly anyone has it jarVersions.put(new Long(424490), "xalan.jar from Xerces Tools releases - ERROR:DO NOT USE!"); jarVersions.put(new Long(1591855), "xerces.jar from xalan-j_1_1 from xerces-1..."); jarVersions.put(new Long(1498679), "xerces.jar from xalan-j_1_2 from xerces-1_2_0.bin"); jarVersions.put(new Long(1484896), "xerces.jar from xalan-j_1_2_1 from xerces-1_2_1.bin"); jarVersions.put(new Long(804460), "xerces.jar from xalan-j_1_2_2 from xerces-1_2_2.bin"); jarVersions.put(new Long(1499244), "xerces.jar from xalan-j_2_0_0 from xerces-1_2_3.bin"); jarVersions.put(new Long(1605266), "xerces.jar from xalan-j_2_0_1 from xerces-1_3_0.bin"); jarVersions.put(new Long(904030), "xerces.jar from xalan-j_2_1_0 from xerces-1_4.bin"); jarVersions.put(new Long(904030), "xerces.jar from xerces-1_4_0.bin"); jarVersions.put(new Long(1802885), "xerces.jar from xerces-1_4_2.bin"); jarVersions.put(new Long(1734594), "xerces.jar from Xerces-J-bin.2.0.0.beta3"); jarVersions.put(new Long(1808883), "xerces.jar from xalan-j_2_2_D10,D11,D12 or xerces-1_4_3.bin"); jarVersions.put(new Long(1812019), "xerces.jar from xalan-j_2_2_0"); jarVersions.put(new Long(1720292), "xercesImpl.jar from xalan-j_2_3_D1"); jarVersions.put(new Long(1730053), "xercesImpl.jar from xalan-j_2_3_0 or xalan-j_2_3_1 from xerces-2_0_0"); jarVersions.put(new Long(1728861), "xercesImpl.jar from xalan-j_2_4_D1 from xerces-2_0_1"); jarVersions.put(new Long(972027), "xercesImpl.jar from xalan-j_2_4_0 from xerces-2_1"); jarVersions.put(new Long(831587), "xercesImpl.jar from xalan-j_2_4_1 from xerces-2_2"); jarVersions.put(new Long(891817), "xercesImpl.jar from xalan-j_2_5_D1 from xerces-2_3"); jarVersions.put(new Long(895924), "xercesImpl.jar from xerces-2_4"); jarVersions.put(new Long(1010806), "xercesImpl.jar from Xerces-J-bin.2.6.2"); jarVersions.put(new Long(1203860), "xercesImpl.jar from Xerces-J-bin.2.7.1"); jarVersions.put(new Long(37485), "xalanj1compat.jar from xalan-j_2_0_0"); jarVersions.put(new Long(38100), "xalanj1compat.jar from xalan-j_2_0_1"); jarVersions.put(new Long(18779), "xalanservlet.jar from xalan-j_2_0_0"); jarVersions.put(new Long(21453), "xalanservlet.jar from xalan-j_2_0_1"); jarVersions.put(new Long(24826), "xalanservlet.jar from xalan-j_2_3_1 or xalan-j_2_4_1"); jarVersions.put(new Long(24831), "xalanservlet.jar from xalan-j_2_4_1"); // Stop recording xalanservlet.jar sizes as of Xalan Java 2.5.0; now a .war file // For those who've downloaded JAXP from sun jarVersions.put(new Long(5618), "jaxp.jar from jaxp1.0.1"); jarVersions.put(new Long(136133), "parser.jar from jaxp1.0.1"); jarVersions.put(new Long(28404), "jaxp.jar from jaxp-1.1"); jarVersions.put(new Long(187162), "crimson.jar from jaxp-1.1"); jarVersions.put(new Long(801714), "xalan.jar from jaxp-1.1"); jarVersions.put(new Long(196399), "crimson.jar from crimson-1.1.1"); jarVersions.put(new Long(33323), "jaxp.jar from crimson-1.1.1 or jakarta-ant-1.4.1b1"); jarVersions.put(new Long(152717), "crimson.jar from crimson-1.1.2beta2"); jarVersions.put(new Long(88143), "xml-apis.jar from crimson-1.1.2beta2"); jarVersions.put(new Long(206384), "crimson.jar from crimson-1.1.3 or jakarta-ant-1.4.1b1"); // jakarta-ant: since many people use ant these days jarVersions.put(new Long(136198), "parser.jar from jakarta-ant-1.3 or 1.2"); jarVersions.put(new Long(5537), "jaxp.jar from jakarta-ant-1.3 or 1.2"); } /** Simple PrintWriter we send output to; defaults to System.out. */ protected PrintWriter outWriter = new PrintWriter(System.out, true); /** * Bottleneck output: calls outWriter.println(s). * @param s String to print */ protected void logMsg(String s) { outWriter.println(s); } } libxalan2-java-2.7.1/src/org/apache/xalan/xslt/package.html0000644000175000017500000000201510721374031022451 0ustar mkochmkoch Xalan command-line interface.

        Implementation of Xalan command-line interface.

        libxalan2-java-2.7.1/src/org/apache/xalan/xslt/Process.java0000644000175000017500000012420110721374031022453 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: Process.java 475586 2006-11-16 05:19:36Z minchau $ */ package org.apache.xalan.xslt; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.PrintWriter; import java.io.StringReader; import java.util.Properties; import java.util.ResourceBundle; import java.util.Vector; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.Version; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.trace.PrintTraceListener; import org.apache.xalan.trace.TraceManager; import org.apache.xalan.transformer.XalanProperties; import org.apache.xml.utils.DefaultErrorHandler; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * The main() method handles the Xalan command-line interface. * @xsl.usage general */ public class Process { /** * Prints argument options. * * @param resbundle Resource bundle */ protected static void printArgOptions(ResourceBundle resbundle) { System.out.println(resbundle.getString("xslProc_option")); //"xslproc options: "); System.out.println("\n\t\t\t" + resbundle.getString("xslProc_common_options") + "\n"); System.out.println(resbundle.getString("optionXSLTC")); //" [-XSLTC (use XSLTC for transformation)] System.out.println(resbundle.getString("optionIN")); //" [-IN inputXMLURL]"); System.out.println(resbundle.getString("optionXSL")); //" [-XSL XSLTransformationURL]"); System.out.println(resbundle.getString("optionOUT")); //" [-OUT outputFileName]"); // System.out.println(resbundle.getString("optionE")); //" [-E (Do not expand entity refs)]"); System.out.println(resbundle.getString("optionV")); //" [-V (Version info)]"); // System.out.println(resbundle.getString("optionVALIDATE")); //" [-VALIDATE (Set whether validation occurs. Validation is off by default.)]"); System.out.println(resbundle.getString("optionEDUMP")); //" [-EDUMP {optional filename} (Do stackdump on error.)]"); System.out.println(resbundle.getString("optionXML")); //" [-XML (Use XML formatter and add XML header.)]"); System.out.println(resbundle.getString("optionTEXT")); //" [-TEXT (Use simple Text formatter.)]"); System.out.println(resbundle.getString("optionHTML")); //" [-HTML (Use HTML formatter.)]"); System.out.println(resbundle.getString("optionPARAM")); //" [-PARAM name expression (Set a stylesheet parameter)]"); System.out.println(resbundle.getString("optionMEDIA")); System.out.println(resbundle.getString("optionFLAVOR")); System.out.println(resbundle.getString("optionDIAG")); System.out.println(resbundle.getString("optionURIRESOLVER")); //" [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"); System.out.println(resbundle.getString("optionENTITYRESOLVER")); //" [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"); waitForReturnKey(resbundle); System.out.println(resbundle.getString("optionCONTENTHANDLER")); //" [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"); System.out.println(resbundle.getString("optionSECUREPROCESSING")); //" [-SECURE (set the secure processing feature to true)]"); System.out.println("\n\t\t\t" + resbundle.getString("xslProc_xalan_options") + "\n"); System.out.println(resbundle.getString("optionQC")); //" [-QC (Quiet Pattern Conflicts Warnings)]"); // System.out.println(resbundle.getString("optionQ")); //" [-Q (Quiet Mode)]"); // sc 28-Feb-01 commented out System.out.println(resbundle.getString("optionTT")); //" [-TT (Trace the templates as they are being called.)]"); System.out.println(resbundle.getString("optionTG")); //" [-TG (Trace each generation event.)]"); System.out.println(resbundle.getString("optionTS")); //" [-TS (Trace each selection event.)]"); System.out.println(resbundle.getString("optionTTC")); //" [-TTC (Trace the template children as they are being processed.)]"); System.out.println(resbundle.getString("optionTCLASS")); //" [-TCLASS (TraceListener class for trace extensions.)]"); System.out.println(resbundle.getString("optionLINENUMBERS")); //" [-L use line numbers]" System.out.println(resbundle.getString("optionINCREMENTAL")); System.out.println(resbundle.getString("optionNOOPTIMIMIZE")); System.out.println(resbundle.getString("optionRL")); System.out.println("\n\t\t\t" + resbundle.getString("xslProc_xsltc_options") + "\n"); System.out.println(resbundle.getString("optionXO")); waitForReturnKey(resbundle); System.out.println(resbundle.getString("optionXD")); System.out.println(resbundle.getString("optionXJ")); System.out.println(resbundle.getString("optionXP")); System.out.println(resbundle.getString("optionXN")); System.out.println(resbundle.getString("optionXX")); System.out.println(resbundle.getString("optionXT")); } /** * Command line interface to transform an XML document according to * the instructions found in an XSL stylesheet. *

        The Process class provides basic functionality for * performing transformations from the command line. To see a * list of arguments supported, call with zero arguments.

        *

        To set stylesheet parameters from the command line, use * -PARAM name expression. If you want to set the * parameter to a string value, simply pass the string value * as-is, and it will be interpreted as a string. (Note: if * the value has spaces in it, you may need to quote it depending * on your shell environment).

        * * @param argv Input parameters from command line */ public static void main(String argv[]) { // Runtime.getRuntime().traceMethodCalls(false); // turns Java tracing off boolean doStackDumpOnError = false; boolean setQuietMode = false; boolean doDiag = false; String msg = null; boolean isSecureProcessing = false; // Runtime.getRuntime().traceMethodCalls(false); // Runtime.getRuntime().traceInstructions(false); /** * The default diagnostic writer... */ java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true); java.io.PrintWriter dumpWriter = diagnosticsWriter; ResourceBundle resbundle = (XSLMessages.loadResourceBundle( org.apache.xml.utils.res.XResourceBundle.ERROR_RESOURCES)); String flavor = "s2s"; if (argv.length < 1) { printArgOptions(resbundle); } else { boolean useXSLTC = false; for (int i = 0; i < argv.length; i++) { if ("-XSLTC".equalsIgnoreCase(argv[i])) { useXSLTC = true; } } TransformerFactory tfactory; if (useXSLTC) { String key = "javax.xml.transform.TransformerFactory"; String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; Properties props = System.getProperties(); props.put(key, value); System.setProperties(props); } try { tfactory = TransformerFactory.newInstance(); tfactory.setErrorListener(new DefaultErrorHandler(false)); } catch (TransformerFactoryConfigurationError pfe) { pfe.printStackTrace(dumpWriter); // "XSL Process was not successful."); msg = XSLMessages.createMessage( XSLTErrorResources.ER_NOT_SUCCESSFUL, null); diagnosticsWriter.println(msg); tfactory = null; // shut up compiler doExit(msg); } boolean formatOutput = false; boolean useSourceLocation = false; String inFileName = null; String outFileName = null; String dumpFileName = null; String xslFileName = null; String treedumpFileName = null; PrintTraceListener tracer = null; String outputType = null; String media = null; Vector params = new Vector(); boolean quietConflictWarnings = false; URIResolver uriResolver = null; EntityResolver entityResolver = null; ContentHandler contentHandler = null; int recursionLimit=-1; for (int i = 0; i < argv.length; i++) { if ("-XSLTC".equalsIgnoreCase(argv[i])) { // The -XSLTC option has been processed. } else if ("-TT".equalsIgnoreCase(argv[i])) { if (!useXSLTC) { if (null == tracer) tracer = new PrintTraceListener(diagnosticsWriter); tracer.m_traceTemplates = true; } else printInvalidXSLTCOption("-TT"); // tfactory.setTraceTemplates(true); } else if ("-TG".equalsIgnoreCase(argv[i])) { if (!useXSLTC) { if (null == tracer) tracer = new PrintTraceListener(diagnosticsWriter); tracer.m_traceGeneration = true; } else printInvalidXSLTCOption("-TG"); // tfactory.setTraceSelect(true); } else if ("-TS".equalsIgnoreCase(argv[i])) { if (!useXSLTC) { if (null == tracer) tracer = new PrintTraceListener(diagnosticsWriter); tracer.m_traceSelection = true; } else printInvalidXSLTCOption("-TS"); // tfactory.setTraceTemplates(true); } else if ("-TTC".equalsIgnoreCase(argv[i])) { if (!useXSLTC) { if (null == tracer) tracer = new PrintTraceListener(diagnosticsWriter); tracer.m_traceElements = true; } else printInvalidXSLTCOption("-TTC"); // tfactory.setTraceTemplateChildren(true); } else if ("-INDENT".equalsIgnoreCase(argv[i])) { int indentAmount; if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) { indentAmount = Integer.parseInt(argv[++i]); } else { indentAmount = 0; } // TBD: // xmlProcessorLiaison.setIndent(indentAmount); } else if ("-IN".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') inFileName = argv[++i]; else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-IN" })); //"Missing argument for); } else if ("-MEDIA".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length) media = argv[++i]; else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-MEDIA" })); //"Missing argument for); } else if ("-OUT".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') outFileName = argv[++i]; else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-OUT" })); //"Missing argument for); } else if ("-XSL".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') xslFileName = argv[++i]; else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-XSL" })); //"Missing argument for); } else if ("-FLAVOR".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length) { flavor = argv[++i]; } else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-FLAVOR" })); //"Missing argument for); } else if ("-PARAM".equalsIgnoreCase(argv[i])) { if (i + 2 < argv.length) { String name = argv[++i]; params.addElement(name); String expression = argv[++i]; params.addElement(expression); } else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-PARAM" })); //"Missing argument for); } else if ("-E".equalsIgnoreCase(argv[i])) { // TBD: // xmlProcessorLiaison.setShouldExpandEntityRefs(false); } else if ("-V".equalsIgnoreCase(argv[i])) { diagnosticsWriter.println(resbundle.getString("version") //">>>>>>> Xalan Version " + Version.getVersion() + ", " + /* xmlProcessorLiaison.getParserDescription()+ */ resbundle.getString("version2")); // "<<<<<<<"); } else if ("-QC".equalsIgnoreCase(argv[i])) { if (!useXSLTC) quietConflictWarnings = true; else printInvalidXSLTCOption("-QC"); } else if ("-Q".equalsIgnoreCase(argv[i])) { setQuietMode = true; } else if ("-DIAG".equalsIgnoreCase(argv[i])) { doDiag = true; } else if ("-XML".equalsIgnoreCase(argv[i])) { outputType = "xml"; } else if ("-TEXT".equalsIgnoreCase(argv[i])) { outputType = "text"; } else if ("-HTML".equalsIgnoreCase(argv[i])) { outputType = "html"; } else if ("-EDUMP".equalsIgnoreCase(argv[i])) { doStackDumpOnError = true; if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) { dumpFileName = argv[++i]; } } else if ("-URIRESOLVER".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length) { try { uriResolver = (URIResolver) ObjectFactory.newInstance( argv[++i], ObjectFactory.findClassLoader(), true); tfactory.setURIResolver(uriResolver); } catch (ObjectFactory.ConfigurationError cnfe) { msg = XSLMessages.createMessage( XSLTErrorResources.ER_CLASS_NOT_FOUND_FOR_OPTION, new Object[]{ "-URIResolver" }); System.err.println(msg); doExit(msg); } } else { msg = XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-URIResolver" }); //"Missing argument for); System.err.println(msg); doExit(msg); } } else if ("-ENTITYRESOLVER".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length) { try { entityResolver = (EntityResolver) ObjectFactory.newInstance( argv[++i], ObjectFactory.findClassLoader(), true); } catch (ObjectFactory.ConfigurationError cnfe) { msg = XSLMessages.createMessage( XSLTErrorResources.ER_CLASS_NOT_FOUND_FOR_OPTION, new Object[]{ "-EntityResolver" }); System.err.println(msg); doExit(msg); } } else { // "Missing argument for); msg = XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-EntityResolver" }); System.err.println(msg); doExit(msg); } } else if ("-CONTENTHANDLER".equalsIgnoreCase(argv[i])) { if (i + 1 < argv.length) { try { contentHandler = (ContentHandler) ObjectFactory.newInstance( argv[++i], ObjectFactory.findClassLoader(), true); } catch (ObjectFactory.ConfigurationError cnfe) { msg = XSLMessages.createMessage( XSLTErrorResources.ER_CLASS_NOT_FOUND_FOR_OPTION, new Object[]{ "-ContentHandler" }); System.err.println(msg); doExit(msg); } } else { // "Missing argument for); msg = XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-ContentHandler" }); System.err.println(msg); doExit(msg); } } else if ("-L".equalsIgnoreCase(argv[i])) { if (!useXSLTC) tfactory.setAttribute(XalanProperties.SOURCE_LOCATION, Boolean.TRUE); else printInvalidXSLTCOption("-L"); } else if ("-INCREMENTAL".equalsIgnoreCase(argv[i])) { if (!useXSLTC) tfactory.setAttribute ("http://xml.apache.org/xalan/features/incremental", java.lang.Boolean.TRUE); else printInvalidXSLTCOption("-INCREMENTAL"); } else if ("-NOOPTIMIZE".equalsIgnoreCase(argv[i])) { // Default is true. // // %REVIEW% We should have a generalized syntax for negative // switches... and probably should accept the inverse even // if it is the default. if (!useXSLTC) tfactory.setAttribute ("http://xml.apache.org/xalan/features/optimize", java.lang.Boolean.FALSE); else printInvalidXSLTCOption("-NOOPTIMIZE"); } else if ("-RL".equalsIgnoreCase(argv[i])) { if (!useXSLTC) { if (i + 1 < argv.length) recursionLimit = Integer.parseInt(argv[++i]); else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-rl" })); //"Missing argument for); } else { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') i++; printInvalidXSLTCOption("-RL"); } } // Generate the translet class and optionally specify the name // of the translet class. else if ("-XO".equalsIgnoreCase(argv[i])) { if (useXSLTC) { if (i + 1 < argv.length && argv[i+1].charAt(0) != '-') { tfactory.setAttribute("generate-translet", "true"); tfactory.setAttribute("translet-name", argv[++i]); } else tfactory.setAttribute("generate-translet", "true"); } else { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') i++; printInvalidXalanOption("-XO"); } } // Specify the destination directory for the translet classes. else if ("-XD".equalsIgnoreCase(argv[i])) { if (useXSLTC) { if (i + 1 < argv.length && argv[i+1].charAt(0) != '-') tfactory.setAttribute("destination-directory", argv[++i]); else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-XD" })); //"Missing argument for); } else { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') i++; printInvalidXalanOption("-XD"); } } // Specify the jar file name which the translet classes are packaged into. else if ("-XJ".equalsIgnoreCase(argv[i])) { if (useXSLTC) { if (i + 1 < argv.length && argv[i+1].charAt(0) != '-') { tfactory.setAttribute("generate-translet", "true"); tfactory.setAttribute("jar-name", argv[++i]); } else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-XJ" })); //"Missing argument for); } else { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') i++; printInvalidXalanOption("-XJ"); } } // Specify the package name prefix for the generated translet classes. else if ("-XP".equalsIgnoreCase(argv[i])) { if (useXSLTC) { if (i + 1 < argv.length && argv[i+1].charAt(0) != '-') tfactory.setAttribute("package-name", argv[++i]); else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[]{ "-XP" })); //"Missing argument for); } else { if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') i++; printInvalidXalanOption("-XP"); } } // Enable template inlining. else if ("-XN".equalsIgnoreCase(argv[i])) { if (useXSLTC) { tfactory.setAttribute("enable-inlining", "true"); } else printInvalidXalanOption("-XN"); } // Turns on additional debugging message output else if ("-XX".equalsIgnoreCase(argv[i])) { if (useXSLTC) { tfactory.setAttribute("debug", "true"); } else printInvalidXalanOption("-XX"); } // Create the Transformer from the translet if the translet class is newer // than the stylesheet. else if ("-XT".equalsIgnoreCase(argv[i])) { if (useXSLTC) { tfactory.setAttribute("auto-translet", "true"); } else printInvalidXalanOption("-XT"); } else if ("-SECURE".equalsIgnoreCase(argv[i])) { isSecureProcessing = true; try { tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (TransformerConfigurationException e) {} } else System.err.println( XSLMessages.createMessage( XSLTErrorResources.ER_INVALID_OPTION, new Object[]{ argv[i] })); //"Invalid argument:); } // Print usage instructions if no xml and xsl file is specified in the command line if (inFileName == null && xslFileName == null) { msg = resbundle.getString("xslProc_no_input"); System.err.println(msg); doExit(msg); } // Note that there are usage cases for calling us without a -IN arg // The main XSL transformation occurs here! try { long start = System.currentTimeMillis(); if (null != dumpFileName) { dumpWriter = new PrintWriter(new FileWriter(dumpFileName)); } Templates stylesheet = null; if (null != xslFileName) { if (flavor.equals("d2d")) { // Parse in the xml data into a DOM DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setNamespaceAware(true); if (isSecureProcessing) { try { dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (ParserConfigurationException pce) {} } DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); Node xslDOM = docBuilder.parse(new InputSource(xslFileName)); stylesheet = tfactory.newTemplates(new DOMSource(xslDOM, xslFileName)); } else { // System.out.println("Calling newTemplates: "+xslFileName); stylesheet = tfactory.newTemplates(new StreamSource(xslFileName)); // System.out.println("Done calling newTemplates: "+xslFileName); } } PrintWriter resultWriter; StreamResult strResult; if (null != outFileName) { strResult = new StreamResult(new FileOutputStream(outFileName)); // One possible improvement might be to ensure this is // a valid URI before setting the systemId, but that // might have subtle changes that pre-existing users // might notice; we can think about that later -sc r1.46 strResult.setSystemId(outFileName); } else { strResult = new StreamResult(System.out); // We used to default to incremental mode in this case. // We've since decided that since the -INCREMENTAL switch is // available, that default is probably not necessary nor // necessarily a good idea. } SAXTransformerFactory stf = (SAXTransformerFactory) tfactory; // This is currently controlled via TransformerFactoryImpl. if (!useXSLTC && useSourceLocation) stf.setAttribute(XalanProperties.SOURCE_LOCATION, Boolean.TRUE); // Did they pass in a stylesheet, or should we get it from the // document? if (null == stylesheet) { Source source = stf.getAssociatedStylesheet(new StreamSource(inFileName), media, null, null); if (null != source) stylesheet = tfactory.newTemplates(source); else { if (null != media) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEET_IN_MEDIA, new Object[]{inFileName, media})); //"No stylesheet found in: " // + inFileName + ", media=" // + media); else throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEET_PI, new Object[]{inFileName})); //"No xml-stylesheet PI found in: " //+ inFileName); } } if (null != stylesheet) { Transformer transformer = flavor.equals("th") ? null : stylesheet.newTransformer(); transformer.setErrorListener(new DefaultErrorHandler(false)); // Override the output format? if (null != outputType) { transformer.setOutputProperty(OutputKeys.METHOD, outputType); } if (transformer instanceof org.apache.xalan.transformer.TransformerImpl) { org.apache.xalan.transformer.TransformerImpl impl = (org.apache.xalan.transformer.TransformerImpl)transformer; TraceManager tm = impl.getTraceManager(); if (null != tracer) tm.addTraceListener(tracer); impl.setQuietConflictWarnings(quietConflictWarnings); // This is currently controlled via TransformerFactoryImpl. if (useSourceLocation) impl.setProperty(XalanProperties.SOURCE_LOCATION, Boolean.TRUE); if(recursionLimit>0) impl.setRecursionLimit(recursionLimit); // sc 28-Feb-01 if we re-implement this, please uncomment helpmsg in printArgOptions // impl.setDiagnosticsOutput( setQuietMode ? null : diagnosticsWriter ); } int nParams = params.size(); for (int i = 0; i < nParams; i += 2) { transformer.setParameter((String) params.elementAt(i), (String) params.elementAt(i + 1)); } if (uriResolver != null) transformer.setURIResolver(uriResolver); if (null != inFileName) { if (flavor.equals("d2d")) { // Parse in the xml data into a DOM DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setCoalescing(true); dfactory.setNamespaceAware(true); if (isSecureProcessing) { try { dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (ParserConfigurationException pce) {} } DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); if (entityResolver != null) docBuilder.setEntityResolver(entityResolver); Node xmlDoc = docBuilder.parse(new InputSource(inFileName)); Document doc = docBuilder.newDocument(); org.w3c.dom.DocumentFragment outNode = doc.createDocumentFragment(); transformer.transform(new DOMSource(xmlDoc, inFileName), new DOMResult(outNode)); // Now serialize output to disk with identity transformer Transformer serializer = stf.newTransformer(); serializer.setErrorListener(new DefaultErrorHandler(false)); Properties serializationProps = stylesheet.getOutputProperties(); serializer.setOutputProperties(serializationProps); if (contentHandler != null) { SAXResult result = new SAXResult(contentHandler); serializer.transform(new DOMSource(outNode), result); } else serializer.transform(new DOMSource(outNode), strResult); } else if (flavor.equals("th")) { for (int i = 0; i < 1; i++) // Loop for diagnosing bugs with inconsistent behavior { // System.out.println("Testing the TransformerHandler..."); // =============== XMLReader reader = null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware(true); if (isSecureProcessing) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException se) {} } javax.xml.parsers.SAXParser jaxpParser = factory.newSAXParser(); reader = jaxpParser.getXMLReader(); } catch (javax.xml.parsers.ParserConfigurationException ex) { throw new org.xml.sax.SAXException(ex); } catch (javax.xml.parsers.FactoryConfigurationError ex1) { throw new org.xml.sax.SAXException(ex1.toString()); } catch (NoSuchMethodError ex2){} catch (AbstractMethodError ame){} if (null == reader) { reader = XMLReaderFactory.createXMLReader(); } if (!useXSLTC) stf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE_INCREMENTAL, Boolean.TRUE); TransformerHandler th = stf.newTransformerHandler(stylesheet); reader.setContentHandler(th); reader.setDTDHandler(th); if(th instanceof org.xml.sax.ErrorHandler) reader.setErrorHandler((org.xml.sax.ErrorHandler)th); try { reader.setProperty( "http://xml.org/sax/properties/lexical-handler", th); } catch (org.xml.sax.SAXNotRecognizedException e){} catch (org.xml.sax.SAXNotSupportedException e){} try { reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); } catch (org.xml.sax.SAXException se) {} th.setResult(strResult); reader.parse(new InputSource(inFileName)); } } else { if (entityResolver != null) { XMLReader reader = null; // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware(true); if (isSecureProcessing) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException se) {} } javax.xml.parsers.SAXParser jaxpParser = factory.newSAXParser(); reader = jaxpParser.getXMLReader(); } catch (javax.xml.parsers.ParserConfigurationException ex) { throw new org.xml.sax.SAXException(ex); } catch (javax.xml.parsers.FactoryConfigurationError ex1) { throw new org.xml.sax.SAXException(ex1.toString()); } catch (NoSuchMethodError ex2){} catch (AbstractMethodError ame){} if (null == reader) { reader = XMLReaderFactory.createXMLReader(); } reader.setEntityResolver(entityResolver); if (contentHandler != null) { SAXResult result = new SAXResult(contentHandler); transformer.transform( new SAXSource(reader, new InputSource(inFileName)), result); } else { transformer.transform( new SAXSource(reader, new InputSource(inFileName)), strResult); } } else if (contentHandler != null) { SAXResult result = new SAXResult(contentHandler); transformer.transform(new StreamSource(inFileName), result); } else { // System.out.println("Starting transform"); transformer.transform(new StreamSource(inFileName), strResult); // System.out.println("Done with transform"); } } } else { StringReader reader = new StringReader(" "); transformer.transform(new StreamSource(reader), strResult); } } else { // "XSL Process was not successful."); msg = XSLMessages.createMessage( XSLTErrorResources.ER_NOT_SUCCESSFUL, null); diagnosticsWriter.println(msg); doExit(msg); } // close output streams if (null != outFileName && strResult!=null) { java.io.OutputStream out = strResult.getOutputStream(); java.io.Writer writer = strResult.getWriter(); try { if (out != null) out.close(); if (writer != null) writer.close(); } catch(java.io.IOException ie) {} } long stop = System.currentTimeMillis(); long millisecondsDuration = stop - start; if (doDiag) { Object[] msgArgs = new Object[]{ inFileName, xslFileName, new Long(millisecondsDuration) }; msg = XSLMessages.createMessage("diagTiming", msgArgs); diagnosticsWriter.println('\n'); diagnosticsWriter.println(msg); } } catch (Throwable throwable) { while (throwable instanceof org.apache.xml.utils.WrappedRuntimeException) { throwable = ((org.apache.xml.utils.WrappedRuntimeException) throwable).getException(); } if ((throwable instanceof NullPointerException) || (throwable instanceof ClassCastException)) doStackDumpOnError = true; diagnosticsWriter.println(); if (doStackDumpOnError) throwable.printStackTrace(dumpWriter); else { DefaultErrorHandler.printLocation(diagnosticsWriter, throwable); diagnosticsWriter.println( XSLMessages.createMessage(XSLTErrorResources.ER_XSLT_ERROR, null) + " (" + throwable.getClass().getName() + "): " + throwable.getMessage()); } // diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful."); if (null != dumpFileName) { dumpWriter.close(); } doExit(throwable.getMessage()); } if (null != dumpFileName) { dumpWriter.close(); } if (null != diagnosticsWriter) { // diagnosticsWriter.close(); } // if(!setQuietMode) // diagnosticsWriter.println(resbundle.getString("xsldone")); //"Xalan: done"); // else // diagnosticsWriter.println(""); //"Xalan: done"); } } /** It is _much_ easier to debug under VJ++ if I can set a single breakpoint * before this blows itself out of the water... * (I keep checking this in, it keeps vanishing. Grr!) * */ static void doExit(String msg) { throw new RuntimeException(msg); } /** * Wait for a return key to continue * * @param resbundle The resource bundle */ private static void waitForReturnKey(ResourceBundle resbundle) { System.out.println(resbundle.getString("xslProc_return_to_continue")); try { while (System.in.read() != '\n'); } catch (java.io.IOException e) { } } /** * Print a message if an option cannot be used with -XSLTC. * * @param option The option String */ private static void printInvalidXSLTCOption(String option) { System.err.println(XSLMessages.createMessage("xslProc_invalid_xsltc_option", new Object[]{option})); } /** * Print a message if an option can only be used with -XSLTC. * * @param option The option String */ private static void printInvalidXalanOption(String option) { System.err.println(XSLMessages.createMessage("xslProc_invalid_xalan_option", new Object[]{option})); } } libxalan2-java-2.7.1/src/org/apache/xalan/xslt/ObjectFactory.java0000644000175000017500000006375710721374031023615 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ObjectFactory.java 468646 2006-10-28 06:57:58Z minchau $ */ package org.apache.xalan.xslt; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.io.BufferedReader; import java.io.InputStreamReader; /** * This class is duplicated for each JAXP subpackage so keep it in sync. * It is package private and therefore is not exposed as part of the JAXP * API. *

        * This code is designed to implement the JAXP 1.1 spec pluggability * feature and is designed to run on JDK version 1.1 and * later, and to compile on JDK 1.2 and onward. * The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. *

        * This class was moved from the javax.xml.parsers.ObjectFactory * class and modified to be used as a general utility for creating objects * dynamically. * * @version $Id: ObjectFactory.java 468646 2006-10-28 06:57:58Z minchau $ */ class ObjectFactory { // // Constants // // name of default properties file to look for in JDK's jre/lib directory private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties"; private static final String SERVICES_PATH = "META-INF/services/"; /** Set to true for debugging */ private static final boolean DEBUG = false; /** cache the contents of the xalan.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error * during the read, this will be empty. */ private static Properties fXalanProperties = null; /*** * Cache the time stamp of the xalan.properties file so * that we know if it's been modified and can invalidate * the cache when necessary. */ private static long fLastModified = -1; // // Public static methods // /** * Finds the implementation Class object in the specified order. The * specified order is the following: *

          *
        1. query the system property using System.getProperty *
        2. read META-INF/services/factoryId file *
        3. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); if (factoryClass == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } try{ Object instance = factoryClass.newInstance(); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) { throw new ConfigurationError( "Provider for factory " + factoryId + " could not be instantiated: " + x, x); } } // createObject(String,String,String):Object /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class /** * Finds the implementation Class object in the specified order. The * specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return Class object that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError { String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); if (factoryClassName == null) { factoryClassName = fallbackClassName; } // assert(className != null); try{ Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + factoryClassName + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider "+factoryClassName+" could not be instantiated: "+x, x); } } // lookUpFactoryClass(String,String,String):Class /** * Finds the name of the required implementation class in the specified * order. The specified order is the following: *
          *
        1. query the system property using System.getProperty *
        2. read $java.home/lib/propertiesFilename file *
        3. read META-INF/services/factoryId file *
        4. use fallback classname *
        * * @return name of class that provides factory service, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) { SecuritySupport ss = SecuritySupport.getInstance(); // Use the system property first try { String systemProp = ss.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; } } catch (SecurityException se) { // Ignore and continue w/ next location } // Try to read from propertiesFilename, or // $java.home/lib/xalan.properties String factoryClassName = null; // no properties file name specified; use // $JAVA_HOME/lib/xalan.properties: if (propertiesFilename == null) { File propertiesFile = null; boolean propertiesFileExists = false; try { String javah = ss.getSystemProperty("java.home"); propertiesFilename = javah + File.separator + "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME; propertiesFile = new File(propertiesFilename); propertiesFileExists = ss.getFileExists(propertiesFile); } catch (SecurityException e) { // try again... fLastModified = -1; fXalanProperties = null; } synchronized (ObjectFactory.class) { boolean loadProperties = false; FileInputStream fis = null; try { // file existed last time if(fLastModified >= 0) { if(propertiesFileExists && (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) { loadProperties = true; } else { // file has stopped existing... if(!propertiesFileExists) { fLastModified = -1; fXalanProperties = null; } // else, file wasn't modified! } } else { // file has started to exist: if(propertiesFileExists) { loadProperties = true; fLastModified = ss.getLastModified(propertiesFile); } // else, nothing's changed } if(loadProperties) { // must never have attempted to read xalan.properties // before (or it's outdeated) fXalanProperties = new Properties(); fis = ss.getFileInputStream(propertiesFile); fXalanProperties.load(fis); } } catch (Exception x) { fXalanProperties = null; fLastModified = -1; // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if(fXalanProperties != null) { factoryClassName = fXalanProperties.getProperty(factoryId); } } else { FileInputStream fis = null; try { fis = ss.getFileInputStream(new File(propertiesFilename)); Properties props = new Properties(); props.load(fis); factoryClassName = props.getProperty(factoryId); } catch (Exception x) { // assert(x instanceof FileNotFoundException // || x instanceof SecurityException) // In both cases, ignore and continue w/ next location } finally { // try to close the input stream if one was opened. if (fis != null) { try { fis.close(); } // Ignore the exception. catch (IOException exc) {} } } } if (factoryClassName != null) { debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; } // Try Jar Service Provider Mechanism return findJarServiceProviderName(factoryId); } // lookUpFactoryClass(String,String):String // // Private static methods // /** Prints a message to standard error if debugging is enabled. */ private static void debugPrintln(String msg) { if (DEBUG) { System.err.println("JAXP: " + msg); } } // debugPrintln(String) /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader findClassLoader() throws ConfigurationError { SecuritySupport ss = SecuritySupport.getInstance(); // Figure out which ClassLoader to use for loading the provider // class. If there is a Context ClassLoader then use it. ClassLoader context = ss.getContextClassLoader(); ClassLoader system = ss.getSystemClassLoader(); ClassLoader chain = system; while (true) { if (context == chain) { // Assert: we are on JDK 1.1 or we have no Context ClassLoader // or any Context ClassLoader in chain of system classloader // (including extension ClassLoader) so extend to widest // ClassLoader (always look in system ClassLoader if Xalan // is in boot/extension/system classpath and in current // ClassLoader otherwise); normal classloaders delegate // back to system ClassLoader first so this widening doesn't // change the fact that context ClassLoader will be consulted ClassLoader current = ObjectFactory.class.getClassLoader(); chain = system; while (true) { if (current == chain) { // Assert: Current ClassLoader in chain of // boot/extension/system ClassLoaders return system; } if (chain == null) { break; } chain = ss.getParentClassLoader(chain); } // Assert: Current ClassLoader not in chain of // boot/extension/system ClassLoaders return current; } if (chain == null) { // boot ClassLoader reached break; } // Check for any extension ClassLoaders in chain up to // boot ClassLoader chain = ss.getParentClassLoader(chain); }; // Assert: Context ClassLoader not in chain of // boot/extension/system ClassLoaders return context; } // findClassLoader():ClassLoader /** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } } /** * Find a Class using the specified ClassLoader */ static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; } /** * Find the name of service provider using Jar Service Provider Mechanism * * @return instance of provider class if found or null */ private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; } // // Classes // /** * A configuration error. */ static class ConfigurationError extends Error { static final long serialVersionUID = 2276082712114762609L; // // Data // /** Exception. */ private Exception exception; // // Constructors // /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } // (String,Exception) // // Public methods // /** Returns the exception associated to this error. */ Exception getException() { return exception; } // getException():Exception } // class ConfigurationError } // class ObjectFactory libxalan2-java-2.7.1/src/org/apache/xalan/res/0000755000175000017500000000000010736146354020004 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_zh_CN.java0000644000175000017500000000164110721374033025420 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.xalan.res; public class XSLTErrorResources_zh_CN extends XSLTErrorResources_zh { } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_ja.java0000644000175000017500000025471110721374031025017 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_ja.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_ja extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "\u30a8\u30e9\u30fc: \u5f0f\u5185\u3067\u306f '{' \u3092\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_ILLEGAL_ATTRIBUTE , "{0} \u306b\u6b63\u3057\u304f\u306a\u3044\u5c5e\u6027\u304c\u3042\u308a\u307e\u3059: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "xsl:apply-imports \u5185\u306e sourceNode \u304c\u30cc\u30eb\u3067\u3059\u3002"}, {ER_CANNOT_ADD, "{0} \u3092 {1} \u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "handleApplyTemplatesInstruction \u5185\u306e sourceNode \u304c\u30cc\u30eb\u3067\u3059\u3002"}, { ER_NO_NAME_ATTRIB, "{0} \u306b\u306f name \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, {ER_TEMPLATE_NOT_FOUND, "{0} \u3068\u3044\u3046\u540d\u524d\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, {ER_CANT_RESOLVE_NAME_AVT, "xsl:call-template \u5185\u306e\u540d\u524d AVT \u3092\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, {ER_REQUIRES_ATTRIB, "{0} \u306b\u306f\u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} \u306b\u306f ''test'' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "level \u5c5e\u6027\u3067\u5024\u304c\u9593\u9055\u3063\u3066\u3044\u307e\u3059: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "\u51e6\u7406\u547d\u4ee4\u306e\u540d\u524d\u306f 'xml' \u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "\u51e6\u7406\u547d\u4ee4\u306e\u540d\u524d\u306f\u6709\u52b9\u306a NCName \u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} \u306b\u30e2\u30fc\u30c9\u304c\u3042\u308b\u5834\u5408\u306f\u3001match \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} \u306b\u306f name \u307e\u305f\u306f match \u306e\u3044\u305a\u308c\u304b\u306e\u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, {ER_CANT_RESOLVE_NSPREFIX, "\u540d\u524d\u7a7a\u9593\u63a5\u982d\u90e8\u3092\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093: {0}"}, { ER_ILLEGAL_VALUE, "xml:space \u306b\u306f\u6b63\u3057\u304f\u306a\u3044\u5024\u304c\u3042\u308a\u307e\u3059: {0}"}, { ER_NO_OWNERDOC, "\u4e0b\u4f4d\u30ce\u30fc\u30c9\u306b\u6240\u6709\u8005\u6587\u66f8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement \u30a8\u30e9\u30fc: {0}"}, { ER_NULL_CHILD, "\u30cc\u30eb\u306e\u5b50\u3092\u8ffd\u52a0\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, { ER_NEED_SELECT_ATTRIB, "{0} \u306b\u306f select \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NEED_TEST_ATTRIB , "xsl:when \u306b\u306f 'test' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NEED_NAME_ATTRIB, "xsl:with-param \u306b\u306f 'name' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NO_CONTEXT_OWNERDOC, "\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306b\u6240\u6709\u8005\u6587\u66f8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "XML TransformerFactory Liaison \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: \u51e6\u7406\u306f\u6210\u529f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_NOT_SUCCESSFUL, "Xalan: \u306f\u6210\u529f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_ENCODING_NOT_SUPPORTED, "\u30a8\u30f3\u30b3\u30fc\u30c9\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "TraceListener \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key \u306b\u306f 'name' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key \u306b\u306f 'match' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key \u306b\u306f 'use' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} \u306b\u306f ''elements'' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} \u306b\u5c5e\u6027 ''prefix'' \u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_BAD_STYLESHEET_URL, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8 URL \u304c\u9593\u9055\u3063\u3066\u3044\u307e\u3059: {0}"}, { ER_FILE_NOT_FOUND, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u30fb\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f: {0}"}, { ER_IOEXCEPTION, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u30fb\u30d5\u30a1\u30a4\u30eb\u306b\u3088\u308b\u5165\u51fa\u529b\u4f8b\u5916\u304c\u8d77\u3053\u308a\u307e\u3057\u305f: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) {0} \u306e href \u5c5e\u6027\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} \u304c\u81ea\u5206\u81ea\u8eab\u3092\u76f4\u63a5\u7684\u307e\u305f\u306f\u9593\u63a5\u7684\u306b\u7d44\u307f\u8fbc\u3082\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude \u30a8\u30e9\u30fc\u3001{0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} \u306b\u5c5e\u6027 ''lang'' \u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) {0} \u8981\u7d20\u306e\u5834\u6240\u3092\u9593\u9055\u3048\u305f\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u30b3\u30f3\u30c6\u30ca\u30fc\u8981\u7d20 ''component'' \u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Element\u3001DocumentFragment\u3001Document\u3001\u307e\u305f\u306f PrintWriter \u3078\u306e\u51fa\u529b\u3057\u304b\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_PROCESS_ERROR, "StylesheetRoot.\u51e6\u7406\u30a8\u30e9\u30fc"}, { ER_UNIMPLNODE_ERROR, "UnImplNode \u30a8\u30e9\u30fc: {0}"}, { ER_NO_SELECT_EXPRESSION, "\u30a8\u30e9\u30fc: xpath select \u5f0f (-select) \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "XSLProcessor \u3092\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NO_INPUT_STYLESHEET, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u5165\u529b\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_FAILED_PROCESS_STYLESHEET, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\u51e6\u7406\u3059\u308b\u3053\u3068\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002"}, { ER_COULDNT_PARSE_DOC, "{0} \u6587\u66f8\u3092\u69cb\u6587\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_COULDNT_FIND_FRAGMENT, "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f: {0}"}, { ER_NODE_NOT_ELEMENT, "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8 ID \u306b\u3088\u308a\u6307\u3055\u308c\u3066\u3044\u308b\u30ce\u30fc\u30c9\u304c\u8981\u7d20\u3067\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each \u306b\u306f match \u307e\u305f\u306f name \u306e\u3044\u305a\u308c\u304b\u306e\u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u306f match \u307e\u305f\u306f name \u306e\u3044\u305a\u308c\u304b\u306e\u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\u6587\u66f8\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306e\u8907\u88fd\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_CANT_CREATE_ITEM, "\u9805\u76ee\u3092\u7d50\u679c\u30c4\u30ea\u30fc\u306b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "\u30bd\u30fc\u30b9 XML \u5185\u306e xml:space \u306b\u306f\u6b63\u3057\u304f\u306a\u3044\u5024\u304c\u3042\u308a\u307e\u3059: {0}"}, { ER_NO_XSLKEY_DECLARATION, "{0} \u306e xsl:key \u5ba3\u8a00\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_CANT_CREATE_URL, "\u30a8\u30e9\u30fc: {0} \u306e URL \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions \u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory \u30a8\u30e9\u30fc"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} \u306f\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306e\u5185\u90e8\u3067\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns \u306f\u3082\u3046\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 \u4ee3\u308a\u306b xsl:output \u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space \u306f\u3082\u3046\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 \u4ee3\u308a\u306b xsl:strip-space \u307e\u305f\u306f xsl:preserve-space \u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result \u306f\u3082\u3046\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 \u4ee3\u308a\u306b xsl:output \u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} \u306b\u306f\u6b63\u3057\u304f\u306a\u3044\u5c5e\u6027\u304c\u3042\u308a\u307e\u3059: {1}"}, { ER_UNKNOWN_XSL_ELEM, "\u4e0d\u660e\u306e XSL \u8981\u7d20: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort \u306f xsl:apply-templates \u307e\u305f\u306f xsl:for-each \u3068\u3057\u304b\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when \u306e\u5834\u6240\u3092\u8aa4\u3063\u3066\u3044\u307e\u3057\u305f\u3002"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when \u304c xsl:choose \u306b\u3088\u308a\u89aa\u306b\u306a\u3063\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise \u306e\u5834\u6240\u3092\u8aa4\u3063\u3066\u3044\u307e\u3057\u305f\u3002"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise \u304c xsl:choose \u306b\u3088\u308a\u89aa\u306b\u306a\u3063\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} \u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u5185\u90e8\u3067\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} \u62e1\u5f35\u540d\u524d\u7a7a\u9593\u63a5\u982d\u90e8 {1} \u304c\u4e0d\u660e\u3067\u3059\u3002"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) \u30a4\u30f3\u30dd\u30fc\u30c8\u306f\u3001\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u5185\u306e\u5148\u982d\u8981\u7d20\u3068\u3057\u3066\u306e\u307f\u5165\u308c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} \u304c\u81ea\u5206\u81ea\u8eab\u3092\u76f4\u63a5\u7684\u307e\u305f\u306f\u9593\u63a5\u7684\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space \u306b\u6b63\u3057\u304f\u306a\u3044\u5024\u304c\u3042\u308a\u307e\u3059: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet \u306f\u6210\u529f\u3057\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_SAX_EXCEPTION, "SAX \u4f8b\u5916"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "\u6a5f\u80fd\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_XSLT_ERROR, "XSLT \u30a8\u30e9\u30fc"}, { ER_CURRENCY_SIGN_ILLEGAL, "\u901a\u8ca8\u8a18\u53f7\u306f\u66f8\u5f0f\u30d1\u30bf\u30fc\u30f3\u30fb\u30b9\u30c8\u30ea\u30f3\u30b0\u5185\u3067\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "\u6587\u66f8\u6a5f\u80fd\u306f\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8 DOM \u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "\u975e\u63a5\u982d\u90e8\u30ea\u30be\u30eb\u30d0\u30fc\u306e\u63a5\u982d\u90e8\u3092\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u62e1\u5f35: \u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002file \u307e\u305f\u306f select \u5c5e\u6027\u306f\u6709\u52b9\u306a\u30b9\u30c8\u30ea\u30f3\u30b0\u3092\u623b\u3055\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "FormatterListener \u306f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u62e1\u5f35\u5185\u306b\u30d3\u30eb\u30c9\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "exclude-result-prefixes \u5185\u306e\u63a5\u982d\u90e8\u304c\u7121\u52b9\u3067\u3059: {0}"}, { ER_MISSING_NS_URI, "\u6307\u5b9a\u3055\u308c\u305f\u63a5\u982d\u90e8\u306e\u540d\u524d\u7a7a\u9593 URI \u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_MISSING_ARG_FOR_OPTION, "\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u5f15\u6570\u304c\u3042\u308a\u307e\u305b\u3093: {0}"}, { ER_INVALID_OPTION, "\u7121\u52b9\u306a\u30aa\u30d7\u30b7\u30e7\u30f3: {0}"}, { ER_MALFORMED_FORMAT_STRING, "\u8aa4\u3063\u305f\u5f62\u5f0f\u306e\u66f8\u5f0f\u30b9\u30c8\u30ea\u30f3\u30b0: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet \u306b\u306f 'version' \u5c5e\u6027\u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "\u5c5e\u6027: {0} \u306b\u306f\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c\u3042\u308a\u307e\u3059\u3002"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose \u306b\u306f xsl:when \u304c\u5fc5\u8981\u3067\u3059\u3002"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports \u306f xsl:for-each \u5185\u3067\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "DTMLiaison \u306f\u51fa\u529b DOM \u30ce\u30fc\u30c9\u306b\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093... \u4ee3\u308a\u306b org.apache.xpath.DOM2Helper \u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { ER_CANT_USE_DTM_FOR_INPUT, "DTMLiaison \u306f\u5165\u529b DOM \u30ce\u30fc\u30c9\u306b\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093... \u4ee3\u308a\u306b org.apache.xpath.DOM2Helper \u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { ER_CALL_TO_EXT_FAILED, "\u62e1\u5f35\u8981\u7d20\u3078\u306e\u547c\u3073\u51fa\u3057\u304c\u5931\u6557\u3057\u307e\u3057\u305f: {0}"}, { ER_PREFIX_MUST_RESOLVE, "\u63a5\u982d\u90e8\u306f\u540d\u524d\u7a7a\u9593\u306b\u89e3\u6c7a\u3055\u308c\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093: {0}"}, { ER_INVALID_UTF16_SURROGATE, "\u7121\u52b9\u306a UTF-16 \u30b5\u30ed\u30b2\u30fc\u30c8\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} \u304c\u81ea\u8eab\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u7121\u9650\u30eb\u30fc\u30d7\u306e\u539f\u56e0\u3068\u306a\u308a\u307e\u3059\u3002"}, { ER_CANNOT_MIX_XERCESDOM, "\u975e Xerces-DOM \u5165\u529b\u3068 Xerces-DOM \u51fa\u529b\u306f\u6df7\u7528\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "ElemTemplateElement.readObject \u5185: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "\u6b21\u306e\u540d\u524d\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u8907\u6570\u898b\u3064\u304b\u308a\u307e\u3057\u305f: {0}"}, { ER_INVALID_KEY_CALL, "\u7121\u52b9\u306a\u95a2\u6570\u547c\u3073\u51fa\u3057: \u518d\u5e30\u7684 key() \u547c\u3073\u51fa\u3057\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_REFERENCING_ITSELF, "\u5909\u6570 {0} \u304c\u76f4\u63a5\u7684\u307e\u305f\u306f\u9593\u63a5\u7684\u306b\u81ea\u5206\u81ea\u8eab\u306b\u53c2\u7167\u3065\u3051\u3066\u3044\u307e\u3059\u3002"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "newTemplates \u306e DOMSource \u306e\u5165\u529b\u30ce\u30fc\u30c9\u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "\u30aa\u30d7\u30b7\u30e7\u30f3 {0} \u306e\u30af\u30e9\u30b9\u30fb\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, { ER_REQUIRED_ELEM_NOT_FOUND, "\u5fc5\u8981\u306a\u8981\u7d20\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream \u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_URI_CANNOT_BE_NULL, "URI \u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_FILE_CANNOT_BE_NULL, "\u30d5\u30a1\u30a4\u30eb\u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource \u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_CANNOT_INIT_BSFMGR, "BSF \u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3092\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_CANNOT_CMPL_EXTENSN, "\u62e1\u5f35\u6a5f\u80fd\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_CANNOT_CREATE_EXTENSN, "\u539f\u56e0: {1} \u306e\u305f\u3081\u306b\u62e1\u5f35\u6a5f\u80fd: {0} \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "\u30e1\u30bd\u30c3\u30c9 {0} \u3078\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30fb\u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u306b\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30fb\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u6700\u521d\u306e\u5f15\u6570\u3068\u3057\u3066\u5fc5\u8981\u3067\u3059\u3002"}, { ER_INVALID_ELEMENT_NAME, "\u7121\u52b9\u306a\u8981\u7d20\u540d\u304c\u6307\u5b9a\u3055\u308c\u307e\u3057\u305f: {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "\u8981\u7d20\u540d\u30e1\u30bd\u30c3\u30c9\u306f\u9759\u7684\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093: {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "\u62e1\u5f35\u6a5f\u80fd {0} : {1} \u304c\u4e0d\u660e\u3067\u3059\u3002"}, { ER_MORE_MATCH_CONSTRUCTOR, "{0} \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30fc\u306e\u6700\u9069\u4e00\u81f4\u304c\u8907\u6570\u3042\u308a\u307e\u3059\u3002"}, { ER_MORE_MATCH_METHOD, "\u30e1\u30bd\u30c3\u30c9 {0} \u306e\u6700\u9069\u4e00\u81f4\u304c\u8907\u6570\u3042\u308a\u307e\u3059\u3002"}, { ER_MORE_MATCH_ELEMENT, "\u8981\u7d20\u30e1\u30bd\u30c3\u30c9 {0} \u306e\u6700\u9069\u4e00\u81f4\u304c\u8907\u6570\u3042\u308a\u307e\u3059\u3002"}, { ER_INVALID_CONTEXT_PASSED, "{0} \u3092\u8a55\u4fa1\u3059\u308b\u305f\u3081\u306b\u6e21\u3055\u308c\u305f\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u304c\u7121\u52b9\u3067\u3059\u3002"}, { ER_POOL_EXISTS, "\u30d7\u30fc\u30eb\u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002"}, { ER_NO_DRIVER_NAME, "\u30c9\u30e9\u30a4\u30d0\u30fc\u540d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_NO_URL, "URL \u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_POOL_SIZE_LESSTHAN_ONE, "\u30d7\u30fc\u30eb\u30fb\u30b5\u30a4\u30ba\u304c 1 \u3088\u308a\u5c0f\u3067\u3059\u3002"}, { ER_INVALID_DRIVER, "\u7121\u52b9\u306a\u30c9\u30e9\u30a4\u30d0\u30fc\u540d\u304c\u6307\u5b9a\u3055\u308c\u307e\u3057\u305f\u3002"}, { ER_NO_STYLESHEETROOT, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306e\u30eb\u30fc\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_ILLEGAL_XMLSPACE_VALUE, "xml:space \u306e\u5024\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode \u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002"}, { ER_RESOURCE_COULD_NOT_LOAD, "\u30ea\u30bd\u30fc\u30b9 [ {0} ] \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u30d0\u30c3\u30d5\u30a1\u30fc\u30fb\u30b5\u30a4\u30ba <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u3092\u547c\u3073\u51fa\u3057\u6642\u306b\u4e0d\u660e\u30a8\u30e9\u30fc"}, { ER_NO_NAMESPACE_DECL, "\u63a5\u982d\u90e8 {0} \u306b\u306f\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u540d\u524d\u7a7a\u9593\u5ba3\u8a00\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "\u8981\u7d20\u306e\u5185\u5bb9\u306f lang=javaclass {0} \u306e\u5834\u5408\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3067\u7d42\u4e86\u304c\u6307\u56f3\u3055\u308c\u307e\u3057\u305f\u3002"}, { ER_ONE_OR_TWO, "1 \u307e\u305f\u306f 2"}, { ER_TWO_OR_THREE, "2 \u307e\u305f\u306f 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "{0} \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f (CLASSPATH \u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044)\u3002\u73fe\u5728\u306f\u307e\u3055\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u3092\u4f7f\u7528\u4e2d\u3067\u3059\u3002"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "\u30c7\u30d5\u30a9\u30eb\u30c8\u30fb\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_RESULT_NULL, "\u7d50\u679c\u306f\u30cc\u30eb\u306b\u306f\u306a\u3089\u306a\u3044\u306f\u305a\u3067\u3059\u3002"}, { ER_RESULT_COULD_NOT_BE_SET, "\u7d50\u679c\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_NO_OUTPUT_SPECIFIED, "\u51fa\u529b\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "\u578b {0} \u306e Result \u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "\u578b {0} \u306e Source \u3092\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NULL_CONTENT_HANDLER, "\u30cc\u30eb\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30fb\u30cf\u30f3\u30c9\u30e9\u30fc"}, { ER_NULL_ERROR_HANDLER, "\u30cc\u30eb\u306e\u30a8\u30e9\u30fc\u30fb\u30cf\u30f3\u30c9\u30e9\u30fc"}, { ER_CANNOT_CALL_PARSE, "ContentHandler \u304c\u672a\u8a2d\u5b9a\u306e\u5834\u5408\u306f parse \u306e\u547c\u3073\u51fa\u3057\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NO_PARENT_FOR_FILTER, "\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u89aa\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_NO_STYLESHEET_IN_MEDIA, "\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u304c {0}\u3001\u30e1\u30c7\u30a3\u30a2= {1} \u306b\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, { ER_NO_STYLESHEET_PI, "XML \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8 PI \u304c {0} \u306b\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, { ER_NOT_SUPPORTED, "\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc {0} \u306e\u5024\u306f\u30d6\u30fc\u30eb\u30fb\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "{0} \u306e\u5916\u90e8\u30b9\u30af\u30ea\u30d7\u30c8\u3078\u5230\u9054\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { ER_RESOURCE_COULD_NOT_FIND, "\u30ea\u30bd\u30fc\u30b9 [ {0} ] \u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "\u51fa\u529b\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u306f\u8a8d\u8b58\u3055\u308c\u3066\u3044\u307e\u305b\u3093: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "ElemLiteralResult \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "{0} \u306e\u5024\u306b\u306f\u69cb\u6587\u89e3\u6790\u53ef\u80fd\u756a\u53f7\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002"}, { ER_VALUE_SHOULD_EQUAL, "{0} \u306e\u5024\u306f yes \u307e\u305f\u306f no \u3068\u7b49\u3057\u304f\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, { ER_FAILED_CALLING_METHOD, "{0} \u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002"}, { ER_FAILED_CREATING_ELEMTMPL, "ElemTemplateElement \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002"}, { ER_CHARS_NOT_ALLOWED, "\u6587\u5b57\u306f\u6587\u66f8\u5185\u306e\u3053\u306e\u30dd\u30a4\u30f3\u30c8\u3067\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_ATTR_NOT_ALLOWED, "\"{0}\" \u5c5e\u6027\u306f {1} \u8981\u7d20\u3067\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_BAD_VALUE, "{0} \u306e\u9593\u9055\u3063\u305f\u5024 {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "{0} \u5c5e\u6027\u5024\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "{0} \u5c5e\u6027\u5024\u306f\u8a8d\u8b58\u3055\u308c\u307e\u305b\u3093\u3002 "}, { ER_NULL_URI_NAMESPACE, "\u540d\u524d\u7a7a\u9593\u63a5\u982d\u90e8\u3092\u30cc\u30eb\u306e URI \u3067\u751f\u6210\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "\u6700\u5927 Long \u6574\u6570\u3088\u308a\u5927\u304d\u3044\u6570\u3092\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002"}, { ER_CANNOT_FIND_SAX1_DRIVER, "SAX1 \u30c9\u30e9\u30a4\u30d0\u30fc\u30fb\u30af\u30e9\u30b9 {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002"}, { ER_SAX1_DRIVER_NOT_LOADED, "SAX1 \u30c9\u30e9\u30a4\u30d0\u30fc\u30fb\u30af\u30e9\u30b9 {0} \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u304c\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "SAX1 \u30c9\u30e9\u30a4\u30d0\u30fc\u30fb\u30af\u30e9\u30b9 {0} \u304c\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3057\u305f\u304c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1 \u30c9\u30e9\u30a4\u30d0\u30fc\u30fb\u30af\u30e9\u30b9 {0} \u304c org.xml.sax.Parser \u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "\u30b7\u30b9\u30c6\u30e0\u30fb\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc org.xml.sax.parser \u306f\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "\u30d1\u30fc\u30b5\u30fc\u306e\u5f15\u6570\u3092\u30cc\u30eb\u306b\u3057\u3066\u306f\u306a\u308a\u307e\u305b\u3093\u3002"}, { ER_FEATURE, "\u6a5f\u80fd: {0}"}, { ER_PROPERTY, "\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc: {0}"}, { ER_NULL_ENTITY_RESOLVER, "\u30cc\u30eb\u5b9f\u4f53\u30ea\u30be\u30eb\u30d0\u30fc"}, { ER_NULL_DTD_HANDLER, "\u30cc\u30eb DTD \u30cf\u30f3\u30c9\u30e9\u30fc"}, { ER_NO_DRIVER_NAME_SPECIFIED, "\u30c9\u30e9\u30a4\u30d0\u30fc\u540d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_NO_URL_SPECIFIED, "URL \u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { ER_POOLSIZE_LESS_THAN_ONE, "\u30d7\u30fc\u30eb\u30fb\u30b5\u30a4\u30ba\u304c 1 \u3088\u308a\u5c0f\u3055\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002"}, { ER_INVALID_DRIVER_NAME, "\u7121\u52b9\u306a\u30c9\u30e9\u30a4\u30d0\u30fc\u540d\u304c\u6307\u5b9a\u3055\u308c\u307e\u3057\u305f\u3002"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u306e\u30a8\u30e9\u30fc: \u5f0f\u306b ElemTemplateElement \u89aa\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "RedundentExprEliminator \u5185\u306e\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} \u306f\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306e\u3053\u306e\u4f4d\u7f6e\u3067\u306f\u8a31\u53ef\u3055\u308c\u307e\u305b\u3093\u3002"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "\u7a7a\u767d\u6587\u5b57\u4ee5\u5916\u306e\u30c6\u30ad\u30b9\u30c8\u306f\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306e\u3053\u306e\u4f4d\u7f6e\u3067\u306f\u8a31\u53ef\u3055\u308c\u307e\u305b\u3093\u3002"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c CHAR \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002CHAR \u578b\u306e\u5c5e\u6027\u306f 1 \u6587\u5b57\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c QNAME \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c ENUM \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002\u6709\u52b9\u5024: {2}\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c NMTOKEN \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c NCNAME \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c boolean \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "\u6b63\u3057\u304f\u306a\u3044\u5024: {1} \u304c number \u5c5e\u6027: {0} \u306b\u4f7f\u7528\u3055\u308c\u307e\u3057\u305f\u3002"}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "\u30de\u30c3\u30c1\u30f3\u30b0\u30fb\u30d1\u30bf\u30fc\u30f3\u306e {0} \u3078\u306e\u5f15\u6570\u306f\u30ea\u30c6\u30e9\u30eb\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002"}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u5ba3\u8a00\u304c\u91cd\u8907\u3057\u3066\u3044\u307e\u3059\u3002"}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "\u5909\u6570\u5ba3\u8a00\u304c\u91cd\u8907\u3057\u3066\u3044\u307e\u3059\u3002"}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template \u306b\u306f name \u307e\u305f\u306f match \u5c5e\u6027 (\u3042\u308b\u3044\u306f\u305d\u306e\u4e21\u65b9) \u304c\u5fc5\u8981\u3067\u3059\u3002"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "exclude-result-prefixes \u5185\u306e\u63a5\u982d\u90e8\u304c\u7121\u52b9\u3067\u3059: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "{0} \u3068\u3044\u3046\u540d\u524d\u306e attribute-set \u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u305b\u3093\u3002"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "{0} \u3068\u3044\u3046\u540d\u524d\u306e\u95a2\u6570\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u305b\u3093\u3002"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "{0} \u8981\u7d20\u306b\u5185\u5bb9\u304a\u3088\u3073 select \u5c5e\u6027\u306e\u4e21\u65b9\u304c\u3042\u3063\u3066\u306f\u306a\u308a\u307e\u305b\u3093\u3002"}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "param {0} \u306e\u5024\u306f\u6709\u52b9\u306a Java \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "xsl:namespace-alias \u8981\u7d20\u306e result-prefix \u5c5e\u6027\u306e\u5024\u304c '#default' \u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u8981\u7d20\u306e\u30b9\u30b3\u30fc\u30d7\u5185\u306b\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u540d\u524d\u7a7a\u9593\u306e\u5ba3\u8a00\u306f\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "xsl:namespace-alias \u8981\u7d20\u306e result-prefix \u5c5e\u6027\u306e\u5024\u304c ''{0}'' \u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u8981\u7d20\u306e\u30b9\u30b3\u30fc\u30d7\u5185\u306b\u306f\u63a5\u982d\u90e8 ''{0}'' \u306e\u540d\u524d\u7a7a\u9593\u5ba3\u8a00\u306f\u3042\u308a\u307e\u305b\u3093\u3002"}, { ER_SET_FEATURE_NULL_NAME, "TransformerFactory.setFeature(String name, boolean value) \u306e\u6a5f\u80fd\u540d\u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_GET_FEATURE_NULL_NAME, "TransformerFactory.getFeature(String name) \u306e\u6a5f\u80fd\u540d\u3092\u30cc\u30eb\u306b\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_UNSUPPORTED_FEATURE, "\u6a5f\u80fd ''{0}'' \u306f\u3053\u306e TransformerFactory \u306b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u4fdd\u8b77\u3055\u308c\u305f\u51e6\u7406\u6a5f\u80fd\u304c true \u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3068\u304d\u306b\u3001\u62e1\u5f35\u8981\u7d20 ''{0}'' \u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "\u30cc\u30eb\u540d\u524d\u7a7a\u9593 URI \u306e\u63a5\u982d\u90e8\u306f\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "\u30cc\u30eb\u63a5\u982d\u90e8\u306e\u540d\u524d\u7a7a\u9593 URI \u306f\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_XPATH_RESOLVER_NULL_QNAME, "\u95a2\u6570\u540d \u306f\u30cc\u30eb\u306b\u3067\u304d\u307e\u305b\u3093\u3002"}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "\u30a2\u30ea\u30c6\u30a3\u30fc (\u5f15\u6570\u306e\u6570) \u306f\u8ca0\u306e\u5024\u306b\u3067\u304d\u307e\u305b\u3093\u3002"}, // Warnings... { WG_FOUND_CURLYBRACE, "'}' \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u304c\u3001\u30aa\u30fc\u30d7\u30f3\u3055\u308c\u305f\u5c5e\u6027\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u3042\u308a\u307e\u305b\u3093\u3002"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "\u8b66\u544a: count \u5c5e\u6027\u304c xsl:number \u5185\u306e\u4e0a\u4f4d\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002 \u30bf\u30fc\u30b2\u30c3\u30c8 = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "\u65e7\u69cb\u6587: 'expr' \u5c5e\u6027\u306e\u540d\u524d\u304c 'select' \u306b\u5909\u66f4\u3055\u308c\u3066\u3044\u307e\u3059\u3002"}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan \u306f\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u756a\u53f7\u95a2\u6570\u5185\u3067\u307e\u3060\u30ed\u30b1\u30fc\u30eb\u540d\u3092\u51e6\u7406\u3057\u307e\u305b\u3093\u3002"}, { WG_LOCALE_NOT_FOUND, "\u8b66\u544a: xml:lang={0} \u306e\u30ed\u30b1\u30fc\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { WG_CANNOT_MAKE_URL_FROM, "URL \u3092 {0} \u304b\u3089\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "\u8981\u6c42\u3055\u308c\u305f doc: {0} \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3002"}, { WG_CANNOT_FIND_COLLATOR, ">>>>>> Xalan \u30d0\u30fc\u30b8\u30e7\u30f3 "}, { "version2", "<<<<<<<"}, { "yes", "\u306f\u3044 (y)"}, { "line", "\u884c #"}, { "column","\u6841 #"}, { "xsldone", "XSLProcessor: \u5b8c\u4e86"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J \u30b3\u30de\u30f3\u30c9\u884c Process \u30af\u30e9\u30b9\u30fb\u30aa\u30d7\u30b7\u30e7\u30f3"}, { "xslProc_option", "Xalan-J \u30b3\u30de\u30f3\u30c9\u884c Process \u30af\u30e9\u30b9\u30fb\u30aa\u30d7\u30b7\u30e7\u30f3\u003a"}, { "xslProc_invalid_xsltc_option", "\u30aa\u30d7\u30b7\u30e7\u30f3 {0} \u306f XSLTC \u30e2\u30fc\u30c9\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"}, { "xslProc_invalid_xalan_option", "\u30aa\u30d7\u30b7\u30e7\u30f3 {0} \u306f -XSLTC \u3068\u4e00\u7dd2\u306b\u3057\u304b\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002"}, { "xslProc_no_input", "\u30a8\u30e9\u30fc: \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u304c\u306a\u3044\u304b\u5165\u529b xml \u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4f7f\u7528\u6cd5\u306e\u8aac\u660e\u306b\u3064\u3044\u3066\u306f\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u306a\u3057\u3067\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002"}, { "xslProc_common_options", "-\u5171\u901a\u30aa\u30d7\u30b7\u30e7\u30f3-"}, { "xslProc_xalan_options", "-Xalan \u7528\u30aa\u30d7\u30b7\u30e7\u30f3-"}, { "xslProc_xsltc_options", "-XSLTC \u7528\u30aa\u30d7\u30b7\u30e7\u30f3-"}, { "xslProc_return_to_continue", "(\u7d9a\u3051\u308b\u306b\u306f \u3092\u62bc\u3057\u3066\u304f\u3060\u3055\u3044)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (\u5909\u63db\u306b XSLTC \u3092\u4f7f\u7528)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER parser liaison \u306e\u5b8c\u5168\u4fee\u98fe\u30af\u30e9\u30b9\u540d]"}, { "optionE", " [-E (\u5b9f\u4f53\u53c2\u7167\u3092\u5c55\u958b\u3057\u306a\u3044)]"}, { "optionV", " [-E (\u5b9f\u4f53\u53c2\u7167\u3092\u5c55\u958b\u3057\u306a\u3044)]"}, { "optionQC", " [-QC (\u9759\u6b62\u30d1\u30bf\u30fc\u30f3\u77db\u76fe\u8b66\u544a)]"}, { "optionQ", " [-Q (\u9759\u6b62\u30e2\u30fc\u30c9)]"}, { "optionLF", " [-LF (LF (\u6539\u884c) \u3092\u51fa\u529b\u6642\u306e\u307f\u306b\u4f7f\u7528 {\u30c7\u30d5\u30a9\u30eb\u30c8\u306f CR/LF})]"}, { "optionCR", " [-CR (CR (\u5fa9\u5e30) \u3092\u51fa\u529b\u6642\u306e\u307f\u306b\u4f7f\u7528 {\u30c7\u30d5\u30a9\u30eb\u30c8\u306f CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u6587\u5b57 {\u30c7\u30d5\u30a9\u30eb\u30c8\u306f <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (\u5b57\u4e0b\u3052\u3059\u308b\u30b9\u30da\u30fc\u30b9\u3092\u5236\u5fa1 {\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 0})]"}, { "optionTT", " [-TT (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u547c\u3073\u51fa\u3057\u4e2d\u306b\u30c8\u30ec\u30fc\u30b9\u3002)]"}, { "optionTG", " [-TG (\u5404\u751f\u6210\u30a4\u30d9\u30f3\u30c8\u3092\u30c8\u30ec\u30fc\u30b9\u3002)]"}, { "optionTS", " [-TS (\u5404\u9078\u629e\u30a4\u30d9\u30f3\u30c8\u3092\u30c8\u30ec\u30fc\u30b9\u3002)]"}, { "optionTTC", " [-TTC (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u5b50\u3092\u547c\u3073\u51fa\u3057\u4e2d\u306b\u30c8\u30ec\u30fc\u30b9\u3002)]"}, { "optionTCLASS", " [-TCLASS (\u30c8\u30ec\u30fc\u30b9\u62e1\u5f35\u6a5f\u80fd\u306e TraceListener \u30af\u30e9\u30b9\u3002)]"}, { "optionVALIDATE", " [-VALIDATE (\u59a5\u5f53\u6027\u691c\u67fb\u3092\u5b9f\u884c\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8a2d\u5b9a\u3002 \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001\u59a5\u5f53\u6027\u691c\u67fb\u306f\u30aa\u30d5\u3067\u3059\u3002)]"}, { "optionEDUMP", " [-EDUMP {optional filename} (\u30a8\u30e9\u30fc\u6642\u306b stackdump \u3092\u5b9f\u884c\u3002)]"}, { "optionXML", " [-XML (XML \u30d5\u30a9\u30fc\u30de\u30c3\u30bf\u30fc\u3092\u4f7f\u7528\u304a\u3088\u3073 XML \u30d8\u30c3\u30c0\u30fc\u3092\u8ffd\u52a0\u3002)]"}, { "optionTEXT", " [-TEXT (\u30b7\u30f3\u30d7\u30eb\u30fb\u30c6\u30ad\u30b9\u30c8\u30fb\u30d5\u30a9\u30fc\u30de\u30c3\u30bf\u30fc\u3092\u4f7f\u7528\u3002)]"}, { "optionHTML", " [-HTML (HTML \u30d5\u30a9\u30fc\u30de\u30c3\u30bf\u30fc\u3092\u4f7f\u7528\u3002)]"}, { "optionPARAM", " [-PARAM \u540d\u524d\u5f0f (stylesheet \u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u8a2d\u5b9a\u3002)]"}, { "noParsermsg1", "XSL \u51e6\u7406\u306f\u6210\u529f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002"}, { "noParsermsg2", "** \u30d1\u30fc\u30b5\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f **"}, { "noParsermsg3", "\u30af\u30e9\u30b9\u30d1\u30b9\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002"}, { "noParsermsg4", "IBM \u306e XML Parser for Java \u304c\u306a\u3044\u5834\u5408\u306f\u3001\u6b21\u306e\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059:"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER \u7d76\u5bfe\u30af\u30e9\u30b9\u540d (URI \u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b URIResolver)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER \u7d76\u5bfe\u30af\u30e9\u30b9\u540d (\u5b9f\u4f53\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b EntityResolver)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER \u7d76\u5bfe\u30af\u30e9\u30b9\u540d (\u51fa\u529b\u3092\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b ContentHandler)]"}, { "optionLINENUMBERS", " [-L \u30bd\u30fc\u30b9\u30fb\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u884c\u756a\u53f7\u3092\u4f7f\u7528]"}, { "optionSECUREPROCESSING", " [-SECURE (\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u4fdd\u8b77\u3055\u308c\u305f\u51e6\u7406\u6a5f\u80fd\u3092 true \u306b\u8a2d\u5b9a)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (\u6587\u66f8\u3068\u95a2\u9023\u3057\u305f\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\u691c\u7d22\u3059\u308b\u30e1\u30c7\u30a3\u30a2\u5c5e\u6027\u3092\u4f7f\u7528\u3002)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (\u5909\u63db\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b s2s=SAX \u307e\u305f\u306f d2d=DOM \u3092\u660e\u793a\u7684\u306b\u4f7f\u7528\u3002)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (\u5909\u63db\u306b\u304b\u304b\u3063\u305f\u5168\u30df\u30ea\u79d2\u3092\u5370\u5237\u3002)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (http://xml.apache.org/xalan/features/incremental \u3092 true \u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u5897\u5206 DTM \u69cb\u9020\u3092\u8981\u6c42\u3002)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (http://xml.apache.org/xalan/features/optimize \u3092 false \u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u6700\u9069\u5316\u51e6\u7406\u306a\u3057\u3092\u8981\u6c42\u3002)]"}, { "optionRL", " [-RL recursionlimit (\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306e\u518d\u5e30\u306e\u6df1\u3055\u306b\u3064\u3044\u3066\u306e\u6570\u5024\u9650\u754c\u3092\u6307\u5b9a\u3002)]"}, { "optionXO", " [-XO [transletName] (\u540d\u524d\u3092\u751f\u6210\u5f8c\u306e translet \u306b\u5272\u308a\u5f53\u3066)]"}, { "optionXD", " [-XD destinationDirectory (\u5b9b\u5148\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092 translet \u306b\u6307\u5b9a)]"}, { "optionXJ", " [-XJ jarfile (translet \u30af\u30e9\u30b9\u3092\u540d\u524d \u306e JAR \u30d5\u30a1\u30a4\u30eb\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u3057\u307e\u3059)]"}, { "optionXP", " [-XP package (\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u63a5\u982d\u90e8\u3092\u3059\u3079\u3066\u306e\u751f\u6210\u5f8c\u306e translet \u30af\u30e9\u30b9\u306b\u6307\u5b9a\u3057\u307e\u3059)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30a4\u30f3\u30e9\u30a4\u30f3\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u3057\u307e\u3059)]" }, { "optionXX", " [-XX (\u8ffd\u52a0\u306e\u30c7\u30d0\u30c3\u30b0\u30fb\u30e1\u30c3\u30bb\u30fc\u30b8\u51fa\u529b\u3092\u30aa\u30f3\u306b\u3057\u307e\u3059)]"}, { "optionXT" , " [-XT (\u53ef\u80fd\u306a\u5834\u5408\u306f translet \u3092\u4f7f\u7528\u3057\u3066\u5909\u63db)]"}, { "diagTiming"," --------- {0} \u306e {1} \u306b\u3088\u308b\u5909\u63db\u306b\u306f {2} \u30df\u30ea\u79d2\u304b\u304b\u308a\u307e\u3057\u305f" }, { "recursionTooDeep","\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30cd\u30b9\u30c8\u304c\u6df1\u3059\u304e\u307e\u3059\u3002 \u30cd\u30b9\u30c8 = {0}\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 {1} {2}" }, { "nameIs", "\u540d\u524d\u306f" }, { "matchPatternIs", "\u30de\u30c3\u30c1\u30f3\u30b0\u30fb\u30d1\u30bf\u30fc\u30f3\u306f" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "\u30a8\u30e9\u30fc: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "\u8b66\u544a: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "\u30d1\u30bf\u30fc\u30f3 "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_hu.java0000644000175000017500000021616210721374032025040 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_hu.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_hu extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Hiba: Nem lehet '{' a kifejez\u00e9seken bel\u00fcl"}, { ER_ILLEGAL_ATTRIBUTE , "A(z) {0}-nak \u00e9rv\u00e9nytelen attrib\u00fatuma van: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "A sourceNode \u00e9rt\u00e9ke null az xsl:apply-imports met\u00f3dusban."}, {ER_CANNOT_ADD, "Nem lehet a(z) {0}-t felvenni a(z) {1}-ba"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "A sourceNode null a handleApplyTemplatesInstruction-ban!"}, { ER_NO_NAME_ATTRIB, "A(z) {0}-nak kell legyen name attrib\u00fatuma."}, {ER_TEMPLATE_NOT_FOUND, "Nem tal\u00e1lhat\u00f3 {0} nev\u0171 sablon"}, {ER_CANT_RESOLVE_NAME_AVT, "Nem lehet feloldani a n\u00e9v AVT-t az xsl:call-template-ben."}, {ER_REQUIRES_ATTRIB, "{0}-nek attrib\u00fatum sz\u00fcks\u00e9ges: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "A(z) {0} -nak kell legyen ''test'' attrib\u00fatuma. "}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Rossz \u00e9rt\u00e9k a level attrib\u00fatumban: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "A feldolgoz\u00e1si utas\u00edt\u00e1s neve nem lehet 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "A feldolgoz\u00e1si utas\u00edt\u00e1s neve \u00e9rv\u00e9nyes NCName kell legyen: {0}"}, { ER_NEED_MATCH_ATTRIB, "A(z) {0}-nek kell legyen illeszked\u00e9si attrib\u00fatuma, ha van m\u00f3dja."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "A(z) {0}-nak kell vagy n\u00e9v vagy illeszked\u00e9si attrib\u00fatum."}, {ER_CANT_RESOLVE_NSPREFIX, "Nem lehet feloldani a n\u00e9vt\u00e9r el\u0151tagot: {0}"}, { ER_ILLEGAL_VALUE, "Az xml:space \u00e9rt\u00e9ke \u00e9rv\u00e9nytelen: {0}"}, { ER_NO_OWNERDOC, "A lesz\u00e1rmazott csom\u00f3pontnak nincs tulajdonos dokumentuma!"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement hiba: {0}"}, { ER_NULL_CHILD, "K\u00eds\u00e9rlet null lesz\u00e1rmazott felv\u00e9tel\u00e9re!"}, { ER_NEED_SELECT_ATTRIB, "A(z) {0}-nak kell kiv\u00e1laszt\u00e1si attrib\u00fatum."}, { ER_NEED_TEST_ATTRIB , "Az xsl:when-nek kell legyen 'test' attrib\u00fatuma."}, { ER_NEED_NAME_ATTRIB, "Az xsl:param-nak kell legyen 'name' attrib\u00fatuma."}, { ER_NO_CONTEXT_OWNERDOC, "A k\u00f6rnyezetnek nincs tulajdonos dokumentuma!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Nem lehet XML TransformerFactory Liaison-t l\u00e9trehozni: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "A Xalan folyamat sikertelen volt."}, { ER_NOT_SUCCESSFUL, "Xalan: sikertelen volt."}, { ER_ENCODING_NOT_SUPPORTED, "A k\u00f3dol\u00e1s nem t\u00e1mogatott: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Nem lehet TraceListener-t l\u00e9trehozni: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "Az xsl:key-nek kell legyen 'name' attrib\u00fatuma!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "Az xsl:key-nek kell legyen 'match' attrib\u00fatuma!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "Az xsl:key-nek kell legyen 'use' attrib\u00fatuma!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) A(z) {0}-nak kell legyen ''elements'' attrib\u00fatuma! "}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) A(z) {0}-nak hi\u00e1nyzik a ''prefix'' attrib\u00fatuma"}, { ER_BAD_STYLESHEET_URL, "A st\u00edluslap URL rossz: {0}"}, { ER_FILE_NOT_FOUND, "A st\u00edluslap f\u00e1jl nem tal\u00e1lhat\u00f3: {0}"}, { ER_IOEXCEPTION, "IO kiv\u00e9tel t\u00f6rt\u00e9nt a st\u00edluslap f\u00e1jln\u00e1l: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) A(z) {0} href attrib\u00fatuma nem tal\u00e1lhat\u00f3"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) A(z) {0} k\u00f6zvetlen\u00fcl vagy k\u00f6zvetetten tartalmazza saj\u00e1t mag\u00e1t!"}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude hiba, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) A(z) {0}-nak hi\u00e1nyzik a ''lang'' attrib\u00fatuma "}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) Rosszul elhelyezett {0} elem?? Hi\u00e1nyzik a ''component'' t\u00e1rol\u00f3elem"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Csak egy Element-be, DocumentFragment-be, Document-be vagy PrintWriter-be lehet kimenetet k\u00fcldeni."}, { ER_PROCESS_ERROR, "StylesheetRoot.process hiba"}, { ER_UNIMPLNODE_ERROR, "UnImplNode hiba: {0}"}, { ER_NO_SELECT_EXPRESSION, "Hiba! Az xpath kiv\u00e1laszt\u00e1si kifejez\u00e9s nem tal\u00e1lhat\u00f3 (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Nem lehet sorbarakni az XSLProcessor-t!"}, { ER_NO_INPUT_STYLESHEET, "Nem adott meg st\u00edluslap bemenetet!"}, { ER_FAILED_PROCESS_STYLESHEET, "Nem siker\u00fclt feldolgozni a st\u00edluslapot!"}, { ER_COULDNT_PARSE_DOC, "Nem lehet elemezni a(z) {0} dokumentumot!"}, { ER_COULDNT_FIND_FRAGMENT, "Nem tal\u00e1lhat\u00f3 a darab: {0}"}, { ER_NODE_NOT_ELEMENT, "A darab azonos\u00edt\u00f3 \u00e1ltal mutatott csom\u00f3pont nem elem: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "A for-each-nek legal\u00e1bb egy match vagy egy name attrib\u00fatuma kell legyen"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "A sablonoknak vagy match vagy name attrib\u00fatumuk kell legyen"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Nincs kl\u00f3nja egy dokumentumdarabnak!"}, { ER_CANT_CREATE_ITEM, "Nem lehet elemet l\u00e9trehozni az eredm\u00e9nyf\u00e1ban: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "Az xml:space-nek a forr\u00e1s XML-ben tiltott \u00e9rt\u00e9ke van: {0}"}, { ER_NO_XSLKEY_DECLARATION, "Nincs xsl:key deklar\u00e1ci\u00f3 a(z) {0}-hoz!"}, { ER_CANT_CREATE_URL, "Hiba! Nem lehet URL-t l\u00e9trehozni ehhez: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "Az xsl:functions nem t\u00e1mogatott"}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory hiba"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) A(z) {0} nem megengedett a st\u00edluslapon bel\u00fcl!"}, { ER_RESULTNS_NOT_SUPPORTED, "A result-ns t\u00f6bb\u00e9 m\u00e1r nem t\u00e1mogatott! Haszn\u00e1lja ink\u00e1bb az xsl:output-ot."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "A default-space t\u00f6bb\u00e9 m\u00e1r nem t\u00e1mogatott! Haszn\u00e1lja ink\u00e1bb az xsl:strip-space-t vagy az xsl:preserve-space-t."}, { ER_INDENTRESULT_NOT_SUPPORTED, "Az indent-result t\u00f6bb\u00e9 m\u00e1r nem t\u00e1mogatott! Haszn\u00e1lja ink\u00e1bb az xsl:output-ot."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) A(z) {0}-nak tiltott attrib\u00fatuma van: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Ismeretlen XSL elem: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) Az xsl:sort csak az xsl:apply-templates-szel vagy xsl:for-each-el egy\u00fctt haszn\u00e1lhat\u00f3."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) Rosszul elhelyezett xsl:when!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) Az xsl:when sz\u00fcl\u0151je nem xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) Rosszul elhelyezett xsl:otherwise!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) Az xsl:otherwise sz\u00fcl\u0151je nem xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) A(z) {0} nem megengedett sablonok belsej\u00e9ben!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) A(z) {0} kiterjeszt\u00e9s n\u00e9vt\u00e9r el\u0151tag {1} ismeretlen"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Az import\u00e1l\u00e1sok csak a st\u00edluslap els\u0151 elemei lehetnek!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) A(z) {0} k\u00f6zvetlen\u00fcl vagy k\u00f6zvetve tartalmazza saj\u00e1t mag\u00e1t!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space \u00e9rt\u00e9ke nem megengedett: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "A processStylesheet sikertelen volt!"}, { ER_SAX_EXCEPTION, "SAX kiv\u00e9tel"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "A f\u00fcggv\u00e9ny nem t\u00e1mogatott!"}, { ER_XSLT_ERROR, "XSLT hiba"}, { ER_CURRENCY_SIGN_ILLEGAL, "A p\u00e9nzjel nem megengedett a form\u00e1tum minta karakterl\u00e1ncban"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "A document funkci\u00f3 nem t\u00e1mogatott a Stylesheet DOM-ban!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Nem lehet feloldani az el\u0151tagot egy nem-el\u0151tag felold\u00f3nak!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "\u00c1tir\u00e1ny\u00edt\u00e1s kiterjeszt\u00e9s: Nem lehet megkapni a f\u00e1jlnevet - a file vagy select attrib\u00fatumnak egy \u00e9rv\u00e9nyes karakterl\u00e1ncot kell visszaadnia."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Nem lehet FormatterListener-t \u00e9p\u00edteni az \u00e1tir\u00e1ny\u00edt\u00e1s kiterjeszt\u00e9sben!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Az el\u0151tag az exclude-result-prefixes-ben nem \u00e9rv\u00e9nyes: {0}"}, { ER_MISSING_NS_URI, "Hi\u00e1nyzik a megadott el\u0151tag n\u00e9vt\u00e9r URI-ja"}, { ER_MISSING_ARG_FOR_OPTION, "Hi\u00e1nyzik az opci\u00f3 argumentuma: {0}"}, { ER_INVALID_OPTION, "\u00c9rv\u00e9nytelen opci\u00f3: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Rossz form\u00e1tum\u00fa karakterl\u00e1nc: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "Az xsl:stylesheet-nek kell legyen 'version' attrib\u00fatuma!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "A(z) {0} attib\u00fatum \u00e9rt\u00e9ke \u00e9rv\u00e9nytelen: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "Az xsl:choose-hoz egy xsl:when sz\u00fcks\u00e9ges"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "Az xsl:apply-imports nem megengedett xsl:for-each-en bel\u00fcl"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Nem haszn\u00e1lhat DTMLiaison-t kimeneti DOM csom\u00f3pontk\u00e9nt... adjon \u00e1t ink\u00e1bb egy org.apache.xpath.DOM2Helper-t!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Nem haszn\u00e1lhat DTMLiaison-t bemeneti DOM csom\u00f3pontk\u00e9nt... adjon \u00e1t ink\u00e1bb egy org.apache.xpath.DOM2Helper-t!"}, { ER_CALL_TO_EXT_FAILED, "A kiterjeszt\u00e9s-elem megh\u00edv\u00e1sa sikertelen volt: {0}"}, { ER_PREFIX_MUST_RESOLVE, "Az el\u0151tagnak egy n\u00e9vt\u00e9rre kell felold\u00f3dnia: {0}"}, { ER_INVALID_UTF16_SURROGATE, "\u00c9rv\u00e9nytelen UTF-16 helyettes\u00edt\u00e9s: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "A(z) {0} xsl:attribute-set-et saj\u00e1t mag\u00e1val haszn\u00e1lta, ami v\u00e9gtelen ciklust eredm\u00e9nyez."}, { ER_CANNOT_MIX_XERCESDOM, "Nem keverheti a nem Xerces-DOM bemenetet a Xerces-DOM kimenettel!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "Az ElemTemplateElement.readObject met\u00f3dusban: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Egyn\u00e9l t\u00f6bb ''{0}'' nev\u0171 sablont tal\u00e1ltam"}, { ER_INVALID_KEY_CALL, "\u00c9rv\u00e9nytelen f\u00fcggv\u00e9nyh\u00edv\u00e1s: rekurz\u00edv key() h\u00edv\u00e1sok nem megengedettek"}, { ER_REFERENCING_ITSELF, "A(z) {0} v\u00e1ltoz\u00f3 k\u00f6zvetlen\u00fcl vagy k\u00f6zvetve \u00f6nmag\u00e1ra hivatkozik!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "A bemeneti csom\u00f3pont nem lehet null egy DOMSource-ban a newTemplates-hez!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Az oszt\u00e1ly f\u00e1jl nem tal\u00e1lhat\u00f3 a(z) {0} opci\u00f3hoz"}, { ER_REQUIRED_ELEM_NOT_FOUND, "A sz\u00fcks\u00e9ges elem nem tal\u00e1lhat\u00f3: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "Az InputStream nem lehet null"}, { ER_URI_CANNOT_BE_NULL, "Az URI nem lehet null"}, { ER_FILE_CANNOT_BE_NULL, "A f\u00e1jl nem lehet null"}, { ER_SOURCE_CANNOT_BE_NULL, "Az InputSource nem lehet null"}, { ER_CANNOT_INIT_BSFMGR, "Nem lehet inicializ\u00e1lni a BSF kezel\u0151t"}, { ER_CANNOT_CMPL_EXTENSN, "Nem lehet leford\u00edtani a kiterjeszt\u00e9st"}, { ER_CANNOT_CREATE_EXTENSN, "Nem lehet l\u00e9trehozni a kiterjeszt\u00e9st ({0}) {1} miatt"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Az {0} met\u00f3dus p\u00e9ld\u00e1ny met\u00f3dush\u00edv\u00e1s\u00e1hoz sz\u00fcks\u00e9g van egy objektump\u00e9ld\u00e1nyra els\u0151 argumentumk\u00e9nt"}, { ER_INVALID_ELEMENT_NAME, "\u00c9rv\u00e9nytelen elemnevet adott meg {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "Az elemn\u00e9v met\u00f3dus statikus {0} kell legyen"}, { ER_EXTENSION_FUNC_UNKNOWN, "{0} kiterjeszt\u00e9s funkci\u00f3 : A(z) {1} ismeretlen"}, { ER_MORE_MATCH_CONSTRUCTOR, "T\u00f6bb legjobb illeszked\u00e9s a(z) {0} konstruktor\u00e1ra"}, { ER_MORE_MATCH_METHOD, "T\u00f6bb legjobb illeszked\u00e9s a(z) {0} met\u00f3dusra"}, { ER_MORE_MATCH_ELEMENT, "T\u00f6bb legjobb illeszked\u00e9s a(z) {0} elem met\u00f3dusra"}, { ER_INVALID_CONTEXT_PASSED, "\u00c9rv\u00e9nytelen k\u00f6rnyzetet adott \u00e1t a(z) {0} ki\u00e9rt\u00e9kel\u00e9s\u00e9hez"}, { ER_POOL_EXISTS, "A t\u00e1rol\u00f3 m\u00e1r l\u00e9tezik"}, { ER_NO_DRIVER_NAME, "Nem adott meg meghajt\u00f3nevet"}, { ER_NO_URL, "Nem adott meg URL-t"}, { ER_POOL_SIZE_LESSTHAN_ONE, "A t\u00e1rol\u00f3 m\u00e9rete egyn\u00e9l kisebb!"}, { ER_INVALID_DRIVER, "\u00c9rv\u00e9nytelen meghajt\u00f3nevet adott meg!"}, { ER_NO_STYLESHEETROOT, "Nem tal\u00e1lhat\u00f3 a st\u00edluslap gy\u00f6kere!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Tiltott \u00e9rt\u00e9k az xml:space-hez"}, { ER_PROCESSFROMNODE_FAILED, "A processFromNode nem siker\u00fclt"}, { ER_RESOURCE_COULD_NOT_LOAD, "Az er\u0151forr\u00e1st [ {0} ] nem lehet bet\u00f6lteni: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Pufferm\u00e9ret <= 0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Ismeretlen hiba a kiterjeszt\u00e9s h\u00edv\u00e1s\u00e1n\u00e1l"}, { ER_NO_NAMESPACE_DECL, "A(z) {0} el\u0151taghoz nem tartozik n\u00e9vt\u00e9r deklar\u00e1ci\u00f3"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Elem tartalom nem megengedett a(z) {0} lang=javaclass-hoz"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "St\u00edluslap \u00e1ltal ir\u00e1ny\u00edtott le\u00e1ll\u00e1s"}, { ER_ONE_OR_TWO, "1 vagy 2"}, { ER_TWO_OR_THREE, "2 vagy 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Nem lehet bet\u00f6lteni a(z) {0}-t (ellen\u0151rizze a CLASSPATH-t), most csak az alap\u00e9rtelmez\u00e9seket haszn\u00e1ljuk"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Nem lehet inicializ\u00e1lni az alap\u00e9rtelmezett sablonokat"}, { ER_RESULT_NULL, "Az eredm\u00e9ny nem lehet null"}, { ER_RESULT_COULD_NOT_BE_SET, "Nem lehet be\u00e1ll\u00edtani az eredm\u00e9nyt"}, { ER_NO_OUTPUT_SPECIFIED, "Nem adott meg kimenetet"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Nem alak\u00edthat\u00f3 \u00e1t {0} t\u00edpus\u00fa eredm\u00e9nny\u00e9"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "A(z) {0} t\u00edpus\u00fa forr\u00e1s nem alak\u00edthat\u00f3 \u00e1t "}, { ER_NULL_CONTENT_HANDLER, "Null tartalomkezel\u0151"}, { ER_NULL_ERROR_HANDLER, "Null hibakezel\u0151"}, { ER_CANNOT_CALL_PARSE, "A parse nem h\u00edvhat\u00f3 meg, ha a ContentHandler-t nem \u00e1ll\u00edtotta be"}, { ER_NO_PARENT_FOR_FILTER, "A sz\u0171r\u0151nek nincs sz\u00fcl\u0151je"}, { ER_NO_STYLESHEET_IN_MEDIA, "Nincs st\u00edluslap ebben: {0}, adathordoz\u00f3: {1}"}, { ER_NO_STYLESHEET_PI, "Nem tal\u00e1lhat\u00f3 xml-stylesheet PI itt: {0}"}, { ER_NOT_SUPPORTED, "Nem t\u00e1mogatott: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "A(z) {0} tulajdons\u00e1g \u00e9rt\u00e9ke Boolean p\u00e9ld\u00e1ny kell legyen"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Nem lehet eljutni a k\u00fcls\u0151 parancsf\u00e1jlhoz a(z) {0}-n"}, { ER_RESOURCE_COULD_NOT_FIND, "A(z) [ {0} ] er\u0151forr\u00e1s nem tal\u00e1lhat\u00f3.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "A kimeneti tulajdons\u00e1g nem felismerhet\u0151: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Nem siker\u00fclt ElemLiteralResult p\u00e9ld\u00e1nyt l\u00e9trehozni"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "A(z) {0} tulajdons\u00e1g \u00e9rt\u00e9ke \u00e9rtelmezhet\u0151 sz\u00e1m kell legyen"}, { ER_VALUE_SHOULD_EQUAL, "A(z) {0} \u00e9rt\u00e9ke igen vagy nem kell legyen"}, { ER_FAILED_CALLING_METHOD, "Nem siker\u00fclt megh\u00edvni a(z) {0} met\u00f3dust"}, { ER_FAILED_CREATING_ELEMTMPL, "Nem siker\u00fclt ElemTemplateElement p\u00e9ld\u00e1nyt l\u00e9trehozni"}, { ER_CHARS_NOT_ALLOWED, "Karakterek nem megengedettek a dokumentumnak ezen a pontj\u00e1n"}, { ER_ATTR_NOT_ALLOWED, "A(z) \"{0}\" attrib\u00fatum nem megengedett a(z) {1} elemhez!"}, { ER_BAD_VALUE, "{0} rossz \u00e9rt\u00e9k {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "{0} attrib\u00fatum \u00e9rt\u00e9k nem tal\u00e1lhat\u00f3 "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "{0} attrib\u00fatum \u00e9rt\u00e9k ismeretlen "}, { ER_NULL_URI_NAMESPACE, "K\u00eds\u00e9rlet egy n\u00e9vt\u00e9r el\u0151tag l\u00e9trehoz\u00e1s\u00e1ra null URI-val"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "K\u00eds\u00e9rlet egy sz\u00e1m megform\u00e1z\u00e1s\u00e1ra, ami nagyobb, mint a legnagyobb Long eg\u00e9sz"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Nem tal\u00e1lhat\u00f3 a(z) {0} SAX1 meghajt\u00f3oszt\u00e1ly"}, { ER_SAX1_DRIVER_NOT_LOADED, "A(z) {0} SAX1 meghajt\u00f3oszt\u00e1ly megvan, de nem t\u00f6lthet\u0151 be"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "A(z) {0} SAX1 meghajt\u00f3oszt\u00e1ly bet\u00f6ltve, de nem lehet p\u00e9ld\u00e1nyt l\u00e9trehozni bel\u0151le"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "A(z) {0} SAX1 meghajt\u00f3oszt\u00e1ly nem implement\u00e1lja az org.xml.sax.Parser-t"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Nem adta meg az org.xml.sax.parser rendszertulajdons\u00e1got"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Az \u00e9rtelmez\u0151 argumentuma nem lehet null"}, { ER_FEATURE, "K\u00e9pess\u00e9g: {0}"}, { ER_PROPERTY, "Tulajdons\u00e1g: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Null entit\u00e1s felold\u00f3"}, { ER_NULL_DTD_HANDLER, "Null DTD kezel\u0151"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Nem adott meg meghajt\u00f3nevet!"}, { ER_NO_URL_SPECIFIED, "Nem adott meg URL-t!"}, { ER_POOLSIZE_LESS_THAN_ONE, "A t\u00e1rol\u00f3 m\u00e9rete 1-n\u00e9l kisebb!"}, { ER_INVALID_DRIVER_NAME, "\u00c9rv\u00e9nytelen meghajt\u00f3nevet adott meg!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Programoz\u00f3i hiba! A kifejez\u00e9snek nincs ElemTemplateElement sz\u00fcl\u0151je!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Programoz\u00f3i \u00e9rtes\u00edt\u00e9s a RedundentExprEliminator h\u00edv\u00e1sban: {0} "}, { ER_NOT_ALLOWED_IN_POSITION, "{0} nem enged\u00e9lyezett a st\u00edluslap ezen hely\u00e9n!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Nem-szepar\u00e1tor sz\u00f6veg nem megengedett a st\u00edluslap ezen hely\u00e9n!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} attrib\u00fatumhoz: {1}. A CHAR t\u00edpus\u00fa attrib\u00fatum csak 1 karakter lehet!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} CHAR attrib\u00fatumhoz: {1}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} ENUM attrib\u00fatumhoz: {1}. Az \u00e9rv\u00e9nyes \u00e9rt\u00e9kek: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} NMTOKEN attrib\u00fatumhoz: {1}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} NCNAME attrib\u00fatumhoz: {1}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} logikai attrib\u00fatumhoz: {1}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Tiltott \u00e9rt\u00e9ket haszn\u00e1lt a(z) {0} sz\u00e1m attrib\u00fatumhoz: {1}. "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "A(z) {0} argumentuma az illeszked\u00e9si mint\u00e1ban egy liter\u00e1l kell legyen."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "K\u00e9tszer szerepel a glob\u00e1lis v\u00e1ltoz\u00f3-deklar\u00e1ci\u00f3."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "K\u00e9tszer szerepel a v\u00e1ltoz\u00f3-deklar\u00e1ci\u00f3."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "Az xsl:template-nek kell legyen neve vagy illeszked\u00e9si attrib\u00fatuma (vagy mindkett\u0151)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Az el\u0151tag az exclude-result-prefixes-ben nem \u00e9rv\u00e9nyes: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "A(z) {0} nev\u0171 attribute-set nem l\u00e9tezik"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "A(z) {0} nev\u0171 funkci\u00f3 nem l\u00e9tezik"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "A(z) {0} elemnek nem lehet egyszerre content \u00e9s select attrib\u00fatuma."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "A(z) {0} param\u00e9ter \u00e9rt\u00e9ke egy \u00e9rv\u00e9nyes J\u00e1va objektum kell legyen"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Az xsl:namespace-alias elem result-prefix r\u00e9sz\u00e9nek \u00e9rt\u00e9ke '#default', de nincs meghat\u00e1rozva alap\u00e9rtelmezett n\u00e9vt\u00e9r az elem hat\u00f3k\u00f6r\u00e9ben. "}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Egy xsl:namespace-alias elem result-prefix attrib\u00fatum\u00e1nak \u00e9rt\u00e9ke ''{0}'', de nincs n\u00e9vt\u00e9r deklar\u00e1ci\u00f3 a(z) ''{0}'' el\u0151taghoz az elem hat\u00f3k\u00f6r\u00e9ben. "}, { ER_SET_FEATURE_NULL_NAME, "A szolg\u00e1ltat\u00e1s neve nem lehet null a TransformerFactory.setFeature(String name, boolean value) met\u00f3dusban."}, { ER_GET_FEATURE_NULL_NAME, "A szolg\u00e1ltat\u00e1s neve nem lehet null a TransformerFactory.getFeature(String name) met\u00f3dusban."}, { ER_UNSUPPORTED_FEATURE, "A(z) ''{0}'' szolg\u00e1ltat\u00e1s nem \u00e1ll\u00edthat\u00f3 be ehhez a TransformerFactory oszt\u00e1lyhoz."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "A(z) ''{0}'' kiterjeszt\u00e9si elem haszn\u00e1lata nem megengedett, ha biztons\u00e1gos feldolgoz\u00e1s be van kapcsolva. "}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Nem lehet beolvasni az el\u0151tagot null n\u00e9vt\u00e9r URI eset\u00e9n. "}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Nem olvashat\u00f3 be a n\u00e9vt\u00e9r null el\u0151tag miatt. "}, { ER_XPATH_RESOLVER_NULL_QNAME, "A f\u00fcggv\u00e9ny neve nem lehet null."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Az arit\u00e1s nem lehet negat\u00edv."}, // Warnings... { WG_FOUND_CURLYBRACE, "'}'-t tal\u00e1ltunk, de nincs attrib\u00fatumsablon megnyitva!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Figyelmeztet\u00e9s: A count attrib\u00fatum nem felel meg a egy felmen\u0151nek az xsl:number-ben! C\u00e9l = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "R\u00e9gi szintaktika: Az 'expr' attrib\u00fatum neve 'select'-re v\u00e1ltozott."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Az Xalan m\u00e9g nem kezeli a locale nevet a format-number f\u00fcggv\u00e9nyben."}, { WG_LOCALE_NOT_FOUND, "Figyelmeztet\u00e9s: Nem tal\u00e1lhat\u00f3 az xml:lang={0} \u00e9rt\u00e9khez tartoz\u00f3 locale"}, { WG_CANNOT_MAKE_URL_FROM, "Nem k\u00e9sz\u00edthet\u0151 URL ebb\u0151l: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "A k\u00e9r dokumentum nem t\u00f6lthet\u0151 be: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Nem tal\u00e1lhat\u00f3 Collator a >>>>>> Xalan verzi\u00f3 "}, { "version2", "<<<<<<<"}, { "yes", "igen"}, { "line", "Sor #"}, { "column","Oszlop #"}, { "xsldone", "XSLProcessor: k\u00e9sz"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J parancssori Process oszt\u00e1ly opci\u00f3k:"}, { "xslProc_option", "Xalan-J parancssori Process oszt\u00e1ly opci\u00f3k\u003a"}, { "xslProc_invalid_xsltc_option", "A(z) {0} opci\u00f3 nem t\u00e1mogatott XSLTC m\u00f3dban."}, { "xslProc_invalid_xalan_option", "A(z) {0} opci\u00f3 csak -XSLTC-vel egy\u00fctt haszn\u00e1lhat\u00f3."}, { "xslProc_no_input", "Hiba: Nem adott meg st\u00edluslapot vagy bemeneti xml-t. Futtassa ezt a parancsot kapcsol\u00f3k n\u00e9lk\u00fcl a haszn\u00e1lati utas\u00edt\u00e1sok megjelen\u00edt\u00e9s\u00e9re."}, { "xslProc_common_options", "-\u00c1ltal\u00e1nos opci\u00f3k-"}, { "xslProc_xalan_options", "-Xalan opci\u00f3k-"}, { "xslProc_xsltc_options", "-XSLTC opci\u00f3k-"}, { "xslProc_return_to_continue", "(nyomja la a gombot a folytat\u00e1shoz)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (XSLTC-t haszn\u00e1l a transzform\u00e1l\u00e1shoz)]"}, { "optionIN", " [-IN bemenetiXMLURL]"}, { "optionXSL", " [-XSL XSLTranszform\u00e1ci\u00f3sURL]"}, { "optionOUT", " [-OUT kimenetiF\u00e1jln\u00e9v]"}, { "optionLXCIN", " [-LXCIN leford\u00edtottst\u00edluslapF\u00e1jln\u00e9vBe]"}, { "optionLXCOUT", " [-LXCOUT leford\u00edtottSt\u00edluslapF\u00e1jln\u00e9vKi]"}, { "optionPARSER", " [-PARSER az \u00e9rtelmez\u0151kapcsolat teljesen meghat\u00e1rozott oszt\u00e1lyneve]"}, { "optionE", " [-E (Nem bontja ki az entit\u00e1s hivatkoz\u00e1sokat)]"}, { "optionV", " [-E (Nem bontja ki az entit\u00e1s hivatkoz\u00e1sokat)]"}, { "optionQC", " [-QC (Csendes mintakonfliktus figyelmeztet\u00e9sek)]"}, { "optionQ", " [-Q (Csendes m\u00f3d)]"}, { "optionLF", " [-LF (A soremel\u00e9seket csak kimenet eset\u00e9n haszn\u00e1lja {alap\u00e9rtelmez\u00e9s: CR/LF})]"}, { "optionCR", " [-CR (A kocsivissza karaktert csak kimenet eset\u00e9n haszn\u00e1lja {alap\u00e9rtelmez\u00e9s: CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Mely karaktereket kell escape-elni {alap\u00e9rtelmez\u00e9s: <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Meghat\u00e1rozza, hogy h\u00e1ny sz\u00f3k\u00f6zzel kell beljebb kezdeni {alap\u00e9rtelmez\u00e9s: 0})]"}, { "optionTT", " [-TT (Nyomk\u00f6veti a sablonokat, ahogy azokat megh\u00edvj\u00e1k.)]"}, { "optionTG", " [-TG (Nyomk\u00f6veti az \u00f6sszes gener\u00e1l\u00e1si esem\u00e9nyt.)]"}, { "optionTS", " [-TS (Nyomk\u00f6veti az \u00f6sszes kiv\u00e1laszt\u00e1si esem\u00e9nyt.)]"}, { "optionTTC", " [-TTC (Nyomk\u00f6veti a sablon-lesz\u00e1rmazottakat, ahogy azokat feldolgozz\u00e1k.)]"}, { "optionTCLASS", " [-TCLASS (TraceListener oszt\u00e1ly a nyomk\u00f6vet\u00e9si kiterjeszt\u00e9sekhez.)]"}, { "optionVALIDATE", " [-VALIDATE (Be\u00e1ll\u00edtja, hogy legyen-e \u00e9rv\u00e9nyess\u00e9gvizsg\u00e1lat. Alap\u00e9rtelmez\u00e9sben nincs \u00e9rv\u00e9nyess\u00e9gvizsg\u00e1lat.)]"}, { "optionEDUMP", " [-EDUMP {opcion\u00e1lis f\u00e1jln\u00e9v} (Hib\u00e1n\u00e1l stackdump-ot hajt v\u00e9gre.)]"}, { "optionXML", " [-XML (XML form\u00e1z\u00f3 haszn\u00e1lata \u00e9s XML fejl\u00e9c hozz\u00e1ad\u00e1sa.)]"}, { "optionTEXT", " [-TEXT (Egyszer\u0171 sz\u00f6vegform\u00e1z\u00f3 haszn\u00e1lata.)]"}, { "optionHTML", " [-HTML (HTML form\u00e1z\u00f3 haszn\u00e1lata.)]"}, { "optionPARAM", " [-PARAM n\u00e9v kifejez\u00e9s (Be\u00e1ll\u00edt egy st\u00edluslap param\u00e9tert)]"}, { "noParsermsg1", "Az XSL folyamat sikertelen volt."}, { "noParsermsg2", "** Az \u00e9rtelmez\u0151 nem tal\u00e1lhat\u00f3 **"}, { "noParsermsg3", "K\u00e9rem, ellen\u0151rizze az oszt\u00e1ly el\u00e9r\u00e9si utat."}, { "noParsermsg4", "Ha \u00f6nnek nincs meg az IBM Java XML \u00e9rtelmez\u0151je, akkor let\u00f6ltheti az"}, { "noParsermsg5", "az IBM AlphaWorks weblapr\u00f3l: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER teljes oszt\u00e1lyn\u00e9v (az URIResolver fogja feloldani az URI-kat)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER teljes oszt\u00e1lyn\u00e9v (az EntityResolver fogja feloldani az entit\u00e1sokat)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER teljes oszt\u00e1lyn\u00e9v (a ContentHandler fogja soros\u00edtani a kimenetet)]"}, { "optionLINENUMBERS", " [-L sorsz\u00e1mokat haszn\u00e1l a forr\u00e1sdokumentumhoz]"}, { "optionSECUREPROCESSING", " [-SECURE (biztons\u00e1gos feldolgoz\u00e1s szolg\u00e1ltat\u00e1s igazra \u00e1ll\u00edt\u00e1sa.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA adathordoz\u00f3T\u00edpus (a media attrib\u00fatum seg\u00edts\u00e9g\u00e9vel megkeresi a dokumentumhoz tartoz\u00f3 st\u00edluslapot.)]"}, { "optionFLAVOR", " [-FLAVOR \u00edzl\u00e9sN\u00e9v (Explicit haszn\u00e1lja az s2s=SAX-ot vagy d2d=DOM-ot a transzform\u00e1ci\u00f3hoz.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Ki\u00edrja, hogy \u00f6sszesen h\u00e1ny ezredm\u00e1sodpercig tartott a transzform\u00e1ci\u00f3.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (n\u00f6vekm\u00e9nyes DTM l\u00e9trehoz\u00e1st ig\u00e9nyel a http://xml.apache.org/xalan/features/incremental igazra \u00e1ll\u00edt\u00e1s\u00e1val.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (nem ig\u00e9nyel st\u00edluslap optimiz\u00e1l\u00e1st a http://xml.apache.org/xalan/features/optimize hamisra \u00e1ll\u00edt\u00e1s\u00e1t.)]"}, { "optionRL", " [-RL rekurzi\u00f3korl\u00e1t (numerikusan korl\u00e1tozza a st\u00edluslap rekurzi\u00f3 m\u00e9lys\u00e9g\u00e9t.)]"}, { "optionXO", " [-XO [transletNeve] (a nevet rendeli a gener\u00e1lt translethez)]"}, { "optionXD", " [-XD c\u00e9lAlk\u00f6nyvt\u00e1r (a translet c\u00e9l-alk\u00f6nyvt\u00e1ra)]"}, { "optionXJ", " [-XJ jarf\u00e1jl (a translet oszt\u00e1lyokat a megadott -ba csomagolja)]"}, { "optionXP", " [-XP csomag (megadja a gener\u00e1lt translet oszt\u00e1lyok n\u00e9v-prefix\u00e9t)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (enged\u00e9lyezi a template inlining optimaliz\u00e1l\u00e1st)]" }, { "optionXX", " [-XX (bekapcsolja a tov\u00e1bbi hibakeres\u00e9si kimenetet)]"}, { "optionXT" , " [-XT (translet-et haszn\u00e1lt az \u00e1talak\u00edt\u00e1shoz, ha lehet)]"}, { "diagTiming"," --------- A(z) {0} tarnszform\u00e1ci\u00f3a a(z) {1}-el {2} ms-ig tartott" }, { "recursionTooDeep","A sablonon egym\u00e1sba \u00e1gyaz\u00e1sa t\u00fal m\u00e9ly. Be\u00e1gyaz\u00e1s = {0}, sablon: {1} {2}" }, { "nameIs", "A n\u00e9v:" }, { "matchPatternIs", "Az illeszked\u00e9si minta:" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Hiba: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Figyelmeztet\u00e9s: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "MINTA "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("hu", "HU")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_es.java0000644000175000017500000021044310721374031025026 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_es.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_es extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Error: No puede haber '{' dentro de la expresi\u00f3n"}, { ER_ILLEGAL_ATTRIBUTE , "{0} tiene un atributo no permitido: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode es nulo en xsl:apply-imports."}, {ER_CANNOT_ADD, "No se puede a\u00f1adir {0} a {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode es nulo en handleApplyTemplatesInstruction."}, { ER_NO_NAME_ATTRIB, "{0} debe tener un atributo de nombre."}, {ER_TEMPLATE_NOT_FOUND, "No se ha podido encontrar la plantilla: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "No se ha podido resolver AVT de nombre en xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} necesita un atributo: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} debe tener un atributo ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Valor incorrecto en atributo de nivel: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Nombre de processing-instruction no puede ser 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "Nombre de processing-instruction debe ser un NCName v\u00e1lido: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} debe tener un atributo de coincidencia si tiene una modalidad."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} necesita un atributo de nombre o de coincidencia."}, {ER_CANT_RESOLVE_NSPREFIX, "No se puede resolver el prefijo del espacio de nombres: {0}"}, { ER_ILLEGAL_VALUE, "xml:space tiene un valor no permitido: {0}"}, { ER_NO_OWNERDOC, "El nodo hijo no tiene un documento propietario."}, { ER_ELEMTEMPLATEELEM_ERR, "Error de ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "Intentando a\u00f1adir un hijo nulo"}, { ER_NEED_SELECT_ATTRIB, "{0} necesita un atributo de selecci\u00f3n."}, { ER_NEED_TEST_ATTRIB , "xsl:when debe tener un atributo 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param debe tener un atributo 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "El contexto no tiene un documento propietario."}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "No se ha podido crear Liaison TransformerFactory XML: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "El proceso Xalan no ha sido satisfactorio."}, { ER_NOT_SUCCESSFUL, "Xalan no ha sido satisfactorio."}, { ER_ENCODING_NOT_SUPPORTED, "Codificaci\u00f3n no soportada: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "No se ha podido crear TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key necesita un atributo 'name'."}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key necesita un atributo 'match'."}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key necesita un atributo 'use'."}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} necesita un atributo ''elements'' "}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) Falta el atributo ''prefix'' de {0} "}, { ER_BAD_STYLESHEET_URL, "El URL de la hoja de estilos es incorrecto: {0}"}, { ER_FILE_NOT_FOUND, "No se ha encontrado el archivo de hoja de estilos: {0}"}, { ER_IOEXCEPTION, "Se ha producido una excepci\u00f3n de ES con el archivo de hoja de estilos: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) No se ha podido encontrar el atributo href para {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) Inclusi\u00f3n propia de {0} directa o indirectamente."}, { ER_PROCESSINCLUDE_ERROR, "Error de StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) Falta el atributo ''lang'' de {0}"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) Elemento {0} incorrecto. Falta el elemento de contenedor ''component''."}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "S\u00f3lo se puede dar salida hacia Element, DocumentFragment, Document o PrintWriter."}, { ER_PROCESS_ERROR, "Error de StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Error de UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Error. No se ha encontrado la expresi\u00f3n de selecci\u00f3n (-select) de xpath."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "No se puede serializar un XSLProcessor."}, { ER_NO_INPUT_STYLESHEET, "No se ha especificado la entrada de hoja de estilos."}, { ER_FAILED_PROCESS_STYLESHEET, "No se ha podido procesar la hoja de estilos."}, { ER_COULDNT_PARSE_DOC, "No se ha podido analizar el documento {0}."}, { ER_COULDNT_FIND_FRAGMENT, "No se ha podido encontrar el fragmento: {0}"}, { ER_NODE_NOT_ELEMENT, "El nodo se\u00f1alado por un identificador de fragmento no es un elemento: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each debe tener un atributo de coincidencia o de nombre."}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates debe tener un atributo de coincidencia o de nombre."}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "No es r\u00e9plica de un fragmento de documento."}, { ER_CANT_CREATE_ITEM, "No se puede crear el elemento en el \u00e1rbol de resultados: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space en el XML fuente tiene un valor no permitido: {0}"}, { ER_NO_XSLKEY_DECLARATION, "No hay declaraci\u00f3n xsl:key para {0}."}, { ER_CANT_CREATE_URL, "Error. No se puede crear url para: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions no est\u00e1 soportado"}, { ER_PROCESSOR_ERROR, "Error de XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} no permitido dentro de una hoja de estilos."}, { ER_RESULTNS_NOT_SUPPORTED, "Ya no se soporta result-ns. Utilice xsl:output en su lugar."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "Ya no se soporta default-space. Utilice xsl:strip-space o xsl:preserve-space en su lugar."}, { ER_INDENTRESULT_NOT_SUPPORTED, "Ya no se soporta indent-result. Utilice xsl:output en su lugar."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} tiene un atributo no permitido: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Elemento XSL desconocido: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort s\u00f3lo puede utilizarse con xsl:apply-templates o xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when equivocado."}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when no emparentado por xsl:choose."}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise equivocado."}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise no emparentado por xsl:choose."}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} no permitido dentro de una plantilla."}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) Prefijo {1} de espacio de nombres de extensi\u00f3n {0} desconocido"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Las importaciones s\u00f3lo pueden aparecer como primeros elementos de la hoja de estilos."}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) Importaci\u00f3n propia de {0} directa o indirectamente."}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space tiene un valor no permitido: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet no satisfactorio."}, { ER_SAX_EXCEPTION, "Excepci\u00f3n SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Funci\u00f3n no soportada."}, { ER_XSLT_ERROR, "Error de XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "El signo monetario no est\u00e1 permitido en la serie del patr\u00f3n de formato"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "La funci\u00f3n de documento no est\u00e1 soportada en DOM de hoja de estilos."}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "No se puede resolver el prefijo de un resolucionador sin prefijo."}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Extensi\u00f3n Redirect: No se ha podido obtener el nombre de archivo - el atributo de archivo o de selecci\u00f3n debe devolver una serie v\u00e1lida."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "No se puede crear FormatterListener en extensi\u00f3n Redirect."}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "El prefijo en exclude-result-prefixes no es v\u00e1lido: {0}"}, { ER_MISSING_NS_URI, "Falta el URI del espacio de nombres para el prefijo especificado"}, { ER_MISSING_ARG_FOR_OPTION, "Falta un argumento para la opci\u00f3n: {0}"}, { ER_INVALID_OPTION, "Opci\u00f3n no v\u00e1lida: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Serie de formato mal formada: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet necesita un atributo 'version'."}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Atributo: {0} tiene un valor no permitido: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose necesita un xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports no permitido en xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "No se puede utilizar DTMLiaison para un nodo DOM de salida... Pase org.apache.xpath.DOM2Helper en su lugar."}, { ER_CANT_USE_DTM_FOR_INPUT, "No se puede utilizar DTMLiaison para un nodo DOM de entrada... Pase org.apache.xpath.DOM2Helper en su lugar."}, { ER_CALL_TO_EXT_FAILED, "Anomal\u00eda al llamar al elemento de extensi\u00f3n: {0}"}, { ER_PREFIX_MUST_RESOLVE, "El prefijo debe resolverse como un espacio de nombres: {0}"}, { ER_INVALID_UTF16_SURROGATE, "\u00bfSe ha detectado un sustituto UTF-16 no v\u00e1lido: {0}?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} se ha utilizado a s\u00ed mismo lo que puede provocar un bucle infinito."}, { ER_CANNOT_MIX_XERCESDOM, "No se puede mezclar la entrada Xerces-DOM con la salida Xerces-DOM."}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "En ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Se ha encontrado m\u00e1s de una plantilla con el nombre: {0}"}, { ER_INVALID_KEY_CALL, "Llamada de funci\u00f3n no v\u00e1lida: no est\u00e1n permitidas las llamadas key() recursivas"}, { ER_REFERENCING_ITSELF, "La variable {0} se est\u00e1 referenciando a s\u00ed misma directa o indirectamente."}, { ER_ILLEGAL_DOMSOURCE_INPUT, "El nodo de entrada no puede ser nulo para DOMSource de newTemplates."}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "No se ha encontrado el archivo de clase para la opci\u00f3n {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "No se ha encontrado un elemento necesario: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream no puede ser nulo"}, { ER_URI_CANNOT_BE_NULL, "URI no puede ser nulo"}, { ER_FILE_CANNOT_BE_NULL, "Archivo no puede ser nulo"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource no puede ser nulo"}, { ER_CANNOT_INIT_BSFMGR, "No se ha podido inicializar el Gestor BSF"}, { ER_CANNOT_CMPL_EXTENSN, "No se ha podido compilar la extensi\u00f3n"}, { ER_CANNOT_CREATE_EXTENSN, "No se ha podido crear la extensi\u00f3n: {0} como consecuencia de: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "La llamada del m\u00e9todo de instancia al m\u00e9todo {0} necesita una instancia Object como primer argumento"}, { ER_INVALID_ELEMENT_NAME, "Se ha especificado un nombre de elemento no v\u00e1lido {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "El m\u00e9todo del nombre de elemento debe ser est\u00e1tico {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Funci\u00f3n de extensi\u00f3n {0} : {1} desconocida"}, { ER_MORE_MATCH_CONSTRUCTOR, "Hay m\u00e1s de una coincidencia m\u00e1xima para el constructor de {0}"}, { ER_MORE_MATCH_METHOD, "Hay m\u00e1s de una coincidencia m\u00e1xima para el m\u00e9todo {0}"}, { ER_MORE_MATCH_ELEMENT, "Hay m\u00e1s de una coincidencia m\u00e1xima para el m\u00e9todo de elemento {0}"}, { ER_INVALID_CONTEXT_PASSED, "Se ha pasado un contexto no v\u00e1lido para evaluar {0}"}, { ER_POOL_EXISTS, "La agrupaci\u00f3n ya existe"}, { ER_NO_DRIVER_NAME, "No se ha especificado un nombre de controlador"}, { ER_NO_URL, "No se ha especificado un URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "El tama\u00f1o de la agrupaci\u00f3n es menor que uno."}, { ER_INVALID_DRIVER, "Se ha especificado un nombre de controlador no v\u00e1lido."}, { ER_NO_STYLESHEETROOT, "No se ha encontrado la ra\u00edz de la hoja de estilos."}, { ER_ILLEGAL_XMLSPACE_VALUE, "Valor no permitido para xml:space"}, { ER_PROCESSFROMNODE_FAILED, "Anomal\u00eda de processFromNode"}, { ER_RESOURCE_COULD_NOT_LOAD, "No se ha podido cargar el recurso [ {0} ]: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Tama\u00f1o de almacenamiento intermedio <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Error desconocido al llamar a la extensi\u00f3n"}, { ER_NO_NAMESPACE_DECL, "El prefijo {0} no tiene una declaraci\u00f3n de espacio de nombres correspondiente"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "No se permite el contenido del elemento para lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Terminaci\u00f3n de hoja de estilos dirigida"}, { ER_ONE_OR_TWO, "1 \u00f3 2"}, { ER_TWO_OR_THREE, "2 \u00f3 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "No se ha podido cargar {0} (compruebe la CLASSPATH), ahora s\u00f3lo se est\u00e1n utilizando los valores predeterminados"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "No se han podido inicializar las plantillas predeterminadas"}, { ER_RESULT_NULL, "El resultado no deber\u00eda ser nulo"}, { ER_RESULT_COULD_NOT_BE_SET, "No se ha podido establecer el resultado"}, { ER_NO_OUTPUT_SPECIFIED, "No se ha especificado salida"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "No se puede transformar un resultado de tipo {0} "}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "No se puede transformar un fuente de tipo {0} "}, { ER_NULL_CONTENT_HANDLER, "Manejador de contenido nulo"}, { ER_NULL_ERROR_HANDLER, "Manejador de error nulo"}, { ER_CANNOT_CALL_PARSE, "No se puede llamar a parse si no se ha establecido ContentHandler"}, { ER_NO_PARENT_FOR_FILTER, "No hay padre para el filtro"}, { ER_NO_STYLESHEET_IN_MEDIA, "No se han encontrado hojas de estilos en: {0}, soporte= {1}"}, { ER_NO_STYLESHEET_PI, "No se ha encontrado xml-stylesheet PI en: {0}"}, { ER_NOT_SUPPORTED, "No soportado: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "El valor de la propiedad {0} deber\u00eda ser una instancia Boolean"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "No se ha podido encontrar el script externo en {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "No se ha podido encontrar el recurso [ {0} ].\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "No se reconoce la propiedad de salida: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Anomal\u00eda al crear la instancia ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "El valor para {0} deber\u00eda contener un n\u00famero analizable"}, { ER_VALUE_SHOULD_EQUAL, "El valor de {0} deber\u00eda ser s\u00ed o no"}, { ER_FAILED_CALLING_METHOD, "Anomal\u00eda al llamar al m\u00e9todo {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "Anomal\u00eda al crear la instancia ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "No se permiten caracteres en este punto del documento"}, { ER_ATTR_NOT_ALLOWED, "El atributo \"{0}\" no est\u00e1 permitido en el elemento {1}."}, { ER_BAD_VALUE, "{0} valor incorrecto {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "No se ha encontrado el valor del atributo {0} "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "No se ha reconocido el valor del atributo {0} "}, { ER_NULL_URI_NAMESPACE, "Se ha intentado generar un prefijo de espacio de nombres con un URI nulo"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Se ha intentado formatear un n\u00famero mayor que el entero largo m\u00e1s grande"}, { ER_CANNOT_FIND_SAX1_DRIVER, "No se ha podido encontrar la clase de controlador SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "Se ha encontrado la clase de controlador SAX1 {0} pero no se ha podido cargar"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "Se ha cargado la clase de controlador SAX1 {0} pero no se ha podido crear una instancia"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "La clase de controlador SAX1 {0} no implementa org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "No se ha especificado la propiedad del sistema org.xml.sax.parser"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "El argumento del analizador no debe ser nulo"}, { ER_FEATURE, "Caracter\u00edstica: {0}"}, { ER_PROPERTY, "Propiedad: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Resolucionador de entidad nulo"}, { ER_NULL_DTD_HANDLER, "Manejador DTD nulo"}, { ER_NO_DRIVER_NAME_SPECIFIED, "No se ha especificado un nombre de controlador."}, { ER_NO_URL_SPECIFIED, "No se ha especificado un URL."}, { ER_POOLSIZE_LESS_THAN_ONE, "El tama\u00f1o de la agrupaci\u00f3n es menor que 1."}, { ER_INVALID_DRIVER_NAME, "Se ha especificado un nombre de controlador no v\u00e1lido."}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Error del programador. La expresi\u00f3n no tiene un padre ElemTemplateElement."}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Aserci\u00f3n del programador en RedundentExprEliminator: {0} "}, { ER_NOT_ALLOWED_IN_POSITION, "{0} no est\u00e1 permitido en esta posici\u00f3n de la hoja de estilos."}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "No est\u00e1 permitido texto sin espacios en blanco en esta posici\u00f3n de la hoja de estilos."}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Valor no permitido: se ha utilizado {1} para el atributo CHAR: {0}. Un atributo de tipo CHAR debe ser de un solo car\u00e1cter."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Valor no permitido: se ha utilizado {1} para el atributo QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Valor no permitido: se ha utilizado {1} para el atributo ENUM: {0}. Los valores v\u00e1lidos son: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Valor no permitido: se ha utilizado {1} para el atributo NMTOKEN: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Valor no permitido: se ha utilizado {1} para el atributo NCNAME: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Valor no permitido: se ha utilizado {1} para el atributo boolean: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Valor no permitido: se ha utilizado {1} para el atributo number: {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "El argumento para {0} en el patr\u00f3n de coincidencia debe ser un literal."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Declaraci\u00f3n de variable global duplicada."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Declaraci\u00f3n de variable duplicada."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template debe tener un atributo name o match (o ambos)."}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "El prefijo en exclude-result-prefixes no es v\u00e1lido: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set de nombre {0} no existe"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "La funci\u00f3n de nombre {0} no existe"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "El elemento {0} no debe tener contenido y un atributo select."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "El valor del par\u00e1metro {0} debe ser un objeto Java v\u00e1lido"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "El atributo result-prefix de un elemento xsl:namespace-alias tiene el valor '#default', pero no hay declaraci\u00f3n de espacio de nombres predeterminado en el \u00e1mbito del elemento."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "El atributo result-prefix de un elemento xsl:namespace-alias tiene el valor ''{0}'', pero no hay declaraci\u00f3n de espacio de nombres para el prefijo ''{0}'' en el \u00e1mbito del elemento."}, { ER_SET_FEATURE_NULL_NAME, "El nombre de caracter\u00edstica no puede ser nulo en TransformerFactory.setFeature(nombre de tipo String, valor booleano)."}, { ER_GET_FEATURE_NULL_NAME, "El nombre de caracter\u00edstica no puede ser nulo en TransformerFactory.getFeature(nombre de tipo String)."}, { ER_UNSUPPORTED_FEATURE, "No se puede establecer la caracter\u00edstica ''{0}'' en esta TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "No se permite el uso del elemento de extensi\u00f3n ''{0}'' cuando la caracter\u00edstica de proceso seguro est\u00e1 establecida en true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "No se puede obtener el prefijo de un uri de espacio de nombres nulo."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "No se puede obtener el uri de espacio de nombres para un prefijo nulo."}, { ER_XPATH_RESOLVER_NULL_QNAME, "El nombre de funci\u00f3n no puede ser nulo."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "La aridad no puede ser negativa."}, // Warnings... { WG_FOUND_CURLYBRACE, "Se ha encontrado '}' pero no se ha abierto una plantilla de atributos."}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Aviso: El atributo count no coincide con un antecesor en xsl:number. Destino = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Sintaxis antigua: El nombre del atributo 'expr' se ha cambiado por 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan no maneja a\u00fan el nombre de entorno local en la funci\u00f3n format-number."}, { WG_LOCALE_NOT_FOUND, "Aviso: No se ha podido encontrar el entorno local para xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "No se puede crear URL desde: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "No se puede cargar el doc solicitado: {0}"}, { WG_CANNOT_FIND_COLLATOR, "No se ha podido encontrar clasificador para >>>>>> Xalan versi\u00f3n "}, { "version2", "<<<<<<<"}, { "yes", "s\u00ed"}, { "line", "L\u00ednea n\u00fam."}, { "column","Columna n\u00fam."}, { "xsldone", "XSLProcessor: terminado"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Opciones de la clase Process de la l\u00ednea de mandatos Xalan-J:"}, { "xslProc_option", "Opciones de la clase Process de la l\u00ednea de mandatos Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "La opci\u00f3n {0} no est\u00e1 soportada en modalidad XSLTC."}, { "xslProc_invalid_xalan_option", "La opci\u00f3n {0} s\u00f3lo puede utilizarse con -XSLTC."}, { "xslProc_no_input", "Error: No se ha especificado ninguna hoja de estilos ni xml de entrada. Ejecute este mandato sin opciones para ver las instrucciones de uso."}, { "xslProc_common_options", "-Opciones comunes-"}, { "xslProc_xalan_options", "-Opciones para Xalan-"}, { "xslProc_xsltc_options", "-Opciones para XSLTC-"}, { "xslProc_return_to_continue", "(pulse para continuar)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", "[-XSLTC (Utilizar XSLTC para transformaci\u00f3n)]"}, { "optionIN", "[-IN URL_XML_entrada]"}, { "optionXSL", "[-XSL URL_transformaci\u00f3n_XSL]"}, { "optionOUT", "[-OUT nombre_archivo_salida]"}, { "optionLXCIN", "[-LXCIN entrada_nombre_archivo_hoja_estilos_compilada]"}, { "optionLXCOUT", "[-LXCOUT salida_nombre_archivo_hoja_estilos_compilada]"}, { "optionPARSER", "[-PARSER nombre de clase completamente cualificado del enlace del analizador]"}, { "optionE", "[-E (No expandir referencias de entidades)]"}, { "optionV", "[-E (No expandir referencias de entidades)]"}, { "optionQC", "[-QC (Avisos silenciosos de conflictos de patrones)]"}, { "optionQ", "[-Q (Modalidad silenciosa)]"}, { "optionLF", "[-LF (Utilizar s\u00f3lo avances de l\u00ednea en la salida {el valor predeterminado es CR/LF})]"}, { "optionCR", "[-CR (Utilizar s\u00f3lo retornos de carro en la salida {el valor predeterminado es CR/LF})]"}, { "optionESCAPE", "[-ESCAPE (Caracteres con escape {el valor predeterminado es <>&\"\'\\r\\n}]"}, { "optionINDENT", "[-INDENT (Controlar el n\u00famero de espacios de sangrado {el valor predeterminado es 0})]"}, { "optionTT", "[-TT (Rastrear las plantillas a medida que se llaman.)]"}, { "optionTG", "[-TG (Rastrear cada suceso de generaci\u00f3n.)]"}, { "optionTS", "[-TS (Rastrear cada suceso de selecci\u00f3n.)]"}, { "optionTTC", "[-TTC (Rastrear los hijos de plantillas a medida que se procesan.)]"}, { "optionTCLASS", "[-TCLASS (Clase TraceListener para extensiones de rastreo.)]"}, { "optionVALIDATE", "[-VALIDATE (Establecer si se realiza la validaci\u00f3n. De forma predeterminada la validaci\u00f3n est\u00e1 desactivada.)]"}, { "optionEDUMP", "[-EDUMP {nombre de archivo opcional} (Realizar vuelco de pila si se produce un error.)]"}, { "optionXML", "[-XML (Utilizar el formateador XML y a\u00f1adir la cabecera XML.)]"}, { "optionTEXT", "[-TEXT (Utilizar el formateador de texto sencillo.)]"}, { "optionHTML", "[-HTML (Utilizar el formateador HTML.)]"}, { "optionPARAM", "[-PARAM expresi\u00f3n de nombre (Establecer un par\u00e1metro de hoja de estilos)]"}, { "noParsermsg1", "El proceso XSL no ha sido satisfactorio."}, { "noParsermsg2", "** No se ha podido encontrar el analizador **"}, { "noParsermsg3", "Compruebe la classpath."}, { "noParsermsg4", "Si no dispone del analizador XML para Java de IBM, puede descargarlo de"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", "[-URIRESOLVER nombre de clase completo (URIResolver a utilizar para resolver URI)]"}, { "optionENTITYRESOLVER", "[-ENTITYRESOLVER nombre de clase completo (EntityResolver a utilizar para resolver entidades)]"}, { "optionCONTENTHANDLER", "[-CONTENTHANDLER nombre de clase completo (ContentHandler a utilizar para serializar la salida)]"}, { "optionLINENUMBERS", "[-L utilizar n\u00fameros de l\u00ednea para el documento fuente]"}, { "optionSECUREPROCESSING", " [-SECURE (establecer la caracter\u00edstica de proceso seguro en true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", "[-MEDIA tipo_soporte (Utilizar el atributo de soporte para encontrar la hoja de estilos asociada con un documento.)]"}, { "optionFLAVOR", "[-FLAVOR nombre_estilo (Utilizar expl\u00edcitamente s2s=SAX o d2d=DOM para realizar la transformaci\u00f3n.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", "[-DIAG (Imprimir el total de milisegundos que lleva la transformaci\u00f3n.)]"}, { "optionINCREMENTAL", "[-INCREMENTAL (Solicitar construcci\u00f3n DTM incremental estableciendo http://xml.apache.org/xalan/features/incremental como verdadero.)]"}, { "optionNOOPTIMIMIZE", "[-NOOPTIMIMIZE (Solicitar proceso de optimizaci\u00f3n de hoja de estilos estableciendo http://xml.apache.org/xalan/features/optimize como falso.)]"}, { "optionRL", "[-RL l\u00edmite_recursi\u00f3n (L\u00edmite num\u00e9rico de aserci\u00f3n sobre profundidad de recursi\u00f3n de hoja de estilos.)]"}, { "optionXO", "[-XO [nombreTranslet] (Asignar el nombre al translet generado)]"}, { "optionXD", "[-XD directorioDestino (Especificar un directorio de destino para translet)]"}, { "optionXJ", "[-XJ archivoJar (Empaqueta las clases translet en un archivo jar de nombre )]"}, { "optionXP", "[-XP paquete (Especifica un prefijo para el nombre del paquete de todas las clases translet generadas)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN (habilita la inclusi\u00f3n en l\u00ednea de plantillas)]" }, { "optionXX", "[-XX (activa la salida de mensajes de depuraci\u00f3n adicionales)]"}, { "optionXT" , "[-XT (utilizar translet para transformar si es posible)]"}, { "diagTiming","--------- La transformaci\u00f3n de {0} mediante {1} ha durado {2} ms" }, { "recursionTooDeep","Anidado de plantilla demasiado profundo. anidado = {0}, plantilla {1} {2}" }, { "nameIs", "el nombre es" }, { "matchPatternIs", "el patr\u00f3n de coincidencia es" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Error: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Aviso: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("es", "ES")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_pl.java0000644000175000017500000021242510721374030025033 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_pl.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_pl extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "B\u0142\u0105d: Wewn\u0105trz wyra\u017cenia nie mo\u017ce by\u0107 znaku '{'"}, { ER_ILLEGAL_ATTRIBUTE , "{0} ma niedozwolony atrybut {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode jest puste w xsl:apply-imports!"}, {ER_CANNOT_ADD, "Nie mo\u017cna doda\u0107 {0} do {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode jest puste w handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "{0} musi mie\u0107 atrybut name."}, {ER_TEMPLATE_NOT_FOUND, "Nie mo\u017cna znale\u017a\u0107 szablonu o nazwie {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Nie mo\u017cna przet\u0142umaczy\u0107 AVT nazwy na xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} wymaga atrybutu: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} musi mie\u0107 atrybut ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "B\u0142\u0119dna warto\u015b\u0107 w atrybucie level: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Nazw\u0105 instrukcji przetwarzania nie mo\u017ce by\u0107 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "Nazwa instrukcji przetwarzania musi by\u0107 poprawn\u0105 nazw\u0105 NCName {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} musi mie\u0107 atrybut match, je\u015bli ma mode."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} wymaga albo atrybutu name, albo match."}, {ER_CANT_RESOLVE_NSPREFIX, "Nie mo\u017cna rozstrzygn\u0105\u0107 przedrostka przestrzeni nazw {0}"}, { ER_ILLEGAL_VALUE, "xml:space ma niepoprawn\u0105 warto\u015b\u0107 {0}"}, { ER_NO_OWNERDOC, "Bezpo\u015bredni w\u0119ze\u0142 potomny nie ma dokumentu w\u0142a\u015bciciela!"}, { ER_ELEMTEMPLATEELEM_ERR, "B\u0142\u0105d ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "Pr\u00f3ba dodania pustego bezpo\u015bredniego elementu potomnego!"}, { ER_NEED_SELECT_ATTRIB, "{0} wymaga atrybutu select."}, { ER_NEED_TEST_ATTRIB , "xsl:when musi mie\u0107 atrybut 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param musi mie\u0107 atrybut 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "Kontekst nie ma dokumentu w\u0142a\u015bciciela!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Nie mo\u017cna utworzy\u0107 po\u0142\u0105czenia XML TransformerFactory: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Proces Xalan nie wykona\u0142 si\u0119 pomy\u015blnie."}, { ER_NOT_SUCCESSFUL, "Xalan nie wykona\u0142 si\u0119 pomy\u015blnie."}, { ER_ENCODING_NOT_SUPPORTED, "Nieobs\u0142ugiwane kodowanie {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Nie mo\u017cna utworzy\u0107 TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key wymaga atrybutu 'name'."}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key wymaga atrybutu 'match'."}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key wymaga atrybutu 'use'."}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} wymaga atrybutu ''elements''!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} brakuje atrybutu ''prefix''"}, { ER_BAD_STYLESHEET_URL, "Adres URL arkusza styl\u00f3w jest b\u0142\u0119dny {0}"}, { ER_FILE_NOT_FOUND, "Nie znaleziono pliku arkusza styl\u00f3w {0}"}, { ER_IOEXCEPTION, "Wyst\u0105pi\u0142 wyj\u0105tek we/wy w pliku arkusza styl\u00f3w {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Nie mo\u017cna znale\u017a\u0107 atrybutu href dla {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} zawiera siebie bezpo\u015brednio lub po\u015brednio!"}, { ER_PROCESSINCLUDE_ERROR, "B\u0142\u0105d StylesheetHandler.processInclude {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} brakuje atrybutu ''lang''"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) \u017ale umieszczony element {0}?? Brakuje elementu kontenera ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Mo\u017cna wyprowadza\u0107 dane tylko do Element, DocumentFragment, Document lub PrintWriter."}, { ER_PROCESS_ERROR, "B\u0142\u0105d StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "B\u0142\u0105d UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "B\u0142\u0105d! Nie znaleziono wyra\u017cenia wyboru xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Nie mo\u017cna szeregowa\u0107 XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "Nie podano danych wej\u015bciowych do arkusza styl\u00f3w!"}, { ER_FAILED_PROCESS_STYLESHEET, "Nie powiod\u0142o si\u0119 przetworzenie arkusza styl\u00f3w!"}, { ER_COULDNT_PARSE_DOC, "Nie mo\u017cna zanalizowa\u0107 dokumentu {0}!"}, { ER_COULDNT_FIND_FRAGMENT, "Nie mo\u017cna znale\u017a\u0107 fragmentu {0}"}, { ER_NODE_NOT_ELEMENT, "W\u0119ze\u0142 wskazywany przez identyfikator fragmentu nie by\u0142 elementem {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each musi mie\u0107 albo atrybut match, albo name"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates musi mie\u0107 albo atrybut match, albo name"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Brak klonu fragmentu dokumentu!"}, { ER_CANT_CREATE_ITEM, "Nie mo\u017cna utworzy\u0107 elementu w wynikowym drzewie {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space w \u017ar\u00f3d\u0142owym pliku XML ma niepoprawn\u0105 warto\u015b\u0107 {0}"}, { ER_NO_XSLKEY_DECLARATION, "Nie ma deklaracji xsl:key dla {0}!"}, { ER_CANT_CREATE_URL, "B\u0142\u0105d! Nie mo\u017cna utworzy\u0107 adresu url dla {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions jest nieobs\u0142ugiwane"}, { ER_PROCESSOR_ERROR, "B\u0142\u0105d XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} jest niedozwolone wewn\u0105trz arkusza styl\u00f3w!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns nie jest ju\u017c obs\u0142ugiwane! U\u017cyj zamiast tego xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space nie jest ju\u017c obs\u0142ugiwane! U\u017cyj zamiast tego xsl:strip-space lub xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result nie jest ju\u017c obs\u0142ugiwane! U\u017cyj zamiast tego xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} ma niedozwolony atrybut {1}"}, { ER_UNKNOWN_XSL_ELEM, "Nieznany element XSL {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort mo\u017ce by\u0107 u\u017cywane tylko z xsl:apply-templates lub xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) b\u0142\u0119dnie umieszczone xsl:when!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when bez nadrz\u0119dnego xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) b\u0142\u0119dnie umieszczone xsl:otherwise!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise bez nadrz\u0119dnego xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} jest niedozwolone wewn\u0105trz szablonu!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) Nieznany przedrostek {1} rozszerzenia {0} przestrzeni nazw"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Importy mog\u0105 wyst\u0105pi\u0107 tylko jako pierwsze elementy w arkuszu styl\u00f3w!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} importuje siebie bezpo\u015brednio lub po\u015brednio!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space ma niedozwolon\u0105 warto\u015b\u0107: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet by\u0142o niepomy\u015blne!"}, { ER_SAX_EXCEPTION, "Wyj\u0105tek SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Nieobs\u0142ugiwana funkcja!"}, { ER_XSLT_ERROR, "B\u0142\u0105d XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "Znak waluty jest niedozwolony w ci\u0105gu znak\u00f3w wzorca formatu"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Funkcja Document nie jest obs\u0142ugiwana w arkuszu styl\u00f3w DOM!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Nie mo\u017cna rozstrzygn\u0105\u0107 przedrostka przelicznika bez przedrostka!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Rozszerzenie Redirect: Nie mo\u017cna pobra\u0107 nazwy pliku - atrybut file lub select musi zwr\u00f3ci\u0107 poprawny ci\u0105g znak\u00f3w."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Nie mo\u017cna zbudowa\u0107 FormatterListener w rozszerzeniu Redirect!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Przedrostek w exclude-result-prefixes jest niepoprawny: {0}"}, { ER_MISSING_NS_URI, "Nieobecny identyfikator URI przestrzeni nazw w podanym przedrostku"}, { ER_MISSING_ARG_FOR_OPTION, "Nieobecny argument opcji {0}"}, { ER_INVALID_OPTION, "Niepoprawna opcja {0}"}, { ER_MALFORMED_FORMAT_STRING, "Zniekszta\u0142cony ci\u0105g znak\u00f3w formatu {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet wymaga atrybutu 'version'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Atrybut {0} ma niepoprawn\u0105 warto\u015b\u0107 {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose wymaga xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports jest niedozwolone w xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Nie mo\u017cna u\u017cy\u0107 DTMLiaison w wyj\u015bciowym w\u0119\u017ale DOM... przeka\u017c zamiast tego org.apache.xpath.DOM2Helper!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Nie mo\u017cna u\u017cy\u0107 DTMLiaison w wej\u015bciowym w\u0119\u017ale DOM... przeka\u017c zamiast tego org.apache.xpath.DOM2Helper!"}, { ER_CALL_TO_EXT_FAILED, "Wywo\u0142anie elementu rozszerzenia nie powiod\u0142o si\u0119: {0}"}, { ER_PREFIX_MUST_RESOLVE, "Przedrostek musi da\u0107 si\u0119 przet\u0142umaczy\u0107 na przestrze\u0144 nazw: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Wykryto niepoprawny odpowiednik UTF-16: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} u\u017cy\u0142o siebie, co wywo\u0142a niesko\u0144czon\u0105 p\u0119tl\u0119."}, { ER_CANNOT_MIX_XERCESDOM, "Nie mo\u017cna miesza\u0107 wej\u015bcia innego ni\u017c Xerces-DOM z wyj\u015bciem Xerces-DOM!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "W ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Znaleziono wi\u0119cej ni\u017c jeden szablon o nazwie {0}"}, { ER_INVALID_KEY_CALL, "Niepoprawne wywo\u0142anie funkcji: Rekurencyjne wywo\u0142ania key() s\u0105 niedozwolone"}, { ER_REFERENCING_ITSELF, "Zmienna {0} odwo\u0142uje si\u0119 do siebie bezpo\u015brednio lub po\u015brednio!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "W\u0119ze\u0142 wej\u015bciowy nie mo\u017ce by\u0107 pusty dla DOMSource dla newTemplates!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Nie znaleziono pliku klasy dla opcji {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Nie znaleziono wymaganego elementu {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream nie mo\u017ce by\u0107 pusty"}, { ER_URI_CANNOT_BE_NULL, "Identyfikator URI nie mo\u017ce by\u0107 pusty"}, { ER_FILE_CANNOT_BE_NULL, "File nie mo\u017ce by\u0107 pusty"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource nie mo\u017ce by\u0107 pusty"}, { ER_CANNOT_INIT_BSFMGR, "Nie mo\u017cna zainicjowa\u0107 mened\u017cera BSF"}, { ER_CANNOT_CMPL_EXTENSN, "Nie mo\u017cna skompilowa\u0107 rozszerzenia"}, { ER_CANNOT_CREATE_EXTENSN, "Nie mo\u017cna utworzy\u0107 rozszerzenia {0} z powodu {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Wywo\u0142anie metody Instance do metody {0} wymaga instancji Object jako pierwszego argumentu"}, { ER_INVALID_ELEMENT_NAME, "Podano niepoprawn\u0105 nazw\u0119 elementu {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "Metoda nazwy elementu musi by\u0107 statyczna {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Funkcja rozszerzenia {0} : {1} jest nieznana"}, { ER_MORE_MATCH_CONSTRUCTOR, "Wi\u0119cej ni\u017c jedno najlepsze dopasowanie dla konstruktora {0}"}, { ER_MORE_MATCH_METHOD, "Wi\u0119cej ni\u017c jedno najlepsze dopasowanie dla metody {0}"}, { ER_MORE_MATCH_ELEMENT, "Wi\u0119cej ni\u017c jedno najlepsze dopasowanie dla metody elementu {0}"}, { ER_INVALID_CONTEXT_PASSED, "Przekazano niepoprawny kontekst do wyliczenia {0}"}, { ER_POOL_EXISTS, "Pula ju\u017c istnieje"}, { ER_NO_DRIVER_NAME, "Nie podano nazwy sterownika"}, { ER_NO_URL, "Nie podano adresu URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "Wielko\u015b\u0107 puli jest mniejsza od jedno\u015bci!"}, { ER_INVALID_DRIVER, "Podano niepoprawn\u0105 nazw\u0119 sterownika!"}, { ER_NO_STYLESHEETROOT, "Nie znaleziono elementu g\u0142\u00f3wnego arkusza styl\u00f3w!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Niedozwolona warto\u015b\u0107 xml:space"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode nie powiod\u0142o si\u0119"}, { ER_RESOURCE_COULD_NOT_LOAD, "Zas\u00f3b [ {0} ] nie m\u00f3g\u0142 za\u0142adowa\u0107: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Wielko\u015b\u0107 buforu <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Nieznany b\u0142\u0105d podczas wywo\u0142ywania rozszerzenia"}, { ER_NO_NAMESPACE_DECL, "Przedrostek {0} nie ma odpowiadaj\u0105cej mu deklaracji przestrzeni nazw"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Zawarto\u015b\u0107 elementu niedozwolona dla lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Arkusz styl\u00f3w zarz\u0105dzi\u0142 zako\u0144czenie"}, { ER_ONE_OR_TWO, "1 lub 2"}, { ER_TWO_OR_THREE, "2 lub 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Nie mo\u017cna za\u0142adowa\u0107 {0} (sprawd\u017a CLASSPATH), u\u017cywane s\u0105 teraz warto\u015bci domy\u015blne"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Nie mo\u017cna zainicjowa\u0107 domy\u015blnych szablon\u00f3w"}, { ER_RESULT_NULL, "Rezultat nie powinien by\u0107 pusty"}, { ER_RESULT_COULD_NOT_BE_SET, "Nie mo\u017cna ustawi\u0107 rezultatu"}, { ER_NO_OUTPUT_SPECIFIED, "Nie podano wyj\u015bcia"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Nie mo\u017cna przekszta\u0142ci\u0107 do rezultatu o typie {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Nie mo\u017cna przekszta\u0142ci\u0107 \u017ar\u00f3d\u0142a o typie {0}"}, { ER_NULL_CONTENT_HANDLER, "Pusta procedura obs\u0142ugi zawarto\u015bci"}, { ER_NULL_ERROR_HANDLER, "Pusta procedura obs\u0142ugi b\u0142\u0119du"}, { ER_CANNOT_CALL_PARSE, "Nie mo\u017cna wywo\u0142a\u0107 parse, je\u015bli nie ustawiono ContentHandler"}, { ER_NO_PARENT_FOR_FILTER, "Brak elementu nadrz\u0119dnego dla filtru"}, { ER_NO_STYLESHEET_IN_MEDIA, "Nie znaleziono arkusza styl\u00f3w w {0}, no\u015bnik= {1}"}, { ER_NO_STYLESHEET_PI, "Nie znaleziono instrukcji przetwarzania xml-stylesheet w {0}"}, { ER_NOT_SUPPORTED, "Nieobs\u0142ugiwane: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Warto\u015b\u0107 w\u0142a\u015bciwo\u015bci {0} powinna by\u0107 instancj\u0105 typu Boolean"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Nie mo\u017cna si\u0119 dosta\u0107 do zewn\u0119trznego skryptu w {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "Nie mo\u017cna znale\u017a\u0107 zasobu [ {0} ].\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Nierozpoznana w\u0142a\u015bciwo\u015b\u0107 wyj\u015bciowa {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Nie powiod\u0142o si\u0119 utworzenie instancji ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Warto\u015b\u0107 {0} powinna zawiera\u0107 liczb\u0119 mo\u017cliw\u0105 do zanalizowania"}, { ER_VALUE_SHOULD_EQUAL, "Warto\u015bci\u0105 {0} powinno by\u0107 yes lub no"}, { ER_FAILED_CALLING_METHOD, "Niepowodzenie wywo\u0142ania metody {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "Nie powiod\u0142o si\u0119 utworzenie instancji ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "W tym miejscu dokumentu znaki s\u0105 niedozwolone"}, { ER_ATTR_NOT_ALLOWED, "Atrybut \"{0}\" nie jest dozwolony w elemencie {1}!"}, { ER_BAD_VALUE, "B\u0142\u0119dna warto\u015b\u0107 {0} {1}"}, { ER_ATTRIB_VALUE_NOT_FOUND, "Nie znaleziono warto\u015bci atrybutu {0}"}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Nie rozpoznano warto\u015bci atrybutu {0}"}, { ER_NULL_URI_NAMESPACE, "Pr\u00f3ba wygenerowania przedrostka przestrzeni nazw z pustym identyfikatorem URI"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Pr\u00f3ba sformatowania liczby wi\u0119kszej ni\u017c najwi\u0119ksza liczba typu long integer"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Nie mo\u017cna znale\u017a\u0107 klasy sterownika SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "Znaleziono klas\u0119 sterownika SAX1 {0}, ale nie mo\u017cna jej za\u0142adowa\u0107"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "Klasa sterownika SAX1 {0} zosta\u0142a za\u0142adowana, ale nie mo\u017cna utworzy\u0107 jej instancji"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "Klasa sterownika SAX1 {0} nie implementuje org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "W\u0142a\u015bciwo\u015b\u0107 systemowa org.xml.sax.parser nie zosta\u0142a podana"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Argument analizatora nie mo\u017ce by\u0107 pusty"}, { ER_FEATURE, "Opcja: {0}"}, { ER_PROPERTY, "W\u0142a\u015bciwo\u015b\u0107: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Pusty przelicznik encji"}, { ER_NULL_DTD_HANDLER, "Pusta procedura obs\u0142ugi DTD"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Nie podano nazwy sterownika!"}, { ER_NO_URL_SPECIFIED, "Nie podano adresu URL!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Wielko\u015b\u0107 puli jest mniejsza od 1!"}, { ER_INVALID_DRIVER_NAME, "Podano niepoprawn\u0105 nazw\u0119 sterownika!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "B\u0142\u0105d programisty! Wyra\u017cenie nie ma elementu nadrz\u0119dnego ElemTemplateElement!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Asercja programisty w RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} jest niedozwolone na tej pozycji w arkuszu styl\u00f3w!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Tekst z\u0142o\u017cony ze znak\u00f3w innych ni\u017c odst\u0119py jest niedozwolony na tej pozycji w arkuszu styl\u00f3w!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie CHAR {0}. Atrybut typu CHAR musi by\u0107 pojedynczym znakiem!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie QNAME {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie ENUM {0}. Poprawne warto\u015bci to: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie NMTOKEN {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie NCNAME {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie logicznym {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Niedozwolona warto\u015b\u0107 {1} u\u017cyta w atrybucie liczbowym {0}"}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argument opcji {0} we wzorcu uzgadniania musi by\u0107 litera\u0142em."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Zduplikowana deklaracja zmiennej globalnej."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Zduplikowana deklaracja zmiennej."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template musi mie\u0107 atrybut name lub match (lub obydwa)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Przedrostek w exclude-result-prefixes jest niepoprawny: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "Zbi\u00f3r atrybut\u00f3w o nazwie {0} nie istnieje"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "Funkcja o nazwie {0} nie istnieje"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "Element {0} nie mo\u017ce mie\u0107 jednocze\u015bnie zawarto\u015bci i atrybutu select."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "Warto\u015bci\u0105 parametru {0} musi by\u0107 poprawny obiekt j\u0119zyka Java."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Atrybut result-prefix elementu xsl:namespace-alias ma warto\u015b\u0107 '#default', ale nie ma deklaracji domy\u015blnej przestrzeni nazw w zasi\u0119gu tego elementu."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Atrybut result-prefix elementu xsl:namespace-alias ma warto\u015b\u0107 ''{0}'', ale nie ma deklaracji przestrzeni nazw dla przedrostka ''{0}'' w zasi\u0119gu tego elementu."}, { ER_SET_FEATURE_NULL_NAME, "Nazwa opcji nie mo\u017ce mie\u0107 warto\u015bci null w TransformerFactory.setFeature(String nazwa, boolean warto\u015b\u0107)."}, { ER_GET_FEATURE_NULL_NAME, "Nazwa opcji nie mo\u017ce mie\u0107 warto\u015bci null w TransformerFactory.getFeature(String nazwa)."}, { ER_UNSUPPORTED_FEATURE, "Nie mo\u017cna ustawi\u0107 opcji ''{0}'' w tej klasie TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "U\u017cycie elementu rozszerzenia ''{0}'' jest niedozwolone, gdy opcja przetwarzania bezpiecznego jest ustawiona na warto\u015b\u0107 true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Nie mo\u017cna pobra\u0107 przedrostka dla pustego identyfikatora uri przestrzeni nazw."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Nie mo\u017cna pobra\u0107 identyfikatora uri przestrzeni nazw dla pustego przedrostka."}, { ER_XPATH_RESOLVER_NULL_QNAME, "Nazwa funkcji nie mo\u017ce by\u0107 pusta (null)."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Liczba parametr\u00f3w nie mo\u017ce by\u0107 ujemna."}, // Warnings... { WG_FOUND_CURLYBRACE, "Znaleziono znak '}', ale nie jest otwarty \u017caden szablon atrybut\u00f3w!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Ostrze\u017cenie: Atrybut count nie jest zgodny ze swym przodkiem w xsl:number! Cel = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Stara sk\u0142adnia: Nazwa atrybutu 'expr' zosta\u0142a zmieniona na 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan nie obs\u0142uguje jeszcze nazwy ustawie\u0144 narodowych w funkcji format-number."}, { WG_LOCALE_NOT_FOUND, "Ostrze\u017cenie: Nie mo\u017cna znale\u017a\u0107 ustawie\u0144 narodowych dla xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nie mo\u017cna utworzy\u0107 adresu URL z {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Nie mo\u017cna za\u0142adowa\u0107 \u017c\u0105danego dokumentu {0}"}, { WG_CANNOT_FIND_COLLATOR, "Nie mo\u017cna znale\u017a\u0107 procesu sortuj\u0105cego (Collator) dla >>>>>> Wersja Xalan "}, { "version2", "<<<<<<<"}, { "yes", "tak"}, { "line", "Nr wiersza: "}, { "column","Nr kolumny: "}, { "xsldone", "XSLProcessor: gotowe"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Opcje wiersza komend klasy Process Xalan-J:"}, { "xslProc_option", "Opcje wiersza komend klasy Process Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "Opcja {0} jest nieobs\u0142ugiwana w trybie XSLTC."}, { "xslProc_invalid_xalan_option", "Opcji {0} mo\u017cna u\u017cywa\u0107 tylko razem z -XSLTC."}, { "xslProc_no_input", "B\u0142\u0105d: Nie podano arkusza styl\u00f3w lub wej\u015bciowego pliku xml. Wykonaj t\u0119 komend\u0119 bez \u017cadnych opcji, aby zapozna\u0107 si\u0119 z informacjami o sk\u0142adni."}, { "xslProc_common_options", "-Wsp\u00f3lne opcje-"}, { "xslProc_xalan_options", "-Opcje dla Xalan-"}, { "xslProc_xsltc_options", "-Opcje dla XSLTC-"}, { "xslProc_return_to_continue", "(naci\u015bnij klawisz , aby kontynuowa\u0107)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", "[-XSLTC (u\u017cycie XSLTC do transformacji)]"}, { "optionIN", "[-IN wej\u015bciowyXMLURL]"}, { "optionXSL", "[-XSL URLTransformacjiXSL]"}, { "optionOUT", "[-OUT NazwaPlikuWyj\u015bciowego]"}, { "optionLXCIN", "[-LXCIN NazwaWej\u015bciowegoPlikuSkompilowanegoArkuszaStyl\u00f3w]"}, { "optionLXCOUT", "[-LXCOUT NazwaWyj\u015bciowegoPlikuSkompilowanegoArkuszaStyl\u00f3w]"}, { "optionPARSER", "[-PARSER pe\u0142na nazwa klasy po\u0142\u0105czenia analizatora]"}, { "optionE", "[-E (bez rozwijania odwo\u0142a\u0144 do encji)]"}, { "optionV", "[-E (bez rozwijania odwo\u0142a\u0144 do encji)]"}, { "optionQC", "[-QC (ciche ostrze\u017cenia o konfliktach wzorc\u00f3w)]"}, { "optionQ", "[-Q (tryb cichy)]"}, { "optionLF", "[-LF (u\u017cycie tylko znak\u00f3w wysuwu wiersza na wyj\u015bciu {domy\u015blnie CR/LF})]"}, { "optionCR", "[-LF (u\u017cycie tylko znak\u00f3w powrotu karetki na wyj\u015bciu {domy\u015blnie CR/LF})]"}, { "optionESCAPE", "[-ESCAPE (znaki o zmienionym znaczeniu {domy\u015blne <>&\"\'\\r\\n}]"}, { "optionINDENT", "[-INDENT (liczba znak\u00f3w wci\u0119cia {domy\u015blnie 0})]"}, { "optionTT", "[-TT (\u015bledzenie szablon\u00f3w podczas ich wywo\u0142ywania)]"}, { "optionTG", "[-TG (\u015bledzenie ka\u017cdego zdarzenia generowania)]"}, { "optionTS", "[-TS (\u015bledzenie ka\u017cdego zdarzenia wyboru)]"}, { "optionTTC", "[-TTC (\u015bledzenie szablon\u00f3w potomnych podczas ich przetwarzania)]"}, { "optionTCLASS", "[-TCLASS (klasa TraceListener dla rozszerze\u0144 \u015bledzenia)]"}, { "optionVALIDATE", "[-VALIDATE (w\u0142\u0105czenie sprawdzania poprawno\u015bci - domy\u015blnie jest wy\u0142\u0105czona)]"}, { "optionEDUMP", "[-EDUMP {opcjonalna nazwa pliku} (wykonywanie zrzutu stosu w przypadku wyst\u0105pienia b\u0142\u0119du)]"}, { "optionXML", "[-XML (u\u017cycie formatera XML i dodanie nag\u0142\u00f3wka XML)]"}, { "optionTEXT", "[-TEXT (u\u017cycie prostego formatera tekstu)]"}, { "optionHTML", "[-HTML (u\u017cycie formatera HTML)]"}, { "optionPARAM", "[-PARAM nazwa wyra\u017cenie (ustawienie parametru arkusza styl\u00f3w)]"}, { "noParsermsg1", "Proces XSL nie wykona\u0142 si\u0119 pomy\u015blnie."}, { "noParsermsg2", "** Nie mo\u017cna znale\u017a\u0107 analizatora **"}, { "noParsermsg3", "Sprawd\u017a classpath."}, { "noParsermsg4", "Je\u015bli nie masz analizatora XML dla j\u0119zyka Java firmy IBM, mo\u017cesz go pobra\u0107"}, { "noParsermsg5", "z serwisu AlphaWorks firmy IBM: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER pe\u0142na nazwa klasy (URIResolver u\u017cywany do t\u0142umaczenia URI)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER pe\u0142na nazwa klasy (EntityResolver u\u017cywany do t\u0142umaczenia encji)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER pe\u0142na nazwa klasy (ContentHandler u\u017cywany do szeregowania wyj\u015bcia)]"}, { "optionLINENUMBERS", " [-L u\u017cycie numer\u00f3w wierszy w dokumentach \u017ar\u00f3d\u0142owych]"}, { "optionSECUREPROCESSING", " [-SECURE (ustawienie opcji przetwarzania bezpiecznego na warto\u015b\u0107 true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA typ_no\u015bnika (u\u017cywaj atrybutu media w celu znalezienia arkusza styl\u00f3w zwi\u0105zanego z dokumentem)]"}, { "optionFLAVOR", " [-FLAVOR nazwa_posmaku (u\u017cywaj jawnie s2s=SAX lub d2d=DOM w celu wykonania transformacji)]"}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (wy\u015bwietlenie ca\u0142kowitego czasu trwania transformacji)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (\u017c\u0105danie przyrostowego budowania DTM poprzez ustawienie http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (\u017c\u0105danie braku optymalizowania arkuszy styl\u00f3w poprzez ustawienie http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL limit_rekurencji (okre\u015blenie liczbowego limitu g\u0142\u0119boko\u015bci rekurencji w arkuszach styl\u00f3w)]"}, { "optionXO", "[-XO [NazwaTransletu] (przypisanie nazwy wygenerowanemu transletowi)]"}, { "optionXD", "[-XD KatalogDocelowy (okre\u015blenie katalogu docelowego dla transletu)]"}, { "optionXJ", "[-XJ plik_jar (pakowanie klas transletu do pliku jar o nazwie )]"}, { "optionXP", "[-XP pakiet (okre\u015blenie przedrostka nazwy pakietu dla wszystkich wygenerowanych klas transletu)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN (w\u0142\u0105czenie wstawiania szablon\u00f3w)]" }, { "optionXX", "[-XX (w\u0142\u0105czenie dodatkowych diagnostycznych komunikat\u00f3w wyj\u015bciowych)]"}, { "optionXT" , "[-XT (u\u017cycie transletu do transformacji, je\u015bli to mo\u017cliwe)]"}, { "diagTiming","--------- Transformacja {0} przez {1} zaj\u0119\u0142a {2} ms" }, { "recursionTooDeep","Zbyt g\u0142\u0119bokie zagnie\u017cd\u017cenie szablon\u00f3w. zagnie\u017cd\u017cenie= {0}, szablon {1} {2}" }, { "nameIs", "nazw\u0105 jest" }, { "matchPatternIs", "wzorcem uzgadniania jest" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "nr b\u0142\u0119du"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "B\u0142\u0105d: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Ostrze\u017cenie: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "WZORZEC "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("pl", "PL")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_tr.java0000644000175000017500000022031210721374032025041 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_tr.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_tr extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Hata: \u0130fade i\u00e7inde '{' olamaz"}, { ER_ILLEGAL_ATTRIBUTE , "{0} ge\u00e7ersiz {1} \u00f6zniteli\u011fini i\u00e7eriyor"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "xsl:apply-imports i\u00e7inde sourceNode bo\u015f de\u011ferli!"}, {ER_CANNOT_ADD, "{0}, {1} i\u00e7ine eklenemiyor"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "handleApplyTemplatesInstruction i\u00e7inde sourceNode bo\u015f de\u011ferli!"}, { ER_NO_NAME_ATTRIB, "{0} i\u00e7in \u00f6znitelik belirtilmeli."}, {ER_TEMPLATE_NOT_FOUND, "Ad\u0131 {0} olan \u015fablon bulunamad\u0131"}, {ER_CANT_RESOLVE_NAME_AVT, "xsl:call-template i\u00e7inde AVT ad\u0131 \u00e7\u00f6z\u00fclemedi."}, {ER_REQUIRES_ATTRIB, "{0} i\u00e7in {1} \u00f6zniteli\u011fi gerekiyor."}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} i\u00e7in ''test'' \u00f6zniteli\u011fi gerekiyor."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "{0} d\u00fczey \u00f6zniteli\u011finde hatal\u0131 de\u011fer."}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "processing-instruction ad\u0131 'xml' olamaz"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "processing-instruction ad\u0131 ge\u00e7erli bir NCName olmal\u0131d\u0131r: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} kip i\u00e7eriyorsa match \u00f6zniteli\u011fi olmas\u0131 gerekir."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} i\u00e7in name ya da match \u00f6zniteli\u011fi gerekiyor."}, {ER_CANT_RESOLVE_NSPREFIX, "Ad alan\u0131 \u00f6neki {0} \u00e7\u00f6z\u00fclemiyor."}, { ER_ILLEGAL_VALUE, "xml:space ge\u00e7ersiz {0} de\u011ferini i\u00e7eriyor."}, { ER_NO_OWNERDOC, "Alt d\u00fc\u011f\u00fcm\u00fcn iye belgesi yok!"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement hatas\u0131: {0}"}, { ER_NULL_CHILD, "Bo\u015f de\u011ferli (null) alt \u00f6\u011fe ekleme giri\u015fimi!"}, { ER_NEED_SELECT_ATTRIB, "{0} i\u00e7in select \u00f6zniteli\u011fi gerekiyor."}, { ER_NEED_TEST_ATTRIB , "xsl:when i\u00e7in 'test' \u00f6zniteli\u011fi gereklidir."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param i\u00e7in 'name' \u00f6zniteli\u011fi gereklidir."}, { ER_NO_CONTEXT_OWNERDOC, "Ba\u011flam\u0131n iye belgesi yok!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "XML TransformerFactory ili\u015fkisi {0} yarat\u0131lamad\u0131"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Process ba\u015far\u0131l\u0131 olmad\u0131."}, { ER_NOT_SUCCESSFUL, "Xalan: ba\u015far\u0131l\u0131 olmad\u0131."}, { ER_ENCODING_NOT_SUPPORTED, "{0} kodlamas\u0131 desteklenmiyor."}, {ER_COULD_NOT_CREATE_TRACELISTENER, "TraceListener {0} yarat\u0131lamad\u0131."}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key i\u00e7in 'name' \u00f6zniteli\u011fi gerekiyor!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key i\u00e7in 'match' \u00f6zniteli\u011fi gerekiyor!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key i\u00e7in 'use' \u00f6zniteli\u011fi gerekiyor!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} i\u00e7in ''elements'' \u00f6zniteli\u011fi gerekiyor!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} \u00f6zniteli\u011fi ''prefix'' eksik"}, { ER_BAD_STYLESHEET_URL, "Bi\u00e7em yapra\u011f\u0131 URL adresi {0} ge\u00e7ersiz"}, { ER_FILE_NOT_FOUND, "Bi\u00e7em yapra\u011f\u0131 dosyas\u0131 bulunamad\u0131: {0}"}, { ER_IOEXCEPTION, "Bi\u00e7em yapra\u011f\u0131 dosyas\u0131 {0} ile G\u00c7 kural d\u0131\u015f\u0131 durumu olu\u015ftu"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) {0} i\u00e7in href \u00f6zniteli\u011fi bulunamad\u0131"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} do\u011frudan ya da dolayl\u0131 olarak kendisini i\u00e7eriyor!"}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude hatas\u0131, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} \u00f6zniteli\u011fi ''lang'' eksik"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) {0} \u00f6\u011fesinin yeri yanl\u0131\u015f? Ta\u015f\u0131y\u0131c\u0131 \u00f6\u011fesi ''component'' eksik"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "\u00c7\u0131k\u0131\u015f yaln\u0131zca \u015funlara y\u00f6neltilebilir: Element, DocumentFragment, Document ya da PrintWriter."}, { ER_PROCESS_ERROR, "StylesheetRoot.process hatas\u0131"}, { ER_UNIMPLNODE_ERROR, "UnImplNode hatas\u0131: {0}"}, { ER_NO_SELECT_EXPRESSION, "Hata! xpath select ifadesi (-select) bulunamad\u0131."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "XSLProcessor diziselle\u015ftirilemez!"}, { ER_NO_INPUT_STYLESHEET, "Bi\u00e7em yapra\u011f\u0131 giri\u015fi belirtilmedi!"}, { ER_FAILED_PROCESS_STYLESHEET, "Bi\u00e7em yapra\u011f\u0131 i\u015flenemedi!"}, { ER_COULDNT_PARSE_DOC, "{0} belgesi ayr\u0131\u015ft\u0131r\u0131lamad\u0131!"}, { ER_COULDNT_FIND_FRAGMENT, "Par\u00e7a bulunamad\u0131: {0}"}, { ER_NODE_NOT_ELEMENT, "Par\u00e7a tan\u0131t\u0131c\u0131s\u0131n\u0131n g\u00f6sterdi\u011fi d\u00fc\u011f\u00fcm bir \u00f6\u011fe de\u011fildi: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each i\u00e7in e\u015fle\u015fme ya da ad \u00f6zniteli\u011fi gerekir"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates i\u00e7in e\u015fle\u015fme ya da ad \u00f6zniteli\u011fi gerekir"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Belge par\u00e7as\u0131n\u0131n e\u015fkopyas\u0131 de\u011fil!"}, { ER_CANT_CREATE_ITEM, "Sonu\u00e7 a\u011fac\u0131nda \u00f6\u011fe yarat\u0131lam\u0131yor: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "Kaynak XML i\u00e7inde xml:space ge\u00e7ersiz de\u011fer i\u00e7eriyor: {0}"}, { ER_NO_XSLKEY_DECLARATION, "{0} i\u00e7in xsl:key bildirimi yok!"}, { ER_CANT_CREATE_URL, "Hata! \u0130lgili url yarat\u0131lam\u0131yor: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions desteklenmiyor"}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory Hatas\u0131"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} bi\u00e7em yapra\u011f\u0131 i\u00e7inde olamaz!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns art\u0131k desteklenmiyor! Yerine xsl:output kullan\u0131n."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space art\u0131k desteklenmiyor! Yerine xsl:strip-space ya da xsl:preserve-space kullan\u0131n."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result art\u0131k desteklenmiyor! Yerine xsl:output kullan\u0131n."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} ge\u00e7ersiz {1} \u00f6zniteli\u011fini i\u00e7eriyor"}, { ER_UNKNOWN_XSL_ELEM, "Bilinmeyen XSL \u00f6\u011fesi: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort yaln\u0131zca xsl:apply-templates ya da xsl:for-each ile kullan\u0131labilir."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when yeri yanl\u0131\u015f!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when \u00f6\u011fesinin \u00fcst \u00f6\u011fesi xsl:choose de\u011fil!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise yeri yanl\u0131\u015f!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise \u00f6\u011fesinin \u00fcst \u00f6\u011fesi xsl:choose de\u011fil!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} \u015fablon i\u00e7inde kullan\u0131lamaz!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} eklenti ad alan\u0131 \u00f6neki {1} bilinmiyor"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Import \u00f6\u011feleri, bi\u00e7em yapra\u011f\u0131n\u0131n ilk \u00f6\u011feleri olarak ge\u00e7ebilir!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} do\u011frudan ya da dolayl\u0131 olarak kendisini i\u00e7e aktar\u0131yor!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space ge\u00e7ersiz {0} de\u011ferini i\u00e7eriyor"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet ba\u015far\u0131s\u0131z oldu!"}, { ER_SAX_EXCEPTION, "SAX kural d\u0131\u015f\u0131 durumu"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "\u0130\u015flev desteklenmiyor!"}, { ER_XSLT_ERROR, "XSLT hatas\u0131"}, { ER_CURRENCY_SIGN_ILLEGAL, "Bi\u00e7im \u00f6r\u00fcnt\u00fcs\u00fc dizgisinde para birimi simgesi olamaz"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Stylesheet DOM belge i\u015flevini desteklemiyor!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "\u00d6nek d\u0131\u015f\u0131 \u00e7\u00f6z\u00fcc\u00fcn\u00fcn \u00f6neki \u00e7\u00f6z\u00fclemez."}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Yeniden y\u00f6nlendirme eklentisi: Dosya ad\u0131 al\u0131namad\u0131 - file ya da select \u00f6zniteli\u011fi ge\u00e7erli bir dizgi d\u00f6nd\u00fcrmelidir."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Yeniden y\u00f6nlendirme eklentisinde FormatterListener olu\u015fturulamad\u0131!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "exclude-result-prefixes i\u00e7indeki \u00f6nek ge\u00e7erli de\u011fil: {0}"}, { ER_MISSING_NS_URI, "Belirtilen \u00f6nek i\u00e7in ad alan\u0131 URI eksik"}, { ER_MISSING_ARG_FOR_OPTION, "{0} se\u00e7ene\u011fi i\u00e7in ba\u011f\u0131ms\u0131z de\u011fi\u015fken eksik"}, { ER_INVALID_OPTION, "Ge\u00e7ersiz se\u00e7enek: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Bozuk bi\u00e7imli bi\u00e7im dizgisi: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet i\u00e7in 'version' \u00f6zniteli\u011fi gerekiyor!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "{0} \u00f6zniteli\u011fi ge\u00e7ersiz {1} de\u011ferini i\u00e7eriyor"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose i\u00e7in xsl:when gerekiyor"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports, xsl:for-each i\u00e7inde kullan\u0131lamaz"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "\u00c7\u0131k\u0131\u015f DOM d\u00fc\u011f\u00fcm\u00fc i\u00e7in DTMLiaison kullan\u0131lamaz... onun yerine org.apache.xpath.DOM2Helper aktar\u0131n!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Giri\u015f DOM d\u00fc\u011f\u00fcm\u00fc i\u00e7in DTMLiaison kullan\u0131lamaz... onun yerine org.apache.xpath.DOM2Helper aktar\u0131n!"}, { ER_CALL_TO_EXT_FAILED, "Eklenti \u00f6\u011fesine \u00e7a\u011fr\u0131 ba\u015far\u0131s\u0131z oldu: {0}"}, { ER_PREFIX_MUST_RESOLVE, "\u00d6nek bir ad alan\u0131na \u00e7\u00f6z\u00fclmelidir: {0}"}, { ER_INVALID_UTF16_SURROGATE, "UTF-16 yerine kullan\u0131lan de\u011fer ge\u00e7ersiz: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} kendisini kulland\u0131, sonsuz d\u00f6ng\u00fc olu\u015facak."}, { ER_CANNOT_MIX_XERCESDOM, "Xerces-DOM d\u0131\u015f\u0131 giri\u015f Xerces-DOM \u00e7\u0131k\u0131\u015fla birle\u015ftirilemez!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "ElemTemplateElement.readObject i\u00e7inde: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Bu ad\u0131 ta\u015f\u0131yan birden \u00e7ok \u015fablon saptand\u0131: {0}"}, { ER_INVALID_KEY_CALL, "Ge\u00e7ersiz i\u015flev \u00e7a\u011fr\u0131s\u0131: \u00d6zyineli key() \u00e7a\u011fr\u0131lar\u0131na izin verilmez"}, { ER_REFERENCING_ITSELF, "{0} de\u011fi\u015fkeni do\u011frudan ya da dolayl\u0131 olarak kendisine ba\u015fvuruda bulunuyor!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "newTemplates ile ilgili DOMSource i\u00e7in giri\u015f d\u00fc\u011f\u00fcm\u00fc bo\u015f de\u011ferli olamaz!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "{0} se\u00e7ene\u011fi i\u00e7in s\u0131n\u0131f dosyas\u0131 bulunamad\u0131"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Gerekli \u00f6\u011fe bulunamad\u0131: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream bo\u015f de\u011ferli olamaz"}, { ER_URI_CANNOT_BE_NULL, "URI bo\u015f de\u011ferli olamaz"}, { ER_FILE_CANNOT_BE_NULL, "Dosya bo\u015f de\u011ferli olamaz"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource bo\u015f de\u011ferli olamaz"}, { ER_CANNOT_INIT_BSFMGR, "BSF Manager kullan\u0131ma haz\u0131rlanamad\u0131"}, { ER_CANNOT_CMPL_EXTENSN, "Eklenti derlenemedi"}, { ER_CANNOT_CREATE_EXTENSN, "Eklenti yarat\u0131lamad\u0131: {0} nedeni: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "{0} y\u00f6ntemine y\u00f6nelik Instance y\u00f6ntemi, birincil ba\u011f\u0131ms\u0131z de\u011fi\u015fkenin somutla\u015fan nesne \u00f6rne\u011fi olmas\u0131n\u0131 gerektirir"}, { ER_INVALID_ELEMENT_NAME, "Belirtilen \u00f6\u011fe ad\u0131 ge\u00e7ersiz {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "\u00d6\u011fe ad\u0131 y\u00f6ntemi dura\u011fan {0} olmal\u0131"}, { ER_EXTENSION_FUNC_UNKNOWN, "Eklenti i\u015flevi {0} : {1} bilinmiyor"}, { ER_MORE_MATCH_CONSTRUCTOR, "{0} ile ilgili olu\u015fturucu i\u00e7in en iyi e\u015fle\u015fme say\u0131s\u0131 birden \u00e7ok"}, { ER_MORE_MATCH_METHOD, "{0} y\u00f6ntemi i\u00e7in en iyi e\u015fle\u015fme say\u0131s\u0131 birden \u00e7ok"}, { ER_MORE_MATCH_ELEMENT, "{0} \u00f6\u011fe y\u00f6ntemi i\u00e7in en iyi e\u015fle\u015fme say\u0131s\u0131 birden \u00e7ok"}, { ER_INVALID_CONTEXT_PASSED, "{0} de\u011ferlendirmesi i\u00e7in ge\u00e7ersiz ba\u011flam aktar\u0131ld\u0131"}, { ER_POOL_EXISTS, "Havuz zaten var"}, { ER_NO_DRIVER_NAME, "S\u00fcr\u00fcc\u00fc ad\u0131 belirtilmedi"}, { ER_NO_URL, "URL belirtilmedi"}, { ER_POOL_SIZE_LESSTHAN_ONE, "Havuz b\u00fcy\u00fckl\u00fc\u011f\u00fc birden az!"}, { ER_INVALID_DRIVER, "Belirtilen s\u00fcr\u00fcc\u00fc ad\u0131 ge\u00e7ersiz!"}, { ER_NO_STYLESHEETROOT, "Bi\u00e7em yapra\u011f\u0131 k\u00f6k\u00fc bulunamad\u0131!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "xml:space i\u00e7in ge\u00e7ersiz de\u011fer"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode ba\u015far\u0131s\u0131z oldu"}, { ER_RESOURCE_COULD_NOT_LOAD, "Kaynak [ {0} ] y\u00fckleyemedi: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Arabellek b\u00fcy\u00fckl\u00fc\u011f\u00fc <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Eklenti \u00e7a\u011fr\u0131l\u0131rken bilinmeyen hata"}, { ER_NO_NAMESPACE_DECL, "{0} \u00f6nekinin ili\u015fkili bir ad alan\u0131 bildirimi yok"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "lang=javaclass {0} i\u00e7in \u00f6\u011fe i\u00e7eri\u011fine izin verilmiyor"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Bi\u00e7em yapra\u011f\u0131 y\u00f6nlendirmeli sonland\u0131rma"}, { ER_ONE_OR_TWO, "1 ya da 2"}, { ER_TWO_OR_THREE, "2 ya da 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "{0} y\u00fcklenemedi (CLASSPATH de\u011fi\u015fkenini inceleyin), yaln\u0131zca varsay\u0131lanlar kullan\u0131l\u0131yor"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Varsay\u0131lan \u015fablonlar kullan\u0131ma haz\u0131rlanam\u0131yor"}, { ER_RESULT_NULL, "Sonu\u00e7 bo\u015f de\u011ferli olmamal\u0131"}, { ER_RESULT_COULD_NOT_BE_SET, "Sonu\u00e7 tan\u0131mlanamad\u0131"}, { ER_NO_OUTPUT_SPECIFIED, "\u00c7\u0131k\u0131\u015f belirtilmedi"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "{0} tipi sonuca d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "{0} tipi kayna\u011fa d\u00f6n\u00fc\u015ft\u00fcr\u00fclemez"}, { ER_NULL_CONTENT_HANDLER, "Bo\u015f de\u011ferli i\u00e7erik i\u015fleyici"}, { ER_NULL_ERROR_HANDLER, "Bo\u015f de\u011ferli hata i\u015fleyici"}, { ER_CANNOT_CALL_PARSE, "ContentHandler tan\u0131mlanmad\u0131ysa parse \u00e7a\u011fr\u0131lamaz"}, { ER_NO_PARENT_FOR_FILTER, "S\u00fczgecin \u00fcst \u00f6\u011fesi yok"}, { ER_NO_STYLESHEET_IN_MEDIA, "Bi\u00e7em yapra\u011f\u0131 burada bulunamad\u0131: {0}, ortam= {1}"}, { ER_NO_STYLESHEET_PI, "xml-stylesheet PI burada bulunamad\u0131: {0}"}, { ER_NOT_SUPPORTED, "Desteklenmiyor: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "{0} \u00f6zelli\u011finin de\u011feri Boole somut \u00f6rne\u011fi olmal\u0131"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "{0} i\u00e7inde d\u0131\u015f komut dosyas\u0131na ula\u015f\u0131lamad\u0131"}, { ER_RESOURCE_COULD_NOT_FIND, "Kaynak [ {0} ] bulunamad\u0131.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "\u00c7\u0131k\u0131\u015f \u00f6zelli\u011fi tan\u0131nm\u0131yor: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "ElemLiteralResult somut \u00f6rne\u011fi yarat\u0131lmas\u0131 ba\u015far\u0131s\u0131z oldu"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "{0} de\u011feri ayr\u0131\u015ft\u0131r\u0131labilir bir say\u0131 i\u00e7ermelidir"}, { ER_VALUE_SHOULD_EQUAL, "{0} de\u011feri yes ya da no olmal\u0131"}, { ER_FAILED_CALLING_METHOD, "{0} y\u00f6ntemi \u00e7a\u011fr\u0131s\u0131 ba\u015far\u0131s\u0131z oldu"}, { ER_FAILED_CREATING_ELEMTMPL, "ElemTemplateElement somut \u00f6rne\u011fi yarat\u0131lmas\u0131 ba\u015far\u0131s\u0131z oldu"}, { ER_CHARS_NOT_ALLOWED, "Belgenin bu noktas\u0131nda karakterlere izin verilmez"}, { ER_ATTR_NOT_ALLOWED, "\"{0}\" \u00f6zniteli\u011fi {1} \u00f6\u011fesinde kullan\u0131lamaz!"}, { ER_BAD_VALUE, "{0} hatal\u0131 de\u011fer {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "{0} \u00f6znitelik de\u011feri bulunamad\u0131 "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "{0} \u00f6znitelik de\u011feri tan\u0131nm\u0131yor "}, { ER_NULL_URI_NAMESPACE, "Bo\u015f de\u011ferli URI ile ad alan\u0131 \u00f6neki olu\u015fturma giri\u015fimi"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "En b\u00fcy\u00fck uzun tamsay\u0131dan daha b\u00fcy\u00fck bir say\u0131 bi\u00e7imleme giri\u015fimi"}, { ER_CANNOT_FIND_SAX1_DRIVER, "SAX1 s\u00fcr\u00fcc\u00fc s\u0131n\u0131f\u0131 {0} bulunam\u0131yor"}, { ER_SAX1_DRIVER_NOT_LOADED, "SAX1 s\u00fcr\u00fcc\u00fc s\u0131n\u0131f\u0131 {0} bulundu, ancak y\u00fcklenemiyor"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "SAX1 s\u00fcr\u00fcc\u00fc s\u0131n\u0131f\u0131 {0} y\u00fcklendi, ancak somutla\u015ft\u0131r\u0131lam\u0131yor"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1 s\u00fcr\u00fcc\u00fc s\u0131n\u0131f\u0131 {0} org.xml.sax.Parser \u00f6zelli\u011fini uygulam\u0131yor"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Sistem \u00f6zelli\u011fi org.xml.sax.parser belirtilmedi"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Ayr\u0131\u015ft\u0131r\u0131c\u0131 (Parser) ba\u011f\u0131ms\u0131z de\u011fi\u015fkeni bo\u015f de\u011ferli olmamal\u0131"}, { ER_FEATURE, "\u00d6zellik: {0}"}, { ER_PROPERTY, "\u00d6zellik: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Bo\u015f de\u011ferli varl\u0131k \u00e7\u00f6z\u00fcc\u00fc"}, { ER_NULL_DTD_HANDLER, "Bo\u015f de\u011ferli DTD i\u015fleyici"}, { ER_NO_DRIVER_NAME_SPECIFIED, "S\u00fcr\u00fcc\u00fc ad\u0131 belirtilmedi!"}, { ER_NO_URL_SPECIFIED, "URL belirtilmedi!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Havuz b\u00fcy\u00fckl\u00fc\u011f\u00fc birden az!"}, { ER_INVALID_DRIVER_NAME, "Belirtilen s\u00fcr\u00fcc\u00fc ad\u0131 ge\u00e7ersiz!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Programc\u0131 hatas\u0131! \u0130fadenin ElemTemplateElement \u00fcst \u00f6\u011fesi yok!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "RedundentExprEliminator i\u00e7inde programc\u0131 do\u011frulamas\u0131: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} bi\u00e7em yapra\u011f\u0131nda bu konumda bulunamaz!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Beyaz alan d\u0131\u015f\u0131 metin bi\u00e7em yapra\u011f\u0131nda bu konumda bulunamaz!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "CHAR \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131. CHAR tipinde bir \u00f6znitelik yaln\u0131zca 1 karakter olmal\u0131d\u0131r!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "QNAME \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "ENUM \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131. Ge\u00e7erli de\u011ferler: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "NMTOKEN \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131 "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "NCNAME \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131 "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "boolean \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131 "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "number \u00f6zniteli\u011fi {0} i\u00e7in ge\u00e7ersiz {1} de\u011feri kullan\u0131ld\u0131 "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "E\u015fle\u015fme \u00f6r\u00fcnt\u00fcs\u00fcnde {0} i\u015flevine ili\u015fkin ba\u011f\u0131ms\u0131z de\u011fi\u015fken bir haz\u0131r bilgi olmal\u0131d\u0131r."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Yinelenen genel de\u011fi\u015fken bildirimi."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Yinelenen de\u011fi\u015fken bildirimi."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template bir name ya da match \u00f6zniteli\u011fi (ya da her ikisini) i\u00e7ermelidir"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "exclude-result-prefixes i\u00e7indeki \u00f6nek ge\u00e7erli de\u011fil: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "{0} adl\u0131 \u00f6znitelik k\u00fcmesi yok"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "{0} adl\u0131 i\u015flev yok"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "{0} \u00f6\u011fesinin hem i\u00e7eri\u011fi, hem de select \u00f6zniteli\u011fi olamaz."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "{0} de\u011fi\u015ftirgesinin de\u011feri ge\u00e7erli bir Java nesnesi olmal\u0131d\u0131r"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Bir xsl:namespace-alias \u00f6\u011fesine ili\u015fkin result-prefix \u00f6zniteli\u011finin de\u011feri '#default', ancak \u00f6\u011fenin kapsam\u0131nda varsay\u0131lan ad alan\u0131 bildirimi yok."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Bir xsl:namespace-alias \u00f6\u011fesine ili\u015fkin result-prefix \u00f6zniteli\u011finin de\u011feri ''{0}'', ancak \u00f6\u011fenin kapsam\u0131nda ''{0}'' \u00f6neki i\u00e7in ad alan\u0131 bildirimi yok."}, { ER_SET_FEATURE_NULL_NAME, "TransformerFactory.setFeature(dizgi ad\u0131, boole de\u011fer) i\u00e7inde \u00f6zellik (feature) ad\u0131 bo\u015f de\u011ferli olamaz."}, { ER_GET_FEATURE_NULL_NAME, "TransformerFactory.getFeature(dizgi ad\u0131) i\u00e7inde \u00f6zellik (feature) ad\u0131 bo\u015f de\u011ferli olamaz."}, { ER_UNSUPPORTED_FEATURE, "Bu TransformerFactory \u00fczerinde ''{0}'' \u00f6zelli\u011fi tan\u0131mlanamaz."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "G\u00fcvenli i\u015fleme \u00f6zelli\u011fi true de\u011ferine ayarland\u0131\u011f\u0131nda ''{0}'' eklenti \u00f6\u011fesinin kullan\u0131lmas\u0131na izin verilmez."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Bo\u015f de\u011ferli ad alan\u0131 Uri i\u00e7in \u00f6nek al\u0131namaz."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Bo\u015f de\u011ferli \u00f6nek i\u00e7in ad alan\u0131 Uri al\u0131namaz."}, { ER_XPATH_RESOLVER_NULL_QNAME, "\u0130\u015flev ad\u0131 bo\u015f de\u011ferli olamaz."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "E\u015flik eksi olamaz."}, // Warnings... { WG_FOUND_CURLYBRACE, "'}' bulundu, ancak a\u00e7\u0131k \u00f6znitelik \u015fablonu yok!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Uyar\u0131: count \u00f6zniteli\u011fi xsl:number i\u00e7indeki bir \u00fcst \u00f6znitelikle e\u015fle\u015fmiyor! Hedef = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Eski s\u00f6zdizimi: 'expr' \u00f6zniteli\u011finin ad\u0131 'select' olarak de\u011fi\u015ftirildi."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan hen\u00fcz format-number i\u015flevinde \u00fclke de\u011feri ad\u0131n\u0131 i\u015flemiyor."}, { WG_LOCALE_NOT_FOUND, "Uyar\u0131: xml:lang={0} ile ilgili \u00fclke de\u011feri bulunamad\u0131"}, { WG_CANNOT_MAKE_URL_FROM, "Dizgiden URL olu\u015fturulamad\u0131: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "\u0130stenen belge y\u00fcklenemiyor: {0}"}, { WG_CANNOT_FIND_COLLATOR, ">>>>>> Xalan S\u00fcr\u00fcm "}, { "version2", "<<<<<<<"}, { "yes", "yes"}, { "line", "Sat\u0131r #"}, { "column","Kolon #"}, { "xsldone", "XSLProcessor: bitti"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J komut sat\u0131r\u0131 Process s\u0131n\u0131f\u0131 se\u00e7enekleri:"}, { "xslProc_option", "Xalan-J komut sat\u0131r\u0131 i\u015flem s\u0131n\u0131f\u0131 se\u00e7enekleri\u003a"}, { "xslProc_invalid_xsltc_option", "{0} se\u00e7ene\u011fi XSLTC kipinde desteklenmez."}, { "xslProc_invalid_xalan_option", "{0} se\u00e7ene\u011fi yaln\u0131zca -XSLTC ile kullan\u0131labilir."}, { "xslProc_no_input", "Hata: Bi\u00e7em yapra\u011f\u0131 ya da giri\u015f xml belirtilmedi. Kullan\u0131m y\u00f6nergeleri i\u00e7in, bu komutu se\u00e7enek belirtmeden \u00e7al\u0131\u015ft\u0131r\u0131n."}, { "xslProc_common_options", "-Ortak Se\u00e7enekler-"}, { "xslProc_xalan_options", "-Xalan Se\u00e7enekleri-"}, { "xslProc_xsltc_options", "-XSLTC Se\u00e7enekleri-"}, { "xslProc_return_to_continue", "(devam etmek i\u00e7in tu\u015funa bas\u0131n)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", "[-XSLTC (XSLTC d\u00f6n\u00fc\u015ft\u00fcrmede kullan\u0131l\u0131r)]"}, { "optionIN", "[-IN inputXMLURL]"}, { "optionXSL", "[-XSL XSLTransformationURL]"}, { "optionOUT", "[-OUT outputFileName]"}, { "optionLXCIN", "[-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", "[-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", "[-PARSER ayr\u0131\u015ft\u0131r\u0131c\u0131 ili\u015fkisinin tam olarak nitelenmi\u015f s\u0131n\u0131f ad\u0131]"}, { "optionE", "[-E (Varl\u0131k ba\u015fvurular\u0131 geni\u015fletilmez)]"}, { "optionV", "[-E (Varl\u0131k ba\u015fvurular\u0131 geni\u015fletilmez)]"}, { "optionQC", "[-QC (Sessiz \u00f6r\u00fcnt\u00fc \u00e7at\u0131\u015fmalar\u0131 uyar\u0131s\u0131)]"}, { "optionQ", "[-Q (Sessiz kip)]"}, { "optionLF", " [-LF (sat\u0131r besleme yaln\u0131zca \u00e7\u0131k\u0131\u015fta kullan\u0131l\u0131r {varsay\u0131lan CR/LF})]"}, { "optionCR", " [-CR (Sat\u0131rba\u015f\u0131 yaln\u0131zca \u00e7\u0131k\u0131\u015fta kullan\u0131l\u0131r {varsay\u0131lan CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Ka\u00e7\u0131\u015f karakterleri {varsay\u0131lan <>&\"\'\\r\\n}]"}, { "optionINDENT", "[-INDENT (Girintili yazarken kullan\u0131lacak bo\u015fluk say\u0131s\u0131 {varsay\u0131lan 0})]"}, { "optionTT", "[-TT (\u015eablonlar \u00e7a\u011fr\u0131l\u0131rken izlenir.)]"}, { "optionTG", "[-TG (Her olu\u015fturma olay\u0131 izlenir.)]"}, { "optionTS", "[-TS (Her se\u00e7im olay\u0131 izlenir.)]"}, { "optionTTC", "[-TTC (\u015eablon alt \u00f6\u011feleri i\u015flenirken izlenir.)]"}, { "optionTCLASS", "[-TCLASS (\u0130zleme eklentileri i\u00e7in TraceListener s\u0131n\u0131f\u0131.)]"}, { "optionVALIDATE", "[-VALIDATE (Ge\u00e7erlilik denetimi yap\u0131l\u0131p yap\u0131lmayaca\u011f\u0131n\u0131 belirler. Varsay\u0131lan olarak, ge\u00e7erlilik denetimi kapal\u0131d\u0131r.)]"}, { "optionEDUMP", "[-EDUMP {iste\u011fe ba\u011fl\u0131 dosya ad\u0131} (Hata durumunda y\u0131\u011f\u0131n d\u00f6k\u00fcm\u00fc ger\u00e7ekle\u015ftirilir.)]"}, { "optionXML", "[-XML (XML bi\u00e7imleyici kullan\u0131l\u0131r ve XML \u00fcstbilgisi eklenir.)]"}, { "optionTEXT", "[-TEXT (Yal\u0131n metin bi\u00e7imleyici kullan\u0131l\u0131r.)]"}, { "optionHTML", "[-HTML (HTML bi\u00e7imleyici kullan\u0131l\u0131r.)]"}, { "optionPARAM", "[-PARAM ad ifadesi (Bi\u00e7em yapra\u011f\u0131 de\u011fi\u015ftirgesi belirlenir.)]"}, { "noParsermsg1", "XSL i\u015flemi ba\u015far\u0131s\u0131z oldu."}, { "noParsermsg2", "** Ayr\u0131\u015ft\u0131r\u0131c\u0131 bulunamad\u0131 **"}, { "noParsermsg3", "L\u00fctfen classpath de\u011fi\u015fkeninizi inceleyin."}, { "noParsermsg4", "Sisteminizde IBM XML Parser for Java arac\u0131 yoksa, \u015fu adresten y\u00fckleyebilirsiniz:"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", "[-URIRESOLVER tam s\u0131n\u0131f ad\u0131 (URI \u00e7\u00f6zmekte kullan\u0131lacak URIResolver)]"}, { "optionENTITYRESOLVER", "[-ENTITYRESOLVER tam s\u0131n\u0131f ad\u0131 (Varl\u0131klar\u0131 \u00e7\u00f6zmekte kullan\u0131lacak EntityResolver)]"}, { "optionCONTENTHANDLER", "[-CONTENTHANDLER tam s\u0131n\u0131f ad\u0131 (\u00c7\u0131k\u0131\u015f\u0131 diziselle\u015ftirmekte kullan\u0131lacak ContentHandler)]"}, { "optionLINENUMBERS", "[-L kaynak belge i\u00e7in sat\u0131r numaralar\u0131 kullan\u0131l\u0131r]"}, { "optionSECUREPROCESSING", " [-SECURE (g\u00fcvenli i\u015fleme \u00f6zelli\u011fi true de\u011ferine ayarlan\u0131r.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (Ortam \u00f6zniteli\u011fi, bir belgeyle ili\u015fkili bi\u00e7em yapra\u011f\u0131n\u0131 bulmak i\u00e7in kullan\u0131l\u0131r.)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (D\u00f6n\u00fc\u015ft\u00fcrmeyi ger\u00e7ekle\u015ftirmek i\u00e7in belirtik olarak s2s=SAX ya da d2d=DOM kullan\u0131l\u0131r.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (D\u00f6n\u00fc\u015ft\u00fcrmenin ka\u00e7 milisaniye s\u00fcrd\u00fc\u011f\u00fcn\u00fc yazd\u0131r\u0131r.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (http://xml.apache.org/xalan/features/incremental true tan\u0131mlayarak art\u0131msal DTM olu\u015fturulmas\u0131 istenir.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (http://xml.apache.org/xalan/features/optimize false tan\u0131mlayarak bi\u00e7em yapra\u011f\u0131 eniyileme i\u015flemi olmamas\u0131 istenir.)]"}, { "optionRL", " [-RL recursionlimit (Bi\u00e7em yapra\u011f\u0131 \u00f6zyineleme derinli\u011fine say\u0131sal s\u0131n\u0131r koyar.)]"}, { "optionXO", "[-XO [derleme sonucu s\u0131n\u0131f dosyas\u0131 ad\u0131] (Olu\u015fturulan s\u0131n\u0131f dosyas\u0131na bu ad\u0131 atar.)]"}, { "optionXD", "[-XD destinationDirectory (Derleme sonucu s\u0131n\u0131f dosyas\u0131 i\u00e7in hedef dizin belirtir.)]"}, { "optionXJ", "[-XJ jardsy (Derleme sonucu \u00fcretilen s\u0131n\u0131flar\u0131 adl\u0131 jar dosyas\u0131nda paketler.)]"}, { "optionXP", "[-XP paket (Derleme sonucunda \u00fcretilen t\u00fcm s\u0131n\u0131flar i\u00e7in bir paket ad\u0131 \u00f6neki belirtir.)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN (\u015eablona do\u011frudan yerle\u015ftirmeyi a\u00e7ar.)]" }, { "optionXX", "[-XX (Ek hata ay\u0131klama iletisi \u00e7\u0131k\u0131\u015f\u0131n\u0131 a\u00e7ar.)]"}, { "optionXT" , "[-XT (Yap\u0131labiliyorsa, d\u00f6n\u00fc\u015ft\u00fcrme i\u00e7in derleme sonucu s\u0131n\u0131f dosyas\u0131n\u0131 kullan\u0131r.)]"}, { "diagTiming","--------- {1} ile {0} d\u00f6n\u00fc\u015ft\u00fcrme i\u015flemi {2} ms s\u00fcrd\u00fc" }, { "recursionTooDeep","\u015eablon i\u00e7i\u00e7e kullan\u0131m derinli\u011fi \u00e7ok fazla. \u0130\u00e7i\u00e7e kullan\u0131m = {0}, \u015fablon {1} {2}" }, { "nameIs", "ad\u0131" }, { "matchPatternIs", "e\u015fle\u015fme \u00f6r\u00fcnt\u00fcs\u00fc" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "HATALI_KOD"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "B\u0130\u00c7\u0130MLEME_BA\u015eARISIZ"; /** General error string. */ public static final String ERROR_STRING = "#hata"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Hata: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Uyar\u0131: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "\u00d6R\u00dcNT\u00dc "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("tr", "TR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_zh.java0000644000175000017500000022044310721374031025041 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_zh.java 338081 2004-12-15 17:35:58Z jycli $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_zh extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "\u9519\u8bef\uff1a\u8868\u8fbe\u5f0f\u4e2d\u4e0d\u80fd\u6709\u201c{\u201d"}, { ER_ILLEGAL_ATTRIBUTE , "{0} \u6709\u4e00\u4e2a\u975e\u6cd5\u5c5e\u6027\uff1a{1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode \u5728 xsl:apply-imports \u4e2d\u4e3a\u7a7a\uff01"}, {ER_CANNOT_ADD, "\u65e0\u6cd5\u5c06\u201c{0}\u201d\u6dfb\u52a0\u5230\u201c{1}\u201d"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode \u5728 handleApplyTemplatesInstruction \u4e2d\u4e3a\u7a7a\uff01"}, { ER_NO_NAME_ATTRIB, "\u201c{0}\u201d\u5fc5\u987b\u6709 name \u5c5e\u6027\u3002"}, {ER_TEMPLATE_NOT_FOUND, "\u627e\u4e0d\u5230\u4ee5\u4e0b\u540d\u79f0\u7684\u6a21\u677f\uff1a{0}"}, {ER_CANT_RESOLVE_NAME_AVT, "\u65e0\u6cd5\u89e3\u6790 xsl:call-template \u4e2d\u7684\u540d\u79f0 AVT\u3002"}, {ER_REQUIRES_ATTRIB, "\u201c{0}\u201d\u9700\u8981\u5c5e\u6027\uff1a{1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "\u201c{0}\u201d\u5fc5\u987b\u6709\u201ctest\u201d\u5c5e\u6027\u3002"}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "\u7ea7\u522b\u5c5e\u6027\u4e0a\u51fa\u73b0\u9519\u8bef\u503c\uff1a{0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "processing-instruction \u540d\u79f0\u4e0d\u80fd\u662f\u201cxml\u201d"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "processing-instruction \u540d\u79f0\u5fc5\u987b\u662f\u6709\u6548\u7684 NCName\uff1a{0}"}, { ER_NEED_MATCH_ATTRIB, "\u201c{0}\u201d\u5982\u679c\u6709\u67d0\u79cd\u65b9\u5f0f\uff0c\u5c31\u5fc5\u987b\u6709 match \u5c5e\u6027\u3002"}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "\u201c{0}\u201d\u9700\u8981 name \u5c5e\u6027\u6216 match \u5c5e\u6027\u3002"}, {ER_CANT_RESOLVE_NSPREFIX, "\u65e0\u6cd5\u89e3\u6790\u540d\u79f0\u7a7a\u95f4\u524d\u7f00\uff1a{0}"}, { ER_ILLEGAL_VALUE, "xml:space \u6709\u975e\u6cd5\u7684\u503c\uff1a{0}"}, { ER_NO_OWNERDOC, "\u5b50\u8282\u70b9\u6ca1\u6709\u6240\u6709\u8005\u6587\u6863\uff01"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement \u9519\u8bef\uff1a{0}"}, { ER_NULL_CHILD, "\u6b63\u5728\u5c1d\u8bd5\u6dfb\u52a0\u7a7a\u7684\u5b50\u4ee3\uff01"}, { ER_NEED_SELECT_ATTRIB, "{0} \u9700\u8981 select \u5c5e\u6027\u3002"}, { ER_NEED_TEST_ATTRIB , "xsl:when \u5fc5\u987b\u6709\u201ctest\u201d\u5c5e\u6027\u3002"}, { ER_NEED_NAME_ATTRIB, "xsl:with-param \u5fc5\u987b\u6709\u201cname\u201d\u5c5e\u6027\u3002"}, { ER_NO_CONTEXT_OWNERDOC, "\u4e0a\u4e0b\u6587\u6ca1\u6709\u6240\u6709\u8005\u6587\u6863\uff01"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "\u65e0\u6cd5\u521b\u5efa XML TransformerFactory \u8054\u7cfb\uff1a{0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Process \u4e0d\u6210\u529f\u3002"}, { ER_NOT_SUCCESSFUL, "Xalan: \u4e0d\u6210\u529f\u3002"}, { ER_ENCODING_NOT_SUPPORTED, "\u4e0d\u652f\u6301\u7f16\u7801\uff1a{0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "\u65e0\u6cd5\u521b\u5efa TraceListener\uff1a{0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key \u9700\u8981\u201cname\u201d\u5c5e\u6027\uff01"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key \u9700\u8981\u201cmatch\u201d\u5c5e\u6027\uff01"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key \u9700\u8981\u201cuse\u201d\u5c5e\u6027\uff01"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} \u9700\u8981\u201celements\u201d\u5c5e\u6027\uff01"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} \u5c5e\u6027\u201cprefix\u201d\u4e22\u5931"}, { ER_BAD_STYLESHEET_URL, "\u6837\u5f0f\u8868 URL \u9519\u8bef\uff1a{0}"}, { ER_FILE_NOT_FOUND, "\u627e\u4e0d\u5230\u6837\u5f0f\u8868\u6587\u4ef6\uff1a{0}"}, { ER_IOEXCEPTION, "\u6837\u5f0f\u8868\u6587\u4ef6\u53d1\u751f IO \u5f02\u5e38\uff1a{0}"}, { ER_NO_HREF_ATTRIB, "\uff08StylesheetHandler\uff09\u65e0\u6cd5\u4e3a {0} \u627e\u5230 href \u5c5e\u6027"}, { ER_STYLESHEET_INCLUDES_ITSELF, "\uff08StylesheetHandler\uff09{0} \u6b63\u5728\u76f4\u63a5\u6216\u95f4\u63a5\u5730\u5305\u542b\u5b83\u81ea\u8eab\uff01"}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude \u9519\u8bef\uff0c{0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} \u5c5e\u6027\u201clang\u201d\u4e22\u5931"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "\uff08StylesheetHandler\uff09\u662f\u5426\u9519\u653e\u4e86 {0} \u5143\u7d20\uff1f\uff1f\u7f3a\u5c11\u5bb9\u5668\u5143\u7d20\u201ccomponent\u201d"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "\u53ea\u80fd\u8f93\u51fa\u5230 Element\u3001DocumentFragment\u3001Document \u6216 PrintWriter\u3002"}, { ER_PROCESS_ERROR, "StylesheetRoot.process \u9519\u8bef"}, { ER_UNIMPLNODE_ERROR, "UnImplNode \u9519\u8bef\uff1a{0}"}, { ER_NO_SELECT_EXPRESSION, "\u9519\u8bef\uff01\u627e\u4e0d\u5230 xpath \u9009\u62e9\u8868\u8fbe\u5f0f\uff08-select\uff09\u3002"}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "\u65e0\u6cd5\u5e8f\u5217\u5316 XSLProcessor\uff01"}, { ER_NO_INPUT_STYLESHEET, "\u6ca1\u6709\u6307\u5b9a\u6837\u5f0f\u8868\u8f93\u5165\uff01"}, { ER_FAILED_PROCESS_STYLESHEET, "\u65e0\u6cd5\u5904\u7406\u6837\u5f0f\u8868\uff01"}, { ER_COULDNT_PARSE_DOC, "\u65e0\u6cd5\u89e3\u6790 {0} \u6587\u6863\uff01"}, { ER_COULDNT_FIND_FRAGMENT, "\u627e\u4e0d\u5230\u7247\u6bb5\uff1a{0}"}, { ER_NODE_NOT_ELEMENT, "\u7247\u6bb5\u6807\u8bc6\u6307\u5411\u7684\u8282\u70b9\u4e0d\u662f\u5143\u7d20\uff1a{0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each \u5fc5\u987b\u6709 match \u6216 name \u5c5e\u6027"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates \u5fc5\u987b\u6709 match \u6216 name \u5c5e\u6027"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\u65e0\u6587\u6863\u7247\u6bb5\u7684\u514b\u9686\uff01"}, { ER_CANT_CREATE_ITEM, "\u65e0\u6cd5\u5728\u7ed3\u679c\u6811\u4e2d\u521b\u5efa\u9879\uff1a{0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "\u6e90 XML \u4e2d\u7684 xml:space \u6709\u975e\u6cd5\u503c\uff1a{0}"}, { ER_NO_XSLKEY_DECLARATION, "{0} \u6ca1\u6709 xsl:key \u58f0\u660e\uff01"}, { ER_CANT_CREATE_URL, "\u9519\u8bef\uff01\u65e0\u6cd5\u4e3a {0} \u521b\u5efa URL"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "\u4e0d\u652f\u6301 xsl:functions"}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory \u9519\u8bef"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "\uff08StylesheetHandler\uff09\u6837\u5f0f\u8868\u5185\u4e0d\u5141\u8bb8 {0}\uff01"}, { ER_RESULTNS_NOT_SUPPORTED, "\u4e0d\u518d\u652f\u6301 result-ns\uff01\u8bf7\u6539\u4e3a\u4f7f\u7528 xsl:output\u3002"}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "\u4e0d\u518d\u652f\u6301 default-space\uff01\u8bf7\u6539\u4e3a\u4f7f\u7528 xsl:strip-space \u6216 xsl:preserve-space\u3002"}, { ER_INDENTRESULT_NOT_SUPPORTED, "\u4e0d\u518d\u652f\u6301 indent-result\uff01\u8bf7\u6539\u4e3a\u4f7f\u7528 xsl:output\u3002"}, { ER_ILLEGAL_ATTRIB, "\uff08StylesheetHandler\uff09{0} \u6709\u975e\u6cd5\u5c5e\u6027\uff1a{1}"}, { ER_UNKNOWN_XSL_ELEM, "\u672a\u77e5 XSL \u5143\u7d20\uff1a{0}"}, { ER_BAD_XSLSORT_USE, "\uff08StylesheetHandler\uff09xsl:sort \u53ea\u80fd\u4e0e xsl:apply-templates \u6216 xsl:for-each \u4e00\u8d77\u4f7f\u7528\u3002"}, { ER_MISPLACED_XSLWHEN, "\uff08StylesheetHandler\uff09\u9519\u653e\u4e86 xsl:when\uff01"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "\uff08StylesheetHandler\uff09xsl:choose \u4e0d\u662f xsl:when \u7684\u7236\u4ee3\uff01"}, { ER_MISPLACED_XSLOTHERWISE, "\uff08StylesheetHandler\uff09\u9519\u653e\u4e86 xsl:otherwise\uff01"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "\uff08StylesheetHandler\uff09xsl:choose \u4e0d\u662f xsl:otherwise \u7684\u7236\u4ee3\uff01"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "\uff08StylesheetHandler\uff09\u6a21\u677f\u5185\u4e0d\u5141\u8bb8\u51fa\u73b0 {0}\uff01"}, { ER_UNKNOWN_EXT_NS_PREFIX, "\uff08StylesheetHandler\uff09{0} \u6269\u5c55\u540d\u79f0\u7a7a\u95f4\u524d\u7f00 {1} \u672a\u77e5"}, { ER_IMPORTS_AS_FIRST_ELEM, "\uff08StylesheetHandler\uff09\u5bfc\u5165\u53ea\u80fd\u4f5c\u4e3a\u6837\u5f0f\u8868\u4e2d\u6700\u524d\u9762\u7684\u5143\u7d20\u53d1\u751f\uff01"}, { ER_IMPORTING_ITSELF, "\uff08StylesheetHandler\uff09{0} \u6b63\u5728\u76f4\u63a5\u6216\u95f4\u63a5\u5730\u5bfc\u5165\u5b83\u81ea\u8eab\uff01"}, { ER_XMLSPACE_ILLEGAL_VAL, "\uff08StylesheetHandler\uff09xml:space \u6709\u975e\u6cd5\u503c\uff1a{0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet \u4e0d\u6210\u529f\uff01"}, { ER_SAX_EXCEPTION, "SAX \u5f02\u5e38"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "\u51fd\u6570\u4e0d\u53d7\u652f\u6301\uff01"}, { ER_XSLT_ERROR, "XSLT \u9519\u8bef"}, { ER_CURRENCY_SIGN_ILLEGAL, "\u683c\u5f0f\u6a21\u5f0f\u5b57\u7b26\u4e32\u4e2d\u4e0d\u5141\u8bb8\u5b58\u5728\u8d27\u5e01\u7b26\u53f7"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "\u6837\u5f0f\u8868 DOM \u4e2d\u4e0d\u652f\u6301\u6587\u6863\u51fd\u6570\uff01"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "\u65e0\u6cd5\u89e3\u6790\u975e\u524d\u7f00\u89e3\u6790\u5668\u7684\u524d\u7f00\uff01"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "\u91cd\u5b9a\u5411\u6269\u5c55\uff1a\u65e0\u6cd5\u83b7\u53d6\u6587\u4ef6\u540d \uff0d file \u6216 select \u5c5e\u6027\u5fc5\u987b\u8fd4\u56de\u6709\u6548\u5b57\u7b26\u4e32\u3002"}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "\u65e0\u6cd5\u5728\u91cd\u5b9a\u5411\u6269\u5c55\u4e2d\u6784\u5efa FormatterListener\uff01"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "exclude-result-prefixes \u4e2d\u7684\u524d\u7f00\u65e0\u6548\uff1a{0}"}, { ER_MISSING_NS_URI, "\u6307\u5b9a\u7684\u524d\u7f00\u7f3a\u5c11\u540d\u79f0\u7a7a\u95f4 URI"}, { ER_MISSING_ARG_FOR_OPTION, "\u9009\u9879 {0} \u7f3a\u5c11\u81ea\u53d8\u91cf"}, { ER_INVALID_OPTION, "\u9009\u9879 {0} \u65e0\u6548"}, { ER_MALFORMED_FORMAT_STRING, "\u683c\u5f0f\u5b57\u7b26\u4e32 {0} \u7684\u683c\u5f0f\u9519\u8bef"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet \u9700\u8981\u201cversion\u201d\u5c5e\u6027\uff01"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "\u5c5e\u6027\uff1a{0} \u6709\u975e\u6cd5\u7684\u503c\uff1a{1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose \u9700\u8981 xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:for-each \u4e2d\u4e0d\u5141\u8bb8\u6709 xsl:apply-imports"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "\u65e0\u6cd5\u5c06 DTMLiaison \u7528\u4e8e\u8f93\u51fa DOM \u8282\u70b9... \u6539\u4e3a\u4f20\u9012 org.apache.xpath.DOM2Helper\uff01"}, { ER_CANT_USE_DTM_FOR_INPUT, "\u65e0\u6cd5\u5c06 DTMLiaison \u7528\u4e8e\u8f93\u5165 DOM \u8282\u70b9... \u6539\u4e3a\u4f20\u9012 org.apache.xpath.DOM2Helper\uff01"}, { ER_CALL_TO_EXT_FAILED, "\u8c03\u7528\u6269\u5c55\u5143\u7d20\u5931\u8d25\uff1a{0}"}, { ER_PREFIX_MUST_RESOLVE, "\u524d\u7f00\u5fc5\u987b\u89e3\u6790\u4e3a\u540d\u79f0\u7a7a\u95f4\uff1a{0}"}, { ER_INVALID_UTF16_SURROGATE, "\u68c0\u6d4b\u5230\u65e0\u6548\u7684 UTF-16 \u8d85\u5927\u5b57\u7b26\u96c6\uff1a{0}\uff1f"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} \u4f7f\u7528\u4e86\u81ea\u8eab\uff0c\u8fd9\u5c06\u5bfc\u81f4\u65e0\u9650\u5faa\u73af\u3002"}, { ER_CANNOT_MIX_XERCESDOM, "\u65e0\u6cd5\u5c06\u975e Xerces-DOM \u8f93\u5165\u4e0e Xerces-DOM \u8f93\u51fa\u6df7\u5408\uff01"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet \u2015 TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "\u5728 ElemTemplateElement.readObject \u4e2d\uff1a{0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "\u627e\u5230\u591a\u4e2a\u540d\u4e3a {0} \u7684\u6a21\u677f"}, { ER_INVALID_KEY_CALL, "\u65e0\u6548\u7684\u51fd\u6570\u8c03\u7528\uff1a\u4e0d\u5141\u8bb8\u9012\u5f52 key() \u8c03\u7528"}, { ER_REFERENCING_ITSELF, "\u53d8\u91cf {0} \u6b63\u5728\u76f4\u63a5\u6216\u95f4\u63a5\u5730\u5f15\u7528\u5b83\u81ea\u8eab\uff01"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "\u8f93\u5165\u8282\u70b9\u5bf9\u4e8e newTemplates \u7684 DOMSource \u4e0d\u80fd\u4e3a\u7a7a\uff01"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "\u627e\u4e0d\u5230\u9009\u9879 {0} \u7684\u7c7b\u6587\u4ef6"}, { ER_REQUIRED_ELEM_NOT_FOUND, "\u627e\u4e0d\u5230\u5fc5\u9700\u7684\u5143\u7d20\uff1a{0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream \u4e0d\u80fd\u4e3a\u7a7a"}, { ER_URI_CANNOT_BE_NULL, "URI \u4e0d\u80fd\u4e3a\u7a7a"}, { ER_FILE_CANNOT_BE_NULL, "File \u4e0d\u80fd\u4e3a\u7a7a"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource \u4e0d\u80fd\u4e3a\u7a7a"}, { ER_CANNOT_INIT_BSFMGR, "\u65e0\u6cd5\u521d\u59cb\u5316 BSF \u7ba1\u7406\u5668"}, { ER_CANNOT_CMPL_EXTENSN, "\u65e0\u6cd5\u7f16\u8bd1\u6269\u5c55"}, { ER_CANNOT_CREATE_EXTENSN, "\u7531\u4e8e {1}\uff0c\u65e0\u6cd5\u521b\u5efa\u6269\u5c55 {0}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "\u5bf9\u65b9\u6cd5 {0} \u7684\u5b9e\u4f8b\u65b9\u6cd5\u8c03\u7528\u8981\u6c42\u4ee5\u5bf9\u8c61\u5b9e\u4f8b\u4f5c\u4e3a\u7b2c\u4e00\u53c2\u6570"}, { ER_INVALID_ELEMENT_NAME, "\u6307\u5b9a\u4e86\u65e0\u6548\u7684\u5143\u7d20\u540d\u79f0 {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "\u5143\u7d20\u540d\u79f0\u65b9\u6cd5\u5fc5\u987b\u662f static {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "\u6269\u5c55\u51fd\u6570 {0} : {1} \u672a\u77e5"}, { ER_MORE_MATCH_CONSTRUCTOR, "\u5bf9\u4e8e {0}\uff0c\u6784\u9020\u51fd\u6570\u6709\u591a\u4e2a\u6700\u4f73\u5339\u914d"}, { ER_MORE_MATCH_METHOD, "\u65b9\u6cd5 {0} \u6709\u591a\u4e2a\u6700\u4f73\u5339\u914d"}, { ER_MORE_MATCH_ELEMENT, "element \u65b9\u6cd5 {0} \u6709\u591a\u4e2a\u6700\u4f73\u5339\u914d"}, { ER_INVALID_CONTEXT_PASSED, "\u8bc4\u4f30 {0} \u65f6\u4f20\u9012\u4e86\u65e0\u6548\u7684\u4e0a\u4e0b\u6587"}, { ER_POOL_EXISTS, "\u6c60\u5df2\u7ecf\u5b58\u5728"}, { ER_NO_DRIVER_NAME, "\u672a\u6307\u5b9a\u9a71\u52a8\u7a0b\u5e8f\u540d\u79f0"}, { ER_NO_URL, "\u672a\u6307\u5b9a URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "\u6c60\u5927\u5c0f\u5c0f\u4e8e 1\uff01"}, { ER_INVALID_DRIVER, "\u6307\u5b9a\u4e86\u65e0\u6548\u7684\u9a71\u52a8\u7a0b\u5e8f\u540d\u79f0\uff01"}, { ER_NO_STYLESHEETROOT, "\u627e\u4e0d\u5230\u6837\u5f0f\u8868\u6839\u76ee\u5f55\uff01"}, { ER_ILLEGAL_XMLSPACE_VALUE, "xml:space \u7684\u503c\u975e\u6cd5"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode \u5931\u8d25"}, { ER_RESOURCE_COULD_NOT_LOAD, "\u8d44\u6e90 [ {0} ] \u65e0\u6cd5\u88c5\u5165\uff1a{1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u7f13\u51b2\u533a\u5927\u5c0f <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "\u8c03\u7528\u6269\u5c55\u65f6\u53d1\u751f\u672a\u77e5\u9519\u8bef"}, { ER_NO_NAMESPACE_DECL, "\u524d\u7f00 {0} \u6ca1\u6709\u76f8\u5e94\u7684\u540d\u79f0\u7a7a\u95f4\u58f0\u660e"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "lang=javaclass {0} \u4e0d\u5141\u8bb8\u51fa\u73b0\u5143\u7d20\u5185\u5bb9"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "\u6837\u5f0f\u8868\u5b9a\u5411\u7684\u7ec8\u6b62"}, { ER_ONE_OR_TWO, "1 \u6216 2"}, { ER_TWO_OR_THREE, "2 \u6216 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "\u65e0\u6cd5\u88c5\u5165 {0}\uff08\u68c0\u67e5 CLASSPATH\uff09\uff0c\u73b0\u5728\u53ea\u4f7f\u7528\u7f3a\u7701\u503c"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "\u65e0\u6cd5\u521d\u59cb\u5316\u7f3a\u7701\u6a21\u677f"}, { ER_RESULT_NULL, "\u7ed3\u679c\u4e0d\u5e94\u4e3a\u7a7a"}, { ER_RESULT_COULD_NOT_BE_SET, "\u65e0\u6cd5\u8bbe\u7f6e\u7ed3\u679c"}, { ER_NO_OUTPUT_SPECIFIED, "\u672a\u6307\u5b9a\u8f93\u51fa"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "\u65e0\u6cd5\u8f6c\u6362\u6210\u7c7b\u578b\u4e3a {0} \u7684\u7ed3\u679c"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "\u65e0\u6cd5\u8f6c\u6362\u7c7b\u578b\u4e3a {0} \u7684\u6e90"}, { ER_NULL_CONTENT_HANDLER, "\u5185\u5bb9\u5904\u7406\u7a0b\u5e8f\u4e3a\u7a7a"}, { ER_NULL_ERROR_HANDLER, "\u9519\u8bef\u5904\u7406\u7a0b\u5e8f\u4e3a\u7a7a"}, { ER_CANNOT_CALL_PARSE, "\u5982\u679c\u6ca1\u6709\u8bbe\u7f6e ContentHandler\uff0c\u5219\u65e0\u6cd5\u8c03\u7528\u89e3\u6790"}, { ER_NO_PARENT_FOR_FILTER, "\u8fc7\u6ee4\u5668\u65e0\u7236\u4ee3"}, { ER_NO_STYLESHEET_IN_MEDIA, "\u5728 {0} \u4e2d\u627e\u4e0d\u5230\u6837\u5f0f\u8868\uff0c\u4ecb\u8d28 = {1}"}, { ER_NO_STYLESHEET_PI, "\u5728 {0} \u4e2d\u627e\u4e0d\u5230 xml-stylesheet PI"}, { ER_NOT_SUPPORTED, "\u4e0d\u652f\u6301\uff1a{0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "\u7279\u6027 {0} \u7684\u503c\u5e94\u5f53\u662f\u5e03\u5c14\u5b9e\u4f8b"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "\u627e\u4e0d\u5230 {0} \u4e0a\u7684\u5916\u90e8\u811a\u672c"}, { ER_RESOURCE_COULD_NOT_FIND, "\u627e\u4e0d\u5230\u8d44\u6e90 [ {0} ]\u3002\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "\u672a\u8bc6\u522b\u51fa\u8f93\u51fa\u5c5e\u6027\uff1a{0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "\u521b\u5efa ElemLiteralResult \u5b9e\u4f8b\u5931\u8d25"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "{0} \u7684\u503c\u5e94\u5f53\u5305\u542b\u53ef\u8fdb\u884c\u89e3\u6790\u7684\u6570\u5b57"}, { ER_VALUE_SHOULD_EQUAL, "{0} \u7684\u503c\u5e94\u5f53\u7b49\u4e8e yes \u6216 no"}, { ER_FAILED_CALLING_METHOD, "\u8c03\u7528 {0} \u65b9\u6cd5\u5931\u8d25"}, { ER_FAILED_CREATING_ELEMTMPL, "\u521b\u5efa ElemTemplateElement \u5b9e\u4f8b\u5931\u8d25"}, { ER_CHARS_NOT_ALLOWED, "\u6b64\u65f6\u6587\u6863\u4e2d\u4e0d\u5141\u8bb8\u6709\u5b57\u7b26"}, { ER_ATTR_NOT_ALLOWED, "{1} \u5143\u7d20\u4e0a\u4e0d\u5141\u8bb8\u4f7f\u7528\u201c{0}\u201d\u5c5e\u6027\uff01"}, { ER_BAD_VALUE, "{0} \u9519\u8bef\u503c {1}"}, { ER_ATTRIB_VALUE_NOT_FOUND, "\u627e\u4e0d\u5230 {0} \u5c5e\u6027\u503c"}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "\u672a\u8bc6\u522b\u51fa {0} \u5c5e\u6027\u503c"}, { ER_NULL_URI_NAMESPACE, "\u6b63\u5728\u8bd5\u56fe\u4ee5\u7a7a\u7684 URI \u751f\u6210\u540d\u79f0\u7a7a\u95f4\u524d\u7f00"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "\u6b63\u5728\u8bd5\u56fe\u683c\u5f0f\u5316\u5927\u4e8e\u6700\u5927\u957f\u6574\u6570\u7684\u6570\u5b57"}, { ER_CANNOT_FIND_SAX1_DRIVER, "\u627e\u4e0d\u5230 SAX1 \u9a71\u52a8\u7a0b\u5e8f\u7c7b {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "\u627e\u5230\u4e86 SAX1 \u9a71\u52a8\u7a0b\u5e8f\u7c7b {0}\uff0c\u4f46\u65e0\u6cd5\u88c5\u5165\u5b83"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "\u88c5\u5165\u4e86 SAX1 \u9a71\u52a8\u7a0b\u5e8f\u7c7b {0}\uff0c\u4f46\u65e0\u6cd5\u5c06\u5b83\u5b9e\u4f8b\u5316"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1 \u9a71\u52a8\u7a0b\u5e8f\u7c7b {0} \u4e0d\u5b9e\u73b0 org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "\u6ca1\u6709\u6307\u5b9a\u7cfb\u7edf\u5c5e\u6027 org.xml.sax.parser"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "\u89e3\u6790\u5668\u53c2\u6570\u4e0d\u5f97\u4e3a\u7a7a"}, { ER_FEATURE, "\u7279\u5f81\uff1a{0}"}, { ER_PROPERTY, "\u5c5e\u6027\uff1a{0}"}, { ER_NULL_ENTITY_RESOLVER, "\u5b9e\u4f53\u89e3\u6790\u5668\u4e3a\u7a7a"}, { ER_NULL_DTD_HANDLER, "DTD \u5904\u7406\u7a0b\u5e8f\u4e3a\u7a7a"}, { ER_NO_DRIVER_NAME_SPECIFIED, "\u672a\u6307\u5b9a\u9a71\u52a8\u7a0b\u5e8f\u540d\u79f0\uff01"}, { ER_NO_URL_SPECIFIED, "\u672a\u6307\u5b9a URL\uff01"}, { ER_POOLSIZE_LESS_THAN_ONE, "\u6c60\u5927\u5c0f\u5c0f\u4e8e 1\uff01"}, { ER_INVALID_DRIVER_NAME, "\u6307\u5b9a\u4e86\u65e0\u6548\u7684\u9a71\u52a8\u7a0b\u5e8f\u540d\u79f0\uff01"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "\u7a0b\u5e8f\u5458\u7684\u9519\u8bef\uff01\u8868\u8fbe\u5f0f\u6ca1\u6709 ElemTemplateElement \u7236\u4ee3\uff01"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "\u7a0b\u5e8f\u5458\u5728 RedundentExprEliminator \u4e2d\u7684\u65ad\u8a00\uff1a{0}"}, { ER_NOT_ALLOWED_IN_POSITION, "\u6837\u5f0f\u8868\u7684\u6b64\u4f4d\u7f6e\u4e2d\u4e0d\u5141\u8bb8\u6709 {0}\uff01"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "\u6837\u5f0f\u8868\u7684\u6b64\u4f4d\u7f6e\u4e2d\u4e0d\u5141\u8bb8\u6709\u975e\u7a7a\u683c\u7684\u6587\u672c\uff01"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "\u7528\u4e8e CHAR \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5\u3002\u7c7b\u578b CHAR \u7684\u5c5e\u6027\u5fc5\u987b\u53ea\u6709 1 \u4e2a\u5b57\u7b26\uff01"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "\u7528\u4e8e QNAME \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "\u7528\u4e8e ENUM \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5\u3002\u6709\u6548\u7684\u503c\u662f\uff1a{2}\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "\u7528\u4e8e NMTOKEN \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "\u7528\u4e8e NCNAME \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "\u7528\u4e8e boolean \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "\u7528\u4e8e number \u5c5e\u6027 {0} \u7684\u503c {1} \u975e\u6cd5"}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "\u5339\u914d\u6a21\u5f0f\u4e2d {0} \u7684\u81ea\u53d8\u91cf\u5fc5\u987b\u662f\u6587\u5b57\u3002"}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "\u5168\u5c40\u53d8\u91cf\u7684\u58f0\u660e\u91cd\u590d\u3002"}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "\u53d8\u91cf\u58f0\u660e\u91cd\u590d\u3002"}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template \u5fc5\u987b\u6709\u4e00\u4e2a name \u6216 match \u5c5e\u6027\uff08\u6216\u4e24\u8005\u517c\u6709\uff09"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "exclude-result-prefixes \u4e2d\u7684\u524d\u7f00\u65e0\u6548\uff1a{0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "\u540d\u4e3a {0} \u7684\u5c5e\u6027\u96c6\u4e0d\u5b58\u5728"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "\u540d\u4e3a {0} \u7684\u51fd\u6570\u4e0d\u5b58\u5728"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "{0} \u5143\u7d20\u4e0d\u5f97\u540c\u65f6\u5177\u6709\u5185\u5bb9\u548c select \u5c5e\u6027\u3002"}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "\u53c2\u6570 {0} \u7684\u503c\u5fc5\u987b\u4e3a\u6709\u6548\u7684 Java \u5bf9\u8c61"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "xsl:namespace-alias \u5143\u7d20\u7684 result-prefix \u5c5e\u6027\u542b\u6709\u201c#default\u201d\u503c\uff0c\u4f46\u5728\u8be5\u5143\u7d20\u7684\u4f5c\u7528\u57df\u4e2d\u6ca1\u6709\u7f3a\u7701\u540d\u79f0\u7a7a\u95f4\u7684\u58f0\u660e\u3002"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "xsl:namespace-alias \u5143\u7d20\u7684 result-prefix \u5c5e\u6027\u542b\u6709\u201c{0}\u201d\u503c\uff0c\u4f46\u662f\u5728\u8be5\u5143\u7d20\u7684\u4f5c\u7528\u57df\u4e2d\u6ca1\u6709\u524d\u7f00\u201c{0}\u201d\u7684\u540d\u79f0\u7a7a\u95f4\u58f0\u660e\u3002"}, { ER_SET_FEATURE_NULL_NAME, "\u5728 TransformerFactory.setFeature(String name, boolean value) \u4e2d\u7279\u5f81\u540d\u4e0d\u80fd\u4e3a\u7a7a\u3002"}, { ER_GET_FEATURE_NULL_NAME, "\u5728 TransformerFactory.getFeature(String name) \u4e2d\u7279\u5f81\u540d\u4e0d\u80fd\u4e3a\u7a7a\u3002"}, { ER_UNSUPPORTED_FEATURE, "\u65e0\u6cd5\u5bf9\u6b64 TransformerFactory \u8bbe\u7f6e\u7279\u5f81\u201c{0}\u201d\u3002"}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "\u5f53\u5b89\u5168\u5904\u7406\u529f\u80fd\u8bbe\u7f6e\u4e3a true \u65f6\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6269\u5c55\u5143\u7d20\u201c{0}\u201d\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "\u65e0\u6cd5\u4e3a\u7a7a\u540d\u79f0\u7a7a\u95f4 uri \u83b7\u53d6\u524d\u7f00\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "\u65e0\u6cd5\u4e3a\u7a7a\u524d\u7f00\u83b7\u53d6\u540d\u79f0\u7a7a\u95f4 uri\u3002"}, { ER_XPATH_RESOLVER_NULL_QNAME, "\u51fd\u6570\u540d\u4e0d\u80fd\u4e3a\u7a7a\u3002"}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "\u6570\u91cf\u4e0d\u80fd\u4e3a\u8d1f\u3002"}, // Warnings... { WG_FOUND_CURLYBRACE, "\u627e\u5230\u201c}\u201d\uff0c\u4f46\u6ca1\u6709\u6253\u5f00\u5c5e\u6027\u6a21\u677f\uff01"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "\u8b66\u544a\uff1acount \u5c5e\u6027\u4e0e xsl:number \u4e2d\u7684\u4e0a\u7ea7\u4e0d\u5339\u914d\uff01\u76ee\u6807 = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "\u65e7\u8bed\u6cd5\uff1a\u201cexpr\u201d\u5c5e\u6027\u7684\u540d\u79f0\u5df2\u7ecf\u66f4\u6539\u4e3a\u201cselect\u201d\u3002"}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan \u5728 format-number \u51fd\u6570\u4e2d\u5c1a\u672a\u5904\u7406\u8bed\u8a00\u73af\u5883\u540d\u3002"}, { WG_LOCALE_NOT_FOUND, "\u8b66\u544a\uff1a\u627e\u4e0d\u5230 xml:lang={0} \u7684\u8bed\u8a00\u73af\u5883"}, { WG_CANNOT_MAKE_URL_FROM, "\u65e0\u6cd5\u4ece {0} \u751f\u6210 URL"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "\u65e0\u6cd5\u88c5\u5165\u8bf7\u6c42\u7684\u6587\u6863\uff1a{0}"}, { WG_CANNOT_FIND_COLLATOR, "\u627e\u4e0d\u5230 >>>>>> Xalan \u7248\u672c"}, { "version2", "<<<<<<<"}, { "yes", "\u662f"}, { "line", "\u884c\u53f7"}, { "column","\u5217\u53f7"}, { "xsldone", "XSLProcessor\uff1a\u5b8c\u6210"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J \u547d\u4ee4\u884c Process \u7c7b\u9009\u9879\uff1a"}, { "xslProc_option", "Xalan-J \u547d\u4ee4\u884c Process \u7c7b\u9009\u9879\uff1a"}, { "xslProc_invalid_xsltc_option", "\u5728 XSLTC \u65b9\u5f0f\u4e2d\uff0c\u4e0d\u652f\u6301\u9009\u9879 {0}\u3002"}, { "xslProc_invalid_xalan_option", "\u9009\u9879 {0} \u53ea\u80fd\u4e0e -XSLTC \u4e00\u8d77\u4f7f\u7528\u3002"}, { "xslProc_no_input", "\u9519\u8bef\uff1a\u6ca1\u6709\u6307\u5b9a\u6837\u5f0f\u8868\u6216\u8f93\u5165 xml\u3002\u4e0d\u5e26\u4efb\u4f55\u9009\u9879\u8fd0\u884c\u6b64\u547d\u4ee4\uff0c\u4ee5\u4e86\u89e3\u4f7f\u7528\u8bf4\u660e\u3002"}, { "xslProc_common_options", "\uff0d \u5e38\u7528\u9009\u9879 \uff0d"}, { "xslProc_xalan_options", "\u2015 Xalan \u9009\u9879 \u2015"}, { "xslProc_xsltc_options", "\u2015 XSLTC \u9009\u9879 \u2015"}, { "xslProc_return_to_continue", "\uff08\u8bf7\u6309 \u952e\u7ee7\u7eed\uff09"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC \uff08\u4f7f\u7528 XSLTC \u8f6c\u6362\uff09]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", "[-XSL XSLTransformationURL]"}, { "optionOUT", "[-OUT outputFileName]"}, { "optionLXCIN", "[-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", "[-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER fully qualified class name of parser liaison]"}, { "optionE", "[-E \uff08\u4e0d\u8981\u5c55\u5f00\u5b9e\u4f53\u5f15\u7528\uff09]"}, { "optionV", "[-E \uff08\u4e0d\u8981\u5c55\u5f00\u5b9e\u4f53\u5f15\u7528\uff09]"}, { "optionQC", "[-QC \uff08\u9759\u9ed8\u6a21\u5f0f\u51b2\u7a81\u8b66\u544a\uff09]"}, { "optionQ", "[-Q \uff08\u9759\u9ed8\u65b9\u5f0f\uff09]"}, { "optionLF", "[-LF \uff08\u4ec5\u5728\u8f93\u51fa\u65f6\u4f7f\u7528\u6362\u884c {\u7f3a\u7701\u503c\u662f CR/LF}\uff09]"}, { "optionCR", "[-CR \uff08\u4ec5\u5728\u8f93\u51fa\u65f6\u4f7f\u7528\u56de\u8f66\u7b26 {\u7f3a\u7701\u503c\u662f CR/LF}\uff09]"}, { "optionESCAPE", "[-ESCAPE \uff08\u8bbe\u7f6e\u8f6c\u4e49\u5b57\u7b26 {\u7f3a\u7701\u503c\u662f <>&\"\'\\r\\n}\uff09]"}, { "optionINDENT", "[-INDENT \uff08\u63a7\u5236\u7f29\u8fdb\u591a\u5c11\u7a7a\u683c {\u7f3a\u7701\u503c\u662f 0}\uff09]"}, { "optionTT", "[-TT \uff08\u5728\u6a21\u677f\u88ab\u8c03\u7528\u65f6\u8ddf\u8e2a\u6a21\u677f\u3002\uff09]"}, { "optionTG", "[-TG \uff08\u8ddf\u8e2a\u6bcf\u4e00\u4e2a\u751f\u6210\u4e8b\u4ef6\u3002\uff09]"}, { "optionTS", "[-TS \uff08\u8ddf\u8e2a\u6bcf\u4e00\u4e2a\u9009\u62e9\u4e8b\u4ef6\u3002\uff09]"}, { "optionTTC", "[-TTC \uff08\u5728\u5b50\u6a21\u677f\u88ab\u5904\u7406\u65f6\u5bf9\u5176\u8fdb\u884c\u8ddf\u8e2a\u3002\uff09]"}, { "optionTCLASS", "[-TCLASS \uff08\u8ddf\u8e2a\u6269\u5c55\u7684 TraceListener \u7c7b\u3002\uff09]"}, { "optionVALIDATE", "[-VALIDATE \uff08\u8bbe\u7f6e\u662f\u5426\u8fdb\u884c\u9a8c\u8bc1\u3002\u7f3a\u7701\u65f6\u9a8c\u8bc1\u662f\u5173\u95ed\u7684\u3002\uff09]"}, { "optionEDUMP", "[-EDUMP {\u53ef\u9009\u6587\u4ef6\u540d} \uff08\u53d1\u751f\u9519\u8bef\u65f6\u5806\u6808\u8f6c\u50a8\u3002\uff09]"}, { "optionXML", "[-XML \uff08\u4f7f\u7528 XML \u683c\u5f0f\u5316\u7a0b\u5e8f\u5e76\u6dfb\u52a0 XML \u5934\u3002\uff09]"}, { "optionTEXT", "[-TEXT \uff08\u4f7f\u7528\u7b80\u5355\u6587\u672c\u683c\u5f0f\u5316\u7a0b\u5e8f\u3002\uff09]"}, { "optionHTML", "[-HTML \uff08\u4f7f\u7528 HTML \u683c\u5f0f\u5316\u7a0b\u5e8f\uff09]"}, { "optionPARAM", "[-PARAM name expression \uff08\u8bbe\u7f6e\u6837\u8bc6\u8868\u53c2\u6570\uff09]"}, { "noParsermsg1", "XSL \u5904\u7406\u4e0d\u6210\u529f\u3002"}, { "noParsermsg2", "** \u627e\u4e0d\u5230\u89e3\u6790\u5668 **"}, { "noParsermsg3", "\u8bf7\u68c0\u67e5\u60a8\u7684\u7c7b\u8def\u5f84\u3002"}, { "noParsermsg4", "\u5982\u679c\u6ca1\u6709 IBM \u7684 XML Parser for Java\uff0c\u60a8\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u4f4d\u7f6e\u4e0b\u8f7d\u5b83\uff1a"}, { "noParsermsg5", "IBM \u7684 AlphaWorks\uff1ahttp://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", "[-URIRESOLVER full class name \uff08\u4f7f\u7528 URIResolver \u89e3\u6790 URI\uff09]"}, { "optionENTITYRESOLVER", "[-ENTITYRESOLVER full class name \uff08\u4f7f\u7528 EntityResolver \u89e3\u6790\u5b9e\u4f53\uff09]"}, { "optionCONTENTHANDLER", "[-CONTENTHANDLER full class name \uff08\u4f7f\u7528 ContentHandler \u4e32\u884c\u5316\u8f93\u51fa\uff09]"}, { "optionLINENUMBERS", "[-L use line numbers for source document]"}, { "optionSECUREPROCESSING", " [-SECURE \uff08\u5c06\u5b89\u5168\u5904\u7406\u529f\u80fd\u8bbe\u7f6e\u4e3a true\u3002\uff09]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType \uff08\u4f7f\u7528 media \u5c5e\u6027\u67e5\u627e\u4e0e\u6587\u6863\u5173\u8054\u7684\u6837\u5f0f\u8868\u3002\uff09]"}, { "optionFLAVOR", " [-FLAVOR flavorName \uff08\u663e\u5f0f\u4f7f\u7528 s2s=SAX \u6216 d2d=DOM \u8fdb\u884c\u8f6c\u6362\u3002\uff09]"}, // Added by sboag/scurcuru; experimental { "optionDIAG", "[-DIAG \uff08\u6253\u5370\u5168\u90e8\u6beb\u79d2\u8f6c\u6362\u6807\u8bb0\u3002\uff09]"}, { "optionINCREMENTAL", " [-INCREMENTAL \uff08\u901a\u8fc7\u5c06 http://xml.apache.org/xalan/features/incremental \u8bbe\u7f6e\u4e3a true \u8bf7\u6c42\u589e\u91cf DTM \u6784\u9020\u3002\uff09]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE \uff08\u901a\u8fc7\u5c06 http://xml.apache.org/xalan/features/optimize \u8bbe\u7f6e\u4e3a false \u8bf7\u6c42\u65e0\u6837\u5f0f\u8868\u7684\u4f18\u5316\u5904\u7406\u3002\uff09]"}, { "optionRL", " [-RL recursionlimit \uff08\u65ad\u8a00\u6837\u5f0f\u8868\u9012\u5f52\u6df1\u5ea6\u7684\u6570\u5b57\u6781\u9650\u3002\uff09]"}, { "optionXO", "[-XO [transletName] \uff08\u65ad\u8a00\u751f\u6210\u7684 translet \u7684\u540d\u79f0\uff09]"}, { "optionXD", "[-XD destinationDirectory \uff08\u6307\u5b9a translet \u7684\u76ee\u6807\u76ee\u5f55\uff09]"}, { "optionXJ", "[-XJ jarfile \uff08\u5c06 translet \u7c7b\u6253\u5305\u6210\u540d\u79f0\u4e3a \u7684 jar \u6587\u4ef6\uff09]"}, { "optionXP", "[-XP package \uff08\u6307\u51fa\u6240\u6709\u751f\u6210\u7684 translet \u7c7b\u7684\u8f6f\u4ef6\u5305\u540d\u79f0\u524d\u7f00\uff09]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN \uff08\u542f\u7528\u6a21\u677f\u4ee3\u7801\u5d4c\u5165\uff09]" }, { "optionXX", "[-XX \uff08\u6253\u5f00\u9644\u52a0\u8c03\u8bd5\u6d88\u606f\u8f93\u51fa\uff09]"}, { "optionXT" , "[-XT \uff08\u53ef\u80fd\u7684\u8bdd\u4f7f\u7528 translet \u8fdb\u884c\u8f6c\u6362\uff09]"}, { "diagTiming","--------- {0} \u901a\u8fc7 {1} \u7684\u8f6c\u6362\u8017\u65f6 {2} \u6beb\u79d2" }, { "recursionTooDeep","\u6a21\u677f\u5d4c\u5957\u592a\u6df1\u3002\u5d4c\u5957 = {0}\uff0c\u6a21\u677f {1} {2}" }, { "nameIs", "\u540d\u79f0\u4e3a" }, { "matchPatternIs", "\u5339\u914d\u6a21\u5f0f\u4e3a" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#\u9519\u8bef"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "\u9519\u8bef\uff1a"; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "\u8b66\u544a\uff1a"; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("zh", "CN")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_sk.java0000644000175000017500000021533510721374031025041 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_sk.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_sk extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Chyba: Nie je mo\u017en\u00e9 ma\u0165 vo v\u00fdraze '{'"}, { ER_ILLEGAL_ATTRIBUTE , "{0} m\u00e1 neplatn\u00fd atrib\u00fat: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode je v xsl:apply-imports nulov\u00fd!"}, {ER_CANNOT_ADD, "Nem\u00f4\u017ee prida\u0165 {0} do {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode je nulov\u00fd v handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "{0} mus\u00ed ma\u0165 atrib\u00fat n\u00e1zvu."}, {ER_TEMPLATE_NOT_FOUND, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 vzor s n\u00e1zvom: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Nebolo mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 n\u00e1zov AVT v xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} vy\u017eaduje atrib\u00fat: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} mus\u00ed ma\u0165 atrib\u00fat ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Nespr\u00e1vna hodnota na atrib\u00fate \u00farovne: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "n\u00e1zov processing-instruction nem\u00f4\u017ee by\u0165 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "n\u00e1zov in\u0161trukcie spracovania mus\u00ed by\u0165 platn\u00fdm NCName: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} mus\u00ed ma\u0165 porovn\u00e1vac\u00ed atrib\u00fat, ak m\u00e1 re\u017eim."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} vy\u017eaduje bu\u010f n\u00e1zov, alebo porovn\u00e1vac\u00ed atrib\u00fat."}, {ER_CANT_RESOLVE_NSPREFIX, "Nie je mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 predponu n\u00e1zvov\u00e9ho priestoru: {0}"}, { ER_ILLEGAL_VALUE, "xml:space m\u00e1 neplatn\u00fa hodnotu: {0}"}, { ER_NO_OWNERDOC, "Potomok uzla nem\u00e1 dokument vlastn\u00edka!"}, { ER_ELEMTEMPLATEELEM_ERR, "Chyba ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "Pokus o pridanie nulov\u00e9ho potomka!"}, { ER_NEED_SELECT_ATTRIB, "{0} vy\u017eaduje atrib\u00fat v\u00fdberu."}, { ER_NEED_TEST_ATTRIB , "xsl:when mus\u00ed ma\u0165 atrib\u00fat 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param mus\u00ed ma\u0165 atrib\u00fat 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "kontext nem\u00e1 dokument vlastn\u00edka!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Nebolo mo\u017en\u00e9 vytvori\u0165 vz\u0165ah XML TransformerFactory: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Proces bol ne\u00faspe\u0161n\u00fd."}, { ER_NOT_SUCCESSFUL, "Xalan: bol ne\u00faspe\u0161n\u00fd."}, { ER_ENCODING_NOT_SUPPORTED, "K\u00f3dovanie nie je podporovan\u00e9: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Nebolo mo\u017en\u00e9 vytvori\u0165 TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key vy\u017eaduje atrib\u00fat 'name'!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key vy\u017eaduje atrib\u00fat 'match'!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key vy\u017eaduje atrib\u00fat 'use'!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} vy\u017eaduje atrib\u00fat ''elements''!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} ch\u00fdba atrib\u00fat ''prefix''"}, { ER_BAD_STYLESHEET_URL, "URL \u0161t\u00fdlu dokumentu je nespr\u00e1vna: {0}"}, { ER_FILE_NOT_FOUND, "S\u00fabor \u0161t\u00fdlu dokumentu nebol n\u00e1jden\u00fd: {0}"}, { ER_IOEXCEPTION, "V s\u00fabore \u0161t\u00fdlu dokumentu bola vstupno-v\u00fdstupn\u00e1 v\u00fdnimka: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Nebolo mo\u017en\u00e9 n\u00e1js\u0165 atrib\u00fat href pre {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} priamo, alebo nepriamo, obsahuje s\u00e1m seba!"}, { ER_PROCESSINCLUDE_ERROR, "chyba StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} ch\u00fdba atrib\u00fat ''lang''"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) chybne umiestnen\u00fd {0} element?? Ch\u00fdba kontajnerov\u00fd prvok ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "M\u00f4\u017ee prev\u00e1dza\u0165 v\u00fdstup len do Element, DocumentFragment, Document, alebo PrintWriter."}, { ER_PROCESS_ERROR, "chyba StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Chyba UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Chyba! Nena\u0161lo sa vyjadrenie v\u00fdberu xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Nie je mo\u017en\u00e9 serializova\u0165 XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "Nebol zadan\u00fd vstup \u0161t\u00fdl dokumentu!"}, { ER_FAILED_PROCESS_STYLESHEET, "Zlyhalo spracovanie \u0161t\u00fdlu dokumentu!"}, { ER_COULDNT_PARSE_DOC, "Nebolo mo\u017en\u00e9 analyzova\u0165 dokument {0}!"}, { ER_COULDNT_FIND_FRAGMENT, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 fragment: {0}"}, { ER_NODE_NOT_ELEMENT, "Uzol, na ktor\u00fd ukazuje identifik\u00e1tor fragmentu nebol elementom: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each mus\u00ed ma\u0165 bu\u010f porovn\u00e1vac\u00ed atrib\u00fat, alebo atrib\u00fat n\u00e1zvu"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "vzory musia ma\u0165 bu\u010f porovn\u00e1vacie atrib\u00faty, alebo atrib\u00faty n\u00e1zvov"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\u017diadna k\u00f3pia fragmentu dokumentu!"}, { ER_CANT_CREATE_ITEM, "Nie je mo\u017en\u00e9 vytvori\u0165 polo\u017eku vo v\u00fdsledkovom strome: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space v zdrojovom XML m\u00e1 neplatn\u00fa hodnotu: {0}"}, { ER_NO_XSLKEY_DECLARATION, "Neexistuje \u017eiadna deklar\u00e1cia xsl:key pre {0}!"}, { ER_CANT_CREATE_URL, "Chyba! Nie je mo\u017en\u00e9 vytvori\u0165 url pre: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions nie je podporovan\u00e9"}, { ER_PROCESSOR_ERROR, "Chyba XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} nie je povolen\u00fd vn\u00fatri \u0161t\u00fdlu dokumentu!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns u\u017e viac nie je podporovan\u00fd! Pou\u017eite namiesto toho xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space u\u017e viac nie je podporovan\u00fd! Pou\u017eite namiesto toho xsl:strip-space alebo xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result u\u017e viac nie je podporovan\u00fd! Pou\u017eite namiesto toho xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} m\u00e1 neplatn\u00fd atrib\u00fat: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Nezn\u00e1my element XSL: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort mo\u017eno pou\u017ei\u0165 len s xsl:apply-templates alebo xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when na nespr\u00e1vnom mieste!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when nem\u00e1 ako rodi\u010da xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise na nespr\u00e1vnom mieste!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise nem\u00e1 ako rodi\u010da xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} nie je povolen\u00fd vn\u00fatri vzoru!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} prefix roz\u0161\u00edren\u00e9ho n\u00e1zvov\u00e9ho priestoru {1} nie je zn\u00e1my"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Importy sa m\u00f4\u017eu vyskytn\u00fa\u0165 len ako prv\u00e9 \u010dasti \u0161t\u00fdlu dokumentu!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} priamo, alebo nepriami, importuje s\u00e1m seba!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space m\u00e1 neplatn\u00fa hodnotu: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet nebol \u00faspe\u0161n\u00fd!"}, { ER_SAX_EXCEPTION, "V\u00fdnimka SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Funkcia nie je podporovan\u00e1!"}, { ER_XSLT_ERROR, "Chyba XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "znak meny nie je povolen\u00fd vo re\u0165azci form\u00e1tu vzoru"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Funckia dokumentu nie je podporovan\u00e1 v \u0161t\u00fdle dokumentu DOM!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Nie je mo\u017en\u00e9 ur\u010di\u0165 prefix bezprefixov\u00e9ho rozklada\u010da!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Roz\u0161\u00edrenie presmerovania: Nedal sa z\u00edska\u0165 n\u00e1zov s\u00faboru - s\u00fabor alebo atrib\u00fat v\u00fdberu mus\u00ed vr\u00e1ti\u0165 platn\u00fd re\u0165azec."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Nie je mo\u017en\u00e9 vytvori\u0165 FormatterListener v roz\u0161\u00edren\u00ed Redirect!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Predpona v exclude-result-prefixes je neplatn\u00e1: {0}"}, { ER_MISSING_NS_URI, "Ch\u00fdbaj\u00faci n\u00e1zvov\u00fd priestor URI pre zadan\u00fd prefix"}, { ER_MISSING_ARG_FOR_OPTION, "Ch\u00fdbaj\u00faci argument pre vo\u013ebu: {0}"}, { ER_INVALID_OPTION, "Neplatn\u00e1 vo\u013eba. {0}"}, { ER_MALFORMED_FORMAT_STRING, "Znetvoren\u00fd re\u0165azec form\u00e1tu: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet si vy\u017eaduje atrib\u00fat 'version'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Atrib\u00fat: {0} m\u00e1 neplatn\u00fa hodnotu: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose vy\u017eaduje xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports nie je povolen\u00fd v xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Nem\u00f4\u017ee pou\u017ei\u0165 DTMLiaison pre v\u00fdstupn\u00fd uzol DOM... namiesto neho odo\u0161lite org.apache.xpath.DOM2Helper!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Nem\u00f4\u017ee pou\u017ei\u0165 DTMLiaison pre vstupn\u00fd uzol DOM... namiesto neho odo\u0161lite org.apache.xpath.DOM2Helper!"}, { ER_CALL_TO_EXT_FAILED, "Volanie elementu roz\u0161\u00edrenia zlyhalo: {0}"}, { ER_PREFIX_MUST_RESOLVE, "Predpona sa mus\u00ed rozl\u00ed\u0161i\u0165 do n\u00e1zvov\u00e9ho priestoru: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Bolo zisten\u00e9 neplatn\u00e9 nahradenie UTF-16: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} pou\u017eil s\u00e1m seba, \u010do sp\u00f4sob\u00ed nekone\u010dn\u00fa slu\u010dku."}, { ER_CANNOT_MIX_XERCESDOM, "Nie je mo\u017en\u00e9 mie\u0161a\u0165 vstup in\u00fd, ne\u017e Xerces-DOM s v\u00fdstupom Xerces-DOM!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "V ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Na\u0161iel sa viac ne\u017e jeden vzor s n\u00e1zvom: {0}"}, { ER_INVALID_KEY_CALL, "Neplatn\u00e9 volanie funkcie: rekurz\u00edvne volanie k\u013e\u00fa\u010da() nie je povolen\u00e9"}, { ER_REFERENCING_ITSELF, "Premenn\u00e1 {0} sa priamo, alebo nepriamo, odkazuje sama na seba!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "Vstupn\u00fd uzol nem\u00f4\u017ee by\u0165 pre DOMSource pre newTemplates nulov\u00fd!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "S\u00fabor triedy nebol pre vo\u013ebu {0} n\u00e1jden\u00fd"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Po\u017eadovan\u00fd element sa nena\u0161iel: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream nem\u00f4\u017ee by\u0165 nulov\u00fd"}, { ER_URI_CANNOT_BE_NULL, "URI nem\u00f4\u017ee by\u0165 nulov\u00fd"}, { ER_FILE_CANNOT_BE_NULL, "S\u00fabor nem\u00f4\u017ee by\u0165 nulov\u00fd"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource nem\u00f4\u017ee by\u0165 nulov\u00fd"}, { ER_CANNOT_INIT_BSFMGR, "Nebolo mo\u017en\u00e9 inicializova\u0165 Spr\u00e1vcu BSF"}, { ER_CANNOT_CMPL_EXTENSN, "Nebolo mo\u017en\u00e9 skompilova\u0165 pr\u00edponu"}, { ER_CANNOT_CREATE_EXTENSN, "Nebolo mo\u017en\u00e9 vytvori\u0165 roz\u0161\u00edrenie: {0} z d\u00f4vodu: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Volanie met\u00f3dy met\u00f3dou in\u0161tancie {0} vy\u017eaduje ako prv\u00fd argument In\u0161tanciu objektu"}, { ER_INVALID_ELEMENT_NAME, "Bol zadan\u00fd neplatn\u00fd n\u00e1zov s\u00fa\u010dasti {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "Met\u00f3da n\u00e1zvu s\u00fa\u010dasti mus\u00ed by\u0165 statick\u00e1 {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Roz\u0161\u00edrenie funkcie {0} : {1} je nezn\u00e1me"}, { ER_MORE_MATCH_CONSTRUCTOR, "Bola n\u00e1jden\u00e1 viac ne\u017e jedna najlep\u0161ia zhoda s kon\u0161truktorom pre {0}"}, { ER_MORE_MATCH_METHOD, "Bola n\u00e1jden\u00e1 viac ne\u017e jedna najlep\u0161ia zhoda pre met\u00f3du {0}"}, { ER_MORE_MATCH_ELEMENT, "Bola n\u00e1jden\u00e1 viac ne\u017e jedna najlep\u0161ia zhoda pre met\u00f3du s\u00fa\u010dasti {0}"}, { ER_INVALID_CONTEXT_PASSED, "Bolo odoslan\u00fd neplatn\u00fd kontext na zhodnotenie {0}"}, { ER_POOL_EXISTS, "Oblas\u0165 u\u017e existuje"}, { ER_NO_DRIVER_NAME, "Nebol zadan\u00fd \u017eiaden n\u00e1zov ovl\u00e1da\u010da"}, { ER_NO_URL, "Nebola zadan\u00e1 \u017eiadna URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "Ve\u013ekos\u0165 oblasti je men\u0161ia ne\u017e jeden!"}, { ER_INVALID_DRIVER, "Bol zadan\u00fd neplatn\u00fd n\u00e1zov ovl\u00e1da\u010da!"}, { ER_NO_STYLESHEETROOT, "Nebol n\u00e1jden\u00fd kore\u0148 \u0161t\u00fdlu dokumentu!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Neplatn\u00e1 hodnota pre xml:space"}, { ER_PROCESSFROMNODE_FAILED, "zlyhal processFromNode"}, { ER_RESOURCE_COULD_NOT_LOAD, "Prostriedok [ {0} ] sa nedal na\u010d\u00edta\u0165: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Ve\u013ekos\u0165 vyrovn\u00e1vacej pam\u00e4te <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Nezn\u00e1ma chyba po\u010das volania pr\u00edpony"}, { ER_NO_NAMESPACE_DECL, "Prefix {0} nem\u00e1 zodpovedaj\u00facu deklar\u00e1ciu n\u00e1zvov\u00e9ho priestoru"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Obsah elementu nie je povolen\u00fd pre lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Ukon\u010denie riaden\u00e9 \u0161t\u00fdlom dokumentu"}, { ER_ONE_OR_TWO, "1, alebo 2"}, { ER_TWO_OR_THREE, "2, alebo 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Nebolo mo\u017en\u00e9 zavies\u0165 {0} (check CLASSPATH), teraz s\u00fa po\u017eit\u00e9 len predvolen\u00e9 \u0161tandardy"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Nie je mo\u017en\u00e9 inicializova\u0165 predvolen\u00e9 vzory"}, { ER_RESULT_NULL, "V\u00fdsledok by nemal by\u0165 nulov\u00fd"}, { ER_RESULT_COULD_NOT_BE_SET, "V\u00fdsledkom nem\u00f4\u017ee by\u0165 mno\u017eina"}, { ER_NO_OUTPUT_SPECIFIED, "Nie je zadan\u00fd \u017eiaden v\u00fdstup"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Ned\u00e1 sa transformova\u0165 na v\u00fdsledok typu {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Ned\u00e1 sa transformova\u0165 zdroj typu {0}"}, { ER_NULL_CONTENT_HANDLER, "Nulov\u00fd manipula\u010dn\u00fd program obsahu"}, { ER_NULL_ERROR_HANDLER, "Nulov\u00fd chybov\u00fd manipula\u010dn\u00fd program"}, { ER_CANNOT_CALL_PARSE, "nem\u00f4\u017ee by\u0165 volan\u00e9 analyzovanie, ak nebol nastaven\u00fd ContentHandler"}, { ER_NO_PARENT_FOR_FILTER, "\u017diaden rodi\u010d pre filter"}, { ER_NO_STYLESHEET_IN_MEDIA, "Nena\u0161iel sa \u017eiadny stylesheet v: {0}, m\u00e9dium= {1}"}, { ER_NO_STYLESHEET_PI, "Nena\u0161iel sa \u017eiadny xml-stylesheet PI v: {0}"}, { ER_NOT_SUPPORTED, "Nie je podporovan\u00e9: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Hodnota vlastnosti {0} by mala by\u0165 boolovsk\u00e1 in\u0161tancia"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Nie je mo\u017en\u00e9 dosiahnu\u0165 extern\u00fd skript na {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "Prostriedok [ {0} ] nemohol by\u0165 n\u00e1jden\u00fd.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "V\u00fdstupn\u00e9 vlastn\u00edctvo nebolo rozoznan\u00e9: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Zlyhalo vytv\u00e1ranie in\u0161tancie ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Hodnota pre {0} by mala obsahova\u0165 analyzovate\u013en\u00e9 \u010d\u00edslo"}, { ER_VALUE_SHOULD_EQUAL, "Hodnota {0} by sa mala rovna\u0165 \u00e1no, alebo nie"}, { ER_FAILED_CALLING_METHOD, "Zlyhalo volanie met\u00f3dy {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "Zlyhalo vytv\u00e1ranie in\u0161tancie ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "V tomto bode dokumentu nie s\u00fa znaky povolen\u00e9"}, { ER_ATTR_NOT_ALLOWED, "Atrib\u00fat \"{0}\" nie je povolen\u00fd na s\u00fa\u010dasti {1}!"}, { ER_BAD_VALUE, "{0} zl\u00e1 hodnota {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "Hodnota atrib\u00fatu {0} nebola n\u00e1jden\u00e1 "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Hodnota atrib\u00fatu {0} nebola rozpoznan\u00e1 "}, { ER_NULL_URI_NAMESPACE, "Pokus o vytvorenie prefixu n\u00e1zvov\u00e9ho priestoru s nulov\u00fdm URI"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Pokus o form\u00e1tovanie \u010d\u00edsla v\u00e4\u010d\u0161ieho, ne\u017e je najdlh\u0161\u00ed dlh\u00fd celo\u010d\u00edseln\u00fd typ"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Nie je mo\u017en\u00e9 n\u00e1js\u0165 triedu ovl\u00e1da\u010da SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "Trieda ovl\u00e1da\u010da SAX1 {0} bola n\u00e1jden\u00e1, ale nem\u00f4\u017ee by\u0165 zaveden\u00e1"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "Trieda ovl\u00e1da\u010da SAX1 {0} bola zaveden\u00e1, ale nem\u00f4\u017ee by\u0165 dolo\u017een\u00e1 pr\u00edkladom"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "Trieda ovl\u00e1da\u010da SAX1 {0} neimplementuje org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Syst\u00e9mov\u00e1 vlastnos\u0165 org.xml.sax.parser nie je zadan\u00e1"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Argument syntaktick\u00e9ho analyz\u00e1tora nesmie by\u0165 nulov\u00fd"}, { ER_FEATURE, "Vlastnos\u0165: {0}"}, { ER_PROPERTY, "Vlastn\u00edctvo: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Rozklada\u010d nulov\u00fdch ent\u00edt"}, { ER_NULL_DTD_HANDLER, "Nulov\u00fd manipula\u010dn\u00fd program DTD"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Nie je zadan\u00fd \u017eiaden n\u00e1zov ovl\u00e1da\u010da!"}, { ER_NO_URL_SPECIFIED, "Nie je zadan\u00e1 \u017eiadna URL!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Ve\u013ekos\u0165 oblasti je men\u0161ia ne\u017e 1!"}, { ER_INVALID_DRIVER_NAME, "Je zadan\u00fd neplatn\u00fd n\u00e1zov ovl\u00e1da\u010da!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Chyba program\u00e1tora! V\u00fdraz nem\u00e1 rodi\u010da ElemTemplateElement!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Tvrdenie program\u00e1tora v RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0}nie je na tejto poz\u00edcii predlohy so \u0161t\u00fdlmi povolen\u00e9!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Text bez medzier nie je povolen\u00fd na tejto poz\u00edcii predlohy so \u0161t\u00fdlmi!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00fd pre atrib\u00fat CHAR: {0}. Atrib\u00fat typu CHAR mus\u00ed by\u0165 len 1 znak!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00e1 pre atrib\u00fat QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00e1 pre atrib\u00fat ENUM: {0}. Platn\u00e9 hodnoty s\u00fa: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00e1 pre atrib\u00fat NMTOKEN:{0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00e1 pre atrib\u00fat NCNAME: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00e1 pre boolovsk\u00fd atrib\u00fat: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Neplatn\u00e1 hodnota: {1} pou\u017e\u00edvan\u00e1 pre atrib\u00fat \u010d\u00edsla: {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argument pre {0} v zhodnom vzore mus\u00ed by\u0165 liter\u00e1lom."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Duplicitn\u00e1 deklar\u00e1cia glob\u00e1lnej premennej."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Duplicitn\u00e1 deklar\u00e1cia premennej."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template mus\u00ed ma\u0165 n\u00e1zov alebo atrib\u00fat zhody (alebo oboje)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Predpona v exclude-result-prefixes je neplatn\u00e1: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "pomenovan\u00e1 sada atrib\u00fatov {0} neexistuje"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "Funkcia s n\u00e1zvom {0} neexistuje."}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "Prvok {0} nesmie ma\u0165 aj atrib\u00fat content aj atrib\u00fat select."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "Hodnota parametra {0} mus\u00ed by\u0165 platn\u00fdm objektom jazyka Java."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Atrib\u00fat result-prefix prvku xsl:namespace-alias m\u00e1 hodnotu '#default', ale v rozsahu pre prvok neexistuje \u017eiadna deklar\u00e1cia \u0161tandardn\u00e9ho n\u00e1zvov\u00e9ho priestoru"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Atrib\u00fat result-prefix prvku xsl:namespace-alias m\u00e1 hodnotu ''{0}'', ale v rozsahu pre prvok neexistuje \u017eiadna deklar\u00e1cia n\u00e1zvov\u00e9ho priestoru pre predponu ''{0}''."}, { ER_SET_FEATURE_NULL_NAME, "V TransformerFactory.setFeature(N\u00e1zov re\u0165azca, boolovsk\u00e1 hodnota)nem\u00f4\u017ee ma\u0165 funkcia n\u00e1zov null."}, { ER_GET_FEATURE_NULL_NAME, "N\u00e1zov vlastnosti nem\u00f4\u017ee by\u0165 null v TransformerFactory.getFeature(N\u00e1zov re\u0165azca)."}, { ER_UNSUPPORTED_FEATURE, "V tomto TransformerFactory sa ned\u00e1 nastavi\u0165 vlastnos\u0165 ''{0}''."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "Pou\u017e\u00edvanie prvku roz\u0161\u00edrenia ''{0}'' nie je povolen\u00e9, ke\u010f je funkcia bezpe\u010dn\u00e9ho spracovania nastaven\u00e1 na hodnotu true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Ned\u00e1 sa z\u00edska\u0165 predpona pre null n\u00e1zvov\u00fd priestor uri."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Ned\u00e1 sa z\u00edska\u0165 n\u00e1zvov\u00fd priestor uri pre predponu null."}, { ER_XPATH_RESOLVER_NULL_QNAME, "N\u00e1zov funkcie nem\u00f4\u017ee by\u0165 null."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Arita nem\u00f4\u017ee by\u0165 z\u00e1porn\u00e1."}, // Warnings... { WG_FOUND_CURLYBRACE, "Bol n\u00e1jden\u00fd znak '}', ale nie otvoren\u00fd \u017eiaden vzor atrib\u00fatu!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Upozornenie: atrib\u00fat po\u010dtu sa nezhoduje s predchodcom v xsl:number! Cie\u013e = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Star\u00e1 syntax: N\u00e1zov atrib\u00fatu 'expr' bol zmenen\u00fd na 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan zatia\u013e nespracov\u00e1va n\u00e1zov umiestnenia vo funkcii format-number."}, { WG_LOCALE_NOT_FOUND, "Upozornenie: Nebolo mo\u017en\u00e9 n\u00e1js\u0165 lok\u00e1l pre xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nie je mo\u017en\u00e9 vytvori\u0165 URL z: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Nie je mo\u017en\u00e9 zavies\u0165 po\u017eadovan\u00fd doc: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Nebolo mo\u017en\u00e9 n\u00e1js\u0165 porovn\u00e1va\u010d pre >>>>>> Verzia Xalan "}, { "version2", "<<<<<<<"}, { "yes", "\u00e1no"}, { "line", "Riadok #"}, { "column","St\u013apec #"}, { "xsldone", "XSLProcessor: vykonan\u00e9"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Vo\u013eby triedy procesu pr\u00edkazov\u00e9ho riadka Xalan-J:"}, { "xslProc_option", "Vo\u013eby triedy Process pr\u00edkazov\u00e9ho riadka Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "Vo\u013eba {0} nie je podporovan\u00e1 v re\u017eime XSLTC."}, { "xslProc_invalid_xalan_option", "Vo\u013ebu {0} mo\u017eno pou\u017ei\u0165 len spolu s -XSLTC."}, { "xslProc_no_input", "Chyba: nie je uveden\u00fd \u017eiadny \u0161t\u00fdl dokumentu, ani vstupn\u00fd xml. Spustite tento pr\u00edkaz bez akejko\u013evek vo\u013eby pre in\u0161trukcie pou\u017eitia."}, { "xslProc_common_options", "-Be\u017en\u00e9 vo\u013eby-"}, { "xslProc_xalan_options", "-Vo\u013eby pre Xalan-"}, { "xslProc_xsltc_options", "-Vo\u013eby pre XSLTC-"}, { "xslProc_return_to_continue", "(stla\u010dte a pokra\u010dujte)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (pou\u017eite XSLTC na transform\u00e1ciu)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER plne kvalifikovan\u00fd n\u00e1zov triedy sprostredkovate\u013ea syntaktick\u00e9ho analyz\u00e1tora]"}, { "optionE", " [-E (Nerozvinie odkazy na entity)]"}, { "optionV", " [-E (Nerozvinie odkazy na entity)]"}, { "optionQC", " [-QC (Varovania pri konfliktoch Quiet Pattern)]"}, { "optionQ", " [-Q (Tich\u00fd re\u017eim)]"}, { "optionLF", " [-LF (Znaky pre posun riadka pou\u017ei\u0165 len vo v\u00fdstupe {default is CR/LF})]"}, { "optionCR", " [-CR (Znaky n\u00e1vratu voz\u00edka pou\u017ei\u0165 len vo v\u00fdstupe {default is CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Ktor\u00e9 znaky maj\u00fa ma\u0165 zmenen\u00fd v\u00fdznam {default is <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Riadi po\u010det medzier odsadenia {default is 0})]"}, { "optionTT", " [-TT (Sledovanie, ako s\u00fa volan\u00e9 vzory.)]"}, { "optionTG", " [-TG (Sledovanie udalost\u00ed ka\u017edej gener\u00e1cie.)]"}, { "optionTS", " [-TS (Sledovanie udalost\u00ed ka\u017ed\u00e9ho v\u00fdberu.)]"}, { "optionTTC", " [-TTC (Sledovanie ako s\u00fa vytv\u00e1ran\u00ed potomkovia vzorov.)]"}, { "optionTCLASS", " [-TCLASS (Trieda TraceListener pre pr\u00edpony sledovania.)]"}, { "optionVALIDATE", " [-VALIDATE (Ur\u010duje, \u010di m\u00e1 doch\u00e1dza\u0165 k overovaniu. Overovanie je \u0161tandardne vypnut\u00e9.)]"}, { "optionEDUMP", " [-EDUMP {optional filename} (Vytvori\u0165 v\u00fdpis z\u00e1sobn\u00edka pri chybe.)]"}, { "optionXML", " [-XML (Pou\u017eije form\u00e1tor XML a prid\u00e1 hlavi\u010dku XML.)]"}, { "optionTEXT", " [-TEXT (Jednoduch\u00fd textov\u00fd form\u00e1tor.)]"}, { "optionHTML", " [-HTML (Pou\u017eije form\u00e1tor HTML.)]"}, { "optionPARAM", " [-PARAM vyjadrenie n\u00e1zvu (nastav\u00ed parameter \u0161t\u00fdlu dokumentu)]"}, { "noParsermsg1", "Proces XSL nebol \u00faspe\u0161n\u00fd."}, { "noParsermsg2", "** Nebolo mo\u017en\u00e9 n\u00e1js\u0165 syntaktick\u00fd analyz\u00e1tor **"}, { "noParsermsg3", "Skontroluje, pros\u00edm, svoju classpath."}, { "noParsermsg4", "Ak nem\u00e1te Syntaktick\u00fd analyz\u00e1tor XML pre jazyk Java od firmy IBM, m\u00f4\u017eete si ho stiahnu\u0165 z"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER pln\u00fd n\u00e1zov triedy (URIResolver bude pou\u017eit\u00fd na ur\u010dovanie URI)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER pln\u00fd n\u00e1zov triedy (EntityResolver bude pou\u017eit\u00fd na ur\u010denie ent\u00edt)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER pln\u00fd n\u00e1zov triedy (ContentHandler bude pou\u017eit\u00fd na serializ\u00e1ciu v\u00fdstupu)]"}, { "optionLINENUMBERS", " [-L pou\u017eije \u010d\u00edsla riadkov pre zdrojov\u00fd dokument]"}, { "optionSECUREPROCESSING", " [-SECURE (nastav\u00ed funkciu bezpe\u010dn\u00e9ho spracovania na hodnotu true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (pou\u017ei\u0165 atrib\u00fat m\u00e9dia na n\u00e1jdenie \u0161t\u00fdlu h\u00e1rka, priraden\u00e9ho k dokumentu.)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (Explicitne pou\u017ei\u0165 s2s=SAX alebo d2d=DOM na vykonanie transform\u00e1cie.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Vytla\u010di\u0165 celkov\u00fd \u010das transform\u00e1cie v milisekund\u00e1ch.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (\u017eiados\u0165 o inkrement\u00e1lnu kon\u0161trukciu DTM nastaven\u00edm http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (po\u017eiadavka na nesprac\u00favanie optimaliz\u00e1cie defin\u00edcie \u0161t\u00fdlov nastaven\u00edm http://xml.apache.org/xalan/features/optimize na hodnotu false.)]"}, { "optionRL", " [-RL recursionlimit (nastavi\u0165 \u010d\u00edseln\u00fd limit pre h\u013abku rekurzie \u0161t\u00fdlov h\u00e1rkov.)]"}, { "optionXO", " [-XO [transletName] (prira\u010fuje n\u00e1zov ku generovan\u00e9mu transletu)]"}, { "optionXD", " [-XD destinationDirectory (uv\u00e1dza cie\u013eov\u00fd adres\u00e1r pre translet)]"}, { "optionXJ", " [-XJ jarfile (pakuje triedy transletu do s\u00faboru jar s n\u00e1zvom )]"}, { "optionXP", " [-XP package (uv\u00e1dza predponu n\u00e1zvu bal\u00edka pre v\u0161etky generovan\u00e9 triedy transletu)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (povo\u013euje zoradenie vzorov do riadka)]" }, { "optionXX", " [-XX (zap\u00edna \u010fal\u0161\u00ed v\u00fdstup spr\u00e1v ladenia)]"}, { "optionXT" , " [-XT (ak je to mo\u017en\u00e9, pou\u017eite translet na transform\u00e1ciu)]"}, { "diagTiming"," --------- Transform\u00e1cia z {0} cez {1} trvala {2} ms" }, { "recursionTooDeep","Vnorenie vzoru je pr\u00edli\u0161 hlbok\u00e9. vnorenie = {0}, vzor {1} {2}" }, { "nameIs", "n\u00e1zov je" }, { "matchPatternIs", "vzor zhody je" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Chyba: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Upozornenie: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_cs.java0000644000175000017500000021567110721374032025035 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_cs.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_cs extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Chyba: Ve v\u00fdrazu nelze pou\u017e\u00edt znak '{'"}, { ER_ILLEGAL_ATTRIBUTE , "{0} m\u00e1 neplatn\u00fd atribut: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "Funkce sourceNode m\u00e1 v prvku xsl:apply-imports hodnotu null!"}, {ER_CANNOT_ADD, "Nelze p\u0159idat {0} do {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "Funkce sourceNode m\u00e1 v instrukci handleApplyTemplatesInstruction hodnotu null!"}, { ER_NO_NAME_ATTRIB, "{0} mus\u00ed m\u00edt jmenn\u00fd atribut"}, {ER_TEMPLATE_NOT_FOUND, "Nelze nal\u00e9zt \u0161ablonu s n\u00e1zvem: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Nelze nal\u00e9zt n\u00e1zev AVT v \u0161ablon\u011b xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} mus\u00ed m\u00edt atribut: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} mus\u00ed m\u00edt atribut ''test''. "}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Nespr\u00e1vn\u00e1 hodnota atributu \u00farovn\u011b: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "n\u00e1zev instrukce processing-instruction nem\u016f\u017ee b\u00fdt 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "n\u00e1zev instrukce processing-instruction mus\u00ed b\u00fdt platn\u00fd n\u00e1zev NCName: {0}"}, { ER_NEED_MATCH_ATTRIB, "M\u00e1-li {0} re\u017eim, mus\u00ed m\u00edt vyhovuj\u00edc\u00ed atribut."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} vy\u017eaduje bu\u010f n\u00e1zev, nebo vyhovuj\u00edc\u00ed atribut."}, {ER_CANT_RESOLVE_NSPREFIX, "Nelze p\u0159elo\u017eit p\u0159edponu oboru n\u00e1zv\u016f: {0}"}, { ER_ILLEGAL_VALUE, "Nepovolen\u00e1 hodnota prvku xml:space: {0}"}, { ER_NO_OWNERDOC, "Uzel potomka nem\u00e1 dokument vlastn\u00edka!"}, { ER_ELEMTEMPLATEELEM_ERR, "Chyba funkce ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "Pokus o p\u0159id\u00e1n\u00ed potomka s hodnotou null!"}, { ER_NEED_SELECT_ATTRIB, "{0} vy\u017eaduje atribut select."}, { ER_NEED_TEST_ATTRIB , "Prvek xsl:when mus\u00ed obsahovat atribut 'test'."}, { ER_NEED_NAME_ATTRIB, "Prvek xsl:with-param mus\u00ed obsahovat atribut 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "Parametr context nem\u00e1 dokument vlastn\u00edka!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Nelze vytvo\u0159it prvek XML TransformerFactory Liaison: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Proces nebyl \u00fasp\u011b\u0161n\u00fd."}, { ER_NOT_SUCCESSFUL, "Xalan: nebylo \u00fasp\u011b\u0161n\u00e9."}, { ER_ENCODING_NOT_SUPPORTED, "K\u00f3dov\u00e1n\u00ed nen\u00ed podporov\u00e1no: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Nelze vytvo\u0159it TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "Prvek xsl:key vy\u017eaduje atribut 'name'!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "Prvek xsl:key vy\u017eaduje atribut 'match'!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "Prvek xsl:key vy\u017eaduje atribut 'use'!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} vy\u017eaduje atribut ''elements''!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) chyb\u00ed atribut ''prefix'' objektu {0}"}, { ER_BAD_STYLESHEET_URL, "Nespr\u00e1vn\u00e1 adresa URL p\u0159edlohy se styly: {0}"}, { ER_FILE_NOT_FOUND, "Soubor p\u0159edlohy se styly nebyl nalezen: {0}"}, { ER_IOEXCEPTION, "Soubor p\u0159edlohy se styly m\u00e1 v\u00fdjimku vstupu/v\u00fdstupu: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Pro {0} nelze naj\u00edt atribut href"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0}: p\u0159\u00edmo nebo nep\u0159\u00edmo zahrnuje sebe sama!"}, { ER_PROCESSINCLUDE_ERROR, "Chyba: StylesheetHandler.processInclude {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) chyb\u00ed atribut ''lang'' objektu {0}"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) Nespr\u00e1vn\u011b um\u00edst\u011bn\u00fd prvek {0}?? Chyb\u00ed prvek po\u0159ada\u010de ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "U atribut\u016f Element, DocumentFragment, Document a PrintWriter lze volat pouze v\u00fdstup."}, { ER_PROCESS_ERROR, "Chyba: StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Chyba: UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Chyba! Nebyl nalezen v\u00fdraz v\u00fdb\u011bru xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Nelze serializovat XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "Nebyl zad\u00e1n vstup p\u0159edlohy se styly!"}, { ER_FAILED_PROCESS_STYLESHEET, "Nepoda\u0159ilo se zpracovat p\u0159edlohu se styly!"}, { ER_COULDNT_PARSE_DOC, "Nelze analyzovat dokument {0}!"}, { ER_COULDNT_FIND_FRAGMENT, "Nelze nal\u00e9zt fragment: {0}"}, { ER_NODE_NOT_ELEMENT, "Uzel, na kter\u00fd odkazuje identifik\u00e1tor fragmentu, nen\u00ed prvek: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "atribut for-each mus\u00ed m\u00edt bu\u010f shodu, nebo n\u00e1zev atributu"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "atribut templates mus\u00ed m\u00edt bu\u010f shodu, nebo n\u00e1zev atributu"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\u017d\u00e1dn\u00fd klon fragmentu dokumentu!"}, { ER_CANT_CREATE_ITEM, "Ve stromu v\u00fdsledk\u016f nelze vytvo\u0159it polo\u017eku: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "Parametr xml:space ve zdrojov\u00e9m XML m\u00e1 neplatnou hodnotu: {0}"}, { ER_NO_XSLKEY_DECLARATION, "{0} nem\u00e1 deklarov\u00e1n \u017e\u00e1dn\u00fd parametr xsl:key!"}, { ER_CANT_CREATE_URL, "Chyba! Nelze vytvo\u0159it url pro: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "Nepodporovan\u00e1 funkce xsl:functions"}, { ER_PROCESSOR_ERROR, "Chyba: XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} - nen\u00ed v r\u00e1mci p\u0159edlohy se styly povoleno!"}, { ER_RESULTNS_NOT_SUPPORTED, "Parametr result-ns ji\u017e nen\u00ed podporov\u00e1n! M\u00edsto toho pou\u017eijte parametr xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "Parametr default-space ji\u017e nen\u00ed podporov\u00e1n! M\u00edsto toho pou\u017eijte parametr xsl:strip-space nebo xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "Parametr indent-result ji\u017e nen\u00ed podporov\u00e1n! M\u00edsto toho pou\u017eijte parametr xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} m\u00e1 neplatn\u00fd atribut: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Nezn\u00e1m\u00fd prvek XSL: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) Parametr xsl:sort lze pou\u017e\u00edt pouze s parametrem xsl:apply-templates nebo xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) Nespr\u00e1vn\u011b um\u00edst\u011bn\u00fd prvek xsl:when!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) Prvkek xsl:when nem\u00e1 v parametru xsl:choose \u017e\u00e1dn\u00e9ho rodi\u010de!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) Nespr\u00e1vn\u011b um\u00edst\u011bn\u00fd prvek xsl:otherwise!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) Prvek xsl:otherwise nem\u00e1 v parametru xsl:choose \u017e\u00e1dn\u00e9ho rodi\u010de!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} - nen\u00ed v r\u00e1mci \u0161ablony povoleno!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0}: nezn\u00e1m\u00e1 p\u0159edpona {1} p\u0159\u00edpony oboru n\u00e1zv\u016f"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Importy mus\u00ed b\u00fdt v r\u00e1mci \u0161ablony se styly na prvn\u00edch m\u00edstech!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0}: p\u0159\u00edmo nebo nep\u0159\u00edmo importuje samo sebe!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) Parametr xml:space m\u00e1 neplatnou hodnotu: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "Ne\u00fasp\u011b\u0161n\u00fd proces processStylesheet!"}, { ER_SAX_EXCEPTION, "V\u00fdjimka SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Nepodporovan\u00e1 funkce!"}, { ER_XSLT_ERROR, "Chyba XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "znak m\u011bny nen\u00ed v \u0159et\u011bzci vzorku form\u00e1tu povolen"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Funkce Document nen\u00ed v p\u0159edloze se styly DOM podporov\u00e1na!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Nelze p\u0159elo\u017eit p\u0159edponu p\u0159eklada\u010de non-Prefix!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "P\u0159esm\u011brov\u00e1n\u00ed p\u0159\u00edpony: Nelze z\u00edskat n\u00e1zev souboru - atribut file nebo select mus\u00ed vr\u00e1tit platn\u00fd \u0159et\u011bzec."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "V p\u0159\u00edpon\u011b Redirect nelze vytvo\u0159it FormatterListener!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Neplatn\u00e1 p\u0159edpona ve funkci exclude-result-prefixes: {0}"}, { ER_MISSING_NS_URI, "U zadan\u00e9 p\u0159edpony chyb\u00ed obor n\u00e1zv\u016f URI"}, { ER_MISSING_ARG_FOR_OPTION, "Chyb\u011bj\u00edc\u00ed argument volby: {0}"}, { ER_INVALID_OPTION, "Neplatn\u00e1 volba: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Vadn\u00fd form\u00e1tovac\u00ed \u0159et\u011bzec: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "Prvek xsl:stylesheet vy\u017eaduje atribut 'version'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Parametr Attribute: {0} m\u00e1 neplatnou hodnotu: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "Prvek xsl:choose vy\u017eaduje parametr xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "Parametr xsl:for-each nen\u00ed v xsl:apply-imports povolen"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Nelze pou\u017e\u00edt DTMLiaison u v\u00fdstupu uzlu DOM node... M\u00edsto toho pou\u017eijte org.apache.xpath.DOM2Helper!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Nelze pou\u017e\u00edt DTMLiaison u vstupu uzlu DOM node... M\u00edsto toho pou\u017eijte org.apache.xpath.DOM2Helper!"}, { ER_CALL_TO_EXT_FAILED, "Ne\u00fasp\u011b\u0161n\u00e9 vol\u00e1n\u00ed prvku p\u0159\u00edpony: {0}"}, { ER_PREFIX_MUST_RESOLVE, "P\u0159edponu mus\u00ed b\u00fdt mo\u017eno p\u0159elo\u017eit do oboru n\u00e1zv\u016f: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Byla zji\u0161t\u011bna neplatn\u00e1 n\u00e1hrada UTF-16: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "Prvek xsl:attribute-set {0} pou\u017e\u00edv\u00e1 s\u00e1m sebe, co\u017e zp\u016fsob\u00ed nekone\u010dnou smy\u010dku."}, { ER_CANNOT_MIX_XERCESDOM, "Vstup Xerces-DOM nelze sm\u011b\u0161ovat s v\u00fdstupem Xerces-DOM!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "V ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Nalezena v\u00edce ne\u017e jedna \u0161ablona s n\u00e1zvem: {0}"}, { ER_INVALID_KEY_CALL, "Neplatn\u00e9 vol\u00e1n\u00ed funkce: rekurzivn\u00ed vol\u00e1n\u00ed funkce key() nen\u00ed povoleno"}, { ER_REFERENCING_ITSELF, "Prom\u011bnn\u00e1 {0} odkazuje p\u0159\u00edmo \u010di nep\u0159\u00edmo sama na sebe!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "Vstupn\u00ed uzel DOMSource pro newTemplates nesm\u00ed m\u00edt hodnotu null!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Nebyl nalezen soubor t\u0159\u00eddy pro volbu {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Nebyl nalezen po\u017eadovan\u00fd prvek: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "Parametr InputStream nesm\u00ed m\u00edt hodnotu null"}, { ER_URI_CANNOT_BE_NULL, "Parametr URI nesm\u00ed m\u00edt hodnotu null"}, { ER_FILE_CANNOT_BE_NULL, "Parametr File nesm\u00ed m\u00edt hodnotu null"}, { ER_SOURCE_CANNOT_BE_NULL, "Parametr InputSource nesm\u00ed m\u00edt hodnotu null"}, { ER_CANNOT_INIT_BSFMGR, "Nelze inicializovat BSF Manager"}, { ER_CANNOT_CMPL_EXTENSN, "P\u0159\u00edponu nelze kompilovat"}, { ER_CANNOT_CREATE_EXTENSN, "Nelze vytvo\u0159it p\u0159\u00edponu: {0}, proto\u017ee: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Vol\u00e1n\u00ed metody {0} metodou Instance vy\u017eaduje jako prvn\u00ed argument instanci Object"}, { ER_INVALID_ELEMENT_NAME, "Byl zad\u00e1n neplatn\u00fd n\u00e1zev prvku {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "N\u00e1zev metody prvku mus\u00ed b\u00fdt static {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Funkce v\u00fdjimky {0} : {1} je nezn\u00e1m\u00e1"}, { ER_MORE_MATCH_CONSTRUCTOR, "Konstruktor {0} m\u00e1 v\u00edce nejlep\u0161\u00edch shod."}, { ER_MORE_MATCH_METHOD, "Metoda {0} m\u00e1 v\u00edce nejlep\u0161\u00edch shod."}, { ER_MORE_MATCH_ELEMENT, "Metoda prvku {0} m\u00e1 v\u00edce nejlep\u0161\u00edch shod."}, { ER_INVALID_CONTEXT_PASSED, "Do vyhodnocen\u00ed byl p\u0159ed\u00e1n neplatn\u00fd kontext {0}."}, { ER_POOL_EXISTS, "Spole\u010dn\u00e1 oblast ji\u017e existuje."}, { ER_NO_DRIVER_NAME, "Nebylo zad\u00e1no \u017e\u00e1dn\u00e9 jm\u00e9no ovlada\u010de."}, { ER_NO_URL, "Nebyla specifikov\u00e1na \u017e\u00e1dn\u00e1 adresa URL."}, { ER_POOL_SIZE_LESSTHAN_ONE, "Velikost spole\u010dn\u00e9 oblasti je men\u0161\u00ed ne\u017e jedna!"}, { ER_INVALID_DRIVER, "Byl zad\u00e1n neplatn\u00fd n\u00e1zev ovlada\u010de!"}, { ER_NO_STYLESHEETROOT, "Nebyl nalezen ko\u0159en p\u0159edlohy se styly!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Neplatn\u00e1 hodnota parametru xml:space"}, { ER_PROCESSFROMNODE_FAILED, "Selh\u00e1n\u00ed procesu processFromNode"}, { ER_RESOURCE_COULD_NOT_LOAD, "Nelze zav\u00e9st zdroj [ {0} ]: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Velikost vyrovn\u00e1vac\u00ed pam\u011bti <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "P\u0159i vol\u00e1n\u00ed p\u0159\u00edpony do\u0161lo k nezn\u00e1m\u00e9 chyb\u011b"}, { ER_NO_NAMESPACE_DECL, "P\u0159edpona {0} nem\u00e1 deklarov\u00e1n odpov\u00eddaj\u00edc\u00ed obor n\u00e1zv\u016f"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Obsah prvku nen\u00ed povolen pro lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Ukon\u010den\u00ed sm\u011brovan\u00e9 na p\u0159edlohu se styly."}, { ER_ONE_OR_TWO, "1 nebo 2"}, { ER_TWO_OR_THREE, "2 nebo 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Nelze zav\u00e9st {0} (zkontrolujte prom\u011bnnou CLASSPATH) - proto se pou\u017e\u00edvaj\u00ed pouze v\u00fdchoz\u00ed hodnoty"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Nelze aktualizovat v\u00fdchoz\u00ed \u0161ablony."}, { ER_RESULT_NULL, "V\u00fdsledek by nem\u011bl m\u00edt hodnotu null"}, { ER_RESULT_COULD_NOT_BE_SET, "Nelze nastavit v\u00fdsledek"}, { ER_NO_OUTPUT_SPECIFIED, "Nebyl ur\u010den \u017e\u00e1dn\u00fd v\u00fdstup"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Nelze prov\u00e9st p\u0159evod na v\u00fdsledek typu {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Nelze prov\u00e9st p\u0159evod zdroje typu {0}"}, { ER_NULL_CONTENT_HANDLER, "Obslu\u017en\u00fd program obsahu hodnoty null"}, { ER_NULL_ERROR_HANDLER, "Obslu\u017en\u00fd program pro zpracov\u00e1n\u00ed chyb hodnoty null"}, { ER_CANNOT_CALL_PARSE, "Nen\u00ed-li nastaven obslu\u017en\u00fd program ContentHandler, nelze volat analyz\u00e1tor."}, { ER_NO_PARENT_FOR_FILTER, "Filtr nem\u00e1 rodi\u010de."}, { ER_NO_STYLESHEET_IN_MEDIA, "Nebyla nalezena p\u0159edloha se styly v: {0}, m\u00e9dium= {1}"}, { ER_NO_STYLESHEET_PI, "Nebyla nalezena p\u0159edloha se styly xml-stylesheet PI v: {0}"}, { ER_NOT_SUPPORTED, "Nepodporov\u00e1no: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Hodnota vlastnosti {0} by m\u011bla b\u00fdt booleovsk\u00e1 instance"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Z {0} nelze z\u00edskat extern\u00ed skript."}, { ER_RESOURCE_COULD_NOT_FIND, "Nelze naj\u00edt zdroj [ {0} ].\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Nezn\u00e1m\u00e1 vlastnost v\u00fdstupu: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Nepoda\u0159ilo se vytvo\u0159it instanci ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Hodnota pro {0} by m\u011bla obsahovat analyzovateln\u00e9 \u010d\u00edslo"}, { ER_VALUE_SHOULD_EQUAL, "Hodnota {0} mus\u00ed b\u00fdt yes nebo no."}, { ER_FAILED_CALLING_METHOD, "Vol\u00e1n\u00ed metody {0} selhalo."}, { ER_FAILED_CREATING_ELEMTMPL, "Nepoda\u0159ilo se vytvo\u0159it instanci ElemTemplateElement."}, { ER_CHARS_NOT_ALLOWED, "V t\u00e9to \u010d\u00e1sti dokumentu nejsou znaky povoleny."}, { ER_ATTR_NOT_ALLOWED, "Atribut \"{0}\" nen\u00ed u prvku {1} povolen!"}, { ER_BAD_VALUE, "{0}: nespr\u00e1vn\u00e1 hodnota {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "Atribut hodnoty ({0}) nebyl nalezen "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Atribut hodnoty ({0}) nebyl rozpozn\u00e1n "}, { ER_NULL_URI_NAMESPACE, "Pokus o generov\u00e1n\u00ed oboru n\u00e1zv\u016f s URI s hodnotou null."}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Pokus o form\u00e1tov\u00e1n\u00ed v\u011bt\u0161\u00edho \u010d\u00edsla, ne\u017e je nejv\u011bt\u0161\u00ed dlouh\u00e9 cel\u00e9 \u010d\u00edslo."}, { ER_CANNOT_FIND_SAX1_DRIVER, "Nelze naj\u00edt t\u0159\u00eddu ovlada\u010de SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "T\u0159\u00edda ovlada\u010de SAX1 {0} byla nalezena, ale nebylo mo\u017eno ji zav\u00e9st."}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "T\u0159\u00edda ovlada\u010de SAX1 {0} byla nalezena, ale nebylo mo\u017eno s n\u00ed zalo\u017eit instanci."}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "T\u0159\u00edda ovlada\u010de SAX1 {0} neimplementuje org.xml.sax.Parser."}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Nebyla ur\u010dena vlastnost syst\u00e9mu org.xml.sax.parser."}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Argument analyz\u00e1toru nesm\u00ed m\u00edt hodnotu null."}, { ER_FEATURE, "Funkce: {0}"}, { ER_PROPERTY, "Vlastnost: {0}"}, { ER_NULL_ENTITY_RESOLVER, "\u0158e\u0161itel s hodnotou entity null"}, { ER_NULL_DTD_HANDLER, "Obslu\u017en\u00fd program DTD s hodnotou null"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Nebyl zad\u00e1n n\u00e1zev ovlada\u010de!"}, { ER_NO_URL_SPECIFIED, "Nebyla specifikov\u00e1na adresa URL!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Velikost spole\u010dn\u00e9 oblasti je men\u0161\u00ed ne\u017e 1!"}, { ER_INVALID_DRIVER_NAME, "Zad\u00e1n neplatn\u00fd n\u00e1zev ovlada\u010de!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Chyba program\u00e1tora! Ve v\u00fdrazu chyb\u00ed nad\u0159azen\u00fd \u010dlen ElemTemplateElement."}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Tvrzen\u00ed program\u00e1tora v RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} - nen\u00ed povoleno v tomto stylu na dan\u00e9m m\u00edst\u011b!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Nepr\u00e1zdn\u00fd text nen\u00ed povolen v tomto stylu na dan\u00e9m m\u00edst\u011b!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro atribut CHAR: {0}. Atribut typu CHAR sm\u00ed m\u00edt pouze jeden znak."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro atribut QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro atribut ENUM {0}. Platn\u00e9 hodnoty jsou: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro atribut NMTOKEN: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro atribut NCNAME: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro booleovsk\u00fd atribut: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Neplatn\u00e1 hodnota: {1} pou\u017eito pro atribut \u010d\u00edsla: {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argument pro {0} ve vyhovuj\u00edc\u00edm vzorku mus\u00ed b\u00fdt typu literal."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Duplicitn\u00ed deklarace glob\u00e1ln\u00ed prom\u011bnn\u00e9."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Duplicitn\u00ed deklarace prom\u011bnn\u00e9."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "Prvek xsl:template mus\u00ed m\u00edt n\u00e1zev nebo odpov\u00eddaj\u00edc\u00ed atribut (nebo oboj\u00ed)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Neplatn\u00e1 p\u0159edpona ve funkci exclude-result-prefixes: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "sada atribut\u016f pojmenovan\u00e1 {0} neexistuje"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "Funkce se jm\u00e9nem {0} neexistuje."}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "Prvek {0} nesm\u00ed obsahovat sou\u010dasn\u011b obsah i atribut volby."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "Hodnota parametru {0} mus\u00ed b\u00fdt platn\u00fdm objektem technologie Java."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Atribut result-prefix prvku xsl:namespace-alias m\u00e1 hodnotu '#default', neexistuje v\u0161ak \u017e\u00e1dn\u00e1 deklarace v\u00fdchoz\u00edho oboru n\u00e1zv\u016f v rozsahu dan\u00e9ho prvku"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Atribut result-prefix prvku xsl:namespace-alias m\u00e1 hodnotu ''{0}'', neexistuje v\u0161ak \u017e\u00e1dn\u00e1 deklarace oboru n\u00e1zv\u016f pro p\u0159edponu ''{0}'' v rozsahu dan\u00e9ho prvku. "}, { ER_SET_FEATURE_NULL_NAME, "N\u00e1zev funkce pou\u017eit\u00fd ve vol\u00e1n\u00ed TransformerFactory.setFeature(\u0159et\u011bzec n\u00e1zvu, booleovsk\u00e1 hodnota) nesm\u00ed m\u00edt hodnotu Null. "}, { ER_GET_FEATURE_NULL_NAME, "N\u00e1zev funkce pou\u017eit\u00fd ve vol\u00e1n\u00ed TransformerFactory.getFeature(\u0159et\u011bzec n\u00e1zvu) nesm\u00ed m\u00edt hodnotu Null. "}, { ER_UNSUPPORTED_FEATURE, "Nelze nastavit funkci ''{0}'' pro tuto t\u0159\u00eddu TransformerFactory. "}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "Je-li funkce zabezpe\u010den\u00e9ho zpracov\u00e1n\u00ed nastavena na hodnotu true, nen\u00ed povoleno pou\u017eit\u00ed roz\u0161i\u0159uj\u00edc\u00edho prvku ''{0}''. "}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Nelze na\u010d\u00edst p\u0159edponu pro identifik\u00e1tor URI, jeho\u017e obor n\u00e1zv\u016f m\u00e1 hodnotu Null. "}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Nelze na\u010d\u00edst identifik\u00e1tor URI oboru n\u00e1zv\u016f pro p\u0159edponu s hodnotou Null. "}, { ER_XPATH_RESOLVER_NULL_QNAME, "N\u00e1zev funkce nesm\u00ed m\u00edt hodnotu Null. "}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Arita nesm\u00ed m\u00edt z\u00e1pornou hodnotu. "}, // Warnings... { WG_FOUND_CURLYBRACE, "Byl nalezen znak '}', ale nen\u00ed otev\u0159ena \u017e\u00e1dn\u00e1 \u0161ablona atributu!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Varov\u00e1n\u00ed: \u010d\u00edta\u010d atributu se neshoduje s p\u0159edch\u016fdcem v xsl:number! C\u00edl = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Star\u00e1 syntaxe: N\u00e1zev atributu 'expr' byl zm\u011bn\u011bn na 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan je\u0161t\u011b neobsluhuje n\u00e1zev n\u00e1rodn\u00edho prost\u0159ed\u00ed ve funkci format-number."}, { WG_LOCALE_NOT_FOUND, "Varov\u00e1n\u00ed: Nebylo nalezeno n\u00e1rodn\u00ed prost\u0159ed\u00ed pro parametr xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Nelze vytvo\u0159it adresu URL z: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Po\u017eadovan\u00fd dokument nelze na\u010d\u00edst: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Nelze naj\u00edt funkci Collator pro >>>>>> Verze Xalan "}, { "version2", "<<<<<<<"}, { "yes", "ano"}, { "line", "\u0158\u00e1dek #"}, { "column","Sloupec #"}, { "xsldone", "XSLProcessor: hotovo"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "P\u0159\u00edkazov\u00fd \u0159\u00e1dek Xalan-J: Zpracov\u00e1n\u00ed voleb t\u0159\u00eddy:"}, { "xslProc_option", "P\u0159\u00edkazov\u00fd \u0159\u00e1dek Xalan-J: Zpracov\u00e1n\u00ed voleb t\u0159\u00eddy\u003a"}, { "xslProc_invalid_xsltc_option", "Volba {0} nen\u00ed v re\u017eimu XSLTC podporovan\u00e1."}, { "xslProc_invalid_xalan_option", "Volba {0} m\u016f\u017ee b\u00fdt pou\u017eita pouze s -XSLTC."}, { "xslProc_no_input", "Chyba: \u017d\u00e1dn\u00e1 p\u0159edloha stylu ani vstup xml nejsou ur\u010deny. K zobrazen\u00ed pokyn\u016f spus\u0165te tento p\u0159\u00edkaz bez jak\u00e9koliv volby."}, { "xslProc_common_options", "-Obecn\u00e9 volby-"}, { "xslProc_xalan_options", "-Volby pro Xalan-"}, { "xslProc_xsltc_options", "-Volby pro XSLTC-"}, { "xslProc_return_to_continue", "(pokra\u010dujte stisknut\u00edm kl\u00e1vesy )"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (pou\u017eije XSLTC pro transformaci)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER pln\u011b kvalifikovan\u00fd n\u00e1zev t\u0159\u00eddy spojen\u00ed analyz\u00e1toru]"}, { "optionE", " [-E (neroz\u0161i\u0159ovat odkazy entity)]"}, { "optionV", " [-E (neroz\u0161i\u0159ovat odkazy entity)]"}, { "optionQC", " [-QC (varov\u00e1n\u00ed p\u0159ed konflikty vzorkov\u00e1n\u00ed v tich\u00e9m re\u017eimu)]"}, { "optionQ", " [-Q (tich\u00fd re\u017eim)]"}, { "optionLF", " [-LF (ve v\u00fdstupu pou\u017e\u00edt pouze \u0159\u00e1dkov\u00e1n\u00ed - LF {v\u00fdchoz\u00ed nastaven\u00ed je CR/LF})]"}, { "optionCR", " [-CR (ve v\u00fdstupu pou\u017e\u00edt pouze znak nov\u00fd \u0159\u00e1dek - CR {v\u00fdchoz\u00ed nastaven\u00ed je CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (nastaven\u00ed znak\u016f escape sekvence {v\u00fdchoz\u00ed nastaven\u00ed je <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (ovliv\u0148uje po\u010det znak\u016f odsazen\u00ed {v\u00fdchoz\u00ed nastaven\u00ed je 0})]"}, { "optionTT", " [-TT (trasuje \u0161ablony p\u0159i vol\u00e1n\u00ed)]"}, { "optionTG", " [-TG (trasuje v\u0161echny ud\u00e1losti generov\u00e1n\u00ed)]"}, { "optionTS", " [-TS (trasuje v\u0161echny ud\u00e1losti v\u00fdb\u011bru)]"}, { "optionTTC", " [-TTC (trasuje potomky \u0161ablony v pr\u016fb\u011bhu jejich zpracov\u00e1n\u00ed)]"}, { "optionTCLASS", " [-TCLASS (t\u0159\u00edda TraceListener p\u0159\u00edpon trasov\u00e1n\u00ed)]"}, { "optionVALIDATE", " [-VALIDATE (zap\u00edn\u00e1/vyp\u00edn\u00e1 validaci; v\u00fdchoz\u00ed nastaven\u00ed je vypnuto)]"}, { "optionEDUMP", " [-EDUMP {voliteln\u00fd n\u00e1zev souboru} (p\u0159i chyb\u011b vyp\u00ed\u0161e obsah z\u00e1sobn\u00edku)]"}, { "optionXML", " [-XML (pou\u017eije program pro form\u00e1tov\u00e1n\u00ed XML a p\u0159id\u00e1 z\u00e1hlav\u00ed XML)]"}, { "optionTEXT", " [-TEXT (pou\u017eije jednoduch\u00fd program pro form\u00e1tov\u00e1n\u00ed textu)]"}, { "optionHTML", " [-HTML (pou\u017eije program pro form\u00e1tov\u00e1n\u00ed HTML)]"}, { "optionPARAM", " [-PARAM n\u00e1zev v\u00fdrazu (nastav\u00ed parametr p\u0159edlohy se styly)]"}, { "noParsermsg1", "Proces XSL nebyl \u00fasp\u011b\u0161n\u00fd."}, { "noParsermsg2", "** Nelze naj\u00edt analyz\u00e1tor **"}, { "noParsermsg3", "Zkontrolujte cestu classpath."}, { "noParsermsg4", "Nem\u00e1te-li analyz\u00e1tor XML jazyka Java spole\u010dnosti IBM, m\u016f\u017eete si jej st\u00e1hnout z adresy:"}, { "noParsermsg5", "AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER cel\u00e9 jm\u00e9no t\u0159\u00eddy (pro p\u0159eklad URI pou\u017eije funkci URIResolver)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER cel\u00e9 jm\u00e9no t\u0159\u00eddy (pro p\u0159eklad entit pou\u017eije funkci EntityResolver)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER cel\u00e9 jm\u00e9no t\u0159\u00eddy (pro serializaci v\u00fdstupu pou\u017eije funkci ContentHandler)]"}, { "optionLINENUMBERS", " [-L ve zdrojov\u00e9m dokumentu pou\u017eije \u010d\u00edsla \u0159\u00e1dk\u016f]"}, { "optionSECUREPROCESSING", " [-SECURE (nastav\u00ed funkci zabezpe\u010den\u00e9ho zpracov\u00e1n\u00ed na hodnotu True.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (k vyhled\u00e1n\u00ed p\u0159edlohy se styly p\u0159i\u0159azen\u00e9 dokumentu pou\u017eije atribut m\u00e9dia)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (p\u0159i transformaci se explicitn\u011b pou\u017eije s2s=SAX nebo d2d=DOM)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (vytiskne \u010das transformace v milisekund\u00e1ch)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (vy\u017eaduje inkrement\u00e1ln\u00ed konstrukci DTM nastaven\u00edm hodnoty http://xml.apache.org/xalan/features/incremental na true)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (vy\u017eaduje optimalizaci p\u0159edlohy se styly nastaven\u00edm hodnoty http://xml.apache.org/xalan/features/optimize na false)]"}, { "optionRL", " [-RL recursionlimit (potvrd\u00ed \u010d\u00edseln\u00fd limit hloubky p\u0159edlohy se styly)]"}, { "optionXO", " [-XO [transletName] (p\u0159i\u0159ad\u00ed n\u00e1zev k generovan\u00e9mu transletu)]"}, { "optionXD", " [-XD destinationDirectory (ur\u010duje c\u00edlov\u00fd adres\u00e1\u0159 pro translet)]"}, { "optionXJ", " [-XJ jarfile (zabal\u00ed t\u0159\u00eddy transletu do souboru jar s n\u00e1zvem )]"}, { "optionXP", " [-XP package (ur\u010d\u00ed p\u0159edponu n\u00e1zvu sady pro v\u0161echny generovan\u00e9 t\u0159\u00eddy transletu)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (povol\u00ed zarovn\u00e1n\u00ed \u0161ablon)]" }, { "optionXX", " [-XX (zapne dal\u0161\u00ed v\u00fdstup zpr\u00e1v lad\u011bn\u00ed)]"}, { "optionXT" , " [-XT (Pou\u017eije translet k transformaci, je-li to mo\u017en\u00e9)]"}, { "diagTiming"," --------- Transformace {0} pomoc\u00ed {1} trvala {2} ms." }, { "recursionTooDeep","Vno\u0159en\u00ed \u0161ablon je p\u0159\u00edli\u0161 hlubok\u00e9. Vno\u0159en\u00ed = {0}, \u0161ablona {1} {2}" }, { "nameIs", "n\u00e1zev je" }, { "matchPatternIs", "vzorek shody je" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#chyba"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Chyba: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Varov\u00e1n\u00ed: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("cs", "CZ")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_pt_BR.java0000644000175000017500000021130210721374033025422 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_pt_BR.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_pt_BR extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Erro: Imposs\u00edvel ter '{' na express\u00e3o"}, { ER_ILLEGAL_ATTRIBUTE , "{0} possui um atributo inv\u00e1lido: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode \u00e9 nulo em xsl:apply-imports!"}, {ER_CANNOT_ADD, "Imposs\u00edvel incluir {0} em {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode \u00e9 nulo em handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "{0} deve ter um atributo name."}, {ER_TEMPLATE_NOT_FOUND, "N\u00e3o foi poss\u00edvel localizar o template: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "N\u00e3o foi poss\u00edvel resolver nome AVT em xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} requer o atributo: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} deve ter um atributo ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Valor inv\u00e1lido no atributo de n\u00edvel: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "O nome de processing-instruction n\u00e3o pode ser 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "O nome de processing-instruction deve ser um NCName v\u00e1lido: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} deve ter um atributo de correspond\u00eancia se tiver um modo."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} requer um nome ou um atributo de correspond\u00eancia."}, {ER_CANT_RESOLVE_NSPREFIX, "Imposs\u00edvel resolver prefixo do espa\u00e7o de nomes: {0}"}, { ER_ILLEGAL_VALUE, "xml:space possui um valor inv\u00e1lido: {0}"}, { ER_NO_OWNERDOC, "O n\u00f3 filho n\u00e3o possui um documento do propriet\u00e1rio!"}, { ER_ELEMTEMPLATEELEM_ERR, "Erro de ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "Tentando incluir um filho nulo!"}, { ER_NEED_SELECT_ATTRIB, "{0} requer um atributo select."}, { ER_NEED_TEST_ATTRIB , "xsl:when deve ter um atributo 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param deve ter um atributo 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "context n\u00e3o possui um documento do propriet\u00e1rio!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "N\u00e3o foi poss\u00edvel criar XML TransformerFactory Liaison: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: O processo n\u00e3o foi bem-sucedido."}, { ER_NOT_SUCCESSFUL, "Xalan: n\u00e3o foi bem-sucedido."}, { ER_ENCODING_NOT_SUPPORTED, "Codifica\u00e7\u00e3o n\u00e3o suportada: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "N\u00e3o foi poss\u00edvel criar TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key requer um atributo 'name'!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key requer um atributo 'match'!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key requer um atributo 'use'!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} requer um atributo ''elements''!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) O atributo ''prefix'' de {0} est\u00e1 ausente"}, { ER_BAD_STYLESHEET_URL, "A URL da p\u00e1gina de estilo \u00e9 inv\u00e1lida: {0}"}, { ER_FILE_NOT_FOUND, "O arquivo da p\u00e1gina de estilo n\u00e3o foi encontrado: {0}"}, { ER_IOEXCEPTION, "Ocorreu uma Exce\u00e7\u00e3o de E/S (entrada/sa\u00edda) no arquivo de p\u00e1gina de estilo: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) N\u00e3o foi poss\u00edvel encontrar o atributo href para {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} est\u00e1 incluindo a si mesmo, direta ou indiretamente!"}, { ER_PROCESSINCLUDE_ERROR, "Erro de StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) O atributo ''lang'' de {0} est\u00e1 ausente"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) Elemento {0} aplicado incorretamente?? O elemento de cont\u00eainer ''component'' est\u00e1 ausente "}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "A sa\u00edda pode ser apenas para um Element, DocumentFragment, Document ou PrintWriter."}, { ER_PROCESS_ERROR, "Erro de StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Erro de UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Erro! N\u00e3o encontrada a express\u00e3o xpath select (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "N\u00e3o \u00e9 poss\u00edvel serializar um XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "A entrada de folha de estilo n\u00e3o foi especificada!"}, { ER_FAILED_PROCESS_STYLESHEET, "Falha ao processar folha de estilo!"}, { ER_COULDNT_PARSE_DOC, "N\u00e3o foi poss\u00edvel analisar o documento {0}!"}, { ER_COULDNT_FIND_FRAGMENT, "N\u00e3o foi poss\u00edvel localizar o fragmento: {0}"}, { ER_NODE_NOT_ELEMENT, "O n\u00f3 apontado por um identificador de fragmento n\u00e3o era um elemento: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each deve ter um atributo match ou name"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates deve ter um atributo match ou name"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Nenhum clone de fragmento de documento!"}, { ER_CANT_CREATE_ITEM, "Imposs\u00edvel criar item na \u00e1rvore de resultados: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space no XML de origem possui um valor inv\u00e1lido: {0}"}, { ER_NO_XSLKEY_DECLARATION, "N\u00e3o existe nenhuma declara\u00e7\u00e3o xsl:key para {0}!"}, { ER_CANT_CREATE_URL, "Erro! Imposs\u00edvel criar url para: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions n\u00e3o \u00e9 suportado"}, { ER_PROCESSOR_ERROR, "Erro de XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} n\u00e3o permitido dentro de uma folha de estilo!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns n\u00e3o \u00e9 mais suportado! Utilize ent\u00e3o xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space n\u00e3o \u00e9 mais suportado! Utilize ent\u00e3o xsl:strip-space ou xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result n\u00e3o \u00e9 mais suportado! Utilize ent\u00e3o xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} possui um atributo inv\u00e1lido: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Elemento XSL desconhecido: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort somente pode ser utilizado com xsl:apply-templates ou xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when aplicado incorretamente!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when n\u00e3o est\u00e1 ligado a xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise aplicado incorretamente!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise n\u00e3o est\u00e1 ligado a xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} n\u00e3o \u00e9 permitido dentro de um template!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) o espa\u00e7o de nomes de extens\u00e3o {0} possui prefixo {1} desconhecido"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Importa\u00e7\u00f5es s\u00f3 podem ocorrer como os primeiros elementos na folha de estilo!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} est\u00e1 importando a si mesmo, direta ou indiretamente!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space tem um valor inv\u00e1lido: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet n\u00e3o obteve \u00eaxito!"}, { ER_SAX_EXCEPTION, "Exce\u00e7\u00e3o de SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Fun\u00e7\u00e3o n\u00e3o suportada!"}, { ER_XSLT_ERROR, "Erro de XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "O sinal monet\u00e1rio n\u00e3o \u00e9 permitido na cadeia de padr\u00f5es de formato"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Fun\u00e7\u00e3o Document n\u00e3o suportada no DOM da Folha de Estilo!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Imposs\u00edvel resolver prefixo de solucionador sem Prefixo!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Redirecionar extens\u00e3o: N\u00e3o foi poss\u00edvel obter o nome do arquivo - o atributo file ou select deve retornar uma cadeia v\u00e1lida."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Imposs\u00edvel construir FormatterListener em Redirecionar extens\u00e3o!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "O prefixo em exclude-result-prefixes n\u00e3o \u00e9 v\u00e1lido: {0}"}, { ER_MISSING_NS_URI, "URI do espa\u00e7o de nomes ausente para o prefixo especificado"}, { ER_MISSING_ARG_FOR_OPTION, "Argumento ausente para a op\u00e7\u00e3o: {0}"}, { ER_INVALID_OPTION, "Op\u00e7\u00e3o inv\u00e1lida: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Cadeia com problemas de formata\u00e7\u00e3o: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet requer um atributo 'version'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Atributo: {0} possui um valor inv\u00e1lido: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose requer um xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports n\u00e3o permitido em um xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Imposs\u00edvel utilizar um DTMLiaison para um n\u00f3 DOM de sa\u00edda... transmita um org.apache.xpath.DOM2Helper no lugar!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Imposs\u00edvel utilizar um DTMLiaison para um n\u00f3 DOM de entrada... transmita um org.apache.xpath.DOM2Helper no lugar!"}, { ER_CALL_TO_EXT_FAILED, "Falha na chamada do elemento da extens\u00e3o: {0}"}, { ER_PREFIX_MUST_RESOLVE, "O prefixo deve ser resolvido para um espa\u00e7o de nomes: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Detectado substituto UTF-16 inv\u00e1lido: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} utilizou a si mesmo, o que causar\u00e1 um loop infinito."}, { ER_CANNOT_MIX_XERCESDOM, "Imposs\u00edvel misturar entrada n\u00e3o Xerces-DOM com sa\u00edda Xerces-DOM!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "Em ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Encontrado mais de um template chamado: {0}"}, { ER_INVALID_KEY_CALL, "Chamada de fun\u00e7\u00e3o inv\u00e1lida: chamadas key() recursivas n\u00e3o s\u00e3o permitidas"}, { ER_REFERENCING_ITSELF, "A vari\u00e1vel {0} est\u00e1 fazendo refer\u00eancia a si mesmo, direta ou indiretamente!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "O n\u00f3 de entrada n\u00e3o pode ser nulo para um DOMSource de newTemplates!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Arquivo de classe n\u00e3o encontrado para a op\u00e7\u00e3o {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Elemento requerido n\u00e3o encontrado: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream n\u00e3o pode ser nulo"}, { ER_URI_CANNOT_BE_NULL, "URI n\u00e3o pode ser nulo"}, { ER_FILE_CANNOT_BE_NULL, "File n\u00e3o pode ser nulo"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource n\u00e3o pode ser nulo"}, { ER_CANNOT_INIT_BSFMGR, "N\u00e3o foi poss\u00edvel inicializar o BSF Manager"}, { ER_CANNOT_CMPL_EXTENSN, "N\u00e3o foi poss\u00edvel compilar a extens\u00e3o"}, { ER_CANNOT_CREATE_EXTENSN, "N\u00e3o foi poss\u00edvel criar extens\u00e3o: {0} devido a: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "A chamada do m\u00e9todo da inst\u00e2ncia para o m\u00e9todo {0} requer uma inst\u00e2ncia Object como primeiro argumento"}, { ER_INVALID_ELEMENT_NAME, "Especificado nome de elemento inv\u00e1lido {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "O m\u00e9todo do nome de elemento deve ser est\u00e1tico {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "A fun\u00e7\u00e3o de extens\u00e3o {0} : {1} \u00e9 desconhecida"}, { ER_MORE_MATCH_CONSTRUCTOR, "Mais de uma correspond\u00eancia principal para o construtor de {0}"}, { ER_MORE_MATCH_METHOD, "Mais de uma correspond\u00eancia principal para o m\u00e9todo {0}"}, { ER_MORE_MATCH_ELEMENT, "Mais de uma correspond\u00eancia principal para o m\u00e9todo do elemento {0}"}, { ER_INVALID_CONTEXT_PASSED, "Contexto inv\u00e1lido transmitido para avaliar {0}"}, { ER_POOL_EXISTS, "O conjunto j\u00e1 existe"}, { ER_NO_DRIVER_NAME, "Nenhum Nome de driver foi especificado"}, { ER_NO_URL, "Nenhuma URL especificada"}, { ER_POOL_SIZE_LESSTHAN_ONE, "O tamanho do conjunto \u00e9 menor que um!"}, { ER_INVALID_DRIVER, "Especificado nome de driver inv\u00e1lido!"}, { ER_NO_STYLESHEETROOT, "N\u00e3o encontrada a raiz da folha de estilo!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Valor inv\u00e1lido para xml:space"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode falhou"}, { ER_RESOURCE_COULD_NOT_LOAD, "O recurso [ {0} ] n\u00e3o p\u00f4de carregar: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Tamanho do buffer <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Erro desconhecido ao chamar a extens\u00e3o"}, { ER_NO_NAMESPACE_DECL, "O prefixo {0} n\u00e3o possui uma declara\u00e7\u00e3o do espa\u00e7o de nomes correspondente"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Conte\u00fado de elemento n\u00e3o permitido para lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Finaliza\u00e7\u00e3o direcionada por folha de estilo"}, { ER_ONE_OR_TWO, "1 ou 2"}, { ER_TWO_OR_THREE, "2 ou 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "N\u00e3o foi poss\u00edvel carregar {0} (verificar CLASSPATH); utilizando apenas os padr\u00f5es"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Imposs\u00edvel inicializar templates padr\u00e3o"}, { ER_RESULT_NULL, "O resultado n\u00e3o deve ser nulo"}, { ER_RESULT_COULD_NOT_BE_SET, "O resultado n\u00e3o p\u00f4de ser definido"}, { ER_NO_OUTPUT_SPECIFIED, "Nenhuma sa\u00edda especificada"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "N\u00e3o \u00e9 poss\u00edvel transformar em um Resultado do tipo {0} "}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "N\u00e3o \u00e9 poss\u00edvel transformar em uma Origem do tipo {0} "}, { ER_NULL_CONTENT_HANDLER, "Rotina de tratamento de conte\u00fado nula"}, { ER_NULL_ERROR_HANDLER, "Rotina de tratamento de erros nula"}, { ER_CANNOT_CALL_PARSE, "parse n\u00e3o pode ser chamado se ContentHandler n\u00e3o tiver sido definido"}, { ER_NO_PARENT_FOR_FILTER, "Nenhum pai para o filtro"}, { ER_NO_STYLESHEET_IN_MEDIA, "Nenhuma p\u00e1gina de estilo foi encontrada em: {0}, m\u00eddia= {1}"}, { ER_NO_STYLESHEET_PI, "Nenhum PI xml-stylesheet encontrado em: {0}"}, { ER_NOT_SUPPORTED, "N\u00e3o suportado: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "O valor para a propriedade {0} deve ser uma inst\u00e2ncia Booleana"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "N\u00e3o foi poss\u00edvel obter script externo em {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "O recurso [ {0} ] n\u00e3o p\u00f4de ser encontrado.\n{1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Propriedade de sa\u00edda n\u00e3o reconhecida: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Falha ao criar a inst\u00e2ncia ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "O valor para {0} deve conter um n\u00famero analis\u00e1vel"}, { ER_VALUE_SHOULD_EQUAL, "O valor de {0} deve ser igual a yes ou no"}, { ER_FAILED_CALLING_METHOD, "Falha ao chamar o m\u00e9todo {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "Falha ao criar a inst\u00e2ncia ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "N\u00e3o s\u00e3o permitidos caracteres neste ponto do documento"}, { ER_ATTR_NOT_ALLOWED, "O atributo \"{0}\" n\u00e3o \u00e9 permitido no elemento {1}!"}, { ER_BAD_VALUE, "{0} possui valor inv\u00e1lido {1}"}, { ER_ATTRIB_VALUE_NOT_FOUND, "Valor do atributo {0} n\u00e3o encontrado"}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Valor do atributo {0} n\u00e3o reconhecido"}, { ER_NULL_URI_NAMESPACE, "Tentando gerar um prefixo do espa\u00e7o de nomes com URI nulo"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Tentando formatar um n\u00famero superior ao maior inteiro Longo"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Imposs\u00edvel encontrar a classe de driver SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "Classe de driver SAX1 {0} encontrada, mas n\u00e3o pode ser carregada"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "Classe de driver SAX1 {0} carregada, mas n\u00e3o pode ser instanciada"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "A classe de driver SAX1 {0} n\u00e3o implementa org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Propriedade de sistema org.xml.sax.parser n\u00e3o especificada"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "O argumento Parser n\u00e3o deve ser nulo"}, { ER_FEATURE, "Recurso: {0}"}, { ER_PROPERTY, "Propriedade: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Solucionador de entidade nulo"}, { ER_NULL_DTD_HANDLER, "Rotina de tratamento DTD nula"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Nenhum Nome de Driver Especificado!"}, { ER_NO_URL_SPECIFIED, "Nenhuma URL Especificada!"}, { ER_POOLSIZE_LESS_THAN_ONE, "O tamanho do conjunto \u00e9 menor que 1!"}, { ER_INVALID_DRIVER_NAME, "Especificado Nome de Driver Inv\u00e1lido!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Erro do programador! A express\u00e3o n\u00e3o possui o pai ElemTemplateElement!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Declara\u00e7\u00e3o do programador em RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} n\u00e3o \u00e9 permitido nesta posi\u00e7\u00e3o na p\u00e1gina de estilo!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "O texto sem espa\u00e7o em branco n\u00e3o \u00e9 permitido nesta posi\u00e7\u00e3o na p\u00e1gina de estilo!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Valor inv\u00e1lido: {1} utilizado para o caractere CHAR: {0}. Um atributo de tipo CHAR deve ter apenas 1 caractere!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Valor inv\u00e1lido: {1} utilizado para o atributo QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Valor inv\u00e1lido: {1} utilizado para o atributo ENUM: {0}. Os valores v\u00e1lidos s\u00e3o: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Valor inv\u00e1lido: {1} utilizado para o atributo NMTOKEN: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Valor inv\u00e1lido: {1} utilizado para o atributo NCNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Valor inv\u00e1lido: {1} utilizado para o atributo boolean: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Valor inv\u00e1lido: {1} utilizado para o atributo number: {0}"}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argumento para {0} no padr\u00e3o de correspond\u00eancia deve ser um literal."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Declara\u00e7\u00e3o de vari\u00e1vel global duplicada."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Declara\u00e7\u00e3o de vari\u00e1vel duplicada."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template deve ter um atributo name ou match (ou ambos)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "O prefixo em exclude-result-prefixes n\u00e3o \u00e9 v\u00e1lido: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "O attribute-set {0} n\u00e3o existe"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "A fun\u00e7\u00e3o denominada {0} n\u00e3o existe"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "O elemento {0} n\u00e3o deve ter um conte\u00fado e um atributo de sele\u00e7\u00e3o ao mesmo tempo."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "O valor do par\u00e2metro {0} deve ser um Objeto Java v\u00e1lido"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "O atributo result-prefix de um elemento xsl:namespace-alias tem o valor '#default', mas n\u00e3o h\u00e1 nenhuma declara\u00e7\u00e3o do espa\u00e7o de nomes padr\u00e3o no escopo para o elemento"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "O atributo result-prefix de um elemento xsl:namespace-alias tem o valor ''{0}'', mas n\u00e3o h\u00e1 nenhuma declara\u00e7\u00e3o do espa\u00e7o de nomes para o prefixo ''{0}'' no escopo para o elemento."}, { ER_SET_FEATURE_NULL_NAME, "O nome do recurso n\u00e3o pode ser nulo em TransformerFactory.setFeature(String name, boolean value)."}, { ER_GET_FEATURE_NULL_NAME, "O nome do recurso n\u00e3o pode ser nulo em TransformerFactory.getFeature(String name)."}, { ER_UNSUPPORTED_FEATURE, "N\u00e3o \u00e9 poss\u00edvel definir o recurso ''{0}'' neste TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "O uso do elemento de extens\u00e3o ''{0}'' n\u00e3o \u00e9 permitido quando o recurso de processamento seguro \u00e9 definido como true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "N\u00e3o \u00e9 poss\u00edvel obter o prefixo para um uri de espa\u00e7o de nomes nulo."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "N\u00e3o \u00e9 poss\u00edvel obter o uri do espa\u00e7o de nomes para um prefixo nulo."}, { ER_XPATH_RESOLVER_NULL_QNAME, "O nome da fun\u00e7\u00e3o n\u00e3o pode ser nulo."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "O arity n\u00e3o pode ser negativo."}, // Warnings... { WG_FOUND_CURLYBRACE, "Encontrado '}', mas nenhum template de atributo aberto!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Aviso: o atributo count n\u00e3o corresponde a um predecessor em xsl:number! Destino = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Sintaxe antiga: O nome do atributo 'expr' foi alterado para 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan ainda n\u00e3o trata do nome de locale na fun\u00e7\u00e3o format-number."}, { WG_LOCALE_NOT_FOUND, "Aviso: N\u00e3o foi poss\u00edvel localizar o locale para xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Imposs\u00edvel criar URL a partir de: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Imposs\u00edvel carregar doc solicitado: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Imposs\u00edvel localizar Intercalador para >>>>>> Vers\u00e3o Xalan"}, { "version2", "<<<<<<<"}, { "yes", "sim"}, { "line", "Linha n\u00b0"}, { "column","Coluna n\u00b0"}, { "xsldone", "XSLProcessor: conclu\u00eddo"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Op\u00e7\u00f5es da classe Process da linha de comando de Xalan-J:"}, { "xslProc_option", "Op\u00e7\u00f5es da classe Process da linha de comandos de Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "A op\u00e7\u00e3o {0} n\u00e3o \u00e9 suportada no modo XSLTC."}, { "xslProc_invalid_xalan_option", "A op\u00e7\u00e3o {0} somente pode ser utilizada com -XSLTC."}, { "xslProc_no_input", "Erro: Nenhuma p\u00e1gina de estilo ou xml de entrada foi especificado. Execute este comando sem nenhuma op\u00e7\u00e3o para instru\u00e7\u00f5es de uso."}, { "xslProc_common_options", "-Op\u00e7\u00f5es Comuns-"}, { "xslProc_xalan_options", "-Op\u00e7\u00f5es para Xalan-"}, { "xslProc_xsltc_options", "-Op\u00e7\u00f5es para XSLTC-"}, { "xslProc_return_to_continue", "(pressione para continuar)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (utilizar XSLTC para transforma\u00e7\u00e3o)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER nome completo da classe do analisador liaison]"}, { "optionE", " [-E (N\u00e3o expandir refs de entidade)]"}, { "optionV", " [-E (N\u00e3o expandir refs de entidade)]"}, { "optionQC", " [-QC (Avisos de Conflitos de Padr\u00e3o Silencioso)]"}, { "optionQ", " [-Q (Modo Silencioso)]"}, { "optionLF", " [-LF (Utilizar avan\u00e7os de linha apenas na sa\u00edda {padr\u00e3o \u00e9 CR/LF})]"}, { "optionCR", " [-CR (Utilizar retornos de carro apenas na sa\u00edda {padr\u00e3o \u00e9 CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Quais caracteres de escape {padr\u00e3o \u00e9 <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Controlar como os espa\u00e7os s\u00e3o recuados {padr\u00e3o \u00e9 0})]"}, { "optionTT", " [-TT (Rastrear os templates enquanto est\u00e3o sendo chamados.)]"}, { "optionTG", " [-TG (Rastrear cada evento de gera\u00e7\u00e3o.)]"}, { "optionTS", " [-TS (Rastrear cada evento de sele\u00e7\u00e3o.)]"}, { "optionTTC", " [-TTC (Rastrear os filhos do modelo enquanto est\u00e3o sendo processados.)]"}, { "optionTCLASS", " [-TCLASS (Classe TraceListener para extens\u00f5es de rastreio.)]"}, { "optionVALIDATE", " [-VALIDATE (Definir se ocorrer valida\u00e7\u00e3o. A valida\u00e7\u00e3o fica desativada por padr\u00e3o.)]"}, { "optionEDUMP", " [-EDUMP {nome de arquivo opcional} (Executar stackdump sob erro.)]"}, { "optionXML", " [-XML (Utilizar formatador XML e incluir cabe\u00e7alho XML.)]"}, { "optionTEXT", " [-TEXT (Utilizar formatador de Texto simples.)]"}, { "optionHTML", " [-HTML (Utilizar formatador HTML.)]"}, { "optionPARAM", " [-PARAM express\u00e3o de nome (Definir um par\u00e2metro stylesheet)]"}, { "noParsermsg1", "O Processo XSL n\u00e3o obteve \u00eaxito."}, { "noParsermsg2", "** N\u00e3o foi poss\u00edvel encontrar o analisador **"}, { "noParsermsg3", "Verifique seu classpath."}, { "noParsermsg4", "Se voc\u00ea n\u00e3o tiver o XML Parser para Java da IBM, poder\u00e1 fazer o download dele a partir de"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER nome completo da classe (URIResolver a ser utilizado para resolver URIs)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER nome completo da classe (EntityResolver a ser utilizado para resolver entidades)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER nome completo da classe (ContentHandler a ser utilizado para serializar sa\u00edda)]"}, { "optionLINENUMBERS", " [-L utilizar n\u00fameros de linha para documento de origem]"}, { "optionSECUREPROCESSING", " [-SECURE (define o recurso de processamento seguro como true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (utilizar atributo de m\u00eddia para encontrar folha de estilo associada a um documento.)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (Utilizar explicitamente s2s=SAX ou d2d=DOM para executar transforma\u00e7\u00e3o.)]"}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Imprimir total de milissegundos que a transforma\u00e7\u00e3o gastou.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (pedir constru\u00e7\u00e3o incremental de DTM definindo http://xml.apache.org/xalan/features/incremental verdadeiro.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (n\u00e3o solicitar o processamento de otimiza\u00e7\u00e3o de folha de estilo definindo http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL recursionlimit (declarar limite num\u00e9rico em profundidade de recorr\u00eancia de folha de estilo.)]"}, { "optionXO", " [-XO [transletName] (atribuir nome ao translet gerado)]"}, { "optionXD", " [-XD destinationDirectory (especificar um diret\u00f3rio de destino para translet)]"}, { "optionXJ", " [-XJ jarfile (empacota classes translet em um arquivo jar denominado )]"}, { "optionXP", " [-XP package (especifica um prefixo de nome de pacote para todas as classes translet geradas)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (ativa a seq\u00fc\u00eancia de templates)]" }, { "optionXX", " [-XX (ativa a sa\u00edda de mensagem de depura\u00e7\u00e3o adicional)]"}, { "optionXT" , " [-XT (utilizar translet para transforma\u00e7\u00e3o, se poss\u00edvel)]"}, { "diagTiming"," --------- Transforma\u00e7\u00e3o de {0} via {1} levou {2} ms" }, { "recursionTooDeep","Aninhamento de templates muito extenso. aninhamento = {0}, template {1} {2}" }, { "nameIs", "o nome \u00e9" }, { "matchPatternIs", "o padr\u00e3o de correspond\u00eancia \u00e9" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Erro: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Aviso: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PADR\u00c3O "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("pt", "BR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_it.java0000644000175000017500000020663310721374031025041 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_it.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_it extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Errore: '{' non pu\u00f2 essere contenuto in un'espressione"}, { ER_ILLEGAL_ATTRIBUTE , "{0} ha un attributo non valido: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode nullo in xsl:apply-imports!"}, {ER_CANNOT_ADD, "Impossibile aggiungere {0} a {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode nullo in handleApplyTemplatesInstruction."}, { ER_NO_NAME_ATTRIB, "{0} deve avere un attributo name."}, {ER_TEMPLATE_NOT_FOUND, "Impossibile trovare la maschera: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Impossibile risolvere il nome AVT in xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} richiede l''''attributo: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} deve avere un attributo ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Valore errato nell''''attributo livello: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Il nome dell'istruzione di elaborazione non pu\u00f2 essere 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "il nome dell''''istruzione di elaborazione deve essere un NCName valido: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} deve avere un attributo match nel caso abbia un modo."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} richiede un attributo match o name."}, {ER_CANT_RESOLVE_NSPREFIX, "Impossibile risolvere il prefisso dello namespace: {0}"}, { ER_ILLEGAL_VALUE, "xml:space ha un valore non valido: {0}"}, { ER_NO_OWNERDOC, "Il nodo secondario non ha un documento proprietario."}, { ER_ELEMTEMPLATEELEM_ERR, "Errore ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "\u00c8 stato effettuato un tentativo di aggiungere un secondario nullo."}, { ER_NEED_SELECT_ATTRIB, "{0} richiede un attributo select."}, { ER_NEED_TEST_ATTRIB , "xsl:when deve avere un attributo 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param deve avere un attributo 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "il contesto non ha un documento proprietario."}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Impossibile creare XML TransformerFactory Liaison: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Processo non eseguito correttamente."}, { ER_NOT_SUCCESSFUL, "Xalan: non eseguito correttamente."}, { ER_ENCODING_NOT_SUPPORTED, "Codifica non supportata: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Impossibile creare TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key richiede un attributo 'name'."}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key richiede un attributo 'match'."}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key richiede un attributo 'use'."}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} richiede un attributo ''elements''."}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} attributo ''prefix'' mancante"}, { ER_BAD_STYLESHEET_URL, "URL del foglio di lavoro errato: {0}"}, { ER_FILE_NOT_FOUND, "File del foglio di lavoro non trovato: {0}"}, { ER_IOEXCEPTION, "Eccezione IO nel file del foglio di lavoro: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Impossibile trovare l''''attributo href per {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} sta direttamente o indirettamente includendo se stesso."}, { ER_PROCESSINCLUDE_ERROR, "Errore StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} attributo ''lang'' mancante"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) elemento {0} non ubicato correttamente. Elemento contenitore ''component'' mancante "}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "L'emissione \u00e8 consentita solo in un elemento, frammento di documento, documento o stampante."}, { ER_PROCESS_ERROR, "Errore StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Errore UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Errore! Impossibile trovare espressione selezione xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Impossibile serializzare XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "Input del foglio di lavoro non specificato."}, { ER_FAILED_PROCESS_STYLESHEET, "Impossibile elaborare il foglio di lavoro."}, { ER_COULDNT_PARSE_DOC, "Impossibile analizzare il documento {0}."}, { ER_COULDNT_FIND_FRAGMENT, "Impossibile trovare il frammento: {0}"}, { ER_NODE_NOT_ELEMENT, "Il nodo a cui fa riferimento l''''identificativo del frammento non \u00e8 un elemento: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each deve avere un attributo match o name"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "le maschere devono avere un attributo match o name"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Non \u00e8 possibile avere un clone di un frammento di documento."}, { ER_CANT_CREATE_ITEM, "Impossibile creare la voce nella struttura dei risultati: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space in XML di origine ha un valore non valido: {0}"}, { ER_NO_XSLKEY_DECLARATION, "Nessuna dichiarazione xsl:key per {0}!"}, { ER_CANT_CREATE_URL, "Errore! Impossibile creare url per: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions non supportato"}, { ER_PROCESSOR_ERROR, "Errore XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} non consentito nel foglio di lavoro."}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns non \u00e8 pi\u00f9 supportato. Utilizzare xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space non \u00e8 pi\u00f9 supportato. Utilizzare xsl:strip-space oppure xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result non \u00e8 pi\u00f9 supportato. Utilizzare xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} ha un attributo non valido: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Elemento XSL sconosciuto: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort pu\u00f2 essere utilizzato solo con xsl:apply-templates oppure xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when posizionato in modo non corretto."}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when non reso principale da xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise posizionato in modo non corretto."}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise non reso principale da xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} non \u00e8 consentito in una maschera."}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} prefisso namespace estensione {1} sconosciuto"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Le importazioni possono verificarsi solo come primi elementi nel foglio di lavoro."}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} sta direttamente o indirettamente importando se stesso."}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space ha un valore non valido: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet con esito negativo."}, { ER_SAX_EXCEPTION, "Eccezione SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Funzione non supportata."}, { ER_XSLT_ERROR, "Errore XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "il simbolo della valuta non \u00e8 consentito nella stringa modello formato."}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "La funzione documento non \u00e8 supportata nel DOM del foglio di lavoro."}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Impossibile risolvere il prefisso di un resolver non di prefisso."}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Redirect extension: Impossibile richiamare il nome file - l'attributo file o select deve restituire una stringa valida."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Impossibile creare FormatterListener in Redirect extension!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Prefisso in exclude-result-prefixes non valido: {0}"}, { ER_MISSING_NS_URI, "URI spazio nome mancante per il prefisso specificato"}, { ER_MISSING_ARG_FOR_OPTION, "Argomento mancante per l''''opzione: {0}"}, { ER_INVALID_OPTION, "Opzione non valida: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Stringa di formato errato: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet richiede un attributo 'version'."}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "L''attributo: {0} ha un valore non valido: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose richiede xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports non consentito in xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Impossibile utilizzare DTMLiaison per un nodo DOM di output... utilizzare invece org.apache.xpath.DOM2Helper."}, { ER_CANT_USE_DTM_FOR_INPUT, "Impossibile utilizzare DTMLiaison per un nodo DON di input... utilizzare invece org.apache.xpath.DOM2Helper."}, { ER_CALL_TO_EXT_FAILED, "Chiamata all''''elemento estensione non riuscita: {0}"}, { ER_PREFIX_MUST_RESOLVE, "Il prefisso deve risolvere in uno namespace: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Rilevato surrogato UTF-16 non valido: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} sta utilizzando se stesso, determinando un loop infinito."}, { ER_CANNOT_MIX_XERCESDOM, "Impossibile unire input non Xerces-DOM con output Xerces-DOM."}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "In ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Sono state rilevate pi\u00f9 maschere denominate: {0}"}, { ER_INVALID_KEY_CALL, "Chiamata funzione non valida: le chiamate key() ricorsive non sono consentite"}, { ER_REFERENCING_ITSELF, "La variabile {0} sta direttamente o indirettamente facendo riferimento a se stessa."}, { ER_ILLEGAL_DOMSOURCE_INPUT, "Il nodo di input non pu\u00f2 essere nullo per DOMSource per newTemplates."}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "File di classe non trovato per l''opzione {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Elemento richiesto non trovato: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream non pu\u00f2 essere nullo"}, { ER_URI_CANNOT_BE_NULL, "URI non pu\u00f2 essere nullo"}, { ER_FILE_CANNOT_BE_NULL, "File non pu\u00f2 essere nullo"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource non pu\u00f2 essere nullo"}, { ER_CANNOT_INIT_BSFMGR, "Impossibile inizializzare BSF Manager"}, { ER_CANNOT_CMPL_EXTENSN, "Impossibile compilare l'estensione"}, { ER_CANNOT_CREATE_EXTENSN, "Impossibile creare l''''estensione: {0} a causa di: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "La chiamata metodo istanza al metodo {0} richiede un''istanza Object come primo argomento"}, { ER_INVALID_ELEMENT_NAME, "Specificato nome elemento non valido{0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "Il metodo nome elemento deve essere statico {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Funzione estensione {0} : {1} sconosciuta"}, { ER_MORE_MATCH_CONSTRUCTOR, "\u00c8 stata trovata pi\u00f9 di una corrispondenza migliore per il costruttore per {0}"}, { ER_MORE_MATCH_METHOD, "\u00c8 stata trovata pi\u00f9 di una corrispondenza migliore per il metodo {0}"}, { ER_MORE_MATCH_ELEMENT, "\u00c8 stata trovata pi\u00f9 di una corrispondenza migliore per il metodo elemento {0}"}, { ER_INVALID_CONTEXT_PASSED, "Specificato contesto non valido per valutare {0}"}, { ER_POOL_EXISTS, "Pool gi\u00e0 esistente"}, { ER_NO_DRIVER_NAME, "Non \u00e8 stato specificato alcun Nome driver"}, { ER_NO_URL, "Non \u00e8 stata specificata alcuna URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "La dimensione del pool \u00e8 inferiore a uno."}, { ER_INVALID_DRIVER, "Specificato nome driver non valido."}, { ER_NO_STYLESHEETROOT, "Impossibile trovare la root del foglio di lavoro."}, { ER_ILLEGAL_XMLSPACE_VALUE, "Valore non valido per xml:space"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode non riuscito"}, { ER_RESOURCE_COULD_NOT_LOAD, "Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Dimensione buffer <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Errore sconosciuto durante la chiamata all'estensione"}, { ER_NO_NAMESPACE_DECL, "Il prefisso {0} non ha una dichiarazione namaspace corrispondente"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Contenuto elemento non consentito per lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Il foglio di lavoro ha indirizzato l'interruzione"}, { ER_ONE_OR_TWO, "1 o 2"}, { ER_TWO_OR_THREE, "2 o 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Impossibile caricare {0} (controllare CLASSPATH), verranno utilizzati i valori predefiniti."}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Impossibile inizializzare le maschere predefinite"}, { ER_RESULT_NULL, "Il risultato non pu\u00f2 essere nullo"}, { ER_RESULT_COULD_NOT_BE_SET, "Impossibile impostare il risultato"}, { ER_NO_OUTPUT_SPECIFIED, "Non \u00e8 stato specificato alcun output"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Impossibile trasformare in un risultato di tipo {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Impossibile trasformare in un''origine di tipo {0}"}, { ER_NULL_CONTENT_HANDLER, "Handler contenuto nullo"}, { ER_NULL_ERROR_HANDLER, "Handler errori nullo"}, { ER_CANNOT_CALL_PARSE, "non \u00e8 possibile richiamare l'analisi se ContentHandler non \u00e8 stato impostato"}, { ER_NO_PARENT_FOR_FILTER, "Nessun principale per il filtro"}, { ER_NO_STYLESHEET_IN_MEDIA, "Nessun foglio di lavoro trovato in: {0}, supporto= {1}"}, { ER_NO_STYLESHEET_PI, "Nessun PI xml-stylesheet trovato in: {0}"}, { ER_NOT_SUPPORTED, "Non supportato: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Il valore della propriet\u00e0 {0} deve essere una istanza booleana"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Impossibile richiamare lo script esterno in {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "Risorsa [ {0} ] non trovata.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Propriet\u00e0 Output non riconosciuta: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Creazione dell'istanza ElemLiteralResult non riuscita"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Il valore di {0} deve contenere un numero analizzabile"}, { ER_VALUE_SHOULD_EQUAL, "Il valore di {0} deve essere uguale a yes o no"}, { ER_FAILED_CALLING_METHOD, "Chiamata al metodo {0} non riuscita"}, { ER_FAILED_CREATING_ELEMTMPL, "Creazione dell'istanza ElemTemplateElement non riuscita"}, { ER_CHARS_NOT_ALLOWED, "I caratteri non sono consentiti in questo punto del documento"}, { ER_ATTR_NOT_ALLOWED, "L''''attributo \"{0}\" non \u00e8 consentito nell''''elemento {1}."}, { ER_BAD_VALUE, "{0} valore errato {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "Valore attributo {0} non trovato "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Valore attributo {0} non riconosciuto "}, { ER_NULL_URI_NAMESPACE, "\u00c8 stato effettuato un tentativo di generare un prefisso spazio nome con un URI nullo"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Si sta effettuando un tentativo di formattare un numero superiore all'intero Long pi\u00f9 grande"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Impossibile trovare la classe driver SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "La classe driver SAX1 {0} \u00e8 stata trovata ma non \u00e8 stato possibile caricarla"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "La classe driver SAX1 {0} \u00e8 stata caricata ma non \u00e8 stato possibile istanziarla"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "La classe driver SAX1 {0} non implementa org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Propriet\u00e0 di sistema org.xml.sax.parser non specificata"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "L'argomento Parser non pu\u00f2 essere nullo"}, { ER_FEATURE, "Funzione: {0}"}, { ER_PROPERTY, "Propriet\u00e0: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Resolver entit\u00e0 nullo"}, { ER_NULL_DTD_HANDLER, "Handler DTD nullo"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Non \u00e8 stato specificato alcun nome driver."}, { ER_NO_URL_SPECIFIED, "Non \u00e8 stato specificato alcun URL."}, { ER_POOLSIZE_LESS_THAN_ONE, "La dimensione del pool \u00e8 inferiore a 1."}, { ER_INVALID_DRIVER_NAME, "Specificato nome driver non valido."}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Errore di programmazione. Espressione senza ElemTemplateElement principale"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Asserzione del programmatore in RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0}non \u00e8 consentito in questa posizione in stylesheet"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Testo Non-whitespace non consentito in questa posizione in stylesheet"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Valore non valido: {1} utilizzato per l''''attributo CHAR: {0}. Un attributo di tipo CHAR deve essere di 1 solo carattere."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Valore non valido: {1} utilizzato per l''''attributo QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Valore non valido: {1} utilizzato per l''''attributo ENUM: {0}. I valori validi sono: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Valore non valido: {1} utilizzato per l''''attributo NMTOKEN: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Valore non valido: {1} utilizzato per l''''attributo NCNAME: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Valore non valido: {1} utilizzato per l''''attributo boolean: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Valore non valido: {1} utilizzato per l''''attributo number: {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "L''''argomento di {0} nel modello di corrispondenza deve essere letterale."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Dichiarazione di variabile globale duplicata."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Dichiarazione di variabile duplicata."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template deve avere un attributo name oppure match (o entrambi)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Prefisso in exclude-result-prefixes non valido: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set denominato {0} non esiste"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "La funzione {0} indicata non esiste"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "L''''elemento {0} non deve avere sia un attributo content o selection."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "Il valore del parametro {0} deve essere un oggetto Java valido"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "L'attributo result-prefix si un elemento xsl:namespace-alias ha il valore '#default', ma non c'\u00e8 dichiarazione dello spazio nome predefinito nell'ambito per l'elemento"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "L''attributo result-prefix di un elemento xsl:namespace-alias ha il valore ''{0}'', ma non c''\u00e8 dichiarazione dello spazio per il prefisso ''{0}'' nell''ambito per l''elemento."}, { ER_SET_FEATURE_NULL_NAME, "Il nome della funzione non pu\u00f2 essere nullo in TransformerFactory.setFeature(Nome stringa, valore booleano)."}, { ER_GET_FEATURE_NULL_NAME, "Il nome della funzione non pu\u00f2 essere nullo in TransformerFactory.getFeature(Nome stringa)."}, { ER_UNSUPPORTED_FEATURE, "Impossibile impostare la funzione ''{0}'' su questo TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "L''''utilizzo di un elemento di estensione ''{0}'' non \u00e8 consentito quando la funzione di elaborazione sicura \u00e8 impostata su true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Impossibile ottenere il prefisso per un uri dello spazio nome nullo."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Impossibile ottenere l'uri dello spazio nome per il prefisso null."}, { ER_XPATH_RESOLVER_NULL_QNAME, "Il nome della funzione non pu\u00f2 essere null."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Arity non pu\u00f2 essere negativo."}, // Warnings... { WG_FOUND_CURLYBRACE, "Rilevato '}' senza una maschera attributo aperta."}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Attenzione: l''attributo count non corrisponde ad un predecessore in xsl:number! Destinazione = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Sintassi obsoleta: Il nome dell'attributo 'expr' \u00e8 stato modificato in 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan non gestisce ancora il nome locale nella funzione formato-numero."}, { WG_LOCALE_NOT_FOUND, "Attenzione: Impossibile trovare la locale per xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Impossibile ricavare l''''URL da: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Impossibile caricare il documento richiesto: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Impossibile trovare Collator per >>>>>> Versione Xalan "}, { "version2", "<<<<<<<"}, { "yes", "s\u00ec"}, { "line", "Riga #"}, { "column","Colonna #"}, { "xsldone", "XSLProcessor: eseguito"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Opzioni classe Process riga comandi Xalan-J:"}, { "xslProc_option", "Opzioni classe Process riga comandi Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "Opzione {0} non supportata in modalit\u00e0."}, { "xslProc_invalid_xalan_option", "L''''opzione {0} pu\u00f2 essere utilizzata solo con -XSLTC."}, { "xslProc_no_input", "Errore: Nessun foglio di lavoro o xml di immissione specificato. Eseguire questo comando senza opzioni per istruzioni sull'utilizzo."}, { "xslProc_common_options", "-Opzioni comuni-"}, { "xslProc_xalan_options", "-Opzioni per Xalan-"}, { "xslProc_xsltc_options", "-Opzioni per XSLTC-"}, { "xslProc_return_to_continue", "(premere per continuare)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (utilizza XSLTC per la trasformazioni)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER nome classe completo del collegamento parser]"}, { "optionE", " [-E (non espandere i riferimenti entit\u00e0)]"}, { "optionV", " [-E (non espandere i riferimenti entit\u00e0)]"}, { "optionQC", " [-QC (Silenziamento avvertenze conflitti modelli)]"}, { "optionQ", " [-Q (Modo silenzioso)]"}, { "optionLF", " [-LF (Utilizza il caricamento riga solo sull'output {valore predefinito: CR/LF})]"}, { "optionCR", " [-CR (Utilizza il ritorno a capo solo sull'output {valore predefinito: CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (specifica quali caratteri saltare {valore predefinito: <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Controlla il numero dei rientri {valore predefinito: 0})]"}, { "optionTT", " [-TT (Traccia le maschere quando vengono richiamate.)]"}, { "optionTG", " [-TG (Traccia ogni evento di generazione.)]"}, { "optionTS", " [-TS (Traccia ogni evento di selezione.)]"}, { "optionTTC", " [-TTC (Traccia il secondario della maschera quando viene elaborato.)]"}, { "optionTCLASS", " [-TCLASS (classe TraceListener per le estensioni di traccia.)]"}, { "optionVALIDATE", " [-VALIDATE (Imposta se eseguire la convalida. Il valore predefinito per la convalida \u00e8 disattivato.)]"}, { "optionEDUMP", " [-EDUMP {nome file facoltativo} (Eseguire stackdump in caso di errori.)]"}, { "optionXML", " [-XML (Utilizza la formattazione XML e aggiunge intestazione XML.)]"}, { "optionTEXT", " [-TEXT (Utilizza la formattazione Testo semplice.)]"}, { "optionHTML", " [-HTML (Utilizza la formattazione HTML.)]"}, { "optionPARAM", " [-PARAM nome espressione (imposta un parametro del foglio di lavoro)]"}, { "noParsermsg1", "Elaborazione XSL non riuscita."}, { "noParsermsg2", "** Impossibile trovare il parser **"}, { "noParsermsg3", "Controllare il classpath."}, { "noParsermsg4", "Se non si possiede IBM XML Parser per Java, \u00e8 possibile scaricarlo da"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER nome classe completo (URIResolver da utilizzare per risolvere gli URI)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER nome classe completo (EntityResolver da utilizzare per risolvere le entit\u00e0)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER nome classe completo (ContentHandler da utilizzare per serializzare l'output)]"}, { "optionLINENUMBERS", " [-L utilizza i numeri riga per il documento di origine]"}, { "optionSECUREPROCESSING", " [-SECURE (imposta la funzione di elaborazione sicura su true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (utilizza l'attributo media per individuare il foglio di lavoro associato ad un documento.)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (Utilizza in modo esplicito s2s=SAX oppure d2d=DOM per eseguire la trasformazione.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Visualizza il tempo impiegato in millisecondi per la trasformazione.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (richiede la costruzione DTM incrementale impostando http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (non richiede alcuna elaborazione di ottimizzazione del foglio di lavoro impostando http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL recursionlimit (limite numerico asserzioni nella profondit\u00e0 ricorsiva del foglio di lavoro.)]"}, { "optionXO", " [-XO [transletName] (assegna il nome al translet generato)]"}, { "optionXD", " [-XD destinationDirectory (specifica una directory di destinazione per il translet)]"}, { "optionXJ", " [-XJ jarfile (raggruppa la classi translet in un file jar di nome )]"}, { "optionXP", " [-XP package (specifica un prefisso di nome pacchetto per tutte le classi translet generate)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (abilita l'allineamento della maschera)]" }, { "optionXX", " [-XX (attiva ulteriori emissioni di messaggi di debug)]"}, { "optionXT" , " [-XT (utilizza il translet per la trasformazione, se possibile)]"}, { "diagTiming"," --------- La trasformazione di {0} utilizzando {1} ha impiegato {2} ms" }, { "recursionTooDeep","Nidificazione della maschera troppo elevata. nesting = {0}, maschera {1} {2}" }, { "nameIs", "il nome \u00e8" }, { "matchPatternIs", "il modello di corrispondenza \u00e8" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Errore: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Avvertenza: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "MODELLO "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("it", "IT")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_ru.java0000644000175000017500000034237510721374031025057 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_ru.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_ru extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "\u041e\u0448\u0438\u0431\u043a\u0430: \u0421\u043a\u043e\u0431\u043a\u0430 '{' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430 \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438"}, { ER_ILLEGAL_ATTRIBUTE , "\u0414\u043b\u044f {0} \u0443\u043a\u0430\u0437\u0430\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "\u041f\u0443\u0441\u0442\u043e\u0439 sourceNode \u0432 xsl:apply-imports!"}, {ER_CANNOT_ADD, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c {0} \u0432 {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "\u041f\u0443\u0441\u0442\u043e\u0439 sourceNode \u0432 handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "\u0423 {0} \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 name"}, {ER_TEMPLATE_NOT_FOUND, "\u0423\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f AVT \u0432 xsl:call-template."}, {ER_REQUIRES_ATTRIB, "\u0414\u043b\u044f {0} \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''test''. "}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0443\u0440\u043e\u0432\u043d\u044f: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "\u0418\u043c\u044f processing-instruction \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "\u0418\u043c\u044f processing-instruction \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c NCName: {0}"}, { ER_NEED_MATCH_ATTRIB, "\u0415\u0441\u043b\u0438 \u0434\u043b\u044f {0} \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0440\u0435\u0436\u0438\u043c, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 match."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "\u0423 {0} \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 name \u0438\u043b\u0438 match."}, {ER_CANT_RESOLVE_NSPREFIX, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d: {0}"}, { ER_ILLEGAL_VALUE, "\u0412 xml:space \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435: {0}"}, { ER_NO_OWNERDOC, "\u0423 \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u0443\u0437\u043b\u0430 \u043d\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430-\u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430!"}, { ER_ELEMTEMPLATEELEM_ERR, "\u041e\u0448\u0438\u0431\u043a\u0430 ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u0430!"}, { ER_NEED_SELECT_ATTRIB, "\u0423 {0} \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 select."}, { ER_NEED_TEST_ATTRIB , "\u0414\u043b\u044f xsl:when \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'test'."}, { ER_NEED_NAME_ATTRIB, "\u0414\u043b\u044f xsl:with-param \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442-\u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c XML TransformerFactory Liaison: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043e\u0448\u0438\u0431\u043a\u0438."}, { ER_NOT_SUCCESSFUL, "Xalan: \u041e\u0448\u0438\u0431\u043a\u0430."}, { ER_ENCODING_NOT_SUPPORTED, "\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "\u0414\u043b\u044f xsl:key \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'name'!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "\u0414\u043b\u044f xsl:key \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'match'!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "\u0414\u043b\u044f xsl:key \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'use'!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "\u0414\u043b\u044f (StylesheetHandler) {0} \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''elements''!"}, { ER_MISSING_PREFIX_ATTRIB, "\u0414\u043b\u044f (StylesheetHandler) {0} \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''prefix''"}, { ER_BAD_STYLESHEET_URL, "\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 URL \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439: {0}"}, { ER_FILE_NOT_FOUND, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0444\u0430\u0439\u043b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439: {0}"}, { ER_IOEXCEPTION, "\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0444\u0430\u0439\u043b\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) \u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 href \u0434\u043b\u044f {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u043b\u0438 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0431\u044f!"}, { ER_PROCESSINCLUDE_ERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "\u0414\u043b\u044f (StylesheetHandler) {0} \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 ''lang''"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) \u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 {0} ?? \u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "\u0412\u044b\u0432\u043e\u0434 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b: Element, DocumentFragment, Document \u0438\u043b\u0438 PrintWriter."}, { ER_PROCESS_ERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "\u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_FAILED_PROCESS_STYLESHEET, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_COULDNT_PARSE_DOC, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 {0} !"}, { ER_COULDNT_FIND_FRAGMENT, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442: {0}"}, { ER_NODE_NOT_ELEMENT, "\u0423\u0437\u0435\u043b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430, \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "\u0423 for-each \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 match \u0438\u043b\u0438 name"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "\u0423 templates \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 match \u0438\u043b\u0438 name"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043f\u0438\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430!"}, { ER_CANT_CREATE_ITEM, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u0435\u0440\u0435\u0432\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "\u0417\u0430\u0434\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 xml:space \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c XML: {0}"}, { ER_NO_XSLKEY_DECLARATION, "\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 xsl:key \u0434\u043b\u044f {0}!"}, { ER_CANT_CREATE_URL, "\u041e\u0448\u0438\u0431\u043a\u0430! \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c URL \u0434\u043b\u044f {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f"}, { ER_PROCESSOR_ERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 xsl:strip-space \u0438\u043b\u0438 xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) \u0414\u043b\u044f {0} \u0443\u043a\u0430\u0437\u0430\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442: {1}"}, { ER_UNKNOWN_XSL_ELEM, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 XSL: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 xsl:apply-templates \u0438\u043b\u0438 xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) \u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 xsl:when!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) \u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 xsl:otherwise!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 {1} \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f {0}"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Imports \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u043b\u0438 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0431\u044f!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) \u0414\u043b\u044f xml:space \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "\u041e\u0448\u0438\u0431\u043a\u0430 processStylesheet!"}, { ER_SAX_EXCEPTION, "\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f!"}, { ER_XSLT_ERROR, "\u041e\u0448\u0438\u0431\u043a\u0430 XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "\u0421\u0438\u043c\u0432\u043e\u043b \u0434\u0435\u043d\u0435\u0436\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 DOM \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f non-Prefix!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 - \u0430\u0442\u0440\u0438\u0431\u0443\u0442 file \u0438\u043b\u0438 select \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c FormatterListener \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0432 exclude-result-prefixes: {0}"}, { ER_MISSING_NS_URI, "\u0414\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 URI \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d"}, { ER_MISSING_ARG_FOR_OPTION, "\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043e\u043f\u0446\u0438\u0438: {0}"}, { ER_INVALID_OPTION, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u0430\u044f \u043e\u043f\u0446\u0438\u044f: {0}"}, { ER_MALFORMED_FORMAT_STRING, "\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "\u0414\u043b\u044f xsl:stylesheet \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 'version'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442: \u0412 {0} \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "\u0414\u043b\u044f xsl:choose \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "\u041d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c DTMLiaison \u0434\u043b\u044f \u0443\u0437\u043b\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 DOM ... \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 org.apache.xpath.DOM2Helper!"}, { ER_CANT_USE_DTM_FOR_INPUT, "\u041d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c DTMLiaison \u0434\u043b\u044f \u0443\u0437\u043b\u0430 \u0432\u0432\u043e\u0434\u0430 DOM ... \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 org.apache.xpath.DOM2Helper!"}, { ER_CALL_TO_EXT_FAILED, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f: {0}"}, { ER_PREFIX_MUST_RESOLVE, "\u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d: {0}"}, { ER_INVALID_UTF16_SURROGATE, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 UTF-16: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0435\u0431\u044f, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430."}, { ER_CANNOT_MIX_XERCESDOM, "\u041d\u0435\u043b\u044c\u0437\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0432\u043e\u0434 \u043d\u0435-Xerces-DOM \u0438 \u0432\u044b\u0432\u043e\u0434 Xerces-DOM!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "\u0412 ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c: {0}"}, { ER_INVALID_KEY_CALL, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b key() \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b"}, { ER_REFERENCING_ITSELF, "\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f {0} \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u043b\u0438 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0431\u044f!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "\u0414\u043b\u044f DOMSource \u0432 newTemplates \u0443\u0437\u0435\u043b \u0432\u0432\u043e\u0434\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0444\u0430\u0439\u043b \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u043e\u043f\u0446\u0438\u0438 {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_URI_CANNOT_BE_NULL, "URI \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_FILE_CANNOT_BE_NULL, "\u0424\u0430\u0439\u043b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_CANNOT_INIT_BSFMGR, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 BSF"}, { ER_CANNOT_CMPL_EXTENSN, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435"}, { ER_CANNOT_CREATE_EXTENSN, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435: {0}, \u043f\u0440\u0438\u0447\u0438\u043d\u0430: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 {0} \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430"}, { ER_INVALID_ELEMENT_NAME, "\u0423\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0438\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "\u041c\u0435\u0442\u043e\u0434 name \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f {0} : {1}"}, { ER_MORE_MATCH_CONSTRUCTOR, "\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 {0}"}, { ER_MORE_MATCH_METHOD, "\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0443\u0447\u0448\u0438\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 {0}"}, { ER_MORE_MATCH_ELEMENT, "\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0443\u0447\u0448\u0438\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 {0}"}, { ER_INVALID_CONTEXT_PASSED, "\u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 {0}"}, { ER_POOL_EXISTS, "\u041f\u0443\u043b \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442"}, { ER_NO_DRIVER_NAME, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043c\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430"}, { ER_NO_URL, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0443\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b!"}, { ER_INVALID_DRIVER, "\u0423\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0438\u043c\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430!"}, { ER_NO_STYLESHEETROOT, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 xml:space"}, { ER_PROCESSFROMNODE_FAILED, "\u041e\u0448\u0438\u0431\u043a\u0430 processFromNode"}, { ER_RESOURCE_COULD_NOT_LOAD, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441 [ {0} ]: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f"}, { ER_NO_NAMESPACE_DECL, "\u0423 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 {0} \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0434\u043b\u044f lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "\u041f\u0440\u0435\u0440\u0432\u0430\u043d\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0442\u0438\u043b\u0435\u0439"}, { ER_ONE_OR_TWO, "1 \u0438\u043b\u0438 2"}, { ER_TWO_OR_THREE, "2 \u0438\u043b\u0438 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c {0} (\u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 CLASSPATH), \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e"}, { ER_RESULT_NULL, "\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_RESULT_COULD_NOT_BE_SET, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442"}, { ER_NO_OUTPUT_SPECIFIED, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0432\u044b\u0432\u043e\u0434"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0438\u043f\u0430 {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0442\u0438\u043f\u0430 {0}"}, { ER_NULL_CONTENT_HANDLER, "\u041f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f"}, { ER_NULL_ERROR_HANDLER, "\u041f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043a\u0438"}, { ER_CANNOT_CALL_PARSE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d ContentHandler"}, { ER_NO_PARENT_FOR_FILTER, "\u041d\u0435 \u0437\u0430\u0434\u0430\u043d \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430"}, { ER_NO_STYLESHEET_IN_MEDIA, "\u0412 {0} \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0442\u0438\u043b\u0435\u0439, \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c={1}"}, { ER_NO_STYLESHEET_PI, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d PI xml-stylesheet \u0432 {0}"}, { ER_NOT_SUPPORTED, "\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 {0} \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c Boolean"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0432 {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "\u0420\u0435\u0441\u0443\u0440\u0441 [ {0} ] \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043e: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {0} \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c"}, { ER_VALUE_SHOULD_EQUAL, "\u0412 {0} \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 yes \u0438\u043b\u0438 no"}, { ER_FAILED_CALLING_METHOD, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "\u0421\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430"}, { ER_ATTR_NOT_ALLOWED, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 \"{0}\" \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 {1}!"}, { ER_BAD_VALUE, "{0} \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 {0} "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 {0} \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043e "}, { ER_NULL_URI_NAMESPACE, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0441 \u043f\u0443\u0441\u0442\u044b\u043c URI"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e LongInteger"}, { ER_CANNOT_FIND_SAX1_DRIVER, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u043b\u0430\u0441\u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "\u041a\u043b\u0430\u0441\u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 SAX1 {0} \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d, \u043d\u043e \u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "\u041a\u043b\u0430\u0441\u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 SAX1 {0} \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d, \u043d\u043e \u0435\u0433\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 SAX1 {0} \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "\u041d\u0435 \u0437\u0430\u0434\u0430\u043d\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e org.xml.sax.parser"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c"}, { ER_FEATURE, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f: {0}"}, { ER_PROPERTY, "\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e: {0}"}, { ER_NULL_ENTITY_RESOLVER, "\u041f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u0430\u043a\u0440\u043e\u0441\u0430"}, { ER_NULL_DTD_HANDLER, "\u041f\u0443\u0441\u0442\u043e\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 DTD"}, { ER_NO_DRIVER_NAME_SPECIFIED, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043c\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430!"}, { ER_NO_URL_SPECIFIED, "\u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d URL!"}, { ER_POOLSIZE_LESS_THAN_ONE, "\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0443\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 1!"}, { ER_INVALID_DRIVER_NAME, "\u0423\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0438\u043c\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430! \u0423 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 ElemTemplateElement!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "\u0417\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u0432 RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "\u0422\u0435\u043a\u0441\u0442 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 CHAR: {0}. \u0410\u0442\u0440\u0438\u0431\u0443\u0442 \u0442\u0438\u043f\u0430 CHAR \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0441\u0438\u043c\u0432\u043e\u043b!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 ENUM: {0}. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 NMTOKEN: {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 NCNAME: {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 boolean: {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 {1} \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 number: {0}. "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 {0} \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u043c."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "\u0414\u043b\u044f xsl:template \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 name \u0438\u043b\u0438 match, \u043b\u0438\u0431\u043e \u043e\u0431\u0430 \u044d\u0442\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0432 exclude-result-prefixes: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set \u0441 \u0438\u043c\u0435\u043d\u0435\u043c {0} \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c {0} \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "\u0414\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 {0} \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0438 \u0432\u044b\u0431\u043e\u0440\u0430. "}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 {0} \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c Java"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 result-prefix \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 xsl:namespace-alias \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 '#default', \u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "\u0410\u0442\u0440\u0438\u0431\u0443\u0442 result-prefix \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 xsl:namespace-alias \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ''{0}'', \u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 ''{0}'' \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e. "}, { ER_SET_FEATURE_NULL_NAME, "\u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c \u0432 TransformerFactory.setFeature(\u0418\u043c\u044f \u0441\u0442\u0440\u043e\u043a\u0438, \u0431\u0443\u043b\u0435\u0432\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435). "}, { ER_GET_FEATURE_NULL_NAME, "\u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c \u0432 TransformerFactory.getFeature(\u0418\u043c\u044f \u0441\u0442\u0440\u043e\u043a\u0438). "}, { ER_UNSUPPORTED_FEATURE, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e ''{0}'' \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 TransformerFactory. "}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ''{0}'' \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true. "}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0434\u043b\u044f uri \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d. "}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 uri \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430. "}, { ER_XPATH_RESOLVER_NULL_QNAME, "\u0418\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c. "}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "\u0427\u0438\u0441\u043b\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c. "}, // Warnings... { WG_FOUND_CURLYBRACE, "\u041d\u0430\u0439\u0434\u0435\u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u043a\u043e\u0431\u043a\u0430 '}', \u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: \u0410\u0442\u0440\u0438\u0431\u0443\u0442 count \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u0432 xsl:number! \u0426\u0435\u043b\u0435\u0432\u043e\u0439 = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "\u0421\u0442\u0430\u0440\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441: \u0418\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 'expr' \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0430 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan \u0435\u0449\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043b\u043e\u043a\u0430\u043b\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 format-number."}, { WG_LOCALE_NOT_FOUND, "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: \u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c \u0434\u043b\u044f xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c URL \u0438\u0437: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442: {0}"}, { WG_CANNOT_FIND_COLLATOR, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 Collator \u0434\u043b\u044f >>>>>> \u0412\u0435\u0440\u0441\u0438\u044f Xalan "}, { "version2", "<<<<<<<"}, { "yes", "\u0434\u0430"}, { "line", "\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 "}, { "column","\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 "}, { "xsldone", "XSLProcessor: \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "\u041e\u043f\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Xalan-J:"}, { "xslProc_option", "\u041e\u043f\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "\u041e\u043f\u0446\u0438\u044f {0} \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 XSLTC."}, { "xslProc_invalid_xalan_option", "\u041e\u043f\u0446\u0438\u044f {0} \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 -XSLTC."}, { "xslProc_no_input", "\u041e\u0448\u0438\u0431\u043a\u0430: \u041d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b xml. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0441\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432."}, { "xslProc_common_options", "-\u041e\u0431\u0449\u0438\u0435 \u043e\u043f\u0446\u0438\u0438-"}, { "xslProc_xalan_options", "-\u041e\u043f\u0446\u0438\u0438 Xalan-"}, { "xslProc_xsltc_options", "-\u041e\u043f\u0446\u0438\u0438 XSLTC-"}, { "xslProc_return_to_continue", "(\u0414\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0436\u043c\u0438\u0442\u0435 )"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (\u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 XSLTC)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430]"}, { "optionE", " [-E (\u041d\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043c\u0430\u043a\u0440\u043e\u0441\u044b entity)]"}, { "optionV", " [-E (\u041d\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043c\u0430\u043a\u0440\u043e\u0441\u044b entity)]"}, { "optionQC", " [-QC (\u041d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432)]"}, { "optionQ", " [-Q (\u0422\u0438\u0445\u0438\u0439 \u0440\u0435\u0436\u0438\u043c)]"}, { "optionLF", " [-LF (\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e LF {\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - CR/LF})]"}, { "optionCR", " [-CR (\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e CR {\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (\u0421\u0438\u043c\u0432\u043e\u043b\u044b, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0435 Esc-\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 {\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (\u0427\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0432 \u043e\u0442\u0441\u0442\u0443\u043f\u0435 {\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - 0})]"}, { "optionTT", " [-TT (\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.)]"}, { "optionTG", " [-TG (\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f.)]"}, { "optionTS", " [-TS (\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u044b\u0431\u043e\u0440\u0430.)]"}, { "optionTTC", " [-TTC (\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.)]"}, { "optionTCLASS", " [-TCLASS (\u041a\u043b\u0430\u0441\u0441 TraceListener \u0434\u043b\u044f \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439.)]"}, { "optionVALIDATE", " [-VALIDATE (\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0430.)]"}, { "optionEDUMP", " [-EDUMP {\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430} (\u0414\u0430\u043c\u043f \u0441\u0442\u0435\u043a\u0430 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435.)]"}, { "optionXML", " [-XML (\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 XML \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a XML.)]"}, { "optionTEXT", " [-TEXT (\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.)]"}, { "optionHTML", " [-HTML (\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 HTML.)]"}, { "optionPARAM", " [-PARAM \u0438\u043c\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u0417\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439)]"}, { "noParsermsg1", "\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 XSL \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u044b \u043e\u0448\u0438\u0431\u043a\u0438."}, { "noParsermsg2", "** \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d **"}, { "noParsermsg3", "\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 classpath."}, { "noParsermsg4", "\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 XML Parser for Java \u0444\u0438\u0440\u043c\u044b IBM, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0441\u0430\u0439\u0442\u0430"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 (URIResolver \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f URL)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 (EntityResolver \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 (ContentHandler \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0430)]"}, { "optionLINENUMBERS", " [-L \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u043e\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430]"}, { "optionSECUREPROCESSING", " [-SECURE (\u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA \u0442\u0438\u043f-\u043d\u043e\u0441\u0438\u0442. (\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439.)]"}, { "optionFLAVOR", " [-FLAVOR \u0438\u043c\u044f-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f (\u042f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c s2s=SAX \u0438\u043b\u0438 d2d=DOM.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (\u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u0430 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c DTM \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 (\u0427\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0442\u0438\u043b\u0435\u0439.)]"}, { "optionXO", " [-XO [\u0438\u043c\u044f-\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b] (\u041f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f)]"}, { "optionXD", " [-XD \u0446\u0435\u043b\u0435\u0432\u043e\u0439-\u043a\u0430\u0442\u0430\u043b\u043e\u0433 (\u0417\u0430\u0434\u0430\u0435\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f)]"}, { "optionXJ", " [-XJ \u0444\u0430\u0439\u043b-jar (\u0423\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 <\u0444\u0430\u0439\u043b-jar>)]"}, { "optionXP", " [-XP \u043f\u0430\u043a\u0435\u0442 (\u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 translet)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (\u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430)]" }, { "optionXX", " [-XX (\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439)]"}, { "optionXT" , " [-XT (\u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f)]"}, { "diagTiming"," --------- \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 {0} \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e {1} \u0437\u0430\u043d\u044f\u043b\u043e {2} \u043c\u0441" }, { "recursionTooDeep","\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0412\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c = {0}, \u0448\u0430\u0431\u043b\u043e\u043d {1} {2}" }, { "nameIs", "\u0438\u043c\u044f" }, { "matchPatternIs", "\u0448\u0430\u0431\u043b\u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "\u041e\u0448\u0438\u0431\u043a\u0430"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "\u041e\u0448\u0438\u0431\u043a\u0430: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_sl.java0000644000175000017500000020350010721374031025031 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_sl.java 338081 2004-12-15 17:35:58Z jycli $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_sl extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Napaka: Izraz ne sme vsebovati '{'"}, { ER_ILLEGAL_ATTRIBUTE , "{0} vsebuje neveljaven atribut: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode je NULL v xsl:apply-imports!"}, {ER_CANNOT_ADD, "Ne morem dodati {0} k {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode je NULL v handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "{0} mora vsebovati atribut imena."}, {ER_TEMPLATE_NOT_FOUND, "Nisem na\u0161em predloge z imenom: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Imena AVT v xsl:call-template ni bilo mogo\u010de razre\u0161iti."}, {ER_REQUIRES_ATTRIB, "{0} zahteva atribut: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} mora imeti atribut ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Slaba vrednost pri atributu stopnje: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Ime navodila za obdelavo ne more biti 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "Ime navodila za obdelavo mora biti veljavno NCIme: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} mora vsebovati primerjalni atribut, \u010de vsebuje vozli\u0161\u010de."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} zahteva atribut imena ali primerjalni atribut."}, {ER_CANT_RESOLVE_NSPREFIX, "Predpone imenskega prostora ni mogo\u010de razre\u0161iti: {0}"}, { ER_ILLEGAL_VALUE, "xml:space vsebuje neveljavno vrednost: {0}"}, { ER_NO_OWNERDOC, "Podrejeno vozli\u0161\u010de ne vsebuje lastni\u0161kega dokumenta!"}, { ER_ELEMTEMPLATEELEM_ERR, "Napaka ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "Poskus dodajanja podrejenega elementa z vrednostjo NULL!"}, { ER_NEED_SELECT_ATTRIB, "{0} zahteva atribut izbire."}, { ER_NEED_TEST_ATTRIB , "xsl:when mora vsebovati atribut 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param mora vsebovati atribut 'ime'."}, { ER_NO_CONTEXT_OWNERDOC, "Kontekst ne vsebuje lastni\u0161kega dokumenta!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Ne morem ustvariti zveze XML TransformerFactory: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: postopek ni uspel."}, { ER_NOT_SUCCESSFUL, "Xalan: ni uspel."}, { ER_ENCODING_NOT_SUPPORTED, "Kodiranje ni podprto: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Ne morem ustvariti javanskega razreda TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key zahteva atribut 'ime'!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key zahteva atribut 'ujemanje'!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key zahteva atribut 'uporaba'!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} zahteva atribut ''elementi''!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} manjka atribut ''predpona''"}, { ER_BAD_STYLESHEET_URL, "URL slogovne datoteke je neveljaven: {0}"}, { ER_FILE_NOT_FOUND, "Slogovne datoteke ni bilo mogo\u010de najti: {0}"}, { ER_IOEXCEPTION, "Pri slogovni datoteki je pri\u0161lo do izjeme IO: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Atributa href za {0} ni bilo mogo\u010de najti"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} neposredno ali posredno vklju\u010duje samega sebe!"}, { ER_PROCESSINCLUDE_ERROR, "Napaka StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} manjka atribut ''lang'' "}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) napa\u010dna postavitev elementa {0}?? Manjka vsebni element ''komponenta''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Prenos mogo\u010d samo v Element, DocumentFragment, Document, ali PrintWriter."}, { ER_PROCESS_ERROR, "Napaka StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Napaka UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Napaka! Ne najdem izbirnega izraza xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Ne morem serializirati XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "Vnos slogovne datoteke ni dolo\u010den!"}, { ER_FAILED_PROCESS_STYLESHEET, "Obdelava slogovne datoteke ni uspela!"}, { ER_COULDNT_PARSE_DOC, "Dokumenta {0} ni mogo\u010de raz\u010dleniti!"}, { ER_COULDNT_FIND_FRAGMENT, "Ne najdem fragmenta: {0}"}, { ER_NODE_NOT_ELEMENT, "Vozli\u0161\u010de, na katerega ka\u017ee identifikator fragmenta, ni element: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "vsak mora vsebovati primerjalni atribut ali atribut imena"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "predloge morajo imeti primerjalni atribut ali atribut imena"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Ni klona fragmenta dokumenta!"}, { ER_CANT_CREATE_ITEM, "Ne morem ustvariti elementa v drevesu rezultatov: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space v izvirnem XML ima neveljavno vrednost: {0}"}, { ER_NO_XSLKEY_DECLARATION, "Ni deklaracije xsl:key za {0}!"}, { ER_CANT_CREATE_URL, "Napaka! Ne morem ustvariti URL za: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions niso podprte"}, { ER_PROCESSOR_ERROR, "Napaka XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} ni dovoljen znotraj slogovne datoteke!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns ni ve\u010d podprt! Namesto njega uporabite xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space ni ve\u010d podprt! Namesto njega uporabite xsl:strip-space ali xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result ni ve\u010d podprt! Namesto njega uporabite xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} ima neveljaven atribut: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Neznani element XSL: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort lahko uporabljamo samo z xsl:apply-templates ali z xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) napa\u010dna postavitev xsl:when!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:choose ni nadrejen xsl:when!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) napa\u010dna postavitev xsl:otherwise!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:choose ni nadrejen xsl:otherwise!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} ni dovoljen znotraj predloge!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) Neznana {0} kon\u010dnica predpone imenskega prostora {1}"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Uvozi se lahko pojavijo samo kot prvi elementi v slogovni datoteki!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} neposredno ali posredno uva\u017ea samega sebe!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space vsebuje neveljavno vrednost: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet ni uspelo!"}, { ER_SAX_EXCEPTION, "Izjema SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Funkcija ni podprta!"}, { ER_XSLT_ERROR, "Napaka XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "V oblikovnem nizu vzorca znak za denarno enoto ni dovoljen"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Funkcija dokumenta v slogovni datoteki DOM ni podprta!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Ne morem razbrati predpone nepredponskega razre\u0161evalnika!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Preusmeri kon\u010dnico: ne morem pridobiti imena datoteke - atribut datoteke ali izbire mora vrniti veljaven niz."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "V Preusmeritvi kon\u010dnice ne morem zgraditi FormatterListener!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Predpona v izklju\u010di-predpone-rezultatov (exclude-result-prefixes) ni veljavna: {0}"}, { ER_MISSING_NS_URI, "Za navedeno predpono manjka imenski prostor URI"}, { ER_MISSING_ARG_FOR_OPTION, "Manjka argument za mo\u017enost: {0}"}, { ER_INVALID_OPTION, "Neveljavna mo\u017enost: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Po\u0161kodovan niz sloga: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet zahteva atribut 'razli\u010dica'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Atribut: {0} ima neveljavno vrednost: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose zahteva xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports v xsl:for-each ni dovoljen"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Za izhodno vozli\u0161\u010de DOM ne morem uporabiti DTMLiaison... namesto njega posredujte org.apache.xpath.DOM2Helper!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Za vhodno vozli\u0161\u010de DOM ne morem uporabiti DTMLiaison... namesto njega posredujte org.apache.xpath.DOM2Helper!"}, { ER_CALL_TO_EXT_FAILED, "Klic elementa kon\u010dnice ni uspel: {0}"}, { ER_PREFIX_MUST_RESOLVE, "Predpona se mora razre\u0161iti v imenski prostor: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Zaznan neveljaven nadomestek UTF-16: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} je uporabil samega sebe, kar bo povzro\u010dilo neskon\u010do ponavljanje."}, { ER_CANNOT_MIX_XERCESDOM, "Prepletanje ne-Xerces-DOM vhoda s Xerces-DOM vhodom ni mogo\u010de!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "V ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Na\u0161el ve\u010d predlog z istim imenom: {0}"}, { ER_INVALID_KEY_CALL, "Neveljaven klic funkcije: povratni klici key() niso dovoljeni"}, { ER_REFERENCING_ITSELF, "Spremenljivka {0} se neposredno ali posredno sklicuje sama nase!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "Vhodno vozli\u0161\u010de za DOMSource za newTemplates ne more biti NULL!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Datoteke razreda za mo\u017enost {0} ni bilo mogo\u010de najti"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Zahtevanega elementa ni bilo mogo\u010de najti: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream ne more biti NULL"}, { ER_URI_CANNOT_BE_NULL, "URI ne more biti NULL"}, { ER_FILE_CANNOT_BE_NULL, "Datoteka ne more biti NULL"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource ne more biti NULL"}, { ER_CANNOT_INIT_BSFMGR, "Inicializacija BSF Manager-ja ni mogo\u010da"}, { ER_CANNOT_CMPL_EXTENSN, "Kon\u010dnice ni mogo\u010de prevesti"}, { ER_CANNOT_CREATE_EXTENSN, "Ne morem ustvariti kon\u010dnice: {0} zaradi: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Klic primerkov metode za metodo {0} zahteva primerek objekta kot prvi argument"}, { ER_INVALID_ELEMENT_NAME, "Navedeno neveljavno ime elementa {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "Metoda imena elementa mora biti stati\u010dna (static) {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Funkcija kon\u010dnice {0} : {1} je neznana"}, { ER_MORE_MATCH_CONSTRUCTOR, "Ve\u010d kot eno najbolj\u0161e ujemanje za graditelja za {0}"}, { ER_MORE_MATCH_METHOD, "Ve\u010d kot eno najbolj\u0161e ujemanje za metodo {0}"}, { ER_MORE_MATCH_ELEMENT, "Ve\u010d kot eno najbolj\u0161e ujemanje za metodo elementa {0}"}, { ER_INVALID_CONTEXT_PASSED, "Posredovan neveljaven kontekst za ovrednotenje {0}"}, { ER_POOL_EXISTS, "Zaloga \u017ee obstaja"}, { ER_NO_DRIVER_NAME, "Ime gonilnika ni dolo\u010deno"}, { ER_NO_URL, "URL ni dolo\u010den"}, { ER_POOL_SIZE_LESSTHAN_ONE, "Zaloga je manj\u0161a od ena!"}, { ER_INVALID_DRIVER, "Navedeno neveljavno ime gonilnika!"}, { ER_NO_STYLESHEETROOT, "Korena slogovne datoteke ni mogo\u010de najti!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Neveljavna vrednost za xml:space"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode spodletelo"}, { ER_RESOURCE_COULD_NOT_LOAD, "Sredstva [ {0} ] ni bilo mogo\u010de nalo\u017eiti: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Velikost medpomnilnika <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Neznana napaka pri klicu kon\u010dnice"}, { ER_NO_NAMESPACE_DECL, "Predpona {0} nima ustrezne deklaracije imenskega prostora"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Vsebina elementa za lang=javaclass {0} ni dovoljena"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Prekinitev usmerja slogovna datoteka"}, { ER_ONE_OR_TWO, "1 ali 2"}, { ER_TWO_OR_THREE, "2 ali 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Nisem mogel nalo\u017eiti {0} (preverite CLASSPATH), trenutno se uporabljajo privzete vrednosti"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Ne morem inicializirati privzetih predlog"}, { ER_RESULT_NULL, "Rezultat naj ne bi bil NULL"}, { ER_RESULT_COULD_NOT_BE_SET, "Rezultata ni bilo mogo\u010de nastaviti"}, { ER_NO_OUTPUT_SPECIFIED, "Izhod ni naveden"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Ne morem pretvoriti v rezultat tipa {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Ne morem pretvoriti vira tipa {0}"}, { ER_NULL_CONTENT_HANDLER, "Program za obravnavo vsebine NULL"}, { ER_NULL_ERROR_HANDLER, "Program za obravnavo napak NULL"}, { ER_CANNOT_CALL_PARSE, "klic raz\u010dlenitve ni mo\u017een \u010de ContentHandler ni bil nastavljen"}, { ER_NO_PARENT_FOR_FILTER, "Ni nadrejenega za filter"}, { ER_NO_STYLESHEET_IN_MEDIA, "Ni mogo\u010de najti slogovne datoteke v: {0}, medij= {1}"}, { ER_NO_STYLESHEET_PI, "Ne najdem xml-stylesheet PI v: {0}"}, { ER_NOT_SUPPORTED, "Ni podprto: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Vrednost lastnosti {0} bi morala biti ponovitev logi\u010dne vrednosti"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Ne morem dostopati do zunanje skripte na {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "Vira [ {0} ] ni mogo\u010de najti.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Izhodna lastnost ni prepoznana: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Priprava primerka ElemLiteralResult ni uspela"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Vrednost za {0} bi morala biti \u0161tevilka, ki jo je mogo\u010de raz\u010dleniti"}, { ER_VALUE_SHOULD_EQUAL, "Vrednost za {0} bi morala biti enaka da ali ne"}, { ER_FAILED_CALLING_METHOD, "Klic metode {0} ni uspel"}, { ER_FAILED_CREATING_ELEMTMPL, "Priprava primerka ElemTemplateElement ni uspela"}, { ER_CHARS_NOT_ALLOWED, "V tem trenutku znaki v dokumentu niso na voljo"}, { ER_ATTR_NOT_ALLOWED, "Atribut \"{0}\" v elementu {1} ni dovoljen!"}, { ER_BAD_VALUE, "{0} slaba vrednost {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "Vrednosti atributa {0} ni bilo mogo\u010de najti "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Vrednosti atributa {0} ni bilo mogo\u010de prepoznati "}, { ER_NULL_URI_NAMESPACE, "Posku\u0161am generirati predpono imenskega prostora z URI z vrednostjo NULL"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Poskus oblikovanja \u0161tevilke, ve\u010dje od najve\u010djega dolgega celega \u0161tevila"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Ne najdem razreda gonilnika SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "Na\u0161el razred gonilnika SAX1 {0}, vendar ga ne morem nalo\u017eiti"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "Nalo\u017eil razred gonilnika SAX1 {0}, vendar ga ne morem udejaniti"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "Razred gonilnika SAX1 {0} ne vklju\u010duje org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Sistemska lastnost org.xml.sax.parser ni dolo\u010dena"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Argument raz\u010dlenjevalnika sme biti NULL"}, { ER_FEATURE, "Zna\u010dilnost: {0}"}, { ER_PROPERTY, "Lastnost: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Razre\u0161evalnik entitet NULL"}, { ER_NULL_DTD_HANDLER, "Program za obravnavanje DTD z vrednostjo NULL"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Ime gonilnika ni dolo\u010deno!"}, { ER_NO_URL_SPECIFIED, "URL ni dolo\u010den!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Zaloga je manj\u0161a od 1!"}, { ER_INVALID_DRIVER_NAME, "Dolo\u010deno neveljavno ime gonilnika!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Programerjeva napaka! Izraz nima nadrejenega ElemTemplateElement!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Programerjeva izjava v RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "Na tem polo\u017eaju v slogovni datoteki {0} ni dovoljen!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Besedilo, ki niso presledki in drugi podobni znaki, na tem polo\u017eaju v slogovni datoteki ni dovoljeno.!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Neveljavna vrednost: {1} uporabljena za atribut CHAR: {0}. Atribut tipa CHAR mora biti samo 1 znak!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Neveljavna vrednost: {1} uporabljena za atribut QNAME: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Neveljavna vrednost: {1} uporabljena za atribut ENUM: {0}. Veljavne vrednosti so: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Neveljavna vrednost: {1} uporabljena za atribut NMTOKEN: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Neveljavna vrednost: {1} uporabljena za atribut NCNAME: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Neveljavna vrednost: {1} uporabljena za atribut boolean: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Neveljavna vrednost: {1} uporabljena za atribut number: {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argument za {0} v primerjalnem vzorcu mora biti dobesedni niz."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Dvojnik deklaracije globalne spremenljivke."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Dvojnik deklaracije spremenljivke."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template mora vsebovati atribut name ali match (ali oba)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Predpona v izklju\u010di-predpone-rezultatov (exclude-result-prefixes) ni veljavna: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "Nabor atributov, imenovana {0}, ne obstaja"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "Funkcija, imenovana {0}, ne obstaja"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "Element {0} ne sme imeti vsebine in atributa izbire hkrati."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "Vrednost parametra {0} mora biti veljaven javanski objekt"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Atribut result-prefix elementa xsl:namespace-alias element ima vrednost '#default' (privzeto), ampak ni deklaracije privzetega imenskega prostora v razponu za ta element."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Atribut result-prefix elementa xsl:namespace-alias ima vrednost ''{0}'', ampak ni deklaracije privzetega imenskega prostora za predpono ''{0}'' v razponu za ta element."}, { ER_SET_FEATURE_NULL_NAME, "Ime funkcije ne sme biti null v TransformerFactory.getFeature(Ime niza, vrednost boolean)."}, { ER_GET_FEATURE_NULL_NAME, "Ime funkcije ne sme biti null v TransformerFactory.getFeature(Ime niza)."}, { ER_UNSUPPORTED_FEATURE, "Ni mogo\u010de nastaviti funkcije ''{0}'' v tem TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "Uporaba raz\u0161iritvene elementa ''{0}'' ni na voljo, ko je funkcija varnega procesiranja nastavljena na true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Ni mogo\u010de dobiti predpone za URI imenskega prostora null."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Ni mogo\u010de dobiti URI-ja imenskega prostora za predpono null."}, { ER_XPATH_RESOLVER_NULL_QNAME, "Ime funkcije ne more biti ni\u010d."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "\u0160tevilo argumentov ne more biti negativno"}, // Warnings... { WG_FOUND_CURLYBRACE, "Najden '}' vendar ni odprtih predlog atributov!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Opozorilo: \u0161tevni atribut ni skladen s prednikom v xsl:number! Cilj = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Stara sintaksa: Ime atributa 'izraz' je bilo spremenjeno v 'izbira'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan \u0161e ne podpira podro\u010dnih imen v funkciji za oblikovanje \u0161tevilk."}, { WG_LOCALE_NOT_FOUND, "Opozorilo: ne najdem podro\u010dnih nastavitev za xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Iz {0} ni mogo\u010de narediti naslova URL."}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Ne morem nalo\u017eiti zahtevanega dokumenta: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Ne najdem kolacionista (collator) za >>>>>> Razli\u010dica Xalan "}, { "version2", "<<<<<<<"}, { "yes", "da"}, { "line", "Vrstica #"}, { "column","Stolpec #"}, { "xsldone", "XSLProcessor: dokon\u010dano"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Ukazna vrstica Xalan-J Mo\u017enosti razreda postopka:"}, { "xslProc_option", "Ukazna vrstica Xalan-J Mo\u017enosti razredov postopkov\u003a"}, { "xslProc_invalid_xsltc_option", "Mo\u017enost {0} v na\u010dinu XSLTC ni podprta."}, { "xslProc_invalid_xalan_option", "Mo\u017enost {0} se lahko uporablja samo z -XSLTC."}, { "xslProc_no_input", "Napaka: ni dolo\u010dene slogovne datoteke ali vhodnega xml. Po\u017eenite ta ukaz, za katerega ni na voljo napotkov za uporabo."}, { "xslProc_common_options", "-Splo\u0161ne mo\u017enosti-"}, { "xslProc_xalan_options", "-Mo\u017enosti za Xalan-"}, { "xslProc_xsltc_options", "-Mo\u017enosti za XSLTC-"}, { "xslProc_return_to_continue", "(za nadaljevanje pritisnite )"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (za preoblikovanje uporabite XSLTC)]"}, { "optionIN", " [-IN vhodniXMLURL]"}, { "optionXSL", " [-XSL XSLPreoblikovanjeURL]"}, { "optionOUT", " [-OUT ImeIzhodneDatoteke]"}, { "optionLXCIN", " [-LXCIN ImeVhodneDatotekePrevedeneSlogovneDatoteke]"}, { "optionLXCOUT", " [-LXCOUT ImeIzhodneDatotekePrevedeneSlogovneDatoteke]"}, { "optionPARSER", " [-PARSER popolnoma ustrezno ime razreda zveze raz\u010dlenjevalnika]"}, { "optionE", " [-E (Ne raz\u0161irjajte sklicev entitet)]"}, { "optionV", " [-E (Ne raz\u0161irjajte sklicev entitet)]"}, { "optionQC", " [-QC (Tiha opozorila o sporih vzorcev)]"}, { "optionQ", " [-Q (Tihi na\u010din)]"}, { "optionLF", " [-LF (Uporabite pomike samo na izhodu {privzeto je CR/LF})]"}, { "optionCR", " [-CR (Uporabite prehode v novo vrstico samo na izhodu {privzeto je CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Znaki za izogib {privzeto je <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Koliko presledkov zamika {privzeto je 0})]"}, { "optionTT", " [-TT (Sledite predlogam glede na njihov poziv.)]"}, { "optionTG", " [-TG (Sledite vsakemu dogodku rodu.)]"}, { "optionTS", " [-TS (Sledite vsakemu dogodku izbire.)]"}, { "optionTTC", " [-TTC (Sledite podrejenim predloge kot se obdelujejo.)]"}, { "optionTCLASS", " [-TCLASS (Razred TraceListener za kon\u010dnice sledi.)]"}, { "optionVALIDATE", " [-VALIDATE (Nastavi v primeru preverjanja veljavnosti. Privzeta vrednost za preverjanje veljavnosti je izklopljeno.)]"}, { "optionEDUMP", " [-EDUMP {izbirno ime datoteke} (V primeru napake naredi izvoz skladov.)]"}, { "optionXML", " [-XML (Uporabite oblikovalnik XML in dodajte glavo XML.)]"}, { "optionTEXT", " [-TEXT (Uporabite preprost oblikovalnik besedila.)]"}, { "optionHTML", " [-HTML (Uporabite oblikovalnik za HTML.)]"}, { "optionPARAM", " [-PARAM izraz imena (nastavite parameter slogovne datoteke)]"}, { "noParsermsg1", "Postopek XSL ni uspel."}, { "noParsermsg2", "** Nisem na\u0161el raz\u010dlenjevalnika **"}, { "noParsermsg3", "Preverite pot razreda."}, { "noParsermsg4", "\u010ce nimate IBM raz\u010dlenjevalnika za Javo, ga lahko prenesete iz"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER polno ime razreda (URIResolver za razre\u0161evanje URL-jev)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER polno ime razreda (EntityResolver za razre\u0161evanje entitet)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER polno ime razreda (ContentHandler za serializacijo izhoda)]"}, { "optionLINENUMBERS", " [-L za izvorni dokument uporabite \u0161tevilke vrstic]"}, { "optionSECUREPROCESSING", " [-SECURE (nastavite funkcijo varne obdelave na True.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA TipMedija (z atributom medija poi\u0161\u010dite slogovno datoteko, ki se nana\u0161a na dokument.)]"}, { "optionFLAVOR", " [-FLAVOR ImePosebnosti (Za preoblikovanje izrecno uporabljajte s2s=SAX ali d2d=DOM.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Natisnite skupni \u010das trajanja pretvorbe v milisekundah.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (zahtevajte gradnjo prirastnega DTM tako, da nastavite http://xml.apache.org/xalan/features/incremental na resni\u010dno.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (prepre\u010dite obdelavo optimiziranja slogovne datoteke, tako da nastavite http://xml.apache.org/xalan/features/optimize na false.)]"}, { "optionRL", " [-RL mejaRekurzije (zahtevajte numeri\u010dno mejo globine rekurzije slogovne datoteke.)]"}, { "optionXO", " [-XO [imeTransleta] (dodelite ime ustvarjenemu transletu)]"}, { "optionXD", " [-XD ciljnaMapa (navedite ciljno mapo za translet)]"}, { "optionXJ", " [-XJ datotekaJar (zdru\u017ei razrede transleta v datoteko jar z imenom )]"}, { "optionXP", " [-XP paket (navede predpono imena paketa vsem ustvarjenim razredom transletov)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (omogo\u010da vstavljanje predlog)]" }, { "optionXX", " [-XX (vklopi izhod za dodatna sporo\u010dila za iskanje napak)]"}, { "optionXT" , " [-XT (\u010de je mogo\u010de, uporabite translet za pretvorbo)]"}, { "diagTiming"," --------- Pretvorba {0} prek {1} je trajala {2} ms" }, { "recursionTooDeep","Predloga pregloboko vgnezdena. Gnezdenje = {0}, predloga {1} {2}" }, { "nameIs", "ime je" }, { "matchPatternIs", "primerjalni vzorec je" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Napaka: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Opozorilo: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "VZOREC "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("sl", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources.java0000644000175000017500000017573010721374031024350 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The int to message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Error: Can not have '{' within expression"}, { ER_ILLEGAL_ATTRIBUTE , "{0} has an illegal attribute: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode is null in xsl:apply-imports!"}, {ER_CANNOT_ADD, "Can not add {0} to {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode is null in handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "{0} must have a name attribute."}, {ER_TEMPLATE_NOT_FOUND, "Could not find template named: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Could not resolve name AVT in xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} requires attribute: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} must have a ''test'' attribute."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Bad value on level attribute: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "processing-instruction name can not be 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "processing-instruction name must be a valid NCName: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} must have a match attribute if it has a mode."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} requires either a name or a match attribute."}, {ER_CANT_RESOLVE_NSPREFIX, "Can not resolve namespace prefix: {0}"}, { ER_ILLEGAL_VALUE, "xml:space has an illegal value: {0}"}, { ER_NO_OWNERDOC, "Child node does not have an owner document!"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement error: {0}"}, { ER_NULL_CHILD, "Trying to add a null child!"}, { ER_NEED_SELECT_ATTRIB, "{0} requires a select attribute."}, { ER_NEED_TEST_ATTRIB , "xsl:when must have a 'test' attribute."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param must have a 'name' attribute."}, { ER_NO_CONTEXT_OWNERDOC, "context does not have an owner document!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Could not create XML TransformerFactory Liaison: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Process was not successful."}, { ER_NOT_SUCCESSFUL, "Xalan: was not successful."}, { ER_ENCODING_NOT_SUPPORTED, "Encoding not supported: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Could not create TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key requires a 'name' attribute!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key requires a 'match' attribute!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key requires a 'use' attribute!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} requires an ''elements'' attribute!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} attribute ''prefix'' is missing"}, { ER_BAD_STYLESHEET_URL, "Stylesheet URL is bad: {0}"}, { ER_FILE_NOT_FOUND, "Stylesheet file was not found: {0}"}, { ER_IOEXCEPTION, "Had IO Exception with stylesheet file: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Could not find href attribute for {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} is directly or indirectly including itself!"}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude error, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} attribute ''lang'' is missing"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) misplaced {0} element?? Missing container element ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Can only output to an Element, DocumentFragment, Document, or PrintWriter."}, { ER_PROCESS_ERROR, "StylesheetRoot.process error"}, { ER_UNIMPLNODE_ERROR, "UnImplNode error: {0}"}, { ER_NO_SELECT_EXPRESSION, "Error! Did not find xpath select expression (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Can not serialize an XSLProcessor!"}, { ER_NO_INPUT_STYLESHEET, "Stylesheet input was not specified!"}, { ER_FAILED_PROCESS_STYLESHEET, "Failed to process stylesheet!"}, { ER_COULDNT_PARSE_DOC, "Could not parse {0} document!"}, { ER_COULDNT_FIND_FRAGMENT, "Could not find fragment: {0}"}, { ER_NODE_NOT_ELEMENT, "Node pointed to by fragment identifier was not an element: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each must have either a match or name attribute"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates must have either a match or name attribute"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "No clone of a document fragment!"}, { ER_CANT_CREATE_ITEM, "Can not create item in result tree: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space in the source XML has an illegal value: {0}"}, { ER_NO_XSLKEY_DECLARATION, "There is no xsl:key declaration for {0}!"}, { ER_CANT_CREATE_URL, "Error! Cannot create url for: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions is unsupported"}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory Error"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} not allowed inside a stylesheet!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns no longer supported! Use xsl:output instead."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space no longer supported! Use xsl:strip-space or xsl:preserve-space instead."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result no longer supported! Use xsl:output instead."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} has an illegal attribute: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Unknown XSL element: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort can only be used with xsl:apply-templates or xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) misplaced xsl:when!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when not parented by xsl:choose!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) misplaced xsl:otherwise!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise not parented by xsl:choose!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} is not allowed inside a template!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} extension namespace prefix {1} unknown"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Imports can only occur as the first elements in the stylesheet!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} is directly or indirectly importing itself!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) " + "xml:space has an illegal value: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet not succesfull!"}, { ER_SAX_EXCEPTION, "SAX Exception"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Function not supported!"}, { ER_XSLT_ERROR, "XSLT Error"}, { ER_CURRENCY_SIGN_ILLEGAL, "currency sign is not allowed in format pattern string"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Document function not supported in Stylesheet DOM!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Can't resolve prefix of non-Prefix resolver!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Redirect extension: Could not get filename - file or select attribute must return vald string."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Can not build FormatterListener in Redirect extension!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Prefix in exclude-result-prefixes is not valid: {0}"}, { ER_MISSING_NS_URI, "Missing namespace URI for specified prefix"}, { ER_MISSING_ARG_FOR_OPTION, "Missing argument for option: {0}"}, { ER_INVALID_OPTION, "Invalid option: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Malformed format string: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet requires a 'version' attribute!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Attribute: {0} has an illegal value: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose requires an xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports not allowed in a xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Cannot use a DTMLiaison for an output DOM node... pass a org.apache.xpath.DOM2Helper instead!"}, { ER_CANT_USE_DTM_FOR_INPUT, "Cannot use a DTMLiaison for a input DOM node... pass a org.apache.xpath.DOM2Helper instead!"}, { ER_CALL_TO_EXT_FAILED, "Call to extension element failed: {0}"}, { ER_PREFIX_MUST_RESOLVE, "Prefix must resolve to a namespace: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Invalid UTF-16 surrogate detected: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} used itself, which will cause an infinite loop."}, { ER_CANNOT_MIX_XERCESDOM, "Can not mix non Xerces-DOM input with Xerces-DOM output!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "In ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Found more than one template named: {0}"}, { ER_INVALID_KEY_CALL, "Invalid function call: recursive key() calls are not allowed"}, { ER_REFERENCING_ITSELF, "Variable {0} is directly or indirectly referencing itself!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "The input node can not be null for a DOMSource for newTemplates!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Class file not found for option {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "Required Element not found: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream cannot be null"}, { ER_URI_CANNOT_BE_NULL, "URI cannot be null"}, { ER_FILE_CANNOT_BE_NULL, "File cannot be null"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource cannot be null"}, { ER_CANNOT_INIT_BSFMGR, "Could not initialize BSF Manager"}, { ER_CANNOT_CMPL_EXTENSN, "Could not compile extension"}, { ER_CANNOT_CREATE_EXTENSN, "Could not create extension: {0} because of: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Instance method call to method {0} requires an Object instance as first argument"}, { ER_INVALID_ELEMENT_NAME, "Invalid element name specified {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "Element name method must be static {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Extension function {0} : {1} is unknown"}, { ER_MORE_MATCH_CONSTRUCTOR, "More than one best match for constructor for {0}"}, { ER_MORE_MATCH_METHOD, "More than one best match for method {0}"}, { ER_MORE_MATCH_ELEMENT, "More than one best match for element method {0}"}, { ER_INVALID_CONTEXT_PASSED, "Invalid context passed to evaluate {0}"}, { ER_POOL_EXISTS, "Pool already exists"}, { ER_NO_DRIVER_NAME, "No driver Name specified"}, { ER_NO_URL, "No URL specified"}, { ER_POOL_SIZE_LESSTHAN_ONE, "Pool size is less than one!"}, { ER_INVALID_DRIVER, "Invalid driver name specified!"}, { ER_NO_STYLESHEETROOT, "Did not find the stylesheet root!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Illegal value for xml:space"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode failed"}, { ER_RESOURCE_COULD_NOT_LOAD, "The resource [ {0} ] could not load: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Buffer size <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Unknown error when calling extension"}, { ER_NO_NAMESPACE_DECL, "Prefix {0} does not have a corresponding namespace declaration"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Element content not allowed for lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Stylesheet directed termination"}, { ER_ONE_OR_TWO, "1 or 2"}, { ER_TWO_OR_THREE, "2 or 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Could not load {0} (check CLASSPATH), now using just the defaults"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Cannot initialize default templates"}, { ER_RESULT_NULL, "Result should not be null"}, { ER_RESULT_COULD_NOT_BE_SET, "Result could not be set"}, { ER_NO_OUTPUT_SPECIFIED, "No output specified"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Can''t transform to a Result of type {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Can''t transform a Source of type {0}"}, { ER_NULL_CONTENT_HANDLER, "Null content handler"}, { ER_NULL_ERROR_HANDLER, "Null error handler"}, { ER_CANNOT_CALL_PARSE, "parse can not be called if the ContentHandler has not been set"}, { ER_NO_PARENT_FOR_FILTER, "No parent for filter"}, { ER_NO_STYLESHEET_IN_MEDIA, "No stylesheet found in: {0}, media= {1}"}, { ER_NO_STYLESHEET_PI, "No xml-stylesheet PI found in: {0}"}, { ER_NOT_SUPPORTED, "Not supported: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Value for property {0} should be a Boolean instance"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Could not get to external script at {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "The resource [ {0} ] could not be found.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Output property not recognized: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Failed creating ElemLiteralResult instance"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Value for {0} should contain a parsable number"}, { ER_VALUE_SHOULD_EQUAL, "Value for {0} should equal yes or no"}, { ER_FAILED_CALLING_METHOD, "Failed calling {0} method"}, { ER_FAILED_CREATING_ELEMTMPL, "Failed creating ElemTemplateElement instance"}, { ER_CHARS_NOT_ALLOWED, "Characters are not allowed at this point in the document"}, { ER_ATTR_NOT_ALLOWED, "\"{0}\" attribute is not allowed on the {1} element!"}, { ER_BAD_VALUE, "{0} bad value {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "{0} attribute value not found "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "{0} attribute value not recognized "}, { ER_NULL_URI_NAMESPACE, "Attempting to generate a namespace prefix with a null URI"}, { ER_NUMBER_TOO_BIG, "Attempting to format a number bigger than the largest Long integer"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Cannot find SAX1 driver class {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "SAX1 driver class {0} found but cannot be loaded"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "SAX1 driver class {0} loaded but cannot be instantiated"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1 driver class {0} does not implement org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "System property org.xml.sax.parser not specified"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Parser argument must not be null"}, { ER_FEATURE, "Feature: {0}"}, { ER_PROPERTY, "Property: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Null entity resolver"}, { ER_NULL_DTD_HANDLER, "Null DTD handler"}, { ER_NO_DRIVER_NAME_SPECIFIED, "No Driver Name Specified!"}, { ER_NO_URL_SPECIFIED, "No URL Specified!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Pool size is less than 1!"}, { ER_INVALID_DRIVER_NAME, "Invalid Driver Name Specified!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Programmer's error! The expression has no ElemTemplateElement parent!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Programmer''s assertion in RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} is not allowed in this position in the stylesheet!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Non-whitespace text is not allowed in this position in the stylesheet!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Illegal value: {1} used for CHAR attribute: {0}. An attribute of type CHAR must be only 1 character!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Illegal value: {1} used for QNAME attribute: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Illegal value: {1} used for ENUM attribute: {0}. Valid values are: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Illegal value: {1} used for NMTOKEN attribute: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Illegal value: {1} used for NCNAME attribute: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Illegal value: {1} used for boolean attribute: {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Illegal value: {1} used for number attribute: {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argument to {0} in match pattern must be a literal."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Duplicate global variable declaration."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Duplicate variable declaration."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template must have a name or match attribute (or both)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Prefix in exclude-result-prefixes is not valid: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set named {0} does not exist"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "The function named {0} does not exist"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "The {0} element must not have both content and a select attribute."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "The value of param {0} must be a valid Java Object"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "The result-prefix attribute of an xsl:namespace-alias element has the value '#default', but there is no declaration of the default namespace in scope for the element"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "The result-prefix attribute of an xsl:namespace-alias element has the value ''{0}'', but there is no namespace declaration for the prefix ''{0}'' in scope for the element."}, { ER_SET_FEATURE_NULL_NAME, "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)."}, { ER_GET_FEATURE_NULL_NAME, "The feature name cannot be null in TransformerFactory.getFeature(String name)."}, { ER_UNSUPPORTED_FEATURE, "Cannot set the feature ''{0}'' on this TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "Use of the extension element ''{0}'' is not allowed when the secure processing feature is set to true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Cannot get the prefix for a null namespace uri."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Cannot get the namespace uri for null prefix."}, { ER_XPATH_RESOLVER_NULL_QNAME, "The function name cannot be null."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "The arity cannot be negative."}, // Warnings... { WG_FOUND_CURLYBRACE, "Found '}' but no attribute template open!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Warning: count attribute does not match an ancestor in xsl:number! Target = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Old syntax: The name of the 'expr' attribute has been changed to 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan doesn't yet handle the locale name in the format-number function."}, { WG_LOCALE_NOT_FOUND, "Warning: Could not find locale for xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Can not make URL from: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Can not load requested doc: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Could not find Collator for >>>>>> Xalan Version "}, { "version2", "<<<<<<<"}, { "yes", "yes"}, { "line", "Line #"}, { "column","Column #"}, { "xsldone", "XSLProcessor: done"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J command line Process class options:"}, { "xslProc_option", "Xalan-J command line Process class options\u003a"}, { "xslProc_invalid_xsltc_option", "The option {0} is not supported in XSLTC mode."}, { "xslProc_invalid_xalan_option", "The option {0} can only be used with -XSLTC."}, { "xslProc_no_input", "Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions."}, { "xslProc_common_options", "-Common Options-"}, { "xslProc_xalan_options", "-Options for Xalan-"}, { "xslProc_xsltc_options", "-Options for XSLTC-"}, { "xslProc_return_to_continue", "(press to continue)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (use XSLTC for transformation)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", " [-PARSER fully qualified class name of parser liaison]"}, { "optionE", " [-E (Do not expand entity refs)]"}, { "optionV", " [-E (Do not expand entity refs)]"}, { "optionQC", " [-QC (Quiet Pattern Conflicts Warnings)]"}, { "optionQ", " [-Q (Quiet Mode)]"}, { "optionLF", " [-LF (Use linefeeds only on output {default is CR/LF})]"}, { "optionCR", " [-CR (Use carriage returns only on output {default is CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Which characters to escape {default is <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Control how many spaces to indent {default is 0})]"}, { "optionTT", " [-TT (Trace the templates as they are being called.)]"}, { "optionTG", " [-TG (Trace each generation event.)]"}, { "optionTS", " [-TS (Trace each selection event.)]"}, { "optionTTC", " [-TTC (Trace the template children as they are being processed.)]"}, { "optionTCLASS", " [-TCLASS (TraceListener class for trace extensions.)]"}, { "optionVALIDATE", " [-VALIDATE (Set whether validation occurs. Validation is off by default.)]"}, { "optionEDUMP", " [-EDUMP {optional filename} (Do stackdump on error.)]"}, { "optionXML", " [-XML (Use XML formatter and add XML header.)]"}, { "optionTEXT", " [-TEXT (Use simple Text formatter.)]"}, { "optionHTML", " [-HTML (Use HTML formatter.)]"}, { "optionPARAM", " [-PARAM name expression (Set a stylesheet parameter)]"}, { "noParsermsg1", "XSL Process was not successful."}, { "noParsermsg2", "** Could not find parser **"}, { "noParsermsg3", "Please check your classpath."}, { "noParsermsg4", "If you don't have IBM's XML Parser for Java, you can download it from"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"}, { "optionLINENUMBERS", " [-L use line numbers for source document]"}, { "optionSECUREPROCESSING", " [-SECURE (set the secure processing feature to true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (use media attribute to find stylesheet associated with a document.)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Print overall milliseconds transform took.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (request incremental DTM construction by setting http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (request no stylesheet optimization processing by setting http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL recursionlimit (assert numeric limit on stylesheet recursion depth.)]"}, { "optionXO", " [-XO [transletName] (assign the name to the generated translet)]"}, { "optionXD", " [-XD destinationDirectory (specify a destination directory for translet)]"}, { "optionXJ", " [-XJ jarfile (packages translet classes into a jar file of name )]"}, { "optionXP", " [-XP package (specifies a package name prefix for all generated translet classes)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (enables template inlining)]" }, { "optionXX", " [-XX (turns on additional debugging message output)]"}, { "optionXT" , " [-XT (use translet to transform if possible)]"}, { "diagTiming"," --------- Transform of {0} via {1} took {2} ms" }, { "recursionTooDeep","Template nesting too deep. nesting = {0}, template {1} {2}" }, { "nameIs", "name is" }, { "matchPatternIs", "match pattern is" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Error: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Warning: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_fr.java0000644000175000017500000021211510721374033025026 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_fr.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_fr extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Erreur : '{' interdit dans une expression"}, { ER_ILLEGAL_ATTRIBUTE , "{0} comporte un attribut incorrect : {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode est vide dans xsl:apply-imports !"}, {ER_CANNOT_ADD, "Impossible d''ajouter {0} \u00e0 {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode est vide dans handleApplyTemplatesInstruction !"}, { ER_NO_NAME_ATTRIB, "{0} doit poss\u00e9der un attribut de nom."}, {ER_TEMPLATE_NOT_FOUND, "Impossible de trouver le mod\u00e8le : {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Impossible de convertir l'AVT du nom dans xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} requiert l''attribut : {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} doit avoir un attribut ''test''."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Valeur erron\u00e9e dans l''attribut de niveau : {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Le nom de l'instruction de traitement ne peut \u00eatre 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "Le nom de l''instruction de traitement doit \u00eatre un NCName valide : {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} doit poss\u00e9der un attribut de correspondance s''il poss\u00e8de un mode."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} requiert un nom ou un attribut de correspondance."}, {ER_CANT_RESOLVE_NSPREFIX, "Impossible de r\u00e9soudre le pr\u00e9fixe de l''espace de noms : {0}"}, { ER_ILLEGAL_VALUE, "xml:space comporte une valeur non valide : {0}"}, { ER_NO_OWNERDOC, "Le noeud enfant ne poss\u00e8de pas de document propri\u00e9taire !"}, { ER_ELEMTEMPLATEELEM_ERR, "Erreur de ElemTemplateElement : {0}"}, { ER_NULL_CHILD, "Tentative d'ajout d'un enfant vide !"}, { ER_NEED_SELECT_ATTRIB, "{0} requiert un attribut de s\u00e9lection."}, { ER_NEED_TEST_ATTRIB , "xsl:when doit poss\u00e9der un attribut 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param doit poss\u00e9der un attribut 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "Le contexte ne poss\u00e8de pas de document propri\u00e9taire !"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Impossible de cr\u00e9er XML TransformerFactory Liaison : {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Echec du processus Xalan."}, { ER_NOT_SUCCESSFUL, "Echec de Xalan."}, { ER_ENCODING_NOT_SUPPORTED, "Encodage non pris en charge : {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "Impossible de cr\u00e9er TraceListener : {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key requiert un attribut 'name' !"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key requiert un attribut 'match' !"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key requiert un attribut 'use' !"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} requiert un attribut ''elements''"}, { ER_MISSING_PREFIX_ATTRIB, "L''attribut ''prefix'' de (StylesheetHandler) {0} est manquant"}, { ER_BAD_STYLESHEET_URL, "URL de la feuille de style erron\u00e9 : {0}"}, { ER_FILE_NOT_FOUND, "Fichier de la feuille de style introuvable : {0}"}, { ER_IOEXCEPTION, "Exception d''E-S avec le fichier de la feuille de style : {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Impossible de trouver d''attribut href pour {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} est directement ou indirectement inclus dans lui-m\u00eame !"}, { ER_PROCESSINCLUDE_ERROR, "Erreur de StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "L''attribut ''lang'' de (StylesheetHandler) {0} est manquant"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) position de l''\u00e9l\u00e9ment {0} inad\u00e9quate ? El\u00e9ment ''component'' de conteneur manquant"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Seule sortie possible vers Element, DocumentFragment, Document ou PrintWriter."}, { ER_PROCESS_ERROR, "Erreur de StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Erreur de UnImplNode : {0}"}, { ER_NO_SELECT_EXPRESSION, "Erreur ! Impossible de trouver l'expression de s\u00e9lection xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Impossible de s\u00e9rialiser un XSLProcessor !"}, { ER_NO_INPUT_STYLESHEET, "Entr\u00e9e de feuille de style non sp\u00e9cifi\u00e9e !"}, { ER_FAILED_PROCESS_STYLESHEET, "Impossible de traiter la feuille de style !"}, { ER_COULDNT_PARSE_DOC, "Impossible d''analyser le document {0} !"}, { ER_COULDNT_FIND_FRAGMENT, "Impossible de trouver le fragment : {0}"}, { ER_NODE_NOT_ELEMENT, "Le noeud d\u00e9sign\u00e9 par l''identificateur de fragment n''est pas un \u00e9l\u00e9ment : {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each doit poss\u00e9der un attribut de correspondance ou de nom"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "Les mod\u00e8les doivent poss\u00e9der un attribut de correspondance ou de nom"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Pas de clone dans un fragment de document !"}, { ER_CANT_CREATE_ITEM, "Impossible de cr\u00e9er l''\u00e9l\u00e9ment dans l''arborescence de r\u00e9sultats : {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space du source XML poss\u00e8de une valeur incorrecte : {0}"}, { ER_NO_XSLKEY_DECLARATION, "Aucune d\u00e9claration xsl:key pour {0} !"}, { ER_CANT_CREATE_URL, "Erreur ! Impossible de cr\u00e9er une URL pour : {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions n'est pas pris en charge"}, { ER_PROCESSOR_ERROR, "Erreur TransformerFactory de XSLT"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} n''est pas pris en charge dans une feuille de style !"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns n'est plus pris en charge ! Pr\u00e9f\u00e9rez xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space n'est plus pris en charge ! Pr\u00e9f\u00e9rez xsl:strip-space ou xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result n'est plus pris en charge ! Pr\u00e9f\u00e9rez xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} comporte un attribut incorrect : {1}"}, { ER_UNKNOWN_XSL_ELEM, "El\u00e9ment XSL inconnu : {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort ne peut \u00eatre utilis\u00e9 qu'avec xsl:apply-templates ou xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when ne figure pas \u00e0 la bonne position !"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when sans rapport avec xsl:choose !"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise ne figure pas \u00e0 la bonne position !"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise sans rapport avec xsl:choose !"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} n''est pas admis dans un mod\u00e8le !"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} pr\u00e9fixe de l''espace de noms de l''extension {1} inconnu"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Les importations peuvent \u00eatre effectu\u00e9es uniquement en tant que premiers \u00e9l\u00e9ments de la feuille de style !"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} s''importe lui-m\u00eame directement ou indirectement !"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space poss\u00e8de une valeur incorrecte : {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "Echec de processStylesheet !"}, { ER_SAX_EXCEPTION, "Exception SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Fonction non prise en charge !"}, { ER_XSLT_ERROR, "Erreur XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "Tout symbole mon\u00e9taire est interdit dans une cha\u00eene de motif de correspondance"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Fonction de document non prise en charge dans le DOM de la feuille de style !"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Impossible de r\u00e9soudre le pr\u00e9fixe du solveur !"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Extension de redirection : Impossible d'extraire le nom du fichier - l'attribut de fichier ou de s\u00e9lection doit retourner une cha\u00eene valide."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Impossible de cr\u00e9er FormatterListener dans une extension Redirect !"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Pr\u00e9fixe de exclude-result-prefixes non valide : {0}"}, { ER_MISSING_NS_URI, "URI de l'espace de noms manquant pour le pr\u00e9fixe indiqu\u00e9"}, { ER_MISSING_ARG_FOR_OPTION, "Argument manquant pour l''option : {0}"}, { ER_INVALID_OPTION, "Option incorrecte : {0}"}, { ER_MALFORMED_FORMAT_STRING, "Cha\u00eene de format mal form\u00e9e : {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet requiert un attribut 'version' !"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "L''attribut : {0} poss\u00e8de une valeur non valide : {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose requiert xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports interdit dans un xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "Impossible d'utiliser DTMLiaison pour un noeud de DOM en sortie... Transmettez org.apache.xpath.DOM2Helper \u00e0 la place !"}, { ER_CANT_USE_DTM_FOR_INPUT, "Impossible d'utiliser DTMLiaison pour un noeud de DOM en entr\u00e9e... Transmettez org.apache.xpath.DOM2Helper \u00e0 la place !"}, { ER_CALL_TO_EXT_FAILED, "Echec de l''appel de l''\u00e9l\u00e9ment d''extension : {0}"}, { ER_PREFIX_MUST_RESOLVE, "Le pr\u00e9fixe doit se convertir en espace de noms : {0}"}, { ER_INVALID_UTF16_SURROGATE, "Substitut UTF-16 non valide d\u00e9tect\u00e9 : {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} s''utilise lui-m\u00eame, ce qui provoque une boucle infinie."}, { ER_CANNOT_MIX_XERCESDOM, "Impossible de m\u00e9langer une entr\u00e9e autre que Xerces-DOM avec une sortie Xerces-DOM !"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "Dans ElemTemplateElement.readObject : {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Plusieurs mod\u00e8les s''appellent : {0}"}, { ER_INVALID_KEY_CALL, "Appel de fonction non valide : appels de key() r\u00e9cursifs interdits"}, { ER_REFERENCING_ITSELF, "La variable {0} fait r\u00e9f\u00e9rence \u00e0 elle-m\u00eame directement ou indirectement !"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "Le noeud d'entr\u00e9e ne peut \u00eatre vide pour un DOMSource de newTemplates !"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Fichier de classe introuvable pour l''option {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "El\u00e9ment requis introuvable : {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream ne doit pas \u00eatre vide"}, { ER_URI_CANNOT_BE_NULL, "L'URI ne doit pas \u00eatre vide"}, { ER_FILE_CANNOT_BE_NULL, "Le fichier ne doit pas \u00eatre vide"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource ne doit pas \u00eatre vide"}, { ER_CANNOT_INIT_BSFMGR, "Impossible d'initialiser le gestionnaire de BSF"}, { ER_CANNOT_CMPL_EXTENSN, "Impossible de compiler l'extension"}, { ER_CANNOT_CREATE_EXTENSN, "Impossible de cr\u00e9er l''extension : {0} en raison de : {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "L''appel de la m\u00e9thode d''instance de la m\u00e9thode {0} requiert une instance d''Object comme premier argument"}, { ER_INVALID_ELEMENT_NAME, "Nom d''\u00e9l\u00e9ment non valide sp\u00e9cifi\u00e9 {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "La m\u00e9thode de nom d''\u00e9l\u00e9ment doit \u00eatre statique {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "La fonction d''extension {0} : {1} est inconnue"}, { ER_MORE_MATCH_CONSTRUCTOR, "Plusieurs occurrences proches pour le constructeur de {0}"}, { ER_MORE_MATCH_METHOD, "Plusieurs occurrences proches pour la m\u00e9thode {0}"}, { ER_MORE_MATCH_ELEMENT, "Plusieurs occurrences proches pour la m\u00e9thode d''\u00e9l\u00e9ment {0}"}, { ER_INVALID_CONTEXT_PASSED, "Contexte non valide transmis pour \u00e9valuer {0}"}, { ER_POOL_EXISTS, "Pool d\u00e9j\u00e0 existant"}, { ER_NO_DRIVER_NAME, "Aucun nom de p\u00e9riph\u00e9rique indiqu\u00e9"}, { ER_NO_URL, "Aucune URL sp\u00e9cifi\u00e9e"}, { ER_POOL_SIZE_LESSTHAN_ONE, "La taille du pool est inf\u00e9rieure \u00e0 1 !"}, { ER_INVALID_DRIVER, "Nom de pilote non valide sp\u00e9cifi\u00e9 !"}, { ER_NO_STYLESHEETROOT, "Impossible de trouver la racine de la feuille de style !"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Valeur incorrecte pour xml:space"}, { ER_PROCESSFROMNODE_FAILED, "Echec de processFromNode"}, { ER_RESOURCE_COULD_NOT_LOAD, "La ressource [ {0} ] n''a pas pu charger : {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Taille du tampon <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Erreur inconnue lors de l'appel de l'extension"}, { ER_NO_NAMESPACE_DECL, "Le pr\u00e9fixe {0} ne poss\u00e8de pas de d\u00e9claration d''espace de noms correspondante"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Contenu d''\u00e9l\u00e9ment interdit pour lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "La feuille de style a provoqu\u00e9 l'arr\u00eat"}, { ER_ONE_OR_TWO, "1 ou 2"}, { ER_TWO_OR_THREE, "2 ou 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "Impossible de charger {0} (v\u00e9rifier CLASSPATH), les valeurs par d\u00e9faut sont donc employ\u00e9es"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Impossible d'initialiser les mod\u00e8les par d\u00e9faut"}, { ER_RESULT_NULL, "Le r\u00e9sultat doit \u00eatre vide"}, { ER_RESULT_COULD_NOT_BE_SET, "Le r\u00e9sultat ne peut \u00eatre d\u00e9fini"}, { ER_NO_OUTPUT_SPECIFIED, "Aucune sortie sp\u00e9cifi\u00e9e"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Transformation impossible vers un r\u00e9sultat de type {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Impossible de transformer une source de type {0}"}, { ER_NULL_CONTENT_HANDLER, "Gestionnaire de contenu vide"}, { ER_NULL_ERROR_HANDLER, "Gestionnaire d'erreurs vide"}, { ER_CANNOT_CALL_PARSE, "L'analyse ne peut \u00eatre appel\u00e9e si le ContentHandler n'a pas \u00e9t\u00e9 d\u00e9fini"}, { ER_NO_PARENT_FOR_FILTER, "Pas de parent pour le filtre"}, { ER_NO_STYLESHEET_IN_MEDIA, "Aucune feuille de style dans : {0}, support = {1}"}, { ER_NO_STYLESHEET_PI, "Pas de PI xml-stylesheet dans : {0}"}, { ER_NOT_SUPPORTED, "Non pris en charge : {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "La valeur de la propri\u00e9t\u00e9 {0} doit \u00eatre une instance bool\u00e9enne"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Impossible d''extraire le script externe \u00e0 {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "La ressource [ {0} ] est introuvable.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Propri\u00e9t\u00e9 de sortie non identifi\u00e9e : {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Impossible de cr\u00e9er une instance de ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "La valeur de {0} doit contenir un nombre analysable"}, { ER_VALUE_SHOULD_EQUAL, "La valeur de {0} doit \u00eatre oui ou non"}, { ER_FAILED_CALLING_METHOD, "Echec de l''appel de la m\u00e9thode {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "Echec de la cr\u00e9ation de l'instance de ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "La pr\u00e9sence de caract\u00e8res n'est pas admise \u00e0 cet endroit du document"}, { ER_ATTR_NOT_ALLOWED, "L''attribut \"{0}\" n''est pas admis sur l''\u00e9l\u00e9ment {1} !"}, { ER_BAD_VALUE, "{0} valeur erron\u00e9e {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "Impossible de trouver la valeur de l''attribut {0} "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Valeur de l''attribut {0} non identifi\u00e9e "}, { ER_NULL_URI_NAMESPACE, "Tentative de cr\u00e9ation d'un pr\u00e9fixe d'espace de noms avec un URI vide"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Tentative de formatage d'un nombre sup\u00e9rieur \u00e0 l'entier Long le plus \u00e9lev\u00e9"}, { ER_CANNOT_FIND_SAX1_DRIVER, "Impossible de trouver la classe {0} du pilote SAX1"}, { ER_SAX1_DRIVER_NOT_LOADED, "Classe {0} du pilote SAX1 trouv\u00e9e mais non charg\u00e9e"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "Classe {0} du pilote SAX1 trouv\u00e9e mais non instanci\u00e9e"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "La classe {0} du pilote SAX1 n''impl\u00e9mente pas org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Propri\u00e9t\u00e9 syst\u00e8me org.xml.sax.parser non sp\u00e9cifi\u00e9e"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "L'argument de l'analyseur ne doit pas \u00eatre vide"}, { ER_FEATURE, "Fonction : {0}"}, { ER_PROPERTY, "Propri\u00e9t\u00e9 : {0}"}, { ER_NULL_ENTITY_RESOLVER, "Solveur d'entit\u00e9 vide"}, { ER_NULL_DTD_HANDLER, "Gestionnaire de DT vide"}, { ER_NO_DRIVER_NAME_SPECIFIED, "Aucun nom de pilote sp\u00e9cifi\u00e9 !"}, { ER_NO_URL_SPECIFIED, "Aucune URL sp\u00e9cifi\u00e9e !"}, { ER_POOLSIZE_LESS_THAN_ONE, "La taille du pool est inf\u00e9rieure \u00e0 1 !"}, { ER_INVALID_DRIVER_NAME, "Nom de pilote non valide sp\u00e9cifi\u00e9 !"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Erreur de programme ! L'expression n'a pas de parent ElemTemplateElement !"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Assertion du programmeur dans RedundentExprEliminator : {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} ne peut pas figurer \u00e0 cette position dans la feuille de style !"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Seul de l'espace est accept\u00e9 \u00e0 cette position dans la feuille de style !"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut CHAR : {0}. Un attribut de type CHAR ne peut comporter qu''un seul caract\u00e8re !"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut QNAME : {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut ENUM : {0}. Les valeurs autoris\u00e9es sont : {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut NMTOKEN : {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut NCNAME : {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut bool\u00e9en : {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Valeur incorrecte : {1} utilis\u00e9e pour l''attribut number : {0}. "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "L''argument de {0} dans le motif de correspondance doit \u00eatre un litt\u00e9ral."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "D\u00e9claration de variable globale en double."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "D\u00e9claration de variable en double."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template doit comporter un attribut name et/ou match"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Pr\u00e9fixe de exclude-result-prefixes non valide : {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set {0} n''existe pas"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "La fonction {0} n''existe pas"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "L''\u00e9l\u00e9ment {0} ne peut poss\u00e9der un attribut content et un attribut select."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "La valeur du param\u00e8tre {0} doit \u00eatre un objet Java valide"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "L'attribut result-prefix d'un \u00e9l\u00e9ment xsl:namespace-alias a la valeur '#default', mais il n'existe aucune d\u00e9claration de l'espace de noms par d\u00e9faut dans la port\u00e9e de l'\u00e9l\u00e9ment"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "L''attribut result-prefix d''un \u00e9l\u00e9ment xsl:namespace-alias a la valeur ''{0}'', mais il n''existe aucune d\u00e9claration d''espace de noms pour le pr\u00e9fixe ''{0}'' dans la port\u00e9e de l''\u00e9l\u00e9ment."}, { ER_SET_FEATURE_NULL_NAME, "Le nom de la fonction ne peut pas avoir une valeur null dans TransformerFactory.setFeature (nom cha\u00eene, valeur bool\u00e9nne)."}, { ER_GET_FEATURE_NULL_NAME, "Le nom de la fonction ne peut pas avoir une valeur null dans TransformerFactory.getFeature (nom cha\u00eene)."}, { ER_UNSUPPORTED_FEATURE, "Impossible de d\u00e9finir la fonction ''{0}'' sur cet \u00e9l\u00e9ment TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "L''utilisation de l''\u00e9l\u00e9ment d''extension ''{0}'' n''est pas admise lorsque la fonction de traitement s\u00e9curis\u00e9e a la valeur true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Impossible d'obtenir le pr\u00e9fixe pour un uri d'espace de noms null."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Impossible d'obtenir l'uri d'espace de noms pour le pr\u00e9fixe null."}, { ER_XPATH_RESOLVER_NULL_QNAME, "Le nom de la fonction ne peut pas avoir une valeur null."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "La parit\u00e9 ne peut pas \u00eatre n\u00e9gative."}, // Warnings... { WG_FOUND_CURLYBRACE, "Une accolade ('}') a \u00e9t\u00e9 trouv\u00e9e alors qu'aucun mod\u00e8le d'attribut n'est ouvert !"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Avertissement : L''attribut de count n''a pas d''ascendant dans xsl:number ! Cible = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Syntaxe obsol\u00e8te : Le nom de l'attribut 'expr' a \u00e9t\u00e9 remplac\u00e9 par 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan ne g\u00e8re pas encore le nom d'environnement local de la fonction format-number."}, { WG_LOCALE_NOT_FOUND, "Avertissement : Impossible de trouver un environnement local pour xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "Impossible de cr\u00e9er l''URL \u00e0 partir de : {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Impossible de charger le document demand\u00e9 : {0}"}, { WG_CANNOT_FIND_COLLATOR, "Impossible de trouver une fonction de regroupement pour >>>>>> Version de Xalan "}, { "version2", "<<<<<<<"}, { "yes", "oui"}, { "line", "Ligne #"}, { "column","Colonne #"}, { "xsldone", "XSLProcessor : termin\u00e9"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Options de classe Process de ligne de commande Xalan-J :"}, { "xslProc_option", "Options de classe Process de ligne de commande Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "L''option {0} n''est pas prise en charge en mode XSLTC."}, { "xslProc_invalid_xalan_option", "L''option {0} s''utilise uniquement avec -XSLTC."}, { "xslProc_no_input", "Erreur : Aucun xml de feuille de style ou d'entr\u00e9e n'est sp\u00e9cifi\u00e9. Ex\u00e9cutez cette commande sans option pour les instructions d'utilisation."}, { "xslProc_common_options", "-Options courantes-"}, { "xslProc_xalan_options", "-Options pour Xalan-"}, { "xslProc_xsltc_options", "-Options pour XSLTC-"}, { "xslProc_return_to_continue", "(appuyez sur pour continuer)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (utilisez XSLTC pour la transformation)]"}, { "optionIN", " [-IN inputXMLURL]"}, { "optionXSL", " [-XSL URLXSLTransformation]"}, { "optionOUT", " [-OUT nomFichierSortie]"}, { "optionLXCIN", " [-LXCIN NomFichierFeuilleDeStylesCompil\u00e9Entr\u00e9e]"}, { "optionLXCOUT", " [-LXCOUT NomFichierFeuilleDeStylesCompil\u00e9Sortie]"}, { "optionPARSER", " [-PARSER nom de classe pleinement qualifi\u00e9 pour la liaison de l'analyseur]"}, { "optionE", " [-E (Ne pas d\u00e9velopper les r\u00e9f. d'entit\u00e9)]"}, { "optionV", " [-E (Ne pas d\u00e9velopper les r\u00e9f. d'entit\u00e9)]"}, { "optionQC", " [-QC (Avertissements brefs de conflits de motifs)]"}, { "optionQ", " [-Q (Mode bref)]"}, { "optionLF", " [-LF (Utilise des sauts de ligne uniquement dans la sortie {CR/LF par d\u00e9faut})]"}, { "optionCR", " [-LF (Utilise des retours chariot uniquement dans la sortie {CR/LF par d\u00e9faut})]"}, { "optionESCAPE", " [-ESCAPE (Caract\u00e8res d'\u00e9chappement {<>&\"\'\\r\\n par d\u00e9faut}]"}, { "optionINDENT", " [-INDENT (Nombre d'espaces pour le retrait {par d\u00e9faut 0})]"}, { "optionTT", " [-TT (Contr\u00f4le les appels de mod\u00e8les - fonction de trace.)]"}, { "optionTG", " [-TG (Contr\u00f4le chaque \u00e9v\u00e9nement de g\u00e9n\u00e9ration - fonction de trace.)]"}, { "optionTS", " [-TS (Contr\u00f4le chaque \u00e9v\u00e9nement de s\u00e9lection - fonction de trace.)]"}, { "optionTTC", " [-TTC (Contr\u00f4le les enfants du mod\u00e8le lors de leur traitement - fonction de trace.)]"}, { "optionTCLASS", " [-TCLASS (Classe TraceListener pour les extensions de trace.)]"}, { "optionVALIDATE", " [-VALIDATE (Indique si la validation se produit. La validation est d\u00e9sactiv\u00e9e par d\u00e9faut.)]"}, { "optionEDUMP", " [-EDUMP {nom de fichier optionnel} (Cr\u00e9e un vidage de pile en cas d'erreur.)]"}, { "optionXML", " [-XML (Utilise un formateur XML et ajoute un en-t\u00eate XML.)]"}, { "optionTEXT", " [-TEXT (Utilise un formateur de texte simple.)]"}, { "optionHTML", " [-HTML (Utilise un formateur HTML.)]"}, { "optionPARAM", " [-PARAM nom expression (D\u00e9finit un param\u00e8tre de feuille de style)]"}, { "noParsermsg1", "Echec du processus XSL."}, { "noParsermsg2", "** Analyseur introuvable **"}, { "noParsermsg3", "V\u00e9rifiez le chemin d'acc\u00e8s des classes."}, { "noParsermsg4", "XML Parser for Java disponible en t\u00e9l\u00e9chargement sur le site"}, { "noParsermsg5", "AlphaWorks de IBM : http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER nom de classe complet (Les URI sont r\u00e9solus par URIResolver)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER nom de classe complet (Les URI sont r\u00e9solus par EntityResolver)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER nom de classe complet (La s\u00e9rialisation de la sortie est effectu\u00e9e par ContentHandler)]"}, { "optionLINENUMBERS", " [-L utilisation des num\u00e9ros de ligne pour le document source]"}, { "optionSECUREPROCESSING", " [-SECURE (attribuez la valeur true \u00e0 la fonction de traitement s\u00e9curis\u00e9.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA type_de_support (Utilise un attribut de support pour trouver la feuille de style associ\u00e9e \u00e0 un document.)]"}, { "optionFLAVOR", " [-FLAVOR sax_ou_dom (effectue la transformation \u00e0 l'aide de SAX (s2s) ou de DOM (d2d).)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (affiche la dur\u00e9e globale de la transformation - en millisecondes.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (construction incr\u00e9mentielle du DTM en d\u00e9finissant http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (pas de traitement d'optimisation des feuilles de style en d\u00e9finissant http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL r\u00e9cursivit\u00e9_maxi (limite de la profondeur de la r\u00e9cursivit\u00e9 pour les feuilles de style.)]"}, { "optionXO", " [-XO [nom_translet] (assignation du nom au translet g\u00e9n\u00e9r\u00e9)]"}, { "optionXD", " [-XD r\u00e9pertoire_cible (sp\u00e9cification d'un r\u00e9pertoire de destination pour translet)]"}, { "optionXJ", " [-XJ fichier_jar (r\u00e9union des classes translet dans un fichier jar appel\u00e9 )]"}, { "optionXP", " [-XP module (sp\u00e9cification d'un pr\u00e9fixe de nom de module pour toutes les classes translet g\u00e9n\u00e9r\u00e9es)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (activation de la mise en ligne de mod\u00e8le)]" }, { "optionXX", " [-XX (activation du d\u00e9bogage suppl\u00e9mentaire de sortie de message)]"}, { "optionXT" , " [-XT (utilisation de translet pour la transformation si possible)]"}, { "diagTiming"," --------- La transformation de {0} via {1} a pris {2} ms" }, { "recursionTooDeep","Trop grande imbrication de mod\u00e8le. imbrication = {0}, mod\u00e8le {1} {2}" }, { "nameIs", "le nom est" }, { "matchPatternIs", "le motif de correspondance est" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Erreur : "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Avertissement : "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/package.html0000644000175000017500000000201310721374032022247 0ustar mkochmkoch Xalan resource Package.

        Contains strings that require internationalization.

        libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_ca.java0000644000175000017500000021112210721374030024774 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_ca.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_ca extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Error: no hi pot haver un car\u00e0cter '{' dins l'expressi\u00f3"}, { ER_ILLEGAL_ATTRIBUTE , "{0} t\u00e9 un atribut no perm\u00e8s: {1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode \u00e9s nul en xsl:apply-imports."}, {ER_CANNOT_ADD, "No es pot afegir {0} a {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode \u00e9s nul en handleApplyTemplatesInstruction."}, { ER_NO_NAME_ATTRIB, "{0} ha de tenir un atribut de nom."}, {ER_TEMPLATE_NOT_FOUND, "No s''ha trobat la plantilla anomenada: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "No s'ha pogut resoldre l'AVT de noms a xsl:call-template."}, {ER_REQUIRES_ATTRIB, "{0} necessita l''atribut: {1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} ha de tenir un atribut ''test''. "}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Valor incorrecte a l''atribut de nivell: {0}"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "El nom processing-instruction no pot ser 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "El nom processing-instruction ha de ser un NCName v\u00e0lid: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0} ha de tenir un atribut que hi coincideixi si t\u00e9 una modalitat."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} necessita un nom o un atribut que hi coincideixi."}, {ER_CANT_RESOLVE_NSPREFIX, "No s''ha pogut resoldre el prefix d''espai de noms: {0}"}, { ER_ILLEGAL_VALUE, "xml:space t\u00e9 un valor no v\u00e0lid: {0}"}, { ER_NO_OWNERDOC, "El node subordinat no t\u00e9 un document de propietari."}, { ER_ELEMTEMPLATEELEM_ERR, "Error d''ElemTemplateElement: {0}"}, { ER_NULL_CHILD, "S'est\u00e0 intentant afegir un subordinat nul."}, { ER_NEED_SELECT_ATTRIB, "{0} necessita un atribut de selecci\u00f3."}, { ER_NEED_TEST_ATTRIB , "xsl:when ha de tenir un atribut 'test'."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param ha de tenir un atribut 'name'."}, { ER_NO_CONTEXT_OWNERDOC, "El context no t\u00e9 un document de propietari."}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "No s''ha pogut crear la relaci\u00f3 XML TransformerFactory: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: el proc\u00e9s no ha estat correcte."}, { ER_NOT_SUCCESSFUL, "Xalan no ha estat correcte."}, { ER_ENCODING_NOT_SUPPORTED, "La codificaci\u00f3 no t\u00e9 suport: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "No s''ha pogut crear TraceListener: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key necessita un atribut 'name'."}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key necessita un atribut 'match'."}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key necessita un atribut 'use'."}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} necessita un atribut ''elements''. "}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) falta l''atribut ''prefix'' {0}. "}, { ER_BAD_STYLESHEET_URL, "La URL del full d''estils \u00e9s incorrecta: {0}"}, { ER_FILE_NOT_FOUND, "No s''ha trobat el fitxer del full d''estils: {0}"}, { ER_IOEXCEPTION, "S''ha produ\u00eft una excepci\u00f3 d''E/S amb el fitxer de full d''estils: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) No s''ha trobat l''atribut href de {0}"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} s''est\u00e0 incloent a ell mateix directament o indirecta."}, { ER_PROCESSINCLUDE_ERROR, "Error de StylesheetHandler.processInclude, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) falta l''atribut ''lang'' {0}. "}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) L''element {0} \u00e9s fora de lloc? Falta l''element de contenidor ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "La sortida nom\u00e9s pot ser cap a un Element, Fragment de document, Document o Transcriptor de documents."}, { ER_PROCESS_ERROR, "Error de StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "Error d''UnImplNode: {0}"}, { ER_NO_SELECT_EXPRESSION, "Error. No s'ha trobat l'expressi\u00f3 select d'xpath (-select)."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "No es pot serialitzar un XSLProcessor."}, { ER_NO_INPUT_STYLESHEET, "No s'ha especificat l'entrada del full d'estils."}, { ER_FAILED_PROCESS_STYLESHEET, "No s'ha pogut processar el full d'estils."}, { ER_COULDNT_PARSE_DOC, "No s''ha pogut analitzar el document {0}."}, { ER_COULDNT_FIND_FRAGMENT, "No s''ha pogut trobar el fragment: {0}"}, { ER_NODE_NOT_ELEMENT, "El node al qual apuntava l''identificador de fragments no era un element: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each ha de tenir o b\u00e9 una coincid\u00e8ncia o b\u00e9 un atribut de nom."}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "Les plantilles han de tenir o b\u00e9 una coincid\u00e8ncia o b\u00e9 un atribut de nom."}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "No hi ha cap clonatge d'un fragment de document."}, { ER_CANT_CREATE_ITEM, "No es pot crear un element a l''arbre de resultats: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space de l''XML d''origen t\u00e9 un valor no perm\u00e8s: {0}"}, { ER_NO_XSLKEY_DECLARATION, "No hi ha cap declaraci\u00f3 d''xls:key per a {0}."}, { ER_CANT_CREATE_URL, "Error. No es pot crear la URL de: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions no t\u00e9 suport."}, { ER_PROCESSOR_ERROR, "Error d'XSLT TransformerFactory"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} no est\u00e0 perm\u00e8s dins d''un full d''estils."}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns ja no t\u00e9 suport. En comptes d'aix\u00f2, feu servir xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space ja no t\u00e9 suport. En comptes d'aix\u00f2, feu servir xsl:strip-space o xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result ja no t\u00e9 suport. En comptes d'aix\u00f2, feu servir xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} t\u00e9 un atribut no perm\u00e8s: {1}"}, { ER_UNKNOWN_XSL_ELEM, "Element XSL desconegut: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort nom\u00e9s es pot utilitzar amb xsl:apply-templates o xsl:for-each."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when est\u00e0 mal col\u00b7locat."}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when no ha estat analitzat per xsl:choose."}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise est\u00e0 mal col\u00b7locat."}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise no t\u00e9 com a superior xsl:choose."}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} no est\u00e0 perm\u00e8s dins d''una plantilla."}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} prefix d''espai de noms d''extensi\u00f3 {1} desconegut"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Les importacions nom\u00e9s es poden produir com els primers elements del full d'estils."}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} s''est\u00e0 important a ell mateix directament o indirecta."}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space t\u00e9 un valor no perm\u00e8s: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet no ha estat correcte."}, { ER_SAX_EXCEPTION, "Excepci\u00f3 SAX"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Aquesta funci\u00f3 no t\u00e9 suport."}, { ER_XSLT_ERROR, "Error d'XSLT"}, { ER_CURRENCY_SIGN_ILLEGAL, "El signe de moneda no est\u00e0 perm\u00e8s en una cadena de patr\u00f3 de format."}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "La funci\u00f3 document no t\u00e9 suport al DOM de full d'estils."}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "No es pot resoldre el prefix del solucionador sense prefix."}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Extensi\u00f3 de redirecci\u00f3: No s'ha pogut obtenir el nom del fitxer - els atributs file o select han de retornar una cadena v\u00e0lida."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "No es pot crear build FormatterListener en l'extensi\u00f3 de redirecci\u00f3."}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "El prefix d''exclude-result-prefixes no \u00e9s v\u00e0lid: {0}"}, { ER_MISSING_NS_URI, "Falta l'URI d'espai de noms del prefix especificat."}, { ER_MISSING_ARG_FOR_OPTION, "Falta un argument de l''opci\u00f3: {0}"}, { ER_INVALID_OPTION, "Opci\u00f3 no v\u00e0lida: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Cadena de format mal formada: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet necessita un atribut 'version'."}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "L''atribut {0} t\u00e9 un valor no perm\u00e8s {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose necessita un xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports no es permeten en un xsl:for-each"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "No es pot utilitzar una DTMLiaison per a un node DOM de sortida. En lloc d'aix\u00f2, utilitzeu org.apache.xpath.DOM2Helper."}, { ER_CANT_USE_DTM_FOR_INPUT, "No es pot utilitzar una DTMLiaison per a un node DOM d'entrada. En lloc d'aix\u00f2, utilitzeu org.apache.xpath.DOM2Helper."}, { ER_CALL_TO_EXT_FAILED, "S''ha produ\u00eft un error en la crida de l''element d''extensi\u00f3 {0}"}, { ER_PREFIX_MUST_RESOLVE, "El prefix s''ha de resoldre en un espai de noms: {0}"}, { ER_INVALID_UTF16_SURROGATE, "S''ha detectat un suplent UTF-16 no v\u00e0lid: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} s''ha utilitzat a ell mateix; aix\u00f2 crear\u00e0 un bucle infinit."}, { ER_CANNOT_MIX_XERCESDOM, "No es pot barrejar entrada no Xerces-DOM amb sortida Xerces-DOM."}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "En ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "S''ha trobat m\u00e9s d''una plantilla anomenada {0}"}, { ER_INVALID_KEY_CALL, "Crida de funci\u00f3 no v\u00e0lida: les crides key() recursives no estan permeses."}, { ER_REFERENCING_ITSELF, "La variable {0} est\u00e0 fent refer\u00e8ncia a ella mateixa directa o indirectament."}, { ER_ILLEGAL_DOMSOURCE_INPUT, "El node d'entrada no pot ser nul per a DOMSource de newTemplates."}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "No s''ha trobat el fitxer de classe per a l''opci\u00f3 {0}"}, { ER_REQUIRED_ELEM_NOT_FOUND, "L''element necessari no s''ha trobat: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream no pot ser nul."}, { ER_URI_CANNOT_BE_NULL, "L'URI no pot ser nul."}, { ER_FILE_CANNOT_BE_NULL, "El fitxer no pot ser nul."}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource no pot ser nul."}, { ER_CANNOT_INIT_BSFMGR, "No s'ha pogut inicialitzar BSF Manager"}, { ER_CANNOT_CMPL_EXTENSN, "No s'ha pogut compilar l'extensi\u00f3"}, { ER_CANNOT_CREATE_EXTENSN, "No s''ha pogut crear l''extensi\u00f3 {0} a causa de {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "La crida del m\u00e8tode d''inst\u00e0ncia {0} necessita una inst\u00e0ncia d''objecte com a primer argument"}, { ER_INVALID_ELEMENT_NAME, "S''ha especificat un nom d''element no v\u00e0lid {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "El m\u00e8tode del nom de l''element ha de ser est\u00e0tic {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "No es coneix la funci\u00f3 d''extensi\u00f3 {0} : {1}."}, { ER_MORE_MATCH_CONSTRUCTOR, "Hi ha m\u00e9s d''una millor coincid\u00e8ncia per al constructor de {0}"}, { ER_MORE_MATCH_METHOD, "Hi ha m\u00e9s d''una millor coincid\u00e8ncia per al m\u00e8tode {0}"}, { ER_MORE_MATCH_ELEMENT, "Hi ha m\u00e9s d''una millor coincid\u00e8ncia per al m\u00e8tode d''element {0}"}, { ER_INVALID_CONTEXT_PASSED, "S''ha donat un context no v\u00e0lid per avaluar {0}"}, { ER_POOL_EXISTS, "L'agrupaci\u00f3 ja existeix"}, { ER_NO_DRIVER_NAME, "No s'ha especificat cap nom de controlador"}, { ER_NO_URL, "No s'ha especificat cap URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "La grand\u00e0ria de l'agrupaci\u00f3 \u00e9s inferior a u"}, { ER_INVALID_DRIVER, "S'ha especificat un nom de controlador no v\u00e0lid"}, { ER_NO_STYLESHEETROOT, "No s'ha trobat l'arrel del full d'estils"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Valor no perm\u00e8s per a xml:space"}, { ER_PROCESSFROMNODE_FAILED, "S'ha produ\u00eft un error a processFromNode"}, { ER_RESOURCE_COULD_NOT_LOAD, "No s''ha pogut carregar el recurs [ {0} ]: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Grand\u00e0ria del buffer <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "S'ha produ\u00eft un error desconegut en cridar l'extensi\u00f3"}, { ER_NO_NAMESPACE_DECL, "El prefix {0} no t\u00e9 una declaraci\u00f3 d''espai de noms corresponent"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "El contingut de l''element no est\u00e0 perm\u00e8s per a lang=javaclass {0}"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "El full d'estils ha ordenat l'acabament"}, { ER_ONE_OR_TWO, "1 o 2"}, { ER_TWO_OR_THREE, "2 o 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "No s''ha pogut carregar {0} (comproveu la CLASSPATH); ara s''estan fent servir els valors per defecte."}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "No es poden inicialitzar les plantilles per defecte"}, { ER_RESULT_NULL, "El resultat no ha de ser nul"}, { ER_RESULT_COULD_NOT_BE_SET, "No s'ha pogut establir el resultat"}, { ER_NO_OUTPUT_SPECIFIED, "No s'ha especificat cap sortida"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "No s''ha pogut transformar en un resultat del tipus {0}"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "No s''ha pogut transformar en un origen del tipus {0}"}, { ER_NULL_CONTENT_HANDLER, "Manejador de contingut nul"}, { ER_NULL_ERROR_HANDLER, "Manejador d'error nul"}, { ER_CANNOT_CALL_PARSE, "L'an\u00e0lisi no es pot cridar si no s'ha establert ContentHandler"}, { ER_NO_PARENT_FOR_FILTER, "El filtre no t\u00e9 superior"}, { ER_NO_STYLESHEET_IN_MEDIA, "No s''ha trobat cap full d''estils a {0}, suport= {1}"}, { ER_NO_STYLESHEET_PI, "No s''ha trobat cap PI d''xml-stylesheet a {0}"}, { ER_NOT_SUPPORTED, "No t\u00e9 suport: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "El valor de la propietat {0} ha de ser una inst\u00e0ncia booleana"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "No s''ha pogut arribar a l''script extern a {0}"}, { ER_RESOURCE_COULD_NOT_FIND, "No s''ha trobat el recurs [ {0} ].\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "La propietat de sortida no es reconeix: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "S'ha produ\u00eft un error en crear la inst\u00e0ncia ElemLiteralResult"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "El valor de {0} ha de contenir un n\u00famero que es pugui analitzar"}, { ER_VALUE_SHOULD_EQUAL, "El valor de {0} ha de ser igual a yes o no"}, { ER_FAILED_CALLING_METHOD, "No s''ha pogut cridar el m\u00e8tode {0}"}, { ER_FAILED_CREATING_ELEMTMPL, "No s'ha pogut crear la inst\u00e0ncia ElemTemplateElement"}, { ER_CHARS_NOT_ALLOWED, "En aquest punt del document no es permeten els car\u00e0cters"}, { ER_ATTR_NOT_ALLOWED, "L''atribut \"{0}\" no es permet en l''element {1}"}, { ER_BAD_VALUE, "{0} valor erroni {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "No s''ha trobat el valor de l''atribut {0} "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "No es reconeix el valor de l''atribut {0} "}, { ER_NULL_URI_NAMESPACE, "S'intenta generar un prefix d'espai de noms amb un URI nul"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "S'intenta formatar un n\u00famero m\u00e9s gran que l'enter llarg m\u00e9s gran"}, { ER_CANNOT_FIND_SAX1_DRIVER, "No es pot trobar la classe de controlador SAX1 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "S''ha trobat la classe de controlador SAX1 {0} per\u00f2 no es pot carregar"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "S''ha carregat la classe de controlador SAX1 {0} per\u00f2 no es pot particularitzar"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "La classe de controlador SAX1 {0} no implementa org.xml.sax.Parser"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "No s'ha identificat la propietat del sistema org.xml.sax.parser"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "L'argument d'analitzador ha de ser nul"}, { ER_FEATURE, "Caracter\u00edstica: {0}"}, { ER_PROPERTY, "Propietat: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Solucionador d'entitat nul"}, { ER_NULL_DTD_HANDLER, "Manejador de DTD nul"}, { ER_NO_DRIVER_NAME_SPECIFIED, "No s'ha especificat cap nom de controlador"}, { ER_NO_URL_SPECIFIED, "No s'ha especificat cap URL"}, { ER_POOLSIZE_LESS_THAN_ONE, "La grand\u00e0ria de l'agrupaci\u00f3 \u00e9s inferior a 1"}, { ER_INVALID_DRIVER_NAME, "S'ha especificat un nom de controlador no v\u00e0lid"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Error del programador. L'expressi\u00f3 no t\u00e9 cap superior ElemTemplateElement "}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "L''afirmaci\u00f3 del programador a RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} no es permet en aquesta posici\u00f3 del full d''estil"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "No es permet text sense espais en blanc en aquesta posici\u00f3 del full d'estil"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut CHAR {0}. Un atribut de tipus CHAR nom\u00e9s ha de contenir un car\u00e0cter."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut QNAME {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut ENUM {0}. Els valors v\u00e0lids s\u00f3n {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut NMTOKEN {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut NCNAME {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut boolean {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "S''ha utilitzat un valor no perm\u00e8s {1} per a l''atribut number {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "L''argument de {0} del patr\u00f3 de coincid\u00e8ncia ha de ser un literal."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "La declaraci\u00f3 de variable global est\u00e0 duplicada."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "La declaraci\u00f3 de variable est\u00e0 duplicada."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template ha de tenir un nom o un atribut de coincid\u00e8ncia (o tots dos)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "El prefix d''exclude-result-prefixes no \u00e9s v\u00e0lid: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set anomenat {0} no existeix"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "La funci\u00f3 anomenada {0} no existeix"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "L''element {0} no ha de tenir ni l''atribut content ni el select. "}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "El valor del par\u00e0metre {0} ha de ser un objecte Java v\u00e0lid "}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "L'atribut result-prefix d'un element xsl:namespace-alias t\u00e9 el valor '#default', per\u00f2 no hi ha cap declaraci\u00f3 de l'espai de noms per defecte en l'\u00e0mbit de l'element "}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "L''atribut result-prefix d''un element xsl:namespace-alias t\u00e9 el valor ''{0}'', per\u00f2 no hi ha cap declaraci\u00f3 d''espai de noms per al prefix ''{0}'' en l''\u00e0mbit de l''element. "}, { ER_SET_FEATURE_NULL_NAME, "El nom de la caracter\u00edstica no pot ser nul a TransformerFactory.setFeature(nom de la cadena, valor boole\u00e0). "}, { ER_GET_FEATURE_NULL_NAME, "El nom de la caracter\u00edstica no pot ser nul a TransformerFactory.getFeature(nom de cadena). "}, { ER_UNSUPPORTED_FEATURE, "No es pot establir la caracter\u00edstica ''{0}'' en aquesta TransformerFactory."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "L''\u00fas de l''element d''extensi\u00f3 ''{0}'' no est\u00e0 perm\u00e8s, si la caracter\u00edstica de proc\u00e9s segur s''ha establert en true."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "No es pot obtenir el prefix per a un URI de nom d'espais nul. "}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "No es pot obtenir l'URI del nom d'espais per a un prefix nul. "}, { ER_XPATH_RESOLVER_NULL_QNAME, "El nom de la funci\u00f3 no pot ser nul. "}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "L'aritat no pot ser negativa."}, // Warnings... { WG_FOUND_CURLYBRACE, "S'ha trobat '}' per\u00f2 no hi ha cap plantilla d'atribut oberta"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Av\u00eds: l''atribut de recompte no coincideix amb un antecessor d''xsl:number. Destinaci\u00f3 = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Sintaxi antiga: El nom de l'atribut 'expr' s'ha canviat per 'select'."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan encara no pot gestionar el nom de l'entorn nacional a la funci\u00f3 format-number."}, { WG_LOCALE_NOT_FOUND, "Av\u00eds: no s''ha trobat l''entorn nacional d''xml:lang={0}"}, { WG_CANNOT_MAKE_URL_FROM, "No es pot crear la URL de: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "No es pot carregar el document sol\u00b7licitat: {0}"}, { WG_CANNOT_FIND_COLLATOR, "No s''ha trobat el classificador de >>>>>> Versi\u00f3 Xalan "}, { "version2", "<<<<<<<"}, { "yes", "s\u00ed"}, { "line", "L\u00ednia n\u00fam."}, { "column","Columna n\u00fam."}, { "xsldone", "XSLProcessor: fet"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Opcions de classe del proc\u00e9s de l\u00ednia d'ordres de Xalan-J:"}, { "xslProc_option", "Opcions de classe del proc\u00e9s de l\u00ednia d'ordres de Xalan-J\u003a"}, { "xslProc_invalid_xsltc_option", "L''opci\u00f3 {0} no t\u00e9 suport en modalitat XSLTC."}, { "xslProc_invalid_xalan_option", "L''opci\u00f3 {0} nom\u00e9s es pot fer servir amb -XSLTC."}, { "xslProc_no_input", "Error: no s'ha especificat cap full d'estils o xml d'entrada. Per obtenir les instruccions d'\u00fas, executeu aquesta ordre sense opcions."}, { "xslProc_common_options", "-Opcions comuns-"}, { "xslProc_xalan_options", "-Opcions per a Xalan-"}, { "xslProc_xsltc_options", "-Opcions per a XSLTC-"}, { "xslProc_return_to_continue", "(premeu per continuar)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", " [-XSLTC (Utilitza XSLTC per a la transformaci\u00f3)]"}, { "optionIN", " [-IN URL_XML_entrada]"}, { "optionXSL", " [-XSL URL_transformaci\u00f3_XSL]"}, { "optionOUT", " [-OUT nom_fitxer_sortida]"}, { "optionLXCIN", " [-LXCIN entrada_nom_fitxer_full_estil_compilat]"}, { "optionLXCOUT", " [-LXCOUT sortida_nom_fitxer_full_estil_compilat]"}, { "optionPARSER", " [-PARSER nom de classe completament qualificat de la relaci\u00f3 de l'analitzador]"}, { "optionE", " [-E (No amplia les refer\u00e8ncies d'entitat)]"}, { "optionV", " [-E (No amplia les refer\u00e8ncies d'entitat)]"}, { "optionQC", " [-QC (Avisos de conflictes de patr\u00f3 redu\u00eft)]"}, { "optionQ", " [-Q (Modalitat redu\u00efda)]"}, { "optionLF", " [-LF (Utilitza salts de l\u00ednia nom\u00e9s a la sortida {el valor per defecte \u00e9s CR/LF})]"}, { "optionCR", " [-CR (Utilitza retorns de carro nom\u00e9s a la sortida {el valor per defecte \u00e9s CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Car\u00e0cters per aplicar un escapament {el valor per defecte \u00e9s <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Controla quants espais tindr\u00e0 el sagnat {el valor per defecte \u00e9s 0})]"}, { "optionTT", " [-TT (Fa un rastreig de les plantilles a mesura que es criden.)]"}, { "optionTG", " [-TG (Fa un rastreig de cada un dels esdeveniments de generaci\u00f3.)]"}, { "optionTS", " [-TS (Fa un rastreig de cada un dels esdeveniments de selecci\u00f3.)]"}, { "optionTTC", " [-TTC (Fa un rastreig dels subordinats de plantilla a mesura que es processen.)]"}, { "optionTCLASS", " [-TCLASS (Classe TraceListener per a extensions de rastreig.)]"}, { "optionVALIDATE", " [-VALIDATE (Estableix si es produeix la validaci\u00f3. Per defecte no est\u00e0 activada.)]"}, { "optionEDUMP", " [-EDUMP {nom de fitxer opcional} (Fer el buidatge de la pila si es produeix un error.)]"}, { "optionXML", " [-XML (Utilitza el formatador XML i afegeix la cap\u00e7alera XML.)]"}, { "optionTEXT", " [-TEXT (Utilitza el formatador de text simple.)]"}, { "optionHTML", " [-HTML (Utilitza el formatador HTML.)]"}, { "optionPARAM", " [-PARAM expressi\u00f3 del nom (Estableix un par\u00e0metre de full d'estils)]"}, { "noParsermsg1", "El proc\u00e9s XSL no ha estat correcte."}, { "noParsermsg2", "** No s'ha trobat l'analitzador **"}, { "noParsermsg3", "Comproveu la vostra classpath."}, { "noParsermsg4", "Si no teniu XML Parser for Java d'IBM, el podeu baixar de l'indret web"}, { "noParsermsg5", "AlphaWorks d'IBM: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER nom de classe complet (URIResolver que s'ha d'utilitzar per resoldre URI)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER nom de classe complet (EntityResolver que s'ha d'utilitzar per resoldre entitats)]"}, { "optionCONTENTHANDLER", " [-CONTENTHANDLER nom de classe complet (ContentHandler que s'ha d'utilitzar per serialitzar la sortida)]"}, { "optionLINENUMBERS", " [-L utilitza els n\u00fameros de l\u00ednia del document origen]"}, { "optionSECUREPROCESSING", " [-SECURE (estableix la caracter\u00edstica de proc\u00e9s segur en true.)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (utilitza l'atribut media per trobar un full d'estils relacionat amb un document.)]"}, { "optionFLAVOR", " [-FLAVOR nom_flavor (utilitza expl\u00edcitament s2s=SAX o d2d=DOM per fer una transformaci\u00f3.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Imprimex els mil\u00b7lisegons en total que ha trigat la transformaci\u00f3.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (sol\u00b7licita la construcci\u00f3 de DTM incremental establint http://xml.apache.org/xalan/features/incremental en true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (sol\u00b7licita que no es processi l'optimitzaci\u00f3 de full d'estils establint http://xml.apache.org/xalan/features/optimize en false.)]"}, { "optionRL", " [-RL recursionlimit (confirma el l\u00edmit num\u00e8ric de la profunditat de recursivitat del full d'estils.)]"}, { "optionXO", " [-XO [nom_translet] (assigna el nom al translet generat)]"}, { "optionXD", " [-XD directori_destinaci\u00f3 (especifica un directori de destinaci\u00f3 per al translet)]"}, { "optionXJ", " [-XJ fitxer_jar (empaqueta les classes de translet en un fitxer jar amb el nom )]"}, { "optionXP", " [-XP paquet (especifica un prefix de nom de paquet per a totes les classes de translet generades)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", " [-XN (habilita l'inlining de plantilles)]" }, { "optionXX", " [-XX (activa la sortida de missatges de depuraci\u00f3 addicionals)]"}, { "optionXT" , " [-XT (utilitza el translet per a la transformaci\u00f3 si \u00e9s possible)]"}, { "diagTiming"," --------- La transformaci\u00f3 de {0} mitjan\u00e7ant {1} ha trigat {2} ms" }, { "recursionTooDeep","La imbricaci\u00f3 de plantilles t\u00e9 massa nivells. Imbricaci\u00f3 = {0}, plantilla{1} {2}" }, { "nameIs", "el nom \u00e9s" }, { "matchPatternIs", "el patr\u00f3 de coincid\u00e8ncia \u00e9s" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Error: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Av\u00eds: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("ca", "ES")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_ko.java0000644000175000017500000024172510721374032025040 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_ko.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_ko extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "\uc624\ub958: \ud45c\ud604\uc2dd\uc5d0 '{'\uac00 \uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ILLEGAL_ATTRIBUTE , "{0}\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uc18d\uc131 {1}\uc774(\uac00) \uc788\uc2b5\ub2c8\ub2e4."}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "xsl:apply-imports\uc5d0\uc11c sourceNode\uac00 \ub110(null)\uc785\ub2c8\ub2e4."}, {ER_CANNOT_ADD, "{1}\uc5d0 {0}\uc744(\ub97c) \ucd94\uac00\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "handleApplyTemplatesInstruction\uc5d0\uc11c sourceNode\uac00 \ub110(null)\uc785\ub2c8\ub2e4."}, { ER_NO_NAME_ATTRIB, "{0}\uc5d0 \uc774\ub984 \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, {ER_TEMPLATE_NOT_FOUND, "{0} \uc774\ub984\uc758 \ud15c\ud50c\ub9ac\ud2b8\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {ER_CANT_RESOLVE_NAME_AVT, "xsl:call-template\uc5d0 \uc788\ub294 \uc774\ub984 AVT\ub97c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, {ER_REQUIRES_ATTRIB, "{0}\uc740(\ub294) {1} \uc18d\uc131\uc744 \ud544\uc694\ub85c \ud569\ub2c8\ub2e4."}, { ER_MUST_HAVE_TEST_ATTRIB, "{0}\uc5d0 ''test'' \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "{0} \ub808\ubca8 \uc18d\uc131\uc5d0 \uc798\ubabb\ub41c \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4."}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "\ucc98\ub9ac \uba85\ub839\uc5b4 \uc774\ub984\uc740 'xml'\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "\ucc98\ub9ac \uba85\ub839\uc5b4 \uc774\ub984\uc740 \uc720\ud6a8\ud55c NCName\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4: {0}"}, { ER_NEED_MATCH_ATTRIB, "{0}\uc5d0 \ubaa8\ub4dc\uac00 \uc788\uc73c\uba74 \uc77c\uce58 \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0}\uc5d0 \uc774\ub984 \ub610\ub294 \uc77c\uce58 \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, {ER_CANT_RESOLVE_NSPREFIX, "\uc774\ub984 \uacf5\uac04 \uc811\ub450\ubd80\ub97c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_ILLEGAL_VALUE, "xml:space\uc5d0 \uc798\ubabb\ub41c \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NO_OWNERDOC, "\ud558\uc704 \ub178\ub4dc\uc5d0 \uc18c\uc720\uc790 \ubb38\uc11c\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement \uc624\ub958: {0}"}, { ER_NULL_CHILD, "\ub110(null) \ud558\uc704\ub97c \ucd94\uac00\ud558\ub824\uace0 \ud569\ub2c8\ub2e4."}, { ER_NEED_SELECT_ATTRIB, "{0}\uc5d0 \uc120\ud0dd\uc801 \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_NEED_TEST_ATTRIB , "xsl:when\uc5d0 'test' \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param\uc5d0 'name' \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_NO_CONTEXT_OWNERDOC, "\ubb38\ub9e5\uc5d0 \uc18c\uc720\uc790 \ubb38\uc11c\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "XML TransformerFactory Liaison\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: \ud504\ub85c\uc138\uc2a4\uac00 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_NOT_SUCCESSFUL, "Xalan:\uc774 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_ENCODING_NOT_SUPPORTED, "\uc778\ucf54\ub529\uc774 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "TraceListener\ub97c \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key\uc5d0 'name' \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key\uc5d0 'match' \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key\uc5d0 'use' \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0}\uc5d0 ''elements'' \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} \uc18d\uc131 ''prefix''\uac00 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_BAD_STYLESHEET_URL, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 URL\uc774 \uc798\ubabb\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0}"}, { ER_FILE_NOT_FOUND, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ud30c\uc77c\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_IOEXCEPTION, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ud30c\uc77c\uc5d0 \uc785\ucd9c\ub825 \uc608\uc678\uac00 \uc788\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) {0}\uc758 href \uc18d\uc131\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0}\uc774(\uac00) \uc9c1\uc811 \ub610\ub294 \uac04\uc811\uc801\uc73c\ub85c \uc790\uc2e0\uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4."}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude \uc624\ub958, {0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} \uc18d\uc131 ''lang''\uc774 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) {0} \uc694\uc18c\uac00 \uc798\ubabb\ub41c \uc704\uce58\uc5d0 \uc788\uc2b5\ub2c8\ub2e4. \ucee8\ud14c\uc774\ub108 \uc694\uc18c ''component''\uac00 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Element, DocumentFragment, Document \ub610\ub294 PrintWriter\ub85c\ub9cc \ucd9c\ub825\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_PROCESS_ERROR, "StylesheetRoot.process \uc624\ub958"}, { ER_UNIMPLNODE_ERROR, "UnImplNode \uc624\ub958: {0}"}, { ER_NO_SELECT_EXPRESSION, "\uc624\ub958. xpath \uc120\ud0dd \ud45c\ud604\uc2dd(-select)\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "XSLProcessor\ub97c \uc9c1\ub82c\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_INPUT_STYLESHEET, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \uc785\ub825\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_FAILED_PROCESS_STYLESHEET, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8\ub97c \ucc98\ub9ac\ud558\ub294 \ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_COULDNT_PARSE_DOC, "{0} \ubb38\uc11c\ub97c \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_COULDNT_FIND_FRAGMENT, "\ub2e8\ud3b8\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NODE_NOT_ELEMENT, "\ub2e8\ud3b8 ID\uac00 \uac00\ub9ac\ud0a4\ub294 \ub178\ub4dc\uac00 \uc694\uc18c\uac00 \uc544\ub2d9\ub2c8\ub2e4: {0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each\uc5d0\ub294 \uc77c\uce58 \ub610\ub294 \uc774\ub984 \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "\ud15c\ud50c\ub9ac\ud2b8\uc5d0\ub294 \uc77c\uce58 \ub610\ub294 \uc774\ub984 \uc18d\uc131\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\ubb38\uc11c \ub2e8\ud3b8\uc758 \ubcf5\uc81c\ubcf8\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CREATE_ITEM, "\uacb0\uacfc \ud2b8\ub9ac\uc5d0 \ud56d\ubaa9\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_XMLSPACE_ILLEGAL_VALUE, "\uc6d0\ubcf8 XML\uc758 xml:space\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4: {0}"}, { ER_NO_XSLKEY_DECLARATION, "{0}\uc5d0 \ub300\ud55c xsl:key \uc120\uc5b8\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANT_CREATE_URL, "\uc624\ub958. url\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory \uc624\ub958"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) \uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ub0b4\uc5d0 {0}\uc774(\uac00) \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns\uac00 \ub354 \uc774\uc0c1 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 xsl:output\uc744 \uc0ac\uc6a9\ud558\uc2ed\uc2dc\uc624."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space\uac00 \ub354 \uc774\uc0c1 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 xsl:strip-space \ub610\ub294 xsl:preserve-space\ub97c \uc0ac\uc6a9\ud558\uc2ed\uc2dc\uc624."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result\uac00 \ub354 \uc774\uc0c1 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 xsl:output\uc744 \uc0ac\uc6a9\ud558\uc2ed\uc2dc\uc624."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0}\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uc18d\uc131\uc774 \uc788\uc2b5\ub2c8\ub2e4: {1}"}, { ER_UNKNOWN_XSL_ELEM, "\uc54c \uc218 \uc5c6\ub294 XSL \uc694\uc18c: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort\ub294 xsl:apply-templates \ub610\ub294 xsl:for-each\uc640 \ud568\uaed8 \uc0ac\uc6a9\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when\uc774 \uc798\ubabb\ub41c \uc704\uce58\uc5d0 \ub193\uc5ec \uc788\uc2b5\ub2c8\ub2e4."}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when\uc774 xsl:choose\uc758 \uc0c1\uc704\uc5d0 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise\uac00 \uc798\ubabb\ub41c \uc704\uce58\uc5d0 \ub193\uc5ec \uc788\uc2b5\ub2c8\ub2e4."}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise\uac00 xsl:choose\uc758 \uc0c1\uc704\uc5d0 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) \ud15c\ud50c\ub9ac\ud2b8 \ub0b4\uc5d0 {0}\uc774(\uac00) \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} \ud655\uc7a5 \uc774\ub984 \uacf5\uac04 \uc811\ub450\ubd80 {1}\uc744(\ub97c) \uc54c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) \uac00\uc838\uc624\uae30\ub294 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uc5d0\uc11c \uccab \ubc88\uc9f8 \uc694\uc18c\ub85c\ub9cc \ub098\ud0c0\ub0a0 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0}\uc774(\uac00) \uc9c1\uc811 \ub610\ub294 \uac04\uc811\uc801\uc73c\ub85c \uc790\uc2e0\uc744 \uac00\uc838\uc635\ub2c8\ub2e4."}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:\uacf5\uac04\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4: {0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_SAX_EXCEPTION, "SAX \uc608\uc678"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "\ud568\uc218\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_XSLT_ERROR, "XSLT \uc624\ub958"}, { ER_CURRENCY_SIGN_ILLEGAL, "\ud3ec\ub9f7 \ud328\ud134 \ubb38\uc790\uc5f4\uc5d0 \ud1b5\ud654 \ubd80\ud638\uac00 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 DOM\uc5d0\uc11c Document \ud568\uc218\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "\ube44\uc811\ub450\ubd80 \ubd84\uc11d\uc790\uc758 \uc811\ub450\ubd80\ub97c \ubd84\uc11d\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Redirect extension: \ud30c\uc77c \uc774\ub984\uc744 \uac00\uc838\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ud30c\uc77c \ub610\ub294 \uc120\ud0dd\uc801 \uc18d\uc131\uc740 \uc62c\ubc14\ub978 \ubb38\uc790\uc5f4\uc744 \ub9ac\ud134\ud574\uc57c \ud569\ub2c8\ub2e4."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "\uacbd\ub85c \uc7ac\uc9c0\uc815 \ud655\uc7a5\uc5d0 FormatterListener\ub97c \ube4c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "exclude-result-prefixes\uc5d0 \uc788\ub294 \uc811\ub450\ubd80\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { ER_MISSING_NS_URI, "\uc9c0\uc815\ub41c \uc811\ub450\ubd80\uc758 \uc774\ub984 \uacf5\uac04 URI\uac00 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_MISSING_ARG_FOR_OPTION, "\uc635\uc158\uc758 \uc778\uc218\uac00 \ub204\ub77d\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0}"}, { ER_INVALID_OPTION, "\uc798\ubabb\ub41c \uc635\uc158: {0}"}, { ER_MALFORMED_FORMAT_STRING, "\uc798\ubabb \ud615\uc2dd\ud654\ub41c \ud3ec\ub9f7 \ubb38\uc790\uc5f4: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet\uc5d0 'version' \uc18d\uc131\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "\uc18d\uc131: {0}\uc5d0 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uac12\uc774 \uc788\uc2b5\ub2c8\ub2e4: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose\uc5d0 xsl:when\uc774 \ud544\uc694\ud569\ub2c8\ub2e4."}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports\ub294 xsl:for-each\uc5d0 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_CANT_USE_DTM_FOR_OUTPUT, "\ucd9c\ub825 DOM \ub178\ub4dc\uc5d0 DTMLiaison\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 org.apache.xpath.DOM2Helper\ub97c \uc804\ub2ec\ud558\uc2ed\uc2dc\uc624."}, { ER_CANT_USE_DTM_FOR_INPUT, "\uc785\ub825 DOM \ub178\ub4dc\uc5d0 DTMLiaison\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 org.apache.xpath.DOM2Helper\ub97c \uc804\ub2ec\ud558\uc2ed\uc2dc\uc624."}, { ER_CALL_TO_EXT_FAILED, "\ud655\uc7a5 \uc694\uc18c \ud638\ucd9c\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: {0}"}, { ER_PREFIX_MUST_RESOLVE, "\uc811\ub450\ubd80\ub294 \uc774\ub984 \uacf5\uac04\uc73c\ub85c \ubd84\uc11d\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4: {0}"}, { ER_INVALID_UTF16_SURROGATE, "\uc798\ubabb\ub41c UTF-16 \ub300\ub9ac\uc790(surrogate)\uac00 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0}"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0}\uc774(\uac00) \uc790\uc2e0\uc744 \uc0ac\uc6a9\ud588\uc73c\ubbc0\ub85c \ubb34\ud55c \ub8e8\ud504\ub97c \ucd08\ub798\ud569\ub2c8\ub2e4."}, { ER_CANNOT_MIX_XERCESDOM, "\ube44Xerces-DOM \uc785\ub825\uacfc Xerces-DOM \ucd9c\ub825\uc744 \ud63c\ud569\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "{0} \uc774\ub984\uc758 \ud15c\ud50c\ub9ac\ud2b8\uac00 \ub458 \uc774\uc0c1\uc785\ub2c8\ub2e4."}, { ER_INVALID_KEY_CALL, "\uc798\ubabb\ub41c \ud568\uc218 \ud638\ucd9c: recursive key() \ud638\ucd9c\uc774 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_REFERENCING_ITSELF, "{0} \ubcc0\uc218\ub294 \uc9c1\uc811 \ub610\ub294 \uac04\uc811\uc801\uc73c\ub85c \uc790\uc2e0\uc744 \ucc38\uc870\ud569\ub2c8\ub2e4."}, { ER_ILLEGAL_DOMSOURCE_INPUT, "newTemplates\uc758 DOMSource\uc5d0 \ub300\ud55c \uc785\ub825 \ub178\ub4dc\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "{0} \uc635\uc158\uc5d0 \ub300\ud55c \ud074\ub798\uc2a4 \ud30c\uc77c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_REQUIRED_ELEM_NOT_FOUND, "\ud544\uc218 \uc694\uc18c\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream\uc740 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_URI_CANNOT_BE_NULL, "URI\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_FILE_CANNOT_BE_NULL, "\ud30c\uc77c\uc740 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_INIT_BSFMGR, "BSF \uad00\ub9ac\uc790\ub97c \ucd08\uae30\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_CMPL_EXTENSN, "\ud655\uc7a5\uc790\ub97c \ucef4\ud30c\uc77c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_CREATE_EXTENSN, "\ud655\uc7a5\uc790\ub97c \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: {0}, \uc6d0\uc778: {1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "{0} \uba54\uc18c\ub4dc\uc5d0 \ub300\ud55c \uc778\uc2a4\ud134\uc2a4 \uba54\uc18c\ub4dc \ud638\ucd9c\uc740 \uccab \ubc88\uc9f8 \uc778\uc218\ub85c \uc624\ube0c\uc81d\ud2b8 \uc778\uc2a4\ud134\uc2a4\ub97c \ud544\uc694\ub85c \ud569\ub2c8\ub2e4."}, { ER_INVALID_ELEMENT_NAME, "\uc798\ubabb\ub41c \uc694\uc18c \uc774\ub984\uc774 \uc9c0\uc815\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "\uc694\uc18c \uc774\ub984 \uba54\uc18c\ub4dc\ub294 static\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4: {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "\ud655\uc7a5 \ud568\uc218 {0} : {1}\uc744(\ub97c) \uc54c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_MORE_MATCH_CONSTRUCTOR, "{0}\uc5d0 \ub300\ud55c \uc0dd\uc131\uc790\uc5d0 \uac00\uc7a5 \uc77c\uce58\ud558\ub294 \uac83\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_MORE_MATCH_METHOD, "{0} \uba54\uc18c\ub4dc\uc5d0 \uac00\uc7a5 \uc77c\uce58\ud558\ub294 \uac83\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_MORE_MATCH_ELEMENT, "{0} \uc694\uc18c \uba54\uc18c\ub4dc\uc5d0 \uac00\uc7a5 \uc77c\uce58\ud558\ub294 \uac83\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_INVALID_CONTEXT_PASSED, "{0}\uc744(\ub97c) \ud3c9\uac00\ud558\ub294 \ub370 \uc798\ubabb\ub41c \ubb38\ub9e5\uc774 \uc804\ub2ec\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { ER_POOL_EXISTS, "\ud480\uc774 \uc774\ubbf8 \uc788\uc2b5\ub2c8\ub2e4."}, { ER_NO_DRIVER_NAME, "\ub4dc\ub77c\uc774\ubc84 \uc774\ub984\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_NO_URL, "URL\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_POOL_SIZE_LESSTHAN_ONE, "\ud480 \ud06c\uae30\uac00 1 \ubbf8\ub9cc\uc785\ub2c8\ub2e4."}, { ER_INVALID_DRIVER, "\uc798\ubabb\ub41c \ub4dc\ub77c\uc774\ubc84 \uc774\ub984\uc744 \uc9c0\uc815\ud588\uc2b5\ub2c8\ub2e4."}, { ER_NO_STYLESHEETROOT, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ub8e8\ud2b8\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ILLEGAL_XMLSPACE_VALUE, "xml:space\uc5d0 \ub300\ud574 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \uac12\uc785\ub2c8\ub2e4."}, { ER_PROCESSFROMNODE_FAILED, "processFromNode\uac00 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_RESOURCE_COULD_NOT_LOAD, "[ {0} ] \uc790\uc6d0\uc774 {1} \n {2} \t {3}\uc744 \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "\ubc84\ud37c \ud06c\uae30 <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "\ud655\uc7a5 \ud638\ucd9c \uc2dc \uc54c \uc218 \uc5c6\ub294 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4."}, { ER_NO_NAMESPACE_DECL, "{0} \uc811\ub450\ubd80\uc5d0 \ud574\ub2f9\ud558\ub294 \uc774\ub984 \uacf5\uac04 \uc120\uc5b8\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_ELEM_CONTENT_NOT_ALLOWED, "lang=javaclass {0}\uc5d0 \ub300\ud574 \uc694\uc18c \ucee8\ud150\uce20\uac00 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_STYLESHEET_DIRECTED_TERMINATION, "\uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uac00 \uc885\ub8cc\ub97c \uc9c0\uc2dc\ud588\uc2b5\ub2c8\ub2e4."}, { ER_ONE_OR_TWO, "1 \ub610\ub294 2"}, { ER_TWO_OR_THREE, "2 \ub610\ub294 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "{0}(CLASSPATH \ud655\uc778)\uc744(\ub97c) \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc73c\ubbc0\ub85c \ud604\uc7ac \uae30\ubcf8\uac12\ub9cc\uc744 \uc0ac\uc6a9\ud558\ub294 \uc911\uc785\ub2c8\ub2e4."}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "\uae30\ubcf8 \ud15c\ud50c\ub9ac\ud2b8\ub97c \ucd08\uae30\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_RESULT_NULL, "\uacb0\uacfc\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_RESULT_COULD_NOT_BE_SET, "\uacb0\uacfc\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_OUTPUT_SPECIFIED, "\ucd9c\ub825\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "{0} \uc720\ud615\uc758 \uacb0\uacfc\ub85c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "{0} \uc720\ud615\uc758 \uc18c\uc2a4\ub97c \ubcc0\ud658\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NULL_CONTENT_HANDLER, "\ub110(null) \ucee8\ud150\uce20 \ud578\ub4e4\ub7ec"}, { ER_NULL_ERROR_HANDLER, "\ub110(null) \uc624\ub958 \ud578\ub4e4\ub7ec"}, { ER_CANNOT_CALL_PARSE, "ContentHandler\ub97c \uc124\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 parse\ub97c \ud638\ucd9c\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_PARENT_FOR_FILTER, "\uc0c1\uc704 \ud544\ud130\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NO_STYLESHEET_IN_MEDIA, "{0}\uc5d0 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4. \ub9e4\uccb4= {1}"}, { ER_NO_STYLESHEET_PI, "{0}\uc5d0 xml-\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 PI\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NOT_SUPPORTED, "\uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "{0} \ud2b9\uc131\uac12\uc740 \ubd80\uc6b8 \uc778\uc2a4\ud134\uc2a4\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "{0}\uc5d0 \uc788\ub294 \uc678\ubd80 \uc2a4\ud06c\ub9bd\ud2b8\uc5d0 \ub3c4\ub2ec\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_RESOURCE_COULD_NOT_FIND, "[ {0} ] \uc790\uc6d0\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\n{1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "\ucd9c\ub825 \ud2b9\uc131\uc774 \uc778\uc2dd\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "ElemLiteralResult \uc778\uc2a4\ud134\uc2a4 \uc791\uc131\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "{0}\uc5d0 \ub300\ud55c \uac12\uc5d0 \uad6c\ubb38 \ubd84\uc11d \uac00\ub2a5\ud55c \uc22b\uc790\uac00 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, { ER_VALUE_SHOULD_EQUAL, "{0}\uc758 \uac12\uc740 yes \ub610\ub294 no\uc5ec\uc57c \ud569\ub2c8\ub2e4."}, { ER_FAILED_CALLING_METHOD, "{0} \uba54\uc18c\ub4dc \ud638\ucd9c\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_FAILED_CREATING_ELEMTMPL, "ElemTemplateElement \uc778\uc2a4\ud134\uc2a4 \uc791\uc131\uc5d0 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { ER_CHARS_NOT_ALLOWED, "\ubb38\uc11c\uc758 \uc774 \uc9c0\uc810\uc5d0 \ubb38\uc790\uac00 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_ATTR_NOT_ALLOWED, "{1} \uc694\uc18c\uc5d0 \"{0}\" \uc18d\uc131\uc774 \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_BAD_VALUE, "{0} \uc798\ubabb\ub41c \uac12 {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "{0} \uc18d\uc131\uac12\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "{0} \uc18d\uc131\uac12\uc774 \uc778\uc2dd\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. "}, { ER_NULL_URI_NAMESPACE, "\ub110(null) URI\ub85c \uc774\ub984 \uacf5\uac04 \uc811\ub450\ubd80\ub97c \uc0dd\uc131\ud558\ub824\uace0 \ud569\ub2c8\ub2e4."}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "\ucd5c\ub300\ub85c \uae34 \uc815\uc218\ubcf4\ub2e4 \ud070 \uc22b\uc790\ub97c \ud3ec\ub9f7\ud558\ub824\uace0 \ud569\ub2c8\ub2e4."}, { ER_CANNOT_FIND_SAX1_DRIVER, "SAX1 \ub4dc\ub77c\uc774\ubc84 \ud074\ub798\uc2a4 {0}\uc744(\ub97c) \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SAX1_DRIVER_NOT_LOADED, "SAX1 \ub4dc\ub77c\uc774\ubc84 \ud074\ub798\uc2a4 {0}\uc774(\uac00) \uc788\uc73c\ub098 \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "SAX1 \ub4dc\ub77c\uc774\ubc84 \ud074\ub798\uc2a4 {0}\uc744(\ub97c) \ub85c\ub4dc\ud588\uc73c\ub098 \uc778\uc2a4\ud134\uc2a4\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1 \ub4dc\ub77c\uc774\ubc84 \ud074\ub798\uc2a4 {0}\uc774(\uac00) org.xml.sax.Parser\ub97c \uad6c\ud604\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "\uc2dc\uc2a4\ud15c \ud2b9\uc131 org.xml.sax.parser\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_PARSER_ARG_CANNOT_BE_NULL, "\uad6c\ubb38 \ubd84\uc11d\uae30 \uc778\uc218\ub294 \ub110(null)\uc774 \ub420 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_FEATURE, "\ud2b9\uc131: {0}"}, { ER_PROPERTY, "\ud2b9\uc131: {0}"}, { ER_NULL_ENTITY_RESOLVER, "\ub110(null) \uc5d4\ud2f0\ud2f0 \ubd84\uc11d\uae30"}, { ER_NULL_DTD_HANDLER, "\ub110(null) DTD \ud578\ub4e4\ub7ec"}, { ER_NO_DRIVER_NAME_SPECIFIED, "\ub4dc\ub77c\uc774\ubc84 \uc774\ub984\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_NO_URL_SPECIFIED, "URL\uc744 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."}, { ER_POOLSIZE_LESS_THAN_ONE, "\ud480 \ud06c\uae30\uac00 1 \ubbf8\ub9cc\uc785\ub2c8\ub2e4."}, { ER_INVALID_DRIVER_NAME, "\uc798\ubabb\ub41c \ub4dc\ub77c\uc774\ubc84 \uc774\ub984\uc744 \uc9c0\uc815\ud588\uc2b5\ub2c8\ub2e4."}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "\ud504\ub85c\uadf8\ub798\uba38 \uc624\ub958. \ud45c\ud604\uc2dd\uc5d0 ElemTemplateElement\uc758 \uc0c1\uc704 \ud56d\ubaa9\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "RedundentExprEliminator\uc5d0 \uc788\ub294 \ud504\ub85c\uadf8\ub798\uba38\uc758 \ub2e8\uc5b8\ubb38: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0}\uc740(\ub294) \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uc758 \uc774 \uc704\uce58\uc5d0\uc11c \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "\ud654\uc774\ud2b8 \uc2a4\ud398\uc774\uc2a4\uac00 \uc544\ub2cc \ud14d\uc2a4\ud2b8\ub294 \uc2a4\ud0c0\uc77c\uc2dc\ud2b8\uc758 \uc774 \uc704\uce58\uc5d0\uc11c \ud5c8\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "{0} CHAR \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. CHAR \uc720\ud615\uc758 \uc18d\uc131\uc740 1\uc790\uc5ec\uc57c \ud569\ub2c8\ub2e4."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "{0} QNAME \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "{0} ENUM \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uc720\ud6a8\ud55c \uac12\uc740 {2}\uc785\ub2c8\ub2e4."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "{0} NMTOKEN \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "{0} NCNAME \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "{0} \ubd80\uc6b8 \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "{0} \uc22b\uc790 \uc18d\uc131\uc5d0 \ub300\ud574 \uc0ac\uc6a9\ub41c {1} \uac12\uc774 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "\uc77c\uce58 \ud328\ud134\uc5d0\uc11c {0}\uc5d0 \ub300\ud55c \uc778\uc218\ub294 \ub9ac\ud130\ub7f4\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "\uc911\ubcf5 \uae00\ub85c\ubc8c \ubcc0\uc218 \uc120\uc5b8\uc785\ub2c8\ub2e4."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "\uc911\ubcf5 \ubcc0\uc218 \uc120\uc5b8\uc785\ub2c8\ub2e4."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template\uc5d0 \uc774\ub984 \ub610\ub294 \uc77c\uce58 \uc18d\uc131(\ub610\ub294 \ub458 \ub2e4)\uc774 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4."}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "exclude-result-prefixes\uc5d0 \uc788\ub294 \uc811\ub450\ubd80\uac00 \uc720\ud6a8\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: {0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "\uc774\ub984\uc774 {0}\uc778 attribute-set\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "\uc774\ub984\uc774 {0}\uc778 \ud568\uc218\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "{0} \uc694\uc18c\uc5d0 \ucee8\ud150\uce20\uc640 select \uc18d\uc131\uc774 \ub458 \ub2e4 \uc788\uc5b4\uc11c\ub294 \uc548\ub429\ub2c8\ub2e4. "}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "{0} \ub9e4\uac1c\ubcc0\uc218 \uac12\uc740 \uc720\ud6a8\ud55c Java \uc624\ube0c\uc81d\ud2b8\uc5ec\uc57c \ud569\ub2c8\ub2e4. "}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "xsl:namespace-alias \uc694\uc18c\uc758 result-prefix \uc18d\uc131\uc774 #default' \uac12\uc744 \uac16\uc9c0\ub9cc \uc694\uc18c\uc758 \ubc94\uc704\uc5d0 \uae30\ubcf8 \uc774\ub984 \uacf5\uac04\uc5d0 \ub300\ud55c \uc120\uc5b8\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "xsl:namespace-alias \uc694\uc18c\uc758 result-prefix \uc18d\uc131\uc774 ''{0}'' \uac12\uc744 \uac16\uc9c0\ub9cc \uc694\uc18c\uc758 \ubc94\uc704\uc5d0 \uc811\ub450\ubd80 ''{0}''\uc5d0 \ub300\ud55c \uc774\ub984 \uacf5\uac04 \uc120\uc5b8\uc774 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_SET_FEATURE_NULL_NAME, "TransformerFactory.setFeature(\ubb38\uc790\uc5f4 \uc774\ub984, \ubd80\uc6b8 \uac12)\uc5d0\uc11c \uae30\ub2a5 \uc774\ub984\uc774 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, { ER_GET_FEATURE_NULL_NAME, "TransformerFactory.getFeature(\ubb38\uc790\uc5f4 \uc774\ub984)\uc5d0\uc11c \uae30\ub2a5 \uc774\ub984\uc774 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, { ER_UNSUPPORTED_FEATURE, "\uc774 TransformerFactory\uc5d0\uc11c ''{0}'' \uae30\ub2a5\uc744 \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "\ubcf4\uc548 \ucc98\ub9ac \uae30\ub2a5\uc774 true\ub85c \uc124\uc815\ub41c \uacbd\uc6b0\uc5d0\ub294 ''{0}'' \ud655\uc7a5 \uc694\uc18c\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "\ub110(null) \uc774\ub984 \uacf5\uac04 uri\uc5d0 \ub300\ud55c \uc811\ub450\ubd80\ub97c \uac00\uc838\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "\ub110(null) \uc811\ub450\ubd80\uc5d0 \ub300\ud55c \uc774\ub984 \uacf5\uac04 uri\ub97c \uac00\uc838\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { ER_XPATH_RESOLVER_NULL_QNAME, "\ud568\uc218 \uc774\ub984\uc774 \ub110(null)\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "arity\uac00 \uc74c\uc218\uc774\uba74 \uc548\ub429\ub2c8\ub2e4."}, // Warnings... { WG_FOUND_CURLYBRACE, "'}'\uac00 \ubc1c\uacac\ub418\uc5c8\uc73c\ub098 \uc5f4\ub9b0 \uc18d\uc131 \ud15c\ud50c\ub9ac\ud2b8\uac00 \uc5c6\uc2b5\ub2c8\ub2e4."}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "\uacbd\uace0: \uacc4\uc218 \uc18d\uc131\uc774 xsl:number\uc758 \uc0c1\uc704 \uc694\uc18c\uc640 \uc77c\uce58\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc0c1 = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "\uc774\uc804 \uad6c\ubb38: 'expr' \uc18d\uc131\uc758 \uc774\ub984\uc774 'select'\ub85c \ubcc0\uacbd\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan\uc774 \uc544\uc9c1 format-number \ud568\uc218\uc5d0 \uc788\ub294 \ub85c\ucf00\uc77c \uc774\ub984\uc744 \ucc98\ub9ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { WG_LOCALE_NOT_FOUND, "\uacbd\uace0: xml:lang={0}\uc5d0 \ub300\ud55c \ub85c\ucf00\uc77c\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { WG_CANNOT_MAKE_URL_FROM, "{0}\uc5d0\uc11c URL\uc744 \uc791\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { WG_CANNOT_LOAD_REQUESTED_DOC, "\uc694\uccad\ub41c \ubb38\uc11c {0}\uc744(\ub97c) \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}, { WG_CANNOT_FIND_COLLATOR, ">>>>>> Xalan \ubc84\uc804 "}, { "version2", "<<<<<<<"}, { "yes", "\uc608"}, { "line", "\ud589 #"}, { "column","\uc5f4 #"}, { "xsldone", "XSLProcessor: \uc644\ub8cc"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J \uba85\ub839\ud589 \ud504\ub85c\uc138\uc2a4 \ud074\ub798\uc2a4 \uc635\uc158:"}, { "xslProc_option", "Xalan-J \uba85\ub839\ud589 \ud504\ub85c\uc138\uc2a4 \ud074\ub798\uc2a4 \uc635\uc158\u003a"}, { "xslProc_invalid_xsltc_option", "{0} \uc635\uc158\uc740 XSLTC \ubaa8\ub4dc\uc5d0\uc11c \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}, { "xslProc_invalid_xalan_option", "{0} \uc635\uc158\uc740 -XSLTC\ub85c\ub9cc \uc0ac\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."}, { "xslProc_no_input", "\uc624\ub958: \uc9c0\uc815\ub41c \uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ub610\ub294 \uc785\ub825 xml\uc774 \uc5c6\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\ubc95 \uba85\ub839\uc5b4\uc5d0 \ub300\ud55c \uc635\uc158\uc5c6\uc774 \uc774 \uba85\ub839\uc744 \uc2e4\ud589\ud558\uc2ed\uc2dc\uc624."}, { "xslProc_common_options", "-\uc77c\ubc18 \uc635\uc158-"}, { "xslProc_xalan_options", "-Xalan\uc5d0 \ub300\ud55c \uc635\uc158-"}, { "xslProc_xsltc_options", "-XSLTC\uc5d0 \ub300\ud55c \uc635\uc158-"}, { "xslProc_return_to_continue", "(\uacc4\uc18d\ud558\ub824\uba74 Enter \ud0a4\ub97c \ub204\ub974\uc2ed\uc2dc\uc624.)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", "[-XSLTC(\ubcc0\ud658\uc5d0 \ub300\ud574 XSLTC \uc0ac\uc6a9)]"}, { "optionIN", "[-IN inputXMLURL]"}, { "optionXSL", "[-XSL XSLTransformationURL]"}, { "optionOUT", "[-OUT outputFileName]"}, { "optionLXCIN", "[-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", "[-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", "[-PARSER \uad6c\ubb38 \ubd84\uc11d\uae30 liaison\uc758 \uc644\uc804\ud55c \ud074\ub798\uc2a4 \uc774\ub984]"}, { "optionE", "[-E(\uc5d4\ud2f0\ud2f0 ref\ub97c \ud3bc\uce58\uc9c0 \uc54a\uc74c)]"}, { "optionV", "[-E(\uc5d4\ud2f0\ud2f0 ref\ub97c \ud3bc\uce58\uc9c0 \uc54a\uc74c)]"}, { "optionQC", "[-QC(\uc790\ub3d9 \ud328\ud134 \ucda9\ub3cc \uacbd\uace0)]"}, { "optionQ", "[-Q(\uc790\ub3d9 \ubaa8\ub4dc)]"}, { "optionLF", "[-LF(\ucd9c\ub825\uc5d0\uc11c\ub9cc \uc904\ubc14\uafb8\uae30 \uc0ac\uc6a9{\uae30\ubcf8\uac12\uc740 CR/LF\uc784})]"}, { "optionCR", "[-CR(\ucd9c\ub825\uc5d0\uc11c\ub9cc \uce90\ub9ac\uc9c0 \ub9ac\ud134 \uc0ac\uc6a9{\uae30\ubcf8\uac12\uc740 CR/LF\uc784})]"}, { "optionESCAPE", "[-ESCAPE(\uc774\uc2a4\ucf00\uc774\ud504\ud560 \ubb38\uc790{\uae30\ubcf8\uac12\uc740 <>&\"\'\\r\\n\uc784})]"}, { "optionINDENT", "[-INDENT(\ub4e4\uc5ec\uc4f0\uae30\ud560 \uacf5\ubc31 \uc218 \uc81c\uc5b4{\uae30\ubcf8\uac12\uc740 0\uc784})]"}, { "optionTT", "[-TT(\ud15c\ud50c\ub9ac\ud2b8 \ud638\ucd9c \uc2dc \ud15c\ud50c\ub9ac\ud2b8 \ucd94\uc801)]"}, { "optionTG", "[-TG(\uac01 \uc0dd\uc131 \uc774\ubca4\ud2b8 \ucd94\uc801)]"}, { "optionTS", "[-TS(\uac01 \uc120\ud0dd \uc774\ubca4\ud2b8 \ucd94\uc801)]"}, { "optionTTC", "[-TTC(\ud558\uc704 \ud15c\ud50c\ub9ac\ud2b8 \ucc98\ub9ac \uc2dc \ud558\uc704 \ud15c\ud50c\ub9ac\ud2b8 \ucd94\uc801)]"}, { "optionTCLASS", "[-TCLASS(\ucd94\uc801 \ud655\uc7a5\uc5d0 \ub300\ud55c TraceListener \ud074\ub798\uc2a4)]"}, { "optionVALIDATE", "[-VALIDATE(\uc720\ud6a8\uc131 \uac80\uc99d \ubc1c\uc0dd \uc5ec\ubd80 \uc124\uc815. \uae30\ubcf8\uc801\uc73c\ub85c\ub294 \uc720\ud6a8\uc131 \uac80\uc99d\uc774 off\ub85c \uc124\uc815\ub428.)]"}, { "optionEDUMP", "[-EDUMP{optional filename}(\uc624\ub958 \uc2dc stackdump \uc218\ud589)]"}, { "optionXML", "[-XML(XML \ud3ec\ub9f7\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec XML \uba38\ub9ac\uae00 \ucd94\uac00)]"}, { "optionTEXT", "[-TEXT(\ub2e8\uc21c \ud14d\uc2a4\ud2b8 \ud3ec\ub9f7\ud130 \uc0ac\uc6a9)]"}, { "optionHTML", "[-HTML(HTML \ud3ec\ub9f7\ud130 \uc0ac\uc6a9)]"}, { "optionPARAM", "[-PARAM name expression(\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ub9e4\uac1c\ubcc0\uc218 \uc124\uc815)]"}, { "noParsermsg1", "XSL \ud504\ub85c\uc138\uc2a4\uac00 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4."}, { "noParsermsg2", "** \uad6c\ubb38 \ubd84\uc11d\uae30\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4 **"}, { "noParsermsg3", "\ud074\ub798\uc2a4 \uacbd\ub85c\ub97c \uc810\uac80\ud558\uc2ed\uc2dc\uc624."}, { "noParsermsg4", "Java\uc6a9 IBM XML \uad6c\ubb38 \ubd84\uc11d\uae30\uac00 \uc5c6\ub294 \uacbd\uc6b0 \ub2e4\uc74c\uc5d0\uc11c \ub2e4\uc6b4\ub85c\ub4dc\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. "}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", "[-URIRESOLVER full class name(URIResolver\ub97c \uc0ac\uc6a9\ud558\uc5ec URI \ubd84\uc11d)]"}, { "optionENTITYRESOLVER", "[-ENTITYRESOLVER full class name(EntityResolver\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc5d4\ud2f0\ud2f0 \ubd84\uc11d)]"}, { "optionCONTENTHANDLER", "[-CONTENTHANDLER full class name(ContentHandler\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucd9c\ub825 \uc9c1\ub82c\ud654)]"}, { "optionLINENUMBERS", "[-L \uc18c\uc2a4 \ubb38\uc11c\uc5d0 \ud589 \ubc88\ud638 \uc0ac\uc6a9]"}, { "optionSECUREPROCESSING", " [-SECURE (\ubcf4\uc548 \ucc98\ub9ac \uae30\ub2a5\uc744 true\ub85c \uc124\uc815)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType(\ub9e4\uccb4 \uc18d\uc131\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubb38\uc11c\uc640 \uc5f0\uad00\ub41c \uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ucc3e\uae30)]"}, { "optionFLAVOR", " [-FLAVOR flavorName(\uba85\uc2dc\uc801\uc73c\ub85c s2s=SAX \ub610\ub294 d2d=DOM\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubcc0\ud658 \uc218\ud589)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG(\ubcc0\ud658\uc5d0 \uc18c\uc694\ub41c \uc804\uccb4 \ubc00\ub9ac\ucd08 \uc778\uc1c4)]"}, { "optionINCREMENTAL", " [-INCREMENTAL(http://xml.apache.org/xalan/features/incremental\uc744 true\ub85c \uc124\uc815\ud558\uc5ec \uc99d\ubd84 DTM \uad6c\uc131 \uc694\uccad)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE(http://xml.apache.org/xalan/features/optimize\ub97c false\ub85c \uc124\uc815\ud558\uc5ec \uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ucd5c\uc801\ud654 \ucc98\ub9ac\ub97c \uc694\uccad\ud558\uc9c0 \uc54a\uc74c)]"}, { "optionRL", " [-RL recursionlimit(\uc2a4\ud0c0\uc77c\uc2dc\ud2b8 \ubc18\ubcf5 \uc815\ub3c4\uc5d0 \ub300\ud55c \uc22b\uc790 \ud55c\uacc4 \ub2e8\uc5b8)]"}, { "optionXO", "[-XO [transletName](\uc0dd\uc131\ub41c translet\uc5d0 \uc774\ub984 \uc9c0\uc815)]"}, { "optionXD", "[-XD destinationDirectory(translet\uc5d0 \ub300\ud574 \ub300\uc0c1 \ub514\ub809\ud1a0\ub9ac \uc9c0\uc815)]"}, { "optionXJ", "[-XJ jarfile(\uc774\ub984\uc774 \uc778 jar \ud30c\uc77c\ub85c translet \ud074\ub798\uc2a4 \ud328\ud0a4\uc9c0)]"}, { "optionXP", "[-XP package(\uc0dd\uc131\ub41c \ubaa8\ub4e0 translet \ud074\ub798\uc2a4\uc5d0 \ub300\ud574 \ud328\ud0a4\uc9c0 \uc774\ub984 \uc811\ub450\ubd80 \uc9c0\uc815)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN(\ud15c\ud50c\ub9ac\ud2b8 \uc778\ub77c\uc774\ub2dd \uc0ac\uc6a9 \uac00\ub2a5)]" }, { "optionXX", "[-XX(\ucd94\uac00 \ub514\ubc84\uae45 \uba54\uc2dc\uc9c0 \ucd9c\ub825 \ucf1c\uae30)]"}, { "optionXT" , "[-XT(\uac00\ub2a5\ud55c \uacbd\uc6b0, translet\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubcc0\ud658)]"}, { "diagTiming","--------- {1}\uc744(\ub97c) \ud1b5\ud55c {0} \ubcc0\ud658\uc5d0 {2}ms\uac00 \uc18c\uc694\ub418\uc5c8\uc2b5\ub2c8\ub2e4." }, { "recursionTooDeep","\ud15c\ud50c\ub9ac\ud2b8 \uc911\ucca9\uc774 \ub108\ubb34 \ub9ce\uc2b5\ub2c8\ub2e4. \uc911\ucca9 = {0}, \ud15c\ud50c\ub9ac\ud2b8 {1} {2}" }, { "nameIs", "\uc774\ub984" }, { "matchPatternIs", "\uc77c\uce58 \ud328\ud134" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "\uc624\ub958: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "\uacbd\uace0: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("ko", "KR")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTInfo.properties0000644000175000017500000000210310721374033023513 0ustar mkochmkoch## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## # # $Id: XSLTInfo.properties 468641 2006-10-28 06:54:42Z minchau $ # # XSLT Resource File # vendor=Apache Software Foundation vendor-url=http://xml.apache.org/xalan-j # Product Version: Xalan-Java @impl.version@ # W3C XSL Transformations (XSLT) Version 1.0 version=1.0 libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_sv.java0000644000175000017500000017346710721374031025065 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_sv.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_sv extends XSLTErrorResources { /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /** Get the lookup table for error messages. * * @return The int to message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ //public static final int ERROR0000 = 0; { "ERROR0000", "{0}"}, /** ER_NO_CURLYBRACE */ //public static final int ER_NO_CURLYBRACE = 1; { ER_NO_CURLYBRACE, "Fel: Kan inte ha '{' inuti uttryck"}, /** ER_ILLEGAL_ATTRIBUTE */ //public static final int ER_ILLEGAL_ATTRIBUTE = 2; { ER_ILLEGAL_ATTRIBUTE, "{0} har ett otill\u00e5tet attribut: {1}"}, /** ER_NULL_SOURCENODE_APPLYIMPORTS */ //public static final int ER_NULL_SOURCENODE_APPLYIMPORTS = 3; { ER_NULL_SOURCENODE_APPLYIMPORTS, "sourceNode \u00e4r null i xsl:apply-imports!"}, /** ER_CANNOT_ADD */ //public static final int ER_CANNOT_ADD = 4; { ER_CANNOT_ADD, "Kan inte l\u00e4gga {0} till {1}"}, /** ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES */ //public static final int ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES = 5; { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode \u00e4r null i handleApplyTemplatesInstruction!"}, /** ER_NO_NAME_ATTRIB */ //public static final int ER_NO_NAME_ATTRIB = 6; { ER_NO_NAME_ATTRIB, "{0} m\u00e5ste ha ett namn-attribut."}, /** ER_TEMPLATE_NOT_FOUND */ //public static final int ER_TEMPLATE_NOT_FOUND = 7; { ER_TEMPLATE_NOT_FOUND, "Hittade inte mallen med namn: {0}"}, /** ER_CANT_RESOLVE_NAME_AVT */ //public static final int ER_CANT_RESOLVE_NAME_AVT = 8; { ER_CANT_RESOLVE_NAME_AVT, "Kunde inte l\u00f6sa namn-AVT i xsl:call-template."}, /** ER_REQUIRES_ATTRIB */ //public static final int ER_REQUIRES_ATTRIB = 9; { ER_REQUIRES_ATTRIB, "{0} kr\u00e4ver attribut: {1}"}, /** ER_MUST_HAVE_TEST_ATTRIB */ //public static final int ER_MUST_HAVE_TEST_ATTRIB = 10; { ER_MUST_HAVE_TEST_ATTRIB, "{0} m\u00e5ste ha ett ''test''-attribut."}, /** ER_BAD_VAL_ON_LEVEL_ATTRIB */ //public static final int ER_BAD_VAL_ON_LEVEL_ATTRIB = 11; { ER_BAD_VAL_ON_LEVEL_ATTRIB, "D\u00e5ligt v\u00e4rde p\u00e5 niv\u00e5-attribut: {0}"}, /** ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML */ //public static final int ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = 12; { ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Namn p\u00e5 behandlande instruktion f\u00e5r inte vara 'xml'"}, /** ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME */ //public static final int ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = 13; { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "Namn p\u00e5 behandlande instruktion m\u00e5ste vara ett giltigt NCNamn: {0}"}, /** ER_NEED_MATCH_ATTRIB */ //public static final int ER_NEED_MATCH_ATTRIB = 14; { ER_NEED_MATCH_ATTRIB, "{0} m\u00e5ste ha ett matchningsattribut om det har ett tillst\u00e5nd."}, /** ER_NEED_NAME_OR_MATCH_ATTRIB */ //public static final int ER_NEED_NAME_OR_MATCH_ATTRIB = 15; { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} kr\u00e4ver antingen ett namn eller ett matchningsattribut."}, /** ER_CANT_RESOLVE_NSPREFIX */ //public static final int ER_CANT_RESOLVE_NSPREFIX = 16; { ER_CANT_RESOLVE_NSPREFIX, "Kan inte l\u00f6sa namnrymdsprefix: {0}"}, /** ER_ILLEGAL_VALUE */ //public static final int ER_ILLEGAL_VALUE = 17; { ER_ILLEGAL_VALUE, "xml:space har ett otill\u00e5tet v\u00e4rde: {0}"}, /** ER_NO_OWNERDOC */ //public static final int ER_NO_OWNERDOC = 18; { ER_NO_OWNERDOC, "Barnnod saknar \u00e4gardokument!"}, /** ER_ELEMTEMPLATEELEM_ERR */ //public static final int ER_ELEMTEMPLATEELEM_ERR = 19; { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement-fel: {0}"}, /** ER_NULL_CHILD */ //public static final int ER_NULL_CHILD = 20; { ER_NULL_CHILD, "F\u00f6rs\u00f6ker l\u00e4gga till ett null-barn!"}, /** ER_NEED_SELECT_ATTRIB */ //public static final int ER_NEED_SELECT_ATTRIB = 21; { ER_NEED_SELECT_ATTRIB, "{0} kr\u00e4ver ett valattribut."}, /** ER_NEED_TEST_ATTRIB */ //public static final int ER_NEED_TEST_ATTRIB = 22; { ER_NEED_TEST_ATTRIB, "xsl:when m\u00e5ste ha ett 'test'-attribut."}, /** ER_NEED_NAME_ATTRIB */ //public static final int ER_NEED_NAME_ATTRIB = 23; { ER_NEED_NAME_ATTRIB, "xsl:with-param m\u00e5ste ha ett 'namn'-attribut."}, /** ER_NO_CONTEXT_OWNERDOC */ //public static final int ER_NO_CONTEXT_OWNERDOC = 24; { ER_NO_CONTEXT_OWNERDOC, "Kontext saknar \u00e4gardokument!"}, /** ER_COULD_NOT_CREATE_XML_PROC_LIAISON */ //public static final int ER_COULD_NOT_CREATE_XML_PROC_LIAISON = 25; { ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "Kunde inte skapa XML TransformerFactory Liaison: {0}"}, /** ER_PROCESS_NOT_SUCCESSFUL */ //public static final int ER_PROCESS_NOT_SUCCESSFUL = 26; { ER_PROCESS_NOT_SUCCESSFUL, "Xalan: Process misslyckades."}, /** ER_NOT_SUCCESSFUL */ //public static final int ER_NOT_SUCCESSFUL = 27; { ER_NOT_SUCCESSFUL, "Xalan: misslyckades."}, /** ER_ENCODING_NOT_SUPPORTED */ //public static final int ER_ENCODING_NOT_SUPPORTED = 28; { ER_ENCODING_NOT_SUPPORTED, "Kodning inte underst\u00f6dd: {0}"}, /** ER_COULD_NOT_CREATE_TRACELISTENER */ //public static final int ER_COULD_NOT_CREATE_TRACELISTENER = 29; { ER_COULD_NOT_CREATE_TRACELISTENER, "Kunde inte skapa TraceListener: {0}"}, /** ER_KEY_REQUIRES_NAME_ATTRIB */ //public static final int ER_KEY_REQUIRES_NAME_ATTRIB = 30; { ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key m\u00e5ste ha ett 'namn'-attribut."}, /** ER_KEY_REQUIRES_MATCH_ATTRIB */ //public static final int ER_KEY_REQUIRES_MATCH_ATTRIB = 31; { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key m\u00e5ste ha ett 'matcha'-attribut."}, /** ER_KEY_REQUIRES_USE_ATTRIB */ //public static final int ER_KEY_REQUIRES_USE_ATTRIB = 32; { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key m\u00e5ste ha ett 'anv\u00e4nd'-attribut."}, /** ER_REQUIRES_ELEMENTS_ATTRIB */ //public static final int ER_REQUIRES_ELEMENTS_ATTRIB = 33; { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} kr\u00e4ver ett ''element''-attribut!"}, /** ER_MISSING_PREFIX_ATTRIB */ //public static final int ER_MISSING_PREFIX_ATTRIB = 34; { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} ''prefix''-attribut saknas"}, /** ER_BAD_STYLESHEET_URL */ //public static final int ER_BAD_STYLESHEET_URL = 35; { ER_BAD_STYLESHEET_URL, "Stylesheet URL \u00e4r d\u00e5lig: {0}"}, /** ER_FILE_NOT_FOUND */ //public static final int ER_FILE_NOT_FOUND = 36; { ER_FILE_NOT_FOUND, "Stylesheet-fil saknas: {0}"}, /** ER_IOEXCEPTION */ //public static final int ER_IOEXCEPTION = 37; { ER_IOEXCEPTION, "Fick IO-Undantag med stylesheet-fil: {0}"}, /** ER_NO_HREF_ATTRIB */ //public static final int ER_NO_HREF_ATTRIB = 38; { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Hittade inte href-attribute f\u00f6r {0}"}, /** ER_STYLESHEET_INCLUDES_ITSELF */ //public static final int ER_STYLESHEET_INCLUDES_ITSELF = 39; { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} inkluderar, direkt eller indirekt, sig sj\u00e4lv!"}, /** ER_PROCESSINCLUDE_ERROR */ //public static final int ER_PROCESSINCLUDE_ERROR = 40; { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude-fel, {0}"}, /** ER_MISSING_LANG_ATTRIB */ //public static final int ER_MISSING_LANG_ATTRIB = 41; { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} ''lang''-attribut' saknas"}, /** ER_MISSING_CONTAINER_ELEMENT_COMPONENT */ //public static final int ER_MISSING_CONTAINER_ELEMENT_COMPONENT = 42; { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) felplacerade {0} element?? Saknar beh\u00e5llarelement ''komponent''"}, /** ER_CAN_ONLY_OUTPUT_TO_ELEMENT */ //public static final int ER_CAN_ONLY_OUTPUT_TO_ELEMENT = 43; { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Kan endast skicka utdata till ett Element, ett DocumentFragment, ett Document, eller en PrintWriter."}, /** ER_PROCESS_ERROR */ //public static final int ER_PROCESS_ERROR = 44; { ER_PROCESS_ERROR, "StylesheetRoot.process-fel"}, /** ER_UNIMPLNODE_ERROR */ //public static final int ER_UNIMPLNODE_ERROR = 45; { ER_UNIMPLNODE_ERROR, "UnImplNode-fel: {0}"}, /** ER_NO_SELECT_EXPRESSION */ //public static final int ER_NO_SELECT_EXPRESSION = 46; { ER_NO_SELECT_EXPRESSION, "Fel! Hittade inte xpath select-uttryck (-select)."}, /** ER_CANNOT_SERIALIZE_XSLPROCESSOR */ //public static final int ER_CANNOT_SERIALIZE_XSLPROCESSOR = 47; { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "Kan inte serialisera en XSLProcessor!"}, /** ER_NO_INPUT_STYLESHEET */ //public static final int ER_NO_INPUT_STYLESHEET = 48; { ER_NO_INPUT_STYLESHEET, "Stylesheet-indata ej angiven!"}, /** ER_FAILED_PROCESS_STYLESHEET */ //public static final int ER_FAILED_PROCESS_STYLESHEET = 49; { ER_FAILED_PROCESS_STYLESHEET, "Kunde inte behandla stylesheet!"}, /** ER_COULDNT_PARSE_DOC */ //public static final int ER_COULDNT_PARSE_DOC = 50; { ER_COULDNT_PARSE_DOC, "Kunde inte tolka {0} dokument!"}, /** ER_COULDNT_FIND_FRAGMENT */ //public static final int ER_COULDNT_FIND_FRAGMENT = 51; { ER_COULDNT_FIND_FRAGMENT, "Hittade inte fragment: {0}"}, /** ER_NODE_NOT_ELEMENT */ //public static final int ER_NODE_NOT_ELEMENT = 52; { ER_NODE_NOT_ELEMENT, "Nod som pekades p\u00e5 av fragment-identifierare var inte ett element: {0}"}, /** ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB */ //public static final int ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = 53; { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each kr\u00e4ver antingen en matchning eller ett namnattribut."}, /** ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB */ //public static final int ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = 54; { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "mallar kr\u00e4ver antingen en matchning eller ett namnattribut."}, /** ER_NO_CLONE_OF_DOCUMENT_FRAG */ //public static final int ER_NO_CLONE_OF_DOCUMENT_FRAG = 55; { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Ingen klon av ett dokumentfragment!"}, /** ER_CANT_CREATE_ITEM */ //public static final int ER_CANT_CREATE_ITEM = 56; { ER_CANT_CREATE_ITEM, "Kan inte skapa element i resultattr\u00e4d: {0}"}, /** ER_XMLSPACE_ILLEGAL_VALUE */ //public static final int ER_XMLSPACE_ILLEGAL_VALUE = 57; { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space i k\u00e4ll-XML har ett otill\u00e5tet v\u00e4rde: {0}"}, /** ER_NO_XSLKEY_DECLARATION */ //public static final int ER_NO_XSLKEY_DECLARATION = 58; { ER_NO_XSLKEY_DECLARATION, "Det finns ingen xsl:key-deklaration f\u00f6r {0}!"}, /** ER_CANT_CREATE_URL */ //public static final int ER_CANT_CREATE_URL = 59; { ER_CANT_CREATE_URL, "Fel! Kan inte skapa url f\u00f6r: {0}"}, /** ER_XSLFUNCTIONS_UNSUPPORTED */ //public static final int ER_XSLFUNCTIONS_UNSUPPORTED = 60; { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions \u00e4r inte underst\u00f6dd"}, /** ER_PROCESSOR_ERROR */ //public static final int ER_PROCESSOR_ERROR = 61; { ER_PROCESSOR_ERROR, "XSLT TransformerFactory-Fel"}, /** ER_NOT_ALLOWED_INSIDE_STYLESHEET */ //public static final int ER_NOT_ALLOWED_INSIDE_STYLESHEET = 62; { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} \u00e4r inte till\u00e5ten inne i ett stylesheet!"}, /** ER_RESULTNS_NOT_SUPPORTED */ //public static final int ER_RESULTNS_NOT_SUPPORTED = 63; { ER_RESULTNS_NOT_SUPPORTED, "result-ns inte l\u00e4ngre underst\u00f6dd! Anv\u00e4nd xsl:output ist\u00e4llet."}, /** ER_DEFAULTSPACE_NOT_SUPPORTED */ //public static final int ER_DEFAULTSPACE_NOT_SUPPORTED = 64; { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space inte l\u00e4ngre underst\u00f6dd! Anv\u00e4nd xsl:strip-space eller xsl:preserve-space ist\u00e4llet."}, /** ER_INDENTRESULT_NOT_SUPPORTED */ //public static final int ER_INDENTRESULT_NOT_SUPPORTED = 65; { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result inte l\u00e4ngre underst\u00f6dd! Anv\u00e4nd xsl:output ist\u00e4llet."}, /** ER_ILLEGAL_ATTRIB */ //public static final int ER_ILLEGAL_ATTRIB = 66; { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} har ett otill\u00e5tet attribut: {1}"}, /** ER_UNKNOWN_XSL_ELEM */ //public static final int ER_UNKNOWN_XSL_ELEM = 67; { ER_UNKNOWN_XSL_ELEM, "Ok\u00e4nt XSL-element: {0}"}, /** ER_BAD_XSLSORT_USE */ //public static final int ER_BAD_XSLSORT_USE = 68; { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort kan endast anv\u00e4ndas med xsl:apply-templates eller xsl:for-each."}, /** ER_MISPLACED_XSLWHEN */ //public static final int ER_MISPLACED_XSLWHEN = 69; { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) felplacerade xsl:when!"}, /** ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE */ //public static final int ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = 70; { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when h\u00e4rstammar inte fr\u00e5n xsl:choose!"}, /** ER_MISPLACED_XSLOTHERWISE */ //public static final int ER_MISPLACED_XSLOTHERWISE = 71; { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) felplacerade xsl:otherwise!"}, /** ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE */ //public static final int ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = 72; { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise h\u00e4rstammar inte fr\u00e5n xsl:choose!"}, /** ER_NOT_ALLOWED_INSIDE_TEMPLATE */ //public static final int ER_NOT_ALLOWED_INSIDE_TEMPLATE = 73; { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} \u00e4r inte till\u00e5ten inne i en mall!"}, /** ER_UNKNOWN_EXT_NS_PREFIX */ //public static final int ER_UNKNOWN_EXT_NS_PREFIX = 74; { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} utbyggnadsnamnrymdsprefix {1} ok\u00e4nt"}, /** ER_IMPORTS_AS_FIRST_ELEM */ //public static final int ER_IMPORTS_AS_FIRST_ELEM = 75; { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Imports kan endast f\u00f6rekomma som de f\u00f6rsta elementen i ett stylesheet!"}, /** ER_IMPORTING_ITSELF */ //public static final int ER_IMPORTING_ITSELF = 76; { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} importerar, direkt eller indirekt, sig sj\u00e4lv!"}, /** ER_XMLSPACE_ILLEGAL_VAL */ //public static final int ER_XMLSPACE_ILLEGAL_VAL = 77; { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) " + "xml:space har ett otill\u00e5tet v\u00e4rde: {0}"}, /** ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL */ //public static final int ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = 78; { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet misslyckades!"}, /** ER_SAX_EXCEPTION */ //public static final int ER_SAX_EXCEPTION = 79; { ER_SAX_EXCEPTION, "SAX-Undantag"}, /** ER_XSLT_ERROR */ //public static final int ER_XSLT_ERROR = 81; { ER_XSLT_ERROR, "XSLT-fel"}, /** ER_CURRENCY_SIGN_ILLEGAL */ //public static final int ER_CURRENCY_SIGN_ILLEGAL = 82; { ER_CURRENCY_SIGN_ILLEGAL, "valutatecken \u00e4r inte till\u00e5tet i formatm\u00f6nsterstr\u00e4ng"}, /** ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM */ //public static final int ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = 83; { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Dokumentfunktion inte underst\u00f6dd i Stylesheet DOM!"}, /** ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER */ //public static final int ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = 84; { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Kan inte l\u00f6sa prefix i icke-Prefixl\u00f6sare!"}, /** ER_REDIRECT_COULDNT_GET_FILENAME */ //public static final int ER_REDIRECT_COULDNT_GET_FILENAME = 85; { ER_REDIRECT_COULDNT_GET_FILENAME, "Redirect extension: Hittade inte filnamn - fil eller valattribut m\u00e5ste returnera vald str\u00e4ng."}, /** ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT */ //public static final int ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = 86; { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "Kan inte bygga FormatterListener i Redirect extension!"}, /** ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX */ //public static final int ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = 87; { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Prefix i exkludera-resultat-prefix \u00e4r inte giltig: {0}"}, /** ER_MISSING_NS_URI */ //public static final int ER_MISSING_NS_URI = 88; { ER_MISSING_NS_URI, "Namnrymds-URI saknas f\u00f6r angivna prefix"}, /** ER_MISSING_ARG_FOR_OPTION */ //public static final int ER_MISSING_ARG_FOR_OPTION = 89; { ER_MISSING_ARG_FOR_OPTION, "Argument saknas f\u00f6r alternativ: {0}"}, /** ER_INVALID_OPTION */ //public static final int ER_INVALID_OPTION = 90; { ER_INVALID_OPTION, "Ogiltigt alternativ: {0}"}, /** ER_MALFORMED_FORMAT_STRING */ //public static final int ER_MALFORMED_FORMAT_STRING = 91; { ER_MALFORMED_FORMAT_STRING, "Fel format p\u00e5 formatstr\u00e4ng: {0}"}, /** ER_STYLESHEET_REQUIRES_VERSION_ATTRIB */ //public static final int ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = 92; { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet m\u00e5ste ha ett 'version'-attribut!"}, /** ER_ILLEGAL_ATTRIBUTE_VALUE */ //public static final int ER_ILLEGAL_ATTRIBUTE_VALUE = 93; { ER_ILLEGAL_ATTRIBUTE_VALUE, "Attribut: {0} har ett otill\u00e5tet v\u00e4rde: {1}"}, /** ER_CHOOSE_REQUIRES_WHEN */ //public static final int ER_CHOOSE_REQUIRES_WHEN = 94; { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose kr\u00e4ver ett xsl:when"}, /** ER_NO_APPLY_IMPORT_IN_FOR_EACH */ //public static final int ER_NO_APPLY_IMPORT_IN_FOR_EACH = 95; { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports inte till\u00e5tet i ett xsl:for-each"}, /** ER_CANT_USE_DTM_FOR_OUTPUT */ //public static final int ER_CANT_USE_DTM_FOR_OUTPUT = 96; { ER_CANT_USE_DTM_FOR_OUTPUT, "Kan inte anv\u00e4nda DTMLiaison till en DOM utdatanod... skicka en org.apache.xpath.DOM2Helper ist\u00e4llet!"}, /** ER_CANT_USE_DTM_FOR_INPUT */ //public static final int ER_CANT_USE_DTM_FOR_INPUT = 97; { ER_CANT_USE_DTM_FOR_INPUT, "Kan inte anv\u00e4nda DTMLiaison till en DOM indatanod... skicka en org.apache.xpath.DOM2Helper ist\u00e4llet!"}, /** ER_CALL_TO_EXT_FAILED */ //public static final int ER_CALL_TO_EXT_FAILED = 98; { ER_CALL_TO_EXT_FAILED, "Anrop till anslutningselement misslyckades: {0}"}, /** ER_PREFIX_MUST_RESOLVE */ //public static final int ER_PREFIX_MUST_RESOLVE = 99; { ER_PREFIX_MUST_RESOLVE, "Prefix m\u00e5ste l\u00f6sa till en mamnrymd: {0}"}, /** ER_INVALID_UTF16_SURROGATE */ //public static final int ER_INVALID_UTF16_SURROGATE = 100; { ER_INVALID_UTF16_SURROGATE, "Ogiltigt UTF-16-surrogat uppt\u00e4ckt: {0} ?"}, /** ER_XSLATTRSET_USED_ITSELF */ //public static final int ER_XSLATTRSET_USED_ITSELF = 101; { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} anv\u00e4nde sig sj\u00e4lvt, vilket kommer att orsaka en o\u00e4ndlig loop."}, /** ER_CANNOT_MIX_XERCESDOM */ //public static final int ER_CANNOT_MIX_XERCESDOM = 102; { ER_CANNOT_MIX_XERCESDOM, "Kan inte blanda icke-Xerces-DOM-indata med Xerces-DOM-utdata!"}, /** ER_TOO_MANY_LISTENERS */ //public static final int ER_TOO_MANY_LISTENERS = 103; { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, /** ER_IN_ELEMTEMPLATEELEM_READOBJECT */ //public static final int ER_IN_ELEMTEMPLATEELEM_READOBJECT = 104; { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "I ElemTemplateElement.readObject: {0}"}, /** ER_DUPLICATE_NAMED_TEMPLATE */ //public static final int ER_DUPLICATE_NAMED_TEMPLATE = 105; { ER_DUPLICATE_NAMED_TEMPLATE, "Hittade mer \u00e4n en mall med namnet: {0}"}, /** ER_INVALID_KEY_CALL */ //public static final int ER_INVALID_KEY_CALL = 106; { ER_INVALID_KEY_CALL, "Ogiltigt funktionsanrop: rekursiva key()-anrop \u00e4r inte till\u00e5tna"}, /** Variable is referencing itself */ //public static final int ER_REFERENCING_ITSELF = 107; { ER_REFERENCING_ITSELF, "Variabel {0} h\u00e4nvisar, direkt eller indirekt, till sig sj\u00e4lv!"}, /** Illegal DOMSource input */ //public static final int ER_ILLEGAL_DOMSOURCE_INPUT = 108; { ER_ILLEGAL_DOMSOURCE_INPUT, "Indatanoden till en DOMSource f\u00f6r newTemplates f\u00e5r inte vara null!"}, /** Class not found for option */ //public static final int ER_CLASS_NOT_FOUND_FOR_OPTION = 109; { ER_CLASS_NOT_FOUND_FOR_OPTION, "Klassfil f\u00f6r alternativ {0} saknas"}, /** Required Element not found */ //public static final int ER_REQUIRED_ELEM_NOT_FOUND = 110; { ER_REQUIRED_ELEM_NOT_FOUND, "N\u00f6dv\u00e4ndigt element saknas: {0}"}, /** InputStream cannot be null */ //public static final int ER_INPUT_CANNOT_BE_NULL = 111; { ER_INPUT_CANNOT_BE_NULL, "InputStream f\u00e5r inte vara null"}, /** URI cannot be null */ //public static final int ER_URI_CANNOT_BE_NULL = 112; { ER_URI_CANNOT_BE_NULL, "URI f\u00e5r inte vara null"}, /** File cannot be null */ //public static final int ER_FILE_CANNOT_BE_NULL = 113; { ER_FILE_CANNOT_BE_NULL, "Fil f\u00e5r inte vara null"}, /** InputSource cannot be null */ //public static final int ER_SOURCE_CANNOT_BE_NULL = 114; { ER_SOURCE_CANNOT_BE_NULL, "InputSource f\u00e5r inte vara null"}, /** Could not initialize BSF Manager */ //public static final int ER_CANNOT_INIT_BSFMGR = 116; { ER_CANNOT_INIT_BSFMGR, "Kan inte initialisera BSF Manager"}, /** Could not compile extension */ //public static final int ER_CANNOT_CMPL_EXTENSN = 117; { ER_CANNOT_CMPL_EXTENSN, "Kunde inte kompilera anslutning"}, /** Could not create extension */ //public static final int ER_CANNOT_CREATE_EXTENSN = 118; { ER_CANNOT_CREATE_EXTENSN, "Kunde inte skapa anslutning: {0} p\u00e5 grund av: {1}"}, /** Instance method call to method {0} requires an Object instance as first argument */ //public static final int ER_INSTANCE_MTHD_CALL_REQUIRES = 119; { ER_INSTANCE_MTHD_CALL_REQUIRES, "Instansmetodanrop till metod {0} kr\u00e4ver en Objektinstans som f\u00f6rsta argument"}, /** Invalid element name specified */ //public static final int ER_INVALID_ELEMENT_NAME = 120; { ER_INVALID_ELEMENT_NAME, "Ogiltigt elementnamn angivet {0}"}, /** Element name method must be static */ //public static final int ER_ELEMENT_NAME_METHOD_STATIC = 121; { ER_ELEMENT_NAME_METHOD_STATIC, "Elementnamnmetod m\u00e5ste vara static {0}"}, /** Extension function {0} : {1} is unknown */ //public static final int ER_EXTENSION_FUNC_UNKNOWN = 122; { ER_EXTENSION_FUNC_UNKNOWN, "Anslutningsfunktion {0} : {1} \u00e4r ok\u00e4nd"}, /** More than one best match for constructor for */ //public static final int ER_MORE_MATCH_CONSTRUCTOR = 123; { ER_MORE_MATCH_CONSTRUCTOR, "Fler \u00e4n en b\u00e4sta matchning f\u00f6r konstruktor f\u00f6r {0}"}, /** More than one best match for method */ //public static final int ER_MORE_MATCH_METHOD = 124; { ER_MORE_MATCH_METHOD, "Fler \u00e4n en b\u00e4sta matchning f\u00f6r metod {0}"}, /** More than one best match for element method */ //public static final int ER_MORE_MATCH_ELEMENT = 125; { ER_MORE_MATCH_ELEMENT, "Fler \u00e4n en b\u00e4sta matchning f\u00f6r elementmetod {0}"}, /** Invalid context passed to evaluate */ //public static final int ER_INVALID_CONTEXT_PASSED = 126; { ER_INVALID_CONTEXT_PASSED, "Ogiltig kontext skickad f\u00f6r att utv\u00e4rdera {0}"}, /** Pool already exists */ //public static final int ER_POOL_EXISTS = 127; { ER_POOL_EXISTS, "Pool finns redan"}, /** No driver Name specified */ //public static final int ER_NO_DRIVER_NAME = 128; { ER_NO_DRIVER_NAME, "Inget driver-namn angivet"}, /** No URL specified */ //public static final int ER_NO_URL = 129; { ER_NO_URL, "Ingen URL angiven"}, /** Pool size is less than one */ //public static final int ER_POOL_SIZE_LESSTHAN_ONE = 130; { ER_POOL_SIZE_LESSTHAN_ONE, "Poolstorlek \u00e4r mindre \u00e4n ett!"}, /** Invalid driver name specified */ //public static final int ER_INVALID_DRIVER = 131; { ER_INVALID_DRIVER, "Ogiltigt driver-namn angivet"}, /** Did not find the stylesheet root */ //public static final int ER_NO_STYLESHEETROOT = 132; { ER_NO_STYLESHEETROOT, "Hittade inte stylesheet-roten!"}, /** Illegal value for xml:space */ //public static final int ER_ILLEGAL_XMLSPACE_VALUE = 133; { ER_ILLEGAL_XMLSPACE_VALUE, "Ogiltigt v\u00e4rde f\u00f6r xml:space"}, /** processFromNode failed */ //public static final int ER_PROCESSFROMNODE_FAILED = 134; { ER_PROCESSFROMNODE_FAILED, "processFromNode misslyckades"}, /** The resource [] could not load: */ //public static final int ER_RESOURCE_COULD_NOT_LOAD = 135; { ER_RESOURCE_COULD_NOT_LOAD, "Resursen [ {0} ] kunde inte laddas: {1} \n {2} \t {3}"}, /** Buffer size <=0 */ //public static final int ER_BUFFER_SIZE_LESSTHAN_ZERO = 136; { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Bufferstorlek <=0"}, /** Unknown error when calling extension */ //public static final int ER_UNKNOWN_ERROR_CALLING_EXTENSION = 137; { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Ok\u00e4nt fel vid anslutningsanrop"}, /** Prefix {0} does not have a corresponding namespace declaration */ //public static final int ER_NO_NAMESPACE_DECL = 138; { ER_NO_NAMESPACE_DECL, "Prefix{0} har inte en motsvarande namnrymdsdeklaration"}, /** Element content not allowed for lang=javaclass */ //public static final int ER_ELEM_CONTENT_NOT_ALLOWED = 139; { ER_ELEM_CONTENT_NOT_ALLOWED, "Elementinneh\u00e5ll \u00e4r inte till\u00e5tet f\u00f6r lang=javaclass {0}"}, /** Stylesheet directed termination */ //public static final int ER_STYLESHEET_DIRECTED_TERMINATION = 140; { ER_STYLESHEET_DIRECTED_TERMINATION, "Stylesheet-ledd avslutning"}, /** 1 or 2 */ //public static final int ER_ONE_OR_TWO = 141; { ER_ONE_OR_TWO, "1 eller 2"}, /** 2 or 3 */ //public static final int ER_TWO_OR_THREE = 142; { ER_TWO_OR_THREE, "2 eller 3"}, /** Could not load {0} (check CLASSPATH), now using just the defaults */ //public static final int ER_COULD_NOT_LOAD_RESOURCE = 143; { ER_COULD_NOT_LOAD_RESOURCE, "Kunde inte ladda {0} (kontrollera CLASSPATH), anv\u00e4nder nu enbart standard"}, /** Cannot initialize default templates */ //public static final int ER_CANNOT_INIT_DEFAULT_TEMPLATES = 144; { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Kan inte initialisera standardmallar"}, /** Result should not be null */ //public static final int ER_RESULT_NULL = 145; { ER_RESULT_NULL, "Result borde inte vara null"}, /** Result could not be set */ //public static final int ER_RESULT_COULD_NOT_BE_SET = 146; { ER_RESULT_COULD_NOT_BE_SET, "Result kunde inte s\u00e4ttas"}, /** No output specified */ //public static final int ER_NO_OUTPUT_SPECIFIED = 147; { ER_NO_OUTPUT_SPECIFIED, "Ingen utdata angiven"}, /** Can't transform to a Result of type */ //public static final int ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = 148; { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Kan inte omvandla till en Result av typ {0}"}, /** Can't transform to a Source of type */ //public static final int ER_CANNOT_TRANSFORM_SOURCE_TYPE = 149; { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Kan inte omvandla en Source av typ {0}"}, /** Null content handler */ //public static final int ER_NULL_CONTENT_HANDLER = 150; { ER_NULL_CONTENT_HANDLER, "Inneh\u00e5llshanterare med v\u00e4rde null"}, /** Null error handler */ //public static final int ER_NULL_ERROR_HANDLER = 151; { ER_NULL_ERROR_HANDLER, "Felhanterare med v\u00e4rde null"}, /** parse can not be called if the ContentHandler has not been set */ //public static final int ER_CANNOT_CALL_PARSE = 152; { ER_CANNOT_CALL_PARSE, "parse kan inte anropas om ContentHandler inte har satts"}, /** No parent for filter */ //public static final int ER_NO_PARENT_FOR_FILTER = 153; { ER_NO_PARENT_FOR_FILTER, "Ingen f\u00f6r\u00e4lder till filter"}, /** No stylesheet found in: {0}, media */ //public static final int ER_NO_STYLESHEET_IN_MEDIA = 154; { ER_NO_STYLESHEET_IN_MEDIA, "Stylesheet saknas i: {0}, media= {1}"}, /** No xml-stylesheet PI found in */ //public static final int ER_NO_STYLESHEET_PI = 155; { ER_NO_STYLESHEET_PI, "xml-stylesheet PI saknas i: {0}"}, /** Not supported */ //public static final int ER_NOT_SUPPORTED = 171; { ER_NOT_SUPPORTED, "Underst\u00f6ds inte: {0}"}, /** Value for property {0} should be a Boolean instance */ //public static final int ER_PROPERTY_VALUE_BOOLEAN = 177; { ER_PROPERTY_VALUE_BOOLEAN, "V\u00e4rde p\u00e5 egenskap {0} borde vara en Boolesk instans"}, /* This key/message changed ,NEED ER_COULD_NOT_FIND_EXTERN_SCRIPT: Pending,Ramesh */ /** src attribute not yet supported for */ //public static final int ER_SRC_ATTRIB_NOT_SUPPORTED = 195; { "ER_SRC_ATTRIB_NOT_SUPPORTED", "src-attributet underst\u00f6ds \u00e4nnu inte f\u00f6r {0}"}, /** The resource [] could not be found */ //public static final int ER_RESOURCE_COULD_NOT_FIND = 196; { ER_RESOURCE_COULD_NOT_FIND, "Resursen [ {0} ] saknas. \n {1}"}, /** output property not recognized: */ //public static final int ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = 197; { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Utdata-egenskap k\u00e4nns inte igen: {0}"}, /** Failed creating ElemLiteralResult instance */ //public static final int ER_FAILED_CREATING_ELEMLITRSLT = 203; { ER_FAILED_CREATING_ELEMLITRSLT, "Kunde inte skapa instans av ElemLiteralResult"}, // Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. - nb. /** Priority value does not contain a parsable number */ //public static final int ER_VALUE_SHOULD_BE_NUMBER = 204; { ER_VALUE_SHOULD_BE_NUMBER, "V\u00e4rdet f\u00f6r {0} b\u00f6r inneh\u00e5lla en siffra som inte kan tolkas"}, /** Value for {0} should equal 'yes' or 'no' */ //public static final int ER_VALUE_SHOULD_EQUAL = 205; { ER_VALUE_SHOULD_EQUAL, "V\u00e4rde p\u00e5 {0} borde motsvara ja eller nej"}, /** Failed calling {0} method */ //public static final int ER_FAILED_CALLING_METHOD = 206; { ER_FAILED_CALLING_METHOD, " Kunde inte anropa metoden {0}"}, /** Failed creating ElemLiteralResult instance */ //public static final int ER_FAILED_CREATING_ELEMTMPL = 207; { ER_FAILED_CREATING_ELEMTMPL, "Kunde inte skapa instans av ElemTemplateElement"}, /** Characters are not allowed at this point in the document */ //public static final int ER_CHARS_NOT_ALLOWED = 208; { ER_CHARS_NOT_ALLOWED, "Tecken \u00e4r inte till\u00e5tna i dokumentet vid den h\u00e4r tidpunkten"}, /** attribute is not allowed on the element */ //public static final int ER_ATTR_NOT_ALLOWED = 209; { ER_ATTR_NOT_ALLOWED, "Attributet \"{0}\" \u00e4r inte till\u00e5ten i det {1} elementet!"}, /** Bad value */ //public static final int ER_BAD_VALUE = 211; { ER_BAD_VALUE, "{0} d\u00e5ligt v\u00e4rde {1} "}, /** attribute value not found */ //public static final int ER_ATTRIB_VALUE_NOT_FOUND = 212; { ER_ATTRIB_VALUE_NOT_FOUND, "Attributet {0} saknas "}, /** attribute value not recognized */ //public static final int ER_ATTRIB_VALUE_NOT_RECOGNIZED = 213; { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Attributv\u00e4rdet {0} k\u00e4nns inte igen "}, /** Attempting to generate a namespace prefix with a null URI */ //public static final int ER_NULL_URI_NAMESPACE = 216; { ER_NULL_URI_NAMESPACE, "F\u00f6rs\u00f6ker generera ett namnomr\u00e5desprefix med en null-URI"}, // Following are the new ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) /** Attempting to generate a namespace prefix with a null URI */ //public static final int ER_NUMBER_TOO_BIG = 217; { ER_NUMBER_TOO_BIG, "F\u00f6rs\u00f6ker formatera en siffra som \u00e4r st\u00f6rre \u00e4n det st\u00f6rsta l\u00e5nga heltalet"}, //ER_CANNOT_FIND_SAX1_DRIVER //public static final int ER_CANNOT_FIND_SAX1_DRIVER = 218; { ER_CANNOT_FIND_SAX1_DRIVER, "Det g\u00e5r inte att hitta SAX1-drivrutinen klass {0}"}, //ER_SAX1_DRIVER_NOT_LOADED //public static final int ER_SAX1_DRIVER_NOT_LOADED = 219; { ER_SAX1_DRIVER_NOT_LOADED, "SAX1-drivrutinen klass {0} hittades men kan inte laddas"}, //ER_SAX1_DRIVER_NOT_INSTANTIATED //public static final int ER_SAX1_DRIVER_NOT_INSTANTIATED = 220 ; { ER_SAX1_DRIVER_NOT_INSTANTIATED, "SAX1-drivrutinen klass {0} hittades men kan inte instansieras"}, // ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER //public static final int ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = 221; { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1-drivrutinen klass {0} implementerar inte org.xml.sax.Parser"}, // ER_PARSER_PROPERTY_NOT_SPECIFIED //public static final int ER_PARSER_PROPERTY_NOT_SPECIFIED = 222; { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Systemegenskapen org.xml.sax.parser \u00e4r inte angiven"}, //ER_PARSER_ARG_CANNOT_BE_NULL //public static final int ER_PARSER_ARG_CANNOT_BE_NULL = 223 ; { ER_PARSER_ARG_CANNOT_BE_NULL, "Tolkningsargumentet f\u00e5r inte vara null"}, // ER_FEATURE //public static final int ER_FEATURE = 224; { ER_FEATURE, "Funktion:a {0}"}, // ER_PROPERTY //public static final int ER_PROPERTY = 225 ; { ER_PROPERTY, "Egenskap:a {0}"}, // ER_NULL_ENTITY_RESOLVER //public static final int ER_NULL_ENTITY_RESOLVER = 226; { ER_NULL_ENTITY_RESOLVER, "Nullenhetsl\u00f6sare"}, // ER_NULL_DTD_HANDLER //public static final int ER_NULL_DTD_HANDLER = 227 ; { ER_NULL_DTD_HANDLER, "Null-DTD-hanterare"}, // No Driver Name Specified! //public static final int ER_NO_DRIVER_NAME_SPECIFIED = 228; { ER_NO_DRIVER_NAME_SPECIFIED, "Inget drivrutinsnamn \u00e4r angett!"}, // No URL Specified! //public static final int ER_NO_URL_SPECIFIED = 229; { ER_NO_URL_SPECIFIED, "Ingen URL har angetts!"}, // Pool size is less than 1! //public static final int ER_POOLSIZE_LESS_THAN_ONE = 230; { ER_POOLSIZE_LESS_THAN_ONE, "Poolstorleken \u00e4r mindre \u00e4n 1!"}, // Invalid Driver Name Specified! //public static final int ER_INVALID_DRIVER_NAME = 231; { ER_INVALID_DRIVER_NAME, "Ett ogiltigt drivrutinsnamn har angetts!"}, // ErrorListener //public static final int ER_ERRORLISTENER = 232; { ER_ERRORLISTENER, "ErrorListener"}, // Programmer's error! expr has no ElemTemplateElement parent! //public static final int ER_ASSERT_NO_TEMPLATE_PARENT = 233; { ER_ASSERT_NO_TEMPLATE_PARENT, "Programmerarfel! expr har inget \u00f6verordnat ElemTemplateElement!"}, // Programmer's assertion in RundundentExprEliminator: {0} //public static final int ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = 234; { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Programmerarkontroll i RundundentExprEliminator: {0}"}, // {0}is not allowed in this position in the stylesheet! //public static final int ER_NOT_ALLOWED_IN_POSITION = 237; { ER_NOT_ALLOWED_IN_POSITION, "{0} \u00e4r inte till\u00e5ten i denna position i formatmallen!"}, // Non-whitespace text is not allowed in this position in the stylesheet! //public static final int ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = 238; { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Text utan blanksteg \u00e4r inte till\u00e5ten i denna position i formatmallen!"}, // This code is shared with warning codes. // Illegal value: {1} used for CHAR attribute: {0}. An attribute of type CHAR must be only 1 character! //public static final int INVALID_TCHAR = 239; // SystemId Unknown { INVALID_TCHAR, "Ogiltigt v\u00e4rde: {1} anv\u00e4nds f\u00f6r CHAR-attributet: {0}. Ett attribut av CHAR-typ f\u00e5r bara ha 1 tecken!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. // INVALID_QNAME //The following codes are shared with the warning codes... // Illegal value: {1} used for QNAME attribute: {0} //public static final int INVALID_QNAME = 242; { INVALID_QNAME, "Ogiltigt v\u00e4rde:a {1} anv\u00e4nds f\u00f6r QNAME-attributet:a {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. // INVALID_ENUM // Illegal value:a {1} used for ENUM attribute:a {0}. Valid values are:a {2}. //public static final int INVALID_ENUM = 243; { INVALID_ENUM, "Ogiltigt v\u00e4rde:a {1} anv\u00e4nds f\u00f6r ENUM-attributet:a {0}. Giltiga v\u00e4rden \u00e4r:a {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. // INVALID_NMTOKEN // Illegal value:a {1} used for NMTOKEN attribute:a {0}. //public static final int INVALID_NMTOKEN = 244; { INVALID_NMTOKEN, "Ogiltigt v\u00e4rde:a {1} anv\u00e4nds f\u00f6r NMTOKEN-attributet:a {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. // INVALID_NCNAME // Illegal value:a {1} used for NCNAME attribute:a {0}. //public static final int INVALID_NCNAME = 245; { INVALID_NCNAME, "Ogiltigt v\u00e4rde:a {1} anv\u00e4nds f\u00f6r NCNAME-attributet:a {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. // INVALID_BOOLEAN // Illegal value:a {1} used for boolean attribute:a {0}. //public static final int INVALID_BOOLEAN = 246; { INVALID_BOOLEAN, "Ogiltigt v\u00e4rde:a {1} anv\u00e4nds som Booleskt attribut:a {0} "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. // INVALID_NUMBER // Illegal value:a {1} used for number attribute:a {0}. //public static final int INVALID_NUMBER = 247; { INVALID_NUMBER, "Ogiltigt v\u00e4rde:a {1} anv\u00e4nds som sifferattribut:a {0} "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 // Argument to {0} in match pattern must be a literal. //public static final int ER_ARG_LITERAL = 248; { ER_ARG_LITERAL, "Argument f\u00f6r {0} i matchningsm\u00f6nstret m\u00e5ste vara literalt."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 // Duplicate global variable declaration. //public static final int ER_DUPLICATE_GLOBAL_VAR = 249; { ER_DUPLICATE_GLOBAL_VAR, "Dubbel deklaration av global variabel."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 // Duplicate variable declaration. //public static final int ER_DUPLICATE_VAR = 250; { ER_DUPLICATE_VAR, "Dubbel variabeldeklaration."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 // xsl:template must have a name or match attribute (or both) //public static final int ER_TEMPLATE_NAME_MATCH = 251; { ER_TEMPLATE_NAME_MATCH, "xsl: en mall m\u00e5ste ha ett namn och ett matchningsattribut (eller b\u00e5de och)"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 // Prefix in exclude-result-prefixes is not valid:a {0} //public static final int ER_INVALID_PREFIX = 252; { ER_INVALID_PREFIX, "Prefix i exclude-result-prefixes \u00e4r ogiltigt:a {0}"}, // Note to translators: An "attribute set" is a set of attributes that can be // added to an element in the output document as a group. The message indicates // that there was a reference to an attribute set named {0} that was never // defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 // attribute-set named {0} does not exist //public static final int ER_NO_ATTRIB_SET = 253; { ER_NO_ATTRIB_SET, "attributserien {0} finns inte"}, // Warnings... /** WG_FOUND_CURLYBRACE */ //public static final int WG_FOUND_CURLYBRACE = 1; { WG_FOUND_CURLYBRACE, "Hittade '}' men ingen attributmall \u00e4r \u00f6ppen!"}, /** WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR */ //public static final int WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = 2; { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Varning: r\u00e4knarattribut matchar inte en f\u00f6rf\u00e4der in xsl:number! Target = {0}"}, /** WG_EXPR_ATTRIB_CHANGED_TO_SELECT */ //public static final int WG_EXPR_ATTRIB_CHANGED_TO_SELECT = 3; { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Gammal syntax: Namnet p\u00e5 'expr'-attributet har \u00e4ndrats till 'select'."}, /** WG_NO_LOCALE_IN_FORMATNUMBER */ //public static final int WG_NO_LOCALE_IN_FORMATNUMBER = 4; { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan hanterar \u00e4nnu inte locale-namnet i funktionen format-number."}, /** WG_LOCALE_NOT_FOUND */ //public static final int WG_LOCALE_NOT_FOUND = 5; { WG_LOCALE_NOT_FOUND, "Varning: Hittade inte locale f\u00f6r xml:lang{0}"}, /** WG_CANNOT_MAKE_URL_FROM */ //public static final int WG_CANNOT_MAKE_URL_FROM = 6; { WG_CANNOT_MAKE_URL_FROM, "Kan inte skapa URL fr\u00e5n: {0}"}, /** WG_CANNOT_LOAD_REQUESTED_DOC */ //public static final int WG_CANNOT_LOAD_REQUESTED_DOC = 7; { WG_CANNOT_LOAD_REQUESTED_DOC, "Kan inte ladda beg\u00e4rd doc: {0}"}, /** WG_CANNOT_FIND_COLLATOR */ //public static final int WG_CANNOT_FIND_COLLATOR = 8; { WG_CANNOT_FIND_COLLATOR, "Hittade inte Collator f\u00f6r >>>>>> Xalan Version"}, { "version2", "<<<<<<<"}, { "yes", "ja"}, { "line", "Rad #"}, { "column", "Kolumn #"}, { "xsldone", "XSLProcessor: f\u00e4rdig"}, { "xslProc_option", "Xalan-J kommando linje Process klass alternativ:"}, { "optionIN", " -IN inputXMLURL"}, { "optionXSL", " [-XSL XSLTransformationURL]"}, { "optionOUT", " [-OUT utdataFilnamn]"}, { "optionLXCIN", " [-LXCIN kompileratStylesheetFilnameIn]"}, { "optionLXCOUT", " [-LXCOUT kompileratStylesheetFilenameUt]"}, { "optionPARSER", " [-PARSER fullt kvalificerat klassnamn eller tolkf\u00f6rbindelse]"}, { "optionE", " [-E (Ut\u00f6ka inte enhetsreferenser)]"}, { "optionV", " [-E (Ut\u00f6ka inte enhetsreferenser)]"}, { "optionQC", " [-QC (Tysta M\u00f6nsterkonfliktvarningar)]"}, { "optionQ", " [-Q (Tyst Tillst\u00e5nd)]"}, { "optionLF", " [-LF (Anv\u00e4nd radframmatning enbart p\u00e5 utdata {standard \u00e4r CR/LF})]"}, { "optionCR", " [-CR (Anv\u00e4nd vagnretur enbart p\u00e5 utdata {standard \u00e4r CR/LF})]"}, { "optionESCAPE", " [-ESCAPE (Vilka tecken \u00e4r skiftningstecken {standard \u00e4r <>&\"\'\\r\\n}]"}, { "optionINDENT", " [-INDENT (Best\u00e4m antal blanksteg f\u00f6r att tabulera {standard \u00e4r 0})]"}, { "optionTT", " [-TT (Sp\u00e5ra mallarna allt eftersom de blir anropade.)]"}, { "optionTG", " [-TG (Sp\u00e5ra varje generationsh\u00e4ndelse.)]"}, { "optionTS", " [-TS (Sp\u00e5ra varje valh\u00e4ndelse.)]"}, { "optionTTC", " [-TTC (Sp\u00e5ra mallbarnen allt eftersom de blir behandlade.)]"}, { "optionTCLASS", " [-TCLASS (TraceListener-klass f\u00f6r sp\u00e5rningsanslutningar.)]"}, { "optionVALIDATE", " [-VALIDATE (S\u00e4tt om validering ska ske. Standard \u00e4r att validering \u00e4r avst\u00e4ngd)]"}, { "optionEDUMP", " [-EDUMP {valfritt filnamn) (G\u00f6r stackdump vid fel.)]"}, { "optionXML", " [-XML (Anv\u00e4nd XML-formaterare och l\u00e4gg till XML-huvud.)]"}, { "optionTEXT", " [-XML (Anv\u00e4nd enkel Text-formaterare.)]"}, { "optionHTML", " [-HTML (Anv\u00e4nd HTML-formaterare)]"}, { "optionPARAM", " [-PARAM namn uttryck (S\u00e4tt en stylesheet-parameter)]"}, { "noParsermsg1", "XSL-Process misslyckades."}, { "noParsermsg2", "** Hittade inte tolk **"}, { "noParsermsg3", "V\u00e4nligen kontrollera din classpath"}, { "noParsermsg4", "Om du inte har IBMs XML-Tolk f\u00f6r Java, kan du ladda ner den fr\u00e5n"}, { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER fullst\u00e4ndigt klassnamn (URIResolver som ska anv\u00e4ndas f\u00f6r att l\u00f6sa URI-er)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER fullst\u00e4ndigt klassnamn (EntityResolver som ska anv\u00e4ndas f\u00f6r att l\u00f6sa enheter)]"}, { "optionCONTENTHANDLER", " [-CONTENTRESOLVER fullst\u00e4ndigt klassnamn (ContentHandler som ska anv\u00e4ndas f\u00f6r att serialisera utdata)]"}, { "optionLINENUMBERS", " [-L anv\u00e4nd radnummer i k\u00e4lldokument]"}, //Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType (anv\u00e4nd medieattribut f\u00f6r att hitta en formatmall som \u00e4r associerad med ett dokument.)]"}, { "optionFLAVOR", " [-FLAVOR flavorName (Anv\u00e4nd s2s=SAX eller d2d=DOM f\u00f6r transformationen.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (Skriv ut totala transformationer, millisekunder.)]"}, { "optionINCREMENTAL", " [-INCREMENTAL (beg\u00e4r inkrementell DTM-konstruktion genom att ange http://xml.apache.org/xalan/features/incremental true.)]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (beg\u00e4r ingen formatmallsoptimering genom att ange http://xml.apache.org/xalan/features/optimize false.)]"}, { "optionRL", " [-RL recursionlimit (kontrollera numerisk gr\u00e4ns p\u00e5 formatmallens rekursionsdjup.)]"}, { "optionXO", " [-XO [transletName] (tilldela namnet till genererad translet)]"}, { "optionXD", " [-XD destinationDirectory (ange m\u00e5lkatalog f\u00f6r translet)]"}, { "optionXJ", " [-XJ jarfile (paketerar transletklasserna i en jar-fil med namnet )]"}, { "optionXP", " [-XP-paket (anger ett paketnamnsprefix f\u00f6r alla genererade transletklasser)]"} }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "D\u00c5LIG_KOD"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMATERING_MISSLYCKADES"; /** General error string. */ public static final String ERROR_STRING = "#fel"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Fel: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Varning: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "M\u00d6NSTER "; } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLMessages.java0000644000175000017500000000560110721374033022776 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLMessages.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import org.apache.xpath.res.XPATHMessages; /** * Sets things up for issuing error messages. This class is misnamed, and * should be called XalanMessages, or some such. * @xsl.usage internal */ public class XSLMessages extends XPATHMessages { /** The language specific resource object for Xalan messages. */ private static ListResourceBundle XSLTBundle = null; /** The class name of the Xalan error message string table. */ private static final String XSLT_ERROR_RESOURCES = "org.apache.xalan.res.XSLTErrorResources"; /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createMessage(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES); if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else return "Could not load any resource bundles."; } /** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted warning string. */ public static final String createWarning(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES); if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else return "Could not load any resource bundles."; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_en.java0000644000175000017500000000214610721374032025021 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_en.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; /** * Default implementation of XSLTErrorResources. This is just * an empty class. * @xsl.usage advanced */ public class XSLTErrorResources_en extends XSLTErrorResources { } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_de.java0000644000175000017500000021247510721374030025015 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_de.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_de extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "Fehler: '{' darf nicht innerhalb des Ausdrucks stehen."}, { ER_ILLEGAL_ATTRIBUTE , "{0} hat ein unzul\u00e4ssiges Attribut {1}."}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "sourceNode ist Null in xsl:apply-imports!"}, {ER_CANNOT_ADD, "{0} kann nicht {1} hinzugef\u00fcgt werden."}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "sourceNode ist Null in handleApplyTemplatesInstruction!"}, { ER_NO_NAME_ATTRIB, "{0} muss ein Namensattribut haben."}, {ER_TEMPLATE_NOT_FOUND, "Vorlage konnte nicht gefunden werden: {0}"}, {ER_CANT_RESOLVE_NAME_AVT, "Namensvorlage f\u00fcr den Attributwert in xsl:call-template konnte nicht aufgel\u00f6st werden."}, {ER_REQUIRES_ATTRIB, "{0} erfordert das Attribut {1}."}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} muss \u00fcber ein Attribut ''test'' verf\u00fcgen."}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "Falscher Wert f\u00fcr Ebenenattribut: {0}."}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "Name der Verarbeitungsanweisung darf nicht 'xml' sein."}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "Name der Verarbeitungsanweisung muss ein g\u00fcltiges NCName-Format haben: {0}."}, { ER_NEED_MATCH_ATTRIB, "{0} muss \u00fcber ein entsprechendes Attribut verf\u00fcgen, wenn ein Modus vorhanden ist."}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} erfordert einen Namen oder ein \u00dcbereinstimmungsattribut."}, {ER_CANT_RESOLVE_NSPREFIX, "Pr\u00e4fix des Namensbereichs kann nicht aufgel\u00f6st werden: {0}."}, { ER_ILLEGAL_VALUE, "xml:space weist einen ung\u00fcltigen Wert auf: {0}"}, { ER_NO_OWNERDOC, "Der Kindknoten hat kein Eignerdokument!"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement-Fehler: {0}"}, { ER_NULL_CHILD, "Es wird versucht, ein leeres Kind hinzuzuf\u00fcgen!"}, { ER_NEED_SELECT_ATTRIB, "{0} erfordert ein Attribut ''''select''''."}, { ER_NEED_TEST_ATTRIB , "xsl:when muss \u00fcber ein Attribut 'test' verf\u00fcgen."}, { ER_NEED_NAME_ATTRIB, "xsl:with-param muss \u00fcber ein Attribut 'name' verf\u00fcgen."}, { ER_NO_CONTEXT_OWNERDOC, "Der Kontextknoten verf\u00fcgt nicht \u00fcber ein Eignerdokument!"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "XML-TransformerFactory-Liaison konnte nicht erstellt werden: {0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan:-Prozess konnte nicht erfolgreich durchgef\u00fchrt werden."}, { ER_NOT_SUCCESSFUL, "Xalan: war nicht erfolgreich."}, { ER_ENCODING_NOT_SUPPORTED, "Verschl\u00fcsselung wird nicht unterst\u00fctzt: {0}."}, {ER_COULD_NOT_CREATE_TRACELISTENER, "TraceListener konnte nicht erstellt werden: {0}."}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key erfordert ein Attribut 'name'!"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key erfordert ein Attribut 'match'!"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key erfordert ein Attribut 'use'!"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} erfordert ein Attribut ''elements''!"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0}: Das Attribut ''prefix'' fehlt."}, { ER_BAD_STYLESHEET_URL, "Formatvorlagen-URL-Adresse ist ung\u00fcltig: {0}."}, { ER_FILE_NOT_FOUND, "Formatvorlagendatei konnte nicht gefunden werden: {0}."}, { ER_IOEXCEPTION, "Bei folgender Formatvorlagendatei ist eine E/A-Ausnahmebedingung aufgetreten: {0}."}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) Attribut ''href'' f\u00fcr {0} konnte nicht gefunden werden."}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} schlie\u00dft sich selbst direkt oder indirekt mit ein!"}, { ER_PROCESSINCLUDE_ERROR, "Fehler in StylesheetHandler.processInclude, {0}."}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0}: Das Attribut ''lang'' fehlt."}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) Element {0} an falscher Position? Fehlendes Containerelement ''component''."}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "Ausgabe kann nur an ein Element, Dokumentfragment, Dokument oder Druckausgabeprogramm erfolgen."}, { ER_PROCESS_ERROR, "Fehler in StylesheetRoot.process"}, { ER_UNIMPLNODE_ERROR, "UnImplNode-Fehler: {0}"}, { ER_NO_SELECT_EXPRESSION, "Fehler! xpath-Auswahlausdruck (-select) konnte nicht gefunden werden."}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "XSLProcessor kann nicht serialisiert werden!"}, { ER_NO_INPUT_STYLESHEET, "Formatvorlageneingabe wurde nicht angegeben!"}, { ER_FAILED_PROCESS_STYLESHEET, "Verarbeitung der Formatvorlage fehlgeschlagen!"}, { ER_COULDNT_PARSE_DOC, "Dokument {0} konnte nicht syntaktisch analysiert werden!"}, { ER_COULDNT_FIND_FRAGMENT, "Fragment konnte nicht gefunden werden: {0}."}, { ER_NODE_NOT_ELEMENT, "Der Knoten, auf den von einer Fragment-ID verwiesen wurde, war kein Element: {0}."}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "'for-each' muss entweder ein Attribut 'match' oder 'name' haben."}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "Vorlagen m\u00fcssen entweder ein Attribut 'match' oder 'name' haben."}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "Kein Klon eines Dokumentfragments!"}, { ER_CANT_CREATE_ITEM, "Im Ergebnisbaum kann kein Eintrag erzeugt werden: {0}."}, { ER_XMLSPACE_ILLEGAL_VALUE, "xml:space in der Quellen-XML hat einen ung\u00fcltigen Wert: {0}."}, { ER_NO_XSLKEY_DECLARATION, "Keine Deklaration xsl:key f\u00fcr {0} vorhanden!"}, { ER_CANT_CREATE_URL, "Fehler! URL kann nicht erstellt werden f\u00fcr: {0}"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions wird nicht unterst\u00fctzt."}, { ER_PROCESSOR_ERROR, "XSLT-TransformerFactory-Fehler"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} nicht zul\u00e4ssig innerhalb einer Formatvorlage!"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns wird nicht mehr unterst\u00fctzt! Verwenden Sie stattdessen xsl:output."}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space wird nicht mehr unterst\u00fctzt! Verwenden Sie stattdessen xsl:strip-space oder xsl:preserve-space."}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result wird nicht mehr unterst\u00fctzt! Verwenden Sie stattdessen xsl:output."}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} hat ein ung\u00fcltiges Attribut: {1}."}, { ER_UNKNOWN_XSL_ELEM, "Unbekanntes XSL-Element: {0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort kann nur mit xsl:apply-templates oder xsl:for-each verwendet werden."}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) xsl:when steht an der falschen Position!"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) F\u00fcr xsl:when ist xsl:choose nicht als Elter definiert!"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) xsl:otherwise steht an der falschen Position!"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) F\u00fcr xsl:otherwise ist xsl:choose nicht als Elter definiert!"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "(StylesheetHandler) {0} ist innerhalb einer Vorlage nicht zul\u00e4ssig!"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0}: Erweiterung des Namensbereichspr\u00e4fixes {1} ist unbekannt"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Importe k\u00f6nnen nur als erste Elemente in der Formatvorlage auftreten!"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} importiert sich direkt oder indirekt selbst!"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space hat einen ung\u00fcltigen Wert: {0}."}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet nicht erfolgreich!"}, { ER_SAX_EXCEPTION, "SAX-Ausnahmebedingung"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "Funktion nicht unterst\u00fctzt!"}, { ER_XSLT_ERROR, "XSLT-Fehler"}, { ER_CURRENCY_SIGN_ILLEGAL, "Ein W\u00e4hrungssymbol ist in der Formatmusterzeichenfolge nicht zul\u00e4ssig."}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "Eine Dokumentfunktion wird in der Dokumentobjektmodell-Formatvorlage nicht unterst\u00fctzt!"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "Pr\u00e4fix einer Aufl\u00f6sung ohne Pr\u00e4fix kann nicht aufgel\u00f6st werden!"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "Umleitungserweiterung: Dateiname konnte nicht abgerufen werden - Datei oder Attribut 'select' muss eine g\u00fcltige Zeichenfolge zur\u00fcckgeben."}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "FormatterListener kann in Umleitungserweiterung nicht erstellt werden!"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "Pr\u00e4fix in exclude-result-prefixes ist nicht g\u00fcltig: {0}."}, { ER_MISSING_NS_URI, "Fehlende Namensbereichs-URI f\u00fcr angegebenes Pr\u00e4fix."}, { ER_MISSING_ARG_FOR_OPTION, "Fehlendes Argument f\u00fcr Option: {0}."}, { ER_INVALID_OPTION, "Ung\u00fcltige Option: {0}"}, { ER_MALFORMED_FORMAT_STRING, "Syntaktisch falsche Formatzeichenfolge: {0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet erfordert ein Attribut 'version'!"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "Attribut {0} weist einen ung\u00fcltigen Wert auf: {1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose erfordert xsl:when."}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports ist in xsl:for-each nicht zul\u00e4ssig."}, { ER_CANT_USE_DTM_FOR_OUTPUT, "DTMLiaison kann nicht f\u00fcr einen Ausgabe-Dokumentobjektmodellknoten verwendet werden... \u00dcbergeben Sie stattdessen org.apache.xpath.DOM2Helper!"}, { ER_CANT_USE_DTM_FOR_INPUT, "DTMLiaison kann nicht f\u00fcr einen Eingabe-Dokumentobjektmodellknoten verwendet werden... \u00dcbergeben Sie stattdessen org.apache.xpath.DOM2Helper!"}, { ER_CALL_TO_EXT_FAILED, "Aufruf an Erweiterungselement fehlgeschlagen: {0}."}, { ER_PREFIX_MUST_RESOLVE, "Das Pr\u00e4fix muss in einen Namensbereich aufgel\u00f6st werden: {0}"}, { ER_INVALID_UTF16_SURROGATE, "Ung\u00fcltige UTF-16-Ersetzung festgestellt: {0} ?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} verwendet sich selbst, wodurch eine Endlosschleife verursacht wird."}, { ER_CANNOT_MIX_XERCESDOM, "Nicht-Xerces-Dokumentobjektmodelleingabe kann nicht mit Xerces-Dokumentobjektmodellausgabe gemischt werden!"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "In ElemTemplateElement.readObject: {0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "Mehrere Vorlagen mit folgendem Namen gefunden: {0}."}, { ER_INVALID_KEY_CALL, "Ung\u00fcltiger Funktionsaufruf: rekursive Aufrufe 'key()'sind nicht zul\u00e4ssig."}, { ER_REFERENCING_ITSELF, "Variable {0} verweist direkt oder indirekt auf sich selbst!"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "Der Eingabeknoten kann f\u00fcr DOMSource f\u00fcr newTemplates nicht Null sein!"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "Klassendatei f\u00fcr Option {0} wurde nicht gefunden."}, { ER_REQUIRED_ELEM_NOT_FOUND, "Erforderliches Element nicht gefunden: {0}."}, { ER_INPUT_CANNOT_BE_NULL, "InputStream kann nicht Null sein."}, { ER_URI_CANNOT_BE_NULL, "URI kann nicht Null sein."}, { ER_FILE_CANNOT_BE_NULL, "Eine Datei kann nicht Null sein."}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource kann nicht Null sein."}, { ER_CANNOT_INIT_BSFMGR, "BSF Manager kann nicht initialisiert werden."}, { ER_CANNOT_CMPL_EXTENSN, "Erweiterung konnte nicht kompiliert werden."}, { ER_CANNOT_CREATE_EXTENSN, "Erweiterung {0} konnte nicht erstellt werden. Ursache: {1}."}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "Der Aufruf einer Instanzdefinitionsmethode von Methode {0} erfordert eine Objektinstanz als erstes Argument."}, { ER_INVALID_ELEMENT_NAME, "Ung\u00fcltiger Elementname angegeben {0}."}, { ER_ELEMENT_NAME_METHOD_STATIC, "Elementnamenmethode muss statisch sein: {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "Erweiterungsfunktion {0} : {1} ist unbekannt."}, { ER_MORE_MATCH_CONSTRUCTOR, "Mehrere passende Entsprechungen f\u00fcr Konstruktor f\u00fcr {0}."}, { ER_MORE_MATCH_METHOD, "Mehrere passende Entsprechungen f\u00fcr Methode {0}."}, { ER_MORE_MATCH_ELEMENT, "Mehrere passende Entsprechungen f\u00fcr Elementmethode {0}."}, { ER_INVALID_CONTEXT_PASSED, "Ung\u00fcltiger Kontext zur Auswertung von {0} \u00fcbergeben."}, { ER_POOL_EXISTS, "Pool ist bereits vorhanden."}, { ER_NO_DRIVER_NAME, "Kein Treibername angegeben."}, { ER_NO_URL, "Keine URL-Adresse angegeben."}, { ER_POOL_SIZE_LESSTHAN_ONE, "Poolgr\u00f6\u00dfe ist kleiner als Eins!"}, { ER_INVALID_DRIVER, "Ung\u00fcltiger Treibername angegeben!"}, { ER_NO_STYLESHEETROOT, "Root der Formatvorlage konnte nicht gefunden werden!"}, { ER_ILLEGAL_XMLSPACE_VALUE, "Ung\u00fcltiger Wert f\u00fcr xml:space"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode ist fehlgeschlagen."}, { ER_RESOURCE_COULD_NOT_LOAD, "Die Ressource [ {0} ] konnte nicht geladen werden: {1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Puffergr\u00f6\u00dfe <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "Unbekannter Fehler beim Aufrufen der Erweiterung."}, { ER_NO_NAMESPACE_DECL, "Pr\u00e4fix {0} hat keine entsprechende Namensbereichsdeklaration."}, { ER_ELEM_CONTENT_NOT_ALLOWED, "Elementinhalt nicht zul\u00e4ssig f\u00fcr lang=javaclass {0}."}, { ER_STYLESHEET_DIRECTED_TERMINATION, "Formatvorlage hat die Beendigung \u00fcbertragen."}, { ER_ONE_OR_TWO, "1 oder 2"}, { ER_TWO_OR_THREE, "2 oder 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "{0} (CLASSPATH pr\u00fcfen) konnte nicht geladen werden; es werden die Standardwerte verwendet."}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "Standardvorlagen k\u00f6nnen nicht initialisiert werden."}, { ER_RESULT_NULL, "Das Ergebnis darf nicht Null sein."}, { ER_RESULT_COULD_NOT_BE_SET, "Das Ergebnis konnte nicht festgelegt werden."}, { ER_NO_OUTPUT_SPECIFIED, "Keine Ausgabe angegeben."}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "Umsetzen in ein Ergebnis des Typs {0} ist nicht m\u00f6glich"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "Umsetzen einer Quelle des Typs {0} ist nicht m\u00f6glich"}, { ER_NULL_CONTENT_HANDLER, "Es ist keine Inhaltssteuerroutine vorhanden."}, { ER_NULL_ERROR_HANDLER, "Kein Fehlerbehandlungsprogramm vorhanden"}, { ER_CANNOT_CALL_PARSE, "Die Syntaxanalyse kann nicht aufgerufen werden, wenn ContentHandler nicht festgelegt wurde."}, { ER_NO_PARENT_FOR_FILTER, "Kein Elter f\u00fcr Filter vorhanden"}, { ER_NO_STYLESHEET_IN_MEDIA, "Keine Formatvorlage gefunden in: {0}, Datentr\u00e4ger= {1}."}, { ER_NO_STYLESHEET_PI, "Keine Verarbeitungsanweisung f\u00fcr xml-stylesheet gefunden in {0}."}, { ER_NOT_SUPPORTED, "Nicht unterst\u00fctzt: {0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "Der Wert f\u00fcr Merkmal {0} sollte eine Boolesche Instanz sein."}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "Externes Script bei {0} konnte nicht erreicht werden."}, { ER_RESOURCE_COULD_NOT_FIND, "Die Ressource [ {0} ] konnte nicht gefunden werden.\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "Ausgabemerkmal nicht erkannt: {0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "Das Erstellen der Instanz ElemLiteralResult ist fehlgeschlagen."}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "Der Wert f\u00fcr {0} sollte eine syntaktisch analysierbare Zahl sein."}, { ER_VALUE_SHOULD_EQUAL, "Der Wert f\u00fcr {0} sollte ''''yes'''' oder ''''no'''' entsprechen."}, { ER_FAILED_CALLING_METHOD, "Aufruf von Methode {0} ist fehlgeschlagen"}, { ER_FAILED_CREATING_ELEMTMPL, "Das Erstellen der Instanz ElemTemplateElement ist fehlgeschlagen."}, { ER_CHARS_NOT_ALLOWED, "Zeichen sind an dieser Stelle im Dokument nicht zul\u00e4ssig."}, { ER_ATTR_NOT_ALLOWED, "Das Attribut \"{0}\" ist im Element {1} nicht zul\u00e4ssig!"}, { ER_BAD_VALUE, "{0} ung\u00fcltiger Wert {1} "}, { ER_ATTRIB_VALUE_NOT_FOUND, "Attributwert {0} wurde nicht gefunden "}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "Attributwert {0} wurde nicht erkannt "}, { ER_NULL_URI_NAMESPACE, "Es wird versucht, ein Namensbereichspr\u00e4fix mit einer Null-URI zu erzeugen."}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "Es wird versucht, eine gr\u00f6\u00dfere Zahl als die gr\u00f6\u00dfte erweiterte Ganzzahl zu formatieren."}, { ER_CANNOT_FIND_SAX1_DRIVER, "SAX1-Treiberklasse {0} konnte nicht gefunden werden."}, { ER_SAX1_DRIVER_NOT_LOADED, "SAX1-Treiberklasse {0} gefunden, kann aber nicht geladen werden."}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "SAX1-Treiberklasse {0} geladen, kann aber nicht instanziert werden."}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1-Treiberklasse {0} implementiert nicht org.xml.sax.Parser."}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "Systemmerkmal org.xml.sax.parser ist nicht angegeben."}, { ER_PARSER_ARG_CANNOT_BE_NULL, "Parserargument darf nicht Null sein."}, { ER_FEATURE, "Feature: {0}"}, { ER_PROPERTY, "Merkmal: {0}"}, { ER_NULL_ENTITY_RESOLVER, "Es ist keine Entit\u00e4tenaufl\u00f6sungsroutine vorhanden."}, { ER_NULL_DTD_HANDLER, "Es ist keine Steuerroutine f\u00fcr Dokumenttypbeschreibungen vorhanden."}, { ER_NO_DRIVER_NAME_SPECIFIED, "Kein Treibername angegeben!"}, { ER_NO_URL_SPECIFIED, "Keine URL-Adresse angegeben!"}, { ER_POOLSIZE_LESS_THAN_ONE, "Poolgr\u00f6\u00dfe ist kleiner als 1!"}, { ER_INVALID_DRIVER_NAME, "Ung\u00fcltiger Treibername angegeben!"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "Programmierfehler! Der Ausdruck hat kein \u00fcbergeordnetes Element ElemTemplateElement!"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "Programmiererfestlegung in RedundentExprEliminator: {0}"}, { ER_NOT_ALLOWED_IN_POSITION, "{0} ist an dieser Position in der Formatvorlage nicht zul\u00e4ssig!"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "Anderer Text als Leerzeichen ist an dieser Position in der Formatvorlage nicht zul\u00e4ssig!"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "Unzul\u00e4ssiger Wert {1} f\u00fcr CHAR-Attribut verwendet: {0}. Ein Attribut des Typs CHAR darf nur ein Zeichen umfassen!"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "Unzul\u00e4ssiger Wert {1} f\u00fcr QNAME-Attribut verwendet: {0}"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "Unzul\u00e4ssiger Wert {1} f\u00fcr ENUM-Attribut verwendet: {0}. Folgende Werte sind g\u00fcltig: {2}."}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "Unzul\u00e4ssiger Wert {1} f\u00fcr NMTOKEN-Attribut verwendet: {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "Unzul\u00e4ssiger Wert {1} f\u00fcr NCNAME-Attribut verwendet: {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Unzul\u00e4ssiger Wert {1} f\u00fcr BOOLEAN-Attribut verwendet: {0}. "}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Unzul\u00e4ssiger Wert {1} f\u00fcr NUMBER-Attribut verwendet: {0}. "}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "Argument von {0} in Suchmuster muss ein Literal sein."}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "Doppelte Deklaration einer globalen Variablen."}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "Doppelte Deklaration einer Variablen."}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template muss ein Attribut 'name' und/oder 'match' haben."}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "Pr\u00e4fix in exclude-result-prefixes ist nicht g\u00fcltig: {0}."}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "Die Attributgruppe {0} ist nicht vorhanden."}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "Die Funktion {0} ist nicht vorhanden."}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "Das Element {0} darf nicht \u00fcber ein Attribut ''''content'''' und zus\u00e4tzlich \u00fcber ein Attribut ''''select'''' verf\u00fcgen."}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "Der Wert von Parameter {0} muss ein g\u00fcltiges Java-Objekt sein."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "Das Attribut result-prefix eines Elements xsl:namespace-alias hat den Wert '#default', es ist jedoch keine Deklaration des Standardnamensbereichs vorhanden, die f\u00fcr dieses Element g\u00fcltig ist."}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "Das Attribut result-prefix eines Elements xsl:namespace-alias hat den Wert ''{0}'', es ist jedoch keine Namensbereichsdeklaration f\u00fcr das Pr\u00e4fix ''{0}'' vorhanden, die f\u00fcr dieses Element g\u00fcltig ist."}, { ER_SET_FEATURE_NULL_NAME, "Der Funktionsname darf in TransformerFactory.setFeature(Name der Zeichenfolge, Boolescher Wert) nicht den Wert Null haben."}, { ER_GET_FEATURE_NULL_NAME, "Der Funktionsname darf in TransformerFactory.getFeature(Name der Zeichenfolge) nicht den Wert Null haben."}, { ER_UNSUPPORTED_FEATURE, "Die Funktion ''{0}'' kann in dieser TransformerFactory nicht festgelegt werden."}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "Die Verwendung des Erweiterungselements ''{0}'' ist nicht zul\u00e4ssig, wenn f\u00fcr die Funktion zur sicheren Verarbeitung der Wert ''true'' festgelegt wurde."}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "Das Pr\u00e4fix f\u00fcr einen Namensbereich-URI mit dem Wert Null kann nicht abgerufen werden."}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "Der Namensbereich-URI f\u00fcr ein Pr\u00e4fix mit dem Wert Null kann nicht abgerufen werden."}, { ER_XPATH_RESOLVER_NULL_QNAME, "Es muss ein Funktionsname angegeben werden."}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Die Stelligkeit darf nicht negativ sein."}, // Warnings... { WG_FOUND_CURLYBRACE, "'}' gefunden, es ist aber keine Attributvorlage ge\u00f6ffnet!"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "Warnung: Attribut ''count'' entspricht keinem \u00fcbergeordneten Fensterobjekt in xsl:number! Ziel = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "Veraltete Syntax: Der Name des Attributs 'expr' wurde in 'select' ge\u00e4ndert."}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan bearbeitet noch nicht den L\u00e4ndereinstellungsnamen in der Funktion 'format-number'."}, { WG_LOCALE_NOT_FOUND, "Warnung: L\u00e4ndereinstellung f\u00fcr xml:lang={0} konnte nicht gefunden werden."}, { WG_CANNOT_MAKE_URL_FROM, "URL konnte nicht erstellt werden aus: {0}"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "Angeforderte Dokumentation kann nicht geladen werden: {0}"}, { WG_CANNOT_FIND_COLLATOR, "Collator f\u00fcr >>>>>> Xalan-Version "}, { "version2", "<<<<<<<"}, { "yes", "ja"}, { "line", "Zeilennummer"}, { "column","Spaltennummer"}, { "xsldone", "XSLProcessor: fertig"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Optionen f\u00fcr Verarbeitungsklassen in der Xalan-J-Befehlszeile:"}, { "xslProc_option", "Optionen f\u00fcr Verarbeitungsklassen in der Xalan-J-Befehlszeile\u003a"}, { "xslProc_invalid_xsltc_option", "Die Option {0} wird im XSLTC-Modus nicht unterst\u00fctzt."}, { "xslProc_invalid_xalan_option", "Die Option {0} kann nur mit -XSLTC verwendet werden."}, { "xslProc_no_input", "Fehler: Es wurde keine Formatvorlagen- oder Eingabe-XML angegeben. F\u00fchren Sie diesen Befehl ohne Optionen f\u00fcr Syntaxanweisungen aus."}, { "xslProc_common_options", "-Allgemeine Optionen-"}, { "xslProc_xalan_options", "-Optionen f\u00fcr Xalan-"}, { "xslProc_xsltc_options", "-Optionen f\u00fcr XSLTC-"}, { "xslProc_return_to_continue", "(Dr\u00fccken Sie die Eingabetaste, um fortzufahren.)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", "[-XSLTC (XSLTC f\u00fcr Umsetzung verwenden)]"}, { "optionIN", "[-IN EingabeXMLURL]"}, { "optionXSL", "[-XSL XSLUmsetzungsURL]"}, { "optionOUT", "[-OUT AusgabeDateiName]"}, { "optionLXCIN", "[-LXCIN kompilierteDateivorlageDateiNameEin]"}, { "optionLXCOUT", "[-LXCOUT kompilierteDateivorlageDateiNameAus]"}, { "optionPARSER", "[-PARSER vollst\u00e4ndig qualifizierter Klassenname der Parser-Liaison]"}, { "optionE", "[-E (Entit\u00e4tenverweise nicht erweitern)]"}, { "optionV", "[-E (Entit\u00e4tenverweise nicht erweitern)]"}, { "optionQC", "[-QC (Unterdr\u00fcckte Musterkonfliktwarnungen)]"}, { "optionQ", "[-Q (Unterdr\u00fcckter Modus)]"}, { "optionLF", "[-LF (Nur Zeilenvorschubzeichen bei Ausgabe verwenden {Standardeinstellung ist CR/LF})]"}, { "optionCR", "[-CR (Nur Zeilenschaltung bei Ausgabe verwenden {Standardeinstellung ist CR/LF})]"}, { "optionESCAPE", "[-ESCAPE (Zeichen, die mit einem Escapezeichen angegeben werden m\u00fcssen {Standardeinstellung ist <>&\"\'\\r\\n}]"}, { "optionINDENT", "[-INDENT (Steuerung, um wie viele Leerzeichen einger\u00fcckt werden soll {Standardeinstellung ist 0})]"}, { "optionTT", "[-TT (Trace f\u00fcr Vorlagen ausf\u00fchren, wenn sie aufgerufen werden.)]"}, { "optionTG", "[-TG (Trace f\u00fcr jedes Generierungsereignis durchf\u00fchren.)]"}, { "optionTS", "[-TS (Trace f\u00fcr jedes Auswahlereignis durchf\u00fchren.)]"}, { "optionTTC", "[-TTC (Trace f\u00fcr die untergeordneten Vorlagen ausf\u00fchren, wenn sie verarbeitet werden.)]"}, { "optionTCLASS", "[-TCLASS (TraceListener-Klasse f\u00fcr Trace-Erweiterungen.)]"}, { "optionVALIDATE", "[-VALIDATE (Festlegen, ob eine G\u00fcltigkeitspr\u00fcfung erfolgen soll. Die G\u00fcltigkeitspr\u00fcfung ist standardm\u00e4\u00dfig ausgeschaltet.)]"}, { "optionEDUMP", "[-EDUMP {optionaler Dateiname} (Bei Fehler Stapelspeicherauszug erstellen.)]"}, { "optionXML", "[-XML (XML-Formatierungsprogramm verwenden und XML-Header hinzuf\u00fcgen.)]"}, { "optionTEXT", "[-TEXT (Einfaches Textformatierungsprogramm verwenden.)]"}, { "optionHTML", "[-HTML (HTML-Formatierungsprogramm verwenden.)]"}, { "optionPARAM", "[-PARAM Name Ausdruck (Festlegen eines Formatvorlagenparameters)]"}, { "noParsermsg1", "XSL-Prozess konnte nicht erfolgreich durchgef\u00fchrt werden."}, { "noParsermsg2", "** Parser konnte nicht gefunden werden **"}, { "noParsermsg3", "Bitte \u00fcberpr\u00fcfen Sie den Klassenpfad."}, { "noParsermsg4", "Wenn Sie nicht \u00fcber einen IBM XML-Parser f\u00fcr Java verf\u00fcgen, k\u00f6nnen Sie ihn herunterladen:"}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", "[-URIRESOLVER vollst\u00e4ndiger Klassenname (URIResolver wird zum Aufl\u00f6sen von URIs verwendet)]"}, { "optionENTITYRESOLVER", "[-ENTITYRESOLVER vollst\u00e4ndiger Klassenname (EntityResolver wird zum Aufl\u00f6sen von Entit\u00e4ten verwendet)]"}, { "optionCONTENTHANDLER", "[-CONTENTHANDLER vollst\u00e4ndiger Klassenname (ContentHandler wird zum Serialisieren der Ausgabe verwendet)]"}, { "optionLINENUMBERS", "[-L Zeilennummern f\u00fcr das Quellendokument verwenden]"}, { "optionSECUREPROCESSING", " [-SECURE (Funktion zur sicheren Verarbeitung auf 'True' setzen)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", "[-MEDIA Datentr\u00e4gerTyp (Datentr\u00e4gerattribut verwenden, um die einem Dokument zugeordnete Formatvorlage zu suchen.)]"}, { "optionFLAVOR", "[-FLAVOR WunschName (Explizit s2s=SAX oder d2d=DOM verwenden, um die Umsetzung auszuf\u00fchren.)] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", "[-DIAG (Gesamtanzahl Millisekunden f\u00fcr die Umsetzung ausgeben.)]"}, { "optionINCREMENTAL", "[-INCREMENTAL (Inkrementelle DTM-Erstellung mit der Einstellung 'true' f\u00fcr http://xml.apache.org/xalan/features/incremental anfordern.)]"}, { "optionNOOPTIMIMIZE", "[-NOOPTIMIMIZE (Mit der Einstellung 'false' f\u00fcr 'http://xml.apache.org/xalan/features/optimize' anfordern, dass keine Formatvorlagenoptimierung ausgef\u00fchrt wird.)]"}, { "optionRL", "[-RL Verschachtelungsbegrenzung (Numerische Begrenzung f\u00fcr Verschachtelungstiefe der Formatvorlage festlegen.)]"}, { "optionXO", "[-XO [transletName] (Namen dem generierten Translet zuordnen)]"}, { "optionXD", "[-XD ZielVerzeichnis (Ein Zielverzeichnis f\u00fcr Translet angeben)]"}, { "optionXJ", "[-XJ jardatei (Translet-Klassen in eine jar-Datei mit dem Namen packen)]"}, { "optionXP", "[-XP paket (Ein Paketnamenpr\u00e4fix f\u00fcr alle generierten Translet-Klassen angeben)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN (Inline-Anordnung f\u00fcr Vorlagen aktivieren)]" }, { "optionXX", "[-XX (Zus\u00e4tzliche Debugnachrichtenausgabe aktivieren)]"}, { "optionXT" , "[-XT (Translet f\u00fcr Umsetzung verwenden, wenn m\u00f6glich)]"}, { "diagTiming","--------- Umsetzung von {0} \u00fcber {1} betrug {2} Millisekunden" }, { "recursionTooDeep","Vorlagenverschachtelung ist zu stark. Verschachtelung = {0}, Vorlage {1} {2}" }, { "nameIs", "Der Name ist" }, { "matchPatternIs", "Das Suchmuster ist" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "FEHLERHAFTER_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FEHLGESCHLAGEN"; /** General error string. */ public static final String ERROR_STRING = "#Fehler"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "Fehler: "; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "Achtung: "; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "MUSTER "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/res/XSLTErrorResources_zh_TW.java0000644000175000017500000022056510721374032025461 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTErrorResources_zh_TW.java 468641 2006-10-28 06:54:42Z minchau $ */ package org.apache.xalan.res; import java.util.ListResourceBundle; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Set up error messages. * We build a two dimensional array of message keys and * message strings. In order to add a new message here, * you need to first add a String constant. And * you need to enter key , value pair as part of contents * Array. You also need to update MAX_CODE for error strings * and MAX_WARNING for warnings ( Needed for only information * purpose ) */ public class XSLTErrorResources_zh_TW extends ListResourceBundle { /* * This file contains error and warning messages related to Xalan Error * Handling. * * General notes to translators: * * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of * components. * XSLT is an acronym for "XML Stylesheet Language: Transformations". * XSLTC is an acronym for XSLT Compiler. * * 2) A stylesheet is a description of how to transform an input XML document * into a resultant XML document (or HTML document or text). The * stylesheet itself is described in the form of an XML document. * * 3) A template is a component of a stylesheet that is used to match a * particular portion of an input document and specifies the form of the * corresponding portion of the output document. * * 4) An element is a mark-up tag in an XML document; an attribute is a * modifier on the tag. For example, in * "elem" is an element name, "attr" and "attr2" are attribute names with * the values "val" and "val2", respectively. * * 5) A namespace declaration is a special attribute that is used to associate * a prefix with a URI (the namespace). The meanings of element names and * attribute names that use that prefix are defined with respect to that * namespace. * * 6) "Translet" is an invented term that describes the class file that * results from compiling an XML stylesheet into a Java class. * * 7) XPath is a specification that describes a notation for identifying * nodes in a tree-structured representation of an XML document. An * instance of that notation is referred to as an XPath expression. * */ /** Maximum error messages, this is needed to keep track of the number of messages. */ public static final int MAX_CODE = 201; /** Maximum warnings, this is needed to keep track of the number of warnings. */ public static final int MAX_WARNING = 29; /** Maximum misc strings. */ public static final int MAX_OTHERS = 55; /** Maximum total warnings and error messages. */ public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1; /* * Static variables */ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX"; public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT"; public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE"; public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE"; public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS"; public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD"; public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES"; public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB"; public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND"; public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT"; public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB"; public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB"; public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB"; public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB"; public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB"; public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX"; public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE"; public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC"; public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR"; public static final String ER_NULL_CHILD = "ER_NULL_CHILD"; public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB"; public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB"; public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB"; public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC"; public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON"; public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL"; public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL"; public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED"; public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER"; public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB"; public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB"; public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB"; public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB"; public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB"; public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL"; public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND"; public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION"; public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB"; public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF"; public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR"; public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB"; public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT"; public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT"; public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR"; public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR"; public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION"; public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR"; public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET"; public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET"; public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC"; public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT"; public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT"; public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB"; public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG"; public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM"; public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE"; public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION"; public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL"; public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED"; public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR"; public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET"; public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED"; public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED"; public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED"; public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB"; public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM"; public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE"; public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN"; public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE"; public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE"; public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE"; public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX"; public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM"; public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF"; public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL"; public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL"; public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION"; public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR"; public static final String ER_CURRENCY_SIGN_ILLEGAL= "ER_CURRENCY_SIGN_ILLEGAL"; public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM"; public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER"; public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME"; public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT"; public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX"; public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI"; public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION"; public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION"; public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING"; public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE"; public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN"; public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH"; public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT"; public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT"; public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED"; public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE"; public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE"; public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF"; public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM"; public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS"; public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT"; public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE"; public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL"; public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF"; public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT"; public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION"; public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND"; public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL"; public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL"; public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL"; public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL"; public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR"; public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN"; public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN"; public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES"; public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME"; public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC"; public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN"; public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR"; public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD"; public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT"; public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED"; public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS"; public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME"; public static final String ER_NO_URL = "ER_NO_URL"; public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE"; public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER"; public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT"; public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE"; public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED"; public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD"; public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO"; public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION"; public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL"; public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED"; public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION"; public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO"; public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE"; public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE"; public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES"; public static final String ER_RESULT_NULL = "ER_RESULT_NULL"; public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET"; public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED"; public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE"; public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE"; public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER"; public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER"; public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE"; public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER"; public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA"; public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI"; public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED"; public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN"; public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT"; public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND"; public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED"; public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT"; public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER"; public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL"; public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD"; public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL"; public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED"; public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED"; public static final String ER_BAD_VALUE = "ER_BAD_VALUE"; public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND"; public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED"; public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE"; public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG"; public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER"; public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED"; public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED" ; public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER"; public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED"; public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL" ; public static final String ER_FEATURE = "ER_FEATURE"; public static final String ER_PROPERTY = "ER_PROPERTY" ; public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER"; public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ; public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED"; public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED"; public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE"; public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME"; public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER"; public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT"; public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR"; public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION"; public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION"; public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE"; public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX"; public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME"; public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY"; public static final String INVALID_TCHAR = "INVALID_TCHAR"; public static final String INVALID_QNAME = "INVALID_QNAME"; public static final String INVALID_ENUM = "INVALID_ENUM"; public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN"; public static final String INVALID_NCNAME = "INVALID_NCNAME"; public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN"; public static final String INVALID_NUMBER = "INVALID_NUMBER"; public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL"; public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR"; public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR"; public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH"; public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX"; public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET"; public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND"; public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT"; public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE"; public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME"; public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME"; public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE"; public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING"; public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE"; public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR"; public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT"; public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER"; public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND"; public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM"; public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC"; public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR"; public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8"; public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA"; public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS"; public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING"; public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE"; public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP"; public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED"; public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION"; public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS"; public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED"; public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE"; public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE"; public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX"; public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB"; public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME"; public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE"; public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG"; public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML"; public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME"; public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION"; public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR"; /* * Now fill in the message text. * Then fill in the message text for that message code in the * array. Use the new error code as the index into the array. */ // Error messages... /** Get the lookup table for error messages. * * @return The message lookup table. */ public Object[][] getContents() { return new Object[][] { /** Error message ID that has a null message, but takes in a single object. */ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, "\u932f\u8aa4\uff1a\u8868\u793a\u5f0f\u5167\u4e0d\u80fd\u6709 '{'"}, { ER_ILLEGAL_ATTRIBUTE , "{0} \u542b\u6709\u4e0d\u5408\u6cd5\u7684\u5c6c\u6027\uff1a{1}"}, {ER_NULL_SOURCENODE_APPLYIMPORTS , "\u5728 xsl:apply-imports \u4e2d\uff0csourceNode \u662f\u7a7a\u503c\uff01"}, {ER_CANNOT_ADD, "\u4e0d\u80fd\u65b0\u589e {0} \u5230 {1}"}, { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES, "\u5728 handleApplyTemplatesInstruction \u4e2d\uff0csourceNode \u662f\u7a7a\u503c\uff01"}, { ER_NO_NAME_ATTRIB, "{0} \u5fc5\u9808\u6709\u540d\u7a31\u5c6c\u6027\u3002"}, {ER_TEMPLATE_NOT_FOUND, "\u627e\u4e0d\u5230\u6307\u540d\u70ba\uff1a{0} \u7684\u7bc4\u672c"}, {ER_CANT_RESOLVE_NAME_AVT, "\u7121\u6cd5\u89e3\u6790 xsl:call-template \u4e2d\u7684\u540d\u7a31 AVT\u3002"}, {ER_REQUIRES_ATTRIB, "{0} \u9700\u8981\u5c6c\u6027\uff1a{1}"}, { ER_MUST_HAVE_TEST_ATTRIB, "{0} \u5fc5\u9808\u6709 ''test'' \u5c6c\u6027\u3002"}, {ER_BAD_VAL_ON_LEVEL_ATTRIB, "\u5c64\u6b21\u5c6c\u6027\uff1a{0} \u5305\u542b\u4e0d\u6b63\u78ba\u7684\u503c"}, {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML, "processing-instruction \u540d\u7a31\u4e0d\u80fd\u662f 'xml'"}, { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, "processing-instruction \u540d\u7a31\u5fc5\u9808\u662f\u6709\u6548\u7684 NCName\uff1a{0}"}, { ER_NEED_MATCH_ATTRIB, "{0} \u5982\u679c\u6709\u6a21\u5f0f\uff0c\u5fc5\u9808\u6709\u7b26\u5408\u5c6c\u6027\u3002"}, { ER_NEED_NAME_OR_MATCH_ATTRIB, "{0} \u9700\u8981\u540d\u7a31\u6216\u7b26\u5408\u5c6c\u6027\u3002"}, {ER_CANT_RESOLVE_NSPREFIX, "\u7121\u6cd5\u89e3\u6790\u540d\u7a31\u7a7a\u9593\u5b57\u9996\uff1a{0}"}, { ER_ILLEGAL_VALUE, "xml:space \u542b\u6709\u4e0d\u5408\u6cd5\u7684\u503c\uff1a{0}"}, { ER_NO_OWNERDOC, "\u5b50\u7bc0\u9ede\u6c92\u6709\u64c1\u6709\u8005\u6587\u4ef6\uff01"}, { ER_ELEMTEMPLATEELEM_ERR, "ElemTemplateElement \u932f\u8aa4\uff1a{0}"}, { ER_NULL_CHILD, "\u5617\u8a66\u65b0\u589e\u7a7a\u503c\u5b50\u9805\u5143\u4ef6\uff01"}, { ER_NEED_SELECT_ATTRIB, "{0} \u9700\u8981\u9078\u53d6\u5c6c\u6027\u3002"}, { ER_NEED_TEST_ATTRIB , "xsl:when \u5fc5\u9808\u6709 'test' \u5c6c\u6027\u3002"}, { ER_NEED_NAME_ATTRIB, "xsl:with-param \u5fc5\u9808\u6709 'name' \u5c6c\u6027\u3002"}, { ER_NO_CONTEXT_OWNERDOC, "\u74b0\u5883\u5b9a\u7fa9\u6c92\u6709\u64c1\u6709\u8005\u6587\u4ef6\uff01"}, {ER_COULD_NOT_CREATE_XML_PROC_LIAISON, "\u7121\u6cd5\u5efa\u7acb XML TransformerFactory Liaison\uff1a{0}"}, {ER_PROCESS_NOT_SUCCESSFUL, "Xalan: \u7a0b\u5e8f\u6c92\u6709\u9806\u5229\u5b8c\u6210\u3002"}, { ER_NOT_SUCCESSFUL, "Xalan: \u4e0d\u6210\u529f\u3002"}, { ER_ENCODING_NOT_SUPPORTED, "\u4e0d\u652f\u63f4\u7de8\u78bc\uff1a{0}"}, {ER_COULD_NOT_CREATE_TRACELISTENER, "\u7121\u6cd5\u5efa\u7acb TraceListener\uff1a{0}"}, {ER_KEY_REQUIRES_NAME_ATTRIB, "xsl:key \u9700\u8981 'name' \u5c6c\u6027\uff01"}, { ER_KEY_REQUIRES_MATCH_ATTRIB, "xsl:key \u9700\u8981 'match' \u5c6c\u6027\uff01"}, { ER_KEY_REQUIRES_USE_ATTRIB, "xsl:key \u9700\u8981 'use' \u5c6c\u6027\uff01"}, { ER_REQUIRES_ELEMENTS_ATTRIB, "(StylesheetHandler) {0} \u9700\u8981 ''elements'' \u5c6c\u6027\uff01"}, { ER_MISSING_PREFIX_ATTRIB, "(StylesheetHandler) {0} \u5c6c\u6027 ''prefix'' \u907a\u6f0f"}, { ER_BAD_STYLESHEET_URL, "\u6a23\u5f0f\u8868 URL \u4e0d\u6b63\u78ba\uff1a{0}"}, { ER_FILE_NOT_FOUND, "\u627e\u4e0d\u5230\u6a23\u5f0f\u8868\u6a94\u6848\uff1a{0}"}, { ER_IOEXCEPTION, "\u6a23\u5f0f\u8868\u6a94\u6848\uff1a{0} \u767c\u751f IO \u7570\u5e38"}, { ER_NO_HREF_ATTRIB, "(StylesheetHandler) \u627e\u4e0d\u5230 {0} \u7684 href \u5c6c\u6027"}, { ER_STYLESHEET_INCLUDES_ITSELF, "(StylesheetHandler) {0} \u76f4\u63a5\u6216\u9593\u63a5\u5305\u542b\u81ea\u5df1\uff01"}, { ER_PROCESSINCLUDE_ERROR, "StylesheetHandler.processInclude \u932f\u8aa4\uff0c{0}"}, { ER_MISSING_LANG_ATTRIB, "(StylesheetHandler) {0} \u5c6c\u6027 ''lang'' \u907a\u6f0f"}, { ER_MISSING_CONTAINER_ELEMENT_COMPONENT, "(StylesheetHandler) \u653e\u7f6e\u932f\u8aa4\u7684 {0} \u5143\u7d20\uff1f\uff1f\u907a\u6f0f\u5132\u5b58\u5668\u5143\u7d20 ''component''"}, { ER_CAN_ONLY_OUTPUT_TO_ELEMENT, "\u53ea\u80fd\u8f38\u51fa\u81f3 Element\u3001DocumentFragment\u3001Document \u6216 PrintWriter\u3002"}, { ER_PROCESS_ERROR, "StylesheetRoot.process \u932f\u8aa4"}, { ER_UNIMPLNODE_ERROR, "UnImplNode \u932f\u8aa4\uff1a{0}"}, { ER_NO_SELECT_EXPRESSION, "\u932f\u8aa4\uff01\u6c92\u6709\u627e\u5230 xpath select \u8868\u793a\u5f0f (-select)\u3002"}, { ER_CANNOT_SERIALIZE_XSLPROCESSOR, "\u7121\u6cd5\u5e8f\u5217\u5316 XSLProcessor\uff01"}, { ER_NO_INPUT_STYLESHEET, "\u6c92\u6709\u6307\u5b9a\u6a23\u5f0f\u8868\u8f38\u5165\uff01"}, { ER_FAILED_PROCESS_STYLESHEET, "\u7121\u6cd5\u8655\u7406\u6a23\u5f0f\u8868\uff01"}, { ER_COULDNT_PARSE_DOC, "\u7121\u6cd5\u5256\u6790 {0} \u6587\u4ef6\uff01"}, { ER_COULDNT_FIND_FRAGMENT, "\u627e\u4e0d\u5230\u7247\u6bb5\uff1a{0}"}, { ER_NODE_NOT_ELEMENT, "\u7247\u6bb5 ID \u6240\u6307\u5411\u7684\u7bc0\u9ede\u4e0d\u662f\u5143\u7d20\uff1a{0}"}, { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB, "for-each \u5fc5\u9808\u6709 match \u6216 name \u5c6c\u6027"}, { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB, "templates \u5fc5\u9808\u6709 match \u6216 name \u5c6c\u6027"}, { ER_NO_CLONE_OF_DOCUMENT_FRAG, "\u6587\u4ef6\u7247\u6bb5\u6c92\u6709\u8907\u88fd\uff01"}, { ER_CANT_CREATE_ITEM, "\u7121\u6cd5\u5728\u7d50\u679c\u6a39\uff1a{0} \u4e2d\u5efa\u7acb\u9805\u76ee"}, { ER_XMLSPACE_ILLEGAL_VALUE, "\u539f\u59cb\u6a94 XML \u4e2d\u7684 xml:space \u542b\u6709\u4e0d\u5408\u6cd5\u7684\u503c\uff1a{0}"}, { ER_NO_XSLKEY_DECLARATION, "{0} \u6c92\u6709 xsl:key \u5ba3\u544a\uff01"}, { ER_CANT_CREATE_URL, "\u932f\u8aa4\uff01\u7121\u6cd5\u91dd\u5c0d\uff1a{0} \u5efa\u7acb URL"}, { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions \u4e0d\u53d7\u652f\u63f4"}, { ER_PROCESSOR_ERROR, "XSLT TransformerFactory \u932f\u8aa4"}, { ER_NOT_ALLOWED_INSIDE_STYLESHEET, "(StylesheetHandler) {0} \u4e0d\u5141\u8a31\u5728\u6a23\u5f0f\u8868\u5167\uff01"}, { ER_RESULTNS_NOT_SUPPORTED, "result-ns \u4e0d\u518d\u53d7\u652f\u63f4\uff01\u8acb\u6539\u7528 xsl:output\u3002"}, { ER_DEFAULTSPACE_NOT_SUPPORTED, "default-space \u4e0d\u518d\u53d7\u652f\u63f4\uff01\u8acb\u6539\u7528 xsl:strip-space \u6216 xsl:preserve-space\u3002"}, { ER_INDENTRESULT_NOT_SUPPORTED, "indent-result \u4e0d\u518d\u53d7\u652f\u63f4\uff01\u8acb\u6539\u7528 xsl:output\u3002"}, { ER_ILLEGAL_ATTRIB, "(StylesheetHandler) {0} \u542b\u6709\u4e0d\u5408\u6cd5\u7684\u5c6c\u6027\uff1a{1}"}, { ER_UNKNOWN_XSL_ELEM, "\u4e0d\u660e XSL \u5143\u7d20\uff1a{0}"}, { ER_BAD_XSLSORT_USE, "(StylesheetHandler) xsl:sort \u53ea\u80fd\u548c xsl:apply-templates \u6216 xsl:for-each \u4e00\u8d77\u4f7f\u7528\u3002"}, { ER_MISPLACED_XSLWHEN, "(StylesheetHandler) \u653e\u7f6e\u932f\u8aa4\u7684 xsl:when\uff01"}, { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:when \u7684\u6bcd\u9805\u4e0d\u662f xsl:choose\uff01"}, { ER_MISPLACED_XSLOTHERWISE, "(StylesheetHandler) \u653e\u7f6e\u932f\u8aa4\u7684 xsl:otherwise\uff01"}, { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE, "(StylesheetHandler) xsl:otherwise \u7684\u6bcd\u9805\u4e0d\u662f xsl:choose\uff01"}, { ER_NOT_ALLOWED_INSIDE_TEMPLATE, "\u5728\u7bc4\u672c\u5167\u4e0d\u5141\u8a31 (StylesheetHandler) {0}\uff01"}, { ER_UNKNOWN_EXT_NS_PREFIX, "(StylesheetHandler) {0} \u5ef6\u4f38\u9805\u76ee\u540d\u7a31\u7a7a\u9593\u5b57\u9996 {1} \u4e0d\u660e"}, { ER_IMPORTS_AS_FIRST_ELEM, "(StylesheetHandler) Imports \u53ea\u80fd\u51fa\u73fe\u5728\u6a23\u5f0f\u8868\u4e2d\u4f5c\u70ba\u7b2c\u4e00\u500b\u5143\u7d20\uff01"}, { ER_IMPORTING_ITSELF, "(StylesheetHandler) {0} \u6b63\u5728\u76f4\u63a5\u6216\u9593\u63a5\u532f\u5165\u81ea\u5df1\uff01"}, { ER_XMLSPACE_ILLEGAL_VAL, "(StylesheetHandler) xml:space \u6709\u4e0d\u5408\u6cd5\u7684\u503c\uff1a{0}"}, { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL, "processStylesheet \u4e0d\u6210\u529f\uff01"}, { ER_SAX_EXCEPTION, "SAX \u7570\u5e38"}, // add this message to fix bug 21478 { ER_FUNCTION_NOT_SUPPORTED, "\u51fd\u6578\u4e0d\u53d7\u652f\u63f4\uff01"}, { ER_XSLT_ERROR, "XSLT \u932f\u8aa4"}, { ER_CURRENCY_SIGN_ILLEGAL, "\u5728\u683c\u5f0f\u578b\u6a23\u5b57\u4e32\u4e2d\u4e0d\u5141\u8a31\u8ca8\u5e63\u7b26\u865f"}, { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM, "\u5728\u6a23\u5f0f\u8868 DOM \u4e2d\u4e0d\u652f\u63f4\u6587\u4ef6\u51fd\u6578\uff01"}, { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER, "\u7121\u6cd5\u89e3\u6790\u975e\u5b57\u9996\u89e3\u6790\u5668\u7684\u5b57\u9996\uff01"}, { ER_REDIRECT_COULDNT_GET_FILENAME, "\u91cd\u65b0\u5c0e\u5411\u5ef6\u4f38\u9805\u76ee\uff1a\u7121\u6cd5\u53d6\u5f97\u6a94\u6848\u540d\u7a31 - file \u6216 select \u5c6c\u6027\u5fc5\u9808\u50b3\u56de\u6709\u6548\u5b57\u4e32\u3002"}, { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT, "\u7121\u6cd5\u5728\u91cd\u65b0\u5c0e\u5411\u5ef6\u4f38\u9805\u76ee\u4e2d\u5efa\u7acb FormatterListener\uff01"}, { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX, "exclude-result-prefixes \u4e2d\u7684\u5b57\u9996\u7121\u6548\uff1a{0}"}, { ER_MISSING_NS_URI, "\u907a\u6f0f\u6307\u5b9a\u7684\u5b57\u9996\u7684\u540d\u7a31\u7a7a\u9593 URI"}, { ER_MISSING_ARG_FOR_OPTION, "\u907a\u6f0f\u9078\u9805\uff1a{0} \u7684\u5f15\u6578"}, { ER_INVALID_OPTION, "\u9078\u9805\uff1a{0} \u7121\u6548"}, { ER_MALFORMED_FORMAT_STRING, "\u4e0d\u6b63\u78ba\u7684\u683c\u5f0f\u5b57\u4e32\uff1a{0}"}, { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB, "xsl:stylesheet \u9700\u8981 'version' \u5c6c\u6027\uff01"}, { ER_ILLEGAL_ATTRIBUTE_VALUE, "\u5c6c\u6027\uff1a{0} \u542b\u6709\u4e0d\u5408\u6cd5\u7684\u503c\uff1a{1}"}, { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose \u9700\u8981\u6709 xsl:when"}, { ER_NO_APPLY_IMPORT_IN_FOR_EACH, "xsl:apply-imports \u4e0d\u5bb9\u8a31\u51fa\u73fe\u5728 xsl:for-each \u4e2d"}, { ER_CANT_USE_DTM_FOR_OUTPUT, "\u7121\u6cd5\u4f7f\u7528\u8f38\u51fa DOM \u7bc0\u9ede\u7684 DTMLiaison ... \u6539\u50b3\u905e org.apache.xpath.DOM2Helper\uff01"}, { ER_CANT_USE_DTM_FOR_INPUT, "\u7121\u6cd5\u4f7f\u7528\u8f38\u5165 DOM \u7bc0\u9ede\u7684 DTMLiaison ... \u6539\u50b3\u905e org.apache.xpath.DOM2Helper\uff01"}, { ER_CALL_TO_EXT_FAILED, "\u547c\u53eb\u5ef6\u4f38\u9805\u76ee\u5143\u7d20\u5931\u6557\uff1a{0}"}, { ER_PREFIX_MUST_RESOLVE, "\u5b57\u9996\u5fc5\u9808\u89e3\u6790\u70ba\u540d\u7a31\u7a7a\u9593\uff1a{0}"}, { ER_INVALID_UTF16_SURROGATE, "\u5075\u6e2c\u5230\u7121\u6548\u7684 UTF-16 \u4ee3\u7406\uff1a{0}?"}, { ER_XSLATTRSET_USED_ITSELF, "xsl:attribute-set {0} \u81ea\u6211\u4f7f\u7528\uff0c\u5c07\u9020\u6210\u7121\u9650\u8ff4\u5708\u3002"}, { ER_CANNOT_MIX_XERCESDOM, "\u7121\u6cd5\u6df7\u5408\u975e Xerces-DOM \u8f38\u5165\u8207 Xerces-DOM \u8f38\u51fa\uff01"}, { ER_TOO_MANY_LISTENERS, "addTraceListenersToStylesheet - TooManyListenersException"}, { ER_IN_ELEMTEMPLATEELEM_READOBJECT, "\u4f4d\u65bc ElemTemplateElement.readObject\uff1a{0}"}, { ER_DUPLICATE_NAMED_TEMPLATE, "\u627e\u5230\u4e0d\u6b62\u4e00\u500b\u540d\u7a31\u70ba\uff1a{0} \u7684\u7bc4\u672c"}, { ER_INVALID_KEY_CALL, "\u7121\u6548\u7684\u51fd\u6578\u547c\u53eb\uff1a\u4e0d\u5141\u8a31 recursive key() \u547c\u53eb"}, { ER_REFERENCING_ITSELF, "\u8b8a\u6578 {0} \u76f4\u63a5\u6216\u9593\u63a5\u53c3\u7167\u81ea\u5df1\uff01"}, { ER_ILLEGAL_DOMSOURCE_INPUT, "\u5c0d newTemplates \u7684 DOMSource \u800c\u8a00\uff0c\u8f38\u5165\u7bc0\u9ede\u4e0d\u53ef\u70ba\u7a7a\u503c\uff01"}, { ER_CLASS_NOT_FOUND_FOR_OPTION, "\u627e\u4e0d\u5230\u9078\u9805 {0} \u7684\u985e\u5225\u6a94\u6848"}, { ER_REQUIRED_ELEM_NOT_FOUND, "\u627e\u4e0d\u5230\u5fc5\u8981\u7684\u5143\u7d20\uff1a{0}"}, { ER_INPUT_CANNOT_BE_NULL, "InputStream \u4e0d\u53ef\u70ba\u7a7a\u503c"}, { ER_URI_CANNOT_BE_NULL, "URI \u4e0d\u53ef\u70ba\u7a7a\u503c"}, { ER_FILE_CANNOT_BE_NULL, "\u6a94\u6848\u4e0d\u53ef\u70ba\u7a7a\u503c"}, { ER_SOURCE_CANNOT_BE_NULL, "InputSource \u4e0d\u53ef\u70ba\u7a7a\u503c"}, { ER_CANNOT_INIT_BSFMGR, "\u7121\u6cd5\u8d77\u59cb\u8a2d\u5b9a BSF \u7ba1\u7406\u7a0b\u5f0f"}, { ER_CANNOT_CMPL_EXTENSN, "\u7121\u6cd5\u7de8\u8b6f\u5ef6\u4f38\u9805\u76ee"}, { ER_CANNOT_CREATE_EXTENSN, "\u7121\u6cd5\u5efa\u7acb\u5ef6\u4f38\u9805\u76ee\uff1a{0} \u56e0\u70ba\uff1a{1}"}, { ER_INSTANCE_MTHD_CALL_REQUIRES, "\u547c\u53eb\u65b9\u6cd5 {0} \u7684\u5be6\u4f8b\u65b9\u6cd5\u9700\u8981\u7269\u4ef6\u5be6\u4f8b\u4f5c\u70ba\u7b2c\u4e00\u500b\u5f15\u6578"}, { ER_INVALID_ELEMENT_NAME, "\u6307\u5b9a\u7121\u6548\u7684\u5143\u7d20\u540d\u7a31 {0}"}, { ER_ELEMENT_NAME_METHOD_STATIC, "\u5143\u7d20\u540d\u7a31\u65b9\u6cd5\u5fc5\u9808\u662f\u975c\u614b {0}"}, { ER_EXTENSION_FUNC_UNKNOWN, "\u5ef6\u4f38\u9805\u76ee\u51fd\u6578 {0} \uff1a {1} \u4e0d\u660e"}, { ER_MORE_MATCH_CONSTRUCTOR, "{0} \u7684\u6700\u7b26\u5408\u5efa\u69cb\u5143\u4e0d\u6b62\u4e00\u500b"}, { ER_MORE_MATCH_METHOD, "\u65b9\u6cd5 {0} \u7684\u6700\u7b26\u5408\u5efa\u69cb\u5143\u4e0d\u6b62\u4e00\u500b"}, { ER_MORE_MATCH_ELEMENT, "\u5143\u7d20\u65b9\u6cd5 {0} \u7684\u6700\u7b26\u5408\u5efa\u69cb\u5143\u4e0d\u6b62\u4e00\u500b"}, { ER_INVALID_CONTEXT_PASSED, "\u50b3\u905e\u5230\u8a55\u4f30 {0} \u7684\u74b0\u5883\u5b9a\u7fa9\u7121\u6548"}, { ER_POOL_EXISTS, "\u5132\u5b58\u6c60\u5df2\u5b58\u5728"}, { ER_NO_DRIVER_NAME, "\u672a\u6307\u5b9a\u9a45\u52d5\u7a0b\u5f0f\u540d\u7a31"}, { ER_NO_URL, "\u672a\u6307\u5b9a URL"}, { ER_POOL_SIZE_LESSTHAN_ONE, "\u5132\u5b58\u6c60\u5927\u5c0f\u5c0f\u65bc 1\uff01"}, { ER_INVALID_DRIVER, "\u6307\u5b9a\u7684\u9a45\u52d5\u7a0b\u5f0f\u540d\u7a31\u7121\u6548\uff01"}, { ER_NO_STYLESHEETROOT, "\u627e\u4e0d\u5230\u6a23\u5f0f\u8868\u6839\u76ee\u9304\uff01"}, { ER_ILLEGAL_XMLSPACE_VALUE, "xml:space \u7684\u503c\u4e0d\u5408\u6cd5"}, { ER_PROCESSFROMNODE_FAILED, "processFromNode \u5931\u6557"}, { ER_RESOURCE_COULD_NOT_LOAD, "\u7121\u6cd5\u8f09\u5165\u8cc7\u6e90 [ {0} ]\uff1a{1} \n {2} \t {3}"}, { ER_BUFFER_SIZE_LESSTHAN_ZERO, "\u7de9\u885d\u5340\u5927\u5c0f <=0"}, { ER_UNKNOWN_ERROR_CALLING_EXTENSION, "\u547c\u53eb\u5ef6\u4f38\u9805\u76ee\u6642\u767c\u751f\u4e0d\u660e\u932f\u8aa4"}, { ER_NO_NAMESPACE_DECL, "\u5b57\u9996 {0} \u6c92\u6709\u5c0d\u61c9\u7684\u540d\u7a31\u7a7a\u9593\u5ba3\u544a"}, { ER_ELEM_CONTENT_NOT_ALLOWED, "lang=javaclass {0} \u4e0d\u5141\u8a31\u5143\u7d20\u5167\u5bb9"}, { ER_STYLESHEET_DIRECTED_TERMINATION, "\u6a23\u5f0f\u8868\u5c0e\u5411\u7d42\u6b62"}, { ER_ONE_OR_TWO, "1 \u6216 2"}, { ER_TWO_OR_THREE, "2 \u6216 3"}, { ER_COULD_NOT_LOAD_RESOURCE, "\u7121\u6cd5\u8f09\u5165 {0}\uff08\u6aa2\u67e5 CLASSPATH\uff09\uff0c\u73fe\u5728\u53ea\u4f7f\u7528\u9810\u8a2d\u503c"}, { ER_CANNOT_INIT_DEFAULT_TEMPLATES, "\u7121\u6cd5\u8d77\u59cb\u8a2d\u5b9a\u9810\u8a2d\u7bc4\u672c"}, { ER_RESULT_NULL, "\u7d50\u679c\u4e0d\u61c9\u70ba\u7a7a\u503c"}, { ER_RESULT_COULD_NOT_BE_SET, "\u7121\u6cd5\u8a2d\u5b9a\u7d50\u679c"}, { ER_NO_OUTPUT_SPECIFIED, "\u6c92\u6709\u6307\u5b9a\u8f38\u51fa"}, { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, "\u7121\u6cd5\u8f49\u63db\u6210\u985e\u578b {0} \u7684\u7d50\u679c"}, { ER_CANNOT_TRANSFORM_SOURCE_TYPE, "\u7121\u6cd5\u8f49\u63db\u985e\u578b {0} \u7684\u539f\u59cb\u6a94"}, { ER_NULL_CONTENT_HANDLER, "\u7a7a\u503c\u5167\u5bb9\u8655\u7406\u7a0b\u5f0f"}, { ER_NULL_ERROR_HANDLER, "\u7a7a\u503c\u932f\u8aa4\u8655\u7406\u7a0b\u5f0f"}, { ER_CANNOT_CALL_PARSE, "\u5982\u679c\u672a\u8a2d\u5b9a ContentHandler \u5247\u7121\u6cd5\u547c\u53eb parse"}, { ER_NO_PARENT_FOR_FILTER, "\u904e\u6ffe\u5668\u6c92\u6709\u6bcd\u9805"}, { ER_NO_STYLESHEET_IN_MEDIA, "\u5728\uff1a{0}\uff0cmedia= {1} \u4e2d\u6c92\u6709\u6a23\u5f0f\u8868"}, { ER_NO_STYLESHEET_PI, "\u5728\uff1a{0} \u4e2d\u627e\u4e0d\u5230 xml-stylesheet PI"}, { ER_NOT_SUPPORTED, "\u4e0d\u652f\u63f4\uff1a{0}"}, { ER_PROPERTY_VALUE_BOOLEAN, "\u5167\u5bb9 {0} \u7684\u503c\u61c9\u70ba Boolean \u5be6\u4f8b"}, { ER_COULD_NOT_FIND_EXTERN_SCRIPT, "\u7121\u6cd5\u5728 {0} \u53d6\u5f97\u5916\u90e8 Script"}, { ER_RESOURCE_COULD_NOT_FIND, "\u627e\u4e0d\u5230\u8cc7\u6e90 [ {0} ]\u3002\n {1}"}, { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, "\u672a\u80fd\u8fa8\u8b58\u8f38\u51fa\u5167\u5bb9\uff1a{0}"}, { ER_FAILED_CREATING_ELEMLITRSLT, "\u5efa\u7acb ElemLiteralResult \u5be6\u4f8b\u5931\u6557"}, //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc. //NOTE: Not only the key name but message has also been changed. { ER_VALUE_SHOULD_BE_NUMBER, "{0} \u7684\u503c\u61c9\u8a72\u5305\u542b\u53ef\u5256\u6790\u7684\u6578\u5b57"}, { ER_VALUE_SHOULD_EQUAL, "{0} \u7684\u503c\u61c9\u7b49\u65bc yes \u6216 no"}, { ER_FAILED_CALLING_METHOD, "\u547c\u53eb {0} \u65b9\u6cd5\u5931\u6557"}, { ER_FAILED_CREATING_ELEMTMPL, "\u5efa\u7acb ElemTemplateElement \u5be6\u4f8b\u5931\u6557"}, { ER_CHARS_NOT_ALLOWED, "\u6587\u4ef6\u6b64\u9ede\u4e0d\u5141\u8a31\u5b57\u5143"}, { ER_ATTR_NOT_ALLOWED, "\"{0}\" \u5c6c\u6027\u5728 {1} \u5143\u7d20\u4e0a\u4e0d\u5141\u8a31\uff01"}, { ER_BAD_VALUE, "{0} \u4e0d\u6b63\u78ba\u7684\u503c {1}"}, { ER_ATTRIB_VALUE_NOT_FOUND, "\u627e\u4e0d\u5230 {0} \u5c6c\u6027\u503c"}, { ER_ATTRIB_VALUE_NOT_RECOGNIZED, "\u4e0d\u80fd\u8fa8\u8b58 {0} \u5c6c\u6027\u503c"}, { ER_NULL_URI_NAMESPACE, "\u5617\u8a66\u7528\u7a7a\u503c URI \u7522\u751f\u540d\u7a31\u7a7a\u9593\u5b57\u9996"}, //New ERROR keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11) { ER_NUMBER_TOO_BIG, "\u5617\u8a66\u683c\u5f0f\u5316\u5927\u65bc\u6700\u5927\u9577\u6574\u6578 (Long integer) \u7684\u6578\u5b57"}, { ER_CANNOT_FIND_SAX1_DRIVER, "\u627e\u4e0d\u5230 SAX1 \u9a45\u52d5\u7a0b\u5f0f\u985e\u5225 {0}"}, { ER_SAX1_DRIVER_NOT_LOADED, "\u627e\u5230 SAX1 \u9a45\u52d5\u7a0b\u5f0f\u985e\u5225 {0}\uff0c\u4f46\u7121\u6cd5\u8f09\u5165"}, { ER_SAX1_DRIVER_NOT_INSTANTIATED, "\u5df2\u8f09\u5165 SAX1 \u9a45\u52d5\u7a0b\u5f0f\u985e\u5225 {0}\uff0c\u4f46\u7121\u6cd5\u5be6\u4f8b\u5316"}, { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER, "SAX1 \u9a45\u52d5\u7a0b\u5f0f\u985e\u5225 {0} \u4e0d\u80fd\u5728 org.xml.sax.Parser \u5be6\u4f5c"}, { ER_PARSER_PROPERTY_NOT_SPECIFIED, "\u7121\u6cd5\u6307\u5b9a\u7cfb\u7d71\u5167\u5bb9 org.xml.sax.parser"}, { ER_PARSER_ARG_CANNOT_BE_NULL, "\u5256\u6790\u5668\u5f15\u6578\u4e0d\u53ef\u70ba\u7a7a\u503c"}, { ER_FEATURE, "\u529f\u80fd\uff1a{0}"}, { ER_PROPERTY, "\u5167\u5bb9\uff1a{0}"}, { ER_NULL_ENTITY_RESOLVER, "\u7a7a\u503c\u5be6\u9ad4\u89e3\u6790\u5668"}, { ER_NULL_DTD_HANDLER, "\u7a7a\u503c DTD \u8655\u7406\u7a0b\u5f0f"}, { ER_NO_DRIVER_NAME_SPECIFIED, "\u672a\u6307\u5b9a\u9a45\u52d5\u7a0b\u5f0f\u540d\u7a31\uff01"}, { ER_NO_URL_SPECIFIED, "\u672a\u6307\u5b9a URL\uff01"}, { ER_POOLSIZE_LESS_THAN_ONE, "\u5132\u5b58\u6c60\u5c0f\u65bc 1\uff01"}, { ER_INVALID_DRIVER_NAME, "\u6307\u5b9a\u7684\u9a45\u52d5\u7a0b\u5f0f\u540d\u7a31\u7121\u6548\uff01"}, { ER_ERRORLISTENER, "ErrorListener"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The name // 'ElemTemplateElement' is the name of a class, and should not be // translated. { ER_ASSERT_NO_TEMPLATE_PARENT, "\u7a0b\u5f0f\u8a2d\u8a08\u5e2b\u7684\u932f\u8aa4\uff01\u8868\u793a\u5f0f\u6c92\u6709 ElemTemplateElement \u6bcd\u9805\uff01"}, // Note to translators: The following message should not normally be displayed // to users. It describes a situation in which the processor has detected // an internal consistency problem in itself, and it provides this message // for the developer to help diagnose the problem. The substitution text // provides further information in order to diagnose the problem. The name // 'RedundentExprEliminator' is the name of a class, and should not be // translated. { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, "\u7a0b\u5f0f\u8a2d\u8a08\u5e2b\u5728 RedundentExprEliminator \u4e2d\u7684\u78ba\u8a8d\uff1a{0}"}, { ER_NOT_ALLOWED_IN_POSITION, "\u5728\u6b64\u6a23\u5f0f\u8868\u4e2d\uff0c\u6b64\u4f4d\u7f6e\u4e0d\u53ef\u4ee5\u662f {0}\u3002"}, { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, "\u5728\u6b64\u6a23\u5f0f\u8868\u4e2d\uff0c\u6b64\u4f4d\u7f6e\u4e0d\u53ef\u4ee5\u662f\u975e\u7a7a\u767d\u5b57\u5143\uff01"}, // This code is shared with warning codes. // SystemId Unknown { INVALID_TCHAR, "CHAR \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5\u3002CHAR \u985e\u578b\u7684\u5c6c\u6027\u53ea\u80fd\u6709\u4e00\u500b\u5b57\u5143\uff01"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. //The following codes are shared with the warning codes... { INVALID_QNAME, "QNAME \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of // the attribute, and should not be translated. The substitution text {1} is // the attribute value, {0} is the attribute name, and {2} is a list of valid // values. { INVALID_ENUM, "ENUM \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5\u3002\u6709\u6548\u7684\u503c\u70ba\uff1a{2}\u3002"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NMTOKEN, "NMTOKEN \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NCNAME, "NCNAME \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_BOOLEAN, "Boolean \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5"}, // Note to translators: The following message is used if the value of // an attribute in a stylesheet is invalid. "number" is the XSLT data-type // of the attribute, and should not be translated. The substitution text {1} is // the attribute value and {0} is the attribute name. { INVALID_NUMBER, "Number \u5c6c\u6027\uff1a{0} \u4f7f\u7528\u7684\u503c\uff1a{1} \u4e0d\u5408\u6cd5"}, // End of shared codes... // Note to translators: A "match pattern" is a special form of XPath expression // that is used for matching patterns. The substitution text is the name of // a function. The message indicates that when this function is referenced in // a match pattern, its argument must be a string literal (or constant.) // ER_ARG_LITERAL - new error message for bugzilla //5202 { ER_ARG_LITERAL, "\u6bd4\u5c0d\u578b\u6a23\u4e2d\u7684 ''''{0}'''' \u7684\u5f15\u6578\u5fc5\u9808\u662f\u6587\u5b57\u3002"}, // Note to translators: The following message indicates that two definitions of // a variable. A "global variable" is a variable that is accessible everywher // in the stylesheet. // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790 { ER_DUPLICATE_GLOBAL_VAR, "\u5ee3\u57df\u8b8a\u6578\u5ba3\u544a\u91cd\u8907\u3002"}, // Note to translators: The following message indicates that two definitions of // a variable were encountered. // ER_DUPLICATE_VAR - new error message for bugzilla #790 { ER_DUPLICATE_VAR, "\u8b8a\u6578\u5ba3\u544a\u91cd\u8907\u3002"}, // Note to translators: "xsl:template, "name" and "match" are XSLT keywords // which must not be translated. // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789 { ER_TEMPLATE_NAME_MATCH, "xsl:template \u5fc5\u9808\u6709\u540d\u7a31\u6216\u76f8\u7b26\u7684\u5c6c\u6027\uff08\u6216\u5169\u8005\uff09"}, // Note to translators: "exclude-result-prefixes" is an XSLT keyword which // should not be translated. The message indicates that a namespace prefix // encountered as part of the value of the exclude-result-prefixes attribute // was in error. // ER_INVALID_PREFIX - new error message for bugzilla #788 { ER_INVALID_PREFIX, "exclude-result-prefixes \u4e2d\u7684\u5b57\u9996\u7121\u6548\uff1a{0}"}, // Note to translators: An "attribute set" is a set of attributes that can // be added to an element in the output document as a group. The message // indicates that there was a reference to an attribute set named {0} that // was never defined. // ER_NO_ATTRIB_SET - new error message for bugzilla #782 { ER_NO_ATTRIB_SET, "attribute-set \u540d\u7a31 {0} \u4e0d\u5b58\u5728"}, // Note to translators: This message indicates that there was a reference // to a function named {0} for which no function definition could be found. { ER_FUNCTION_NOT_FOUND, "\u51fd\u6578\u540d\u70ba {0} \u4e0d\u5b58\u5728"}, // Note to translators: This message indicates that the XSLT instruction // that is named by the substitution text {0} must not contain other XSLT // instructions (content) or a "select" attribute. The word "select" is // an XSLT keyword in this case and must not be translated. { ER_CANT_HAVE_CONTENT_AND_SELECT, "{0} \u5143\u7d20\u4e0d\u5f97\u540c\u6642\u6709\u5167\u5bb9\u548c select \u5c6c\u6027\u3002"}, // Note to translators: This message indicates that the value argument // of setParameter must be a valid Java Object. { ER_INVALID_SET_PARAM_VALUE, "\u53c3\u6578 {0} \u7684\u503c\u5fc5\u9808\u662f\u6709\u6548\u7684 Java \u7269\u4ef6"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, "\u4e00\u500b xsl:namespace-alias \u5143\u7d20\u7684 result-prefix \u5c6c\u6027\u6709\u503c '#default'\uff0c\u4f46\u5728\u8a72\u5143\u7d20\u7684\u7bc4\u570d\u4e2d\u4e26\u6c92\u6709\u9810\u8a2d\u540d\u7a31\u7a7a\u9593\u7684\u5ba3\u544a"}, { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, "\u4e00\u500b xsl:namespace-alias \u5143\u7d20\u7684 result-prefix \u5c6c\u6027\u6709\u503c ''{0}''\uff0c\u4f46\u5728\u8a72\u5143\u7d20\u7684\u7bc4\u570d\u4e2d\u4e26\u6c92\u6709\u5b57\u9996 ''{0}'' \u7684\u540d\u7a31\u7a7a\u9593\u5ba3\u544a\u3002"}, { ER_SET_FEATURE_NULL_NAME, "\u7279\u6027\u540d\u7a31\u5728 TransformerFactory.setFeature(\u5b57\u4e32\u540d\u7a31\u3001boolean \u503c) \u4e2d\u4e0d\u53ef\u662f\u7a7a\u503c\u3002"}, { ER_GET_FEATURE_NULL_NAME, "\u7279\u6027\u540d\u7a31\u5728 TransformerFactory.getFeature(\u5b57\u4e32\u540d\u7a31) \u4e2d\u4e0d\u53ef\u662f\u7a7a\u503c\u3002"}, { ER_UNSUPPORTED_FEATURE, "\u7121\u6cd5\u5728\u9019\u500b TransformerFactory \u8a2d\u5b9a\u7279\u6027 ''{0}''\u3002"}, { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING, "\u7576\u5b89\u5168\u8655\u7406\u7279\u6027\u8a2d\u70ba true \u6642\uff0c\u4e0d\u63a5\u53d7\u4f7f\u7528\u5ef6\u4f38\u5143\u7d20 ''{0}''\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, "\u7121\u6cd5\u53d6\u5f97\u7a7a\u503c\u540d\u7a31\u7a7a\u9593 uri \u7684\u5b57\u9996\u3002"}, { ER_NAMESPACE_CONTEXT_NULL_PREFIX, "\u7121\u6cd5\u53d6\u5f97\u7a7a\u503c\u5b57\u9996\u7684\u540d\u7a31\u7a7a\u9593 uri\u3002"}, { ER_XPATH_RESOLVER_NULL_QNAME, "\u51fd\u6578\u540d\u7a31\u4e0d\u53ef\u70ba\u7a7a\u503c\u3002"}, { ER_XPATH_RESOLVER_NEGATIVE_ARITY, "Arity \u4e0d\u53ef\u70ba\u8ca0\u503c\u3002"}, // Warnings... { WG_FOUND_CURLYBRACE, "\u627e\u5230 '}' \u4f46\u6c92\u6709\u958b\u555f\u5c6c\u6027\u7bc4\u672c\uff01"}, { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR, "\u8b66\u544a\uff1acount \u5c6c\u6027\u4e0d\u7b26\u5408 xsl:number \u4e2d\u7684\u88ab\u7e7c\u627f\u8005\uff01\u76ee\u6a19 = {0}"}, { WG_EXPR_ATTRIB_CHANGED_TO_SELECT, "\u820a\u8a9e\u6cd5\uff1a'expr' \u5c6c\u6027\u7684\u540d\u7a31\u5df2\u8b8a\u66f4\u70ba 'select'\u3002"}, { WG_NO_LOCALE_IN_FORMATNUMBER, "Xalan \u5c1a\u672a\u8655\u7406 format-number \u51fd\u6578\u4e2d\u7684\u8a9e\u8a00\u74b0\u5883\u540d\u7a31\u3002"}, { WG_LOCALE_NOT_FOUND, "\u8b66\u544a\uff1a\u627e\u4e0d\u5230 xml:lang={0} \u7684\u8a9e\u8a00\u74b0\u5883"}, { WG_CANNOT_MAKE_URL_FROM, "\u7121\u6cd5\u5f9e\uff1a{0} \u7522\u751f URL"}, { WG_CANNOT_LOAD_REQUESTED_DOC, "\u7121\u6cd5\u8f09\u5165\u6240\u8981\u6c42\u7684\u6587\u4ef6\uff1a{0}"}, { WG_CANNOT_FIND_COLLATOR, "\u627e\u4e0d\u5230 >>>>>> Xalan \u7248\u672c"}, { "version2", "<<<<<<<"}, { "yes", "yes"}, { "line", "\u884c\u865f"}, { "column","\u6b04\u865f"}, { "xsldone", "XSLProcessor\uff1a\u5b8c\u6210"}, // Note to translators: The following messages provide usage information // for the Xalan Process command line. "Process" is the name of a Java class, // and should not be translated. { "xslProc_option", "Xalan-J \u6307\u4ee4\u884c Process \u985e\u5225\u9078\u9805\uff1a"}, { "xslProc_option", "Xalan-J \u6307\u4ee4\u884c Process \u985e\u5225\u9078\u9805\u003a"}, { "xslProc_invalid_xsltc_option", "XSLTC \u6a21\u5f0f\u4e0d\u652f\u63f4\u9078\u9805 {0}\u3002"}, { "xslProc_invalid_xalan_option", "\u9078\u9805 {0} \u53ea\u80fd\u548c -XSLTC \u4e00\u8d77\u4f7f\u7528\u3002"}, { "xslProc_no_input", "\u932f\u8aa4\uff1a\u672a\u6307\u5b9a\u6a23\u5f0f\u8868\u6216\u8f38\u5165 xml\u3002\u57f7\u884c\u6b64\u6307\u4ee4\u6642\u4e0d\u8981\u5305\u542b\u4efb\u4f55\u9078\u9805\uff0c\u5373\u53ef\u53d6\u5f97\u7528\u6cd5\u6307\u793a\u3002"}, { "xslProc_common_options", "-\u4e00\u822c\u9078\u9805-"}, { "xslProc_xalan_options", "-Xalan \u7684\u9078\u9805-"}, { "xslProc_xsltc_options", "-XSLTC \u7684\u9078\u9805-"}, { "xslProc_return_to_continue", "(\u6309 \u7e7c\u7e8c)"}, // Note to translators: The option name and the parameter name do not need to // be translated. Only translate the messages in parentheses. Note also that // leading whitespace in the messages is used to indent the usage information // for each option in the English messages. // Do not translate the keywords: XSLTC, SAX, DOM and DTM. { "optionXSLTC", "[-XSLTC (\u4f7f\u7528 XSLTC \u9032\u884c\u8f49\u63db)]"}, { "optionIN", "[-IN inputXMLURL]"}, { "optionXSL", "[-XSL XSLTransformationURL]"}, { "optionOUT", "[-OUT outputFileName]"}, { "optionLXCIN", "[-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", "[-LXCOUT compiledStylesheetFileNameOutOut]"}, { "optionPARSER", "[-PARSER fully qualified class name of parser liaison]"}, { "optionE", " [-E\uff08\u4e0d\u5c55\u958b\u5be6\u9ad4\u53c3\u7167\uff09]"}, { "optionV", " [-E\uff08\u4e0d\u5c55\u958b\u5be6\u9ad4\u53c3\u7167\uff09]"}, { "optionQC", " [-QC\uff08\u7121\u8072\u578b\u6a23\u885d\u7a81\u8b66\u544a\uff09]"}, { "optionQ", " [-Q \uff08\u7121\u8072\u6a21\u5f0f\uff09]"}, { "optionLF", " [-LF\uff08\u53ea\u5728\u8f38\u51fa\u4e0a\u4f7f\u7528\u8f38\u51fa {\u9810\u8a2d\u662f CR/LF}\uff09]"}, { "optionCR", " [-LF\uff08\u53ea\u5728\u8f38\u51fa\u4e0a\u4f7f\u7528\u56de\u8eca {\u9810\u8a2d\u662f CR/LF}\uff09]"}, { "optionESCAPE", "[-ESCAPE\uff08\u8981\u8df3\u51fa\u7684\u5b57\u5143 {\u9810\u8a2d\u662f <>&\"\'\\r\\n}]"}, { "optionINDENT", "[-INDENT\uff08\u63a7\u5236\u8981\u5167\u7e2e\u7684\u7a7a\u683c\u6578 {\u9810\u8a2d\u662f 0}\uff09]"}, { "optionTT", " [-TT\uff08\u5728\u88ab\u547c\u53eb\u6642\u8ffd\u8e64\u7bc4\u672c\u3002\uff09]"}, { "optionTG", " [-TG\uff08\u8ffd\u8e64\u6bcf\u4e00\u500b\u7522\u751f\u4e8b\u4ef6\u3002\uff09]"}, { "optionTS", " [-TS\uff08\u8ffd\u8e64\u6bcf\u4e00\u500b\u9078\u53d6\u4e8b\u4ef6\u3002\uff09]"}, { "optionTTC", " [-TTC\uff08\u5728\u88ab\u8655\u7406\u6642\u8ffd\u8e64\u7bc4\u672c\u5b50\u9805\u5143\u4ef6\u3002\uff09]"}, { "optionTCLASS", " [-TCLASS\uff08\u8ffd\u8e64\u5ef6\u4f38\u9805\u76ee\u7684 TraceListener \u985e\u5225\u3002\uff09]"}, { "optionVALIDATE", "[-VALIDATE\uff08\u8a2d\u5b9a\u662f\u5426\u767c\u751f\u9a57\u8b49\u3002\u4f9d\u9810\u8a2d\u9a57\u8b49\u662f\u95dc\u9589\u7684\u3002\uff09]"}, { "optionEDUMP", "[-EDUMP {\u9078\u7528\u7684\u6a94\u6848\u540d\u7a31}\uff08\u767c\u751f\u932f\u8aa4\u6642\u57f7\u884c stackdump\uff09]"}, { "optionXML", " [-XML\uff08\u4f7f\u7528 XML \u683c\u5f0f\u88fd\u4f5c\u5668\u53ca\u65b0\u589e XML \u6a19\u982d\u3002\uff09]"}, { "optionTEXT", " [-TEXT\uff08\u4f7f\u7528\u7c21\u6613\u6587\u5b57\u683c\u5f0f\u5316\u7a0b\u5f0f\u3002\uff09]"}, { "optionHTML", " [-HTML\uff08\u4f7f\u7528 HTML \u683c\u5f0f\u88fd\u4f5c\u5668\u3002\uff09]"}, { "optionPARAM", " [-PARAM \u540d\u7a31\u8868\u793a\u5f0f\uff08\u8a2d\u5b9a\u6a23\u5f0f\u8868\u53c3\u6578\uff09]"}, { "noParsermsg1", "XSL \u7a0b\u5e8f\u6c92\u6709\u9806\u5229\u5b8c\u6210\u3002"}, { "noParsermsg2", "** \u627e\u4e0d\u5230\u5256\u6790\u5668 **"}, { "noParsermsg3", "\u8acb\u6aa2\u67e5\u985e\u5225\u8def\u5f91\u3002"}, { "noParsermsg4", "\u5982\u679c\u60a8\u6c92\u6709 IBM \u7684 XML Parser for Java\uff0c\u53ef\u81ea\u4ee5\u4e0b\u7db2\u5740\u4e0b\u8f09"}, { "noParsermsg5", "IBM \u7684 AlphaWorks\uff1ahttp://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", "[-URIRESOLVER \u5b8c\u6574\u7684\u985e\u5225\u540d\u7a31\uff08URIResolver \u7528\u4f86\u89e3\u6790 URI\uff09]"}, { "optionENTITYRESOLVER", "[-ENTITYRESOLVER \u5b8c\u6574\u7684\u985e\u5225\u540d\u7a31\uff08EntityResolver \u7528\u4f86\u89e3\u6790\u5be6\u9ad4\uff09]"}, { "optionCONTENTHANDLER", "[-CONTENTHANDLER \u5b8c\u6574\u7684\u985e\u5225\u540d\u7a31\uff08ContentHandler \u7528\u4f86\u5e8f\u5217\u5316\u8f38\u51fa\uff09]"}, { "optionLINENUMBERS", "[-L \u4f7f\u7528\u539f\u59cb\u6587\u4ef6\u7684\u884c\u865f]"}, { "optionSECUREPROCESSING", " [-SECURE (\u5c07\u5b89\u5168\u8655\u7406\u7279\u6027\u8a2d\u70ba true\u3002)]"}, // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11) { "optionMEDIA", " [-MEDIA mediaType\uff08\u4f7f\u7528\u5a92\u9ad4\u5c6c\u6027\u5c0b\u627e\u8207\u6587\u4ef6\u76f8\u95dc\u806f\u7684\u6a23\u5f0f\u8868\u3002\uff09]"}, { "optionFLAVOR", " [-FLAVOR flavorName\uff08\u660e\u78ba\u4f7f\u7528 s2s=SAX \u6216 d2d=DOM \u4f86\u57f7\u884c\u8f49\u63db\u3002\uff09] "}, // Added by sboag/scurcuru; experimental { "optionDIAG", " [-DIAG (\u5217\u5370\u8f49\u63db\u82b1\u8cbb\u7684\u6beb\u79d2\u6578\u3002\uff09]"}, { "optionINCREMENTAL", " [-INCREMENTAL\uff08\u8a2d\u5b9a http://xml.apache.org/xalan/features/incremental \u70ba true\uff0c\u8981\u6c42\u6f38\u9032\u5f0f DTM \u5efa\u69cb\u3002\uff09]"}, { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE\uff08\u8a2d\u5b9a http://xml.apache.org/xalan/features/optimize \u70ba false\uff0c\u8981\u6c42\u4e0d\u9032\u884c\u6a23\u5f0f\u8868\u6700\u4f73\u5316\u8655\u7406\u7a0b\u5e8f\u3002)]"}, { "optionRL", " [-RL recursionlimit\uff08\u4e3b\u5f35\u5c0d\u6a23\u5f0f\u8868\u905e\u8ff4\u6df1\u5ea6\u5be6\u65bd\u6578\u503c\u9650\u5236\u3002\uff09]"}, { "optionXO", "[-XO [transletName] (\u6307\u5b9a\u540d\u7a31\u7d66\u7522\u751f\u7684 translet)]"}, { "optionXD", "[-XD destinationDirectory (\u6307\u5b9a translet \u7684\u76ee\u6a19\u76ee\u9304)]"}, { "optionXJ", "[-XJ jarfile (\u5c07 translet \u985e\u5225\u5c01\u88dd\u5728\u6a94\u540d\u70ba \u7684 jar \u6a94\u6848\u4e2d)]"}, { "optionXP", "[-XP package (\u6307\u5b9a\u6240\u7522\u751f\u7684\u6240\u6709 translet \u985e\u5225\u4e4b\u5957\u4ef6\u540d\u7a31\u5b57\u9996)]"}, //AddITIONAL STRINGS that need L10n // Note to translators: The following message describes usage of a particular // command-line option that is used to enable the "template inlining" // optimization. The optimization involves making a copy of the code // generated for a template in another template that refers to it. { "optionXN", "[-XN (\u555f\u7528\u7bc4\u672c\u5217\u5165)]" }, { "optionXX", "[-XX (\u958b\u555f\u984d\u5916\u7684\u9664\u932f\u8a0a\u606f\u8f38\u51fa)]"}, { "optionXT" , "[-XT (\u53ef\u80fd\u7684\u8a71\uff0c\u4f7f\u7528 translet \u9032\u884c\u8f49\u63db)]"}, { "diagTiming","--------- \u900f\u904e {1} \u8017\u8cbb {2} \u6beb\u79d2\u8f49\u63db {0}" }, { "recursionTooDeep","\u7bc4\u672c\u5de2\u72c0\u7d50\u69cb\u592a\u6df1\u3002\u5de2\u72c0 = {0}\uff0c\u7bc4\u672c {1} {2}" }, { "nameIs", "\u540d\u7a31\u70ba" }, { "matchPatternIs", "\u6bd4\u5c0d\u578b\u6a23\u70ba" } }; } // ================= INFRASTRUCTURE ====================== /** String for use when a bad error code was encountered. */ public static final String BAD_CODE = "BAD_CODE"; /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; /** General error string. */ public static final String ERROR_STRING = "#error"; /** String to prepend to error messages. */ public static final String ERROR_HEADER = "\u932f\u8aa4\uff1a"; /** String to prepend to warning messages. */ public static final String WARNING_HEADER = "\u8b66\u544a\uff1a"; /** String to specify the XSLT module. */ public static final String XSL_HEADER = "XSLT "; /** String to specify the XML parser module. */ public static final String XML_HEADER = "XML "; /** I don't think this is used any more. * @deprecated */ public static final String QUERY_HEADER = "PATTERN "; /** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */ public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("zh", "TW")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } } /** * Return the resource file suffic for the indicated locale * For most locales, this will be based the language code. However * for Chinese, we do distinguish between Taiwan and PRC * * @param locale the locale * @return an String suffix which canbe appended to a resource name */ private static final String getResourceSuffix(Locale locale) { String suffix = "_" + locale.getLanguage(); String country = locale.getCountry(); if (country.equals("TW")) suffix += "_" + country; return suffix; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/0000755000175000017500000000000010736146354021232 5ustar mkochmkochlibxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorImport.java0000644000175000017500000000346410721374032025244 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorImport.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.res.XSLTErrorResources; /** * This class processes parse events for an xsl:import element. * @see XSLT DTD * @see import in XSLT Specification * * @xsl.usage internal */ public class ProcessorImport extends ProcessorInclude { static final long serialVersionUID = -8247537698214245237L; /** * Get the stylesheet type associated with an imported stylesheet * * @return the type of the stylesheet */ protected int getStylesheetType() { return StylesheetHandler.STYPE_IMPORT; } /** * Get the error number associated with this type of stylesheet importing itself * * @return the appropriate error number */ protected String getStylesheetInclErr() { return XSLTErrorResources.ER_IMPORTING_ITSELF; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorCharacters.java0000644000175000017500000001421410721374030026042 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorCharacters.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemText; import org.apache.xalan.templates.ElemTextLiteral; import org.apache.xml.utils.XMLCharacterRecognizer; import org.w3c.dom.Node; /** * This class processes character events for a XSLT template element. * @see XSLT DTD * @see section-Creating-the-Result-Tree in XSLT Specification */ public class ProcessorCharacters extends XSLTElementProcessor { static final long serialVersionUID = 8632900007814162650L; /** * Receive notification of the start of the non-text event. This * is sent to the current processor when any non-text event occurs. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. */ public void startNonText(StylesheetHandler handler) throws org.xml.sax.SAXException { if (this == handler.getCurrentProcessor()) { handler.popProcessor(); } int nChars = m_accumulator.length(); if ((nChars > 0) && ((null != m_xslTextElement) ||!XMLCharacterRecognizer.isWhiteSpace(m_accumulator)) || handler.isSpacePreserve()) { ElemTextLiteral elem = new ElemTextLiteral(); elem.setDOMBackPointer(m_firstBackPointer); elem.setLocaterInfo(handler.getLocator()); try { elem.setPrefixes(handler.getNamespaceSupport()); } catch(TransformerException te) { throw new org.xml.sax.SAXException(te); } boolean doe = (null != m_xslTextElement) ? m_xslTextElement.getDisableOutputEscaping() : false; elem.setDisableOutputEscaping(doe); elem.setPreserveSpace(true); char[] chars = new char[nChars]; m_accumulator.getChars(0, nChars, chars, 0); elem.setChars(chars); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(elem); } m_accumulator.setLength(0); m_firstBackPointer = null; } protected Node m_firstBackPointer = null; /** * Receive notification of character data inside an element. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#characters */ public void characters( StylesheetHandler handler, char ch[], int start, int length) throws org.xml.sax.SAXException { m_accumulator.append(ch, start, length); if(null == m_firstBackPointer) m_firstBackPointer = handler.getOriginatingNode(); // Catch all events until a non-character event. if (this != handler.getCurrentProcessor()) handler.pushProcessor(this); } /** * Receive notification of the end of an element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @see org.apache.xalan.processor.StylesheetHandler#startElement * @see org.apache.xalan.processor.StylesheetHandler#endElement * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.Attributes */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { // Since this has been installed as the current processor, we // may get and end element event, in which case, we pop and clear // and then call the real element processor. startNonText(handler); handler.getCurrentProcessor().endElement(handler, uri, localName, rawName); handler.popProcessor(); } /** * Accumulate characters, until a non-whitespace event has * occured. */ private StringBuffer m_accumulator = new StringBuffer(); /** * The xsl:text processor will call this to set a * preserve space state. */ private ElemText m_xslTextElement; /** * Set the current setXslTextElement. The xsl:text * processor will call this to set a preserve space state. * * @param xslTextElement The current xslTextElement that * is preserving state, or null. */ void setXslTextElement(ElemText xslTextElement) { m_xslTextElement = xslTextElement; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorTemplate.java0000644000175000017500000000377710721374031025553 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorTemplate.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; /** * TransformerFactory for xsl:template markup. */ class ProcessorTemplate extends ProcessorTemplateElem { static final long serialVersionUID = -8457812845473603860L; /** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem Must be a non-null reference to a {@link org.apache.xalan.templates.ElemTemplate} object. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { super.appendAndPush(handler, elem); elem.setDOMBackPointer(handler.getOriginatingNode()); handler.getStylesheet().setTemplate((ElemTemplate) elem); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/XSLTElementDef.java0000644000175000017500000006237410721374031024621 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTElementDef.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.util.Enumeration; import java.util.Hashtable; import org.apache.xalan.templates.Constants; import org.apache.xml.utils.QName; /** * This class defines the allowed structure for an element in a XSLT stylesheet, * is meant to reflect the structure defined in http://www.w3.org/TR/xslt#dtd, and the * mapping between Xalan classes and the markup elements in the XSLT instance. * This actually represents both text nodes and elements. */ public class XSLTElementDef { /** * Construct an instance of XSLTElementDef. This must be followed by a * call to build(). */ XSLTElementDef(){} /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject) { build(namespace, name, nameAlias, elements, attributes, contentHandler, classObject); if ( (null != namespace) && (namespace.equals(Constants.S_XSLNAMESPACEURL) || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL) || namespace.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL))) { schema.addAvailableElement(new QName(namespace, name)); if(null != nameAlias) schema.addAvailableElement(new QName(namespace, nameAlias)); } } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. * @param has_required true if this element has required elements by the XSLT specification. */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject, boolean has_required) { this.m_has_required = has_required; build(namespace, name, nameAlias, elements, attributes, contentHandler, classObject); if ( (null != namespace) && (namespace.equals(Constants.S_XSLNAMESPACEURL) || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL) || namespace.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL))) { schema.addAvailableElement(new QName(namespace, name)); if(null != nameAlias) schema.addAvailableElement(new QName(namespace, nameAlias)); } } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. * @param has_required true if this element has required elements by the XSLT specification. * @param required true if this element is required by the XSLT specification. */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject, boolean has_required, boolean required) { this(schema, namespace, name, nameAlias, elements, attributes, contentHandler, classObject, has_required); this.m_required = required; } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. * @param has_required true if this element has required elements by the XSLT specification. * @param required true if this element is required by the XSLT specification. * @param order the order this element should appear according to the XSLT specification. * @param multiAllowed whether this element is allowed more than once */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject, boolean has_required, boolean required, int order, boolean multiAllowed) { this(schema, namespace, name, nameAlias, elements, attributes, contentHandler, classObject, has_required, required); this.m_order = order; this.m_multiAllowed = multiAllowed; } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. * @param has_required true if this element has required elements by the XSLT specification. * @param required true if this element is required by the XSLT specification. * @param has_order whether this element has ordered child elements * @param order the order this element should appear according to the XSLT specification. * @param multiAllowed whether this element is allowed more than once */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject, boolean has_required, boolean required, boolean has_order, int order, boolean multiAllowed) { this(schema, namespace, name, nameAlias, elements, attributes, contentHandler, classObject, has_required, required); this.m_order = order; this.m_multiAllowed = multiAllowed; this.m_isOrdered = has_order; } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. * @param has_order whether this element has ordered child elements * @param order the order this element should appear according to the XSLT specification. * @param multiAllowed whether this element is allowed more than once */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject, boolean has_order, int order, boolean multiAllowed) { this(schema, namespace, name, nameAlias, elements, attributes, contentHandler, classObject, order, multiAllowed); this.m_isOrdered = has_order; } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. * @param order the order this element should appear according to the XSLT specification. * @param multiAllowed whether this element is allowed more than once */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject, int order, boolean multiAllowed) { this(schema, namespace, name, nameAlias, elements, attributes, contentHandler, classObject); this.m_order = order; this.m_multiAllowed = multiAllowed; } /** * Construct an instance of XSLTElementDef that represents text. * * @param classObject The class of the object that this element def should produce. * @param contentHandler The element processor for this element. * @param type Content type, one of T_ELEMENT, T_PCDATA, or T_ANY. */ XSLTElementDef(Class classObject, XSLTElementProcessor contentHandler, int type) { this.m_classObject = classObject; this.m_type = type; setElementProcessor(contentHandler); } /** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. */ void build(String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject) { this.m_namespace = namespace; this.m_name = name; this.m_nameAlias = nameAlias; this.m_elements = elements; this.m_attributes = attributes; setElementProcessor(contentHandler); this.m_classObject = classObject; if (hasRequired() && m_elements != null) { int n = m_elements.length; for (int i = 0; i < n; i++) { XSLTElementDef def = m_elements[i]; if (def != null && def.getRequired()) { if (m_requiredFound == null) m_requiredFound = new Hashtable(); m_requiredFound.put(def.getName(), "xsl:" +def.getName()); } } } } /** * Tell if two objects are equal, when either one may be null. * If both are null, they are considered equal. * * @param obj1 A reference to the first object, or null. * @param obj2 A reference to the second object, or null. * * @return true if the to objects are equal by both being null or * because obj2.equals(obj1) returns true. */ private static boolean equalsMayBeNull(Object obj1, Object obj2) { return (obj2 == obj1) || ((null != obj1) && (null != obj2) && obj2.equals(obj1)); } /** * Tell if the two string refs are equal, * equality being defined as: * 1) Both strings are null. * 2) One string is null and the other is empty. * 3) Both strings are non-null, and equal. * * @param s1 A reference to the first string, or null. * @param s2 A reference to the second string, or null. * * @return true if Both strings are null, or if * one string is null and the other is empty, or if * both strings are non-null, and equal because * s1.equals(s2) returns true. */ private static boolean equalsMayBeNullOrZeroLen(String s1, String s2) { int len1 = (s1 == null) ? 0 : s1.length(); int len2 = (s2 == null) ? 0 : s2.length(); return (len1 != len2) ? false : (len1 == 0) ? true : s1.equals(s2); } /** Content type enumerations */ static final int T_ELEMENT = 1, T_PCDATA = 2, T_ANY = 3; /** * The type of this element. */ private int m_type = T_ELEMENT; /** * Get the type of this element. * * @return Content type, one of T_ELEMENT, T_PCDATA, or T_ANY. */ int getType() { return m_type; } /** * Set the type of this element. * * @param t Content type, one of T_ELEMENT, T_PCDATA, or T_ANY. */ void setType(int t) { m_type = t; } /** * The allowed namespace for this element. */ private String m_namespace; /** * Get the allowed namespace for this element. * * @return The Namespace URI, "*", or null. */ String getNamespace() { return m_namespace; } /** * The name of this element. */ private String m_name; /** * Get the local name of this element. * * @return The local name of this element, "*", or null. */ String getName() { return m_name; } /** * The name of this element. */ private String m_nameAlias; /** * Get the name of this element. * * @return A potential alias for the name, or null. */ String getNameAlias() { return m_nameAlias; } /** * The allowed elements for this type. */ private XSLTElementDef[] m_elements; /** * Get the allowed elements for this type. * * @return An array of allowed child element defs, or null. * @xsl.usage internal */ public XSLTElementDef[] getElements() { return m_elements; } /** * Set the allowed elements for this type. * * @param defs An array of allowed child element defs, or null. */ void setElements(XSLTElementDef[] defs) { m_elements = defs; } /** * Tell if the namespace URI and local name match this * element. * @param uri The namespace uri, which may be null. * @param localName The local name of an element, which may be null. * * @return true if the uri and local name arguments are considered * to match the uri and local name of this element def. */ private boolean QNameEquals(String uri, String localName) { return (equalsMayBeNullOrZeroLen(m_namespace, uri) && (equalsMayBeNullOrZeroLen(m_name, localName) || equalsMayBeNullOrZeroLen(m_nameAlias, localName))); } /** * Given a namespace URI, and a local name, get the processor * for the element, or return null if not allowed. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * * @return The element processor that matches the arguments, or null. */ XSLTElementProcessor getProcessorFor(String uri, String localName) { XSLTElementProcessor elemDef = null; // return value if (null == m_elements) return null; int n = m_elements.length; int order = -1; boolean multiAllowed = true; for (int i = 0; i < n; i++) { XSLTElementDef def = m_elements[i]; // A "*" signals that the element allows literal result // elements, so just assign the def, and continue to // see if anything else matches. if (def.m_name.equals("*")) { // Don't allow xsl elements if (!equalsMayBeNullOrZeroLen(uri, Constants.S_XSLNAMESPACEURL)) { elemDef = def.m_elementProcessor; order = def.getOrder(); multiAllowed = def.getMultiAllowed(); } } else if (def.QNameEquals(uri, localName)) { if (def.getRequired()) this.setRequiredFound(def.getName(), true); order = def.getOrder(); multiAllowed = def.getMultiAllowed(); elemDef = def.m_elementProcessor; break; } } if (elemDef != null && this.isOrdered()) { int lastOrder = getLastOrder(); if (order > lastOrder) setLastOrder(order); else if (order == lastOrder && !multiAllowed) { return null; } else if (order < lastOrder && order > 0) { return null; } } return elemDef; } /** * Given an unknown element, get the processor * for the element. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * * @return normally a {@link ProcessorUnknown} reference. * @see ProcessorUnknown */ XSLTElementProcessor getProcessorForUnknown(String uri, String localName) { // XSLTElementProcessor lreDef = null; // return value if (null == m_elements) return null; int n = m_elements.length; for (int i = 0; i < n; i++) { XSLTElementDef def = m_elements[i]; if (def.m_name.equals("unknown") && uri.length() > 0) { return def.m_elementProcessor; } } return null; } /** * The allowed attributes for this type. */ private XSLTAttributeDef[] m_attributes; /** * Get the allowed attributes for this type. * * @return An array of allowed attribute defs, or null. */ XSLTAttributeDef[] getAttributes() { return m_attributes; } /** * Given a namespace URI, and a local name, return the element's * attribute definition, if it has one. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * * @return The attribute def that matches the arguments, or null. */ XSLTAttributeDef getAttributeDef(String uri, String localName) { XSLTAttributeDef defaultDef = null; XSLTAttributeDef[] attrDefs = getAttributes(); int nAttrDefs = attrDefs.length; for (int k = 0; k < nAttrDefs; k++) { XSLTAttributeDef attrDef = attrDefs[k]; String uriDef = attrDef.getNamespace(); String nameDef = attrDef.getName(); if (nameDef.equals("*") && (equalsMayBeNullOrZeroLen(uri, uriDef) || (uriDef != null && uriDef.equals("*") && uri!=null && uri.length() > 0 ))) { return attrDef; } else if (nameDef.equals("*") && (uriDef == null)) { // In this case, all attributes are legal, so return // this as the last resort. defaultDef = attrDef; } else if (equalsMayBeNullOrZeroLen(uri, uriDef) && localName.equals(nameDef)) { return attrDef; } } if (null == defaultDef) { if (uri.length() > 0 && !equalsMayBeNullOrZeroLen(uri, Constants.S_XSLNAMESPACEURL)) { return XSLTAttributeDef.m_foreignAttr; } } return defaultDef; } /** * If non-null, the ContentHandler/TransformerFactory for this element. */ private XSLTElementProcessor m_elementProcessor; /** * Return the XSLTElementProcessor for this element. * * @return The element processor for this element. * @xsl.usage internal */ public XSLTElementProcessor getElementProcessor() { return m_elementProcessor; } /** * Set the XSLTElementProcessor for this element. * * @param handler The element processor for this element. * @xsl.usage internal */ public void setElementProcessor(XSLTElementProcessor handler) { if (handler != null) { m_elementProcessor = handler; m_elementProcessor.setElemDef(this); } } /** * If non-null, the class object that should in instantiated for * a Xalan instance of this element. */ private Class m_classObject; /** * Return the class object that should in instantiated for * a Xalan instance of this element. * * @return The class of the object that this element def should produce, or null. */ Class getClassObject() { return m_classObject; } /** * If true, this has a required element. */ private boolean m_has_required = false; /** * Get whether or not this has a required element. * * @return true if this this has a required element. */ boolean hasRequired() { return m_has_required; } /** * If true, this is a required element. */ private boolean m_required = false; /** * Get whether or not this is a required element. * * @return true if this is a required element. */ boolean getRequired() { return m_required; } Hashtable m_requiredFound; /** * Set this required element found. * */ void setRequiredFound(String elem, boolean found) { if (m_requiredFound.get(elem) != null) m_requiredFound.remove(elem); } /** * Get whether all required elements were found. * * @return true if all required elements were found. */ boolean getRequiredFound() { if (m_requiredFound == null) return true; return m_requiredFound.isEmpty(); } /** * Get required elements that were not found. * * @return required elements that were not found. */ String getRequiredElem() { if (m_requiredFound == null) return null; Enumeration elems = m_requiredFound.elements(); String s = ""; boolean first = true; while (elems.hasMoreElements()) { if (first) first = false; else s = s + ", "; s = s + (String)elems.nextElement(); } return s; } boolean m_isOrdered = false; /** * Get whether this element requires ordered children. * * @return true if this element requires ordered children. */ boolean isOrdered() { /*if (!m_CheckedOrdered) { m_CheckedOrdered = true; m_isOrdered = false; if (null == m_elements) return false; int n = m_elements.length; for (int i = 0; i < n; i++) { if (m_elements[i].getOrder() > 0) { m_isOrdered = true; return true; } } return false; } else*/ return m_isOrdered; } /** * the order that this element should appear, or -1 if not ordered */ private int m_order = -1; /** * Get the order that this element should appear . * * @return the order that this element should appear. */ int getOrder() { return m_order; } /** * the highest order of child elements have appeared so far, * or -1 if not ordered */ private int m_lastOrder = -1; /** * Get the highest order of child elements have appeared so far . * * @return the highest order of child elements have appeared so far. */ int getLastOrder() { return m_lastOrder; } /** * Set the highest order of child elements have appeared so far . * * @param order the highest order of child elements have appeared so far. */ void setLastOrder(int order) { m_lastOrder = order ; } /** * True if this element can appear multiple times */ private boolean m_multiAllowed = true; /** * Get whether this element can appear multiple times * * @return true if this element can appear multiple times */ boolean getMultiAllowed() { return m_multiAllowed; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorGlobalParamDecl.java0000644000175000017500000000567210721374030026744 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorGlobalParamDecl.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.ElemParam; import org.apache.xalan.templates.ElemTemplateElement; /** * This class processes parse events for an xsl:param element. * @see XSLT DTD * @see top-level-variables in XSLT Specification */ class ProcessorGlobalParamDecl extends ProcessorTemplateElem { static final long serialVersionUID = 1900450872353587350L; /** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem The non-null reference to the ElemParam element. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { // Just push, but don't append. handler.pushElemTemplateElement(elem); } /** * Receive notification of the end of an element. * * @param name The element type name. * @param attributes The specified or defaulted attributes. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { ElemParam v = (ElemParam) handler.getElemTemplateElement(); handler.getStylesheet().appendChild(v); handler.getStylesheet().setParam(v); super.endElement(handler, uri, localName, rawName); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/XSLTSchema.java0000644000175000017500000015726710721374030024016 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTSchema.java 476466 2006-11-18 08:22:31Z minchau $ */ package org.apache.xalan.processor; import java.util.HashMap; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemApplyImport; import org.apache.xalan.templates.ElemApplyTemplates; import org.apache.xalan.templates.ElemAttribute; import org.apache.xalan.templates.ElemCallTemplate; import org.apache.xalan.templates.ElemChoose; import org.apache.xalan.templates.ElemComment; import org.apache.xalan.templates.ElemCopy; import org.apache.xalan.templates.ElemCopyOf; import org.apache.xalan.templates.ElemElement; import org.apache.xalan.templates.ElemExsltFuncResult; import org.apache.xalan.templates.ElemExsltFunction; import org.apache.xalan.templates.ElemExtensionDecl; import org.apache.xalan.templates.ElemExtensionScript; import org.apache.xalan.templates.ElemFallback; import org.apache.xalan.templates.ElemForEach; import org.apache.xalan.templates.ElemIf; import org.apache.xalan.templates.ElemLiteralResult; import org.apache.xalan.templates.ElemMessage; import org.apache.xalan.templates.ElemNumber; import org.apache.xalan.templates.ElemOtherwise; import org.apache.xalan.templates.ElemPI; import org.apache.xalan.templates.ElemParam; import org.apache.xalan.templates.ElemSort; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemText; import org.apache.xalan.templates.ElemTextLiteral; import org.apache.xalan.templates.ElemUnknown; import org.apache.xalan.templates.ElemValueOf; import org.apache.xalan.templates.ElemVariable; import org.apache.xalan.templates.ElemWhen; import org.apache.xalan.templates.ElemWithParam; import org.apache.xml.utils.QName; /** * This class defines the allowed structure for a stylesheet, and the * mapping between Xalan classes and the markup elements in the stylesheet. * @see XSLT DTD */ public class XSLTSchema extends XSLTElementDef { /** * Construct a XSLTSchema which represents the XSLT "schema". */ XSLTSchema() { build(); } /** * This method builds an XSLT "schema" according to http://www.w3.org/TR/xslt#dtd. This * schema provides instructions for building the Xalan Stylesheet (Templates) structure. */ void build() { // xsl:import, xsl:include XSLTAttributeDef hrefAttr = new XSLTAttributeDef(null, "href", XSLTAttributeDef.T_URL, true, false,XSLTAttributeDef.ERROR); // xsl:preserve-space, xsl:strip-space XSLTAttributeDef elementsAttr = new XSLTAttributeDef(null, "elements", XSLTAttributeDef.T_SIMPLEPATTERNLIST, true, false, XSLTAttributeDef.ERROR); // XSLTAttributeDef anyNamespacedAttr = new XSLTAttributeDef("*", "*", // XSLTAttributeDef.T_CDATA, false); // xsl:output XSLTAttributeDef methodAttr = new XSLTAttributeDef(null, "method", XSLTAttributeDef.T_QNAME, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef versionAttr = new XSLTAttributeDef(null, "version", XSLTAttributeDef.T_NMTOKEN, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef encodingAttr = new XSLTAttributeDef(null, "encoding", XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef omitXmlDeclarationAttr = new XSLTAttributeDef(null, "omit-xml-declaration", XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef standaloneAttr = new XSLTAttributeDef(null, "standalone", XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef doctypePublicAttr = new XSLTAttributeDef(null, "doctype-public", XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef doctypeSystemAttr = new XSLTAttributeDef(null, "doctype-system", XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef cdataSectionElementsAttr = new XSLTAttributeDef(null, "cdata-section-elements", XSLTAttributeDef.T_QNAMES_RESOLVE_NULL, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef indentAttr = new XSLTAttributeDef(null, "indent", XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef mediaTypeAttr = new XSLTAttributeDef(null, "media-type", XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); // Required. // It is an error if the name attribute is invalid on any of these elements // xsl:key, xsl:attribute-set, xsl:call-template, xsl:with-param, xsl:variable, xsl:param XSLTAttributeDef nameAttrRequired = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_QNAME, true, false,XSLTAttributeDef.ERROR); // Required. // Support AVT // xsl:element, xsl:attribute XSLTAttributeDef nameAVTRequired = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_AVT_QNAME, true, true,XSLTAttributeDef.WARNING); // Required. // Support AVT // xsl:processing-instruction XSLTAttributeDef nameAVT_NCNAMERequired = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_NCNAME, true, true,XSLTAttributeDef.WARNING); // Optional. // Static error if invalid // xsl:template, xsl:decimal-format XSLTAttributeDef nameAttrOpt_ERROR = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_QNAME, false, false,XSLTAttributeDef.ERROR); // xsl:key XSLTAttributeDef useAttr = new XSLTAttributeDef(null, "use", XSLTAttributeDef.T_EXPR, true, false,XSLTAttributeDef.ERROR); // xsl:element, xsl:attribute XSLTAttributeDef namespaceAVTOpt = new XSLTAttributeDef(null, "namespace",XSLTAttributeDef.T_URL, false, true,XSLTAttributeDef.WARNING); // xsl:decimal-format XSLTAttributeDef decimalSeparatorAttr = new XSLTAttributeDef(null, "decimal-separator", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "."); XSLTAttributeDef infinityAttr = new XSLTAttributeDef(null, "infinity", XSLTAttributeDef.T_CDATA, false,XSLTAttributeDef.ERROR,"Infinity"); XSLTAttributeDef minusSignAttr = new XSLTAttributeDef(null, "minus-sign", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR,"-"); XSLTAttributeDef NaNAttr = new XSLTAttributeDef(null, "NaN", XSLTAttributeDef.T_CDATA, false,XSLTAttributeDef.ERROR, "NaN"); XSLTAttributeDef percentAttr = new XSLTAttributeDef(null, "percent", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "%"); XSLTAttributeDef perMilleAttr = new XSLTAttributeDef(null, "per-mille", XSLTAttributeDef.T_CHAR, false, false,XSLTAttributeDef.ERROR /* ,"‰" */); XSLTAttributeDef zeroDigitAttr = new XSLTAttributeDef(null, "zero-digit", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "0"); XSLTAttributeDef digitAttr = new XSLTAttributeDef(null, "digit", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "#"); XSLTAttributeDef patternSeparatorAttr = new XSLTAttributeDef(null, "pattern-separator", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, ";"); // xsl:decimal-format XSLTAttributeDef groupingSeparatorAttr = new XSLTAttributeDef(null, "grouping-separator", XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR,","); // xsl:element, xsl:attribute-set, xsl:copy XSLTAttributeDef useAttributeSetsAttr = new XSLTAttributeDef(null, "use-attribute-sets", XSLTAttributeDef.T_QNAMES, false, false, XSLTAttributeDef.ERROR); // xsl:if, xsl:when XSLTAttributeDef testAttrRequired = new XSLTAttributeDef(null, "test", XSLTAttributeDef.T_EXPR, true, false,XSLTAttributeDef.ERROR); // Required. // xsl:value-of, xsl:for-each, xsl:copy-of XSLTAttributeDef selectAttrRequired = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, true, false,XSLTAttributeDef.ERROR); // Optional. // xsl:variable, xsl:param, xsl:with-param XSLTAttributeDef selectAttrOpt = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, false, false,XSLTAttributeDef.ERROR); // Optional. // Default: "node()" // xsl:apply-templates XSLTAttributeDef selectAttrDefNode = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, false,XSLTAttributeDef.ERROR, "node()"); // Optional. // Default: "." // xsl:sort XSLTAttributeDef selectAttrDefDot = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, false,XSLTAttributeDef.ERROR, "."); // xsl:key XSLTAttributeDef matchAttrRequired = new XSLTAttributeDef(null, "match", XSLTAttributeDef.T_PATTERN, true, false,XSLTAttributeDef.ERROR); // xsl:template XSLTAttributeDef matchAttrOpt = new XSLTAttributeDef(null, "match", XSLTAttributeDef.T_PATTERN, false, false,XSLTAttributeDef.ERROR); // xsl:template XSLTAttributeDef priorityAttr = new XSLTAttributeDef(null, "priority", XSLTAttributeDef.T_NUMBER, false, false,XSLTAttributeDef.ERROR); // xsl:template, xsl:apply-templates XSLTAttributeDef modeAttr = new XSLTAttributeDef(null, "mode", XSLTAttributeDef.T_QNAME, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef spaceAttr = new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", false, false, false, XSLTAttributeDef.WARNING, "default", Constants.ATTRVAL_STRIP, "preserve", Constants.ATTRVAL_PRESERVE); XSLTAttributeDef spaceAttrLiteral = new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", XSLTAttributeDef.T_URL, false, true,XSLTAttributeDef.ERROR); // xsl:namespace-alias XSLTAttributeDef stylesheetPrefixAttr = new XSLTAttributeDef(null, "stylesheet-prefix", XSLTAttributeDef.T_CDATA, true, false,XSLTAttributeDef.ERROR); XSLTAttributeDef resultPrefixAttr = new XSLTAttributeDef(null, "result-prefix", XSLTAttributeDef.T_CDATA, true, false,XSLTAttributeDef.ERROR); // xsl:text, xsl:value-of XSLTAttributeDef disableOutputEscapingAttr = new XSLTAttributeDef(null, "disable-output-escaping", XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); // xsl:number XSLTAttributeDef levelAttr = new XSLTAttributeDef(null, "level", false, false, false, XSLTAttributeDef.ERROR, "single", Constants.NUMBERLEVEL_SINGLE, "multiple", Constants.NUMBERLEVEL_MULTI, "any", Constants.NUMBERLEVEL_ANY); levelAttr.setDefault("single"); XSLTAttributeDef countAttr = new XSLTAttributeDef(null, "count", XSLTAttributeDef.T_PATTERN, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef fromAttr = new XSLTAttributeDef(null, "from", XSLTAttributeDef.T_PATTERN, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef valueAttr = new XSLTAttributeDef(null, "value", XSLTAttributeDef.T_EXPR, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef formatAttr = new XSLTAttributeDef(null, "format", XSLTAttributeDef.T_CDATA, false, true,XSLTAttributeDef.ERROR); formatAttr.setDefault("1"); // xsl:number, xsl:sort XSLTAttributeDef langAttr = new XSLTAttributeDef(null, "lang", XSLTAttributeDef.T_NMTOKEN, false, true,XSLTAttributeDef.ERROR); // xsl:number XSLTAttributeDef letterValueAttr = new XSLTAttributeDef(null, "letter-value", false, true, false, XSLTAttributeDef.ERROR, "alphabetic", Constants.NUMBERLETTER_ALPHABETIC, "traditional", Constants.NUMBERLETTER_TRADITIONAL); // xsl:number XSLTAttributeDef groupingSeparatorAVT = new XSLTAttributeDef(null, "grouping-separator", XSLTAttributeDef.T_CHAR, false, true,XSLTAttributeDef.ERROR); // xsl:number XSLTAttributeDef groupingSizeAttr = new XSLTAttributeDef(null, "grouping-size", XSLTAttributeDef.T_NUMBER, false, true,XSLTAttributeDef.ERROR); // xsl:sort XSLTAttributeDef dataTypeAttr = new XSLTAttributeDef(null, "data-type", false, true, true, XSLTAttributeDef.ERROR, "text", Constants.SORTDATATYPE_TEXT ,"number", Constants.SORTDATATYPE_TEXT); dataTypeAttr.setDefault("text"); // xsl:sort XSLTAttributeDef orderAttr = new XSLTAttributeDef(null, "order", false, true, false,XSLTAttributeDef.ERROR, "ascending", Constants.SORTORDER_ASCENDING, "descending", Constants.SORTORDER_DESCENDING); orderAttr.setDefault("ascending"); // xsl:sort XSLTAttributeDef caseOrderAttr = new XSLTAttributeDef(null, "case-order", false, true, false,XSLTAttributeDef.ERROR, "upper-first", Constants.SORTCASEORDER_UPPERFIRST , "lower-first", Constants.SORTCASEORDER_LOWERFIRST); // xsl:message XSLTAttributeDef terminateAttr = new XSLTAttributeDef(null, "terminate", XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); terminateAttr.setDefault("no"); // top level attributes XSLTAttributeDef xslExcludeResultPrefixesAttr = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "exclude-result-prefixes", XSLTAttributeDef.T_PREFIXLIST, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef xslExtensionElementPrefixesAttr = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "extension-element-prefixes", XSLTAttributeDef.T_PREFIX_URLLIST, false, false,XSLTAttributeDef.ERROR); // result-element-atts XSLTAttributeDef xslUseAttributeSetsAttr = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "use-attribute-sets", XSLTAttributeDef.T_QNAMES, false, false,XSLTAttributeDef.ERROR); XSLTAttributeDef xslVersionAttr = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "version", XSLTAttributeDef.T_NMTOKEN, false, false,XSLTAttributeDef.ERROR); XSLTElementDef charData = new XSLTElementDef(this, null, "text()", null /*alias */, null /* elements */, null, /* attributes */ new ProcessorCharacters(), ElemTextLiteral.class /* class object */); charData.setType(XSLTElementDef.T_PCDATA); XSLTElementDef whiteSpaceOnly = new XSLTElementDef(this, null, "text()", null /*alias */, null /* elements */, null, /* attributes */ null, ElemTextLiteral.class /* should be null? -sb */); charData.setType(XSLTElementDef.T_PCDATA); XSLTAttributeDef resultAttr = new XSLTAttributeDef(null, "*", XSLTAttributeDef.T_AVT, false, true,XSLTAttributeDef.WARNING); XSLTAttributeDef xslResultAttr = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "*", XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.WARNING); XSLTElementDef[] templateElements = new XSLTElementDef[23]; XSLTElementDef[] templateElementsAndParams = new XSLTElementDef[24]; XSLTElementDef[] templateElementsAndSort = new XSLTElementDef[24]; //exslt XSLTElementDef[] exsltFunctionElements = new XSLTElementDef[24]; XSLTElementDef[] charTemplateElements = new XSLTElementDef[15]; XSLTElementDef resultElement = new XSLTElementDef(this, null, "*", null /*alias */, templateElements /* elements */, new XSLTAttributeDef[]{ spaceAttrLiteral, // special xslExcludeResultPrefixesAttr, xslExtensionElementPrefixesAttr, xslUseAttributeSetsAttr, xslVersionAttr, xslResultAttr, resultAttr }, new ProcessorLRE(), ElemLiteralResult.class /* class object */, 20, true); XSLTElementDef unknownElement = new XSLTElementDef(this, "*", "unknown", null /*alias */, templateElementsAndParams /* elements */, new XSLTAttributeDef[]{ xslExcludeResultPrefixesAttr, xslExtensionElementPrefixesAttr, xslUseAttributeSetsAttr, xslVersionAttr, xslResultAttr, resultAttr }, new ProcessorUnknown(), ElemUnknown.class /* class object */, 20, true); XSLTElementDef xslValueOf = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "value-of", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ selectAttrRequired, disableOutputEscapingAttr }, new ProcessorTemplateElem(), ElemValueOf.class /* class object */, 20, true); XSLTElementDef xslCopyOf = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "copy-of", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ selectAttrRequired }, new ProcessorTemplateElem(), ElemCopyOf.class /* class object */, 20, true); XSLTElementDef xslNumber = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "number", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ levelAttr, countAttr, fromAttr, valueAttr, formatAttr, langAttr, letterValueAttr, groupingSeparatorAVT, groupingSizeAttr }, new ProcessorTemplateElem(), ElemNumber.class /* class object */, 20, true); // XSLTElementDef xslSort = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "sort", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ selectAttrDefDot, langAttr, dataTypeAttr, orderAttr, caseOrderAttr }, new ProcessorTemplateElem(), ElemSort.class/* class object */, 19, true ); XSLTElementDef xslWithParam = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "with-param", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ nameAttrRequired, selectAttrOpt }, new ProcessorTemplateElem(), ElemWithParam.class /* class object */, 19, true); XSLTElementDef xslApplyTemplates = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "apply-templates", null /*alias */, new XSLTElementDef[]{ xslSort, xslWithParam } /* elements */, new XSLTAttributeDef[]{ selectAttrDefNode, modeAttr }, new ProcessorTemplateElem(), ElemApplyTemplates.class /* class object */, 20, true); XSLTElementDef xslApplyImports = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "apply-imports", null /*alias */, null /* elements */, new XSLTAttributeDef[]{}, new ProcessorTemplateElem(), ElemApplyImport.class /* class object */); XSLTElementDef xslForEach = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "for-each", null /*alias */, templateElementsAndSort, // (#PCDATA %instructions; %result-elements; | xsl:sort)* new XSLTAttributeDef[]{ selectAttrRequired, spaceAttr }, new ProcessorTemplateElem(), ElemForEach.class /* class object */, true, false, true, 20, true); XSLTElementDef xslIf = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "if", null /*alias */, templateElements /* elements */, // %template; new XSLTAttributeDef[]{ testAttrRequired, spaceAttr }, new ProcessorTemplateElem(), ElemIf.class /* class object */, 20, true); XSLTElementDef xslWhen = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "when", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ testAttrRequired, spaceAttr }, new ProcessorTemplateElem(), ElemWhen.class /* class object */, false, true, 1, true); XSLTElementDef xslOtherwise = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "otherwise", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ spaceAttr }, new ProcessorTemplateElem(), ElemOtherwise.class /* class object */, false, false, 2, false); XSLTElementDef xslChoose = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "choose", null /*alias */, new XSLTElementDef[]{ xslWhen, xslOtherwise } /* elements */, new XSLTAttributeDef[]{ spaceAttr }, new ProcessorTemplateElem(), ElemChoose.class /* class object */, true, false, true, 20, true); XSLTElementDef xslAttribute = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "attribute", null /*alias */, charTemplateElements /* elements */, // %char-template;> new XSLTAttributeDef[]{ nameAVTRequired, namespaceAVTOpt, spaceAttr }, new ProcessorTemplateElem(), ElemAttribute.class /* class object */, 20, true); XSLTElementDef xslCallTemplate = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "call-template", null /*alias */, new XSLTElementDef[]{ xslWithParam } /* elements */, new XSLTAttributeDef[]{ nameAttrRequired }, new ProcessorTemplateElem(), ElemCallTemplate.class /* class object */, 20, true); XSLTElementDef xslVariable = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "variable", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ nameAttrRequired, selectAttrOpt }, new ProcessorTemplateElem(), ElemVariable.class /* class object */, 20, true); XSLTElementDef xslParam = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "param", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ nameAttrRequired, selectAttrOpt }, new ProcessorTemplateElem(), ElemParam.class /* class object */, 19, true); XSLTElementDef xslText = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "text", null /*alias */, new XSLTElementDef[]{ charData } /* elements */, new XSLTAttributeDef[]{ disableOutputEscapingAttr }, new ProcessorText(), ElemText.class /* class object */, 20, true); XSLTElementDef xslProcessingInstruction = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "processing-instruction", null /*alias */, charTemplateElements /* elements */, // %char-template;> new XSLTAttributeDef[]{ nameAVT_NCNAMERequired, spaceAttr }, new ProcessorTemplateElem(), ElemPI.class /* class object */, 20, true); XSLTElementDef xslElement = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "element", null /*alias */, templateElements /* elements */, // %template; new XSLTAttributeDef[]{ nameAVTRequired, namespaceAVTOpt, useAttributeSetsAttr, spaceAttr }, new ProcessorTemplateElem(), ElemElement.class /* class object */, 20, true); XSLTElementDef xslComment = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "comment", null /*alias */, charTemplateElements /* elements */, // %char-template;> new XSLTAttributeDef[]{ spaceAttr }, new ProcessorTemplateElem(), ElemComment.class /* class object */, 20, true); XSLTElementDef xslCopy = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "copy", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ spaceAttr, useAttributeSetsAttr }, new ProcessorTemplateElem(), ElemCopy.class /* class object */, 20, true); XSLTElementDef xslMessage = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "message", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ terminateAttr }, new ProcessorTemplateElem(), ElemMessage.class /* class object */, 20, true); XSLTElementDef xslFallback = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "fallback", null /*alias */, templateElements /* elements */, // %template;> new XSLTAttributeDef[]{ spaceAttr }, new ProcessorTemplateElem(), ElemFallback.class /* class object */, 20, true); //exslt XSLTElementDef exsltFunction = new XSLTElementDef(this, Constants.S_EXSLT_FUNCTIONS_URL, "function", null /*alias */, exsltFunctionElements /* elements */, new XSLTAttributeDef[]{ nameAttrRequired }, new ProcessorExsltFunction(), ElemExsltFunction.class /* class object */); XSLTElementDef exsltResult = new XSLTElementDef(this, Constants.S_EXSLT_FUNCTIONS_URL, "result", null /*alias */, templateElements /* elements */, new XSLTAttributeDef[]{ selectAttrOpt }, new ProcessorExsltFuncResult(), ElemExsltFuncResult.class /* class object */); int i = 0; templateElements[i++] = charData; // #PCDATA // char-instructions templateElements[i++] = xslApplyTemplates; templateElements[i++] = xslCallTemplate; templateElements[i++] = xslApplyImports; templateElements[i++] = xslForEach; templateElements[i++] = xslValueOf; templateElements[i++] = xslCopyOf; templateElements[i++] = xslNumber; templateElements[i++] = xslChoose; templateElements[i++] = xslIf; templateElements[i++] = xslText; templateElements[i++] = xslCopy; templateElements[i++] = xslVariable; templateElements[i++] = xslMessage; templateElements[i++] = xslFallback; // instructions templateElements[i++] = xslProcessingInstruction; templateElements[i++] = xslComment; templateElements[i++] = xslElement; templateElements[i++] = xslAttribute; templateElements[i++] = resultElement; templateElements[i++] = unknownElement; templateElements[i++] = exsltFunction; templateElements[i++] = exsltResult; System.arraycopy(templateElements, 0, templateElementsAndParams, 0, i); System.arraycopy(templateElements, 0, templateElementsAndSort, 0, i); System.arraycopy(templateElements, 0, exsltFunctionElements, 0, i); templateElementsAndParams[i] = xslParam; templateElementsAndSort[i] = xslSort; exsltFunctionElements[i] = xslParam; i = 0; charTemplateElements[i++] = charData; // #PCDATA // char-instructions charTemplateElements[i++] = xslApplyTemplates; charTemplateElements[i++] = xslCallTemplate; charTemplateElements[i++] = xslApplyImports; charTemplateElements[i++] = xslForEach; charTemplateElements[i++] = xslValueOf; charTemplateElements[i++] = xslCopyOf; charTemplateElements[i++] = xslNumber; charTemplateElements[i++] = xslChoose; charTemplateElements[i++] = xslIf; charTemplateElements[i++] = xslText; charTemplateElements[i++] = xslCopy; charTemplateElements[i++] = xslVariable; charTemplateElements[i++] = xslMessage; charTemplateElements[i++] = xslFallback; XSLTElementDef importDef = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "import", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ hrefAttr }, // EMPTY new ProcessorImport(), null /* class object */, 1, true); XSLTElementDef includeDef = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "include", null /*alias */, null /* elements */, // EMPTY new XSLTAttributeDef[]{ hrefAttr }, new ProcessorInclude(), null /* class object */, 20, true); XSLTAttributeDef[] scriptAttrs = new XSLTAttributeDef[]{ new XSLTAttributeDef(null, "lang", XSLTAttributeDef.T_NMTOKEN, true, false,XSLTAttributeDef.WARNING), new XSLTAttributeDef(null, "src", XSLTAttributeDef.T_URL, false, false,XSLTAttributeDef.WARNING)}; XSLTAttributeDef[] componentAttrs = new XSLTAttributeDef[]{ new XSLTAttributeDef(null, "prefix", XSLTAttributeDef.T_NMTOKEN, true, false,XSLTAttributeDef.WARNING), new XSLTAttributeDef(null, "elements", XSLTAttributeDef.T_STRINGLIST, false, false,XSLTAttributeDef.WARNING), new XSLTAttributeDef(null, "functions", XSLTAttributeDef.T_STRINGLIST, false, false,XSLTAttributeDef.WARNING) }; XSLTElementDef[] topLevelElements = new XSLTElementDef[] {includeDef, importDef, // resultElement, whiteSpaceOnly, unknownElement, new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "strip-space", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ elementsAttr }, new ProcessorStripSpace(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "preserve-space", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ elementsAttr }, new ProcessorPreserveSpace(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "output", null /*alias */, null /* elements */, new XSLTAttributeDef[]{ methodAttr, versionAttr, encodingAttr, omitXmlDeclarationAttr, standaloneAttr, doctypePublicAttr, doctypeSystemAttr, cdataSectionElementsAttr, indentAttr, mediaTypeAttr, XSLTAttributeDef.m_foreignAttr }, new ProcessorOutputElem(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "key", null /*alias */, null /* elements */, // EMPTY new XSLTAttributeDef[]{ nameAttrRequired, matchAttrRequired, useAttr }, new ProcessorKey(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "decimal-format", null /*alias */, null /* elements */, // EMPTY new XSLTAttributeDef[]{ nameAttrOpt_ERROR, decimalSeparatorAttr, groupingSeparatorAttr, infinityAttr, minusSignAttr, NaNAttr, percentAttr, perMilleAttr, zeroDigitAttr, digitAttr, patternSeparatorAttr }, new ProcessorDecimalFormat(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "attribute-set", null /*alias */, new XSLTElementDef[]{ xslAttribute } /* elements */, new XSLTAttributeDef[]{ nameAttrRequired, useAttributeSetsAttr }, new ProcessorAttributeSet(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "variable", null /*alias */, templateElements /* elements */, new XSLTAttributeDef[]{ nameAttrRequired, selectAttrOpt }, new ProcessorGlobalVariableDecl(), ElemVariable.class /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "param", null /*alias */, templateElements /* elements */, new XSLTAttributeDef[]{ nameAttrRequired, selectAttrOpt }, new ProcessorGlobalParamDecl(), ElemParam.class /* class object */, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "template", null /*alias */, templateElementsAndParams /* elements */, new XSLTAttributeDef[]{ matchAttrOpt, nameAttrOpt_ERROR, priorityAttr, modeAttr, spaceAttr }, new ProcessorTemplate(), ElemTemplate.class /* class object */, true, 20, true), new XSLTElementDef( this, Constants.S_XSLNAMESPACEURL, "namespace-alias", null /*alias */, null /* elements */, // EMPTY new XSLTAttributeDef[]{ stylesheetPrefixAttr, resultPrefixAttr }, new ProcessorNamespaceAlias(), null /* class object */, 20, true), new XSLTElementDef( this, Constants.S_BUILTIN_EXTENSIONS_URL, "component", null /*alias */, new XSLTElementDef[]{ new XSLTElementDef( this, Constants.S_BUILTIN_EXTENSIONS_URL, "script", null /*alias */, new XSLTElementDef[]{ charData } /* elements */, scriptAttrs, new ProcessorLRE(), ElemExtensionScript.class /* class object */, 20, true) }, // EMPTY componentAttrs, new ProcessorLRE(), ElemExtensionDecl.class /* class object */), new XSLTElementDef( this, Constants.S_BUILTIN_OLD_EXTENSIONS_URL, "component", null /*alias */, new XSLTElementDef[]{ new XSLTElementDef( this, Constants.S_BUILTIN_OLD_EXTENSIONS_URL, "script", null /*alias */, new XSLTElementDef[]{ charData } /* elements */, scriptAttrs, new ProcessorLRE(), ElemExtensionScript.class /* class object */, 20, true) }, // EMPTY componentAttrs, new ProcessorLRE(), ElemExtensionDecl.class /* class object */), exsltFunction}/* exslt */; //end of topevelElements XSLTAttributeDef excludeResultPrefixesAttr = new XSLTAttributeDef(null, "exclude-result-prefixes", XSLTAttributeDef.T_PREFIXLIST, false,false,XSLTAttributeDef.WARNING); XSLTAttributeDef extensionElementPrefixesAttr = new XSLTAttributeDef(null, "extension-element-prefixes", XSLTAttributeDef.T_PREFIX_URLLIST, false,false,XSLTAttributeDef.WARNING); XSLTAttributeDef idAttr = new XSLTAttributeDef(null, "id", XSLTAttributeDef.T_CDATA, false,false,XSLTAttributeDef.WARNING); XSLTAttributeDef versionAttrRequired = new XSLTAttributeDef(null, "version", XSLTAttributeDef.T_NMTOKEN, true,false,XSLTAttributeDef.WARNING); XSLTElementDef stylesheetElemDef = new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "stylesheet", "transform", topLevelElements, new XSLTAttributeDef[]{ extensionElementPrefixesAttr, excludeResultPrefixesAttr, idAttr, versionAttrRequired, spaceAttr }, new ProcessorStylesheetElement(), /* ContentHandler */ null /* class object */, true, -1, false); importDef.setElements(new XSLTElementDef[]{ stylesheetElemDef, resultElement, unknownElement }); includeDef.setElements(new XSLTElementDef[]{ stylesheetElemDef, resultElement, unknownElement }); build(null, null, null, new XSLTElementDef[]{ stylesheetElemDef, whiteSpaceOnly, resultElement, unknownElement }, null, new ProcessorStylesheetDoc(), /* ContentHandler */ null /* class object */ ); } /** * A hashtable of all available built-in elements for use by the element-available * function. * TODO: When we convert to Java2, this should be a Set. */ private HashMap m_availElems = new HashMap(); /** * Get the table of available elements. * * @return table of available elements, keyed by qualified names, and with * values of the same qualified names. */ public HashMap getElemsAvailable() { return m_availElems; } /** * Adds a new element name to the Hashtable of available elements. * @param elemName The name of the element to add to the Hashtable of available elements. */ void addAvailableElement(QName elemName) { m_availElems.put(elemName, elemName); } /** * Determines whether the passed element name is present in the list of available elements. * @param elemName The name of the element to look up. * * @return true if an element corresponding to elemName is available. */ public boolean elementAvailable(QName elemName) { return m_availElems.containsKey(elemName); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/XSLProcessorVersion.java0000644000175000017500000001014410721374031025776 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLProcessorVersion.src 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; /** * Administrative class to keep track of the version number of * the Xalan release. *

        See also: org/apache/xalan/res/XSLTInfo.properties

        * @deprecated To be replaced by org.apache.xalan.Version.getVersion() * @xsl.usage general */ public class XSLProcessorVersion { /** * Print the processor version to the command line. * * @param argv command line arguments, unused. */ public static void main(String argv[]) { System.out.println(S_VERSION); } /** * Constant name of product. */ public static final String PRODUCT = "Xalan"; /** * Implementation Language. */ public static final String LANGUAGE = "Java"; /** * Major version number. * Version number. This changes only when there is a * significant, externally apparent enhancement from * the previous release. 'n' represents the n'th * version. * * Clients should carefully consider the implications * of new versions as external interfaces and behaviour * may have changed. */ public static final int VERSION = 2; /** * Release Number. * Release number. This changes when: * - a new set of functionality is to be added, eg, * implementation of a new W3C specification. * - API or behaviour change. * - its designated as a reference release. */ public static final int RELEASE = 7; /** * Maintenance Drop Number. * Optional identifier used to designate maintenance * drop applied to a specific release and contains * fixes for defects reported. It maintains compatibility * with the release and contains no API changes. * When missing, it designates the final and complete * development drop for a release. */ public static final int MAINTENANCE = 1; /** * Development Drop Number. * Optional identifier designates development drop of * a specific release. D01 is the first development drop * of a new release. * * Development drops are works in progress towards a * compeleted, final release. A specific development drop * may not completely implement all aspects of a new * feature, which may take several development drops to * complete. At the point of the final drop for the * release, the D suffix will be omitted. * * Each 'D' drops can contain functional enhancements as * well as defect fixes. 'D' drops may not be as stable as * the final releases. */ public static final int DEVELOPMENT = 0; /** * Version String like "Xalan Language * v.r[.dd| Dnn]". *

        Semantics of the version string are identical to the Xerces project.

        */ public static final String S_VERSION = PRODUCT+" "+LANGUAGE+" " +VERSION+"."+RELEASE+"." +(DEVELOPMENT > 0 ? ("D"+DEVELOPMENT) : (""+MAINTENANCE)); } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorUnknown.java0000644000175000017500000000253110721374033025424 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorUnknown.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.xml.sax.Attributes; /** * This class processes an unknown template element. It is used both * for unknown top-level elements, and for elements in the * xslt namespace when the version is higher than the version * of XSLT that we are set up to process. * @xsl.usage internal */ public class ProcessorUnknown extends ProcessorLRE { static final long serialVersionUID = 600521151487682248L; } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorTemplateElem.java0000644000175000017500000001147110721374031026344 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorTemplateElem.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.ElemTemplateElement; import org.xml.sax.Attributes; /** * This class processes parse events for an XSLT template element. * @see XSLT DTD * @see section-Creating-the-Result-Tree in XSLT Specification */ public class ProcessorTemplateElem extends XSLTElementProcessor { static final long serialVersionUID = 8344994001943407235L; /** * Receive notification of the start of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param attributes The specified or defaulted attributes. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { super.startElement(handler, uri, localName, rawName, attributes); try { // ElemTemplateElement parent = handler.getElemTemplateElement(); XSLTElementDef def = getElemDef(); Class classObject = def.getClassObject(); ElemTemplateElement elem = null; try { elem = (ElemTemplateElement) classObject.newInstance(); elem.setDOMBackPointer(handler.getOriginatingNode()); elem.setLocaterInfo(handler.getLocator()); elem.setPrefixes(handler.getNamespaceSupport()); } catch (InstantiationException ie) { handler.error(XSLTErrorResources.ER_FAILED_CREATING_ELEMTMPL, null, ie);//"Failed creating ElemTemplateElement instance!", ie); } catch (IllegalAccessException iae) { handler.error(XSLTErrorResources.ER_FAILED_CREATING_ELEMTMPL, null, iae);//"Failed creating ElemTemplateElement instance!", iae); } setPropertiesFromAttributes(handler, rawName, attributes, elem); appendAndPush(handler, elem); } catch(TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem non-null reference to a the current template element. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { ElemTemplateElement parent = handler.getElemTemplateElement(); if(null != parent) // defensive, for better multiple error reporting. -sb { parent.appendChild(elem); handler.pushElemTemplateElement(elem); } } /** * Receive notification of the end of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { super.endElement(handler, uri, localName, rawName); handler.popElemTemplateElement().setEndLocaterInfo(handler.getLocator()); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/StylesheetHandler.java0000644000175000017500000015010610721374031025514 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: StylesheetHandler.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.util.Stack; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.SourceLocator; import javax.xml.transform.Templates; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.sax.TemplatesHandler; import org.apache.xalan.extensions.ExpressionVisitor; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemForEach; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.StylesheetRoot; import org.apache.xml.utils.BoolStack; import org.apache.xml.utils.NamespaceSupport2; import org.apache.xml.utils.NodeConsumer; import org.apache.xml.utils.PrefixResolver; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xml.utils.XMLCharacterRecognizer; import org.apache.xpath.XPath; import org.apache.xpath.compiler.FunctionTable; import org.apache.xpath.functions.Function; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.NamespaceSupport; /** * Initializes and processes a stylesheet via SAX events. * This class acts as essentially a state machine, maintaining * a ContentHandler stack, and pushing appropriate content * handlers as parse events occur. * @xsl.usage advanced */ public class StylesheetHandler extends DefaultHandler implements TemplatesHandler, PrefixResolver, NodeConsumer { /** * The function table of XPath and XSLT; */ private FunctionTable m_funcTable = new FunctionTable(); /** * The flag for the setting of the optimize feature; */ private boolean m_optimize = true; /** * The flag for the setting of the incremental feature; */ private boolean m_incremental = false; /** * The flag for the setting of the source_location feature; */ private boolean m_source_location = false; /** * Create a StylesheetHandler object, creating a root stylesheet * as the target. * * @param processor non-null reference to the transformer factory that owns this handler. * * @throws TransformerConfigurationException if a StylesheetRoot * can not be constructed for some reason. */ public StylesheetHandler(TransformerFactoryImpl processor) throws TransformerConfigurationException { Class func = org.apache.xalan.templates.FuncDocument.class; m_funcTable.installFunction("document", func); // func = new org.apache.xalan.templates.FuncKey(); // FunctionTable.installFunction("key", func); func = org.apache.xalan.templates.FuncFormatNumb.class; m_funcTable.installFunction("format-number", func); m_optimize =((Boolean) processor.getAttribute( TransformerFactoryImpl.FEATURE_OPTIMIZE)).booleanValue(); m_incremental = ((Boolean) processor.getAttribute( TransformerFactoryImpl.FEATURE_INCREMENTAL)).booleanValue(); m_source_location = ((Boolean) processor.getAttribute( TransformerFactoryImpl.FEATURE_SOURCE_LOCATION)).booleanValue(); // m_schema = new XSLTSchema(); init(processor); } /** * Do common initialization. * * @param processor non-null reference to the transformer factory that owns this handler. */ void init(TransformerFactoryImpl processor) { m_stylesheetProcessor = processor; // Set the initial content handler. m_processors.push(m_schema.getElementProcessor()); this.pushNewNamespaceSupport(); // m_includeStack.push(SystemIDResolver.getAbsoluteURI(this.getBaseIdentifier(), null)); // initXPath(processor, null); } /** * Process an expression string into an XPath. * Must be public for access by the AVT class. * * @param str A non-null reference to a valid or invalid XPath expression string. * * @return A non-null reference to an XPath object that represents the string argument. * * @throws javax.xml.transform.TransformerException if the expression can not be processed. * @see Section 4 Expressions in XSLT Specification */ public XPath createXPath(String str, ElemTemplateElement owningTemplate) throws javax.xml.transform.TransformerException { ErrorListener handler = m_stylesheetProcessor.getErrorListener(); XPath xpath = new XPath(str, owningTemplate, this, XPath.SELECT, handler, m_funcTable); // Visit the expression, registering namespaces for any extension functions it includes. xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot())); return xpath; } /** * Process an expression string into an XPath. * * @param str A non-null reference to a valid or invalid match pattern string. * * @return A non-null reference to an XPath object that represents the string argument. * * @throws javax.xml.transform.TransformerException if the pattern can not be processed. * @see Section 5.2 Patterns in XSLT Specification */ XPath createMatchPatternXPath(String str, ElemTemplateElement owningTemplate) throws javax.xml.transform.TransformerException { ErrorListener handler = m_stylesheetProcessor.getErrorListener(); XPath xpath = new XPath(str, owningTemplate, this, XPath.MATCH, handler, m_funcTable); // Visit the expression, registering namespaces for any extension functions it includes. xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot())); return xpath; } /** * Given a namespace, get the corrisponding prefix from the current * namespace support context. * * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. * * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. */ public String getNamespaceForPrefix(String prefix) { return this.getNamespaceSupport().getURI(prefix); } /** * Given a namespace, get the corrisponding prefix. This is here only * to support the {@link org.apache.xml.utils.PrefixResolver} interface, * and will throw an error if invoked on this object. * * @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. * @param context The node context from which to look up the URI. * * @return The associated Namespace URI, or null if the prefix * is undeclared in this context. */ public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { // Don't need to support this here. Return the current URI for the prefix, // ignoring the context. assertion(true, "can't process a context node in StylesheetHandler!"); return null; } /** * Utility function to see if the stack contains the given URL. * * @param stack non-null reference to a Stack. * @param url URL string on which an equality test will be performed. * * @return true if the stack contains the url argument. */ private boolean stackContains(Stack stack, String url) { int n = stack.size(); boolean contains = false; for (int i = 0; i < n; i++) { String url2 = (String) stack.elementAt(i); if (url2.equals(url)) { contains = true; break; } } return contains; } //////////////////////////////////////////////////////////////////// // Implementation of the TRAX TemplatesBuilder interface. //////////////////////////////////////////////////////////////////// /** * When this object is used as a ContentHandler or ContentHandler, it will * create a Templates object, which the caller can get once * the SAX events have been completed. * @return The stylesheet object that was created during * the SAX event process, or null if no stylesheet has * been created. * * Author Scott Boag * * */ public Templates getTemplates() { return getStylesheetRoot(); } /** * Set the base ID (URL or system ID) for the stylesheet * created by this builder. This must be set in order to * resolve relative URLs in the stylesheet. * * @param baseID Base URL for this stylesheet. */ public void setSystemId(String baseID) { pushBaseIndentifier(baseID); } /** * Get the base ID (URI or system ID) from where relative * URLs will be resolved. * * @return The systemID that was set with {@link #setSystemId}. */ public String getSystemId() { return this.getBaseIdentifier(); } //////////////////////////////////////////////////////////////////// // Implementation of the EntityResolver interface. //////////////////////////////////////////////////////////////////// /** * Resolve an external entity. * * @param publicId The public identifer, or null if none is * available. * @param systemId The system identifier provided in the XML * document. * @return The new input source, or null to require the * default behaviour. * * @throws org.xml.sax.SAXException if the entity can not be resolved. */ public InputSource resolveEntity(String publicId, String systemId) throws org.xml.sax.SAXException { return getCurrentProcessor().resolveEntity(this, publicId, systemId); } //////////////////////////////////////////////////////////////////// // Implementation of DTDHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive notification of a notation declaration. * *

        By default, do nothing. Application writers may override this * method in a subclass if they wish to keep track of the notations * declared in a document.

        * * @param name The notation name. * @param publicId The notation public identifier, or null if not * available. * @param systemId The notation system identifier. * @see org.xml.sax.DTDHandler#notationDecl */ public void notationDecl(String name, String publicId, String systemId) { getCurrentProcessor().notationDecl(this, name, publicId, systemId); } /** * Receive notification of an unparsed entity declaration. * * @param name The entity name. * @param publicId The entity public identifier, or null if not * available. * @param systemId The entity system identifier. * @param notationName The name of the associated notation. * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) { getCurrentProcessor().unparsedEntityDecl(this, name, publicId, systemId, notationName); } /** * Given a namespace URI, and a local name or a node type, get the processor * for the element, or return null if not allowed. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * * @return A non-null reference to a element processor. * * @throws org.xml.sax.SAXException if the element is not allowed in the * found position in the stylesheet. */ XSLTElementProcessor getProcessorFor( String uri, String localName, String rawName) throws org.xml.sax.SAXException { XSLTElementProcessor currentProcessor = getCurrentProcessor(); XSLTElementDef def = currentProcessor.getElemDef(); XSLTElementProcessor elemProcessor = def.getProcessorFor(uri, localName); if (null == elemProcessor && !(currentProcessor instanceof ProcessorStylesheetDoc) && ((null == getStylesheet() || Double.valueOf(getStylesheet().getVersion()).doubleValue() > Constants.XSLTVERSUPPORTED) ||(!uri.equals(Constants.S_XSLNAMESPACEURL) && currentProcessor instanceof ProcessorStylesheetElement) || getElemVersion() > Constants.XSLTVERSUPPORTED )) { elemProcessor = def.getProcessorForUnknown(uri, localName); } if (null == elemProcessor) error(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_ALLOWED_IN_POSITION, new Object[]{rawName}),null);//rawName + " is not allowed in this position in the stylesheet!", return elemProcessor; } //////////////////////////////////////////////////////////////////// // Implementation of ContentHandler interface. //////////////////////////////////////////////////////////////////// /** * Receive a Locator object for document events. * This is called by the parser to push a locator for the * stylesheet being parsed. The stack needs to be popped * after the stylesheet has been parsed. We pop in * popStylesheet. * * @param locator A locator for all SAX document events. * @see org.xml.sax.ContentHandler#setDocumentLocator * @see org.xml.sax.Locator */ public void setDocumentLocator(Locator locator) { // System.out.println("pushing locator for: "+locator.getSystemId()); m_stylesheetLocatorStack.push(new SAXSourceLocator(locator)); } /** * The level of the stylesheet we are at. */ private int m_stylesheetLevel = -1; /** * Receive notification of the beginning of the document. * * @see org.xml.sax.ContentHandler#startDocument * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void startDocument() throws org.xml.sax.SAXException { m_stylesheetLevel++; pushSpaceHandling(false); } /** m_parsingComplete becomes true when the top-level stylesheet and all * its included/imported stylesheets have been been fully parsed, as an * indication that composition/optimization/compilation can begin. * @see isStylesheetParsingComplete */ private boolean m_parsingComplete = false; /** * Test whether the _last_ endDocument() has been processed. * This is needed as guidance for stylesheet optimization * and compilation engines, which generally don't want to start * until all included and imported stylesheets have been fully * parsed. * * @return true iff the complete stylesheet tree has been built. */ public boolean isStylesheetParsingComplete() { return m_parsingComplete; } /** * Receive notification of the end of the document. * * @see org.xml.sax.ContentHandler#endDocument * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void endDocument() throws org.xml.sax.SAXException { try { if (null != getStylesheetRoot()) { if (0 == m_stylesheetLevel) getStylesheetRoot().recompose(); } else throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEETROOT, null)); //"Did not find the stylesheet root!"); XSLTElementProcessor elemProcessor = getCurrentProcessor(); if (null != elemProcessor) elemProcessor.startNonText(this); m_stylesheetLevel--; popSpaceHandling(); // WARNING: This test works only as long as stylesheets are parsed // more or less recursively. If we switch to an iterative "work-list" // model, this will become true prematurely. In that case, // isStylesheetParsingComplete() will have to be adjusted to be aware // of the worklist. m_parsingComplete = (m_stylesheetLevel < 0); } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } private java.util.Vector m_prefixMappings = new java.util.Vector(); /** * Receive notification of the start of a Namespace mapping. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each element (such as allocating a new tree node or writing * output to a file).

        * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI mapped to the prefix. * @see org.xml.sax.ContentHandler#startPrefixMapping * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { // m_nsSupport.pushContext(); // this.getNamespaceSupport().declarePrefix(prefix, uri); //m_prefixMappings.add(prefix); // JDK 1.2+ only -sc //m_prefixMappings.add(uri); // JDK 1.2+ only -sc m_prefixMappings.addElement(prefix); // JDK 1.1.x compat -sc m_prefixMappings.addElement(uri); // JDK 1.1.x compat -sc } /** * Receive notification of the end of a Namespace mapping. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions at the start of * each element (such as allocating a new tree node or writing * output to a file).

        * * @param prefix The Namespace prefix being declared. * @see org.xml.sax.ContentHandler#endPrefixMapping * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException { // m_nsSupport.popContext(); } /** * Flush the characters buffer. * * @throws org.xml.sax.SAXException */ private void flushCharacters() throws org.xml.sax.SAXException { XSLTElementProcessor elemProcessor = getCurrentProcessor(); if (null != elemProcessor) elemProcessor.startNonText(this); } /** * Receive notification of the start of an element. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param attributes The specified or defaulted attributes. * * @throws org.xml.sax.SAXException */ public void startElement( String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { NamespaceSupport nssupport = this.getNamespaceSupport(); nssupport.pushContext(); int n = m_prefixMappings.size(); for (int i = 0; i < n; i++) { String prefix = (String)m_prefixMappings.elementAt(i++); String nsURI = (String)m_prefixMappings.elementAt(i); nssupport.declarePrefix(prefix, nsURI); } //m_prefixMappings.clear(); // JDK 1.2+ only -sc m_prefixMappings.removeAllElements(); // JDK 1.1.x compat -sc m_elementID++; // This check is currently done for all elements. We should possibly consider // limiting this check to xsl:stylesheet elements only since that is all it really // applies to. Also, it could be bypassed if m_shouldProcess is already true. // In other words, the next two statements could instead look something like this: // if (!m_shouldProcess) // { // if (localName.equals(Constants.ELEMNAME_STYLESHEET_STRING) && // url.equals(Constants.S_XSLNAMESPACEURL)) // { // checkForFragmentID(attributes); // if (!m_shouldProcess) // return; // } // else // return; // } // I didn't include this code statement at this time because in practice // it is a small performance hit and I was waiting to see if its absence // caused a problem. - GLP checkForFragmentID(attributes); if (!m_shouldProcess) return; flushCharacters(); pushSpaceHandling(attributes); XSLTElementProcessor elemProcessor = getProcessorFor(uri, localName, rawName); if(null != elemProcessor) // defensive, for better multiple error reporting. -sb { this.pushProcessor(elemProcessor); elemProcessor.startElement(this, uri, localName, rawName, attributes); } else { m_shouldProcess = false; popSpaceHandling(); } } /** * Receive notification of the end of an element. * * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @see org.xml.sax.ContentHandler#endElement * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void endElement(String uri, String localName, String rawName) throws org.xml.sax.SAXException { m_elementID--; if (!m_shouldProcess) return; if ((m_elementID + 1) == m_fragmentID) m_shouldProcess = false; flushCharacters(); popSpaceHandling(); XSLTElementProcessor p = getCurrentProcessor(); p.endElement(this, uri, localName, rawName); this.popProcessor(); this.getNamespaceSupport().popContext(); } /** * Receive notification of character data inside an element. * * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @see org.xml.sax.ContentHandler#characters * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void characters(char ch[], int start, int length) throws org.xml.sax.SAXException { if (!m_shouldProcess) return; XSLTElementProcessor elemProcessor = getCurrentProcessor(); XSLTElementDef def = elemProcessor.getElemDef(); if (def.getType() != XSLTElementDef.T_PCDATA) elemProcessor = def.getProcessorFor(null, "text()"); if (null == elemProcessor) { // If it's whitespace, just ignore it, otherwise flag an error. if (!XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) error( XSLMessages.createMessage(XSLTErrorResources.ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, null),null);//"Non-whitespace text is not allowed in this position in the stylesheet!", } else elemProcessor.characters(this, ch, start, length); } /** * Receive notification of ignorable whitespace in element content. * * @param ch The whitespace characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. * @see org.xml.sax.ContentHandler#ignorableWhitespace * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void ignorableWhitespace(char ch[], int start, int length) throws org.xml.sax.SAXException { if (!m_shouldProcess) return; getCurrentProcessor().ignorableWhitespace(this, ch, start, length); } /** * Receive notification of a processing instruction. * *

        The Parser will invoke this method once for each processing * instruction found: note that processing instructions may occur * before or after the main document element.

        * *

        A SAX parser should never report an XML declaration (XML 1.0, * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.

        * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.

        * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. * @see org.xml.sax.ContentHandler#processingInstruction * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { if (!m_shouldProcess) return; // Recreating Scott's kluge: // A xsl:for-each or xsl:apply-templates may have a special // PI that tells us not to cache the document. This PI // should really be namespaced. // String localName = getLocalName(target); // String ns = m_stylesheet.getNamespaceFromStack(target); // // %REVIEW%: We need a better PI architecture String prefix="",ns="", localName=target; int colon=target.indexOf(':'); if(colon>=0) { ns=getNamespaceForPrefix(prefix=target.substring(0,colon)); localName=target.substring(colon+1); } try { // A xsl:for-each or xsl:apply-templates may have a special // PI that tells us not to cache the document. This PI // should really be namespaced... but since the XML Namespaces // spec never defined namespaces as applying to PI's, and since // the testcase we're trying to support is inconsistant in whether // it binds the prefix, I'm going to make this sloppy for // testing purposes. if( "xalan-doc-cache-off".equals(target) || "xalan:doc-cache-off".equals(target) || ("doc-cache-off".equals(localName) && ns.equals("org.apache.xalan.xslt.extensions.Redirect") ) ) { if(!(m_elems.peek() instanceof ElemForEach)) throw new TransformerException ("xalan:doc-cache-off not allowed here!", getLocator()); ElemForEach elem = (ElemForEach)m_elems.peek(); elem.m_doc_cache_off = true; //System.out.println("JJK***** Recognized "); } } catch(Exception e) { // JJK: Officially, unknown PIs can just be ignored. // Do we want to issue a warning? } flushCharacters(); getCurrentProcessor().processingInstruction(this, target, data); } /** * Receive notification of a skipped entity. * *

        By default, do nothing. Application writers may override this * method in a subclass to take specific actions for each * processing instruction, such as setting status variables or * invoking other methods.

        * * @param name The name of the skipped entity. * @see org.xml.sax.ContentHandler#processingInstruction * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void skippedEntity(String name) throws org.xml.sax.SAXException { if (!m_shouldProcess) return; getCurrentProcessor().skippedEntity(this, name); } /** * Warn the user of an problem. * * @param msg An key into the {@link org.apache.xalan.res.XSLTErrorResources} * table, that is one of the WG_ prefixed definitions. * @param args An array of arguments for the given warning. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the current * {@link javax.xml.transform.ErrorListener#warning} * method chooses to flag this condition as an error. * @xsl.usage internal */ public void warn(String msg, Object args[]) throws org.xml.sax.SAXException { String formattedMsg = XSLMessages.createWarning(msg, args); SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { if (null != handler) handler.warning(new TransformerException(formattedMsg, locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Assert that a condition is true. If it is not true, throw an error. * * @param condition false if an error should not be thrown, otherwise true. * @param msg Error message to be passed to the RuntimeException as an * argument. * @throws RuntimeException if the condition is not true. * @xsl.usage internal */ private void assertion(boolean condition, String msg) throws RuntimeException { if (!condition) throw new RuntimeException(msg); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg An error message. * @param e An error which the SAXException should wrap. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the current * {@link javax.xml.transform.ErrorListener#error} * method chooses to flag this condition as an error. * @xsl.usage internal */ protected void error(String msg, Exception e) throws org.xml.sax.SAXException { SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); TransformerException pe; if (!(e instanceof TransformerException)) { pe = (null == e) ? new TransformerException(msg, locator) : new TransformerException(msg, locator, e); } else pe = (TransformerException) e; if (null != handler) { try { handler.error(pe); } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } else throw new org.xml.sax.SAXException(pe); } /** * Tell the user of an error, and probably throw an * exception. * * @param msg A key into the {@link org.apache.xalan.res.XSLTErrorResources} * table, that is one of the WG_ prefixed definitions. * @param args An array of arguments for the given warning. * @param e An error which the SAXException should wrap. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the current * {@link javax.xml.transform.ErrorListener#error} * method chooses to flag this condition as an error. * @xsl.usage internal */ protected void error(String msg, Object args[], Exception e) throws org.xml.sax.SAXException { String formattedMsg = XSLMessages.createMessage(msg, args); error(formattedMsg, e); } /** * Receive notification of a XSLT processing warning. * * @param e The warning information encoded as an exception. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the current * {@link javax.xml.transform.ErrorListener#warning} * method chooses to flag this condition as an error. */ public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException { String formattedMsg = e.getMessage(); SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { handler.warning(new TransformerException(formattedMsg, locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Receive notification of a recoverable XSLT processing error. * * @param e The error information encoded as an exception. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the current * {@link javax.xml.transform.ErrorListener#error} * method chooses to flag this condition as an error. */ public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException { String formattedMsg = e.getMessage(); SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { handler.error(new TransformerException(formattedMsg, locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Report a fatal XSLT processing error. * * @param e The error information encoded as an exception. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the current * {@link javax.xml.transform.ErrorListener#fatalError} * method chooses to flag this condition as an error. */ public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException { String formattedMsg = e.getMessage(); SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { handler.fatalError(new TransformerException(formattedMsg, locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * If we have a URL to a XML fragment, this is set * to false until the ID is found. * (warning: I worry that this should be in a stack). */ private boolean m_shouldProcess = true; /** * If we have a URL to a XML fragment, the value is stored * in this string, and the m_shouldProcess flag is set to * false until we match an ID with this string. * (warning: I worry that this should be in a stack). */ private String m_fragmentIDString; /** * Keep track of the elementID, so we can tell when * is has completed. This isn't a real ID, but rather * a nesting level. However, it's good enough for * our purposes. * (warning: I worry that this should be in a stack). */ private int m_elementID = 0; /** * The ID of the fragment that has been found * (warning: I worry that this should be in a stack). */ private int m_fragmentID = 0; /** * Check to see if an ID attribute matched the #id, called * from startElement. * * @param attributes The specified or defaulted attributes. */ private void checkForFragmentID(Attributes attributes) { if (!m_shouldProcess) { if ((null != attributes) && (null != m_fragmentIDString)) { int n = attributes.getLength(); for (int i = 0; i < n; i++) { String name = attributes.getQName(i); if (name.equals(Constants.ATTRNAME_ID)) { String val = attributes.getValue(i); if (val.equalsIgnoreCase(m_fragmentIDString)) { m_shouldProcess = true; m_fragmentID = m_elementID; } } } } } } /** * The XSLT TransformerFactory for needed services. */ private TransformerFactoryImpl m_stylesheetProcessor; /** * Get the XSLT TransformerFactoryImpl for needed services. * TODO: This method should be renamed. * * @return The TransformerFactoryImpl that owns this handler. */ public TransformerFactoryImpl getStylesheetProcessor() { return m_stylesheetProcessor; } /** * If getStylesheetType returns this value, the current stylesheet * is a root stylesheet. * @xsl.usage internal */ public static final int STYPE_ROOT = 1; /** * If getStylesheetType returns this value, the current stylesheet * is an included stylesheet. * @xsl.usage internal */ public static final int STYPE_INCLUDE = 2; /** * If getStylesheetType returns this value, the current stylesheet * is an imported stylesheet. * @xsl.usage internal */ public static final int STYPE_IMPORT = 3; /** The current stylesheet type. */ private int m_stylesheetType = STYPE_ROOT; /** * Get the type of stylesheet that should be built * or is being processed. * * @return one of STYPE_ROOT, STYPE_INCLUDE, or STYPE_IMPORT. */ int getStylesheetType() { return m_stylesheetType; } /** * Set the type of stylesheet that should be built * or is being processed. * * @param type Must be one of STYPE_ROOT, STYPE_INCLUDE, or STYPE_IMPORT. */ void setStylesheetType(int type) { m_stylesheetType = type; } /** * The stack of stylesheets being processed. */ private Stack m_stylesheets = new Stack(); /** * Return the stylesheet that this handler is constructing. * * @return The current stylesheet that is on top of the stylesheets stack, * or null if no stylesheet is on the stylesheets stack. */ Stylesheet getStylesheet() { return (m_stylesheets.size() == 0) ? null : (Stylesheet) m_stylesheets.peek(); } /** * Return the last stylesheet that was popped off the stylesheets stack. * * @return The last popped stylesheet, or null. */ Stylesheet getLastPoppedStylesheet() { return m_lastPoppedStylesheet; } /** * Return the stylesheet root that this handler is constructing. * * @return The root stylesheet of the stylesheets tree. */ public StylesheetRoot getStylesheetRoot() { if (m_stylesheetRoot != null){ m_stylesheetRoot.setOptimizer(m_optimize); m_stylesheetRoot.setIncremental(m_incremental); m_stylesheetRoot.setSource_location(m_source_location); } return m_stylesheetRoot; } /** The root stylesheet of the stylesheets tree. */ StylesheetRoot m_stylesheetRoot; /** The last stylesheet that was popped off the stylesheets stack. */ Stylesheet m_lastPoppedStylesheet; /** * Push the current stylesheet being constructed. If no other stylesheets * have been pushed onto the stack, assume the argument is a stylesheet * root, and also set the stylesheet root member. * * @param s non-null reference to a stylesheet. */ public void pushStylesheet(Stylesheet s) { if (m_stylesheets.size() == 0) m_stylesheetRoot = (StylesheetRoot) s; m_stylesheets.push(s); } /** * Pop the last stylesheet pushed, and return the stylesheet that this * handler is constructing, and set the last popped stylesheet member. * Also pop the stylesheet locator stack. * * @return The stylesheet popped off the stack, or the last popped stylesheet. */ Stylesheet popStylesheet() { // The stylesheetLocatorStack needs to be popped because // a locator was pushed in for this stylesheet by the SAXparser by calling // setDocumentLocator(). if (!m_stylesheetLocatorStack.isEmpty()) m_stylesheetLocatorStack.pop(); if (!m_stylesheets.isEmpty()) m_lastPoppedStylesheet = (Stylesheet) m_stylesheets.pop(); // Shouldn't this be null if stylesheets is empty? -sb return m_lastPoppedStylesheet; } /** * The stack of current processors. */ private Stack m_processors = new Stack(); /** * Get the current XSLTElementProcessor at the top of the stack. * * @return Valid XSLTElementProcessor, which should never be null. */ XSLTElementProcessor getCurrentProcessor() { return (XSLTElementProcessor) m_processors.peek(); } /** * Push the current XSLTElementProcessor onto the top of the stack. * * @param processor non-null reference to the current element processor. */ void pushProcessor(XSLTElementProcessor processor) { m_processors.push(processor); } /** * Pop the current XSLTElementProcessor from the top of the stack. * @return the XSLTElementProcessor which was popped. */ XSLTElementProcessor popProcessor() { return (XSLTElementProcessor) m_processors.pop(); } /** * The root of the XSLT Schema, which tells us how to * transition content handlers, create elements, etc. * For the moment at least, this can't be static, since * the processors store state. */ private XSLTSchema m_schema = new XSLTSchema(); /** * Get the root of the XSLT Schema, which tells us how to * transition content handlers, create elements, etc. * * @return The root XSLT Schema, which should never be null. * @xsl.usage internal */ public XSLTSchema getSchema() { return m_schema; } /** * The stack of elements, pushed and popped as events occur. */ private Stack m_elems = new Stack(); /** * Get the current ElemTemplateElement at the top of the stack. * @return Valid ElemTemplateElement, which may be null. */ ElemTemplateElement getElemTemplateElement() { try { return (ElemTemplateElement) m_elems.peek(); } catch (java.util.EmptyStackException ese) { return null; } } /** An increasing number that is used to indicate the order in which this element * was encountered during the parse of the XSLT tree. */ private int m_docOrderCount = 0; /** * Returns the next m_docOrderCount number and increments the number for future use. */ int nextUid() { return m_docOrderCount++; } /** * Push the current XSLTElementProcessor to the top of the stack. As a * side-effect, set the document order index (simply because this is a * convenient place to set it). * * @param elem Should be a non-null reference to the intended current * template element. */ void pushElemTemplateElement(ElemTemplateElement elem) { if (elem.getUid() == -1) elem.setUid(nextUid()); m_elems.push(elem); } /** * Get the current XSLTElementProcessor from the top of the stack. * @return the ElemTemplateElement which was popped. */ ElemTemplateElement popElemTemplateElement() { return (ElemTemplateElement) m_elems.pop(); } /** * This will act as a stack to keep track of the * current include base. */ Stack m_baseIdentifiers = new Stack(); /** * Push a base identifier onto the base URI stack. * * @param baseID The current base identifier for this position in the * stylesheet, which may be a fragment identifier, or which may be null. * @see * Section 3.2 Base URI of XSLT specification. */ void pushBaseIndentifier(String baseID) { if (null != baseID) { int posOfHash = baseID.indexOf('#'); if (posOfHash > -1) { m_fragmentIDString = baseID.substring(posOfHash + 1); m_shouldProcess = false; } else m_shouldProcess = true; } else m_shouldProcess = true; m_baseIdentifiers.push(baseID); } /** * Pop a base URI from the stack. * @return baseIdentifier. */ String popBaseIndentifier() { return (String) m_baseIdentifiers.pop(); } /** * Return the base identifier. * * @return The base identifier of the current stylesheet. */ public String getBaseIdentifier() { // Try to get the baseIdentifier from the baseIdentifier's stack, // which may not be the same thing as the value found in the // SourceLocators stack. String base = (String) (m_baseIdentifiers.isEmpty() ? null : m_baseIdentifiers.peek()); // Otherwise try the stylesheet. if (null == base) { SourceLocator locator = getLocator(); base = (null == locator) ? "" : locator.getSystemId(); } return base; } /** * The top of this stack should contain the currently processed * stylesheet SAX locator object. */ private Stack m_stylesheetLocatorStack = new Stack(); /** * Get the current stylesheet Locator object. * * @return non-null reference to the current locator object. */ public SAXSourceLocator getLocator() { if (m_stylesheetLocatorStack.isEmpty()) { SAXSourceLocator locator = new SAXSourceLocator(); locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID()); return locator; // m_stylesheetLocatorStack.push(locator); } return ((SAXSourceLocator) m_stylesheetLocatorStack.peek()); } /** * A stack of URL hrefs for imported stylesheets. This is * used to diagnose circular imports. */ private Stack m_importStack = new Stack(); /** * A stack of Source objects obtained from a URIResolver, * for each element in this stack there is a 1-1 correspondence * with an element in the m_importStack. */ private Stack m_importSourceStack = new Stack(); /** * Push an import href onto the stylesheet stack. * * @param hrefUrl non-null reference to the URL for the current imported * stylesheet. */ void pushImportURL(String hrefUrl) { m_importStack.push(hrefUrl); } /** * Push the Source of an import href onto the stylesheet stack, * obtained from a URIResolver, null if there is no URIResolver, * or if that resolver returned null. */ void pushImportSource(Source sourceFromURIResolver) { m_importSourceStack.push(sourceFromURIResolver); } /** * See if the imported stylesheet stack already contains * the given URL. Used to test for recursive imports. * * @param hrefUrl non-null reference to a URL string. * * @return true if the URL is on the import stack. */ boolean importStackContains(String hrefUrl) { return stackContains(m_importStack, hrefUrl); } /** * Pop an import href from the stylesheet stack. * * @return non-null reference to the import URL that was popped. */ String popImportURL() { return (String) m_importStack.pop(); } String peekImportURL() { return (String) m_importStack.peek(); } Source peekSourceFromURIResolver() { return (Source) m_importSourceStack.peek(); } /** * Pop a Source from a user provided URIResolver, corresponding * to the URL popped from the m_importStack. */ Source popImportSource() { return (Source) m_importSourceStack.pop(); } /** * If this is set to true, we've already warned about using the * older XSLT namespace URL. */ private boolean warnedAboutOldXSLTNamespace = false; /** Stack of NamespaceSupport objects. */ Stack m_nsSupportStack = new Stack(); /** * Push a new NamespaceSupport instance. */ void pushNewNamespaceSupport() { m_nsSupportStack.push(new NamespaceSupport2()); } /** * Pop the current NamespaceSupport object. * */ void popNamespaceSupport() { m_nsSupportStack.pop(); } /** * Get the current NamespaceSupport object. * * @return a non-null reference to the current NamespaceSupport object, * which is the top of the namespace support stack. */ NamespaceSupport getNamespaceSupport() { return (NamespaceSupport) m_nsSupportStack.peek(); } /** * The originating node if the current stylesheet is being created * from a DOM. * @see org.apache.xml.utils.NodeConsumer */ private Node m_originatingNode; /** * Set the node that is originating the SAX event. * * @param n Reference to node that originated the current event. * @see org.apache.xml.utils.NodeConsumer */ public void setOriginatingNode(Node n) { m_originatingNode = n; } /** * Set the node that is originating the SAX event. * * @return Reference to node that originated the current event. * @see org.apache.xml.utils.NodeConsumer */ public Node getOriginatingNode() { return m_originatingNode; } /** * Stack of booleans that are pushed and popped in start/endElement depending * on the value of xml:space=default/preserve. */ private BoolStack m_spacePreserveStack = new BoolStack(); /** * Return boolean value from the spacePreserve stack depending on the value * of xml:space=default/preserve. * * @return true if space should be preserved, false otherwise. */ boolean isSpacePreserve() { return m_spacePreserveStack.peek(); } /** * Pop boolean value from the spacePreserve stack. */ void popSpaceHandling() { m_spacePreserveStack.pop(); } /** * Push boolean value on to the spacePreserve stack. * * @param b true if space should be preserved, false otherwise. */ void pushSpaceHandling(boolean b) throws org.xml.sax.SAXParseException { m_spacePreserveStack.push(b); } /** * Push boolean value on to the spacePreserve stack depending on the value * of xml:space=default/preserve. * * @param attrs list of attributes that were passed to startElement. */ void pushSpaceHandling(Attributes attrs) throws org.xml.sax.SAXParseException { String value = attrs.getValue("xml:space"); if(null == value) { m_spacePreserveStack.push(m_spacePreserveStack.peekOrFalse()); } else if(value.equals("preserve")) { m_spacePreserveStack.push(true); } else if(value.equals("default")) { m_spacePreserveStack.push(false); } else { SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { handler.error(new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_XMLSPACE_VALUE, null), locator)); //"Illegal value for xml:space", locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXParseException(te.getMessage(), locator, te); } m_spacePreserveStack.push(m_spacePreserveStack.peek()); } } private double getElemVersion() { ElemTemplateElement elem = getElemTemplateElement(); double version = -1; while ((version == -1 || version == Constants.XSLTVERSUPPORTED) && elem != null) { try{ version = Double.valueOf(elem.getXmlVersion()).doubleValue(); } catch (Exception ex) { version = -1; } elem = elem.getParentElem(); } return (version == -1)? Constants.XSLTVERSUPPORTED : version; } /** * @see PrefixResolver#handlesNullPrefixes() */ public boolean handlesNullPrefixes() { return false; } /** * @return Optimization flag */ public boolean getOptimize() { return m_optimize; } /** * @return Incremental flag */ public boolean getIncremental() { return m_incremental; } /** * @return Source Location flag */ public boolean getSource_location() { return m_source_location; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorInclude.java0000644000175000017500000003313610721374030025352 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorInclude.java 469349 2006-10-31 03:06:50Z minchau $ */ package org.apache.xalan.processor; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xml.utils.SystemIDResolver; import org.apache.xml.utils.TreeWalker; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * TransformerFactory class for xsl:include markup. * @see XSLT DTD * @see include in XSLT Specification * * @xsl.usage internal */ public class ProcessorInclude extends XSLTElementProcessor { static final long serialVersionUID = -4570078731972673481L; /** * The base URL of the XSL document. * @serial */ private String m_href = null; /** * Get the base identifier with which this stylesheet is associated. * * @return non-null reference to the href attribute string, or * null if setHref has not been called. */ public String getHref() { return m_href; } /** * Get the base identifier with which this stylesheet is associated. * * @param baseIdent Should be a non-null reference to a valid URL string. */ public void setHref(String baseIdent) { // Validate? m_href = baseIdent; } /** * Get the stylesheet type associated with an included stylesheet * * @return the type of the stylesheet */ protected int getStylesheetType() { return StylesheetHandler.STYPE_INCLUDE; } /** * Get the error number associated with this type of stylesheet including itself * * @return the appropriate error number */ protected String getStylesheetInclErr() { return XSLTErrorResources.ER_STYLESHEET_INCLUDES_ITSELF; } /** * Receive notification of the start of an xsl:include element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { setPropertiesFromAttributes(handler, rawName, attributes, this); try { // Get the Source from the user's URIResolver (if any). Source sourceFromURIResolver = getSourceFromUriResolver(handler); // Get the system ID of the included/imported stylesheet module String hrefUrl = getBaseURIOfIncludedStylesheet(handler, sourceFromURIResolver); if (handler.importStackContains(hrefUrl)) { throw new org.xml.sax.SAXException( XSLMessages.createMessage( getStylesheetInclErr(), new Object[]{ hrefUrl })); //"(StylesheetHandler) "+hrefUrl+" is directly or indirectly importing itself!"); } // Push the system ID and corresponding Source // on some stacks for later retrieval during parse() time. handler.pushImportURL(hrefUrl); handler.pushImportSource(sourceFromURIResolver); int savedStylesheetType = handler.getStylesheetType(); handler.setStylesheetType(this.getStylesheetType()); handler.pushNewNamespaceSupport(); try { parse(handler, uri, localName, rawName, attributes); } finally { handler.setStylesheetType(savedStylesheetType); handler.popImportURL(); handler.popImportSource(); handler.popNamespaceSupport(); } } catch(TransformerException te) { handler.error(te.getMessage(), te); } } /** * Set off a new parse for an included or imported stylesheet. This will * set the {@link StylesheetHandler} to a new state, and recurse in with * a new set of parse events. Once this function returns, the state of * the StylesheetHandler should be restored. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, which should be the XSLT namespace. * @param localName The local name (without prefix), which should be "include" or "import". * @param rawName The qualified name (with prefix). * @param attributes The list of attributes on the xsl:include or xsl:import element. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void parse( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { TransformerFactoryImpl processor = handler.getStylesheetProcessor(); URIResolver uriresolver = processor.getURIResolver(); try { Source source = null; // The base identifier, an aboslute URI // that is associated with the included/imported // stylesheet module is known in this method, // so this method does the pushing of the // base ID onto the stack. if (null != uriresolver) { // There is a user provided URI resolver. // At the startElement() call we would // have tried to obtain a Source from it // which we now retrieve source = handler.peekSourceFromURIResolver(); if (null != source && source instanceof DOMSource) { Node node = ((DOMSource)source).getNode(); // There is a user provided URI resolver. // At the startElement() call we would // have already pushed the system ID, obtained // from either the source.getSystemId(), if non-null // or from SystemIDResolver.getAbsoluteURI() as a backup // which we now retrieve. String systemId = handler.peekImportURL(); // Push the absolute URI of the included/imported // stylesheet module onto the stack. if (systemId != null) handler.pushBaseIndentifier(systemId); TreeWalker walker = new TreeWalker(handler, new org.apache.xml.utils.DOM2Helper(), systemId); try { walker.traverse(node); } catch(org.xml.sax.SAXException se) { throw new TransformerException(se); } if (systemId != null) handler.popBaseIndentifier(); return; } } if(null == source) { String absURL = SystemIDResolver.getAbsoluteURI(getHref(), handler.getBaseIdentifier()); source = new StreamSource(absURL); } // possible callback to a class that over-rides this method. source = processSource(handler, source); XMLReader reader = null; if(source instanceof SAXSource) { SAXSource saxSource = (SAXSource)source; reader = saxSource.getXMLReader(); // may be null } InputSource inputSource = SAXSource.sourceToInputSource(source); if (null == reader) { // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory= javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware( true ); if (handler.getStylesheetProcessor().isSecureProcessing()) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException se) {} } javax.xml.parsers.SAXParser jaxpParser= factory.newSAXParser(); reader=jaxpParser.getXMLReader(); } catch( javax.xml.parsers.ParserConfigurationException ex ) { throw new org.xml.sax.SAXException( ex ); } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { throw new org.xml.sax.SAXException( ex1.toString() ); } catch( NoSuchMethodError ex2 ) { } catch (AbstractMethodError ame){} } if (null == reader) reader = XMLReaderFactory.createXMLReader(); if (null != reader) { reader.setContentHandler(handler); // Push the absolute URI of the included/imported // stylesheet module onto the stack. handler.pushBaseIndentifier(inputSource.getSystemId()); try { reader.parse(inputSource); } finally { handler.popBaseIndentifier(); } } } catch (IOException ioe) { handler.error(XSLTErrorResources.ER_IOEXCEPTION, new Object[]{ getHref() }, ioe); } catch(TransformerException te) { handler.error(te.getMessage(), te); } } /** * This method does nothing, but a class that extends this class could * over-ride it and do some processing of the source. * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param source The source of the included stylesheet. * @return the same or an equivalent source to what was passed in. */ protected Source processSource(StylesheetHandler handler, Source source) { return source; } /** * Get the Source object for the included or imported stylesheet module * obtained from the user's URIResolver, if there is no user provided * URIResolver null is returned. */ private Source getSourceFromUriResolver(StylesheetHandler handler) throws TransformerException { Source s = null; TransformerFactoryImpl processor = handler.getStylesheetProcessor(); URIResolver uriresolver = processor.getURIResolver(); if (uriresolver != null) { String href = getHref(); String base = handler.getBaseIdentifier(); s = uriresolver.resolve(href,base); } return s; } /** * Get the base URI of the included or imported stylesheet, * if the user provided a URIResolver, then get the Source * object for the stylsheet from it, and get the systemId * from that Source object, otherwise try to recover by * using the SysteIDResolver to figure out the base URI. * @param handler The handler that processes the stylesheet as SAX events, * and maintains state * @param s The Source object from a URIResolver, for the included stylesheet module, * so this will be null if there is no URIResolver set. */ private String getBaseURIOfIncludedStylesheet(StylesheetHandler handler, Source s) throws TransformerException { String baseURI; String idFromUriResolverSource; if (s != null && (idFromUriResolverSource = s.getSystemId()) != null) { // We have a Source obtained from a users's URIResolver, // and the system ID is set on it, so return that as the base URI baseURI = idFromUriResolverSource; } else { // The user did not provide a URIResolver, or it did not // return a Source for the included stylesheet module, or // the Source has no system ID set, so we fall back to using // the system ID Resolver to take the href and base // to generate the baseURI of the included stylesheet. baseURI = SystemIDResolver.getAbsoluteURI(getHref(), handler .getBaseIdentifier()); } return baseURI; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/TransformerFactoryImpl.java0000644000175000017500000010161610721374030026542 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: TransformerFactoryImpl.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.Properties; import javax.xml.XMLConstants; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TemplatesHandler; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.transformer.TrAXFilter; import org.apache.xalan.transformer.TransformerIdentityImpl; import org.apache.xalan.transformer.TransformerImpl; import org.apache.xalan.transformer.XalanProperties; import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM; import org.apache.xml.utils.DefaultErrorHandler; import org.apache.xml.utils.SystemIDResolver; import org.apache.xml.utils.TreeWalker; import org.apache.xml.utils.StylesheetPIHandler; import org.apache.xml.utils.StopParseException; import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.XMLFilter; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * The TransformerFactoryImpl, which implements the TRaX TransformerFactory * interface, processes XSLT stylesheets into a Templates object * (a StylesheetRoot). */ public class TransformerFactoryImpl extends SAXTransformerFactory { /** * The path/filename of the property file: XSLTInfo.properties * Maintenance note: see also * org.apache.xpath.functions.FuncSystemProperty.XSLT_PROPERTIES */ public static final String XSLT_PROPERTIES = "org/apache/xalan/res/XSLTInfo.properties"; /** *

        State of secure processing feature.

        */ private boolean m_isSecureProcessing = false; /** * Constructor TransformerFactoryImpl * */ public TransformerFactoryImpl() { } /** Static string to be used for incremental feature */ public static final String FEATURE_INCREMENTAL = "http://xml.apache.org/xalan/features/incremental"; /** Static string to be used for optimize feature */ public static final String FEATURE_OPTIMIZE = "http://xml.apache.org/xalan/features/optimize"; /** Static string to be used for source_location feature */ public static final String FEATURE_SOURCE_LOCATION = XalanProperties.SOURCE_LOCATION; public javax.xml.transform.Templates processFromNode(Node node) throws TransformerConfigurationException { try { TemplatesHandler builder = newTemplatesHandler(); TreeWalker walker = new TreeWalker(builder, new org.apache.xml.utils.DOM2Helper(), builder.getSystemId()); walker.traverse(node); return builder.getTemplates(); } catch (org.xml.sax.SAXException se) { if (m_errorListener != null) { try { m_errorListener.fatalError(new TransformerException(se)); } catch (TransformerConfigurationException ex) { throw ex; } catch (TransformerException ex) { throw new TransformerConfigurationException(ex); } return null; } else { // Should remove this later... but right now diagnostics from // TransformerConfigurationException are not good. // se.printStackTrace(); throw new TransformerConfigurationException(XSLMessages.createMessage(XSLTErrorResources.ER_PROCESSFROMNODE_FAILED, null), se); //"processFromNode failed", se); } } catch (TransformerConfigurationException tce) { // Assume it's already been reported to the error listener. throw tce; } /* catch (TransformerException tce) { // Assume it's already been reported to the error listener. throw new TransformerConfigurationException(tce.getMessage(), tce); }*/ catch (Exception e) { if (m_errorListener != null) { try { m_errorListener.fatalError(new TransformerException(e)); } catch (TransformerConfigurationException ex) { throw ex; } catch (TransformerException ex) { throw new TransformerConfigurationException(ex); } return null; } else { // Should remove this later... but right now diagnostics from // TransformerConfigurationException are not good. // se.printStackTrace(); throw new TransformerConfigurationException(XSLMessages.createMessage(XSLTErrorResources.ER_PROCESSFROMNODE_FAILED, null), e); //"processFromNode failed", //e); } } } /** * The systemID that was specified in * processFromNode(Node node, String systemID). */ private String m_DOMsystemID = null; /** * The systemID that was specified in * processFromNode(Node node, String systemID). * * @return The systemID, or null. */ String getDOMsystemID() { return m_DOMsystemID; } /** * Process the stylesheet from a DOM tree, if the * processor supports the "http://xml.org/trax/features/dom/input" * feature. * * @param node A DOM tree which must contain * valid transform instructions that this processor understands. * @param systemID The systemID from where xsl:includes and xsl:imports * should be resolved from. * * @return A Templates object capable of being used for transformation purposes. * * @throws TransformerConfigurationException */ javax.xml.transform.Templates processFromNode(Node node, String systemID) throws TransformerConfigurationException { m_DOMsystemID = systemID; return processFromNode(node); } /** * Get InputSource specification(s) that are associated with the * given document specified in the source param, * via the xml-stylesheet processing instruction * (see http://www.w3.org/TR/xml-stylesheet/), and that matches * the given criteria. Note that it is possible to return several stylesheets * that match the criteria, in which case they are applied as if they were * a list of imports or cascades. * *

        Note that DOM2 has it's own mechanism for discovering stylesheets. * Therefore, there isn't a DOM version of this method.

        * * * @param source The XML source that is to be searched. * @param media The media attribute to be matched. May be null, in which * case the prefered templates will be used (i.e. alternate = no). * @param title The value of the title attribute to match. May be null. * @param charset The value of the charset attribute to match. May be null. * * @return A Source object capable of being used to create a Templates object. * * @throws TransformerConfigurationException */ public Source getAssociatedStylesheet( Source source, String media, String title, String charset) throws TransformerConfigurationException { String baseID; InputSource isource = null; Node node = null; XMLReader reader = null; if (source instanceof DOMSource) { DOMSource dsource = (DOMSource) source; node = dsource.getNode(); baseID = dsource.getSystemId(); } else { isource = SAXSource.sourceToInputSource(source); baseID = isource.getSystemId(); } // What I try to do here is parse until the first startElement // is found, then throw a special exception in order to terminate // the parse. StylesheetPIHandler handler = new StylesheetPIHandler(baseID, media, title, charset); // Use URIResolver. Patch from Dmitri Ilyin if (m_uriResolver != null) { handler.setURIResolver(m_uriResolver); } try { if (null != node) { TreeWalker walker = new TreeWalker(handler, new org.apache.xml.utils.DOM2Helper(), baseID); walker.traverse(node); } else { // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware(true); if (m_isSecureProcessing) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException e) {} } javax.xml.parsers.SAXParser jaxpParser = factory.newSAXParser(); reader = jaxpParser.getXMLReader(); } catch (javax.xml.parsers.ParserConfigurationException ex) { throw new org.xml.sax.SAXException(ex); } catch (javax.xml.parsers.FactoryConfigurationError ex1) { throw new org.xml.sax.SAXException(ex1.toString()); } catch (NoSuchMethodError ex2){} catch (AbstractMethodError ame){} if (null == reader) { reader = XMLReaderFactory.createXMLReader(); } // Need to set options! reader.setContentHandler(handler); reader.parse(isource); } } catch (StopParseException spe) { // OK, good. } catch (org.xml.sax.SAXException se) { throw new TransformerConfigurationException( "getAssociatedStylesheets failed", se); } catch (IOException ioe) { throw new TransformerConfigurationException( "getAssociatedStylesheets failed", ioe); } return handler.getAssociatedStylesheet(); } /** * Create a new Transformer object that performs a copy * of the source to the result. * * @return A Transformer object that may be used to perform a transformation * in a single thread, never null. * * @throws TransformerConfigurationException May throw this during * the parse when it is constructing the * Templates object and fails. */ public TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException { return new StylesheetHandler(this); } /** *

        Set a feature for this TransformerFactory and Transformers * or Templates created by this factory.

        * *

        * Feature names are fully qualified {@link java.net.URI}s. * Implementations may define their own features. * An {@link TransformerConfigurationException} is thrown if this TransformerFactory or the * Transformers or Templates it creates cannot support the feature. * It is possible for an TransformerFactory to expose a feature value but be unable to change its state. *

        * *

        See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.

        * * @param name Feature name. * @param value Is feature state true or false. * * @throws TransformerConfigurationException if this TransformerFactory * or the Transformers or Templates it creates cannot support this feature. * @throws NullPointerException If the name parameter is null. */ public void setFeature(String name, boolean value) throws TransformerConfigurationException { // feature name cannot be null if (name == null) { throw new NullPointerException( XSLMessages.createMessage( XSLTErrorResources.ER_SET_FEATURE_NULL_NAME, null)); } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { m_isSecureProcessing = value; } // This implementation does not support the setting of a feature other than // the secure processing feature. else { throw new TransformerConfigurationException( XSLMessages.createMessage( XSLTErrorResources.ER_UNSUPPORTED_FEATURE, new Object[] {name})); } } /** * Look up the value of a feature. *

        The feature name is any fully-qualified URI. It is * possible for an TransformerFactory to recognize a feature name but * to be unable to return its value; this is especially true * in the case of an adapter for a SAX1 Parser, which has * no way of knowing whether the underlying parser is * validating, for example.

        * * @param name The feature name, which is a fully-qualified URI. * @return The current state of the feature (true or false). */ public boolean getFeature(String name) { // feature name cannot be null if (name == null) { throw new NullPointerException( XSLMessages.createMessage( XSLTErrorResources.ER_GET_FEATURE_NULL_NAME, null)); } // Try first with identity comparison, which // will be faster. if ((DOMResult.FEATURE == name) || (DOMSource.FEATURE == name) || (SAXResult.FEATURE == name) || (SAXSource.FEATURE == name) || (StreamResult.FEATURE == name) || (StreamSource.FEATURE == name) || (SAXTransformerFactory.FEATURE == name) || (SAXTransformerFactory.FEATURE_XMLFILTER == name)) return true; else if ((DOMResult.FEATURE.equals(name)) || (DOMSource.FEATURE.equals(name)) || (SAXResult.FEATURE.equals(name)) || (SAXSource.FEATURE.equals(name)) || (StreamResult.FEATURE.equals(name)) || (StreamSource.FEATURE.equals(name)) || (SAXTransformerFactory.FEATURE.equals(name)) || (SAXTransformerFactory.FEATURE_XMLFILTER.equals(name))) return true; // secure processing? else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) return m_isSecureProcessing; else // unknown feature return false; } /** * Flag set by FEATURE_OPTIMIZE. * This feature specifies whether to Optimize stylesheet processing. By * default it is set to true. */ private boolean m_optimize = true; /** Flag set by FEATURE_SOURCE_LOCATION. * This feature specifies whether the transformation phase should * keep track of line and column numbers for the input source * document. Note that this works only when that * information is available from the source -- in other words, if you * pass in a DOM, there's little we can do for you. * * The default is false. Setting it true may significantly * increase storage cost per node. */ private boolean m_source_location = false; /** * Flag set by FEATURE_INCREMENTAL. * This feature specifies whether to produce output incrementally, rather than * waiting to finish parsing the input before generating any output. By * default this attribute is set to false. */ private boolean m_incremental = false; /** * Allows the user to set specific attributes on the underlying * implementation. * * @param name The name of the attribute. * @param value The value of the attribute; Boolean or String="true"|"false" * * @throws IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ public void setAttribute(String name, Object value) throws IllegalArgumentException { if (name.equals(FEATURE_INCREMENTAL)) { if(value instanceof Boolean) { // Accept a Boolean object.. m_incremental = ((Boolean)value).booleanValue(); } else if(value instanceof String) { // .. or a String object m_incremental = (new Boolean((String)value)).booleanValue(); } else { // Give a more meaningful error message throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value); } } else if (name.equals(FEATURE_OPTIMIZE)) { if(value instanceof Boolean) { // Accept a Boolean object.. m_optimize = ((Boolean)value).booleanValue(); } else if(value instanceof String) { // .. or a String object m_optimize = (new Boolean((String)value)).booleanValue(); } else { // Give a more meaningful error message throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value); } } // Custom Xalan feature: annotate DTM with SAX source locator fields. // This gets used during SAX2DTM instantiation. // // %REVIEW% Should the name of this field really be in XalanProperties? // %REVIEW% I hate that it's a global static, but didn't want to change APIs yet. else if(name.equals(FEATURE_SOURCE_LOCATION)) { if(value instanceof Boolean) { // Accept a Boolean object.. m_source_location = ((Boolean)value).booleanValue(); } else if(value instanceof String) { // .. or a String object m_source_location = (new Boolean((String)value)).booleanValue(); } else { // Give a more meaningful error message throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value); } } else { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUPPORTED, new Object[]{name})); //name + "not supported"); } } /** * Allows the user to retrieve specific attributes on the underlying * implementation. * * @param name The name of the attribute. * @return value The value of the attribute. * * @throws IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ public Object getAttribute(String name) throws IllegalArgumentException { if (name.equals(FEATURE_INCREMENTAL)) { return new Boolean(m_incremental); } else if (name.equals(FEATURE_OPTIMIZE)) { return new Boolean(m_optimize); } else if (name.equals(FEATURE_SOURCE_LOCATION)) { return new Boolean(m_source_location); } else throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_ATTRIB_VALUE_NOT_RECOGNIZED, new Object[]{name})); //name + " attribute not recognized"); } /** * Create an XMLFilter that uses the given source as the * transformation instructions. * * @param src The source of the transformation instructions. * * @return An XMLFilter object, or null if this feature is not supported. * * @throws TransformerConfigurationException */ public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException { Templates templates = newTemplates(src); if( templates==null ) return null; return newXMLFilter(templates); } /** * Create an XMLFilter that uses the given source as the * transformation instructions. * * @param templates non-null reference to Templates object. * * @return An XMLFilter object, or null if this feature is not supported. * * @throws TransformerConfigurationException */ public XMLFilter newXMLFilter(Templates templates) throws TransformerConfigurationException { try { return new TrAXFilter(templates); } catch( TransformerConfigurationException ex ) { if( m_errorListener != null) { try { m_errorListener.fatalError( ex ); return null; } catch( TransformerConfigurationException ex1 ) { throw ex1; } catch( TransformerException ex1 ) { throw new TransformerConfigurationException(ex1); } } throw ex; } } /** * Get a TransformerHandler object that can process SAX * ContentHandler events into a Result, based on the transformation * instructions specified by the argument. * * @param src The source of the transformation instructions. * * @return TransformerHandler ready to transform SAX events. * * @throws TransformerConfigurationException */ public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException { Templates templates = newTemplates(src); if( templates==null ) return null; return newTransformerHandler(templates); } /** * Get a TransformerHandler object that can process SAX * ContentHandler events into a Result, based on the Templates argument. * * @param templates The source of the transformation instructions. * * @return TransformerHandler ready to transform SAX events. * @throws TransformerConfigurationException */ public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException { try { TransformerImpl transformer = (TransformerImpl) templates.newTransformer(); transformer.setURIResolver(m_uriResolver); TransformerHandler th = (TransformerHandler) transformer.getInputContentHandler(true); return th; } catch( TransformerConfigurationException ex ) { if( m_errorListener != null ) { try { m_errorListener.fatalError( ex ); return null; } catch (TransformerConfigurationException ex1 ) { throw ex1; } catch (TransformerException ex1 ) { throw new TransformerConfigurationException(ex1); } } throw ex; } } // /** The identity transform string, for support of newTransformerHandler() // * and newTransformer(). */ // private static final String identityTransform = // "" + "" // + "" + "" + ""; // // /** The identity transform Templates, built from identityTransform, // * for support of newTransformerHandler() and newTransformer(). */ // private static Templates m_identityTemplate = null; /** * Get a TransformerHandler object that can process SAX * ContentHandler events into a Result. * * @return TransformerHandler ready to transform SAX events. * * @throws TransformerConfigurationException */ public TransformerHandler newTransformerHandler() throws TransformerConfigurationException { return new TransformerIdentityImpl(m_isSecureProcessing); } /** * Process the source into a Transformer object. Care must * be given to know that this object can not be used concurrently * in multiple threads. * * @param source An object that holds a URL, input stream, etc. * * @return A Transformer object capable of * being used for transformation purposes in a single thread. * * @throws TransformerConfigurationException May throw this during the parse when it * is constructing the Templates object and fails. */ public Transformer newTransformer(Source source) throws TransformerConfigurationException { try { Templates tmpl=newTemplates( source ); /* this can happen if an ErrorListener is present and it doesn't throw any exception in fatalError. The spec says: "a Transformer must use this interface instead of throwing an exception" - the newTemplates() does that, and returns null. */ if( tmpl==null ) return null; Transformer transformer = tmpl.newTransformer(); transformer.setURIResolver(m_uriResolver); return transformer; } catch( TransformerConfigurationException ex ) { if( m_errorListener != null ) { try { m_errorListener.fatalError( ex ); return null; } catch( TransformerConfigurationException ex1 ) { throw ex1; } catch( TransformerException ex1 ) { throw new TransformerConfigurationException( ex1 ); } } throw ex; } } /** * Create a new Transformer object that performs a copy * of the source to the result. * * @return A Transformer object capable of * being used for transformation purposes in a single thread. * * @throws TransformerConfigurationException May throw this during * the parse when it is constructing the * Templates object and it fails. */ public Transformer newTransformer() throws TransformerConfigurationException { return new TransformerIdentityImpl(m_isSecureProcessing); } /** * Process the source into a Templates object, which is likely * a compiled representation of the source. This Templates object * may then be used concurrently across multiple threads. Creating * a Templates object allows the TransformerFactory to do detailed * performance optimization of transformation instructions, without * penalizing runtime transformation. * * @param source An object that holds a URL, input stream, etc. * @return A Templates object capable of being used for transformation purposes. * * @throws TransformerConfigurationException May throw this during the parse when it * is constructing the Templates object and fails. */ public Templates newTemplates(Source source) throws TransformerConfigurationException { String baseID = source.getSystemId(); if (null != baseID) { baseID = SystemIDResolver.getAbsoluteURI(baseID); } if (source instanceof DOMSource) { DOMSource dsource = (DOMSource) source; Node node = dsource.getNode(); if (null != node) return processFromNode(node, baseID); else { String messageStr = XSLMessages.createMessage( XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null); throw new IllegalArgumentException(messageStr); } } TemplatesHandler builder = newTemplatesHandler(); builder.setSystemId(baseID); try { InputSource isource = SAXSource.sourceToInputSource(source); isource.setSystemId(baseID); XMLReader reader = null; if (source instanceof SAXSource) reader = ((SAXSource) source).getXMLReader(); if (null == reader) { // Use JAXP1.1 ( if possible ) try { javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance(); factory.setNamespaceAware(true); if (m_isSecureProcessing) { try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (org.xml.sax.SAXException se) {} } javax.xml.parsers.SAXParser jaxpParser = factory.newSAXParser(); reader = jaxpParser.getXMLReader(); } catch (javax.xml.parsers.ParserConfigurationException ex) { throw new org.xml.sax.SAXException(ex); } catch (javax.xml.parsers.FactoryConfigurationError ex1) { throw new org.xml.sax.SAXException(ex1.toString()); } catch (NoSuchMethodError ex2){} catch (AbstractMethodError ame){} } if (null == reader) reader = XMLReaderFactory.createXMLReader(); // If you set the namespaces to true, we'll end up getting double // xmlns attributes. Needs to be fixed. -sb // reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); reader.setContentHandler(builder); reader.parse(isource); } catch (org.xml.sax.SAXException se) { if (m_errorListener != null) { try { m_errorListener.fatalError(new TransformerException(se)); } catch (TransformerConfigurationException ex1) { throw ex1; } catch (TransformerException ex1) { throw new TransformerConfigurationException(ex1); } } else { throw new TransformerConfigurationException(se.getMessage(), se); } } catch (Exception e) { if (m_errorListener != null) { try { m_errorListener.fatalError(new TransformerException(e)); return null; } catch (TransformerConfigurationException ex1) { throw ex1; } catch (TransformerException ex1) { throw new TransformerConfigurationException(ex1); } } else { throw new TransformerConfigurationException(e.getMessage(), e); } } return builder.getTemplates(); } /** * The object that implements the URIResolver interface, * or null. */ URIResolver m_uriResolver; /** * Set an object that will be used to resolve URIs used in * xsl:import, etc. This will be used as the default for the * transformation. * @param resolver An object that implements the URIResolver interface, * or null. */ public void setURIResolver(URIResolver resolver) { m_uriResolver = resolver; } /** * Get the object that will be used to resolve URIs used in * xsl:import, etc. This will be used as the default for the * transformation. * * @return The URIResolver that was set with setURIResolver. */ public URIResolver getURIResolver() { return m_uriResolver; } /** The error listener. */ private ErrorListener m_errorListener = new org.apache.xml.utils.DefaultErrorHandler(false); /** * Get the error listener in effect for the TransformerFactory. * * @return A non-null reference to an error listener. */ public ErrorListener getErrorListener() { return m_errorListener; } /** * Set an error listener for the TransformerFactory. * * @param listener Must be a non-null reference to an ErrorListener. * * @throws IllegalArgumentException if the listener argument is null. */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { if (null == listener) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_ERRORLISTENER, null)); // "ErrorListener"); m_errorListener = listener; } /** * Return the state of the secure processing feature. * * @return state of the secure processing feature. */ public boolean isSecureProcessing() { return m_isSecureProcessing; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorStylesheetElement.java0000644000175000017500000001224510721374032027432 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorStylesheetElement.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.StylesheetComposed; import org.apache.xalan.templates.StylesheetRoot; import org.xml.sax.Attributes; /** * TransformerFactory for xsl:stylesheet or xsl:transform markup. * @see XSLT DTD * @see stylesheet-element in XSLT Specification * * @xsl.usage internal */ public class ProcessorStylesheetElement extends XSLTElementProcessor { static final long serialVersionUID = -877798927447840792L; /** * Receive notification of the start of an strip-space element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { super.startElement(handler, uri, localName, rawName, attributes); try { int stylesheetType = handler.getStylesheetType(); Stylesheet stylesheet; if (stylesheetType == StylesheetHandler.STYPE_ROOT) { try { stylesheet = getStylesheetRoot(handler); } catch(TransformerConfigurationException tfe) { throw new TransformerException(tfe); } } else { Stylesheet parent = handler.getStylesheet(); if (stylesheetType == StylesheetHandler.STYPE_IMPORT) { StylesheetComposed sc = new StylesheetComposed(parent); parent.setImport(sc); stylesheet = sc; } else { stylesheet = new Stylesheet(parent); parent.setInclude(stylesheet); } } stylesheet.setDOMBackPointer(handler.getOriginatingNode()); stylesheet.setLocaterInfo(handler.getLocator()); stylesheet.setPrefixes(handler.getNamespaceSupport()); handler.pushStylesheet(stylesheet); setPropertiesFromAttributes(handler, rawName, attributes, handler.getStylesheet()); handler.pushElemTemplateElement(handler.getStylesheet()); } catch(TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * This method can be over-ridden by a class that extends this one. * @param handler The calling StylesheetHandler/TemplatesBuilder. */ protected Stylesheet getStylesheetRoot(StylesheetHandler handler) throws TransformerConfigurationException { StylesheetRoot stylesheet; stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener()); if (handler.getStylesheetProcessor().isSecureProcessing()) stylesheet.setSecureProcessing(true); return stylesheet; } /** * Receive notification of the end of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { super.endElement(handler, uri, localName, rawName); handler.popElemTemplateElement(); handler.popStylesheet(); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorText.java0000644000175000017500000000604610721374030024713 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorText.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemText; /** * Process xsl:text. * @see XSLT DTD * @see element-text in XSLT Specification */ public class ProcessorText extends ProcessorTemplateElem { static final long serialVersionUID = 5170229307201307523L; /** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem non-null reference to a {@link org.apache.xalan.templates.ElemText}. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { // Don't push this element onto the element stack. ProcessorCharacters charProcessor = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text"); charProcessor.setXslTextElement((ElemText) elem); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(elem); elem.setDOMBackPointer(handler.getOriginatingNode()); } /** * Receive notification of the end of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { ProcessorCharacters charProcessor = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text"); charProcessor.setXslTextElement(null); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorGlobalVariableDecl.java0000644000175000017500000000572310721374030027426 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorGlobalVariableDecl.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemVariable; /** * This class processes parse events for an xsl:variable element. * @see XSLT DTD * @see top-level-variables in XSLT Specification */ class ProcessorGlobalVariableDecl extends ProcessorTemplateElem { static final long serialVersionUID = -5954332402269819582L; /** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem The non-null reference to the ElemVariable element. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { // Just push, but don't append. handler.pushElemTemplateElement(elem); } /** * Receive notification of the end of an element. * * @param name The element type name. * @param attributes The specified or defaulted attributes. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { ElemVariable v = (ElemVariable) handler.getElemTemplateElement(); handler.getStylesheet().appendChild(v); handler.getStylesheet().setVariable(v); super.endElement(handler, uri, localName, rawName); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorStylesheetDoc.java0000644000175000017500000000231710721374032026545 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorStylesheetDoc.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; /** * This class processes the xsl:stylesheet element. At the * moment, it defers all methods to it's superclass. * @xsl.usage internal */ public class ProcessorStylesheetDoc extends XSLTElementProcessor { static final long serialVersionUID = -1661497592836231844L; } libxalan2-java-2.7.1/src/org/apache/xalan/processor/WhitespaceInfoPaths.java0000644000175000017500000000446210721374030025777 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: WhitespaceInfoPaths.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.util.Vector; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.WhiteSpaceInfo; public class WhitespaceInfoPaths extends WhiteSpaceInfo { static final long serialVersionUID = 5954766719577516723L; /** * Bean property to allow setPropertiesFromAttributes to * get the elements attribute. */ private Vector m_elements; /** * Set from the elements attribute. This is a list of * whitespace delimited element qualified names that specify * preservation of whitespace. * * @param elems Should be a non-null reference to a list * of {@link org.apache.xpath.XPath} objects. */ public void setElements(Vector elems) { m_elements = elems; } /** * Get the property set by setElements(). This is a list of * whitespace delimited element qualified names that specify * preservation of whitespace. * * @return A reference to a list of {@link org.apache.xpath.XPath} objects, * or null. */ Vector getElements() { return m_elements; } public void clearElements() { m_elements = null; } /** * Constructor WhitespaceInfoPaths * * @param thisSheet The current stylesheet */ public WhitespaceInfoPaths(Stylesheet thisSheet) { super(thisSheet); setStylesheet(thisSheet); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorExsltFuncResult.java0000644000175000017500000000516310721374033027103 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorExsltFuncResult.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.ElemExsltFuncResult; import org.apache.xalan.templates.ElemExsltFunction; import org.apache.xalan.templates.ElemParam; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemVariable; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * This class processes parse events for an exslt func:result element. * @xsl.usage internal */ public class ProcessorExsltFuncResult extends ProcessorTemplateElem { static final long serialVersionUID = 6451230911473482423L; /** * Verify that the func:result element does not appear within a variable, * parameter, or another func:result, and that it belongs to a func:function * element. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws SAXException { String msg = ""; super.startElement(handler, uri, localName, rawName, attributes); ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem(); while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) { if (ancestor instanceof ElemVariable || ancestor instanceof ElemParam || ancestor instanceof ElemExsltFuncResult) { msg = "func:result cannot appear within a variable, parameter, or another func:result."; handler.error(msg, new SAXException(msg)); } ancestor = ancestor.getParentElem(); } if (ancestor == null) { msg = "func:result must appear in a func:function element"; handler.error(msg, new SAXException(msg)); } } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorExsltFunction.java0000644000175000017500000001552510721374030026576 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorExsltFunction.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.ElemApplyImport; import org.apache.xalan.templates.ElemApplyTemplates; import org.apache.xalan.templates.ElemAttribute; import org.apache.xalan.templates.ElemCallTemplate; import org.apache.xalan.templates.ElemComment; import org.apache.xalan.templates.ElemCopy; import org.apache.xalan.templates.ElemCopyOf; import org.apache.xalan.templates.ElemElement; import org.apache.xalan.templates.ElemExsltFuncResult; import org.apache.xalan.templates.ElemExsltFunction; import org.apache.xalan.templates.ElemFallback; import org.apache.xalan.templates.ElemLiteralResult; import org.apache.xalan.templates.ElemMessage; import org.apache.xalan.templates.ElemNumber; import org.apache.xalan.templates.ElemPI; import org.apache.xalan.templates.ElemParam; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.ElemText; import org.apache.xalan.templates.ElemTextLiteral; import org.apache.xalan.templates.ElemValueOf; import org.apache.xalan.templates.ElemVariable; import org.apache.xalan.templates.Stylesheet; import org.xml.sax.Attributes; import org.xml.sax.SAXException; /** * This class processes parse events for an exslt func:function element. * @xsl.usage internal */ public class ProcessorExsltFunction extends ProcessorTemplateElem { static final long serialVersionUID = 2411427965578315332L; /** * Start an ElemExsltFunction. Verify that it is top level and that it has a name attribute with a * namespace. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws SAXException { //System.out.println("ProcessorFunction.startElement()"); String msg = ""; if (!(handler.getElemTemplateElement() instanceof Stylesheet)) { msg = "func:function element must be top level."; handler.error(msg, new SAXException(msg)); } super.startElement(handler, uri, localName, rawName, attributes); String val = attributes.getValue("name"); int indexOfColon = val.indexOf(":"); if (indexOfColon > 0) { //String prefix = val.substring(0, indexOfColon); //String localVal = val.substring(indexOfColon + 1); //String ns = handler.getNamespaceSupport().getURI(prefix); //if (ns.length() > 0) // System.out.println("fullfuncname " + ns + localVal); } else { msg = "func:function name must have namespace"; handler.error(msg, new SAXException(msg)); } } /** * Must include; super doesn't suffice! */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws SAXException { //System.out.println("ProcessorFunction appendAndPush()" + elem); super.appendAndPush(handler, elem); //System.out.println("originating node " + handler.getOriginatingNode()); elem.setDOMBackPointer(handler.getOriginatingNode()); handler.getStylesheet().setTemplate((ElemTemplate) elem); } /** * End an ElemExsltFunction, and verify its validity. */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws SAXException { ElemTemplateElement function = handler.getElemTemplateElement(); validate(function, handler); // may throw exception super.endElement(handler, uri, localName, rawName); } /** * Non-recursive traversal of FunctionElement tree based on TreeWalker to verify that * there are no literal result elements except within a func:result element and that * the func:result element does not contain any following siblings except xsl:fallback. */ public void validate(ElemTemplateElement elem, StylesheetHandler handler) throws SAXException { String msg = ""; while (elem != null) { //System.out.println("elem " + elem); if (elem instanceof ElemExsltFuncResult && elem.getNextSiblingElem() != null && !(elem.getNextSiblingElem() instanceof ElemFallback)) { msg = "func:result has an illegal following sibling (only xsl:fallback allowed)"; handler.error(msg, new SAXException(msg)); } if((elem instanceof ElemApplyImport || elem instanceof ElemApplyTemplates || elem instanceof ElemAttribute || elem instanceof ElemCallTemplate || elem instanceof ElemComment || elem instanceof ElemCopy || elem instanceof ElemCopyOf || elem instanceof ElemElement || elem instanceof ElemLiteralResult || elem instanceof ElemNumber || elem instanceof ElemPI || elem instanceof ElemText || elem instanceof ElemTextLiteral || elem instanceof ElemValueOf) && !(ancestorIsOk(elem))) { msg ="misplaced literal result in a func:function container."; handler.error(msg, new SAXException(msg)); } ElemTemplateElement nextElem = elem.getFirstChildElem(); while (nextElem == null) { nextElem = elem.getNextSiblingElem(); if (nextElem == null) elem = elem.getParentElem(); if (elem == null || elem instanceof ElemExsltFunction) return; // ok } elem = nextElem; } } /** * Verify that a literal result belongs to a result element, a variable, * or a parameter. */ boolean ancestorIsOk(ElemTemplateElement child) { while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction)) { ElemTemplateElement parent = child.getParentElem(); if (parent instanceof ElemExsltFuncResult || parent instanceof ElemVariable || parent instanceof ElemParam || parent instanceof ElemMessage) return true; child = parent; } return false; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/XSLTElementProcessor.java0000644000175000017500000003224010721374031026067 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTElementProcessor.java 469688 2006-10-31 22:39:43Z minchau $ */ package org.apache.xalan.processor; import java.util.ArrayList; import java.util.List; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xml.utils.IntStack; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.helpers.AttributesImpl; /** * This class acts as the superclass for all stylesheet element * processors, and deals with things that are common to all elements. * @see XSLT DTD */ public class XSLTElementProcessor extends ElemTemplateElement { static final long serialVersionUID = 5597421564955304421L; /** * Construct a processor for top-level elements. * @see XSLT DTD */ XSLTElementProcessor(){} private IntStack m_savedLastOrder; /** * The element definition that this processor conforms to. */ private XSLTElementDef m_elemDef; /** * Get the element definition that belongs to this element. * * @return The element definition object that produced and constrains this element. */ XSLTElementDef getElemDef() { return m_elemDef; } /** * Set the element definition that belongs to this element. * * @param def The element definition object that produced and constrains this element. */ void setElemDef(XSLTElementDef def) { m_elemDef = def; } /** * Resolve an external entity. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param publicId The public identifer, or null if none is * available. * @param systemId The system identifier provided in the XML * document. * @return The new input source, or null to require the * default behaviour. */ public InputSource resolveEntity( StylesheetHandler handler, String publicId, String systemId) throws org.xml.sax.SAXException { return null; } /** * Receive notification of a notation declaration. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param name The notation name. * @param publicId The notation public identifier, or null if not * available. * @param systemId The notation system identifier. * @see org.xml.sax.DTDHandler#notationDecl */ public void notationDecl(StylesheetHandler handler, String name, String publicId, String systemId) { // no op } /** * Receive notification of an unparsed entity declaration. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param name The entity name. * @param publicId The entity public identifier, or null if not * available. * @param systemId The entity system identifier. * @param notationName The name of the associated notation. * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void unparsedEntityDecl(StylesheetHandler handler, String name, String publicId, String systemId, String notationName) { // no op } /** * Receive notification of the start of the non-text event. This * is sent to the current processor when any non-text event occurs. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. */ public void startNonText(StylesheetHandler handler) throws org.xml.sax.SAXException { // no op } /** * Receive notification of the start of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param attributes The specified or defaulted attributes. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { if (m_savedLastOrder == null) m_savedLastOrder = new IntStack(); m_savedLastOrder.push(getElemDef().getLastOrder()); getElemDef().setLastOrder(-1); } /** * Receive notification of the end of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { if (m_savedLastOrder != null && !m_savedLastOrder.empty()) getElemDef().setLastOrder(m_savedLastOrder.pop()); if (!getElemDef().getRequiredFound()) handler.error(XSLTErrorResources.ER_REQUIRED_ELEM_NOT_FOUND, new Object[]{getElemDef().getRequiredElem()}, null); } /** * Receive notification of character data inside an element. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param ch The characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. */ public void characters( StylesheetHandler handler, char ch[], int start, int length) throws org.xml.sax.SAXException { handler.error(XSLTErrorResources.ER_CHARS_NOT_ALLOWED, null, null);//"Characters are not allowed at this point in the document!", //null); } /** * Receive notification of ignorable whitespace in element content. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param ch The whitespace characters. * @param start The start position in the character array. * @param length The number of characters to use from the * character array. */ public void ignorableWhitespace( StylesheetHandler handler, char ch[], int start, int length) throws org.xml.sax.SAXException { // no op } /** * Receive notification of a processing instruction. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param target The processing instruction target. * @param data The processing instruction data, or null if * none is supplied. */ public void processingInstruction( StylesheetHandler handler, String target, String data) throws org.xml.sax.SAXException { // no op } /** * Receive notification of a skipped entity. * * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param name The name of the skipped entity. */ public void skippedEntity(StylesheetHandler handler, String name) throws org.xml.sax.SAXException { // no op } /** * Set the properties of an object from the given attribute list. * @param handler The stylesheet's Content handler, needed for * error reporting. * @param rawName The raw name of the owner element, needed for * error reporting. * @param attributes The list of attributes. * @param target The target element where the properties will be set. */ void setPropertiesFromAttributes( StylesheetHandler handler, String rawName, Attributes attributes, ElemTemplateElement target) throws org.xml.sax.SAXException { setPropertiesFromAttributes(handler, rawName, attributes, target, true); } /** * Set the properties of an object from the given attribute list. * @param handler The stylesheet's Content handler, needed for * error reporting. * @param rawName The raw name of the owner element, needed for * error reporting. * @param attributes The list of attributes. * @param target The target element where the properties will be set. * @param throwError True if it should throw an error if an * attribute is not defined. * @return the attributes not allowed on this element. * * @throws TransformerException */ Attributes setPropertiesFromAttributes( StylesheetHandler handler, String rawName, Attributes attributes, ElemTemplateElement target, boolean throwError) throws org.xml.sax.SAXException { XSLTElementDef def = getElemDef(); AttributesImpl undefines = null; boolean isCompatibleMode = ((null != handler.getStylesheet() && handler.getStylesheet().getCompatibleMode()) || !throwError); if (isCompatibleMode) undefines = new AttributesImpl(); // Keep track of which XSLTAttributeDefs have been processed, so // I can see which default values need to be set. List processedDefs = new ArrayList(); // Keep track of XSLTAttributeDefs that were invalid List errorDefs = new ArrayList(); int nAttrs = attributes.getLength(); for (int i = 0; i < nAttrs; i++) { String attrUri = attributes.getURI(i); // Hack for Crimson. -sb if((null != attrUri) && (attrUri.length() == 0) && (attributes.getQName(i).startsWith("xmlns:") || attributes.getQName(i).equals("xmlns"))) { attrUri = org.apache.xalan.templates.Constants.S_XMLNAMESPACEURI; } String attrLocalName = attributes.getLocalName(i); XSLTAttributeDef attrDef = def.getAttributeDef(attrUri, attrLocalName); if (null == attrDef) { if (!isCompatibleMode) { // Then barf, because this element does not allow this attribute. handler.error(XSLTErrorResources.ER_ATTR_NOT_ALLOWED, new Object[]{attributes.getQName(i), rawName}, null);//"\""+attributes.getQName(i)+"\"" //+ " attribute is not allowed on the " + rawName // + " element!", null); } else { undefines.addAttribute(attrUri, attrLocalName, attributes.getQName(i), attributes.getType(i), attributes.getValue(i)); } } else { // Can we switch the order here: boolean success = attrDef.setAttrValue(handler, attrUri, attrLocalName, attributes.getQName(i), attributes.getValue(i), target); // Now we only add the element if it passed a validation check if (success) processedDefs.add(attrDef); else errorDefs.add(attrDef); } } XSLTAttributeDef[] attrDefs = def.getAttributes(); int nAttrDefs = attrDefs.length; for (int i = 0; i < nAttrDefs; i++) { XSLTAttributeDef attrDef = attrDefs[i]; String defVal = attrDef.getDefault(); if (null != defVal) { if (!processedDefs.contains(attrDef)) { attrDef.setDefAttrValue(handler, target); } } if (attrDef.getRequired()) { if ((!processedDefs.contains(attrDef)) && (!errorDefs.contains(attrDef))) handler.error( XSLMessages.createMessage( XSLTErrorResources.ER_REQUIRES_ATTRIB, new Object[]{ rawName, attrDef.getName() }), null); } } return undefines; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/package.html0000644000175000017500000000420210721374033023500 0ustar mkochmkoch Xalan Processor Package.

        Parses an XSLT stylesheet document (which may include and import other stylesheet documents) and produces a StylesheetRoot (a TRaX Templates object).

        StylesheetProcessor implements the TRaX {@link javax.xml.transform.TransformerFactory} interface, as well as the {@link javax.xml.transform.sax.SAXTransformerFactory} interface. It registers the {@link org.apache.xalan.processor.StylesheetHandler} object (a TrAX {@link javax.xml.transform.sax.TemplatesHandler} implementation) as the SAX ContentHandler for an XMLReader, and uses the XMLReader to parse the stylesheet document.

        Before parsing the XSLT input, StylesheetHandler assembles an {@link org.apache.xalan.processor.XSLTSchema}, which uses {@link org.apache.xalan.processor.XSLTElementDef} and {@link org.apache.xalan.processor.XSLTAttributeDef} objects to recursively define the elements and attributes that an XSLT stylesheet may contain. The StylesheetHandler then passes on each parse event to the {@link org.apache.xalan.processor.XSLTElementProcessor} which the XSLTElementDef assigned to the element associated with that event.

        libxalan2-java-2.7.1/src/org/apache/xalan/processor/XSLProcessorVersion.src0000644000175000017500000001022210721374031025641 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLProcessorVersion.src 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; /** * Administrative class to keep track of the version number of * the Xalan release. *

        See also: org/apache/xalan/res/XSLTInfo.properties

        * @deprecated To be replaced by org.apache.xalan.Version.getVersion() * @xsl.usage general */ public class XSLProcessorVersion { /** * Print the processor version to the command line. * * @param argv command line arguments, unused. */ public static void main(String argv[]) { System.out.println(S_VERSION); } /** * Constant name of product. */ public static final String PRODUCT = "Xalan"; /** * Implementation Language. */ public static final String LANGUAGE = "Java"; /** * Major version number. * Version number. This changes only when there is a * significant, externally apparent enhancement from * the previous release. 'n' represents the n'th * version. * * Clients should carefully consider the implications * of new versions as external interfaces and behaviour * may have changed. */ public static final int VERSION = @version.VERSION@; /** * Release Number. * Release number. This changes when: * - a new set of functionality is to be added, eg, * implementation of a new W3C specification. * - API or behaviour change. * - its designated as a reference release. */ public static final int RELEASE = @version.RELEASE@; /** * Maintenance Drop Number. * Optional identifier used to designate maintenance * drop applied to a specific release and contains * fixes for defects reported. It maintains compatibility * with the release and contains no API changes. * When missing, it designates the final and complete * development drop for a release. */ public static final int MAINTENANCE = @version.MINOR@; /** * Development Drop Number. * Optional identifier designates development drop of * a specific release. D01 is the first development drop * of a new release. * * Development drops are works in progress towards a * compeleted, final release. A specific development drop * may not completely implement all aspects of a new * feature, which may take several development drops to * complete. At the point of the final drop for the * release, the D suffix will be omitted. * * Each 'D' drops can contain functional enhancements as * well as defect fixes. 'D' drops may not be as stable as * the final releases. */ public static final int DEVELOPMENT = 0; /** * Version String like "Xalan Language * v.r[.dd| Dnn]". *

        Semantics of the version string are identical to the Xerces project.

        */ public static final String S_VERSION = PRODUCT+" "+LANGUAGE+" " +VERSION+"."+RELEASE+"." +(DEVELOPMENT > 0 ? ("D"+DEVELOPMENT) : (""+MAINTENANCE)); } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorOutputElem.java0000644000175000017500000001777610721374033026111 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorOutputElem.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import javax.xml.transform.OutputKeys; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.OutputProperties; import org.apache.xml.serializer.OutputPropertiesFactory; import org.apache.xml.utils.QName; import org.apache.xml.utils.SystemIDResolver; import org.xml.sax.Attributes; /** * TransformerFactory for xsl:output markup. * @see XSLT DTD * @see output in XSLT Specification */ class ProcessorOutputElem extends XSLTElementProcessor { static final long serialVersionUID = 3513742319582547590L; /** The output properties, set temporarily while the properties are * being set from the attributes, and then nulled after that operation * is completed. */ private OutputProperties m_outputProperties; /** * Set the cdata-section-elements property from the attribute value. * @see javax.xml.transform.OutputKeys#CDATA_SECTION_ELEMENTS * @param newValue non-null reference to processed attribute value. */ public void setCdataSectionElements(java.util.Vector newValue) { m_outputProperties.setQNameProperties(OutputKeys.CDATA_SECTION_ELEMENTS, newValue); } /** * Set the doctype-public property from the attribute value. * @see javax.xml.transform.OutputKeys#DOCTYPE_PUBLIC * @param newValue non-null reference to processed attribute value. */ public void setDoctypePublic(String newValue) { m_outputProperties.setProperty(OutputKeys.DOCTYPE_PUBLIC, newValue); } /** * Set the doctype-system property from the attribute value. * @see javax.xml.transform.OutputKeys#DOCTYPE_SYSTEM * @param newValue non-null reference to processed attribute value. */ public void setDoctypeSystem(String newValue) { m_outputProperties.setProperty(OutputKeys.DOCTYPE_SYSTEM, newValue); } /** * Set the encoding property from the attribute value. * @see javax.xml.transform.OutputKeys#ENCODING * @param newValue non-null reference to processed attribute value. */ public void setEncoding(String newValue) { m_outputProperties.setProperty(OutputKeys.ENCODING, newValue); } /** * Set the indent property from the attribute value. * @see javax.xml.transform.OutputKeys#INDENT * @param newValue non-null reference to processed attribute value. */ public void setIndent(boolean newValue) { m_outputProperties.setBooleanProperty(OutputKeys.INDENT, newValue); } /** * Set the media type property from the attribute value. * @see javax.xml.transform.OutputKeys#MEDIA_TYPE * @param newValue non-null reference to processed attribute value. */ public void setMediaType(String newValue) { m_outputProperties.setProperty(OutputKeys.MEDIA_TYPE, newValue); } /** * Set the method property from the attribute value. * @see javax.xml.transform.OutputKeys#METHOD * @param newValue non-null reference to processed attribute value. */ public void setMethod(org.apache.xml.utils.QName newValue) { m_outputProperties.setQNameProperty(OutputKeys.METHOD, newValue); } /** * Set the omit-xml-declaration property from the attribute value. * @see javax.xml.transform.OutputKeys#OMIT_XML_DECLARATION * @param newValue processed attribute value. */ public void setOmitXmlDeclaration(boolean newValue) { m_outputProperties.setBooleanProperty(OutputKeys.OMIT_XML_DECLARATION, newValue); } /** * Set the standalone property from the attribute value. * @see javax.xml.transform.OutputKeys#STANDALONE * @param newValue processed attribute value. */ public void setStandalone(boolean newValue) { m_outputProperties.setBooleanProperty(OutputKeys.STANDALONE, newValue); } /** * Set the version property from the attribute value. * @see javax.xml.transform.OutputKeys#VERSION * @param newValue non-null reference to processed attribute value. */ public void setVersion(String newValue) { m_outputProperties.setProperty(OutputKeys.VERSION, newValue); } /** * Set a foreign property from the attribute value. * @param newValue non-null reference to attribute value. */ public void setForeignAttr(String attrUri, String attrLocalName, String attrRawName, String attrValue) { QName key = new QName(attrUri, attrLocalName); m_outputProperties.setProperty(key, attrValue); } /** * Set a foreign property from the attribute value. * @param newValue non-null reference to attribute value. */ public void addLiteralResultAttribute(String attrUri, String attrLocalName, String attrRawName, String attrValue) { QName key = new QName(attrUri, attrLocalName); m_outputProperties.setProperty(key, attrValue); } /** * Receive notification of the start of an xsl:output element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * * @throws org.xml.sax.SAXException */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { // Hmmm... for the moment I don't think I'll have default properties set for this. -sb m_outputProperties = new OutputProperties(); m_outputProperties.setDOMBackPointer(handler.getOriginatingNode()); m_outputProperties.setLocaterInfo(handler.getLocator()); m_outputProperties.setUid(handler.nextUid()); setPropertiesFromAttributes(handler, rawName, attributes, this); // Access this only from the Hashtable level... we don't want to // get default properties. String entitiesFileName = (String) m_outputProperties.getProperties().get(OutputPropertiesFactory.S_KEY_ENTITIES); if (null != entitiesFileName) { try { String absURL = SystemIDResolver.getAbsoluteURI(entitiesFileName, handler.getBaseIdentifier()); m_outputProperties.getProperties().put(OutputPropertiesFactory.S_KEY_ENTITIES, absURL); } catch(TransformerException te) { handler.error(te.getMessage(), te); } } handler.getStylesheet().setOutput(m_outputProperties); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(m_outputProperties); m_outputProperties = null; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorKey.java0000644000175000017500000001301610721374032024514 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorKey.java 469688 2006-10-31 22:39:43Z minchau $ */ package org.apache.xalan.processor; import java.util.ArrayList; import java.util.List; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.KeyDeclaration; import org.xml.sax.Attributes; /** * TransformerFactory for xsl:key markup. *
         * 
         * 
         * 
        * @see XSLT DTD * @see key in XSLT Specification */ class ProcessorKey extends XSLTElementProcessor { static final long serialVersionUID = 4285205417566822979L; /** * Receive notification of the start of an xsl:key element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { KeyDeclaration kd = new KeyDeclaration(handler.getStylesheet(), handler.nextUid()); kd.setDOMBackPointer(handler.getOriginatingNode()); kd.setLocaterInfo(handler.getLocator()); setPropertiesFromAttributes(handler, rawName, attributes, kd); handler.getStylesheet().setKey(kd); } /** * Set the properties of an object from the given attribute list. * @param handler The stylesheet's Content handler, needed for * error reporting. * @param rawName The raw name of the owner element, needed for * error reporting. * @param attributes The list of attributes. * @param target The target element where the properties will be set. */ void setPropertiesFromAttributes( StylesheetHandler handler, String rawName, Attributes attributes, org.apache.xalan.templates.ElemTemplateElement target) throws org.xml.sax.SAXException { XSLTElementDef def = getElemDef(); // Keep track of which XSLTAttributeDefs have been processed, so // I can see which default values need to be set. List processedDefs = new ArrayList(); int nAttrs = attributes.getLength(); for (int i = 0; i < nAttrs; i++) { String attrUri = attributes.getURI(i); String attrLocalName = attributes.getLocalName(i); XSLTAttributeDef attrDef = def.getAttributeDef(attrUri, attrLocalName); if (null == attrDef) { // Then barf, because this element does not allow this attribute. handler.error(attributes.getQName(i) + "attribute is not allowed on the " + rawName + " element!", null); } else { String valueString = attributes.getValue(i); if (valueString.indexOf(org.apache.xpath.compiler.Keywords.FUNC_KEY_STRING + "(") >= 0) handler.error( XSLMessages.createMessage( XSLTErrorResources.ER_INVALID_KEY_CALL, null), null); processedDefs.add(attrDef); attrDef.setAttrValue(handler, attrUri, attrLocalName, attributes.getQName(i), attributes.getValue(i), target); } } XSLTAttributeDef[] attrDefs = def.getAttributes(); int nAttrDefs = attrDefs.length; for (int i = 0; i < nAttrDefs; i++) { XSLTAttributeDef attrDef = attrDefs[i]; String defVal = attrDef.getDefault(); if (null != defVal) { if (!processedDefs.contains(attrDef)) { attrDef.setDefAttrValue(handler, target); } } if (attrDef.getRequired()) { if (!processedDefs.contains(attrDef)) handler.error( XSLMessages.createMessage( XSLTErrorResources.ER_REQUIRES_ATTRIB, new Object[]{ rawName, attrDef.getName() }), null); } } } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/XSLTAttributeDef.java0000644000175000017500000015771010721374031025172 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSLTAttributeDef.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.AVT; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xml.utils.QName; import org.apache.xml.utils.StringToIntTable; import org.apache.xml.utils.StringVector; import org.apache.xml.utils.XML11Char; import org.apache.xpath.XPath; /** * This class defines an attribute for an element in a XSLT stylesheet, * is meant to reflect the structure defined in http://www.w3.org/TR/xslt#dtd, and the * mapping between Xalan classes and the markup attributes in the element. */ public class XSLTAttributeDef { // How to handle invalid values for this attribute static final int FATAL = 0; static final int ERROR = 1; static final int WARNING = 2; /** * Construct an instance of XSLTAttributeDef. * * @param namespace The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param type One of T_CDATA, T_URL, T_AVT, T_PATTERN, T_EXPR, T_CHAR, * T_NUMBER, T_YESNO, T_QNAME, T_QNAMES, T_ENUM, T_SIMPLEPATTERNLIST, * T_NMTOKEN, T_STRINGLIST, T_PREFIX_URLLIST, T_ENUM_OR_PQNAME, T_NCNAME. * @param required true if this is attribute is required by the XSLT specification. * @param supportsAVT true if this attribute supports AVT's. * @param errorType the type of error to issue if validation fails. One of FATAL, ERROR, WARNING. */ XSLTAttributeDef(String namespace, String name, int type, boolean required, boolean supportsAVT, int errorType) { this.m_namespace = namespace; this.m_name = name; this.m_type = type; this.m_required = required; this.m_supportsAVT = supportsAVT; this.m_errorType = errorType; } /** * Construct an instance of XSLTAttributeDef. * * @param namespace The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param type One of T_CDATA, T_URL, T_AVT, T_PATTERN, T_EXPR, * T_CHAR, T_NUMBER, T_YESNO, T_QNAME, T_QNAMES, T_ENUM, * T_SIMPLEPATTERNLIST, T_NMTOKEN, T_STRINGLIST, T_PREFIX_URLLIST, * T_ENUM_OR_PQNAME, T_NCNAME. * @param supportsAVT true if this attribute supports AVT's. * @param errorType the type of error to issue if validation fails. One of FATAL, ERROR, WARNING. * @param defaultVal The default value for this attribute. */ XSLTAttributeDef(String namespace, String name, int type, boolean supportsAVT, int errorType, String defaultVal) { this.m_namespace = namespace; this.m_name = name; this.m_type = type; this.m_required = false; this.m_supportsAVT = supportsAVT; this.m_errorType = errorType; this.m_default = defaultVal; } /** * Construct an instance of XSLTAttributeDef that uses two * enumerated values. * * @param namespace The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param required true if this attribute is required by the XSLT specification. * @param supportsAVT true if this attribute supports AVT's. * @param prefixedQNameValAllowed If true, the type is T_ENUM_OR_PQNAME * @param errorType the type of error to issue if validation fails. One of FATAL, ERROR, WARNING. * @param k1 The XSLT name of the enumerated value. * @param v1 An integer representation of k1. * @param k2 The XSLT name of the enumerated value. * @param v2 An integer representation of k2. */ XSLTAttributeDef(String namespace, String name, boolean required, boolean supportsAVT, boolean prefixedQNameValAllowed, int errorType, String k1, int v1, String k2, int v2) { this.m_namespace = namespace; this.m_name = name; this.m_type = prefixedQNameValAllowed ? this.T_ENUM_OR_PQNAME : this.T_ENUM; this.m_required = required; this.m_supportsAVT = supportsAVT; this.m_errorType = errorType; m_enums = new StringToIntTable(2); m_enums.put(k1, v1); m_enums.put(k2, v2); } /** * Construct an instance of XSLTAttributeDef that uses three * enumerated values. * * @param namespace The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param required true if this attribute is required by the XSLT specification. * @param supportsAVT true if this attribute supports AVT's. * @param prefixedQNameValAllowed If true, the type is T_ENUM_OR_PQNAME * @param errorType the type of error to issue if validation fails. One of FATAL, ERROR, WARNING. * * @param k1 The XSLT name of the enumerated value. * @param v1 An integer representation of k1. * @param k2 The XSLT name of the enumerated value. * @param v2 An integer representation of k2. * @param k3 The XSLT name of the enumerated value. * @param v3 An integer representation of k3. */ XSLTAttributeDef(String namespace, String name, boolean required, boolean supportsAVT, boolean prefixedQNameValAllowed, int errorType, String k1, int v1, String k2, int v2, String k3, int v3) { this.m_namespace = namespace; this.m_name = name; this.m_type = prefixedQNameValAllowed ? this.T_ENUM_OR_PQNAME : this.T_ENUM; this.m_required = required; this.m_supportsAVT = supportsAVT; this.m_errorType = errorType; m_enums = new StringToIntTable(3); m_enums.put(k1, v1); m_enums.put(k2, v2); m_enums.put(k3, v3); } /** * Construct an instance of XSLTAttributeDef that uses three * enumerated values. * * @param namespace The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param required true if this attribute is required by the XSLT specification. * @param supportsAVT true if this attribute supports AVT's. * @param prefixedQNameValAllowed If true, the type is T_ENUM_OR_PQNAME * @param errorType the type of error to issue if validation fails. One of FATAL, ERROR, WARNING. * @param k1 The XSLT name of the enumerated value. * @param v1 An integer representation of k1. * @param k2 The XSLT name of the enumerated value. * @param v2 An integer representation of k2. * @param k3 The XSLT name of the enumerated value. * @param v3 An integer representation of k3. * @param k4 The XSLT name of the enumerated value. * @param v4 An integer representation of k4. */ XSLTAttributeDef(String namespace, String name, boolean required, boolean supportsAVT, boolean prefixedQNameValAllowed, int errorType, String k1, int v1, String k2, int v2, String k3, int v3, String k4, int v4) { this.m_namespace = namespace; this.m_name = name; this.m_type = prefixedQNameValAllowed ? this.T_ENUM_OR_PQNAME : this.T_ENUM; this.m_required = required; this.m_supportsAVT = supportsAVT; this.m_errorType = errorType; m_enums = new StringToIntTable(4); m_enums.put(k1, v1); m_enums.put(k2, v2); m_enums.put(k3, v3); m_enums.put(k4, v4); } /** Type values that represent XSLT attribute types. */ static final int T_CDATA = 1, // T_URL = 2, // T_AVT = 3, // Attribute Value Template // T_PATTERN = 4, // T_EXPR = 5, // T_CHAR = 6, // T_NUMBER = 7, // Used for boolean values T_YESNO = 8, // T_QNAME = 9, // T_QNAMES = 10, // T_ENUM = 11, // Used for simple match patterns, i.e. xsl:strip-space spec. T_SIMPLEPATTERNLIST = 12, // Used for a known token. T_NMTOKEN = 13, // Used for a list of white-space delimited strings. T_STRINGLIST = 14, // Used for a list of white-space delimited strings. // Prefixes are checked to make sure they refer to // valid namespaces, and are resolved when processed T_PREFIX_URLLIST = 15, // Used for enumerated values, one of which could be a qname-but-not-ncname T_ENUM_OR_PQNAME = 16, // Used for the type of an attribute value that is a NCName T_NCNAME = 17, // Used for QName attributes that are always AVT. Prefix isn't resolved. T_AVT_QNAME = 18, // Used for a list of QNames where non-prefixed items are to be resolved // using the default namespace (This is only true for cdata-section-elements) T_QNAMES_RESOLVE_NULL = 19, // Used for a list of white-space delimited strings. // strings are checked to make sure they are valid // prefixes, and are not expanded when processed. T_PREFIXLIST = 20; /** Representation for an attribute in a foreign namespace. */ static final XSLTAttributeDef m_foreignAttr = new XSLTAttributeDef("*", "*", XSLTAttributeDef.T_CDATA,false, false, WARNING); /** Method name that objects may implement if they wish to have forein attributes set. */ static final String S_FOREIGNATTR_SETTER = "setForeignAttr"; /** * The allowed namespace for this element. */ private String m_namespace; /** * Get the allowed namespace for this attribute. * * @return The allowed namespace for this attribute, which may be null, or may be "*". */ String getNamespace() { return m_namespace; } /** * The name of this element. */ private String m_name; /** * Get the name of this attribute. * * @return non-null reference to the name of this attribute, which may be "*". */ String getName() { return m_name; } /** * The type of this attribute value. */ private int m_type; /** * Get the type of this attribute value. * * @return One of T_CDATA, T_URL, T_AVT, T_PATTERN, T_EXPR, T_CHAR, * T_NUMBER, T_YESNO, T_QNAME, T_QNAMES, T_ENUM, T_SIMPLEPATTERNLIST, * T_NMTOKEN, T_STRINGLIST, T_PREFIX_URLLIST, T_ENUM_OR_PQNAME. */ int getType() { return m_type; } /** * If this element is of type T_ENUM, this will contain * a map from the attribute string to the Xalan integer * value. */ private StringToIntTable m_enums; /** * If this element is of type T_ENUM, this will return * a map from the attribute string to the Xalan integer * value. * @param key The XSLT attribute value. * * @return The integer representation of the enumerated value for this attribute. * @throws Throws NullPointerException if m_enums is null. */ private int getEnum(String key) { return m_enums.get(key); } /** * If this element is of type T_ENUM, this will return * an array of strings - the values in the enumeration * * @return An array of the enumerated values permitted for this attribute. * * @throws Throws NullPointerException if m_enums is null. */ private String[] getEnumNames() { return m_enums.keys(); } /** * The default value for this attribute. */ private String m_default; /** * Get the default value for this attribute. * * @return The default value for this attribute, or null. */ String getDefault() { return m_default; } /** * Set the default value for this attribute. * * @param def String representation of the default value for this attribute. */ void setDefault(String def) { m_default = def; } /** * If true, this is a required attribute. */ private boolean m_required; /** * Get whether or not this is a required attribute. * * @return true if this is a required attribute. */ boolean getRequired() { return m_required; } /** * If true, this is attribute supports AVT's. */ private boolean m_supportsAVT; /** * Get whether or not this attribute supports AVT's. * * @return true if this attribute supports AVT's. */ boolean getSupportsAVT() { return m_supportsAVT; } int m_errorType = this.WARNING; /** * Get the type of error message to use if the attribute value is invalid. * * @return one of XSLAttributeDef.FATAL, XSLAttributeDef.ERROR, XSLAttributeDef.WARNING */ int getErrorType() { return m_errorType; } /** * String that should represent the setter method which which * may be used on objects to set a value that represents this attribute */ String m_setterString = null; /** * Return a string that should represent the setter method. * The setter method name will be created algorithmically the * first time this method is accessed, and then cached for return * by subsequent invocations of this method. * * @return String that should represent the setter method which which * may be used on objects to set a value that represents this attribute, * of null if no setter method should be called. */ public String getSetterMethodName() { if (null == m_setterString) { if (m_foreignAttr == this) { return S_FOREIGNATTR_SETTER; } else if (m_name.equals("*")) { m_setterString = "addLiteralResultAttribute"; return m_setterString; } StringBuffer outBuf = new StringBuffer(); outBuf.append("set"); if ((m_namespace != null) && m_namespace.equals(Constants.S_XMLNAMESPACEURI)) { outBuf.append("Xml"); } int n = m_name.length(); for (int i = 0; i < n; i++) { char c = m_name.charAt(i); if ('-' == c) { i++; c = m_name.charAt(i); c = Character.toUpperCase(c); } else if (0 == i) { c = Character.toUpperCase(c); } outBuf.append(c); } m_setterString = outBuf.toString(); } return m_setterString; } /** * Process an attribute string of type T_AVT into * a AVT value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value Should be an Attribute Value Template string. * * @return An AVT object that may be used to evaluate the Attribute Value Template. * * @throws org.xml.sax.SAXException which will wrap a * {@link javax.xml.transform.TransformerException}, if there is a syntax error * in the attribute value template string. */ AVT processAVT( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { AVT avt = new AVT(handler, uri, name, rawName, value, owner); return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Process an attribute string of type T_CDATA into * a String value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value non-null string reference. * * @return The value argument. * * @throws org.xml.sax.SAXException. */ Object processCDATA(StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { if (getSupportsAVT()) { try { AVT avt = new AVT(handler, uri, name, rawName, value, owner); return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } else { return value; } } /** * Process an attribute string of type T_CHAR into * a Character value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value Should be a string with a length of 1. * * @return Character object. * * @throws org.xml.sax.SAXException if the string is not a length of 1. */ Object processCHAR( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { if (getSupportsAVT()) { try { AVT avt = new AVT(handler, uri, name, rawName, value, owner); // If an AVT wasn't used, validate the value if ((avt.isSimple()) && (value.length() != 1)) { handleError(handler, XSLTErrorResources.INVALID_TCHAR, new Object[] {name, value},null); return null; } return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } else { if (value.length() != 1) { handleError(handler, XSLTErrorResources.INVALID_TCHAR, new Object[] {name, value},null); return null; } return new Character(value.charAt(0)); } } /** * Process an attribute string of type T_ENUM into a int value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value non-null string that represents an enumerated value that is * valid for this element. * @param owner * * @return An Integer representation of the enumerated value if this attribute does not support * AVT. Otherwise, and AVT is returned. */ Object processENUM(StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { AVT avt = null; if (getSupportsAVT()) { try { avt = new AVT(handler, uri, name, rawName, value, owner); // If this attribute used an avt, then we can't validate at this time. if (!avt.isSimple()) return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } int retVal = this.getEnum(value); if (retVal == StringToIntTable.INVALID_KEY) { StringBuffer enumNamesList = getListOfEnums(); handleError(handler, XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null); return null; } if (getSupportsAVT()) return avt; else return new Integer(retVal); } /** * Process an attribute string of that is either an enumerated value or a qname-but-not-ncname. * Returns an AVT, if this attribute support AVT; otherwise returns int or qname. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value non-null string that represents an enumerated value that is * valid for this element. * @param owner * * @return AVT if attribute supports AVT. An Integer representation of the enumerated value if * attribute does not support AVT and an enumerated value was used. Otherwise a qname * is returned. */ Object processENUM_OR_PQNAME(StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { Object objToReturn = null; if (getSupportsAVT()) { try { AVT avt = new AVT(handler, uri, name, rawName, value, owner); if (!avt.isSimple()) return avt; else objToReturn = avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } // An avt wasn't used. int key = this.getEnum(value); if (key != StringToIntTable.INVALID_KEY) { if (objToReturn == null) objToReturn = new Integer(key); } // enum not used. Validate qname-but-not-ncname. else { try { QName qname = new QName(value, handler, true); if (objToReturn == null) objToReturn = qname; if (qname.getPrefix() == null) { StringBuffer enumNamesList = getListOfEnums(); enumNamesList.append(" "); handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null); return null; } } catch (IllegalArgumentException ie) { StringBuffer enumNamesList = getListOfEnums(); enumNamesList.append(" "); handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },ie); return null; } catch (RuntimeException re) { StringBuffer enumNamesList = getListOfEnums(); enumNamesList.append(" "); handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },re); return null; } } return objToReturn; } /** * Process an attribute string of type T_EXPR into * an XPath value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value An XSLT expression string. * * @return an XPath object that may be used for evaluation. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the expression * string contains a syntax error. */ Object processEXPR( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { XPath expr = handler.createXPath(value, owner); return expr; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Process an attribute string of type T_NMTOKEN into * a String value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A NMTOKEN string. * * @return the value argument or an AVT if this attribute supports AVTs. * * @throws org.xml.sax.SAXException if the value is not a valid nmtoken */ Object processNMTOKEN(StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { if (getSupportsAVT()) { try { AVT avt = new AVT(handler, uri, name, rawName, value, owner); // If an AVT wasn't used, validate the value if ((avt.isSimple()) && (!XML11Char.isXML11ValidNmtoken(value))) { handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null); return null; } return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } else { if (!XML11Char.isXML11ValidNmtoken(value)) { handleError(handler,XSLTErrorResources.INVALID_NMTOKEN, new Object[] {name,value},null); return null; } } return value; } /** * Process an attribute string of type T_PATTERN into * an XPath match pattern value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A match pattern string. * * @return An XPath pattern that may be used to evaluate the XPath. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if the match pattern * string contains a syntax error. */ Object processPATTERN( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { XPath pattern = handler.createMatchPatternXPath(value, owner); return pattern; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Process an attribute string of type T_NUMBER into * a double value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A string that can be parsed into a double value. * @param number * * @return A Double object. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} * if the string does not contain a parsable number. */ Object processNUMBER( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { if (getSupportsAVT()) { Double val; AVT avt = null; try { avt = new AVT(handler, uri, name, rawName, value, owner); // If this attribute used an avt, then we can't validate at this time. if (avt.isSimple()) { val = Double.valueOf(value); } } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } catch (NumberFormatException nfe) { handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe); return null; } return avt; } else { try { return Double.valueOf(value); } catch (NumberFormatException nfe) { handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe); return null; } } } /** * Process an attribute string of type T_QNAME into a QName value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A string that represents a potentially prefix qualified name. * @param owner * * @return A QName object if this attribute does not support AVT's. Otherwise, an AVT * is returned. * * @throws org.xml.sax.SAXException if the string contains a prefix that can not be * resolved, or the string contains syntax that is invalid for a qualified name. */ Object processQNAME( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { QName qname = new QName(value, handler, true); return qname; } catch (IllegalArgumentException ie) { // thrown by QName constructor handleError(handler,XSLTErrorResources.INVALID_QNAME, new Object[] {name, value},ie); return null; } catch (RuntimeException re) { // thrown by QName constructor handleError(handler,XSLTErrorResources.INVALID_QNAME, new Object[] {name, value},re); return null; } } /** * Process an attribute string of type T_QNAME into a QName value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A string that represents a potentially prefix qualified name. * @param owner * * @return An AVT is returned. * * @throws org.xml.sax.SAXException if the string contains a prefix that can not be * resolved, or the string contains syntax that is invalid for a qualified name. */ Object processAVT_QNAME( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { AVT avt = null; try { avt = new AVT(handler, uri, name, rawName, value, owner); // If an AVT wasn't used, validate the value if (avt.isSimple()) { int indexOfNSSep = value.indexOf(':'); if (indexOfNSSep >= 0) { String prefix = value.substring(0, indexOfNSSep); if (!XML11Char.isXML11ValidNCName(prefix)) { handleError(handler,XSLTErrorResources.INVALID_QNAME,new Object[]{name,value },null); return null; } } String localName = (indexOfNSSep < 0) ? value : value.substring(indexOfNSSep + 1); if ((localName == null) || (localName.length() == 0) || (!XML11Char.isXML11ValidNCName(localName))) { handleError(handler,XSLTErrorResources.INVALID_QNAME,new Object[]{name,value },null ); return null; } } } catch (TransformerException te) { // thrown by AVT constructor throw new org.xml.sax.SAXException(te); } return avt; } /** * Process an attribute string of type NCName into a String * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A string that represents a potentially prefix qualified name. * @param owner * * @return A String object if this attribute does not support AVT's. Otherwise, an AVT * is returned. * * @throws org.xml.sax.SAXException if the string contains a prefix that can not be * resolved, or the string contains syntax that is invalid for a NCName. */ Object processNCNAME( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { if (getSupportsAVT()) { AVT avt = null; try { avt = new AVT(handler, uri, name, rawName, value, owner); // If an AVT wasn't used, validate the value if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value))) { handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null); return null; } return avt; } catch (TransformerException te) { // thrown by AVT constructor throw new org.xml.sax.SAXException(te); } } else { if (!XML11Char.isXML11ValidNCName(value)) { handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null); return null; } return value; } } /** * Process an attribute string of type T_QNAMES into a vector of QNames where * the specification requires that non-prefixed elements not be placed in a * namespace. (See section 2.4 of XSLT 1.0.) * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A whitespace delimited list of qualified names. * * @return a Vector of QName objects. * * @throws org.xml.sax.SAXException if the one of the qualified name strings * contains a prefix that can not be * resolved, or a qualified name contains syntax that is invalid for a qualified name. */ Vector processQNAMES( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nQNames = tokenizer.countTokens(); Vector qnames = new Vector(nQNames); for (int i = 0; i < nQNames; i++) { // Fix from Alexander Rudnev qnames.addElement(new QName(tokenizer.nextToken(), handler)); } return qnames; } /** * Process an attribute string of type T_QNAMES_RESOLVE_NULL into a vector * of QNames where the specification requires non-prefixed elements to be * placed in the default namespace. (See section 16 of XSLT 1.0; the * only time that this will get called is for the * cdata-section-elements attribute on xsl:output. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A whitespace delimited list of qualified names. * * @return a Vector of QName objects. * * @throws org.xml.sax.SAXException if the one of the qualified name strings * contains a prefix that can not be resolved, or a qualified name contains * syntax that is invalid for a qualified name. */ final Vector processQNAMESRNU(StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nQNames = tokenizer.countTokens(); Vector qnames = new Vector(nQNames); String defaultURI = handler.getNamespaceForPrefix(""); for (int i = 0; i < nQNames; i++) { String tok = tokenizer.nextToken(); if (tok.indexOf(':') == -1) { qnames.addElement(new QName(defaultURI,tok)); } else { qnames.addElement(new QName(tok, handler)); } } return qnames; } /** * Process an attribute string of type T_SIMPLEPATTERNLIST into * a vector of XPath match patterns. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A whitespace delimited list of simple match patterns. * * @return A Vector of XPath objects. * * @throws org.xml.sax.SAXException that wraps a * {@link javax.xml.transform.TransformerException} if one of the match pattern * strings contains a syntax error. */ Vector processSIMPLEPATTERNLIST( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nPatterns = tokenizer.countTokens(); Vector patterns = new Vector(nPatterns); for (int i = 0; i < nPatterns; i++) { XPath pattern = handler.createMatchPatternXPath(tokenizer.nextToken(), owner); patterns.addElement(pattern); } return patterns; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * Process an attribute string of type T_STRINGLIST into * a vector of XPath match patterns. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value a whitespace delimited list of string values. * * @return A StringVector of the tokenized strings. */ StringVector processSTRINGLIST(StylesheetHandler handler, String uri, String name, String rawName, String value) { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { strings.addElement(tokenizer.nextToken()); } return strings; } /** * Process an attribute string of type T_URLLIST into * a vector of prefixes that may be resolved to URLs. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A list of whitespace delimited prefixes. * * @return A vector of strings that may be resolved to URLs. * * @throws org.xml.sax.SAXException if one of the prefixes can not be resolved. */ StringVector processPREFIX_URLLIST( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { String prefix = tokenizer.nextToken(); String url = handler.getNamespaceForPrefix(prefix); if (url != null) strings.addElement(url); else throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix})); } return strings; } /** * Process an attribute string of type T_PREFIXLIST into * a vector of prefixes that may be resolved to URLs. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A list of whitespace delimited prefixes. * * @return A vector of strings that may be resolved to URLs. * * @throws org.xml.sax.SAXException if one of the prefixes can not be resolved. */ StringVector processPREFIX_LIST( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { String prefix = tokenizer.nextToken(); String url = handler.getNamespaceForPrefix(prefix); if (prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX) || url != null) strings.addElement(prefix); else throw new org.xml.sax.SAXException( XSLMessages.createMessage( XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix})); } return strings; } /** * Process an attribute string of type T_URL into * a URL value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value non-null string that conforms to the URL syntax. * * @return The non-absolutized URL argument, in other words, the value argument. If this * attribute supports AVT, an AVT is returned. * * @throws org.xml.sax.SAXException if the URL does not conform to the URL syntax. */ Object processURL( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { if (getSupportsAVT()) { try { AVT avt = new AVT(handler, uri, name, rawName, value, owner); // If an AVT wasn't used, validate the value // if (avt.getSimpleString() != null) { // TODO: syntax check URL value. // return SystemIDResolver.getAbsoluteURI(value, // handler.getBaseIdentifier()); //} return avt; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } } else { // TODO: syntax check URL value. // return SystemIDResolver.getAbsoluteURI(value, // handler.getBaseIdentifier()); return value; } } /** * Process an attribute string of type T_YESNO into * a Boolean value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value A string that should be "yes" or "no". * * @return Boolean object representation of the value. * * @throws org.xml.sax.SAXException */ private Boolean processYESNO( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { // Is this already checked somewhere else? -sb if (!(value.equals("yes") || value.equals("no"))) { handleError(handler, XSLTErrorResources.INVALID_BOOLEAN, new Object[] {name,value}, null); return null; } return new Boolean(value.equals("yes") ? true : false); } /** * Process an attribute value. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param name The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param value The unprocessed string value of the attribute. * * @return The processed Object representation of the attribute. * * @throws org.xml.sax.SAXException if the attribute value can not be processed. */ Object processValue( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { int type = getType(); Object processedValue = null; switch (type) { case T_AVT : processedValue = processAVT(handler, uri, name, rawName, value, owner); break; case T_CDATA : processedValue = processCDATA(handler, uri, name, rawName, value, owner); break; case T_CHAR : processedValue = processCHAR(handler, uri, name, rawName, value, owner); break; case T_ENUM : processedValue = processENUM(handler, uri, name, rawName, value, owner); break; case T_EXPR : processedValue = processEXPR(handler, uri, name, rawName, value, owner); break; case T_NMTOKEN : processedValue = processNMTOKEN(handler, uri, name, rawName, value, owner); break; case T_PATTERN : processedValue = processPATTERN(handler, uri, name, rawName, value, owner); break; case T_NUMBER : processedValue = processNUMBER(handler, uri, name, rawName, value, owner); break; case T_QNAME : processedValue = processQNAME(handler, uri, name, rawName, value, owner); break; case T_QNAMES : processedValue = processQNAMES(handler, uri, name, rawName, value); break; case T_QNAMES_RESOLVE_NULL: processedValue = processQNAMESRNU(handler, uri, name, rawName, value); break; case T_SIMPLEPATTERNLIST : processedValue = processSIMPLEPATTERNLIST(handler, uri, name, rawName, value, owner); break; case T_URL : processedValue = processURL(handler, uri, name, rawName, value, owner); break; case T_YESNO : processedValue = processYESNO(handler, uri, name, rawName, value); break; case T_STRINGLIST : processedValue = processSTRINGLIST(handler, uri, name, rawName, value); break; case T_PREFIX_URLLIST : processedValue = processPREFIX_URLLIST(handler, uri, name, rawName, value); break; case T_ENUM_OR_PQNAME : processedValue = processENUM_OR_PQNAME(handler, uri, name, rawName, value, owner); break; case T_NCNAME : processedValue = processNCNAME(handler, uri, name, rawName, value, owner); break; case T_AVT_QNAME : processedValue = processAVT_QNAME(handler, uri, name, rawName, value, owner); break; case T_PREFIXLIST : processedValue = processPREFIX_LIST(handler, uri, name, rawName, value); break; default : } return processedValue; } /** * Set the default value of an attribute. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem The object on which the property will be set. * * @throws org.xml.sax.SAXException wraps an invocation exception if the * setter method can not be invoked on the object. */ void setDefAttrValue(StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { setAttrValue(handler, this.getNamespace(), this.getName(), this.getName(), this.getDefault(), elem); } /** * Get the primative type for the class, if there * is one. If the class is a Double, for instance, * this will return double.class. If the class is not one * of the 9 primative types, it will return the same * class that was passed in. * * @param obj The object which will be resolved to a primative class object if possible. * * @return The most primative class representation possible for the object, never null. */ private Class getPrimativeClass(Object obj) { if (obj instanceof XPath) return XPath.class; Class cl = obj.getClass(); if (cl == Double.class) { cl = double.class; } if (cl == Float.class) { cl = float.class; } else if (cl == Boolean.class) { cl = boolean.class; } else if (cl == Byte.class) { cl = byte.class; } else if (cl == Character.class) { cl = char.class; } else if (cl == Short.class) { cl = short.class; } else if (cl == Integer.class) { cl = int.class; } else if (cl == Long.class) { cl = long.class; } return cl; } /** * StringBuffer containing comma delimited list of valid values for ENUM type. * Used to build error message. */ private StringBuffer getListOfEnums() { StringBuffer enumNamesList = new StringBuffer(); String [] enumValues = this.getEnumNames(); for (int i = 0; i < enumValues.length; i++) { if (i > 0) { enumNamesList.append(' '); } enumNamesList.append(enumValues[i]); } return enumNamesList; } /** * Set a value on an attribute. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param attrUri The Namespace URI of the attribute, or an empty string. * @param attrLocalName The local name (without prefix), or empty string if not namespace processing. * @param attrRawName The raw name of the attribute, including possible prefix. * @param attrValue The attribute's value. * @param elem The object that should contain a property that represents the attribute. * * @throws org.xml.sax.SAXException */ boolean setAttrValue( StylesheetHandler handler, String attrUri, String attrLocalName, String attrRawName, String attrValue, ElemTemplateElement elem) throws org.xml.sax.SAXException { if(attrRawName.equals("xmlns") || attrRawName.startsWith("xmlns:")) return true; String setterString = getSetterMethodName(); // If this is null, then it is a foreign namespace and we // do not process it. if (null != setterString) { try { Method meth; Object[] args; if(setterString.equals(S_FOREIGNATTR_SETTER)) { // workaround for possible crimson bug if( attrUri==null) attrUri=""; // First try to match with the primative value. Class sclass = attrUri.getClass(); Class[] argTypes = new Class[]{ sclass, sclass, sclass, sclass }; meth = elem.getClass().getMethod(setterString, argTypes); args = new Object[]{ attrUri, attrLocalName, attrRawName, attrValue }; } else { Object value = processValue(handler, attrUri, attrLocalName, attrRawName, attrValue, elem); // If a warning was issued because the value for this attribute was // invalid, then the value will be null. Just return if (null == value) return false; // First try to match with the primative value. Class[] argTypes = new Class[]{ getPrimativeClass(value) }; try { meth = elem.getClass().getMethod(setterString, argTypes); } catch (NoSuchMethodException nsme) { Class cl = ((Object) value).getClass(); // If this doesn't work, try it with the non-primative value; argTypes[0] = cl; meth = elem.getClass().getMethod(setterString, argTypes); } args = new Object[]{ value }; } meth.invoke(elem, args); } catch (NoSuchMethodException nsme) { if (!setterString.equals(S_FOREIGNATTR_SETTER)) { handler.error(XSLTErrorResources.ER_FAILED_CALLING_METHOD, new Object[]{setterString}, nsme);//"Failed calling " + setterString + " method!", nsme); return false; } } catch (IllegalAccessException iae) { handler.error(XSLTErrorResources.ER_FAILED_CALLING_METHOD, new Object[]{setterString}, iae);//"Failed calling " + setterString + " method!", iae); return false; } catch (InvocationTargetException nsme) { handleError(handler, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_NAME, getName()}, nsme); return false; } } return true; } private void handleError(StylesheetHandler handler, String msg, Object [] args, Exception exc) throws org.xml.sax.SAXException { switch (getErrorType()) { case (FATAL): case (ERROR): handler.error(msg, args, exc); break; case (WARNING): handler.warn(msg, args); default: break; } } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorPreserveSpace.java0000644000175000017500000000554310721374031026540 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorPreserveSpace.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.util.Vector; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.WhiteSpaceInfo; import org.apache.xpath.XPath; import org.xml.sax.Attributes; /** * TransformerFactory for xsl:preserve-space markup. *
         * 
         * 
         * 
        */ class ProcessorPreserveSpace extends XSLTElementProcessor { static final long serialVersionUID = -5552836470051177302L; /** * Receive notification of the start of an preserve-space element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { Stylesheet thisSheet = handler.getStylesheet(); WhitespaceInfoPaths paths = new WhitespaceInfoPaths(thisSheet); setPropertiesFromAttributes(handler, rawName, attributes, paths); Vector xpaths = paths.getElements(); for (int i = 0; i < xpaths.size(); i++) { WhiteSpaceInfo wsi = new WhiteSpaceInfo((XPath) xpaths.elementAt(i), false, thisSheet); wsi.setUid(handler.nextUid()); thisSheet.setPreserveSpaces(wsi); } paths.clearElements(); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorStripSpace.java0000644000175000017500000000550510721374033026046 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorStripSpace.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import java.util.Vector; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.WhiteSpaceInfo; import org.apache.xpath.XPath; import org.xml.sax.Attributes; /** * TransformerFactory for xsl:strip-space markup. *
         * 
         * 
         * 
        */ class ProcessorStripSpace extends ProcessorPreserveSpace { static final long serialVersionUID = -5594493198637899591L; /** * Receive notification of the start of an strip-space element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { Stylesheet thisSheet = handler.getStylesheet(); WhitespaceInfoPaths paths = new WhitespaceInfoPaths(thisSheet); setPropertiesFromAttributes(handler, rawName, attributes, paths); Vector xpaths = paths.getElements(); for (int i = 0; i < xpaths.size(); i++) { WhiteSpaceInfo wsi = new WhiteSpaceInfo((XPath) xpaths.elementAt(i), true, thisSheet); wsi.setUid(handler.nextUid()); thisSheet.setStripSpaces(wsi); } paths.clearElements(); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorLRE.java0000644000175000017500000003175410721374030024415 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorLRE.java 475981 2006-11-16 23:35:53Z minchau $ */ package org.apache.xalan.processor; import java.util.List; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import org.apache.xalan.res.XSLMessages; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.Constants; import org.apache.xalan.templates.ElemExtensionCall; import org.apache.xalan.templates.ElemLiteralResult; import org.apache.xalan.templates.ElemTemplate; import org.apache.xalan.templates.ElemTemplateElement; import org.apache.xalan.templates.Stylesheet; import org.apache.xalan.templates.StylesheetRoot; import org.apache.xalan.templates.XMLNSDecl; import org.apache.xml.utils.SAXSourceLocator; import org.apache.xpath.XPath; import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.helpers.AttributesImpl; /** * Processes an XSLT literal-result-element, or something that looks * like one. The actual {@link org.apache.xalan.templates.ElemTemplateElement} * produced may be a {@link org.apache.xalan.templates.ElemLiteralResult}, * a {@link org.apache.xalan.templates.StylesheetRoot}, or a * {@link org.apache.xalan.templates.ElemExtensionCall}. * * @see literal-result-element in XSLT Specification * @see org.apache.xalan.templates.ElemLiteralResult * @xsl.usage internal */ public class ProcessorLRE extends ProcessorTemplateElem { static final long serialVersionUID = -1490218021772101404L; /** * Receive notification of the start of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). * @param attributes The specified or defaulted attributes. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { try { ElemTemplateElement p = handler.getElemTemplateElement(); boolean excludeXSLDecl = false; boolean isLREAsStyleSheet = false; if (null == p) { // Literal Result Template as stylesheet. XSLTElementProcessor lreProcessor = handler.popProcessor(); XSLTElementProcessor stylesheetProcessor = handler.getProcessorFor(Constants.S_XSLNAMESPACEURL, "stylesheet", "xsl:stylesheet"); handler.pushProcessor(lreProcessor); Stylesheet stylesheet; try { stylesheet = getStylesheetRoot(handler); } catch(TransformerConfigurationException tfe) { throw new TransformerException(tfe); } // stylesheet.setDOMBackPointer(handler.getOriginatingNode()); // ***** Note that we're assigning an empty locator. Is this necessary? SAXSourceLocator slocator = new SAXSourceLocator(); Locator locator = handler.getLocator(); if(null != locator) { slocator.setLineNumber(locator.getLineNumber()); slocator.setColumnNumber(locator.getColumnNumber()); slocator.setPublicId(locator.getPublicId()); slocator.setSystemId(locator.getSystemId()); } stylesheet.setLocaterInfo(slocator); stylesheet.setPrefixes(handler.getNamespaceSupport()); handler.pushStylesheet(stylesheet); isLREAsStyleSheet = true; AttributesImpl stylesheetAttrs = new AttributesImpl(); AttributesImpl lreAttrs = new AttributesImpl(); int n = attributes.getLength(); for (int i = 0; i < n; i++) { String attrLocalName = attributes.getLocalName(i); String attrUri = attributes.getURI(i); String value = attributes.getValue(i); if ((null != attrUri) && attrUri.equals(Constants.S_XSLNAMESPACEURL)) { stylesheetAttrs.addAttribute(null, attrLocalName, attrLocalName, attributes.getType(i), attributes.getValue(i)); } else if ((attrLocalName.startsWith("xmlns:") || attrLocalName.equals( "xmlns")) && value.equals(Constants.S_XSLNAMESPACEURL)) { // ignore } else { lreAttrs.addAttribute(attrUri, attrLocalName, attributes.getQName(i), attributes.getType(i), attributes.getValue(i)); } } attributes = lreAttrs; // Set properties from the attributes, but don't throw // an error if there is an attribute defined that is not // allowed on a stylesheet. try{ stylesheetProcessor.setPropertiesFromAttributes(handler, "stylesheet", stylesheetAttrs, stylesheet); } catch (Exception e) { // This is pretty ugly, but it will have to do for now. // This is just trying to append some text specifying that // this error came from a missing or invalid XSLT namespace // declaration. // If someone comes up with a better solution, please feel // free to contribute it. -mm if (stylesheet.getDeclaredPrefixes() == null || !declaredXSLNS(stylesheet)) { throw new org.xml.sax.SAXException(XSLMessages.createWarning(XSLTErrorResources.WG_OLD_XSLT_NS, null)); } else { throw new org.xml.sax.SAXException(e); } } handler.pushElemTemplateElement(stylesheet); ElemTemplate template = new ElemTemplate(); if (slocator != null) template.setLocaterInfo(slocator); appendAndPush(handler, template); XPath rootMatch = new XPath("/", stylesheet, stylesheet, XPath.MATCH, handler.getStylesheetProcessor().getErrorListener()); template.setMatch(rootMatch); // template.setDOMBackPointer(handler.getOriginatingNode()); stylesheet.setTemplate(template); p = handler.getElemTemplateElement(); excludeXSLDecl = true; } XSLTElementDef def = getElemDef(); Class classObject = def.getClassObject(); boolean isExtension = false; boolean isComponentDecl = false; boolean isUnknownTopLevel = false; while (null != p) { // System.out.println("Checking: "+p); if (p instanceof ElemLiteralResult) { ElemLiteralResult parentElem = (ElemLiteralResult) p; isExtension = parentElem.containsExtensionElementURI(uri); } else if (p instanceof Stylesheet) { Stylesheet parentElem = (Stylesheet) p; isExtension = parentElem.containsExtensionElementURI(uri); if ((false == isExtension) && (null != uri) && (uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL) || uri.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL))) { isComponentDecl = true; } else { isUnknownTopLevel = true; } } if (isExtension) break; p = p.getParentElem(); } ElemTemplateElement elem = null; try { if (isExtension) { // System.out.println("Creating extension(1): "+uri); elem = new ElemExtensionCall(); } else if (isComponentDecl) { elem = (ElemTemplateElement) classObject.newInstance(); } else if (isUnknownTopLevel) { // TBD: Investigate, not sure about this. -sb elem = (ElemTemplateElement) classObject.newInstance(); } else { elem = (ElemTemplateElement) classObject.newInstance(); } elem.setDOMBackPointer(handler.getOriginatingNode()); elem.setLocaterInfo(handler.getLocator()); elem.setPrefixes(handler.getNamespaceSupport(), excludeXSLDecl); if (elem instanceof ElemLiteralResult) { ((ElemLiteralResult) elem).setNamespace(uri); ((ElemLiteralResult) elem).setLocalName(localName); ((ElemLiteralResult) elem).setRawName(rawName); ((ElemLiteralResult) elem).setIsLiteralResultAsStylesheet( isLREAsStyleSheet); } } catch (InstantiationException ie) { handler.error(XSLTErrorResources.ER_FAILED_CREATING_ELEMLITRSLT, null, ie);//"Failed creating ElemLiteralResult instance!", ie); } catch (IllegalAccessException iae) { handler.error(XSLTErrorResources.ER_FAILED_CREATING_ELEMLITRSLT, null, iae);//"Failed creating ElemLiteralResult instance!", iae); } setPropertiesFromAttributes(handler, rawName, attributes, elem); // bit of a hack here... if (!isExtension && (elem instanceof ElemLiteralResult)) { isExtension = ((ElemLiteralResult) elem).containsExtensionElementURI(uri); if (isExtension) { // System.out.println("Creating extension(2): "+uri); elem = new ElemExtensionCall(); elem.setLocaterInfo(handler.getLocator()); elem.setPrefixes(handler.getNamespaceSupport()); ((ElemLiteralResult) elem).setNamespace(uri); ((ElemLiteralResult) elem).setLocalName(localName); ((ElemLiteralResult) elem).setRawName(rawName); setPropertiesFromAttributes(handler, rawName, attributes, elem); } } appendAndPush(handler, elem); } catch(TransformerException te) { throw new org.xml.sax.SAXException(te); } } /** * This method could be over-ridden by a class that extends this class. * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @return an object that represents the stylesheet element. */ protected Stylesheet getStylesheetRoot(StylesheetHandler handler) throws TransformerConfigurationException { StylesheetRoot stylesheet; stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener()); if (handler.getStylesheetProcessor().isSecureProcessing()) stylesheet.setSecureProcessing(true); return stylesheet; } /** * Receive notification of the end of an element. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { ElemTemplateElement elem = handler.getElemTemplateElement(); if (elem instanceof ElemLiteralResult) { if (((ElemLiteralResult) elem).getIsLiteralResultAsStylesheet()) { handler.popStylesheet(); } } super.endElement(handler, uri, localName, rawName); } private boolean declaredXSLNS(Stylesheet stylesheet) { List declaredPrefixes = stylesheet.getDeclaredPrefixes(); int n = declaredPrefixes.size(); for (int i = 0; i < n; i++) { XMLNSDecl decl = (XMLNSDecl) declaredPrefixes.get(i); if(decl.getURI().equals(Constants.S_XSLNAMESPACEURL)) return true; } return false; } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorAttributeSet.java0000644000175000017500000000767310721374031026416 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorAttributeSet.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import javax.xml.transform.TransformerException; import org.apache.xalan.templates.ElemAttributeSet; import org.apache.xalan.templates.ElemTemplateElement; import org.xml.sax.Attributes; /** * This class processes parse events for an xsl:attribute-set. * @see XSLT DTD * @see attribute-sets in XSLT Specification */ class ProcessorAttributeSet extends XSLTElementProcessor { static final long serialVersionUID = -6473739251316787552L; /** * Receive notification of the start of an xsl:attribute-set element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * * @see org.apache.xalan.processor.StylesheetHandler#startElement * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.Attributes */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { ElemAttributeSet eat = new ElemAttributeSet(); eat.setLocaterInfo(handler.getLocator()); try { eat.setPrefixes(handler.getNamespaceSupport()); } catch(TransformerException te) { throw new org.xml.sax.SAXException(te); } eat.setDOMBackPointer(handler.getOriginatingNode()); setPropertiesFromAttributes(handler, rawName, attributes, eat); handler.getStylesheet().setAttributeSet(eat); // handler.pushElemTemplateElement(eat); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(eat); handler.pushElemTemplateElement(eat); } /** * Receive notification of the end of an element. * * @param name The element type name. * @param attributes The specified or defaulted attributes. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param uri The Namespace URI, or an empty string. * @param localName The local name (without prefix), or empty string if not namespace processing. * @param rawName The qualified name (with prefix). */ public void endElement( StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException { handler.popElemTemplateElement(); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorNamespaceAlias.java0000644000175000017500000000743710721374031026643 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorNamespaceAlias.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.res.XSLTErrorResources; import org.apache.xalan.templates.NamespaceAlias; import org.xml.sax.Attributes; /** * TransformerFactory for xsl:namespace-alias markup. * A stylesheet can use the xsl:namespace-alias element to * declare that one namespace URI is an alias for another namespace URI. *
         * 
         * 
         * 
        * @see XSLT DTD * @see literal-result-element in XSLT Specification */ class ProcessorNamespaceAlias extends XSLTElementProcessor { static final long serialVersionUID = -6309867839007018964L; /** * Receive notification of the start of an xsl:namespace-alias element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { final String resultNS; NamespaceAlias na = new NamespaceAlias(handler.nextUid()); setPropertiesFromAttributes(handler, rawName, attributes, na); String prefix = na.getStylesheetPrefix(); if(prefix.equals("#default")) { prefix = ""; na.setStylesheetPrefix(prefix); } String stylesheetNS = handler.getNamespaceForPrefix(prefix); na.setStylesheetNamespace(stylesheetNS); prefix = na.getResultPrefix(); if(prefix.equals("#default")) { prefix = ""; na.setResultPrefix(prefix); resultNS = handler.getNamespaceForPrefix(prefix); if(null == resultNS) handler.error(XSLTErrorResources.ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT, null, null); } else { resultNS = handler.getNamespaceForPrefix(prefix); if(null == resultNS) handler.error(XSLTErrorResources.ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX, new Object[] {prefix}, null); } na.setResultNamespace(resultNS); handler.getStylesheet().setNamespaceAlias(na); handler.getStylesheet().appendChild(na); } } libxalan2-java-2.7.1/src/org/apache/xalan/processor/ProcessorDecimalFormat.java0000644000175000017500000000607010721374032026475 0ustar mkochmkoch/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: ProcessorDecimalFormat.java 468640 2006-10-28 06:53:53Z minchau $ */ package org.apache.xalan.processor; import org.apache.xalan.templates.DecimalFormatProperties; import org.xml.sax.Attributes; /** * Process xsl:decimal-format by creating a DecimalFormatProperties * object and passing it to the stylesheet. * * @see org.apache.xalan.templates.Stylesheet#setDecimalFormat * @see org.apache.xalan.templates.DecimalFormatProperties * @see format-number in XSLT Specification * @xsl.usage internal */ class ProcessorDecimalFormat extends XSLTElementProcessor { static final long serialVersionUID = -5052904382662921627L; /** * Receive notification of the start of an element. * * @param handler The calling StylesheetHandler/TemplatesBuilder. * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param rawName The raw XML 1.0 name (with prefix), or the * empty string if raw names are not available. * @param attributes The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * @see org.apache.xalan.processor.StylesheetHandler#startElement * @see org.apache.xalan.processor.StylesheetHandler#endElement * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.Attributes */ public void startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException { DecimalFormatProperties dfp = new DecimalFormatProperties(handler.nextUid()); dfp.setDOMBackPointer(handler.getOriginatingNode()); dfp.setLocaterInfo(handler.getLocator()); setPropertiesFromAttributes(handler, rawName, attributes, dfp); handler.getStylesheet().setDecimalFormat(dfp); handler.getStylesheet().appendChild(dfp); } } libxalan2-java-2.7.1/src/javadocOverview.html0000644000175000017500000000263510721374030020116 0ustar mkochmkoch Xalan-Java 2

        Xalan-Java implements the W3C Recommendation 16 November 1999 XSL Transformations (XSLT) Version 1.0.

        XLST is a stylesheet language for transforming XML documents into other XML documents, HTML documents, other document types, or text. The language includes the XSL Transformation vocabulary and XPath, a language for addressing parts of an XML document. An XSL stylesheet describes how to transform the tree of nodes in the XML input into another tree of nodes.

        libxalan2-java-2.7.1/LICENSE.txt0000644000175000017500000010136010721374041015123 0ustar mkochmkoch<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The license above applies to this Apache Xalan release of: Xalan-Java 2 - XSLT Processor Xalan-Java 2 - Serializer The license above also applies to the jar files xalan.jar and xsltc.jar - Xalan-Java 2 - XSLT Processor from Source: http://xalan.apache.org/ The license above also applies to the jar file serializer.jar - Xalan-Java 2 - Serializer Source: http://xalan.apache.org/ Used by: Xalan-Java 2 and Xerces-Java 2 The license above also applies to the jar file xercesImpl.jar - Xerces-Java 2 XML Parser. Source: http://xerces.apache.org/ Used by: Xalan-Java 2 The license above also applies to the jar file xml-apis.jar - Xerces-Java 2 XML Parser. Source: http://xerces.apache.org/ Used by: Xalan-Java 2 and release copy of Xerces-Java 2 The following license applies to the included files: tools/ant.jar tools/antRun tools/antRun.bat Source: http://ant.apache.org/ Used By: Xalan's build process: java/build.xml and test/build.xml <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ * * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "Ant" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * apache@apache.org. * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation. For more information on the * Apache Software Foundation, please see . * */ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license, Apache Software License, Version 1.1, applies to the included BCEL.jar from Apache Jakarta (Byte Code Engineering Library). Source: http://jakarta.apache.org/bcel Used By: XSLTC component of xml-xalan/java The following license, Apache Software License, Version 1.1, also applies to the included regexp.jar, jakarta-regexp-1.2.jar from Apache Jakarta. Source: http://jakarta.apache.org/regexp Used By: BCEL.jar which is used by XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache BCEL" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * "Apache BCEL", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the DOM documentation for the org.w3c.dom.* packages: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< W3C® DOCUMENT LICENSE http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231 Public documents on the W3C site are provided by the copyright holders under the following license. By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: Permission to copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: 1. A link or URL to the original W3C document. 2. The pre-existing copyright notice of the original author, or if it doesn't exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright © [$date-of-document] World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231" 3. If it exists, the STATUS of the W3C document. When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements. THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. ---------------------------------------------------------------------------- This formulation of W3C's notice and license became active on December 31 2002. This version removes the copyright ownership notice such that this license can be used with materials other than those owned by the W3C, moves information on style sheets, DTDs, and schemas to the Copyright FAQ, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the license, and removes the ambiguous grant of "use". See the older formulation for the policy prior to this date. Please see our Copyright FAQ for common questions about using materials from our site, such as the translating or annotating specifications. Other questions about this notice can be directed to site-policy@w3.org. Joseph Reagle >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the DOM software, for the org.w3c.dom.* packages in jar file xml-apis.jar: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< W3C® SOFTWARE NOTICE AND LICENSE http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code. 3. Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. ____________________________________ This formulation of W3C's notice and license became active on December 31 2002. This version removes the copyright ownership notice such that this license can be used with materials other than those owned by the W3C, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the license, and removes the ambiguous grant of "use". Otherwise, this version is the same as the previous version and is written so as to preserve the Free Software Foundation's assessment of GPL compatibility and OSI's certification under the Open Source Definition. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to site-policy@w3.org. Joseph Reagle >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the SAX software, for the org.xml.sax.* packages in jar file xml-apis.jar: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the jar file java_cup.jar - LALR Parser Generator for Java(TM). Source: http://www.cs.princeton.edu/~appel/modern/java/CUP Used By: XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CUP Parser Generator Copyright Notice, License, and Disclaimer Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the names of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the jar file runtime.jar - Component of JavaCup: LALR Parser Generator for Java(TM). Source: http://www.cs.princeton.edu/~appel/modern/java/CUP Used By: XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CUP Parser Generator Copyright Notice, License, and Disclaimer (runtime.jar component) Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the names of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the JLEX jar file JLex.jar - A Lexical Analyzer Generator for Java(TM). Source: http://www.cs.princeton.edu/~appel/modern/java/JLex Used By: XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JLEX COPYRIGHT NOTICE, LICENSE AND DISCLAIMER. Copyright 1996-2000 by Elliot Joel Berk and C. Scott Ananian Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. Java is a trademark of Sun Microsystems, Inc. References to the Java programming language in relation to JLex are not meant to imply that Sun endorses this product. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the jar file stylebook-1.0-b3_xalan-2.jar - Tool for generating Xalan documentation. Integrated with Xalan-Java 2 and Xerces 2. Source: http://svn.apache.org/viewvc/xml/stylebook/ Used by: Xalan-Java 2, Xalan-C++ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* * The Apache Software License, Version 1.1 * * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xalan", "Xerces", and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 1999, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * . */ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> libxalan2-java-2.7.1/readme.html0000644000175000017500000000162210721374041015423 0ustar mkochmkoch Redirecting to What's New in Xalan_Java 2 libxalan2-java-2.7.1/build.bat0000644000175000017500000000576310721374041015101 0ustar mkochmkoch@echo off rem rem ========================================================================== rem = Copyright 2004 The Apache Software Foundation. rem = rem = Licensed under the Apache License, Version 2.0 (the "License"); rem = you may not use this file except in compliance with the License. rem = You may obtain a copy of the License at rem = rem = http://www.apache.org/licenses/LICENSE-2.0 rem = rem = Unless required by applicable law or agreed to in writing, software rem = distributed under the License is distributed on an "AS IS" BASIS, rem = WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem = See the License for the specific language governing permissions and rem = limitations under the License. rem ========================================================================== rem rem build.bat: Build Xalan-J 2.x using Ant rem Usage: build [ant-options] [targets] rem Setup: rem - you should set JAVA_HOME rem - you can set ANT_HOME if you use your own Ant install rem - JAVA_OPTS is added to the java command line rem - PARSER_JAR may be set to use alternate parser (default:lib\xercesImpl.jar) echo. echo Xalan-J 2.x Build echo ------------- if not "%JAVA_HOME%" == "" goto setant :noJavaHome rem Default command used to call java.exe; hopefully it's on the path here if "%_JAVACMD%" == "" set _JAVACMD=java echo. echo Warning: JAVA_HOME environment variable is not set. echo If build fails because sun.* classes could not be found echo you will need to set the JAVA_HOME environment variable echo to the installation directory of java. echo. :setant rem Default command used to call java.exe or equivalent if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java rem Default _ANT_HOME to Xalan's checked-in copy if not set set _ANT_HOME=%ANT_HOME% if "%_ANT_HOME%" == "" set _ANT_HOME=. rem Default locations of jars we depend on to run Ant on our build.xml file rem Set our local vars to all start with _underscore set _ANT_JAR=%ANT_JAR% if "%_ANT_JAR%" == "" set _ANT_JAR=tools\ant.jar set _PARSER_JAR=%PARSER_JAR% if "%_PARSER_JAR%" == "" set _PARSER_JAR=lib\xercesImpl.jar set _XML-APIS_JAR=%XML-APIS_JAR% if "%_XML-APIS_JAR%" == "" set _XML-APIS_JAR=lib\xml-apis.jar rem Attempt to automatically add system classes to _CLASSPATH rem Use _underscore prefix to not conflict with user's settings set _CLASSPATH=%CLASSPATH% if exist "%JAVA_HOME%\lib\tools.jar" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar if exist "%JAVA_HOME%\lib\classes.zip" set _CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\classes.zip set _CLASSPATH=%_ANT_JAR%;%_XML-APIS_JAR%;%_PARSER_JAR%;%_CLASSPATH% @echo on "%_JAVACMD%" -mx64m %JAVA_OPTS% -Dant.home="%ANT_HOME%" -classpath "%_CLASSPATH%" org.apache.tools.ant.Main %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off goto end :end rem Cleanup environment variables set _JAVACMD= set _CLASSPATH= set _ANT_HOME= set _ANT_JAR= set _PARSER_JAR= set _XML-APIS_JAR=